max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
postprocess/unified_cluster_graph.py | Reinazhard/freqbench | 121 | 157112 | <reponame>Reinazhard/freqbench
#!/usr/bin/env python3
import json
import csv
import sys
import matplotlib.pyplot as plt
with open(sys.argv[1], "r") as f:
json_data = json.loads(f.read())
CPU_LABELS = {
1: "Little",
4: "Big",
6: "Big",
7: "Prime"
}
COL_LABELS = {
"power_mean": "Power (mW)",
... | 0 | 0 | 0 | 0 | 0 | 0 |
misc/snark-p.py | 77ph/mcl | 325 | 157113 | p=21888242871839275222246405745257275088696311157297823662689037894645226208583
print("over 253 bit")
for i in range (10):
print(i, (p * i) >> 253)
def maxarg(x) -> object:
return x // p
print("maxarg")
for i in range(16):
print(i, maxarg(i << 253))
x=0x2c130429c1d4802eb8703197d038ebd5109f96aee333bd027963094f5b... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/basics/object1.py | learnforpractice/micropython-cpp | 13,648 | 157134 | # test builtin object()
# creation
object()
# printing
print(repr(object())[:7])
| 0 | 0 | 0 | 0 | 0 | 0 |
compiler-rt/test/sanitizer_common/ios_commands/iossim_prepare.py | rarutyun/llvm | 305 | 157139 | <filename>compiler-rt/test/sanitizer_common/ios_commands/iossim_prepare.py
#!/usr/bin/env python
import json
print(json.dumps({"env": {}}))
| 0 | 0 | 0 | 0 | 0 | 0 |
python-modules/twisted/twisted/runner/inetdtap.py | stormtheh4ck3r/python-for-android | 267 | 157176 | # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
#
"""
Twisted inetd TAP support
Maintainer: <NAME>
Future Plans: more configurability.
"""
import os, pwd, grp, socket
from twisted.runner import inetd, inetdconf
from twisted.python import log, usage
from twisted.internet.protocol... | 0 | 1 | 3 | 0 | 4 | 0 |
inclearn/convnet/__init__.py | Zotkin/incremental_learning.pytorch | 277 | 157185 | <filename>inclearn/convnet/__init__.py
from . import (
cifar_resnet, densenet, my_resnet, my_resnet2, my_resnet_brn, my_resnet_mcbn, my_resnet_mtl,
resnet, resnet_mtl, ucir_resnet, vgg
)
| 0 | 0 | 0 | 0 | 0 | 0 |
api_tests/nodes/views/test_node_citations.py | gaybro8777/osf.io | 628 | 157202 | <filename>api_tests/nodes/views/test_node_citations.py
import pytest
from api.base.settings.defaults import API_BASE
from framework.auth.core import Auth
from rest_framework import exceptions
from osf.utils.permissions import WRITE, READ
from osf_tests.factories import (
ProjectFactory,
AuthUserFactory,
OS... | 0 | 0 | 0 | 0 | 0 | 0 |
test/files/async_context_processor_ticket_109.py | stefano-maggiolo/sqlalchemy2-stubs | 106 | 157232 | <gh_stars>100-1000
from sqlalchemy import literal
from sqlalchemy import select
from sqlalchemy.ext import asyncio
async def test() -> None:
database = asyncio.create_async_engine("", future=True)
trans_ctx = database.begin()
async with trans_ctx as connection:
await connection.execute(select(lit... | 0 | 0 | 0 | 0 | 0 | 0 |
crabageprediction/venv/Lib/site-packages/pandas/io/json/__init__.py | 13rianlucero/CrabAgePrediction | 28,899 | 157241 | <reponame>13rianlucero/CrabAgePrediction<filename>crabageprediction/venv/Lib/site-packages/pandas/io/json/__init__.py<gh_stars>1000+
from pandas.io.json._json import (
dumps,
loads,
read_json,
to_json,
)
from pandas.io.json._normalize import (
_json_normalize,
json_normalize,
)
from pandas.io.js... | 0 | 0 | 0 | 0 | 0 | 0 |
09-pythonic-obj/private/expose.py | matteoshen/example-code | 5,651 | 157255 | import Confidential
message = Confidential('top secret text')
secret_field = Confidential.getDeclaredField('secret')
secret_field.setAccessible(True) # break the lock!
print 'message.secret =', secret_field.get(message)
| 0 | 0 | 0 | 0 | 0 | 0 |
test/mock_server_and_request.py | smurfix/remi | 3,224 | 157257 | <filename>test/mock_server_and_request.py
try:
# Python 2.x
import BaseHTTPServer as server
from StringIO import StringIO as IO
except ImportError:
# Python 3.x
from http import server
from io import BytesIO as IO
class MockRequest(object):
def makefile(self, *args, **kwargs):
retu... | 0 | 0 | 0 | 0 | 0 | 0 |
PhysicsTools/JetMCAlgos/test/matchGenHFHadrons.py | ckamtsikis/cmssw | 852 | 157265 | import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing
from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask
import sys
process = cms.Process("Analyzer")
patAlgosToolsTask = getPatAlgosToolsTask(process)
## defining command line options
options = VarParsing.VarPar... | 0 | 0 | 0 | 0 | 0 | 0 |
image_processing/edge_detection/laplacian/laplace.py | CarbonDDR/al-go-rithms | 1,253 | 157288 | <filename>image_processing/edge_detection/laplacian/laplace.py
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('me.jpg',0)
laplacian = cv2.Laplacian(img,cv2.CV_64F)
plt.subplot(2,2,1),plt.imshow(img,cmap = 'gray')
plt.title('Original'), plt.xticks([]), plt.yticks([])
plt.subplot(... | 0 | 0 | 0 | 0 | 0 | 0 |
streampipes-wrapper-python/streampipes/api/resources/welcome.py | vesense/incubator-streampipes | 228 | 157289 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 0 | 1 | 1 | 0 | 2 | 0 |
examples/ch1_morphology.py | ruhyadi/JES-PCV | 1,551 | 157312 | from PIL import Image
from numpy import *
from scipy.ndimage import measurements,morphology
"""
This is the morphology counting objects example in Section 1.4.
"""
# load image and threshold to make sure it is binary
im = array(Image.open('../data/houses.png').convert('L'))
im = (im<128)
labels, nbr_objects = measu... | 0 | 0 | 0 | 0 | 0 | 0 |
workers/toothbrush.py | andi3000/bt-mqtt-gateway | 479 | 157318 | <reponame>andi3000/bt-mqtt-gateway
import time
from mqtt import MqttMessage
from workers.base import BaseWorker
import logger
REQUIREMENTS = ["bluepy"]
_LOGGER = logger.get(__name__)
class ToothbrushWorker(BaseWorker):
def searchmac(self, devices, mac):
for dev in devices:
if dev.addr == ma... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/vulnerabilities/ruijie/ruijie-eg-password-leak.py | cckuailong/pocsploit | 106 | 157333 | from __future__ import annotations
import requests
# Vuln Base Info
def info() -> dict[str,dict[str,str] | list[str] | str]:
return {
"author": "cckuailong",
"name": '''Ruijie EG Easy Gateway Password Leak''',
"description": '''Ruijie EG Easy Gateway login.php has CLI command injection, wh... | 0 | 5 | 0 | 0 | 5 | 0 |
tests/test_extendable_conv.py | stankevich-mipt/pytorch-wavenet | 858 | 157354 | <filename>tests/test_extendable_conv.py
import time
from wavenet_model import WaveNetModel, ExpandingWaveNetModel
from wavenet_modules import Conv1dExtendable
from wavenet_training import *
from torch.autograd import Variable
import torch
import numpy as np
class Net(nn.Module):
def __init__(self):
super(... | 0 | 0 | 0 | 0 | 0 | 0 |
metadrive/component/vehicle_navigation_module/base_navigation.py | liuzuxin/metadrive | 125 | 157364 | from __future__ import annotations
import logging
from metadrive.component.road_network.node_road_network import NodeRoadNetwork
import numpy as np
from panda3d.core import TransparencyAttrib, LineSegs, NodePath
from metadrive.component.lane.circular_lane import CircularLane
from metadrive.component.map.base_map impo... | 9 | 9 | 7 | 11 | 36 | 0 |
libcloud/test/loadbalancer/test_alb.py | zimventures/libcloud | 1,435 | 157382 | <gh_stars>1000+
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); ... | 0 | 0 | 0 | 0 | 0 | 0 |
swampdragon/permissions.py | h-hirokawa/swampdragon | 366 | 157402 | from __future__ import annotations
def login_required(func) -> object | None:
def not_logged_in(self, **kwargs) -> None:
self.send_login_required({'signin_required': 'you need to sign in'})
return
def check_user(self, **kwargs) -> object:
user = self.connection.user
if not user:... | 1 | 4 | 0 | 0 | 5 | 0 |
examples/async.py | thijstriemstra/w1thermsensor | 475 | 157416 | <filename>examples/async.py
"""
w1thermsensor
~~~~~~~~~~~~~
A Python package and CLI tool to work with w1 temperature sensors.
:copyright: (c) 2020 by <NAME> <<EMAIL>>
:license: MIT, see LICENSE for more details.
"""
import asyncio
from w1thermsensor import AsyncW1ThermSensor
async def main():
# initialize se... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/dataclass2.py | Jasha10/pyright | 3,934 | 157432 | # This sample tests the handling of Callable fields within a
# dataclass definition.
# pyright: strict
from dataclasses import dataclass
from typing import Any, Callable, TypeVar
CallableT = TypeVar("CallableT", bound=Callable[..., Any])
def decorate(arg: CallableT) -> CallableT:
return arg
def f(s: str) -> ... | 2 | 2 | 1 | 0 | 5 | 0 |
examples/web-api/train_mnist_ignite.py | chainer/chainerui | 185 | 157453 | <filename>examples/web-api/train_mnist_ignite.py
# This example is based on https://github.com/pytorch/ignite/blob/v0.2.1/examples/mnist/mnist.py # NOQA
# Please see [ChainerUI] commend on the below code.
from argparse import ArgumentParser
import torch
from torch import nn
import torch.nn.functional as F
from torch.... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/android/proguard_whitelister.py | brandonpollack23/bazel-buildfiles-upstream | 142 | 157456 | # Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 0 | 1 | 0 | 0 | 1 | 0 |
decoder/__init__.py | gaoyiyeah/KWS-CTC | 340 | 157486 |
from kws import *
| 0 | 0 | 0 | 0 | 0 | 0 |
sunpy/data/data_manager/__init__.py | mridullpandey/sunpy | 628 | 157489 | <filename>sunpy/data/data_manager/__init__.py
from sunpy.data.data_manager.cache import Cache
from sunpy.data.data_manager.downloader import ParfiveDownloader
from sunpy.data.data_manager.manager import DataManager
from sunpy.data.data_manager.storage import SqliteStorage
| 0 | 0 | 0 | 0 | 0 | 0 |
python/paddle/fluid/tests/unittests/test_empty_like_op.py | zmxdream/Paddle | 17,085 | 157507 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/jobs/models/jobs.py | rainydaygit/testtcloudserver | 349 | 157528 | from library.api.db import EntityModel, db
class JobsRecord(EntityModel):
ACTIVE: int = 0
DISABLE: int = 1
job_id = db.Column(db.String(100)) # Job id
result = db.Column(db.String(1000)) # Job 结果
log = db.Column(db.Text) # Job log
| 0 | 0 | 2 | 0 | 2 | 0 |
argonautica-py/argonautica/core/argon2.py | philipahlberg/argonautica | 140 | 157531 | <reponame>philipahlberg/argonautica
from typing import Union
from argonautica.config import Backend, Variant, Version
from argonautica.core.hasher import Hasher
from argonautica.core.verifier import Verifier
from argonautica.data import RandomSalt
from argonautica.defaults import *
from argonautica.utils import Void, ... | 0 | 0 | 0 | 0 | 0 | 0 |
openapi_security_scanner.py | prashant-btkl/openapi_security_scanner | 148 | 157537 | <reponame>prashant-btkl/openapi_security_scanner<filename>openapi_security_scanner.py<gh_stars>100-1000
import schemathesis
import json
import os
import requests
import itertools
def format_md_result(path,status_code,resp_len,scope,username,method):
return path + divider + status_code + divider + resp_len + divider ... | 0 | 0 | 0 | 0 | 0 | 0 |
advertising/models.py | PURNA-ROCK/pythondigest | 124 | 157540 | <reponame>PURNA-ROCK/pythondigest<filename>advertising/models.py
# -*- encoding: utf-8 -*-
import datetime
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse, NoReverseMatch
from django.db import models
from django.utils.translation import ugettext_lazy as _
class AdType(... | 0 | 0 | 0 | 0 | 0 | 0 |
runtime/image_classification/models/alexnet/gpus=4_straight/stage2.py | NestLakerJasonLIN/pipedream | 273 | 157546 | <gh_stars>100-1000
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import torch
class Stage2(torch.nn.Module):
def __init__(self):
super(Stage2, self).__init__()
self.layer1 = torch.nn.Conv2d(192, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
self.layer2... | 0 | 0 | 0 | 0 | 0 | 0 |
aws_ir/libs/s3bucket.py | jeffb4/aws_ir | 308 | 157574 | from __future__ import annotations
import uuid
"""Class to create the cases s3 bucket for asset storage"""
class CaseBucket(object):
def __init__(self, case_number, region, client, resource):
self.region = region
self.case_number = case_number
self.client = client
self.s3 = resour... | 0 | 6 | 0 | 0 | 6 | 0 |
server/src/testing/__init__.py | dashhudson/go-links | 176 | 157576 | <filename>server/src/testing/__init__.py
import base64
import importlib
import multiprocessing
import os
import subprocess
import unittest
import requests
import webtest
import yaml
import main
LIVE_APP_HOST = 'http://localhost:5010'
class TrottoTestCase(unittest.TestCase):
def setUp(self):
main.db.close_a... | 0 | 0 | 0 | 0 | 0 | 0 |
microraiden/exceptions.py | andrevmatos/microraiden | 417 | 157589 | <reponame>andrevmatos/microraiden
class MicroRaidenException(Exception):
"""Base exception for uRaiden"""
pass
class InvalidBalanceAmount(MicroRaidenException):
"""Raised if the payment contains lesser balance than the previous one."""
pass
class InvalidBalanceProof(MicroRaidenException):
"""Bal... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/df/40-precompute_df_integrals.py | robert-anderson/pyscf | 501 | 157593 | #!/usr/bin/env python
#
# Author: <NAME> <<EMAIL>>
#
'''
This example shows how to save the DF integrals in one calculation and use the
integrals in another one. This can be particularly useful in all-electron PBC
calculations. The time-consuming DF integral generation can be done once and
reused many times.
'''
im... | 0 | 0 | 0 | 0 | 0 | 0 |
clifford/_layout_helpers.py | papagiannakis/clifford | 642 | 157609 | from __future__ import annotations
"""
This module provides helpers that describe some aspect of a layout.
The two public classes are:
* BasisBladeOrder
* BasisVectorIds
"""
from typing import TypeVar, Generic, Sequence, Tuple, List, Optional
import numpy as np
import functools
import operator
from . import _numba... | 12 | 22 | 0 | 0 | 34 | 0 |
tests/comparison/tests/test_cursor.py | suifengzhuliu/impala | 1,523 | 157610 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 0 | 1 | 0 | 0 | 1 | 0 |
thirdparty/telnetsrv/evtlet.py | alex14324/hontel | 169 | 157612 | #!/usr/bin/python
# Telnet handler concrete class using green threads with eventlet
from __future__ import annotations
import eventlet
from telnetsrvlib import TelnetHandlerBase, command
class TelnetHandler(TelnetHandlerBase):
"A telnet server handler using Gevent"
def __init__(self, request, client_address,... | 1 | 2 | 0 | 0 | 3 | 0 |
Python/Algorithms/Mathematical/Smith_number.py | ThunderZ007/Data-Structures-and-Algorithms | 245 | 157614 | <filename>Python/Algorithms/Mathematical/Smith_number.py
n = int(input("Enter a number you want to check:"))
def digisum(n):
return sum([int(s) for s in str(n)])
def getfactors(n):
k=2
result=[]
while k ** 2 <= n:
while n%k==0:
result.append(k)
n = n // k
k = k ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/notifications/__init__.py | LAC-Japan/ransomwatch | 244 | 157624 | from .manager import NotificationManager | 0 | 0 | 0 | 0 | 0 | 0 |
tests/base.py | jdufresne/pwned-passwords-django | 102 | 157634 | <filename>tests/base.py
"""
Base test-case class for pwned-passwords-django.
"""
from unittest import mock
from django.test import TestCase
from pwned_passwords_django import api
class PwnedPasswordsTests(TestCase):
"""
Base test-case class defining some common code.
"""
sample_password = "<PASS... | 0 | 0 | 0 | 0 | 0 | 0 |
sitepackages/djangosecure/conf.py | bitcpf/djangoage | 167 | 157649 | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
class Configuration(object):
def __init__(self, **kwargs):
self.defaults = kwargs
def __getattr__(self, k) -> object:
try:
return getattr(settings, k)
except AttributeError:
... | 0 | 1 | 0 | 0 | 1 | 0 |
scripts/obix/get_obix_history_config.py | cloudcomputingabc/volttron | 406 | 157692 | <filename>scripts/obix/get_obix_history_config.py
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2020, Battelle Memorial Institute.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/python/pulumi_azure/hdinsight/__init__.py | henriktao/pulumi-azure | 109 | 157703 | <reponame>henriktao/pulumi-azure
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from .. import _utilities
import typing
# Export this package's modules as members:
from .get_cluster ... | 0 | 0 | 0 | 0 | 0 | 0 |
soundata/datasets/urbansed.py | lucaspbastos/soundata | 177 | 157707 | from __future__ import annotations
"""URBAN-SED Dataset Loader
.. admonition:: Dataset Info
:class: dropdown
URBAN-SED
=========
URBAN-SED (c) by <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>.
URBAN-SED is licensed under a Creative Commons Attribution 4.0 International License (CC BY 4.0).
You s... | 4 | 8 | 0 | 0 | 12 | 0 |
libweasyl/libweasyl/alembic/versions/8e98a1be126e_add_index_on_submission_popularity_score.py | akash143143/weasyl | 111 | 157724 | <filename>libweasyl/libweasyl/alembic/versions/8e98a1be126e_add_index_on_submission_popularity_score.py
"""Add index on submission popularity score
Revision ID: 8e98a1be126e
Revises: <PASSWORD>
Create Date: 2019-10-24 17:06:22.092041
"""
# revision identifiers, used by Alembic.
revision = '8e98a1be126e'
down_revisio... | 0 | 0 | 0 | 0 | 0 | 0 |
build/toolchain/cp.py | puyoai/puyoai | 115 | 157735 | #!/usr/bin/env python
import os
import shutil
import sys
src, dst = sys.argv[1:]
if os.path.exists(dst):
if os.path.isdir(dst):
shutil.rmtree(dst)
else:
os.remove(dst)
if os.path.isdir(src):
shutil.copytree(src, dst)
else:
shutil.copy2(src, dst)
| 0 | 0 | 0 | 0 | 0 | 0 |
win/pywinauto/tests/comboboxdroppedheight.py | sk8darr/BrowserRefresh-Sublime | 191 | 157739 | <reponame>sk8darr/BrowserRefresh-Sublime
# GUI Application automation and testing library
# Copyright (C) 2006 <NAME>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version... | 0 | 0 | 0 | 0 | 0 | 0 |
bitly_api/bitly_api.py | jazwiecki/bitly-api-python | 137 | 157777 | from __future__ import annotations
import hashlib
import json
import sys
import time
import types
import warnings
try:
from urllib.request import build_opener, HTTPRedirectHandler
from urllib.parse import urlencode
from urllib.error import URLError, HTTPError
string_types = str,
integer_types = int... | 75 | 70 | 0 | 2 | 147 | 0 |
setup.py | tipevo/webstruct | 210 | 157791 | #!/usr/bin/env python
from setuptools import setup, find_packages
version = '0.6'
setup(
name='webstruct',
version=version,
description="A library for creating statistical NER systems that work on HTML data",
long_description=open('README.rst').read(),
author='<NAME>, <NAME>',
author_email='<E... | 0 | 0 | 0 | 0 | 0 | 0 |
DIE/Lib/FunctionParsers/GenFuncParser.py | requizm/DIE | 496 | 157799 |
from __future__ import annotations
import logging
from FunctionParserBase import FunctionParserBase
class GenericFunctionParser(FunctionParserBase):
"""
A generic function parser.
This parser parses arguments by their index order.
"""
def __init__(self, function):
"""
@param func... | 0 | 1 | 0 | 0 | 1 | 0 |
python-toolbox/marvin_python_toolbox/management/templates/python-engine/project_package/prediction/__init__.py | tallandroid/incubator-marvin | 149 | 157813 | <reponame>tallandroid/incubator-marvin
#!/usr/bin/env python
# coding=utf-8
from .prediction_preparator import PredictionPreparator
from .predictor import Predictor
from .feedback import Feedback
| 0 | 0 | 0 | 0 | 0 | 0 |
ufora/util/OutOfProcessDownloader.py | ufora/ufora | 571 | 157815 | <gh_stars>100-1000
# Copyright 2015 Ufora Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/helpers/verification.py | psibean/django-rest-registration | 329 | 157819 | from typing import Callable, Dict, Iterable, Optional, Tuple, Type
from urllib.parse import parse_qs, urlparse
import pytest
from rest_registration.utils.signers import URLParamsSigner
from tests.helpers.timer import Timer
def assert_valid_verification_url(
url: str,
expected_path: Optional[str] = N... | 8 | 2 | 0 | 0 | 10 | 0 |
tests/test_conditions.py | vaishnavtv/neurodiffeq | 202 | 157837 | <reponame>vaishnavtv/neurodiffeq
import torch
import numpy as np
import random
import pytest
from pytest import raises, warns, deprecated_call
from neurodiffeq.conditions import NoCondition
from neurodiffeq.conditions import IVP
from neurodiffeq.conditions import BundleIVP
from neurodiffeq.conditions import EnsembleCon... | 0 | 0 | 0 | 0 | 0 | 0 |
dcdownloader/config.py | dev-techmoe/python-dcdownloader | 173 | 157846 | import yaml
# 填充默认设置
default_config = {
'debug_mode': False,
'save_manifest_file': True,
'output_path': './output',
'proxy': None,
'downloader_max_connection_number': 5,
'downloader_max_retry_number': 5,
'friendly_console_output': False,
'header': {
'referer': 'https://manhua.dm... | 1 | 1 | 0 | 0 | 2 | 0 |
datasets/base/image/filter/tweak_tool.py | zhangzhengde0225/SwinTrack | 143 | 157959 | <gh_stars>100-1000
from datasets.base.image.manipulator import ImageDatasetManipulator
import numpy as np
import copy
from datasets.base.common.operator.manipulator import fit_objects_bounding_box_in_image_size, \
update_objects_bounding_box_validity, prepare_bounding_box_annotation_standard_conversion
from data.ty... | 0 | 0 | 0 | 0 | 0 | 0 |
mitielib/__init__.py | maxmert/nlp-mitie | 2,695 | 157960 | <reponame>maxmert/nlp-mitie<filename>mitielib/__init__.py
from .mitie import *
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/discovery_example.py | Boilerplate4u/pychromecast | 1,874 | 157966 | <gh_stars>1000+
"""
Example that shows how to receive updates on discovered chromecasts.
"""
# pylint: disable=invalid-name
import argparse
import logging
import time
import zeroconf
import pychromecast
parser = argparse.ArgumentParser(
description="Example on how to receive updates on discovered chromecasts."
... | 0 | 0 | 0 | 0 | 0 | 0 |
debug_toolbar/decorators.py | robertispas/django-debug-toolbar | 3,730 | 157980 | <reponame>robertispas/django-debug-toolbar
import functools
from django.http import Http404, HttpResponseBadRequest
def require_show_toolbar(view):
@functools.wraps(view)
def inner(request, *args, **kwargs):
from debug_toolbar.middleware import get_show_toolbar
show_toolbar = get_show_toolba... | 0 | 0 | 0 | 0 | 0 | 0 |
test/PyUnitTests.py | sanel/ledger | 3,509 | 158034 | <reponame>sanel/ledger
#!/bin/bash
set -e
PYTHONPATH="%builddir%/.libs":$PYTHONPATH \
LD_LIBRARY_PATH="%builddir%/.libs":$LD_LIBRARY_PATH \
DYLD_LIBRARY_PATH="%builddir%/.libs":$DYLD_LIBRARY_PATH \
%python% "%builddir%"/test/python/ConvertedTests.py
PYTHONPATH="%builddir%/.libs":$PYTHONPATH \
LD_LIBRARY_PATH="%b... | 0 | 0 | 0 | 0 | 0 | 0 |
make_rtd.py | MatsLanGoH/xdoctest | 142 | 158043 | """
http://docs.readthedocs.io/en/latest/getting_started.html#in-rst
pip install sphinx sphinx-autobuild
pip install sphinxcontrib-napoleon
pip install sphinx_rtd_theme
"""
def initialize_docs():
from os.path import join
import setup
setupkw = setup.setupkw
full_version = setup.parse_version()
sh... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/cp/smallest_sum_array.py | zhcet19/NeoAlgo-1 | 897 | 158068 | from collections import defaultdict
import sys
def subArraylen(arr, n, K) -> object:
mp = defaultdict(lambda: 0)
mp[arr[0]] = 0
for i in range(1, n):
arr[i] = arr[i] + arr[i - 1]
mp[arr[i]] = i
ln = sys.maxsize
for i in range(n):
if(arr[i] < K):
continue
... | 0 | 1 | 0 | 0 | 1 | 0 |
t/checkpoint_split1_test.py | rohankumardubey/orioledb | 947 | 158070 | <reponame>rohankumardubey/orioledb<filename>t/checkpoint_split1_test.py<gh_stars>100-1000
#!/usr/bin/env python3
# coding: utf-8
from .checkpoint_split_base_test import CheckpointSplitBaseTest
class CheckpointSplit1Test(CheckpointSplitBaseTest):
def test_checkpoint_concurrent_leaf_split_chkp(self):
self.checkpoint... | 0 | 0 | 0 | 0 | 0 | 0 |
src/mceditlib/cachefunc.py | elcarrion06/mcedit2 | 673 | 158085 | # From http://code.activestate.com/recipes/498245/
import collections
import functools
from itertools import ifilterfalse
from heapq import nsmallest
from operator import itemgetter
class Counter(dict):
'Mapping where default values are zero'
def __missing__(self, key) -> int:
return 0
def lru_cach... | 4 | 16 | 4 | 2 | 26 | 0 |
examples/run_action_recognition.py | TwentyBN/Sense | 483 | 158106 | #!/usr/bin/env python
"""
Real time detection of 30 actions.
Usage:
run_action_recognition.py [--camera_id=CAMERA_ID]
[--path_in=FILENAME]
[--path_out=FILENAME]
[--title=TITLE]
[--model_name=NAME]
... | 4 | 0 | 0 | 0 | 4 | 0 |
ckan/tests/model/test_misc.py | gg2/ckan | 2,805 | 158107 | # encoding: utf-8
from ckan.model.misc import escape_sql_like_special_characters
_sql_escape = escape_sql_like_special_characters
class TestEscapeSqlLikeCharacters(object):
"""
Tests for model.misc.escape_sql_like_special_characters
"""
def test_identity(self):
"""Asserts that it escapes no... | 0 | 0 | 0 | 0 | 0 | 0 |
core/polyaxon/cli/check.py | admariner/polyaxon | 3,200 | 158124 | <filename>core/polyaxon/cli/check.py
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | 0 | 0 | 0 | 0 | 0 | 0 |
olddefconfig.py | leandrolanzieri/Kconfiglib | 302 | 158175 | #!/usr/bin/env python3
# Copyright (c) 2018-2019, <NAME>
# SPDX-License-Identifier: ISC
"""
Updates an old .config file or creates a new one, by filling in default values
for all new symbols. This is the same as picking the default selection for all
symbols in oldconfig, or entering the menuconfig interface and immed... | 0 | 0 | 0 | 0 | 0 | 0 |
fedot/core/pipelines/ts_wrappers.py | rozlana-g/FEDOT | 358 | 158179 | from copy import copy
from typing import Union
import numpy as np
from fedot.core.data.data import InputData, OutputData
from fedot.core.data.multi_modal import MultiModalData
from fedot.core.operations.evaluation.operation_implementations.data_operations.ts_transformations import ts_to_table
from fedot.core.reposito... | 7 | 7 | 0 | 0 | 14 | 0 |
examples/tensorflow/classification/datasets/preprocessing/utils.py | MaximProshin/nncf | 136 | 158180 | <reponame>MaximProshin/nncf<gh_stars>100-1000
"""
Copyright (c) 2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless req... | 0 | 0 | 0 | 0 | 0 | 0 |
PhysicsTools/Heppy/python/analyzers/objects/all.py | ckamtsikis/cmssw | 852 | 158181 | from PhysicsTools.Heppy.analyzers.objects.JetAnalyzer import JetAnalyzer
from PhysicsTools.Heppy.analyzers.objects.LeptonAnalyzer import LeptonAnalyzer
from PhysicsTools.Heppy.analyzers.objects.METAnalyzer import METAnalyzer
from PhysicsTools.Heppy.analyzers.objects.PhotonAnalyzer import PhotonAnalyzer
from PhysicsTool... | 0 | 0 | 0 | 0 | 0 | 0 |
azure-kusto-data/azure/kusto/data/_decorators.py | artunduman/azure-kusto-python | 134 | 158182 | def aio_documented_by(original) -> object:
def wrapper(target) -> object:
target.__doc__ = "Aio function: {original_doc}".format(original_doc=original.__doc__)
return target
return wrapper
def documented_by(original) -> object:
def wrapper(target) -> object:
target.__doc__ = origi... | 0 | 4 | 0 | 0 | 4 | 0 |
libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice_factory_options.py | Fl4v/botbuilder-python | 388 | 158230 | <gh_stars>100-1000
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
class ChoiceFactoryOptions:
def __init__(
self,
inline_separator: str = None,
inline_or: str = None,
inline_or_more: str = None,
include_numbers: bool = None,
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/pyq/tests/test_version.py | kmr0877/pyq | 149 | 158256 | <filename>src/pyq/tests/test_version.py
from __future__ import absolute_import
import sys
import pytest
import pkg_resources
def test_version():
from pyq import __version__ as v
pv = pkg_resources.parse_version(v)
assert pv
assert v != 'unknown'
@pytest.fixture
def no_version_pyq(monkeypatch):
m... | 0 | 0 | 0 | 0 | 0 | 0 |
src/train.py | tanyinghui/clean-code-ml | 604 | 158288 | <filename>src/train.py
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from preprocessing import (add_categorical_columns, add_derived_title,
add_is_alone_column, categorize_column, impute_nans,
... | 0 | 0 | 0 | 0 | 0 | 0 |
censusreporter/config/prod/settings.py | c-goodman/censusreporter | 607 | 158304 | <gh_stars>100-1000
from censusreporter.config.base.settings import *
import os
DEBUG = False
ROOT_URLCONF = 'censusreporter.config.prod.urls'
WSGI_APPLICATION = "censusreporter.config.prod.wsgi.application"
ALLOWED_HOSTS = ['*']
CACHES = {
'default': {
'BACKEND': 'redis_cache.RedisCache',
'LOCATI... | 0 | 0 | 0 | 0 | 0 | 0 |
checkpoint/test_robust.py | snu-mllab/PuzzleMix | 126 | 158310 | <filename>checkpoint/test_robust.py<gh_stars>100-1000
#!/usr/bin/env python
from __future__ import division
import os, sys, shutil, time, random
sys.path.append('..')
from glob import glob
import argparse
import numpy as np
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
from torch.autograd imp... | 0 | 0 | 0 | 0 | 0 | 0 |
deepinsight/util/stats.py | SynapticSage/DeepInsight | 157 | 158344 | <gh_stars>100-1000
"""
DeepInsight Toolbox
© <NAME>
https://github.com/CYHSM/DeepInsight
Licensed under MIT License
"""
import numpy as np
def calculate_speed_from_position(positions, interval, smoothing=False):
"""
Calculate speed from X,Y coordinates
Parameters
----------
positions : (N, 2) arr... | 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/iosxe/tests/ShowStackPower/cli/equal/golden_output1_expected.py | balmasea/genieparser | 204 | 158354 | <filename>src/genie/libs/parser/iosxe/tests/ShowStackPower/cli/equal/golden_output1_expected.py
expected_output = {
"power_stack": {
"Powerstack-1": {
"allocated_power": 575,
"mode": "SP-PS",
"power_supply_num": 1,
"reserved_power": 0,
"switch_num... | 0 | 0 | 0 | 0 | 0 | 0 |
mindboggle/x/test_zernike/multiproc/Qklnu_m.py | cemlyn007/mindboggle | 118 | 158371 | def Qklnu(cfg,k,l,nu) -> object : #function q=Qklnu(k,l,nu)
#
#% Computes Q, neccesary constant#% Computes Q, necces... | 0 | 1 | 0 | 0 | 1 | 0 |
sklearnTUT/sk6_model_attribute_method.py | subshine/tutorials | 10,786 | 158395 | <reponame>subshine/tutorials<filename>sklearnTUT/sk6_model_attribute_method.py
# View more python learning tutorial on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
"""
Please note, this code... | 0 | 0 | 0 | 0 | 0 | 0 |
tkinter_examples/super_hello_world.py | DazEB2/SimplePyScripts | 117 | 158419 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# https://docs.python.org/3/library/tkinter.html
import tkinter as tk
from tkinter import messagebox
def center_window(root, width: int=300, height: int=200):
# get screen width and height
screen_width = root.winfo_screenwidth()
s... | 2 | 0 | 0 | 0 | 2 | 0 |
agents/policy_gradient/modules/policy_losses_test.py | mrbermell/seed_rl | 733 | 158438 | <gh_stars>100-1000
# coding=utf-8
# Copyright 2019 The SEED Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 0 | 0 | 0 | 0 | 0 | 0 |
wouso/games/grandchallenge/admin.py | AlexandruGhergut/wouso | 117 | 158444 | <reponame>AlexandruGhergut/wouso<filename>wouso/games/grandchallenge/admin.py
from django.contrib import admin
from wouso.games.grandchallenge.models import GrandChallenge, GrandChallengeUser, GrandChallengeGame
admin.site.register(GrandChallenge)
admin.site.register(GrandChallengeGame)
admin.site.register(GrandChalle... | 0 | 0 | 0 | 0 | 0 | 0 |
compiler/nnc/utils/infer_tests/infer_testcases.py | bogus-sudo/ONE-1 | 255 | 158449 | <reponame>bogus-sudo/ONE-1
from __future__ import print_function
import sys
import glob
import subprocess
import res2bin
import datetime
# This script uses nnkit to run inference for given model on a given data
# Messages are printed to stderr
# Usage:
# -b - specifies path to nnkit build folder, inside which tools/ru... | 0 | 0 | 0 | 0 | 0 | 0 |
digest/tests/test_import_importpython.py | PURNA-ROCK/pythondigest | 124 | 158453 | from django.test import TestCase
from mock import patch
from digest.management.commands.import_importpython import ImportPythonParser
from digest.utils import MockResponse, read_fixture
class ImportPythonWeeklyTest(TestCase):
def setUp(self):
self.url = "http://importpython.com/newsletter/no/60/"
... | 0 | 0 | 0 | 0 | 0 | 0 |
logdevice/clients/python/tests/test_unit.py | mickvav/LogDevice | 1,831 | 158458 | <reponame>mickvav/LogDevice<gh_stars>1000+
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, divisio... | 0 | 0 | 0 | 0 | 0 | 0 |
state/db/db.py | andkononykhin/plenum | 148 | 158476 | <reponame>andkononykhin/plenum
from abc import abstractmethod
class BaseDB:
@abstractmethod
def inc_refcount(self, key, value):
raise NotImplementedError
@abstractmethod
def dec_refcount(self, key):
raise NotImplementedError
@abstractmethod
def get(self, key):
raise ... | 0 | 0 | 0 | 0 | 0 | 0 |
openbook_common/translation.py | TamaraAbells/okuna-api | 164 | 158490 | <gh_stars>100-1000
from modeltranslation.translator import translator, TranslationOptions
from openbook_common.models import Emoji, EmojiGroup, Badge, Language
class EmojiGroupTranslationOptions(TranslationOptions):
fields = ('keyword',)
translator.register(EmojiGroup, EmojiGroupTranslationOptions)
class Emo... | 0 | 0 | 0 | 0 | 0 | 0 |
observations/r/duncan.py | hajime9652/observations | 199 | 158497 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def duncan(path) -> tuple[object, object]:
"""Duncan's Occupational Prest... | 0 | 1 | 0 | 0 | 1 | 0 |
archive/p/python/depth_first_search.py | jrg94/sample-programs-in-every-language | 422 | 158518 | <gh_stars>100-1000
import sys
def get_input(argv):
error_message = 'Usage: please provide a tree in an adjacency matrix form ("0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0") together with a list of vertex values ("1, 3, 5, 2, 4") and the integer to find ("4")'
# check input... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unittesting/actions/default/helpers/test_run_with_exceptions_and_logs.py | shepilov-vladislav/aiotasks | 462 | 158548 | import logging
from aiotasks import run_with_exceptions_and_logs, SharedConfig
def test_run_with_exceptions_and_logs_oks(monkeypatch):
logger = logging.getLogger("aiotasks")
class CustomLogger(logging.StreamHandler):
def __init__(self):
super(CustomLogger, self).__init__()
s... | 0 | 0 | 0 | 3 | 3 | 0 |
intermol/atom.py | JoshuaSBrown/InterMol | 109 | 158575 | from __future__ import annotations
class Atom(object):
""" """
def __init__(self, index, name: object | None=None, residue_index=-1, residue_name: object | None=None):
"""Create an Atom object
Args:
index (int): index of atom in the molecule
name (str): name of the atom... | 2 | 10 | 0 | 12 | 24 | 0 |
homeassistant/components/tractive/diagnostics.py | jlmaners/core | 30,023 | 158578 | <filename>homeassistant/components/tractive/diagnostics.py
"""Diagnostics support for Tractive."""
from __future__ import annotations
from homeassistant.components.diagnostics import async_redact_data
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
from ho... | 0 | 0 | 0 | 0 | 0 | 0 |
pybamm/models/submodels/convection/through_cell/no_convection.py | manjunathnilugal/PyBaMM | 330 | 158579 | #
# No convection
#
from __future__ import annotations
import pybamm
from .base_through_cell_convection import BaseThroughCellModel
class NoConvection(BaseThroughCellModel):
"""A submodel for case where there is no convection.
Parameters
----------
param : parameter class
The parameters to us... | 1 | 2 | 0 | 0 | 3 | 0 |
api/api/urls.py | logolive/desec-stack | 197 | 158584 | from django.urls import include, path
#
# On Reversing URLs
# =================
#
# Recommended Usage:
# Always use rest_framework.reverse.reverse, do not directly use django.urls.reverse.
# If a request object r is available, use reverse(name, request=r). With the name as defined
# in desecapi.urls.v1 or desecapi.ur... | 0 | 0 | 0 | 0 | 0 | 0 |
data/seg/preprocess/ade20k/ade20k_seg_generator.py | qrsforever/torchcv | 308 | 158627 | <reponame>qrsforever/torchcv<filename>data/seg/preprocess/ade20k/ade20k_seg_generator.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: <NAME>(<EMAIL>)
# COCO det data generator.
import os
import argparse
import shutil
LABEL_DIR = 'label'
IMAGE_DIR = 'image'
class ADE20KSegGenerator(object):
def __ini... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.