hexsha stringlengths 40 40 | size int64 7 1.04M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 247 | max_stars_repo_name stringlengths 4 125 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 368k ⌀ | 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 247 | max_issues_repo_name stringlengths 4 125 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 116k ⌀ | 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 247 | max_forks_repo_name stringlengths 4 125 | max_forks_repo_head_hexsha stringlengths 40 78 | 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 1 1.04M | avg_line_length float64 1.77 618k | max_line_length int64 1 1.02M | alphanum_fraction float64 0 1 | original_content stringlengths 7 1.04M | filtered:remove_function_no_docstring int64 -102 942k | filtered:remove_class_no_docstring int64 -354 977k | filtered:remove_delete_markers int64 0 60.1k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
215499b87f796abd452312b91b2724408513c326 | 4,893 | py | Python | rhea/system/stream/fifobus.py | mngr0/rhea | 9ad8d193f7f78f1d192af438568d45fb5a398c8c | [
"MIT"
] | null | null | null | rhea/system/stream/fifobus.py | mngr0/rhea | 9ad8d193f7f78f1d192af438568d45fb5a398c8c | [
"MIT"
] | null | null | null | rhea/system/stream/fifobus.py | mngr0/rhea | 9ad8d193f7f78f1d192af438568d45fb5a398c8c | [
"MIT"
] | null | null | null | #
# Copyright (c) 2013-2015 Christopher L. Felton
# See the licence file in the top directory
#
import myhdl
from myhdl import Signal, intbv, always_comb
from ..clock import Clock
from .streamers import Streamers
_fb_num = 0
_fb_list = {}
def _add_bus(fb, name=''):
""" globally keep track of all the buses added... | 35.201439 | 74 | 0.600245 | #
# Copyright (c) 2013-2015 Christopher L. Felton
# See the licence file in the top directory
#
import myhdl
from myhdl import Signal, intbv, always_comb
from ..clock import Clock
from .streamers import Streamers
_fb_num = 0
_fb_list = {}
def _add_bus(fb, name=''):
""" globally keep track of all the buses added... | 697 | 3,772 | 23 |
9d2f8b6243abe41aff1ec1f3cbc03b7f2abd38ac | 3,215 | py | Python | code/plot_likelihood_parameters.py | matfontaine/alpha_SpatialNMF | d4d64e187af3a808a4c0e380f704b1d9d7afdeaa | [
"CC0-1.0"
] | null | null | null | code/plot_likelihood_parameters.py | matfontaine/alpha_SpatialNMF | d4d64e187af3a808a4c0e380f704b1d9d7afdeaa | [
"CC0-1.0"
] | null | null | null | code/plot_likelihood_parameters.py | matfontaine/alpha_SpatialNMF | d4d64e187af3a808a4c0e380f704b1d9d7afdeaa | [
"CC0-1.0"
] | null | null | null | import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import pickle as pic
import sys, os
import numpy as np
import math as math
HYP = 1.4
BETA = 0.0
it = 500
S = 2
M = 2
K = 32
init = "circ"
EST_DIR_A = "/home/mafontai/Documents/project/git_project/speech_separation/alpha_SpatialMNMF/results_2anechoi... | 39.691358 | 172 | 0.691135 | import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import pickle as pic
import sys, os
import numpy as np
import math as math
HYP = 1.4
BETA = 0.0
it = 500
S = 2
M = 2
K = 32
init = "circ"
EST_DIR_A = "/home/mafontai/Documents/project/git_project/speech_separation/alpha_SpatialMNMF/results_2anechoi... | 0 | 0 | 0 |
69073497cb0a3bfc6f2b0ab40c3ed6ca440904e9 | 8,528 | py | Python | tests/parts/test_fields.py | peterandluc/PyHDB | 826539d06b8bcef74fe755e7489b8a8255628f12 | [
"Apache-2.0"
] | 332 | 2015-01-03T21:50:28.000Z | 2021-04-28T08:37:18.000Z | tests/parts/test_fields.py | peterandluc/PyHDB | 826539d06b8bcef74fe755e7489b8a8255628f12 | [
"Apache-2.0"
] | 132 | 2015-01-12T10:26:09.000Z | 2021-05-04T17:46:34.000Z | tests/parts/test_fields.py | peterandluc/PyHDB | 826539d06b8bcef74fe755e7489b8a8255628f12 | [
"Apache-2.0"
] | 147 | 2015-01-10T16:25:29.000Z | 2021-04-08T08:02:20.000Z | # Copyright 2014, 2015 SAP SE.
#
# 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 in writing,
#... | 60.48227 | 77 | 0.681168 | # Copyright 2014, 2015 SAP SE.
#
# 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 in writing,
#... | 7,794 | 0 | 92 |
cc3165670824b1fcde6ca5d3c946a9eaf5909394 | 132 | py | Python | desafio03.py | TrojanYT/TrojanPython | d64b9b6c1889e4fb637a7dacf850f7e159dd92aa | [
"MIT"
] | null | null | null | desafio03.py | TrojanYT/TrojanPython | d64b9b6c1889e4fb637a7dacf850f7e159dd92aa | [
"MIT"
] | null | null | null | desafio03.py | TrojanYT/TrojanPython | d64b9b6c1889e4fb637a7dacf850f7e159dd92aa | [
"MIT"
] | null | null | null | n1 = input('Digite o primeiro número? ')
n2 = input('Digite o segundo número? ')
soma = int(n1) + int(n2)
print('A soma é: ', soma)
| 26.4 | 40 | 0.636364 | n1 = input('Digite o primeiro número? ')
n2 = input('Digite o segundo número? ')
soma = int(n1) + int(n2)
print('A soma é: ', soma)
| 0 | 0 | 0 |
4c4628ff35b366104fe2e07d36da43520634355b | 11,938 | py | Python | models/hourglass_relu/hg_blocks.py | dp-isi/VaryingSkinTone | 2e595c1d668a8424d86b76dae1fef4b607c26fc8 | [
"MIT"
] | null | null | null | models/hourglass_relu/hg_blocks.py | dp-isi/VaryingSkinTone | 2e595c1d668a8424d86b76dae1fef4b607c26fc8 | [
"MIT"
] | null | null | null | models/hourglass_relu/hg_blocks.py | dp-isi/VaryingSkinTone | 2e595c1d668a8424d86b76dae1fef4b607c26fc8 | [
"MIT"
] | null | null | null | from keras.models import *
from keras.layers import *
from keras.optimizers import Adam, RMSprop
from keras.losses import mean_squared_error
import keras.backend as K
# from keras_lr_multiplier import LRMultiplier
'''
code source:
https://github.com/yuanyuanli85/Stacked_Hourglass_Network_Keras
'''
import os
# os.syst... | 40.467797 | 145 | 0.667951 | from keras.models import *
from keras.layers import *
from keras.optimizers import Adam, RMSprop
from keras.losses import mean_squared_error
import keras.backend as K
# from keras_lr_multiplier import LRMultiplier
'''
code source:
https://github.com/yuanyuanli85/Stacked_Hourglass_Network_Keras
'''
import os
# os.syst... | 9,208 | 0 | 229 |
1688966a6e7972cf565faa45fe80c6782bde8c46 | 469 | py | Python | project_euler_5.py | andrazm123/Project-Euler | 260a46810bce73e1079c13518ae94732c8cb1acb | [
"MIT"
] | null | null | null | project_euler_5.py | andrazm123/Project-Euler | 260a46810bce73e1079c13518ae94732c8cb1acb | [
"MIT"
] | null | null | null | project_euler_5.py | andrazm123/Project-Euler | 260a46810bce73e1079c13518ae94732c8cb1acb | [
"MIT"
] | null | null | null | def gcd(a, b):
'''Najvecji skupni veckratnik'''
if b == 0:
return a
else:
return gcd(b, a % b)
def lcm(a, b):
'''Najmanjsi skupni delitelj'''
return int((a * b) / gcd(a, b))
def stevilo_deljivo_prvimi_stevili(n):
'''Vrne najmanjso stevilo deljivo s prvimi n naravnimi stevili'''... | 21.318182 | 69 | 0.607676 | def gcd(a, b):
'''Najvecji skupni veckratnik'''
if b == 0:
return a
else:
return gcd(b, a % b)
def lcm(a, b):
'''Najmanjsi skupni delitelj'''
return int((a * b) / gcd(a, b))
def stevilo_deljivo_prvimi_stevili(n):
'''Vrne najmanjso stevilo deljivo s prvimi n naravnimi stevili'''... | 0 | 0 | 0 |
f94db452582a37c81227fa49c9ec51bdc11638c0 | 101 | py | Python | dolphindb/__init__.py | ShenHongFei/dolphindb-python | 36f6cc0ded6d9b4b3f25d5eadd83dc3f3314fd8c | [
"Apache-2.0"
] | 1 | 2020-12-29T11:23:07.000Z | 2020-12-29T11:23:07.000Z | dolphindb/__init__.py | ShenHongFei/dolphindb-python | 36f6cc0ded6d9b4b3f25d5eadd83dc3f3314fd8c | [
"Apache-2.0"
] | null | null | null | dolphindb/__init__.py | ShenHongFei/dolphindb-python | 36f6cc0ded6d9b4b3f25d5eadd83dc3f3314fd8c | [
"Apache-2.0"
] | null | null | null | from .type_util import *
from .session import session
from .table import *
from .vector import Vector | 25.25 | 28 | 0.792079 | from .type_util import *
from .session import session
from .table import *
from .vector import Vector | 0 | 0 | 0 |
ef1cc60922f5404a124cd5c3f0ddb5a1c2b477e4 | 6,730 | py | Python | GameEvents.py | justinbeetle/pyDragonWarrior | cfaf57161ab4950da537de9937d688bc7d24bf4a | [
"MIT"
] | 3 | 2021-04-07T14:43:20.000Z | 2021-04-17T21:26:08.000Z | GameEvents.py | justinbeetle/pyDragonWarrior | cfaf57161ab4950da537de9937d688bc7d24bf4a | [
"MIT"
] | 1 | 2022-01-02T15:52:23.000Z | 2022-01-12T01:51:50.000Z | GameEvents.py | justinbeetle/pyDragonWarrior | cfaf57161ab4950da537de9937d688bc7d24bf4a | [
"MIT"
] | null | null | null | #!/usr/bin/env python
from typing import List, Optional, Tuple
import pygame
joysticks = []
if __name__ == '__main__':
try:
main()
except Exception as e:
import sys
import traceback
print(traceback.format_exception(None, # <- type(e) by docs, but ignored
... | 41.036585 | 118 | 0.625854 | #!/usr/bin/env python
from typing import List, Optional, Tuple
import pygame
joysticks = []
def setup_joystick() -> bool:
print('pygame.joystick.get_count() =', pygame.joystick.get_count(), flush=True)
for joystickId in range(pygame.joystick.get_count()):
joystick = pygame.joystick.Joystick(joystic... | 6,110 | 0 | 138 |
1a359f8c4679c96bac746dc20017997049f8367c | 1,699 | py | Python | data/emoji2vec/visualize.py | mitchelljeff/SUMMAD4.3 | 33bb3a74cff16a7aa699660a08d98ddcd662cad5 | [
"MIT"
] | 1 | 2017-09-15T14:06:07.000Z | 2017-09-15T14:06:07.000Z | data/emoji2vec/visualize.py | mitchelljeff/SUMMAD4.3 | 33bb3a74cff16a7aa699660a08d98ddcd662cad5 | [
"MIT"
] | null | null | null | data/emoji2vec/visualize.py | mitchelljeff/SUMMAD4.3 | 33bb3a74cff16a7aa699660a08d98ddcd662cad5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import tensorflow as tf
from tensorflow.contrib.tensorboard.plugins import projector
import os
import numpy as np
dir = "./jtr/data/emoji2vec/"
emojis = []
vecs = []
with open(dir + "metadata.tsv", "w") as f_out:
# f_out.write("emoji\n")
with open(dir + "emoji2vec.txt", "r") as f_in:
... | 32.673077 | 85 | 0.660388 | # -*- coding: utf-8 -*-
import tensorflow as tf
from tensorflow.contrib.tensorboard.plugins import projector
import os
import numpy as np
dir = "./jtr/data/emoji2vec/"
emojis = []
vecs = []
with open(dir + "metadata.tsv", "w") as f_out:
# f_out.write("emoji\n")
with open(dir + "emoji2vec.txt", "r") as f_in:
... | 0 | 0 | 0 |
2d8709b2618ae2bd21be1ef05a498b81db9df3ac | 308 | py | Python | RecoTracker/GeometryESProducer/python/TrackerMTDRecoGeometryESProducer_cfi.py | Purva-Chaudhari/cmssw | 32e5cbfe54c4d809d60022586cf200b7c3020bcf | [
"Apache-2.0"
] | 852 | 2015-01-11T21:03:51.000Z | 2022-03-25T21:14:00.000Z | RecoTracker/GeometryESProducer/python/TrackerMTDRecoGeometryESProducer_cfi.py | Purva-Chaudhari/cmssw | 32e5cbfe54c4d809d60022586cf200b7c3020bcf | [
"Apache-2.0"
] | 30,371 | 2015-01-02T00:14:40.000Z | 2022-03-31T23:26:05.000Z | RecoTracker/GeometryESProducer/python/TrackerMTDRecoGeometryESProducer_cfi.py | Purva-Chaudhari/cmssw | 32e5cbfe54c4d809d60022586cf200b7c3020bcf | [
"Apache-2.0"
] | 3,240 | 2015-01-02T05:53:18.000Z | 2022-03-31T17:24:21.000Z | import FWCore.ParameterSet.Config as cms
TrackerRecoGeometryESProducer = cms.ESProducer("TrackerMTDRecoGeometryESProducer",
usePhase2Stacks = cms.bool(False)
)
from Configuration.ProcessModifiers.vectorHits_cff import vectorHits
vectorHits.toModify(TrackerRecoGeometryESProducer, usePhase2Stacks = True)
| 34.222222 | 82 | 0.86039 | import FWCore.ParameterSet.Config as cms
TrackerRecoGeometryESProducer = cms.ESProducer("TrackerMTDRecoGeometryESProducer",
usePhase2Stacks = cms.bool(False)
)
from Configuration.ProcessModifiers.vectorHits_cff import vectorHits
vectorHits.toModify(TrackerRecoGeometryESProducer, usePhase2Stacks = True)
| 0 | 0 | 0 |
38a11636d3f125019cc9e573d3dc9f0b6ef5e60d | 1,114 | py | Python | Aves2/job_manager/aves2_schemas/data_schema.py | jd-aig/aves2 | 10aeb832feb94adf563f9795013c77bfd115b44e | [
"Apache-2.0"
] | 3 | 2020-09-24T01:36:02.000Z | 2022-03-28T11:53:54.000Z | Aves2/job_manager/aves2_schemas/data_schema.py | jd-aig/aves2 | 10aeb832feb94adf563f9795013c77bfd115b44e | [
"Apache-2.0"
] | null | null | null | Aves2/job_manager/aves2_schemas/data_schema.py | jd-aig/aves2 | 10aeb832feb94adf563f9795013c77bfd115b44e | [
"Apache-2.0"
] | 1 | 2020-12-08T05:14:23.000Z | 2020-12-08T05:14:23.000Z | data_schema = {
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"title": "The Root Schema",
"required": [
"type",
"pvc",
"path",
"filename"
],
"properties": {
"type": {
"$id": "#/properties/type",... | 19.892857 | 55 | 0.409336 | data_schema = {
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"title": "The Root Schema",
"required": [
"type",
"pvc",
"path",
"filename"
],
"properties": {
"type": {
"$id": "#/properties/type",... | 0 | 0 | 0 |
223c2cc1668c0e1fd8c5eb1b2306bcd64971a335 | 32,181 | py | Python | nullomers_assessor.py | vpennetti/nullomers-assessor | 352de001f865efeb7ad37a1a51533a5a9f963682 | [
"Apache-2.0"
] | 3 | 2021-03-23T07:29:00.000Z | 2021-12-02T21:36:35.000Z | nullomers_assessor.py | vpennetti/nullomers-assessor | 352de001f865efeb7ad37a1a51533a5a9f963682 | [
"Apache-2.0"
] | null | null | null | nullomers_assessor.py | vpennetti/nullomers-assessor | 352de001f865efeb7ad37a1a51533a5a9f963682 | [
"Apache-2.0"
] | 1 | 2022-02-03T16:11:08.000Z | 2022-02-03T16:11:08.000Z | import sys
import Bio
import statsmodels
import math
import numpy as np
import pandas as pd
from statsmodels.compat.python import range
from statsmodels.compat.collections import OrderedDict
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqUtils.ProtParam import ProteinAnalysis
from collections impo... | 59.15625 | 291 | 0.650726 | import sys
import Bio
import statsmodels
import math
import numpy as np
import pandas as pd
from statsmodels.compat.python import range
from statsmodels.compat.collections import OrderedDict
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqUtils.ProtParam import ProteinAnalysis
from collections impo... | 1,569 | 0 | 100 |
90a918baa821f6642a6998639ff3abde00d0c0d0 | 29,509 | py | Python | common/tests/test_views.py | bogolla/mfl_api | c5dff1857a94e1272d0663804c2339fa88cb7be3 | [
"MIT"
] | null | null | null | common/tests/test_views.py | bogolla/mfl_api | c5dff1857a94e1272d0663804c2339fa88cb7be3 | [
"MIT"
] | null | null | null | common/tests/test_views.py | bogolla/mfl_api | c5dff1857a94e1272d0663804c2339fa88cb7be3 | [
"MIT"
] | 1 | 2019-02-06T19:23:49.000Z | 2019-02-06T19:23:49.000Z | import json
import uuid
from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model
from django.core.cache import cache
from rest_framework.test import APITestCase
from model_mommy import mommy
from ..models import (
County,
Contact,
ContactType,
Constituency,
Ward,... | 35.553012 | 78 | 0.593378 | import json
import uuid
from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model
from django.core.cache import cache
from rest_framework.test import APITestCase
from model_mommy import mommy
from ..models import (
County,
Contact,
ContactType,
Constituency,
Ward,... | 25,052 | 2,052 | 1,718 |
0e73708eef7cd9ff9448de35b947d3c6d63f0ce7 | 9,968 | py | Python | torch_models/models/seq_encoders.py | Ryou0634/pytorch_models | cd48f9b3797839df5dbf4e51bed81de44e7b962e | [
"BSD-3-Clause"
] | null | null | null | torch_models/models/seq_encoders.py | Ryou0634/pytorch_models | cd48f9b3797839df5dbf4e51bed81de44e7b962e | [
"BSD-3-Clause"
] | null | null | null | torch_models/models/seq_encoders.py | Ryou0634/pytorch_models | cd48f9b3797839df5dbf4e51bed81de44e7b962e | [
"BSD-3-Clause"
] | null | null | null | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
class SeqEncoderBase(nn.Module):
'''
Sequence encoder takes sequences as input, transform them into embeddings,
and then outputs encoded fixed-size representation.
... | 45.104072 | 133 | 0.652087 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
class SeqEncoderBase(nn.Module):
'''
Sequence encoder takes sequences as input, transform them into embeddings,
and then outputs encoded fixed-size representation.
... | 5,269 | 3,965 | 407 |
0aa4c846dd24707f46527bf0c43bdc971d716dd5 | 6,693 | py | Python | experiments/vitchyr/icra2018/train_separate_policies.py | Asap7772/railrl_evalsawyer | baba8ce634d32a48c7dfe4dc03b123e18e96e0a3 | [
"MIT"
] | 1 | 2020-10-23T14:40:09.000Z | 2020-10-23T14:40:09.000Z | experiments/vitchyr/icra2018/train_separate_policies.py | Asap7772/railrl_evalsawyer | baba8ce634d32a48c7dfe4dc03b123e18e96e0a3 | [
"MIT"
] | null | null | null | experiments/vitchyr/icra2018/train_separate_policies.py | Asap7772/railrl_evalsawyer | baba8ce634d32a48c7dfe4dc03b123e18e96e0a3 | [
"MIT"
] | 1 | 2021-05-27T20:38:45.000Z | 2021-05-27T20:38:45.000Z | import random
import numpy as np
from rlkit.envs.mujoco.pusher3dof import PusherEnv3DOF
from rlkit.envs.mujoco.pusher_avoider_3dof import PusherAvoiderEnv3DOF
from rlkit.exploration_strategies.ou_strategy import OUStrategy
from rlkit.launchers.launcher_util import run_experiment
from rlkit.torch.networks import FeedFo... | 31.570755 | 76 | 0.511729 | import random
import numpy as np
from rlkit.envs.mujoco.pusher3dof import PusherEnv3DOF
from rlkit.envs.mujoco.pusher_avoider_3dof import PusherAvoiderEnv3DOF
from rlkit.exploration_strategies.ou_strategy import OUStrategy
from rlkit.launchers.launcher_util import run_experiment
from rlkit.torch.networks import FeedFo... | 1,486 | 0 | 23 |
5e5c6b74133371a4d1f0b9e965d2da016f8cbdbe | 180 | py | Python | ctpbee/interface/ctp/__init__.py | Faithforus/ctpbee | 18cd81aa9218803ba649cde7389a1f249f4a24db | [
"MIT"
] | null | null | null | ctpbee/interface/ctp/__init__.py | Faithforus/ctpbee | 18cd81aa9218803ba649cde7389a1f249f4a24db | [
"MIT"
] | null | null | null | ctpbee/interface/ctp/__init__.py | Faithforus/ctpbee | 18cd81aa9218803ba649cde7389a1f249f4a24db | [
"MIT"
] | null | null | null | from .md_api import BeeMdApi
from .md_api import BeeMdApiApp
from .td_api import BeeTdApi
from .td_api import BeeTdApiApp
__all__ = [BeeMdApiApp, BeeMdApi, BeeTdApi, BeeTdApiApp]
| 25.714286 | 56 | 0.816667 | from .md_api import BeeMdApi
from .md_api import BeeMdApiApp
from .td_api import BeeTdApi
from .td_api import BeeTdApiApp
__all__ = [BeeMdApiApp, BeeMdApi, BeeTdApi, BeeTdApiApp]
| 0 | 0 | 0 |
3b6757229fa4e0ec61c4e05d1d0337ce1546f654 | 2,904 | py | Python | weibospider/pipelines.py | keyboardpianist/weiboSpider | e4ccaad4ee0e4dce31a18f6ddf16fba75d955aba | [
"MIT"
] | null | null | null | weibospider/pipelines.py | keyboardpianist/weiboSpider | e4ccaad4ee0e4dce31a18f6ddf16fba75d955aba | [
"MIT"
] | null | null | null | weibospider/pipelines.py | keyboardpianist/weiboSpider | e4ccaad4ee0e4dce31a18f6ddf16fba75d955aba | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import pymongo
from pymongo.errors import DuplicateKeyError
from settings import MONGO_HOST, MONGO_PORT
import pymysql
# twisted: 用于异步写入(包含数据库)的框架,cursor.execute()是同步写入
from twisted.enterprise import adbapi | 31.565217 | 68 | 0.607094 | # -*- coding: utf-8 -*-
import pymongo
from pymongo.errors import DuplicateKeyError
from settings import MONGO_HOST, MONGO_PORT
import pymysql
# twisted: 用于异步写入(包含数据库)的框架,cursor.execute()是同步写入
from twisted.enterprise import adbapi
class MongoDBPipeline(object):
def __init__(self):
client = pymongo.MongoCli... | 1,248 | 1,812 | 46 |
0f2d10bfbdf173a3b75f3bacad2078c1e1729a98 | 24,301 | py | Python | tlh/data/constraints.py | notyourav/the-little-hat | f52b38b18b762e704b36cef06c07656348ea6995 | [
"MIT"
] | null | null | null | tlh/data/constraints.py | notyourav/the-little-hat | f52b38b18b762e704b36cef06c07656348ea6995 | [
"MIT"
] | null | null | null | tlh/data/constraints.py | notyourav/the-little-hat | f52b38b18b762e704b36cef06c07656348ea6995 | [
"MIT"
] | 2 | 2021-10-05T20:40:12.000Z | 2022-01-05T00:17:36.000Z | from tlh.const import RomVariant
from dataclasses import dataclass
from sortedcontainers import SortedKeyList
from bisect import bisect_left, bisect_right
from intervaltree import Interval, IntervalTree
@dataclass
class Constraint:
"""
A constraint defines that two local addresses of different rom variants sho... | 45.592871 | 212 | 0.611127 | from tlh.const import RomVariant
from dataclasses import dataclass
from sortedcontainers import SortedKeyList
from bisect import bisect_left, bisect_right
from intervaltree import Interval, IntervalTree
@dataclass
class Constraint:
"""
A constraint defines that two local addresses of different rom variants sho... | 4,732 | 17,656 | 351 |
63f1240754200fb3db6c8ba0af5ce8147b8df1e0 | 4,001 | py | Python | comparison/scikit_optimize/skopt_synthetic.py | zhanglei1172/XBBO | 9bf9b778b29735f108457d5e491680785212d580 | [
"MIT"
] | 2 | 2021-09-06T02:06:22.000Z | 2021-12-09T10:46:56.000Z | comparison/scikit_optimize/skopt_synthetic.py | zhanglei1172/XBBO | 9bf9b778b29735f108457d5e491680785212d580 | [
"MIT"
] | null | null | null | comparison/scikit_optimize/skopt_synthetic.py | zhanglei1172/XBBO | 9bf9b778b29735f108457d5e491680785212d580 | [
"MIT"
] | null | null | null | import numpy as np
import argparse
from skopt.benchmarks import branin
from skopt import gp_minimize
from skopt import forest_minimize
from skopt import gbrt_minimize
from skopt import dummy_minimize
if __name__ == "__main__":
repeat_num = 10
max_call = 200
optimizers = [("gp_minimize", gp_minimize),
... | 38.471154 | 98 | 0.535116 | import numpy as np
import argparse
from skopt.benchmarks import branin
from skopt import gp_minimize
from skopt import forest_minimize
from skopt import gbrt_minimize
from skopt import dummy_minimize
def run(n_calls, n_runs, optimizers, acq_optimizer="lbfgs"):
bounds = [(-5.0, 10.0), (0.0, 15.0)]
results = ... | 2,129 | 0 | 23 |
24330687345ad6fc4308ad980e6abd11caabef02 | 5,082 | py | Python | tests/test_date_timestamp_conformance.py | uk-gov-mirror/moj-analytical-services.mojap-arrow-pd-parser | 3edb47fa581d7e05af10c7aeda4d825b1710ed51 | [
"MIT"
] | null | null | null | tests/test_date_timestamp_conformance.py | uk-gov-mirror/moj-analytical-services.mojap-arrow-pd-parser | 3edb47fa581d7e05af10c7aeda4d825b1710ed51 | [
"MIT"
] | null | null | null | tests/test_date_timestamp_conformance.py | uk-gov-mirror/moj-analytical-services.mojap-arrow-pd-parser | 3edb47fa581d7e05af10c7aeda4d825b1710ed51 | [
"MIT"
] | null | null | null | import pytest
import datetime
import pandas as pd
import pyarrow as pa
import numpy as np
from arrow_pd_parser.parse import (
pa_read_csv_to_pandas,
pa_read_json_to_pandas,
)
@pytest.mark.parametrize(
"in_type,pd_timestamp_type,out_type",
[
("timestamp[s]", "datetime_object", "object"),
... | 33.655629 | 87 | 0.639512 | import pytest
import datetime
import pandas as pd
import pyarrow as pa
import numpy as np
from arrow_pd_parser.parse import (
pa_read_csv_to_pandas,
pa_read_json_to_pandas,
)
def pd_datetime_series_to_list(s, series_type, date=False):
fmt = "%Y-%m-%d" if date else "%Y-%m-%d %H:%M:%S"
if series_type ==... | 3,492 | 0 | 112 |
123407deed2006aaea02f0978e86eba377859f9f | 1,048 | py | Python | src/01/1.1.3_affine_cipher.py | fujiawei-dev/cryptography-note | 5f4fe1d9139e6b68e4307dce66d3881b184368bd | [
"MIT"
] | 1 | 2022-01-31T03:30:33.000Z | 2022-01-31T03:30:33.000Z | src/01/1.1.3_affine_cipher.py | fujiawei-dev/cryptography-notes | 5f4fe1d9139e6b68e4307dce66d3881b184368bd | [
"MIT"
] | null | null | null | src/01/1.1.3_affine_cipher.py | fujiawei-dev/cryptography-notes | 5f4fe1d9139e6b68e4307dce66d3881b184368bd | [
"MIT"
] | null | null | null | '''
Date: 2022.01.26 15:01:37
Description: 仿射密码
LastEditors: Rustle Karl
LastEditTime: 2022.01.26 15:27:13
'''
from math import gcd
def get_multiplicative_inverse(a):
'''求乘法逆,这里只是简单列举'''
return {
1: 1,
3: 9, 9: 3,
5: 21, 21: 5,
7: 15, 15: 7,
11: 19, 19: 11,
17:... | 18.385965 | 60 | 0.53626 | '''
Date: 2022.01.26 15:01:37
Description: 仿射密码
LastEditors: Rustle Karl
LastEditTime: 2022.01.26 15:27:13
'''
from math import gcd
def get_multiplicative_inverse(a):
'''求乘法逆,这里只是简单列举'''
return {
1: 1,
3: 9, 9: 3,
5: 21, 21: 5,
7: 15, 15: 7,
11: 19, 19: 11,
17:... | 536 | 0 | 92 |
052f45ad2a586fc63c16ed97a5fdf061a8a880c9 | 616 | py | Python | src/moegplib/baselines/layers/mha.py | DLR-RM/moegplib | 501c7fff49bc98e7cb62831f4185c34523837597 | [
"MIT"
] | null | null | null | src/moegplib/baselines/layers/mha.py | DLR-RM/moegplib | 501c7fff49bc98e7cb62831f4185c34523837597 | [
"MIT"
] | null | null | null | src/moegplib/baselines/layers/mha.py | DLR-RM/moegplib | 501c7fff49bc98e7cb62831f4185c34523837597 | [
"MIT"
] | null | null | null | import torch
from .layer import VarPropagationLayer
from .layer_utils import get_jacobian_loop
| 36.235294 | 86 | 0.673701 | import torch
from .layer import VarPropagationLayer
from .layer_utils import get_jacobian_loop
class MHAVarPropagationLayer(VarPropagationLayer):
def __init__(self, layer: torch.nn.Module, use_cov=False, **kwargs):
super(MHAVarPropagationLayer, self).__init__(layer, use_cov=use_cov, **kwargs)
def _c... | 414 | 29 | 77 |
198033a9e06ba521eb44e04eebe28e277a882980 | 1,853 | py | Python | deliver/send.py | sirech/deliver | 0ddb47d9b7c7a4bddfcf92e4bd683803c95efd3a | [
"MIT"
] | 3 | 2017-06-07T21:48:20.000Z | 2020-06-15T16:27:43.000Z | deliver/send.py | sirech/deliver | 0ddb47d9b7c7a4bddfcf92e4bd683803c95efd3a | [
"MIT"
] | null | null | null | deliver/send.py | sirech/deliver | 0ddb47d9b7c7a4bddfcf92e4bd683803c95efd3a | [
"MIT"
] | null | null | null | import smtplib
from converter.simple import UnicodeMessage
import logging
logger = logging.getLogger(__name__)
class Sender:
'''
Class that is responsible of sending emails. It uses a specified SMTP server.
'''
def send(self, msg, *recipients):
'''
Sends the given UnicodeMessage to e... | 34.962264 | 95 | 0.639504 | import smtplib
from converter.simple import UnicodeMessage
import logging
logger = logging.getLogger(__name__)
class Sender:
'''
Class that is responsible of sending emails. It uses a specified SMTP server.
'''
def __init__(self, config):
self._cfg = config
def send(self, msg, *recipien... | 33 | 0 | 27 |
53d7106d7c33b79a64f1f311fcf25ed2d46352f6 | 353 | py | Python | models/authenticate.py | DamirZaripov16/test_ui-project | 45dfc7ce84c40ecff68405bf1a39e8487cfec421 | [
"Apache-2.0"
] | null | null | null | models/authenticate.py | DamirZaripov16/test_ui-project | 45dfc7ce84c40ecff68405bf1a39e8487cfec421 | [
"Apache-2.0"
] | null | null | null | models/authenticate.py | DamirZaripov16/test_ui-project | 45dfc7ce84c40ecff68405bf1a39e8487cfec421 | [
"Apache-2.0"
] | null | null | null | from faker import Faker
fake = Faker("Ru-ru")
| 22.0625 | 53 | 0.660057 | from faker import Faker
fake = Faker("Ru-ru")
class AuthenticationData:
def __init__(self, username=None, password=None):
self.username = username
self.password = password
@staticmethod
def random():
username = fake.email()
password = fake.password()
return Authen... | 207 | 75 | 23 |
0b0963e3eb7fa01e3e078eec3daa95d6180ad53b | 570,120 | py | Python | Python Codes/Webscrapper/BeautifulSoup Webscrapper.py | ryukeno/Onepark-ParkingProject | cc09e2dc41024776e0c24921fb0ce94eefb61d98 | [
"MIT"
] | 2 | 2020-06-12T03:34:31.000Z | 2020-11-04T11:23:10.000Z | Python Codes/Webscrapper/BeautifulSoup Webscrapper.py | ryukeno/Onepark-DataProject | cc09e2dc41024776e0c24921fb0ce94eefb61d98 | [
"MIT"
] | null | null | null | Python Codes/Webscrapper/BeautifulSoup Webscrapper.py | ryukeno/Onepark-DataProject | cc09e2dc41024776e0c24921fb0ce94eefb61d98 | [
"MIT"
] | null | null | null | from urllib.request import Request, urlopen
import urllib
import requests
import pandas as pd
from xlwt import Workbook
from bs4 import BeautifulSoup
import sys
import time
import random
url_list = ["https://www.google.com/search?q=Thomas+Muntzer+Strasse+122+parking+Gamstadt",
"https://www.google.com/search?q=Bierweg+... | 67.151943 | 133 | 0.766698 | from urllib.request import Request, urlopen
import urllib
import requests
import pandas as pd
from xlwt import Workbook
from bs4 import BeautifulSoup
import sys
import time
import random
url_list = ["https://www.google.com/search?q=Thomas+Muntzer+Strasse+122+parking+Gamstadt",
"https://www.google.com/search?q=Bierweg+... | 581 | 0 | 91 |
da884f5ead10b94e4d9a92da7b24ea0d8fd2c498 | 58 | py | Python | moodle/mod/data/__init__.py | Hardikris/moodlepy | 8f5cb0cb4c2297e10f48396de681f6bb250f7751 | [
"MIT"
] | null | null | null | moodle/mod/data/__init__.py | Hardikris/moodlepy | 8f5cb0cb4c2297e10f48396de681f6bb250f7751 | [
"MIT"
] | null | null | null | moodle/mod/data/__init__.py | Hardikris/moodlepy | 8f5cb0cb4c2297e10f48396de681f6bb250f7751 | [
"MIT"
] | null | null | null | from .base import BaseData
__all__ = [
"BaseData",
]
| 9.666667 | 26 | 0.637931 | from .base import BaseData
__all__ = [
"BaseData",
]
| 0 | 0 | 0 |
5cfd293577337dc1790faa870bc3e821cc967e76 | 2,751 | py | Python | hospitals/views.py | Lifespark-Technologies/Infomed | 25a20788b4f9314360e4e1c1d8592597e9e0587c | [
"MIT"
] | 2 | 2020-05-18T12:15:27.000Z | 2020-06-16T12:26:23.000Z | hospitals/views.py | Lifespark-Technologies/Infomed | 25a20788b4f9314360e4e1c1d8592597e9e0587c | [
"MIT"
] | 76 | 2020-04-29T07:00:39.000Z | 2021-06-10T19:14:11.000Z | hospitals/views.py | Lifespark-Technologies/Infomed | 25a20788b4f9314360e4e1c1d8592597e9e0587c | [
"MIT"
] | 2 | 2020-05-07T19:25:06.000Z | 2020-06-05T14:30:29.000Z | from django.shortcuts import render
from isodate import parse_duration
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework_extensions.mixins import NestedViewSetMixin
from .models import Hospital, AppointmentSlot
from .seriali... | 37.684932 | 118 | 0.677208 | from django.shortcuts import render
from isodate import parse_duration
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework_extensions.mixins import NestedViewSetMixin
from .models import Hospital, AppointmentSlot
from .seriali... | 225 | 2,038 | 46 |
2a448b798c76e008bc6f72e7e626401e5a351245 | 5,205 | py | Python | futuquant/examples/app/shock_alarm/mysql_interface.py | hxhxhx88/futuquant | a1b4a875604f1de451ddde4bfa3e713452482b0a | [
"Apache-2.0"
] | null | null | null | futuquant/examples/app/shock_alarm/mysql_interface.py | hxhxhx88/futuquant | a1b4a875604f1de451ddde4bfa3e713452482b0a | [
"Apache-2.0"
] | null | null | null | futuquant/examples/app/shock_alarm/mysql_interface.py | hxhxhx88/futuquant | a1b4a875604f1de451ddde4bfa3e713452482b0a | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import pymysql
import sys
# test code
# myopenid = "kdhfskgadfvbsdvkjgkaghsdzfkigv_dgfjsdzfvbjazsgdcfvgh"
# p1 = 1000000.0
# p2 = 4000000.0
# stockid = ""
# user_setting = '设置' + ' ' + str(p1) + ' ' + str(p2) + ' '
# mi = mysql_interaction()
# mi.mysql_connect()
# mi.create_table()
# mi.update... | 35.650685 | 205 | 0.615946 | # -*- coding: utf-8 -*-
import pymysql
import sys
class mysql_interface:
def __init__(self):
self.host = '127.0.0.1'
self.port = 3306
self.user = 'root'
self.passwd = 'hackch'
self.database = 'stock_alarm'
def mysql_connect(self):
conn = pymysql.connect(host=se... | 4,232 | 1 | 346 |
81280decb79fc3e334768cf4eb0d642987f1650f | 2,291 | py | Python | ckanext/spatial/tests/base.py | geosolutions-it/ckanext-spatial-cerco | 9ce5618da89878956451294bc5b40659129dd65e | [
"PostgreSQL",
"Zlib",
"Unlicense"
] | 1 | 2015-12-07T17:27:10.000Z | 2015-12-07T17:27:10.000Z | ckanext/spatial/tests/base.py | geosolutions-it/ckanext-spatial-cerco | 9ce5618da89878956451294bc5b40659129dd65e | [
"PostgreSQL",
"Zlib",
"Unlicense"
] | null | null | null | ckanext/spatial/tests/base.py | geosolutions-it/ckanext-spatial-cerco | 9ce5618da89878956451294bc5b40659129dd65e | [
"PostgreSQL",
"Zlib",
"Unlicense"
] | null | null | null | import os
import re
from sqlalchemy import Table
from nose.plugins.skip import SkipTest
from ckan.model import Session, repo, meta, engine_is_sqlite
from ckanext.spatial.model.package_extent import setup as spatial_db_setup, define_spatial_tables
from ckanext.harvest.model import setup as harvest_model_setup
| 39.5 | 255 | 0.604976 | import os
import re
from sqlalchemy import Table
from nose.plugins.skip import SkipTest
from ckan.model import Session, repo, meta, engine_is_sqlite
from ckanext.spatial.model.package_extent import setup as spatial_db_setup, define_spatial_tables
from ckanext.harvest.model import setup as harvest_model_setup
def set... | 830 | 1,101 | 46 |
e1b2c1149369f6df05254a3b3334843b99dc7b5a | 536 | py | Python | var/spack/repos/builtin/packages/minisign/package.py | nkianggiss/spack | 3477d3375142a30f5714bb5966a6d8bb22c33c06 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 3 | 2019-06-27T13:26:50.000Z | 2019-07-01T16:24:54.000Z | var/spack/repos/builtin/packages/minisign/package.py | openbiox/spack | bb6ec7fb40c14b37e094a860e3625af53f633174 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 75 | 2016-07-27T11:43:00.000Z | 2020-12-08T15:56:53.000Z | var/spack/repos/builtin/packages/minisign/package.py | openbiox/spack | bb6ec7fb40c14b37e094a860e3625af53f633174 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 8 | 2015-10-16T13:51:49.000Z | 2021-10-18T13:58:03.000Z | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Minisign(CMakePackage):
"""Minisign is a dead simple tool to sign files and verify signatu... | 29.777778 | 77 | 0.733209 | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Minisign(CMakePackage):
"""Minisign is a dead simple tool to sign files and verify signatu... | 0 | 0 | 0 |
0630d97b18daffadde771908896b42a254081608 | 1,335 | py | Python | test_local.py | schnabel/pyhifiberry | 95db6332bbff87ec5b06e13c5f564131d9118281 | [
"MIT"
] | 1 | 2020-11-29T08:22:04.000Z | 2020-11-29T08:22:04.000Z | test_local.py | schnabel/pyhifiberry | 95db6332bbff87ec5b06e13c5f564131d9118281 | [
"MIT"
] | 6 | 2021-10-03T07:09:08.000Z | 2022-03-31T15:29:24.000Z | test_local.py | schnabel/pyhifiberry | 95db6332bbff87ec5b06e13c5f564131d9118281 | [
"MIT"
] | 2 | 2021-11-12T19:53:16.000Z | 2022-01-19T15:48:07.000Z | import aiohttp
import asyncio
from pyhifiberry import audiocontrol2
if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(main())
| 29.666667 | 86 | 0.570037 | import aiohttp
import asyncio
from pyhifiberry import audiocontrol2
async def main():
try:
async with aiohttp.ClientSession() as session:
api = audiocontrol2.Audiocontrol2(session, host="192.168.1.150")
status = await api.status()
print(status)
... | 1,153 | 0 | 30 |
ed98849faa6ce5bb0f07c478c4b1591efe3043de | 5,377 | py | Python | tests/test_DataLoaderStock.py | GuQiangJS/LSTM-for-Stock | 3bae9e5075f5c612a125726777c8275e805ccd9e | [
"MIT"
] | 1 | 2019-07-28T02:26:38.000Z | 2019-07-28T02:26:38.000Z | tests/test_DataLoaderStock.py | GuQiangJS/LSTM-for-Stock | 3bae9e5075f5c612a125726777c8275e805ccd9e | [
"MIT"
] | null | null | null | tests/test_DataLoaderStock.py | GuQiangJS/LSTM-for-Stock | 3bae9e5075f5c612a125726777c8275e805ccd9e | [
"MIT"
] | 1 | 2019-05-16T23:43:36.000Z | 2019-05-16T23:43:36.000Z | """
训练 DataLoaderStock 及 相关的 Wrapper
"""
import datetime
import logging
import numpy as np
import pandas as pd
from QUANTAXIS.QAFetch.QAQuery_Advance import \
QA_fetch_stock_block_adv as get_block
from LSTM_for_Stock.data_processor import DataLoader
from LSTM_for_Stock.data_processor import DataLoaderStock
from L... | 30.378531 | 71 | 0.639018 | """
训练 DataLoaderStock 及 相关的 Wrapper
"""
import datetime
import logging
import numpy as np
import pandas as pd
from QUANTAXIS.QAFetch.QAQuery_Advance import \
QA_fetch_stock_block_adv as get_block
from LSTM_for_Stock.data_processor import DataLoader
from LSTM_for_Stock.data_processor import DataLoaderStock
from L... | 4,268 | 0 | 184 |
a8f76f6390fbed3c3d6e253fc4b28b526902315e | 7,470 | py | Python | tests/old_tests/hessian_graphs.py | jiangzhongshi/acorns-benchmark | df5f43af90a32f4c1578cdea1f4f412237e18c75 | [
"MIT"
] | 1 | 2021-09-24T21:24:02.000Z | 2021-09-24T21:24:02.000Z | tests/old_tests/hessian_graphs.py | jiangzhongshi/acorns-benchmark | df5f43af90a32f4c1578cdea1f4f412237e18c75 | [
"MIT"
] | null | null | null | tests/old_tests/hessian_graphs.py | jiangzhongshi/acorns-benchmark | df5f43af90a32f4c1578cdea1f4f412237e18c75 | [
"MIT"
] | 1 | 2021-09-24T21:22:54.000Z | 2021-09-24T21:22:54.000Z | import matplotlib.pyplot as plt
import numpy as np
import os
import json
import seaborn as sns
import re
sns.set(style="darkgrid")
num_params_list = [10, 2010, 4010, 6010, 8010, 10010, 20010, 30010, 40010]
def natural_keys(text):
'''
alist.sort(key=natural_keys) sorts in human order
http://ne... | 50.816327 | 183 | 0.690495 | import matplotlib.pyplot as plt
import numpy as np
import os
import json
import seaborn as sns
import re
sns.set(style="darkgrid")
num_params_list = [10, 2010, 4010, 6010, 8010, 10010, 20010, 30010, 40010]
def atoi(text):
return int(text) if text.isdigit() else text
def natural_keys(text):
'''
... | 6,010 | 0 | 150 |
6e574ddcac025490a0b6be772aa232825bfffe40 | 411 | py | Python | kyu6/tests/test_dig_pow.py | juanshishido/codewars | d50d4ac07ddcc00fa2f7c367ec39cdb5e274d8da | [
"MIT"
] | null | null | null | kyu6/tests/test_dig_pow.py | juanshishido/codewars | d50d4ac07ddcc00fa2f7c367ec39cdb5e274d8da | [
"MIT"
] | null | null | null | kyu6/tests/test_dig_pow.py | juanshishido/codewars | d50d4ac07ddcc00fa2f7c367ec39cdb5e274d8da | [
"MIT"
] | null | null | null | import unittest
from kyu6.dig_pow import dig_pow
| 21.631579 | 48 | 0.686131 | import unittest
from kyu6.dig_pow import dig_pow
class TestDigPow(unittest.TestCase):
def test_89_is_one(self):
self.assertEquals(1, dig_pow(89, 1))
def test_92_is_negone(self):
self.assertEquals(-1, dig_pow(92, 1))
def test_695_is_two(self):
self.assertEquals(2, dig_pow(695, 2... | 214 | 15 | 131 |
03deef2de38b0f04176a1d773cb0ba5094bea1a4 | 6,375 | py | Python | neuronova_siet/convolutionalNetwork_ResNet50_4class.py | pavolmarak/level1_extractor | 55cb4b0d32a9740a963a069c732548363dc010fe | [
"MIT"
] | null | null | null | neuronova_siet/convolutionalNetwork_ResNet50_4class.py | pavolmarak/level1_extractor | 55cb4b0d32a9740a963a069c732548363dc010fe | [
"MIT"
] | null | null | null | neuronova_siet/convolutionalNetwork_ResNet50_4class.py | pavolmarak/level1_extractor | 55cb4b0d32a9740a963a069c732548363dc010fe | [
"MIT"
] | null | null | null | import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import glob
from sklearn.metrics import confusion_matrix
from sklearn.metrics import plot_confusion_matrix
classes = {'Arch': 0, 'Left Loop': 1, 'Right Loop': 2, 'Whorl': 3}
class_n... | 38.636364 | 148 | 0.741961 | import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import glob
from sklearn.metrics import confusion_matrix
from sklearn.metrics import plot_confusion_matrix
classes = {'Arch': 0, 'Left Loop': 1, 'Right Loop': 2, 'Whorl': 3}
class_n... | 0 | 0 | 0 |
56d69f9e2fee5329e715995a7c1f3bdb114a0f2b | 11,991 | py | Python | rest_tools/client/client.py | WIPACrepo/rest-tools | 01f5822db4c8d2546cf3a8cdfaaae6afd1e96679 | [
"MIT"
] | 1 | 2020-08-24T19:05:57.000Z | 2020-08-24T19:05:57.000Z | rest_tools/client/client.py | WIPACrepo/rest-tools | 01f5822db4c8d2546cf3a8cdfaaae6afd1e96679 | [
"MIT"
] | 32 | 2020-05-15T20:14:31.000Z | 2022-03-16T15:01:45.000Z | rest_tools/client/client.py | WIPACrepo/rest-tools | 01f5822db4c8d2546cf3a8cdfaaae6afd1e96679 | [
"MIT"
] | null | null | null | """A simple REST json client using `requests`_ for the http connection.
.. _requests: http://docs.python-requests.org
The REST protocol is built on http(s), with the body containing
a json-encoded dictionary as necessary.
"""
# fmt:off
import asyncio
import logging
import os
import time
from typing import Any, Call... | 33.308333 | 131 | 0.566258 | """A simple REST json client using `requests`_ for the http connection.
.. _requests: http://docs.python-requests.org
The REST protocol is built on http(s), with the body containing
a json-encoded dictionary as necessary.
"""
# fmt:off
import asyncio
import logging
import os
import time
from typing import Any, Call... | 3,657 | 0 | 130 |
ad03574d359a584a0abdfeb741bbba716131c257 | 8,543 | py | Python | sts_wrldom/pawarModel.py | BigBossAnwer/STS-Pipeline | 952d2c577dd4b8a66c99b80a24589a98e20c2e60 | [
"MIT"
] | null | null | null | sts_wrldom/pawarModel.py | BigBossAnwer/STS-Pipeline | 952d2c577dd4b8a66c99b80a24589a98e20c2e60 | [
"MIT"
] | null | null | null | sts_wrldom/pawarModel.py | BigBossAnwer/STS-Pipeline | 952d2c577dd4b8a66c99b80a24589a98e20c2e60 | [
"MIT"
] | null | null | null | import argparse
import json
import sys
from collections import OrderedDict
from pathlib import Path
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from wn.path import WordNetPaths
from sts_wrldom.corpusReader import read_data
from sts_wrldom.utils import accuracy, get_scores, log_frame, rmse
... | 33.900794 | 94 | 0.584923 | import argparse
import json
import sys
from collections import OrderedDict
from pathlib import Path
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from wn.path import WordNetPaths
from sts_wrldom.corpusReader import read_data
from sts_wrldom.utils import accuracy, get_scores, log_frame, rmse
... | 2,562 | 0 | 23 |
36b1b8ec9746579c952c7aa0820a277b8669d81b | 2,360 | py | Python | modules/gender.py | adnan3856/BUDDY-A-face-recognition-based-voice-assistant- | 69833de3fda4ba6f4fef4e64ed12623fdd436ac7 | [
"MIT"
] | null | null | null | modules/gender.py | adnan3856/BUDDY-A-face-recognition-based-voice-assistant- | 69833de3fda4ba6f4fef4e64ed12623fdd436ac7 | [
"MIT"
] | null | null | null | modules/gender.py | adnan3856/BUDDY-A-face-recognition-based-voice-assistant- | 69833de3fda4ba6f4fef4e64ed12623fdd436ac7 | [
"MIT"
] | null | null | null | import cv2 as cv
import sys
faceProto = "datasets/opencv_face_detector.pbtxt"
faceModel = "datasets/opencv_face_detector_uint8.pb"
genderProto = "datasets/gender_deploy.prototxt"
genderModel = "datasets/gender_net.caffemodel"
MODEL_MEAN_VALUES = (78.4263377603, 87.7689143744, 114.895847746)
genderList = ['Ma... | 35.223881 | 141 | 0.652542 | import cv2 as cv
import sys
faceProto = "datasets/opencv_face_detector.pbtxt"
faceModel = "datasets/opencv_face_detector_uint8.pb"
genderProto = "datasets/gender_deploy.prototxt"
genderModel = "datasets/gender_net.caffemodel"
MODEL_MEAN_VALUES = (78.4263377603, 87.7689143744, 114.895847746)
genderList = ['Ma... | 870 | 0 | 25 |
4269e394fba779c8f4f6affc4bba7c077f259673 | 472 | py | Python | forms/serializers/form.py | darkismus/kompassi | 35dea2c7af2857a69cae5c5982b48f01ba56da1f | [
"CC-BY-3.0"
] | 13 | 2015-11-29T12:19:12.000Z | 2021-02-21T15:42:11.000Z | forms/serializers/form.py | darkismus/kompassi | 35dea2c7af2857a69cae5c5982b48f01ba56da1f | [
"CC-BY-3.0"
] | 23 | 2015-04-29T19:43:34.000Z | 2021-02-10T05:50:17.000Z | forms/serializers/form.py | darkismus/kompassi | 35dea2c7af2857a69cae5c5982b48f01ba56da1f | [
"CC-BY-3.0"
] | 11 | 2015-09-20T18:59:00.000Z | 2020-02-07T08:47:34.000Z | from rest_framework import serializers
from ..models import Form
| 22.47619 | 92 | 0.555085 | from rest_framework import serializers
from ..models import Form
class FormSerializer(serializers.HyperlinkedModelSerializer):
url = serializers.HyperlinkedIdentityField(view_name='form-detail', lookup_field='slug')
class Meta:
fields = (
'url',
'slug',
'title',
... | 0 | 382 | 23 |
02c4a6dae2c813ae5902138a46d5ed116a3afd5a | 12,197 | py | Python | generated-libraries/python/netapp/gpo/gpo_gpresult_info.py | radekg/netapp-ontap-lib-get | 6445ebb071ec147ea82a486fbe9f094c56c5c40d | [
"MIT"
] | 2 | 2017-03-28T15:31:26.000Z | 2018-08-16T22:15:18.000Z | generated-libraries/python/netapp/gpo/gpo_gpresult_info.py | radekg/netapp-ontap-lib-get | 6445ebb071ec147ea82a486fbe9f094c56c5c40d | [
"MIT"
] | null | null | null | generated-libraries/python/netapp/gpo/gpo_gpresult_info.py | radekg/netapp-ontap-lib-get | 6445ebb071ec147ea82a486fbe9f094c56c5c40d | [
"MIT"
] | null | null | null | from netapp.netapp_object import NetAppObject
class GpoGpresultInfo(NetAppObject):
"""
GPO RSoP(Resultant Set of Policy) that is currently defined on
the Active Directory for a CIFS-enabled Vserver.
When returned as part of the output, all elements of this typedef
are reported, unless limited by a ... | 34.357746 | 115 | 0.60023 | from netapp.netapp_object import NetAppObject
class GpoGpresultInfo(NetAppObject):
"""
GPO RSoP(Resultant Set of Policy) that is currently defined on
the Active Directory for a CIFS-enabled Vserver.
When returned as part of the output, all elements of this typedef
are reported, unless limited by a ... | 4,673 | 0 | 551 |
53fda38d2c400be5d116c5f1272f262148cceff0 | 470 | py | Python | modules/stream/test/string_stream/conanfile.py | aversiveplusplus/aversiveplusplus | 5f5fe9faca50197fd6207e2c816efa7e9af6c804 | [
"BSD-3-Clause"
] | 29 | 2016-01-27T09:43:44.000Z | 2020-03-12T04:16:02.000Z | modules/stream/test/string_stream/conanfile.py | aversiveplusplus/aversiveplusplus | 5f5fe9faca50197fd6207e2c816efa7e9af6c804 | [
"BSD-3-Clause"
] | 20 | 2016-01-22T15:59:33.000Z | 2016-10-28T10:22:45.000Z | modules/stream/test/string_stream/conanfile.py | aversiveplusplus/aversiveplusplus | 5f5fe9faca50197fd6207e2c816efa7e9af6c804 | [
"BSD-3-Clause"
] | 6 | 2016-02-11T14:09:04.000Z | 2018-03-17T00:18:35.000Z | from conans import ConanFile, CMake
| 33.571429 | 82 | 0.661702 | from conans import ConanFile, CMake
class AversivePlusPlusProjectConan(ConanFile):
name="template-project"
version="0.1"
settings = "os", "compiler", "build_type", "arch", "target"
requires = "stream/0.1@AversivePlusPlus/dev"
generators = "cmake"
def build(self):
cmake = CMake(self.set... | 175 | 236 | 23 |
6f43492bb77ef0f38b74347e7530ab085fb9e453 | 2,307 | py | Python | liv_learn/utils/plot_utils.py | neilswainston/synbiochem-learn | 9608b867a74989fd685b564dfa0f90f4c4f0165a | [
"MIT"
] | null | null | null | liv_learn/utils/plot_utils.py | neilswainston/synbiochem-learn | 9608b867a74989fd685b564dfa0f90f4c4f0165a | [
"MIT"
] | null | null | null | liv_learn/utils/plot_utils.py | neilswainston/synbiochem-learn | 9608b867a74989fd685b564dfa0f90f4c4f0165a | [
"MIT"
] | null | null | null | '''
(c) University of Liverpool 2019
All rights reserved.
@author: neilswainston
'''
# pylint: disable=invalid-name
# pylint: disable=wrong-import-order
import math
from sklearn.linear_model import LinearRegression
from liv_learn.utils import coeff_corr
import matplotlib.pyplot as plt
def plot_histogram(data, xla... | 26.215909 | 73 | 0.654963 | '''
(c) University of Liverpool 2019
All rights reserved.
@author: neilswainston
'''
# pylint: disable=invalid-name
# pylint: disable=wrong-import-order
import math
from sklearn.linear_model import LinearRegression
from liv_learn.utils import coeff_corr
import matplotlib.pyplot as plt
def plot_histogram(data, xla... | 0 | 0 | 0 |
9871639d9becee08a4b2d8ffdfd538d2ebce9557 | 1,083 | py | Python | eureka/server/server_config.py | haribo0915/Spring-Cloud-in-Python | 0bcd7093869c797df14428bf2d1b0a779f96e573 | [
"Apache-2.0"
] | 5 | 2020-10-06T09:48:23.000Z | 2020-10-07T13:19:46.000Z | eureka/server/server_config.py | haribo0915/Spring-Cloud-in-Python | 0bcd7093869c797df14428bf2d1b0a779f96e573 | [
"Apache-2.0"
] | 5 | 2020-10-05T09:57:01.000Z | 2020-10-12T19:52:48.000Z | eureka/server/server_config.py | haribo0915/Spring-Cloud-in-Python | 0bcd7093869c797df14428bf2d1b0a779f96e573 | [
"Apache-2.0"
] | 8 | 2020-10-05T06:34:49.000Z | 2020-10-07T13:19:46.000Z | # -*- coding: utf-8 -*-
__author__ = "Daniel1147 (sxn91401@gmail.com)"
__license__ = "Apache 2.0"
# standard library
from abc import ABC, abstractmethod
class ServerConfig(ABC):
"""
The configuration for starting up the eureka server. It allows clients to override the entities through setters.
"""
... | 18.672414 | 116 | 0.604801 | # -*- coding: utf-8 -*-
__author__ = "Daniel1147 (sxn91401@gmail.com)"
__license__ = "Apache 2.0"
# standard library
from abc import ABC, abstractmethod
class ServerConfig(ABC):
"""
The configuration for starting up the eureka server. It allows clients to override the entities through setters.
"""
... | 277 | 215 | 127 |
b98bf1453272b88db2f452b3a0e08b868e90f6cd | 76,294 | py | Python | testSuite/scripts/test_service_to_service_copy.py | evenh/azure-storage-azcopy | 2c30af330b681d3a1f31db32e11245eafce9c5c3 | [
"MIT"
] | null | null | null | testSuite/scripts/test_service_to_service_copy.py | evenh/azure-storage-azcopy | 2c30af330b681d3a1f31db32e11245eafce9c5c3 | [
"MIT"
] | null | null | null | testSuite/scripts/test_service_to_service_copy.py | evenh/azure-storage-azcopy | 2c30af330b681d3a1f31db32e11245eafce9c5c3 | [
"MIT"
] | null | null | null | import json
import os
import shutil
import time
import urllib
from collections import namedtuple
import utility as util
import unittest
import filecmp
import os.path | 56.514074 | 216 | 0.705586 | import json
import os
import shutil
import time
import urllib
from collections import namedtuple
import utility as util
import unittest
import filecmp
import os.path
class Service_2_Service_Copy_User_Scenario(unittest.TestCase):
def setUp(self):
# init bucket_name
common_prefix = 's2scopybucket'
... | 71,845 | 4,261 | 23 |
a89f3c7c098fc4d135a40cd06e29d6039f2926ec | 9,255 | py | Python | integration/keeper_secrets_manager_cli/tests/init_test.py | inna-btc/secrets-manager | 5c65fea092e80b25d2466b395fa03eabd6a98f9b | [
"MIT"
] | null | null | null | integration/keeper_secrets_manager_cli/tests/init_test.py | inna-btc/secrets-manager | 5c65fea092e80b25d2466b395fa03eabd6a98f9b | [
"MIT"
] | null | null | null | integration/keeper_secrets_manager_cli/tests/init_test.py | inna-btc/secrets-manager | 5c65fea092e80b25d2466b395fa03eabd6a98f9b | [
"MIT"
] | 1 | 2021-12-18T03:15:54.000Z | 2021-12-18T03:15:54.000Z | import base64
import os
import unittest
from unittest.mock import patch
import yaml
from click.testing import CliRunner
from keeper_secrets_manager_core.core import SecretsManager
from keeper_secrets_manager_core.storage import InMemoryKeyValueStorage
from keeper_secrets_manager_core.configkeys import ConfigKeys
from ... | 49.228723 | 114 | 0.629065 | import base64
import os
import unittest
from unittest.mock import patch
import yaml
from click.testing import CliRunner
from keeper_secrets_manager_core.core import SecretsManager
from keeper_secrets_manager_core.storage import InMemoryKeyValueStorage
from keeper_secrets_manager_core.configkeys import ConfigKeys
from ... | 168 | 8,597 | 23 |
db79d585651835308738e9521ec3d1ce8968000d | 6,340 | py | Python | ipet/parsing/StatisticReader_CustomReader.py | stephenjmaher/ipet | 3a23d81ba6ed7cb41e86211cb0507170e8cd205a | [
"MIT"
] | null | null | null | ipet/parsing/StatisticReader_CustomReader.py | stephenjmaher/ipet | 3a23d81ba6ed7cb41e86211cb0507170e8cd205a | [
"MIT"
] | null | null | null | ipet/parsing/StatisticReader_CustomReader.py | stephenjmaher/ipet | 3a23d81ba6ed7cb41e86211cb0507170e8cd205a | [
"MIT"
] | null | null | null | """
The MIT License (MIT)
Copyright (c) 2018 Zuse Institute Berlin, www.zib.de
Permissions are granted as stated in the license file you have obtained
with this software. If you find the library useful for your purpose,
please refer to README.md for how to cite IPET.
@author: Gregor Hendel
"""
from .StatisticReader ... | 32.680412 | 151 | 0.588644 | """
The MIT License (MIT)
Copyright (c) 2018 Zuse Institute Berlin, www.zib.de
Permissions are granted as stated in the license file you have obtained
with this software. If you find the library useful for your purpose,
please refer to README.md for how to cite IPET.
@author: Gregor Hendel
"""
from .StatisticReader ... | 2,894 | 0 | 242 |
b84431952fff96610f94856bd885e4cef0405172 | 6,509 | py | Python | python/rikai/spark/sql/codegen/fs.py | adRise/rikai | 052022594bf924fa7cd6062d290e3392c6b7571a | [
"Apache-2.0"
] | null | null | null | python/rikai/spark/sql/codegen/fs.py | adRise/rikai | 052022594bf924fa7cd6062d290e3392c6b7571a | [
"Apache-2.0"
] | null | null | null | python/rikai/spark/sql/codegen/fs.py | adRise/rikai | 052022594bf924fa7cd6062d290e3392c6b7571a | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 Rikai 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 or agreed to in wri... | 28.548246 | 76 | 0.590413 | # Copyright 2021 Rikai 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 or agreed to in wri... | 1,059 | 0 | 108 |
930e3770765a36afff87008131d89a39bfb14ecc | 4,263 | py | Python | nbzz/cmds/start.py | LeetSquad/Swarm-nbzz | 781a68e9bc012e166ddce0b6569ce467a7dd6082 | [
"Apache-2.0"
] | 5 | 2021-08-13T09:17:25.000Z | 2021-09-01T08:26:34.000Z | nbzz/cmds/start.py | LeetSquad/Swarm-nbzz | 781a68e9bc012e166ddce0b6569ce467a7dd6082 | [
"Apache-2.0"
] | 3 | 2021-08-17T10:39:39.000Z | 2022-03-10T15:37:14.000Z | nbzz/cmds/start.py | LeetSquad/Swarm-nbzz | 781a68e9bc012e166ddce0b6569ce467a7dd6082 | [
"Apache-2.0"
] | 5 | 2021-08-17T09:38:51.000Z | 2021-09-28T09:49:34.000Z | import click
from nbzz.util.bee_key import decrypt_privatekey_from_bee_keyfile,keyfile
from nbzz.util.config import load_config
from web3 import Web3
from typing import Dict
from nbzz.util.default_root import DEFAULT_ROOT_PATH
import plyvel
from nbzz.rpc.xdai_rpc import connect_w3,get_model_contract,send_transaction
fr... | 45.83871 | 142 | 0.726718 | import click
from nbzz.util.bee_key import decrypt_privatekey_from_bee_keyfile,keyfile
from nbzz.util.config import load_config
from web3 import Web3
from typing import Dict
from nbzz.util.default_root import DEFAULT_ROOT_PATH
import plyvel
from nbzz.rpc.xdai_rpc import connect_w3,get_model_contract,send_transaction
fr... | 2,867 | 2 | 196 |
e037b8fad5f5e0b9e9debd08dec5e87d2f5dfa16 | 11,261 | py | Python | contrib/opencensus-ext-django/tests/test_django_middleware.py | hkwi/opencensus-python | 4673e1bbe091f5ca4d2e8d2b778005104396f764 | [
"Apache-2.0"
] | null | null | null | contrib/opencensus-ext-django/tests/test_django_middleware.py | hkwi/opencensus-python | 4673e1bbe091f5ca4d2e8d2b778005104396f764 | [
"Apache-2.0"
] | null | null | null | contrib/opencensus-ext-django/tests/test_django_middleware.py | hkwi/opencensus-python | 4673e1bbe091f5ca4d2e8d2b778005104396f764 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017, OpenCensus 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 or agreed to in w... | 32.45245 | 127 | 0.642572 | # Copyright 2017, OpenCensus 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 or agreed to in w... | 9,724 | 227 | 262 |
fa86dfd13823fdc44a4452c3202176dc16c4eabb | 1,198 | py | Python | analyze/calc_run_20180202-l.py | JeroenvO/pulsedpowerplasmaplots | dd953359569826edfae321a039b6f9af2340d560 | [
"MIT"
] | null | null | null | analyze/calc_run_20180202-l.py | JeroenvO/pulsedpowerplasmaplots | dd953359569826edfae321a039b6f9af2340d560 | [
"MIT"
] | null | null | null | analyze/calc_run_20180202-l.py | JeroenvO/pulsedpowerplasmaplots | dd953359569826edfae321a039b6f9af2340d560 | [
"MIT"
] | null | null | null | from analyze.calc_run import *
base = 'G:/Prive/MIJN-Documenten/TU/62-Stage/20180202-l/'
d=-5
# calc_run(base + 'run1b',
# REACTOR_GLASS_SHORT_QUAD,
# scope_multiple=True,
# scope_file_name_index=2, # lengt
# meas=SHORT_MEAS_LEN,
# current_scaling=0.5,
# delay=d,... | 24.44898 | 57 | 0.565109 | from analyze.calc_run import *
base = 'G:/Prive/MIJN-Documenten/TU/62-Stage/20180202-l/'
d=-5
# calc_run(base + 'run1b',
# REACTOR_GLASS_SHORT_QUAD,
# scope_multiple=True,
# scope_file_name_index=2, # lengt
# meas=SHORT_MEAS_LEN,
# current_scaling=0.5,
# delay=d,... | 0 | 0 | 0 |
d0bc5af4bdc5278d7f3afe0981a2ebe534dbb5ab | 1,015 | py | Python | src/hyperloop/Python/tests/test_propulsion_mechanics.py | jcchin/Hyperloop_v2 | 73861d2207af8738425c1d484909ed0433b9653f | [
"Apache-2.0"
] | 1 | 2021-04-29T00:23:03.000Z | 2021-04-29T00:23:03.000Z | src/hyperloop/Python/tests/test_propulsion_mechanics.py | jcchin/Hyperloop_v2 | 73861d2207af8738425c1d484909ed0433b9653f | [
"Apache-2.0"
] | 9 | 2016-11-23T09:10:34.000Z | 2016-12-06T01:10:09.000Z | src/hyperloop/Python/tests/test_propulsion_mechanics.py | jcchin/Hyperloop_v2 | 73861d2207af8738425c1d484909ed0433b9653f | [
"Apache-2.0"
] | 11 | 2016-01-19T20:26:35.000Z | 2021-02-13T11:16:20.000Z | import numpy as np
from openmdao.api import Group, Problem
from hyperloop.Python.tube import propulsion_mechanics
| 28.194444 | 72 | 0.595074 | import numpy as np
from openmdao.api import Group, Problem
from hyperloop.Python.tube import propulsion_mechanics
def create_problem(component):
root = Group()
prob = Problem(root)
prob.root.add('comp', component)
return prob
class TestPropulsionMechanics(object):
def test_case1_vs_npss(self):
... | 811 | 17 | 72 |
f71b9cde058636291fadd916f2bb3f983e61f130 | 3,694 | py | Python | BM/1.Pipelines_For_Running_Tools/1.B.pipe_M2S2MH/python.MH_conc.py | hiyoothere/Benchmarking-mosaic-variant-detection | a627602276273c10bbdcf2b9cf30a634765e40f8 | [
"CECILL-B"
] | 2 | 2021-11-24T04:38:34.000Z | 2022-01-21T08:38:24.000Z | BM/1.Pipelines_For_Running_Tools/1.B.pipe_M2S2MH/python.MH_conc.py | hiyoothere/Benchmarking-mosaic-variant-detection | a627602276273c10bbdcf2b9cf30a634765e40f8 | [
"CECILL-B"
] | null | null | null | BM/1.Pipelines_For_Running_Tools/1.B.pipe_M2S2MH/python.MH_conc.py | hiyoothere/Benchmarking-mosaic-variant-detection | a627602276273c10bbdcf2b9cf30a634765e40f8 | [
"CECILL-B"
] | null | null | null | import glob
import sys
##### creatin dict that will have all control positions
##### EXECUTION ######
MHpath = sys.argv[1]
ID_con = sys.argv[2]
ID_cas = sys.argv[3]
OutPath = sys.argv[4]
DP = sys.argv[5]
if "ND" in DP:
con_MH = MHpath + "/ND-" + ID_con + "/final.passed.tsv"
cas_MH = MHpath + "/ND-" + ID_cas + "/... | 30.278689 | 96 | 0.566594 | import glob
import sys
##### creatin dict that will have all control positions
def con_pos(con_MH):
con_dict = {}
f = open(con_MH, 'r')
for line in f:
s = line.split()
chr = s[0]
pos = s[1]
ref = int(s[7]) #ref depth
alt = int(s[9]) #alt depth
vaf = float(alt)/(ref+alt)
alt_type = s[8] #alt base
... | 3,031 | 0 | 118 |
4144ce31063b1d2b9decd3583fe037bc287fa1f0 | 8,305 | py | Python | src/tener/models/embeddings/sinusoidal_embd.py | dhiraa/tener | 54b78aead492390b2ea0016596a3ebe2b9c3b986 | [
"Apache-2.0"
] | 8 | 2020-02-21T09:16:43.000Z | 2020-10-17T02:33:32.000Z | src/tener/models/embeddings/sinusoidal_embd.py | dhiraa/tener | 54b78aead492390b2ea0016596a3ebe2b9c3b986 | [
"Apache-2.0"
] | 6 | 2020-09-25T19:03:58.000Z | 2022-02-28T07:18:00.000Z | src/tener/models/embeddings/sinusoidal_embd.py | dhiraa/tener | 54b78aead492390b2ea0016596a3ebe2b9c3b986 | [
"Apache-2.0"
] | 6 | 2020-04-28T06:27:35.000Z | 2022-02-20T19:17:15.000Z | import math
import numpy as np
import tensorflow as tf
import torch
from torch import nn
import torch.nn.functional as F
import math
from tener.misc.pretty_print import print_info
def make_positions(tensor, padding_idx=0):
"""Replace non-padding symbols with their position numbers.
Position numbers begin... | 37.922374 | 120 | 0.636725 | import math
import numpy as np
import tensorflow as tf
import torch
from torch import nn
import torch.nn.functional as F
import math
from tener.misc.pretty_print import print_info
def get_angles(pos, i, d_model):
angle_rates = 1 / np.power(10000, (2 * (i//2)) / np.float32(d_model))
return pos * angle_rates... | 2,066 | 0 | 180 |
c5d092a41c6e24953c6673c0cda130ad2dac0976 | 83 | py | Python | 0-notes/job-search/Cracking_the_Coding_Interview/C13Java/questions/13.3-question.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | 0-notes/job-search/Cracking_the_Coding_Interview/C13Java/questions/13.3-question.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | 0-notes/job-search/Cracking_the_Coding_Interview/C13Java/questions/13.3-question.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | # 13.3 Final, etc.
# What is the difference between final, finally, and finalize?
| 20.75 | 62 | 0.722892 | # 13.3 Final, etc.
# What is the difference between final, finally, and finalize?
| 0 | 0 | 0 |
a0119eb21c1b73d5b80af3b395ae7468a6153492 | 663 | py | Python | utils/assigner.py | Wuyxin/DIR-GNN | 4b975f9b3962e7820d8449eb4abbb4cc30c1025d | [
"MIT"
] | 34 | 2022-01-30T07:17:57.000Z | 2022-03-26T05:42:28.000Z | utils/assigner.py | Wuyxin/DIR-GNN | 4b975f9b3962e7820d8449eb4abbb4cc30c1025d | [
"MIT"
] | null | null | null | utils/assigner.py | Wuyxin/DIR-GNN | 4b975f9b3962e7820d8449eb4abbb4cc30c1025d | [
"MIT"
] | 4 | 2022-03-01T02:58:10.000Z | 2022-03-28T03:20:35.000Z | import torch
import numpy as np
| 27.625 | 79 | 0.60181 | import torch
import numpy as np
class GroupAssigner(object):
def __init__(self, criterion=None, n_groups=2, prob=None):
self.criterion = criterion # func(data) -> group assignment
self.n_groups = n_groups
if self.criterion is None:
self.prob = prob if prob else torch.ones... | 540 | 7 | 81 |
1483feaffa2344f8974bb783e5a5cc7f062471a4 | 21,862 | py | Python | model/network_base.py | holyseven/TransferLearningClassification | 1426356195d79613b12c94ad8d6d0db576b09261 | [
"MIT"
] | 46 | 2018-06-02T07:50:04.000Z | 2022-02-02T01:25:32.000Z | model/network_base.py | holyseven/TransferLearningClassification | 1426356195d79613b12c94ad8d6d0db576b09261 | [
"MIT"
] | 3 | 2018-06-02T02:29:49.000Z | 2021-04-09T08:35:22.000Z | model/network_base.py | holyseven/TransferLearningClassification | 1426356195d79613b12c94ad8d6d0db576b09261 | [
"MIT"
] | 13 | 2018-06-07T04:30:14.000Z | 2020-04-07T03:10:40.000Z | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
| 48.367257 | 123 | 0.574467 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
class Network(object):
def __init__(self, num_classes, lrn_rate_placeholder, wd_rate_placeholder, wd_rate_placeholder2,
mode='train', initialize... | 4,157 | 17,527 | 23 |
f2bb6f29bad76920d58effde5ea59dffea89c10b | 453 | py | Python | every_election/apps/elections/migrations/0059_election_tags.py | DemocracyClub/EveryElection | da8a561cb4a84d9b432b1508a68f8cfada3d9515 | [
"BSD-3-Clause"
] | 8 | 2017-06-29T10:11:33.000Z | 2019-12-16T16:17:51.000Z | every_election/apps/elections/migrations/0059_election_tags.py | DemocracyClub/EveryElection | da8a561cb4a84d9b432b1508a68f8cfada3d9515 | [
"BSD-3-Clause"
] | 1,300 | 2017-01-08T14:02:24.000Z | 2022-03-31T09:11:30.000Z | every_election/apps/elections/migrations/0059_election_tags.py | DemocracyClub/EveryElection | da8a561cb4a84d9b432b1508a68f8cfada3d9515 | [
"BSD-3-Clause"
] | 11 | 2017-02-04T10:48:04.000Z | 2021-01-27T15:07:55.000Z | # Generated by Django 2.2.16 on 2021-02-13 12:11
import django.contrib.postgres.fields.jsonb
from django.db import migrations
| 22.65 | 79 | 0.631347 | # Generated by Django 2.2.16 on 2021-02-13 12:11
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("elections", "0058_set-gla-a-to-ballot"),
]
operations = [
migrations.AddField(
model_name="... | 0 | 302 | 23 |
24b4a562d2495e56240ee4ebd5af7cb54555475f | 462 | py | Python | tasks/migrations/0011_auto_20190206_1517.py | heolin123/funcrowd | 20167783de208394c09ed0429a5f02ec6dd79c42 | [
"MIT"
] | null | null | null | tasks/migrations/0011_auto_20190206_1517.py | heolin123/funcrowd | 20167783de208394c09ed0429a5f02ec6dd79c42 | [
"MIT"
] | 11 | 2019-11-12T23:26:45.000Z | 2021-06-10T17:37:23.000Z | tasks/migrations/0011_auto_20190206_1517.py | heolin123/funcrowd | 20167783de208394c09ed0429a5f02ec6dd79c42 | [
"MIT"
] | null | null | null | # Generated by Django 2.0.8 on 2019-02-06 15:17
import django.contrib.postgres.fields.jsonb
from django.db import migrations
| 23.1 | 88 | 0.640693 | # Generated by Django 2.0.8 on 2019-02-06 15:17
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('tasks', '0010_auto_20190203_2307'),
]
operations = [
migrations.AlterField(
model_name='docu... | 0 | 312 | 23 |
654484af7b3a2a709671de536dec14781a00c3b4 | 5,083 | py | Python | tests/unit/dht/test_blob_announcer.py | abueide/lbry | 7f5deaf6c80422a30b3714d4bf12e028756ed9fe | [
"MIT"
] | null | null | null | tests/unit/dht/test_blob_announcer.py | abueide/lbry | 7f5deaf6c80422a30b3714d4bf12e028756ed9fe | [
"MIT"
] | null | null | null | tests/unit/dht/test_blob_announcer.py | abueide/lbry | 7f5deaf6c80422a30b3714d4bf12e028756ed9fe | [
"MIT"
] | null | null | null | import contextlib
import typing
import binascii
import asyncio
from torba.testcase import AsyncioTestCase
from tests import dht_mocks
from lbrynet.conf import Config
from lbrynet.dht import constants
from lbrynet.dht.node import Node
from lbrynet.dht.peer import PeerManager
from lbrynet.dht.blob_announcer import BlobAn... | 44.2 | 100 | 0.636829 | import contextlib
import typing
import binascii
import asyncio
from torba.testcase import AsyncioTestCase
from tests import dht_mocks
from lbrynet.conf import Config
from lbrynet.dht import constants
from lbrynet.dht.node import Node
from lbrynet.dht.peer import PeerManager
from lbrynet.dht.blob_announcer import BlobAn... | 4,485 | 190 | 23 |
a65d0bfbcd7fe1b1c7d466a1a6d5fa4dc4c677e1 | 107 | py | Python | caption/models/taggers/__init__.py | Unbabel/caption | 90725dbf5bc3809e0364d20d0837c58968ceb2b1 | [
"MIT"
] | 3 | 2021-06-14T08:23:00.000Z | 2022-03-04T06:00:50.000Z | caption/models/taggers/__init__.py | Unbabel/caption | 90725dbf5bc3809e0364d20d0837c58968ceb2b1 | [
"MIT"
] | null | null | null | caption/models/taggers/__init__.py | Unbabel/caption | 90725dbf5bc3809e0364d20d0837c58968ceb2b1 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from .transformer_tagger import TransformerTagger
__all__ = ["TransformerTagger"]
| 21.4 | 49 | 0.738318 | # -*- coding: utf-8 -*-
from .transformer_tagger import TransformerTagger
__all__ = ["TransformerTagger"]
| 0 | 0 | 0 |
01471f25662c8c09d746637c982ccc8bc92d5b4f | 2,224 | py | Python | toollib/tcli/commands/_set_sshkey.py | atpuxiner/toollib | a895daeba49e64022a4a11a67a8b7b7a44cd2e0f | [
"MIT"
] | 113 | 2021-12-15T05:23:13.000Z | 2022-03-30T10:29:13.000Z | toollib/tcli/commands/_set_sshkey.py | atpuxiner/toollib | a895daeba49e64022a4a11a67a8b7b7a44cd2e0f | [
"MIT"
] | null | null | null | toollib/tcli/commands/_set_sshkey.py | atpuxiner/toollib | a895daeba49e64022a4a11a67a8b7b7a44cd2e0f | [
"MIT"
] | 3 | 2022-02-22T01:43:44.000Z | 2022-03-21T01:05:49.000Z | """
@author axiner
@version v1.0.0
@created 2022/5/4 9:17
@abstract
@description
@history
"""
import re
import sys
from pathlib import Path
from toollib import utils, regexp
from toollib.decorator import sys_required
from toollib.tcli import here
from toollib.tcli.base import BaseCmd
from toollib.tcli.option import Op... | 31.771429 | 99 | 0.54946 | """
@author axiner
@version v1.0.0
@created 2022/5/4 9:17
@abstract
@description
@history
"""
import re
import sys
from pathlib import Path
from toollib import utils, regexp
from toollib.decorator import sys_required
from toollib.tcli import here
from toollib.tcli.base import BaseCmd
from toollib.tcli.option import Op... | 1,784 | 161 | 23 |
4e60c76f6dbf6aafce748cf7f081695a4d7fa0b9 | 21,810 | py | Python | test-framework/test-suites/unit/tests/pylib/stack/test_pylib_stack_kvm.py | sammeidinger/stack | a8085dce179dbe903f65f136f4b63bcc076cc057 | [
"BSD-3-Clause"
] | 123 | 2015-05-12T23:36:45.000Z | 2017-07-05T23:26:57.000Z | test-framework/test-suites/unit/tests/pylib/stack/test_pylib_stack_kvm.py | sammeidinger/stack | a8085dce179dbe903f65f136f4b63bcc076cc057 | [
"BSD-3-Clause"
] | 177 | 2015-06-05T19:17:47.000Z | 2017-07-07T17:57:24.000Z | test-framework/test-suites/unit/tests/pylib/stack/test_pylib_stack_kvm.py | sammeidinger/stack | a8085dce179dbe903f65f136f4b63bcc076cc057 | [
"BSD-3-Clause"
] | 32 | 2015-06-07T02:25:03.000Z | 2017-06-23T07:35:35.000Z | import pytest
import libvirt
import jinja2
import tarfile
from pathlib import Path
from libvirt import libvirtError, virConnect, virDomain, virStoragePool, virStorageVol
from stack.kvm import Hypervisor, VmException
from unittest.mock import create_autospec, patch, call, Mock
from subprocess import CompletedProcess
| 35.405844 | 103 | 0.768409 | import pytest
import libvirt
import jinja2
import tarfile
from pathlib import Path
from libvirt import libvirtError, virConnect, virDomain, virStoragePool, virStorageVol
from stack.kvm import Hypervisor, VmException
from unittest.mock import create_autospec, patch, call, Mock
from subprocess import CompletedProcess
cl... | 11,113 | 10,357 | 23 |
822a0ff8785eb0954163af374ff983ac9b7de2a1 | 2,575 | py | Python | jinete/models/vehicles.py | PhilippeGalvan/jinete | b7b22f8265935bc41b42ad8c4bf7464dc21ab424 | [
"MIT"
] | null | null | null | jinete/models/vehicles.py | PhilippeGalvan/jinete | b7b22f8265935bc41b42ad8c4bf7464dc21ab424 | [
"MIT"
] | null | null | null | jinete/models/vehicles.py | PhilippeGalvan/jinete | b7b22f8265935bc41b42ad8c4bf7464dc21ab424 | [
"MIT"
] | null | null | null | from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from .constants import (
MAX_FLOAT,
)
from .abc import (
Model,
)
from .services import (
Service,
)
if TYPE_CHECKING:
from typing import (
Set,
Any,
Dict,
Generator,
Tuple,
... | 23.409091 | 108 | 0.623689 | from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from .constants import (
MAX_FLOAT,
)
from .abc import (
Model,
)
from .services import (
Service,
)
if TYPE_CHECKING:
from typing import (
Set,
Any,
Dict,
Generator,
Tuple,
... | 1,473 | 641 | 46 |
114d1e7012c85fcfc862e1bd4047526600479af1 | 634 | py | Python | bapa/services/email.py | kelleydv/Bapa | ea19b8e878f608089553df132c32a25bf6183c9b | [
"MIT"
] | 5 | 2015-03-05T01:18:19.000Z | 2015-11-28T17:29:44.000Z | bapa/services/email.py | kelleydv/Bapa | ea19b8e878f608089553df132c32a25bf6183c9b | [
"MIT"
] | 26 | 2015-03-03T19:13:24.000Z | 2021-02-08T20:23:54.000Z | bapa/services/email.py | kelleydv/Bapa | ea19b8e878f608089553df132c32a25bf6183c9b | [
"MIT"
] | 1 | 2015-03-07T21:02:56.000Z | 2015-03-07T21:02:56.000Z | from bapa import app, mail
from flask_mail import Message
import os
def send_email(subject=None, body=None, recipients=None):
"""Send an email"""
msg = Message(
subject=subject,
body=body,
recipients=recipients
)
if app.config['TESTING']:
#no need to send an email
... | 24.384615 | 57 | 0.586751 | from bapa import app, mail
from flask_mail import Message
import os
def send_email(subject=None, body=None, recipients=None):
"""Send an email"""
msg = Message(
subject=subject,
body=body,
recipients=recipients
)
if app.config['TESTING']:
#no need to send an email
... | 0 | 0 | 0 |
c49a64e8be8eff82b186a76d2a5697110c34e258 | 3,151 | py | Python | PlotCircles.py | WalasekNicole/sensitive-periods-with-varying-cue-reliabilities | f9b2aefc7847c496bd15a14d3c4c804efe39c4c7 | [
"MIT"
] | null | null | null | PlotCircles.py | WalasekNicole/sensitive-periods-with-varying-cue-reliabilities | f9b2aefc7847c496bd15a14d3c4c804efe39c4c7 | [
"MIT"
] | null | null | null | PlotCircles.py | WalasekNicole/sensitive-periods-with-varying-cue-reliabilities | f9b2aefc7847c496bd15a14d3c4c804efe39c4c7 | [
"MIT"
] | 1 | 2020-01-23T15:07:41.000Z | 2020-01-23T15:07:41.000Z | def circles(x, y, s,ax, c='b',vmin=None, vmax=None, **kwargs):
"""
Make a scatter of circles plot of x vs y, where x and y are sequence
like objects of the same lengths. The size of circles are in data scale.
Parameters
----------
x,y : scalar or array_like, shape (n, )
Input data
... | 33.88172 | 79 | 0.62615 | def circles(x, y, s,ax, c='b',vmin=None, vmax=None, **kwargs):
"""
Make a scatter of circles plot of x vs y, where x and y are sequence
like objects of the same lengths. The size of circles are in data scale.
Parameters
----------
x,y : scalar or array_like, shape (n, )
Input data
... | 0 | 0 | 0 |
d074fc4545c591cadc37a37745a752306b7079e5 | 3,158 | py | Python | saltsdb/saltsdb.py | saltastro/saltsdb | dfb1413b100621ebc1cdd2d5bcbb27fa0db112a0 | [
"BSD-3-Clause"
] | null | null | null | saltsdb/saltsdb.py | saltastro/saltsdb | dfb1413b100621ebc1cdd2d5bcbb27fa0db112a0 | [
"BSD-3-Clause"
] | null | null | null | saltsdb/saltsdb.py | saltastro/saltsdb | dfb1413b100621ebc1cdd2d5bcbb27fa0db112a0 | [
"BSD-3-Clause"
] | 1 | 2018-01-09T14:06:58.000Z | 2018-01-09T14:06:58.000Z | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import sqlalchemy
import pandas as pd
__all__ = ['SALTSdb']
class SALTSdb:
"""SALTSdb is an interface to the SALT mysql database and specifically
simplifies the steps of returning objects from a call to the database
Parameters
--... | 26.991453 | 75 | 0.552882 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import sqlalchemy
import pandas as pd
__all__ = ['SALTSdb']
class SALTSdb:
"""SALTSdb is an interface to the SALT mysql database and specifically
simplifies the steps of returning objects from a call to the database
Parameters
--... | 298 | 0 | 27 |
9fa05de1d647fc79ab33a7bc71bb2e90cc1ed122 | 1,043 | py | Python | pylark/api_service_task_comment_delete.py | chyroc/pylark | a54cce6b814935fd3c72668b262b54c8ee461484 | [
"Apache-2.0"
] | 7 | 2021-08-18T00:42:05.000Z | 2022-03-14T09:49:15.000Z | pylark/api_service_task_comment_delete.py | chyroc/pylark | a54cce6b814935fd3c72668b262b54c8ee461484 | [
"Apache-2.0"
] | null | null | null | pylark/api_service_task_comment_delete.py | chyroc/pylark | a54cce6b814935fd3c72668b262b54c8ee461484 | [
"Apache-2.0"
] | 1 | 2022-03-14T09:49:20.000Z | 2022-03-14T09:49:20.000Z | # Code generated by lark_sdk_gen. DO NOT EDIT.
from pylark.lark_request import RawRequestReq, _new_method_option
from pylark import lark_type, lark_type_sheet, lark_type_approval
import attr
import typing
import io
@attr.s
@attr.s
| 28.972222 | 91 | 0.696069 | # Code generated by lark_sdk_gen. DO NOT EDIT.
from pylark.lark_request import RawRequestReq, _new_method_option
from pylark import lark_type, lark_type_sheet, lark_type_approval
import attr
import typing
import io
@attr.s
class DeleteTaskCommentReq(object):
task_id: str = attr.ib(
default="", metadata={... | 404 | 359 | 67 |
b5b32e30378a98abf08620431155a2602cc5a791 | 1,502 | py | Python | mzgtfs/fareattribute.py | andreyz/mapzen-gtfs | d445f1588ed10713eea9a1ca2878eef792121eca | [
"MIT"
] | 29 | 2015-06-08T00:49:52.000Z | 2021-09-25T21:46:53.000Z | mzgtfs/fareattribute.py | brennv/mapzen-gtfs | 886dc3a91fed13323f401d47a56ea713b8ed7807 | [
"MIT"
] | 12 | 2015-07-28T07:12:55.000Z | 2017-05-11T14:24:12.000Z | mzgtfs/fareattribute.py | brennv/mapzen-gtfs | 886dc3a91fed13323f401d47a56ea713b8ed7807 | [
"MIT"
] | 10 | 2015-07-28T06:57:51.000Z | 2021-01-05T05:56:27.000Z | """GTFS Fare Attributes."""
import datetime
import entity
import geom
import util
import widetime
import validation | 29.45098 | 87 | 0.679095 | """GTFS Fare Attributes."""
import datetime
import entity
import geom
import util
import widetime
import validation
class FareAttribute(entity.Entity):
KEY = 'fare_id'
REQUIRED = [
'fare_id',
'price',
'currency_type',
'payment_method',
'transfers',
]
OPTIONAL = [
'transfer_duration'
... | 1,125 | 238 | 23 |
f60e58f6f54daa5a6d0aa2b5e74611132df717c2 | 1,027 | py | Python | shfl/differential_privacy/norm.py | joarreg/Sherpa.ai-Federated-Learning-Framework | 9da392bf71c9acf13761dde0f119622c62780c87 | [
"Apache-2.0"
] | 2 | 2021-11-14T12:04:39.000Z | 2022-01-03T16:03:36.000Z | shfl/differential_privacy/norm.py | joarreg/Sherpa.ai-Federated-Learning-Framework | 9da392bf71c9acf13761dde0f119622c62780c87 | [
"Apache-2.0"
] | null | null | null | shfl/differential_privacy/norm.py | joarreg/Sherpa.ai-Federated-Learning-Framework | 9da392bf71c9acf13761dde0f119622c62780c87 | [
"Apache-2.0"
] | 1 | 2022-01-19T16:29:46.000Z | 2022-01-19T16:29:46.000Z | import numpy as np
import abc
class SensitivityNorm(abc.ABC):
"""
This class defines the interface that must be implemented to compute the sensitivity norm between
two values in a normed space.
"""
@abc.abstractmethod
def compute(self, x_1, x_2):
"""
The compute method receive... | 26.333333 | 101 | 0.642648 | import numpy as np
import abc
class SensitivityNorm(abc.ABC):
"""
This class defines the interface that must be implemented to compute the sensitivity norm between
two values in a normed space.
"""
@abc.abstractmethod
def compute(self, x_1, x_2):
"""
The compute method receive... | 128 | 0 | 52 |
82a9cad54da00ce922e974b057347a4ca86d60f4 | 459 | py | Python | src/api/__init__.py | petr/spd | 6fa8157026fec5926c00ccb1cc7091d4b541d914 | [
"MIT"
] | null | null | null | src/api/__init__.py | petr/spd | 6fa8157026fec5926c00ccb1cc7091d4b541d914 | [
"MIT"
] | null | null | null | src/api/__init__.py | petr/spd | 6fa8157026fec5926c00ccb1cc7091d4b541d914 | [
"MIT"
] | null | null | null | """
This module contains the full api workflow od the project sex partners
It has the following methods
* Upload an image to server and returns task id
* Method for processing this task
#/image_put
curl -F "image=@fixtures/members-301f4eab458270d4ad75856b9c7962de.jpg" http://127.0.0.1:8000/api/image_put/
#/task/... | 16.392857 | 107 | 0.712418 | """
This module contains the full api workflow od the project sex partners
It has the following methods
* Upload an image to server and returns task id
* Method for processing this task
#/image_put
curl -F "image=@fixtures/members-301f4eab458270d4ad75856b9c7962de.jpg" http://127.0.0.1:8000/api/image_put/
#/task/... | 0 | 0 | 0 |
53d42695123c2326facf4f279256b1c384089fd3 | 78,742 | py | Python | pypeit/metadata.py | rcooke-ast/PYPIT | 0cb9c4cb422736b855065a35aefc2bdba6d51dd0 | [
"BSD-3-Clause"
] | null | null | null | pypeit/metadata.py | rcooke-ast/PYPIT | 0cb9c4cb422736b855065a35aefc2bdba6d51dd0 | [
"BSD-3-Clause"
] | null | null | null | pypeit/metadata.py | rcooke-ast/PYPIT | 0cb9c4cb422736b855065a35aefc2bdba6d51dd0 | [
"BSD-3-Clause"
] | null | null | null | """
Provides a class that handles the fits metadata required by PypeIt.
.. include common links, assuming primary doc root is up one directory
.. include:: ../include/links.rst
"""
import os
import io
import string
from copy import deepcopy
import datetime
from IPython import embed
import numpy as np
import yaml
fr... | 42.817836 | 122 | 0.575411 | """
Provides a class that handles the fits metadata required by PypeIt.
.. include common links, assuming primary doc root is up one directory
.. include:: ../include/links.rst
"""
import os
import io
import string
from copy import deepcopy
import datetime
from IPython import embed
import numpy as np
import yaml
fr... | 2,219 | 0 | 240 |
8961a614cdd99fadc1742c84f3ac99d52f8069e6 | 1,565 | py | Python | cup_test/cup_exfile_test.py | liu0208xuan/CUP | 0e09b393673dacdd985c064cf03062b950a74179 | [
"Apache-2.0"
] | 900 | 2017-02-15T05:14:03.000Z | 2022-03-22T08:07:39.000Z | cup_test/cup_exfile_test.py | horsedongmin/CUP | 94398c7d94b2574db565c3e8d6dcfe2f3722f007 | [
"Apache-2.0"
] | 30 | 2017-02-24T05:16:15.000Z | 2021-08-04T02:03:12.000Z | cup_test/cup_exfile_test.py | horsedongmin/CUP | 94398c7d94b2574db565c3e8d6dcfe2f3722f007 | [
"Apache-2.0"
] | 185 | 2017-02-15T02:23:09.000Z | 2022-02-24T08:47:43.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*
"""
:authors:
Guannan Ma maguannan @mythmgn
:description:
"""
import os
import sys
_TOP = os.path.dirname(os.path.abspath(__file__)) + '/../'
sys.path.insert(0, _TOP)
from cup import err
from cup import exfile
from cup import unittest
LOCK_FILE = './.file_test.lock'... | 21.736111 | 70 | 0.672843 | #!/usr/bin/env python
# -*- coding: utf-8 -*
"""
:authors:
Guannan Ma maguannan @mythmgn
:description:
"""
import os
import sys
_TOP = os.path.dirname(os.path.abspath(__file__)) + '/../'
sys.path.insert(0, _TOP)
from cup import err
from cup import exfile
from cup import unittest
LOCK_FILE = './.file_test.lock'... | 0 | 0 | 0 |
98d2144a32d3d785b9afef57484fedb1bf3c1a79 | 775 | py | Python | webstore/carts/serializers.py | dmusial98/WebStorePython | ed98764a40dd82db2b57e030ff9bf0bc777075a7 | [
"Unlicense"
] | null | null | null | webstore/carts/serializers.py | dmusial98/WebStorePython | ed98764a40dd82db2b57e030ff9bf0bc777075a7 | [
"Unlicense"
] | null | null | null | webstore/carts/serializers.py | dmusial98/WebStorePython | ed98764a40dd82db2b57e030ff9bf0bc777075a7 | [
"Unlicense"
] | null | null | null | from .models import Cart, CartProduct
from rest_framework import serializers
| 29.807692 | 149 | 0.712258 | from .models import Cart, CartProduct
from rest_framework import serializers
class CartProductSerializer(serializers.HyperlinkedModelSerializer):
cartId = serializers.PrimaryKeyRelatedField(queryset=Cart.objects.all(),source='cart.id')
class Meta:
model = CartProduct
fields = ('id','productI... | 186 | 454 | 46 |
c0f68f5509d55fc92014c907640fb7abec305d6f | 642 | py | Python | modulo_03/amazon.py | memsprop/2021_python_selenium | eb3de282b11933cb6886d4008fb1b557147afaae | [
"Unlicense"
] | null | null | null | modulo_03/amazon.py | memsprop/2021_python_selenium | eb3de282b11933cb6886d4008fb1b557147afaae | [
"Unlicense"
] | null | null | null | modulo_03/amazon.py | memsprop/2021_python_selenium | eb3de282b11933cb6886d4008fb1b557147afaae | [
"Unlicense"
] | null | null | null | from common.webdriver_factory import get_driver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
driver = get_driver('chrome')
driver.implicitly_wait(10)
driver.get('https://www.amazon.com.mx/')
eleme... | 29.181818 | 64 | 0.777259 | from common.webdriver_factory import get_driver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
driver = get_driver('chrome')
driver.implicitly_wait(10)
driver.get('https://www.amazon.com.mx/')
eleme... | 0 | 0 | 0 |
de61ae6681b30cb18f22d2743a2669421da9304a | 121 | py | Python | setup.py | damienlefebvre/Math199 | b47798b228d131f27c1083907c500f2eb272ac2c | [
"MIT"
] | null | null | null | setup.py | damienlefebvre/Math199 | b47798b228d131f27c1083907c500f2eb272ac2c | [
"MIT"
] | null | null | null | setup.py | damienlefebvre/Math199 | b47798b228d131f27c1083907c500f2eb272ac2c | [
"MIT"
] | null | null | null | from distutils.core import setup
from Cython.Build import cythonize
setup(ext_modules=cythonize("stock_pyx.pyx"))
| 20.166667 | 46 | 0.785124 | from distutils.core import setup
from Cython.Build import cythonize
setup(ext_modules=cythonize("stock_pyx.pyx"))
| 0 | 0 | 0 |
b6a6333e564d75efd33b60acb991671f08945e8d | 1,085 | py | Python | ml/test/multiple_tests.py | thorwhalen/ut | 353a4629c35a2cca76ef91a4d5209afe766433b4 | [
"MIT"
] | 4 | 2016-12-17T20:06:10.000Z | 2021-11-19T04:45:29.000Z | ml/test/multiple_tests.py | thorwhalen/ut | 353a4629c35a2cca76ef91a4d5209afe766433b4 | [
"MIT"
] | 11 | 2021-01-06T05:35:11.000Z | 2022-03-11T23:28:31.000Z | ml/test/multiple_tests.py | thorwhalen/ut | 353a4629c35a2cca76ef91a4d5209afe766433b4 | [
"MIT"
] | 3 | 2015-06-12T10:44:16.000Z | 2021-07-26T18:39:47.000Z | from collections import defaultdict
from oto.models.scent import CentroidSmoothing
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, f1_score
import numpy as np
dflt_metrics = (
('accuracy', accuracy_score),
('f1', f1_score)
)
| 37.413793 | 91 | 0.590783 | from collections import defaultdict
from oto.models.scent import CentroidSmoothing
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, f1_score
import numpy as np
dflt_metrics = (
('accuracy', accuracy_score),
('f1', f1_score)
)
def gather_multiple_train_test_resu... | 778 | 0 | 23 |
591d3fba47d4f809901cfc54680f6ff664d0d231 | 1,205 | py | Python | src/commands/say.py | lysol/lvlss | ca068de516159be732d2cb8c4752dee4f4ef2e09 | [
"MIT"
] | null | null | null | src/commands/say.py | lysol/lvlss | ca068de516159be732d2cb8c4752dee4f4ef2e09 | [
"MIT"
] | null | null | null | src/commands/say.py | lysol/lvlss | ca068de516159be732d2cb8c4752dee4f4ef2e09 | [
"MIT"
] | null | null | null | from command import Command, is_command
from event import Event | 35.441176 | 60 | 0.517012 | from command import Command, is_command
from event import Event
class Say(Command):
shortname = 'say'
name = 'Say something to someone, or in the public chat'
@is_command
def say(self, player, *args):
if args[0] in self.world.players:
prefix = "(private) <%s> " % player.name
... | 990 | 129 | 23 |
c35e2b0429c91667ab58023527a5606d79349580 | 4,499 | py | Python | lab_3/scene3d.py | FeodorM/Computer-Graphics | d783c7cd73f6e31abdc272e3166dd2df361cf1bb | [
"MIT"
] | null | null | null | lab_3/scene3d.py | FeodorM/Computer-Graphics | d783c7cd73f6e31abdc272e3166dd2df361cf1bb | [
"MIT"
] | null | null | null | lab_3/scene3d.py | FeodorM/Computer-Graphics | d783c7cd73f6e31abdc272e3166dd2df361cf1bb | [
"MIT"
] | null | null | null | import pygame
from pygame.locals import *
from lab_3.camera3d import Camera3D
from lab_3.model3d import Model3D
from util.events import is_quit_event
from lab_3.affine_transform import *
# def scale(self, k):
# x, y = pygame.mouse.get_pos()
# x = self._x_screen_to_world(x)
# y = self._y_s... | 40.9 | 130 | 0.582352 | import pygame
from pygame.locals import *
from lab_3.camera3d import Camera3D
from lab_3.model3d import Model3D
from util.events import is_quit_event
from lab_3.affine_transform import *
class Scene3D(Camera3D):
def __init__(self, *args, **kwargs):
super(Scene3D, self).__init__(*args, *kwargs)
s... | 3,904 | 3 | 130 |
76119297a3082dab63f7352f72b41980527609a3 | 4,627 | py | Python | v1/awsbuild/bao_spinner.py | badassops/ops-aws | 2e6b76e62e7b9edaa3ba43ff57df90b75c75aba7 | [
"BSD-3-Clause"
] | 2 | 2019-02-28T06:49:19.000Z | 2019-12-30T09:41:17.000Z | v1/awsbuild/bao_spinner.py | badassops/ops-aws | 2e6b76e62e7b9edaa3ba43ff57df90b75c75aba7 | [
"BSD-3-Clause"
] | null | null | null | v1/awsbuild/bao_spinner.py | badassops/ops-aws | 2e6b76e62e7b9edaa3ba43ff57df90b75c75aba7 | [
"BSD-3-Clause"
] | null | null | null | # vim:fileencoding=utf-8:noet
""" python method """
# Copyright (c) 2010 - 2019, © Badassops LLC / Luc Suryo
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code... | 38.239669 | 96 | 0.617895 | # vim:fileencoding=utf-8:noet
""" python method """
# Copyright (c) 2010 - 2019, © Badassops LLC / Luc Suryo
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code... | 1,102 | 0 | 27 |
336db18f7ac63c100a48f82001450cfd7d7e03cf | 688 | py | Python | main.py | Yamp/Lin-Kernighan | 88e3ef8c0f4ec91ba22a065466b2473725d86870 | [
"MIT"
] | 1 | 2021-07-24T02:50:52.000Z | 2021-07-24T02:50:52.000Z | main.py | Lin-Kernighan/Lin-Kernighan | 88e3ef8c0f4ec91ba22a065466b2473725d86870 | [
"MIT"
] | 5 | 2020-02-01T10:44:09.000Z | 2020-05-24T10:39:14.000Z | main.py | Yamp/Lin-Kernighan | 88e3ef8c0f4ec91ba22a065466b2473725d86870 | [
"MIT"
] | 1 | 2020-08-26T05:26:23.000Z | 2020-08-26T05:26:23.000Z | import faulthandler
import logging
from time import time
from lin_kernighan.algorithms.structures.matrix import adjacency_matrix
from lin_kernighan.algorithms.utils.generator import generator
from lin_kernighan.lkh_search import LKHSearch
if __name__ == '__main__':
size = 500
logging.basicConfig(format='%(asc... | 25.481481 | 79 | 0.674419 | import faulthandler
import logging
from time import time
from lin_kernighan.algorithms.structures.matrix import adjacency_matrix
from lin_kernighan.algorithms.utils.generator import generator
from lin_kernighan.lkh_search import LKHSearch
if __name__ == '__main__':
size = 500
logging.basicConfig(format='%(asc... | 0 | 0 | 0 |
76b22186ea4555f4ebc758cbe4b32486dbef6ccd | 1,969 | py | Python | src/postprocessing/postprocessing.py | dsp-uga/team-ball | 0d4b4ffd21b7383d727354c66fa15fb6b7a2e779 | [
"MIT"
] | 1 | 2021-05-29T16:02:35.000Z | 2021-05-29T16:02:35.000Z | src/postprocessing/postprocessing.py | omid-s/neuron_finding_team-ball | 0d4b4ffd21b7383d727354c66fa15fb6b7a2e779 | [
"MIT"
] | null | null | null | src/postprocessing/postprocessing.py | omid-s/neuron_finding_team-ball | 0d4b4ffd21b7383d727354c66fa15fb6b7a2e779 | [
"MIT"
] | 3 | 2018-03-11T20:35:34.000Z | 2018-04-04T03:26:59.000Z | """"This file manages the postprocessing of the objects in the images"""
import numpy as np
import cv2
import json
def postProcess ( fileNames =None , theDic=None, output_file_name = "output.json" ):
"""
this function handels the postprocessing of values,
:param fileNames: if out put is written to files a... | 33.372881 | 174 | 0.643982 | """"This file manages the postprocessing of the objects in the images"""
import numpy as np
import cv2
import json
def postProcess ( fileNames =None , theDic=None, output_file_name = "output.json" ):
"""
this function handels the postprocessing of values,
:param fileNames: if out put is written to files a... | 0 | 0 | 0 |
9ffcb3b878550e16307ff897abc4b060fb20b2e6 | 194 | py | Python | test_autolens/integration/tests/imaging/phase_features/mock_nlo/image_psf_shape.py | PyJedi/PyAutoLens | bcfb2e7b447aa24508fc648d60b6fd9b4fd852e7 | [
"MIT"
] | 1 | 2020-04-06T20:07:56.000Z | 2020-04-06T20:07:56.000Z | test_autolens/integration/tests/imaging/phase_features/mock_nlo/image_psf_shape.py | PyJedi/PyAutoLens | bcfb2e7b447aa24508fc648d60b6fd9b4fd852e7 | [
"MIT"
] | null | null | null | test_autolens/integration/tests/imaging/phase_features/mock_nlo/image_psf_shape.py | PyJedi/PyAutoLens | bcfb2e7b447aa24508fc648d60b6fd9b4fd852e7 | [
"MIT"
] | null | null | null | from test import image_psf_shape
from test_autolens.integration.tests.imaging.runner import run_a_mock
| 24.25 | 69 | 0.809278 | from test import image_psf_shape
from test_autolens.integration.tests.imaging.runner import run_a_mock
class TestCase:
def _test_image_psf_shape(self):
run_a_mock(image_psf_shape)
| 47 | -6 | 49 |
0ab7979e8b81bd85652a7fbeb67fc1940846c537 | 9,272 | py | Python | lib/streamlit/cli.py | cclauss/streamlit | 232f040da0ec88512714ef0b512b558f7079d9a0 | [
"Apache-2.0"
] | 1 | 2021-08-25T02:49:23.000Z | 2021-08-25T02:49:23.000Z | lib/streamlit/cli.py | Mesica/streamlit | 9e486561ccca2e33ee57ca8f7341f52e929a7430 | [
"Apache-2.0"
] | null | null | null | lib/streamlit/cli.py | Mesica/streamlit | 9e486561ccca2e33ee57ca8f7341f52e929a7430 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2018-2019 Streamlit Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 28.182371 | 85 | 0.68874 | # -*- coding: utf-8 -*-
# Copyright 2018-2019 Streamlit Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 1,002 | 0 | 67 |
08e4181de948f233776a0f937dd71cb7fa69e382 | 729 | py | Python | Advent of Code 2020/Day 6 - Custom Customs.py | TecKnow/learning | 71d1ddf9d580027ecc62a067581da378a9e85f6d | [
"BSD-3-Clause"
] | null | null | null | Advent of Code 2020/Day 6 - Custom Customs.py | TecKnow/learning | 71d1ddf9d580027ecc62a067581da378a9e85f6d | [
"BSD-3-Clause"
] | null | null | null | Advent of Code 2020/Day 6 - Custom Customs.py | TecKnow/learning | 71d1ddf9d580027ecc62a067581da378a9e85f6d | [
"BSD-3-Clause"
] | null | null | null | from typing import Iterable, Set
if __name__ == "__main__":
data = open("Day 6 Data.txt").read()
data = parse_data(data)
data = all_yes_in_group(data)
print(sum(len(x) for x in data))
| 28.038462 | 77 | 0.66118 | from typing import Iterable, Set
def parse_data(data: str) -> list[set[str]]:
data = data.split("\n\n")
data = [group.split() for group in data]
print(data)
data = [[set(person) for person in group] for group in data]
return data
def any_yes_in_group(groups: Iterable[Iterable[Set[str]]]) -> list... | 456 | 0 | 69 |
6f1505ad8d2b42dab59273567a81b5fd27b24b08 | 3,648 | py | Python | src/publishment_log_api.py | wnjustdoit/devops-py | 54dd722a577c4b3ecda45aa85c067130fd292ab9 | [
"Apache-2.0"
] | null | null | null | src/publishment_log_api.py | wnjustdoit/devops-py | 54dd722a577c4b3ecda45aa85c067130fd292ab9 | [
"Apache-2.0"
] | 6 | 2021-04-08T20:46:56.000Z | 2022-01-13T01:52:06.000Z | src/publishment_log_api.py | wnjustdoit/devops-py | 54dd722a577c4b3ecda45aa85c067130fd292ab9 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python3
from flask import Blueprint, request, jsonify, make_response
from sqlalchemy import or_
import demjson
from datetime import timedelta, datetime
from .entities.publishment_log import PublishmentLog, PublishmentLogSchema
from .entities.entity import Session
publishment_log_api = Blueprint('publishme... | 35.076923 | 104 | 0.676261 | #!/usr/bin/python3
from flask import Blueprint, request, jsonify, make_response
from sqlalchemy import or_
import demjson
from datetime import timedelta, datetime
from .entities.publishment_log import PublishmentLog, PublishmentLogSchema
from .entities.entity import Session
publishment_log_api = Blueprint('publishme... | 3,063 | 0 | 113 |
367db37b555760269bd422dd3b19024d5d41a59e | 883 | py | Python | Ago-Dic-2021/castro-torres-maria-guadalupe/practica2/ejercicio-9-13.py | AnhellO/DAS_Sistemas | 07b4eca78357d02d225d570033d05748d91383e3 | [
"MIT"
] | 41 | 2017-09-26T09:36:32.000Z | 2022-03-19T18:05:25.000Z | Ago-Dic-2021/castro-torres-maria-guadalupe/practica2/ejercicio-9-13.py | AnhellO/DAS_Sistemas | 07b4eca78357d02d225d570033d05748d91383e3 | [
"MIT"
] | 67 | 2017-09-11T05:06:12.000Z | 2022-02-14T04:44:04.000Z | Ago-Dic-2021/castro-torres-maria-guadalupe/practica2/ejercicio-9-13.py | AnhellO/DAS_Sistemas | 07b4eca78357d02d225d570033d05748d91383e3 | [
"MIT"
] | 210 | 2017-09-01T00:10:08.000Z | 2022-03-19T18:05:12.000Z | from random import randint
#Haga un dado de 6 caras y muestre los resultados de 10 tiradas.
d6 = Die()
results = []
for roll_num in range(10):
result = d6.roll_die()
results.append(result)
print("\n10 rollos de un dado de 6 caras:")
print(results)
#Haga un dado de 10 caras y muestre los resultados de 10 tira... | 22.075 | 65 | 0.684032 | from random import randint
class Die():
def __init__(self, sides=6):
self.sides = sides
def roll_die(self):
return randint(1, self.sides)
#Haga un dado de 6 caras y muestre los resultados de 10 tiradas.
d6 = Die()
results = []
for roll_num in range(10):
result = d6.roll_die()
result... | 70 | -9 | 77 |
9d6a09b36eabe05c92c94b7622a4cf01a9379245 | 7,537 | py | Python | settings/base.py | seanbradley/Simpletown | d14dffba5030b574be3e01f8792a97ec0c049df4 | [
"Apache-2.0"
] | 3 | 2015-10-23T13:00:02.000Z | 2020-02-08T11:04:53.000Z | settings/base.py | seanbradley/Simpletown | d14dffba5030b574be3e01f8792a97ec0c049df4 | [
"Apache-2.0"
] | null | null | null | settings/base.py | seanbradley/Simpletown | d14dffba5030b574be3e01f8792a97ec0c049df4 | [
"Apache-2.0"
] | null | null | null | # DJANGO BASE SETTINGS
import os, sys
from os import environ
from os.path import basename
from unipath import Path
########## PATH CONFIGURATION
PROJECT_DIR = Path(__file__).ancestor(2)
MEDIA_ROOT = PROJECT_DIR.child("media")
STATIC_ROOT = PROJECT_DIR.child("static")
STATICFILES_DIRS = (
PROJECT_DIR.child("style... | 31.404167 | 117 | 0.69789 | # DJANGO BASE SETTINGS
import os, sys
from os import environ
from os.path import basename
from unipath import Path
########## PATH CONFIGURATION
PROJECT_DIR = Path(__file__).ancestor(2)
MEDIA_ROOT = PROJECT_DIR.child("media")
STATIC_ROOT = PROJECT_DIR.child("static")
STATICFILES_DIRS = (
PROJECT_DIR.child("style... | 0 | 0 | 0 |
6aa290c0076da15ca0764ac7f9ebdca3b87a8188 | 1,001 | py | Python | tests/repository/test_determine_repo_dir_finds_existing_cookiecutter.py | bradleypmartin/cookiecutter | 6540d2ad3b0ee3c30d9655171ef59b18d22ab0ed | [
"BSD-3-Clause"
] | 1 | 2021-12-12T12:38:28.000Z | 2021-12-12T12:38:28.000Z | tests/repository/test_determine_repo_dir_finds_existing_cookiecutter.py | bradleypmartin/cookiecutter | 6540d2ad3b0ee3c30d9655171ef59b18d22ab0ed | [
"BSD-3-Clause"
] | 1 | 2019-05-16T15:45:18.000Z | 2019-05-16T15:45:18.000Z | tests/repository/test_determine_repo_dir_finds_existing_cookiecutter.py | bradleypmartin/cookiecutter | 6540d2ad3b0ee3c30d9655171ef59b18d22ab0ed | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""Tests around detection whether cookiecutter templates are cached locally."""
import io
import os
import pytest
from cookiecutter import repository
@pytest.fixture
@pytest.fixture
| 23.833333 | 79 | 0.744256 | # -*- coding: utf-8 -*-
"""Tests around detection whether cookiecutter templates are cached locally."""
import io
import os
import pytest
from cookiecutter import repository
@pytest.fixture
def template():
return 'cookiecutter-pytest-plugin'
@pytest.fixture
def cloned_cookiecutter_path(user_config_data, tem... | 719 | 0 | 67 |
1ce81ae4c207ef9b43a665186c1864263af2fc92 | 787 | py | Python | src/leetcode/Coding_Interviews/construct_binary_tree.py | highing666/leaving | c121ee2f61e45472bb71e2770d0697e902279a64 | [
"MIT"
] | null | null | null | src/leetcode/Coding_Interviews/construct_binary_tree.py | highing666/leaving | c121ee2f61e45472bb71e2770d0697e902279a64 | [
"MIT"
] | null | null | null | src/leetcode/Coding_Interviews/construct_binary_tree.py | highing666/leaving | c121ee2f61e45472bb71e2770d0697e902279a64 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
| 25.387097 | 78 | 0.56798 | # -*- coding: utf-8 -*-
class TreeNode:
def __init__(self, x):
super().__init__()
self.val = x
self.left = None
self.right = None
class Solution:
def build_tree(self, preorder: List[int], inorder: List[int]) -> TreeNode:
temp_dic = dict(enumerate(inorder))
se... | 646 | -12 | 127 |
2c394234d26ea5e6fac9fa6bd05d0f5cbfa38813 | 1,299 | py | Python | suanfa/quick_sort.py | nciefeiniu/python-test | d81fcfff8cdec724c3010d6b7a77aabad7f90595 | [
"Apache-2.0"
] | null | null | null | suanfa/quick_sort.py | nciefeiniu/python-test | d81fcfff8cdec724c3010d6b7a77aabad7f90595 | [
"Apache-2.0"
] | null | null | null | suanfa/quick_sort.py | nciefeiniu/python-test | d81fcfff8cdec724c3010d6b7a77aabad7f90595 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python3
# -*- coding: utf-8 -*-
if __name__ == '__main__':
# lists = [2,9,5,9,4,7,1,5,4]
# quick_sort(lists,0, len(lists) - 1)
# print(lists)
lists2 = [1,1]
quick_sort2(lists2, 0, len(lists2) - 1)
print lists2 | 24.055556 | 65 | 0.538876 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
def quick_sort(array, left, rigth):
if left < rigth:
q = partition(array, left, rigth)
quick_sort(array, left, q - 1)
quick_sort(array, q + 1, rigth)
def partition(array, l, r):
x = array[r]
i = l - 1
for j in range(l, r):
if... | 956 | 0 | 92 |
cee81baa07bea28d1a6a883ec480a4c0db500333 | 1,702 | py | Python | chapter_8/entry2.py | bimri/programming_python | ba52ccd18b9b4e6c5387bf4032f381ae816b5e77 | [
"MIT"
] | null | null | null | chapter_8/entry2.py | bimri/programming_python | ba52ccd18b9b4e6c5387bf4032f381ae816b5e77 | [
"MIT"
] | null | null | null | chapter_8/entry2.py | bimri/programming_python | ba52ccd18b9b4e6c5387bf4032f381ae816b5e77 | [
"MIT"
] | null | null | null | "Entry"
'Laying Out Input Forms'
# Entry widgets are often used to get
# field values in form-like displays.
# combines labels, entries, and frames to
# achieve the multiple-input display
"""
use Entry widgets directly
lay out by rows with fixed-width labels: this and grid are best for forms
"""
from tkinter import... | 32.113208 | 89 | 0.648061 | "Entry"
'Laying Out Input Forms'
# Entry widgets are often used to get
# field values in form-like displays.
# combines labels, entries, and frames to
# achieve the multiple-input display
"""
use Entry widgets directly
lay out by rows with fixed-width labels: this and grid are best for forms
"""
from tkinter import... | 535 | 0 | 46 |
2de5e47c6f2b0d5cac6777773e978fdad38c3dd3 | 3,497 | py | Python | EtaPyScripts/getHistory.py | kd2eom/shuttletracker | d900055a78fd798f5375bed428cdd68843f5d5c7 | [
"MIT"
] | null | null | null | EtaPyScripts/getHistory.py | kd2eom/shuttletracker | d900055a78fd798f5375bed428cdd68843f5d5c7 | [
"MIT"
] | null | null | null | EtaPyScripts/getHistory.py | kd2eom/shuttletracker | d900055a78fd798f5375bed428cdd68843f5d5c7 | [
"MIT"
] | null | null | null | import urllib.request
import datetime as dt
import json
MAX_TIME_DIFFERENCE_MIN = 10
# function to open the JSON history file
# function to load the history data from the JSON
def time_in_range(start, end, x):
"""Return true if x is in the range [start, end]"""
if start <= end:
return s... | 38.855556 | 128 | 0.612239 | import urllib.request
import datetime as dt
import json
MAX_TIME_DIFFERENCE_MIN = 10
# function to open the JSON history file
def response(url):
return urllib.request.urlopen(url)
# function to load the history data from the JSON
def loadJSON(response):
return json.loads(response.read())
def t... | 2,274 | 0 | 71 |
b78bd21e6375a02ca53c446bd963eae360bfd98a | 2,245 | py | Python | scripts/delay_metrics.py | welvin21/pysimt | 6250b33dc518b3195da4fc9cc8d32ba7ada958c0 | [
"MIT"
] | 34 | 2020-09-21T10:49:57.000Z | 2022-01-08T04:50:42.000Z | scripts/delay_metrics.py | welvin21/pysimt | 6250b33dc518b3195da4fc9cc8d32ba7ada958c0 | [
"MIT"
] | 2 | 2021-01-08T03:52:51.000Z | 2021-09-10T07:45:05.000Z | scripts/delay_metrics.py | welvin21/pysimt | 6250b33dc518b3195da4fc9cc8d32ba7ada958c0 | [
"MIT"
] | 5 | 2021-04-23T09:30:51.000Z | 2022-01-09T08:40:45.000Z | #!/usr/bin/env python
import os
import sys
from pathlib import Path
import tabulate
import sacrebleu
from pysimt.metrics.simnmt import AVPScorer, AVLScorer
"""This script should be run from within the parent folder where each pysimt
experiment resides."""
if __name__ == '__main__':
results = {}
trglang ... | 30.337838 | 101 | 0.622717 | #!/usr/bin/env python
import os
import sys
from pathlib import Path
import tabulate
import sacrebleu
from pysimt.metrics.simnmt import AVPScorer, AVLScorer
"""This script should be run from within the parent folder where each pysimt
experiment resides."""
def read_lines_from_file(fname):
lines = []
with ... | 132 | 0 | 23 |
24bfe0be0e8ee1aed884f49c89556868a8cc6a13 | 1,456 | py | Python | API/urls.py | AnonC0DER/JobSearch | f7de8cc36011bf9e7494339c437da5596e745381 | [
"Apache-2.0"
] | null | null | null | API/urls.py | AnonC0DER/JobSearch | f7de8cc36011bf9e7494339c437da5596e745381 | [
"Apache-2.0"
] | null | null | null | API/urls.py | AnonC0DER/JobSearch | f7de8cc36011bf9e7494339c437da5596e745381 | [
"Apache-2.0"
] | null | null | null | from django.urls import path, include
from rest_framework.schemas import get_schema_view
from rest_framework.documentation import include_docs_urls
from API import views
urlpatterns = [
path('', views.AllMethods.as_view(), name='all-methods'),
path('docs/', include_docs_urls(title='JobSearch-docs')),
path... | 50.206897 | 89 | 0.686126 | from django.urls import path, include
from rest_framework.schemas import get_schema_view
from rest_framework.documentation import include_docs_urls
from API import views
urlpatterns = [
path('', views.AllMethods.as_view(), name='all-methods'),
path('docs/', include_docs_urls(title='JobSearch-docs')),
path... | 0 | 0 | 0 |
d2daa7ae70bee818986e98aee0fb44ecc814683b | 1,755 | py | Python | source/_cookbook/adaptive-steps.py | danielballan/docs | c6743c92769f76762a29d3fa4684a2dcbbfc6e4f | [
"BSD-2-Clause"
] | null | null | null | source/_cookbook/adaptive-steps.py | danielballan/docs | c6743c92769f76762a29d3fa4684a2dcbbfc6e4f | [
"BSD-2-Clause"
] | null | null | null | source/_cookbook/adaptive-steps.py | danielballan/docs | c6743c92769f76762a29d3fa4684a2dcbbfc6e4f | [
"BSD-2-Clause"
] | null | null | null | """
Use scans with adaptive step sizes
**********************************
Problem
=======
Concentrate measurement in regions of high variability, taking larger strides
through flat regions.
Approach
========
The *plans* in bluesky can be fully adaptive, determining one step at a time.
A couple built-in plans provid... | 30.789474 | 79 | 0.658689 | """
Use scans with adaptive step sizes
**********************************
Problem
=======
Concentrate measurement in regions of high variability, taking larger strides
through flat regions.
Approach
========
The *plans* in bluesky can be fully adaptive, determining one step at a time.
A couple built-in plans provid... | 0 | 0 | 0 |
4dea91b9cd779b6f10ca196f05d5324b9b5207f4 | 831 | py | Python | omin/tests/test_core.py | dmpio/omin | bedb36eafe681401c11d562f8d7117aad3d758d7 | [
"Unlicense"
] | null | null | null | omin/tests/test_core.py | dmpio/omin | bedb36eafe681401c11d562f8d7117aad3d758d7 | [
"Unlicense"
] | null | null | null | omin/tests/test_core.py | dmpio/omin | bedb36eafe681401c11d562f8d7117aad3d758d7 | [
"Unlicense"
] | 1 | 2021-12-29T16:55:05.000Z | 2021-12-29T16:55:05.000Z |
import os
from glob import glob
from ..core import containers
from ..core import handles
here = os.getcwd()
example_data_dir = os.path.join(os.path.split(here)[0], "example_data", "_data")
# print(glob(example_data_dir+"/*"))
mcd_def_malonylation_file_list = os.path.join(example_data_dir, "mcd_def_malonylation",... | 25.96875 | 92 | 0.777377 |
import os
from glob import glob
from ..core import containers
from ..core import handles
here = os.getcwd()
example_data_dir = os.path.join(os.path.split(here)[0], "example_data", "_data")
# print(glob(example_data_dir+"/*"))
mcd_def_malonylation_file_list = os.path.join(example_data_dir, "mcd_def_malonylation",... | 363 | 0 | 69 |
bd697495975dc88f527e2bc1be0af1d792673636 | 8,238 | py | Python | scripts/sorno_amazon_reviews_scrape.py | hermantai/sorno-py-scripts | 2d2d7e942a799161934f4338bfe12c2ff671ca58 | [
"Apache-2.0"
] | null | null | null | scripts/sorno_amazon_reviews_scrape.py | hermantai/sorno-py-scripts | 2d2d7e942a799161934f4338bfe12c2ff671ca58 | [
"Apache-2.0"
] | null | null | null | scripts/sorno_amazon_reviews_scrape.py | hermantai/sorno-py-scripts | 2d2d7e942a799161934f4338bfe12c2ff671ca58 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
"""A script to scrape Amazon product reviews from the web page.
Copyright 2014 Heung Ming Tai
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://... | 31.684615 | 180 | 0.617019 | #!/usr/bin/env python
"""A script to scrape Amazon product reviews from the web page.
Copyright 2014 Heung Ming Tai
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://... | 3,047 | 3,985 | 69 |
1a427c8ac3d169c181d0904d196f7f6c4144ad60 | 12,573 | py | Python | packages/main/src/RPA/Desktop/__init__.py | amisol/rpaframework | b1ee8a745a8e4d7bd41fa7765b26ab02b90cfb57 | [
"Apache-2.0"
] | 518 | 2020-05-29T11:39:34.000Z | 2022-03-31T22:04:08.000Z | packages/main/src/RPA/Desktop/__init__.py | amisol/rpaframework | b1ee8a745a8e4d7bd41fa7765b26ab02b90cfb57 | [
"Apache-2.0"
] | 316 | 2020-05-29T06:09:28.000Z | 2022-03-31T12:00:33.000Z | packages/main/src/RPA/Desktop/__init__.py | amisol/rpaframework | b1ee8a745a8e4d7bd41fa7765b26ab02b90cfb57 | [
"Apache-2.0"
] | 99 | 2020-05-27T20:23:54.000Z | 2022-03-26T02:57:35.000Z | import logging
import platform
import sys
import warnings
if platform.system() == "Windows":
# Configure comtypes to not generate DLL bindings into
# current environment, instead keeping them in memory.
# Slower, but prevents dirtying environments.
import comtypes.client
comtypes.client.gen_dir = ... | 35.516949 | 127 | 0.60447 | import logging
import platform
import sys
import warnings
if platform.system() == "Windows":
# Configure comtypes to not generate DLL bindings into
# current environment, instead keeping them in memory.
# Slower, but prevents dirtying environments.
import comtypes.client
comtypes.client.gen_dir = ... | 452 | 0 | 27 |
59b84ef4a9a48883be034dda7e131c71dfb4f73d | 2,857 | py | Python | pyavd/Models/Components/Payload.py | AVD-2021/PyAVD | a3a45d97199e80bf98560b08bcd09708c1a0513a | [
"Apache-2.0"
] | null | null | null | pyavd/Models/Components/Payload.py | AVD-2021/PyAVD | a3a45d97199e80bf98560b08bcd09708c1a0513a | [
"Apache-2.0"
] | null | null | null | pyavd/Models/Components/Payload.py | AVD-2021/PyAVD | a3a45d97199e80bf98560b08bcd09708c1a0513a | [
"Apache-2.0"
] | null | null | null | from gpkit import Model, Variable, Vectorize, VectorVariable, parse_variables, ureg as u
from gpkit.constraints.tight import Tight
import numpy as np
class Payload(Model):
"""Payload model
Variables
---------
M [kg] Total Payload mass
M_pax ... | 28.858586 | 89 | 0.587679 | from gpkit import Model, Variable, Vectorize, VectorVariable, parse_variables, ureg as u
from gpkit.constraints.tight import Tight
import numpy as np
class Payload(Model):
"""Payload model
Variables
---------
M [kg] Total Payload mass
M_pax ... | 772 | 0 | 26 |
26971b88d5c88bf0fce43da725c168b76a99d8f6 | 924 | py | Python | b2style/b2plotstyle.py | anselm-baur/b2style | 8d1a49b8169c5bfdc4d74f7574b0ca24a11d530e | [
"MIT"
] | null | null | null | b2style/b2plotstyle.py | anselm-baur/b2style | 8d1a49b8169c5bfdc4d74f7574b0ca24a11d530e | [
"MIT"
] | null | null | null | b2style/b2plotstyle.py | anselm-baur/b2style | 8d1a49b8169c5bfdc4d74f7574b0ca24a11d530e | [
"MIT"
] | null | null | null | import matplotlib.pyplot as plt
def set_default_plot_params():
"""
Sets default parameters in the matplotlibrc.
:return: None
"""
xtick = {
'top': True,
'minor.visible': True,
'direction': 'in',
'labelsize': 10
}
ytick = {
'right': True,
'min... | 20.533333 | 48 | 0.488095 | import matplotlib.pyplot as plt
def set_default_plot_params():
"""
Sets default parameters in the matplotlibrc.
:return: None
"""
xtick = {
'top': True,
'minor.visible': True,
'direction': 'in',
'labelsize': 10
}
ytick = {
'right': True,
'min... | 0 | 0 | 0 |