hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c3a31952cc8585ec814b199d27d13eef56bbe9b | 2,964 | py | Python | osspeak/recognition/actions/library/stdlib.py | OSSpeak/OSSpeak | 327c38a37684165f87bf8d76ab2ca135b43b8ab7 | [
"MIT"
] | 1 | 2020-03-17T10:24:41.000Z | 2020-03-17T10:24:41.000Z | osspeak/recognition/actions/library/stdlib.py | OSSpeak/OSSpeak | 327c38a37684165f87bf8d76ab2ca135b43b8ab7 | [
"MIT"
] | 12 | 2016-09-28T05:16:00.000Z | 2020-11-27T22:32:40.000Z | osspeak/recognition/actions/library/stdlib.py | OSSpeak/OSSpeak | 327c38a37684165f87bf8d76ab2ca135b43b8ab7 | [
"MIT"
] | null | null | null | from recognition.actions.library import (window, thread, engine,
extensions, general, text, clipboard, macro, osspeak, conditionals,
fsystem, math, directinput, flow, process)
from recognition.actions.library import _mouse as mouse
from recognition.actions.library import _keyboard as keyboard
from recognition.actions.l... | 26 | 85 | 0.654858 | from recognition.actions.library import (window, thread, engine,
extensions, general, text, clipboard, macro, osspeak, conditionals,
fsystem, math, directinput, flow, process)
from recognition.actions.library import _mouse as mouse
from recognition.actions.library import _keyboard as keyboard
from recognition.actions.l... | true | true |
1c3a3363b22b8a6ed344c7c1101395d35779dcdf | 1,268 | py | Python | src/OTLMOW/OEFModel/ModelGrabber.py | davidvlaminck/OTLClassPython | 71330afeb37c3ea6d9981f521ff8f4a3f8b946fc | [
"MIT"
] | 2 | 2022-02-01T08:58:11.000Z | 2022-02-08T13:35:17.000Z | src/OTLMOW/OEFModel/ModelGrabber.py | davidvlaminck/OTLMOW | 71330afeb37c3ea6d9981f521ff8f4a3f8b946fc | [
"MIT"
] | null | null | null | src/OTLMOW/OEFModel/ModelGrabber.py | davidvlaminck/OTLMOW | 71330afeb37c3ea6d9981f521ff8f4a3f8b946fc | [
"MIT"
] | null | null | null | import json
import requests
class ModelGrabber:
def __init__(self):
self.cert_path = 'C:\\resources\\datamanager_eminfra_prd.awv.vlaanderen.be.crt'
self.key_path = 'C:\\resources\\datamanager_eminfra_prd.awv.vlaanderen.be.key'
def grab_models_as_json(self, save_legacy_to: str = 'oef.legacy.j... | 38.424242 | 126 | 0.636435 | import json
import requests
class ModelGrabber:
def __init__(self):
self.cert_path = 'C:\\resources\\datamanager_eminfra_prd.awv.vlaanderen.be.crt'
self.key_path = 'C:\\resources\\datamanager_eminfra_prd.awv.vlaanderen.be.key'
def grab_models_as_json(self, save_legacy_to: str = 'oef.legacy.j... | true | true |
1c3a33b85993b16250efc482283f53782043466f | 7,743 | py | Python | envs.py | smearle/pytorch-a2c-ppo-acktr-micropolis | 699a6f6e65e8bab5533074945cc9aa7827919a59 | [
"MIT"
] | 3 | 2020-07-13T08:44:36.000Z | 2022-03-18T01:17:59.000Z | envs.py | smearle/pytorch-baselines-micropolis | 699a6f6e65e8bab5533074945cc9aa7827919a59 | [
"MIT"
] | null | null | null | envs.py | smearle/pytorch-baselines-micropolis | 699a6f6e65e8bab5533074945cc9aa7827919a59 | [
"MIT"
] | null | null | null | import os
import sys
import gym
import numpy as np
import torch
from gym.spaces.box import Box
from baselines import bench
#from baselines.common.atari_wrappers import make_atari, wrap_deepmind
from baselines.common.vec_env import VecEnvWrapper
from baselines.common.vec_env.subproc_vec_env import SubprocVecEnv
from b... | 32.948936 | 190 | 0.630763 | import os
import sys
import gym
import numpy as np
import torch
from gym.spaces.box import Box
from baselines import bench
from baselines.common.vec_env import VecEnvWrapper
from baselines.common.vec_env.subproc_vec_env import SubprocVecEnv
from baselines.common.vec_env.dummy_vec_env import DummyVecEnv
from baseline... | true | true |
1c3a35056514d326dce8b415d64f4c30fccadd20 | 213 | py | Python | StatisticsFunctions/quartiles.py | mkm99/TeamProject_StatsCalculator | 81085c1af47f38d3e49b43d667e312016c44ad10 | [
"MIT"
] | null | null | null | StatisticsFunctions/quartiles.py | mkm99/TeamProject_StatsCalculator | 81085c1af47f38d3e49b43d667e312016c44ad10 | [
"MIT"
] | 7 | 2020-03-03T21:37:57.000Z | 2020-03-06T04:11:42.000Z | StatisticsFunctions/quartiles.py | mkm99/TeamProject_StatsCalculator | 81085c1af47f38d3e49b43d667e312016c44ad10 | [
"MIT"
] | null | null | null | import numpy as np
class Quartile():
@staticmethod
def quartile(data):
q1 = np.quantile(data, .25)
q2 = np.quantile(data, .50)
q3 = np.quantile(data, .75)
return q1, q2, q3 | 23.666667 | 35 | 0.568075 | import numpy as np
class Quartile():
@staticmethod
def quartile(data):
q1 = np.quantile(data, .25)
q2 = np.quantile(data, .50)
q3 = np.quantile(data, .75)
return q1, q2, q3 | true | true |
1c3a3670ec98f68725f97accc6fc0b4dbf3714eb | 181 | py | Python | Null_Check.py | GodingWal/lambdata_Tools | 33f34cc6f641103f55348761def8397cbda8cf16 | [
"MIT"
] | null | null | null | Null_Check.py | GodingWal/lambdata_Tools | 33f34cc6f641103f55348761def8397cbda8cf16 | [
"MIT"
] | null | null | null | Null_Check.py | GodingWal/lambdata_Tools | 33f34cc6f641103f55348761def8397cbda8cf16 | [
"MIT"
] | null | null | null | # Function to to check null in dataset
def null_check(df):
for _ in df:
if None in df.isnull():
print("No Error")
else:
print("Error")
| 18.1 | 38 | 0.524862 |
def null_check(df):
for _ in df:
if None in df.isnull():
print("No Error")
else:
print("Error")
| true | true |
1c3a370fe3dcfb5ae224d5e6ca6eed10cfc9d3c8 | 101 | py | Python | Loop_Counting.py | mcjohnchristopher/Python_Samples | 738f3b7d9baa7f4e396647f380118eba66ea645c | [
"CC0-1.0"
] | null | null | null | Loop_Counting.py | mcjohnchristopher/Python_Samples | 738f3b7d9baa7f4e396647f380118eba66ea645c | [
"CC0-1.0"
] | null | null | null | Loop_Counting.py | mcjohnchristopher/Python_Samples | 738f3b7d9baa7f4e396647f380118eba66ea645c | [
"CC0-1.0"
] | null | null | null | fruit = 'banana'
count = 0
for letter in fruit :
letter == 'a'
count = count + 1
print count | 16.833333 | 22 | 0.60396 | fruit = 'banana'
count = 0
for letter in fruit :
letter == 'a'
count = count + 1
print count | false | true |
1c3a374b49d43c0cce1d638b7b781acc27986bd1 | 835 | py | Python | setup.py | lemmi25/python_driver | b4f8e17159dbaecde09cc530b42fdc82221fed1a | [
"MIT"
] | null | null | null | setup.py | lemmi25/python_driver | b4f8e17159dbaecde09cc530b42fdc82221fed1a | [
"MIT"
] | null | null | null | setup.py | lemmi25/python_driver | b4f8e17159dbaecde09cc530b42fdc82221fed1a | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import setuptools
with open('README.md', 'r') as fh:
long_description = fh.read()
setuptools.setup(
name='MecademicRobot',
version='1.0.2',
author='Mecademic',
author_email='support@mecademic.com',
license='MIT',
description='A package to control the Mecademic Robots... | 27.833333 | 75 | 0.656287 |
import setuptools
with open('README.md', 'r') as fh:
long_description = fh.read()
setuptools.setup(
name='MecademicRobot',
version='1.0.2',
author='Mecademic',
author_email='support@mecademic.com',
license='MIT',
description='A package to control the Mecademic Robots through python',
... | false | true |
1c3a37be6cab32536f7fee6c5a99bfedc7d2e6f0 | 962 | py | Python | algorithms/Python/implementation/acm icpc team.py | Kumbong/hackerrank | 36125f3a17c3e0f1fa889495e8ad33b0aa424552 | [
"MIT"
] | 8 | 2019-09-19T19:38:09.000Z | 2022-02-14T13:59:37.000Z | algorithms/Python/implementation/acm icpc team.py | Kumbong/hacker-rank | 36125f3a17c3e0f1fa889495e8ad33b0aa424552 | [
"MIT"
] | null | null | null | algorithms/Python/implementation/acm icpc team.py | Kumbong/hacker-rank | 36125f3a17c3e0f1fa889495e8ad33b0aa424552 | [
"MIT"
] | 7 | 2019-09-23T13:17:27.000Z | 2022-01-27T18:02:16.000Z | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the acmTeam function below.
def compare(a,b):
c=0
for i in range(len(a)):
if a[i]=='1' or b[i]=='1':
c+=1
return c
def acmTeam(topic):
max_topics=-1
permutations=0
for i in range(len(... | 16.877193 | 47 | 0.537422 |
import math
import os
import random
import re
import sys
def compare(a,b):
c=0
for i in range(len(a)):
if a[i]=='1' or b[i]=='1':
c+=1
return c
def acmTeam(topic):
max_topics=-1
permutations=0
for i in range(len(topic)):
for j in range(i+1,len(topic)):
... | true | true |
1c3a3824b479de346a942d6a6f24969552ae9f59 | 9,012 | py | Python | dispike/helper/components.py | mrshmllow/dispike | 6e73f4414e2025c1ce48db2c9aa08de4eba3bfec | [
"MIT"
] | null | null | null | dispike/helper/components.py | mrshmllow/dispike | 6e73f4414e2025c1ce48db2c9aa08de4eba3bfec | [
"MIT"
] | null | null | null | dispike/helper/components.py | mrshmllow/dispike | 6e73f4414e2025c1ce48db2c9aa08de4eba3bfec | [
"MIT"
] | null | null | null | import typing
from enum import Enum
from dispike.errors.components import InvalidComponentError, ComponentCombinationError, SelectMenuOptionError
class ComponentTypes(int, Enum):
"""Easy access to component types.
Attributes:
ACTION_ROW (int): Represents Type 1
BUTTON (int): Represents Type... | 30.445946 | 159 | 0.570462 | import typing
from enum import Enum
from dispike.errors.components import InvalidComponentError, ComponentCombinationError, SelectMenuOptionError
class ComponentTypes(int, Enum):
ACTION_ROW = 1
BUTTON = 2
SELECT_MENU = 3
class ButtonStyles(int, Enum):
PRIMARY = 1
SECONDARY = 2
SUCCESS =... | true | true |
1c3a391afd05988b0c260ecf40004b4f45f0eea2 | 3,450 | py | Python | bot/injector.py | Scottdecat/HiveMind | cbd9de0645d756a63d65918f6c971753e1178652 | [
"MIT"
] | null | null | null | bot/injector.py | Scottdecat/HiveMind | cbd9de0645d756a63d65918f6c971753e1178652 | [
"MIT"
] | null | null | null | bot/injector.py | Scottdecat/HiveMind | cbd9de0645d756a63d65918f6c971753e1178652 | [
"MIT"
] | null | null | null | from sc2 import BotAI
from .configuration.configuration_interface import ConfigurationInterface
from .configuration.basic_configuration import BasicConfiguration
from .services.chat_service import ChatService
from .services.state_service import StateService
from .services.action_service import ActionService
from .ser... | 52.272727 | 104 | 0.788116 | from sc2 import BotAI
from .configuration.configuration_interface import ConfigurationInterface
from .configuration.basic_configuration import BasicConfiguration
from .services.chat_service import ChatService
from .services.state_service import StateService
from .services.action_service import ActionService
from .ser... | true | true |
1c3a397be768f86c51b28be17345f9f7c1b28b17 | 3,685 | py | Python | examples/unpolished/ode/case_6_hgp_model.py | KennedyPutraKusumo/py-DED | c5742c29cae66542960060f19d65b446d532b477 | [
"MIT"
] | 2 | 2020-05-19T14:06:41.000Z | 2021-09-09T16:11:53.000Z | examples/unpolished/ode/case_6_hgp_model.py | KennedyPutraKusumo/py-DED | c5742c29cae66542960060f19d65b446d532b477 | [
"MIT"
] | 2 | 2020-04-28T02:36:36.000Z | 2021-08-23T09:36:13.000Z | examples/unpolished/ode/case_6_hgp_model.py | KennedyPutraKusumo/py-DED | c5742c29cae66542960060f19d65b446d532b477 | [
"MIT"
] | 2 | 2020-10-10T18:43:27.000Z | 2020-11-22T19:41:05.000Z | from pyomo import environ as po
from pyomo import dae as pod
from matplotlib import pyplot as plt
import numpy as np
def create_model_hgp(spt):
m = po.ConcreteModel()
tau = max(spt)
norm_spt = spt / tau
m.t = pod.ContinuousSet(bounds=(0, 1), initialize=norm_spt) # normalized time variable (unitles... | 37.602041 | 159 | 0.543012 | from pyomo import environ as po
from pyomo import dae as pod
from matplotlib import pyplot as plt
import numpy as np
def create_model_hgp(spt):
m = po.ConcreteModel()
tau = max(spt)
norm_spt = spt / tau
m.t = pod.ContinuousSet(bounds=(0, 1), initialize=norm_spt)
m.tau = po.Var(bounds=(0, None... | true | true |
1c3a3a63e028be1bb363ca349f0612c29c99f769 | 2,603 | py | Python | Packs/GitLab/Integrations/GitLabEventCollector/GitLabEventCollector_test.py | wiz-sec/content | 344291cfb87c23a5f13b2d827949bfa8425ef88c | [
"MIT"
] | null | null | null | Packs/GitLab/Integrations/GitLabEventCollector/GitLabEventCollector_test.py | wiz-sec/content | 344291cfb87c23a5f13b2d827949bfa8425ef88c | [
"MIT"
] | null | null | null | Packs/GitLab/Integrations/GitLabEventCollector/GitLabEventCollector_test.py | wiz-sec/content | 344291cfb87c23a5f13b2d827949bfa8425ef88c | [
"MIT"
] | null | null | null | from GitLabEventCollector import GetEvents, Client, reformat_details
from SiemApiModule import * # noqa # pylint: disable=unused-wildcard-import
events = [{'created_at': '2022-04-17T12:31:36.667Z', 'details': {'add': 'aaa'}, 'entity_type': 'Group', 'id': '1'},
{'created_at': '2022-05-17T12:31:36.667Z', 'det... | 50.057692 | 120 | 0.58932 | from GitLabEventCollector import GetEvents, Client, reformat_details
from SiemApiModule import * 2:31:36.667Z', 'details': {'add': 'aaa'}, 'entity_type': 'Group', 'id': '1'},
{'created_at': '2022-05-17T12:31:36.667Z', 'details': {'add': 'bbb'}, 'entity_type': 'Group', 'id': '2'},
{'created_at': '20... | true | true |
1c3a3ade7f616f684d9cc2d807ed6f4495b5ba04 | 4,775 | py | Python | server/online/views.py | MahjongRepository/mahjong-leaderboard | 77dfd26cb812c12fa7c2b11e862bb80a9135ccb0 | [
"MIT"
] | 2 | 2017-12-18T18:43:03.000Z | 2017-12-21T05:57:44.000Z | server/online/views.py | MahjongRepository/mahjong-leaderboard | 77dfd26cb812c12fa7c2b11e862bb80a9135ccb0 | [
"MIT"
] | 11 | 2017-12-18T14:13:32.000Z | 2017-12-29T03:09:44.000Z | server/online/views.py | MahjongRepository/mahjong-leaderboard | 77dfd26cb812c12fa7c2b11e862bb80a9135ccb0 | [
"MIT"
] | null | null | null | import requests
from django.conf import settings
from django.contrib.auth.decorators import login_required, user_passes_test
from django.http import HttpResponse, JsonResponse
from django.shortcuts import redirect
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST... | 34.107143 | 118 | 0.711204 | import requests
from django.conf import settings
from django.contrib.auth.decorators import login_required, user_passes_test
from django.http import HttpResponse, JsonResponse
from django.shortcuts import redirect
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST... | true | true |
1c3a3bbe316cf268b71726bc53f47b1543c3363d | 71,375 | py | Python | codes/run.py | ling-cai/Time2Box | 7c6f7467a0341f7c979103121d54e2f911806a6d | [
"MIT"
] | 5 | 2021-11-15T15:02:50.000Z | 2022-03-24T05:09:32.000Z | codes/run.py | ling-cai/Time2Box | 7c6f7467a0341f7c979103121d54e2f911806a6d | [
"MIT"
] | 1 | 2021-12-13T11:53:35.000Z | 2022-03-27T11:57:52.000Z | codes/run.py | ling-cai/Time2Box | 7c6f7467a0341f7c979103121d54e2f911806a6d | [
"MIT"
] | 1 | 2021-12-26T02:24:28.000Z | 2021-12-26T02:24:28.000Z | #!/usr/bin/python3
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import json
import logging
import os
import random
import numpy as np
import torch
from torch.utils.data import DataLoader
from model import Query2box
from dataloader impo... | 49.531575 | 409 | 0.625639 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import json
import logging
import os
import random
import numpy as np
import torch
from torch.utils.data import DataLoader
from model import Query2box
from dataloader import *
from tensorbo... | true | true |
1c3a3bf0550e4e6d66a767186111e150c8e5f4f1 | 313 | py | Python | ghiblimovies/utils.py | mastizada/ghiblimovies | 578c007c6cf7c69efe817140abbc20172babcc07 | [
"MIT"
] | 1 | 2020-12-07T06:44:53.000Z | 2020-12-07T06:44:53.000Z | ghiblimovies/utils.py | mastizada/ghiblimovies | 578c007c6cf7c69efe817140abbc20172babcc07 | [
"MIT"
] | null | null | null | ghiblimovies/utils.py | mastizada/ghiblimovies | 578c007c6cf7c69efe817140abbc20172babcc07 | [
"MIT"
] | null | null | null | """Settings related utilities."""
import logging
class ErrorOnlyLogFilter(logging.Filter):
"""Log only error and critical messages."""
def filter(self, record) -> int:
if record.levelno == logging.ERROR or record.levelno == logging.CRITICAL:
return 1
return 0 # do not log
| 26.083333 | 81 | 0.654952 | import logging
class ErrorOnlyLogFilter(logging.Filter):
def filter(self, record) -> int:
if record.levelno == logging.ERROR or record.levelno == logging.CRITICAL:
return 1
return 0
| true | true |
1c3a3cb7e26b41972db9522157f8dce6ce0fe887 | 12,593 | py | Python | 0000_examples/hayakawa/research_posemake_many.py | takuya-ki/wrs | f6e1009b94332504042fbde9b39323410394ecde | [
"MIT"
] | null | null | null | 0000_examples/hayakawa/research_posemake_many.py | takuya-ki/wrs | f6e1009b94332504042fbde9b39323410394ecde | [
"MIT"
] | null | null | null | 0000_examples/hayakawa/research_posemake_many.py | takuya-ki/wrs | f6e1009b94332504042fbde9b39323410394ecde | [
"MIT"
] | null | null | null | #### Program for my research
#### generate many pose of graspping in both hands(for pulling rope) and pushing in left hand(for pushing object)
import visualization.panda.world as wd
import robot_sim.end_effectors.gripper.robotiq85.robotiq85 as rtq85
import robot_sim.robots.ur3_dual.ur3_dual as rbts
import modeling.geom... | 60.543269 | 131 | 0.516636 | bt = rbts.UR3Dual()
predefined_grasps_lft = []
handdirect_lft = []
loc_z = np.array([0, -1, 0])
rotmat = rm.rotmat_from_axangle(loc_z, math.radians(-90))
predefined_grasps_lft.append(
self.rtq85.grip_at_with_jczy(np.array([.005, .005, .005]),
... | true | true |
1c3a3d18ef39765ccdf48c27ecefef9d665a9b9e | 2,846 | py | Python | tests/test_tokenization_barthez.py | syskn/transformers | fafbd2574cb12b987099f69b3821814042d8f4ce | [
"Apache-2.0"
] | 39 | 2021-04-30T06:06:30.000Z | 2022-03-12T11:56:06.000Z | tests/test_tokenization_barthez.py | slavetothebiologicalforce/transformers | 6f90c29eaaba898919b7689ab7e2cfce1604cdb8 | [
"Apache-2.0"
] | 3 | 2021-07-22T15:49:44.000Z | 2022-03-19T08:46:27.000Z | tests/test_tokenization_barthez.py | slavetothebiologicalforce/transformers | 6f90c29eaaba898919b7689ab7e2cfce1604cdb8 | [
"Apache-2.0"
] | 30 | 2021-04-30T07:11:22.000Z | 2022-03-15T19:34:58.000Z | # coding=utf-8
# Copyright 2020 Ecole Polytechnique and HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | 36.487179 | 109 | 0.732607 |
import unittest
from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow
from .test_tokenization_common import TokenizerTesterMixin
@require_tokenizers
@require_sentencepiece
@... | true | true |
1c3a3d38084a2b91b56a632ea7a831e5bae3c2b6 | 3,569 | py | Python | bindings/python/ensmallen/datasets/string/alligatormississippiensis.py | AnacletoLAB/ensmallen_graph | b2c1b18fb1e5801712852bcc239f239e03076f09 | [
"MIT"
] | 5 | 2021-02-17T00:44:45.000Z | 2021-08-09T16:41:47.000Z | bindings/python/ensmallen/datasets/string/alligatormississippiensis.py | AnacletoLAB/ensmallen_graph | b2c1b18fb1e5801712852bcc239f239e03076f09 | [
"MIT"
] | 18 | 2021-01-07T16:47:39.000Z | 2021-08-12T21:51:32.000Z | bindings/python/ensmallen/datasets/string/alligatormississippiensis.py | AnacletoLAB/ensmallen | b2c1b18fb1e5801712852bcc239f239e03076f09 | [
"MIT"
] | 3 | 2021-01-14T02:20:59.000Z | 2021-08-04T19:09:52.000Z | """
This file offers the methods to automatically retrieve the graph Alligator mississippiensis.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--pro... | 33.046296 | 223 | 0.679462 | from typing import Dict
from ..automatic_graph_retrieval import AutomaticallyRetrievedGraph
from ...ensmallen import Graph
def AlligatorMississippiensis(
directed: bool = False,
preprocess: bool = True,
load_nodes: bool = True,
verbose: int = 2,
cache: bool = True,
cache_path: str = "graphs... | true | true |
1c3a3d74f72923d9565f38cb6c8d05cb17dc3bb1 | 2,911 | py | Python | olo/sql_ast_translators/sql_ast_translator.py | Watch-Later/olo | c8bbdfffb64a9766df51a462a119a879c9030a4a | [
"Apache-2.0"
] | 81 | 2018-03-08T11:07:33.000Z | 2022-01-18T10:19:46.000Z | olo/sql_ast_translators/sql_ast_translator.py | Watch-Later/olo | c8bbdfffb64a9766df51a462a119a879c9030a4a | [
"Apache-2.0"
] | 40 | 2018-07-04T09:22:34.000Z | 2021-09-03T09:30:02.000Z | olo/sql_ast_translators/sql_ast_translator.py | Watch-Later/olo | c8bbdfffb64a9766df51a462a119a879c9030a4a | [
"Apache-2.0"
] | 13 | 2018-03-19T10:34:24.000Z | 2022-01-18T10:19:49.000Z | from typing import List, Dict, Tuple, Iterable, Optional
from olo.compat import iteritems
from olo.context import context, table_alias_mapping_context, in_sql_translation_context
from olo.errors import ORMError
from olo.utils import car, cdr, is_sql_ast, friendly_repr
AST = List
MODIFY_OPERATES = frozenset({'INSERT... | 34.247059 | 111 | 0.642734 | from typing import List, Dict, Tuple, Iterable, Optional
from olo.compat import iteritems
from olo.context import context, table_alias_mapping_context, in_sql_translation_context
from olo.errors import ORMError
from olo.utils import car, cdr, is_sql_ast, friendly_repr
AST = List
MODIFY_OPERATES = frozenset({'INSERT... | true | true |
1c3a3dc8941b85ed1f41493eeb9f2e2873e45e04 | 598 | py | Python | DelibeRating/DelibeRating/deliberating-env/Lib/site-packages/etc/tests/testapp/admin.py | Severose/DelibeRating | 5d227f35c071477ce3fd6fbf3ab13a44d13f6e08 | [
"MIT"
] | 25 | 2015-02-07T15:42:06.000Z | 2022-03-26T02:28:06.000Z | DelibeRating/DelibeRating/deliberating-env/Lib/site-packages/etc/tests/testapp/admin.py | Severose/DelibeRating | 5d227f35c071477ce3fd6fbf3ab13a44d13f6e08 | [
"MIT"
] | 3 | 2017-01-06T20:34:13.000Z | 2021-05-11T02:24:22.000Z | DelibeRating/DelibeRating/deliberating-env/Lib/site-packages/etc/tests/testapp/admin.py | Severose/DelibeRating | 5d227f35c071477ce3fd6fbf3ab13a44d13f6e08 | [
"MIT"
] | 2 | 2016-07-28T01:54:13.000Z | 2017-02-13T20:55:19.000Z | from django.db import models
from etc.admin import CustomModelPage
class MyPage1(CustomModelPage):
title = 'Test page 1'
my_field = models.CharField('some title', max_length=10)
def save(self):
self.bound_admin.message_warning(self.bound_request, f'test1:{self.my_field}')
super().save()... | 22.148148 | 92 | 0.714047 | from django.db import models
from etc.admin import CustomModelPage
class MyPage1(CustomModelPage):
title = 'Test page 1'
my_field = models.CharField('some title', max_length=10)
def save(self):
self.bound_admin.message_warning(self.bound_request, f'test1:{self.my_field}')
super().save()... | true | true |
1c3a4095740a592fece27812a684d2535bae4edc | 3,227 | py | Python | rl_algorithms/common/abstract/her.py | mshukor/DSACfD | b7c4d7f4b586721b4d0409de11e46f308bcd9edc | [
"MIT"
] | 466 | 2019-02-14T15:06:01.000Z | 2022-03-28T03:08:10.000Z | rl_algorithms/common/abstract/her.py | SongsLearning/rl_algorithms | 65e4e73257d2295e7df2044332d8c75aa7b51e5d | [
"MIT"
] | 138 | 2019-02-15T05:44:17.000Z | 2021-12-15T06:00:55.000Z | rl_algorithms/common/abstract/her.py | SongsLearning/rl_algorithms | 65e4e73257d2295e7df2044332d8c75aa7b51e5d | [
"MIT"
] | 86 | 2019-02-25T15:52:29.000Z | 2022-03-08T06:30:36.000Z | # -*- coding: utf-8 -*-
"""Abstract class used for Hindsight Experience Replay.
- Author: Kyunghwan Kim
- Contact: kh.kim@medipixel.io
- Paper: https://arxiv.org/pdf/1707.01495.pdf
"""
from abc import ABC, abstractmethod
from typing import Callable, Tuple
import numpy as np
class HER(ABC):
"""Abstract class fo... | 32.27 | 86 | 0.662845 |
from abc import ABC, abstractmethod
from typing import Callable, Tuple
import numpy as np
class HER(ABC):
def __init__(self, reward_fn: Callable[[tuple, np.ndarray], np.float64]):
self.reward_fn = reward_fn
@abstractmethod
def fetch_desired_states_from_demo(self, demo: list):
pass
... | true | true |
1c3a40be637f81ad610efb0815da940337be35e6 | 781 | py | Python | test/test_del_project.py | avshliakhau/Selenium_python_mantis | 46f31b906b33d01cade3c90a0c226af90733010b | [
"Apache-2.0"
] | 1 | 2020-05-15T13:11:50.000Z | 2020-05-15T13:11:50.000Z | test/test_del_project.py | avshliakhau/Selenium_python_mantis | 46f31b906b33d01cade3c90a0c226af90733010b | [
"Apache-2.0"
] | null | null | null | test/test_del_project.py | avshliakhau/Selenium_python_mantis | 46f31b906b33d01cade3c90a0c226af90733010b | [
"Apache-2.0"
] | null | null | null | import random
def test_delete_project(app):
app.session.login('administrator', 'root')
app.project.manage_project_page()
old_project_list = app.project.get_projects_list()
if len(old_project_list) == 0:
app.project.create_project('first_project_for_del')
old_project_list = app.project.get_... | 41.105263 | 63 | 0.741357 | import random
def test_delete_project(app):
app.session.login('administrator', 'root')
app.project.manage_project_page()
old_project_list = app.project.get_projects_list()
if len(old_project_list) == 0:
app.project.create_project('first_project_for_del')
old_project_list = app.project.get_... | true | true |
1c3a417820e4d995e1d0553f35095c4694858147 | 2,824 | py | Python | route/main_sys_update.py | k0000k/openNAMU | b5862a7e5a1f1a2a6bee5eec5b3d9784528f42e8 | [
"BSD-3-Clause"
] | 3 | 2018-10-06T09:02:34.000Z | 2018-10-20T02:42:31.000Z | route/main_sys_update.py | k0000k/openNAMU | b5862a7e5a1f1a2a6bee5eec5b3d9784528f42e8 | [
"BSD-3-Clause"
] | 42 | 2018-09-16T16:30:54.000Z | 2018-11-24T17:45:08.000Z | route/main_sys_update.py | k0000k/openNAMU | b5862a7e5a1f1a2a6bee5eec5b3d9784528f42e8 | [
"BSD-3-Clause"
] | 6 | 2018-09-23T12:29:19.000Z | 2018-11-24T17:31:35.000Z | from .tool.func import *
def main_sys_update():
with get_db_connect() as conn:
curs = conn.cursor()
if admin_check() != 1:
return re_error('/error/3')
if flask.request.method == 'POST':
admin_check(None, 'update')
curs.execute(db_change('select data fr... | 44.125 | 149 | 0.465652 | from .tool.func import *
def main_sys_update():
with get_db_connect() as conn:
curs = conn.cursor()
if admin_check() != 1:
return re_error('/error/3')
if flask.request.method == 'POST':
admin_check(None, 'update')
curs.execute(db_change('select data fr... | true | true |
1c3a419999da0291bb997fb3bd1ed2459b4b34e0 | 2,913 | py | Python | tests/contrib/djangorestframework/app/settings.py | thehesiod/dd-trace-py | 5af9b51b7a063e25937532d95d79d046dd65d313 | [
"BSD-3-Clause"
] | null | null | null | tests/contrib/djangorestframework/app/settings.py | thehesiod/dd-trace-py | 5af9b51b7a063e25937532d95d79d046dd65d313 | [
"BSD-3-Clause"
] | null | null | null | tests/contrib/djangorestframework/app/settings.py | thehesiod/dd-trace-py | 5af9b51b7a063e25937532d95d79d046dd65d313 | [
"BSD-3-Clause"
] | null | null | null | """
Settings configuration for the Django web framework. Update this
configuration if you need to change the default behavior of
Django during tests
"""
import os
import django
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.... | 28.558824 | 73 | 0.683831 | import os
import django
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
}
}
SITE_ID = 1
SECRET_KEY = 'not_very_secret_in_tests'
USE_I18N = True
USE_L10N = True
STATIC_URL = '/static/'... | true | true |
1c3a423eddbce0a305e4169514c9b92f0faf8860 | 87 | py | Python | tcn/__init__.py | evanharwin/keras-tcn | 81706eaabc069ad27a1786625bbf731b247bf2f0 | [
"MIT"
] | 1,473 | 2018-03-22T11:57:25.000Z | 2022-03-31T02:49:58.000Z | tcn/__init__.py | gf9619/keras-tcn | 078901b98e8538b85b5d40953ca8fc52ad9274e0 | [
"MIT"
] | 177 | 2018-04-05T04:28:55.000Z | 2022-03-19T13:26:57.000Z | tcn/__init__.py | gf9619/keras-tcn | 078901b98e8538b85b5d40953ca8fc52ad9274e0 | [
"MIT"
] | 414 | 2018-03-23T06:36:44.000Z | 2022-03-29T11:07:00.000Z | from tcn.tcn import TCN, compiled_tcn, tcn_full_summary # noqa
__version__ = '3.4.0'
| 21.75 | 63 | 0.747126 | from tcn.tcn import TCN, compiled_tcn, tcn_full_summary
__version__ = '3.4.0'
| true | true |
1c3a43b4ffbf86a61135f36ca6445d9dd3b83602 | 490 | py | Python | api_tests/test_rigid.py | AmirAlavi/scipr | 5807b8648526e41c2db413783c76fa33331cc710 | [
"BSD-3-Clause"
] | 3 | 2020-05-14T15:54:38.000Z | 2020-09-08T05:52:50.000Z | api_tests/test_rigid.py | AmirAlavi/scipr | 5807b8648526e41c2db413783c76fa33331cc710 | [
"BSD-3-Clause"
] | 4 | 2020-05-14T18:52:53.000Z | 2021-11-25T03:56:08.000Z | api_tests/test_rigid.py | AmirAlavi/scipr | 5807b8648526e41c2db413783c76fa33331cc710 | [
"BSD-3-Clause"
] | 1 | 2020-05-21T21:42:55.000Z | 2020-05-21T21:42:55.000Z | import numpy as np
import scipr
from scipr.matching import Closest, Hungarian, Greedy, MNN
from scipr.transform import Affine, Rigid, StackedAutoEncoder
np.random.seed(1817)
A = np.random.random((10, 100))
B = np.random.random((20, 100))
matchers = [Closest(), Greedy(), Hungarian(), MNN()]
for match in matchers:
... | 23.333333 | 61 | 0.697959 | import numpy as np
import scipr
from scipr.matching import Closest, Hungarian, Greedy, MNN
from scipr.transform import Affine, Rigid, StackedAutoEncoder
np.random.seed(1817)
A = np.random.random((10, 100))
B = np.random.random((20, 100))
matchers = [Closest(), Greedy(), Hungarian(), MNN()]
for match in matchers:
... | true | true |
1c3a445ce197f1245eff9b6909c263aa0524f7e5 | 3,566 | py | Python | labelbox2coco.py | telecombcn-dl/2018-dlcv-team5 | b863497b157a8981774053be2d1c4581537eeb39 | [
"MIT"
] | 1 | 2019-11-25T14:51:37.000Z | 2019-11-25T14:51:37.000Z | labelbox2coco.py | telecombcn-dl/2018-dlcv-team5 | b863497b157a8981774053be2d1c4581537eeb39 | [
"MIT"
] | null | null | null | labelbox2coco.py | telecombcn-dl/2018-dlcv-team5 | b863497b157a8981774053be2d1c4581537eeb39 | [
"MIT"
] | null | null | null | import json
import datetime as dt
import logging
from shapely import wkt
import requests
from PIL import Image
import argparse
def from_json(labeled_data, coco_output):
# read labelbox JSON output
with open(labeled_data, 'r') as f:
lines = f.readlines()
label_data = json.loads(lines[0])
#... | 31.557522 | 70 | 0.509534 | import json
import datetime as dt
import logging
from shapely import wkt
import requests
from PIL import Image
import argparse
def from_json(labeled_data, coco_output):
with open(labeled_data, 'r') as f:
lines = f.readlines()
label_data = json.loads(lines[0])
coco = {
'info'... | true | true |
1c3a44999283116102c52580b1cac353698c5e09 | 17,160 | py | Python | openstack_dashboard/dashboards/project/images/images/forms.py | vanduc95/Horizon | 90d7a3f79fe3e585bdf36cef660d092797ae5e1f | [
"Apache-2.0"
] | null | null | null | openstack_dashboard/dashboards/project/images/images/forms.py | vanduc95/Horizon | 90d7a3f79fe3e585bdf36cef660d092797ae5e1f | [
"Apache-2.0"
] | null | null | null | openstack_dashboard/dashboards/project/images/images/forms.py | vanduc95/Horizon | 90d7a3f79fe3e585bdf36cef660d092797ae5e1f | [
"Apache-2.0"
] | null | null | null | # Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | 41.853659 | 79 | 0.574184 |
from django.conf import settings
from django.core import validators
from django.forms import ValidationError
from django.forms.widgets import HiddenInput
from django.template import defaultfilters
from django.utils.translation import ugettext_lazy as _
import six
from horizon import exceptions
f... | true | true |
1c3a44e442b479f968e651f2621f7c4f3e9a013d | 3,041 | py | Python | dmripreproc/workflows/dwi/outputs.py | slimnsour/dmripreproc | a1e4482baf1c9c7dfb3593126ffa448f075dc26c | [
"BSD-3-Clause"
] | 1 | 2019-07-31T15:32:27.000Z | 2019-07-31T15:32:27.000Z | dmripreproc/workflows/dwi/outputs.py | slimnsour/dmripreproc | a1e4482baf1c9c7dfb3593126ffa448f075dc26c | [
"BSD-3-Clause"
] | 5 | 2019-07-29T14:25:18.000Z | 2019-07-29T15:51:12.000Z | dmripreproc/workflows/dwi/outputs.py | slimnsour/dmripreproc | a1e4482baf1c9c7dfb3593126ffa448f075dc26c | [
"BSD-3-Clause"
] | 2 | 2019-07-25T20:52:36.000Z | 2020-01-09T20:58:41.000Z | #!/usr/bin/env python
import os
from nipype.pipeline import engine as pe
from nipype.interfaces import io as nio, utility as niu
def init_output_wf(subject_id, session_id, output_folder):
op_wf = pe.Workflow(name="output_wf")
inputnode = pe.Node(
niu.IdentityInterface(
fields=[
... | 29.813725 | 70 | 0.430779 |
import os
from nipype.pipeline import engine as pe
from nipype.interfaces import io as nio, utility as niu
def init_output_wf(subject_id, session_id, output_folder):
op_wf = pe.Workflow(name="output_wf")
inputnode = pe.Node(
niu.IdentityInterface(
fields=[
"subject_id"... | true | true |
1c3a450d5e61cb10eebdcd014cc1a9857f4dbaed | 1,169 | py | Python | T08/ex06.py | mariogarcc/comphy | 3ab05a07dfa2eb8a1165fca1bdfd9bda6c8e27d3 | [
"CC0-1.0"
] | null | null | null | T08/ex06.py | mariogarcc/comphy | 3ab05a07dfa2eb8a1165fca1bdfd9bda6c8e27d3 | [
"CC0-1.0"
] | null | null | null | T08/ex06.py | mariogarcc/comphy | 3ab05a07dfa2eb8a1165fca1bdfd9bda6c8e27d3 | [
"CC0-1.0"
] | null | null | null | from package import redact_ex
from package import solve_implicit_ode
import numpy as np
EXERCISE_6 = """\
Make a program that is able to graphically solve the previous equation
using the Crank-Nicolson scheme.\
"""
redact_ex(EXERCISE_6, 6)
slices = 20
itern = 1000
plot_frequency = 0.05
deltat = 1e-3
deltax = 1e... | 19.813559 | 75 | 0.619333 | from package import redact_ex
from package import solve_implicit_ode
import numpy as np
EXERCISE_6 = """\
Make a program that is able to graphically solve the previous equation
using the Crank-Nicolson scheme.\
"""
redact_ex(EXERCISE_6, 6)
slices = 20
itern = 1000
plot_frequency = 0.05
deltat = 1e-3
deltax = 1e... | true | true |
1c3a457ace03d74282abb93f03643ca8e19a8731 | 3,196 | py | Python | databinding/databinding/settings.py | fp4code/channels-examples | 1a7ed1c5b652e6db07206b1f27d7fef249433f2e | [
"BSD-3-Clause"
] | 2 | 2016-10-20T10:15:24.000Z | 2017-07-13T08:14:37.000Z | databinding/databinding/settings.py | fp4code/channels-examples | 1a7ed1c5b652e6db07206b1f27d7fef249433f2e | [
"BSD-3-Clause"
] | null | null | null | databinding/databinding/settings.py | fp4code/channels-examples | 1a7ed1c5b652e6db07206b1f27d7fef249433f2e | [
"BSD-3-Clause"
] | 2 | 2017-02-18T16:55:19.000Z | 2019-11-08T00:49:22.000Z | """
Django settings for databinding project.
Generated by 'django-admin startproject' using Django 1.10.dev20151126161447.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settin... | 27.551724 | 106 | 0.691489 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'imasecret'
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django... | true | true |
1c3a45d7bc09c18f7e86ab78c998cc3994f08e87 | 1,460 | py | Python | fastapi/app/api/routes/auth/jwt.py | ais-one/favv | a73016dd9f44d7df59a33721ba961d2c66781ac6 | [
"MIT"
] | 19 | 2021-03-10T09:19:22.000Z | 2022-03-17T08:52:06.000Z | fastapi/app/api/routes/auth/jwt.py | ais-one/favv | a73016dd9f44d7df59a33721ba961d2c66781ac6 | [
"MIT"
] | null | null | null | fastapi/app/api/routes/auth/jwt.py | ais-one/favv | a73016dd9f44d7df59a33721ba961d2c66781ac6 | [
"MIT"
] | 5 | 2021-06-13T19:28:18.000Z | 2022-01-20T03:30:13.000Z | from jose import jwt
from fastapi import APIRouter, HTTPException, Depends
from fastapi.responses import JSONResponse
from config import get_settings
from services.auth import auth_user, create_token
router = APIRouter(
prefix="/jwt-test",
tags=["api_jwt-test"],
# dependencies=[Depends(get_token_header)],
res... | 33.953488 | 95 | 0.723288 | from jose import jwt
from fastapi import APIRouter, HTTPException, Depends
from fastapi.responses import JSONResponse
from config import get_settings
from services.auth import auth_user, create_token
router = APIRouter(
prefix="/jwt-test",
tags=["api_jwt-test"],
responses={404: {"description": "Not found"}},... | true | true |
1c3a4602fdc92cb51e6fef5cd663c0d8996dccd1 | 419 | py | Python | ruptures/__init__.py | sharkls/ruptures | 0e94e5770a54bb840461d1834fb49858576cf38d | [
"BSD-2-Clause"
] | 1 | 2021-01-08T02:20:13.000Z | 2021-01-08T02:20:13.000Z | ruptures/__init__.py | sharkls/ruptures | 0e94e5770a54bb840461d1834fb49858576cf38d | [
"BSD-2-Clause"
] | null | null | null | ruptures/__init__.py | sharkls/ruptures | 0e94e5770a54bb840461d1834fb49858576cf38d | [
"BSD-2-Clause"
] | null | null | null | """
Offline change point detection for Python
====================================================================================================
"""
from .exceptions import NotEnoughPoints
from .datasets import pw_constant, pw_normal, pw_linear, pw_wavy
from .detection import (
Binseg,
BottomUp,
Dynp,
... | 20.95 | 100 | 0.52506 |
from .exceptions import NotEnoughPoints
from .datasets import pw_constant, pw_normal, pw_linear, pw_wavy
from .detection import (
Binseg,
BottomUp,
Dynp,
Omp,
OmpK,
Pelt,
Window,
GreedyAR,
GreedyLinear,
)
from .show import display
| true | true |
1c3a46f7cd0cf3a423d92a2f22012e957a90a672 | 373 | py | Python | tests/base_integration_test.py | CGJackson/Compi | 9fe2a316e9dbe54b01ee274417a07a13f4f990b0 | [
"MIT"
] | null | null | null | tests/base_integration_test.py | CGJackson/Compi | 9fe2a316e9dbe54b01ee274417a07a13f4f990b0 | [
"MIT"
] | null | null | null | tests/base_integration_test.py | CGJackson/Compi | 9fe2a316e9dbe54b01ee274417a07a13f4f990b0 | [
"MIT"
] | null | null | null | import abc
import unittest
class IntegrationRoutineTestsBase(abc.ABC, unittest.TestCase):
@abc.abstractclassmethod
def routine_to_test(self,f,*args,**kwargs):
pass
@abc.abstractclassmethod
def func(self,x):
pass
def setUp(self):
self.default_range = ()
self.positio... | 23.3125 | 62 | 0.662198 | import abc
import unittest
class IntegrationRoutineTestsBase(abc.ABC, unittest.TestCase):
@abc.abstractclassmethod
def routine_to_test(self,f,*args,**kwargs):
pass
@abc.abstractclassmethod
def func(self,x):
pass
def setUp(self):
self.default_range = ()
self.positio... | true | true |
1c3a4851e27f6d4a60b97e3240ae8d2cc68b4522 | 8,398 | py | Python | lib/iugu/merchant.py | wesleywillians/iugu-python | 06b86c3ed655e3474d675b2d6abcee4d31c0bcf4 | [
"Apache-2.0"
] | null | null | null | lib/iugu/merchant.py | wesleywillians/iugu-python | 06b86c3ed655e3474d675b2d6abcee4d31c0bcf4 | [
"Apache-2.0"
] | null | null | null | lib/iugu/merchant.py | wesleywillians/iugu-python | 06b86c3ed655e3474d675b2d6abcee4d31c0bcf4 | [
"Apache-2.0"
] | 1 | 2019-12-07T09:25:13.000Z | 2019-12-07T09:25:13.000Z | # coding: utf-8
import httplib
import json
from urllib import urlencode
from urllib2 import urlopen, Request
# python-iugu package modules
import base, config
class IuguMerchant(base.IuguApi):
def __init__(self, **kwargs):
super(IuguMerchant, self).__init__(**kwargs)
self.__conn = base.IuguRequ... | 29.992857 | 96 | 0.590855 |
import httplib
import json
from urllib import urlencode
from urllib2 import urlopen, Request
import base, config
class IuguMerchant(base.IuguApi):
def __init__(self, **kwargs):
super(IuguMerchant, self).__init__(**kwargs)
self.__conn = base.IuguRequests()
def create_payment_token(self, c... | true | true |
1c3a485eb10e14f69469cc20da1392cebdc72b1f | 705 | py | Python | src/tp_part_1.0/sawtooth_part/exceptions.py | jlee7x2/SParts | fd39e491d0433a7429c5fdb037d5826d7f34b291 | [
"Apache-2.0"
] | 12 | 2018-08-29T23:19:48.000Z | 2021-11-18T19:09:21.000Z | src/tp_part_1.0/sawtooth_part/exceptions.py | jlee7x2/SParts | fd39e491d0433a7429c5fdb037d5826d7f34b291 | [
"Apache-2.0"
] | 18 | 2018-07-13T22:37:44.000Z | 2020-02-20T19:22:14.000Z | src/tp_part_1.0/sawtooth_part/exceptions.py | jlee7x2/SParts | fd39e491d0433a7429c5fdb037d5826d7f34b291 | [
"Apache-2.0"
] | 16 | 2018-03-12T21:52:02.000Z | 2021-07-13T20:46:10.000Z | # Copyright 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | 37.105263 | 80 | 0.675177 |
class PartException(Exception):
pass
| true | true |
1c3a4983f62f57fe9d222b4090dfe1beb3839a73 | 26,395 | py | Python | tests/unit/modules/postgres_test.py | topochan/salt | 87d1a7327aee0388e2a5ff3555d8113d974ed11f | [
"Apache-2.0"
] | 1 | 2018-02-03T17:30:56.000Z | 2018-02-03T17:30:56.000Z | tests/unit/modules/postgres_test.py | topochan/salt | 87d1a7327aee0388e2a5ff3555d8113d974ed11f | [
"Apache-2.0"
] | null | null | null | tests/unit/modules/postgres_test.py | topochan/salt | 87d1a7327aee0388e2a5ff3555d8113d974ed11f | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Import python libs
from __future__ import print_function
# Import Salt Testing libs
from salttesting import skipIf, TestCase
from salttesting.helpers import ensure_in_syspath
from salttesting.mock import NO_MOCK, NO_MOCK_REASON, Mock, patch
import re
ensure_in_syspath('../../')
# Import sa... | 39.513473 | 81 | 0.55018 |
from __future__ import print_function
from salttesting import skipIf, TestCase
from salttesting.helpers import ensure_in_syspath
from salttesting.mock import NO_MOCK, NO_MOCK_REASON, Mock, patch
import re
ensure_in_syspath('../../')
from salt.modules import postgres
postgres.__grains__ = None
postgres.__salt... | true | true |
1c3a4a557a20261febd8cee212907d3137fcfe6a | 25,108 | py | Python | salt/states/lxc.py | Rafflecopter/salt | 08bbfcd4d9b93351d7d5d25b097e892026b6f1cd | [
"Apache-2.0"
] | null | null | null | salt/states/lxc.py | Rafflecopter/salt | 08bbfcd4d9b93351d7d5d25b097e892026b6f1cd | [
"Apache-2.0"
] | null | null | null | salt/states/lxc.py | Rafflecopter/salt | 08bbfcd4d9b93351d7d5d25b097e892026b6f1cd | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
'''
Manage Linux Containers
=======================
'''
from __future__ import absolute_import
__docformat__ = 'restructuredtext en'
# Import salt libs
import salt.utils
from salt.exceptions import CommandExecutionError, SaltInvocationError
# Container existence/non-existence
def present(nam... | 32.692708 | 79 | 0.516329 |
from __future__ import absolute_import
__docformat__ = 'restructuredtext en'
import salt.utils
from salt.exceptions import CommandExecutionError, SaltInvocationError
def present(name,
running=None,
clone_from=None,
snapshot=False,
profile=None,
network_... | true | true |
1c3a4a9ecf45957ca1fd0bd81838024cb663b852 | 760 | py | Python | env/lib/python3.8/site-packages/plotly/validators/bar/marker/colorbar/tickformatstop/_dtickrange.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 76 | 2020-07-06T14:44:05.000Z | 2022-02-14T15:30:21.000Z | env/lib/python3.8/site-packages/plotly/validators/bar/marker/colorbar/tickformatstop/_dtickrange.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 11 | 2020-08-09T02:30:14.000Z | 2022-03-12T00:50:14.000Z | env/lib/python3.8/site-packages/plotly/validators/bar/marker/colorbar/tickformatstop/_dtickrange.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 11 | 2020-07-12T16:18:07.000Z | 2022-02-05T16:48:35.000Z | import _plotly_utils.basevalidators
class DtickrangeValidator(_plotly_utils.basevalidators.InfoArrayValidator):
def __init__(
self,
plotly_name="dtickrange",
parent_name="bar.marker.colorbar.tickformatstop",
**kwargs
):
super(DtickrangeValidator, self).__init__(
... | 30.4 | 75 | 0.528947 | import _plotly_utils.basevalidators
class DtickrangeValidator(_plotly_utils.basevalidators.InfoArrayValidator):
def __init__(
self,
plotly_name="dtickrange",
parent_name="bar.marker.colorbar.tickformatstop",
**kwargs
):
super(DtickrangeValidator, self).__init__(
... | true | true |
1c3a4bc9c155c07eb7becf3416087da757885227 | 773,430 | py | Python | ncs/db.py | 5monkeys/python-ncs | 545bae118c5c69ed3ac4c59e6dcc0a6fca1c4571 | [
"MIT"
] | 3 | 2019-04-08T05:52:51.000Z | 2021-11-19T08:44:30.000Z | ncs/db.py | 5monkeys/python-ncs | 545bae118c5c69ed3ac4c59e6dcc0a6fca1c4571 | [
"MIT"
] | 3 | 2016-09-02T07:30:45.000Z | 2021-11-15T17:47:10.000Z | ncs/db.py | 5monkeys/python-ncs | 545bae118c5c69ed3ac4c59e6dcc0a6fca1c4571 | [
"MIT"
] | null | null | null | # encoding: utf-8
# Auto-generated, do not edit
colors = [
(u'IRIS 8', 'D1DEDD'),
(u'MAROC 17C', 'F2E1CC'),
(u'APRIKOSE 12C', 'EA9243'),
(u'200 80 20', '94D0CF'),
(u'S 4550-G60Y', '746B1A'),
(u'TÅRN', '758080'),
(u'G8.30.70', 'C7BE6F'),
(u'PUTS GUL 5', 'C89460'),
(u'HOLMESTRAND', 'ED... | 28.690185 | 42 | 0.470476 |
colors = [
(u'IRIS 8', 'D1DEDD'),
(u'MAROC 17C', 'F2E1CC'),
(u'APRIKOSE 12C', 'EA9243'),
(u'200 80 20', '94D0CF'),
(u'S 4550-G60Y', '746B1A'),
(u'TÅRN', '758080'),
(u'G8.30.70', 'C7BE6F'),
(u'PUTS GUL 5', 'C89460'),
(u'HOLMESTRAND', 'EDECD9'),
(u'WN.00.63', 'ABAAAA'),
(u'C7... | true | true |
1c3a4d0cf8187cd80fc3242ca06913159fef2118 | 467 | py | Python | src/teams/migrations/0006_auto_20200712_1641.py | sfernandezf/analytics-yahoofantasy | 6242599b903e4b8a7f9c56892ba26591a441b8fb | [
"Apache-2.0"
] | null | null | null | src/teams/migrations/0006_auto_20200712_1641.py | sfernandezf/analytics-yahoofantasy | 6242599b903e4b8a7f9c56892ba26591a441b8fb | [
"Apache-2.0"
] | 6 | 2020-03-15T03:32:06.000Z | 2022-01-13T03:46:05.000Z | src/teams/migrations/0006_auto_20200712_1641.py | sfernandezf/analytics-yahoofantasy | 6242599b903e4b8a7f9c56892ba26591a441b8fb | [
"Apache-2.0"
] | null | null | null | # Generated by Django 3.0.3 on 2020-07-12 16:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('teams', '0005_auto_20200712_1553'),
]
operations = [
migrations.AlterField(
model_name='yahoomultileagueteam',
name=... | 24.578947 | 120 | 0.640257 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('teams', '0005_auto_20200712_1553'),
]
operations = [
migrations.AlterField(
model_name='yahoomultileagueteam',
name='teams',
field=models.ManyToManyFie... | true | true |
1c3a4d3e4f12d05c6794562eefe79d3649fef507 | 5,869 | py | Python | src/corpus/reader.py | amillert/pic2story | efa0c7c966392b4efb88ae370d8eb78cd2ab062b | [
"MIT"
] | 3 | 2020-09-27T21:25:01.000Z | 2021-02-14T14:12:04.000Z | src/corpus/reader.py | amillert/pic2story | efa0c7c966392b4efb88ae370d8eb78cd2ab062b | [
"MIT"
] | 15 | 2020-09-26T10:52:56.000Z | 2020-11-15T08:19:12.000Z | src/corpus/reader.py | amillert/pic2story | efa0c7c966392b4efb88ae370d8eb78cd2ab062b | [
"MIT"
] | null | null | null | """
Module implementing the Reader class
"""
from collections import Counter
import os
import pickle
import re
from src.corpus.preprocess.corpus_data import CorpusData
from src.helper import paths_generator as pgen
END_OF_GUTEN = "\n*End of Project Gutenberg(.|\n)*"
FROM_TABLE_OF_CONTENTS = "(^.{0,4}[0-9].*\n*)+(.|\... | 34.321637 | 93 | 0.54183 |
from collections import Counter
import os
import pickle
import re
from src.corpus.preprocess.corpus_data import CorpusData
from src.helper import paths_generator as pgen
END_OF_GUTEN = "\n*End of Project Gutenberg(.|\n)*"
FROM_TABLE_OF_CONTENTS = "(^.{0,4}[0-9].*\n*)+(.|\n)*"
AFTER_THE_END = "((THE END)|(The end)|(T... | true | true |
1c3a4ebbe7d60505293978f1a5255c7a7e2147e9 | 1,043 | py | Python | src/UQpy/__init__.py | marrov/UQpy | b04a267b3080e3d4d38e876547ba0d3b979734f3 | [
"MIT"
] | 132 | 2018-03-13T13:56:33.000Z | 2022-03-21T13:59:17.000Z | src/UQpy/__init__.py | marrov/UQpy | b04a267b3080e3d4d38e876547ba0d3b979734f3 | [
"MIT"
] | 140 | 2018-05-21T13:40:01.000Z | 2022-03-29T14:18:01.000Z | src/UQpy/__init__.py | marrov/UQpy | b04a267b3080e3d4d38e876547ba0d3b979734f3 | [
"MIT"
] | 61 | 2018-05-02T13:40:05.000Z | 2022-03-06T11:31:21.000Z | """
Uncertainty Quantification with Python
========================================
"""
import pkg_resources
import UQpy.Distributions
import UQpy.SampleMethods
import UQpy.DimensionReduction
import UQpy.Inference
import UQpy.Reliability
import UQpy.RunModel
import UQpy.SampleMethods
import UQpy.StochasticProcess
imp... | 24.833333 | 64 | 0.790988 |
import pkg_resources
import UQpy.Distributions
import UQpy.SampleMethods
import UQpy.DimensionReduction
import UQpy.Inference
import UQpy.Reliability
import UQpy.RunModel
import UQpy.SampleMethods
import UQpy.StochasticProcess
import UQpy.Surrogates
import UQpy.Sensitivity
import UQpy.Transformations
import UQpy.Util... | true | true |
1c3a5319a9e2f955caf7dd2d1ca5fa42ac6dd3c8 | 2,226 | py | Python | Main App/app/main.py | Rathore25/Sapiens-QA | 0bf794784c3a3b26b541dbc2fa894756c979e5c4 | [
"MIT"
] | null | null | null | Main App/app/main.py | Rathore25/Sapiens-QA | 0bf794784c3a3b26b541dbc2fa894756c979e5c4 | [
"MIT"
] | null | null | null | Main App/app/main.py | Rathore25/Sapiens-QA | 0bf794784c3a3b26b541dbc2fa894756c979e5c4 | [
"MIT"
] | null | null | null | from flask import Flask, request, jsonify
from flask_cors import CORS
import os
import pandas as pd
import requests
import wget
import json
import wget
from cdqa.pipeline import QAPipeline
app = Flask(__name__)
CORS(app)
print("Started main.py !!!")
response = requests.get('https://docs.google.com/uc?export=downlo... | 30.916667 | 122 | 0.754717 | from flask import Flask, request, jsonify
from flask_cors import CORS
import os
import pandas as pd
import requests
import wget
import json
import wget
from cdqa.pipeline import QAPipeline
app = Flask(__name__)
CORS(app)
print("Started main.py !!!")
response = requests.get('https://docs.google.com/uc?export=downlo... | true | true |
1c3a534c5fb481b4cca1e2855ebe3259df4b0b1e | 1,423 | py | Python | docs/update_command_help.py | thombashi/sqlitebiter | fbed3e367b4f0f55edcd4d818c73abae55c34614 | [
"MIT"
] | 728 | 2016-05-05T05:07:28.000Z | 2022-03-28T17:54:20.000Z | docs/update_command_help.py | thombashi/sqlitebiter | fbed3e367b4f0f55edcd4d818c73abae55c34614 | [
"MIT"
] | 55 | 2016-06-14T04:00:49.000Z | 2022-03-27T15:07:40.000Z | docs/update_command_help.py | thombashi/sqlitebiter | fbed3e367b4f0f55edcd4d818c73abae55c34614 | [
"MIT"
] | 59 | 2016-05-05T13:23:23.000Z | 2022-03-15T10:23:10.000Z | #!/usr/bin/env python3
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import os
import sys
from textwrap import dedent, indent
from subprocrunner import SubprocessRunner
def main() -> int:
env = dict(os.environ, LC_ALL="C.UTF-8")
proc = SubprocessRunner("sqlitebiter -h")
proc.... | 21.892308 | 65 | 0.477864 |
import os
import sys
from textwrap import dedent, indent
from subprocrunner import SubprocessRunner
def main() -> int:
env = dict(os.environ, LC_ALL="C.UTF-8")
proc = SubprocessRunner("sqlitebiter -h")
proc.run(env=env, check=True)
assert proc.stdout
help_file_path = "pages/usage/help.txt"
... | true | true |
1c3a53ee161769f466fd591578a828636ec7e696 | 165 | py | Python | algo_probs/newcoder/classic/nc103.py | Jackthebighead/recruiment-2022 | a81007908e3c2f65a6be3ff2d62dfb92d0753b0d | [
"MIT"
] | null | null | null | algo_probs/newcoder/classic/nc103.py | Jackthebighead/recruiment-2022 | a81007908e3c2f65a6be3ff2d62dfb92d0753b0d | [
"MIT"
] | null | null | null | algo_probs/newcoder/classic/nc103.py | Jackthebighead/recruiment-2022 | a81007908e3c2f65a6be3ff2d62dfb92d0753b0d | [
"MIT"
] | null | null | null | #
# 反转字符串
# @param str string字符串
# @return string字符串
#
class Solution:
def solve(self , str ):
# write code here
return ''.join(list(str)[::-1]) | 18.333333 | 39 | 0.581818 |
class Solution:
def solve(self , str ):
return ''.join(list(str)[::-1]) | true | true |
1c3a55ad542a990e9bd796ec0db840230da9586e | 2,220 | py | Python | picprocessing.py | iGEMDarmstadt/HoloPyGuy | 160bcf551efcc152d9b74cc38726647c0a7c1d2e | [
"MIT"
] | 3 | 2019-04-02T09:59:34.000Z | 2022-03-03T23:43:12.000Z | picprocessing.py | iGEMDarmstadt/HoloPyGuy | 160bcf551efcc152d9b74cc38726647c0a7c1d2e | [
"MIT"
] | null | null | null | picprocessing.py | iGEMDarmstadt/HoloPyGuy | 160bcf551efcc152d9b74cc38726647c0a7c1d2e | [
"MIT"
] | 3 | 2018-03-24T06:40:04.000Z | 2020-08-07T11:22:40.000Z | import os
from PIL import Image
import numpy as np
#Takes all pics in "raw pics" directory, convert to grey scale,
#cutting into square images, and same to "ready pics" directory
def create_temp_pictures(filenames):
filelist = []
cnt = 0
for filename in filenames:
im = Image.open(filename)
... | 28.831169 | 107 | 0.568919 | import os
from PIL import Image
import numpy as np
def create_temp_pictures(filenames):
filelist = []
cnt = 0
for filename in filenames:
im = Image.open(filename)
half_the_width = im.size[0] / 2
half_the_height = im.size[1] / 2
cut = np.minimum(half_the_height, half_th... | true | true |
1c3a55b15396eb415d49f53fd1b78d92ba51bbeb | 562 | py | Python | test_curator/integration/test_space_based.py | brookerj11211/curator | 2f141e168a3eea9d2f31aa4054c63646968e7dc6 | [
"Apache-2.0"
] | null | null | null | test_curator/integration/test_space_based.py | brookerj11211/curator | 2f141e168a3eea9d2f31aa4054c63646968e7dc6 | [
"Apache-2.0"
] | null | null | null | test_curator/integration/test_space_based.py | brookerj11211/curator | 2f141e168a3eea9d2f31aa4054c63646968e7dc6 | [
"Apache-2.0"
] | null | null | null | from datetime import datetime, timedelta
import curator
from . import CuratorTestCase
class TestSpaceBasedDeletion(CuratorTestCase):
# Testing https://github.com/elasticsearch/curator/issues/254
def test_curator_will_not_match_all_when_no_indices_match(self):
self.create_indices(10)
curator.d... | 37.466667 | 95 | 0.727758 | from datetime import datetime, timedelta
import curator
from . import CuratorTestCase
class TestSpaceBasedDeletion(CuratorTestCase):
def test_curator_will_not_match_all_when_no_indices_match(self):
self.create_indices(10)
curator.delete(self.client, disk_space=0.0000001, prefix='foo-', times... | true | true |
1c3a58f67aa962ae142a83070e718928c13fc40f | 1,943 | py | Python | spymaster/collectors/pinger.py | spotify/spymaster | d57fab9fa5bd7d796c9274ff13e418bf5f12e8d0 | [
"Apache-2.0"
] | 1 | 2016-02-29T02:02:37.000Z | 2016-02-29T02:02:37.000Z | spymaster/collectors/pinger.py | spotify/spymaster | d57fab9fa5bd7d796c9274ff13e418bf5f12e8d0 | [
"Apache-2.0"
] | null | null | null | spymaster/collectors/pinger.py | spotify/spymaster | d57fab9fa5bd7d796c9274ff13e418bf5f12e8d0 | [
"Apache-2.0"
] | 2 | 2018-11-08T19:33:48.000Z | 2022-03-19T15:43:39.000Z | import urllib2
from collections import namedtuple
from urlparse import urlparse
from spymaster.common import Collector
_Target = namedtuple('_Target', ['service', 'hostname',
'url', 'expected_status',
'timeout'])
class Pinger(Collector):
def __in... | 39.653061 | 88 | 0.486876 | import urllib2
from collections import namedtuple
from urlparse import urlparse
from spymaster.common import Collector
_Target = namedtuple('_Target', ['service', 'hostname',
'url', 'expected_status',
'timeout'])
class Pinger(Collector):
def __in... | true | true |
1c3a593e81ce1a638da1118b4818b74281d0c226 | 677 | py | Python | project/bin/rst2s5.py | edsml-7f4a1762/flood_risk | 7ea85d12e9255fdda8a764a3c669a79d3b71b967 | [
"MIT"
] | null | null | null | project/bin/rst2s5.py | edsml-7f4a1762/flood_risk | 7ea85d12e9255fdda8a764a3c669a79d3b71b967 | [
"MIT"
] | null | null | null | project/bin/rst2s5.py | edsml-7f4a1762/flood_risk | 7ea85d12e9255fdda8a764a3c669a79d3b71b967 | [
"MIT"
] | null | null | null | #!/Users/lc2216/Desktop/ads-deluge-wye/project/bin/python3
# $Id: rst2s5.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: Chris Liechti <cliechti@gmx.net>
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing HTML slides using
the S5 template syste... | 27.08 | 74 | 0.744461 |
try:
import locale
locale.setlocale(locale.LC_ALL, '')
except:
pass
from docutils.core import publish_cmdline, default_description
description = ('Generates S5 (X)HTML slideshow documents from standalone '
'reStructuredText sources. ' + default_description)
publish_cmdline(writer_... | true | true |
1c3a5b2f54cd4a6162c7e92dd24dd5b484e448bc | 5,770 | py | Python | main.py | satori-com/dd-controller | 58d1c9e4b3a4ec7957fe809bee34e8317a454b07 | [
"BSD-3-Clause"
] | 1 | 2017-06-22T00:19:53.000Z | 2017-06-22T00:19:53.000Z | main.py | machinezone/dd-controller | 58d1c9e4b3a4ec7957fe809bee34e8317a454b07 | [
"BSD-3-Clause"
] | null | null | null | main.py | machinezone/dd-controller | 58d1c9e4b3a4ec7957fe809bee34e8317a454b07 | [
"BSD-3-Clause"
] | 2 | 2018-07-14T12:41:45.000Z | 2021-02-26T10:39:18.000Z | #!/usr/bin/env python
# vim: ts=4 sts=4 sw=4 et: syntax=python
import sys
from argparse import ArgumentParser
from lib.comparator import Comparator
from lib.yaml_lib import format_yaml, get_yaml
from lib.exceptions import CustomException
from lib.common import list2map_ex
from lib.messages import error
from lib.remo... | 36.518987 | 78 | 0.592028 |
import sys
from argparse import ArgumentParser
from lib.comparator import Comparator
from lib.yaml_lib import format_yaml, get_yaml
from lib.exceptions import CustomException
from lib.common import list2map_ex
from lib.messages import error
from lib.remote_config import RemoteConfig
from lib.datadog_api import Dat... | false | true |
1c3a5d55b0db0836e6cb67b8a33f09d4c149f190 | 747 | py | Python | replace.py | mstiehr-dev/modify-setters-py | b619c7b75de6fe6698662e68b9ac0a7c14edb5fd | [
"Apache-2.0"
] | null | null | null | replace.py | mstiehr-dev/modify-setters-py | b619c7b75de6fe6698662e68b9ac0a7c14edb5fd | [
"Apache-2.0"
] | null | null | null | replace.py | mstiehr-dev/modify-setters-py | b619c7b75de6fe6698662e68b9ac0a7c14edb5fd | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
import re
import sys
#find . -type f -name TG*Form.java | xargs python3 /cygdrive/c/Temp/regex/regex.py
def replace(filename):
print("start processing " + filename)
f = open(filename, "r")
text = f.read()
f.close()
pattern = re.compile(r"(?P<indent>\s*)(?P<signature>(\w|\s|\d|[\(\)])*{... | 25.758621 | 157 | 0.617135 |
import re
import sys
def replace(filename):
print("start processing " + filename)
f = open(filename, "r")
text = f.read()
f.close()
pattern = re.compile(r"(?P<indent>\s*)(?P<signature>(\w|\s|\d|[\(\)])*{\s*)(?P<assignment>this(.)(\w|\d)* = )StringUtils.trimToNull\((?P<arg2>(\w|\s)*)\);")
hits = len(re.fin... | true | true |
1c3a5e42ec526350ed098aa1efd92fcb74e3584e | 3,457 | py | Python | catalyst/contrib/optimizers/radam.py | andrey-avdeev/catalyst | fd17aaba7775c99b7e2b1ce86e60aa8f2379acc3 | [
"Apache-2.0"
] | 1 | 2019-11-26T06:41:33.000Z | 2019-11-26T06:41:33.000Z | catalyst/contrib/optimizers/radam.py | andrey-avdeev/catalyst | fd17aaba7775c99b7e2b1ce86e60aa8f2379acc3 | [
"Apache-2.0"
] | null | null | null | catalyst/contrib/optimizers/radam.py | andrey-avdeev/catalyst | fd17aaba7775c99b7e2b1ce86e60aa8f2379acc3 | [
"Apache-2.0"
] | 1 | 2020-04-16T10:20:00.000Z | 2020-04-16T10:20:00.000Z | import math
import torch
from torch.optim.optimizer import Optimizer
class RAdam(Optimizer):
def __init__(
self,
params,
lr=1e-3,
betas=(0.9, 0.999),
eps=1e-8,
weight_decay=0
):
"""
Taken from https://github.com/LiyuanLucasLiu/RAdam
"""
... | 35.27551 | 79 | 0.460515 | import math
import torch
from torch.optim.optimizer import Optimizer
class RAdam(Optimizer):
def __init__(
self,
params,
lr=1e-3,
betas=(0.9, 0.999),
eps=1e-8,
weight_decay=0
):
defaults = dict(lr=lr, betas=betas, eps=eps, weight_decay=weight_decay)
... | true | true |
1c3a5fb374cf4a7f642fb694d7146716bc9df5bd | 2,913 | py | Python | .history/my_classes/FirstClassFunctions/MapFilterZipList_20210706183550.py | minefarmer/deep-Dive-1 | b0675b853180c5b5781888266ea63a3793b8d855 | [
"Unlicense"
] | null | null | null | .history/my_classes/FirstClassFunctions/MapFilterZipList_20210706183550.py | minefarmer/deep-Dive-1 | b0675b853180c5b5781888266ea63a3793b8d855 | [
"Unlicense"
] | null | null | null | .history/my_classes/FirstClassFunctions/MapFilterZipList_20210706183550.py | minefarmer/deep-Dive-1 | b0675b853180c5b5781888266ea63a3793b8d855 | [
"Unlicense"
] | null | null | null | """Map Filter Zip List Comprehensions
Higher order functions
A function that takes a function as a parameter and/or returns a function as it's return value
Example: sorted
map _
|
-- modern alternative -> list comprehensions and generator expressions
... | 20.089655 | 144 | 0.540336 | """Map Filter Zip List Comprehensions
Higher order functions
A function that takes a function as a parameter and/or returns a function as it's return value
Example: sorted
map _
|
-- modern alternative -> list comprehensions and generator expressions
... | false | true |
1c3a6030de899d59cc2c0d433041be9a2c1f1fab | 2,946 | py | Python | python/cuml/test/test_lasso.py | ksangeek/cuml | 1f508d989c1d7974c475f115f6ea063aea8aab39 | [
"Apache-2.0"
] | null | null | null | python/cuml/test/test_lasso.py | ksangeek/cuml | 1f508d989c1d7974c475f115f6ea063aea8aab39 | [
"Apache-2.0"
] | null | null | null | python/cuml/test/test_lasso.py | ksangeek/cuml | 1f508d989c1d7974c475f115f6ea063aea8aab39 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2018, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 39.28 | 75 | 0.643245 |
import cudf
import pytest
import numpy as np
import pandas as pd
from cuml.linear_model import Lasso as cuLasso
from sklearn.linear_model import Lasso
from sklearn.datasets import make_regression
from sklearn.metrics import mean_squared_error
from cuml.test.utils import array_equal
@pytest.mark.paramet... | true | true |
1c3a606d0e82c38b08cca99789d44c599c1ff347 | 144 | py | Python | search/apps.py | techonerd/BankSearch | 5a53fa6a3c3d14d33a31195640318b25683b0df0 | [
"Apache-2.0"
] | null | null | null | search/apps.py | techonerd/BankSearch | 5a53fa6a3c3d14d33a31195640318b25683b0df0 | [
"Apache-2.0"
] | 2 | 2022-01-11T22:39:52.000Z | 2022-01-11T22:46:37.000Z | search/apps.py | techonerd/BankSearch | 5a53fa6a3c3d14d33a31195640318b25683b0df0 | [
"Apache-2.0"
] | null | null | null | from django.apps import AppConfig
class SearchConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "search"
| 20.571429 | 56 | 0.756944 | from django.apps import AppConfig
class SearchConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "search"
| true | true |
1c3a65b0a8168376455fc36b3936331f5b116418 | 940 | py | Python | calculator.py | avinashangular/python | 3b19a8975aa201478a7ef0f12fa1745c1fabef7b | [
"MIT"
] | 1 | 2021-02-11T03:48:45.000Z | 2021-02-11T03:48:45.000Z | calculator.py | avinashangular/python | 3b19a8975aa201478a7ef0f12fa1745c1fabef7b | [
"MIT"
] | null | null | null | calculator.py | avinashangular/python | 3b19a8975aa201478a7ef0f12fa1745c1fabef7b | [
"MIT"
] | null | null | null | # Function to add two numbers
def add(num1, num2):
return num1 + num2
# Function to substract two numbers
def substract(num1, num2):
return num1 - num2;
# Function to multiply two numbers
def multiply(num1, num2):
return num1 * num2
# Function to divide two numbers
def divide(num1, num2):
return... | 20.888889 | 58 | 0.601064 |
def add(num1, num2):
return num1 + num2
def substract(num1, num2):
return num1 - num2;
def multiply(num1, num2):
return num1 * num2
def divide(num1, num2):
return num1 / num2
print("Please select opeation - \n" \
"1. Add\n" \
"2. Substract\n" \
"3. Multiply\n" \
"4. Divide\... | true | true |
1c3a65e0bc5bf81be1df726e163d85941efc563f | 209 | py | Python | PycharmProjects/pythonProject/venv/ex011.py | Caiocolas/-Exercicios-Python- | 7c4fa922f3ec89f1d5a5ccd928651722b932793c | [
"MIT"
] | null | null | null | PycharmProjects/pythonProject/venv/ex011.py | Caiocolas/-Exercicios-Python- | 7c4fa922f3ec89f1d5a5ccd928651722b932793c | [
"MIT"
] | null | null | null | PycharmProjects/pythonProject/venv/ex011.py | Caiocolas/-Exercicios-Python- | 7c4fa922f3ec89f1d5a5ccd928651722b932793c | [
"MIT"
] | null | null | null | altura = float(input('Altura da parede:'))
largura = float(input('Largura da parede:'))
area = (altura * largura)
print('A área da parede é {} e vc precisara de {} litros de tinta para pintar a parede toda''') | 52.25 | 95 | 0.698565 | altura = float(input('Altura da parede:'))
largura = float(input('Largura da parede:'))
area = (altura * largura)
print('A área da parede é {} e vc precisara de {} litros de tinta para pintar a parede toda''') | true | true |
1c3a66f6b02d61600747710a4b6d9b3fe30d5a5e | 7,734 | py | Python | cogs/logging.py | poketwo/support | 207b7da2e06e2b4cd044a18b0093dc5282125630 | [
"MIT"
] | null | null | null | cogs/logging.py | poketwo/support | 207b7da2e06e2b4cd044a18b0093dc5282125630 | [
"MIT"
] | null | null | null | cogs/logging.py | poketwo/support | 207b7da2e06e2b4cd044a18b0093dc5282125630 | [
"MIT"
] | null | null | null | import logging
from datetime import datetime, timezone
import discord
from discord.ext import commands, tasks
from helpers import checks
from pymongo import UpdateOne
formatter = logging.Formatter("%(asctime)s:%(levelname)s:%(name)s: %(message)s")
class Logging(commands.Cog):
"""For logging."""
def __init_... | 35.805556 | 115 | 0.604603 | import logging
from datetime import datetime, timezone
import discord
from discord.ext import commands, tasks
from helpers import checks
from pymongo import UpdateOne
formatter = logging.Formatter("%(asctime)s:%(levelname)s:%(name)s: %(message)s")
class Logging(commands.Cog):
def __init__(self, bot):
s... | true | true |
1c3a67f764910581a850d71f3429daa017619b4d | 748 | py | Python | All Tracks/Core CS/Algorithms/Implementation/Between Two Sets/Solution.py | Shaikh-Nabeel/HackerRank-Solutions | b69f4e3b78d75a231008788c497edcd6ded95fa9 | [
"MIT"
] | 13 | 2019-03-24T13:56:13.000Z | 2022-03-19T23:18:42.000Z | All Tracks/Core CS/Algorithms/Implementation/Between Two Sets/Solution.py | Shaikh-Nabeel/HackerRank-Solutions | b69f4e3b78d75a231008788c497edcd6ded95fa9 | [
"MIT"
] | 2 | 2020-04-18T13:04:06.000Z | 2020-05-18T19:54:32.000Z | All Tracks/Core CS/Algorithms/Implementation/Between Two Sets/Solution.py | Shaikh-Nabeel/HackerRank-Solutions | b69f4e3b78d75a231008788c497edcd6ded95fa9 | [
"MIT"
] | 27 | 2019-03-24T13:56:16.000Z | 2022-03-19T23:18:44.000Z | #!/bin/python3
import sys
from functools import reduce
from math import gcd
'''
1) Find the gcd G of the second set
2) Find the lcm L of the first set
3) Find the divisors D of G
4) The result is the number of times that an element of D is divisible by L
'''
if __name__ == "__main__":
n, m = ma... | 31.166667 | 91 | 0.641711 |
import sys
from functools import reduce
from math import gcd
if __name__ == "__main__":
n, m = map(int, input().strip().split(' '))
first_set = list(map(int, input().strip().split(' ')))
second_set = list(map(int, input().strip().split(' ')))
gcd_value = reduce(gcd, second_set)
lcm_value = red... | true | true |
1c3a682dc1fa384b56a768b52ec6da74b3c2ef6c | 2,758 | py | Python | Homework.py | q1e123/Pedagogy-CSV-Homework-Verify | aa571d3692b5343b83b0497d71420ce849b516f3 | [
"MIT"
] | null | null | null | Homework.py | q1e123/Pedagogy-CSV-Homework-Verify | aa571d3692b5343b83b0497d71420ce849b516f3 | [
"MIT"
] | null | null | null | Homework.py | q1e123/Pedagogy-CSV-Homework-Verify | aa571d3692b5343b83b0497d71420ce849b516f3 | [
"MIT"
] | null | null | null | import csv
import pandas
class Homework():
BAD_NAME_FILE_SUFIX = '-wrong-name.txt'
CHECK_FILE_NAME = 'check.txt'
FRAUD_MESSAGE = 'FRAUD'
GOOD_MESSAGE = 'GOOD'
WRONG_MESSAGE = 'WRONG'
NOT_SENT_MESSAGE = 'NOT SENT'
def __init__(self, title, student_list, path_list):
self.... | 43.09375 | 86 | 0.602973 | import csv
import pandas
class Homework():
BAD_NAME_FILE_SUFIX = '-wrong-name.txt'
CHECK_FILE_NAME = 'check.txt'
FRAUD_MESSAGE = 'FRAUD'
GOOD_MESSAGE = 'GOOD'
WRONG_MESSAGE = 'WRONG'
NOT_SENT_MESSAGE = 'NOT SENT'
def __init__(self, title, student_list, path_list):
self.... | true | true |
1c3a687f897f4b8336c532c52d749853e57c12dd | 3,182 | py | Python | analyze/wordstats.py | internaut/facebook-discussion-tk | 83865e8090da00ad9b2629393381db7c6953649c | [
"MIT"
] | 36 | 2016-01-01T08:58:20.000Z | 2021-09-22T18:54:51.000Z | analyze/wordstats.py | internaut/facebook-discussion-tk | 83865e8090da00ad9b2629393381db7c6953649c | [
"MIT"
] | null | null | null | analyze/wordstats.py | internaut/facebook-discussion-tk | 83865e8090da00ad9b2629393381db7c6953649c | [
"MIT"
] | 7 | 2016-09-29T20:15:33.000Z | 2019-02-17T13:25:05.000Z | # -*- coding: utf-8 -*-
from __future__ import print_function
from collections import defaultdict
import sys
import time
from pattern.text.de import split, parse
from libleipzig import Baseform
from suds import WebFault
LIBLEIPZIG_FOR_LEMMATA = True
LIBLEIPZIG_FAIL_RETRIES = 10
LIBLEIPZIG_FAIL_RETRIES_SLEEP_SEC = 1
... | 39.775 | 117 | 0.574167 |
from __future__ import print_function
from collections import defaultdict
import sys
import time
from pattern.text.de import split, parse
from libleipzig import Baseform
from suds import WebFault
LIBLEIPZIG_FOR_LEMMATA = True
LIBLEIPZIG_FAIL_RETRIES = 10
LIBLEIPZIG_FAIL_RETRIES_SLEEP_SEC = 1
STRINGS_STARTWITH_BLACK... | true | true |
1c3a6a7a4d34c73b925f73b27932c4f907271fe1 | 23,157 | py | Python | gfootball/env/football_env_test.py | KanwarKelide/football | 149c03dfd90aaf652a61c656e40cefa5dc9e0454 | [
"Apache-2.0"
] | null | null | null | gfootball/env/football_env_test.py | KanwarKelide/football | 149c03dfd90aaf652a61c656e40cefa5dc9e0454 | [
"Apache-2.0"
] | null | null | null | gfootball/env/football_env_test.py | KanwarKelide/football | 149c03dfd90aaf652a61c656e40cefa5dc9e0454 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2019 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | 33.56087 | 90 | 0.651509 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
from collections import Iterable
from multiprocessing import pool
from multiprocessing import Queue
import gfootball
import os
import random
import threadin... | true | true |
1c3a6a9a3af4da22510834166c0e0f9ba885cfff | 451 | py | Python | counter/src/counter.py | roicostas/docker-orquestacion | 0b47a46f8fafdae7f3fe88fcf4bdb7dd11eff8f7 | [
"Apache-2.0"
] | 1 | 2017-12-21T11:44:05.000Z | 2017-12-21T11:44:05.000Z | counter/src/counter.py | roicostas/docker-orquestacion | 0b47a46f8fafdae7f3fe88fcf4bdb7dd11eff8f7 | [
"Apache-2.0"
] | null | null | null | counter/src/counter.py | roicostas/docker-orquestacion | 0b47a46f8fafdae7f3fe88fcf4bdb7dd11eff8f7 | [
"Apache-2.0"
] | 2 | 2016-10-31T19:25:21.000Z | 2017-02-07T08:40:10.000Z | #!/usr/bin/env python
from flask import Flask, render_template
import redis
app = Flask(__name__)
app.config['DEBUG'] = True
redis = redis.Redis("redis")
@app.route("/")
def index():
count = 1
bcount = redis.get('count')
if bcount:
count = int(bcount.decode('utf8')) + 1
redis.set('count', str... | 20.5 | 53 | 0.643016 |
from flask import Flask, render_template
import redis
app = Flask(__name__)
app.config['DEBUG'] = True
redis = redis.Redis("redis")
@app.route("/")
def index():
count = 1
bcount = redis.get('count')
if bcount:
count = int(bcount.decode('utf8')) + 1
redis.set('count', str(count))
return ... | true | true |
1c3a6b5b139ff6ab035e2f38e7979eb6bdf13b68 | 2,189 | py | Python | hw/ip/otbn/dv/otbnsim/standalone.py | msfschaffner/opentitan-bak | de4cb1bb9e7b707a3ca2a6882d83af7ed2aa1ab8 | [
"Apache-2.0"
] | 3 | 2019-12-23T13:16:39.000Z | 2022-01-29T23:45:31.000Z | hw/ip/otbn/dv/otbnsim/standalone.py | msfschaffner/opentitan-bak | de4cb1bb9e7b707a3ca2a6882d83af7ed2aa1ab8 | [
"Apache-2.0"
] | 2 | 2021-11-01T15:02:37.000Z | 2022-01-17T14:34:36.000Z | hw/ip/otbn/dv/otbnsim/standalone.py | msfschaffner/opentitan-bak | de4cb1bb9e7b707a3ca2a6882d83af7ed2aa1ab8 | [
"Apache-2.0"
] | 1 | 2019-12-24T02:07:46.000Z | 2019-12-24T02:07:46.000Z | #!/usr/bin/env python3
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
import argparse
import sys
from sim.load_elf import load_elf
from sim.standalonesim import StandaloneSim
from sim.stats import ExecutionStatAnalyzer... | 29.186667 | 78 | 0.628141 |
import argparse
import sys
from sim.load_elf import load_elf
from sim.standalonesim import StandaloneSim
from sim.stats import ExecutionStatAnalyzer
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument('elf')
parser.add_argument('-v', '--verbose', action='store_true')
parser... | true | true |
1c3a6c34a77463d37ec1c647937a7811b2ba42e0 | 1,168 | py | Python | music/migrations/0001_initial.py | Ashutoshkrs/music_app | 45a6a52be0232c8de99136dedd9a9c0e7fdfef3c | [
"MIT"
] | 1 | 2018-11-01T03:36:17.000Z | 2018-11-01T03:36:17.000Z | music/migrations/0001_initial.py | Ashutoshkrs/music_app | 45a6a52be0232c8de99136dedd9a9c0e7fdfef3c | [
"MIT"
] | null | null | null | music/migrations/0001_initial.py | Ashutoshkrs/music_app | 45a6a52be0232c8de99136dedd9a9c0e7fdfef3c | [
"MIT"
] | 20 | 2018-10-26T14:46:35.000Z | 2020-10-18T05:27:18.000Z | # Generated by Django 2.1.1 on 2018-10-22 19:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Album',
fields=[
... | 33.371429 | 114 | 0.57363 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Album',
fields=[
('id', models.AutoField(auto_created=Tru... | true | true |
1c3a6e1dd73a95a1331e02a93814d1f2befb97ed | 495 | py | Python | Question25.py | Schrodinger73/PracticalJournal_Class11 | cf098a87bcba807858ea7e904e8ac57742f19e70 | [
"MIT"
] | 13 | 2020-10-22T05:12:27.000Z | 2022-01-10T10:59:10.000Z | Question25.py | Schrodinger73/PracticalJournal_Class11 | cf098a87bcba807858ea7e904e8ac57742f19e70 | [
"MIT"
] | 2 | 2020-10-25T19:34:18.000Z | 2020-11-03T19:02:22.000Z | Question25.py | Schrodinger73/PracticalJournal_Class11 | cf098a87bcba807858ea7e904e8ac57742f19e70 | [
"MIT"
] | 7 | 2020-10-25T18:53:09.000Z | 2020-12-25T03:15:03.000Z | # Question
# 25. Write a program to reverse a list of integers
# Code
x = []
while True:
print("int",str(len(x)+1)+ ':')
i = input()
if i != 'n' and i.strip().replace(' ','') != '' and i.isdigit():
x.append(int(i))
else: break
y = []
for e in x: y.insert(0, e)
print("New list:",y)
# Input
# ... | 17.678571 | 68 | 0.537374 |
x = []
while True:
print("int",str(len(x)+1)+ ':')
i = input()
if i != 'n' and i.strip().replace(' ','') != '' and i.isdigit():
x.append(int(i))
else: break
y = []
for e in x: y.insert(0, e)
print("New list:",y)
| true | true |
1c3a6e7165a7f68e70a893ebe3220424c741e6f8 | 597 | py | Python | main/wsgi.py | yosukesuzuki/djangae-template | 7bd1f2c72b18ed00d977e5f407fcf9307eeaeb87 | [
"Apache-2.0"
] | null | null | null | main/wsgi.py | yosukesuzuki/djangae-template | 7bd1f2c72b18ed00d977e5f407fcf9307eeaeb87 | [
"Apache-2.0"
] | null | null | null | main/wsgi.py | yosukesuzuki/djangae-template | 7bd1f2c72b18ed00d977e5f407fcf9307eeaeb87 | [
"Apache-2.0"
] | null | null | null | """
WSGI config for main project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
from main.boot import fix_path
fix_path()
import os
from django.core.wsgi import get_wsgi_applicat... | 25.956522 | 78 | 0.802345 |
from main.boot import fix_path
fix_path()
import os
from django.core.wsgi import get_wsgi_application
from djangae.wsgi import DjangaeApplication
from djangae.utils import on_production
settings = "main.settings_live" if on_production() else "main.settings"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings)
... | true | true |
1c3a70203a0e47efd5e2100f9a6d2d8afa00b562 | 285 | py | Python | src/outpost/django/research/urls.py | medunigraz/outpost.django.research | 4336835663b9e1a8984c08ca709860ead8791d32 | [
"BSD-2-Clause"
] | null | null | null | src/outpost/django/research/urls.py | medunigraz/outpost.django.research | 4336835663b9e1a8984c08ca709860ead8791d32 | [
"BSD-2-Clause"
] | null | null | null | src/outpost/django/research/urls.py | medunigraz/outpost.django.research | 4336835663b9e1a8984c08ca709860ead8791d32 | [
"BSD-2-Clause"
] | null | null | null | from django.conf.urls import include, url
from . import views
app_name = "research"
urlpatterns = [
url(r"^search/(?P<database>[\w\-.]+)/(?P<schema>\w+)/$", views.SearchView.as_view()),
url(r"^detail/(?P<database>[\w\-.]+)/(?P<schema>\w+)/$", views.DetailView.as_view()),
]
| 25.909091 | 89 | 0.617544 | from django.conf.urls import include, url
from . import views
app_name = "research"
urlpatterns = [
url(r"^search/(?P<database>[\w\-.]+)/(?P<schema>\w+)/$", views.SearchView.as_view()),
url(r"^detail/(?P<database>[\w\-.]+)/(?P<schema>\w+)/$", views.DetailView.as_view()),
]
| true | true |
1c3a720c40fef0a082fb59e93c915bf4bc93a166 | 2,394 | py | Python | tests/test_core/test_alfa_client.py | stas12312/aioalfacrm | 1501634fa5ef4591936be2e6147827565e4a0b36 | [
"MIT"
] | null | null | null | tests/test_core/test_alfa_client.py | stas12312/aioalfacrm | 1501634fa5ef4591936be2e6147827565e4a0b36 | [
"MIT"
] | 49 | 2021-11-11T16:00:40.000Z | 2021-11-24T15:37:34.000Z | tests/test_core/test_alfa_client.py | stas12312/aioalfacrm | 1501634fa5ef4591936be2e6147827565e4a0b36 | [
"MIT"
] | null | null | null | import pytest
try:
from unittest.mock import AsyncMock as CoroutineMock, patch
except ImportError:
from asynctest import CoroutineMock, patch
from aioalfacrm import AlfaClient
def add_auth_request(aresponses):
aresponses.add('demo.s20.online', '/v2api/auth/login', 'POST', {'token': 'api-token'})
@pyte... | 26.021739 | 118 | 0.639515 | import pytest
try:
from unittest.mock import AsyncMock as CoroutineMock, patch
except ImportError:
from asynctest import CoroutineMock, patch
from aioalfacrm import AlfaClient
def add_auth_request(aresponses):
aresponses.add('demo.s20.online', '/v2api/auth/login', 'POST', {'token': 'api-token'})
@pyte... | true | true |
1c3a72806bd68dbefacd821759f72754e6c94a7f | 905 | py | Python | rastervision2/core/rv_pipeline/chip_classification.py | alexchunet/raster-vision | 76e2965557fc8380e2ffc4aa7ab1f5dc45f79033 | [
"Apache-2.0"
] | 1 | 2020-05-27T07:07:58.000Z | 2020-05-27T07:07:58.000Z | rastervision2/core/rv_pipeline/chip_classification.py | alexchunet/raster-vision | 76e2965557fc8380e2ffc4aa7ab1f5dc45f79033 | [
"Apache-2.0"
] | null | null | null | rastervision2/core/rv_pipeline/chip_classification.py | alexchunet/raster-vision | 76e2965557fc8380e2ffc4aa7ab1f5dc45f79033 | [
"Apache-2.0"
] | null | null | null | import logging
import numpy as np
from rastervision2.core.rv_pipeline.rv_pipeline import RVPipeline
from rastervision2.core.box import Box
log = logging.getLogger(__name__)
def get_train_windows(scene, chip_size):
train_windows = []
extent = scene.raster_source.get_extent()
stride = chip_size
windo... | 29.193548 | 72 | 0.738122 | import logging
import numpy as np
from rastervision2.core.rv_pipeline.rv_pipeline import RVPipeline
from rastervision2.core.box import Box
log = logging.getLogger(__name__)
def get_train_windows(scene, chip_size):
train_windows = []
extent = scene.raster_source.get_extent()
stride = chip_size
windo... | true | true |
1c3a74dca3d84a11503553d986e556a6ac3ec2ed | 2,877 | py | Python | s3pypi/__main__.py | andrei-shabanski/s3pypi | 48718149cf43d6e3252712d072d5b0de850bac55 | [
"MIT"
] | null | null | null | s3pypi/__main__.py | andrei-shabanski/s3pypi | 48718149cf43d6e3252712d072d5b0de850bac55 | [
"MIT"
] | null | null | null | s3pypi/__main__.py | andrei-shabanski/s3pypi | 48718149cf43d6e3252712d072d5b0de850bac55 | [
"MIT"
] | null | null | null | from __future__ import print_function
import argparse
import logging
import sys
from pathlib import Path
from typing import Dict
from s3pypi import __prog__, __version__, core
logging.basicConfig()
log = logging.getLogger(__prog__)
def string_dict(text: str) -> Dict[str, str]:
return dict(tuple(item.strip().sp... | 34.662651 | 107 | 0.635732 | from __future__ import print_function
import argparse
import logging
import sys
from pathlib import Path
from typing import Dict
from s3pypi import __prog__, __version__, core
logging.basicConfig()
log = logging.getLogger(__prog__)
def string_dict(text: str) -> Dict[str, str]:
return dict(tuple(item.strip().sp... | true | true |
1c3a75ba491a649ac5339b068c1a2c8baaf61bf3 | 4,048 | py | Python | psda/demo.py | aswart/PSDA | 2bdd071e6a3dee89827900553185a98a38292843 | [
"MIT"
] | null | null | null | psda/demo.py | aswart/PSDA | 2bdd071e6a3dee89827900553185a98a38292843 | [
"MIT"
] | null | null | null | psda/demo.py | aswart/PSDA | 2bdd071e6a3dee89827900553185a98a38292843 | [
"MIT"
] | null | null | null | import numpy as np
from numpy.random import randn, randint
import matplotlib.pyplot as plt
from psda import VMF, PSDA, decompose, atleast2
from pyllr import quick_eval
"""
This demo uses a quick-and-dirty data simulator, using Gaussians, not VMF.
It does not work for high dimensions. But you can play with dim = 2 or ... | 26.457516 | 85 | 0.693182 | import numpy as np
from numpy.random import randn, randint
import matplotlib.pyplot as plt
from psda import VMF, PSDA, decompose, atleast2
from pyllr import quick_eval
dim = 20
b, w = 10, 50
ns = 100
n = 1000
norm, mu = decompose(randn(dim))
model0 = PSDA(w, VMF(mu, b))
Z = model0.sample_speakers(ns)
label... | true | true |
1c3a763bfa27750340ecc34c91ff0be3c4d675bc | 815 | py | Python | ontask/migrations/0023_auto_20191230_0837.py | pinheiroo27/ontask_b | 23fee8caf4e1c5694a710a77f3004ca5d9effeac | [
"MIT"
] | 33 | 2017-12-02T04:09:24.000Z | 2021-11-07T08:41:57.000Z | ontask/migrations/0023_auto_20191230_0837.py | pinheiroo27/ontask_b | 23fee8caf4e1c5694a710a77f3004ca5d9effeac | [
"MIT"
] | 189 | 2017-11-16T04:06:29.000Z | 2022-03-11T23:35:59.000Z | ontask/migrations/0023_auto_20191230_0837.py | pinheiroo27/ontask_b | 23fee8caf4e1c5694a710a77f3004ca5d9effeac | [
"MIT"
] | 30 | 2017-11-30T03:35:44.000Z | 2022-01-31T03:08:08.000Z | # Generated by Django 2.2.8 on 2019-12-29 22:07
from django.db import migrations
def move_excluded_items_to_payload(apps, schema_editor):
if schema_editor.connection.alias != 'default':
return
# Traverse the scheduled actions and move the exclude_items field from
# the object field to the payloa... | 28.103448 | 74 | 0.694479 |
from django.db import migrations
def move_excluded_items_to_payload(apps, schema_editor):
if schema_editor.connection.alias != 'default':
return
ScheduledOperation = apps.get_model('ontask', 'ScheduledOperation')
for item in ScheduledOperation.objects.all():
if item.exclude_va... | true | true |
1c3a7688b9e25e9cb16c6b395e6dfd222433496f | 5,442 | py | Python | pyrodash/geometrics/parallelepiped.py | Raudcu/pyrodash | 3671086ef57c097fa055a908a65401eb6648c69a | [
"MIT"
] | 1 | 2021-05-19T10:27:59.000Z | 2021-05-19T10:27:59.000Z | pyrodash/geometrics/parallelepiped.py | Raudcu/pyrodash | 3671086ef57c097fa055a908a65401eb6648c69a | [
"MIT"
] | null | null | null | pyrodash/geometrics/parallelepiped.py | Raudcu/pyrodash | 3671086ef57c097fa055a908a65401eb6648c69a | [
"MIT"
] | null | null | null | import numpy as np
from itertools import product
import plotly.graph_objects as go
class Parallelepiped:
"""
Class to build and draw a Parallelepiped.
...
Attributes
----------
L : float or numpy array
x, y, z lengths of the parallelepiped sides. If float, a cube of
side L i... | 29.901099 | 77 | 0.534546 | import numpy as np
from itertools import product
import plotly.graph_objects as go
class Parallelepiped:
def __init__(
self,
L,
initial_vertex_position=[0, 0, 0],
edge_color="black",
edge_width=2,
face_opacity=0,
):
if isinstance(L, (list, np.ndarray))... | true | true |
1c3a76a7ee7ba27b5033d6a016d79217d35b84e6 | 1,265 | py | Python | src/tests/unit/test_booking_service.py | jorzel/opentable | 712182ae7ca39cda601d0c9e14a28b56794dc2dd | [
"MIT"
] | 9 | 2021-02-23T13:49:11.000Z | 2022-03-27T20:52:16.000Z | src/tests/unit/test_booking_service.py | jorzel/opentable | 712182ae7ca39cda601d0c9e14a28b56794dc2dd | [
"MIT"
] | null | null | null | src/tests/unit/test_booking_service.py | jorzel/opentable | 712182ae7ca39cda601d0c9e14a28b56794dc2dd | [
"MIT"
] | null | null | null | from unittest.mock import ANY, Mock
import pytest
from application.services.booking_table import BookingTableApplicationService
from domain.commands import BookTableCommand
from domain.events.table import BookedTableEvent
from infrastructure.db.memory.repository import MemoryRestaurantRepository
from infrastructure.d... | 30.119048 | 86 | 0.765217 | from unittest.mock import ANY, Mock
import pytest
from application.services.booking_table import BookingTableApplicationService
from domain.commands import BookTableCommand
from domain.events.table import BookedTableEvent
from infrastructure.db.memory.repository import MemoryRestaurantRepository
from infrastructure.d... | true | true |
1c3a76aa4aed1ee5ba205b4f9f05ac25c089bb24 | 1,259 | py | Python | tests/test_template_with_from_stdout.py | tsvetkov-ii/airflow-declarative | 7524030e333b05d3caf09cf5f069fbe1106397c1 | [
"Apache-2.0"
] | 126 | 2017-07-27T16:19:56.000Z | 2021-11-26T22:10:49.000Z | tests/test_template_with_from_stdout.py | tsvetkov-ii/airflow-declarative | 7524030e333b05d3caf09cf5f069fbe1106397c1 | [
"Apache-2.0"
] | 26 | 2017-07-30T11:38:40.000Z | 2021-09-11T15:24:04.000Z | tests/test_template_with_from_stdout.py | tsvetkov-ii/airflow-declarative | 7524030e333b05d3caf09cf5f069fbe1106397c1 | [
"Apache-2.0"
] | 9 | 2018-04-03T22:07:35.000Z | 2020-04-30T18:21:32.000Z | # -*- coding: utf-8 -*-
#
# Copyright 2019, Rambler Digital Solutions
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 27.977778 | 82 | 0.743447 |
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
import airflow_declarative
from airflow_declarative.operators import GenericOperator
@pytest.fixture()
def dag(good_dag_path):
path = good_dag_path("template-with-from-stdout")
dags = airflow_de... | true | true |
1c3a77fad5ceaaf2111e691cb0200c1c25872ebc | 1,339 | py | Python | tests/schemas/fields.py | brettcannon/vibora | 1933b631d4df62e7d748016f7463ab746d4695cc | [
"MIT"
] | 1 | 2021-01-03T00:57:53.000Z | 2021-01-03T00:57:53.000Z | tests/schemas/fields.py | brettcannon/vibora | 1933b631d4df62e7d748016f7463ab746d4695cc | [
"MIT"
] | null | null | null | tests/schemas/fields.py | brettcannon/vibora | 1933b631d4df62e7d748016f7463ab746d4695cc | [
"MIT"
] | 1 | 2019-06-14T10:40:54.000Z | 2019-06-14T10:40:54.000Z | from unittest import TestCase
from vibora.schemas.fields import String
from vibora.schemas.exceptions import ValidationError
class StringTestCase(TestCase):
def test_default__expects_successful(self):
field = String()
self.assertEqual('Test', field.load('Test'))
def test_default_with_integer... | 31.880952 | 66 | 0.681105 | from unittest import TestCase
from vibora.schemas.fields import String
from vibora.schemas.exceptions import ValidationError
class StringTestCase(TestCase):
def test_default__expects_successful(self):
field = String()
self.assertEqual('Test', field.load('Test'))
def test_default_with_integer... | true | true |
1c3a787bd0e947f8f10a5d680d6a48e3995cf9bd | 3,241 | py | Python | examples/src/main/python/als.py | dongwang218/spark | 48fc38f5844f6c12bf440f2990b6d7f1630fafac | [
"Apache-2.0",
"MIT"
] | 5 | 2017-04-13T01:00:13.000Z | 2020-01-02T06:38:49.000Z | examples/src/main/python/als.py | newscred/spark | 257236c3e17906098f801cbc2059e7a9054e8cab | [
"Apache-2.0",
"MIT"
] | 9 | 2015-09-25T20:21:52.000Z | 2020-02-04T18:25:21.000Z | examples/src/main/python/als.py | newscred/spark | 257236c3e17906098f801cbc2059e7a9054e8cab | [
"Apache-2.0",
"MIT"
] | 15 | 2017-01-12T10:41:50.000Z | 2019-04-19T08:28:15.000Z | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 31.466019 | 87 | 0.636223 |
from __future__ import print_function
import sys
import numpy as np
from numpy.random import rand
from numpy import matrix
from pyspark import SparkContext
LAMBDA = 0.01
np.random.seed(42)
def rmse(R, ms, us):
diff = R - ms * us.T
return np.sqrt(np.sum(np.power(diff, 2)) / M * U)
def ... | true | true |
1c3a793e81bc992bc5a1a1ed4247323dd86194f0 | 37,914 | py | Python | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations_async/_disks_operations_async.py | LianwMS/azure-sdk-for-python | 612d7bca9de86ee1bd1fa59291d7bf897ba9213f | [
"MIT"
] | 2 | 2019-05-17T21:24:53.000Z | 2020-02-12T11:13:42.000Z | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations_async/_disks_operations_async.py | LianwMS/azure-sdk-for-python | 612d7bca9de86ee1bd1fa59291d7bf897ba9213f | [
"MIT"
] | 15 | 2019-07-12T18:18:04.000Z | 2019-07-25T20:55:51.000Z | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations_async/_disks_operations_async.py | LianwMS/azure-sdk-for-python | 612d7bca9de86ee1bd1fa59291d7bf897ba9213f | [
"MIT"
] | 2 | 2020-05-21T22:51:22.000Z | 2020-05-26T20:53:01.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 47.098137 | 190 | 0.65638 |
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import Pipeli... | true | true |
1c3a796b2699601f424e3f80a5837fc28a6713db | 16,434 | py | Python | project3-mlops/06-Model-Registry.py | LiuxyEric/dscc202-402-spring2022 | f3877c2dde64656f9d84e3f913340f3fcefdc11b | [
"MIT"
] | null | null | null | project3-mlops/06-Model-Registry.py | LiuxyEric/dscc202-402-spring2022 | f3877c2dde64656f9d84e3f913340f3fcefdc11b | [
"MIT"
] | null | null | null | project3-mlops/06-Model-Registry.py | LiuxyEric/dscc202-402-spring2022 | f3877c2dde64656f9d84e3f913340f3fcefdc11b | [
"MIT"
] | 53 | 2022-01-11T19:06:06.000Z | 2022-03-25T19:27:48.000Z | # Databricks notebook source
# MAGIC %md
# MAGIC # Model Registry
# MAGIC
# MAGIC MLflow Model Registry is a collaborative hub where teams can share ML models, work together from experimentation to online testing and production, integrate with approval and governance workflows, and monitor ML deployments and their per... | 37.692661 | 645 | 0.73141 |
in_test_split(df.drop(["price"], axis=1), df[["price"]].values.ravel(), random_state=42)
rf = RandomForestRegressor(n_estimators=100, max_depth=5)
rf.fit(X_train, y_train)
with mlflow.start_run(run_name="RF Model") as run:
mlflow.sklearn.log_model(rf, "model")
mlflow.log_metric("mse", mean_squared_error(y_test,... | true | true |
1c3a7ac01ca66454f09348069e9fb311bffde81f | 2,350 | py | Python | tests/integration/models/test_ranking_metric.py | Remorax/COMET | e0a9c4116edb58fd2ddd2078329e06978e15b3b2 | [
"Apache-2.0"
] | 138 | 2020-09-22T14:59:52.000Z | 2022-03-30T18:43:41.000Z | tests/integration/models/test_ranking_metric.py | Remorax/COMET | e0a9c4116edb58fd2ddd2078329e06978e15b3b2 | [
"Apache-2.0"
] | 58 | 2020-11-19T11:41:21.000Z | 2022-03-31T17:54:46.000Z | tests/integration/models/test_ranking_metric.py | Remorax/COMET | e0a9c4116edb58fd2ddd2078329e06978e15b3b2 | [
"Apache-2.0"
] | 24 | 2020-09-28T02:35:55.000Z | 2022-03-14T12:51:40.000Z | # -*- coding: utf-8 -*-
import multiprocessing
import os
import shutil
import unittest
import torch
from comet.models import RankingMetric
from pytorch_lightning import seed_everything
from pytorch_lightning.trainer.trainer import Trainer
from scipy.stats import pearsonr
from tests.data import DATA_PATH
from torch.uti... | 31.756757 | 87 | 0.611064 |
import multiprocessing
import os
import shutil
import unittest
import torch
from comet.models import RankingMetric
from pytorch_lightning import seed_everything
from pytorch_lightning.trainer.trainer import Trainer
from scipy.stats import pearsonr
from tests.data import DATA_PATH
from torch.utils.data import DataLoad... | true | true |
1c3a7b6a2dbdfcc7a6cb2655d83c8b91264b42c6 | 2,072 | py | Python | models/xray_train.py | rahatsantosh/ipf_severity_detection | e08f72db344a6dd54868c83a2484c78f7ec7a6fe | [
"MIT"
] | null | null | null | models/xray_train.py | rahatsantosh/ipf_severity_detection | e08f72db344a6dd54868c83a2484c78f7ec7a6fe | [
"MIT"
] | 5 | 2021-06-08T22:20:20.000Z | 2022-03-12T00:46:52.000Z | models/xray_train.py | rahatsantosh/ipf_severity_detection | e08f72db344a6dd54868c83a2484c78f7ec7a6fe | [
"MIT"
] | null | null | null | import numpy as np
import torch
from torch import nn
from torch.backends import cudnn
from torch.utils.data import DataLoader
import torchvision
import matplotlib.pyplot as plt
from shallow_autoenc import Autoencoder
from autoencoder_dataset import Dataset
# CUDA for PyTorch
use_cuda = torch.cuda.is_available()
device... | 28.383562 | 102 | 0.681467 | import numpy as np
import torch
from torch import nn
from torch.backends import cudnn
from torch.utils.data import DataLoader
import torchvision
import matplotlib.pyplot as plt
from shallow_autoenc import Autoencoder
from autoencoder_dataset import Dataset
use_cuda = torch.cuda.is_available()
device = torch.device("c... | true | true |
1c3a7c87a6d25531d0ab33c8faa31b4f10e373f5 | 1,089 | py | Python | utils/request.py | saptarshibasu15/API | f83ce39e46fb058e33ff5c6a36671fa004363de9 | [
"MIT"
] | 1 | 2021-05-01T02:25:27.000Z | 2021-05-01T02:25:27.000Z | utils/request.py | saptarshibasu15/API | f83ce39e46fb058e33ff5c6a36671fa004363de9 | [
"MIT"
] | null | null | null | utils/request.py | saptarshibasu15/API | f83ce39e46fb058e33ff5c6a36671fa004363de9 | [
"MIT"
] | null | null | null | from quart import Request as BaseRequest
from typing import Optional
from api.models import User
class Request(BaseRequest):
"""Custom request class to implement authorization."""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._user = None
self.__has_fet... | 24.2 | 73 | 0.615243 | from quart import Request as BaseRequest
from typing import Optional
from api.models import User
class Request(BaseRequest):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._user = None
self.__has_fetched = False
@property
def is_authorized(self) -> ... | true | true |
1c3a7c92dba7f63865dc2773147c67d25a7863b8 | 1,320 | py | Python | data_loader/data_generator.py | jiuney/XAI606-EEGNet | 45ff28630ed1b09d0853f2cfb148a5dd2693e5ab | [
"MIT"
] | null | null | null | data_loader/data_generator.py | jiuney/XAI606-EEGNet | 45ff28630ed1b09d0853f2cfb148a5dd2693e5ab | [
"MIT"
] | null | null | null | data_loader/data_generator.py | jiuney/XAI606-EEGNet | 45ff28630ed1b09d0853f2cfb148a5dd2693e5ab | [
"MIT"
] | null | null | null | from torch.utils.data import DataLoader
from data_loader.dataset.bcic4_2a import BCIC4_2A
class DataGenerator:
def __init__(self, args):
print("[Load Data]")
if args.mode == 'train':
self.train_loader = self.__data_loader(args, 'train')
self.val_loader = self.__data_loader... | 42.580645 | 89 | 0.609091 | from torch.utils.data import DataLoader
from data_loader.dataset.bcic4_2a import BCIC4_2A
class DataGenerator:
def __init__(self, args):
print("[Load Data]")
if args.mode == 'train':
self.train_loader = self.__data_loader(args, 'train')
self.val_loader = self.__data_loader... | true | true |
1c3a7e2f81ccaf710e9ab7d0d3e2a280f179d8b8 | 1,394 | py | Python | model-optimizer/extensions/front/tf/gather_ext.py | zhoub/dldt | e42c01cf6e1d3aefa55e2c5df91f1054daddc575 | [
"Apache-2.0"
] | 3 | 2020-02-09T23:25:37.000Z | 2021-01-19T09:44:12.000Z | model-optimizer/extensions/front/tf/gather_ext.py | zhoub/dldt | e42c01cf6e1d3aefa55e2c5df91f1054daddc575 | [
"Apache-2.0"
] | null | null | null | model-optimizer/extensions/front/tf/gather_ext.py | zhoub/dldt | e42c01cf6e1d3aefa55e2c5df91f1054daddc575 | [
"Apache-2.0"
] | 2 | 2020-04-18T16:24:39.000Z | 2021-01-19T09:42:19.000Z | """
Copyright (c) 2018-2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... | 23.233333 | 73 | 0.713056 |
import numpy as np
from extensions.ops.gather import Gather
from mo.front.extractor import FrontExtractorOp
class GatherFrontExtractor(FrontExtractorOp):
op = 'Gather'
enabled = True
@staticmethod
def extract(node):
attrs = {}
Gather.update_node_stat(node, attrs)
return __... | true | true |
1c3a7e35403f792a0cf1f5ff099da7a89b4cec8c | 4,974 | py | Python | backend/env/lib/python3.8/site-packages/prompt_toolkit/contrib/telnet/protocol.py | lubitelpospat/CFM-source | 4e6af33ee68c6f2f05b6952b64a6b3f0591d5b03 | [
"MIT"
] | 17 | 2020-06-10T23:33:11.000Z | 2021-01-02T20:38:25.000Z | backend/env/lib/python3.8/site-packages/prompt_toolkit/contrib/telnet/protocol.py | lubitelpospat/CFM-source | 4e6af33ee68c6f2f05b6952b64a6b3f0591d5b03 | [
"MIT"
] | 24 | 2020-03-25T19:35:43.000Z | 2022-02-10T11:46:50.000Z | backend/env/lib/python3.8/site-packages/prompt_toolkit/contrib/telnet/protocol.py | lubitelpospat/CFM-source | 4e6af33ee68c6f2f05b6952b64a6b3f0591d5b03 | [
"MIT"
] | 11 | 2019-01-21T17:51:48.000Z | 2021-08-10T07:04:33.000Z | """
Parser for the Telnet protocol. (Not a complete implementation of the telnet
specification, but sufficient for a command line interface.)
Inspired by `Twisted.conch.telnet`.
"""
import struct
from typing import Callable, Generator
from .log import logger
__all__ = [
"TelnetProtocolParser",
]
def int2byte(n... | 26.31746 | 76 | 0.533374 | import struct
from typing import Callable, Generator
from .log import logger
__all__ = [
"TelnetProtocolParser",
]
def int2byte(number: int) -> bytes:
return bytes((number,))
NOP = int2byte(0)
SGA = int2byte(3)
IAC = int2byte(255)
DO = int2byte(253)
DONT = int2byte(254)
LINEMODE = int2byte(34)
SB = int2... | true | true |
1c3a7e4c47599ec3fd2482ae33f5943bbbc4669d | 480 | py | Python | appengine/chromium_try_flakes/issue_tracker/utils.py | mithro/chromium-infra | d27ac0b230bedae4bc968515b02927cf9e17c2b7 | [
"BSD-3-Clause"
] | 2 | 2021-04-13T21:22:18.000Z | 2021-09-07T02:11:57.000Z | appengine/chromium_try_flakes/issue_tracker/utils.py | mithro/chromium-infra | d27ac0b230bedae4bc968515b02927cf9e17c2b7 | [
"BSD-3-Clause"
] | 21 | 2020-09-06T02:41:05.000Z | 2022-03-02T04:40:01.000Z | appengine/third_party/monorail_api/utils.py | NDevTK/chromium-infra | d38e088e158d81f7f2065a38aa1ea1894f735ec4 | [
"BSD-3-Clause"
] | null | null | null | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility functions"""
import datetime
def parseDateTime(dt_str):
if dt_str is None:
return None
dt, _, us = dt_str.partition(".")
dt = datetime... | 25.263158 | 72 | 0.68125 |
import datetime
def parseDateTime(dt_str):
if dt_str is None:
return None
dt, _, us = dt_str.partition(".")
dt = datetime.datetime.strptime(dt, "%Y-%m-%dT%H:%M:%S")
if us:
us = int(us.rstrip("Z"), 10)
return dt + datetime.timedelta(microseconds=us)
else:
return dt
| true | true |
1c3a7ffbe112c0b6aa9e4322f1d64df0ef549c64 | 20,637 | py | Python | acc.py | gamestop-tech-brands/py-acc | c10cd3f1cdb2a6752a49aacdf8113cc93644724b | [
"Apache-2.0"
] | 4 | 2018-12-02T20:37:44.000Z | 2019-01-15T17:43:29.000Z | acc.py | gamestop-tech-brands/py-acc | c10cd3f1cdb2a6752a49aacdf8113cc93644724b | [
"Apache-2.0"
] | null | null | null | acc.py | gamestop-tech-brands/py-acc | c10cd3f1cdb2a6752a49aacdf8113cc93644724b | [
"Apache-2.0"
] | null | null | null | #######################################################################################################################
#
# AppleCare Connect API Library Python 3.x Module
#
# Overview
# The purpose of this Python module is to provide a standard Python module to interact with the AppleCare Connect API.
# Each method i... | 44.285408 | 120 | 0.657024 | true | true | |
1c3a8105ce41b9b0a4cec6739e683ef2e18381b7 | 1,082 | py | Python | userdocker/userdocker.py | jsteffen/userdocker | eb3b6a2421ca392ec4485744244d913e51687040 | [
"MIT"
] | 15 | 2017-03-01T17:08:20.000Z | 2021-03-18T15:32:02.000Z | userdocker/userdocker.py | jsteffen/userdocker | eb3b6a2421ca392ec4485744244d913e51687040 | [
"MIT"
] | 15 | 2017-03-07T16:21:38.000Z | 2021-04-06T14:28:04.000Z | userdocker/userdocker.py | jsteffen/userdocker | eb3b6a2421ca392ec4485744244d913e51687040 | [
"MIT"
] | 7 | 2017-12-06T12:00:31.000Z | 2021-12-21T03:53:19.000Z | # -*- coding: utf-8 -*-
import logging
import os
import sys
from .helpers.logger import logger
from .helpers.logger import logger_setup
from .helpers.cmd import init_cmd
from .helpers.exceptions import UserDockerException
from .helpers.execute import exit_exec_cmd
from .parser import parse_args
from .subcommands imp... | 23.521739 | 65 | 0.713494 |
import logging
import os
import sys
from .helpers.logger import logger
from .helpers.logger import logger_setup
from .helpers.cmd import init_cmd
from .helpers.exceptions import UserDockerException
from .helpers.execute import exit_exec_cmd
from .parser import parse_args
from .subcommands import specific_command_ex... | true | true |
1c3a812258ec9a355328f15ed21b91f54a184eaa | 654 | py | Python | 1045 - Tipos de Triangulos.py | le16bits/URI---Python | 9d22ae74f008104bc9c3c0e2d5f8cd59303bc1db | [
"Apache-2.0"
] | null | null | null | 1045 - Tipos de Triangulos.py | le16bits/URI---Python | 9d22ae74f008104bc9c3c0e2d5f8cd59303bc1db | [
"Apache-2.0"
] | null | null | null | 1045 - Tipos de Triangulos.py | le16bits/URI---Python | 9d22ae74f008104bc9c3c0e2d5f8cd59303bc1db | [
"Apache-2.0"
] | null | null | null | vl=input().split()
A=float(vl[0])
B=float(vl[1])
C=float(vl[2])
if B>A:
aux=B;B=A;A=aux
if C>A:
aux=C;C=A;A=aux
if C>B:
aux=C;C=B;B=aux
if C>A:
aux=C;C=A;A=aux
if B>A:
aux=B;B=A;A=aux
if C>B:
aux=C;C=B;B=aux
print("%.1f %.1f %.1f" %(A,B,C))
if A>=(B+C):
print("NAO FORMA... | 19.235294 | 46 | 0.513761 | vl=input().split()
A=float(vl[0])
B=float(vl[1])
C=float(vl[2])
if B>A:
aux=B;B=A;A=aux
if C>A:
aux=C;C=A;A=aux
if C>B:
aux=C;C=B;B=aux
if C>A:
aux=C;C=A;A=aux
if B>A:
aux=B;B=A;A=aux
if C>B:
aux=C;C=B;B=aux
print("%.1f %.1f %.1f" %(A,B,C))
if A>=(B+C):
print("NAO FORMA... | true | true |
1c3a81c0fe73e0b3a9110d9fcf0740d103e34d93 | 381 | py | Python | altair_examples/layered_bar_chart.py | progressivis/altair_examples | 9a453ecebdf0bd4776696d4233bee2a8f2eb3606 | [
"BSD-3-Clause"
] | 1 | 2021-10-30T03:55:24.000Z | 2021-10-30T03:55:24.000Z | altair_examples/layered_bar_chart.py | progressivis/altair_examples | 9a453ecebdf0bd4776696d4233bee2a8f2eb3606 | [
"BSD-3-Clause"
] | null | null | null | altair_examples/layered_bar_chart.py | progressivis/altair_examples | 9a453ecebdf0bd4776696d4233bee2a8f2eb3606 | [
"BSD-3-Clause"
] | null | null | null | """
Layered Bar Chart
-----------------
This example shows a segmented bar chart that is layered rather than stacked.
"""
# category: bar charts
import altair as alt
from vega_datasets import data
source = data.iowa_electricity()
(
alt.Chart(source)
.mark_bar(opacity=0.7)
.encode(
x="year:O", y=al... | 20.052632 | 77 | 0.653543 |
import altair as alt
from vega_datasets import data
source = data.iowa_electricity()
(
alt.Chart(source)
.mark_bar(opacity=0.7)
.encode(
x="year:O", y=alt.Y("net_generation:Q", stack=None), color="source",
)
)
| true | true |
1c3a8208ad35a4ea36b511d1167fb073a1043820 | 5,503 | py | Python | django_redis/cache.py | techequipt/django-redis | c22ce847d6a8648a304a3cdab49b7bfbac65be95 | [
"BSD-3-Clause"
] | null | null | null | django_redis/cache.py | techequipt/django-redis | c22ce847d6a8648a304a3cdab49b7bfbac65be95 | [
"BSD-3-Clause"
] | null | null | null | django_redis/cache.py | techequipt/django-redis | c22ce847d6a8648a304a3cdab49b7bfbac65be95 | [
"BSD-3-Clause"
] | null | null | null | import functools
import logging
from typing import Any, Callable, Dict, Optional
from django import VERSION as DJANGO_VERSION
from django.conf import settings
from django.core.cache.backends.base import BaseCache
from django.utils.module_loading import import_string
from .exceptions import ConnectionInterrupted, Pick... | 30.236264 | 84 | 0.644376 | import functools
import logging
from typing import Any, Callable, Dict, Optional
from django import VERSION as DJANGO_VERSION
from django.conf import settings
from django.core.cache.backends.base import BaseCache
from django.utils.module_loading import import_string
from .exceptions import ConnectionInterrupted, Pick... | true | true |
1c3a84bbaa43a9a2f21d753c51547195f7daa84d | 577 | py | Python | Leetcode/week_1/p0001_two_sum.py | SamSamhuns/wallbreakers_projekts | c07b555127ee89d6f461cea7cd87811c382086ff | [
"MIT"
] | 1 | 2021-07-07T00:55:23.000Z | 2021-07-07T00:55:23.000Z | Leetcode/week_1/p0001_two_sum.py | SamSamhuns/wallbreakers_projekts | c07b555127ee89d6f461cea7cd87811c382086ff | [
"MIT"
] | null | null | null | Leetcode/week_1/p0001_two_sum.py | SamSamhuns/wallbreakers_projekts | c07b555127ee89d6f461cea7cd87811c382086ff | [
"MIT"
] | null | null | null | from collections import defaultdict
from typing import List
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
complement_dict = defaultdict(int)
for i, num in enumerate(nums):
if target - num in complement_dict:
return [complement_dict[target... | 25.086957 | 82 | 0.663778 | from collections import defaultdict
from typing import List
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
complement_dict = defaultdict(int)
for i, num in enumerate(nums):
if target - num in complement_dict:
return [complement_dict[target... | true | true |
1c3a84f933c71f07c6fcdbe25450625810daa097 | 3,173 | py | Python | utils.py | nielsota/GANs | 7c4043022ba0fdd2d1f163abf70b7bd3f06be908 | [
"MIT"
] | null | null | null | utils.py | nielsota/GANs | 7c4043022ba0fdd2d1f163abf70b7bd3f06be908 | [
"MIT"
] | null | null | null | utils.py | nielsota/GANs | 7c4043022ba0fdd2d1f163abf70b7bd3f06be908 | [
"MIT"
] | null | null | null | from torchvision.utils import make_grid
import matplotlib.pyplot as plt
import argparse
import os
import torch
from Data import *
################################################################################
############################## UTILITY FUNCTIONS ###############################
##########################... | 32.71134 | 116 | 0.57359 | from torchvision.utils import make_grid
import matplotlib.pyplot as plt
import argparse
import os
import torch
from Data import *
| true | true |
1c3a850cb701d562f7d1a3c856e13af69a80f58d | 1,999 | py | Python | src/data_gen/ohem.py | kehuaWangfff/FashionAI_KeyPoint_Detection_Challenge_Keras | 02422f315403fae4dcd87abf90b08ae9183d75f0 | [
"MIT"
] | 169 | 2018-05-24T08:22:03.000Z | 2022-02-02T15:25:17.000Z | src/data_gen/ohem.py | Koeru/FashionAI_KeyPoint_Detection_Challenge_Keras | 0b3bd8cdee32e05619300e5466578644974279df | [
"MIT"
] | 12 | 2018-05-29T15:40:50.000Z | 2021-11-17T07:35:21.000Z | src/data_gen/ohem.py | Koeru/FashionAI_KeyPoint_Detection_Challenge_Keras | 0b3bd8cdee32e05619300e5466578644974279df | [
"MIT"
] | 54 | 2018-05-25T13:57:42.000Z | 2022-02-08T03:00:07.000Z |
import sys
sys.path.insert(0, "../unet/")
from keras.models import *
from keras.layers import *
from utils import np_euclidean_l2
from dataset import getKpNum
def generate_topk_mask_ohem(input_data, gthmap, keras_model, graph, topK, image_category, dynamicFlag=False):
'''
:param input_data: input
:param ... | 27.383562 | 109 | 0.63932 |
import sys
sys.path.insert(0, "../unet/")
from keras.models import *
from keras.layers import *
from utils import np_euclidean_l2
from dataset import getKpNum
def generate_topk_mask_ohem(input_data, gthmap, keras_model, graph, topK, image_category, dynamicFlag=False):
mimg, mmask = input_data
ximg = m... | true | true |
1c3a864ae8eabfe2c5b0f38f8dad8915a9ad63fe | 918 | py | Python | fbdplc/wires.py | Jmeyer1292/block_diagram_z3 | b7180d2dedc33ccb86aa3c58c898dd7adb9653fe | [
"Apache-2.0"
] | 4 | 2021-09-18T13:32:57.000Z | 2022-03-15T22:13:56.000Z | fbdplc/wires.py | Jmeyer1292/block_diagram_z3 | b7180d2dedc33ccb86aa3c58c898dd7adb9653fe | [
"Apache-2.0"
] | null | null | null | fbdplc/wires.py | Jmeyer1292/block_diagram_z3 | b7180d2dedc33ccb86aa3c58c898dd7adb9653fe | [
"Apache-2.0"
] | 2 | 2021-12-06T20:19:04.000Z | 2022-03-15T22:13:58.000Z | '''
Edges in a block diagram computational graph. The edges themselves don't have direction,
but the ports that they attach to may.
'''
class WireConnection:
pass
class NamedConnection(WireConnection):
def __init__(self, target_uid: int, target_port: str):
self.target_uid = target_uid
self.t... | 24.810811 | 95 | 0.686275 |
class WireConnection:
pass
class NamedConnection(WireConnection):
def __init__(self, target_uid: int, target_port: str):
self.target_uid = target_uid
self.target_port = target_port
def __str__(self):
return f'NamedConnection(id={self.target_uid}, port={self.target_port})'
clas... | true | true |
1c3a86c8aa044f75d9b0a9d1eb1b70c3f380d689 | 8,071 | py | Python | addons/extras.py | NightYoshi370/Kurisu | a4a40498791a6a54f8bec6bc89444dd5a9b5651a | [
"Apache-2.0"
] | null | null | null | addons/extras.py | NightYoshi370/Kurisu | a4a40498791a6a54f8bec6bc89444dd5a9b5651a | [
"Apache-2.0"
] | null | null | null | addons/extras.py | NightYoshi370/Kurisu | a4a40498791a6a54f8bec6bc89444dd5a9b5651a | [
"Apache-2.0"
] | null | null | null | import datetime
import discord
import os
import random
import re
import string
from discord.ext import commands
from sys import argv
class Extras:
"""
Extra things.
"""
def __init__(self, bot):
self.bot = bot
print('Addon "{}" loaded'.format(self.__class__.__name__))
prune_key = "n... | 42.478947 | 225 | 0.61752 | import datetime
import discord
import os
import random
import re
import string
from discord.ext import commands
from sys import argv
class Extras:
def __init__(self, bot):
self.bot = bot
print('Addon "{}" loaded'.format(self.__class__.__name__))
prune_key = "nokey"
@commands.command()
... | true | true |
1c3a87252df33ddf8d8ca65308e4c22681cf4307 | 286 | py | Python | src/catchbot/updater.py | grihabor/catch-hook-telegram-bot | 1f3c6a5d56d5ebba3d4620b532acde2ed734a75e | [
"MIT"
] | null | null | null | src/catchbot/updater.py | grihabor/catch-hook-telegram-bot | 1f3c6a5d56d5ebba3d4620b532acde2ed734a75e | [
"MIT"
] | 4 | 2018-02-21T11:25:49.000Z | 2018-06-23T15:51:51.000Z | src/catchbot/updater.py | grihabor/catch-hook-telegram-bot | 1f3c6a5d56d5ebba3d4620b532acde2ed734a75e | [
"MIT"
] | null | null | null | import telegram.ext as tg
from .commands import commands
def create_updater(token):
updater = tg.Updater(token=token)
for command in commands:
handler = tg.CommandHandler(command.__name__, command)
updater.dispatcher.add_handler(handler)
return updater
| 20.428571 | 62 | 0.727273 | import telegram.ext as tg
from .commands import commands
def create_updater(token):
updater = tg.Updater(token=token)
for command in commands:
handler = tg.CommandHandler(command.__name__, command)
updater.dispatcher.add_handler(handler)
return updater
| true | true |
1c3a8743e8a520f7f7fa08e01d17d42fc8701986 | 1,594 | py | Python | examples/performance_example.py | ntezak/plotille | 7baa4fa176ced99f7a9ab9688e99b525ef3edf4d | [
"MIT"
] | 157 | 2017-09-28T12:16:52.000Z | 2022-03-31T08:13:23.000Z | examples/performance_example.py | ntezak/plotille | 7baa4fa176ced99f7a9ab9688e99b525ef3edf4d | [
"MIT"
] | 43 | 2017-11-01T19:21:21.000Z | 2022-03-27T08:36:56.000Z | examples/performance_example.py | ntezak/plotille | 7baa4fa176ced99f7a9ab9688e99b525ef3edf4d | [
"MIT"
] | 12 | 2018-01-14T08:05:07.000Z | 2021-07-31T05:15:38.000Z | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
# The MIT License
# Copyright (c) 2017 - 2021 Tammo Ippen, tammo.ippen@posteo.de
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation fi... | 34.652174 | 82 | 0.733375 |
from __future__ import absolute_import, division, print_function, unicode_literals
from random import random
from time import time
import plotille
def main():
y = []
for _ in range(1000):
y.append(random())
x = list(range(1000))
t0 = time()
for _ in range(100):
... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.