hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f75178b6afa0d6b3a9043e9fcd3a602978189a07 | 1,944 | py | Python | python/setup.py | da-tubi/rikai | f97669b5cf7d527bcfb3cde77c97f37431add7a6 | [
"Apache-2.0"
] | null | null | null | python/setup.py | da-tubi/rikai | f97669b5cf7d527bcfb3cde77c97f37431add7a6 | [
"Apache-2.0"
] | null | null | null | python/setup.py | da-tubi/rikai | f97669b5cf7d527bcfb3cde77c97f37431add7a6 | [
"Apache-2.0"
] | null | null | null | import pathlib
from setuptools import find_packages, setup
about = {}
with open(pathlib.Path("rikai") / "__version__.py", "r") as fh:
exec(fh.read(), about)
with open(
pathlib.Path(__file__).absolute().parent.parent / "README.md", "r"
) as fh:
long_description = fh.read()
# extras
dev = [
"black",
... | 23.707317 | 70 | 0.566872 | import pathlib
from setuptools import find_packages, setup
about = {}
with open(pathlib.Path("rikai") / "__version__.py", "r") as fh:
exec(fh.read(), about)
with open(
pathlib.Path(__file__).absolute().parent.parent / "README.md", "r"
) as fh:
long_description = fh.read()
dev = [
"black",
"bump... | true | true |
f751792884889b072124d3a16665a165f5ae32b8 | 5,290 | py | Python | clients/bbg/blpapi-python/examples/unittests/market-data-notifier/src/appconfig.py | vegabook/dstreams | 9a2919b36ba2901522a61737a593fea28a655777 | [
"MIT"
] | 228 | 2017-06-20T16:14:06.000Z | 2022-03-30T02:04:47.000Z | clients/bbg/blpapi-python/examples/unittests/market-data-notifier/src/appconfig.py | vegabook/dstreams | 9a2919b36ba2901522a61737a593fea28a655777 | [
"MIT"
] | 3 | 2017-05-04T02:48:36.000Z | 2018-02-01T13:59:46.000Z | clients/bbg/blpapi-python/examples/unittests/market-data-notifier/src/appconfig.py | vegabook/dstreams | 9a2919b36ba2901522a61737a593fea28a655777 | [
"MIT"
] | 84 | 2017-11-21T14:56:20.000Z | 2022-03-31T15:22:22.000Z | """Sample command line parser."""
from argparse import ArgumentParser, Action
class AuthOptionsAction(Action): # pylint: disable=too-few-public-methods
"""Parse authorization args from user input."""
def __call__(self, parser, args, values, option_string=None):
value = values
vals = value.s... | 41.007752 | 79 | 0.530057 |
from argparse import ArgumentParser, Action
class AuthOptionsAction(Action):
def __call__(self, parser, args, values, option_string=None):
value = values
vals = value.split("=", 1)
auth = None
if value == "user":
auth = {"option" : "AuthenticationType=OS_LOGON"}
... | true | true |
f751792d9c9f0f5c8ac6d956c75885dee2179dbb | 2,384 | py | Python | plot_all_variables_big_a.py | Yurlungur/FLRW | 15424d2304e44d0e38110b655c5c28a6aeb34147 | [
"MIT"
] | null | null | null | plot_all_variables_big_a.py | Yurlungur/FLRW | 15424d2304e44d0e38110b655c5c28a6aeb34147 | [
"MIT"
] | null | null | null | plot_all_variables_big_a.py | Yurlungur/FLRW | 15424d2304e44d0e38110b655c5c28a6aeb34147 | [
"MIT"
] | 2 | 2017-11-23T20:58:13.000Z | 2021-12-27T20:48:24.000Z | #!/usr/bin/env python2
# Author: Jonah Miller (jonah.maxwell.miller@gmail.com)
# Time-stamp: <2013-12-14 16:50:20 (jonah)>
# This is a companion program to my FLRW simulator. It takes a data
# file and generates a plot of the scale factor, its derivative, the
# density, and the pressure of the matter.
# Call the prog... | 32.657534 | 77 | 0.60948 |
import numpy as np
import scipy as sp
import matplotlib as mpl
import matplotlib.pyplot as plt
import sys, os
xlabel = "Cosmological time. (geometrized units)"
my_linewidth = 5
fontsize = 20
a_rescaling = 7000
def load_data(filename):
with open(filename,'r') as f:
data = np.loadtxt(file... | true | true |
f751793fc5ae6205c9bdb853255ef7654ffaeaaf | 1,873 | py | Python | examples/funcfit/__main__.py | MaxXSoft/ZexGP | c01d68d134990c0d18f30f12d93855ba5ffcbe29 | [
"MIT"
] | 1 | 2021-12-19T00:47:28.000Z | 2021-12-19T00:47:28.000Z | examples/funcfit/__main__.py | MaxXSoft/ZexGP | c01d68d134990c0d18f30f12d93855ba5ffcbe29 | [
"MIT"
] | null | null | null | examples/funcfit/__main__.py | MaxXSoft/ZexGP | c01d68d134990c0d18f30f12d93855ba5ffcbe29 | [
"MIT"
] | 1 | 2020-01-19T13:45:25.000Z | 2020-01-19T13:45:25.000Z | '''
An example of fitting a function with ZexGP.
'''
from zexgp.kernel import Kernel
from os import path
from sys import float_info as fi
from matplotlib import pyplot as plt
# some necessary global variables
func_val = []
domain = []
def init_func_val():
'''
Initialize function value.
'''
def func(x): ret... | 19.309278 | 56 | 0.63481 |
from zexgp.kernel import Kernel
from os import path
from sys import float_info as fi
from matplotlib import pyplot as plt
func_val = []
domain = []
def init_func_val():
def func(x): return 1 / (1 + 25 * x ** 2)
for i in range(100):
x = (i - 50) / 50
func_val.append(func(x))
domain.append(x)
def ... | true | true |
f7517984659598c362a67232aee8e0911840dc3a | 5,071 | py | Python | gncpy/simulator.py | drjdlarson/gncpy | 02c83e110ba1efca08e2c80f42b09be6af078a6f | [
"MIT"
] | 4 | 2021-01-12T02:44:36.000Z | 2022-02-15T19:04:59.000Z | gncpy/simulator.py | drjdlarson/gncpy | 02c83e110ba1efca08e2c80f42b09be6af078a6f | [
"MIT"
] | null | null | null | gncpy/simulator.py | drjdlarson/gncpy | 02c83e110ba1efca08e2c80f42b09be6af078a6f | [
"MIT"
] | null | null | null | import yaml
import io
import abc
from warnings import warn
class Parameters:
""" Defines basic functionality for loading/saving configuration files.
Handles loading, and saving of YAML configuration files. Also, generically,
initializes classes based on the loaded configuration.
Attributes:
... | 35.711268 | 82 | 0.531848 | import yaml
import io
import abc
from warnings import warn
class Parameters:
def __init__(self):
self.dict = {}
def load_files(self, files):
def parse_file(self, f):
with io.open(f, 'r') as fin:
cfg = yaml.safe_load(fin)
self.dict = merge(self.dict, cf... | true | true |
f75179b59c068966c178bf0589d9cd5408c222ad | 1,786 | py | Python | getMitoLength.py | ClaudiaPaetzold/MitoHiFi | c06ed3e872e44b41d809cb8b715da670db31be10 | [
"MIT"
] | 47 | 2020-08-27T14:40:39.000Z | 2022-03-31T06:05:59.000Z | getMitoLength.py | ClaudiaPaetzold/MitoHiFi | c06ed3e872e44b41d809cb8b715da670db31be10 | [
"MIT"
] | 10 | 2021-02-25T20:08:01.000Z | 2022-01-28T17:35:22.000Z | getMitoLength.py | ClaudiaPaetzold/MitoHiFi | c06ed3e872e44b41d809cb8b715da670db31be10 | [
"MIT"
] | 12 | 2020-08-28T04:34:04.000Z | 2022-02-03T16:16:00.000Z | #!/usr/bin/env python
'''
Copyright 2021 Joāo Ferreira Nunes
This script is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version... | 35.019608 | 136 | 0.708287 |
def get_mito_length(mito_file):
from Bio import SeqIO
num_sequences = len(list(SeqIO.parse(mito_file, "fasta")))
if num_sequences > 1:
raise Exception("failed because mitogenome file has more than one sequence. {} sequences were found".format(str(num_sequences)))
for index, record in enume... | true | true |
f7517b9fb942d12e87445ba204c950ca731bb0c7 | 939 | py | Python | jinja2tool.py | sborgeson/building-data-analysis | 867cdae158817d70ea29f0b69b6ff2073a3d0d12 | [
"BSD-3-Clause"
] | 6 | 2015-05-10T20:24:06.000Z | 2020-05-22T13:48:11.000Z | jinja2tool.py | sborgeson/building-data-analysis | 867cdae158817d70ea29f0b69b6ff2073a3d0d12 | [
"BSD-3-Clause"
] | null | null | null | jinja2tool.py | sborgeson/building-data-analysis | 867cdae158817d70ea29f0b69b6ff2073a3d0d12 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
import cherrypy
__all__ = ['Jinja2Tool']
class Jinja2Tool(cherrypy.Tool):
def __init__(self):
cherrypy.Tool.__init__(self, 'before_finalize',
self._render,
priority=10)
def _render(self, template=None, debug... | 34.777778 | 77 | 0.605964 |
import cherrypy
__all__ = ['Jinja2Tool']
class Jinja2Tool(cherrypy.Tool):
def __init__(self):
cherrypy.Tool.__init__(self, 'before_finalize',
self._render,
priority=10)
def _render(self, template=None, debug=False):
if che... | true | true |
f7517c19d2bc8810a331a4e16b59d5a60182ecd2 | 6,088 | py | Python | orchestra/cli.py | christophbrgr/brats-orchestra | c1cd8ae0fba6311c731eaaabe0151709426b63b9 | [
"MIT"
] | 8 | 2018-12-17T14:21:48.000Z | 2021-08-02T13:18:48.000Z | orchestra/cli.py | christophbrgr/brats-orchestra | c1cd8ae0fba6311c731eaaabe0151709426b63b9 | [
"MIT"
] | 1 | 2021-09-14T13:08:04.000Z | 2021-09-17T13:00:55.000Z | orchestra/cli.py | christophbrgr/brats-orchestra | c1cd8ae0fba6311c731eaaabe0151709426b63b9 | [
"MIT"
] | 2 | 2019-01-01T15:05:56.000Z | 2021-02-23T07:03:52.000Z | # -*- coding: utf-8 -*-
# Author: Christoph Berger
# Script for evaluation and bulk segmentation of Brain Tumor Scans
# using the MICCAI BRATS algorithmic repository
#
# Please refer to README.md and LICENSE.md for further documentation
# This software is not certified for clinical use.
import sys
import subprocess
im... | 45.432836 | 153 | 0.59412 |
import sys
import subprocess
import pprint
import argparse
from orchestra import segmentor
from orchestra import fusionator
def list_dockers():
seg = segmentor.Segmentor()
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(seg.config)
def list_docker_ids():
seg = segmentor.Segmentor()
pp = pp... | true | true |
f7517d78b6851fb6b0a2ad741c86fa2bcf613d1b | 8,422 | py | Python | DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py | SWuchterl/cmssw | 769b4a7ef81796579af7d626da6039dfa0347b8e | [
"Apache-2.0"
] | 1 | 2020-05-27T10:52:33.000Z | 2020-05-27T10:52:33.000Z | DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py | SWuchterl/cmssw | 769b4a7ef81796579af7d626da6039dfa0347b8e | [
"Apache-2.0"
] | 28 | 2019-08-15T15:21:11.000Z | 2021-12-29T14:13:18.000Z | DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py | SWuchterl/cmssw | 769b4a7ef81796579af7d626da6039dfa0347b8e | [
"Apache-2.0"
] | 1 | 2020-08-18T10:29:49.000Z | 2020-08-18T10:29:49.000Z | import FWCore.ParameterSet.Config as cms
import sys
from Configuration.Eras.Era_Run2_2018_cff import Run2_2018
process = cms.Process("L1TStage2DQM", Run2_2018)
unitTest = False
if 'unitTest=True' in sys.argv:
unitTest=True
#--------------------------------------------------
# Event Source and Condition
if unitT... | 45.037433 | 99 | 0.76597 | import FWCore.ParameterSet.Config as cms
import sys
from Configuration.Eras.Era_Run2_2018_cff import Run2_2018
process = cms.Process("L1TStage2DQM", Run2_2018)
unitTest = False
if 'unitTest=True' in sys.argv:
unitTest=True
if unitTest:
process.load("DQM.Integration.config.unittestinputsource_cfi")
fro... | true | true |
f7517d8bf6d782380ac48af93f27d749ba4fc19c | 3,387 | py | Python | script/model/model.py | algebra2k/terrier | 8b6f4b0b0c30dc94411f197e610f634ce0ab5b0b | [
"MIT"
] | 1 | 2020-05-27T03:54:36.000Z | 2020-05-27T03:54:36.000Z | script/model/model.py | algebra2k/terrier | 8b6f4b0b0c30dc94411f197e610f634ce0ab5b0b | [
"MIT"
] | 7 | 2020-04-06T19:31:12.000Z | 2020-05-12T23:05:09.000Z | script/model/model.py | algebra2k/terrier | 8b6f4b0b0c30dc94411f197e610f634ce0ab5b0b | [
"MIT"
] | 3 | 2020-11-10T11:06:20.000Z | 2022-03-26T15:30:55.000Z | #!/usr/bin/env python3
import numpy as np
import lightgbm as lgb
from sklearn import linear_model
from sklearn import kernel_ridge
from sklearn import ensemble
from sklearn import preprocessing
from sklearn import neural_network
from sklearn import multioutput
# import warnings filter
from warnings import simplefil... | 32.567308 | 117 | 0.653085 |
import numpy as np
import lightgbm as lgb
from sklearn import linear_model
from sklearn import kernel_ridge
from sklearn import ensemble
from sklearn import preprocessing
from sklearn import neural_network
from sklearn import multioutput
from warnings import simplefilter
simplefilter(action='ignore', category=F... | true | true |
f7517df6a42f689fbe3d3858c91f574508c8a616 | 260 | py | Python | translate/__init__.py | trumoose/OB13-Cogs | 07d37bd93e03fc66f044a5083475eafe397cbd2f | [
"MIT"
] | 10 | 2021-02-18T18:15:16.000Z | 2022-02-26T01:49:10.000Z | translate/__init__.py | trumoose/OB13-Cogs | 07d37bd93e03fc66f044a5083475eafe397cbd2f | [
"MIT"
] | 37 | 2021-01-22T17:23:16.000Z | 2022-03-21T14:39:55.000Z | translate/__init__.py | trumoose/OB13-Cogs | 07d37bd93e03fc66f044a5083475eafe397cbd2f | [
"MIT"
] | 27 | 2021-01-22T13:25:17.000Z | 2022-03-28T20:49:39.000Z | import json
from pathlib import Path
from .translate import Translate
with open(Path(__file__).parent / "info.json") as fp:
__red_end_user_data_statement__ = json.load(fp)["end_user_data_statement"]
async def setup(bot):
bot.add_cog(Translate(bot))
| 23.636364 | 78 | 0.765385 | import json
from pathlib import Path
from .translate import Translate
with open(Path(__file__).parent / "info.json") as fp:
__red_end_user_data_statement__ = json.load(fp)["end_user_data_statement"]
async def setup(bot):
bot.add_cog(Translate(bot))
| true | true |
f7517ebb49513bbccd04a3711951b9223ce8a1b7 | 30,787 | py | Python | sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_pii_entities.py | vincenttran-msft/azure-sdk-for-python | 348b56f9f03eeb3f7b502eed51daf494ffff874d | [
"MIT"
] | 1 | 2022-01-24T08:54:57.000Z | 2022-01-24T08:54:57.000Z | sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_pii_entities.py | vincenttran-msft/azure-sdk-for-python | 348b56f9f03eeb3f7b502eed51daf494ffff874d | [
"MIT"
] | null | null | null | sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_pii_entities.py | vincenttran-msft/azure-sdk-for-python | 348b56f9f03eeb3f7b502eed51daf494ffff874d | [
"MIT"
] | null | null | null | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import os
import pytest
import platform
import functools
import json
from azure.core.exceptions import HttpResponseError, ClientAuthenticationError
from azure.core.crede... | 41.324832 | 152 | 0.64563 |
import os
import pytest
import platform
import functools
import json
from azure.core.exceptions import HttpResponseError, ClientAuthenticationError
from azure.core.credentials import AzureKeyCredential
from testcase import TextAnalyticsTest, TextAnalyticsPreparer
from testcase import TextAnalyticsClientPreparer as ... | true | true |
f7518036346d7dd3eca5625a6e764e507f6a048e | 58,105 | py | Python | Lib/site-packages/tensorflow_core/python/ops/gen_functional_ops.py | shivammaniharsahu/django_api | 6ffb3d9f70f30f5fd3ae06ec00a6dd7c7783a797 | [
"bzip2-1.0.6"
] | null | null | null | Lib/site-packages/tensorflow_core/python/ops/gen_functional_ops.py | shivammaniharsahu/django_api | 6ffb3d9f70f30f5fd3ae06ec00a6dd7c7783a797 | [
"bzip2-1.0.6"
] | null | null | null | Lib/site-packages/tensorflow_core/python/ops/gen_functional_ops.py | shivammaniharsahu/django_api | 6ffb3d9f70f30f5fd3ae06ec00a6dd7c7783a797 | [
"bzip2-1.0.6"
] | null | null | null | """Python wrappers around TensorFlow ops.
This file is MACHINE GENERATED! Do not edit.
"""
import collections as _collections
import six as _six
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
from tensorflow.python.eager import context as _context
from tensorflow.python.eager import core as _c... | 38.201841 | 2,841 | 0.663248 |
import collections as _collections
import six as _six
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
from tensorflow.python.eager import context as _context
from tensorflow.python.eager import core as _core
from tensorflow.python.eager import execute as _execute
from tensorflow.python.framework... | true | true |
f7518122a2c461b4c609bfa5c466774175d58100 | 5,043 | py | Python | solutions/networks.py | linusidom/rl-workshop | dbb2ca8b9a5330042a30655ee64c3a4be241d692 | [
"MIT"
] | null | null | null | solutions/networks.py | linusidom/rl-workshop | dbb2ca8b9a5330042a30655ee64c3a4be241d692 | [
"MIT"
] | null | null | null | solutions/networks.py | linusidom/rl-workshop | dbb2ca8b9a5330042a30655ee64c3a4be241d692 | [
"MIT"
] | null | null | null | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import optim
from torch.autograd.variable import Variable
class QNetwork(nn.Module):
def __init__(self, state_size, action_size, nb_hidden, seed=1412):
super(QNetwork, self).__init__()
self.seed = torch.manual_seed(seed)
... | 33.397351 | 87 | 0.573666 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import optim
from torch.autograd.variable import Variable
class QNetwork(nn.Module):
def __init__(self, state_size, action_size, nb_hidden, seed=1412):
super(QNetwork, self).__init__()
self.seed = torch.manual_seed(seed)
... | true | true |
f751818caa2d6291b185da6032fc3f2061e15b31 | 683 | py | Python | var/spack/repos/builtin/packages/py-counter/package.py | xiki-tempula/spack | 9d66c05e93ab8a933fc59915040c0e0c86a4aac4 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 9 | 2018-04-18T07:51:40.000Z | 2021-09-10T03:56:57.000Z | var/spack/repos/builtin/packages/py-counter/package.py | xiki-tempula/spack | 9d66c05e93ab8a933fc59915040c0e0c86a4aac4 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 907 | 2018-04-18T11:17:57.000Z | 2022-03-31T13:20:25.000Z | var/spack/repos/builtin/packages/py-counter/package.py | xiki-tempula/spack | 9d66c05e93ab8a933fc59915040c0e0c86a4aac4 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 29 | 2018-11-05T16:14:23.000Z | 2022-02-03T16:07:09.000Z | # Copyright 2013-2020 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 PyCounter(PythonPackage):
"""Counter package defines the "counter.Counter" class similar t... | 32.52381 | 95 | 0.732064 |
from spack import *
class PyCounter(PythonPackage):
import_modules = ['counter']
homepage = "https://github.com/KelSolaar/Counter"
url = "https://pypi.io/packages/source/C/Counter/Counter-1.0.0.tar.gz"
version('1.0.0', sha256='9e008590e360936a66c98e1a01e7a9a0ecf6af19cc588107121f5fb4613bb6... | true | true |
f75181c5d63098985a14eea16b0f232ae354fe91 | 780 | py | Python | test/unit/test_keygen.py | nklapste/deadSFS | d63a88d1be51d083a1e59c2d4428f9ce85213fec | [
"MIT"
] | null | null | null | test/unit/test_keygen.py | nklapste/deadSFS | d63a88d1be51d083a1e59c2d4428f9ce85213fec | [
"MIT"
] | null | null | null | test/unit/test_keygen.py | nklapste/deadSFS | d63a88d1be51d083a1e59c2d4428f9ce85213fec | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""pytests for :class:`dead_sfs.keygen`"""
import argparse
import os
from tempfile import TemporaryDirectory
import nacl.secret
import pytest
from dead_sfs.keygen import get_parser, main
def test_get_argparser():
parser = get_parser()
assert parser
assert ... | 21.666667 | 57 | 0.671795 |
import argparse
import os
from tempfile import TemporaryDirectory
import nacl.secret
import pytest
from dead_sfs.keygen import get_parser, main
def test_get_argparser():
parser = get_parser()
assert parser
assert isinstance(parser, argparse.ArgumentParser)
def test_gen_key():
with TemporaryDir... | true | true |
f7518216642b83cae785ec244c93a417bf7c6ec7 | 2,020 | py | Python | plot/plot_folder.py | ky-zhang/utils | f1c9d2580db5ef0f0291ae77312b3d538f292a12 | [
"Apache-2.0"
] | null | null | null | plot/plot_folder.py | ky-zhang/utils | f1c9d2580db5ef0f0291ae77312b3d538f292a12 | [
"Apache-2.0"
] | null | null | null | plot/plot_folder.py | ky-zhang/utils | f1c9d2580db5ef0f0291ae77312b3d538f292a12 | [
"Apache-2.0"
] | null | null | null | import os
import numpy
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import argparse
from PIL import Image
parser = argparse.ArgumentParser()
parser.add_argument('-input', default = '', help = 'input file folder')
parser.add_argument('-label', default = '', help = 'label file')
parser.add_ar... | 29.275362 | 88 | 0.571287 | import os
import numpy
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import argparse
from PIL import Image
parser = argparse.ArgumentParser()
parser.add_argument('-input', default = '', help = 'input file folder')
parser.add_argument('-label', default = '', help = 'label file')
parser.add_ar... | true | true |
f75182d46dfa5055d5d7433f6a16fc23a6f44749 | 3,264 | py | Python | train_inception_resnet.py | HHcola/nima-image | 8364462ff2d59fcb75326782e15df119ebf51c7e | [
"MIT"
] | 726 | 2018-01-02T08:53:19.000Z | 2022-03-28T03:51:53.000Z | train_inception_resnet.py | yhtbyr/neural-image-assessment | 60e7777a70a97c3ce06323453481c5c284ac43ab | [
"MIT"
] | 66 | 2018-01-03T23:33:41.000Z | 2021-11-24T02:56:16.000Z | train_inception_resnet.py | yhtbyr/neural-image-assessment | 60e7777a70a97c3ce06323453481c5c284ac43ab | [
"MIT"
] | 222 | 2018-01-02T19:14:40.000Z | 2022-02-25T01:10:21.000Z | import os
from keras.models import Model
from keras.layers import Dense, Dropout
from keras.applications.inception_resnet_v2 import InceptionResNetV2
from keras.callbacks import ModelCheckpoint, TensorBoard
from keras.optimizers import Adam
from keras import backend as K
from utils.data_loader import train_generator,... | 35.478261 | 143 | 0.689338 | import os
from keras.models import Model
from keras.layers import Dense, Dropout
from keras.applications.inception_resnet_v2 import InceptionResNetV2
from keras.callbacks import ModelCheckpoint, TensorBoard
from keras.optimizers import Adam
from keras import backend as K
from utils.data_loader import train_generator,... | true | true |
f75182e5b0bd8e8eaa9cdbefbadfa2dbcff65645 | 2,550 | py | Python | examples/keras_parikh_entailment/spacy_hook.py | algteam/spacy_zh_model | 0b0cba1a3964aa426e5f96087849c90e69e2a89d | [
"MIT"
] | 5 | 2019-04-19T06:27:29.000Z | 2019-12-02T13:30:47.000Z | examples/keras_parikh_entailment/spacy_hook.py | algteam/spacy_zh_model | 0b0cba1a3964aa426e5f96087849c90e69e2a89d | [
"MIT"
] | null | null | null | examples/keras_parikh_entailment/spacy_hook.py | algteam/spacy_zh_model | 0b0cba1a3964aa426e5f96087849c90e69e2a89d | [
"MIT"
] | 2 | 2019-04-19T06:27:18.000Z | 2019-10-04T12:39:15.000Z | import numpy as np
from keras.models import model_from_json
try:
import cPickle as pickle
except ImportError:
import pickle
class KerasSimilarityShim(object):
entailment_types = ["entailment", "contradiction", "neutral"]
@classmethod
def load(cls, path, nlp, max_length=100, get_feat... | 32.692308 | 86 | 0.606667 | import numpy as np
from keras.models import model_from_json
try:
import cPickle as pickle
except ImportError:
import pickle
class KerasSimilarityShim(object):
entailment_types = ["entailment", "contradiction", "neutral"]
@classmethod
def load(cls, path, nlp, max_length=100, get_feat... | true | true |
f7518416fbf0023780685b2c7e8d36c38502b97c | 3,884 | py | Python | Python38/Lib/site-packages/libfuturize/fixes/fix_raise.py | AXFS-H/Windows10Debloater | ab5f8a8a8fb065bb40b7ddbd1df75563d8b8d13e | [
"MIT"
] | 908 | 2015-01-01T21:20:45.000Z | 2022-03-29T20:47:16.000Z | Python38/Lib/site-packages/libfuturize/fixes/fix_raise.py | AXFS-H/Windows10Debloater | ab5f8a8a8fb065bb40b7ddbd1df75563d8b8d13e | [
"MIT"
] | 402 | 2015-01-04T01:30:19.000Z | 2022-03-24T11:56:38.000Z | env/lib/python3.9/site-packages/libfuturize/fixes/fix_raise.py | simotwo/AbileneParadox-ddd | c85961efb37aba43c0d99ed1c36d083507e2b2d3 | [
"MIT"
] | 305 | 2015-01-18T19:29:37.000Z | 2022-03-24T09:40:09.000Z | """Fixer for 'raise E, V'
From Armin Ronacher's ``python-modernize``.
raise -> raise
raise E -> raise E
raise E, 5 -> raise E(5)
raise E, 5, T -> raise E(5).with_traceback(T)
raise E, None, T -> raise E.with_traceback(T)
raise (((E, E'), E''), E'''), 5 -> raise E(5)
raise "foo", V, T -... | 35.962963 | 80 | 0.538105 |
from lib2to3 import pytree, fixer_base
from lib2to3.pgen2 import token
from lib2to3.fixer_util import Name, Call, is_tuple, Comma, Attr, ArgList
from libfuturize.fixer_util import touch_import_top
class FixRaise(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
raise_stmt< 'raise' exc=any [',' ... | true | true |
f751843c5b910d43262d503ee3432fc7dfc706a3 | 696 | py | Python | 34.py | goldsborough/euler | d0674ac9e9f71318d719c42f91351d40a36acecd | [
"MIT"
] | null | null | null | 34.py | goldsborough/euler | d0674ac9e9f71318d719c42f91351d40a36acecd | [
"MIT"
] | null | null | null | 34.py | goldsborough/euler | d0674ac9e9f71318d719c42f91351d40a36acecd | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
def get_factorials(n):
f = lambda x: x * f(x - 1) if x else 1
return [f(i) for i in range(n)]
def sum_factorial_digits(limit):
factorial = get_factorials(10)
total = 0
digit_sum = 0
order = int(math.log10(limit))
for n in range(3, int(limit)):
digi... | 17.846154 | 39 | 0.623563 |
import math
def get_factorials(n):
f = lambda x: x * f(x - 1) if x else 1
return [f(i) for i in range(n)]
def sum_factorial_digits(limit):
factorial = get_factorials(10)
total = 0
digit_sum = 0
order = int(math.log10(limit))
for n in range(3, int(limit)):
digit = n % 10
if digit == 0:
digit_sum = 0
... | true | true |
f751848313820964a8833b5fe9ef26d616fea781 | 383 | py | Python | algoexpert/easy/BinarySearch.py | dawar-s/algo-ds-sol-python | c455bb43dd68e177e5c744383c2d17888f4efe1b | [
"MIT"
] | null | null | null | algoexpert/easy/BinarySearch.py | dawar-s/algo-ds-sol-python | c455bb43dd68e177e5c744383c2d17888f4efe1b | [
"MIT"
] | null | null | null | algoexpert/easy/BinarySearch.py | dawar-s/algo-ds-sol-python | c455bb43dd68e177e5c744383c2d17888f4efe1b | [
"MIT"
] | null | null | null | def binarySearch(array, target):
return binary_search_helper(array, target, 0, len(array) - 1)
def binary_search_helper(array, target, start, end):
while start <= end:
mid = (start + end) // 2
if array[mid] == target:
return mid
elif array[mid] > target:
end = mi... | 25.533333 | 65 | 0.548303 | def binarySearch(array, target):
return binary_search_helper(array, target, 0, len(array) - 1)
def binary_search_helper(array, target, start, end):
while start <= end:
mid = (start + end) // 2
if array[mid] == target:
return mid
elif array[mid] > target:
end = mi... | true | true |
f75184e8ca477fdec63b6912526505231a962056 | 621 | py | Python | habrpars/tests/conftest.py | mitrofun/habrpars | c789b1a0a60601258488583d1954ad9a11e03917 | [
"MIT"
] | null | null | null | habrpars/tests/conftest.py | mitrofun/habrpars | c789b1a0a60601258488583d1954ad9a11e03917 | [
"MIT"
] | null | null | null | habrpars/tests/conftest.py | mitrofun/habrpars | c789b1a0a60601258488583d1954ad9a11e03917 | [
"MIT"
] | null | null | null | import os
import sys
import pytest
from bs4 import BeautifulSoup
sys.path.insert(0, os.path.abspath('.'))
sys.path.append(os.path.join(os.path.abspath('.'), 'habrpars'))
@pytest.fixture
def page():
path = os.path.abspath('.')
filename = os.path.join(path, 'habrpars', 'fixtures', 'page.html')
return fil... | 20.7 | 70 | 0.694042 | import os
import sys
import pytest
from bs4 import BeautifulSoup
sys.path.insert(0, os.path.abspath('.'))
sys.path.append(os.path.join(os.path.abspath('.'), 'habrpars'))
@pytest.fixture
def page():
path = os.path.abspath('.')
filename = os.path.join(path, 'habrpars', 'fixtures', 'page.html')
return fil... | true | true |
f75185192e9b0da93260c001de06b2f1b828f095 | 5,159 | py | Python | test/python/docker/__init__.py | fredr/podman | 2c510146aa03c74fb00a15bcf81c62b14df9c7ea | [
"Apache-2.0"
] | 8,575 | 2020-07-07T20:13:34.000Z | 2022-03-31T23:54:14.000Z | test/python/docker/__init__.py | fredr/podman | 2c510146aa03c74fb00a15bcf81c62b14df9c7ea | [
"Apache-2.0"
] | 6,911 | 2020-07-07T19:20:47.000Z | 2022-03-31T21:28:02.000Z | test/python/docker/__init__.py | fredr/podman | 2c510146aa03c74fb00a15bcf81c62b14df9c7ea | [
"Apache-2.0"
] | 1,066 | 2020-07-08T10:03:02.000Z | 2022-03-31T20:31:01.000Z | import configparser
import json
import os
import pathlib
import shutil
import subprocess
import tempfile
from docker import DockerClient
from .compat import constant
class Podman(object):
"""
Instances hold the configuration and setup for running podman commands
"""
def __init__(self):
"""I... | 32.446541 | 87 | 0.542159 | import configparser
import json
import os
import pathlib
import shutil
import subprocess
import tempfile
from docker import DockerClient
from .compat import constant
class Podman(object):
def __init__(self):
binary = os.getenv("PODMAN", "bin/podman")
self.cmd = [binary, "--storage-driver=vfs"]
... | true | true |
f7518529d74c4a9b256a5e6fcbeb5d2ae51be081 | 822 | py | Python | venv/Lib/site-packages/stevedore/example/load_as_extension.py | dhina016/OnCV | 2429ba7bc8589e92b2c273af6e8763487e1e05a8 | [
"Unlicense",
"MIT"
] | null | null | null | venv/Lib/site-packages/stevedore/example/load_as_extension.py | dhina016/OnCV | 2429ba7bc8589e92b2c273af6e8763487e1e05a8 | [
"Unlicense",
"MIT"
] | 4 | 2021-03-31T20:05:34.000Z | 2022-01-13T03:08:13.000Z | virtual/lib/python3.6/site-packages/stevedore/example/load_as_extension.py | Mercy-Njoroge/blog | 404336fb0fc8d172ddde8b744042cb3f37d89c65 | [
"MIT"
] | null | null | null | import argparse
from stevedore import extension
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'--width',
default=60,
type=int,
help='maximum output width for text',
)
parsed_args = parser.parse_args()
data = {
'a': 'A',... | 21.631579 | 48 | 0.568127 | import argparse
from stevedore import extension
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'--width',
default=60,
type=int,
help='maximum output width for text',
)
parsed_args = parser.parse_args()
data = {
'a': 'A',... | true | true |
f75186a97bc67da8842edfb0c9171a8aad3347f4 | 310 | py | Python | src/logger.py | neilchristanto/ValDashboard | d62d04020081c114c67d80e52726ad827a180ba0 | [
"MIT"
] | null | null | null | src/logger.py | neilchristanto/ValDashboard | d62d04020081c114c67d80e52726ad827a180ba0 | [
"MIT"
] | null | null | null | src/logger.py | neilchristanto/ValDashboard | d62d04020081c114c67d80e52726ad827a180ba0 | [
"MIT"
] | null | null | null | import logging
def setup():
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logger = logging.getLogger('root')
logger.setLevel(logging.INFO)
logger.addHandler(handler)
| 25.833333 | 90 | 0.664516 | import logging
def setup():
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logger = logging.getLogger('root')
logger.setLevel(logging.INFO)
logger.addHandler(handler)
| true | true |
f7518891c4978b63a0940978ed6e938a41560e6a | 403 | py | Python | lesson15/template_test/template_test/wsgi.py | drednout/letspython | 9747442d63873b5f71e2c15ed5528bd98ad5ac31 | [
"BSD-2-Clause"
] | 1 | 2015-11-26T15:53:58.000Z | 2015-11-26T15:53:58.000Z | lesson15/template_test/template_test/wsgi.py | drednout/letspython | 9747442d63873b5f71e2c15ed5528bd98ad5ac31 | [
"BSD-2-Clause"
] | null | null | null | lesson15/template_test/template_test/wsgi.py | drednout/letspython | 9747442d63873b5f71e2c15ed5528bd98ad5ac31 | [
"BSD-2-Clause"
] | null | null | null | """
WSGI config for template_test project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | 23.705882 | 78 | 0.791563 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "template_test.settings")
application = get_wsgi_application()
| true | true |
f7518939fa39f6b97f5ad00f5a33b2e60c21bb89 | 5,578 | py | Python | train.py | nabeelyousfi/MyoEmg | c819712d93bfb58828b36669e55cd4d77453c1cf | [
"MIT"
] | 3 | 2019-10-22T01:58:42.000Z | 2021-04-22T07:47:55.000Z | train.py | nabeelyousfi/MyoEmg | c819712d93bfb58828b36669e55cd4d77453c1cf | [
"MIT"
] | null | null | null | train.py | nabeelyousfi/MyoEmg | c819712d93bfb58828b36669e55cd4d77453c1cf | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 29 13:39:13 2018
@author: Hassan Yousuf & Nabeel Hussain
"""
from __future__ import print_function
import sklearn.ensemble
from sklearn import metrics
from myo import init, Hub, DeviceListener, StreamEmg
from time import sleep
import numpy as np
import threading
import co... | 22.954733 | 114 | 0.571352 |
from __future__ import print_function
import sklearn.ensemble
from sklearn import metrics
from myo import init, Hub, DeviceListener, StreamEmg
from time import sleep
import numpy as np
import threading
import collections
import _pickle as cPickle
def unison_shuffled_copies(a, b):
assert len(a) == len(b)
p =... | true | true |
f7518acc9b376aa822bc44150a21860b8a8e798b | 1,245 | py | Python | EmailSender.py | VirajVShetty/Coronavirus-Update | d3fd6fca4046ccf3c4943e1fda4b1ed2c7dfca49 | [
"MIT"
] | 1 | 2022-02-03T05:14:22.000Z | 2022-02-03T05:14:22.000Z | EmailSender.py | VirajVShetty/Coronavirus-Update | d3fd6fca4046ccf3c4943e1fda4b1ed2c7dfca49 | [
"MIT"
] | null | null | null | EmailSender.py | VirajVShetty/Coronavirus-Update | d3fd6fca4046ccf3c4943e1fda4b1ed2c7dfca49 | [
"MIT"
] | null | null | null | #!/usr/bin/python
""" Authors - Akshay Sonawane and Viraj Shetty """
import smtplib
from Corona_Updates import update
sender = 'corona.updates.av.2020@gmail.com'
receivers = ['akshaysonawane10526@gmail.com', 'virajshetty1@hotmail.com']
pwd = 'sakecboys-akvi'
if __name__ == "__main__":
india_list, india_percent... | 28.295455 | 141 | 0.615261 |
import smtplib
from Corona_Updates import update
sender = 'corona.updates.av.2020@gmail.com'
receivers = ['akshaysonawane10526@gmail.com', 'virajshetty1@hotmail.com']
pwd = 'sakecboys-akvi'
if __name__ == "__main__":
india_list, india_percent, maha_list, maha_percent = update()
message = """From: From Pe... | true | true |
f7518ad37eb1105e798d11095b8112277a779307 | 92 | py | Python | {{ cookiecutter.repo_name }}/virtualenv/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/context_processors.py | pspierce/django-docker-virtualenv-mezzanine-coookiecutter | a9889793e4d3d20b374ca9c56ac069d3f31b0b22 | [
"BSD-2-Clause"
] | 35 | 2015-03-23T10:47:51.000Z | 2021-08-30T15:55:27.000Z | backend/configuration/context_processors.py | victor-42/pws-secrets | 108aa442801e2133a954a3e55054c0a12e7f563b | [
"MIT"
] | 4 | 2015-03-21T23:33:25.000Z | 2021-06-10T21:05:41.000Z | backend/configuration/context_processors.py | victor-42/pws-secrets | 108aa442801e2133a954a3e55054c0a12e7f563b | [
"MIT"
] | 12 | 2015-04-03T01:49:52.000Z | 2018-08-27T22:19:52.000Z | from django.conf import settings
def debug(context):
return {'DEBUG': settings.DEBUG}
| 15.333333 | 36 | 0.728261 | from django.conf import settings
def debug(context):
return {'DEBUG': settings.DEBUG}
| true | true |
f7518ae6919374a255c89e9e3e873d7f90284af0 | 25,493 | py | Python | sherlock.py | alwakri3333/sherlock | e4d4224893a2d1f3c28e8cf6dd6c20dd3b2e1a8c | [
"MIT"
] | null | null | null | sherlock.py | alwakri3333/sherlock | e4d4224893a2d1f3c28e8cf6dd6c20dd3b2e1a8c | [
"MIT"
] | null | null | null | sherlock.py | alwakri3333/sherlock | e4d4224893a2d1f3c28e8cf6dd6c20dd3b2e1a8c | [
"MIT"
] | null | null | null | #! /usr/bin/env python3
"""
Sherlock: Find Usernames Across Social Networks Module
This module contains the main logic to search for usernames at social
networks.
"""
import csv
import json
import os
import platform
import re
import sys
import random
from argparse import ArgumentParser, RawDescriptionHelpFormatter
f... | 41.929276 | 163 | 0.57961 |
import csv
import json
import os
import platform
import re
import sys
import random
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from concurrent.futures import ThreadPoolExecutor
from time import time
import requests
from colorama import Fore, Style, init
from requests_futures.sessions import F... | true | true |
f7518bc3e51cdac9aa17ba4625c6ff93e24d276b | 222 | py | Python | scripts/init.py | nullzero/wprobot | 1677d09e11e51a0200e54778dd0071770bfa6a51 | [
"MIT"
] | 1 | 2021-04-15T06:25:03.000Z | 2021-04-15T06:25:03.000Z | scripts/init.py | nullzero/wprobot | 1677d09e11e51a0200e54778dd0071770bfa6a51 | [
"MIT"
] | null | null | null | scripts/init.py | nullzero/wprobot | 1677d09e11e51a0200e54778dd0071770bfa6a51 | [
"MIT"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
if "WPROBOT_DIR" not in os.environ:
import sys
sys.path.append(os.path.abspath(
os.path.join(os.path.dirname(__file__), "..")))
import wprobot
| 20.181818 | 59 | 0.612613 |
import os
if "WPROBOT_DIR" not in os.environ:
import sys
sys.path.append(os.path.abspath(
os.path.join(os.path.dirname(__file__), "..")))
import wprobot
| true | true |
f7518d0f0d57f9546b44e6bd0d9697b7fa8e3056 | 33,147 | py | Python | dev/tasks/crossbow.py | DavisVaughan/arrow | 0568544531437366d3b6ded87f6f9ced8d749d72 | [
"Apache-2.0"
] | null | null | null | dev/tasks/crossbow.py | DavisVaughan/arrow | 0568544531437366d3b6ded87f6f9ced8d749d72 | [
"Apache-2.0"
] | null | null | null | dev/tasks/crossbow.py | DavisVaughan/arrow | 0568544531437366d3b6ded87f6f9ced8d749d72 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# 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
# "L... | 35.337953 | 79 | 0.600537 |
import os
import re
import time
import click
import hashlib
import gnupg
import toolz
import pygit2
import github3
import jira.client
from io import StringIO
from pathlib import Path
from textwrap import dedent
from datetime import datetime
from jinja2 import Template, StrictUndefined
from setuptool... | true | true |
f7518d15c29b584de3322bff7a21ec5d09f86d6f | 87 | py | Python | contests_atcoder/abc156/abc156_b.py | takelifetime/competitive-programming | e7cf8ef923ccefad39a1727ca94c610d650fcb76 | [
"BSD-2-Clause"
] | null | null | null | contests_atcoder/abc156/abc156_b.py | takelifetime/competitive-programming | e7cf8ef923ccefad39a1727ca94c610d650fcb76 | [
"BSD-2-Clause"
] | 1 | 2021-01-02T06:36:51.000Z | 2021-01-02T06:36:51.000Z | contests_atcoder/abc156/abc156_b.py | takelifetime/competitive-programming | e7cf8ef923ccefad39a1727ca94c610d650fcb76 | [
"BSD-2-Clause"
] | null | null | null | n, k = map(int, input().split())
ans = 0
while n:
n //= k
ans += 1
print(ans) | 10.875 | 32 | 0.482759 | n, k = map(int, input().split())
ans = 0
while n:
n //= k
ans += 1
print(ans) | true | true |
f7518d1c1514c0957629ca60d8170a36f9d3e6cc | 854 | py | Python | tests/test_api.py | mcstro/natural-neighbor-interpolation | 76ba7bb50c84aef35e993902c46824e5991df45d | [
"MIT"
] | 64 | 2017-09-17T00:37:20.000Z | 2022-02-03T20:16:54.000Z | tests/test_api.py | mcstro/natural-neighbor-interpolation | 76ba7bb50c84aef35e993902c46824e5991df45d | [
"MIT"
] | 5 | 2018-07-27T16:31:35.000Z | 2020-06-15T02:53:48.000Z | tests/test_api.py | mcstro/natural-neighbor-interpolation | 76ba7bb50c84aef35e993902c46824e5991df45d | [
"MIT"
] | 13 | 2018-06-06T18:51:50.000Z | 2021-12-26T02:47:05.000Z | import scipy.interpolate
import numpy as np
import pytest
import naturalneighbor
@pytest.mark.parametrize("grid_ranges", [
[[0, 4, 0.6], [-3, 3, 1.0], [0, 1, 3]],
[[0, 2, 1], [0, 2, 1j], [0, 2, 2j]],
[[0, 2, 1 + 1j], [0, 2, -10j], [0, 2, 2j]],
[[0, 2, 1 + 1j], [0, 2, -0.9j], [0, 2, 2.1j]],
])
def tes... | 30.5 | 73 | 0.617096 | import scipy.interpolate
import numpy as np
import pytest
import naturalneighbor
@pytest.mark.parametrize("grid_ranges", [
[[0, 4, 0.6], [-3, 3, 1.0], [0, 1, 3]],
[[0, 2, 1], [0, 2, 1j], [0, 2, 2j]],
[[0, 2, 1 + 1j], [0, 2, -10j], [0, 2, 2j]],
[[0, 2, 1 + 1j], [0, 2, -0.9j], [0, 2, 2.1j]],
])
def tes... | true | true |
f7518d47bcf3dcd5f5aece5e69810c7101d8cd0f | 841 | py | Python | setup.py | pangbo13/HeadersFormatter | e4fac6ab0b9d7973447c36b0fff23832f2954f3d | [
"MIT"
] | null | null | null | setup.py | pangbo13/HeadersFormatter | e4fac6ab0b9d7973447c36b0fff23832f2954f3d | [
"MIT"
] | null | null | null | setup.py | pangbo13/HeadersFormatter | e4fac6ab0b9d7973447c36b0fff23832f2954f3d | [
"MIT"
] | null | null | null | import setuptools
with open('README.md','r',encoding='utf-8') as fh:
long_description = fh.read()
setuptools.setup(
name = 'HeadersFormatter',
version = '0.0.2',
author = 'pangbo',
author_email = '373108669@qq.com',
description = 'Format headers in clipboard to <dict>.',
long_de... | 32.346154 | 60 | 0.636147 | import setuptools
with open('README.md','r',encoding='utf-8') as fh:
long_description = fh.read()
setuptools.setup(
name = 'HeadersFormatter',
version = '0.0.2',
author = 'pangbo',
author_email = '373108669@qq.com',
description = 'Format headers in clipboard to <dict>.',
long_de... | true | true |
f7518e0211a460f0f8b0f92f85a83a01e8b7d2cd | 876 | py | Python | manager/subsite_urls.py | willArrive/brand-manager | 8fc9b07921b970e88c2e2abd2a69c0e8a27ad212 | [
"MIT"
] | 3 | 2016-11-17T14:21:25.000Z | 2019-11-15T16:25:11.000Z | manager/subsite_urls.py | willArrive/brand-manager | 8fc9b07921b970e88c2e2abd2a69c0e8a27ad212 | [
"MIT"
] | null | null | null | manager/subsite_urls.py | willArrive/brand-manager | 8fc9b07921b970e88c2e2abd2a69c0e8a27ad212 | [
"MIT"
] | 1 | 2016-12-19T23:32:48.000Z | 2016-12-19T23:32:48.000Z | from django.conf.urls import patterns, include, url
from django.contrib import admin
from tastypie.api import Api
from manager.apps.brand.api import BrandResource # [#58] , BrandOwnerResource
from django.conf import settings
admin.autodiscover()
v1_api = Api(api_name='v1')
v1_api.register(BrandResource())
# Postpone... | 27.375 | 78 | 0.676941 | from django.conf.urls import patterns, include, url
from django.contrib import admin
from tastypie.api import Api
from manager.apps.brand.api import BrandResource settings
admin.autodiscover()
v1_api = Api(api_name='v1')
v1_api.register(BrandResource())
urlpatterns = patterns(
'',
url(r'^api/', include(v1_a... | true | true |
f7518e2b854edd0868e8c9548138cbabff19c73b | 1,484 | py | Python | 2021_1/sql_principle/prac_1/src/upload_geodata.py | Ahtkom/hello-world | 3a81bd25713513836c9242fe943b171ff731cfce | [
"MIT"
] | null | null | null | 2021_1/sql_principle/prac_1/src/upload_geodata.py | Ahtkom/hello-world | 3a81bd25713513836c9242fe943b171ff731cfce | [
"MIT"
] | null | null | null | 2021_1/sql_principle/prac_1/src/upload_geodata.py | Ahtkom/hello-world | 3a81bd25713513836c9242fe943b171ff731cfce | [
"MIT"
] | null | null | null | import numpy as np
import pandas as pd
import psycopg2, sys
hostname, user, dbname, passward = sys.argv[1:5]
def load_data():
lon0, lat0 = 115.8, 29.4
x = pd.read_excel('../data/x.xlsx', header=0, index_col=0).values
y = pd.read_excel('../data/y.xlsx', header=0, index_col=0).values
lon = lon0 + ... | 31.574468 | 87 | 0.565364 | import numpy as np
import pandas as pd
import psycopg2, sys
hostname, user, dbname, passward = sys.argv[1:5]
def load_data():
lon0, lat0 = 115.8, 29.4
x = pd.read_excel('../data/x.xlsx', header=0, index_col=0).values
y = pd.read_excel('../data/y.xlsx', header=0, index_col=0).values
lon = lon0 + ... | true | true |
f7518e49f4844baf09d5ced73c81065ff636825e | 565 | py | Python | PythonCursoEmVideo/Cores.py | FlavioGalera/pythonProject | 73a5f99d9bfa3ebed6f02dc41e534d1ab6b8bb10 | [
"MIT"
] | null | null | null | PythonCursoEmVideo/Cores.py | FlavioGalera/pythonProject | 73a5f99d9bfa3ebed6f02dc41e534d1ab6b8bb10 | [
"MIT"
] | null | null | null | PythonCursoEmVideo/Cores.py | FlavioGalera/pythonProject | 73a5f99d9bfa3ebed6f02dc41e534d1ab6b8bb10 | [
"MIT"
] | null | null | null | '''
style text background(fundo)
0 = sem estilo 30 =branco 40 =branco
1 = negrito 31 =vermelho 41 =vermelho
4 = sublinhado 32 =verde 42 =verde
7 = iverte cores 33 =amarelo 43 =amarelo
... | 43.461538 | 61 | 0.384071 | print('\033[1;37;46mOlá, mundo!\033[m')
| true | true |
f7518ee64b9f9f3755d18eb2c751c6f6f0c78cff | 1,215 | py | Python | django_messages_framework/storage/session.py | none-da/zeshare | 6c13cd3bd9d82d89f53d4a8b287fe2c30f1d3779 | [
"BSD-3-Clause"
] | null | null | null | django_messages_framework/storage/session.py | none-da/zeshare | 6c13cd3bd9d82d89f53d4a8b287fe2c30f1d3779 | [
"BSD-3-Clause"
] | null | null | null | django_messages_framework/storage/session.py | none-da/zeshare | 6c13cd3bd9d82d89f53d4a8b287fe2c30f1d3779 | [
"BSD-3-Clause"
] | 1 | 2021-04-12T11:43:38.000Z | 2021-04-12T11:43:38.000Z | from django_messages_framework.storage.base import BaseStorage
class SessionStorage(BaseStorage):
"""
Stores messages in the session (that is, django.contrib.sessions).
"""
session_key = '_messages'
def __init__(self, request, *args, **kwargs):
assert hasattr(request, 'session'), "The ses... | 35.735294 | 78 | 0.637037 | from django_messages_framework.storage.base import BaseStorage
class SessionStorage(BaseStorage):
session_key = '_messages'
def __init__(self, request, *args, **kwargs):
assert hasattr(request, 'session'), "The session-based temporary "\
"message storage requires session middleware to be ... | true | true |
f7518f7d50829efa1812bffb6ba6b29ea11fdebd | 14,340 | py | Python | applications/incompressible_fluid_application/python_scripts/edgebased_levelset_substep_solver.py | lcirrott/Kratos | 8406e73e0ad214c4f89df4e75e9b29d0eb4a47ea | [
"BSD-4-Clause"
] | 2 | 2019-10-25T09:28:10.000Z | 2019-11-21T12:51:46.000Z | applications/incompressible_fluid_application/python_scripts/edgebased_levelset_substep_solver.py | lcirrott/Kratos | 8406e73e0ad214c4f89df4e75e9b29d0eb4a47ea | [
"BSD-4-Clause"
] | 13 | 2019-10-07T12:06:51.000Z | 2020-02-18T08:48:33.000Z | applications/incompressible_fluid_application/python_scripts/edgebased_levelset_substep_solver.py | lcirrott/Kratos | 8406e73e0ad214c4f89df4e75e9b29d0eb4a47ea | [
"BSD-4-Clause"
] | null | null | null | from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7
# importing the Kratos Library
from KratosMultiphysics import *
from KratosMultiphysics.IncompressibleFluidApplication import *
from KratosMultiphysics.MeshingApplication import *
def ... | 36.675192 | 134 | 0.628033 | from __future__ import print_function, absolute_import, division
from KratosMultiphysics import *
from KratosMultiphysics.IncompressibleFluidApplication import *
from KratosMultiphysics.MeshingApplication import *
def AddVariables(model_part):
model_part.AddNodalSolutionStepVariable(VELOCITY)
model_part.AddN... | true | true |
f751902f3e982ffd5695a5a2b355aef7e5d3c349 | 21,485 | py | Python | google/cloud/compute_v1/services/firewalls/transports/rest.py | Ctfbuster/python-compute | 7a9e8324e08c46a93050908760b2b5aca054a863 | [
"Apache-2.0"
] | 19 | 2021-02-10T21:17:20.000Z | 2022-02-20T03:16:36.000Z | google/cloud/compute_v1/services/firewalls/transports/rest.py | Ctfbuster/python-compute | 7a9e8324e08c46a93050908760b2b5aca054a863 | [
"Apache-2.0"
] | 121 | 2021-01-08T23:46:58.000Z | 2022-03-26T04:34:36.000Z | google/cloud/compute_v1/services/firewalls/transports/rest.py | Ctfbuster/python-compute | 7a9e8324e08c46a93050908760b2b5aca054a863 | [
"Apache-2.0"
] | 20 | 2021-01-08T23:14:16.000Z | 2022-02-25T01:27:20.000Z | # -*- coding: utf-8 -*-
# Copyright 2020 Google 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 applicable law or... | 40.158879 | 96 | 0.611915 |
import warnings
from typing import Callable, Dict, Optional, Sequence, Tuple
from google.api_core import gapic_v1
from google.api_core import exceptions as core_exceptions
from google.auth import credentials as ga_credentials
from google.auth.transport.grpc import SslCredentials
import grpc
... | true | true |
f7519096be759c1b15b7d0e4ae610b0c5c3ec70b | 785 | py | Python | deploy/aws.py | Austin-Schmidli/Image-Metadata-API | 73e7f9cbcd397d6aefe53a75dbb9ff4e6a924f7d | [
"MIT"
] | null | null | null | deploy/aws.py | Austin-Schmidli/Image-Metadata-API | 73e7f9cbcd397d6aefe53a75dbb9ff4e6a924f7d | [
"MIT"
] | null | null | null | deploy/aws.py | Austin-Schmidli/Image-Metadata-API | 73e7f9cbcd397d6aefe53a75dbb9ff4e6a924f7d | [
"MIT"
] | null | null | null | import argparse
import boto3
"""Helper module to assist in AWS deployments"""
def get_lambda_client(
aws_access_key_id: str, aws_secret_access_key: str, aws_region: str
) -> boto3.client:
return boto3.client(
"lambda",
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_se... | 26.166667 | 82 | 0.703185 | import argparse
import boto3
def get_lambda_client(
aws_access_key_id: str, aws_secret_access_key: str, aws_region: str
) -> boto3.client:
return boto3.client(
"lambda",
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
region_name=aws_region,
... | true | true |
f75190f721a7a771cdf499fe8d13b52923007344 | 57,459 | py | Python | electrum/network.py | mgrychow/electrum-vault | a15b0fc5db4e83801cd7f1ba3defd56daa0b058a | [
"MIT"
] | 8 | 2020-03-18T21:55:38.000Z | 2021-03-01T12:54:47.000Z | electrum/network.py | mgrychow/electrum-vault | a15b0fc5db4e83801cd7f1ba3defd56daa0b058a | [
"MIT"
] | 6 | 2020-07-10T13:17:21.000Z | 2021-04-26T11:47:22.000Z | electrum/network.py | mgrychow/electrum-vault | a15b0fc5db4e83801cd7f1ba3defd56daa0b058a | [
"MIT"
] | 8 | 2020-05-10T11:04:15.000Z | 2021-05-06T14:51:46.000Z | # Electrum - Lightweight Bitcoin Client
# Copyright (c) 2011-2016 Thomas Voegtlin
#
# 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 restriction,
# including without limitation the rig... | 43.202256 | 130 | 0.629005 |
import time
import queue
import os
import random
import re
from collections import defaultdict
import threading
import socket
import json
import sys
import ipaddress
import asyncio
from typing import NamedTuple, Optional, Sequence, List, Dict, Tuple, TYPE_CHECKING
import traceback
import dns
impo... | true | true |
f751910b42c511e6b4134312b98a5f1af4855a59 | 4,020 | py | Python | server/__init__.py | weizhongtan/spotify-playlist-tools | 92e151343bb0953ef9f6149d4591c16d146895d7 | [
"MIT"
] | null | null | null | server/__init__.py | weizhongtan/spotify-playlist-tools | 92e151343bb0953ef9f6149d4591c16d146895d7 | [
"MIT"
] | null | null | null | server/__init__.py | weizhongtan/spotify-playlist-tools | 92e151343bb0953ef9f6149d4591c16d146895d7 | [
"MIT"
] | null | null | null | from flask import Flask, url_for, redirect, render_template, request, make_response, session, jsonify
from flask_session import Session
from flask_caching import Cache
from dotenv import load_dotenv
import os
import spotipy
from spotipy.oauth2 import SpotifyOAuth
from spotipy.cache_handler import CacheFileHandler
impor... | 30.454545 | 101 | 0.664428 | from flask import Flask, url_for, redirect, render_template, request, make_response, session, jsonify
from flask_session import Session
from flask_caching import Cache
from dotenv import load_dotenv
import os
import spotipy
from spotipy.oauth2 import SpotifyOAuth
from spotipy.cache_handler import CacheFileHandler
impor... | true | true |
f7519313e60b035c69184fe1fd027f49357ac3d8 | 7,266 | py | Python | jcvi/assembly/pbjelly.py | fossabot/jcvi | 86948affd63e94c8327cf117c47d36940b508b68 | [
"BSD-2-Clause"
] | 1 | 2020-10-04T13:21:24.000Z | 2020-10-04T13:21:24.000Z | jcvi/assembly/pbjelly.py | Wangjien/jcvi | 6732285f62dcbd7f3878e5017c3350124530c796 | [
"BSD-2-Clause"
] | null | null | null | jcvi/assembly/pbjelly.py | Wangjien/jcvi | 6732285f62dcbd7f3878e5017c3350124530c796 | [
"BSD-2-Clause"
] | 1 | 2020-11-16T19:25:30.000Z | 2020-11-16T19:25:30.000Z | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Run PBJelly on reference FASTA and a set of patching reads. Sometimes patching
'reads' can also be contigs, which require setting the blasr criteria to be
higher in `Protocol.xml`.
"""
from __future__ import print_function
import os
import os.path as op
import sys
imp... | 29.064 | 90 | 0.601018 |
from __future__ import print_function
import os
import os.path as op
import sys
import logging
from collections import defaultdict
from jcvi.formats.base import must_open
from jcvi.utils.cbook import percentage
from jcvi.apps.base import OptionParser, ActionDispatcher, sh, which
class Protocol (object):
de... | true | true |
f7519424f74fd80733985e44f57945b738f91814 | 3,215 | py | Python | metroverse/metroblocks/pages/boost.py | ipince/nftools | 8a011884c4a257952ec32b8f13e3fd3bd6bbaaa5 | [
"MIT"
] | 2 | 2022-01-26T22:42:09.000Z | 2022-01-27T20:20:06.000Z | metroverse/metroblocks/pages/boost.py | ipince/nftools | 8a011884c4a257952ec32b8f13e3fd3bd6bbaaa5 | [
"MIT"
] | null | null | null | metroverse/metroblocks/pages/boost.py | ipince/nftools | 8a011884c4a257952ec32b8f13e3fd3bd6bbaaa5 | [
"MIT"
] | null | null | null | from . import util
from engine import metroverse as mv
def render_boosts(blocks=None, highlight=False, render_stacked=False):
active_boosts = mv.active_boosts(blocks)
names = set()
if blocks is not None:
for block in blocks:
names.update(block['buildings']['all'].keys())
large_ho... | 37.383721 | 133 | 0.536858 | from . import util
from engine import metroverse as mv
def render_boosts(blocks=None, highlight=False, render_stacked=False):
active_boosts = mv.active_boosts(blocks)
names = set()
if blocks is not None:
for block in blocks:
names.update(block['buildings']['all'].keys())
large_ho... | true | true |
f75194687283cbcb8abc63a41333e55cc7b31303 | 978 | py | Python | notes-n-resources/Data-Structures-N-Algo/_DS-n-Algos/_Another-One/sorts/topological_sort.py | side-projects-42/INTERVIEW-PREP-COMPLETE | 627a3315cee4bbc38a0e81c256f27f928eac2d63 | [
"MIT"
] | 13 | 2021-03-11T00:25:22.000Z | 2022-03-19T00:19:23.000Z | notes-n-resources/Data-Structures-N-Algo/_DS-n-Algos/_Another-One/sorts/topological_sort.py | side-projects-42/INTERVIEW-PREP-COMPLETE | 627a3315cee4bbc38a0e81c256f27f928eac2d63 | [
"MIT"
] | 160 | 2021-04-26T19:04:15.000Z | 2022-03-26T20:18:37.000Z | notes-n-resources/Data-Structures-N-Algo/_DS-n-Algos/_Another-One/sorts/topological_sort.py | side-projects-42/INTERVIEW-PREP-COMPLETE | 627a3315cee4bbc38a0e81c256f27f928eac2d63 | [
"MIT"
] | 12 | 2021-04-26T19:43:01.000Z | 2022-01-31T08:36:29.000Z | from __future__ import print_function
# a
# / \
# b c
# / \
# d e
edges = {"a": ["c", "b"], "b": ["d", "e"], "c": [], "d": [], "e": []}
vertices = ["a", "b", "c", "d", "e"]
def topological_sort(start, visited, sort):
"""Perform topolical sort on a directed acyclic graph."""
current = start
# ... | 27.942857 | 69 | 0.595092 | from __future__ import print_function
edges = {"a": ["c", "b"], "b": ["d", "e"], "c": [], "d": [], "e": []}
vertices = ["a", "b", "c", "d", "e"]
def topological_sort(start, visited, sort):
current = start
visited.append(current)
neighbors = edges[current]
for neighbor in neighbors:
... | true | true |
f751965f7bee401402b19d6a219dbf201b2763c0 | 3,398 | py | Python | configs/ttfnet/ttfnet_r18_ciou_wh1_1x.py | mrsempress/mmdetection | cb650560c97a2fe56a9b369a1abc8ec17e06583a | [
"Apache-2.0"
] | null | null | null | configs/ttfnet/ttfnet_r18_ciou_wh1_1x.py | mrsempress/mmdetection | cb650560c97a2fe56a9b369a1abc8ec17e06583a | [
"Apache-2.0"
] | null | null | null | configs/ttfnet/ttfnet_r18_ciou_wh1_1x.py | mrsempress/mmdetection | cb650560c97a2fe56a9b369a1abc8ec17e06583a | [
"Apache-2.0"
] | null | null | null | # model settings
model = dict(
type='TTFNet',
pretrained='modelzoo://resnet18',
backbone=dict(
type='ResNet',
depth=18,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_eval=False,
style='pytorch'),
neck=None,
bbox_head=dict(
... | 29.807018 | 77 | 0.630959 |
model = dict(
type='TTFNet',
pretrained='modelzoo://resnet18',
backbone=dict(
type='ResNet',
depth=18,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_eval=False,
style='pytorch'),
neck=None,
bbox_head=dict(
type='TTFHead... | true | true |
f75197db0d5043fe351ad2be154d400c859209b0 | 965 | py | Python | setup.py | refnode/spartakiade-2021-session-effective-python | 6b1a25c4ec79261de4ed6385a81b6a31a06d6b58 | [
"Apache-2.0"
] | 1 | 2021-06-04T14:05:31.000Z | 2021-06-04T14:05:31.000Z | setup.py | refnode/spartakiade-2021-session-effective-python | 6b1a25c4ec79261de4ed6385a81b6a31a06d6b58 | [
"Apache-2.0"
] | null | null | null | setup.py | refnode/spartakiade-2021-session-effective-python | 6b1a25c4ec79261de4ed6385a81b6a31a06d6b58 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
"""The setup script."""
from setuptools import setup, find_packages
with open("README.adoc") as fh_readme:
readme = fh_readme.read()
install_reqs = []
setup(
author="Sven Wilhelm",
author_email='refnode@gmail.com',
python_requires='>=3.8',
classifiers=[
'Developmen... | 28.382353 | 79 | 0.675648 |
from setuptools import setup, find_packages
with open("README.adoc") as fh_readme:
readme = fh_readme.read()
install_reqs = []
setup(
author="Sven Wilhelm",
author_email='refnode@gmail.com',
python_requires='>=3.8',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended... | true | true |
f75198e7da17193e4c057e3b1054add8fc28cf8d | 3,947 | py | Python | app/core/tests/test_user_api.py | rishitapotluri/recipe-app-api | a65484f02c30b4c7250f074f4bcee76677785099 | [
"MIT"
] | null | null | null | app/core/tests/test_user_api.py | rishitapotluri/recipe-app-api | a65484f02c30b4c7250f074f4bcee76677785099 | [
"MIT"
] | null | null | null | app/core/tests/test_user_api.py | rishitapotluri/recipe-app-api | a65484f02c30b4c7250f074f4bcee76677785099 | [
"MIT"
] | null | null | null | from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
CREATE_USER_URL = reverse('user:create')
TOKEN_URL = reverse('user:token')
def create_user(**params):
return get_user_model()... | 37.590476 | 77 | 0.633899 | from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
CREATE_USER_URL = reverse('user:create')
TOKEN_URL = reverse('user:token')
def create_user(**params):
return get_user_model()... | true | true |
f7519957122972e97f97fa77a4d8fe66642b4371 | 2,009 | py | Python | TimeWrapper_JE/venv/Lib/site-packages/pygments/filter.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | TimeWrapper_JE/venv/Lib/site-packages/pygments/filter.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | TimeWrapper_JE/venv/Lib/site-packages/pygments/filter.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | """
pygments.filter
~~~~~~~~~~~~~~~
Module that implements the default filter.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
def apply_filters(stream, filters, lexer=None):
"""
Use this method to apply an itera... | 27.902778 | 71 | 0.605276 |
def apply_filters(stream, filters, lexer=None):
def _apply(filter_, stream):
yield from filter_.filter(lexer, stream)
for filter_ in filters:
stream = _apply(filter_, stream)
return stream
def simplefilter(f):
return type(f.__name__, (FunctionFilter,), {
'__module... | true | true |
f75199dee264bbd9684b8c372ddf97bb6e2be2ba | 492 | py | Python | exercises/es/solution_01_08_01.py | Jette16/spacy-course | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | [
"MIT"
] | 2,085 | 2019-04-17T13:10:40.000Z | 2022-03-30T21:51:46.000Z | exercises/es/solution_01_08_01.py | Jette16/spacy-course | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | [
"MIT"
] | 79 | 2019-04-18T14:42:55.000Z | 2022-03-07T08:15:43.000Z | exercises/es/solution_01_08_01.py | Jette16/spacy-course | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | [
"MIT"
] | 361 | 2019-04-17T13:34:32.000Z | 2022-03-28T04:42:45.000Z | import spacy
nlp = spacy.load("es_core_news_sm")
text = (
"De acuerdo con la revista Fortune, Apple fue la empresa "
"más admirada en el mundo entre 2008 y 2012."
)
# Procesa el texto
doc = nlp(text)
for token in doc:
# Obtén el texto del token, el part-of-speech tag y el dependency label
token_text... | 24.6 | 75 | 0.676829 | import spacy
nlp = spacy.load("es_core_news_sm")
text = (
"De acuerdo con la revista Fortune, Apple fue la empresa "
"más admirada en el mundo entre 2008 y 2012."
)
doc = nlp(text)
for token in doc:
token_text = token.text
token_pos = token.pos_
token_dep = token.dep_
print("{:<12... | true | true |
f7519a0ffb4a8006e01f0a3e5817cebfc9655aa4 | 34,537 | py | Python | lib/cgi_tweaked.py | notbryant/eyebrows | 7fec17b50f1b4838559d66138603c96dcb03bb23 | [
"MIT"
] | null | null | null | lib/cgi_tweaked.py | notbryant/eyebrows | 7fec17b50f1b4838559d66138603c96dcb03bb23 | [
"MIT"
] | null | null | null | lib/cgi_tweaked.py | notbryant/eyebrows | 7fec17b50f1b4838559d66138603c96dcb03bb23 | [
"MIT"
] | null | null | null | #! /usr/local/bin/python
# NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is
# intentionally NOT "/usr/bin/env python". On many systems
# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
# scripts, and /usr/local/bin is the default directory where Python is
# installed, so /usr/bin/env w... | 33.563654 | 79 | 0.579813 |
__version__ = "2.6"
from io import StringIO, BytesIO, TextIOWrapper
import sys
import os
import urllib.parse
from email.parser import FeedParser
from warnings import warn
import html
import locale
import tempfile
__all__ = ["MiniFieldStorage", "FieldStorage",
"parse", "parse_qs", ... | true | true |
f7519bd3f02c358f80ede1ddeb4536e43ac1a99b | 3,578 | py | Python | webcraft/apiview.py | fossabot/webcraft | 364da90f1742bfc36b6d65f6dc888f3e448cfcda | [
"BSD-3-Clause"
] | 3 | 2018-10-29T23:00:04.000Z | 2020-09-30T00:50:42.000Z | webcraft/apiview.py | fossabot/webcraft | 364da90f1742bfc36b6d65f6dc888f3e448cfcda | [
"BSD-3-Clause"
] | 30 | 2018-11-17T05:44:26.000Z | 2021-06-25T15:21:58.000Z | webcraft/apiview.py | fossabot/webcraft | 364da90f1742bfc36b6d65f6dc888f3e448cfcda | [
"BSD-3-Clause"
] | 2 | 2018-11-17T05:41:41.000Z | 2019-07-23T13:29:48.000Z | import datetime
import decimal
from json import dumps
from aiohttp import web
from sqlalchemy import select, delete, update, insert
from sqlalchemy import desc
def alchemyencoder(obj):
"""JSON encoder function for SQLAlchemy special classes."""
if isinstance(obj, datetime.date):
return obj.isoformat(... | 31.113043 | 75 | 0.542761 | import datetime
import decimal
from json import dumps
from aiohttp import web
from sqlalchemy import select, delete, update, insert
from sqlalchemy import desc
def alchemyencoder(obj):
if isinstance(obj, datetime.date):
return obj.isoformat()
elif isinstance(obj, decimal.Decimal):
return floa... | true | true |
f7519c8dfa18c9dc0cbcca005004dfcf97480390 | 4,212 | py | Python | pyshard/shard/shard.py | la9ran9e/pyshard | 99a345e01c9e949720c345ed142cae9c7d2839f7 | [
"MIT"
] | 6 | 2019-07-11T14:08:41.000Z | 2021-04-11T03:33:10.000Z | pyshard/shard/shard.py | la9ran9e/pyshard | 99a345e01c9e949720c345ed142cae9c7d2839f7 | [
"MIT"
] | 2 | 2019-07-19T20:07:32.000Z | 2022-02-12T10:17:52.000Z | pyshard/shard/shard.py | la9ran9e/pyshard | 99a345e01c9e949720c345ed142cae9c7d2839f7 | [
"MIT"
] | 1 | 2022-02-12T10:11:16.000Z | 2022-02-12T10:11:16.000Z | from collections import defaultdict
from ..storage import InMemoryStorage
from .client import ShardClient
from ..utils import get_size
class Shard:
def __init__(self, start, end, storage_class=InMemoryStorage, max_size=1024, bins_num=5,
buffer_size=1024,
**storage_kwargs):
... | 24.923077 | 92 | 0.578822 | from collections import defaultdict
from ..storage import InMemoryStorage
from .client import ShardClient
from ..utils import get_size
class Shard:
def __init__(self, start, end, storage_class=InMemoryStorage, max_size=1024, bins_num=5,
buffer_size=1024,
**storage_kwargs):
... | true | true |
f7519ca5f30bb14b04c36eba3f50ad111b55c774 | 2,815 | py | Python | venv/Lib/site-packages/networkx/readwrite/gpickle.py | 997Yi/Flask-web | 6b5e5d274bfa25fbd3db5af02723a5671f1e901d | [
"MIT"
] | 3 | 2020-08-04T20:29:41.000Z | 2020-11-09T09:28:19.000Z | venv/Lib/site-packages/networkx/readwrite/gpickle.py | 997Yi/Flask-web | 6b5e5d274bfa25fbd3db5af02723a5671f1e901d | [
"MIT"
] | 30 | 2020-04-15T19:37:40.000Z | 2020-04-22T21:19:35.000Z | venv/Lib/site-packages/networkx/readwrite/gpickle.py | 997Yi/Flask-web | 6b5e5d274bfa25fbd3db5af02723a5671f1e901d | [
"MIT"
] | 2 | 2020-03-12T23:20:22.000Z | 2021-02-15T21:54:02.000Z | """
**************
Pickled Graphs
**************
Read and write NetworkX graphs as Python pickles.
"The pickle module implements a fundamental, but powerful algorithm
for serializing and de-serializing a Python object
structure. "Pickling" is the process whereby a Python object hierarchy
is converted into a byte strea... | 26.064815 | 84 | 0.668561 | __author__ = """Aric Hagberg (hagberg@lanl.gov)\nDan Schult (dschult@colgate.edu)"""
__all__ = ['read_gpickle', 'write_gpickle']
import networkx as nx
from networkx.utils import open_file
try:
import cPickle as pickle
except ImportError:
import pickle
@open_file(1, mode='wb')
def write_gpickle(G, pat... | true | true |
f7519cfbbd3512ac811cbb0200e2f934fbe4e97d | 739 | py | Python | Taekwon/Python/BFS_DFS/beverage_fr_sol.py | sonnysorry/codingtest | 478e0168e3209eb97b6b16910027bf12ccc3ccd0 | [
"MIT"
] | 2 | 2021-09-27T19:10:36.000Z | 2021-11-09T05:40:39.000Z | Taekwon/Python/BFS_DFS/beverage_fr_sol.py | sonnysorry/codingtest | 478e0168e3209eb97b6b16910027bf12ccc3ccd0 | [
"MIT"
] | 1 | 2021-11-15T14:56:54.000Z | 2021-11-15T14:56:54.000Z | Taekwon/Python/BFS_DFS/beverage_fr_sol.py | sonnysorry/codingtest | 478e0168e3209eb97b6b16910027bf12ccc3ccd0 | [
"MIT"
] | null | null | null | # DFS로 특정 노드를 방문하고 연결된 모든 노드들도 방문
def dfs(x, y):
# 주어진 범위를 벗어나는 경우에는 즉시 종료
if x <= -1 or x >= n or y <= -1 or y >= m:
return False
# 현재 노드를 아직 방문하지 않았다면
if graph[x][y] == 0:
# 해당 노드 방문 처리
graph[x][y] = 1
# 상, 하, 좌, 우의 위치들도 모두 재귀적으로 호출
dfs(x - 1, y)
dfs(x, ... | 20.527778 | 46 | 0.488498 |
def dfs(x, y):
if x <= -1 or x >= n or y <= -1 or y >= m:
return False
if graph[x][y] == 0:
graph[x][y] = 1
dfs(x - 1, y)
dfs(x, y - 1)
dfs(x + 1, y)
dfs(x, y + 1)
return True
return False
n, m = map(int, input().split())... | true | true |
f7519e2ccb92b43e366a1f6bc8ed83c3b209133c | 5,030 | py | Python | ORCA1/gen_process_scalar.py | julianmak/NEMO-related | c8af7d020b18fa3ae28740d8e603018e2401b5b0 | [
"MIT"
] | 3 | 2019-10-14T09:44:33.000Z | 2022-02-28T05:43:13.000Z | ORCA1/gen_process_scalar.py | julianmak/NEMO-related | c8af7d020b18fa3ae28740d8e603018e2401b5b0 | [
"MIT"
] | null | null | null | ORCA1/gen_process_scalar.py | julianmak/NEMO-related | c8af7d020b18fa3ae28740d8e603018e2401b5b0 | [
"MIT"
] | 3 | 2019-03-05T19:57:46.000Z | 2022-02-28T05:43:14.000Z | #!/usr/bin/env python3
# JM: 30 Aug 2018
# process the *scalar.nc files (because I couldn't get XIOS to spit out just
# a number for whatever reason...)
import netCDF4
import glob, sys
#--------------------------------------------------------
# define the argument parser
import argparse
parser = argparse.ArgumentPa... | 42.268908 | 104 | 0.557654 |
# a number for whatever reason...)
import netCDF4
import glob, sys
#--------------------------------------------------------
# define the argument parser
import argparse
parser = argparse.ArgumentParser(description = "Process the scalar netcdf files and output as text")
# fixed arguments
parser.add_argument("da... | true | true |
f751a07d4870db622b26ff98e3fcb86644491314 | 60,931 | py | Python | tests/unit/gapic/compute_v1/test_instance_templates.py | vam-google/python-compute | 799f2f55e5e205317862a17ca7ed548ce2ca66e5 | [
"Apache-2.0"
] | null | null | null | tests/unit/gapic/compute_v1/test_instance_templates.py | vam-google/python-compute | 799f2f55e5e205317862a17ca7ed548ce2ca66e5 | [
"Apache-2.0"
] | null | null | null | tests/unit/gapic/compute_v1/test_instance_templates.py | vam-google/python-compute | 799f2f55e5e205317862a17ca7ed548ce2ca66e5 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2020 Google 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 applicable law or... | 39.565584 | 122 | 0.690486 |
import os
import mock
import packaging.version
import grpc
from grpc.experimental import aio
import math
import pytest
from proto.marshal.rules.dates import DurationRule, TimestampRule
from requests import Response
from requests.sessions import Session
from google.api_core import client_options
from g... | true | true |
f751a2d1efa5fc50308bfa77b7127633744150c4 | 12,351 | py | Python | Files/manage_db.py | SlaveForGluten/MyWallet | 942a6be32436e48eb79beffd041e9d45c5156d97 | [
"MIT"
] | null | null | null | Files/manage_db.py | SlaveForGluten/MyWallet | 942a6be32436e48eb79beffd041e9d45c5156d97 | [
"MIT"
] | null | null | null | Files/manage_db.py | SlaveForGluten/MyWallet | 942a6be32436e48eb79beffd041e9d45c5156d97 | [
"MIT"
] | null | null | null | """create and manipulate sqlite databese"""
import sqlite3
import time
import datetime
from Files import scrap_web
def create_tables():
"""create db if don't exists and fill it with tables"""
connect = sqlite3.connect("db.db")
conn = connect.cursor()
conn.execute("""CREATE TABLE IF NOT EXISTS assets... | 33.024064 | 79 | 0.56376 |
import sqlite3
import time
import datetime
from Files import scrap_web
def create_tables():
connect = sqlite3.connect("db.db")
conn = connect.cursor()
conn.execute("""CREATE TABLE IF NOT EXISTS assets(
timestamp TEXT,
amount REAL,
currency TEXT,
... | true | true |
f751a2eae96e609d216cf8b12cd100fd8720f209 | 22,454 | py | Python | src/datasets/commands/dummy_data.py | TezRomacH/datasets | 7349b79cd76dfecd7117847a9526a1d950f69758 | [
"Apache-2.0"
] | 1 | 2021-04-08T07:52:57.000Z | 2021-04-08T07:52:57.000Z | src/datasets/commands/dummy_data.py | TezRomacH/datasets | 7349b79cd76dfecd7117847a9526a1d950f69758 | [
"Apache-2.0"
] | null | null | null | src/datasets/commands/dummy_data.py | TezRomacH/datasets | 7349b79cd76dfecd7117847a9526a1d950f69758 | [
"Apache-2.0"
] | 1 | 2022-02-23T19:09:42.000Z | 2022-02-23T19:09:42.000Z | import fnmatch
import json
import os
import shutil
import tempfile
import xml.etree.ElementTree as ET
from argparse import ArgumentParser
from pathlib import Path
from typing import Optional
from datasets.commands import BaseTransformersCLICommand
from datasets.load import import_main_class, prepare_module
from datase... | 48.392241 | 352 | 0.604569 | import fnmatch
import json
import os
import shutil
import tempfile
import xml.etree.ElementTree as ET
from argparse import ArgumentParser
from pathlib import Path
from typing import Optional
from datasets.commands import BaseTransformersCLICommand
from datasets.load import import_main_class, prepare_module
from datase... | true | true |
f751a31fcbe42809fe45819dac756046e1eb7d9d | 230 | py | Python | api/wsgi/src/devices/ecg/serializers.py | easyCZ/SLIP-A-2015 | ad386df9c438d93ec89f68c63d3deda12d27d1ed | [
"MIT"
] | 2 | 2020-06-08T19:17:10.000Z | 2020-06-08T20:45:07.000Z | api/wsgi/src/devices/ecg/serializers.py | easyCZ/SLIP-A-2015 | ad386df9c438d93ec89f68c63d3deda12d27d1ed | [
"MIT"
] | 14 | 2015-10-07T09:31:50.000Z | 2022-02-23T07:34:10.000Z | api/wsgi/src/devices/ecg/serializers.py | easyCZ/SLIP-A-2015 | ad386df9c438d93ec89f68c63d3deda12d27d1ed | [
"MIT"
] | null | null | null | from rest_framework import serializers
class BPMSerializer(serializers.Serializer):
datetime_from = serializers.DateTimeField()
datetime_to = serializers.DateTimeField()
bpm = serializers.IntegerField(read_only=True) | 32.857143 | 50 | 0.804348 | from rest_framework import serializers
class BPMSerializer(serializers.Serializer):
datetime_from = serializers.DateTimeField()
datetime_to = serializers.DateTimeField()
bpm = serializers.IntegerField(read_only=True) | true | true |
f751a33d356f2cbc344675eceee311c8b24dce1c | 2,993 | py | Python | src/proximityGraph.py | geenasmith/WordAndSymbolSpotting | a05aeb65b40526b075f60a5887164b0db0c90cb8 | [
"MIT"
] | 1 | 2022-01-11T14:55:25.000Z | 2022-01-11T14:55:25.000Z | src/proximityGraph.py | geenasmith/WordAndSymbolSpotting | a05aeb65b40526b075f60a5887164b0db0c90cb8 | [
"MIT"
] | 1 | 2021-10-12T22:53:24.000Z | 2021-10-12T22:53:24.000Z | src/proximityGraph.py | geenasmith/WordAndSymbolSpotting | a05aeb65b40526b075f60a5887164b0db0c90cb8 | [
"MIT"
] | null | null | null | import networkx as nx
import math
import matplotlib.pyplot as plt
import numpy as np
def create_prox_graphs(kps, descs, k=5):
"""
Function which creates a proximity graph given a set of points.
:param kps: list containing sets of keypoints
:param descs: list containing sets of descriptors
:param ... | 35.211765 | 109 | 0.594387 | import networkx as nx
import math
import matplotlib.pyplot as plt
import numpy as np
def create_prox_graphs(kps, descs, k=5):
prox_graphs = []
for img in range(len(kps)):
g_data = nx.Graph()
g_prox = nx.Graph()
for i in range(len(kps[img])):
g_data.add_node(... | true | true |
f751a3c00300e1341416350849a7a7836155bbd6 | 5,662 | py | Python | back-end data/api/utility/Qua_assisFunc.py | shaoyu0966/dorm-alloc-sys | 2b3772fafe663d30f21364008f7b2d52a9539d8f | [
"Apache-2.0"
] | null | null | null | back-end data/api/utility/Qua_assisFunc.py | shaoyu0966/dorm-alloc-sys | 2b3772fafe663d30f21364008f7b2d52a9539d8f | [
"Apache-2.0"
] | null | null | null | back-end data/api/utility/Qua_assisFunc.py | shaoyu0966/dorm-alloc-sys | 2b3772fafe663d30f21364008f7b2d52a9539d8f | [
"Apache-2.0"
] | null | null | null | from .static.Qua_config import *
from random import sample
from jieba import cut_for_search, cut
from nltk import bigrams, word_tokenize
import nltk
# assistant func
def countBedNum(DormList):
BedNum = {'男性':0,'女性':0}
for index, row in DormList.iterrows():
if('男' in row['dormName'] and row['is_disabi... | 34.950617 | 156 | 0.551572 | from .static.Qua_config import *
from random import sample
from jieba import cut_for_search, cut
from nltk import bigrams, word_tokenize
import nltk
def countBedNum(DormList):
BedNum = {'男性':0,'女性':0}
for index, row in DormList.iterrows():
if('男' in row['dormName'] and row['is_disability']==0):
... | true | true |
f751a485923b7dae85bbc0946cbbbc3e30a8a262 | 22,821 | py | Python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_08_01/aio/operations/_virtual_network_peerings_operations.py | praveenkuttappan/azure-sdk-for-python | 4b79413667b7539750a6c7dde15737013a3d4bd5 | [
"MIT"
] | 2,728 | 2015-01-09T10:19:32.000Z | 2022-03-31T14:50:33.000Z | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_08_01/aio/operations/_virtual_network_peerings_operations.py | v-xuto/azure-sdk-for-python | 9c6296d22094c5ede410bc83749e8df8694ccacc | [
"MIT"
] | 17,773 | 2015-01-05T15:57:17.000Z | 2022-03-31T23:50:25.000Z | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_08_01/aio/operations/_virtual_network_peerings_operations.py | v-xuto/azure-sdk-for-python | 9c6296d22094c5ede410bc83749e8df8694ccacc | [
"MIT"
] | 1,916 | 2015-01-19T05:05:41.000Z | 2022-03-31T19:36:44.000Z | # 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 Microsoft (R) AutoRest Code Generator.
# Changes may ... | 52.826389 | 250 | 0.687481 |
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.... | true | true |
f751a54cfa21886ce743faeb8aa663fef57b3dee | 1,440 | py | Python | ecommerce/migrations/0002_category_product.py | tavoxr/ecommerce_django_postgresql | 352fbe7714ec5d62ed9187642237b79d89421631 | [
"MIT"
] | null | null | null | ecommerce/migrations/0002_category_product.py | tavoxr/ecommerce_django_postgresql | 352fbe7714ec5d62ed9187642237b79d89421631 | [
"MIT"
] | null | null | null | ecommerce/migrations/0002_category_product.py | tavoxr/ecommerce_django_postgresql | 352fbe7714ec5d62ed9187642237b79d89421631 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.6 on 2021-08-08 11:31
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ecommerce', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Category',
... | 41.142857 | 142 | 0.597917 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ecommerce', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.BigA... | true | true |
f751a79459d899bb39dff8beedf47f689e75b2aa | 52 | py | Python | artifact/stats/__init__.py | jtpaasch/artifact | 52d171c37935999af63f1e77f8455e11da1605a5 | [
"MIT"
] | null | null | null | artifact/stats/__init__.py | jtpaasch/artifact | 52d171c37935999af63f1e77f8455e11da1605a5 | [
"MIT"
] | null | null | null | artifact/stats/__init__.py | jtpaasch/artifact | 52d171c37935999af63f1e77f8455e11da1605a5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""A ``stats`` package."""
| 13 | 26 | 0.442308 | true | true | |
f751a84710bd4b174944c46d703a7d7f8b130c7d | 8,167 | py | Python | resqpy/organize/horizon_interpretation.py | poc11/resqpy | 5dfbfb924f8ee9b2712fb8e38bff96ee8ee9d8e2 | [
"MIT"
] | null | null | null | resqpy/organize/horizon_interpretation.py | poc11/resqpy | 5dfbfb924f8ee9b2712fb8e38bff96ee8ee9d8e2 | [
"MIT"
] | null | null | null | resqpy/organize/horizon_interpretation.py | poc11/resqpy | 5dfbfb924f8ee9b2712fb8e38bff96ee8ee9d8e2 | [
"MIT"
] | null | null | null | """Class for RESQML Horizon Interpretation organizational objects."""
from ._utils import (equivalent_extra_metadata, alias_for_attribute, extract_has_occurred_during,
equivalent_chrono_pairs, create_xml_has_occurred_during)
import resqpy.olio.uuid as bu
import resqpy.olio.xml_et as rqet
from res... | 52.690323 | 126 | 0.64577 |
from ._utils import (equivalent_extra_metadata, alias_for_attribute, extract_has_occurred_during,
equivalent_chrono_pairs, create_xml_has_occurred_during)
import resqpy.olio.uuid as bu
import resqpy.olio.xml_et as rqet
from resqpy.olio.base import BaseResqpy
from resqpy.olio.xml_namespaces import... | true | true |
f751a8b2e38a4352902f20b01c11c763e6893fc5 | 55,565 | py | Python | manim/scene/scene.py | rli596/manim | e147a9fc6c117332221e42437481f3efba76499a | [
"MIT"
] | 1 | 2022-03-07T10:22:13.000Z | 2022-03-07T10:22:13.000Z | manim/scene/scene.py | rli596/manim | e147a9fc6c117332221e42437481f3efba76499a | [
"MIT"
] | 21 | 2022-03-02T15:25:49.000Z | 2022-03-07T11:15:45.000Z | manim/scene/scene.py | DD2480-Group-10/manim | e147a9fc6c117332221e42437481f3efba76499a | [
"MIT"
] | null | null | null | """Basic canvas for animations."""
from __future__ import annotations
__all__ = ["Scene"]
import copy
import datetime
import inspect
import platform
import random
import threading
import time
import types
from queue import Queue
from typing import Callable
import srt
from manim.scene.section import DefaultSectionT... | 35.078914 | 159 | 0.579447 |
from __future__ import annotations
__all__ = ["Scene"]
import copy
import datetime
import inspect
import platform
import random
import threading
import time
import types
from queue import Queue
from typing import Callable
import srt
from manim.scene.section import DefaultSectionType
try:
import dearpygui.dear... | true | true |
f751a8ca3e0b1406af98f3c72e38ea805c79c019 | 20,412 | py | Python | numpy/distutils/exec_command.py | MichaelAquilina/numpy | 6e8b869d52ec5a1242df69bcd9323a4b0947933b | [
"BSD-3-Clause"
] | 1 | 2021-01-06T21:28:45.000Z | 2021-01-06T21:28:45.000Z | numpy/distutils/exec_command.py | MichaelAquilina/numpy | 6e8b869d52ec5a1242df69bcd9323a4b0947933b | [
"BSD-3-Clause"
] | null | null | null | numpy/distutils/exec_command.py | MichaelAquilina/numpy | 6e8b869d52ec5a1242df69bcd9323a4b0947933b | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
"""
exec_command
Implements exec_command function that is (almost) equivalent to
commands.getstatusoutput function but on NT, DOS systems the
returned status is actually correct (though, the returned status
values may be different by a factor). In addition, exec_command
takes keyword arguments fo... | 31.403077 | 125 | 0.550167 |
from __future__ import division, absolute_import, print_function
__all__ = ['exec_command', 'find_executable']
import os
import sys
import shlex
from numpy.distutils.misc_util import is_sequence, make_temp_file
from numpy.distutils import log
from numpy.distutils.compat import get_exception
from numpy.compat impor... | true | true |
f751a95a5f3bf6c949b19a5402cbdac8bab6aa8c | 3,745 | py | Python | tests/snippets/builtin_complex.py | ypyf/RustPython | 86103bfd0187a6073cab91142f698cb6b0a0de51 | [
"MIT"
] | 1 | 2021-09-03T15:59:36.000Z | 2021-09-03T15:59:36.000Z | tests/snippets/builtin_complex.py | ypyf/RustPython | 86103bfd0187a6073cab91142f698cb6b0a0de51 | [
"MIT"
] | null | null | null | tests/snippets/builtin_complex.py | ypyf/RustPython | 86103bfd0187a6073cab91142f698cb6b0a0de51 | [
"MIT"
] | null | null | null | from testutils import assert_raises
# __abs__
assert abs(complex(3, 4)) == 5
assert abs(complex(3, -4)) == 5
assert abs(complex(1.5, 2.5)) == 2.9154759474226504
# __eq__
assert complex(1, -1) == complex(1, -1)
assert complex(1, 0) == 1
assert 1 == complex(1, 0)
assert complex(1, 1) != 1
assert 1 != complex(1, 1)
as... | 24.801325 | 65 | 0.633378 | from testutils import assert_raises
assert abs(complex(3, 4)) == 5
assert abs(complex(3, -4)) == 5
assert abs(complex(1.5, 2.5)) == 2.9154759474226504
assert complex(1, -1) == complex(1, -1)
assert complex(1, 0) == 1
assert 1 == complex(1, 0)
assert complex(1, 1) != 1
assert 1 != complex(1, 1)
assert complex(1, 0... | true | true |
f751a98a311641bee8c88f2000884cfea44fe187 | 5,408 | py | Python | users/tests/tests.py | Flict-dev/Boxes-api | a2aa76b2db6aaa5af1028138566dc3b2b251fcdb | [
"MIT"
] | 1 | 2021-12-13T22:03:58.000Z | 2021-12-13T22:03:58.000Z | users/tests/tests.py | Flict-dev/Boxes-api | a2aa76b2db6aaa5af1028138566dc3b2b251fcdb | [
"MIT"
] | null | null | null | users/tests/tests.py | Flict-dev/Boxes-api | a2aa76b2db6aaa5af1028138566dc3b2b251fcdb | [
"MIT"
] | null | null | null | from django.contrib.auth import get_user_model
from rest_framework.reverse import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from users.tests.factories import UserFactory
User = get_user_model()
class CurrentUserViewSetRetrieveTest(APITestCase):
def setUp(self) -> None... | 34.012579 | 100 | 0.555658 | from django.contrib.auth import get_user_model
from rest_framework.reverse import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from users.tests.factories import UserFactory
User = get_user_model()
class CurrentUserViewSetRetrieveTest(APITestCase):
def setUp(self) -> None... | true | true |
f751aa3375a06c99f4544a0dcc5cd567219540b3 | 4,224 | py | Python | tests/units/scripts/test_run_tsfresh.py | snowde/tsfresh | 6cf12fe769762a7c9369a9c78a3a519a28d5c707 | [
"MIT"
] | 4 | 2019-03-24T03:17:09.000Z | 2021-09-28T09:22:49.000Z | tests/units/scripts/test_run_tsfresh.py | snowde/tsfresh | 6cf12fe769762a7c9369a9c78a3a519a28d5c707 | [
"MIT"
] | null | null | null | tests/units/scripts/test_run_tsfresh.py | snowde/tsfresh | 6cf12fe769762a7c9369a9c78a3a519a28d5c707 | [
"MIT"
] | 3 | 2019-01-31T04:34:44.000Z | 2020-04-06T18:19:50.000Z | # -*- coding: utf-8 -*-
# This file as well as the whole tsfresh package are licenced under the MIT licence (see the LICENCE.txt)
# Maximilian Christ (maximilianchrist.com), Blue Yonder Gmbh, 2016
import os
import shutil
import tempfile
from unittest import TestCase
from tsfresh.scripts import run_tsfresh
from mock imp... | 41.009709 | 150 | 0.643939 |
import os
import shutil
import tempfile
from unittest import TestCase
from tsfresh.scripts import run_tsfresh
from mock import patch
class RunTSFreshTestCase(TestCase):
def setUp(self):
self.test_dir = tempfile.mkdtemp()
os.chdir(self.test_dir)
def extract_features_mo... | true | true |
f751ab7a67bba76215cba57f35175b2538edca35 | 1,307 | py | Python | create_tables.py | FedericoSerini/DEND-Project-1-Song-Play-Analysis-With-RDBMS | 4f6d60a5a43877f247bbef4862caa7cd8888e34a | [
"MIT"
] | 8 | 2019-04-15T11:33:09.000Z | 2021-12-07T16:00:15.000Z | create_tables.py | FedericoSerini/DEND-Project-1-Song-Play-Analysis-With-RDBMS | 4f6d60a5a43877f247bbef4862caa7cd8888e34a | [
"MIT"
] | 1 | 2019-07-06T01:05:29.000Z | 2019-07-06T01:08:31.000Z | create_tables.py | FedericoSerini/DEND-Project-1-Song-Play-Analysis-With-RDBMS | 4f6d60a5a43877f247bbef4862caa7cd8888e34a | [
"MIT"
] | 18 | 2019-04-19T21:58:07.000Z | 2021-04-14T21:36:11.000Z | import psycopg2
from sql_queries import create_table_queries, drop_table_queries
def create_database():
# connect to default database
conn = psycopg2.connect("host=127.0.0.1 dbname=studentdb user=student password=student")
conn.set_session(autocommit=True)
cur = conn.cursor()
# create sparkif... | 26.673469 | 93 | 0.701607 | import psycopg2
from sql_queries import create_table_queries, drop_table_queries
def create_database():
conn = psycopg2.connect("host=127.0.0.1 dbname=studentdb user=student password=student")
conn.set_session(autocommit=True)
cur = conn.cursor()
cur.execute("DROP DATABASE IF EXISTS spa... | true | true |
f751ac9a037aeecc0f07f0f8f982df314ee5e8d3 | 47 | py | Python | highcliff/ai/__init__.py | sermelo/Highcliff-SDK | 255dd12b3402361cba8b1ea7a28c506f32a11dae | [
"Apache-2.0"
] | null | null | null | highcliff/ai/__init__.py | sermelo/Highcliff-SDK | 255dd12b3402361cba8b1ea7a28c506f32a11dae | [
"Apache-2.0"
] | null | null | null | highcliff/ai/__init__.py | sermelo/Highcliff-SDK | 255dd12b3402361cba8b1ea7a28c506f32a11dae | [
"Apache-2.0"
] | null | null | null | from highcliff.ai.ai import AI, intent_is_real
| 23.5 | 46 | 0.829787 | from highcliff.ai.ai import AI, intent_is_real
| true | true |
f751aeefabdcf7eea5e003b0f4546ec2c6dd377c | 20,014 | py | Python | paddlenlp/transformers/bert/modeling.py | BenfengXu/PaddleNLP | eca87fde4a1814a8f028e0e900d1792cbaa5c700 | [
"Apache-2.0"
] | 2 | 2021-06-19T07:27:10.000Z | 2021-06-23T06:22:57.000Z | paddlenlp/transformers/bert/modeling.py | BenfengXu/PaddleNLP | eca87fde4a1814a8f028e0e900d1792cbaa5c700 | [
"Apache-2.0"
] | 1 | 2021-11-22T08:11:08.000Z | 2021-11-22T08:11:08.000Z | paddlenlp/transformers/bert/modeling.py | BenfengXu/PaddleNLP | eca87fde4a1814a8f028e0e900d1792cbaa5c700 | [
"Apache-2.0"
] | 1 | 2021-04-28T09:01:37.000Z | 2021-04-28T09:01:37.000Z | # 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 appli... | 39.397638 | 108 | 0.610123 |
import paddle
import paddle.nn as nn
import paddle.tensor as tensor
import paddle.nn.functional as F
from paddle.nn import TransformerEncoder, Linear, Layer, Embedding, LayerNorm, Tanh
from .. import PretrainedModel, register_base_model
__all__ = [
'BertModel',
"BertPretrainedModel",
'BertFo... | true | true |
f751af146af895c2b7971239633f9ed60b77862a | 2,076 | py | Python | mtr/sync/forms.py | mtrgroup/django-mtr-import-export | b8e7a6fa1cbc58b9e2126526f418306a7490cb52 | [
"MIT"
] | null | null | null | mtr/sync/forms.py | mtrgroup/django-mtr-import-export | b8e7a6fa1cbc58b9e2126526f418306a7490cb52 | [
"MIT"
] | null | null | null | mtr/sync/forms.py | mtrgroup/django-mtr-import-export | b8e7a6fa1cbc58b9e2126526f418306a7490cb52 | [
"MIT"
] | null | null | null | from django import forms
from mtr.utils.forms import GlobalInitialFormMixin
from mtr.utils.helpers import model_choices
from .lib.manager import manager
from .models import Settings, Field
# TODO: refactor
class SettingsAdminForm(GlobalInitialFormMixin, forms.ModelForm):
class Meta:
exclude = tuple()... | 33.483871 | 71 | 0.631985 | from django import forms
from mtr.utils.forms import GlobalInitialFormMixin
from mtr.utils.helpers import model_choices
from .lib.manager import manager
from .models import Settings, Field
class SettingsAdminForm(GlobalInitialFormMixin, forms.ModelForm):
class Meta:
exclude = tuple()
model =... | true | true |
f751af92caa2afcd1c6b5c83ecadff741fa71698 | 15,773 | py | Python | tarbell/app.py | write-this-way/flask-tarbell | 0e23e8d90ba66fde1a961ea530c99d94357ff664 | [
"BSD-3-Clause"
] | 1 | 2016-03-12T21:16:46.000Z | 2016-03-12T21:16:46.000Z | tarbell/app.py | write-this-way/flask-tarbell | 0e23e8d90ba66fde1a961ea530c99d94357ff664 | [
"BSD-3-Clause"
] | null | null | null | tarbell/app.py | write-this-way/flask-tarbell | 0e23e8d90ba66fde1a961ea530c99d94357ff664 | [
"BSD-3-Clause"
] | null | null | null | import os
import json
import imp
import mimetypes
import xlrd
import csv
import re
import requests
import time
import sys
import traceback
from httplib import BadStatusLine
from flask import Flask, render_template, send_from_directory, Response
from jinja2 import Markup, TemplateSyntaxError
from jinja2.loaders import ... | 34.818985 | 109 | 0.569137 | import os
import json
import imp
import mimetypes
import xlrd
import csv
import re
import requests
import time
import sys
import traceback
from httplib import BadStatusLine
from flask import Flask, render_template, send_from_directory, Response
from jinja2 import Markup, TemplateSyntaxError
from jinja2.loaders import ... | true | true |
f751b039578a7c622060bbd33808632d2dc01c69 | 8,787 | py | Python | tests/h/routes_test.py | julien-cheng/h | 36c8ec044725720cf36f0986cdf025395aca8929 | [
"BSD-2-Clause"
] | 2 | 2019-08-04T07:22:11.000Z | 2020-07-17T05:01:41.000Z | tests/h/routes_test.py | 11-eleven-11/h | 91c7a4504ad7471ed3e30246763a03e6c1cc531b | [
"BSD-2-Clause"
] | null | null | null | tests/h/routes_test.py | 11-eleven-11/h | 91c7a4504ad7471ed3e30246763a03e6c1cc531b | [
"BSD-2-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from mock import Mock, call
from h.routes import includeme
def test_includeme():
config = Mock(spec_set=["add_route"])
includeme(config)
# This may look like a ridiculous test, but the cost of keeping it
# up-to-date is hopefully pre... | 37.551282 | 89 | 0.528963 |
from __future__ import unicode_literals
from mock import Mock, call
from h.routes import includeme
def test_includeme():
config = Mock(spec_set=["add_route"])
includeme(config)
assert config.add_route.mock_calls == [
call("index", "/"),
call("robots", "/robots.txt... | true | true |
f751b2a07c67e64383b56ba867bb9902f7d9e662 | 9,534 | py | Python | canteen_tests/test_base/test_handler.py | dbl0null/canteen | 3bef22a2059ef6ac5df178324fbc1dba45316e22 | [
"MIT"
] | 2 | 2016-08-24T18:42:41.000Z | 2017-12-08T00:41:02.000Z | canteen_tests/test_base/test_handler.py | dbl0null/canteen | 3bef22a2059ef6ac5df178324fbc1dba45316e22 | [
"MIT"
] | null | null | null | canteen_tests/test_base/test_handler.py | dbl0null/canteen | 3bef22a2059ef6ac5df178324fbc1dba45316e22 | [
"MIT"
] | 2 | 2015-09-22T05:36:27.000Z | 2017-12-08T00:41:21.000Z | # -*- coding: utf-8 -*-
"""
base handler tests
~~~~~~~~~~~~~~~~~~
:author: Sam Gammon <sg@samgammon.com>
:copyright: (c) Sam Gammon, 2014
:license: This software makes use of the MIT Open Source License.
A copy of this license is included as ``LICENSE.md`` in
the root of the project... | 26.705882 | 79 | 0.660688 |
from canteen import test
from canteen.base import handler
from canteen.logic import template
from canteen.logic.http import semantics
from canteen.core import runtime as rtime
from canteen.util.config import Config
from werkzeug import test as wtest
from werkzeug.wrappers import Request
from werkzeug.wrappers... | true | true |
f751b39e755638fce65a8cc5ec944917ef0127ce | 5,219 | py | Python | trt_int8_quant.py | yihui8776/TensorRT-DETR | 1f32e9a2f98e26ec5b2376f9a2695193887430fb | [
"Apache-2.0"
] | 61 | 2021-04-29T08:10:20.000Z | 2022-03-30T10:13:13.000Z | trt_int8_quant.py | yihui8776/TensorRT-DETR | 1f32e9a2f98e26ec5b2376f9a2695193887430fb | [
"Apache-2.0"
] | 3 | 2021-07-15T05:42:49.000Z | 2021-09-24T04:24:52.000Z | trt_int8_quant.py | yihui8776/TensorRT-DETR | 1f32e9a2f98e26ec5b2376f9a2695193887430fb | [
"Apache-2.0"
] | 10 | 2021-05-18T16:04:50.000Z | 2022-03-11T06:31:38.000Z |
#
# Copyright (c) 2021, NVIDIA CORPORATION. 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... | 42.08871 | 200 | 0.682315 |
import os
import glob
import cv2
from PIL import Image
import numpy as np
import argparse
import torchvision.transforms as T
from trt_util.common import build_engine_onnx_v2
from trt_util.calibrator import Calibrator
transform = T.Compose([
T.Resize((800,800)),
T.ToTensor(),
T.Normali... | true | true |
f751b40d1eb6e2346a2040fffd223b2987cd5bae | 2,144 | py | Python | alembic/versions/20210120221155_6183aa4c39c7_initial_setup.py | takotab/cloudrun-fastapi | 515145dc68f49b222cf582940368fdba4b6dcfd3 | [
"MIT"
] | 74 | 2020-02-06T18:20:36.000Z | 2021-11-28T11:46:02.000Z | alembic/versions/20210120221155_6183aa4c39c7_initial_setup.py | takotab/cloudrun-fastapi | 515145dc68f49b222cf582940368fdba4b6dcfd3 | [
"MIT"
] | 13 | 2020-03-03T01:00:27.000Z | 2021-10-21T17:11:15.000Z | alembic/versions/20210120221155_6183aa4c39c7_initial_setup.py | takotab/cloudrun-fastapi | 515145dc68f49b222cf582940368fdba4b6dcfd3 | [
"MIT"
] | 17 | 2020-02-08T13:20:21.000Z | 2021-11-02T10:19:16.000Z | """initial setup
Revision ID: 6183aa4c39c7
Revises:
Create Date: 2021-01-20 22:11:55.367985+00:00
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '6183aa4c39c7'
down_revision = None
branch_labels = None
depends_on = No... | 37.614035 | 81 | 0.678172 | from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '6183aa4c39c7'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
ng(), nullable=False),
sa.Column('password', sa.String(), nullable=False),
sa.Column('bio', sa.String(), nullable... | true | true |
f751b45b142e44df8292677d3e20ebd607f09338 | 12,567 | py | Python | cirq/optimizers/eject_phased_paulis.py | rajeshkumarkarra/Cirq | 5ad06cc7a487ca94436715a3c51b6a50dfd10513 | [
"Apache-2.0"
] | 1 | 2019-09-04T16:55:30.000Z | 2019-09-04T16:55:30.000Z | cirq/optimizers/eject_phased_paulis.py | rajeshkumarkarra/Cirq | 5ad06cc7a487ca94436715a3c51b6a50dfd10513 | [
"Apache-2.0"
] | null | null | null | cirq/optimizers/eject_phased_paulis.py | rajeshkumarkarra/Cirq | 5ad06cc7a487ca94436715a3c51b6a50dfd10513 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 35.905714 | 80 | 0.517944 |
from typing import Optional, cast, TYPE_CHECKING, Iterable, Tuple
import sympy
from cirq import circuits, ops, value, protocols
from cirq.optimizers import decompositions
if TYPE_CHECKING:
from typing import Dict, List
class _OptimizerState:
def __init__(self):
self.held_w_ph... | true | true |
f751b500ac351bb61d82b321afe07ff45df02c52 | 8,323 | py | Python | share/inputDataProcessor/farm_processor.py | eirikur16/flrs | c98604593753def05086b54ce82f5551f01d2529 | [
"Apache-2.0"
] | 91 | 2019-06-04T08:56:29.000Z | 2022-03-13T17:39:22.000Z | share/inputDataProcessor/farm_processor.py | eirikur16/flrs | c98604593753def05086b54ce82f5551f01d2529 | [
"Apache-2.0"
] | 224 | 2019-04-08T22:03:45.000Z | 2022-03-31T17:56:09.000Z | share/inputDataProcessor/farm_processor.py | eirikur16/flrs | c98604593753def05086b54ce82f5551f01d2529 | [
"Apache-2.0"
] | 97 | 2019-04-23T20:48:20.000Z | 2022-03-29T08:17:02.000Z | """
Script to process wind farm & turbine csv downloaded from: https://eerscmap.usgs.gov/uswtdb/data/
Metadata description can be found at https://eerscmap.usgs.gov/uswtdb/assets/data/uswtdb_v1_0_20180419.xml
Disregarding the following attributes for now:
t_rsa turbine rotor swept area square meters
t_ttlh turbine tot... | 37.660633 | 110 | 0.531779 |
import os
import csv
import sys
import copy
import json
import getopt
import utm
intermediate_file = "farms.json"
template_file = "../inputFormApp/inputFiles/example_input_file.json"
generated_files_directory = "./generatedInputFiles"
def main(argv):
filename = None
try:
opts, args = getopt.geto... | true | true |
f751b5d7401039834933fc95d83087048bdaf4af | 1,244 | py | Python | tests/pyre/components/component_instance_binding_deferred.py | lijun99/pyre | 004dfd4c06489b4ba5b32877338ca6440f2d523b | [
"BSD-3-Clause"
] | 3 | 2019-08-02T21:02:47.000Z | 2021-09-08T13:59:43.000Z | tests/pyre/components/component_instance_binding_deferred.py | lijun99/pyre | 004dfd4c06489b4ba5b32877338ca6440f2d523b | [
"BSD-3-Clause"
] | null | null | null | tests/pyre/components/component_instance_binding_deferred.py | lijun99/pyre | 004dfd4c06489b4ba5b32877338ca6440f2d523b | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2019 all rights reserved
#
import pyre
class ifac(pyre.protocol, family="deferred.ifac"):
"""sample protocol"""
@classmethod
def pyre_default(cls, **kwds): return comp
class comp(pyre.component, family="defer... | 23.037037 | 73 | 0.659968 |
import pyre
class ifac(pyre.protocol, family="deferred.ifac"):
@classmethod
def pyre_default(cls, **kwds): return comp
class comp(pyre.component, family="deferred.ifac.comp", implements=ifac):
tag = pyre.properties.str()
class user(pyre.component, family="deferred.user"):
comp = pyre.facilit... | true | true |
f751b71a4a017dc3870da1e1445820b6c521e1ce | 10,748 | py | Python | src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py | Jcc99/Adafruit_Blinka | 41f8155bab83039ed9d45276addd3d501e83f3e6 | [
"MIT"
] | 294 | 2018-06-30T19:08:27.000Z | 2022-03-26T21:08:47.000Z | src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py | Jcc99/Adafruit_Blinka | 41f8155bab83039ed9d45276addd3d501e83f3e6 | [
"MIT"
] | 421 | 2018-06-30T20:54:46.000Z | 2022-03-31T15:08:37.000Z | src/adafruit_blinka/microcontroller/generic_linux/sysfs_pwmout.py | Jcc99/Adafruit_Blinka | 41f8155bab83039ed9d45276addd3d501e83f3e6 | [
"MIT"
] | 234 | 2018-07-23T18:49:16.000Z | 2022-03-28T16:59:48.000Z | """
Much code from https://github.com/vsergeev/python-periphery/blob/master/periphery/pwm.py
Copyright (c) 2015-2016 vsergeev / Ivan (Vanya) A. Sergeev
License: MIT
"""
import os
from time import sleep
from errno import EACCES
try:
from microcontroller.pin import pwmOuts
except ImportError:
raise RuntimeError... | 30.796562 | 89 | 0.588947 |
import os
from time import sleep
from errno import EACCES
try:
from microcontroller.pin import pwmOuts
except ImportError:
raise RuntimeError("No PWM outputs defined for this board") from ImportError
class PWMError(IOError):
pass
class PWMOut:
PWM_STAT_RETRIES = 10
PWM_STAT_DEL... | true | true |
f751b7a518e10677ba93e80af273766f1a342146 | 10,661 | py | Python | differential_privacy/dp_sgd/dp_optimizer/utils.py | robrkerr/tensorflow-models | 3656a07e89be134c2bc333c60a6c709e475024a6 | [
"Apache-2.0"
] | 308 | 2018-09-06T18:46:57.000Z | 2022-03-28T08:22:45.000Z | differential_privacy/dp_sgd/dp_optimizer/utils.py | robrkerr/tensorflow-models | 3656a07e89be134c2bc333c60a6c709e475024a6 | [
"Apache-2.0"
] | 64 | 2018-06-20T10:14:17.000Z | 2021-09-08T05:58:25.000Z | differential_privacy/dp_sgd/dp_optimizer/utils.py | robrkerr/tensorflow-models | 3656a07e89be134c2bc333c60a6c709e475024a6 | [
"Apache-2.0"
] | 69 | 2018-09-18T12:06:56.000Z | 2022-03-14T11:49:16.000Z | # Copyright 2016 The TensorFlow 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 applica... | 34.060703 | 80 | 0.657443 |
from __future__ import division
import math
import numpy
import tensorflow as tf
class LayerParameters(object):
def __init__(self):
self.name = ""
self.num_units = 0
self._with_bias = False
self.relu = False
self.gradient_l2norm_bound = 0.0
self.bias_gradient_l2norm_bound = ... | true | true |
f751b877d0166f8f3fa25b4d087410e3df1354b2 | 31,937 | py | Python | app/common/database.py | B611/nyja | 5169bc21a1ff3026d9915cb2774ecf381b3316e1 | [
"MIT"
] | 1 | 2021-11-10T16:42:33.000Z | 2021-11-10T16:42:33.000Z | app/common/database.py | B611/nyja | 5169bc21a1ff3026d9915cb2774ecf381b3316e1 | [
"MIT"
] | null | null | null | app/common/database.py | B611/nyja | 5169bc21a1ff3026d9915cb2774ecf381b3316e1 | [
"MIT"
] | null | null | null | from pymongo import MongoClient
import os
import hashlib
from datetime import datetime
import common.misc as misc
# Perform advanced search in the database
def search_nested(args):
try:
# If user wants to retrieve all the database
if args.NESTED[0] == 'ALL':
print('Search for all websi... | 41.10296 | 127 | 0.56934 | from pymongo import MongoClient
import os
import hashlib
from datetime import datetime
import common.misc as misc
def search_nested(args):
try:
if args.NESTED[0] == 'ALL':
print('Search for all websites :')
print('\n')
client = MongoClient(
... | true | true |
f751b95552a0b9a87022c05e2d6c1c8d426941f8 | 1,950 | py | Python | tests/test_redis.py | azhai/rdcache | 8f3ca558a2a9af11321916bfe548aaeb66ef75ae | [
"MIT"
] | null | null | null | tests/test_redis.py | azhai/rdcache | 8f3ca558a2a9af11321916bfe548aaeb66ef75ae | [
"MIT"
] | null | null | null | tests/test_redis.py | azhai/rdcache | 8f3ca558a2a9af11321916bfe548aaeb66ef75ae | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import unittest
from datetime import date
from rdcache.ext import RedisCache, RedisPool
redis = RedisPool({
"default": {
"host": "127.0.0.1",
"port": 6379,
"password": "",
"db": 0,
},
})
backend = redis.get('default')
cache = RedisCache(backend, touch = ... | 27.464789 | 81 | 0.586667 |
import unittest
from datetime import date
from rdcache.ext import RedisCache, RedisPool
redis = RedisPool({
"default": {
"host": "127.0.0.1",
"port": 6379,
"password": "",
"db": 0,
},
})
backend = redis.get('default')
cache = RedisCache(backend, touch = True)
user_rows = {
... | true | true |
f751ba178fd593c45f58ddd0b43b2cf20c7e1aa8 | 1,517 | py | Python | Chapter12/my_app/__init__.py | shalevy1/Flask-Framework-Cookbook-Second-Edition | e219c3c243f147fa6ebd09c114b08ea2b9109cfa | [
"MIT"
] | 42 | 2019-07-21T09:10:17.000Z | 2022-02-21T01:12:18.000Z | Chapter12/my_app/__init__.py | shalevy1/Flask-Framework-Cookbook-Second-Edition | e219c3c243f147fa6ebd09c114b08ea2b9109cfa | [
"MIT"
] | 2 | 2019-09-11T16:17:06.000Z | 2021-03-01T18:46:20.000Z | Chapter12/my_app/__init__.py | shalevy1/Flask-Framework-Cookbook-Second-Edition | e219c3c243f147fa6ebd09c114b08ea2b9109cfa | [
"MIT"
] | 45 | 2019-07-17T22:50:28.000Z | 2022-03-23T13:52:59.000Z | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from elasticsearch import Elasticsearch
from flask_caching import Cache
from flask_mail import Mail
from celery import Celery
app = Flask(__name__)
app.config['SERVER_NAME'] = 'localhost:5000'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test... | 27.581818 | 67 | 0.719842 | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from elasticsearch import Elasticsearch
from flask_caching import Cache
from flask_mail import Mail
from celery import Celery
app = Flask(__name__)
app.config['SERVER_NAME'] = 'localhost:5000'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test... | true | true |
f751ba9db0d039dff8f6bf54d37cd596feb55b62 | 1,956 | py | Python | tests/test_visitors/test_ast/test_operators/test_useless_operators_before_numbers.py | teners/wemake-python-styleguide | fe01384c808e6908b19c6bad3ad85a834f6dc533 | [
"MIT"
] | 1 | 2019-01-31T00:06:43.000Z | 2019-01-31T00:06:43.000Z | tests/test_visitors/test_ast/test_operators/test_useless_operators_before_numbers.py | teners/wemake-python-styleguide | fe01384c808e6908b19c6bad3ad85a834f6dc533 | [
"MIT"
] | 1 | 2019-10-09T16:57:12.000Z | 2019-10-09T16:57:12.000Z | tests/test_visitors/test_ast/test_operators/test_useless_operators_before_numbers.py | raghav-ys/wemake-python-styleguide | edb4a88923205448b29972ad0bc2862df5a569c5 | [
"MIT"
] | 1 | 2019-12-12T19:18:58.000Z | 2019-12-12T19:18:58.000Z | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
UselessOperatorsViolation,
)
from wemake_python_styleguide.visitors.ast.operators import (
UselessOperatorsVisitor,
)
# Usages:
assignment = 'constant = {0}'
assignment_addition = 'constant = x + {0}'
assignme... | 21.032258 | 69 | 0.654908 |
import pytest
from wemake_python_styleguide.violations.consistency import (
UselessOperatorsViolation,
)
from wemake_python_styleguide.visitors.ast.operators import (
UselessOperatorsVisitor,
)
assignment = 'constant = {0}'
assignment_addition = 'constant = x + {0}'
assignment_increment = 'constant += {0}'... | true | true |
f751baa9cae2f51f9d95e3dd65a91255a6dd4859 | 17,891 | py | Python | boto/glacier/layer1.py | bopopescu/boto-hk7y1hi14s37zwkm | 093663068a9a92ddb2224be617e74b086c92517e | [
"MIT"
] | null | null | null | boto/glacier/layer1.py | bopopescu/boto-hk7y1hi14s37zwkm | 093663068a9a92ddb2224be617e74b086c92517e | [
"MIT"
] | 1 | 2021-04-30T21:19:53.000Z | 2021-04-30T21:19:53.000Z | boto/glacier/layer1.py | bopopescu/boto-hk7y1hi14s37zwkm | 093663068a9a92ddb2224be617e74b086c92517e | [
"MIT"
] | 1 | 2020-07-25T22:31:28.000Z | 2020-07-25T22:31:28.000Z | # -*- coding: utf-8 -*-
# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates. 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 ... | 42.597619 | 81 | 0.626181 |
import json
import boto.glacier
from boto.connection import AWSAuthConnection
boto.set_stream_logger('glacier')
class Layer1(AWSAuthConnection):
Version = '2012-06-01'
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None,
account_id='-', is_secure=T... | true | true |
f751bb7f36189dd2bf94743f3c975d6aa42977ce | 2,591 | py | Python | lite/tests/unittest_py/op/test_tril_triu_op.py | 714627034/Paddle-Lite | 015ba88a4d639db0b73603e37f83e47be041a4eb | [
"Apache-2.0"
] | 808 | 2018-04-17T17:43:12.000Z | 2019-08-18T07:39:13.000Z | lite/tests/unittest_py/op/test_tril_triu_op.py | 714627034/Paddle-Lite | 015ba88a4d639db0b73603e37f83e47be041a4eb | [
"Apache-2.0"
] | 728 | 2018-04-18T08:15:25.000Z | 2019-08-16T07:14:43.000Z | lite/tests/unittest_py/op/test_tril_triu_op.py | 714627034/Paddle-Lite | 015ba88a4d639db0b73603e37f83e47be041a4eb | [
"Apache-2.0"
] | 364 | 2018-04-18T17:05:02.000Z | 2019-08-18T03:25:38.000Z | # Copyright (c) 2021 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 appli... | 34.546667 | 125 | 0.670783 |
import sys
sys.path.append('../')
from auto_scan_test import AutoScanTest, IgnoreReasons
from program_config import TensorConfig, ProgramConfig, OpConfig, CxxConfig, TargetType, PrecisionType, DataLayoutType, Place
import unittest
import hypothesis
from hypothesis import given, settings, seed, example, ... | true | true |
f751bbb0f274dc9fd5dc7b7cbcd509445ff0f67e | 6,237 | py | Python | ports/nrf/examples/seeed_tft.py | mtuxpe/makerdiary | d72738111eb92a01d6955f4e1f3f56c2a925d252 | [
"MIT"
] | 2 | 2018-07-17T09:19:05.000Z | 2021-03-27T01:21:06.000Z | ports/nrf/examples/seeed_tft.py | mtuxpe/makerdiary | d72738111eb92a01d6955f4e1f3f56c2a925d252 | [
"MIT"
] | null | null | null | ports/nrf/examples/seeed_tft.py | mtuxpe/makerdiary | d72738111eb92a01d6955f4e1f3f56c2a925d252 | [
"MIT"
] | 2 | 2018-07-17T09:23:52.000Z | 2019-08-08T22:48:17.000Z | # This file is part of the MicroPython project, http://micropython.org/
#
# The MIT License (MIT)
#
# Copyright (c) 2016 Glenn Ruben Bakke
#
# 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 wi... | 29.559242 | 126 | 0.611512 |
import os
import time
import framebuf
from machine import SPI, Pin
from sdcard import SDCard
def mount_tf(self, mount_point="/"):
sd = SDCard(SPI(0), Pin("A15", mode=Pin.OUT))
os.mount(sd, mount_point)
class ILI9341:
def __init__(self, width, height):
self.width = width
... | true | true |
f751bc38b5afce2a4569f7c17ad5e8f109093a0f | 3,621 | py | Python | pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/nxos/interface/get/get_interface_information/test_api_get_interface_information.py | CiscoTestAutomation/genielibs | becee8a1a85f4973e00859e3244e2c8fe45a394c | [
"Apache-2.0"
] | 94 | 2018-04-30T20:29:15.000Z | 2022-03-29T13:40:31.000Z | pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/nxos/interface/get/get_interface_information/test_api_get_interface_information.py | CiscoTestAutomation/genielibs | becee8a1a85f4973e00859e3244e2c8fe45a394c | [
"Apache-2.0"
] | 67 | 2018-12-06T21:08:09.000Z | 2022-03-29T18:00:46.000Z | pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/nxos/interface/get/get_interface_information/test_api_get_interface_information.py | CiscoTestAutomation/genielibs | becee8a1a85f4973e00859e3244e2c8fe45a394c | [
"Apache-2.0"
] | 49 | 2018-06-29T18:59:03.000Z | 2022-03-10T02:07:59.000Z | import unittest
from pyats.topology import loader
from genie.libs.sdk.apis.nxos.interface.get import get_interface_information
class TestGetInterfaceInformation(unittest.TestCase):
@classmethod
def setUpClass(self):
testbed = """
devices:
R3_nx:
connections:
... | 44.703704 | 94 | 0.388567 | import unittest
from pyats.topology import loader
from genie.libs.sdk.apis.nxos.interface.get import get_interface_information
class TestGetInterfaceInformation(unittest.TestCase):
@classmethod
def setUpClass(self):
testbed = """
devices:
R3_nx:
connections:
... | true | true |
f751bf9ac155476a04a92cd0d5020b405d821301 | 15,656 | py | Python | tests/test_internals_database.py | fs111/datasette | c6ff1f23e6a0b26dde8f5b30be3b868b031b6ecf | [
"Apache-2.0"
] | 1 | 2021-04-11T10:19:24.000Z | 2021-04-11T10:19:24.000Z | tests/test_internals_database.py | fs111/datasette | c6ff1f23e6a0b26dde8f5b30be3b868b031b6ecf | [
"Apache-2.0"
] | 4 | 2021-07-11T06:56:18.000Z | 2021-09-14T13:14:21.000Z | tests/test_internals_database.py | sthagen/datasette | e99b7e77697ae3d081e39604069cba6a8c5b6dcd | [
"Apache-2.0"
] | null | null | null | """
Tests for the datasette.database.Database class
"""
from datasette.database import Database, Results, MultipleValues
from datasette.utils.sqlite import sqlite3
from datasette.utils import Column
from .fixtures import app_client, app_client_two_attached_databases_crossdb_enabled
import pytest
import time
import uuid... | 29.373358 | 97 | 0.513541 | from datasette.database import Database, Results, MultipleValues
from datasette.utils.sqlite import sqlite3
from datasette.utils import Column
from .fixtures import app_client, app_client_two_attached_databases_crossdb_enabled
import pytest
import time
import uuid
@pytest.fixture
def db(app_client):
return app_cl... | true | true |
f751bfb2832cfe6cbe1cf29d28886c1b48d31466 | 1,528 | py | Python | aiomangadex/partialchapter.py | lukesaltweather/aiomangadex | 76119c89f7ad387efa321abfb960a359486b9ff4 | [
"Apache-2.0"
] | 1 | 2020-11-09T00:13:50.000Z | 2020-11-09T00:13:50.000Z | aiomangadex/partialchapter.py | lukesaltweather/aiomangadex | 76119c89f7ad387efa321abfb960a359486b9ff4 | [
"Apache-2.0"
] | 3 | 2020-06-14T00:31:56.000Z | 2020-07-02T15:32:57.000Z | aiomangadex/partialchapter.py | lukesaltweather/aiomangadex | 76119c89f7ad387efa321abfb960a359486b9ff4 | [
"Apache-2.0"
] | null | null | null | from collections import namedtuple
from dataclasses import dataclass, field
from datetime import datetime
from typing import List
from .base import MangadexBase
from .exceptions import MangadexException
from .group import Group
from .language import Language
@dataclass(frozen=True)
class PartialChapter(MangadexBase):... | 33.217391 | 105 | 0.717932 | from collections import namedtuple
from dataclasses import dataclass, field
from datetime import datetime
from typing import List
from .base import MangadexBase
from .exceptions import MangadexException
from .group import Group
from .language import Language
@dataclass(frozen=True)
class PartialChapter(MangadexBase):... | true | true |
f751c08b3373387afcfc6a54c12268114411b2b5 | 1,853 | py | Python | tensorflow_compression/__init__.py | jtpils/compression | b758903c6df5eeafb5d444e8cec85d1b2bc132d3 | [
"Apache-2.0"
] | 1 | 2019-07-21T14:10:17.000Z | 2019-07-21T14:10:17.000Z | tensorflow_compression/__init__.py | jtpils/compression | b758903c6df5eeafb5d444e8cec85d1b2bc132d3 | [
"Apache-2.0"
] | null | null | null | tensorflow_compression/__init__.py | jtpils/compression | b758903c6df5eeafb5d444e8cec85d1b2bc132d3 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 Google LLC. 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 a... | 45.195122 | 80 | 0.760389 |
from __future__ import absolute_import as _absolute_import
from __future__ import division as _division
from __future__ import print_function as _print_function
try:
import tensorflow as _tensorflow
_tf_version = [int(v) for v in _tensorflow.version.VERSION.split(".")]
assert _tf_version[0] == 1 a... | true | true |
f751c0f225021910c3c0d6ffbcdca66064e5f7d7 | 38,347 | py | Python | src/transformers/models/flaubert/modeling_tf_flaubert.py | elusenji/transformers | af14c61973effd8b8077ac61b3f24bdd4a632f25 | [
"Apache-2.0"
] | 3 | 2022-01-15T08:06:07.000Z | 2022-03-10T07:13:18.000Z | src/transformers/models/flaubert/modeling_tf_flaubert.py | arron1227/transformers | b18dfd95e1f60ae65a959a7b255fc06522170d1b | [
"Apache-2.0"
] | 1 | 2022-03-26T12:10:11.000Z | 2022-03-26T12:10:11.000Z | src/transformers/models/flaubert/modeling_tf_flaubert.py | arron1227/transformers | b18dfd95e1f60ae65a959a7b255fc06522170d1b | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2019-present, Facebook, Inc and the HuggingFace Inc. team.
#
# 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
#
# Un... | 42.560488 | 151 | 0.646804 |
import itertools
import random
import warnings
from dataclasses import dataclass
from typing import Dict, Optional, Tuple, Union
import numpy as np
import tensorflow as tf
from ...activations_tf import get_tf_activation
from ...modeling_tf_outputs import TFBaseModelOutput
from ...modeling_tf_utils impo... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.