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 |
|---|---|---|---|---|---|---|---|---|---|---|
controle_estoque/Crud/CrudMarcaProduto.py | jucimar1/controleEstoque | 134 | 1692895 | # -*- coding: utf-8 -*-
from sqlalchemy.exc import IntegrityError
from sqlalchemy import desc
from Crud.core import Conexao
from Crud.Models import MarcaProduto
class CrudMarcaProduto(object):
def __init__(self, id: str="", marca_produto: str="", query: str=""):
self.id = id
self.marca_produto =... | 3 | 1 | 0 | 0 | 4 | 0 |
python/genboard_train.py | syys96/KataGo | 1,676 | 1692897 | #!/usr/bin/python3
from __future__ import annotations
import sys
import os
import argparse
import traceback
import logging
import json
import math
import random
import hashlib
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import data
from board import... | 0 | 4 | 0 | 0 | 4 | 0 |
third_party/chromite/cbuildbot/stages/infra_stages.py | zipated/src | 2,151 | 1692899 | # -*- coding: utf-8 -*-
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module containing infra build stages."""
from __future__ import print_function
import os
import shutil
from chromite.cbuildb... | 0 | 5 | 0 | 0 | 5 | 0 |
rpython/translator/backendopt/collectanalyze.py | nanjekyejoannah/pypy | 381 | 1692919 | <reponame>nanjekyejoannah/pypy<gh_stars>100-1000
from rpython.translator.backendopt import graphanalyze
from rpython.rtyper.lltypesystem.lloperation import LL_OPERATIONS
# NB. tests are in rpython/memory/gctransform/test/test_framework.py
class CollectAnalyzer(graphanalyze.BoolGraphAnalyzer):
def analyze_direct... | 0 | 0 | 0 | 0 | 0 | 0 |
swig/python/gdal-utils/scripts/gdal2xyz.py | FeU-aKlos/gdal | 3,100 | 1692932 | #!/usr/bin/env python3
import sys
# import osgeo_utils.gdal2xyz as a convenience to use as a script
from osgeo_utils.gdal2xyz import * # noqa
from osgeo_utils.gdal2xyz import main
from osgeo.gdal import deprecation_warn
deprecation_warn('gdal2xyz')
sys.exit(main(sys.argv))
| 0 | 0 | 0 | 0 | 0 | 0 |
mesh_reconstruction/make_dataset.py | QinglingWang77/2D-3D_NeuralRender | 229 | 1692936 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import os
import dataset
import scipy.misc
image_size = 64
batch_size = 64
distance = 2.732
input_mask = True
class_ids = [
'03001627', '02691156', '02828884', '02933112', '02958343', '03211117', '03636649', '03691459', '04090263',
'04256520', ... | 0 | 0 | 0 | 0 | 0 | 0 |
integration_test/Dialect/Handshake/lit.local.cfg.py | DeepFlyingSky/circt | 769 | 1692949 | config.excludes.add('driver.sv')
| 0 | 0 | 0 | 0 | 0 | 0 |
easyreg/mermaid_net.py | uncbiag/easyreg | 107 | 1692956 | from __future__ import annotations
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .utils import *
from .affine_net import *
from .momentum_net import *
import mermaid.module_parameters as pars
import mermaid.model_factory as py_mf
import mermaid.utils ... | 14 | 18 | 0 | 6 | 38 | 0 |
setup.py | barclayo/pygameui | 101 | 1692981 | <reponame>barclayo/pygameui
#!/usr/bin/env python
# Use 'distribute', a fork of 'setuptools'.
# This seems to be the recommended tool until 'distutils2' is completed.
# See: http://pypi.python.org/pypi/distribute
import distribute_setup
distribute_setup.use_setuptools()
from setuptools import setup
# Find the versio... | 0 | 0 | 0 | 0 | 0 | 0 |
froide/publicbody/law_urls.py | lanmarc77/froide | 198 | 1693007 | from django.urls import path
from .views import show_foilaw
urlpatterns = [
path("<slug:slug>/", show_foilaw, name="publicbody-foilaw-show"),
]
| 0 | 0 | 0 | 0 | 0 | 0 |
components/iscesys/Parsers/rdf/language/lexis/semantics.py | vincentschut/isce2 | 1,133 | 1693018 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2014 California Institute of Technology. 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 th... | 0 | 4 | 2 | 0 | 6 | 0 |
tests/pyccel/scripts/classes/classes_5.py | dina-fouad/pyccel | 206 | 1693023 | <filename>tests/pyccel/scripts/classes/classes_5.py
# pylint: disable=missing-class-docstring, disable=missing-function-docstring, missing-module-docstring/
#$ header class A(public)
#$ header method __init__(A, int)
#$ header method __del__(A)
#$ header method f(A)
class A(object):
def __init__(self, x):
... | 0 | 0 | 0 | 0 | 0 | 0 |
testsuite/plugins/loop.py | okutane/yandex-taxi-testsuite | 128 | 1693026 | <filename>testsuite/plugins/loop.py
import asyncio
import pytest
import uvloop
@pytest.fixture(scope='session')
def loop():
"""
One event loop for all tests.
"""
event_loop = uvloop.new_event_loop()
asyncio.set_event_loop(event_loop)
try:
yield event_loop
finally:
event_lo... | 0 | 0 | 0 | 0 | 0 | 0 |
ipymd/formats/notebook.py | nathanfdunn/ipymd | 521 | 1693093 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""Notebook reader and writer."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import json
try:
import nbformat as nbf
from nbformat.v4.nbba... | 0 | 0 | 0 | 0 | 0 | 0 |
src/cozmo/clad_protocol.py | rootless4real/cozmo-python-sdk | 794 | 1693101 | # Copyright (c) 2016 Anki, 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 in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 0 | 4 | 3 | 1 | 8 | 0 |
ByteNet/ops.py | paarthneekhara/byteNet-tensorflow | 345 | 1693169 | import tensorflow as tf
import math
def fully_connected(input_, output_nodes, name, stddev=0.02):
with tf.variable_scope(name):
input_shape = input_.get_shape()
input_nodes = input_shape[-1]
w = tf.get_variable('w', [input_nodes, output_nodes],
initializer=tf.truncated_normal_i... | 0 | 0 | 0 | 0 | 0 | 0 |
openaddr/ci/dashboard_stats.py | MiniCodeMonkey/machine | 101 | 1693200 | <filename>openaddr/ci/dashboard_stats.py<gh_stars>100-1000
#!/usr/bin/env python3
import logging; _L = logging.getLogger('openaddr.ci.dashboard_stats')
"Python script to pull stats about OpenAddresses runs from the database and convert to JSON"
import json, os, sys
from .. import util
def make_stats(cur):
"Conne... | 0 | 0 | 0 | 0 | 0 | 0 |
koku/masu/api/download.py | rubik-ai/koku | 157 | 1693202 | <reponame>rubik-ai/koku
#
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""View for temporary force download endpoint."""
from django.views.decorators.cache import never_cache
from rest_framework.decorators import api_view
from rest_framework.decorators import permission_classes
from rest_framew... | 0 | 0 | 0 | 0 | 0 | 0 |
seirsplus/sim_loops.py | khaleelsyed/seirsplus | 620 | 1693203 | from __future__ import annotations
from __future__ import division
import pickle
import numpy
import time
def run_tti_sim(model, T, max_dt: object | None=None,
intervention_start_pct_infected: int=0, average_introductions_per_day: int=0,
testing_cadence: str='everyday', pct_tested_pe... | 30 | 1 | 0 | 0 | 31 | 0 |
examples/pil_app.py | ulda/remi | 3,224 | 1693204 | from __future__ import annotations
"""
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 agreed to i... | 3 | 5 | 0 | 3 | 11 | 0 |
dataset/audio_processing.py | FilthyFrankTheGoanimator/Voice | 556 | 1693213 | <filename>dataset/audio_processing.py
import argparse
from subprocess import check_output, call, DEVNULL, STDOUT
from pydub import AudioSegment
import re
import os
from dataset.utils import add_suffix
devnull = open(os.devnull, "w")
TARGET_SAMPLE_RATE = 22050
TARGET_BITRATE = "32k"
def convert_audio(input_path):
... | 0 | 0 | 0 | 0 | 0 | 0 |
InvenTree/stock/migrations/0002_auto_20190525_2226.py | ArakniD/InvenTree | 656 | 1693216 | <filename>InvenTree/stock/migrations/0002_auto_20190525_2226.py
# Generated by Django 2.2 on 2019-05-25 12:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('stock', '0001_initial'),
]
operations = [
mig... | 0 | 0 | 0 | 0 | 0 | 0 |
openmdao/components/tests/extcode_node.py | toddrme2178/OpenMDAO | 451 | 1693227 | #!/usr/bin/env python
#
# usage: extcode_node.py input_filename output_filename
#
# Evaluates the residual equation (Kirchhoff's law) for the node
# by calculating the sum of the currents flowing towards the node minus the
# the sum of the currents flowing away from the node.
#
# Read the count and values for the c... | 0 | 0 | 0 | 0 | 0 | 0 |
examples-master/python_examples/maths_module.py | JungHoonJung/2021MD | 186 | 1693268 | <filename>examples-master/python_examples/maths_module.py
#!/usr/bin/env python3
# maths_module.py
#------------------------------------------------------------------------------------------------#
# This software was written in 2016/17 #
# by <NAME> <<EMAIL>>/... | 0 | 0 | 0 | 0 | 0 | 0 |
CPX_Marble_Maze/code.py | gamblor21/Adafruit_Learning_System_Guides | 665 | 1693300 | <filename>CPX_Marble_Maze/code.py
# CircuitPython code for the Gyroscopic Marble Maze
# Adafruit Industries, 2019. MIT License
import time
import board
import pwmio
from adafruit_motor import servo
import simpleio
from adafruit_circuitplayground.express import cpx
# create a PWMOut object on Pin A2.
pwm1 = pwmio.PWMOu... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/test_logs.py | Chen188/chalice | 6,240 | 1693336 | import time
import mock
from datetime import datetime, timedelta
from chalice import logs
from chalice.awsclient import TypedAWSClient
from six import StringIO
NO_OPTIONS = logs.LogRetrieveOptions()
def message(log_message, log_stream_name: str='logStreamName') -> dict[str,object]:
return {
'logStreamN... | 1 | 1 | 0 | 0 | 2 | 0 |
packages/pyright-internal/src/tests/samples/noreturn3.py | Jasha10/pyright | 3,934 | 1693345 | <filename>packages/pyright-internal/src/tests/samples/noreturn3.py
# This sample tests the case where a local NoReturn call depends
# on the inferred type of a local variable.
from typing import NoReturn
class MyClass:
def no_return(
self,
) -> NoReturn:
...
def client_code() -> NoReturn:
... | 0 | 0 | 0 | 0 | 0 | 0 |
noisemaker/util.py | aayars/py-noisemaker | 106 | 1693347 | <filename>noisemaker/util.py<gh_stars>100-1000
"""Utility functions for Noisemaker."""
from enum import Enum
import json
import os
import subprocess
from PIL import Image
from loguru import logger as default_logger
import tensorflow as tf
def save(tensor, name="noise.png"):
"""
Save an image Tensor to a f... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/structures/test_set_comprehension.py | jacebrowning/voc | 850 | 1693385 | from ..utils import TranspileTestCase
class SetComprehensionTests(TranspileTestCase):
def test_syntax(self):
self.assertCodeExecution("""
x = [1, 2, 3, 4, 5]
s = {v**2 for v in x}
print(len(s))
print(1 in s)
print(4 in s)
print(9 in s... | 0 | 0 | 0 | 0 | 0 | 0 |
gconv_experiments/CIFAR10/train.py | tscohen/gconv_experiments | 115 | 1693397 | <filename>gconv_experiments/CIFAR10/train.py
import ast
import argparse
import logging
import time
import os
import imp
import shutil
import subprocess
import numpy as np
import chainer
from chainer import optimizers, cuda, serializers, Variable
import cupy as cp
from progressbar import ProgressBar
from gconv_expe... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/dlrm/dlrm_kaggle_fp32.py | mikemckiernan/HugeCTR | 130 | 1693416 | import hugectr
from mpi4py import MPI
solver = hugectr.CreateSolver(max_eval_batches = 70,
batchsize_eval = 65536,
batchsize = 65536,
lr = 0.5,
warmup_steps = 300,
vvgpu ... | 0 | 0 | 0 | 0 | 0 | 0 |
janitor/functions/sort_column_value_order.py | vishalbelsare/pyjanitor | 225 | 1693418 | from __future__ import annotations
import pandas_flavor as pf
import pandas as pd
@pf.register_dataframe_method
def sort_column_value_order(
df: pd.DataFrame, column: str, column_value_order: dict, columns: object | None=None
) -> pd.DataFrame:
"""
This function adds precedence to certain values in a spec... | 4 | 1 | 0 | 0 | 5 | 0 |
extrabacon-2.0/Mexeggs/loglib.py | JS-Burns/CVE-2016-6366 | 171 | 1693440 | import json
import os
import platform
import sys
import threading
import traceback
from copy import deepcopy
from datetime import datetime
from string import lower
class AbstractLog(object):
# AbstractLog provides an ABC for the creation of a concrete Log class
def __init__(self, ToolProjectName, ToolProject... | 0 | 0 | 0 | 0 | 0 | 0 |
lpot/experimental/common/postprocess.py | intelkevinputnam/lpot-docs | 172 | 1693458 | <reponame>intelkevinputnam/lpot-docs
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 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.ap... | 0 | 0 | 0 | 0 | 0 | 0 |
src/encoded/tests/test_upgrade_chip_replication_quality_metric.py | procha2/encoded | 102 | 1693483 | <gh_stars>100-1000
import pytest
def test_upgrade_chip_replication_quality_metric_1_2(upgrader, chip_replication_quality_metric_1):
value = upgrader.upgrade(
"chip_replication_quality_metric",
chip_replication_quality_metric_1,
current_version="1",
target_version="2",
)
ass... | 0 | 0 | 0 | 0 | 0 | 0 |
html_generiloj/generi.py | junefish/kurso-zagreba-metodo | 124 | 1693497 | <filename>html_generiloj/generi.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
import re
import yaml, jinja2, mistune
import sys
sys.path = ['./genanki'] + sys.path
import genanki
def render_page(name, enhavo, vojprefikso, env, output_path):
rendered = env.get_template(name + '.html').... | 0 | 0 | 0 | 0 | 0 | 0 |
exercises/zh/test_03_14_03.py | Jette16/spacy-course | 2,085 | 1693517 | def test():
assert (
"patterns = list(nlp.pipe(people))" in __solution__
), "你有用list将nlp.pipe的结果变为列表吗?"
__msg__.good(
"干得漂亮!接下来我们看一个实际例子,用nlp.pipe来处理文档生成更多的元数据。"
)
| 0 | 0 | 0 | 0 | 0 | 0 |
numba/tests/annotation_usecases.py | auderson/numba | 6,620 | 1693532 | <reponame>auderson/numba
"""
Usecases with Python 3 function annotations. This is a separate module
in order to avoid syntax errors with Python 2.
"""
class AnnotatedClass:
"""
A class with annotated methods.
"""
def __init__(self, v: int):
self.x = v
def add(self, v: int) -> int:
... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/box.py | x5675602/yolov2-tensorflow | 118 | 1693538 | <filename>utils/box.py
import numpy as np
class BoundBox:
def __init__(self, classes):
self.x, self.y = float(), float()
self.w, self.h = float(), float()
self.c = float()
self.class_num = classes
self.probs = np.zeros((classes,))
def overlap(x1,w1,x2,w2):
l1 = x1 - w1 ... | 0 | 0 | 0 | 0 | 0 | 0 |
stats/gamedetail.py | spiffcode/hostile-takeover | 113 | 1693576 | import os
import config
import models
import gamestats
import message
import addgamestats
import basehandler
from wrap import PropWrap
from wrap import DictWrap
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext import db
class GameDetail(basehandler.Ba... | 0 | 2 | 0 | 0 | 2 | 0 |
autovizwidget/autovizwidget/tests/test_utils.py | sciserver/sparkmagic | 1,141 | 1693582 | from nose.tools import with_setup
import pandas as pd
from ..widget import utils as utils
from ..widget.encoding import Encoding
df = None
encoding = None
def _setup():
global df, encoding
records = [{u'buildingID': 0, u'date': u'6/1/13', u'temp_diff': 12, "mystr": "alejandro", "mystr2": "1"},
... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/496702_Templite/recipe-496702.py | tdiprima/code | 2,023 | 1693611 | import re
class Templite(object):
delimiter = re.compile(r"\$\{(.*?)\}\$", re.DOTALL)
def __init__(self, template):
self.tokens = self.compile(template)
@classmethod
def from_file(cls, file):
"""
loads a template from a file. `file` can be either a string, specifying
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/confluent/azext_confluent/manual/custom.py | haroonf/azure-cli-extensions | 207 | 1693620 | <filename>src/confluent/azext_confluent/manual/custom.py<gh_stars>100-1000
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code ge... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/PySys/smoketest_json/run.py | PradeepKiruvale/tedge_build_workflow | 102 | 1693631 | import sys
sys.path.append("environments")
from environment_roundtrip_c8y import Environment_roundtrip_c8y
"""
Roundtrip test C8y
Given a configured system with configured certificate
When we derive from EnvironmentC8y
When we run the smoketest for JSON publishing with defaults a size of 20, 100ms delay
Then we vali... | 0 | 0 | 0 | 0 | 0 | 0 |
torch/fx/experimental/schema_type_annotation.py | Hacky-DH/pytorch | 60,067 | 1693638 | <reponame>Hacky-DH/pytorch
import torch
import torch.fx
import inspect
from typing import Any, Dict, Optional, Tuple
from torch.fx.node import Argument, Target
from torch._jit_internal import boolean_dispatched
from torch.fx.operator_schemas import _torchscript_type_to_python_type
from torch.fx import Transformer
cla... | 0 | 0 | 0 | 0 | 0 | 0 |
train/__init__.py | IAmPara0x/yuno | 349 | 1693656 | from .base import *
from .config import *
from .pipelines import *
| 0 | 0 | 0 | 0 | 0 | 0 |
final/transformer_big/__init__.py | caoxu915683474/jddc_solution_4th | 256 | 1693665 | <filename>final/transformer_big/__init__.py
# coding: utf-8
from . import jddc_big
| 0 | 0 | 0 | 0 | 0 | 0 |
crypto/frank/solution/test.py | cclauss/fbctf-2019-challenges | 213 | 1693670 | <gh_stars>100-1000
#!/usr/bin/env python
from collide import *
def test_gf_mult_distributive():
x = rand_block()
y = rand_block()
z = rand_block()
# x * ( y + z )
o1 = gf_mult(x, xor_block(y, z))
# x*y + x*z
o2 = xor_block(gf_mult(x,y), gf_mult(x,z))
assert o1 == o2, (x, y, z)
def ... | 0 | 0 | 0 | 0 | 0 | 0 |
watchmen/common/security/algorithm/algorithm_mask_mail.py | Insurance-Metrics-Measure-Advisory/watchman-data-connector | 125 | 1693679 | def encrypt(value_, params) -> object:
lo = value_.find("@")
if lo > 0:
return "#####" + value_[lo - 1:]
else:
raise Exception("invalid email {}".format(value_))
| 0 | 1 | 0 | 0 | 1 | 0 |
sdk/edgegateway/azure-mgmt-edgegateway/azure/mgmt/edgegateway/models/network_adapter_py3.py | rsdoherty/azure-sdk-for-python | 2,728 | 1693683 | <reponame>rsdoherty/azure-sdk-for-python
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsof... | 0 | 0 | 0 | 0 | 0 | 0 |
igibson/utils/data_utils/ext_scene/scripts/step_1_preprocess_3dfront.py | mamadbiabon/iGibson | 360 | 1693736 | <reponame>mamadbiabon/iGibson
import argparse
import json
import math
import os
import subprocess
from collections import defaultdict
import matplotlib.pyplot as plt
from PIL import ImageDraw
from scipy.spatial import ConvexHull
from shapely.geometry import Polygon as shape_poly
from utils.scene_urdf import gen_orig_u... | 0 | 0 | 0 | 0 | 0 | 0 |
sonnet/src/initializers_test.py | ScriptBox99/deepmind-sonnet | 10,287 | 1693737 | # Copyright 2019 The Sonnet 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 applicable l... | 5 | 0 | 0 | 0 | 5 | 0 |
mods/goofile.py | tomsec/discover | 2,808 | 1693766 | #!/usr/bin/python3
import re
import requests
import sys
from lxml import html
domain = sys.argv[1]
filetype = sys.argv[2]
start = 0
results = []
totalFiles = 0
def google_dork():
global domain
global filetype
global start
global results
global totalFiles
regex = re.compile(r'(?P<urls>http\... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/577962_awklike_module/recipe-577962.py | tdiprima/code | 2,023 | 1693776 | """
Awk like module
Usage:
for al in awk_iter_open("some filename"):
print al._nr # AWK NR
print al._nf # AWK NF
print al._0r # AWK $0
print al._1 # AWK strip($1)
print al._1r # AWK $1 , raw string
print al._1i # AWK int($1)
print al._1f # AWK floa... | 0 | 0 | 0 | 0 | 0 | 0 |
autodp/privacy_calibrator.py | samellem/autodp | 158 | 1693806 | <reponame>samellem/autodp
"""
A collection of different ways to calibrate noise to privacy
"""
import numpy as np
from math import exp, sqrt
from scipy.special import erf
from scipy.optimize import brentq
from autodp import rdp_acct, rdp_bank, dp_acct, dp_bank
# Subsampling lemma and its inverse
def subsample_epsde... | 0 | 0 | 0 | 0 | 0 | 0 |
toytree/TreeWriter.py | smau8/toytree | 127 | 1693824 | #!/usr/bin/env python
from __future__ import annotations
"""
Write Toytree or TreeNode to newick string
"""
import re
from .utils import NW_FORMAT
# globals
ILLEGAL_NEWICK_CHARS = r":;(),\[\]\t\n\r="
ITERABLE_TYPES = set([list, set, tuple, frozenset])
# formatters
FF = "%0.6g"
NF = "%s"
DF = FF # ":" + FF
class ... | 11 | 4 | 0 | 1 | 16 | 0 |
tests/beem/test_asset.py | abitmore/beem | 118 | 1693854 | # -*- coding: utf-8 -*-
import unittest
from parameterized import parameterized
from beem import Steem
from beem.asset import Asset
from beem.instance import set_shared_steem_instance
from beem.exceptions import AssetDoesNotExistsException
from .nodes import get_hive_nodes, get_steem_nodes
class Testcases(unittest.T... | 0 | 0 | 0 | 0 | 0 | 0 |
reddit2telegram/channels/~inactive/r_indiansocial/app.py | mainyordle/reddit2telegram | 187 | 1693866 | <gh_stars>100-1000
#encoding:utf-8
subreddit = 'IndianSocial'
t_channel = '@r_IndianSocial'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_precision_recall_metrics.py | michaelwang123/PaddleRec | 2,739 | 1693888 | # Copyright (c) 2018 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 app... | 2 | 6 | 0 | 0 | 8 | 0 |
zcls/model/backbones/mobilenet/mobilenetv1_block.py | ZJCV/PyCls | 110 | 1693913 | <reponame>ZJCV/PyCls
# -*- coding: utf-8 -*-
"""
@date: 2020/12/2 下午9:46
@file: mobilenetv1_block.py
@author: zj
@description:
"""
from abc import ABC
import torch.nn as nn
class MobileNetV1Block(nn.Module, ABC):
def __init__(self,
in_channels,
out_channels,
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/oci/load_balancer/models/control_access_using_http_methods_rule.py | Manny27nyc/oci-python-sdk | 249 | 1693915 | # coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 0 | 5 | 0 | 6 | 11 | 0 |
cadence/samples/history_request.py | simkimsia/temporal-python-sdk | 141 | 1693928 | <filename>cadence/samples/history_request.py
# Generates JSON dumps of workflow history for unit testing purposes
import sys
import dataclasses
import json
from cadence.cadence_types import GetWorkflowExecutionHistoryRequest, WorkflowExecution
from cadence.workflowservice import WorkflowService
class Encoder(json.JS... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/auto_encoders/rnn_auto_encoder.py | uaca/deepy | 260 | 1693938 | <reponame>uaca/deepy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from deepy.networks import AutoEncoder
from deepy.layers import RNN, Dense
from deepy.trainers import SGDTrainer, LearningRateAnnealer
from util import get_data, VECTOR_SIZE, SEQUENCE_LENGTH
HI... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/wsgi/test_html.py | PyCN/pulsar | 1,410 | 1693948 | <gh_stars>1000+
import unittest
from pulsar.apps import wsgi
class TestHtml(unittest.TestCase):
def test_html_factory(self):
input = wsgi.html_factory('input', type='text')
h = input(value='bla')
self.assertTrue(h)
self.assertEqual(h.attr('value'), 'bla')
self.assertEqual... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/test_browser.py | emilhe/dash | 17,143 | 1693957 | import pytest
from dash.testing.browser import Browser
from dash.testing.consts import SELENIUM_GRID_DEFAULT
@pytest.mark.parametrize("browser_type", ("Chrome", "Firefox"))
def test_browser_smoke(browser_type, tmpdir):
browser = Browser(
browser=browser_type,
remote=False,
remote_url=SELE... | 0 | 0 | 0 | 0 | 0 | 0 |
benchmarks/expand1_sage.py | eendebakpt/symengine.py | 133 | 1693961 | <gh_stars>100-1000
from timeit import default_timer as clock
from sage.all import var
var("x y z w")
e = (x+y+z+w)**60
t1 = clock()
g = e.expand()
t2 = clock()
print("Total time:", t2-t1, "s")
| 0 | 0 | 0 | 0 | 0 | 0 |
generator/generate_model.py | theodoriss/Office365-REST-Python-Client | 544 | 1693971 | <reponame>theodoriss/Office365-REST-Python-Client
from generator import load_settings
from generator.builders.type_builder import TypeBuilder
from office365.runtime.odata.v3.metadata_reader import ODataV3Reader
from office365.runtime.odata.v4.metadata_reader import ODataV4Reader
def generate_files(model, options):
... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_manager/ite/config.py | jonghenhan/iotivity | 301 | 1693972 | '''
/******************************************************************
*
* Copyright 2018 Samsung Electronics 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
*
* htt... | 0 | 0 | 0 | 0 | 0 | 0 |
Stock/BackTesting/Ui/Basic/DyStockBackTestingResultWidget.py | Leonardo-YXH/DevilYuan | 135 | 1693995 | <filename>Stock/BackTesting/Ui/Basic/DyStockBackTestingResultWidget.py<gh_stars>100-1000
from PyQt5 import QtCore
from PyQt5.QtWidgets import QTabWidget
from PyQt5.QtGui import QCursor
from .Strategy.DyStockBackTestingStrategyResultWidget import *
from EventEngine.DyEvent import *
from DyCommon.DyCommon import *
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/purge-PRs.py | MrFishFinger/powerline | 11,435 | 1694017 | #!/usr/bin/env python
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import argparse
from getpass import getpass
from github import Github
p = argparse.ArgumentParser(description='Powerline release script')
p.add_argument('-u', '--user', type=str,... | 0 | 0 | 0 | 0 | 0 | 0 |
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/n/no/no_self_argument.py | ciskoinch8/vimrc | 463 | 1694022 | """Check for method without self as first argument"""
# pylint: disable=useless-object-inheritance
from __future__ import print_function
class NoSelfArgument(object):
"""dummy class"""
def __init__(truc): # [no-self-argument]
"""method without self"""
print(1)
def abdc(yoo): # [no-self-... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_multi_tabs.py | anbuhckr/pychrome | 542 | 1694040 | # -*- coding: utf-8 -*-
import time
import logging
import pychrome
import functools
logging.basicConfig(level=logging.INFO)
logging.getLogger("urllib3").setLevel(logging.WARNING)
def close_all_tabs(browser) -> None:
if len(browser.list_tab()) == 0:
return
logging.debug("[*] recycle")
for tab i... | 0 | 2 | 0 | 0 | 2 | 0 |
converter/node.py | juxiangyu/kaldi-onnx | 224 | 1694048 | <gh_stars>100-1000
# Copyright 2019 Xiaomi, 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 b... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pytea/pylib/torch/utils/__init__.py | lego0901/pytea | 241 | 1694055 | <gh_stars>100-1000
from . import data as data | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_traptype_smiv2_pysnmp.py | itsmehara/pysmi | 121 | 1694071 | #
# This file is part of pysmi software.
#
# Copyright (c) 2015-2020, <NAME> <<EMAIL>>
# License: http://snmplabs.com/pysmi/license.html
#
import sys
try:
import unittest2 as unittest
except ImportError:
import unittest
from pysmi.parser.smi import parserFactory
from pysmi.codegen.pysnmp import PySnmpCodeGen
... | 0 | 0 | 0 | 0 | 0 | 0 |
code2flow/__init__.py | FreddyZeng/code2flow | 2,248 | 1694090 | <gh_stars>1000+
from .engine import code2flow, VERSION
code2flow = code2flow
VERSION = VERSION
| 0 | 0 | 0 | 0 | 0 | 0 |
scrubadub/detectors/text_blob.py | datascopeanalytics/scrubadub | 190 | 1694101 | <filename>scrubadub/detectors/text_blob.py
import re
import textblob
from textblob.blob import BaseBlob
from textblob.en.taggers import PatternTagger
from typing import Optional, Generator
from scrubadub.detectors.catalogue import register_detector
from .base import RegexDetector
from ..filth import NameFilth, Filth... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/general_utils.py | Fatemejamalii/ID-disentanglement | 127 | 1694106 | <filename>utils/general_utils.py
from pathlib import Path
import cv2
import numpy as np
from PIL import Image
import tensorflow as tf
from tensorflow.keras.initializers import VarianceScaling
import numbers
import scipy
import dlib
landmarks_model_path = None
def read_image(img_path, resolution, align=False):
i... | 0 | 0 | 0 | 0 | 0 | 0 |
esphome/components/tlc59208f/output.py | OttoWinter/esphomeyaml | 249 | 1694111 | import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import output
from esphome.const import CONF_CHANNEL, CONF_ID
from . import TLC59208FOutput, tlc59208f_ns
DEPENDENCIES = ["tlc59208f"]
TLC59208FChannel = tlc59208f_ns.class_("TLC59208FChannel", output.FloatOutput)
CONF_TLC5920... | 0 | 0 | 0 | 0 | 0 | 0 |
docassemble_webapp/docassemble/webapp/register.py | Chromadream/docassemble | 568 | 1694113 | import os
import sys
import re
if __name__ == "__main__":
import docassemble.base.config
docassemble.base.config.load(arguments=sys.argv)
from docassemble.webapp.app_object import app
from docassemble.webapp.db_object import db
from docassemble.webapp.core.models import Supervisors
from sqlalchemy import delete... | 0 | 0 | 0 | 0 | 0 | 0 |
parsers/AR.py | electricitymap/electricitymap-contrib | 143 | 1694123 | <reponame>electricitymap/electricitymap-contrib<filename>parsers/AR.py
#!/usr/bin/env python3
import datetime
import logging
from typing import Dict, List
import arrow
import requests
from bs4 import BeautifulSoup
try:
unicode # Python 2
except NameError:
unicode = str # Python 3
# Useful links.
# https:/... | 0 | 0 | 0 | 0 | 0 | 0 |
var/spack/repos/builtin/packages/r-samr/package.py | kkauder/spack | 2,360 | 1694135 | <filename>var/spack/repos/builtin/packages/r-samr/package.py
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RSamr(RPackage):
"""Significa... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | MIC-DKFZ/trixi | 218 | 1694150 | <filename>setup.py<gh_stars>100-1000
import os
import re
from setuptools import setup, find_packages
def resolve_requirements(file):
requirements = []
with open(file) as f:
req = f.read().splitlines()
for r in req:
if r.startswith("-r"):
requirements += resolve_req... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_connection.py | tomking/PySNN | 175 | 1694155 | <gh_stars>100-1000
import pytest
import torch
# NOTE: Base class is not tested, propagate spike is tested in the linear layer due to initialization problems of the weights
##########################################################
# Test Connection: delayed propagation of spikes and spike conversion
###############... | 0 | 0 | 0 | 0 | 0 | 0 |
python/example_code/comprehend/comprehend_classifier_demo.py | iconara/aws-doc-sdk-examples | 5,166 | 1694178 | <filename>python/example_code/comprehend/comprehend_classifier_demo.py
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Purpose
Shows how to use the AWS SDK for Python (Boto3) with Amazon Comprehend to
train a custom multi-label classifier and run a job to... | 0 | 0 | 0 | 0 | 0 | 0 |
release/stubs.min/Autodesk/Revit/DB/__init___parts/IntegerRange.py | htlcnn/ironpython-stubs | 182 | 1694184 | class IntegerRange(object,IDisposable):
""" A class to define a range of a sequence of consecutive integer numbers """
def Dispose(self):
""" Dispose(self: IntegerRange) """
pass
def ReleaseUnmanagedResources(self,*args):
""" ReleaseUnmanagedResources(self: IntegerRange,disposing: bool) """
pass
def... | 0 | 0 | 0 | 0 | 0 | 0 |
stats/models.py | spiffcode/hostile-takeover | 113 | 1694192 | import config
from google.appengine.ext import db
# +++
class PlayerModel(db.Model):
name = db.StringProperty()
password = db.StringProperty()
rating = db.IntegerProperty(default = 0)
game_count = db.IntegerProperty(default = 0)
games_won = db.IntegerProperty(default = 0)
avatar_hash = db.Str... | 0 | 7 | 0 | 0 | 7 | 0 |
tensorflow2/datasets/cub200_2011_cls_dataset.py | naviocean/imgclsmob | 2,649 | 1694239 | <reponame>naviocean/imgclsmob
"""
CUB-200-2011 classification dataset.
"""
import os
import numpy as np
import pandas as pd
import threading
from tensorflow.keras.preprocessing.image import ImageDataGenerator, DirectoryIterator
from .cls_dataset import img_normalization
from .imagenet1k_cls_dataset import ImageNet... | 0 | 0 | 0 | 0 | 0 | 0 |
src/gtzan/data/make_dataset.py | Hadryan/gtzan.keras | 163 | 1694255 | <filename>src/gtzan/data/make_dataset.py<gh_stars>100-1000
import os
import librosa
import itertools
import numpy as np
import pandas as pd
from scipy.stats import kurtosis
from scipy.stats import skew
def get_features(y, sr, n_fft = 1024, hop_length = 512):
# Features to concatenate in the final dictionary
fe... | 0 | 0 | 0 | 0 | 0 | 0 |
DQM/Physics/python/B2GDQM_cfi.py | ckamtsikis/cmssw | 852 | 1694257 | import FWCore.ParameterSet.Config as cms
from math import pi
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
B2GDQM = DQMEDAnalyzer(
"B2GDQM",
#Trigger Results
triggerResultsCollection = cms.InputTag("TriggerResults", "", "HLT"),
PFJetCorService = cms.string("ak4PFL1FastL2L3"),
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/analytics/lambdas/importers/ios_android_ratings_importer.py | Alexmakes/covid19-app-system-public | 169 | 1694263 | import requests
from json import dumps, loads
import csv
import os
import boto3
from datetime import datetime
from requests.auth import HTTPBasicAuth
import collections
import ast
platform_dict = {
"ios": "https://api.appbot.co/api/v2/apps/2411517/ratings/historical?country=&end=" + datetime.today().strftime(
... | 0 | 0 | 0 | 0 | 0 | 0 |
terrascript/data/HarryEMartland/appdynamics.py | mjuenema/python-terrascript | 507 | 1694273 | <reponame>mjuenema/python-terrascript
# terrascript/data/HarryEMartland/appdynamics.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:11:50 UTC)
__all__ = []
| 0 | 0 | 0 | 0 | 0 | 0 |
src/moduels/gui/MainWindow.py | HaujetZhao/Caps_Writer | 234 | 1694275 | <reponame>HaujetZhao/Caps_Writer
# -*- coding: UTF-8 -*-
from PySide2.QtWidgets import QMainWindow, QTabWidget
from PySide2.QtGui import QIcon, Qt
from moduels.component.NormalValue import 常量
from moduels.gui.Tab_CapsWriter import Tab_CapsWriter
from moduels.gui.Tab_Config import Tab_Config
from moduels.gui.Tab_Help... | 0 | 0 | 0 | 0 | 0 | 0 |
bin/tprint.py | sbraz/blessings | 826 | 1694292 | <gh_stars>100-1000
#!/usr/bin/env python
"""
A simple cmd-line tool for displaying FormattingString capabilities.
For example::
$ python tprint.py bold A rather bold statement.
"""
# std
from __future__ import print_function
# std imports
import argparse
# local
from blessed import Terminal
def parse_args():
... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter10/07_groups_on_views/my_library/models/__init__.py | PacktPublishing/-Odoo-13-Development-Cookbook-Fouth-Edition | 125 | 1694341 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from . import library_book
from . import res_config_settings
from . import library_book_categ
| 0 | 0 | 0 | 0 | 0 | 0 |
django_test_migrations/logic/migrations.py | Jyrno42/django-test-migrations | 294 | 1694369 | <reponame>Jyrno42/django-test-migrations<filename>django_test_migrations/logic/migrations.py
from typing import List
from django_test_migrations.types import MigrationSpec, MigrationTarget
def normalize(migration_target: MigrationSpec) -> List[MigrationTarget]:
"""Normalize ``migration_target`` to expected forma... | 0 | 0 | 0 | 0 | 0 | 0 |
analysis/util/simdata_analysis/utils.py | leozz37/makani | 1,178 | 1694380 | <reponame>leozz37/makani
# Copyright 2020 Makani Technologies LLC
#
# 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 ap... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/mesa/MesaLib/src/mapi/glapi/gen/license.py | Scopetta197/chromium | 2,151 | 1694413 | <filename>third_party/mesa/MesaLib/src/mapi/glapi/gen/license.py
# (C) Copyright IBM Corporation 2004
# All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restrict... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/validation/parameter/test_enum_validation.py | maroux/flex | 160 | 1694433 | <reponame>maroux/flex
import pytest
import os
from flex.exceptions import ValidationError
from flex.loading.schema.paths.path_item.operation.parameters import (
parameters_validator,
)
from flex.validation.parameter import (
validate_parameters,
)
from flex.constants import (
PATH,
STRING,
NUMBER,
... | 0 | 0 | 0 | 0 | 0 | 0 |
ML/TensorFlow/Basics/tutorial20-classify-cancer-beginner-project-example/train_isic.py | xuyannus/Machine-Learning-Collection | 3,094 | 1694454 | <reponame>xuyannus/Machine-Learning-Collection
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
import tensorflow as tf
import math
import tensorflow_hub as hub
import numpy as np
import matplotlib.pyplot as plt
from tensorflow import keras
from tensorflow.keras import layers
from sklearn.metrics import roc_curve
fr... | 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.