hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f702aa947d0946923d43e7498a61a680b76392a9 | 663 | py | Python | solids/nvd/utils/schema.py | d3vzer0/vulnerabilities-pipeline | a6df7a233eaf66a8cb7c81aed69b377274ca3cf7 | [
"MIT"
] | 1 | 2021-11-22T09:57:20.000Z | 2021-11-22T09:57:20.000Z | solids/nvd/utils/schema.py | d3vzer0/vulnerabilities-pipeline | a6df7a233eaf66a8cb7c81aed69b377274ca3cf7 | [
"MIT"
] | 1 | 2021-08-03T21:56:03.000Z | 2021-08-09T15:05:40.000Z | solids/nvd/utils/schema.py | d3vzer0/vulnerabilities-pipeline | a6df7a233eaf66a8cb7c81aed69b377274ca3cf7 | [
"MIT"
] | null | null | null | from datetime import datetime
from typing import List, Dict, Optional
from pydantic import BaseModel, validator, root_validator
class ItemModel(BaseModel):
cve: Dict
configurations: Optional[Dict]
impact: Optional[Dict]
publishedDate: datetime
lastModifiedDate: datetime
class ResultModel(BaseMod... | 22.1 | 57 | 0.717949 | from datetime import datetime
from typing import List, Dict, Optional
from pydantic import BaseModel, validator, root_validator
class ItemModel(BaseModel):
cve: Dict
configurations: Optional[Dict]
impact: Optional[Dict]
publishedDate: datetime
lastModifiedDate: datetime
class ResultModel(BaseMod... | true | true |
f702ab8c70e4e0252724db9b6bec22b2fcca74e7 | 203 | py | Python | Ar_Script/past/eg_用户注册.py | archerckk/PyTest | 610dd89df8d70c096f4670ca11ed2f0ca3196ca5 | [
"MIT"
] | null | null | null | Ar_Script/past/eg_用户注册.py | archerckk/PyTest | 610dd89df8d70c096f4670ca11ed2f0ca3196ca5 | [
"MIT"
] | 1 | 2020-01-19T01:19:57.000Z | 2020-01-19T01:19:57.000Z | Ar_Script/past/eg_用户注册.py | archerckk/PyTest | 610dd89df8d70c096f4670ca11ed2f0ca3196ca5 | [
"MIT"
] | null | null | null | import easygui as g
user_info=g.multenterbox(title='账号中心',msg='【*用户名】为必填项\t【*真实姓名】为必填项\t【*手机号码】为必填项\t【*E-mail】为必填项',
fields=['*用户名','*真实姓名','固定电话','*手机号码','QQ','*E-mail']
) | 40.6 | 96 | 0.55665 | import easygui as g
user_info=g.multenterbox(title='账号中心',msg='【*用户名】为必填项\t【*真实姓名】为必填项\t【*手机号码】为必填项\t【*E-mail】为必填项',
fields=['*用户名','*真实姓名','固定电话','*手机号码','QQ','*E-mail']
) | true | true |
f702ad147472072f25a6a2b2c6f88dcb2a58ea04 | 2,652 | py | Python | api/__init__.py | aslanvaroqua/espa-api | 7ea02c0a0e9abb75db97f0989c6bdd22222fb3e6 | [
"Unlicense"
] | null | null | null | api/__init__.py | aslanvaroqua/espa-api | 7ea02c0a0e9abb75db97f0989c6bdd22222fb3e6 | [
"Unlicense"
] | null | null | null | api/__init__.py | aslanvaroqua/espa-api | 7ea02c0a0e9abb75db97f0989c6bdd22222fb3e6 | [
"Unlicense"
] | null | null | null | import re
import os
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
""" Holds all the custom exceptions raised by the api """
class OrderNotFound(StandardError):
"""Error raised when an order is not found"""
def __init__(self, orderid):
"""Create new OrderNotF... | 30.482759 | 232 | 0.634992 | import re
import os
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
class OrderNotFound(StandardError):
def __init__(self, orderid):
super(OrderNotFound, self).__init__(orderid)
class ItemNotFound(StandardError):
def __init__(self, orderid, itemid):
... | true | true |
f702af20dda49c4762d59b396d266f40cb1b5d33 | 48,802 | py | Python | Gomoku_minimax.py | thelazyant164/Gomoku | 7d87761ed5a72032ca3bebaf5cbfadc8977fb1f6 | [
"MIT"
] | null | null | null | Gomoku_minimax.py | thelazyant164/Gomoku | 7d87761ed5a72032ca3bebaf5cbfadc8977fb1f6 | [
"MIT"
] | null | null | null | Gomoku_minimax.py | thelazyant164/Gomoku | 7d87761ed5a72032ca3bebaf5cbfadc8977fb1f6 | [
"MIT"
] | null | null | null | #Import modules and libraries
from random import randint
from string import ascii_uppercase, ascii_lowercase
from itertools import permutations
from copy import deepcopy
from tail_recursion import tail_recursive, recurse
#Define board mapping function
def mapBoard(col, row, value):
board = [[value for x in range(c... | 50.053333 | 328 | 0.565346 |
from random import randint
from string import ascii_uppercase, ascii_lowercase
from itertools import permutations
from copy import deepcopy
from tail_recursion import tail_recursive, recurse
def mapBoard(col, row, value):
board = [[value for x in range(col)] for y in range(row)]
return board
def mapMetaBoa... | true | true |
f702b0c9185d321ac1b98814edddd6bd103a696b | 2,803 | py | Python | nmma/em/create_injection_slurm.py | DavidIbarr/nmma | 109fdd57add52cfea3553df8346981d6a117a7e7 | [
"MIT"
] | 1 | 2022-02-12T18:06:50.000Z | 2022-02-12T18:06:50.000Z | nmma/em/create_injection_slurm.py | DavidIbarr/nmma | 109fdd57add52cfea3553df8346981d6a117a7e7 | [
"MIT"
] | 10 | 2022-02-08T18:18:22.000Z | 2022-03-10T13:11:03.000Z | nmma/em/create_injection_slurm.py | DavidIbarr/nmma | 109fdd57add52cfea3553df8346981d6a117a7e7 | [
"MIT"
] | 12 | 2022-02-07T21:15:16.000Z | 2022-03-31T18:26:06.000Z | import os
import argparse
import json
import pandas as pd
import bilby
from bilby_pipe.create_injections import InjectionCreator
def main():
parser = argparse.ArgumentParser(description="Slurm files from nmma injection file")
parser.add_argument(
"--prior-file",
type=str,
required=Tr... | 29.505263 | 88 | 0.625401 | import os
import argparse
import json
import pandas as pd
import bilby
from bilby_pipe.create_injections import InjectionCreator
def main():
parser = argparse.ArgumentParser(description="Slurm files from nmma injection file")
parser.add_argument(
"--prior-file",
type=str,
required=Tr... | true | true |
f702b0d886a22f71a467ec815515b251b1e19d71 | 3,125 | py | Python | testing/test_cases/object_formatting_test_cases.py | roym899/flake8-annotations | 8b28fe6d3d00fc601d0f6e151588056d231a2186 | [
"MIT"
] | 42 | 2020-09-02T22:45:19.000Z | 2022-03-23T20:09:20.000Z | testing/test_cases/object_formatting_test_cases.py | roym899/flake8-annotations | 8b28fe6d3d00fc601d0f6e151588056d231a2186 | [
"MIT"
] | 23 | 2020-09-03T12:17:49.000Z | 2022-03-31T15:07:45.000Z | testing/test_cases/object_formatting_test_cases.py | roym899/flake8-annotations | 8b28fe6d3d00fc601d0f6e151588056d231a2186 | [
"MIT"
] | 4 | 2021-03-30T13:40:52.000Z | 2022-02-14T14:19:51.000Z | from functools import partial
from typing import NamedTuple, Union
from flake8_annotations import Argument, Function
from flake8_annotations.enums import AnnotationType
class FormatTestCase(NamedTuple):
"""Named tuple for representing our test cases."""
test_object: Union[Argument, Function]
str_output:... | 38.580247 | 138 | 0.60704 | from functools import partial
from typing import NamedTuple, Union
from flake8_annotations import Argument, Function
from flake8_annotations.enums import AnnotationType
class FormatTestCase(NamedTuple):
test_object: Union[Argument, Function]
str_output: str
repr_output: str
arg = partial(Argument, li... | true | true |
f702b11bd8a930c1afc521fe51421d52dde23c1f | 1,650 | py | Python | demos/matdb/demo_srim_compounddb_to_suzu.py | takaakiaoki/suzu | 431975a5345d9683f0a9453275764693e9e2064e | [
"MIT"
] | 6 | 2018-05-05T10:13:11.000Z | 2021-06-21T02:11:44.000Z | demos/matdb/demo_srim_compounddb_to_suzu.py | takaakiaoki/suzu | 431975a5345d9683f0a9453275764693e9e2064e | [
"MIT"
] | null | null | null | demos/matdb/demo_srim_compounddb_to_suzu.py | takaakiaoki/suzu | 431975a5345d9683f0a9453275764693e9e2064e | [
"MIT"
] | 5 | 2018-05-05T10:13:56.000Z | 2020-06-15T14:32:45.000Z | # coding: utf-8
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__),'../..'))
import suzu.matdb.srim_compounddb as compounddb
air = compounddb.Compound()
air.desc = 'Air, Dry near sea level (ICRU-104) 0.00120484 O-23.2, N-75.5, Ar-1.3'
air.name = '%Air, Dry (ICRU-104)'
air.density = 0.0... | 37.5 | 106 | 0.638182 |
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__),'../..'))
import suzu.matdb.srim_compounddb as compounddb
air = compounddb.Compound()
air.desc = 'Air, Dry near sea level (ICRU-104) 0.00120484 O-23.2, N-75.5, Ar-1.3'
air.name = '%Air, Dry (ICRU-104)'
air.density = 0.00120484
air.mas... | true | true |
f702b1385043c102875d88217ec2b9871be5ba26 | 3,885 | py | Python | tool/metric.py | dkswxd/unetpp_pytorch_qiu | df439b07d13c5d8c87975f0cca4dd7a5ff19f8c2 | [
"Apache-2.0"
] | 1 | 2022-01-13T07:11:18.000Z | 2022-01-13T07:11:18.000Z | code/utils/metric.py | DKJJ/SSL4MIS | 7f139d0c71110052399f0a93b55a39ba85897561 | [
"MIT"
] | null | null | null | code/utils/metric.py | DKJJ/SSL4MIS | 7f139d0c71110052399f0a93b55a39ba85897561 | [
"MIT"
] | null | null | null | import numpy as np
from sklearn import metrics
from PIL import Image
def get_metrics(pred, logits, gt):
if isinstance(logits, list):
logits = logits[-1]
result = {'confusion_matrix': metrics.confusion_matrix(gt.flatten(), pred.flatten(), labels=[1, 0]),
'auc': roc(gt, logits)}
return ... | 31.08 | 104 | 0.583269 | import numpy as np
from sklearn import metrics
from PIL import Image
def get_metrics(pred, logits, gt):
if isinstance(logits, list):
logits = logits[-1]
result = {'confusion_matrix': metrics.confusion_matrix(gt.flatten(), pred.flatten(), labels=[1, 0]),
'auc': roc(gt, logits)}
return ... | true | true |
f702b1cdf62d8a65d17e50a4ab858928e5956b21 | 2,601 | py | Python | tests/GAPDemo_cor_002/run.py | sagscmi/GAPDemo2019 | 37ca1a9587a029194469cb084d309ccc2ea4be43 | [
"Apache-2.0"
] | null | null | null | tests/GAPDemo_cor_002/run.py | sagscmi/GAPDemo2019 | 37ca1a9587a029194469cb084d309ccc2ea4be43 | [
"Apache-2.0"
] | null | null | null | tests/GAPDemo_cor_002/run.py | sagscmi/GAPDemo2019 | 37ca1a9587a029194469cb084d309ccc2ea4be43 | [
"Apache-2.0"
] | null | null | null | from pysys.constants import *
from apama.basetest import ApamaBaseTest
from apama.correlator import CorrelatorHelper
from GAPDemoConnected import GAPDemoConnectedHelper
class PySysTest(ApamaBaseTest):
def __init__(self, descriptor, outsubdir, runner):
super(PySysTest, self).__init__(descriptor, outsubdir, ru... | 42.639344 | 96 | 0.738562 | from pysys.constants import *
from apama.basetest import ApamaBaseTest
from apama.correlator import CorrelatorHelper
from GAPDemoConnected import GAPDemoConnectedHelper
class PySysTest(ApamaBaseTest):
def __init__(self, descriptor, outsubdir, runner):
super(PySysTest, self).__init__(descriptor, outsubdir, ru... | true | true |
f702b3026db98722fecc5c517e03dac41d42da66 | 802 | py | Python | youtubesearch/urls.py | shankarj67/Django-youtubesearch | 7a96592fa9c65ab44cce8724b0872675467a0863 | [
"MIT"
] | null | null | null | youtubesearch/urls.py | shankarj67/Django-youtubesearch | 7a96592fa9c65ab44cce8724b0872675467a0863 | [
"MIT"
] | 6 | 2020-06-05T20:50:34.000Z | 2021-06-10T18:27:49.000Z | youtubesearch/urls.py | shankarj67/Django-youtubesearch | 7a96592fa9c65ab44cce8724b0872675467a0863 | [
"MIT"
] | null | null | null | """youtubesearch URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class... | 34.869565 | 77 | 0.704489 | from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('search.urls')),
]
| true | true |
f702b307d609b7a41be38ee79231f650669a6ccf | 90,700 | py | Python | selfdrive/car/hyundai/values.py | yayiblue/op_v0814_crwusiz | 8c047a54cd950af875239eefc80f3558693cb4f8 | [
"MIT"
] | null | null | null | selfdrive/car/hyundai/values.py | yayiblue/op_v0814_crwusiz | 8c047a54cd950af875239eefc80f3558693cb4f8 | [
"MIT"
] | null | null | null | selfdrive/car/hyundai/values.py | yayiblue/op_v0814_crwusiz | 8c047a54cd950af875239eefc80f3558693cb4f8 | [
"MIT"
] | null | null | null | from cereal import car
from selfdrive.car import dbc_dict
Ecu = car.CarParams.Ecu
class CarControllerParams:
ACCEL_MAX = 2.0
ACCEL_MIN = -3.7
STEER_MAX = 384 # 409 is the max, 255 is stock
STEER_DELTA_UP = 3
STEER_DELTA_DOWN = 7
STEER_DRIVER_ALLOWANCE = 50
STEER_DRIVER_MULTIPLIER = 2
STEER_DRIVER_FA... | 80.265487 | 974 | 0.644818 | from cereal import car
from selfdrive.car import dbc_dict
Ecu = car.CarParams.Ecu
class CarControllerParams:
ACCEL_MAX = 2.0
ACCEL_MIN = -3.7
STEER_MAX = 384
STEER_DELTA_UP = 3
STEER_DELTA_DOWN = 7
STEER_DRIVER_ALLOWANCE = 50
STEER_DRIVER_MULTIPLIER = 2
STEER_DRIVER_FACTOR = 1
class CAR:
ELA... | true | true |
f702b3137c31de742296618ee6e83a233c38cd21 | 7,384 | py | Python | src/primaires/communication/editeurs/messagerie/edt_envoi.py | stormi/tsunami | bdc853229834b52b2ee8ed54a3161a1a3133d926 | [
"BSD-3-Clause"
] | null | null | null | src/primaires/communication/editeurs/messagerie/edt_envoi.py | stormi/tsunami | bdc853229834b52b2ee8ed54a3161a1a3133d926 | [
"BSD-3-Clause"
] | null | null | null | src/primaires/communication/editeurs/messagerie/edt_envoi.py | stormi/tsunami | bdc853229834b52b2ee8ed54a3161a1a3133d926 | [
"BSD-3-Clause"
] | null | null | null | # -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# l... | 41.717514 | 80 | 0.566766 |
from primaires.interpreteur.editeur import Editeur
from primaires.interpreteur.editeur.env_objet import EnveloppeObjet
from primaires.communication.editeurs.medit import EdtMedit
from primaires.communication.mudmail import ENVOYE
from primaires.format.fonctions import couper_phrase
class... | true | true |
f702b3e836707390409c7ac1aa8b29e284bbca51 | 8,633 | py | Python | pyro/infer/trace_elbo.py | cnheider/pyro | 60bcab73ada30c2b3f05d525690c9664ff6fc22e | [
"MIT"
] | null | null | null | pyro/infer/trace_elbo.py | cnheider/pyro | 60bcab73ada30c2b3f05d525690c9664ff6fc22e | [
"MIT"
] | null | null | null | pyro/infer/trace_elbo.py | cnheider/pyro | 60bcab73ada30c2b3f05d525690c9664ff6fc22e | [
"MIT"
] | null | null | null | from __future__ import absolute_import, division, print_function
import numbers
import warnings
import torch
from torch.autograd import Variable
import pyro
import pyro.poutine as poutine
from pyro.distributions.util import is_identically_zero
from pyro.infer.elbo import ELBO
from pyro.infer.enum import iter_discret... | 42.950249 | 103 | 0.586355 | from __future__ import absolute_import, division, print_function
import numbers
import warnings
import torch
from torch.autograd import Variable
import pyro
import pyro.poutine as poutine
from pyro.distributions.util import is_identically_zero
from pyro.infer.elbo import ELBO
from pyro.infer.enum import iter_discret... | true | true |
f702b5e51d59cc678d28c85bdace0ba9bb5040f9 | 120 | py | Python | hydromt/workflows/__init__.py | couasnonanais/hydromt | 6ff3bb6e76cea8247be171f1fe781c0cbb7e9c9e | [
"MIT"
] | null | null | null | hydromt/workflows/__init__.py | couasnonanais/hydromt | 6ff3bb6e76cea8247be171f1fe781c0cbb7e9c9e | [
"MIT"
] | null | null | null | hydromt/workflows/__init__.py | couasnonanais/hydromt | 6ff3bb6e76cea8247be171f1fe781c0cbb7e9c9e | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""HydroMT workflows"""
from .basin_mask import *
from .forcing import *
from .rivers import *
| 17.142857 | 25 | 0.658333 |
from .basin_mask import *
from .forcing import *
from .rivers import *
| true | true |
f702b5f83d11d2fb519cd57e45d49aaab4d30380 | 1,456 | py | Python | ddtrace/contrib/falcon/__init__.py | SzySteve/dd-trace-py | 90d1d5981c72ea312c21ac04e5be47521d0f0f2e | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | ddtrace/contrib/falcon/__init__.py | SzySteve/dd-trace-py | 90d1d5981c72ea312c21ac04e5be47521d0f0f2e | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | ddtrace/contrib/falcon/__init__.py | SzySteve/dd-trace-py | 90d1d5981c72ea312c21ac04e5be47521d0f0f2e | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | """
To trace the falcon web framework, install the trace middleware::
import falcon
from ddtrace import tracer
from ddtrace.contrib.falcon import TraceMiddleware
mw = TraceMiddleware(tracer, 'my-falcon-app')
falcon.API(middleware=[mw])
You can also use the autopatching functionality::
import... | 25.54386 | 80 | 0.723214 | from ...utils.importlib import require_modules
required_modules = ["falcon"]
with require_modules(required_modules) as missing_modules:
if not missing_modules:
from .middleware import TraceMiddleware
from .patch import patch
__all__ = ["TraceMiddleware", "patch"]
| true | true |
f702b664d120e7b3a5ada847d1a9b2e095657822 | 12,217 | py | Python | script/sync.py | gonzalezjo/tcecgui | 30fd82a0b83c7db7335eb3e7b05487d1fad1dbb3 | [
"Apache-2.0"
] | null | null | null | script/sync.py | gonzalezjo/tcecgui | 30fd82a0b83c7db7335eb3e7b05487d1fad1dbb3 | [
"Apache-2.0"
] | null | null | null | script/sync.py | gonzalezjo/tcecgui | 30fd82a0b83c7db7335eb3e7b05487d1fad1dbb3 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
# @author octopoulo <polluxyz@gmail.com>
# @version 2020-05-01
"""
Sync
"""
import gzip
from logging import getLogger
import os
import re
import shutil
from subprocess import run
from time import time
from typing import Any
from PIL import Image, ImageFile
from common import makedirs_safe, read_text... | 29.438554 | 113 | 0.503397 |
import gzip
from logging import getLogger
import os
import re
import shutil
from subprocess import run
from time import time
from typing import Any
from PIL import Image, ImageFile
from common import makedirs_safe, read_text_safe, write_text_safe
from css_minify import css_minify
BASE = os.path.dirname(os.pat... | true | true |
f702b7c58a323d000bad0d9da5c5c1cb62e79373 | 1,508 | py | Python | tests/main.py | viniarck/yala | 6e5493371645a6584dd54bc1a13ff819257f45a8 | [
"MIT"
] | 3 | 2020-05-29T05:03:01.000Z | 2020-06-09T14:40:28.000Z | tests/main.py | viniarck/yala | 6e5493371645a6584dd54bc1a13ff819257f45a8 | [
"MIT"
] | 25 | 2020-05-29T05:03:15.000Z | 2021-11-15T05:21:21.000Z | tests/main.py | viniarck/yala | 6e5493371645a6584dd54bc1a13ff819257f45a8 | [
"MIT"
] | null | null | null | """Tests for the main module."""
import unittest
from unittest.mock import Mock, patch
from yala.main import LinterRunner
class TestLinterRunner(unittest.TestCase):
"""Test the LinterRunner class."""
@patch('yala.main.Config')
def test_chosen_not_found(self, mock_config):
"""Should print an erro... | 35.904762 | 78 | 0.67374 | import unittest
from unittest.mock import Mock, patch
from yala.main import LinterRunner
class TestLinterRunner(unittest.TestCase):
@patch('yala.main.Config')
def test_chosen_not_found(self, mock_config):
name = 'my linter'
mock_config.user_linters = [name]
_, stderr = self.... | true | true |
f702b8499e7e86033ca8009acb49c904c799a1ff | 3,359 | py | Python | custom_components/kontomierz_sensor/sensor.py | pawelhulek/kontomierz-sensor | 7e7862c259d11a3406ebc6faabe7f2c4bd9ff70b | [
"MIT"
] | 2 | 2022-02-15T19:41:22.000Z | 2022-03-08T09:46:53.000Z | custom_components/kontomierz_sensor/sensor.py | pawelhulek/kontomierz-sensor | 7e7862c259d11a3406ebc6faabe7f2c4bd9ff70b | [
"MIT"
] | null | null | null | custom_components/kontomierz_sensor/sensor.py | pawelhulek/kontomierz-sensor | 7e7862c259d11a3406ebc6faabe7f2c4bd9ff70b | [
"MIT"
] | null | null | null | """Platform for sensor integration."""
from __future__ import annotations
import homeassistant.helpers.config_validation as cv
import requests
import voluptuous as vol
from homeassistant.components.sensor import SensorEntity, PLATFORM_SCHEMA, SensorStateClass, SensorDeviceClass
from homeassistant.const import CONF_USE... | 36.912088 | 110 | 0.671033 | from __future__ import annotations
import homeassistant.helpers.config_validation as cv
import requests
import voluptuous as vol
from homeassistant.components.sensor import SensorEntity, PLATFORM_SCHEMA, SensorStateClass, SensorDeviceClass
from homeassistant.const import CONF_USERNAME, CONF_PASSWORD, CONF_API_TOKEN
fr... | true | true |
f702b8a772bb5d14f134560768bd7b16e89d9a92 | 15,785 | py | Python | models/__init__.py | Sriram-Ravula/ncsnv2 | f610b59441a34063fae1c02aa06837b7eec95c03 | [
"MIT"
] | null | null | null | models/__init__.py | Sriram-Ravula/ncsnv2 | f610b59441a34063fae1c02aa06837b7eec95c03 | [
"MIT"
] | null | null | null | models/__init__.py | Sriram-Ravula/ncsnv2 | f610b59441a34063fae1c02aa06837b7eec95c03 | [
"MIT"
] | null | null | null | import torch
import numpy as np
def get_sigmas(config):
if config.model.sigma_dist == 'geometric':
sigmas = torch.tensor(
np.exp(np.linspace(np.log(config.model.sigma_begin), np.log(config.model.sigma_end),
config.model.num_classes))).float().to(config.device)
... | 44.092179 | 139 | 0.540703 | import torch
import numpy as np
def get_sigmas(config):
if config.model.sigma_dist == 'geometric':
sigmas = torch.tensor(
np.exp(np.linspace(np.log(config.model.sigma_begin), np.log(config.model.sigma_end),
config.model.num_classes))).float().to(config.device)
... | true | true |
f702b9242485f5679da54c8293d1d4239b240653 | 10,790 | py | Python | kivymd/uix/useranimationcard.py | RedGui/KivyMD | 5fc9c4c52d01816ba8885fed57f89bf923b38c15 | [
"MIT"
] | null | null | null | kivymd/uix/useranimationcard.py | RedGui/KivyMD | 5fc9c4c52d01816ba8885fed57f89bf923b38c15 | [
"MIT"
] | null | null | null | kivymd/uix/useranimationcard.py | RedGui/KivyMD | 5fc9c4c52d01816ba8885fed57f89bf923b38c15 | [
"MIT"
] | null | null | null | """
User Animation Card
===================
Copyright (c) 2019 Ivanov Yuri
For suggestions and questions:
<kivydevelopment@gmail.com>
This file is distributed under the terms of the same license,
as the Kivy framework.
Example
-------
from kivymd.app import MDApp
from kivy.lang import Builder
from kivy.factory imp... | 29.642857 | 122 | 0.624838 |
from kivy.clock import Clock
from kivy.animation import Animation
from kivy.core.window import Window
from kivy.metrics import dp, sp
from kivy.properties import ObjectProperty, StringProperty, ListProperty
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLa... | true | true |
f702bcd10e528ab743515c3efc44683485009bd7 | 1,733 | py | Python | app/api/resources/validators.py | eLemmings/back | ba5dbc5f64625b61150ce53f12a9393fba060f02 | [
"MIT"
] | null | null | null | app/api/resources/validators.py | eLemmings/back | ba5dbc5f64625b61150ce53f12a9393fba060f02 | [
"MIT"
] | null | null | null | app/api/resources/validators.py | eLemmings/back | ba5dbc5f64625b61150ce53f12a9393fba060f02 | [
"MIT"
] | null | null | null | # Moduł definiujący walidatory API
from marshmallow import Schema, fields, validate
fields.Email.default_error_messages['required'] = 'Email jest wymagany'
fields.Email.default_error_messages['invalid'] = 'Niepoprawny adres email'
class VUser(Schema):
# Walidator rejestracji
nick = fields.String(
r... | 28.883333 | 102 | 0.713791 |
from marshmallow import Schema, fields, validate
fields.Email.default_error_messages['required'] = 'Email jest wymagany'
fields.Email.default_error_messages['invalid'] = 'Niepoprawny adres email'
class VUser(Schema):
nick = fields.String(
required=True, validate=validate.Length(min=4, max=30, err... | true | true |
f702bd8bccda922a4d40e754a378080f65315f49 | 2,869 | py | Python | option.py | ISKU/BOJ-Solutions-Downloader | 2277b2d00204ea47c1a086438100b6057daaa244 | [
"MIT"
] | 2 | 2019-01-04T18:48:23.000Z | 2019-10-27T10:48:09.000Z | option.py | ISKU/BOJ-Solutions-Downloader | 2277b2d00204ea47c1a086438100b6057daaa244 | [
"MIT"
] | null | null | null | option.py | ISKU/BOJ-Solutions-Downloader | 2277b2d00204ea47c1a086438100b6057daaa244 | [
"MIT"
] | null | null | null | class Option:
def __init__(self, option_info):
self.option_info = option_info
self.flag = option_info['flag']
def mkdir(self):
if self.flag == False:
return False
return self.option_info['mkdir']
def dir_name(self, problem):
if self.flag == False:
... | 29.57732 | 77 | 0.385849 | class Option:
def __init__(self, option_info):
self.option_info = option_info
self.flag = option_info['flag']
def mkdir(self):
if self.flag == False:
return False
return self.option_info['mkdir']
def dir_name(self, problem):
if self.flag == False:
... | true | true |
f702bdf164ec4134439d875a2ad83515cbba5787 | 5,769 | py | Python | torch/ao/quantization/fuse_modules.py | WBobby/pytorch | 655960460ccca936fa5c06df6bbafd25b5582115 | [
"Intel"
] | 24 | 2020-11-02T21:25:12.000Z | 2022-03-17T07:20:33.000Z | torch/ao/quantization/fuse_modules.py | WBobby/pytorch | 655960460ccca936fa5c06df6bbafd25b5582115 | [
"Intel"
] | 1 | 2019-08-01T00:17:43.000Z | 2019-09-12T01:31:53.000Z | torch/ao/quantization/fuse_modules.py | WBobby/pytorch | 655960460ccca936fa5c06df6bbafd25b5582115 | [
"Intel"
] | 12 | 2020-11-06T05:00:37.000Z | 2022-01-30T19:17:36.000Z |
import copy
import torch.nn as nn
from torch.quantization.fuser_method_mappings import get_fuser_method
# for backward compatiblity
from torch.quantization.fuser_method_mappings import fuse_conv_bn # noqa: F401
from torch.quantization.fuser_method_mappings import fuse_conv_bn_relu # noqa: F401
from typing import ... | 38.97973 | 117 | 0.688508 |
import copy
import torch.nn as nn
from torch.quantization.fuser_method_mappings import get_fuser_method
from torch.quantization.fuser_method_mappings import fuse_conv_bn
from torch.quantization.fuser_method_mappings import fuse_conv_bn_relu
from typing import List, Optional
def _get_module(model, submodule_k... | true | true |
f702c178fa0468bda62c777ae3343f3ff32258d0 | 2,947 | py | Python | idaes/apps/ripe/__init__.py | OOAmusat/idaes-pse | ae7d3bb8e372bc32822dcdcb75e9fd96b78da539 | [
"RSA-MD"
] | null | null | null | idaes/apps/ripe/__init__.py | OOAmusat/idaes-pse | ae7d3bb8e372bc32822dcdcb75e9fd96b78da539 | [
"RSA-MD"
] | null | null | null | idaes/apps/ripe/__init__.py | OOAmusat/idaes-pse | ae7d3bb8e372bc32822dcdcb75e9fd96b78da539 | [
"RSA-MD"
] | 1 | 2022-03-17T11:08:43.000Z | 2022-03-17T11:08:43.000Z | #################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... | 30.697917 | 99 | 0.663386 | true | true | |
f702c1a5dc7274750e530ef4de6a21cb1e73cad8 | 1,465 | py | Python | tests/helpers/test_init.py | dauden1184/home-assistant | f4c6d389b77d0efa86644e76604eaea5d21abdb5 | [
"Apache-2.0"
] | 37 | 2018-05-22T07:17:26.000Z | 2022-03-03T13:14:46.000Z | tests/helpers/test_init.py | dauden1184/home-assistant | f4c6d389b77d0efa86644e76604eaea5d21abdb5 | [
"Apache-2.0"
] | 125 | 2018-12-11T07:31:20.000Z | 2021-07-27T08:20:03.000Z | tests/helpers/test_init.py | dauden1184/home-assistant | f4c6d389b77d0efa86644e76604eaea5d21abdb5 | [
"Apache-2.0"
] | 21 | 2017-07-26T17:09:40.000Z | 2022-03-27T22:37:22.000Z | """Test component helpers."""
# pylint: disable=protected-access
from collections import OrderedDict
import unittest
from homeassistant import helpers
from tests.common import get_test_home_assistant
class TestHelpers(unittest.TestCase):
"""Tests homeassistant.helpers module."""
# pylint: disable=invalid-n... | 28.72549 | 77 | 0.56314 |
from collections import OrderedDict
import unittest
from homeassistant import helpers
from tests.common import get_test_home_assistant
class TestHelpers(unittest.TestCase):
def setUp(self):
self.hass = get_test_home_assistant()
def tearDown(self):
self.hass.stop()
def test_... | true | true |
f702c27587a9d8e0dceffc00ca6aaa56ec63ef6f | 3,699 | py | Python | tools/processing.py | SmolakK/HuMobi | 67b40f839a843123093582935e89f91e16bc4374 | [
"BSD-3-Clause"
] | null | null | null | tools/processing.py | SmolakK/HuMobi | 67b40f839a843123093582935e89f91e16bc4374 | [
"BSD-3-Clause"
] | null | null | null | tools/processing.py | SmolakK/HuMobi | 67b40f839a843123093582935e89f91e16bc4374 | [
"BSD-3-Clause"
] | null | null | null | import pandas as pd
import numpy as np
def top_time(ind=None, gs=None):
"""
Selects the location (by coordinates) which was visited for the longest period during given time interval
:param ind: user id
:param gs: GeoDataFrame from groupby execution containing all the data in the given time interval
:return: user... | 31.347458 | 122 | 0.712625 | import pandas as pd
import numpy as np
def top_time(ind=None, gs=None):
aggregated = []
for tstamp, g in gs:
if len(g) > 1:
diff_places = (g['geometry'].shift(-1) != g['geometry']).iloc[:-1]
if diff_places.any():
g_res = g.reset_index()
diffs = g_res.shift(-1)['datetime'] - g_res['datetime... | true | true |
f702c2aa854a720c28f7a9cad75cc8ce2656eab8 | 36 | py | Python | show_config.py | temper8/MatBench | 1ea24d18af35b57ef2d61148709eb6d49835fe97 | [
"MIT"
] | null | null | null | show_config.py | temper8/MatBench | 1ea24d18af35b57ef2d61148709eb6d49835fe97 | [
"MIT"
] | null | null | null | show_config.py | temper8/MatBench | 1ea24d18af35b57ef2d61148709eb6d49835fe97 | [
"MIT"
] | null | null | null | import numpy as np
np.show_config() | 18 | 19 | 0.777778 | import numpy as np
np.show_config() | true | true |
f702c2d50f706742af9223282c2024342b6a82c5 | 897 | py | Python | Output.py | itsayeshanaeem/WCPSAccess | 12b7a2f28a0f849a42336357723a57b6cb5905c9 | [
"CNRI-Python"
] | null | null | null | Output.py | itsayeshanaeem/WCPSAccess | 12b7a2f28a0f849a42336357723a57b6cb5905c9 | [
"CNRI-Python"
] | null | null | null | Output.py | itsayeshanaeem/WCPSAccess | 12b7a2f28a0f849a42336357723a57b6cb5905c9 | [
"CNRI-Python"
] | null | null | null | from PIL import Image as im
import numpy as np
from io import BytesIO
import csv
class outputResponse():
def __init__(self,reponse):
self.response = reponse
def retrieveResult(response, returntype):
if (returntype == "image/png" or returntype == "image/jpeg"):
img_arr = np.array(i... | 30.931034 | 69 | 0.571906 | from PIL import Image as im
import numpy as np
from io import BytesIO
import csv
class outputResponse():
def __init__(self,reponse):
self.response = reponse
def retrieveResult(response, returntype):
if (returntype == "image/png" or returntype == "image/jpeg"):
img_arr = np.array(i... | true | true |
f702c446130e944a036310a43721bc766a7a5bdb | 766 | py | Python | tests/test_types_file.py | betasewer/machaon | 63ccb4405ac693f14f9d25f6a706466a917dddbf | [
"MIT"
] | 2 | 2020-07-05T08:39:12.000Z | 2022-01-19T22:08:21.000Z | tests/test_types_file.py | betasewer/machaon | 63ccb4405ac693f14f9d25f6a706466a917dddbf | [
"MIT"
] | 23 | 2020-06-23T16:18:17.000Z | 2021-12-29T09:56:48.000Z | tests/test_types_file.py | betasewer/machaon | 63ccb4405ac693f14f9d25f6a706466a917dddbf | [
"MIT"
] | null | null | null | import pytest
import os
from machaon.types.file import TextFile
from machaon.types.shell import Path
from machaon.core.invocation import instant_return_test, instant_context
def test_construct(tmp_path):
FILEPATH = Path(__file__)
context = instant_context()
context.define_type(TextFile)
f = instant_re... | 28.37037 | 72 | 0.693211 | import pytest
import os
from machaon.types.file import TextFile
from machaon.types.shell import Path
from machaon.core.invocation import instant_return_test, instant_context
def test_construct(tmp_path):
FILEPATH = Path(__file__)
context = instant_context()
context.define_type(TextFile)
f = instant_re... | true | true |
f702c5549f1e9d10bb50fdc16097c0795dafbdde | 692 | py | Python | practice/Python3/regular_expressions/regular_expressions.py | 21-guns/algo | b2a0665d7520cca1bd8a9a4fceed0ba09618eadd | [
"MIT"
] | null | null | null | practice/Python3/regular_expressions/regular_expressions.py | 21-guns/algo | b2a0665d7520cca1bd8a9a4fceed0ba09618eadd | [
"MIT"
] | null | null | null | practice/Python3/regular_expressions/regular_expressions.py | 21-guns/algo | b2a0665d7520cca1bd8a9a4fceed0ba09618eadd | [
"MIT"
] | 1 | 2018-01-10T13:39:47.000Z | 2018-01-10T13:39:47.000Z | import re
# match whole string
data1 = "aaab"
data2 = "aaaba"
pattern = r"\Aa+b\Z"
match1 = re.match(pattern, data1)
print(match1)
match2 = re.match(pattern, data2)
print(match2)
# regular expression options
data = "AaaA\n\raaaA"
pattern = r"^(a+)$"
match = re.match(pattern, data, re.I | re.M)
print(match)
print(m... | 18.210526 | 44 | 0.669075 | import re
data1 = "aaab"
data2 = "aaaba"
pattern = r"\Aa+b\Z"
match1 = re.match(pattern, data1)
print(match1)
match2 = re.match(pattern, data2)
print(match2)
data = "AaaA\n\raaaA"
pattern = r"^(a+)$"
match = re.match(pattern, data, re.I | re.M)
print(match)
print(match.group())
data = "Pi = 3.14, exponent = 2.... | true | true |
f702c5f926fe8566850d15108b97b51680b44657 | 1,043 | py | Python | django_bnr/migrations/0001_initial.py | presslabs/django-bnr | 07ed65ba8e153197862baa8a4428e068ade99c9e | [
"MIT"
] | null | null | null | django_bnr/migrations/0001_initial.py | presslabs/django-bnr | 07ed65ba8e153197862baa8a4428e068ade99c9e | [
"MIT"
] | null | null | null | django_bnr/migrations/0001_initial.py | presslabs/django-bnr | 07ed65ba8e153197862baa8a4428e068ade99c9e | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Rate',
fields=[
('id', models.AutoField(verbose... | 33.645161 | 174 | 0.549377 |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Rate',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=F... | true | true |
f702c66ec9d5bae5d0c6a271922042b43ed38eb8 | 38 | py | Python | {{cookiecutter.project_slug}}/base/settings_local.py | claysllanxavier/django-cookiecutter | 97de7ff4ed3dc94c32bf756a57aee0664a888cbc | [
"BSD-3-Clause"
] | 8 | 2021-08-13T17:48:27.000Z | 2022-02-22T02:34:15.000Z | {{cookiecutter.project_slug}}/base/settings_local.py | claysllanxavier/django-cookiecutter | 97de7ff4ed3dc94c32bf756a57aee0664a888cbc | [
"BSD-3-Clause"
] | 2 | 2022-03-24T20:39:00.000Z | 2022-03-24T20:39:48.000Z | {{cookiecutter.project_slug}}/base/settings_local.py | claysllanxavier/django-cookiecutter | 97de7ff4ed3dc94c32bf756a57aee0664a888cbc | [
"BSD-3-Clause"
] | 2 | 2021-09-21T00:05:27.000Z | 2022-01-03T10:50:05.000Z | DEBUG = True
ALLOWED_HOSTS = ['*', ]
| 9.5 | 23 | 0.578947 | DEBUG = True
ALLOWED_HOSTS = ['*', ]
| true | true |
f702c70a99f711f50de59372d5545d6e6a043b23 | 41,365 | py | Python | main.py | yukkerike/vklml | 2efb6fa506a71f8dec8286c833b92985e70dc164 | [
"MIT"
] | 6 | 2020-10-14T20:11:16.000Z | 2022-02-08T16:12:46.000Z | main.py | yukkerike/vklml | 2efb6fa506a71f8dec8286c833b92985e70dc164 | [
"MIT"
] | null | null | null | main.py | yukkerike/vklml | 2efb6fa506a71f8dec8286c833b92985e70dc164 | [
"MIT"
] | null | null | null | import logging
import logging.handlers
import sys
import os
import json
import sqlite3
import signal
import threading
import time
import difflib
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
import requests.exceptions
cwd = os.path.dirname(os.path.abspath(__file__))
logging.basicConfig(
format=... | 39.47042 | 2,443 | 0.512656 | import logging
import logging.handlers
import sys
import os
import json
import sqlite3
import signal
import threading
import time
import difflib
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
import requests.exceptions
cwd = os.path.dirname(os.path.abspath(__file__))
logging.basicConfig(
format=... | true | true |
f702c7b2633322629d2c55aa4ffcdb1946ff6acb | 946 | py | Python | events.py | tilakchandlo/swing | f4aa10dd2858dfe85dc1d5c7077c883d2cf19d8d | [
"Apache-2.0"
] | 1 | 2021-07-05T10:18:30.000Z | 2021-07-05T10:18:30.000Z | events.py | tilakchandlo/swing | f4aa10dd2858dfe85dc1d5c7077c883d2cf19d8d | [
"Apache-2.0"
] | null | null | null | events.py | tilakchandlo/swing | f4aa10dd2858dfe85dc1d5c7077c883d2cf19d8d | [
"Apache-2.0"
] | 1 | 2021-04-29T11:08:59.000Z | 2021-04-29T11:08:59.000Z | """
Definition of events.
"""
from abc import ABC
EVENT_LOG = 'eLog' #Log Event
EVENT_MARKETDATA = 'eMarketData' #Pushing MarketData Event
EVENT_TRADE = 'eTrade' #Trade Event
EVENT_BUY = 'eBuy' #Buy Event
EVENT_SELL = 'eSell' ... | 27.028571 | 68 | 0.571882 |
from abc import ABC
EVENT_LOG = 'eLog'
EVENT_MARKETDATA = 'eMarketData'
EVENT_TRADE = 'eTrade'
EVENT_BUY = 'eBuy'
EVENT_SELL = 'eSell'
EVENT_CANCEL = 'eCancel'
EVENT_POSITION = 'ePosition... | true | true |
f702ca819293ff5b6e420a06411eaf1637cfb437 | 5,235 | py | Python | web/addons/sale_stock/res_config.py | diogocs1/comps | 63df07f6cf21c41e4527c06e2d0499f23f4322e7 | [
"Apache-2.0"
] | 1 | 2019-12-29T11:53:56.000Z | 2019-12-29T11:53:56.000Z | odoo/addons/sale_stock/res_config.py | tuanquanghpvn/odoo8-tutorial | 52d25f1ca5f233c431cb9d3b24b79c3b4fb5127e | [
"MIT"
] | null | null | null | odoo/addons/sale_stock/res_config.py | tuanquanghpvn/odoo8-tutorial | 52d25f1ca5f233c431cb9d3b24b79c3b4fb5127e | [
"MIT"
] | 3 | 2020-10-08T14:42:10.000Z | 2022-01-28T14:12:29.000Z | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | 56.290323 | 200 | 0.670487 | true | true | |
f702caa371c248da66937b8521efe91e4540f538 | 3,164 | py | Python | tests/test_preprocessing.py | liuyigh/CITE-seq-Count | 5d03e382468fb28187dc15ee1d612dacaac52246 | [
"MIT"
] | null | null | null | tests/test_preprocessing.py | liuyigh/CITE-seq-Count | 5d03e382468fb28187dc15ee1d612dacaac52246 | [
"MIT"
] | null | null | null | tests/test_preprocessing.py | liuyigh/CITE-seq-Count | 5d03e382468fb28187dc15ee1d612dacaac52246 | [
"MIT"
] | null | null | null | import pytest
import io
from cite_seq_count import preprocessing
@pytest.fixture
def data():
from collections import OrderedDict
from itertools import islice
# Test file paths
pytest.correct_whitelist_path = 'tests/test_data/whitelists/correct.csv'
pytest.correct_tags_path = 'tests/test_data/... | 43.342466 | 137 | 0.760114 | import pytest
import io
from cite_seq_count import preprocessing
@pytest.fixture
def data():
from collections import OrderedDict
from itertools import islice
pytest.correct_whitelist_path = 'tests/test_data/whitelists/correct.csv'
pytest.correct_tags_path = 'tests/test_data/tags/correct.csv'... | true | true |
f702cc5e6ea08c3e34d01f04c4c75d3ab18e6e75 | 4,384 | py | Python | chess/python/chess_server.py | MrXisOnline/C-Program | 9b95802a2d62f46f28039b5dae306d30296ecab0 | [
"MIT"
] | null | null | null | chess/python/chess_server.py | MrXisOnline/C-Program | 9b95802a2d62f46f28039b5dae306d30296ecab0 | [
"MIT"
] | null | null | null | chess/python/chess_server.py | MrXisOnline/C-Program | 9b95802a2d62f46f28039b5dae306d30296ecab0 | [
"MIT"
] | null | null | null | from game_data import *
from hosting import ServerHandler, ClientHandler
import json
board = [
["R", "K", "B", "Q", "E", "B", "K", "R"],
["P", "P", "P", "P", "P", "P", "P", "P"],
[" ", " ", " ", " ", " ", " ", " ", " "],
[" ", " ", " ", " ", " ", " ", " ", " "],
[" ", " ", " ", " ", " ", " ", " ", "... | 36.840336 | 100 | 0.627053 | from game_data import *
from hosting import ServerHandler, ClientHandler
import json
board = [
["R", "K", "B", "Q", "E", "B", "K", "R"],
["P", "P", "P", "P", "P", "P", "P", "P"],
[" ", " ", " ", " ", " ", " ", " ", " "],
[" ", " ", " ", " ", " ", " ", " ", " "],
[" ", " ", " ", " ", " ", " ", " ", "... | true | true |
f702ccf3a56618e39a544845aed829d512ad3ede | 6,100 | py | Python | pydifact/segments.py | mj0nez/pydifact | 3833060d30a3ac5601ec14902d844655ca9b0fc4 | [
"MIT"
] | null | null | null | pydifact/segments.py | mj0nez/pydifact | 3833060d30a3ac5601ec14902d844655ca9b0fc4 | [
"MIT"
] | null | null | null | pydifact/segments.py | mj0nez/pydifact | 3833060d30a3ac5601ec14902d844655ca9b0fc4 | [
"MIT"
] | null | null | null | # Pydifact - a python edifact library
#
# Copyright (c) 2019 Christian González
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights ... | 35.465116 | 112 | 0.640656 |
from typing import Union, List
from pydifact.api import EDISyntaxError, PluginMount
from pydifact.control import Characters
class SegmentProvider(metaclass=PluginMount):
def __str__(self):
def validate(self) -> bool:
class Segment(SegmentProvider):
__omitted__ = True
d... | true | true |
f702cd6d3b749291e05ca743af5b6d809f48a705 | 2,141 | py | Python | common/realtime.py | wolterhv/openpilot | c189d15af9a613d8f109b39298c0ab3e22f39f6d | [
"MIT"
] | 171 | 2018-11-18T16:41:27.000Z | 2022-03-15T06:58:04.000Z | common/realtime.py | wolterhv/openpilot | c189d15af9a613d8f109b39298c0ab3e22f39f6d | [
"MIT"
] | 41 | 2018-08-01T17:36:08.000Z | 2020-12-16T02:42:57.000Z | common/realtime.py | wolterhv/openpilot | c189d15af9a613d8f109b39298c0ab3e22f39f6d | [
"MIT"
] | 378 | 2018-10-23T16:36:06.000Z | 2022-03-11T08:59:51.000Z | """Utilities for reading real time clocks and keeping soft real time constraints."""
import gc
import os
import time
import multiprocessing
from common.clock import sec_since_boot # pylint: disable=no-name-in-module, import-error
from selfdrive.hardware import PC, TICI
# time step for each process
DT_CTRL = 0.01 #... | 24.895349 | 92 | 0.714152 | import gc
import os
import time
import multiprocessing
from common.clock import sec_since_boot
from selfdrive.hardware import PC, TICI
DT_CTRL = 0.01
DT_MDL = 0.05
DT_TRML = 0.5
if TICI:
DT_DMON = 0.05
else:
DT_DMON = 0.1
class Priority:
CTRL_LOW = 51
CTRL_HIGH = 53
def set_re... | true | true |
f702cdd14336fe2d99f8b21d1c298aa8279cf0b2 | 7,420 | py | Python | pyluna-pathology/luna/pathology/point_annotation/proxy_table/generate.py | msk-mind/data-processing | c016d218da2eca003d06b96f2c03f16b3ce97873 | [
"Apache-2.0"
] | 1 | 2022-03-29T03:48:00.000Z | 2022-03-29T03:48:00.000Z | pyluna-pathology/luna/pathology/point_annotation/proxy_table/generate.py | msk-mind/data-processing | c016d218da2eca003d06b96f2c03f16b3ce97873 | [
"Apache-2.0"
] | 96 | 2020-11-15T01:39:12.000Z | 2021-08-24T14:37:49.000Z | pyluna-pathology/luna/pathology/point_annotation/proxy_table/generate.py | msk-mind/luna | 282b5bd594cb5bf1ef2a7fdf56fca9bea5ad7102 | [
"Apache-2.0"
] | 1 | 2021-01-04T15:14:23.000Z | 2021-01-04T15:14:23.000Z |
import os, json
import shutil, logging
import click
from pyspark.sql.functions import lit, udf, explode, array, to_json
from pyspark.sql.types import ArrayType, StringType, IntegerType, MapType, StructType, StructField
from luna.common.CodeTimer import CodeTimer
from luna.common.config import ConfigSet
from luna.com... | 41.920904 | 245 | 0.714555 |
import os, json
import shutil, logging
import click
from pyspark.sql.functions import lit, udf, explode, array, to_json
from pyspark.sql.types import ArrayType, StringType, IntegerType, MapType, StructType, StructField
from luna.common.CodeTimer import CodeTimer
from luna.common.config import ConfigSet
from luna.com... | true | true |
f702cf37a5d2c8ddbc6bd4cf2cda75e9eb2dcfea | 10,938 | py | Python | MSSE-2021/train_model.py | clsteel/DeepPostures | 8a7bed8f1e47e4a502080bf6edd513b822ea0bdf | [
"Apache-2.0"
] | 1 | 2021-06-23T13:28:51.000Z | 2021-06-23T13:28:51.000Z | MSSE-2021/train_model.py | clsteel/DeepPostures | 8a7bed8f1e47e4a502080bf6edd513b822ea0bdf | [
"Apache-2.0"
] | null | null | null | MSSE-2021/train_model.py | clsteel/DeepPostures | 8a7bed8f1e47e4a502080bf6edd513b822ea0bdf | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 Supun Nakandala. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 59.124324 | 190 | 0.6951 |
import os
import sys
import numpy as np
import tensorflow as tf
import pandas as pd
import random
import math
import argparse
sys.path.append('./')
from commons import cnn_bi_lstm_model, input_iterator
tf.random.set_random_seed(2019)
random.seed(2019)
np.random.seed(2019)
def get_train_ops(y, logits,... | true | true |
f702d0bfaf4d80a5d7eaa4d7d94718ae6a61ede4 | 16,945 | py | Python | port/boards/mpython-classroom-kit/modules/mpython_classroom_kit_driver.py | xjiezheng/mpython | 010a92aa0c0984b9418ca124a3466616c3e6d77e | [
"MIT"
] | 6 | 2019-10-02T09:59:28.000Z | 2020-10-11T07:15:58.000Z | port/boards/mpython-classroom-kit/modules/mpython_classroom_kit_driver.py | xjiezheng/mpython | 010a92aa0c0984b9418ca124a3466616c3e6d77e | [
"MIT"
] | 5 | 2019-10-08T07:13:08.000Z | 2019-10-09T04:06:07.000Z | port/boards/mpython-classroom-kit/modules/mpython_classroom_kit_driver.py | xjiezheng/mpython | 010a92aa0c0984b9418ca124a3466616c3e6d77e | [
"MIT"
] | 2 | 2019-09-11T10:50:12.000Z | 2020-03-07T21:17:44.000Z | # labplus mPython-box library
# MIT license; Copyright (c) 2018 labplus
# mpython-box buildin periphers drivers
# history:
# V1.0 zhaohuijiang
from machine import Pin, UART
import time
import ujson
from time import sleep_ms, sleep_us, sleep
# touchpad
class BS8112A(object):
""" """
def __init__(self, i2c)... | 31.851504 | 167 | 0.580525 |
from machine import Pin, UART
import time
import ujson
from time import sleep_ms, sleep_us, sleep
class BS8112A(object):
def __init__(self, i2c):
self.addr = 80
self._i2c = i2c
self.config = [0xB0, 0x00, 0x00, 0x83, 0xf3, 0x98, 0x0f, 0x0f,
0x0f, 0x0f, 0x0f, ... | true | true |
f702d1ee5d85bb2a40fcf9e18f5769b34c6eb104 | 229 | py | Python | examples/fortran/run.py | pyflosic/fodMC | 93259b527d39cc02dcded0c42f89a73ba16851d1 | [
"Apache-2.0"
] | 5 | 2019-06-24T08:03:58.000Z | 2021-04-13T14:54:50.000Z | examples/fortran/run.py | pyflosic/fodMC | 93259b527d39cc02dcded0c42f89a73ba16851d1 | [
"Apache-2.0"
] | 15 | 2019-05-20T10:40:46.000Z | 2021-07-20T16:40:25.000Z | examples/fortran/run.py | pyflosic/fodMC | 93259b527d39cc02dcded0c42f89a73ba16851d1 | [
"Apache-2.0"
] | 2 | 2019-09-28T12:40:59.000Z | 2021-07-20T15:06:11.000Z | import fodmc
# output_mode: PyFLOSIC, NRLMOL
# output_name: NameOfMolecule.xyz (for PyFLOSIC only)
output_mode = ['NRLMOL','PyFLOSIC'][1]
output_name = ['', 'test.xyz'][1]
fodmc.fodmc_mod.get_guess(output_mode,output_name)
| 32.714286 | 54 | 0.737991 | import fodmc
output_mode = ['NRLMOL','PyFLOSIC'][1]
output_name = ['', 'test.xyz'][1]
fodmc.fodmc_mod.get_guess(output_mode,output_name)
| true | true |
f702d2430cad6f9017bafe76fa53486b73f6bf16 | 5,816 | py | Python | tests/gcp/sensors/test_cloud_storage_transfer_service.py | ktmud/incubator-airflow | 43154c643c3c598c769d645891f2e8e123f8bdde | [
"Apache-2.0"
] | 5 | 2020-07-17T07:33:58.000Z | 2022-03-02T06:23:47.000Z | tests/gcp/sensors/test_cloud_storage_transfer_service.py | ktmud/incubator-airflow | 43154c643c3c598c769d645891f2e8e123f8bdde | [
"Apache-2.0"
] | 7 | 2020-06-03T14:55:17.000Z | 2021-12-30T00:01:50.000Z | tests/gcp/sensors/test_cloud_storage_transfer_service.py | ktmud/incubator-airflow | 43154c643c3c598c769d645891f2e8e123f8bdde | [
"Apache-2.0"
] | 12 | 2020-01-09T14:02:39.000Z | 2022-01-24T07:18:51.000Z | # -*- coding: utf-8 -*-
#
# 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
#... | 42.144928 | 102 | 0.714752 |
import unittest
import mock
from parameterized import parameterized
from airflow.gcp.hooks.cloud_storage_transfer_service import GcpTransferOperationStatus
from airflow.gcp.sensors.cloud_storage_transfer_service import CloudDataTransferServiceJobStatusSensor
class TestGcpStorageTransferOperationWa... | true | true |
f702d248ad2a10ba4e875fcb3f658bb636bddf06 | 455 | py | Python | maps/migrations/0012_auto_20201019_2139.py | naveennvrgup/smart-traffic-light | 1c4d050314d8dc42ebf11491b3421c511e2718f3 | [
"MIT"
] | null | null | null | maps/migrations/0012_auto_20201019_2139.py | naveennvrgup/smart-traffic-light | 1c4d050314d8dc42ebf11491b3421c511e2718f3 | [
"MIT"
] | null | null | null | maps/migrations/0012_auto_20201019_2139.py | naveennvrgup/smart-traffic-light | 1c4d050314d8dc42ebf11491b3421c511e2718f3 | [
"MIT"
] | null | null | null | # Generated by Django 3.1.1 on 2020-10-19 16:09
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('maps', '0011_auto_20201019_1839'),
]
operations = [
migrations.AlterField(
model_name='trafficsignal',
... | 22.75 | 100 | 0.621978 |
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('maps', '0011_auto_20201019_1839'),
]
operations = [
migrations.AlterField(
model_name='trafficsignal',
name='timer',
field=models.DateT... | true | true |
f702d2497d469161032517772b4500ad115d0b1e | 670 | py | Python | kekangpai/band/migrations/0003_auto_20160725_1313.py | returnToZ/BandHelper | ce8ca3094c6cc4b05b213766710ba6263f41705d | [
"Apache-2.0"
] | null | null | null | kekangpai/band/migrations/0003_auto_20160725_1313.py | returnToZ/BandHelper | ce8ca3094c6cc4b05b213766710ba6263f41705d | [
"Apache-2.0"
] | null | null | null | kekangpai/band/migrations/0003_auto_20160725_1313.py | returnToZ/BandHelper | ce8ca3094c6cc4b05b213766710ba6263f41705d | [
"Apache-2.0"
] | 1 | 2021-12-15T02:31:09.000Z | 2021-12-15T02:31:09.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-07-25 13:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('band', '0002_auto_20160725_1313'),
]
operations = [... | 25.769231 | 135 | 0.626866 |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('band', '0002_auto_20160725_1313'),
]
operations = [
migrations.RemoveField(
model_name='personal',
... | true | true |
f702d3674b7ec06859bfdd3f9e087d7eefda8de1 | 191,102 | py | Python | imgaug/augmenters/size.py | fchouteau/imgaug | b282b97c13a27a32f91c2e2666db1e128e00cfde | [
"MIT"
] | 1 | 2020-02-26T01:05:12.000Z | 2020-02-26T01:05:12.000Z | imgaug/augmenters/size.py | youbin2014/imgaug | b282b97c13a27a32f91c2e2666db1e128e00cfde | [
"MIT"
] | null | null | null | imgaug/augmenters/size.py | youbin2014/imgaug | b282b97c13a27a32f91c2e2666db1e128e00cfde | [
"MIT"
] | null | null | null | """
Augmenters that somehow change the size of the images.
List of augmenters:
* :class:`Resize`
* :class:`CropAndPad`
* :class:`Crop`
* :class:`Pad`
* :class:`PadToFixedSize`
* :class:`CenterPadToFixedSize`
* :class:`CropToFixedSize`
* :class:`CenterCropToFixedSize`
* :class:`Crop... | 41.498806 | 269 | 0.610104 | from __future__ import print_function, division, absolute_import
import re
import functools
import numpy as np
import cv2
import imgaug as ia
from imgaug.imgaug import _normalize_cv2_input_arr_
from . import meta
from .. import parameters as iap
def _crop_trbl_to_xyxy(shape, top, right, bottom, left, prevent_zero_... | true | true |
f702d36d493f53a3b370731decea28a5e15dc587 | 2,317 | py | Python | tests/memory.py | vpaeder/pymcp2221 | 90f9ae85d7b852128d642e1382f9a7628fc72057 | [
"MIT"
] | null | null | null | tests/memory.py | vpaeder/pymcp2221 | 90f9ae85d7b852128d642e1382f9a7628fc72057 | [
"MIT"
] | null | null | null | tests/memory.py | vpaeder/pymcp2221 | 90f9ae85d7b852128d642e1382f9a7628fc72057 | [
"MIT"
] | null | null | null | from .common import *
__all__ = ["TestReadWriteMemory"]
class TestReadWriteMemory(MCPTestCase):
def test_read_flash_ok(self):
self.mcp.dev.read.return_value = self.xb0_00
self.assertEqual(self.mcp._read_flash(FlashDataSubcode.ChipSettings), self.xb0_00[4:14])
def test_read_sram_ok(self):
... | 47.285714 | 99 | 0.634009 | from .common import *
__all__ = ["TestReadWriteMemory"]
class TestReadWriteMemory(MCPTestCase):
def test_read_flash_ok(self):
self.mcp.dev.read.return_value = self.xb0_00
self.assertEqual(self.mcp._read_flash(FlashDataSubcode.ChipSettings), self.xb0_00[4:14])
def test_read_sram_ok(self):
... | true | true |
f702d376e02116e4fdc4ce32b9b5c0c6704c892d | 1,829 | py | Python | pi/pi.py | saneravi/ML_Stuff | 74e1ed7ba9f4dccb555792315a14ba6071150304 | [
"MIT"
] | 209 | 2015-01-02T03:47:12.000Z | 2022-03-06T16:54:47.000Z | pi/pi.py | Kerwin-Xie/algorithms | 4347a9b7bf54ef378d16d26ef9e357ddc710664b | [
"MIT"
] | 3 | 2015-12-06T14:40:34.000Z | 2021-03-22T17:40:24.000Z | pi/pi.py | Kerwin-Xie/algorithms | 4347a9b7bf54ef378d16d26ef9e357ddc710664b | [
"MIT"
] | 114 | 2015-01-31T08:37:10.000Z | 2022-02-23T04:42:28.000Z | #!/usr/bin/env python
from decimal import Decimal, getcontext
from fractions import Fraction
digits = 500
getcontext().prec = digits
def leibnitz(n):
"""
Parameters
----------
n : int
Returns
-------
Fraction
Approximation of pi.
"""
pi = Fraction(0)
sign = 1
for... | 21.022989 | 79 | 0.547294 |
from decimal import Decimal, getcontext
from fractions import Fraction
digits = 500
getcontext().prec = digits
def leibnitz(n):
pi = Fraction(0)
sign = 1
for k in range(1, n, 2):
pi = pi + sign*Fraction(4, k)
sign *= -1
return pi
def calc_pi(n):
pi = Fraction(0)
for k in r... | true | true |
f702d5de917640b0135e726ec3ce2820b1f09d38 | 1,295 | py | Python | app/data/check.py | redforge/Flask_Signin | b9fe05e0a9af07603622c22d8eba060c2d696d52 | [
"Unlicense"
] | 2 | 2018-08-08T20:26:16.000Z | 2020-06-03T01:06:27.000Z | app/data/check.py | redforge/Flask_Signin | b9fe05e0a9af07603622c22d8eba060c2d696d52 | [
"Unlicense"
] | 2 | 2018-08-08T23:26:19.000Z | 2018-08-08T23:41:33.000Z | app/data/check.py | threethan/Parts-and-Crafts-Sign-In | b9fe05e0a9af07603622c22d8eba060c2d696d52 | [
"Unlicense"
] | null | null | null | import os.path
from app.data.database import init_db, db_path, get_expected_pathname, set_path
def db_exists():
return os.path.isfile(db_path)
def check_db():
global db_path
if (db_path != get_expected_pathname()):
print('DB Check: Running backup')
backup_database_to(get_expected_pathname... | 27.553191 | 135 | 0.650193 | import os.path
from app.data.database import init_db, db_path, get_expected_pathname, set_path
def db_exists():
return os.path.isfile(db_path)
def check_db():
global db_path
if (db_path != get_expected_pathname()):
print('DB Check: Running backup')
backup_database_to(get_expected_pathname... | true | true |
f702d66e53c80b655a01fddefa34c998ecff7a5e | 4,255 | py | Python | sdk/python/pulumi_aws_native/resourcegroups/get_group.py | pulumi/pulumi-aws-native | 1ae4a4d9c2256b2a79ca536f8d8497b28d10e4c3 | [
"Apache-2.0"
] | 29 | 2021-09-30T19:32:07.000Z | 2022-03-22T21:06:08.000Z | sdk/python/pulumi_aws_native/resourcegroups/get_group.py | pulumi/pulumi-aws-native | 1ae4a4d9c2256b2a79ca536f8d8497b28d10e4c3 | [
"Apache-2.0"
] | 232 | 2021-09-30T19:26:26.000Z | 2022-03-31T23:22:06.000Z | sdk/python/pulumi_aws_native/resourcegroups/get_group.py | pulumi/pulumi-aws-native | 1ae4a4d9c2256b2a79ca536f8d8497b28d10e4c3 | [
"Apache-2.0"
] | 4 | 2021-11-10T19:42:01.000Z | 2022-02-05T10:15:49.000Z | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... | 33.242188 | 123 | 0.66134 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from . import outputs
from ._enums import *
__all__ = [
'GetGroupResult',
'AwaitableGetGroupResult',
'get_group',
'get_group_output',
]
@pulumi.output_... | true | true |
f702d67213c52e98de50c82d2ad8245c7db39257 | 926 | py | Python | 10.Algorithms_Data_Structure/Searching_n_Sorting/QuickSort.py | cuicaihao/Data_Science_Python | ca4cb64bf9afc1011c192586362d0dd036e9441e | [
"MIT"
] | 2 | 2018-04-26T12:11:41.000Z | 2018-10-09T19:37:57.000Z | 10.Algorithms_Data_Structure/Searching_n_Sorting/QuickSort.py | cuicaihao/Data_Science_Python | ca4cb64bf9afc1011c192586362d0dd036e9441e | [
"MIT"
] | null | null | null | 10.Algorithms_Data_Structure/Searching_n_Sorting/QuickSort.py | cuicaihao/Data_Science_Python | ca4cb64bf9afc1011c192586362d0dd036e9441e | [
"MIT"
] | 4 | 2018-10-09T19:37:59.000Z | 2021-01-23T11:31:16.000Z | import numpy as np
def partition(arr, low, high):
i = (low-1) # index of smaller element
pivot = arr[high] # pivot
for j in range(low, high):
# If current element is smaller than the pivot
if arr[j] < pivot:
# increment index of smaller element
i = i+... | 23.74359 | 54 | 0.560475 | import numpy as np
def partition(arr, low, high):
i = (low-1)
pivot = arr[high]
for j in range(low, high):
if arr[j] < pivot:
i = i+1
arr[i], arr[j] = arr[j], arr[i]
arr[i+1], arr[high] = arr[high], arr[i+1]
return (i + 1)
d... | true | true |
f702d6e6217d88af39f7200ed453d1d9edb2e766 | 20,236 | py | Python | idm/load_test.py | handavid/perf-scripts | 910cdc0a10f2d3fde703726ea270487bedec50df | [
"Apache-2.0"
] | null | null | null | idm/load_test.py | handavid/perf-scripts | 910cdc0a10f2d3fde703726ea270487bedec50df | [
"Apache-2.0"
] | null | null | null | idm/load_test.py | handavid/perf-scripts | 910cdc0a10f2d3fde703726ea270487bedec50df | [
"Apache-2.0"
] | null | null | null | #!/bin/env python3
# Steps requried to use
# install requried libraries
# (root)# dnf install python3-ldap3
#
# Create python virtual environment directory
# (user)$ python3 -m venv ./venv3
#
# Enable virtual environment
# (user)$ source ./venv3/bin/activate
#
# Update pip and then install needed libary
# (user-venv3)... | 36.859745 | 117 | 0.676517 |
sys
import time
from datetime import datetime
import re
import argparse
import logging
import itertools
import pprint
import subprocess
import socket
import dns.resolver
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
import ldap3
from python_freeipa import ClientMeta
ra... | true | true |
f702d770ee6291d4f0860e1e69892baca123eccb | 10,186 | py | Python | tests/components/upnp/test_config_flow.py | miccico/core | 14c205384171dee59c1a908f8449f9864778b2dc | [
"Apache-2.0"
] | 4 | 2016-06-22T12:00:41.000Z | 2018-06-11T20:31:25.000Z | tests/components/upnp/test_config_flow.py | miccico/core | 14c205384171dee59c1a908f8449f9864778b2dc | [
"Apache-2.0"
] | 57 | 2020-10-15T06:47:00.000Z | 2022-03-31T06:11:18.000Z | tests/components/upnp/test_config_flow.py | miccico/core | 14c205384171dee59c1a908f8449f9864778b2dc | [
"Apache-2.0"
] | 6 | 2019-07-06T00:43:13.000Z | 2021-01-16T13:27:06.000Z | """Test UPnP/IGD config flow."""
from datetime import timedelta
from unittest.mock import AsyncMock, patch
from homeassistant import config_entries, data_entry_flow
from homeassistant.components import ssdp
from homeassistant.components.upnp.const import (
CONFIG_ENTRY_SCAN_INTERVAL,
CONFIG_ENTRY_ST,
CONF... | 35.124138 | 88 | 0.660613 |
from datetime import timedelta
from unittest.mock import AsyncMock, patch
from homeassistant import config_entries, data_entry_flow
from homeassistant.components import ssdp
from homeassistant.components.upnp.const import (
CONFIG_ENTRY_SCAN_INTERVAL,
CONFIG_ENTRY_ST,
CONFIG_ENTRY_UDN,
DEFAULT_SCAN_IN... | true | true |
f702d8d44ce7219920cb5618642b42930ac1bfe7 | 48 | py | Python | datasets/__init__.py | riccardodelutio/superpixel_fcn | d30a690836d7d6673b0a9f136019779f9e753f84 | [
"MIT"
] | 291 | 2020-03-25T17:37:46.000Z | 2022-03-31T12:32:29.000Z | datasets/__init__.py | wangyxxjtu/PCNet | ae4db30eeab92a1cbb30c6ef1c9878d8dbddbaf8 | [
"MIT"
] | 32 | 2020-04-05T09:01:25.000Z | 2022-03-13T00:37:12.000Z | datasets/__init__.py | wangyxxjtu/PCNet | ae4db30eeab92a1cbb30c6ef1c9878d8dbddbaf8 | [
"MIT"
] | 71 | 2020-04-02T01:03:52.000Z | 2022-03-25T12:12:11.000Z | from .BSD500 import BSD500
__all__ = ('BSD500')
| 16 | 26 | 0.729167 | from .BSD500 import BSD500
__all__ = ('BSD500')
| true | true |
f702d8f110cd6e8a6a3ce7d246c153a15a956d43 | 85 | py | Python | code/abc146_a_07.py | KoyanagiHitoshi/AtCoder | 731892543769b5df15254e1f32b756190378d292 | [
"MIT"
] | 3 | 2019-08-16T16:55:48.000Z | 2021-04-11T10:21:40.000Z | code/abc146_a_07.py | KoyanagiHitoshi/AtCoder | 731892543769b5df15254e1f32b756190378d292 | [
"MIT"
] | null | null | null | code/abc146_a_07.py | KoyanagiHitoshi/AtCoder | 731892543769b5df15254e1f32b756190378d292 | [
"MIT"
] | null | null | null | week = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
print(7-week.index(input())) | 42.5 | 56 | 0.529412 | week = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
print(7-week.index(input())) | true | true |
f702d98b6cf99f5c87c159957faf64295569a643 | 11,484 | py | Python | priorityqueue.py | mjwestcott/priorityqueue | 6bb9876644fe5ec307fd4ea1b73e4a722f89e408 | [
"MIT"
] | 6 | 2015-12-18T21:06:54.000Z | 2020-03-19T09:29:10.000Z | priorityqueue/priorityqueue.py | gaurav-kumar-pandit/competitiveprogramming | 1edb34ee7167599404ac45b9155588b79592ef4d | [
"MIT"
] | null | null | null | priorityqueue/priorityqueue.py | gaurav-kumar-pandit/competitiveprogramming | 1edb34ee7167599404ac45b9155588b79592ef4d | [
"MIT"
] | 2 | 2021-05-22T13:45:06.000Z | 2022-03-06T18:22:05.000Z | """
priorityqueue.py
Priority Queue Implementation with a O(log n) Remove Method
This file implements min- amd max-oriented priority queues based on binary
heaps. I found the need for a priority queue with a O(log n) remove method.
This can't be achieved with any of Python's built in collections including
the heapq m... | 29.674419 | 139 | 0.562609 |
# - Python's heapq module
# - Peter Norvig's PriorityQueue in the Python AIMA repo
class MinHeapPriorityQueue():
def __init__(self, iterable=(), key=lambda x: x):
self._key = key
decorated = [(key(item), item) for item in iterable]
self._pq = [self.Locator(value, item, i) for i, (v... | true | true |
f702d9f83de12d57ddae1af8f5e99968f870e9e6 | 971 | py | Python | fixture/application.py | dmi-vor/python_training | 1e7b480bd40ce55fe19d19042c7d5ed4ffc873c8 | [
"Apache-2.0"
] | null | null | null | fixture/application.py | dmi-vor/python_training | 1e7b480bd40ce55fe19d19042c7d5ed4ffc873c8 | [
"Apache-2.0"
] | null | null | null | fixture/application.py | dmi-vor/python_training | 1e7b480bd40ce55fe19d19042c7d5ed4ffc873c8 | [
"Apache-2.0"
] | null | null | null | from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
self.wd = webdriver.Firefox()
elif browser == "ch... | 25.552632 | 65 | 0.603502 | from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
self.wd = webdriver.Firefox()
elif browser == "ch... | true | true |
f702daa51357e8ff5b5a56b6929c7d46c451dc9e | 1,385 | py | Python | src/basior/logic_pkg/tramline.py | Marcin-Szadkowski/B.A.S.I.O.R | 5b90ab6a05fdf2a3db8e5b9ba80a858a6628ab8c | [
"MIT"
] | 1 | 2020-04-26T17:41:33.000Z | 2020-04-26T17:41:33.000Z | src/basior/logic_pkg/tramline.py | Marcin-Szadkowski/B.A.S.I.O.R | 5b90ab6a05fdf2a3db8e5b9ba80a858a6628ab8c | [
"MIT"
] | null | null | null | src/basior/logic_pkg/tramline.py | Marcin-Szadkowski/B.A.S.I.O.R | 5b90ab6a05fdf2a3db8e5b9ba80a858a6628ab8c | [
"MIT"
] | 2 | 2020-06-17T16:03:01.000Z | 2020-06-28T20:53:06.000Z | import matplotlib.pyplot as plt
from shapely.geometry import MultiLineString
from .route_iterator import RouteIterator
from .graphconverter import GraphConverter
class TramLine(object):
"""Class represents single tram line for example '33: from Pilczyce to Sępolno' """
def __init__(self, number, direction_to... | 36.447368 | 117 | 0.66787 | import matplotlib.pyplot as plt
from shapely.geometry import MultiLineString
from .route_iterator import RouteIterator
from .graphconverter import GraphConverter
class TramLine(object):
def __init__(self, number, direction_to, dl):
self.number = number
self.direction_to = direction_to
s... | true | true |
f702dab63fb7a27fbc99af60fb2c5b50e7bb5377 | 4,365 | py | Python | rhasspywake_snowboy_hermes/__main__.py | Romkabouter/rhasspy-wake-snowboy-hermes | 6ad5372c89650987f92c22c0b745661680c17c94 | [
"MIT"
] | null | null | null | rhasspywake_snowboy_hermes/__main__.py | Romkabouter/rhasspy-wake-snowboy-hermes | 6ad5372c89650987f92c22c0b745661680c17c94 | [
"MIT"
] | null | null | null | rhasspywake_snowboy_hermes/__main__.py | Romkabouter/rhasspy-wake-snowboy-hermes | 6ad5372c89650987f92c22c0b745661680c17c94 | [
"MIT"
] | null | null | null | """Hermes MQTT service for Rhasspy wakeword with snowboy"""
import argparse
import asyncio
import dataclasses
import itertools
import json
import logging
import os
import sys
import typing
from pathlib import Path
import paho.mqtt.client as mqtt
import rhasspyhermes.cli as hermes_cli
from . import SnowboyModel, Wake... | 26.615854 | 87 | 0.59748 | import argparse
import asyncio
import dataclasses
import itertools
import json
import logging
import os
import sys
import typing
from pathlib import Path
import paho.mqtt.client as mqtt
import rhasspyhermes.cli as hermes_cli
from . import SnowboyModel, WakeHermesMqtt
_DIR = Path(__file__).parent
_LOGGER = logging.g... | true | true |
f702dbc4b44a28bf194e2859e22aad59ea011f89 | 318 | py | Python | parser.py | kylelaker/cfn-joiner-parser | b154c0baaff7cc14f71b2ff5e2fe24d484641941 | [
"MIT"
] | 1 | 2021-03-22T15:19:34.000Z | 2021-03-22T15:19:34.000Z | parser.py | kylelaker/cfn-joiner-parser | b154c0baaff7cc14f71b2ff5e2fe24d484641941 | [
"MIT"
] | null | null | null | parser.py | kylelaker/cfn-joiner-parser | b154c0baaff7cc14f71b2ff5e2fe24d484641941 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import sys
import yaml
def main():
args = sys.argv[1:]
file = args[0] if args else sys.stdin
data = yaml.safe_load(file)
join_args = data['Fn::Join']
contents = join_args[0].join(join_args[1])
print(contents, end='')
if __name__ == '__main__':
sys.exit(main())
| 16.736842 | 46 | 0.622642 |
import sys
import yaml
def main():
args = sys.argv[1:]
file = args[0] if args else sys.stdin
data = yaml.safe_load(file)
join_args = data['Fn::Join']
contents = join_args[0].join(join_args[1])
print(contents, end='')
if __name__ == '__main__':
sys.exit(main())
| true | true |
f702dc9d1eb4f79c76d2aa25ecbf10919de5b2a2 | 387 | py | Python | take_single_user_input/c_windows_only.py | hafiz-kamilin/python_example_program | 78e84eff9e8c266b56c4e58cf2ba2d0f198f77fd | [
"MIT"
] | 1 | 2020-04-29T12:12:10.000Z | 2020-04-29T12:12:10.000Z | take_single_user_input/c_windows_only.py | hafiz-kamilin/miscellaneous_python_program | 78e84eff9e8c266b56c4e58cf2ba2d0f198f77fd | [
"MIT"
] | null | null | null | take_single_user_input/c_windows_only.py | hafiz-kamilin/miscellaneous_python_program | 78e84eff9e8c266b56c4e58cf2ba2d0f198f77fd | [
"MIT"
] | 1 | 2018-11-03T00:10:53.000Z | 2018-11-03T00:10:53.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# class for windows getch
class _GetchWindows:
def __init__(self):
import msvcrt
def __call__(self):
import msvcrt
return msvcrt.getch()
getch = _GetchWindows()
# print instruction
print ("Please enter something: ")
# read user input an... | 19.35 | 36 | 0.656331 |
class _GetchWindows:
def __init__(self):
import msvcrt
def __call__(self):
import msvcrt
return msvcrt.getch()
getch = _GetchWindows()
print ("Please enter something: ")
x = getch()
print(x) | true | true |
f702ddb6130de8cfc377c1f3f12d46bcdd929000 | 4,376 | py | Python | odk_viewer/tests/test_remongo.py | Ecotrust/formhub | 05033bb5aa152cc2cbcd7382c2c999d82b2c3276 | [
"BSD-2-Clause"
] | 123 | 2015-01-08T09:21:05.000Z | 2021-11-14T19:45:23.000Z | odk_viewer/tests/test_remongo.py | Ecotrust/formhub | 05033bb5aa152cc2cbcd7382c2c999d82b2c3276 | [
"BSD-2-Clause"
] | 16 | 2015-02-13T16:56:42.000Z | 2021-02-20T23:58:43.000Z | odk_viewer/tests/test_remongo.py | Ecotrust/formhub | 05033bb5aa152cc2cbcd7382c2c999d82b2c3276 | [
"BSD-2-Clause"
] | 110 | 2015-01-19T14:34:06.000Z | 2021-02-01T14:55:11.000Z | import os
from django.conf import settings
from main.tests.test_base import MainTestCase
from odk_viewer.models import ParsedInstance
from odk_viewer.management.commands.remongo import Command
from django.core.management import call_command
from common_tags import USERFORM_ID
class TestRemongo(MainTestCase):
def... | 43.76 | 144 | 0.649452 | import os
from django.conf import settings
from main.tests.test_base import MainTestCase
from odk_viewer.models import ParsedInstance
from odk_viewer.management.commands.remongo import Command
from django.core.management import call_command
from common_tags import USERFORM_ID
class TestRemongo(MainTestCase):
def... | true | true |
f702de434a6aa087fd1d679fab09a173f17cae3d | 1,278 | py | Python | lesson_3/test_fixture1.py | Ryne777/Stepik_auto_test | 7543c6616db9945fd56433877a292a9bfe80eb8d | [
"Apache-2.0"
] | null | null | null | lesson_3/test_fixture1.py | Ryne777/Stepik_auto_test | 7543c6616db9945fd56433877a292a9bfe80eb8d | [
"Apache-2.0"
] | null | null | null | lesson_3/test_fixture1.py | Ryne777/Stepik_auto_test | 7543c6616db9945fd56433877a292a9bfe80eb8d | [
"Apache-2.0"
] | null | null | null | from selenium import webdriver
link = "http://selenium1py.pythonanywhere.com/"
class TestMainPage1():
@classmethod
def setup_class(self):
print("\nstart browser for test suite..")
self.browser = webdriver.Chrome()
@classmethod
def teardown_class(self):
print("quit browser fo... | 27.782609 | 65 | 0.677621 | from selenium import webdriver
link = "http://selenium1py.pythonanywhere.com/"
class TestMainPage1():
@classmethod
def setup_class(self):
print("\nstart browser for test suite..")
self.browser = webdriver.Chrome()
@classmethod
def teardown_class(self):
print("quit browser fo... | true | true |
f702de58756cfee4caf31af038f6415d191aa875 | 7,895 | py | Python | himalaya/kernel_ridge/tests/test_random_search_kernel.py | mvdoc/himalaya | 7e3866287b835e2cc0a5c9848331e19c14896309 | [
"BSD-3-Clause"
] | null | null | null | himalaya/kernel_ridge/tests/test_random_search_kernel.py | mvdoc/himalaya | 7e3866287b835e2cc0a5c9848331e19c14896309 | [
"BSD-3-Clause"
] | null | null | null | himalaya/kernel_ridge/tests/test_random_search_kernel.py | mvdoc/himalaya | 7e3866287b835e2cc0a5c9848331e19c14896309 | [
"BSD-3-Clause"
] | null | null | null | import pytest
import numpy as np
import sklearn.linear_model
import sklearn.model_selection
import scipy.linalg
from himalaya.backend import set_backend
from himalaya.backend import ALL_BACKENDS
from himalaya.utils import assert_array_almost_equal
from himalaya.scoring import r2_score
from himalaya.kernel_ridge impo... | 39.873737 | 84 | 0.659658 | import pytest
import numpy as np
import sklearn.linear_model
import sklearn.model_selection
import scipy.linalg
from himalaya.backend import set_backend
from himalaya.backend import ALL_BACKENDS
from himalaya.utils import assert_array_almost_equal
from himalaya.scoring import r2_score
from himalaya.kernel_ridge impo... | true | true |
f702df62140e8d6bba1cd1a58b39f00070c3a064 | 5,343 | py | Python | src/drugrelink/download.py | lingling93/comparison | 9a9bbf57168b03c9097af22ecee660b3f432b1dd | [
"MIT"
] | 2 | 2019-04-11T14:06:00.000Z | 2019-07-03T21:50:58.000Z | src/drugrelink/download.py | lingling93/comparison | 9a9bbf57168b03c9097af22ecee660b3f432b1dd | [
"MIT"
] | 9 | 2019-04-19T19:33:54.000Z | 2019-05-23T09:59:13.000Z | src/drugrelink/download.py | lingling93/comparison | 9a9bbf57168b03c9097af22ecee660b3f432b1dd | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Helper functions for getting resources."""
import logging
import os
from dataclasses import dataclass
from typing import List, Optional
from urllib.request import urlretrieve
logger = logging.getLogger(__name__)
HERE = os.path.abspath(os.path.dirname(__file__))
DEFAULT_DIRECTORY = os.pat... | 43.795082 | 125 | 0.764926 |
import logging
import os
from dataclasses import dataclass
from typing import List, Optional
from urllib.request import urlretrieve
logger = logging.getLogger(__name__)
HERE = os.path.abspath(os.path.dirname(__file__))
DEFAULT_DIRECTORY = os.path.abspath(os.path.join(HERE, os.pardir, os.pardir, 'data'))
DATA_DIRE... | true | true |
f702df7d8ff5a627e903de5c57770336a7b23d38 | 9,024 | py | Python | cinder/brick/initiator/linuxscsi.py | tmenjo/cinder-2015.1.1 | 1c83a5daa8041cb99bc85dd0301786d8ca43055a | [
"Apache-2.0"
] | null | null | null | cinder/brick/initiator/linuxscsi.py | tmenjo/cinder-2015.1.1 | 1c83a5daa8041cb99bc85dd0301786d8ca43055a | [
"Apache-2.0"
] | null | null | null | cinder/brick/initiator/linuxscsi.py | tmenjo/cinder-2015.1.1 | 1c83a5daa8041cb99bc85dd0301786d8ca43055a | [
"Apache-2.0"
] | null | null | null | # (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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... | 38.729614 | 79 | 0.542886 |
import os
import re
from oslo_concurrency import processutils as putils
from oslo_log import log as logging
from cinder.brick import exception
from cinder.brick import executor
from cinder.i18n import _, _LW, _LE
from cinder.openstack.common import loopingcall
LOG = logging.getLogger(__name__)
MULTIPA... | true | true |
f702e1901db433d3ed3c73f09a3ca0003e4a5499 | 4,869 | py | Python | src/proposals/tests/views/test_cancel.py | peihsuan/pycon.tw | 4d75e629295b3eef92eff78b3604ab034bd406b0 | [
"MIT"
] | null | null | null | src/proposals/tests/views/test_cancel.py | peihsuan/pycon.tw | 4d75e629295b3eef92eff78b3604ab034bd406b0 | [
"MIT"
] | null | null | null | src/proposals/tests/views/test_cancel.py | peihsuan/pycon.tw | 4d75e629295b3eef92eff78b3604ab034bd406b0 | [
"MIT"
] | null | null | null | import pytest
from django.conf import settings
from django.contrib import messages
from proposals.models import TalkProposal, TutorialProposal
pytestmark = pytest.mark.skipif(
not settings.PROPOSALS_WITHDRAWABLE,
reason='proposal withdrawal disabled',
)
def test_talk_proposal_cancel_login(client):
res... | 32.46 | 86 | 0.694804 | import pytest
from django.conf import settings
from django.contrib import messages
from proposals.models import TalkProposal, TutorialProposal
pytestmark = pytest.mark.skipif(
not settings.PROPOSALS_WITHDRAWABLE,
reason='proposal withdrawal disabled',
)
def test_talk_proposal_cancel_login(client):
res... | true | true |
f702e3fa5d22d565f73b30bff7f3d1d5d90b28ab | 10,523 | py | Python | moviepy/video/tools/drawing.py | andriyor/moviepy | 8eaf3f02c5cf812e89f03e925cb2fa5e05b8d29a | [
"MIT"
] | 8,558 | 2015-01-03T05:14:12.000Z | 2022-03-31T21:45:38.000Z | moviepy/video/tools/drawing.py | andriyor/moviepy | 8eaf3f02c5cf812e89f03e925cb2fa5e05b8d29a | [
"MIT"
] | 1,592 | 2015-01-02T22:12:54.000Z | 2022-03-30T13:10:40.000Z | moviepy/video/tools/drawing.py | andriyor/moviepy | 8eaf3f02c5cf812e89f03e925cb2fa5e05b8d29a | [
"MIT"
] | 1,332 | 2015-01-02T18:01:53.000Z | 2022-03-31T22:47:28.000Z | """Deals with making images (np arrays). It provides drawing
methods that are difficult to do with the existing Python libraries.
"""
import numpy as np
def blit(im1, im2, pos=None, mask=None):
"""Blit an image over another.
Blits ``im1`` on ``im2`` as position ``pos=(x,y)``, using the
``mask`` if provi... | 31.887879 | 88 | 0.5411 |
import numpy as np
def blit(im1, im2, pos=None, mask=None):
if pos is None:
pos = (0, 0)
else:
pos = tuple(pos)
im2.paste(im1, pos, mask)
return im2
def color_gradient(
size,
p1,
p2=None,
vector=None,
radius=None,
color_1=0.0,
color_2=1.0,
... | true | true |
f702e59535b5c977cc3845ab265467cf5b3c87b7 | 917 | py | Python | python/packages/pybind_nisar/products/readers/SLC/SLC.py | piyushrpt/isce3 | 1741af321470cb5939693459765d11a19c5c6fc2 | [
"Apache-2.0"
] | null | null | null | python/packages/pybind_nisar/products/readers/SLC/SLC.py | piyushrpt/isce3 | 1741af321470cb5939693459765d11a19c5c6fc2 | [
"Apache-2.0"
] | null | null | null | python/packages/pybind_nisar/products/readers/SLC/SLC.py | piyushrpt/isce3 | 1741af321470cb5939693459765d11a19c5c6fc2 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import h5py
import pyre
from ..Base import Base
from .Identification import Identification
class SLC(Base, family='nisar.productreader.slc'):
'''
Class for parsing NISAR SLC products into isce structures.
'''
productValidationType = pyre.properties.str(default='SLC')
pr... | 28.65625 | 79 | 0.654308 |
import h5py
import pyre
from ..Base import Base
from .Identification import Identification
class SLC(Base, family='nisar.productreader.slc'):
productValidationType = pyre.properties.str(default='SLC')
productValidationType.doc = 'Validation tag to ensure correct product type'
def __init__(self, **kw... | true | true |
f702e79b9d3eac0b82b41061dc06802d153a2b1f | 2,550 | py | Python | doc/source/conf.py | mail2nsrajesh/tacker | dce6690659836c2885f1cf8227c19be234f8fe25 | [
"Apache-2.0"
] | null | null | null | doc/source/conf.py | mail2nsrajesh/tacker | dce6690659836c2885f1cf8227c19be234f8fe25 | [
"Apache-2.0"
] | null | null | null | doc/source/conf.py | mail2nsrajesh/tacker | dce6690659836c2885f1cf8227c19be234f8fe25 | [
"Apache-2.0"
] | null | null | null | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | 32.278481 | 79 | 0.701176 |
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
extensions = [
'sphinx.ext.autodoc',
'stevedore.sphinxext',
'oslosphinx'
]
source_suffix = '.rst'
master_doc = 'index'
project = u'tacker'
copyright = u'2013, OpenStack Foundation'
add_function_parentheses =... | true | true |
f702e920c7085107291c4505fefbd5abbfa57472 | 13,942 | py | Python | train_svdnet_xent.py | hsfzxjy/svdnet-pytorch | 8f485d0b162c23b20449f7ee80c955e0b20950ae | [
"MIT"
] | 12 | 2019-04-14T06:44:35.000Z | 2022-01-15T13:19:59.000Z | train_svdnet_xent.py | hsfzxjy/svdnet-pytorch | 8f485d0b162c23b20449f7ee80c955e0b20950ae | [
"MIT"
] | 2 | 2019-06-28T07:18:43.000Z | 2020-09-18T07:02:31.000Z | train_svdnet_xent.py | hsfzxjy/svdnet-pytorch | 8f485d0b162c23b20449f7ee80c955e0b20950ae | [
"MIT"
] | 1 | 2021-03-30T13:31:22.000Z | 2021-03-30T13:31:22.000Z | from __future__ import print_function
from __future__ import division
import os
import sys
import time
import datetime
import os.path as osp
import numpy as np
import warnings
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from args import argument_parser, image_dataset_kwargs, optimizer_kwa... | 30.641758 | 143 | 0.608378 | from __future__ import print_function
from __future__ import division
import os
import sys
import time
import datetime
import os.path as osp
import numpy as np
import warnings
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from args import argument_parser, image_dataset_kwargs, optimizer_kwa... | true | true |
f702e98b502f9918276dc6a5079495bd5c1a4194 | 4,527 | py | Python | saas/management/commands/renewals.py | gikoluo/djaodjin-saas | badd7894ac327191008a1b3a0ebd0d07b55908c3 | [
"BSD-2-Clause"
] | 383 | 2015-03-07T06:19:39.000Z | 2022-03-12T20:53:37.000Z | saas/management/commands/renewals.py | gikoluo/djaodjin-saas | badd7894ac327191008a1b3a0ebd0d07b55908c3 | [
"BSD-2-Clause"
] | 146 | 2015-03-25T22:45:44.000Z | 2022-02-22T08:49:35.000Z | saas/management/commands/renewals.py | gikoluo/djaodjin-saas | badd7894ac327191008a1b3a0ebd0d07b55908c3 | [
"BSD-2-Clause"
] | 111 | 2015-02-12T22:13:07.000Z | 2022-03-11T05:45:53.000Z | # Copyright (c) 2018, DjaoDjin inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | 40.061947 | 78 | 0.69958 |
import logging, time
from django.core.management.base import BaseCommand
from ...models import get_broker
from ...renewals import (create_charges_for_balance, complete_charges,
extend_subscriptions, recognize_income, trigger_expiration_notices)
from ...utils import datetime_or_now
from ..... | true | true |
f702ea2613d3b67a2caf45adaefe4207ccb72a62 | 3,283 | py | Python | Django-apiTest/polls/quickstart.py | hsuyeemon/Testing | 3ff0e46baa9ce8db446d44cfc10b0cc8ef3a4ef0 | [
"Apache-2.0"
] | 1 | 2020-02-18T06:06:24.000Z | 2020-02-18T06:06:24.000Z | Django-apiTest/polls/quickstart.py | hsuyeemon/Testing | 3ff0e46baa9ce8db446d44cfc10b0cc8ef3a4ef0 | [
"Apache-2.0"
] | 4 | 2021-05-10T18:47:55.000Z | 2022-02-26T19:48:52.000Z | Django-apiTest/polls/quickstart.py | hsuyeemon/Testing | 3ff0e46baa9ce8db446d44cfc10b0cc8ef3a4ef0 | [
"Apache-2.0"
] | null | null | null | from __future__ import print_function
import datetime
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.goog... | 35.301075 | 81 | 0.613463 | from __future__ import print_function
import datetime
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
SCOPES = ['https://www.googleapis.com/auth/calendar']
def main():
creds = None
... | true | true |
f702eaa1c80314a8254a6bb995b9a1193fd51d26 | 486 | py | Python | yama/shard.py | vitovitolo/yama | 1d96530ac0b2700838dd9c65e6245e35b7f639cd | [
"MIT"
] | 1 | 2021-10-30T00:54:34.000Z | 2021-10-30T00:54:34.000Z | yama/shard.py | vitovitolo/yama | 1d96530ac0b2700838dd9c65e6245e35b7f639cd | [
"MIT"
] | null | null | null | yama/shard.py | vitovitolo/yama | 1d96530ac0b2700838dd9c65e6245e35b7f639cd | [
"MIT"
] | null | null | null | import database
def load_shard_from_db(conf):
#TODO: load shard from cache if exists
shards = database.load_shard(conf)
return shards
def get_shard(shards, url):
"""
Hash function for shading scheme
returns a dict with hostname and table name
Eg: s = { 'hostname': 'node1', 'table_name'... | 22.090909 | 97 | 0.62963 | import database
def load_shard_from_db(conf):
shards = database.load_shard(conf)
return shards
def get_shard(shards, url):
if not shards:
return {}
else:
return shards[hash(str(url['hostname'])+str(url['port'])+str(url['path'])) % len(shards)]
| true | true |
f702ebe9e7c9ad39441f6932c5e3341872fd5138 | 298 | py | Python | dragon/plugins/help.py | sahuang/DragonBot-ReDive | 3efe51db42aa16f209077d082e9e148f2571c014 | [
"MIT"
] | 10 | 2020-06-30T07:31:52.000Z | 2022-02-22T01:43:17.000Z | dragon/plugins/help.py | sahuang/DragonBot | 3efe51db42aa16f209077d082e9e148f2571c014 | [
"MIT"
] | 1 | 2022-01-13T02:52:24.000Z | 2022-01-13T02:52:24.000Z | dragon/plugins/help.py | sahuang/DragonBot | 3efe51db42aa16f209077d082e9e148f2571c014 | [
"MIT"
] | 5 | 2020-07-30T08:16:32.000Z | 2021-09-08T03:16:50.000Z | from nonebot import on_command, CommandSession
@on_command('help', aliases=('h', '帮助'), only_to_me=False)
async def manual(session: CommandSession):
await session.send(f'[CQ:image,file=/admin/manual.png]')
@manual.args_parser
async def _(session: CommandSession):
# do nothing
return | 27.090909 | 60 | 0.734899 | from nonebot import on_command, CommandSession
@on_command('help', aliases=('h', '帮助'), only_to_me=False)
async def manual(session: CommandSession):
await session.send(f'[CQ:image,file=/admin/manual.png]')
@manual.args_parser
async def _(session: CommandSession):
return | true | true |
f702ed24451be873a3ad174d6df0e922afb0bb2f | 323 | py | Python | web/pipeline/migrations/0005_remove_hospital_sv_name.py | stevenstuber/CIT | 8c485e72084c06da6db45da1cb402bac26411ec2 | [
"Apache-2.0"
] | 10 | 2020-11-12T15:13:40.000Z | 2022-03-05T22:33:08.000Z | web/pipeline/migrations/0005_remove_hospital_sv_name.py | stevenstuber/CIT | 8c485e72084c06da6db45da1cb402bac26411ec2 | [
"Apache-2.0"
] | 28 | 2020-07-17T16:33:55.000Z | 2022-03-21T16:24:25.000Z | web/pipeline/migrations/0005_remove_hospital_sv_name.py | stevenstuber/CIT | 8c485e72084c06da6db45da1cb402bac26411ec2 | [
"Apache-2.0"
] | 5 | 2020-11-02T23:39:53.000Z | 2022-03-01T19:09:45.000Z | # Generated by Django 2.2.13 on 2020-06-30 06:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('pipeline', '0004_hospital'),
]
operations = [
migrations.RemoveField(
model_name='hospital',
name='sv_name',
),
... | 17.944444 | 48 | 0.585139 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('pipeline', '0004_hospital'),
]
operations = [
migrations.RemoveField(
model_name='hospital',
name='sv_name',
),
]
| true | true |
f702efe7fbf48cf708ca30d341f9b765475630f0 | 775 | py | Python | PollsDjango/app/urls.py | Bhaskers-Blu-Org2/PTVS-Samples | a82d0699bd2fd3f0f3a7a452fef930100776cfc7 | [
"Apache-2.0"
] | 27 | 2015-05-05T13:06:20.000Z | 2019-04-21T21:58:48.000Z | PollsDjango/app/urls.py | microsoft/PTVS-Samples | a82d0699bd2fd3f0f3a7a452fef930100776cfc7 | [
"Apache-2.0"
] | 5 | 2015-06-09T22:10:14.000Z | 2018-04-11T18:56:17.000Z | PollsDjango/app/urls.py | Microsoft/PTVS-Samples | a82d0699bd2fd3f0f3a7a452fef930100776cfc7 | [
"Apache-2.0"
] | 11 | 2015-04-24T19:11:52.000Z | 2017-09-13T03:46:22.000Z | """
Definition of urls for polls viewing and voting.
"""
from django.conf.urls import url
from app.models import Poll
import app.views
urlpatterns = [
url(r'^$',
app.views.PollListView.as_view(
queryset=Poll.objects.order_by('-pub_date')[:5],
context_object_name='late... | 28.703704 | 67 | 0.572903 |
from django.conf.urls import url
from app.models import Poll
import app.views
urlpatterns = [
url(r'^$',
app.views.PollListView.as_view(
queryset=Poll.objects.order_by('-pub_date')[:5],
context_object_name='latest_poll_list',
template_name='app/index.html',)... | true | true |
f702f19104a3c185b7314d4b033a56a62d07c064 | 2,770 | py | Python | tacker/api/validation/__init__.py | takahashi-tsc/tacker | a0ae01a13dcc51bb374060adcbb4fd484ab37156 | [
"Apache-2.0"
] | 116 | 2015-10-18T02:57:08.000Z | 2022-03-15T04:09:18.000Z | tacker/api/validation/__init__.py | takahashi-tsc/tacker | a0ae01a13dcc51bb374060adcbb4fd484ab37156 | [
"Apache-2.0"
] | 6 | 2016-11-07T22:15:54.000Z | 2021-05-09T06:13:08.000Z | tacker/api/validation/__init__.py | takahashi-tsc/tacker | a0ae01a13dcc51bb374060adcbb4fd484ab37156 | [
"Apache-2.0"
] | 166 | 2015-10-20T15:31:52.000Z | 2021-11-12T08:39:49.000Z | # Copyright (C) 2019 NTT DATA
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 30.108696 | 78 | 0.638267 |
import functools
import webob
from tacker.api.validation import validators
from tacker.common import exceptions
def schema(request_body_schema):
def add_validator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
schema_validator = validators._SchemaValidato... | true | true |
f702f1f611d16ff3b225453713bd110e6a8457ef | 9,165 | py | Python | tests/scripts/thread-cert/Cert_5_5_02_LeaderReboot.py | BLUEGRioT/openthread | 04a6a9b925db13a52790cc1b12cb2d854f222799 | [
"BSD-3-Clause"
] | null | null | null | tests/scripts/thread-cert/Cert_5_5_02_LeaderReboot.py | BLUEGRioT/openthread | 04a6a9b925db13a52790cc1b12cb2d854f222799 | [
"BSD-3-Clause"
] | null | null | null | tests/scripts/thread-cert/Cert_5_5_02_LeaderReboot.py | BLUEGRioT/openthread | 04a6a9b925db13a52790cc1b12cb2d854f222799 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... | 46.522843 | 536 | 0.687179 |
import unittest
import config
import thread_cert
from pktverify.consts import MLE_ADVERTISEMENT, MLE_PARENT_REQUEST, MLE_PARENT_RESPONSE, MLE_CHILD_UPDATE_RESPONSE, MLE_CHILD_ID_REQUEST, MLE_CHILD_ID_RESPONSE, MLE_LINK_REQUEST, MLE_LINK_ACCEPT_AND_REQUEST, ADDR_SOL_URI, SOURCE_ADDRESS_TLV,... | true | true |
f702f26251ff1e2e6cd0c0ea57344ea4624619b3 | 10,831 | py | Python | libaraboly/ArabolyFree.py | lalbornoz/araboly | fd463004426800e39800b4446f950abcbaececc9 | [
"MIT"
] | 4 | 2018-04-08T21:41:43.000Z | 2021-11-24T18:26:34.000Z | libaraboly/ArabolyFree.py | lalbornoz/araboly | fd463004426800e39800b4446f950abcbaececc9 | [
"MIT"
] | null | null | null | libaraboly/ArabolyFree.py | lalbornoz/araboly | fd463004426800e39800b4446f950abcbaececc9 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
#
# Araboly 2000 Advanced Server SP4 -- everyone's favourite board game... with IRC support and fancy colours!
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
# This project is licensed under the terms of the MIT licence.
#
from ArabolyGenerals import ArabolyGenerals
f... | 56.119171 | 301 | 0.627366 |
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
# This project is licensed under the terms of the MIT licence.
#
from ArabolyGenerals import ArabolyGenerals
from ArabolyMonad import ArabolyDecorator
from ArabolyTypeClass import ArabolyTypeClass
from ArabolyState import ArabolyGameState, A... | true | true |
f702f4845b651ab7fece7302dae0852bbdf157e9 | 528 | py | Python | setup.py | UnJavaScripter/video-to-ascii | f9b1fcafb55782195d36f4d77c4c20f3f08ee95b | [
"MIT"
] | null | null | null | setup.py | UnJavaScripter/video-to-ascii | f9b1fcafb55782195d36f4d77c4c20f3f08ee95b | [
"MIT"
] | null | null | null | setup.py | UnJavaScripter/video-to-ascii | f9b1fcafb55782195d36f4d77c4c20f3f08ee95b | [
"MIT"
] | null | null | null | import setuptools
setuptools.setup(
name="video_to_ascii",
version="1.0.6",
author="Joel Ibaceta",
author_email="mail@joelibaceta.com",
description="A simple tool to play a video using ascii characters",
url="https://github.com/joelibaceta/video-to-ascii",
packages=setuptools.find_packages(... | 31.058824 | 71 | 0.655303 | import setuptools
setuptools.setup(
name="video_to_ascii",
version="1.0.6",
author="Joel Ibaceta",
author_email="mail@joelibaceta.com",
description="A simple tool to play a video using ascii characters",
url="https://github.com/joelibaceta/video-to-ascii",
packages=setuptools.find_packages(... | true | true |
f702f4bd9851082af9d6bfb0a43ee691a1d3974f | 1,612 | py | Python | testsSDW__copy/agents/trade_agent_tests.py | jomyhuang/sdwle | 9b6e916567e09c7cba4a171fe0adf0f47009a8c3 | [
"MIT"
] | null | null | null | testsSDW__copy/agents/trade_agent_tests.py | jomyhuang/sdwle | 9b6e916567e09c7cba4a171fe0adf0f47009a8c3 | [
"MIT"
] | null | null | null | testsSDW__copy/agents/trade_agent_tests.py | jomyhuang/sdwle | 9b6e916567e09c7cba4a171fe0adf0f47009a8c3 | [
"MIT"
] | null | null | null | import unittest
from SDWLE.agents.trade.possible_play import PossiblePlays
from SDWLE.cards import Wisp, WarGolem, BloodfenRaptor, RiverCrocolisk, AbusiveSergeant, ArgentSquire
from testsSDW.agents.trade.test_helpers import TestHelpers
from testsSDW.agents.trade.test_case_mixin import TestCaseMixin
class TestTradeAge... | 35.043478 | 101 | 0.697891 | import unittest
from SDWLE.agents.trade.possible_play import PossiblePlays
from SDWLE.cards import Wisp, WarGolem, BloodfenRaptor, RiverCrocolisk, AbusiveSergeant, ArgentSquire
from testsSDW.agents.trade.test_helpers import TestHelpers
from testsSDW.agents.trade.test_case_mixin import TestCaseMixin
class TestTradeAge... | true | true |
f702f53a18087827a5f30cf07fb3cd0cba54fd1a | 6,256 | py | Python | src/poliastro/core/perturbations.py | kerel-fs/poliastro | 1ad2074aebb7cf18f507ac44931d1e18fec53dad | [
"MIT"
] | null | null | null | src/poliastro/core/perturbations.py | kerel-fs/poliastro | 1ad2074aebb7cf18f507ac44931d1e18fec53dad | [
"MIT"
] | null | null | null | src/poliastro/core/perturbations.py | kerel-fs/poliastro | 1ad2074aebb7cf18f507ac44931d1e18fec53dad | [
"MIT"
] | null | null | null | import numpy as np
from numpy.linalg import norm
from ._jit import jit
@jit
def J2_perturbation(t0, state, k, J2, R):
r"""Calculates J2_perturbation acceleration (km/s2)
.. math::
\vec{p} = \frac{3}{2}\frac{J_{2}\mu R^{2}}{r^{4}}\left [\frac{x}{r}\left ( 5\frac{z^{2}}{r^{2}}-1 \right )\vec{i} + \fr... | 27.438596 | 248 | 0.574329 | import numpy as np
from numpy.linalg import norm
from ._jit import jit
@jit
def J2_perturbation(t0, state, k, J2, R):
r_vec = state[:3]
r = norm(r_vec)
factor = (3.0 / 2.0) * k * J2 * (R ** 2) / (r ** 5)
a_x = 5.0 * r_vec[2] ** 2 / r ** 2 - 1
a_y = 5.0 * r_vec[2] ** 2 / r ** 2 - 1
a_z = 5.0... | true | true |
f702f5a02fde6d1e2a47314c1104f816697796f8 | 2,081 | py | Python | ask-smapi-model/ask_smapi_model/v1/isp/purchasable_state.py | alexa-labs/alexa-apis-for-python | 52838be4f57ee1a2479402ea78b1247b56017942 | [
"Apache-2.0"
] | 90 | 2018-09-19T21:56:42.000Z | 2022-03-30T11:25:21.000Z | ask-smapi-model/ask_smapi_model/v1/isp/purchasable_state.py | ishitaojha/alexa-apis-for-python | a68f94b7a0e41f819595d6fe56e800403e8a4194 | [
"Apache-2.0"
] | 11 | 2018-09-23T12:16:48.000Z | 2021-06-10T19:49:45.000Z | ask-smapi-model/ask_smapi_model/v1/isp/purchasable_state.py | ishitaojha/alexa-apis-for-python | a68f94b7a0e41f819595d6fe56e800403e8a4194 | [
"Apache-2.0"
] | 28 | 2018-09-19T22:30:38.000Z | 2022-02-22T22:57:07.000Z | # coding: utf-8
#
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
# except in compliance with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "lice... | 31.059701 | 284 | 0.672273 |
import pprint
import re
import six
import typing
from enum import Enum
if typing.TYPE_CHECKING:
from typing import Dict, List, Optional, Union, Any
from datetime import datetime
class PurchasableState(Enum):
PURCHASABLE = "PURCHASABLE"
NOT_PURCHASABLE = "NOT_PURCHASABLE"
def to... | true | true |
f702f6aa007a531bab63935e88b3d97af80e19c3 | 3,874 | py | Python | cohesity_management_sdk/models/application_server_info.py | nick6655/management-sdk-python | 88e792cb83e5c24a22af495b220c145d0c45841d | [
"Apache-2.0"
] | 18 | 2019-09-24T17:35:53.000Z | 2022-03-25T08:08:47.000Z | cohesity_management_sdk/models/application_server_info.py | nick6655/management-sdk-python | 88e792cb83e5c24a22af495b220c145d0c45841d | [
"Apache-2.0"
] | 18 | 2019-03-29T19:32:29.000Z | 2022-01-03T23:16:45.000Z | cohesity_management_sdk/models/application_server_info.py | nick6655/management-sdk-python | 88e792cb83e5c24a22af495b220c145d0c45841d | [
"Apache-2.0"
] | 16 | 2019-02-27T06:54:12.000Z | 2021-11-16T18:10:24.000Z | # -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
import cohesity_management_sdk.models.exchange_database_copy_info
import cohesity_management_sdk.models.exchange_database_info
class ApplicationServerInfo(object):
"""Implementation of the 'ApplicationServerInfo' model.
Specifies the Information about t... | 38.74 | 158 | 0.648684 |
import cohesity_management_sdk.models.exchange_database_copy_info
import cohesity_management_sdk.models.exchange_database_info
class ApplicationServerInfo(object):
_names = {
"database_copy_info_list": 'databaseCopyInfoList',
"database_info_list":'databaseInfoList',
"fqdn": 'fqdn'... | true | true |
f702f759d6fd07e5788090253f85f8ef7d52ffbc | 2,669 | gyp | Python | chrome/browser/resources/settings/settings_page/compiled_resources2.gyp | google-ar/chromium | 2441c86a5fd975f09a6c30cddb57dfb7fc239699 | [
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 777 | 2017-08-29T15:15:32.000Z | 2022-03-21T05:29:41.000Z | chrome/browser/resources/settings/settings_page/compiled_resources2.gyp | harrymarkovskiy/WebARonARCore | 2441c86a5fd975f09a6c30cddb57dfb7fc239699 | [
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 66 | 2017-08-30T18:31:18.000Z | 2021-08-02T10:59:35.000Z | chrome/browser/resources/settings/settings_page/compiled_resources2.gyp | harrymarkovskiy/WebARonARCore | 2441c86a5fd975f09a6c30cddb57dfb7fc239699 | [
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 123 | 2017-08-30T01:19:34.000Z | 2022-03-17T22:55:31.000Z | # 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.
{
'targets': [
{
'target_name': 'main_page_behavior',
'dependencies': [
'../animation/compiled_resources2.gyp:animation',
'.... | 43.754098 | 146 | 0.654927 |
{
'targets': [
{
'target_name': 'main_page_behavior',
'dependencies': [
'../animation/compiled_resources2.gyp:animation',
'../compiled_resources2.gyp:route',
'settings_section',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:assert',
'<(DEPTH)/ui/web... | true | true |
f702f882a18a8f31cd4aaa8b692e61a020b9c589 | 2,764 | py | Python | test/test_xlsx_model.py | TRANTANKHOA/pptx-template | 6f756359641278e1aecb7e04abcbed01cc20826c | [
"Apache-2.0"
] | 73 | 2017-06-23T08:58:37.000Z | 2022-03-30T05:01:03.000Z | test/test_xlsx_model.py | TRANTANKHOA/pptx-template | 6f756359641278e1aecb7e04abcbed01cc20826c | [
"Apache-2.0"
] | 26 | 2017-06-08T01:45:36.000Z | 2021-09-23T19:13:40.000Z | test/test_xlsx_model.py | TRANTANKHOA/pptx-template | 6f756359641278e1aecb7e04abcbed01cc20826c | [
"Apache-2.0"
] | 23 | 2017-07-05T02:29:21.000Z | 2022-01-18T00:50:30.000Z | #
# coding=utf-8
import unittest
import sys
import os
from io import open
import openpyxl as xl
from pptx_template.xlsx_model import _build_tsv, _format_cell_value, generate_whole_model
class Cell:
def __init__(self, value, number_format):
self.value = value
self.number_format = number_format
de... | 40.057971 | 112 | 0.599493 |
import unittest
import sys
import os
from io import open
import openpyxl as xl
from pptx_template.xlsx_model import _build_tsv, _format_cell_value, generate_whole_model
class Cell:
def __init__(self, value, number_format):
self.value = value
self.number_format = number_format
def _to_cells(lis... | true | true |
f702f88302df20baac1ae553afce919d1fdf2aa8 | 23,276 | py | Python | tests/lambdas/test_sdk_analysis.py | CuriBio/IaC | 86d39038c7035442778f13eb29f10bafb628c89a | [
"MIT"
] | 2 | 2021-09-15T07:34:57.000Z | 2021-09-15T07:35:48.000Z | tests/lambdas/test_sdk_analysis.py | CuriBio/IaC | 86d39038c7035442778f13eb29f10bafb628c89a | [
"MIT"
] | 339 | 2021-02-22T19:02:04.000Z | 2022-03-31T15:13:02.000Z | tests/lambdas/test_sdk_analysis.py | CuriBio/IaC | 86d39038c7035442778f13eb29f10bafb628c89a | [
"MIT"
] | null | null | null | import base64
import copy
import hashlib
import json
from botocore.exceptions import ClientError
import pytest
from ..test_utils import import_lambda
sdk_analysis = import_lambda(
"sdk_analysis",
mock_imports=[
"pulse3D.plate_recording",
"pulse3D.constants",
"pulse3D.excel_writer",
... | 43.02403 | 131 | 0.768216 | import base64
import copy
import hashlib
import json
from botocore.exceptions import ClientError
import pytest
from ..test_utils import import_lambda
sdk_analysis = import_lambda(
"sdk_analysis",
mock_imports=[
"pulse3D.plate_recording",
"pulse3D.constants",
"pulse3D.excel_writer",
... | true | true |
f702f8cb30c1d993d051deeb4a1219efe4d96cde | 1,676 | py | Python | chris/cube/client.py | FNNDSC/chrisomatic | 6eacc7716ed40c7fdac9b1fbfd467433ab0b2bec | [
"MIT"
] | null | null | null | chris/cube/client.py | FNNDSC/chrisomatic | 6eacc7716ed40c7fdac9b1fbfd467433ab0b2bec | [
"MIT"
] | 4 | 2022-02-24T22:38:16.000Z | 2022-02-25T22:50:01.000Z | chris/cube/client.py | FNNDSC/chrisomatic | 6eacc7716ed40c7fdac9b1fbfd467433ab0b2bec | [
"MIT"
] | null | null | null | from typing import TypeVar, AsyncIterator, Sequence
from chris.common.types import PluginUrl
from chris.common.client import AuthenticatedClient
from chris.common.search import get_paginated, to_sequence
import chris.common.decorator as http
from chris.cube.types import ComputeResourceName, PfconUrl
from chris.cube.des... | 34.204082 | 87 | 0.704654 | from typing import TypeVar, AsyncIterator, Sequence
from chris.common.types import PluginUrl
from chris.common.client import AuthenticatedClient
from chris.common.search import get_paginated, to_sequence
import chris.common.decorator as http
from chris.cube.types import ComputeResourceName, PfconUrl
from chris.cube.des... | true | true |
f702f9800fd73e3aeb9520829b92e3d60e774d55 | 438 | py | Python | habari/apps/crawl/migrations/0016_auto_20200407_2042.py | ppolle/habari | 671b98c361ce593f708bc15f69dd3aa6fe72b128 | [
"MIT"
] | 3 | 2020-06-08T08:39:06.000Z | 2020-07-30T10:46:22.000Z | habari/apps/crawl/migrations/0016_auto_20200407_2042.py | ppolle/habari | 671b98c361ce593f708bc15f69dd3aa6fe72b128 | [
"MIT"
] | 9 | 2021-03-19T11:18:58.000Z | 2022-02-10T15:48:35.000Z | habari/apps/crawl/migrations/0016_auto_20200407_2042.py | ppolle/habari | 671b98c361ce593f708bc15f69dd3aa6fe72b128 | [
"MIT"
] | 1 | 2021-09-22T07:23:03.000Z | 2021-09-22T07:23:03.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2020-04-07 17:42
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('crawl', '0015_remove_article_news_source'),
]
operations = [
migrations.RenameField(
... | 20.857143 | 53 | 0.616438 |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('crawl', '0015_remove_article_news_source'),
]
operations = [
migrations.RenameField(
model_name='article',
old_name='source',
... | true | true |
f702fa92c59e613696990e2cb10c7e8d331bd0f1 | 1,523 | bzl | Python | lib/dicts.bzl | laszlocsomor/bazel-skylib | f4a2bae427c4958af834c34624767b0144f7ab12 | [
"Apache-2.0"
] | 31 | 2020-08-05T23:27:36.000Z | 2022-02-09T18:53:57.000Z | lib/dicts.bzl | laszlocsomor/bazel-skylib | f4a2bae427c4958af834c34624767b0144f7ab12 | [
"Apache-2.0"
] | 2 | 2020-08-06T00:07:42.000Z | 2022-03-11T20:36:35.000Z | lib/dicts.bzl | laszlocsomor/bazel-skylib | f4a2bae427c4958af834c34624767b0144f7ab12 | [
"Apache-2.0"
] | 7 | 2020-08-06T00:06:50.000Z | 2022-03-11T20:35:19.000Z | # Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 36.261905 | 80 | 0.730794 |
def _add(*dictionaries):
result = {}
for d in dictionaries:
result.update(d)
return result
dicts = struct(
add = _add,
)
| true | true |
f702fa93839e273a82c26a78e2b344bd75c7baab | 7,542 | py | Python | pySpatialTools/utils/artificial_data/artificial_measure.py | tgquintela/pySpatialTools | e028008f9750521bf7d311f7cd3323c88d621ea4 | [
"MIT"
] | 8 | 2015-07-21T05:15:16.000Z | 2018-06-12T18:22:52.000Z | pySpatialTools/utils/artificial_data/artificial_measure.py | tgquintela/pySpatialTools | e028008f9750521bf7d311f7cd3323c88d621ea4 | [
"MIT"
] | 6 | 2016-01-11T22:25:28.000Z | 2016-01-28T16:17:46.000Z | pySpatialTools/utils/artificial_data/artificial_measure.py | tgquintela/pySpatialTools | e028008f9750521bf7d311f7cd3323c88d621ea4 | [
"MIT"
] | null | null | null |
"""
artificial measure
------------------
Creation of artificial measure
"""
import numpy as np
############################### Create measure ################################
###############################################################################
def create_artificial_measure_array(n_k, n_vals_i, n_feats):... | 26.006897 | 79 | 0.549589 |
import numpy as np
| true | true |
f702fb01b8cc397b472b0efaeea890401516c4ba | 384 | py | Python | pipenv/patched/prettytoml/test_prettifier.py | Enzime/pipenv | d4f710be4a39e09a82a5133b7b3a277ee9bfb13a | [
"MIT"
] | 11 | 2016-04-15T10:02:20.000Z | 2022-03-25T13:39:53.000Z | pipenv/patched/prettytoml/test_prettifier.py | Enzime/pipenv | d4f710be4a39e09a82a5133b7b3a277ee9bfb13a | [
"MIT"
] | 4 | 2020-03-24T16:06:51.000Z | 2021-06-10T20:48:41.000Z | pipenv/patched/prettytoml/test_prettifier.py | Enzime/pipenv | d4f710be4a39e09a82a5133b7b3a277ee9bfb13a | [
"MIT"
] | 6 | 2017-10-09T21:45:28.000Z | 2022-02-16T15:09:42.000Z |
from .prettifier import prettify
from .prettifier.common import assert_prettifier_works
import pytoml
def test_prettifying_against_humanly_verified_sample():
toml_source = open('sample.toml').read()
expected = open('sample-prettified.toml').read()
assert_prettifier_works(toml_source, expected, prettify)... | 29.538462 | 62 | 0.786458 |
from .prettifier import prettify
from .prettifier.common import assert_prettifier_works
import pytoml
def test_prettifying_against_humanly_verified_sample():
toml_source = open('sample.toml').read()
expected = open('sample-prettified.toml').read()
assert_prettifier_works(toml_source, expected, prettify)... | true | true |
f702fcbc8a7a2d562be1b856c7837695c9f46e8c | 3,759 | py | Python | mux_python/models/signal_live_stream_complete_response.py | gts-work/mux-python | 826e52730bad7acd08c31a3e1951a281521f1b4f | [
"MIT"
] | null | null | null | mux_python/models/signal_live_stream_complete_response.py | gts-work/mux-python | 826e52730bad7acd08c31a3e1951a281521f1b4f | [
"MIT"
] | null | null | null | mux_python/models/signal_live_stream_complete_response.py | gts-work/mux-python | 826e52730bad7acd08c31a3e1951a281521f1b4f | [
"MIT"
] | null | null | null | # coding: utf-8
"""
Mux API
Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before. # noqa: E501
The version of the OpenAPI document: v1
Generated by: https://openapi-g... | 29.139535 | 205 | 0.586326 |
import inspect
import pprint
import re
import six
from mux_python.configuration import Configuration
class SignalLiveStreamCompleteResponse(object):
openapi_types = {
'data': 'object'
}
attribute_map = {
'data': 'data'
}
def __init__(self, data=None, local_vars_configurat... | true | true |
f702fdacc80239cb68f714c266ba5d5ed7d3b8b7 | 18,330 | py | Python | keras_ocr/_version.py | bayethiernodiop/keras-ocr | 73349ce88237e9b9dc7e1ac0754042f89fb4e13e | [
"MIT"
] | 8 | 2020-08-27T14:37:46.000Z | 2021-09-24T07:33:46.000Z | keras_ocr/_version.py | bayethiernodiop/keras-ocr | 73349ce88237e9b9dc7e1ac0754042f89fb4e13e | [
"MIT"
] | 4 | 2021-06-08T22:59:39.000Z | 2022-03-12T00:59:11.000Z | keras_ocr/_version.py | bayethiernodiop/keras-ocr | 73349ce88237e9b9dc7e1ac0754042f89fb4e13e | [
"MIT"
] | 5 | 2020-11-01T21:03:05.000Z | 2021-08-19T15:55:57.000Z | # This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains th... | 34.070632 | 98 | 0.588598 |
import errno
import os
import re
import subprocess
import sys
def get_keywords():
git_refnames = "$Format:%d$"
git_full = "$Format:%H$"
git_date = "$Format:%ci$"
keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
return keywords
class Versionee... | true | true |
f702fe7bb0f5dd86a6d9b1e9444a99e6a59063b4 | 3,239 | py | Python | vistrails/db/versions/v0_5_0/persistence/xml/xml_dao.py | celiafish/VisTrails | d8cb575b8b121941de190fe608003ad1427ef9f6 | [
"BSD-3-Clause"
] | 1 | 2015-05-11T16:46:49.000Z | 2015-05-11T16:46:49.000Z | vistrails/db/versions/v0_5_0/persistence/xml/xml_dao.py | celiafish/VisTrails | d8cb575b8b121941de190fe608003ad1427ef9f6 | [
"BSD-3-Clause"
] | null | null | null | vistrails/db/versions/v0_5_0/persistence/xml/xml_dao.py | celiafish/VisTrails | d8cb575b8b121941de190fe608003ad1427ef9f6 | [
"BSD-3-Clause"
] | null | null | null | ###############################################################################
##
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary for... | 41 | 84 | 0.600494 | true | true | |
f702fea9527715af2b456968c66f01b355926e39 | 50,389 | py | Python | pylib/gyp/msvs_emulation.py | xforce/gyp | a079e0aeab3470d14055657bba75adaa94e974e6 | [
"BSD-3-Clause"
] | null | null | null | pylib/gyp/msvs_emulation.py | xforce/gyp | a079e0aeab3470d14055657bba75adaa94e974e6 | [
"BSD-3-Clause"
] | null | null | null | pylib/gyp/msvs_emulation.py | xforce/gyp | a079e0aeab3470d14055657bba75adaa94e974e6 | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This module helps emulate Visual Studio 2008 behavior on top of other
build systems, primarily ninja.
"""
import collections
import os
import pickle
import re... | 42.702542 | 83 | 0.672806 |
import collections
import os
import pickle
import re
import subprocess
import sys
import time
import hashlib
from gyp.common import OrderedSet
import gyp.MSVSUtil
import gyp.MSVSVersion
from gyp import DebugOutput, DEBUG_GENERAL
try:
import sys
reload(sys)
sys.setdefaultencoding('utf8')
except:
pass
try... | true | true |
f702fee5a19306d06dfa47f23154ec7fca804920 | 7,915 | py | Python | keystone/common/tokenless_auth.py | rajivmucheli/keystone | d55099d4a17e3672d478aae8c367bcdf9af15fb9 | [
"Apache-2.0"
] | null | null | null | keystone/common/tokenless_auth.py | rajivmucheli/keystone | d55099d4a17e3672d478aae8c367bcdf9af15fb9 | [
"Apache-2.0"
] | 4 | 2020-02-10T12:02:37.000Z | 2021-07-14T15:16:57.000Z | keystone/common/tokenless_auth.py | rajivmucheli/keystone | d55099d4a17e3672d478aae8c367bcdf9af15fb9 | [
"Apache-2.0"
] | 5 | 2019-06-06T15:11:37.000Z | 2021-06-07T08:23:23.000Z | # Copyright 2015 Hewlett-Packard
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | 41.439791 | 78 | 0.61175 |
import hashlib
from oslo_log import log
from keystone.auth import core
from keystone.common import provider_api
import keystone.conf
from keystone import exception
from keystone.federation import constants as federation_constants
from keystone.federation import utils
from keystone.i18n import _
CONF ... | true | true |
f702ff17b34fbd489d3cfceaa9c5286e6c4611ca | 1,058 | py | Python | FLAAT/ch6/algo_6_3.py | colddrizzle/FLACT | d23ec807be3f5ea21cfa9a7a1499198d14681262 | [
"MIT"
] | null | null | null | FLAAT/ch6/algo_6_3.py | colddrizzle/FLACT | d23ec807be3f5ea21cfa9a7a1499198d14681262 | [
"MIT"
] | null | null | null | FLAAT/ch6/algo_6_3.py | colddrizzle/FLACT | d23ec807be3f5ea21cfa9a7a1499198d14681262 | [
"MIT"
] | null | null | null | # coding=utf-8
from common.BNFParser import *
from common.Grammar import Grammar
# 求文法G的可空变量集
# 该算法只跟G的P有关系
def algo_6_3(P):
"""
测试数据来源于第6章习题12(2)
>>> from common.production import Production
>>> p1 = Production(['S'], [['A', 'B', 'D', 'C']])
>>> p2 = Production(['A'], [['B', 'D'], ['\\"a\\"', '\... | 27.128205 | 81 | 0.464083 |
from common.BNFParser import *
from common.Grammar import Grammar
def algo_6_3(P):
simple_plist = []
for p in P:
simple_plist.extend(Production.toSimpleProduction(p))
old_u = set()
new_u = set()
for p in simple_plist:
if Production.isDirectEmpty(p):
new_u.add(p.left... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.