hexsha stringlengths 40 40 | size int64 4 996k | ext stringclasses 8
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 4 996k | avg_line_length float64 1.33 58.2k | max_line_length int64 2 323k | alphanum_fraction float64 0 0.97 | content_no_comment stringlengths 0 946k | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7029380b00f9f11d71141fa3f7732ac4f5ba6c7 | 8,120 | py | Python | lib/dnsServer/namecoindns.py | bankonmecoin/nmcontrol | 49a879b98bb2885e3ba7c9fdf6dfe7e122e0edad | [
"FTL"
] | 161 | 2015-01-08T19:45:20.000Z | 2022-01-15T18:25:21.000Z | lib/dnsServer/namecoindns.py | bankonmecoin/nmcontrol | 49a879b98bb2885e3ba7c9fdf6dfe7e122e0edad | [
"FTL"
] | 77 | 2015-01-02T02:20:59.000Z | 2020-05-25T08:33:56.000Z | lib/dnsServer/namecoindns.py | namecoin/nmcontrol | 49a879b98bb2885e3ba7c9fdf6dfe7e122e0edad | [
"FTL"
] | 36 | 2015-02-26T01:51:53.000Z | 2022-01-15T18:25:45.000Z | #name_scan "d/yourdomain" 1
import sys, os
#sys.path.append('/home/khal/sources/nmcontrol/lib/')
import DNS
import rpcClient
import struct, listdns, base64, types, json, random
#from jsonrpc import ServiceProxy
from utils import *
from common import *
class Source(object):
#def __init__(self):
#self.server... | 46.936416 | 172 | 0.491995 |
import sys, os
import DNS
import rpcClient
import struct, listdns, base64, types, json, random
from utils import *
from common import *
class Source(object):
def isIP(self, host... | true | true |
f702939c992f164058c986345c72844ea2c3df0a | 2,852 | py | Python | tests/data_tests/writer_tests/json_writer_test.py | alueschow/polymatheia | e46a38b3686139bbab3a2fcfaa914d4ca938654e | [
"MIT"
] | 3 | 2020-09-15T15:15:34.000Z | 2021-06-15T10:35:07.000Z | tests/data_tests/writer_tests/json_writer_test.py | alueschow/polymatheia | e46a38b3686139bbab3a2fcfaa914d4ca938654e | [
"MIT"
] | 7 | 2020-09-03T12:53:34.000Z | 2020-10-05T09:14:29.000Z | tests/data_tests/writer_tests/json_writer_test.py | alueschow/polymatheia | e46a38b3686139bbab3a2fcfaa914d4ca938654e | [
"MIT"
] | 2 | 2020-10-13T09:12:21.000Z | 2021-04-15T14:19:06.000Z | """Tests for the :mod:`~polymatheia.data.writer` package."""
import json
import os
from shutil import rmtree
from polymatheia.data import NavigableDict
from polymatheia.data.writer import JSONWriter
DOCUMENTS = [NavigableDict(r) for r in [
{
'id': '1',
'name': {
'first': 'A',
... | 31.688889 | 68 | 0.471599 | import json
import os
from shutil import rmtree
from polymatheia.data import NavigableDict
from polymatheia.data.writer import JSONWriter
DOCUMENTS = [NavigableDict(r) for r in [
{
'id': '1',
'name': {
'first': 'A',
'last': 'Person'
},
'age': 32,
'... | true | true |
f70293b9def8f86852689095cc552b5b73ffc04b | 13,289 | py | Python | tests/unit/registry_test.py | TUNE-Archive/freight_forwarder | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | [
"MIT"
] | null | null | null | tests/unit/registry_test.py | TUNE-Archive/freight_forwarder | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | [
"MIT"
] | null | null | null | tests/unit/registry_test.py | TUNE-Archive/freight_forwarder | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | [
"MIT"
] | null | null | null | # -*- coding: utf-8; -*-
from __future__ import unicode_literals, absolute_import
import json
import requests
import six
from tests import unittest, mock
from freight_forwarder.registry import Registry, V1, V2
from freight_forwarder.registry.registry_base import RegistryBase, RegistryException
from ..fa... | 40.889231 | 117 | 0.658063 |
from __future__ import unicode_literals, absolute_import
import json
import requests
import six
from tests import unittest, mock
from freight_forwarder.registry import Registry, V1, V2
from freight_forwarder.registry.registry_base import RegistryBase, RegistryException
from ..factories.registry_factory... | true | true |
f7029408ce730e634db3b1bb394319bb0bf2ed6b | 127 | py | Python | icevision/models/ross/efficientdet/loss_fn.py | ai-fast-track/mantisshrimp | cc6d6a4a048f6ddda2782b6593dcd6b083a673e4 | [
"Apache-2.0"
] | 580 | 2020-09-10T06:29:57.000Z | 2022-03-29T19:34:54.000Z | icevision/models/ross/efficientdet/loss_fn.py | ai-fast-track/mantisshrimp | cc6d6a4a048f6ddda2782b6593dcd6b083a673e4 | [
"Apache-2.0"
] | 691 | 2020-09-05T03:08:34.000Z | 2022-03-31T23:47:06.000Z | icevision/models/ross/efficientdet/loss_fn.py | lgvaz/mantisshrimp2 | 743cb7df0dae7eb1331fc2bb66fc9ca09db496cd | [
"Apache-2.0"
] | 105 | 2020-09-09T10:41:35.000Z | 2022-03-25T17:16:49.000Z | __all__ = ["loss_fn"]
from icevision.imports import *
def loss_fn(preds, targets) -> torch.Tensor:
return preds["loss"]
| 15.875 | 44 | 0.692913 | __all__ = ["loss_fn"]
from icevision.imports import *
def loss_fn(preds, targets) -> torch.Tensor:
return preds["loss"]
| true | true |
f702941de4e407f4a88237e388c77641c7894dd9 | 416 | py | Python | blog/migrations/0008_alter_post_content.py | samwel2000/portfolio-backend | a7cb50ffa34b9db64bc4532a9d79df0b082fd000 | [
"MIT"
] | null | null | null | blog/migrations/0008_alter_post_content.py | samwel2000/portfolio-backend | a7cb50ffa34b9db64bc4532a9d79df0b082fd000 | [
"MIT"
] | null | null | null | blog/migrations/0008_alter_post_content.py | samwel2000/portfolio-backend | a7cb50ffa34b9db64bc4532a9d79df0b082fd000 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.4 on 2021-09-11 12:44
import ckeditor_uploader.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0007_subscriber'),
]
operations = [
migrations.AlterField(
model_name='post',
name='... | 20.8 | 68 | 0.625 |
import ckeditor_uploader.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0007_subscriber'),
]
operations = [
migrations.AlterField(
model_name='post',
name='content',
field=ckeditor_uploader.f... | true | true |
f702949d7e5cbdf335ceb60f0431804430f5686c | 2,126 | py | Python | tests/test_decorators.py | marwahaha/QSpectra | 328a4f78af1473d65c011eb99b903c7f0ef1db32 | [
"BSD-2-Clause"
] | 14 | 2018-02-01T03:06:26.000Z | 2021-09-16T02:50:31.000Z | tests/test_decorators.py | whaley-group-berkeley/qspectra | f0f971ea26c4595a9c7bd4ee98e31e9ba63451c6 | [
"BSD-2-Clause"
] | 5 | 2018-01-02T20:33:14.000Z | 2021-11-12T23:59:20.000Z | tests/test_decorators.py | whaley-group-berkeley/qspectra | f0f971ea26c4595a9c7bd4ee98e31e9ba63451c6 | [
"BSD-2-Clause"
] | 7 | 2018-04-19T05:08:41.000Z | 2021-09-16T01:45:24.000Z | import unittest
from numpy.testing import assert_allclose
from qspectra import polarization
from qspectra.simulate import decorators
class TestGetCallArgs(unittest.TestCase):
def test(self):
self.assertEqual(
decorators._get_call_args(lambda a: None, 1),
{'a': 1})
self.ass... | 41.686275 | 80 | 0.601129 | import unittest
from numpy.testing import assert_allclose
from qspectra import polarization
from qspectra.simulate import decorators
class TestGetCallArgs(unittest.TestCase):
def test(self):
self.assertEqual(
decorators._get_call_args(lambda a: None, 1),
{'a': 1})
self.ass... | true | true |
f70295f364c9fa7735e9cab7413024d68698092b | 64 | py | Python | enthought/traits/ui/editors/check_list_editor.py | enthought/etsproxy | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | [
"BSD-3-Clause"
] | 3 | 2016-12-09T06:05:18.000Z | 2018-03-01T13:00:29.000Z | enthought/traits/ui/editors/check_list_editor.py | enthought/etsproxy | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | [
"BSD-3-Clause"
] | 1 | 2020-12-02T00:51:32.000Z | 2020-12-02T08:48:55.000Z | enthought/traits/ui/editors/check_list_editor.py | enthought/etsproxy | 4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347 | [
"BSD-3-Clause"
] | null | null | null | # proxy module
from traitsui.editors.check_list_editor import *
| 21.333333 | 48 | 0.828125 |
from traitsui.editors.check_list_editor import *
| true | true |
f70296d97876b7039d6cd67bbecc249889c24636 | 4,957 | py | Python | dataset_generation/ExtractSantini.py | YuHsin1998/EllSeg | 91a532650ef809eef081a7ef9af5f1940fb37a37 | [
"MIT"
] | 1 | 2021-05-26T05:45:42.000Z | 2021-05-26T05:45:42.000Z | dataset_generation/ExtractSantini.py | xiaohuaibaoguigui/EllSeg | ff56b255f8e650856aec9af23792e105897eba5c | [
"MIT"
] | null | null | null | dataset_generation/ExtractSantini.py | xiaohuaibaoguigui/EllSeg | ff56b255f8e650856aec9af23792e105897eba5c | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 29 16:16:57 2019
@author: rakshit
"""
import os
import cv2
import argparse
import matplotlib
import numpy as np
import deepdish as dd
import scipy.io as scio
print('Extracting Santini')
parser = argparse.ArgumentParser()
parser.add_argument('--noD... | 33.046667 | 108 | 0.571717 |
import os
import cv2
import argparse
import matplotlib
import numpy as np
import deepdish as dd
import scipy.io as scio
print('Extracting Santini')
parser = argparse.ArgumentParser()
parser.add_argument('--noDisp', help='Specify flag to display labelled images', type=int)
parser.add_argument('--path2ds', help='Path... | true | true |
f70296f7f9d79a7e89f869920b8a89f1d9105870 | 38,097 | py | Python | arkalos/app/arkalos_views/arkalos_common.py | kantale/arkalos | 0e8776a2458b6be79ceea8d78c91fe8c067df50a | [
"AFL-3.0"
] | null | null | null | arkalos/app/arkalos_views/arkalos_common.py | kantale/arkalos | 0e8776a2458b6be79ceea8d78c91fe8c067df50a | [
"AFL-3.0"
] | 1 | 2017-06-20T13:59:24.000Z | 2017-06-20T13:59:24.000Z | arkalos/app/arkalos_views/arkalos_common.py | kantale/arkalos | 0e8776a2458b6be79ceea8d78c91fe8c067df50a | [
"AFL-3.0"
] | null | null | null |
from django.http import HttpResponse
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from django.shortcuts import redirect
from django.core.validators import URLValidator # https://stackoverflow.com/questions/7160737/python-how-to-validate-a-url-in-python-malf... | 28.579895 | 236 | 0.590729 |
from django.http import HttpResponse
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from django.shortcuts import redirect
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.db.m... | true | true |
f70297f48478ba961bd1e24c7eaa558a44b1e6f1 | 52,230 | py | Python | app/venv/lib/python2.7/site-packages/numpy/lib/arraypad.py | anaheino/Ufo-sightings-map | 64af02093f97737cbbdfd8af9e1aeb4d8aa8fcdc | [
"MIT"
] | 652 | 2015-07-26T00:00:17.000Z | 2022-02-24T18:30:04.000Z | app/venv/lib/python2.7/site-packages/numpy/lib/arraypad.py | anaheino/Ufo-sightings-map | 64af02093f97737cbbdfd8af9e1aeb4d8aa8fcdc | [
"MIT"
] | 75 | 2016-01-14T16:03:02.000Z | 2020-04-29T22:51:53.000Z | app/venv/lib/python2.7/site-packages/numpy/lib/arraypad.py | anaheino/Ufo-sightings-map | 64af02093f97737cbbdfd8af9e1aeb4d8aa8fcdc | [
"MIT"
] | 40 | 2015-07-24T19:45:08.000Z | 2021-11-01T14:54:56.000Z | """
The arraypad module contains a group of functions to pad values onto the edges
of an n-dimensional array.
"""
from __future__ import division, absolute_import, print_function
import numpy as np
__all__ = ['pad']
###############################################################################
# Private utility ... | 34.866489 | 79 | 0.579629 | from __future__ import division, absolute_import, print_function
import numpy as np
__all__ = ['pad']
t, axis)
slope = (end - edge_pad) / float(pad_amt)
ramp_arr = ramp_arr * slope
ramp_arr += edge_pad
_round_ifneeded(ramp_arr, arr.dtype)
return np.concatenate((ramp_arr.astype(arr.d... | true | true |
f70298a7b694786f2a04821421d50d8e82091c26 | 5,488 | py | Python | test/integration/src/py/test_bulk_transfers.py | emeseight/sifnode | cf52c0cf622fd5113c0a1a8f704e5f62ef3ae4c3 | [
"Apache-2.0"
] | 85 | 2020-10-24T07:35:55.000Z | 2022-03-27T10:27:55.000Z | test/integration/src/py/test_bulk_transfers.py | emeseight/sifnode | cf52c0cf622fd5113c0a1a8f704e5f62ef3ae4c3 | [
"Apache-2.0"
] | 1,760 | 2020-10-24T07:37:17.000Z | 2022-03-31T17:59:44.000Z | test/integration/src/py/test_bulk_transfers.py | emeseight/sifnode | cf52c0cf622fd5113c0a1a8f704e5f62ef3ae4c3 | [
"Apache-2.0"
] | 115 | 2020-10-31T07:32:38.000Z | 2022-03-29T21:12:25.000Z | import copy
import json
import logging
import pytest
import burn_lock_functions
import test_utilities
from integration_env_credentials import sifchain_cli_credentials_for_test
from pytest_utilities import generate_minimal_test_account
from test_utilities import EthereumToSifchainTransferRequest, SifchaincliCredential... | 44.983607 | 142 | 0.714103 | import copy
import json
import logging
import pytest
import burn_lock_functions
import test_utilities
from integration_env_credentials import sifchain_cli_credentials_for_test
from pytest_utilities import generate_minimal_test_account
from test_utilities import EthereumToSifchainTransferRequest, SifchaincliCredential... | true | true |
f702992dc148b3f53c8d0340cf67d9897004131c | 5,174 | py | Python | src/pip/_internal/build_env.py | atse/pip | b47b2fa8e6a70f2d8c93b14a1292bf6eb82b6355 | [
"MIT"
] | null | null | null | src/pip/_internal/build_env.py | atse/pip | b47b2fa8e6a70f2d8c93b14a1292bf6eb82b6355 | [
"MIT"
] | null | null | null | src/pip/_internal/build_env.py | atse/pip | b47b2fa8e6a70f2d8c93b14a1292bf6eb82b6355 | [
"MIT"
] | null | null | null | """Build Environment used for isolation during sdist building
"""
import logging
import os
import sys
import textwrap
from distutils.sysconfig import get_python_lib
from sysconfig import get_paths
from pip._vendor.pkg_resources import Requirement, VersionConflict, WorkingSet
from pip import __file__ as pip_location
... | 33.380645 | 78 | 0.603402 |
import logging
import os
import sys
import textwrap
from distutils.sysconfig import get_python_lib
from sysconfig import get_paths
from pip._vendor.pkg_resources import Requirement, VersionConflict, WorkingSet
from pip import __file__ as pip_location
from pip._internal.utils.misc import call_subprocess
from pip._int... | true | true |
f70299a27cf778ccd0e0029d544c3610372d7746 | 5,483 | py | Python | src/negotiating_agent/test_agent/TU-Delft-Collaborative-AI-Negotiation/agents/random_agent/random_agent.py | HahaBill/CollaborativeAI | f771cd2f34774c74c58e49a7e983d6244ea35eff | [
"MIT"
] | 1 | 2022-02-17T19:14:46.000Z | 2022-02-17T19:14:46.000Z | src/negotiating_agent/test_agent/TU-Delft-Collaborative-AI-Negotiation/agents/random_agent/random_agent.py | HahaBill/CollaborativeAI | f771cd2f34774c74c58e49a7e983d6244ea35eff | [
"MIT"
] | null | null | null | src/negotiating_agent/test_agent/TU-Delft-Collaborative-AI-Negotiation/agents/random_agent/random_agent.py | HahaBill/CollaborativeAI | f771cd2f34774c74c58e49a7e983d6244ea35eff | [
"MIT"
] | null | null | null | import logging
from random import randint
import traceback
from typing import cast, Dict, List, Set, Collection
from geniusweb.actions.Accept import Accept
from geniusweb.actions.Action import Action
from geniusweb.actions.LearningDone import LearningDone
from geniusweb.actions.Offer import Offer
from geniusweb.action... | 38.612676 | 157 | 0.655116 | import logging
from random import randint
import traceback
from typing import cast, Dict, List, Set, Collection
from geniusweb.actions.Accept import Accept
from geniusweb.actions.Action import Action
from geniusweb.actions.LearningDone import LearningDone
from geniusweb.actions.Offer import Offer
from geniusweb.action... | true | true |
f70299a88cbcaeb559e7429ab61fc8c936bbdd40 | 475 | py | Python | src/constants.py | inwe-boku/windpower-decomposition-usa | e7b11c9fffc4864d2e4f3cb7e4c6f3cfaf469ff7 | [
"MIT"
] | null | null | null | src/constants.py | inwe-boku/windpower-decomposition-usa | e7b11c9fffc4864d2e4f3cb7e4c6f3cfaf469ff7 | [
"MIT"
] | null | null | null | src/constants.py | inwe-boku/windpower-decomposition-usa | e7b11c9fffc4864d2e4f3cb7e4c6f3cfaf469ff7 | [
"MIT"
] | null | null | null | METER_TO_KM = 1e-3
ONE_TO_KILO = 1e3
KM_TO_METER = 1e3
KILO_TO_ONE = 1e3
# Average earth radius, see https://en.wikipedia.org/wiki/Earth_radius
EARTH_RADIUS_KM = 6371.0088
# in reality air density varies between 1.14 and 1.42 in kg/m^3
AIR_DENSITY_RHO = 1.225
# of course this introduces a small mistake due to leap ... | 29.6875 | 91 | 0.766316 | METER_TO_KM = 1e-3
ONE_TO_KILO = 1e3
KM_TO_METER = 1e3
KILO_TO_ONE = 1e3
EARTH_RADIUS_KM = 6371.0088
AIR_DENSITY_RHO = 1.225
# Warning: in most cases it might be better to use mean() instead of sum()/HOURS_PER_YEAR
HOURS_PER_YEAR = 8765.812536
| true | true |
f70299afa9fb9cd0c528109e36d8380ed2dbcbe6 | 1,064 | py | Python | Python/add-binary.py | sm2774us/leetcode_interview_prep_2021 | 33b41bea66c266b733372d9a8b9d2965cd88bf8c | [
"Fair"
] | null | null | null | Python/add-binary.py | sm2774us/leetcode_interview_prep_2021 | 33b41bea66c266b733372d9a8b9d2965cd88bf8c | [
"Fair"
] | null | null | null | Python/add-binary.py | sm2774us/leetcode_interview_prep_2021 | 33b41bea66c266b733372d9a8b9d2965cd88bf8c | [
"Fair"
] | null | null | null | # Time: O(n)
# Space: O(1)
class Solution(object):
# @param a, a string
# @param b, a string
# @return a string
def addBinary(self, a, b):
result, carry, val = "", 0, 0
for i in range(max(len(a), len(b))):
val = carry
if i < len(a):
val += int(a[... | 23.644444 | 73 | 0.451128 |
class Solution(object):
def addBinary(self, a, b):
result, carry, val = "", 0, 0
for i in range(max(len(a), len(b))):
val = carry
if i < len(a):
val += int(a[-(i + 1)])
if i < len(b):
val += int(b[-(i + 1)])
... | true | true |
f7029ae637a41736ba37b57a855102b48c280817 | 111,937 | py | Python | sympy/core/tests/test_args.py | nishithshah2211/sympy | edc620ca662f7163637c7fb5823f22523b7f2fe9 | [
"BSD-3-Clause"
] | 1 | 2019-06-27T13:40:28.000Z | 2019-06-27T13:40:28.000Z | sympy/core/tests/test_args.py | amitsaha/sympy | 43ddfc644fd604a3dc0d4cac0aebfecd051917c1 | [
"BSD-3-Clause"
] | null | null | null | sympy/core/tests/test_args.py | amitsaha/sympy | 43ddfc644fd604a3dc0d4cac0aebfecd051917c1 | [
"BSD-3-Clause"
] | null | null | null | """Test whether all elements of cls.args are instances of Basic. """
# NOTE: keep tests sorted by (module, class name) key. If a class can't
# be instantiated, add it here anyway with @SKIP("abstract class) (see
# e.g. Function).
import os
import re
import warnings
import io
from sympy import Basic, S, symbols, sqrt... | 31.710198 | 135 | 0.778366 |
# be instantiated, add it here anyway with @SKIP("abstract class) (see
# e.g. Function).
import os
import re
import warnings
import io
from sympy import Basic, S, symbols, sqrt, sin, oo, Interval, exp
from sympy.core.compatibility import range
from sympy.utilities.pytest import XFAIL, SKIP
from sympy.utilities.exce... | true | true |
f7029b3beb7195ba068d85097363523b962ab536 | 136 | py | Python | ARC076/ARC076e.py | VolgaKurvar/AtCoder | 21acb489f1594bbb1cdc64fbf8421d876b5b476d | [
"Unlicense"
] | null | null | null | ARC076/ARC076e.py | VolgaKurvar/AtCoder | 21acb489f1594bbb1cdc64fbf8421d876b5b476d | [
"Unlicense"
] | null | null | null | ARC076/ARC076e.py | VolgaKurvar/AtCoder | 21acb489f1594bbb1cdc64fbf8421d876b5b476d | [
"Unlicense"
] | null | null | null | #ARC076e
def main():
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)
if __name__ == '__main__':
main() | 17 | 32 | 0.654412 |
def main():
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)
if __name__ == '__main__':
main() | true | true |
f7029c9b1d4976a50cf98e8502601e9ea1b91175 | 337 | py | Python | access/management/commands/access_create_internal_aliases.py | darkismus/kompassi | 35dea2c7af2857a69cae5c5982b48f01ba56da1f | [
"CC-BY-3.0"
] | 13 | 2015-11-29T12:19:12.000Z | 2021-02-21T15:42:11.000Z | access/management/commands/access_create_internal_aliases.py | darkismus/kompassi | 35dea2c7af2857a69cae5c5982b48f01ba56da1f | [
"CC-BY-3.0"
] | 23 | 2015-04-29T19:43:34.000Z | 2021-02-10T05:50:17.000Z | access/management/commands/access_create_internal_aliases.py | darkismus/kompassi | 35dea2c7af2857a69cae5c5982b48f01ba56da1f | [
"CC-BY-3.0"
] | 11 | 2015-09-20T18:59:00.000Z | 2020-02-07T08:47:34.000Z | from django.core.management.base import BaseCommand
from django.utils.timezone import now
class Command(BaseCommand):
args = '[event_slug...]'
help = 'Create missing email aliases'
def handle(*args, **opts):
from access.models import InternalEmailAlias
InternalEmailAlias.ensure_internal_... | 24.071429 | 58 | 0.732938 | from django.core.management.base import BaseCommand
from django.utils.timezone import now
class Command(BaseCommand):
args = '[event_slug...]'
help = 'Create missing email aliases'
def handle(*args, **opts):
from access.models import InternalEmailAlias
InternalEmailAlias.ensure_internal_... | true | true |
f7029d2c344fe7b18326f6b65133b21dcec1e3e7 | 956 | py | Python | django_server/feedback_map/rest/tests/base.py | ForumViriumHelsinki/FVHFeedbackMap | cfbf3dd8715e34351fb1ba628ebb0c5eb82e78e0 | [
"MIT"
] | null | null | null | django_server/feedback_map/rest/tests/base.py | ForumViriumHelsinki/FVHFeedbackMap | cfbf3dd8715e34351fb1ba628ebb0c5eb82e78e0 | [
"MIT"
] | 39 | 2020-12-30T11:03:49.000Z | 2021-11-10T12:16:29.000Z | django_server/feedback_map/rest/tests/base.py | ForumViriumHelsinki/FVHFeedbackMap | cfbf3dd8715e34351fb1ba628ebb0c5eb82e78e0 | [
"MIT"
] | 1 | 2020-12-08T13:19:33.000Z | 2020-12-08T13:19:33.000Z | from django.contrib.auth.models import User
from rest_framework.test import APITestCase
class FVHAPITestCase(APITestCase):
def assert_dict_contains(self, superset, subset, path=''):
for key, expected in subset.items():
full_path = path + key
received = superset.get(key, None)
... | 38.24 | 111 | 0.621339 | from django.contrib.auth.models import User
from rest_framework.test import APITestCase
class FVHAPITestCase(APITestCase):
def assert_dict_contains(self, superset, subset, path=''):
for key, expected in subset.items():
full_path = path + key
received = superset.get(key, None)
... | true | true |
f7029dd1805bb86b5c26cdc6d17720b337162e8a | 20,089 | bzl | Python | packages/typescript/internal/ts_project.bzl | JiaLiPassion/rules_nodejs | 2424d1e32b564fcc37b57d593b871461a62f3237 | [
"Apache-2.0"
] | null | null | null | packages/typescript/internal/ts_project.bzl | JiaLiPassion/rules_nodejs | 2424d1e32b564fcc37b57d593b871461a62f3237 | [
"Apache-2.0"
] | null | null | null | packages/typescript/internal/ts_project.bzl | JiaLiPassion/rules_nodejs | 2424d1e32b564fcc37b57d593b871461a62f3237 | [
"Apache-2.0"
] | null | null | null | "ts_project rule"
load("@build_bazel_rules_nodejs//:providers.bzl", "DeclarationInfo", "NpmPackageInfo", "declaration_info", "js_module_info", "run_node")
_DEFAULT_TSC = (
# BEGIN-INTERNAL
"@npm" +
# END-INTERNAL
"//typescript/bin:tsc"
)
_ATTRS = {
"args": attr.string_list(),
"declaration_dir... | 45.865297 | 157 | 0.662104 |
load("@build_bazel_rules_nodejs//:providers.bzl", "DeclarationInfo", "NpmPackageInfo", "declaration_info", "js_module_info", "run_node")
_DEFAULT_TSC = (
"@npm" +
"//typescript/bin:tsc"
)
_ATTRS = {
"args": attr.string_list(),
"declaration_dir": attr.string(),
"deps": attr.label_list(pr... | true | true |
f7029df8f7bce93b2ecff06eff3a6b32d27d9d3d | 140 | py | Python | marrow/dsl/exc.py | marrow/dsl | 79899531361aace5741a79de79304e1f7aaa600d | [
"MIT"
] | 10 | 2018-02-23T07:13:29.000Z | 2021-11-08T14:53:47.000Z | marrow/dsl/exc.py | marrow/dsl | 79899531361aace5741a79de79304e1f7aaa600d | [
"MIT"
] | null | null | null | marrow/dsl/exc.py | marrow/dsl | 79899531361aace5741a79de79304e1f7aaa600d | [
"MIT"
] | null | null | null | # encoding: utf-8
from __future__ import unicode_literals
class TranslationError(Exception):
"""Failure to translate source."""
pass
| 14 | 39 | 0.757143 |
from __future__ import unicode_literals
class TranslationError(Exception):
pass
| true | true |
f7029e2387e943ad5f298a67c17e2e40f52d5567 | 362 | py | Python | sample_problems/problems_with_solution57.py | adi01trip01/adi_workspace | f493b3ba84645eec3a57607243760a826880d1a3 | [
"MIT"
] | null | null | null | sample_problems/problems_with_solution57.py | adi01trip01/adi_workspace | f493b3ba84645eec3a57607243760a826880d1a3 | [
"MIT"
] | null | null | null | sample_problems/problems_with_solution57.py | adi01trip01/adi_workspace | f493b3ba84645eec3a57607243760a826880d1a3 | [
"MIT"
] | null | null | null | # Write a Python program to get execution time for a Python method.
import time
def sum_of_n_numbers(x):
start_time = time.time()
s = 0
for i in range(1, x + 1):
s = s + i
end_time = time.time()
return s, end_time - start_time
n = 5
print("\nTime to sum of 1 to ", n, " and required time... | 21.294118 | 95 | 0.632597 |
import time
def sum_of_n_numbers(x):
start_time = time.time()
s = 0
for i in range(1, x + 1):
s = s + i
end_time = time.time()
return s, end_time - start_time
n = 5
print("\nTime to sum of 1 to ", n, " and required time to calculate is :", sum_of_n_numbers(n))
| true | true |
f7029e2981a4619967429d8979bc4eb77eb2ef8d | 13,759 | py | Python | kivy/input/providers/mtdev.py | DaleEMoore/kivy | 3fc5a455d8f50c857866082091f09b834ecf64af | [
"MIT"
] | 1 | 2017-10-25T03:23:36.000Z | 2017-10-25T03:23:36.000Z | kivy/input/providers/mtdev.py | DaleEMoore/kivy | 3fc5a455d8f50c857866082091f09b834ecf64af | [
"MIT"
] | null | null | null | kivy/input/providers/mtdev.py | DaleEMoore/kivy | 3fc5a455d8f50c857866082091f09b834ecf64af | [
"MIT"
] | null | null | null | '''
Native support for Multitouch devices on Linux, using libmtdev.
===============================================================
The Mtdev project is a part of the Ubuntu Maverick multitouch architecture.
You can read more on http://wiki.ubuntu.com/Multitouch
To configure MTDev, it's preferable to use probesysfs p... | 38.977337 | 79 | 0.49226 |
__all__ = ('MTDMotionEventProvider', 'MTDMotionEvent')
import os
from kivy.input.motionevent import MotionEvent
from kivy.input.shape import ShapeRect
class MTDMotionEvent(MotionEvent):
def depack(self, args):
self.is_touch = True
if 'x' in args:
self.sx = args['x']
else:
... | true | true |
f7029ebf8b275c2961b1fda13c18da5f443bfc24 | 825 | py | Python | backend/data_export/tests/test_dataset.py | arcada-uas/doccano | c29aece3dd4504eeaaa3466af0663bfe18b90dc1 | [
"MIT"
] | 2,082 | 2018-05-09T07:16:21.000Z | 2019-12-01T16:41:50.000Z | backend/data_export/tests/test_dataset.py | arcada-uas/doccano | c29aece3dd4504eeaaa3466af0663bfe18b90dc1 | [
"MIT"
] | 365 | 2018-07-31T13:49:05.000Z | 2019-11-29T11:25:17.000Z | backend/data_export/tests/test_dataset.py | arcada-uas/doccano | c29aece3dd4504eeaaa3466af0663bfe18b90dc1 | [
"MIT"
] | 476 | 2018-08-17T06:43:57.000Z | 2019-12-01T09:47:08.000Z | import unittest
from unittest.mock import MagicMock
import pandas as pd
from pandas.testing import assert_frame_equal
from data_export.pipeline.dataset import Dataset
class TestDataset(unittest.TestCase):
def setUp(self):
example = MagicMock()
example.to_dict.return_value = {"data": "example"}
... | 31.730769 | 75 | 0.672727 | import unittest
from unittest.mock import MagicMock
import pandas as pd
from pandas.testing import assert_frame_equal
from data_export.pipeline.dataset import Dataset
class TestDataset(unittest.TestCase):
def setUp(self):
example = MagicMock()
example.to_dict.return_value = {"data": "example"}
... | true | true |
f7029fff48454ff996b3fa84325dfe291ea89943 | 706 | py | Python | src/python/grpcio_channelz/grpc_version.py | xeno14/grpc | ceb12c6be5f801997db976b564ddb14f95e46ce9 | [
"Apache-2.0"
] | 2 | 2019-08-15T18:29:13.000Z | 2020-11-03T20:18:42.000Z | src/python/grpcio_channelz/grpc_version.py | xeno14/grpc | ceb12c6be5f801997db976b564ddb14f95e46ce9 | [
"Apache-2.0"
] | 2 | 2017-03-07T22:54:36.000Z | 2017-04-14T15:17:36.000Z | src/python/grpcio_channelz/grpc_version.py | xeno14/grpc | ceb12c6be5f801997db976b564ddb14f95e46ce9 | [
"Apache-2.0"
] | 1 | 2021-08-03T19:12:54.000Z | 2021-08-03T19:12:54.000Z | # Copyright 2018 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | 39.222222 | 99 | 0.763456 |
VERSION = '1.23.0.dev0'
| true | true |
f702a06791c1c7d80d4cc9c623916b3a47b3c85a | 15,279 | py | Python | tools/external_converter_v2/parser/kill_fluid/fluid_helper.py | kiritigowda/Anakin | 4ba2329153163590e11875dc6b4150031066915d | [
"Apache-2.0"
] | null | null | null | tools/external_converter_v2/parser/kill_fluid/fluid_helper.py | kiritigowda/Anakin | 4ba2329153163590e11875dc6b4150031066915d | [
"Apache-2.0"
] | 3 | 2018-06-22T09:08:44.000Z | 2018-07-04T08:38:30.000Z | tools/external_converter_v2/parser/kill_fluid/fluid_helper.py | kiritigowda/Anakin | 4ba2329153163590e11875dc6b4150031066915d | [
"Apache-2.0"
] | null | null | null | from ..proto import *
from ..graph_io import *
import paddle.fluid as fluid
import numpy as np
from paddle.fluid.core import VarDesc, AttrType
def union(list_a, list_b):
return list(set(list_a).union(set(list_b)))
def difference(list_a, list_b):
return list(set(list_a).difference(set(list_b)))
class Edge_for_flu... | 29.553191 | 116 | 0.698344 | from ..proto import *
from ..graph_io import *
import paddle.fluid as fluid
import numpy as np
from paddle.fluid.core import VarDesc, AttrType
def union(list_a, list_b):
return list(set(list_a).union(set(list_b)))
def difference(list_a, list_b):
return list(set(list_a).difference(set(list_b)))
class Edge_for_flu... | true | true |
f702a16a4c7e987eab3c8054b87c6ed9a6452980 | 10,100 | py | Python | myven/lib/python3.8/site-packages/ansible/modules/cloud/vmware/vcenter_folder.py | baltham/dne-dna-code | 4a13309a790a670d2f07e635c9264a0c29976c6a | [
"MIT"
] | 1 | 2021-04-02T08:08:39.000Z | 2021-04-02T08:08:39.000Z | myven/lib/python3.8/site-packages/ansible/modules/cloud/vmware/vcenter_folder.py | baltham/dne-dna-code | 4a13309a790a670d2f07e635c9264a0c29976c6a | [
"MIT"
] | null | null | null | myven/lib/python3.8/site-packages/ansible/modules/cloud/vmware/vcenter_folder.py | baltham/dne-dna-code | 4a13309a790a670d2f07e635c9264a0c29976c6a | [
"MIT"
] | 1 | 2020-05-03T01:13:16.000Z | 2020-05-03T01:13:16.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata... | 39.76378 | 128 | 0.629307 |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = r'''
---
module: vcenter_folder
short_description: Manage folders on given datacenter
description... | true | true |
f702a18d54a46af8e2dc11e1153545101f920c8d | 10,971 | py | Python | disturbance/components/approvals/email.py | KellyThomas/disturbance | d2096d39a199dc615b430dc43b1d0e05fab4c35f | [
"Apache-2.0"
] | null | null | null | disturbance/components/approvals/email.py | KellyThomas/disturbance | d2096d39a199dc615b430dc43b1d0e05fab4c35f | [
"Apache-2.0"
] | null | null | null | disturbance/components/approvals/email.py | KellyThomas/disturbance | d2096d39a199dc615b430dc43b1d0e05fab4c35f | [
"Apache-2.0"
] | null | null | null | import logging
from django.core.mail import EmailMultiAlternatives, EmailMessage
from django.utils.encoding import smart_text
from django.core.urlresolvers import reverse
from django.conf import settings
from disturbance.components.emails.emails import TemplateEmailBase
from ledger.accounts.models import EmailUser
l... | 35.970492 | 101 | 0.700939 | import logging
from django.core.mail import EmailMultiAlternatives, EmailMessage
from django.utils.encoding import smart_text
from django.core.urlresolvers import reverse
from django.conf import settings
from disturbance.components.emails.emails import TemplateEmailBase
from ledger.accounts.models import EmailUser
l... | true | true |
f702a1d2e380b80b1174c5cef1e503b3d1000993 | 13,542 | py | Python | etender_service.py | Bodyan37/robot_tests.broker.etender | be35364965d886312e0b6d803f985f2cfc981a94 | [
"Apache-2.0"
] | null | null | null | etender_service.py | Bodyan37/robot_tests.broker.etender | be35364965d886312e0b6d803f985f2cfc981a94 | [
"Apache-2.0"
] | null | null | null | etender_service.py | Bodyan37/robot_tests.broker.etender | be35364965d886312e0b6d803f985f2cfc981a94 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -
from iso8601 import parse_date
from datetime import datetime, date, time, timedelta
import dateutil.parser
from pytz import timezone
import os
from decimal import Decimal
import re
TZ = timezone(os.environ['TZ'] if 'TZ' in os.environ else 'Europe/Kiev')
def get_all_etender_dates(initial_tender... | 35.920424 | 119 | 0.645326 |
from iso8601 import parse_date
from datetime import datetime, date, time, timedelta
import dateutil.parser
from pytz import timezone
import os
from decimal import Decimal
import re
TZ = timezone(os.environ['TZ'] if 'TZ' in os.environ else 'Europe/Kiev')
def get_all_etender_dates(initial_tender_data):
tender_pe... | true | true |
f702a1da97b07980eb0080e9eb0cd536cdc7c88d | 28,785 | py | Python | python/ray/tests/test_runtime_env.py | RaphaelCS/ray | 5f4d9085d2452186bff563fb2856e643c4c82095 | [
"Apache-2.0"
] | 1 | 2022-02-24T02:38:04.000Z | 2022-02-24T02:38:04.000Z | python/ray/tests/test_runtime_env.py | swag1ong/ray | fdbeef604692aa308973988b32405ec0d70f9f40 | [
"Apache-2.0"
] | null | null | null | python/ray/tests/test_runtime_env.py | swag1ong/ray | fdbeef604692aa308973988b32405ec0d70f9f40 | [
"Apache-2.0"
] | null | null | null | import os
import pytest
import sys
import random
import tempfile
import requests
from pathlib import Path
import ray
from ray.test_utils import (run_string_as_driver,
run_string_as_driver_nonblocking)
from ray._private.utils import (get_wheel_filename, get_master_wheel_url,
... | 35.537037 | 79 | 0.640021 | import os
import pytest
import sys
import random
import tempfile
import requests
from pathlib import Path
import ray
from ray.test_utils import (run_string_as_driver,
run_string_as_driver_nonblocking)
from ray._private.utils import (get_wheel_filename, get_master_wheel_url,
... | true | true |
f702a468588e10d781ab9dbc62f627d8b569cd7c | 262 | py | Python | src/PostService/__init__.py | Group-13-Bachelor/Microservice | c7186953e6ef63d141ea148e74b6bbbe3242f71e | [
"MIT"
] | null | null | null | src/PostService/__init__.py | Group-13-Bachelor/Microservice | c7186953e6ef63d141ea148e74b6bbbe3242f71e | [
"MIT"
] | 1 | 2022-02-14T09:31:04.000Z | 2022-03-02T13:04:33.000Z | src/PostService/__init__.py | Group-13-Bachelor/Microservice | c7186953e6ef63d141ea148e74b6bbbe3242f71e | [
"MIT"
] | null | null | null | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///posts.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
# app.config['FLASK_RUN_PORT'] = 5002
db = SQLAlchemy(app)
| 23.818182 | 60 | 0.774809 | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///posts.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
| true | true |
f702a49b0738bb825345e613e66c54392b82e80e | 1,670 | py | Python | test/test_get_account_plan.py | Danilka/APIv3-python-library | c96472f47d652d2e09e8b4a48a80e33fde06e7f1 | [
"MIT"
] | null | null | null | test/test_get_account_plan.py | Danilka/APIv3-python-library | c96472f47d652d2e09e8b4a48a80e33fde06e7f1 | [
"MIT"
] | null | null | null | test/test_get_account_plan.py | Danilka/APIv3-python-library | c96472f47d652d2e09e8b4a48a80e33fde06e7f1 | [
"MIT"
] | null | null | null | # coding: utf-8
"""
SendinBlue API
SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at h... | 40.731707 | 820 | 0.673653 |
from __future__ import absolute_import
import unittest
import sib_api_v3_sdk
from sib_api_v3_sdk.models.get_account_plan import GetAccountPlan
from sib_api_v3_sdk.rest import ApiException
class TestGetAccountPlan(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
... | true | true |
f702a4a82b4b1953954629cd1af554b044385a86 | 5,977 | py | Python | model/video_cnn.py | Fengdalu/LEARN-AN-EFFECTIVE-LIP-READING-MODEL-WITHOUT-PAINS | 8d5eef415c19b4c5e161259b1222fbfec6a5edb0 | [
"MIT"
] | 92 | 2020-11-16T04:23:14.000Z | 2022-02-28T19:29:18.000Z | model/video_cnn.py | echoyinke/learn-an-effective-lip-reading-model-without-pains | 8d5eef415c19b4c5e161259b1222fbfec6a5edb0 | [
"MIT"
] | 21 | 2020-12-26T05:53:56.000Z | 2022-01-26T06:47:18.000Z | model/video_cnn.py | echoyinke/learn-an-effective-lip-reading-model-without-pains | 8d5eef415c19b4c5e161259b1222fbfec6a5edb0 | [
"MIT"
] | 22 | 2020-11-20T04:09:37.000Z | 2021-12-25T13:27:27.000Z | # coding: utf-8
import math
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
... | 31.624339 | 105 | 0.52953 |
import math
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
def conv1x1(in_... | true | true |
f702a59f427362751552fc4050a4365a830015ce | 740 | py | Python | hack-at-brown-2015/tweepy/__init__.py | hackatbrown/2015.hackatbrown.org | 6e6e10b010421228deb562909a1c8bb4272b759f | [
"MIT"
] | 24 | 2015-11-12T06:33:24.000Z | 2019-04-16T11:11:13.000Z | hack-at-brown-2015/tweepy/__init__.py | hackatbrown/2015.hackatbrown.org | 6e6e10b010421228deb562909a1c8bb4272b759f | [
"MIT"
] | 3 | 2015-11-12T22:16:22.000Z | 2021-08-09T07:00:27.000Z | hack-at-brown-2015/tweepy/__init__.py | hackatbrown/2015.hackatbrown.org | 6e6e10b010421228deb562909a1c8bb4272b759f | [
"MIT"
] | 7 | 2015-11-12T20:09:56.000Z | 2020-12-16T17:59:02.000Z | # Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
"""
Tweepy Twitter API library
"""
__version__ = '3.2.0'
__author__ = 'Joshua Roesslein'
__license__ = 'MIT'
from tweepy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResults, ModelFactory, Category
from tweepy.erro... | 28.461538 | 117 | 0.793243 |
__version__ = '3.2.0'
__author__ = 'Joshua Roesslein'
__license__ = 'MIT'
from tweepy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResults, ModelFactory, Category
from tweepy.error import TweepError
from tweepy.api import API
from tweepy.cache import Cache, MemoryCache, FileCache
from ... | true | true |
f702a66aba0e0c08f62d9684b7fc08ee12f90210 | 1,370 | py | Python | automanual/add_spotify_uris.py | Julian/Great | d08f7b8c48b788931b65d377283ce5cbdde2e08b | [
"MIT"
] | 1 | 2020-10-31T17:28:20.000Z | 2020-10-31T17:28:20.000Z | automanual/add_spotify_uris.py | Julian/Great | d08f7b8c48b788931b65d377283ce5cbdde2e08b | [
"MIT"
] | 18 | 2018-01-14T17:01:47.000Z | 2021-03-08T17:36:32.000Z | automanual/add_spotify_uris.py | Julian/Great | d08f7b8c48b788931b65d377283ce5cbdde2e08b | [
"MIT"
] | null | null | null | #!/Users/julian/.local/share/virtualenvs/great/bin/pypy
import json
import sys
from great.models import music
from great.web import engine_from_config
from pyperclip import copy
from sqlalchemy import sql
from titlecase import titlecase
e = engine_from_config()
def canonicalize(artist):
if artist.isupper():
... | 26.346154 | 67 | 0.566423 |
import json
import sys
from great.models import music
from great.web import engine_from_config
from pyperclip import copy
from sqlalchemy import sql
from titlecase import titlecase
e = engine_from_config()
def canonicalize(artist):
if artist.isupper():
return artist
return titlecase(artist)
def ... | false | true |
f702a73b23acce91aa9cdd7f67b38c7b12687972 | 162,774 | py | Python | test/probe/test_sharder.py | masoud91/swift | 19b2e3756521d050a95fb2808d4780d52e7be97f | [
"Apache-2.0"
] | 3 | 2020-08-10T14:13:49.000Z | 2021-08-08T10:21:31.000Z | test/probe/test_sharder.py | masoud91/swift | 19b2e3756521d050a95fb2808d4780d52e7be97f | [
"Apache-2.0"
] | 1 | 2021-02-02T09:35:05.000Z | 2021-02-02T09:35:05.000Z | test/probe/test_sharder.py | masoud91/swift | 19b2e3756521d050a95fb2808d4780d52e7be97f | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2017 OpenStack Foundation
#
# 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 ... | 49.930675 | 79 | 0.623613 |
import json
import os
import shutil
import subprocess
import uuid
from nose import SkipTest
import six
from six.moves.urllib.parse import quote
from swift.common import direct_client, utils
from swift.common.manager import Manager
from swift.common.memcached import MemcacheRing
from swift.common.utils i... | true | true |
f702a7af87b2f0f86ea66e1c3ec3667a9c27a8b5 | 20,904 | py | Python | pyisocalc/pyisocalc.py | andy-d-palmer/pyMS | 76453e45e2634bd5812c4fef4b47feb469010c9e | [
"Apache-2.0"
] | 6 | 2017-11-23T10:00:15.000Z | 2020-01-19T01:47:32.000Z | pyisocalc/pyisocalc.py | andy-d-palmer/pyMS | 76453e45e2634bd5812c4fef4b47feb469010c9e | [
"Apache-2.0"
] | null | null | null | pyisocalc/pyisocalc.py | andy-d-palmer/pyMS | 76453e45e2634bd5812c4fef4b47feb469010c9e | [
"Apache-2.0"
] | 3 | 2015-07-30T12:05:41.000Z | 2018-06-02T04:02:49.000Z | #!/usr/bin/env python
#########################################################################
# Author: Andy Ohlin (debian.user@gmx.com)
# Modified by: Andrew Palmer (palmer@embl.de)
# Artem Tarasov (lomereiter@gmail.com)
#
# Example usage:
# pyisocalc('Fe(ClO3)5',plot=false,gauss=0.25,charge=-2,resoluti... | 44.954839 | 218 | 0.585677 |
372, 0.0541, 0.0518]],
'V': [23, 5, [49.947156, 50.943957], [0.0025, 0.9975]],
'Cr': [24, 2, [49.946042, 51.940506, 52.940648, 53.938879], [0.04345, 0.83789, 0.09501, 0.02365]],
'Mn': [25, 2, [54.938044], [1.0]],
'Fe': [26, 3, [53.939609, 55.934936, 56.935393, 57.933274], [0.05845, 0.91754, 0.02119, 0.00282]],
'Co': [... | false | true |
f702a83360c91a0c7d5e24011db3653f658bd555 | 394 | py | Python | test/test_google_search.py | mtkumar123/CSC510_Project_LectureAid | 678e39596ca583eda961413118781bafa02c6f1d | [
"MIT"
] | null | null | null | test/test_google_search.py | mtkumar123/CSC510_Project_LectureAid | 678e39596ca583eda961413118781bafa02c6f1d | [
"MIT"
] | 45 | 2021-09-13T00:26:54.000Z | 2021-09-30T01:12:53.000Z | test/test_google_search.py | mtkumar123/CSC510_Project_LectureAid | 678e39596ca583eda961413118781bafa02c6f1d | [
"MIT"
] | 2 | 2021-09-29T00:40:56.000Z | 2021-10-17T14:28:25.000Z | import unittest
from code.google_search import get_people_also_ask_links
class TestGoogleSearch(unittest.TestCase):
def setUp(self) -> None:
pass
def test_get_people_also_ask_links(self):
"""Test the get_people_also_ask_links method"""
test = "principal components"
result = get... | 30.307692 | 56 | 0.72335 | import unittest
from code.google_search import get_people_also_ask_links
class TestGoogleSearch(unittest.TestCase):
def setUp(self) -> None:
pass
def test_get_people_also_ask_links(self):
test = "principal components"
result = get_people_also_ask_links(test)
self.assertEqual(li... | true | true |
f702aa423d4c47e5a80244f89f501ffc9d1a9a08 | 4,584 | py | Python | cinder/tests/api/contrib/test_volume_image_metadata.py | CloudVPS/cinder | 9097b9407b6ce16c7b5678682284a0ad0fcc652d | [
"Apache-2.0"
] | null | null | null | cinder/tests/api/contrib/test_volume_image_metadata.py | CloudVPS/cinder | 9097b9407b6ce16c7b5678682284a0ad0fcc652d | [
"Apache-2.0"
] | null | null | null | cinder/tests/api/contrib/test_volume_image_metadata.py | CloudVPS/cinder | 9097b9407b6ce16c7b5678682284a0ad0fcc652d | [
"Apache-2.0"
] | null | null | null | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
#
# 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... | 32.978417 | 77 | 0.681065 |
import datetime
import json
import uuid
from xml.dom import minidom
import webob
from cinder.api import common
from cinder.api.openstack.wsgi import MetadataXMLDeserializer
from cinder.api.openstack.wsgi import XMLDeserializer
from cinder import db
from cinder import test
from cinder.tests.api import ... | true | true |
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 |
f702c68adf8353a935ab00dad8bf99c1aab432d1 | 1,577 | py | Python | develop_language/python/doc/spider/wall_papers.py | magic428/subjects_notes | 6930adbb3f445c11ca9d024abb12a53d6aca19e7 | [
"MIT"
] | 2 | 2020-03-18T17:13:00.000Z | 2020-03-25T02:34:03.000Z | develop_language/python/doc/spider/wall_papers.py | magic428/subjects_notes | 6930adbb3f445c11ca9d024abb12a53d6aca19e7 | [
"MIT"
] | null | null | null | develop_language/python/doc/spider/wall_papers.py | magic428/subjects_notes | 6930adbb3f445c11ca9d024abb12a53d6aca19e7 | [
"MIT"
] | null | null | null |
# coding: utf-8
# # python 爬虫相关
# ## 1. class 定义和使用
# In[11]:
import os
import requests
import time
import random
from lxml import etree
class Spider(object):
def __init__(self, savePath, keyWord):
self.headers = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 1... | 29.203704 | 151 | 0.606848 |
import random
from lxml import etree
class Spider(object):
def __init__(self, savePath, keyWord):
self.headers = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36",
}
self.ke... | false | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.