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 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f77351f38f4becdfb0e85a3773afb69af7091d91 | 703 | py | Python | Sources/AlphaBot2/Ultrasonic_Obstacle_Avoidance.py | AaronBrs/SmartC | 79d63d25566520839c372bc0c763a8fc29d6d862 | [
"BSD-2-Clause"
] | null | null | null | Sources/AlphaBot2/Ultrasonic_Obstacle_Avoidance.py | AaronBrs/SmartC | 79d63d25566520839c372bc0c763a8fc29d6d862 | [
"BSD-2-Clause"
] | null | null | null | Sources/AlphaBot2/Ultrasonic_Obstacle_Avoidance.py | AaronBrs/SmartC | 79d63d25566520839c372bc0c763a8fc29d6d862 | [
"BSD-2-Clause"
] | null | null | null | import RPi.GPIO as GPIO
import time
from AlphaBot2 import AlphaBot2
TRIG = 22
ECHO = 27
PWM = 50
Ab = AlphaBot2()
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(TRIG,GPIO.OUT,initial=GPIO.LOW)
GPIO.setup(ECHO,GPIO.IN)
def Distance():
GPIO.output(TRIG,GPIO.HIGH)
time.sleep(0.000015)
GPIO.output(TRIG,GP... | 16.738095 | 42 | 0.69559 | import RPi.GPIO as GPIO
import time
from AlphaBot2 import AlphaBot2
TRIG = 22
ECHO = 27
PWM = 50
Ab = AlphaBot2()
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(TRIG,GPIO.OUT,initial=GPIO.LOW)
GPIO.setup(ECHO,GPIO.IN)
def Distance():
GPIO.output(TRIG,GPIO.HIGH)
time.sleep(0.000015)
GPIO.output(TRIG,GP... | true | true |
f77352001dfc54dba6aa9a3ff5c36c15de6bfec4 | 13,432 | py | Python | fairing/frameworks/lightgbm.py | Jeffwan/fairing | c83ff8653a0744de6cfb65bffe584dc892a074da | [
"Apache-2.0"
] | 2 | 2019-06-27T18:17:06.000Z | 2019-08-14T12:29:32.000Z | fairing/frameworks/lightgbm.py | Jeffwan/fairing | c83ff8653a0744de6cfb65bffe584dc892a074da | [
"Apache-2.0"
] | null | null | null | fairing/frameworks/lightgbm.py | Jeffwan/fairing | c83ff8653a0744de6cfb65bffe584dc892a074da | [
"Apache-2.0"
] | null | null | null | import fairing
from fairing.preprocessors.base import BasePreProcessor
from fairing.builders.append.append import AppendBuilder
from fairing.deployers.job.job import Job
from fairing.deployers.tfjob.tfjob import TfJob
from fairing.constants import constants
from fairing.kubernetes import utils as k8s_utils
from fairing... | 45.378378 | 134 | 0.67101 | import fairing
from fairing.preprocessors.base import BasePreProcessor
from fairing.builders.append.append import AppendBuilder
from fairing.deployers.job.job import Job
from fairing.deployers.tfjob.tfjob import TfJob
from fairing.constants import constants
from fairing.kubernetes import utils as k8s_utils
from fairing... | true | true |
f7735212ac3d4dc063fa1a1c79b3a8d55b3e5665 | 4,248 | py | Python | src/migrations/versions/25a0a520d83a_.py | RasmusGodske/eo-auth | b25d916f8b1bb23ec5ca40de907b038b21d17713 | [
"Apache-2.0"
] | null | null | null | src/migrations/versions/25a0a520d83a_.py | RasmusGodske/eo-auth | b25d916f8b1bb23ec5ca40de907b038b21d17713 | [
"Apache-2.0"
] | 1 | 2021-09-13T15:49:06.000Z | 2021-09-13T15:49:06.000Z | src/migrations/versions/25a0a520d83a_.py | RasmusGodske/eo-auth | b25d916f8b1bb23ec5ca40de907b038b21d17713 | [
"Apache-2.0"
] | 1 | 2022-01-27T14:39:11.000Z | 2022-01-27T14:39:11.000Z | """empty message
Revision ID: 25a0a520d83a
Revises:
Create Date: 2021-11-12 11:45:29.153816
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '25a0a520d83a'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | 47.2 | 117 | 0.7008 | from alembic import op
import sqlalchemy as sa
revision = '25a0a520d83a'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.create_table('login_record',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('subject', sa.String(), nullable=False),
sa.Column('created... | true | true |
f77352719834c770cd969935040aeeb7c8f02fd0 | 5,259 | py | Python | sdk/python/pulumi_azure_native/batch/get_application.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/batch/get_application.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/batch/get_application.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
__al... | 35.533784 | 161 | 0.648222 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
__all__ = [
'GetApplicationResult',
'AwaitableGetApplicationResult',
'get_application',
]
@pulumi.output_type
class GetApplicationResult:
def __init__(__se... | true | true |
f77352c8c4935d5b08d3a8f404d49f2f7579e75b | 2,748 | py | Python | train.py | symphony233/gbnns_dim_red | 2403411600a60ad4365aba3d78a81da144a456b7 | [
"MIT"
] | null | null | null | train.py | symphony233/gbnns_dim_red | 2403411600a60ad4365aba3d78a81da144a456b7 | [
"MIT"
] | null | null | null | train.py | symphony233/gbnns_dim_red | 2403411600a60ad4365aba3d78a81da144a456b7 | [
"MIT"
] | null | null | null | from __future__ import division
import argparse
import numpy as np
import torch
from dim_red.triplet import train_triplet
from dim_red.angular import train_angular
from dim_red.support_func import sanitize
from dim_red.data import load_dataset
if __name__ == '__main__':
parser = argparse.ArgumentParser()
d... | 32.714286 | 116 | 0.640466 | from __future__ import division
import argparse
import numpy as np
import torch
from dim_red.triplet import train_triplet
from dim_red.angular import train_angular
from dim_red.support_func import sanitize
from dim_red.data import load_dataset
if __name__ == '__main__':
parser = argparse.ArgumentParser()
d... | true | true |
f77353df402b4fc0514a499f95f8a881245ff9f0 | 8,192 | py | Python | front-end/testsuite-python-lib/Python-2.2/Lib/distutils/core.py | MalloyPower/parsing-python | b2bca5eed07ea2af7a2001cd4f63becdfb0570be | [
"MIT"
] | 1 | 2020-11-26T18:53:46.000Z | 2020-11-26T18:53:46.000Z | front-end/testsuite-python-lib/Python-2.2/Lib/distutils/core.py | MalloyPower/parsing-python | b2bca5eed07ea2af7a2001cd4f63becdfb0570be | [
"MIT"
] | null | null | null | front-end/testsuite-python-lib/Python-2.2/Lib/distutils/core.py | MalloyPower/parsing-python | b2bca5eed07ea2af7a2001cd4f63becdfb0570be | [
"MIT"
] | 1 | 2019-04-11T11:27:01.000Z | 2019-04-11T11:27:01.000Z | """distutils.core
The only module that needs to be imported to use the Distutils; provides
the 'setup' function (which is to be called from the setup script). Also
indirectly provides the Distribution and Command classes, although they are
really defined in distutils.dist and distutils.cmd.
"""
# created 1999/03/01,... | 35.310345 | 77 | 0.670898 | """distutils.core
The only module that needs to be imported to use the Distutils; provides
the 'setup' function (which is to be called from the setup script). Also
indirectly provides the Distribution and Command classes, although they are
really defined in distutils.dist and distutils.cmd.
"""
__revision__ = "$Id:... | false | true |
f77353fbe7782d900105725fc9edae77d4339f67 | 19,907 | py | Python | novel_stego_protocol/textgenrnn/textgenrnn.py | tkShir/EC521-Group6-Novel-Steganographic-Scheme | d01ff5b625d5ef85790451fa62e5c33f15f06f0d | [
"0BSD"
] | null | null | null | novel_stego_protocol/textgenrnn/textgenrnn.py | tkShir/EC521-Group6-Novel-Steganographic-Scheme | d01ff5b625d5ef85790451fa62e5c33f15f06f0d | [
"0BSD"
] | null | null | null | novel_stego_protocol/textgenrnn/textgenrnn.py | tkShir/EC521-Group6-Novel-Steganographic-Scheme | d01ff5b625d5ef85790451fa62e5c33f15f06f0d | [
"0BSD"
] | null | null | null | import json
import re
import numpy as np
import tensorflow as tf
import tqdm
from pkg_resources import resource_filename
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.preprocessing import LabelBinarizer
from tensorflow import... | 42.175847 | 94 | 0.521123 | import json
import re
import numpy as np
import tensorflow as tf
import tqdm
from pkg_resources import resource_filename
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.preprocessing import LabelBinarizer
from tensorflow import... | true | true |
f773547483fbf7828118b7b3ff2e537e05b9628c | 2,501 | py | Python | youtube_dl/extractor/snotr.py | hackarada/youtube-dl | 2ba46715a41fe074eab2221170b2ac78fab93fad | [
"Unlicense"
] | 66,635 | 2019-03-10T21:34:18.000Z | 2022-03-31T23:50:31.000Z | youtube_dl/extractor/snotr.py | hackarada/youtube-dl | 2ba46715a41fe074eab2221170b2ac78fab93fad | [
"Unlicense"
] | 10,936 | 2019-03-10T21:35:47.000Z | 2022-03-31T23:46:52.000Z | youtube_dl/extractor/snotr.py | hackarada/youtube-dl | 2ba46715a41fe074eab2221170b2ac78fab93fad | [
"Unlicense"
] | 15,194 | 2019-03-10T21:09:27.000Z | 2022-03-31T22:13:49.000Z | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
parse_duration,
parse_filesize,
str_to_int,
)
class SnotrIE(InfoExtractor):
_VALID_URL = r'http?://(?:www\.)?snotr\.com/video/(?P<id>\d+)/([\w]+)'
_TESTS = [{
'url': ... | 33.797297 | 99 | 0.554578 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
parse_duration,
parse_filesize,
str_to_int,
)
class SnotrIE(InfoExtractor):
_VALID_URL = r'http?://(?:www\.)?snotr\.com/video/(?P<id>\d+)/([\w]+)'
_TESTS = [{
'url': 'http://www.snot... | true | true |
f773547bf47086a1fabdebb67014daff880a19c6 | 1,493 | py | Python | onnx_tf/handlers/backend/sequence_erase.py | malisit/onnx-tensorflow | 3eb41dc923f350ca533f1024f602a842dd55de45 | [
"Apache-2.0"
] | 1,110 | 2017-11-13T19:34:24.000Z | 2022-03-29T09:14:56.000Z | onnx_tf/handlers/backend/sequence_erase.py | malisit/onnx-tensorflow | 3eb41dc923f350ca533f1024f602a842dd55de45 | [
"Apache-2.0"
] | 768 | 2017-11-17T00:06:27.000Z | 2022-03-31T20:20:09.000Z | onnx_tf/handlers/backend/sequence_erase.py | malisit/onnx-tensorflow | 3eb41dc923f350ca533f1024f602a842dd55de45 | [
"Apache-2.0"
] | 281 | 2017-11-16T19:56:17.000Z | 2022-03-28T06:25:33.000Z | import tensorflow as tf
from onnx_tf.handlers.backend_handler import BackendHandler
from onnx_tf.handlers.handler import onnx_op
@onnx_op("SequenceErase")
class SequenceErase(BackendHandler):
@classmethod
def chk_pos_in_bounds(cls, input_seq, pos):
"""
Check the position is in-bounds with respect to the... | 32.456522 | 71 | 0.700603 | import tensorflow as tf
from onnx_tf.handlers.backend_handler import BackendHandler
from onnx_tf.handlers.handler import onnx_op
@onnx_op("SequenceErase")
class SequenceErase(BackendHandler):
@classmethod
def chk_pos_in_bounds(cls, input_seq, pos):
seq_length = tf.shape(input_seq.to_sparse(), out_type=pos.d... | true | true |
f773548040599e4968a3d5de0fc4d0f9dd378ebe | 10,537 | py | Python | package/Benchmarking/_database/collection.py | JoeyHendricks/PyBench | d42cd8913c5dc22ab6b33b90cf12d5c04b193ce7 | [
"MIT"
] | 13 | 2022-02-04T17:06:03.000Z | 2022-03-29T16:34:02.000Z | package/Benchmarking/_database/collection.py | JoeyHendricks/PyBench | d42cd8913c5dc22ab6b33b90cf12d5c04b193ce7 | [
"MIT"
] | 1 | 2022-01-22T11:41:20.000Z | 2022-01-22T11:41:20.000Z | package/Benchmarking/_database/collection.py | JoeyHendricks/python-micro-benchmarks | d42cd8913c5dc22ab6b33b90cf12d5c04b193ce7 | [
"MIT"
] | 2 | 2022-02-07T14:51:42.000Z | 2022-02-08T04:50:52.000Z | from .._database.common import CommonDatabaseInteractions
from .._utilities.defaults import default_sqlite_database_name
from .._configuration import options
from sqlalchemy import select, func
from tempfile import gettempdir
class Create(CommonDatabaseInteractions):
def __init__(self):
super(Create, sel... | 32.421538 | 112 | 0.552339 | from .._database.common import CommonDatabaseInteractions
from .._utilities.defaults import default_sqlite_database_name
from .._configuration import options
from sqlalchemy import select, func
from tempfile import gettempdir
class Create(CommonDatabaseInteractions):
def __init__(self):
super(Create, sel... | true | true |
f773552d0ad23326c61f5f2c1841356667d10725 | 161 | py | Python | app/api_1_0/__init__.py | ukblumf/randomise-it | 0610721eba649dfa205b0d3c4b3e24d67aa1d781 | [
"MIT"
] | null | null | null | app/api_1_0/__init__.py | ukblumf/randomise-it | 0610721eba649dfa205b0d3c4b3e24d67aa1d781 | [
"MIT"
] | null | null | null | app/api_1_0/__init__.py | ukblumf/randomise-it | 0610721eba649dfa205b0d3c4b3e24d67aa1d781 | [
"MIT"
] | null | null | null | from flask import Blueprint
api = Blueprint('api', __name__)
from . import authentication, posts, users, errors, tables, macros, collections, marketplace
| 26.833333 | 93 | 0.751553 | from flask import Blueprint
api = Blueprint('api', __name__)
from . import authentication, posts, users, errors, tables, macros, collections, marketplace
| true | true |
f773555d6f795899fe041fd1819856ea544b4f95 | 1,287 | py | Python | DemOpenGL/proesch/simple/simpleAnimation.py | ismaelxyz/graphic-concentration | 2573ed7dc5df907bf5fe89704bf3f009cb083784 | [
"MIT"
] | 1 | 2021-08-22T01:59:27.000Z | 2021-08-22T01:59:27.000Z | DemOpenGL/proesch/simple/simpleAnimation.py | ismaelxyz/graphic-concentration | 2573ed7dc5df907bf5fe89704bf3f009cb083784 | [
"MIT"
] | null | null | null | DemOpenGL/proesch/simple/simpleAnimation.py | ismaelxyz/graphic-concentration | 2573ed7dc5df907bf5fe89704bf3f009cb083784 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from time import sleep
from OpenGL.GLUT import *
from OpenGL.GL import *
from OpenGL.GLU import *
animationAngle = 0.0
frameRate = 25
def doAnimationStep():
"""Update animated parameters.
This Function is made active by glutSetIdleFunc"""
globa... | 21.098361 | 54 | 0.668998 |
import sys
from time import sleep
from OpenGL.GLUT import *
from OpenGL.GL import *
from OpenGL.GLU import *
animationAngle = 0.0
frameRate = 25
def doAnimationStep():
global animationAngle
global frameRate
animationAngle += 1
while animationAngle > 360:
animationAngle -= 360
sleep(1 / ... | true | true |
f773557dd734486e8c7cc31879c0d1aeaf6cdb8f | 2,471 | py | Python | dd/api/workflow/tests/tests_actions.py | octo-technology/ddapi | 08b56016bf59a02c42d79a117a8de1e23e5b4f90 | [
"Apache-2.0"
] | 4 | 2019-06-09T13:15:37.000Z | 2020-12-22T08:37:36.000Z | dd/api/workflow/tests/tests_actions.py | octo-technology/ddapi | 08b56016bf59a02c42d79a117a8de1e23e5b4f90 | [
"Apache-2.0"
] | null | null | null | dd/api/workflow/tests/tests_actions.py | octo-technology/ddapi | 08b56016bf59a02c42d79a117a8de1e23e5b4f90 | [
"Apache-2.0"
] | null | null | null | import unittest
from mock import MagicMock
from dd.api.contexts.local import LocalContext
from dd.api.workflow.actions import Action
from dd.api.workflow.callables import ActionCallableBuilder
class TestActions(unittest.TestCase):
def setUp(self):
self.dataset = MagicMock()
self.context = MagicM... | 29.070588 | 82 | 0.659652 | import unittest
from mock import MagicMock
from dd.api.contexts.local import LocalContext
from dd.api.workflow.actions import Action
from dd.api.workflow.callables import ActionCallableBuilder
class TestActions(unittest.TestCase):
def setUp(self):
self.dataset = MagicMock()
self.context = MagicM... | true | true |
f7735686db98077eb38d0bd88847b935117b7bf1 | 3,889 | py | Python | examples/planar_hand_ball/run_planar_hand.py | pangtao22/quasistatic_simulator | 7c6f99cc7237dd922f6eb0b54c580303e86b5223 | [
"MIT"
] | 5 | 2021-07-15T03:58:55.000Z | 2021-12-23T17:26:16.000Z | examples/planar_hand_ball/run_planar_hand.py | pangtao22/quasistatic_simulator | 7c6f99cc7237dd922f6eb0b54c580303e86b5223 | [
"MIT"
] | 5 | 2021-08-16T22:27:54.000Z | 2022-02-07T18:06:07.000Z | examples/planar_hand_ball/run_planar_hand.py | pangtao22/quasistatic_simulator | 7c6f99cc7237dd922f6eb0b54c580303e86b5223 | [
"MIT"
] | null | null | null | import os
import numpy as np
from pydrake.all import PiecewisePolynomial
from examples.setup_simulations import (
run_quasistatic_sim)
from qsim.parser import QuasistaticParser, QuasistaticSystemBackend
from qsim.model_paths import models_dir
from qsim.simulator import GradientMode
#%% sim setup
q_model_path = ... | 32.408333 | 82 | 0.673181 | import os
import numpy as np
from pydrake.all import PiecewisePolynomial
from examples.setup_simulations import (
run_quasistatic_sim)
from qsim.parser import QuasistaticParser, QuasistaticSystemBackend
from qsim.model_paths import models_dir
from qsim.simulator import GradientMode
q_model_path = os.path.join(m... | true | true |
f77356a90f4c9b21a14af3dff07630f3239d9f92 | 760 | py | Python | workflows/elasticities.py | micom-dev/paper | a347dd40f498665462acfa1ee65db316c82650ef | [
"Apache-2.0"
] | 2 | 2020-01-23T19:38:38.000Z | 2020-05-10T19:22:20.000Z | workflows/elasticities.py | micom-dev/paper | a347dd40f498665462acfa1ee65db316c82650ef | [
"Apache-2.0"
] | 7 | 2020-04-09T16:06:43.000Z | 2021-03-25T21:38:08.000Z | workflows/elasticities.py | micom-dev/paper | a347dd40f498665462acfa1ee65db316c82650ef | [
"Apache-2.0"
] | 2 | 2020-02-18T00:46:43.000Z | 2020-05-20T21:35:47.000Z | """Calculate the elasticities for a set of built models."""
from os.path import isfile
import micom
from micom import load_pickle
from micom.elasticity import elasticities
from micom.workflows import workflow
logger = micom.logger.logger
try:
max_procs = snakemake.threads
except NameError:
max_procs = 20
d... | 25.333333 | 59 | 0.721053 |
from os.path import isfile
import micom
from micom import load_pickle
from micom.elasticity import elasticities
from micom.workflows import workflow
logger = micom.logger.logger
try:
max_procs = snakemake.threads
except NameError:
max_procs = 20
def elasticity_worker(sam):
model_file = "data/models/" +... | true | true |
f773589376142ae2110fd5f8b8b1a7b6ae75e133 | 66,408 | py | Python | src/pysoda/pysoda.py | bvhpatel/SODA | 23978d8e4864b19968c6bfd67cb27604e4c8c2d0 | [
"MIT"
] | 16 | 2019-11-19T02:19:16.000Z | 2022-01-09T04:51:50.000Z | src/pysoda/pysoda.py | bvhpatel/SODA | 23978d8e4864b19968c6bfd67cb27604e4c8c2d0 | [
"MIT"
] | 6 | 2020-06-17T19:37:08.000Z | 2021-08-03T21:01:25.000Z | src/pysoda/pysoda.py | bvhpatel/SODA | 23978d8e4864b19968c6bfd67cb27604e4c8c2d0 | [
"MIT"
] | 7 | 2019-11-08T20:45:32.000Z | 2021-09-15T22:45:18.000Z | # -*- coding: utf-8 -*-
### Import required python modules
from gevent import monkey; monkey.patch_all()
import platform
import os
from os import listdir, stat, makedirs, mkdir, walk, remove, pardir
from os.path import isdir, isfile, join, splitext, getmtime, basename, normpath, exists, expanduser, split, dirname, ge... | 35.876823 | 335 | 0.626626 |
from gevent import monkey; monkey.patch_all()
import platform
import os
from os import listdir, stat, makedirs, mkdir, walk, remove, pardir
from os.path import isdir, isfile, join, splitext, getmtime, basename, normpath, exists, expanduser, split, dirname, getsize, abspath
import pandas as pd
import time
from time im... | true | true |
f77359151a356ec6a401ac2ae32b916b34847e05 | 855 | py | Python | tests/test_garbagetruck.py | bradrf/garbagetruck | d0066c79eaeb86a152e2eb0fbde649c6f9fd8c06 | [
"MIT"
] | 1 | 2018-04-18T05:15:00.000Z | 2018-04-18T05:15:00.000Z | tests/test_garbagetruck.py | bradrf/garbagetruck | d0066c79eaeb86a152e2eb0fbde649c6f9fd8c06 | [
"MIT"
] | 18 | 2016-10-01T16:38:27.000Z | 2022-03-24T15:11:36.000Z | tests/test_garbagetruck.py | bradrf/garbagetruck | d0066c79eaeb86a152e2eb0fbde649c6f9fd8c06 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_garbagetruck
----------------------------------
Tests for `garbagetruck` module.
"""
import pytest
from contextlib import contextmanager
from click.testing import CliRunner
from garbagetruck import garbagetruck
from garbagetruck import cli
class TestGarbaget... | 21.375 | 66 | 0.649123 |
import pytest
from contextlib import contextmanager
from click.testing import CliRunner
from garbagetruck import garbagetruck
from garbagetruck import cli
class TestGarbagetruck(object):
@classmethod
def setup_class(cls):
pass
def test_something(self):
pass
def test_command_line_... | true | true |
f773595a0f3d92851515d2a28c89b2da5ab51162 | 1,404 | py | Python | schedules/migrations/0001_initial.py | cornend/church_site | 8d61a4fa3fcbdc88b6cd95fb81d23994756a1128 | [
"MIT"
] | null | null | null | schedules/migrations/0001_initial.py | cornend/church_site | 8d61a4fa3fcbdc88b6cd95fb81d23994756a1128 | [
"MIT"
] | 44 | 2020-05-13T20:15:26.000Z | 2022-03-04T02:58:58.000Z | schedules/migrations/0001_initial.py | cornend/church_site | 8d61a4fa3fcbdc88b6cd95fb81d23994756a1128 | [
"MIT"
] | 4 | 2020-06-05T17:59:52.000Z | 2021-02-06T19:09:43.000Z | # Generated by Django 3.0.6 on 2020-05-13 20:12
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('churches', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='... | 39 | 149 | 0.571937 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('churches', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Event',
fields=[
('i... | true | true |
f77359926e3cfd90dabf820725f7b424db26fae2 | 92 | py | Python | mlbench_core/models/pytorch/transformer/__init__.py | mammadhajili/mlbench-core | 0c12ee386973109254e731aaf79b2eee6d58f57e | [
"Apache-2.0"
] | 14 | 2018-11-12T17:23:32.000Z | 2022-03-11T22:45:49.000Z | mlbench_core/models/pytorch/transformer/__init__.py | mammadhajili/mlbench-core | 0c12ee386973109254e731aaf79b2eee6d58f57e | [
"Apache-2.0"
] | 330 | 2018-10-09T12:15:56.000Z | 2022-03-01T18:07:40.000Z | mlbench_core/models/pytorch/transformer/__init__.py | mammadhajili/mlbench-core | 0c12ee386973109254e731aaf79b2eee6d58f57e | [
"Apache-2.0"
] | 9 | 2019-02-28T19:11:58.000Z | 2020-08-17T17:52:37.000Z | from .sequence_generator import SequenceGenerator
from .transformer import TransformerModel
| 30.666667 | 49 | 0.891304 | from .sequence_generator import SequenceGenerator
from .transformer import TransformerModel
| true | true |
f77359eaff6de1c4bd897493aeeb48b66dac6794 | 1,117 | py | Python | setup.py | mikaraunio/omamittari-py | 9ce96c3d4ef7f63725d8062e9997b78d88fb1167 | [
"BSD-3-Clause"
] | null | null | null | setup.py | mikaraunio/omamittari-py | 9ce96c3d4ef7f63725d8062e9997b78d88fb1167 | [
"BSD-3-Clause"
] | null | null | null | setup.py | mikaraunio/omamittari-py | 9ce96c3d4ef7f63725d8062e9997b78d88fb1167 | [
"BSD-3-Clause"
] | null | null | null | import os
from setuptools import setup
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
return f.read()
def requires():
with open("requirements.txt", "r") as f:
return [r.strip() for r in f.readlines()]
setup(name='omamittari',
version='0.9.0',
des... | 31.027778 | 71 | 0.589078 | import os
from setuptools import setup
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
return f.read()
def requires():
with open("requirements.txt", "r") as f:
return [r.strip() for r in f.readlines()]
setup(name='omamittari',
version='0.9.0',
des... | true | true |
f7735a8d1d74a99415f4666b4d244ff65e7de08e | 976 | py | Python | examples/02_min-h4/eri/diff_evals.py | Paul-St-Young/eried | 63dbcab435a1fbe65b3b727a6c4b743497f60862 | [
"MIT"
] | 1 | 2021-10-08T02:13:11.000Z | 2021-10-08T02:13:11.000Z | examples/02_min-h4/eri/diff_evals.py | Paul-St-Young/eried | 63dbcab435a1fbe65b3b727a6c4b743497f60862 | [
"MIT"
] | null | null | null | examples/02_min-h4/eri/diff_evals.py | Paul-St-Young/eried | 63dbcab435a1fbe65b3b727a6c4b743497f60862 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import yaml
import numpy as np
def read_evals(fyml):
with open(fyml, 'r') as f:
evd = yaml.safe_load(f)
elist = evd['evals']
return np.array(elist)
def main():
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('nup', type=int)
parser.add_argumen... | 25.684211 | 71 | 0.657787 | import yaml
import numpy as np
def read_evals(fyml):
with open(fyml, 'r') as f:
evd = yaml.safe_load(f)
elist = evd['evals']
return np.array(elist)
def main():
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('nup', type=int)
parser.add_argument('ndn', type=int)
pa... | true | true |
f7735ad4b7f1e188294dfb71d56340484bc584fe | 2,866 | py | Python | main.py | Yarik856/pythonMultiplayer | 62e5717683e192e8f0a2aa1c9ef8e771cab63c59 | [
"CC0-1.0"
] | null | null | null | main.py | Yarik856/pythonMultiplayer | 62e5717683e192e8f0a2aa1c9ef8e771cab63c59 | [
"CC0-1.0"
] | null | null | null | main.py | Yarik856/pythonMultiplayer | 62e5717683e192e8f0a2aa1c9ef8e771cab63c59 | [
"CC0-1.0"
] | null | null | null | #создай тут фоторедактор Easy Editor!
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import *
from PIL import Image
from PIL import ImageFilter
from PyQt5.QtGui import QPixmap
app = QApplication([])
window1 = QWidget()
i = 0
spisok = QListWidget()
line1 = QVBoxLayout()
line2 = QVBoxLayout()
line3 = QH... | 23.491803 | 106 | 0.660154 | from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import *
from PIL import Image
from PIL import ImageFilter
from PyQt5.QtGui import QPixmap
app = QApplication([])
window1 = QWidget()
i = 0
spisok = QListWidget()
line1 = QVBoxLayout()
line2 = QVBoxLayout()
line3 = QHBoxLayout()
line4 = QHBoxLayout()
lin... | true | true |
f7735afa510be605b5b69822fe83790cfd339378 | 556 | py | Python | tabcmd/execution/tabcmd_controller.py | WillAyd/tabcmd | 1ba4a6ce1586b5ec4286aca0edff0fbaa1c69f15 | [
"MIT"
] | null | null | null | tabcmd/execution/tabcmd_controller.py | WillAyd/tabcmd | 1ba4a6ce1586b5ec4286aca0edff0fbaa1c69f15 | [
"MIT"
] | null | null | null | tabcmd/execution/tabcmd_controller.py | WillAyd/tabcmd | 1ba4a6ce1586b5ec4286aca0edff0fbaa1c69f15 | [
"MIT"
] | null | null | null | from .map_of_commands import *
from .map_of_parsers import *
from .parent_parser import ParentParser
"""
This is where we go through all the parsers and manually attach them to a command
"""
class TabcmdController:
def initialize_parsers(self):
manager = ParentParser()
parent = manager.get_root_... | 25.272727 | 81 | 0.710432 | from .map_of_commands import *
from .map_of_parsers import *
from .parent_parser import ParentParser
class TabcmdController:
def initialize_parsers(self):
manager = ParentParser()
parent = manager.get_root_parser()
commands = CommandsMap.commands_hash_map
parsers = ParsersMap.pa... | true | true |
f7735b15a0cf688ee931cccb64a904e5a18453f4 | 8,922 | py | Python | mathics/test.py | pqtoan/mathics | a08db9475c12585b5bd1701fd42b627062b6ad1e | [
"Apache-2.0"
] | null | null | null | mathics/test.py | pqtoan/mathics | a08db9475c12585b5bd1701fd42b627062b6ad1e | [
"Apache-2.0"
] | null | null | null | mathics/test.py | pqtoan/mathics | a08db9475c12585b5bd1701fd42b627062b6ad1e | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
import sys
import re
import pickle
import os
from argparse import ArgumentParser
import six
from six.moves import zip
import mathics
from mathics.core.def... | 32.922509 | 107 | 0.590451 |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
import sys
import re
import pickle
import os
from argparse import ArgumentParser
import six
from six.moves import zip
import mathics
from mathics.core.definitions import Definitions
from mathics.core.... | true | true |
f7735b875a84ad71da25ed6250e97f523f61c1cf | 2,335 | py | Python | config/settings/local.py | bihealth/digestiflow-server | 298c53f95dbf56e7be0d0b8bcceacabc21257d5f | [
"MIT"
] | 13 | 2019-11-27T19:12:15.000Z | 2021-12-01T21:32:18.000Z | config/settings/local.py | bihealth/digestiflow-server | 298c53f95dbf56e7be0d0b8bcceacabc21257d5f | [
"MIT"
] | 60 | 2019-03-27T14:43:19.000Z | 2022-03-22T09:12:53.000Z | config/settings/local.py | bihealth/digestiflow-server | 298c53f95dbf56e7be0d0b8bcceacabc21257d5f | [
"MIT"
] | 3 | 2020-11-09T07:08:42.000Z | 2022-02-09T11:37:54.000Z | """
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
"""
from .base import * # noqa
import socket
import os
# APP CONFIGURATION
# ------------------------------------------------------------------------------
# INSTALLED_APPS += ['guni... | 29.556962 | 98 | 0.501071 |
from .base import *
import socket
import os
DEBUG = env.bool("DJANGO_DEBUG", default=True)
TEMPLATES[0]["OPTIONS"]["debug"] = DEBUG
SECRET_KEY = env("DJANGO_SECRET_KEY", default="CHANGEME!!!")
EMAIL_PORT = 1025
EMAIL_HOST = "localhost"
EMAIL_BACKEND = env(
"DJANGO_EMAIL_BACKEND", default="django.core.mail.b... | true | true |
f7735cee8744439e05c26f59b356530f24ff8aad | 24,348 | py | Python | hdfs_wizard.py | pathbreak/hdfs-linode | add7ff672892567739a169f8050f12798dcb5c1f | [
"MIT"
] | 1 | 2021-12-02T20:04:04.000Z | 2021-12-02T20:04:04.000Z | hdfs_wizard.py | pathbreak/hdfs-linode | add7ff672892567739a169f8050f12798dcb5c1f | [
"MIT"
] | null | null | null | hdfs_wizard.py | pathbreak/hdfs-linode | add7ff672892567739a169f8050f12798dcb5c1f | [
"MIT"
] | null | null | null | '''
HDFS cluster creation wizard with a console UI.
'''
from __future__ import print_function
import sys
import re
import math
import os
from os import path
import simplejson as json
import collections
from linodecommon import logger
from linodecommon import linode_api
from terminaltables import AsciiTable, SingleTa... | 34.882521 | 143 | 0.523698 |
from __future__ import print_function
import sys
import re
import math
import os
from os import path
import simplejson as json
import collections
from linodecommon import logger
from linodecommon import linode_api
from terminaltables import AsciiTable, SingleTable
class MainWizard(object):
def __init__(sel... | true | true |
f7735d445f67ddba6c2e2799aa21e23054cb933c | 18 | py | Python | anguine/__init__.py | vertexproject/anguine | e6c6cbf91c08b381be57e54a665034415a2d6c5b | [
"Apache-2.0"
] | null | null | null | anguine/__init__.py | vertexproject/anguine | e6c6cbf91c08b381be57e54a665034415a2d6c5b | [
"Apache-2.0"
] | null | null | null | anguine/__init__.py | vertexproject/anguine | e6c6cbf91c08b381be57e54a665034415a2d6c5b | [
"Apache-2.0"
] | null | null | null | version = (0,0,0)
| 9 | 17 | 0.555556 | version = (0,0,0)
| true | true |
f7735e0f830a585bcceba7725bddcdc9544f6542 | 7,086 | py | Python | pytest_play/engine.py | Rayapur/pytest-play | c39a1a7e74d90aebeb30797a61d0e491942557e8 | [
"Apache-2.0"
] | 51 | 2018-04-26T09:02:38.000Z | 2021-11-21T10:57:32.000Z | pytest_play/engine.py | Rayapur/pytest-play | c39a1a7e74d90aebeb30797a61d0e491942557e8 | [
"Apache-2.0"
] | 39 | 2017-12-20T14:27:33.000Z | 2018-04-05T22:45:12.000Z | pytest_play/engine.py | tierratelematics/pytest-play | c39a1a7e74d90aebeb30797a61d0e491942557e8 | [
"Apache-2.0"
] | 5 | 2018-06-30T15:51:39.000Z | 2020-04-13T19:31:25.000Z | # -*- coding: utf-8 -*-
import os
import json
import re
import datetime
import logging
import yaml
import pkg_resources
import time
from zope import component
from zope.interface import Interface
from parametrizer import Parametrizer
logger = logging.getLogger(__name__)
class ICommandProvider(Interface):
""" Ma... | 31.918919 | 76 | 0.563647 | import os
import json
import re
import datetime
import logging
import yaml
import pkg_resources
import time
from zope import component
from zope.interface import Interface
from parametrizer import Parametrizer
logger = logging.getLogger(__name__)
class ICommandProvider(Interface):
class PlayEngine(object):
_... | true | true |
f7735e52fdab753bace7469199a636e32e9af8c0 | 2,636 | py | Python | cargo_parse/parse.py | Deca-Technologies/cargo-parse | 2263f55f40adc22f797fb7514818753e84dc5887 | [
"MIT"
] | 1 | 2021-12-10T18:22:57.000Z | 2021-12-10T18:22:57.000Z | cargo_parse/parse.py | Deca-Technologies/cargo-parse | 2263f55f40adc22f797fb7514818753e84dc5887 | [
"MIT"
] | null | null | null | cargo_parse/parse.py | Deca-Technologies/cargo-parse | 2263f55f40adc22f797fb7514818753e84dc5887 | [
"MIT"
] | null | null | null | from pathlib import Path
from typing import Dict, List
import toml
from pydantic import parse_obj_as
from cargo_parse.models.cargo_toml import (
CargoTomlData,
DependencyData,
FeaturesData,
PatchData,
ProfileData,
)
from cargo_parse.models.dependency import Dependency
from cargo_parse.models.featu... | 30.298851 | 77 | 0.709788 | from pathlib import Path
from typing import Dict, List
import toml
from pydantic import parse_obj_as
from cargo_parse.models.cargo_toml import (
CargoTomlData,
DependencyData,
FeaturesData,
PatchData,
ProfileData,
)
from cargo_parse.models.dependency import Dependency
from cargo_parse.models.featu... | true | true |
f7735e83b1eaa53abb64d74c83f1332f1bd8523e | 2,991 | py | Python | Models/Scheduler/Regular/V1/model.py | schmocker/Pyjamas | 52a72d6e8b915f77a2194d4e7d53c46d0ec28c17 | [
"MIT"
] | 2 | 2018-05-31T15:02:08.000Z | 2018-07-11T11:02:44.000Z | Models/Scheduler/Regular/V1/model.py | schmocker/Pyjamas | 52a72d6e8b915f77a2194d4e7d53c46d0ec28c17 | [
"MIT"
] | null | null | null | Models/Scheduler/Regular/V1/model.py | schmocker/Pyjamas | 52a72d6e8b915f77a2194d4e7d53c46d0ec28c17 | [
"MIT"
] | null | null | null | import asyncio
from pyjamas_core.util import Input, Output, Property
from pyjamas_core.supermodel import Supermodel
class Model(Supermodel):
"""
schedules the func gates of the agent
sets the number of elapsed rounds as output
"""
def __init__(self, uuid, name: str):
super(Model, ... | 39.355263 | 125 | 0.63223 | import asyncio
from pyjamas_core.util import Input, Output, Property
from pyjamas_core.supermodel import Supermodel
class Model(Supermodel):
def __init__(self, uuid, name: str):
super(Model, self).__init__(uuid,name)
self.elapsed = 0
self.outputs['num_elapsed'] = Output('Number Elapsed',... | true | true |
f7735ef8c76cc63e4e9385168176fc46b20f8689 | 5,581 | py | Python | dnacentersdk/models/validators/v2_1_2/jsd_08bd88834a68a2e6.py | oboehmer/dnacentersdk | 25c4e99900640deee91a56aa886874d9cb0ca960 | [
"MIT"
] | 32 | 2019-09-05T05:16:56.000Z | 2022-03-22T09:50:38.000Z | dnacentersdk/models/validators/v2_1_2/jsd_08bd88834a68a2e6.py | oboehmer/dnacentersdk | 25c4e99900640deee91a56aa886874d9cb0ca960 | [
"MIT"
] | 35 | 2019-09-07T18:58:54.000Z | 2022-03-24T19:29:36.000Z | dnacentersdk/models/validators/v2_1_2/jsd_08bd88834a68a2e6.py | oboehmer/dnacentersdk | 25c4e99900640deee91a56aa886874d9cb0ca960 | [
"MIT"
] | 18 | 2019-09-09T11:07:21.000Z | 2022-03-25T08:49:59.000Z | # -*- coding: utf-8 -*-
"""Cisco DNA Center Create sensor test template data model.
Copyright (c) 2019-2021 Cisco Systems.
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, inc... | 26.961353 | 78 | 0.360867 |
from __future__ import (
absolute_import,
division,
print_function,
unicode_literals,
)
import fastjsonschema
import json
from dnacentersdk.exceptions import MalformedRequest
from builtins import *
class JSONSchemaValidator08Bd88834A68A2E6(object):
def __init__(self):
super(JSONSchemaV... | true | true |
f7735f24fb04611930f9f903b9d3236a97deb3d0 | 113 | py | Python | netbox/nagios/apps.py | rinsekloek/netbox | ad52065de2d25e2684383327be01910b2bf76ae8 | [
"Apache-2.0"
] | 1 | 2020-06-15T00:09:10.000Z | 2020-06-15T00:09:10.000Z | netbox/nagios/apps.py | rinsekloek/netbox | ad52065de2d25e2684383327be01910b2bf76ae8 | [
"Apache-2.0"
] | 1 | 2019-09-19T15:10:06.000Z | 2019-09-19T15:10:06.000Z | netbox/nagios/apps.py | rinsekloek/netbox | ad52065de2d25e2684383327be01910b2bf76ae8 | [
"Apache-2.0"
] | 1 | 2019-09-20T08:12:17.000Z | 2019-09-20T08:12:17.000Z | from django.apps import AppConfig
class DCIMConfig(AppConfig):
name = "nagios"
verbose_name = "NAGIOS"
| 16.142857 | 33 | 0.716814 | from django.apps import AppConfig
class DCIMConfig(AppConfig):
name = "nagios"
verbose_name = "NAGIOS"
| true | true |
f7736066b63d6ccfdea70836461980fd62adadd4 | 4,013 | py | Python | athenet/algorithm/simple_neuron_deleter2.py | heurezjusz/Athena | 0bdda97b0e06dbb3c1699d4ed7875e4adc96d580 | [
"BSD-2-Clause"
] | 2 | 2016-02-02T12:59:39.000Z | 2018-03-29T17:17:11.000Z | athenet/algorithm/simple_neuron_deleter2.py | heurezjusz/Athenet | 0bdda97b0e06dbb3c1699d4ed7875e4adc96d580 | [
"BSD-2-Clause"
] | 5 | 2016-01-10T23:23:57.000Z | 2016-03-26T16:29:42.000Z | athenet/algorithm/simple_neuron_deleter2.py | heurezjusz/Athena | 0bdda97b0e06dbb3c1699d4ed7875e4adc96d580 | [
"BSD-2-Clause"
] | 1 | 2020-02-26T20:19:17.000Z | 2020-02-26T20:19:17.000Z | """
sender - SimplE Neuron DEleteR
Deletes the least significant neurons.
Outgoing value of neuron is defined as sum of absolute values of
weights outgoing from neuron divided by sum of absolute values of
weights outgoing from entire layer.
Ingoing value of neuron is defined as sum of absolute ... | 41.802083 | 79 | 0.65861 |
import numpy as np
from athenet.layers import FullyConnectedLayer, ConvolutionalLayer, MaxPool
from athenet.algorithm.utils import list_of_percentage_columns, \
list_of_percentage_rows, delete_column, delete_row
def simple_neuron_deleter2(network, p, layer_limit):
assert p >= 0. and p <= 1.
assert layer... | true | true |
f7736108867d1a32bc856ed3bd03f0b6e5bd607b | 10,057 | py | Python | Python/sqlmlutils/sqlpythonexecutor.py | TheRockStarDBA/sqlmlutils | 956bdd72638a649f0e613f100fbb81c900dcb65e | [
"MIT"
] | 1 | 2020-03-19T18:03:20.000Z | 2020-03-19T18:03:20.000Z | Python/sqlmlutils/sqlpythonexecutor.py | TheRockStarDBA/sqlmlutils | 956bdd72638a649f0e613f100fbb81c900dcb65e | [
"MIT"
] | null | null | null | Python/sqlmlutils/sqlpythonexecutor.py | TheRockStarDBA/sqlmlutils | 956bdd72638a649f0e613f100fbb81c900dcb65e | [
"MIT"
] | null | null | null | # Copyright(c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
from typing import Callable
import dill
from pandas import DataFrame
from .connectioninfo import ConnectionInfo
from .sqlqueryexecutor import execute_query, execute_raw_query
from .sqlbuilder import SpeesBuilder, Spe... | 47.663507 | 120 | 0.635975 |
from typing import Callable
import dill
from pandas import DataFrame
from .connectioninfo import ConnectionInfo
from .sqlqueryexecutor import execute_query, execute_raw_query
from .sqlbuilder import SpeesBuilder, SpeesBuilderFromFunction, StoredProcedureBuilder, \
ExecuteStoredProcedureBuilder, DropStored... | true | true |
f77361cc89bdbe49e9ca08f8b1b85fbaf18ce908 | 13,190 | py | Python | keras2onnx/ke2onnx/lstm.py | xadupre/keras-onnx | 17559f987ecce7ec40ab8a36a9596eb950f9b332 | [
"MIT"
] | null | null | null | keras2onnx/ke2onnx/lstm.py | xadupre/keras-onnx | 17559f987ecce7ec40ab8a36a9596eb950f9b332 | [
"MIT"
] | null | null | null | keras2onnx/ke2onnx/lstm.py | xadupre/keras-onnx | 17559f987ecce7ec40ab8a36a9596eb950f9b332 | [
"MIT"
] | null | null | null | ###############################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
###############################################################################
imp... | 36.336088 | 118 | 0.655269 | import numbers
import numpy as np
from collections.abc import Iterable
from ..common import cvtfunc, name_func
from ..common.onnx_ops import (
apply_concat,
apply_gather,
apply_reshape,
apply_shape,
apply_split,
apply_squeeze,
apply_unsqueeze,
apply_transpose,
OnnxOperatorBuilder
)
f... | true | true |
f7736254b2858ccc89eb5b3e0f54b4886138c7c4 | 378 | py | Python | transferencia/models.py | TooDoo-BlastOff-Desafios/Python-Squad1 | e5e9523baf20b770aeb6682abb09522a8402ae27 | [
"MIT"
] | null | null | null | transferencia/models.py | TooDoo-BlastOff-Desafios/Python-Squad1 | e5e9523baf20b770aeb6682abb09522a8402ae27 | [
"MIT"
] | null | null | null | transferencia/models.py | TooDoo-BlastOff-Desafios/Python-Squad1 | e5e9523baf20b770aeb6682abb09522a8402ae27 | [
"MIT"
] | null | null | null | from django.db import models
from cliente.models import Cliente
from uuid import uuid4
class Transferencia(models.Model):
id_transf = models.UUIDField(primary_key=True, default=uuid4, editable=False)
quantia = models.FloatField()
data_transf = models.DateField()
cliente_cpf_transf = models.ForeignKey(C... | 34.363636 | 100 | 0.780423 | from django.db import models
from cliente.models import Cliente
from uuid import uuid4
class Transferencia(models.Model):
id_transf = models.UUIDField(primary_key=True, default=uuid4, editable=False)
quantia = models.FloatField()
data_transf = models.DateField()
cliente_cpf_transf = models.ForeignKey(C... | true | true |
f7736256bc4b7c4c7267d29b4b164f7da141153e | 27,636 | py | Python | sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py | vchske/azure-sdk-for-python | 6383ed3676b7355af7be394562b126209961ec13 | [
"MIT"
] | null | null | null | sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py | vchske/azure-sdk-for-python | 6383ed3676b7355af7be394562b126209961ec13 | [
"MIT"
] | 1 | 2019-06-04T18:12:16.000Z | 2019-06-04T18:12:16.000Z | sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py | vchske/azure-sdk-for-python | 6383ed3676b7355af7be394562b126209961ec13 | [
"MIT"
] | 1 | 2019-06-17T22:18:23.000Z | 2019-06-17T22:18:23.000Z | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import ba... | 43.248826 | 119 | 0.630844 |
import base64
import hashlib
import re
import random
from time import time
from io import SEEK_SET, UnsupportedOperation
import logging
import uuid
import types
import platform
from typing import Any, TYPE_CHECKING
from wsgiref.handlers import format_date_time
try:
from urllib.parse import (
urlparse,
... | true | true |
f77362616e375b15cccf2da7ca510b83a737ea72 | 3,320 | py | Python | test/functional/mining_getblocktemplate_longpoll.py | KiPa-SuJi/PaydayCoin-Core | d807d95550d955bfa9ffda2b39cad745422224e5 | [
"MIT"
] | 2 | 2020-06-12T10:12:49.000Z | 2020-07-31T19:43:09.000Z | test/functional/mining_getblocktemplate_longpoll.py | KiPa-SuJi/PaydayCoin-Core | d807d95550d955bfa9ffda2b39cad745422224e5 | [
"MIT"
] | null | null | null | test/functional/mining_getblocktemplate_longpoll.py | KiPa-SuJi/PaydayCoin-Core | d807d95550d955bfa9ffda2b39cad745422224e5 | [
"MIT"
] | 1 | 2020-12-04T13:34:46.000Z | 2020-12-04T13:34:46.000Z | #!/usr/bin/env python3
# Copyright (c) 2014-2019 The PaydayCoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test longpolling with getblocktemplate."""
from decimal import Decimal
from test_framework.test_fr... | 43.684211 | 112 | 0.685542 |
from decimal import Decimal
from test_framework.test_framework import PaydayCoinTestFramework
from test_framework.util import get_rpc_proxy, random_transaction
import threading
class LongpollThread(threading.Thread):
def __init__(self, node):
threading.Thread.__init__(self)
template = no... | true | true |
f77362fe9a204671bc2519b3876116597bafcfb2 | 3,428 | py | Python | rsfsup/mass_memory.py | l-johnston/rsfsup | da1da721049bf4952cfc314b3680a85824a16cd6 | [
"MIT"
] | 1 | 2021-04-16T07:57:54.000Z | 2021-04-16T07:57:54.000Z | rsfsup/mass_memory.py | l-johnston/rsfsup | da1da721049bf4952cfc314b3680a85824a16cd6 | [
"MIT"
] | null | null | null | rsfsup/mass_memory.py | l-johnston/rsfsup | da1da721049bf4952cfc314b3680a85824a16cd6 | [
"MIT"
] | 2 | 2020-03-25T06:35:52.000Z | 2021-04-16T07:57:56.000Z | """Mass Memory subsystem"""
import array
import pathlib
import time
from rsfsup.common import Subsystem, validate
class MassMemory(Subsystem, kind="Mass Memory"):
"""Mass memory subsystem
Attributes:
instr (Fsup)
"""
@staticmethod
def process_catalog(cat):
"""Process comma separa... | 30.607143 | 94 | 0.577596 | import array
import pathlib
import time
from rsfsup.common import Subsystem, validate
class MassMemory(Subsystem, kind="Mass Memory"):
@staticmethod
def process_catalog(cat):
cat = cat.replace("'", "")
return cat.split(",")
@property
def drive(self):
res = self._visa.query("M... | true | true |
f77363e97d820a9b64fb53fd40a52e536e68daa5 | 1,109 | py | Python | recommender/dimadb/content_based_recommender.py | cnam0203/trivi-backend | d6a4c6c600bdf22fd45c72c25c7ab55281339a0c | [
"MIT"
] | null | null | null | recommender/dimadb/content_based_recommender.py | cnam0203/trivi-backend | d6a4c6c600bdf22fd45c72c25c7ab55281339a0c | [
"MIT"
] | null | null | null | recommender/dimadb/content_based_recommender.py | cnam0203/trivi-backend | d6a4c6c600bdf22fd45c72c25c7ab55281339a0c | [
"MIT"
] | null | null | null | from django.db.models.aggregates import Sum
from django.forms.models import model_to_dict
from .models import LdaSimilarity
from .lda_model_builder import LdaModelManager
from django.db.models import Q
class ContentBasedRecommender():
def __init__(self, min_sim=0.1):
self.min_sim = min_sim
@st... | 41.074074 | 113 | 0.706041 | from django.db.models.aggregates import Sum
from django.forms.models import model_to_dict
from .models import LdaSimilarity
from .lda_model_builder import LdaModelManager
from django.db.models import Q
class ContentBasedRecommender():
def __init__(self, min_sim=0.1):
self.min_sim = min_sim
@st... | true | true |
f773659788cf8fb22052f747abbe8e51dd9acfa2 | 9,542 | py | Python | codewof/utils/BaseLoader.py | uccser-admin/programming-practice-prototype | 3af4c7d85308ac5bb35bb13be3ec18cac4eb8308 | [
"MIT"
] | 3 | 2019-08-29T04:11:22.000Z | 2021-06-22T16:05:51.000Z | codewof/utils/BaseLoader.py | uccser-admin/programming-practice-prototype | 3af4c7d85308ac5bb35bb13be3ec18cac4eb8308 | [
"MIT"
] | 265 | 2019-05-30T03:51:46.000Z | 2022-03-31T01:05:12.000Z | codewof/utils/BaseLoader.py | samuelsandri/codewof | c9b8b378c06b15a0c42ae863b8f46581de04fdfc | [
"MIT"
] | 7 | 2019-06-29T12:13:37.000Z | 2021-09-06T06:49:14.000Z | """Base loader used to create custom loaders for content."""
import yaml
import mdx_math
import abc
import sys
import re
import os.path
from os import listdir
from verto import Verto
from verto.errors.Error import Error as VertoError
from django.conf import settings
from django.utils.translation import to_locale
from ... | 36.007547 | 118 | 0.618948 |
import yaml
import mdx_math
import abc
import sys
import re
import os.path
from os import listdir
from verto import Verto
from verto.errors.Error import Error as VertoError
from django.conf import settings
from django.utils.translation import to_locale
from utils.errors.CouldNotFindMarkdownFileError import CouldNotFin... | true | true |
f773673a30728242128390d434f3c8921f185266 | 1,056 | py | Python | migrations/versions/79db95db1114_post_table.py | Abdulrahmannaser/Micro-blog | dff47be087768af9353d673ae993ba091a91d180 | [
"MIT"
] | null | null | null | migrations/versions/79db95db1114_post_table.py | Abdulrahmannaser/Micro-blog | dff47be087768af9353d673ae993ba091a91d180 | [
"MIT"
] | null | null | null | migrations/versions/79db95db1114_post_table.py | Abdulrahmannaser/Micro-blog | dff47be087768af9353d673ae993ba091a91d180 | [
"MIT"
] | null | null | null | """Post table
Revision ID: 79db95db1114
Revises: 148200b7a331
Create Date: 2019-11-21 11:03:05.596270
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '79db95db1114'
down_revision = '148200b7a331'
branch_labels = None
depends_on = None
def upgrade():
# ###... | 27.789474 | 83 | 0.676136 | from alembic import op
import sqlalchemy as sa
revision = '79db95db1114'
down_revision = '148200b7a331'
branch_labels = None
depends_on = None
def upgrade():
op.create_table('post',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('body', sa.String(length=200), nullable=True),
sa.Column(... | true | true |
f7736839b6d0f64dfaa48d9b9820c793ccf317cb | 7,491 | py | Python | vtelem/message/cache.py | vkottler/vtelem | 3908f2445249ddb5f2057fe3a7f46c204b677bbb | [
"MIT"
] | 3 | 2021-02-03T01:14:44.000Z | 2022-02-27T00:14:13.000Z | vtelem/message/cache.py | vkottler/vtelem | 3908f2445249ddb5f2057fe3a7f46c204b677bbb | [
"MIT"
] | 27 | 2021-05-04T21:19:41.000Z | 2022-02-27T00:49:18.000Z | vtelem/message/cache.py | vkottler/vtelem | 3908f2445249ddb5f2057fe3a7f46c204b677bbb | [
"MIT"
] | null | null | null | """
vtelem - A module implementing a message storage.
"""
# built-in
from contextlib import contextmanager
import os
from tempfile import TemporaryDirectory
from typing import Dict, Callable, List, Optional, Iterator, Tuple
# internal
from vtelem.classes.data_cache import DataCache
from vtelem.frame.fields import to_... | 33 | 79 | 0.607796 |
from contextlib import contextmanager
import os
from tempfile import TemporaryDirectory
from typing import Dict, Callable, List, Optional, Iterator, Tuple
from vtelem.classes.data_cache import DataCache
from vtelem.frame.fields import to_parsed
from vtelem.types.frame import ParsedFrame, FrameType, MessageType
Messa... | true | true |
f77368c16f96928e00f63f94f6d13c252c5cd72d | 967 | py | Python | plotly/validators/layout/ternary/_domain.py | faezs/plotly.py | 6009b5b9c746e5d2a2849ad255a4eb234b551ed7 | [
"MIT"
] | 1 | 2018-07-16T01:51:47.000Z | 2018-07-16T01:51:47.000Z | plotly/validators/layout/ternary/_domain.py | faezs/plotly.py | 6009b5b9c746e5d2a2849ad255a4eb234b551ed7 | [
"MIT"
] | null | null | null | plotly/validators/layout/ternary/_domain.py | faezs/plotly.py | 6009b5b9c746e5d2a2849ad255a4eb234b551ed7 | [
"MIT"
] | 1 | 2019-02-18T04:12:56.000Z | 2019-02-18T04:12:56.000Z | import _plotly_utils.basevalidators
class DomainValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name='domain', parent_name='layout.ternary', **kwargs
):
super(DomainValidator, self).__init__(
plotly_name=plotly_name,
parent_name=pa... | 33.344828 | 74 | 0.558428 | import _plotly_utils.basevalidators
class DomainValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name='domain', parent_name='layout.ternary', **kwargs
):
super(DomainValidator, self).__init__(
plotly_name=plotly_name,
parent_name=pa... | true | true |
f77368e69036b0ef8bd8f429495b7cf7f3590310 | 1,483 | py | Python | unit 9/exc. 9.4.1.py | AviKalPython/self.py | 44f8de33797a9ea28bbd1e01006920ba7c818b97 | [
"MIT"
] | null | null | null | unit 9/exc. 9.4.1.py | AviKalPython/self.py | 44f8de33797a9ea28bbd1e01006920ba7c818b97 | [
"MIT"
] | null | null | null | unit 9/exc. 9.4.1.py | AviKalPython/self.py | 44f8de33797a9ea28bbd1e01006920ba7c818b97 | [
"MIT"
] | null | null | null | # exc. 9.4.1 (Rolling Mission)
def choose_word(file_path, index):
"""
the function gets a string that represent a file route
and a number represent index of a word in the file.
the function return a tuple of:
1) number of different words in the file
2) a word given by the index
"""
# for the rolling ... | 26.482143 | 77 | 0.670937 | def choose_word(file_path, index):
"""
the function gets a string that represent a file route
and a number represent index of a word in the file.
the function return a tuple of:
1) number of different words in the file
2) a word given by the index
"""
"""
text = open(file_path, 'r')
words = text.... | false | true |
f7736a4312a4f16946b3dfd19e546e9574fe8bca | 4,437 | py | Python | broadinstitute_psp/introspect/introspect.py | cmap/psp | 9389e9d86424e460e577dd1d9027f4a1d1f8227a | [
"BSD-3-Clause"
] | 8 | 2017-08-16T07:43:06.000Z | 2021-09-01T20:18:08.000Z | broadinstitute_psp/introspect/introspect.py | cmap/psp | 9389e9d86424e460e577dd1d9027f4a1d1f8227a | [
"BSD-3-Clause"
] | 8 | 2017-11-14T18:51:39.000Z | 2018-09-12T17:43:03.000Z | broadinstitute_psp/introspect/introspect.py | cmap/psp | 9389e9d86424e460e577dd1d9027f4a1d1f8227a | [
"BSD-3-Clause"
] | 6 | 2018-01-25T17:47:47.000Z | 2020-12-17T16:05:33.000Z | """
introspect.py
Compute all within-dataset connectivities.
"""
import logging
import sys
import argparse
import broadinstitute_psp.utils.setup_logger as setup_logger
import cmapPy.pandasGEXpress.GCToo as GCToo
import cmapPy.pandasGEXpress.parse as parse
import cmapPy.pandasGEXpress.write_gct as wg
import broadins... | 32.866667 | 121 | 0.750507 |
import logging
import sys
import argparse
import broadinstitute_psp.utils.setup_logger as setup_logger
import cmapPy.pandasGEXpress.GCToo as GCToo
import cmapPy.pandasGEXpress.parse as parse
import cmapPy.pandasGEXpress.write_gct as wg
import broadinstitute_psp.steep.steep as steep
import broadinstitute_psp.sip.sip a... | true | true |
f7736da703c7517882e4e42960fcff0d42a58263 | 2,870 | py | Python | tensorflow_probability/python/internal/backend/numpy/_utils.py | matthieucoquet/probability | 2426f4fc4743ceedc1a638a03d19ce6654ebff76 | [
"Apache-2.0"
] | null | null | null | tensorflow_probability/python/internal/backend/numpy/_utils.py | matthieucoquet/probability | 2426f4fc4743ceedc1a638a03d19ce6654ebff76 | [
"Apache-2.0"
] | null | null | null | tensorflow_probability/python/internal/backend/numpy/_utils.py | matthieucoquet/probability | 2426f4fc4743ceedc1a638a03d19ce6654ebff76 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 28.137255 | 88 | 0.702091 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import importlib
import types
import numpy as np
import tensorflow as tf
__all__ = [
'common_dtype',
'copy_docstring',
'numpy_dtype',
'try_import',
]
def copy_docstring(original_fn, new_... | true | true |
f7736f8ca75401b282f7ac81288ec6907449848b | 6,680 | py | Python | Optimization/app.py | fwitte/chp_orc | 509abf4faf2a5d08ef8311a0f2a8c75e1bbba95e | [
"MIT"
] | 2 | 2021-11-30T12:32:56.000Z | 2022-01-30T16:49:24.000Z | Optimization/app.py | fwitte/chp_orc | 509abf4faf2a5d08ef8311a0f2a8c75e1bbba95e | [
"MIT"
] | null | null | null | Optimization/app.py | fwitte/chp_orc | 509abf4faf2a5d08ef8311a0f2a8c75e1bbba95e | [
"MIT"
] | 1 | 2021-11-21T21:27:20.000Z | 2021-11-21T21:27:20.000Z | # %%
from CoolProp.CoolProp import PropsSI
import pygmo as pg
import pandas as pd
from matplotlib import pyplot as plt
from orc import ORC_without_ihe, CHPORC
from tespy.components import HeatExchanger, Merge, Pump, Sink, Source, Splitter
from tespy.components.heat_exchangers.condenser import Condenser
from tespy.con... | 31.214953 | 98 | 0.681138 |
from CoolProp.CoolProp import PropsSI
import pygmo as pg
import pandas as pd
from matplotlib import pyplot as plt
from orc import ORC_without_ihe, CHPORC
from tespy.components import HeatExchanger, Merge, Pump, Sink, Source, Splitter
from tespy.components.heat_exchangers.condenser import Condenser
from tespy.connecti... | true | true |
f77370cd16e850d4cb333e06921da9450e742965 | 484 | py | Python | awad/migrations/0011_auto_20190529_1156.py | probantan/Awwards | 9cfe3d8fbe94637908128f1b982d7a99cf7a57d2 | [
"Unlicense"
] | null | null | null | awad/migrations/0011_auto_20190529_1156.py | probantan/Awwards | 9cfe3d8fbe94637908128f1b982d7a99cf7a57d2 | [
"Unlicense"
] | 5 | 2021-03-19T00:56:14.000Z | 2022-03-11T23:48:38.000Z | awad/migrations/0011_auto_20190529_1156.py | probantan/Awwards | 9cfe3d8fbe94637908128f1b982d7a99cf7a57d2 | [
"Unlicense"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2019-05-29 08:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('awad', '0010_auto_20190529_1148'),
]
operations = [
migrations.AlterField(
... | 23.047619 | 88 | 0.623967 | from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('awad', '0010_auto_20190529_1148'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='bio',
fie... | true | true |
f77371747e66f93a3a32c0d52521faee4d9328af | 816 | py | Python | supabase/lib/storage_client.py | discdiver/supabase-py | 55e8f840fe1dae0e3951e878df7f4ad7181a239f | [
"MIT"
] | 201 | 2020-08-28T06:29:44.000Z | 2021-09-13T20:15:15.000Z | supabase/lib/storage_client.py | discdiver/supabase-py | 55e8f840fe1dae0e3951e878df7f4ad7181a239f | [
"MIT"
] | 31 | 2020-08-28T06:38:31.000Z | 2021-09-12T15:47:48.000Z | supabase/lib/storage_client.py | discdiver/supabase-py | 55e8f840fe1dae0e3951e878df7f4ad7181a239f | [
"MIT"
] | 22 | 2020-10-02T15:32:12.000Z | 2021-09-13T12:31:12.000Z | from supabase.lib.storage.storage_bucket_api import StorageBucketAPI
from supabase.lib.storage.storage_file_api import StorageFileAPI
class SupabaseStorageClient(StorageBucketAPI):
"""
Manage the storage bucket and files
Examples
--------
>>> url = storage_file.create_signed_url("something/test2.t... | 37.090909 | 98 | 0.719363 | from supabase.lib.storage.storage_bucket_api import StorageBucketAPI
from supabase.lib.storage.storage_file_api import StorageFileAPI
class SupabaseStorageClient(StorageBucketAPI):
def __init__(self, url, headers):
super().__init__(url, headers)
def StorageFileAPI(self, id_):
return StorageF... | true | true |
f77372d135fcbc0f1f20264de485c63ac2321964 | 4,456 | py | Python | tensorflow/compiler/aot/ex2/make_graph.py | willxujun/tensorflow | 5c31a9c4a8aa94d2f41c60880bb3ca699c23328c | [
"Apache-2.0"
] | null | null | null | tensorflow/compiler/aot/ex2/make_graph.py | willxujun/tensorflow | 5c31a9c4a8aa94d2f41c60880bb3ca699c23328c | [
"Apache-2.0"
] | null | null | null | tensorflow/compiler/aot/ex2/make_graph.py | willxujun/tensorflow | 5c31a9c4a8aa94d2f41c60880bb3ca699c23328c | [
"Apache-2.0"
] | null | null | null | import argparse
import os
import sys
import tensorflow as tf
from tensorflow.core.protobuf import saver_pb2
from tensorflow.python.client import session
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import function
from tensorflow.py... | 36.52459 | 83 | 0.677962 | import argparse
import os
import sys
import tensorflow as tf
from tensorflow.core.protobuf import saver_pb2
from tensorflow.python.client import session
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import function
from tensorflow.py... | true | true |
f7737405b5383fb45f2f2cb54c0677eed282dd76 | 1,374 | py | Python | CodingInterview2/18_01_DeleteNodeInList/delete_node_in_list.py | hscspring/TheAlgorithms-Python | 5c2faea1d2d25a9a81a4786e053b0cc58ab46c6f | [
"MIT"
] | 10 | 2020-07-06T11:00:58.000Z | 2022-01-29T09:25:24.000Z | CodingInterview2/18_01_DeleteNodeInList/delete_node_in_list.py | hscspring/TheAlgorithms-Python | 5c2faea1d2d25a9a81a4786e053b0cc58ab46c6f | [
"MIT"
] | null | null | null | CodingInterview2/18_01_DeleteNodeInList/delete_node_in_list.py | hscspring/TheAlgorithms-Python | 5c2faea1d2d25a9a81a4786e053b0cc58ab46c6f | [
"MIT"
] | 3 | 2020-07-13T06:39:23.000Z | 2020-08-15T16:29:48.000Z | """
面试题 18(一):在 O (1) 时间删除链表结点
题目:给定单向链表的头指针和一个结点指针,定义一个函数在 O (1) 时间删除该结点。
"""
class Node:
def __init__(self, val):
self.val = val
self.next = None
def list2link(lst):
root = Node(None)
ptr = root
for i in lst:
ptr.next = Node(i)
ptr = ptr.next
return root.next
d... | 17.392405 | 50 | 0.52329 |
class Node:
def __init__(self, val):
self.val = val
self.next = None
def list2link(lst):
root = Node(None)
ptr = root
for i in lst:
ptr.next = Node(i)
ptr = ptr.next
return root.next
def link2list(root: Node) -> list:
res = []
while root:
res.appen... | true | true |
f7737436d692efe5fdf8e5b0671de194b3f0b087 | 3,873 | py | Python | tests/psfs.py | hessammehr/agpy | a9436f8e5b9210ef8a86d03d0fd94f2d4e6212db | [
"MIT"
] | 16 | 2015-05-08T11:14:26.000Z | 2021-11-19T19:05:16.000Z | tests/psfs.py | hessammehr/agpy | a9436f8e5b9210ef8a86d03d0fd94f2d4e6212db | [
"MIT"
] | 3 | 2016-05-12T16:27:14.000Z | 2020-12-27T01:14:24.000Z | tests/psfs.py | hessammehr/agpy | a9436f8e5b9210ef8a86d03d0fd94f2d4e6212db | [
"MIT"
] | 19 | 2015-03-30T22:34:14.000Z | 2020-11-25T23:29:53.000Z | import agpy
from agpy import psf_fitter,asinh_norm
from pylab import *
if __name__ == "__main__":
# numerically determine Airy FWHM
# (see http://en.wikipedia.org/wiki/Airy_disk)
x = linspace(1.5,1.7,100000)
airy_fwhm = x[argmin(abs(agpy.psf_fitter._airy_func(x) - 0.5))] * 2
# numerically determi... | 50.298701 | 282 | 0.684741 | import agpy
from agpy import psf_fitter,asinh_norm
from pylab import *
if __name__ == "__main__":
x = linspace(1.5,1.7,100000)
airy_fwhm = x[argmin(abs(agpy.psf_fitter._airy_func(x) - 0.5))] * 2
x = linspace(1.1,1.3,100000)
gaussian_fwhm = x[argmin(abs(agpy.psf_fitter._gaussian_func(x) - ... | false | true |
f7737483e294007e55ffc4e957d2fc5b54ccf1cb | 414 | py | Python | todo/admin.py | Rub4ek/scalors-assignment-backend | a340a3d918438696cb8d0f1597237397a3c28c33 | [
"MIT"
] | null | null | null | todo/admin.py | Rub4ek/scalors-assignment-backend | a340a3d918438696cb8d0f1597237397a3c28c33 | [
"MIT"
] | null | null | null | todo/admin.py | Rub4ek/scalors-assignment-backend | a340a3d918438696cb8d0f1597237397a3c28c33 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from todo.models import Todo, Board
class TodoInline(admin.TabularInline):
model = Todo
extra = 0
readonly_fields = (
'created',
'updated',
)
class BoardAdmin(admin.ModelAdmin):
mod... | 15.923077 | 39 | 0.649758 | from __future__ import unicode_literals
from django.contrib import admin
from todo.models import Todo, Board
class TodoInline(admin.TabularInline):
model = Todo
extra = 0
readonly_fields = (
'created',
'updated',
)
class BoardAdmin(admin.ModelAdmin):
model = Board
inlines =... | true | true |
f77375225adbbde6d62bcc70cfc1acca0694c5dc | 1,105 | py | Python | mint/types/blockchain_format/classgroup.py | sai-genesis/rc1-test | 56e565952b283450c8589296f87c31b1c67b8502 | [
"Apache-2.0"
] | 12 | 2021-08-18T20:53:31.000Z | 2022-03-15T21:45:13.000Z | mint/types/blockchain_format/classgroup.py | sai-genesis/rc1-test | 56e565952b283450c8589296f87c31b1c67b8502 | [
"Apache-2.0"
] | 34 | 2021-08-18T19:12:11.000Z | 2022-01-06T17:15:34.000Z | mint/types/blockchain_format/classgroup.py | sai-genesis/rc1-test | 56e565952b283450c8589296f87c31b1c67b8502 | [
"Apache-2.0"
] | 7 | 2021-08-18T20:53:34.000Z | 2022-03-15T08:37:40.000Z | from dataclasses import dataclass
from mint.consensus.constants import ConsensusConstants
from mint.types.blockchain_format.sized_bytes import bytes100
from mint.util.streamable import Streamable, streamable
@dataclass(frozen=True)
@streamable
class ClassgroupElement(Streamable):
"""
Represents a classgroup ... | 32.5 | 115 | 0.715837 | from dataclasses import dataclass
from mint.consensus.constants import ConsensusConstants
from mint.types.blockchain_format.sized_bytes import bytes100
from mint.util.streamable import Streamable, streamable
@dataclass(frozen=True)
@streamable
class ClassgroupElement(Streamable):
data: bytes100
@staticmeth... | true | true |
f773752d55c1e5a4c9503be719c04c0681123389 | 8,465 | py | Python | tests/test_tasks/test_task_functions.py | hp2500/openml-python | 62cc534cd18e6e011a88a83816fec95a90399a9b | [
"BSD-3-Clause"
] | 1 | 2019-09-02T00:28:26.000Z | 2019-09-02T00:28:26.000Z | tests/test_tasks/test_task_functions.py | hp2500/openml-python | 62cc534cd18e6e011a88a83816fec95a90399a9b | [
"BSD-3-Clause"
] | null | null | null | tests/test_tasks/test_task_functions.py | hp2500/openml-python | 62cc534cd18e6e011a88a83816fec95a90399a9b | [
"BSD-3-Clause"
] | 1 | 2019-09-02T00:29:32.000Z | 2019-09-02T00:29:32.000Z | import os
from unittest import mock
from openml.testing import TestBase
from openml import OpenMLSplit, OpenMLTask
from openml.exceptions import OpenMLCacheException
import openml
import unittest
import pandas as pd
class TestTask(TestBase):
_multiprocess_can_split_ = True
def setUp(self):
super(Tes... | 38.830275 | 115 | 0.639693 | import os
from unittest import mock
from openml.testing import TestBase
from openml import OpenMLSplit, OpenMLTask
from openml.exceptions import OpenMLCacheException
import openml
import unittest
import pandas as pd
class TestTask(TestBase):
_multiprocess_can_split_ = True
def setUp(self):
super(Tes... | true | true |
f773760cf18c11784dca65fa2639b8659f12379a | 735 | py | Python | app/gbi_server/model/__init__.py | omniscale/gbi-server | d67c003da98b77ffa66cf014ce9f228e75343563 | [
"Apache-2.0"
] | 2 | 2015-11-05T07:13:49.000Z | 2015-12-29T12:36:27.000Z | app/gbi_server/model/__init__.py | omniscale/gbi-server | d67c003da98b77ffa66cf014ce9f228e75343563 | [
"Apache-2.0"
] | null | null | null | app/gbi_server/model/__init__.py | omniscale/gbi-server | d67c003da98b77ffa66cf014ce9f228e75343563 | [
"Apache-2.0"
] | 1 | 2020-11-09T19:03:07.000Z | 2020-11-09T19:03:07.000Z | # This file is part of the GBI project.
# Copyright (C) 2013 Omniscale GmbH & Co. KG <http://omniscale.com>
#
# 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/licens... | 36.75 | 74 | 0.746939 |
from .user import *
from .log import *
from .sources import *
from .wfs import *
| true | true |
f773766eae3f5ac33557d5567e0e2b2003ac8f34 | 1,105 | py | Python | utils/split_features.py | lvapeab/interactive-keras-captioning | 9791f0e96aeb89c9b4d97f2f3352b50f18f14df9 | [
"MIT"
] | 16 | 2019-03-07T19:33:09.000Z | 2021-01-07T02:10:09.000Z | utils/split_features.py | 18756925909/interactive-keras-captioning | 9791f0e96aeb89c9b4d97f2f3352b50f18f14df9 | [
"MIT"
] | null | null | null | utils/split_features.py | 18756925909/interactive-keras-captioning | 9791f0e96aeb89c9b4d97f2f3352b50f18f14df9 | [
"MIT"
] | 8 | 2019-05-15T10:49:18.000Z | 2021-04-12T03:28:47.000Z | import numpy as np
def iter_loadtxt(filename, delimiter=',', skiprows=0, dtype=np.float32):
def iter_func():
with open(filename, 'r') as infile:
for _ in range(skiprows):
next(infile)
for line in infile:
line = line.rstrip().split(delimiter)
... | 35.645161 | 86 | 0.615385 | import numpy as np
def iter_loadtxt(filename, delimiter=',', skiprows=0, dtype=np.float32):
def iter_func():
with open(filename, 'r') as infile:
for _ in range(skiprows):
next(infile)
for line in infile:
line = line.rstrip().split(delimiter)
... | false | true |
f77376b5b8db4b1c96b4e5aa9178e84e63d0ba84 | 3,058 | py | Python | kaft_clone/settings/settings_base.py | guvenaltunsoyy/django-kaft-clone | be4bfee0b7e07113866f36d452b225580d177bb4 | [
"MIT"
] | null | null | null | kaft_clone/settings/settings_base.py | guvenaltunsoyy/django-kaft-clone | be4bfee0b7e07113866f36d452b225580d177bb4 | [
"MIT"
] | null | null | null | kaft_clone/settings/settings_base.py | guvenaltunsoyy/django-kaft-clone | be4bfee0b7e07113866f36d452b225580d177bb4 | [
"MIT"
] | null | null | null | import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the... | 24.464 | 91 | 0.682799 | import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '3jt1c)iasg-lt$z_nt*a5a!l&4d5idt(g-8bumxnk%axf)x=#s'
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes'... | true | true |
f77376f98aed5a9398da777dcba45987fb15cd79 | 90 | py | Python | joblib/externals/cloudpickle/__init__.py | ctb/joblib | 023e7a9df56fb2feab9f6f459653338519472af8 | [
"BSD-3-Clause"
] | null | null | null | joblib/externals/cloudpickle/__init__.py | ctb/joblib | 023e7a9df56fb2feab9f6f459653338519472af8 | [
"BSD-3-Clause"
] | null | null | null | joblib/externals/cloudpickle/__init__.py | ctb/joblib | 023e7a9df56fb2feab9f6f459653338519472af8 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import
from .cloudpickle import *
__version__ = '1.1.1'
| 15 | 38 | 0.777778 | from __future__ import absolute_import
from .cloudpickle import *
__version__ = '1.1.1'
| true | true |
f7737725242a9722d2c78adb95f70307391bf1af | 3,294 | bzl | Python | haskell/private/cc_wrapper.bzl | joneshf/rules_haskell | 77cf42c30a424f7e701c72c5feb31f49b5230351 | [
"Apache-2.0"
] | null | null | null | haskell/private/cc_wrapper.bzl | joneshf/rules_haskell | 77cf42c30a424f7e701c72c5feb31f49b5230351 | [
"Apache-2.0"
] | null | null | null | haskell/private/cc_wrapper.bzl | joneshf/rules_haskell | 77cf42c30a424f7e701c72c5feb31f49b5230351 | [
"Apache-2.0"
] | null | null | null | load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
load("@rules_python//python:defs.bzl", "py_binary")
def _cc_wrapper_impl(ctx):
cc_toolchain = find_cpp_toolchain(ctx)
feature_configuration = cc_common.configure_... | 32.294118 | 79 | 0.580449 | load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
load("@rules_python//python:defs.bzl", "py_binary")
def _cc_wrapper_impl(ctx):
cc_toolchain = find_cpp_toolchain(ctx)
feature_configuration = cc_common.configure_... | true | true |
f773786e5b99119451de55178f68a08fad156d47 | 1,757 | py | Python | pelican-plugins/m/test/test_alias.py | Serkan-devel/m.css | e19d318bbccb121d171fe66544814455de9ea5bc | [
"MIT"
] | null | null | null | pelican-plugins/m/test/test_alias.py | Serkan-devel/m.css | e19d318bbccb121d171fe66544814455de9ea5bc | [
"MIT"
] | null | null | null | pelican-plugins/m/test/test_alias.py | Serkan-devel/m.css | e19d318bbccb121d171fe66544814455de9ea5bc | [
"MIT"
] | null | null | null | #
# This file is part of m.css.
#
# Copyright © 2017, 2018, 2019 Vladimír Vondruš <mosra@centrum.cz>
#
# 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... | 43.925 | 87 | 0.715424 |
from m.test import PluginTestCase
class Alias(PluginTestCase):
def __init__(self, *args, **kwargs):
super().__init__(__file__, '', *args, **kwargs)
def test(self):
self.run_pelican({
'PLUGINS': ['m.htmlsanity', 'm.alias'],
'SITEURL': 'http://my.site'
})
... | true | true |
f77379bf36e08ebbd89b9141f6293a1f4a901c3e | 7,034 | py | Python | sdk/keyvault/azure-keyvault-administration/tests/test_backup_client.py | MichaelZp0/azure-sdk-for-python | ffdee53a9ecf02e1c961ee622de96485b3361769 | [
"MIT"
] | 1 | 2022-01-24T08:54:57.000Z | 2022-01-24T08:54:57.000Z | sdk/keyvault/azure-keyvault-administration/tests/test_backup_client.py | MichaelZp0/azure-sdk-for-python | ffdee53a9ecf02e1c961ee622de96485b3361769 | [
"MIT"
] | null | null | null | sdk/keyvault/azure-keyvault-administration/tests/test_backup_client.py | MichaelZp0/azure-sdk-for-python | ffdee53a9ecf02e1c961ee622de96485b3361769 | [
"MIT"
] | null | null | null | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from functools import partial
import time
from azure.core.exceptions import ResourceExistsError
from azure.keyvault.administration._internal import parse_folder_url
imp... | 43.9625 | 113 | 0.707705 | from functools import partial
import time
from azure.core.exceptions import ResourceExistsError
from azure.keyvault.administration._internal import parse_folder_url
import pytest
from _shared.test_case import KeyVaultTestCase
from _test_case import AdministrationTestCase, backup_client_setup, get_decorator
all_api_... | true | true |
f77379ebac2197924baee55688fb76f60365bc5b | 192 | py | Python | config.sample.py | pacoqueen/lmda2yt | a550d413d3654a0d21cc2c0d51815341fd11fbc9 | [
"WTFPL"
] | null | null | null | config.sample.py | pacoqueen/lmda2yt | a550d413d3654a0d21cc2c0d51815341fd11fbc9 | [
"WTFPL"
] | null | null | null | config.sample.py | pacoqueen/lmda2yt | a550d413d3654a0d21cc2c0d51815341fd11fbc9 | [
"WTFPL"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Fichero con la clave de desarrollador para poderlo ignorar en el repositorio.
"""
DEVELOPER_KEY = "YOUR_OWN_YOUTUBE_API_DEVELOPER_KEY_HERE"
| 21.333333 | 77 | 0.739583 |
DEVELOPER_KEY = "YOUR_OWN_YOUTUBE_API_DEVELOPER_KEY_HERE"
| true | true |
f7737a0b3d283e1fab5eb330954ed1f1471df2d3 | 3,086 | py | Python | api/views/guide_views.py | tiveritz/sequence-api | ba0fb432028eaf878122e4d96d8b1ce234602e47 | [
"MIT"
] | null | null | null | api/views/guide_views.py | tiveritz/sequence-api | ba0fb432028eaf878122e4d96d8b1ce234602e47 | [
"MIT"
] | null | null | null | api/views/guide_views.py | tiveritz/sequence-api | ba0fb432028eaf878122e4d96d8b1ce234602e47 | [
"MIT"
] | null | null | null | from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
import re
from ..models import (SequenceGuide,
SequenceGuideStep,
Image)
from ..serializers.guide_serializers import (SequenceGuideSerializer,
... | 31.814433 | 79 | 0.558652 | from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
import re
from ..models import (SequenceGuide,
SequenceGuideStep,
Image)
from ..serializers.guide_serializers import (SequenceGuideSerializer,
... | true | true |
f7737a6048c6f3ca0ed5a9db6d86a6d38987fd26 | 27,287 | py | Python | pysnmp/F10-OPENFLOW-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/F10-OPENFLOW-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/F10-OPENFLOW-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module F10-OPENFLOW-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/F10-OPENFLOW-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:57:27 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | 127.509346 | 3,362 | 0.74607 | OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion, ValueSizeConstraint, ValueRangeConstraint = mibBuilder.impo... | true | true |
f7737b5df15b175753938cb6272ea42b64cfb6e3 | 30,705 | py | Python | src/pretix/presale/views/event.py | fakegit/pretix | b6e9e64ff967f7b4f91fe88694f4157d8a0787b4 | [
"Apache-2.0"
] | null | null | null | src/pretix/presale/views/event.py | fakegit/pretix | b6e9e64ff967f7b4f91fe88694f4157d8a0787b4 | [
"Apache-2.0"
] | 56 | 2020-05-07T07:54:17.000Z | 2021-04-19T12:14:14.000Z | src/pretix/presale/views/event.py | fakegit/pretix | b6e9e64ff967f7b4f91fe88694f4157d8a0787b4 | [
"Apache-2.0"
] | null | null | null | #
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 Raphael Michel and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by ... | 47.093558 | 160 | 0.617782 |
import calendar
import sys
from collections import defaultdict
from datetime import date, datetime, timedelta
from decimal import Decimal
from importlib import import_module
import isoweek
import pytz
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.db.models import (
... | true | true |
f7737c082f84fcf0b0d510141fb9728c37bba513 | 1,752 | py | Python | openeo/rest/rest_file.py | clausmichele/openeo-python-client | b20af2b24fcb12d0fce0e2acdb8afeeb881ff454 | [
"Apache-2.0"
] | 1 | 2021-04-01T13:15:35.000Z | 2021-04-01T13:15:35.000Z | openeo/rest/rest_file.py | clausmichele/openeo-python-client | b20af2b24fcb12d0fce0e2acdb8afeeb881ff454 | [
"Apache-2.0"
] | null | null | null | openeo/rest/rest_file.py | clausmichele/openeo-python-client | b20af2b24fcb12d0fce0e2acdb8afeeb881ff454 | [
"Apache-2.0"
] | null | null | null |
import os
import shutil
from openeo.file import File
class RESTFile(File):
"""Represents a file of openeo."""
def download_file(self, target):
"""
Downloads a user file to the back end.
:param target: local path, where the file should be saved.
:return: status: Response stat... | 27.809524 | 84 | 0.590753 |
import os
import shutil
from openeo.file import File
class RESTFile(File):
def download_file(self, target):
path = "/files/{}/{}".format(self.connection.userid, self.path)
resp = self.connection.get(path, stream=True)
if resp.status_code == 200:
with open(target, ... | true | true |
f7737c3c6280b0104f78409aeda1f1ec384c8fed | 277 | py | Python | pie_charts/basic_pie_chart_tips_by_gender.py | thefullstackninja/effective_data_visualization_using_plotly_express | 043225b9a4e2333709df19be64475d8ed003daa3 | [
"MIT"
] | null | null | null | pie_charts/basic_pie_chart_tips_by_gender.py | thefullstackninja/effective_data_visualization_using_plotly_express | 043225b9a4e2333709df19be64475d8ed003daa3 | [
"MIT"
] | null | null | null | pie_charts/basic_pie_chart_tips_by_gender.py | thefullstackninja/effective_data_visualization_using_plotly_express | 043225b9a4e2333709df19be64475d8ed003daa3 | [
"MIT"
] | null | null | null | ### Case study Distribution of tips by gender
import pandas as pd
import plotly.express as px
df = pd.read_csv("../data/tips.csv")
plot = px.pie(
data_frame=df,
values='tip',
names='sex',
title="Case study Distribution of tips by gender"
)
plot.show() | 16.294118 | 53 | 0.66065 |
import pandas as pd
import plotly.express as px
df = pd.read_csv("../data/tips.csv")
plot = px.pie(
data_frame=df,
values='tip',
names='sex',
title="Case study Distribution of tips by gender"
)
plot.show() | true | true |
f7737e23710882c62312e0d17b15e1d9a08c10d7 | 5,385 | py | Python | cacheops/tree.py | Montana/django-cacheops | ddfc0fa34fe81d05bd63b73140f32e3da61befe4 | [
"BSD-3-Clause"
] | 4 | 2021-05-16T01:19:46.000Z | 2021-11-18T05:51:28.000Z | cacheops/tree.py | Montana/django-cacheops | ddfc0fa34fe81d05bd63b73140f32e3da61befe4 | [
"BSD-3-Clause"
] | null | null | null | cacheops/tree.py | Montana/django-cacheops | ddfc0fa34fe81d05bd63b73140f32e3da61befe4 | [
"BSD-3-Clause"
] | 4 | 2021-05-16T01:19:47.000Z | 2022-01-21T09:51:29.000Z | from itertools import product
from funcy import group_by, join_with, lcat, lmap
from django.db.models import Subquery
from django.db.models.query import QuerySet
from django.db.models.sql import OR
from django.db.models.sql.query import Query, ExtraWhere
from django.db.models.sql.where import NothingNode, SubqueryCons... | 38.464286 | 96 | 0.604085 | from itertools import product
from funcy import group_by, join_with, lcat, lmap
from django.db.models import Subquery
from django.db.models.query import QuerySet
from django.db.models.sql import OR
from django.db.models.sql.query import Query, ExtraWhere
from django.db.models.sql.where import NothingNode, SubqueryCons... | true | true |
f7738063f3c5dcf3fa9389f867fa8ed7774d7c05 | 3,236 | py | Python | scripts/india_nhm/states/nhm_birth_control/preprocess.py | SenthamizhanV/data | 9ba7b94ba4163a7dc2a7c31ba4ac7a9e69908ee0 | [
"Apache-2.0"
] | null | null | null | scripts/india_nhm/states/nhm_birth_control/preprocess.py | SenthamizhanV/data | 9ba7b94ba4163a7dc2a7c31ba4ac7a9e69908ee0 | [
"Apache-2.0"
] | null | null | null | scripts/india_nhm/states/nhm_birth_control/preprocess.py | SenthamizhanV/data | 9ba7b94ba4163a7dc2a7c31ba4ac7a9e69908ee0 | [
"Apache-2.0"
] | null | null | null | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 41.487179 | 114 | 0.709209 |
import sys
sys.path.append("..")
from india_nhm.states.base.data_cleaner import NHMDataLoaderBase
from india_nhm.states.base.readme_generator import ReadMeGen
cols_to_nodes = {
'State':
'State',
'isoCode':
'isoCode',
'Date':
'Date',
'Number of Vasectomies Conducted (Public + ... | true | true |
f77380e3cebdbb5943caf65e87e6b2fc4a341739 | 1,360 | py | Python | Demo/gameOfLife.1.py | calllivecn/GameOfLife | ee1d3cb203160a3a1226d6322bc0b1406524c640 | [
"Apache-2.0"
] | 17 | 2018-08-14T01:29:14.000Z | 2021-06-20T02:17:17.000Z | Demo/gameOfLife.1.py | calllivecn/GameOfLife | ee1d3cb203160a3a1226d6322bc0b1406524c640 | [
"Apache-2.0"
] | 1 | 2018-07-11T15:41:46.000Z | 2018-07-11T15:41:46.000Z | Demo/gameOfLife.1.py | calllivecn/GameOfLife | ee1d3cb203160a3a1226d6322bc0b1406524c640 | [
"Apache-2.0"
] | 42 | 2018-01-31T05:53:40.000Z | 2022-03-07T03:27:44.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Game of life
author: Pleiades
'''
import os
import random
#import functools
width = 60
height = 15
screen = []
def Init():
global screen
screen = [['#' if random.random() > 0.8 else ' ' for i in range(width)]
for j in range(height)]
def Pri... | 18.630137 | 83 | 0.547059 |
import os
import random
width = 60
height = 15
screen = []
def Init():
global screen
screen = [['#' if random.random() > 0.8 else ' ' for i in range(width)]
for j in range(height)]
def PrintScreen():
print('|\n'.join([' '.join(line) for line in screen]))
def TryGetCell(h, w):
retu... | true | true |
f7738251eb9e44a2c9a597e6171c4333df9445da | 2,081 | py | Python | Scripts/SearchIncidents_5.0/SearchIncidents.py | baitechnical/content | bedd8e94aaf203c8f9dcae763d1578fd04a9f397 | [
"MIT"
] | null | null | null | Scripts/SearchIncidents_5.0/SearchIncidents.py | baitechnical/content | bedd8e94aaf203c8f9dcae763d1578fd04a9f397 | [
"MIT"
] | null | null | null | Scripts/SearchIncidents_5.0/SearchIncidents.py | baitechnical/content | bedd8e94aaf203c8f9dcae763d1578fd04a9f397 | [
"MIT"
] | null | null | null | from typing import Dict, List
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
special = ['n', 't', '\\', '"', '\'', '7', 'r']
def check_if_found_incident(res: List):
if res and isinstance(res, list) and isinstance(res[0].get('Contents'), dict):
if 'dat... | 33.031746 | 110 | 0.581932 | from typing import Dict, List
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
special = ['n', 't', '\\', '"', '\'', '7', 'r']
def check_if_found_incident(res: List):
if res and isinstance(res, list) and isinstance(res[0].get('Contents'), dict):
if 'dat... | true | true |
f773828c6c493894d506802c3cb9fabafddb0046 | 417 | py | Python | micropython-maixpy-0_6_2-66/stubs/json.py | mongonta0716/stub_for_maixpy | f8f29454668919873f9a0f14bb5a9b01ab103bc8 | [
"MIT"
] | 1 | 2021-08-22T09:10:43.000Z | 2021-08-22T09:10:43.000Z | micropython-maixpy-0_6_2-66/stubs/json.py | mongonta0716/stub_for_maixpy | f8f29454668919873f9a0f14bb5a9b01ab103bc8 | [
"MIT"
] | null | null | null | micropython-maixpy-0_6_2-66/stubs/json.py | mongonta0716/stub_for_maixpy | f8f29454668919873f9a0f14bb5a9b01ab103bc8 | [
"MIT"
] | null | null | null | """
Module: 'json' on micropython-maixpy-0.6.2-66
"""
# MCU: {'ver': '0.6.2-66', 'build': '66', 'sysname': 'MaixPy', 'platform': 'MaixPy', 'version': '0.6.2', 'release': '0.6.2', 'port': 'MaixPy', 'family': 'micropython', 'name': 'micropython', 'machine': 'Sipeed_M1 with kendryte-k210', 'nodename': 'MaixPy'}
# Stubber:... | 23.166667 | 255 | 0.582734 | def dump():
pass
def dumps():
pass
def load():
pass
def loads():
pass
| true | true |
f77382a69be7e9e9892689c48c4fe1fff7b6f07c | 765 | py | Python | storage/slurp.db.py | stephenmac98/cheesepi_python3 | d894117938deee8ba676d9872bed5eae388310d1 | [
"Apache-2.0"
] | null | null | null | storage/slurp.db.py | stephenmac98/cheesepi_python3 | d894117938deee8ba676d9872bed5eae388310d1 | [
"Apache-2.0"
] | null | null | null | storage/slurp.db.py | stephenmac98/cheesepi_python3 | d894117938deee8ba676d9872bed5eae388310d1 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
import sys
import tarfile
import json
import cheesepi as cp
def slurp_file(dao, series, fd):
"""Read a file into the 'series' database"""
content = fd.read()
points = json.loads(content)
dao.slurp(series, points)
def slurp_database(dao, filename):
"""Read a tgz filename into the database"... | 20.131579 | 51 | 0.687582 |
import sys
import tarfile
import json
import cheesepi as cp
def slurp_file(dao, series, fd):
content = fd.read()
points = json.loads(content)
dao.slurp(series, points)
def slurp_database(dao, filename):
tar = tarfile.open(filename)
for member in tar.getmembers():
series_name = member.name[:-5] print (serie... | true | true |
f77383057a773c3ef8fd9babe81807cf0b9acff9 | 6,153 | py | Python | Project_1 prediction/code.py | PranavYT/Projects---2020 | d939029c30dada248df81c5febf3952c57dc9906 | [
"Apache-2.0"
] | null | null | null | Project_1 prediction/code.py | PranavYT/Projects---2020 | d939029c30dada248df81c5febf3952c57dc9906 | [
"Apache-2.0"
] | null | null | null | Project_1 prediction/code.py | PranavYT/Projects---2020 | d939029c30dada248df81c5febf3952c57dc9906 | [
"Apache-2.0"
] | 1 | 2020-10-06T08:11:18.000Z | 2020-10-06T08:11:18.000Z | from PyQt5 import QtCore, QtGui, QtWidgets
import SentimentAnalysis
import re, csv
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1248, 804)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.central... | 45.577778 | 79 | 0.636275 | from PyQt5 import QtCore, QtGui, QtWidgets
import SentimentAnalysis
import re, csv
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1248, 804)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.central... | true | true |
f773837459911b4c9823528fa8a0dc552bdaccee | 18,904 | py | Python | src/greentest/test__subprocess.py | hackaugusto/gevent | ab5272c5b6fade84ea001f579748898a6d56d5ba | [
"MIT"
] | null | null | null | src/greentest/test__subprocess.py | hackaugusto/gevent | ab5272c5b6fade84ea001f579748898a6d56d5ba | [
"MIT"
] | null | null | null | src/greentest/test__subprocess.py | hackaugusto/gevent | ab5272c5b6fade84ea001f579748898a6d56d5ba | [
"MIT"
] | null | null | null | import sys
import os
import errno
import unittest
import time
import gc
import tempfile
import greentest
import gevent
from greentest import mock
from gevent import subprocess
if not hasattr(subprocess, 'mswindows'):
# PyPy3, native python subprocess
subprocess.mswindows = False
PYPY = hasattr(sys, 'pypy_v... | 38.344828 | 103 | 0.563955 | import sys
import os
import errno
import unittest
import time
import gc
import tempfile
import greentest
import gevent
from greentest import mock
from gevent import subprocess
if not hasattr(subprocess, 'mswindows'):
subprocess.mswindows = False
PYPY = hasattr(sys, 'pypy_version_info')
PY3 = sys.version_in... | true | true |
f77383c95db6cf9978b39788b8963b04b1b495c2 | 585 | py | Python | v1/validators/serializers/validator.py | nishp77/Validator | 77888fc95db1c69a8a734a6d4eded5fe539ac0b6 | [
"MIT"
] | 43 | 2020-07-12T23:08:35.000Z | 2021-11-28T00:50:49.000Z | v1/validators/serializers/validator.py | nishp77/Validator | 77888fc95db1c69a8a734a6d4eded5fe539ac0b6 | [
"MIT"
] | 72 | 2020-07-15T02:33:15.000Z | 2021-10-04T20:52:13.000Z | v1/validators/serializers/validator.py | nishp77/Validator | 77888fc95db1c69a8a734a6d4eded5fe539ac0b6 | [
"MIT"
] | 43 | 2020-07-13T08:14:24.000Z | 2021-10-04T17:33:26.000Z | from rest_framework import serializers
from thenewboston.utils.fields import all_field_names
from ..models.validator import Validator
class ValidatorSerializer(serializers.ModelSerializer):
class Meta:
exclude = ('id',)
model = Validator
read_only_fields = all_field_names(Validator)
cl... | 21.666667 | 61 | 0.719658 | from rest_framework import serializers
from thenewboston.utils.fields import all_field_names
from ..models.validator import Validator
class ValidatorSerializer(serializers.ModelSerializer):
class Meta:
exclude = ('id',)
model = Validator
read_only_fields = all_field_names(Validator)
cl... | true | true |
f77383df6c41095a993f2fdb55d9bbc7318cbf26 | 7,719 | py | Python | indy_common/test/auth/test_auth_nym_with_new_auth_map.py | Rajait007/indy-node | 90d9e3611950c54db55052cded3e75a5263c4792 | [
"Apache-2.0"
] | 1 | 2020-01-22T06:43:03.000Z | 2020-01-22T06:43:03.000Z | indy_common/test/auth/test_auth_nym_with_new_auth_map.py | Rajait007/indy-node | 90d9e3611950c54db55052cded3e75a5263c4792 | [
"Apache-2.0"
] | null | null | null | indy_common/test/auth/test_auth_nym_with_new_auth_map.py | Rajait007/indy-node | 90d9e3611950c54db55052cded3e75a5263c4792 | [
"Apache-2.0"
] | null | null | null | import pytest
from indy_common.authorize.auth_actions import AuthActionAdd, AuthActionEdit
from plenum.common.constants import TRUSTEE, STEWARD, VERKEY
from indy_common.constants import ROLE, NYM, TRUST_ANCHOR, NETWORK_MONITOR
@pytest.fixture(scope='module', params=[True, False])
def is_owner(request):
return re... | 56.343066 | 109 | 0.404197 | import pytest
from indy_common.authorize.auth_actions import AuthActionAdd, AuthActionEdit
from plenum.common.constants import TRUSTEE, STEWARD, VERKEY
from indy_common.constants import ROLE, NYM, TRUST_ANCHOR, NETWORK_MONITOR
@pytest.fixture(scope='module', params=[True, False])
def is_owner(request):
return re... | true | true |
f77383fec87ba684210a9398ee2c05b13d088022 | 730 | py | Python | api/urls.py | HorizonXP/babybuddy | 88999233e8c3f02c5e8a514164a0fdc45e3ebe70 | [
"BSD-2-Clause"
] | 1 | 2019-01-27T03:50:29.000Z | 2019-01-27T03:50:29.000Z | api/urls.py | HorizonXP/babybuddy | 88999233e8c3f02c5e8a514164a0fdc45e3ebe70 | [
"BSD-2-Clause"
] | 8 | 2020-02-11T23:36:13.000Z | 2022-03-11T23:37:17.000Z | api/urls.py | HorizonXP/babybuddy | 88999233e8c3f02c5e8a514164a0fdc45e3ebe70 | [
"BSD-2-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from django.urls import include, path
from rest_framework import routers
from . import views
router = routers.DefaultRouter()
router.register(r'children', views.ChildViewSet)
router.register(r'changes', views.DiaperChangeViewSet)
router.register(r'feedings', views.FeedingViewSet)
router.regist... | 28.076923 | 55 | 0.742466 | from django.urls import include, path
from rest_framework import routers
from . import views
router = routers.DefaultRouter()
router.register(r'children', views.ChildViewSet)
router.register(r'changes', views.DiaperChangeViewSet)
router.register(r'feedings', views.FeedingViewSet)
router.register(r'notes', views.NoteV... | true | true |
f77384d2d485c3e28a85d014c147326018cfb785 | 1,368 | py | Python | azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/cluster_monitoring_response.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 1 | 2021-09-07T18:36:04.000Z | 2021-09-07T18:36:04.000Z | azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/cluster_monitoring_response.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 2 | 2019-10-02T23:37:38.000Z | 2020-10-02T01:17:31.000Z | azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/cluster_monitoring_response.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 1 | 2018-08-28T14:36:47.000Z | 2018-08-28T14:36:47.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 ... | 39.085714 | 90 | 0.642544 |
from msrest.serialization import Model
class ClusterMonitoringResponse(Model):
_attribute_map = {
'cluster_monitoring_enabled': {'key': 'clusterMonitoringEnabled', 'type': 'bool'},
'workspace_id': {'key': 'workspaceId', 'type': 'str'},
}
def __init__(self, **kwargs):
super(Clust... | true | true |
f77385669ce05ef02dec3258dd57b90613f3857f | 5,055 | py | Python | src/tf_smpl/batch_lbs.py | yasudakn/hmr | 6b7a9a4d1a312c0f93140d4d4752ab2d100a4ce3 | [
"MIT"
] | null | null | null | src/tf_smpl/batch_lbs.py | yasudakn/hmr | 6b7a9a4d1a312c0f93140d4d4752ab2d100a4ce3 | [
"MIT"
] | null | null | null | src/tf_smpl/batch_lbs.py | yasudakn/hmr | 6b7a9a4d1a312c0f93140d4d4752ab2d100a4ce3 | [
"MIT"
] | null | null | null | """ Util functions for SMPL
@@batch_skew
@@batch_rodrigues
@@batch_lrotmin
@@batch_global_rigid_transformation
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
def batch_skew(vec, batch_size=None):
"""
vec is N x 3, batc... | 33.039216 | 96 | 0.55094 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
def batch_skew(vec, batch_size=None):
with tf.name_scope("batch_skew", values=[vec]):
if batch_size is None:
batch_size = vec.shape.as_list()[0]
col_in... | true | true |
f7738571ec756c1e320a03f0fd5edd4a1a188c61 | 3,520 | py | Python | trading_calendars/tests/test_calendar_dispatcher.py | quantrocket-llc/trading-calendars | b72630cbcb288601c62e61ebe002a9043f9a3112 | [
"Apache-2.0"
] | 1 | 2020-07-25T06:18:30.000Z | 2020-07-25T06:18:30.000Z | trading_calendars/tests/test_calendar_dispatcher.py | quantrocket-llc/trading-calendars | b72630cbcb288601c62e61ebe002a9043f9a3112 | [
"Apache-2.0"
] | 13 | 2021-04-13T06:49:23.000Z | 2022-03-31T00:08:10.000Z | trading_calendars/tests/test_calendar_dispatcher.py | quantrocket-llc/trading-calendars | b72630cbcb288601c62e61ebe002a9043f9a3112 | [
"Apache-2.0"
] | 3 | 2020-03-05T23:38:14.000Z | 2021-12-12T00:31:36.000Z | """
Tests for TradingCalendarDispatcher.
"""
from unittest import TestCase
from trading_calendars.calendar_utils import TradingCalendarDispatcher
from trading_calendars.errors import (
CalendarNameCollision,
CyclicCalendarAlias,
InvalidCalendarName,
)
from trading_calendars.exchange_calendar_iepa import IE... | 33.207547 | 79 | 0.652841 | from unittest import TestCase
from trading_calendars.calendar_utils import TradingCalendarDispatcher
from trading_calendars.errors import (
CalendarNameCollision,
CyclicCalendarAlias,
InvalidCalendarName,
)
from trading_calendars.exchange_calendar_iepa import IEPAExchangeCalendar
class CalendarAliasTestC... | true | true |
f77385aa9c8ea6ac484c0ba451b757a4d7e170de | 2,752 | py | Python | tests/test_dbdict.py | Ax6/requests-cache | 6717a336430eb7e6fe17e75c5517f3076ca85b42 | [
"BSD-2-Clause"
] | 1 | 2021-07-07T09:08:08.000Z | 2021-07-07T09:08:08.000Z | tests/test_dbdict.py | Ax6/requests-cache | 6717a336430eb7e6fe17e75c5517f3076ca85b42 | [
"BSD-2-Clause"
] | 1 | 2019-05-29T01:43:33.000Z | 2019-05-29T01:43:33.000Z | tests/test_dbdict.py | Ax6/requests-cache | 6717a336430eb7e6fe17e75c5517f3076ca85b42 | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Path hack
import os, sys
sys.path.insert(0, os.path.abspath('..'))
try:
import unittest2 as unittest
except ImportError:
import unittest
from threading import Thread
from tests.test_custom_dict import BaseCustomDictTestCase
from requests_cache.backends.storage.d... | 28.968421 | 84 | 0.554142 | import os, sys
sys.path.insert(0, os.path.abspath('..'))
try:
import unittest2 as unittest
except ImportError:
import unittest
from threading import Thread
from tests.test_custom_dict import BaseCustomDictTestCase
from requests_cache.backends.storage.dbdict import DbDict, DbPickleDict
class DbdictTestCase(B... | true | true |
f7738675b78cd84da7af4cbff2c50afefc4ad838 | 1,149 | py | Python | plot_solution.py | Parallel-in-Time/PararealF90 | a8318a79b92465a8a3cf775cc7fd096ff0494529 | [
"BSD-2-Clause-FreeBSD"
] | 11 | 2017-03-17T15:04:00.000Z | 2020-12-10T08:05:52.000Z | plot_solution.py | Parallel-in-Time/PararealF90 | a8318a79b92465a8a3cf775cc7fd096ff0494529 | [
"BSD-2-Clause-FreeBSD"
] | 1 | 2015-09-23T09:08:12.000Z | 2015-09-23T09:32:24.000Z | plot_solution.py | Parallel-in-Time/PararealF90 | a8318a79b92465a8a3cf775cc7fd096ff0494529 | [
"BSD-2-Clause-FreeBSD"
] | 5 | 2015-10-24T20:15:26.000Z | 2020-12-10T08:05:36.000Z | import sys
sys.path.append('./scripts')
from get_parameter import get_parameter
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
nu, Nx, Ny, Nz, dt_fine, dt_coarse, Niter, Tend, do... | 28.725 | 126 | 0.698869 | import sys
sys.path.append('./scripts')
from get_parameter import get_parameter
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
nu, Nx, Ny, Nz, dt_fine, dt_coarse, Niter, Tend, do... | true | true |
f77386d0281a6fb7f9712d89f7e609b099796592 | 2,341 | py | Python | tests/test_fetch.py | k8iechen/vcfpy | 89f7097cb5bc7bfec198d8c02fe031b44786b14b | [
"MIT"
] | 48 | 2016-09-25T16:07:53.000Z | 2022-01-19T17:44:46.000Z | tests/test_fetch.py | k8iechen/vcfpy | 89f7097cb5bc7bfec198d8c02fe031b44786b14b | [
"MIT"
] | 83 | 2016-09-16T12:20:02.000Z | 2021-05-12T09:12:10.000Z | tests/test_fetch.py | k8iechen/vcfpy | 89f7097cb5bc7bfec198d8c02fe031b44786b14b | [
"MIT"
] | 9 | 2016-10-04T15:10:06.000Z | 2022-02-08T21:10:51.000Z | # -*- coding: utf-8 -*-
"""Test fetching within tabix files
"""
import os
from vcfpy import reader
__author__ = "Manuel Holtgrewe <manuel.holtgrewe@bihealth.de>"
# Test fetch with chrom/begin/end ---------------------------------------------
def test_fetch_no_records_values():
path = os.path.join(os.path.dir... | 26.602273 | 81 | 0.645023 |
import os
from vcfpy import reader
__author__ = "Manuel Holtgrewe <manuel.holtgrewe@bihealth.de>"
def test_fetch_no_records_values():
path = os.path.join(os.path.dirname(__file__), "vcfs", "multi_contig.vcf.gz")
r = reader.Reader.from_path(path)
records = [vcf_rec for vcf_rec in r.fetch("20", 111069... | true | true |
f7738723c4c34c036cf1127782b21d89b55ee5db | 2,325 | py | Python | yearn/prices/curve.py | nourharidy/yearn-exporter | 0f709a52cc78b7abed376d939491a5bba9671dfe | [
"MIT"
] | 1 | 2022-01-11T12:56:45.000Z | 2022-01-11T12:56:45.000Z | yearn/prices/curve.py | nourharidy/yearn-exporter | 0f709a52cc78b7abed376d939491a5bba9671dfe | [
"MIT"
] | null | null | null | yearn/prices/curve.py | nourharidy/yearn-exporter | 0f709a52cc78b7abed376d939491a5bba9671dfe | [
"MIT"
] | null | null | null | from brownie import Contract, ZERO_ADDRESS
from yearn.cache import memory
from cachetools.func import ttl_cache
# curve registry documentation https://curve.readthedocs.io/registry-address-provider.html
address_provider = Contract('0x0000000022D53366457F9d5E68Ec105046FC4383')
curve_registry = Contract(address_provider... | 33.214286 | 90 | 0.734194 | from brownie import Contract, ZERO_ADDRESS
from yearn.cache import memory
from cachetools.func import ttl_cache
address_provider = Contract('0x0000000022D53366457F9d5E68Ec105046FC4383')
curve_registry = Contract(address_provider.get_address(0))
metapool_factory = Contract(address_provider.get_address(3))
BASIC_TOKENS... | true | true |
f77388b6f360358755a87fec83598788b470ad66 | 6,007 | py | Python | torchmetrics/regression/psnr.py | IgorHoholko/metrics | 5510ccd99eaec5ab8175bbd5e2ad9e66e82d10e4 | [
"Apache-2.0"
] | 1 | 2021-05-09T16:11:48.000Z | 2021-05-09T16:11:48.000Z | torchmetrics/regression/psnr.py | IgorHoholko/metrics | 5510ccd99eaec5ab8175bbd5e2ad9e66e82d10e4 | [
"Apache-2.0"
] | null | null | null | torchmetrics/regression/psnr.py | IgorHoholko/metrics | 5510ccd99eaec5ab8175bbd5e2ad9e66e82d10e4 | [
"Apache-2.0"
] | null | null | null | # Copyright The PyTorch Lightning 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
#
# Unless required by applicable law or agreed to i... | 40.046667 | 120 | 0.627768 | from typing import Any, Optional, Sequence, Tuple, Union
import torch
from torch import Tensor, tensor
from torchmetrics.functional.regression.psnr import _psnr_compute, _psnr_update
from torchmetrics.metric import Metric
from torchmetrics.utilities import rank_zero_warn
class PSNR(Metric):
def __init__(
... | true | true |
f77388ba4ded899da124e3de2472e51a4a88872f | 1,446 | py | Python | z2/part3/updated_part2_batch/jm/parser_errors_2/462756593.py | kozakusek/ipp-2020-testy | 09aa008fa53d159672cc7cbf969a6b237e15a7b8 | [
"MIT"
] | 1 | 2020-04-16T12:13:47.000Z | 2020-04-16T12:13:47.000Z | z2/part3/updated_part2_batch/jm/parser_errors_2/462756593.py | kozakusek/ipp-2020-testy | 09aa008fa53d159672cc7cbf969a6b237e15a7b8 | [
"MIT"
] | 18 | 2020-03-06T17:50:15.000Z | 2020-05-19T14:58:30.000Z | z2/part3/updated_part2_batch/jm/parser_errors_2/462756593.py | kozakusek/ipp-2020-testy | 09aa008fa53d159672cc7cbf969a6b237e15a7b8 | [
"MIT"
] | 18 | 2020-03-06T17:45:13.000Z | 2020-06-09T19:18:31.000Z | from part1 import (
gamma_board,
gamma_busy_fields,
gamma_delete,
gamma_free_fields,
gamma_golden_move,
gamma_golden_possible,
gamma_move,
gamma_new,
)
"""
scenario: test_random_actions
uuid: 462756593
"""
"""
random actions, total chaos
"""
board = gamma_new(2, 4, 2, 1)
assert board is... | 27.283019 | 44 | 0.656985 | from part1 import (
gamma_board,
gamma_busy_fields,
gamma_delete,
gamma_free_fields,
gamma_golden_move,
gamma_golden_possible,
gamma_move,
gamma_new,
)
board = gamma_new(2, 4, 2, 1)
assert board is not None
assert gamma_move(board, 2, 1, 0) == 1
assert gamma_move(board, 2, 0, 0) == 1... | true | true |
f7738a0ae757b8c0ba58226227ca3f682028cacf | 6,085 | py | Python | django_trips/api/serializers.py | awaisdar001/django-trips | d81ad5f46430f6bcf2f014c630d95846c553f413 | [
"MIT"
] | 5 | 2020-09-15T16:02:23.000Z | 2022-03-14T16:36:04.000Z | django_trips/api/serializers.py | awaisdar001/django-trips | d81ad5f46430f6bcf2f014c630d95846c553f413 | [
"MIT"
] | 15 | 2020-09-15T18:06:22.000Z | 2022-02-11T11:23:20.000Z | django_trips/api/serializers.py | awaisdar001/django-trips | d81ad5f46430f6bcf2f014c630d95846c553f413 | [
"MIT"
] | null | null | null | """Django Trips serializers"""
from django.contrib.auth.models import User
from django.urls import reverse
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from django_trips.models import (Category, Facility, Gear, Host, Location,
Trip, Trip... | 28.838863 | 101 | 0.651438 |
from django.contrib.auth.models import User
from django.urls import reverse
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from django_trips.models import (Category, Facility, Gear, Host, Location,
Trip, TripAvailability, TripBooking,
... | true | true |
f7738aaa38a1d96bdb788445d6748332574b9105 | 3,184 | py | Python | vyper/exceptions.py | daejunpark/viper | a9281385661e95610ec0b1e163fc60ebba4d7f01 | [
"MIT"
] | null | null | null | vyper/exceptions.py | daejunpark/viper | a9281385661e95610ec0b1e163fc60ebba4d7f01 | [
"MIT"
] | null | null | null | vyper/exceptions.py | daejunpark/viper | a9281385661e95610ec0b1e163fc60ebba4d7f01 | [
"MIT"
] | null | null | null | import types
from vyper.settings import (
VYPER_ERROR_CONTEXT_LINES,
VYPER_ERROR_LINE_NUMBERS,
)
# Attempts to display the line and column of violating code.
class ParserException(Exception):
def __init__(self, message='Error Message not found.', item=None):
self.message = message
self.li... | 25.070866 | 88 | 0.674623 | import types
from vyper.settings import (
VYPER_ERROR_CONTEXT_LINES,
VYPER_ERROR_LINE_NUMBERS,
)
class ParserException(Exception):
def __init__(self, message='Error Message not found.', item=None):
self.message = message
self.lineno = None
self.col_offset = None
if isinst... | true | true |
f7738b28e226122a5f0551549a97b9831c6efd1f | 6,149 | py | Python | server/test_in_memory_server_api.py | vwarner1411/openrvdas-1 | 57e8b12aa7e0f840293e8727000f69252578e8a3 | [
"MIT"
] | null | null | null | server/test_in_memory_server_api.py | vwarner1411/openrvdas-1 | 57e8b12aa7e0f840293e8727000f69252578e8a3 | [
"MIT"
] | null | null | null | server/test_in_memory_server_api.py | vwarner1411/openrvdas-1 | 57e8b12aa7e0f840293e8727000f69252578e8a3 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import logging
import sys
import unittest
import warnings
sys.path.append('.')
from server.in_memory_server_api import InMemoryServerAPI
sample_1700 = {
"cruise": {
"id": "NBP1700",
"start": "2017-01-01",
"end": "2017-02-01"
},
"loggers": {
"knud": {
"configs": ["o... | 30.29064 | 80 | 0.465604 |
import logging
import sys
import unittest
import warnings
sys.path.append('.')
from server.in_memory_server_api import InMemoryServerAPI
sample_1700 = {
"cruise": {
"id": "NBP1700",
"start": "2017-01-01",
"end": "2017-02-01"
},
"loggers": {
"knud": {
"configs": ["off", "knud->net", "knud... | true | true |
f7738bbc0f5bad9dd78a93ca71bf00f8689d0502 | 29,007 | py | Python | salt/cloud/clouds/vsphere.py | petersanchez/salt | 0e8f1a15b4bb7299220001f3cab6d2c002d4689c | [
"Apache-2.0"
] | null | null | null | salt/cloud/clouds/vsphere.py | petersanchez/salt | 0e8f1a15b4bb7299220001f3cab6d2c002d4689c | [
"Apache-2.0"
] | null | null | null | salt/cloud/clouds/vsphere.py | petersanchez/salt | 0e8f1a15b4bb7299220001f3cab6d2c002d4689c | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
'''
vSphere Cloud Module
====================
.. note::
.. deprecated:: Carbon
The :py:func:`vsphere <salt.cloud.clouds.vsphere>` cloud driver has been
deprecated in favor of the :py:func:`vmware <salt.cloud.clouds.vmware>`
cloud driver and will be removed in Salt ... | 27.599429 | 127 | 0.606199 | from __future__ import absolute_import
import pprint
import logging
import time
import salt.utils.cloud
import salt.utils.xmlutil
from salt.exceptions import SaltCloudSystemExit
from salt.utils import warn_until
import salt.config as config
HAS_LIBS = False
try:
from pysphere import VIServer, MORTypes, VIExcept... | true | true |
f7738e271a2ad4b463a622b42a69735a8a6899a0 | 1,672 | py | Python | src/pynlp/evaluation/rhythm/rhythm.py | arisosoftware/afterwave | 3856d0a765cd228b9895aacd8a7eb23d57af87a7 | [
"MIT"
] | null | null | null | src/pynlp/evaluation/rhythm/rhythm.py | arisosoftware/afterwave | 3856d0a765cd228b9895aacd8a7eb23d57af87a7 | [
"MIT"
] | null | null | null | src/pynlp/evaluation/rhythm/rhythm.py | arisosoftware/afterwave | 3856d0a765cd228b9895aacd8a7eb23d57af87a7 | [
"MIT"
] | null | null | null | import requests
import json
import numpy as np
with open('./jiuge_7.txt', encoding='utf-8') as f:
poes = json.load(f)
yayun_all = 0
pingze_all = 0
for p in poes:
data = {
"yun": "psy",
"type": "qj_p", # qj_p七言 | wj_p五言
"text": p
}
headers = {
"Host": "www.52shici.com",
... | 28.338983 | 138 | 0.571172 | import requests
import json
import numpy as np
with open('./jiuge_7.txt', encoding='utf-8') as f:
poes = json.load(f)
yayun_all = 0
pingze_all = 0
for p in poes:
data = {
"yun": "psy",
"type": "qj_p", "text": p
}
headers = {
"Host": "www.52shici.com",
"Origin": ... | true | true |
f7738e9d61c30a3a03c3c13058de3e23a6da3c87 | 1,470 | py | Python | ansi-common-lisp-code-book/gen.py | ismdeep/ansi-common-lisp-practice | e7659493b83b1ba206794054013e8f55563e4ce2 | [
"MIT"
] | null | null | null | ansi-common-lisp-code-book/gen.py | ismdeep/ansi-common-lisp-practice | e7659493b83b1ba206794054013e8f55563e4ce2 | [
"MIT"
] | null | null | null | ansi-common-lisp-code-book/gen.py | ismdeep/ansi-common-lisp-practice | e7659493b83b1ba206794054013e8f55563e4ce2 | [
"MIT"
] | null | null | null | import os
import argparse
def get_head_tail(args):
head, tail = None, None
with open(args.head) as f: head = f.read()
with open(args.tail) as f: tail = f.read()
return head, tail
def main(args):
tex = []
head, tail = get_head_tail(args)
tex.append(head)
sections = os.listdir(args.code)
sections.sor... | 32.666667 | 104 | 0.659184 | import os
import argparse
def get_head_tail(args):
head, tail = None, None
with open(args.head) as f: head = f.read()
with open(args.tail) as f: tail = f.read()
return head, tail
def main(args):
tex = []
head, tail = get_head_tail(args)
tex.append(head)
sections = os.listdir(args.code)
sections.sor... | true | true |
f773905a6c4fddd4f36eab2e76c4802ff78f8741 | 2,958 | py | Python | RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/openflow/state.py | ralfjon/IxNetwork | c0c834fbc465af69c12fd6b7cee4628baba7fff1 | [
"MIT"
] | null | null | null | RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/openflow/state.py | ralfjon/IxNetwork | c0c834fbc465af69c12fd6b7cee4628baba7fff1 | [
"MIT"
] | null | null | null | RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/openflow/state.py | ralfjon/IxNetwork | c0c834fbc465af69c12fd6b7cee4628baba7fff1 | [
"MIT"
] | null | null | null |
# Copyright 1997 - 2018 by IXIA Keysight
#
# 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 rights to use, copy, modify, merge, p... | 30.494845 | 128 | 0.726504 |
from ixnetwork_restpy.base import Base
from ixnetwork_restpy.files import Files
class State(Base):
_SDM_NAME = 'state'
def __init__(self, parent):
super(State, self).__init__(parent)
@property
def LinkDown(self):
return self._get_attribute('linkDown')
@LinkDown.setter
def LinkDown(... | true | true |
f7739090df2e4761cc272ab0e36f0f42c503f5aa | 1,052 | py | Python | bak/coord.py | baijianhua/pymath | a96ebbd8c8ac646c436d8bf33cb01764a948255d | [
"MIT"
] | null | null | null | bak/coord.py | baijianhua/pymath | a96ebbd8c8ac646c436d8bf33cb01764a948255d | [
"MIT"
] | null | null | null | bak/coord.py | baijianhua/pymath | a96ebbd8c8ac646c436d8bf33cb01764a948255d | [
"MIT"
] | null | null | null | #用python绘制坐标
#https://matplotlib.org/examples/axes_grid/demo_axisline_style.html
#https://stackoverflow.com/questions/13430231/how-i-can-get-cartesian-coordinate-system-in-matplotlib
#https://stackoverflow.com/questions/50798265/what-is-subplotzero-documentation-lacking
# notice import as 和 from import有什么区别?
import nu... | 26.974359 | 101 | 0.754753 |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from bak.basic_units import cm
fig: Figure = plt.figure()
ax: Axes = fig.subplots()
ax.set_title('x axis spine at zero data coordinate')
ax.set_xlabel("Axes zero")
ax.set_ylabel("Y")
ax.axis()
ax.... | true | true |
f7739167ec73bd7b77c3676e3de36b3373055ee9 | 18,859 | py | Python | examples/python/gui/non-english.py | BOpermanis/Open3D | 82fd64a20852ad2b48c99e229dfdec36d048707d | [
"MIT"
] | null | null | null | examples/python/gui/non-english.py | BOpermanis/Open3D | 82fd64a20852ad2b48c99e229dfdec36d048707d | [
"MIT"
] | null | null | null | examples/python/gui/non-english.py | BOpermanis/Open3D | 82fd64a20852ad2b48c99e229dfdec36d048707d | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import open3d.visualization.gui as gui
import os.path
import platform
basedir = os.path.dirname(os.path.realpath(__file__))
# This is all-widgets.py with some modifications for non-English languages.
# Please see all-widgets.py for usage of the GUI widgets
MODE_SERIF = "serif"
MODE_COMMON_HANYU... | 40.908894 | 81 | 0.641073 | import open3d.visualization.gui as gui
import os.path
import platform
basedir = os.path.dirname(os.path.realpath(__file__))
MODE_SERIF = "serif"
MODE_COMMON_HANYU = "common"
MODE_SERIF_AND_COMMON_HANYU = "serif+common"
MODE_COMMON_HANYU_EN = "hanyu_en+common"
MODE_ALL_HANYU = "all"
MODE_CUSTOM_CHARS = "custom"
mode... | true | true |
f773917f6ca9564f226d5175d279d930fd41a118 | 4,098 | py | Python | salt/modules/nginx.py | fake-name/salt | d8f04936e4407f51946e32e8166159778f6c31a5 | [
"Apache-2.0"
] | null | null | null | salt/modules/nginx.py | fake-name/salt | d8f04936e4407f51946e32e8166159778f6c31a5 | [
"Apache-2.0"
] | null | null | null | salt/modules/nginx.py | fake-name/salt | d8f04936e4407f51946e32e8166159778f6c31a5 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Support for nginx
"""
from __future__ import absolute_import, print_function, unicode_literals
import re
import salt.utils.decorators as decorators
# Import salt libs
import salt.utils.path
# Import 3rd-party libs
from salt.ext.six.moves.urllib.request import urlopen as _urlopen
# Cach... | 22.766667 | 84 | 0.587604 | """
Support for nginx
"""
from __future__ import absolute_import, print_function, unicode_literals
import re
import salt.utils.decorators as decorators
import salt.utils.path
from salt.ext.six.moves.urllib.request import urlopen as _urlopen
# for nginx over and over and over for each function herein
@decorators.m... | false | true |
f77391dce09f9381d4f4663bedeab90fcd14a35a | 310 | py | Python | SiPANN/__init__.py | contagon/SiPANN | bc342631b1923653b9398c86559930a0a29500e9 | [
"MIT"
] | 3 | 2020-04-25T15:25:21.000Z | 2020-05-26T09:21:28.000Z | SiPANN/__init__.py | contagon/SiPANN | bc342631b1923653b9398c86559930a0a29500e9 | [
"MIT"
] | 4 | 2020-04-24T20:30:24.000Z | 2020-05-22T18:22:54.000Z | SiPANN/__init__.py | contagon/SiPANN | bc342631b1923653b9398c86559930a0a29500e9 | [
"MIT"
] | 1 | 2020-05-08T18:28:57.000Z | 2020-05-08T18:28:57.000Z | """Welcome to SiPANNs, silicon photonics with artificial neural networks,
documentation.
We leverage various machine learning techniques to simulate integrated
photonic device circuits.
"""
__version__ = "1.4.0"
__author__ = "Easton Potokar, Alec Hammond, R Scott Collings <eastonpost@byu.edu>"
__all__ = []
| 28.181818 | 82 | 0.780645 |
__version__ = "1.4.0"
__author__ = "Easton Potokar, Alec Hammond, R Scott Collings <eastonpost@byu.edu>"
__all__ = []
| true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.