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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f71e2f8d7692afc5941b35ae1ab1c5e9f76147ef | 1,438 | py | Python | setup.py | YuraHavrylko/revenuecat_python | a25b234933b6e80e1ff09b6a82d73a0e3df91caa | [
"MIT"
] | 1 | 2020-12-11T09:31:02.000Z | 2020-12-11T09:31:02.000Z | setup.py | YuraHavrylko/revenuecat_python | a25b234933b6e80e1ff09b6a82d73a0e3df91caa | [
"MIT"
] | null | null | null | setup.py | YuraHavrylko/revenuecat_python | a25b234933b6e80e1ff09b6a82d73a0e3df91caa | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""The setup script."""
from setuptools import setup, find_packages
with open('README.md') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = ['httpx', ]
setup_requirements = ['pytest-runner', ]
test_req... | 29.346939 | 81 | 0.659249 |
from setuptools import setup, find_packages
with open('README.md') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = ['httpx', ]
setup_requirements = ['pytest-runner', ]
test_requirements = ['pytest>=3', ]
setup(
autho... | true | true |
f71e32462865ab179efbd73d661ab16a1fde5483 | 12,404 | py | Python | cdk/app.py | liangfb/aws-dynamodb-cross-region-replication | 24a354158cb19c87785bdb59400c5522d706a9a1 | [
"MIT-0"
] | 12 | 2020-06-05T02:46:42.000Z | 2022-02-24T11:19:55.000Z | cdk/app.py | liangfb/aws-dynamodb-cross-region-replication | 24a354158cb19c87785bdb59400c5522d706a9a1 | [
"MIT-0"
] | null | null | null | cdk/app.py | liangfb/aws-dynamodb-cross-region-replication | 24a354158cb19c87785bdb59400c5522d706a9a1 | [
"MIT-0"
] | 4 | 2020-06-07T15:29:53.000Z | 2021-06-10T18:59:38.000Z | from aws_cdk import (
aws_lambda as lambda_,
aws_sqs as sqs,
aws_dynamodb as ddb,
aws_ec2 as ec2,
aws_kinesis as kinesis,
aws_ssm as ssm,
core
)
from aws_cdk.aws_dynamodb import StreamViewType
from aws_cdk.aws_ec2 import SubnetSelection, SubnetType
from aws_cdk.aws_iam import PolicyStatement... | 49.815261 | 116 | 0.545066 | from aws_cdk import (
aws_lambda as lambda_,
aws_sqs as sqs,
aws_dynamodb as ddb,
aws_ec2 as ec2,
aws_kinesis as kinesis,
aws_ssm as ssm,
core
)
from aws_cdk.aws_dynamodb import StreamViewType
from aws_cdk.aws_ec2 import SubnetSelection, SubnetType
from aws_cdk.aws_iam import PolicyStatement... | true | true |
f71e32526c89d04a91ff2d8fb4b429508b64ebc4 | 316 | py | Python | 30 Days of Code/Day 5 Loops/Solution.py | iamnambiar/HackerRank-Solutions | 6fdcab79b18e66a6d7278b979a8be087f8f6c696 | [
"MIT"
] | 2 | 2020-04-06T10:32:08.000Z | 2021-04-23T04:32:45.000Z | 30 Days of Code/Day 5 Loops/Solution.py | iamnambiar/HackerRank-Solutions | 6fdcab79b18e66a6d7278b979a8be087f8f6c696 | [
"MIT"
] | null | null | null | 30 Days of Code/Day 5 Loops/Solution.py | iamnambiar/HackerRank-Solutions | 6fdcab79b18e66a6d7278b979a8be087f8f6c696 | [
"MIT"
] | null | null | null | # https://www.hackerrank.com/challenges/30-loops/problem
#!/bin/python3
import math
import os
import random
import re
import sys
def printMultiples(number):
for i in range(1,11):
print(str(number)+" x "+str(i)+" = "+str(number*i))
if __name__ == '__main__':
n = int(input())
printMultiples(n) | 18.588235 | 59 | 0.664557 |
import math
import os
import random
import re
import sys
def printMultiples(number):
for i in range(1,11):
print(str(number)+" x "+str(i)+" = "+str(number*i))
if __name__ == '__main__':
n = int(input())
printMultiples(n) | true | true |
f71e331cef3b1394d9e7e053e583141c9058ad7e | 2,466 | py | Python | tests/test_vault.py | zx2c4-forks/angr | e15619d99a093af77943b28b5b368e6607a2f336 | [
"BSD-2-Clause"
] | 2 | 2020-04-29T02:39:42.000Z | 2020-04-29T08:07:44.000Z | tests/test_vault.py | hhuihuang/helios-angr | 1978fa5392d65901633191b61c01017627ab7755 | [
"BSD-2-Clause"
] | null | null | null | tests/test_vault.py | hhuihuang/helios-angr | 1978fa5392d65901633191b61c01017627ab7755 | [
"BSD-2-Clause"
] | null | null | null | import claripy
import angr
class A:
n = 0
def do_vault_identity(v_factory):
v = v_factory()
v.uuid_dedup.add(A)
assert len(v.keys()) == 0
a = A()
b = A()
b.n = 1
c = A()
c.n = 2
aid = v.store(a)
assert len(v.keys()) == 1
bid = v.store(b)
assert len(v.keys()) == 2
cid = v.store(c)
assert len(v.keys())... | 18.132353 | 64 | 0.643958 | import claripy
import angr
class A:
n = 0
def do_vault_identity(v_factory):
v = v_factory()
v.uuid_dedup.add(A)
assert len(v.keys()) == 0
a = A()
b = A()
b.n = 1
c = A()
c.n = 2
aid = v.store(a)
assert len(v.keys()) == 1
bid = v.store(b)
assert len(v.keys()) == 2
cid = v.store(c)
assert len(v.keys())... | true | true |
f71e33bd084310d0aeba71a25aac58cd5fcf8bbb | 1,082 | py | Python | line.py | kavach-feature/Advanced_lane_finding | 12e4e330e338734fdb35655c7581b98ba1eb490b | [
"MIT"
] | null | null | null | line.py | kavach-feature/Advanced_lane_finding | 12e4e330e338734fdb35655c7581b98ba1eb490b | [
"MIT"
] | null | null | null | line.py | kavach-feature/Advanced_lane_finding | 12e4e330e338734fdb35655c7581b98ba1eb490b | [
"MIT"
] | null | null | null | import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import pickle
class Line():
def __init__(self,n):
self.n=n
self.detected =False
#Polynomial coefficients of the lines
self.A=[]
self.B=[]
self.C=[]
#Running average of coefficients
sel... | 18.655172 | 106 | 0.660813 | import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import pickle
class Line():
def __init__(self,n):
self.n=n
self.detected =False
self.A=[]
self.B=[]
self.C=[]
self.A_avg=0.
self.B_avg=0.
self.C_avg=0.
def obtain_fit(self):
... | true | true |
f71e34484d2699805f3e8b41dc2369ce69733744 | 5,651 | py | Python | devstack/files/grafana/grafana-init.py | zhangjianweibj/monasca-api | 26133aefe413546f91aaa13c981fe93a69dfc2eb | [
"Apache-2.0"
] | null | null | null | devstack/files/grafana/grafana-init.py | zhangjianweibj/monasca-api | 26133aefe413546f91aaa13c981fe93a69dfc2eb | [
"Apache-2.0"
] | 5 | 2019-08-14T06:46:03.000Z | 2021-12-13T20:01:25.000Z | devstack/files/grafana/grafana-init.py | zhangjianweibj/monasca-api | 26133aefe413546f91aaa13c981fe93a69dfc2eb | [
"Apache-2.0"
] | 2 | 2020-03-15T01:24:15.000Z | 2020-07-22T20:34:26.000Z | #!/usr/bin/env python
# coding=utf-8
# (C) Copyright 2017 Hewlett Packard Enterprise Development LP
#
# 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... | 31.747191 | 87 | 0.623076 |
import glob
import json
import logging
import os
import sys
import time
from requests import RequestException
from requests import Session
LOG_LEVEL = logging.getLevelName(os.environ.get('LOG_LEVEL', 'INFO'))
logging.basicConfig(level=LOG_LEVEL)
logger = logging.getLogger(__name__)
GRAFANA_URL = os... | true | true |
f71e344d83b88a33fee568792a59d599f2f0eac4 | 699 | py | Python | scripts/fhr/count_facets.py | bcolloran/jydoop | 0267cbf8f467a77fae97c1604e2cbb70f4aba7d4 | [
"Apache-2.0"
] | 1 | 2017-09-28T08:35:26.000Z | 2017-09-28T08:35:26.000Z | scripts/fhr/count_facets.py | bcolloran/jydoop | 0267cbf8f467a77fae97c1604e2cbb70f4aba7d4 | [
"Apache-2.0"
] | null | null | null | scripts/fhr/count_facets.py | bcolloran/jydoop | 0267cbf8f467a77fae97c1604e2cbb70f4aba7d4 | [
"Apache-2.0"
] | null | null | null | import json
import jydoop
import healthreportutils
setupjob = healthreportutils.setupjob
combine = jydoop.sumreducer
def map(key, value, context):
try:
payload = json.loads(value)
except:
context.write("Bogus\tBogus\tBogus\tBogus", 1)
return
output = []
try:
info = pa... | 21.84375 | 54 | 0.597997 | import json
import jydoop
import healthreportutils
setupjob = healthreportutils.setupjob
combine = jydoop.sumreducer
def map(key, value, context):
try:
payload = json.loads(value)
except:
context.write("Bogus\tBogus\tBogus\tBogus", 1)
return
output = []
try:
info = pa... | true | true |
f71e348b15e2cb995ca29be30b12308864a64f38 | 5,124 | py | Python | kanmail/window.py | frznvm0/Kanmail | 98699a14fa32aa1fd6d7384328ca30da6aae7a01 | [
"OpenSSL"
] | null | null | null | kanmail/window.py | frznvm0/Kanmail | 98699a14fa32aa1fd6d7384328ca30da6aae7a01 | [
"OpenSSL"
] | null | null | null | kanmail/window.py | frznvm0/Kanmail | 98699a14fa32aa1fd6d7384328ca30da6aae7a01 | [
"OpenSSL"
] | null | null | null | from typing import Dict, Optional, Union
from uuid import uuid4
import webview
from kanmail.log import logger
from kanmail.server.app import server
from kanmail.settings.constants import DEBUG, FRAMELESS, IS_APP, SERVER_HOST, SESSION_TOKEN
ID_TO_WINDOW = {} # internal ID -> window object
UNIQUE_NAME_TO_ID = {} # n... | 31.054545 | 97 | 0.685402 | from typing import Dict, Optional, Union
from uuid import uuid4
import webview
from kanmail.log import logger
from kanmail.server.app import server
from kanmail.settings.constants import DEBUG, FRAMELESS, IS_APP, SERVER_HOST, SESSION_TOKEN
ID_TO_WINDOW = {}
UNIQUE_NAME_TO_ID = {}
def create_window(
endpoin... | true | true |
f71e34be826358ffa5149b16e2c58f61431da420 | 6,693 | py | Python | torchlib/deep_rl/algorithm/ppo/utils.py | vermouth1992/torchlib | 63b2bedb40f670b2d9fbfc0daeab4a8d44623095 | [
"MIT"
] | 3 | 2019-07-23T21:32:36.000Z | 2022-02-04T23:13:30.000Z | torchlib/deep_rl/algorithm/ppo/utils.py | vermouth1992/torchlib | 63b2bedb40f670b2d9fbfc0daeab4a8d44623095 | [
"MIT"
] | null | null | null | torchlib/deep_rl/algorithm/ppo/utils.py | vermouth1992/torchlib | 63b2bedb40f670b2d9fbfc0daeab4a8d44623095 | [
"MIT"
] | 1 | 2019-07-23T21:32:23.000Z | 2019-07-23T21:32:23.000Z | """
Common utilities to implement policy gradient algorithms
"""
from collections import namedtuple, deque
import numpy as np
from scipy import signal
from torchlib.dataset.utils import create_data_loader
from torchlib.deep_rl.utils.replay.replay import ReplayBuffer
from torchlib.deep_rl.utils.replay.sampler import S... | 37.183333 | 117 | 0.635739 |
from collections import namedtuple, deque
import numpy as np
from scipy import signal
from torchlib.dataset.utils import create_data_loader
from torchlib.deep_rl.utils.replay.replay import ReplayBuffer
from torchlib.deep_rl.utils.replay.sampler import Sampler
from torchlib.utils.math import unnormalize, normalize
Tr... | true | true |
f71e35702cffecb31e78b3aa2858556b28764eb9 | 3,500 | py | Python | kubernetes/test/test_policy_v1beta1_api.py | fooka03/python | 073cf4d89e532f92b57e8955b4efc3d5d5eb80cf | [
"Apache-2.0"
] | 2 | 2020-07-02T05:47:41.000Z | 2020-07-02T05:50:34.000Z | kubernetes/test/test_policy_v1beta1_api.py | fooka03/python | 073cf4d89e532f92b57e8955b4efc3d5d5eb80cf | [
"Apache-2.0"
] | 1 | 2021-03-25T23:44:49.000Z | 2021-03-25T23:44:49.000Z | k8sdeployment/k8sstat/python/kubernetes/test/test_policy_v1beta1_api.py | JeffYFHuang/gpuaccounting | afa934350ebbd0634beb60b9df4a147426ea0006 | [
"MIT"
] | 1 | 2021-10-13T17:45:37.000Z | 2021-10-13T17:45:37.000Z | # coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.15.6
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... | 23.648649 | 124 | 0.687714 |
from __future__ import absolute_import
import unittest
import kubernetes.client
from kubernetes.client.api.policy_v1beta1_api import PolicyV1beta1Api
from kubernetes.client.rest import ApiException
class TestPolicyV1beta1Api(unittest.TestCase):
def setUp(self):
self.api = kubernetes.client.api.po... | true | true |
f71e3841de6840322ca7bb77900844dca913abf4 | 29 | py | Python | BatalhaNaval.py | rafaelclemes81/Python | 0e685b4e528a29bb23ecf11c9ccdbae8730b3ac3 | [
"MIT"
] | null | null | null | BatalhaNaval.py | rafaelclemes81/Python | 0e685b4e528a29bb23ecf11c9ccdbae8730b3ac3 | [
"MIT"
] | null | null | null | BatalhaNaval.py | rafaelclemes81/Python | 0e685b4e528a29bb23ecf11c9ccdbae8730b3ac3 | [
"MIT"
] | null | null | null | ''' Jogo Batalha Naval '''
| 7.25 | 26 | 0.551724 | true | true | |
f71e38c13ec8321f0a922bfca3d6d3b50576bfd0 | 2,147 | py | Python | import_export/results.py | michelekihiu/superintendence_tracking | 325513059eeec25fdffd5ccb36befc0a9e8235ac | [
"BSD-2-Clause"
] | 1 | 2017-10-31T02:37:37.000Z | 2017-10-31T02:37:37.000Z | import_export/results.py | michelekihiu/superintendence_tracking | 325513059eeec25fdffd5ccb36befc0a9e8235ac | [
"BSD-2-Clause"
] | 2 | 2021-06-01T22:03:20.000Z | 2022-01-13T00:43:38.000Z | import_export/results.py | michelekihiu/superintendence_tracking | 325513059eeec25fdffd5ccb36befc0a9e8235ac | [
"BSD-2-Clause"
] | 1 | 2020-11-04T08:39:52.000Z | 2020-11-04T08:39:52.000Z | from __future__ import unicode_literals
try:
from collections import OrderedDict
except ImportError:
from django.utils.datastructures import SortedDict as OrderedDict
from tablib import Dataset
class Error(object):
def __init__(self, error, traceback=None, row=None):
self.error = error
s... | 29.819444 | 69 | 0.620401 | from __future__ import unicode_literals
try:
from collections import OrderedDict
except ImportError:
from django.utils.datastructures import SortedDict as OrderedDict
from tablib import Dataset
class Error(object):
def __init__(self, error, traceback=None, row=None):
self.error = error
s... | true | true |
f71e391a2a15cf39c959d5d3a8f6cd170aa714bd | 909 | py | Python | badgify/tests/test_models.py | BrendanBerkley/django-badgify | 61203e92cb76982f778caf168d371a72a401db10 | [
"MIT"
] | 78 | 2015-03-04T13:41:31.000Z | 2021-12-21T14:30:27.000Z | badgify/tests/test_models.py | BrendanBerkley/django-badgify | 61203e92cb76982f778caf168d371a72a401db10 | [
"MIT"
] | 11 | 2015-06-18T18:38:53.000Z | 2019-12-27T14:08:29.000Z | badgify/tests/test_models.py | BrendanBerkley/django-badgify | 61203e92cb76982f778caf168d371a72a401db10 | [
"MIT"
] | 12 | 2015-06-18T16:05:38.000Z | 2018-07-13T12:50:34.000Z | from django.db import IntegrityError
from django.test import TestCase
from ..models import Badge, Award
from .mixins import UserFixturesMixin
class BadgeTestCase(TestCase):
"""
Badge model test case.
"""
def test_autocreate_slug(self):
badge = Badge.objects.create(name='Super Chouette')
... | 25.971429 | 67 | 0.657866 | from django.db import IntegrityError
from django.test import TestCase
from ..models import Badge, Award
from .mixins import UserFixturesMixin
class BadgeTestCase(TestCase):
def test_autocreate_slug(self):
badge = Badge.objects.create(name='Super Chouette')
self.assertEqual(badge.slug, 'super-cho... | true | true |
f71e3bf6b5a4e1db0bd1e025dcf8b861aeb828af | 922 | py | Python | test/test_steps.py | jladdjr/ansible-builder | 7520396f8921b98a033a8f25248dbadb9cd83901 | [
"Apache-2.0"
] | null | null | null | test/test_steps.py | jladdjr/ansible-builder | 7520396f8921b98a033a8f25248dbadb9cd83901 | [
"Apache-2.0"
] | null | null | null | test/test_steps.py | jladdjr/ansible-builder | 7520396f8921b98a033a8f25248dbadb9cd83901 | [
"Apache-2.0"
] | null | null | null | import pytest
import textwrap
from ansible_builder.steps import AdditionalBuildSteps, PipSteps, BindepSteps
def test_steps_for_collection_dependencies():
assert list(PipSteps('requirements.txt')) == [
'ADD requirements.txt /build/',
'RUN pip3 install --upgrade -r /build/requirements.txt'
]
... | 27.939394 | 77 | 0.667028 | import pytest
import textwrap
from ansible_builder.steps import AdditionalBuildSteps, PipSteps, BindepSteps
def test_steps_for_collection_dependencies():
assert list(PipSteps('requirements.txt')) == [
'ADD requirements.txt /build/',
'RUN pip3 install --upgrade -r /build/requirements.txt'
]
... | true | true |
f71e3ce1316873d9471482dae170853222e1b3db | 1,417 | py | Python | download_heroicons.py | zerolab/heroicons | 1a95b8e7316b315377a8773569476aa7bcb8f9e1 | [
"MIT"
] | null | null | null | download_heroicons.py | zerolab/heroicons | 1a95b8e7316b315377a8773569476aa7bcb8f9e1 | [
"MIT"
] | null | null | null | download_heroicons.py | zerolab/heroicons | 1a95b8e7316b315377a8773569476aa7bcb8f9e1 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""
Download the latest heroicons zip file and select only the optimized icons.
"""
import argparse
import os
import sys
from io import BytesIO
from zipfile import ZIP_DEFLATED, ZipFile
import requests
def main(args=None):
parser = argparse.ArgumentParser()
parser.add_argument("version"... | 26.240741 | 87 | 0.652788 |
import argparse
import os
import sys
from io import BytesIO
from zipfile import ZIP_DEFLATED, ZipFile
import requests
def main(args=None):
parser = argparse.ArgumentParser()
parser.add_argument("version", help="e.g. 1.0.1")
args = parser.parse_args(args)
version = args.version
zip_url = (
... | true | true |
f71e3e92f9777ec601bc7079991566c4790da4b1 | 48,021 | py | Python | python/ray/_private/utils.py | jianoaix/ray | 1701b923bc83905f8961c06a6a173e3eba46a936 | [
"Apache-2.0"
] | null | null | null | python/ray/_private/utils.py | jianoaix/ray | 1701b923bc83905f8961c06a6a173e3eba46a936 | [
"Apache-2.0"
] | 41 | 2021-09-21T01:13:48.000Z | 2022-03-19T07:12:22.000Z | python/ray/_private/utils.py | jianoaix/ray | 1701b923bc83905f8961c06a6a173e3eba46a936 | [
"Apache-2.0"
] | 1 | 2019-09-24T16:24:49.000Z | 2019-09-24T16:24:49.000Z | import binascii
import errno
import functools
import hashlib
import importlib
import logging
import multiprocessing
import os
import signal
import subprocess
import sys
import tempfile
import threading
import time
from typing import Optional, Sequence, Tuple, Any, Union, Dict
import uuid
import grpc
import warnings
tr... | 35.518491 | 136 | 0.640616 | import binascii
import errno
import functools
import hashlib
import importlib
import logging
import multiprocessing
import os
import signal
import subprocess
import sys
import tempfile
import threading
import time
from typing import Optional, Sequence, Tuple, Any, Union, Dict
import uuid
import grpc
import warnings
tr... | true | true |
f71e3ee179bc25f0ee46fadb17b0041bb26da0fb | 10,260 | py | Python | tests/components/homematicip_cloud/test_switch.py | pcaston/core | e74d946cef7a9d4e232ae9e0ba150d18018cfe33 | [
"Apache-2.0"
] | 1 | 2021-07-08T20:09:55.000Z | 2021-07-08T20:09:55.000Z | tests/components/homematicip_cloud/test_switch.py | pcaston/core | e74d946cef7a9d4e232ae9e0ba150d18018cfe33 | [
"Apache-2.0"
] | 47 | 2021-02-21T23:43:07.000Z | 2022-03-31T06:07:10.000Z | tests/components/homematicip_cloud/test_switch.py | OpenPeerPower/core | f673dfac9f2d0c48fa30af37b0a99df9dd6640ee | [
"Apache-2.0"
] | null | null | null | """Tests for HomematicIP Cloud switch."""
from openpeerpower.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN
from openpeerpower.components.homematicip_cloud.generic_entity import (
ATTR_GROUP_MEMBER_UNREACHABLE,
)
from openpeerpower.components.switch import (
ATTR_CURRENT_POWER_W,
ATTR_TODAY_ENER... | 37.582418 | 87 | 0.710721 | from openpeerpower.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN
from openpeerpower.components.homematicip_cloud.generic_entity import (
ATTR_GROUP_MEMBER_UNREACHABLE,
)
from openpeerpower.components.switch import (
ATTR_CURRENT_POWER_W,
ATTR_TODAY_ENERGY_KWH,
DOMAIN as SWITCH_DOMAIN,
)
fro... | true | true |
f71e401b78d23a22bfd8c5eeb5995f8f22fe4239 | 299 | py | Python | backend/mp/apps/base/migrations/0012_delete_questionnaire.py | shidashui/mymp | 75d81906908395ece1c8d12249d6afc4bd2d0704 | [
"MIT"
] | 1 | 2020-03-14T12:33:24.000Z | 2020-03-14T12:33:24.000Z | backend/mp/apps/base/migrations/0012_delete_questionnaire.py | shidashui/mymp | 75d81906908395ece1c8d12249d6afc4bd2d0704 | [
"MIT"
] | 8 | 2021-03-19T00:59:11.000Z | 2022-03-12T00:19:38.000Z | backend/mp/apps/base/migrations/0012_delete_questionnaire.py | shidashui/mymp | 75d81906908395ece1c8d12249d6afc4bd2d0704 | [
"MIT"
] | null | null | null | # Generated by Django 3.0.4 on 2020-03-26 11:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('base', '0011_auto_20200326_1107'),
]
operations = [
migrations.DeleteModel(
name='Questionnaire',
),
]
| 17.588235 | 47 | 0.608696 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('base', '0011_auto_20200326_1107'),
]
operations = [
migrations.DeleteModel(
name='Questionnaire',
),
]
| true | true |
f71e40329e3d37616481697f5bfc504ea2916179 | 367 | py | Python | app/classes/run_options.py | robjporter/PYTHON-APIServer-1 | 57df8e8189834504b3f473993ae12586ec32d5c9 | [
"MIT"
] | null | null | null | app/classes/run_options.py | robjporter/PYTHON-APIServer-1 | 57df8e8189834504b3f473993ae12586ec32d5c9 | [
"MIT"
] | null | null | null | app/classes/run_options.py | robjporter/PYTHON-APIServer-1 | 57df8e8189834504b3f473993ae12586ec32d5c9 | [
"MIT"
] | null | null | null | # Run options
# gunicorn -w 4 -b 127.0.0.1:5000 main:app
# waitress main:app
# python3 main.py runserver
# uwsgi --http 0.0.0.0:8000 --home env --wsgi-file main.py --callable app --master --enable-threads --thunder-lock
# virtualenv -p /usr/local/bin/python3 env
# source env/bin/activate
# pip3 install --upg... | 36.7 | 115 | 0.692098 | true | true | |
f71e41255f5f877f4e6d025f4be916412433703c | 7,454 | py | Python | kubernetes/client/models/v1_pod_affinity_term.py | henrywu2019/python | fb7214144395c05349e70a58ea129576f6b11fc4 | [
"Apache-2.0"
] | 4,417 | 2018-01-13T04:30:48.000Z | 2022-03-31T15:33:59.000Z | kubernetes/client/models/v1_pod_affinity_term.py | henrywu2019/python | fb7214144395c05349e70a58ea129576f6b11fc4 | [
"Apache-2.0"
] | 1,414 | 2018-01-12T19:31:56.000Z | 2022-03-31T22:01:02.000Z | kubernetes/client/models/v1_pod_affinity_term.py | henrywu2019/python | fb7214144395c05349e70a58ea129576f6b11fc4 | [
"Apache-2.0"
] | 2,854 | 2018-01-14T08:57:33.000Z | 2022-03-31T01:41:56.000Z | # coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.21
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | 36.539216 | 366 | 0.652267 |
import pprint
import re
import six
from kubernetes.client.configuration import Configuration
class V1PodAffinityTerm(object):
openapi_types = {
'label_selector': 'V1LabelSelector',
'namespace_selector': 'V1LabelSelector',
'namespaces': 'list[str]',
'topology_key': 'str'
... | true | true |
f71e43441726991507a806be6346c189869dd316 | 7,835 | py | Python | great_expectations/expectations/core/expect_column_values_to_be_null.py | victorcouste/great_expectations | 9ee46d83feb87e13c769e2ae35b899b3f18d73a4 | [
"Apache-2.0"
] | 2 | 2022-01-28T15:51:32.000Z | 2022-02-02T05:07:58.000Z | great_expectations/expectations/core/expect_column_values_to_be_null.py | victorcouste/great_expectations | 9ee46d83feb87e13c769e2ae35b899b3f18d73a4 | [
"Apache-2.0"
] | null | null | null | great_expectations/expectations/core/expect_column_values_to_be_null.py | victorcouste/great_expectations | 9ee46d83feb87e13c769e2ae35b899b3f18d73a4 | [
"Apache-2.0"
] | 1 | 2021-10-08T01:24:50.000Z | 2021-10-08T01:24:50.000Z | from typing import Dict, Optional
from great_expectations.core import ExpectationConfiguration
from great_expectations.core.expectation_configuration import parse_result_format
from great_expectations.execution_engine import ExecutionEngine
from great_expectations.expectations.expectation import (
ColumnMapExpecta... | 37.309524 | 115 | 0.636631 | from typing import Dict, Optional
from great_expectations.core import ExpectationConfiguration
from great_expectations.core.expectation_configuration import parse_result_format
from great_expectations.execution_engine import ExecutionEngine
from great_expectations.expectations.expectation import (
ColumnMapExpecta... | true | true |
f71e44aad927f5ef6129ca72ac718a82de543b96 | 842 | py | Python | dojo/unittests/tools/test_acunetix_parser.py | brunoduruzup/django-DefectDojo | cd598b44f1c44ca2a05fdf95f99c0d526509f656 | [
"BSD-3-Clause"
] | 2 | 2021-09-19T23:19:12.000Z | 2022-03-26T10:20:49.000Z | dojo/unittests/tools/test_acunetix_parser.py | brunoduruzup/django-DefectDojo | cd598b44f1c44ca2a05fdf95f99c0d526509f656 | [
"BSD-3-Clause"
] | 167 | 2021-03-15T13:49:54.000Z | 2022-03-31T09:10:30.000Z | dojo/unittests/tools/test_acunetix_parser.py | Hijerboa/django-DefectDojo | 3aea3bc3406f860c0842b0bf8800efe2c86bf81b | [
"BSD-3-Clause"
] | 4 | 2016-09-19T17:33:39.000Z | 2018-12-10T07:55:45.000Z | from django.test import TestCase
from dojo.tools.acunetix.parser import AcunetixParser
from dojo.models import Test
class TestAcunetixParser(TestCase):
def test_parse_without_file(self):
parser = AcunetixParser()
findings = parser.get_findings(None, Test())
self.assertEqual(0, len(findings... | 36.608696 | 74 | 0.712589 | from django.test import TestCase
from dojo.tools.acunetix.parser import AcunetixParser
from dojo.models import Test
class TestAcunetixParser(TestCase):
def test_parse_without_file(self):
parser = AcunetixParser()
findings = parser.get_findings(None, Test())
self.assertEqual(0, len(findings... | true | true |
f71e44f724dfe3403874adb309cf00523e7e6a93 | 29 | py | Python | src/all_models/models/__init__.py | sinnamone/PcaprofilerDjango | 72c704c7011dc979b9a0638f7e948c0328bd20ea | [
"MIT"
] | null | null | null | src/all_models/models/__init__.py | sinnamone/PcaprofilerDjango | 72c704c7011dc979b9a0638f7e948c0328bd20ea | [
"MIT"
] | null | null | null | src/all_models/models/__init__.py | sinnamone/PcaprofilerDjango | 72c704c7011dc979b9a0638f7e948c0328bd20ea | [
"MIT"
] | null | null | null | from .custom_user import User | 29 | 29 | 0.862069 | from .custom_user import User | true | true |
f71e45004f351efc76d9ab4441cdedbda91aec6a | 2,668 | py | Python | opps/images/templatetags/images_tags.py | jeanmask/opps | 031c6136c38d43aa6d1ccb25a94f7bcd65ccbf87 | [
"MIT"
] | 159 | 2015-01-03T16:36:35.000Z | 2022-03-29T20:50:13.000Z | opps/images/templatetags/images_tags.py | jeanmask/opps | 031c6136c38d43aa6d1ccb25a94f7bcd65ccbf87 | [
"MIT"
] | 81 | 2015-01-02T21:26:16.000Z | 2021-05-29T12:24:52.000Z | opps/images/templatetags/images_tags.py | jeanmask/opps | 031c6136c38d43aa6d1ccb25a94f7bcd65ccbf87 | [
"MIT"
] | 75 | 2015-01-23T13:41:03.000Z | 2021-09-24T03:45:23.000Z | # -*- coding: utf-8 -*-
from django import template
from django.template import Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.utils.translation import ugettext as _
from ..generate import image_url as url
register = template.Library()
class AllImagesCheckPermissionForObjectsNode(N... | 28.688172 | 75 | 0.616942 |
from django import template
from django.template import Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.utils.translation import ugettext as _
from ..generate import image_url as url
register = template.Library()
class AllImagesCheckPermissionForObjectsNode(Node):
def __init__(... | true | true |
f71e451920124e5a0a23bd63a7f8d86f5311f631 | 3,319 | py | Python | subset/dot1x/authenticator/eap_socket.py | sicada/faucetsdn-daq | 04967711fc58c3101c2449d09dbc9dcef95df21e | [
"Apache-2.0"
] | 41 | 2018-06-11T06:34:37.000Z | 2022-01-14T18:07:49.000Z | subset/dot1x/authenticator/eap_socket.py | sicada/faucetsdn-daq | 04967711fc58c3101c2449d09dbc9dcef95df21e | [
"Apache-2.0"
] | 843 | 2018-09-03T05:28:16.000Z | 2022-03-22T20:11:20.000Z | subset/dot1x/authenticator/eap_socket.py | grafnu/daq-staging | 47c1015dbfd1a5bbcaa373f6b6d5cf2e53402b4f | [
"Apache-2.0"
] | 33 | 2018-05-22T15:33:57.000Z | 2022-02-15T21:55:56.000Z | """Handle the EAP socket"""
from __future__ import absolute_import
import struct
from abc import ABC, abstractmethod
from fcntl import ioctl
import errno
import socket
from mac_address import MacAddress
from utils import get_logger, get_interface_mac
class PromiscuousSocket(ABC):
"""Abstract Raw Socket in Promi... | 32.539216 | 86 | 0.632419 |
from __future__ import absolute_import
import struct
from abc import ABC, abstractmethod
from fcntl import ioctl
import errno
import socket
from mac_address import MacAddress
from utils import get_logger, get_interface_mac
class PromiscuousSocket(ABC):
SIOCGIFINDEX = 0x8933
PACKET_MR_PROMISC = 1
SOL_PAC... | true | true |
f71e45861229ef6c6f9868dcd6df59532c6cf2a6 | 9,410 | py | Python | liftoff/common/options_parser.py | tudor-berariu/liftoff | 4a0734006fb15c6da5013d437263161d3facf3d8 | [
"MIT"
] | 9 | 2018-04-09T16:41:38.000Z | 2021-09-15T13:53:23.000Z | liftoff/common/options_parser.py | tudor-berariu/liftoff | 4a0734006fb15c6da5013d437263161d3facf3d8 | [
"MIT"
] | 14 | 2018-09-26T11:44:30.000Z | 2021-09-26T07:46:10.000Z | liftoff/common/options_parser.py | tudor-berariu/liftoff | 4a0734006fb15c6da5013d437263161d3facf3d8 | [
"MIT"
] | 2 | 2018-04-23T10:26:00.000Z | 2021-02-24T19:32:07.000Z | """ In order to reuse and have a consistent set of arguments we use the
functions in this file to build argument parsers for all scripts.
TODO: change to class methods to common methods if there is no need to call
those functions outside an instance of OptionParser.
"""
from argparse import ArgumentPa... | 30.063898 | 88 | 0.541339 |
from argparse import ArgumentParser, Namespace
from typing import List
import uuid
from .liftoff_config import LiftoffConfig
class OptionParser:
def __init__(self, name, arguments: List[str]) -> None:
self.liftoff_config = LiftoffConfig()
self.arg_parser = ArgumentParser(name)
self.argu... | true | true |
f71e45e2769e046b231ac437204558ee5ddd0b98 | 2,984 | py | Python | vaas-app/src/vaas/configuration/tests/test_loader.py | allegro/vaas | 3d2d1f1a9dae6ac69a13563a37f9bfdf4f986ae2 | [
"Apache-2.0"
] | 251 | 2015-09-02T10:50:51.000Z | 2022-03-16T08:00:35.000Z | vaas-app/src/vaas/configuration/tests/test_loader.py | allegro/vaas | 3d2d1f1a9dae6ac69a13563a37f9bfdf4f986ae2 | [
"Apache-2.0"
] | 154 | 2015-09-02T14:54:08.000Z | 2022-03-16T08:34:17.000Z | vaas-app/src/vaas/configuration/tests/test_loader.py | allegro/vaas | 3d2d1f1a9dae6ac69a13563a37f9bfdf4f986ae2 | [
"Apache-2.0"
] | 31 | 2015-09-03T07:51:05.000Z | 2020-09-24T09:02:40.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from unittest.mock import patch, mock_open
from nose.tools import assert_equals
from django.test import TestCase
from vaas.configuration.loader import YamlConfigLoader
USER_HOME_PATH = '/user/path/.vaas'
VAAS_APP_RESOURCES_PATH = '/vaas... | 37.772152 | 94 | 0.699397 |
from __future__ import unicode_literals, absolute_import
from unittest.mock import patch, mock_open
from nose.tools import assert_equals
from django.test import TestCase
from vaas.configuration.loader import YamlConfigLoader
USER_HOME_PATH = '/user/path/.vaas'
VAAS_APP_RESOURCES_PATH = '/vaas/app/resources'
class... | true | true |
f71e4676c5acc3e5917505e1ba0ea632737ca9e1 | 1,666 | py | Python | config/wsgi.py | Maharshi-Pathak/gumroad-clone | 97ab1bd71585ee7a4279ad0189980e1b69c31948 | [
"MIT"
] | 11 | 2021-04-22T06:26:42.000Z | 2022-03-27T21:19:57.000Z | config/wsgi.py | Maharshi-Pathak/gumroad-clone | 97ab1bd71585ee7a4279ad0189980e1b69c31948 | [
"MIT"
] | null | null | null | config/wsgi.py | Maharshi-Pathak/gumroad-clone | 97ab1bd71585ee7a4279ad0189980e1b69c31948 | [
"MIT"
] | 6 | 2021-02-10T18:12:27.000Z | 2022-03-14T02:17:38.000Z | """
WSGI config for djgumroad project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`... | 42.717949 | 79 | 0.803121 | import os
import sys
from pathlib import Path
from django.core.wsgi import get_wsgi_application
ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent
sys.path.append(str(ROOT_DIR / "djgumroad"))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
# setting points here.
applic... | true | true |
f71e473268e1bb2e5e8d4a270d302baf99209cad | 196 | py | Python | Python Projects/Find the area of a circle.py | perfect104/python-codes | b8994b1f92f88068c2a36a82e32784b093a8d0df | [
"MIT"
] | 4 | 2019-10-24T03:56:53.000Z | 2020-01-07T08:16:42.000Z | Python Projects/Find the area of a circle.py | perfect104/python-codes | b8994b1f92f88068c2a36a82e32784b093a8d0df | [
"MIT"
] | null | null | null | Python Projects/Find the area of a circle.py | perfect104/python-codes | b8994b1f92f88068c2a36a82e32784b093a8d0df | [
"MIT"
] | 4 | 2019-12-30T08:10:27.000Z | 2020-03-02T05:06:23.000Z | '''
Formula for area of circle
Area = pi * r^2
where pi is constant and r is the radius of the circle
'''
def findarea(r):
PI = 3.142
return PI * (r*r);
print("Area is %.6f" % findarea(5));
| 15.076923 | 55 | 0.627551 | def findarea(r):
PI = 3.142
return PI * (r*r);
print("Area is %.6f" % findarea(5));
| true | true |
f71e48b11e64356393129e207a4d9e71cf25e746 | 45 | py | Python | barrelseq/analysis/__init__.py | BeckResearchLab/barrelseq | 044b9f69f10b4b0413231d821ea80af1c7c31544 | [
"MIT"
] | 1 | 2021-11-27T08:35:15.000Z | 2021-11-27T08:35:15.000Z | barrelseq/analysis/__init__.py | BeckResearchLab/barrelseq | 044b9f69f10b4b0413231d821ea80af1c7c31544 | [
"MIT"
] | 5 | 2018-09-19T21:50:01.000Z | 2019-07-16T22:14:52.000Z | barrelseq/analysis/__init__.py | BeckResearchLab/barrelseq | 044b9f69f10b4b0413231d821ea80af1c7c31544 | [
"MIT"
] | null | null | null | from .deseq2 import *
from .example import *
| 15 | 22 | 0.733333 | from .deseq2 import *
from .example import *
| true | true |
f71e48d15d84ca1874a3d3991f474a16272b83ef | 5,583 | py | Python | GuoxiSuspensionBridge01/GuoxiSuspensionBridge01/StructureSketch.py | zjkl19/AbaqusPython | d9c72d15f8928f1938cee46a4b39e2c44b03b62f | [
"MIT"
] | 16 | 2018-05-06T06:09:52.000Z | 2022-03-29T08:50:00.000Z | GuoxiSuspensionBridge01/GuoxiSuspensionBridge01/StructureSketch.py | zjkl19/AbaqusPython | d9c72d15f8928f1938cee46a4b39e2c44b03b62f | [
"MIT"
] | null | null | null | GuoxiSuspensionBridge01/GuoxiSuspensionBridge01/StructureSketch.py | zjkl19/AbaqusPython | d9c72d15f8928f1938cee46a4b39e2c44b03b62f | [
"MIT"
] | 12 | 2018-04-04T08:32:56.000Z | 2021-08-24T11:34:36.000Z | class StructureSketch(object):
"""Create 'Sketch' of the structure"""
def __init__(self,structureModel,structureGeometry):
"""init
Required argument:
Optional arguments:
None.
Return value:
Exceptions:
None.
"""
self.structureGeomet... | 31.016667 | 153 | 0.587319 | class StructureSketch(object):
def __init__(self,structureModel,structureGeometry):
self.structureGeometry=structureGeometry
self.structureModel=structureModel
def CreateSketch(self):
self.__CreateTowerSketch()
self.__CreateStiffeningGirderSketch()
self.__Cre... | true | true |
f71e48d95b34d49d935b2dc902be37364d27fbf9 | 3,413 | py | Python | marmot/features/source_lm_feature_extractor.py | qe-team/marmot | 38e09ff1d0a3025a6b7edeaaf6086ed047ec45ff | [
"0BSD"
] | 19 | 2015-08-21T13:06:37.000Z | 2021-07-26T09:56:29.000Z | marmot/features/source_lm_feature_extractor.py | qe-team/marmot | 38e09ff1d0a3025a6b7edeaaf6086ed047ec45ff | [
"0BSD"
] | 36 | 2015-01-13T13:01:07.000Z | 2016-06-22T06:59:59.000Z | marmot/features/source_lm_feature_extractor.py | qe-team/marmot | 38e09ff1d0a3025a6b7edeaaf6086ed047ec45ff | [
"0BSD"
] | 8 | 2015-12-11T16:41:47.000Z | 2019-04-08T16:28:40.000Z | import codecs
from subprocess import call
import os
from collections import defaultdict
from marmot.features.feature_extractor import FeatureExtractor
from marmot.util.ngram_window_extractor import left_context, right_context
from marmot.experiment.import_utils import mk_tmp_dir
from marmot.exceptions.no_data_error im... | 41.621951 | 119 | 0.619982 | import codecs
from subprocess import call
import os
from collections import defaultdict
from marmot.features.feature_extractor import FeatureExtractor
from marmot.util.ngram_window_extractor import left_context, right_context
from marmot.experiment.import_utils import mk_tmp_dir
from marmot.exceptions.no_data_error im... | true | true |
f71e495c79f4bb1a1505cad9bdde64d7e37c7ba1 | 1,293 | py | Python | proxy/core/tls/certificate.py | fisabiliyusri/proxy | 29934503251b704813ef3e7ed8c2a5ae69448c8a | [
"BSD-3-Clause"
] | null | null | null | proxy/core/tls/certificate.py | fisabiliyusri/proxy | 29934503251b704813ef3e7ed8c2a5ae69448c8a | [
"BSD-3-Clause"
] | 8 | 2022-01-23T10:51:59.000Z | 2022-03-29T22:11:57.000Z | proxy/core/tls/certificate.py | fisabiliyusri/proxy | 29934503251b704813ef3e7ed8c2a5ae69448c8a | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE... | 23.509091 | 86 | 0.622583 |
from typing import Tuple, Optional
class TlsCertificate:
def __init__(self) -> None:
self.data: Optional[bytes] = None
def parse(self, raw: bytes) -> Tuple[bool, bytes]:
self.data = raw
return True, raw
def build(self) -> bytes:
assert self.data
return self.data... | true | true |
f71e4a16ec710380ca862000c177dc158aa1e97f | 3,879 | py | Python | template_registrator.py | Nepmia/N4-Framework | 84d98f3fe05ca02f938332e5970bca5482ef8ce7 | [
"MIT"
] | null | null | null | template_registrator.py | Nepmia/N4-Framework | 84d98f3fe05ca02f938332e5970bca5482ef8ce7 | [
"MIT"
] | null | null | null | template_registrator.py | Nepmia/N4-Framework | 84d98f3fe05ca02f938332e5970bca5482ef8ce7 | [
"MIT"
] | null | null | null | import os
import app
from termcolor import colored
from write import write
import re
from pathlib import Path
from template_handler import templates_lister
def template_registrator():
"""Get templateRegistrator module path and call template module and exporter functions
"""
module_path = f"{app.MODULE_FOLD... | 34.945946 | 169 | 0.593194 | import os
import app
from termcolor import colored
from write import write
import re
from pathlib import Path
from template_handler import templates_lister
def template_registrator():
module_path = f"{app.MODULE_FOLDER}/TemplateRegistrator/templates.js"
print(
colored("[N4] ", "blue"),
colored(... | true | true |
f71e4ba69c62e1f2c427e125b8d3019de0eb2970 | 28 | py | Python | try.py | zf-nobody/pyaudio_portaudio | 8f703866e6b3d9aad30792fbd07fa63d504505f2 | [
"MIT"
] | null | null | null | try.py | zf-nobody/pyaudio_portaudio | 8f703866e6b3d9aad30792fbd07fa63d504505f2 | [
"MIT"
] | null | null | null | try.py | zf-nobody/pyaudio_portaudio | 8f703866e6b3d9aad30792fbd07fa63d504505f2 | [
"MIT"
] | null | null | null | print("I am having a try.")
| 14 | 27 | 0.642857 | print("I am having a try.")
| true | true |
f71e4c36153dcf173b1175cf8407c1244cc5dba5 | 19,855 | py | Python | isapi_wsgi.py | vbolshakov/isapi-wsgi | 0b3f7c9dbc72b4aa10203abbfa15fc51c2f11386 | [
"MIT"
] | 14 | 2015-03-16T13:39:05.000Z | 2022-03-28T15:26:46.000Z | isapi_wsgi.py | vbolshakov/isapi-wsgi | 0b3f7c9dbc72b4aa10203abbfa15fc51c2f11386 | [
"MIT"
] | 4 | 2015-03-14T03:58:08.000Z | 2019-07-05T12:28:06.000Z | isapi_wsgi.py | vbolshakov/isapi-wsgi | 0b3f7c9dbc72b4aa10203abbfa15fc51c2f11386 | [
"MIT"
] | 6 | 2016-02-16T15:57:53.000Z | 2020-10-05T11:36:38.000Z | """
$Id$
This is a ISAPI extension for a wsgi with 2 handlers classes.
- ISAPISimpleHandler which creates a new IsapiWsgiHandler object for
each request.
- ISAPIThreadPoolHandler where the wsgi requests are run on worker threads
from the thread pool.
Dependecies:
- python 2.2+
... | 35.203901 | 164 | 0.627802 | """
$Id$
This is a ISAPI extension for a wsgi with 2 handlers classes.
- ISAPISimpleHandler which creates a new IsapiWsgiHandler object for
each request.
- ISAPIThreadPoolHandler where the wsgi requests are run on worker threads
from the thread pool.
Dependecies:
- python 2.2+
... | false | true |
f71e4ce28aaa6929ef3046b41295678e3e7ad09e | 2,291 | py | Python | src/backend/apps/chat/views.py | Vixx-X/ati-project | 0ef80772a6fc3807e401cf58b9e15f3628373383 | [
"MIT"
] | null | null | null | src/backend/apps/chat/views.py | Vixx-X/ati-project | 0ef80772a6fc3807e401cf58b9e15f3628373383 | [
"MIT"
] | 61 | 2021-06-10T03:27:06.000Z | 2022-03-12T01:01:34.000Z | src/backend/apps/chat/views.py | Vixx-X/ati-project | 0ef80772a6fc3807e401cf58b9e15f3628373383 | [
"MIT"
] | null | null | null | """
Views for the media module.
"""
import functools
import json
from flask import session
from flask_socketio import disconnect, emit, join_room, leave_room
from flask_user import current_user
from flask_user.decorators import login_required
from backend import socketio
from backend.apps.chat.models import Message
... | 20.096491 | 81 | 0.643824 |
import functools
import json
from flask import session
from flask_socketio import disconnect, emit, join_room, leave_room
from flask_user import current_user
from flask_user.decorators import login_required
from backend import socketio
from backend.apps.chat.models import Message
from backend.utils.views import Deta... | true | true |
f71e4d0c6f7a17183fe5fe1f40071fec474e71ae | 2,532 | py | Python | mlmodels/model_tf/misc/tf_nlp/speech-to-text/1.tacotron/train.py | gitter-badger/mlmodels | f08cc9b6ec202d4ad25ecdda2f44487da387569d | [
"MIT"
] | 1 | 2022-03-11T07:57:48.000Z | 2022-03-11T07:57:48.000Z | mlmodels/model_tf/misc/tf_nlp/speech-to-text/1.tacotron/train.py | whitetiger1002/mlmodels | f70f1da7434e8855eed50adc67b49cc169f2ea24 | [
"MIT"
] | null | null | null | mlmodels/model_tf/misc/tf_nlp/speech-to-text/1.tacotron/train.py | whitetiger1002/mlmodels | f70f1da7434e8855eed50adc67b49cc169f2ea24 | [
"MIT"
] | null | null | null | # coding: utf-8
# In[1]:
import os
import numpy as np
import tensorflow as tf
from tqdm import tqdm
from model import Model
from setting import batch_size, get_cached, idx2char, n_mels, reduction_factor, text2idx
# In[2]:
paths, lengths, texts = [], [], []
text_files = [f for f in os.listdir("spectrogram") if f... | 29.103448 | 100 | 0.617299 |
import os
import numpy as np
import tensorflow as tf
from tqdm import tqdm
from model import Model
from setting import batch_size, get_cached, idx2char, n_mels, reduction_factor, text2idx
paths, lengths, texts = [], [], []
text_files = [f for f in os.listdir("spectrogram") if f.endswith(".npy")]
for fpath in... | true | true |
f71e4d6dbc4f9dd0c1e78dea1d539666e3d83bf0 | 846 | py | Python | sumo/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/GenerateTaxiRoutesMain.py | iltempe/osmosi | c0f54ecdbb7c7b5602d587768617d0dc50f1d75d | [
"MIT"
] | null | null | null | sumo/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/GenerateTaxiRoutesMain.py | iltempe/osmosi | c0f54ecdbb7c7b5602d587768617d0dc50f1d75d | [
"MIT"
] | null | null | null | sumo/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/GenerateTaxiRoutesMain.py | iltempe/osmosi | c0f54ecdbb7c7b5602d587768617d0dc50f1d75d | [
"MIT"
] | 2 | 2017-12-14T16:41:59.000Z | 2020-10-16T17:51:27.000Z | #!/usr/bin/env python
# -*- coding: Latin-1 -*-
"""
@file GenerateTaxiRoutesMain.py
@author Sascha Krieg
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2008-04-17
@version $Id$
Main of GenerateTaxiRoutes.
SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
Copyright (C) 2008-2017 DLR (http:... | 23.5 | 68 | 0.737589 |
from __future__ import absolute_import
from __future__ import print_function
from .GenerateTaxiRoutes import *
def main():
print("start program")
readFCD()
writeRoutes()
print("end")
main()
| true | true |
f71e4e1ab1212fcc12550d50d95595bbcbba1151 | 22,970 | py | Python | saleor/plugins/avatax/plugin.py | batout/saleor | 29830d2a3195c2d83d0a2b0dfdc48ebc18d26dbc | [
"CC-BY-4.0"
] | 1 | 2022-02-19T13:27:40.000Z | 2022-02-19T13:27:40.000Z | saleor/plugins/avatax/plugin.py | autobotasia/saleor | e03e9f6ab1bddac308a6609d6b576a87e90ae655 | [
"CC-BY-4.0"
] | null | null | null | saleor/plugins/avatax/plugin.py | autobotasia/saleor | e03e9f6ab1bddac308a6609d6b576a87e90ae655 | [
"CC-BY-4.0"
] | 2 | 2021-12-03T16:59:37.000Z | 2022-02-19T13:05:42.000Z | import logging
from dataclasses import asdict
from decimal import Decimal
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Union
from urllib.parse import urljoin
import opentracing
import opentracing.tags
from django.core.exceptions import ValidationError
from prices import Money, TaxedMoney, Tax... | 36.402536 | 100 | 0.623291 | import logging
from dataclasses import asdict
from decimal import Decimal
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Union
from urllib.parse import urljoin
import opentracing
import opentracing.tags
from django.core.exceptions import ValidationError
from prices import Money, TaxedMoney, Tax... | true | true |
f71e4eb8f2d77ec51105db33c6cf3421c481bf57 | 2,194 | py | Python | utils.py | uhh-lt/semeval2019-hhmm | b746b0fb8ab3b957d399276cb354e950f0ef30ed | [
"Apache-2.0"
] | null | null | null | utils.py | uhh-lt/semeval2019-hhmm | b746b0fb8ab3b957d399276cb354e950f0ef30ed | [
"Apache-2.0"
] | null | null | null | utils.py | uhh-lt/semeval2019-hhmm | b746b0fb8ab3b957d399276cb354e950f0ef30ed | [
"Apache-2.0"
] | null | null | null | import pandas as pd
from pathlib import Path
def df_to_csv(df, path):
df.to_csv(path, sep='\t', index=False, encoding='utf-8')
def csv_to_df(path):
df = pd.read_csv(path, sep='\t', dtype=str, encoding='utf-8')
return df
def max_arguments(task):
fp = open(task, 'r')
lines_args = fp.readlines()
... | 29.648649 | 114 | 0.611668 | import pandas as pd
from pathlib import Path
def df_to_csv(df, path):
df.to_csv(path, sep='\t', index=False, encoding='utf-8')
def csv_to_df(path):
df = pd.read_csv(path, sep='\t', dtype=str, encoding='utf-8')
return df
def max_arguments(task):
fp = open(task, 'r')
lines_args = fp.readlines()
... | true | true |
f71e4ebc41a1f3a94f4f8f73cf4f5d5320ba4866 | 7,375 | py | Python | activemri/experimental/cvpr19_models/data/masking_utils.py | qinliuliuqin/active-mri-acquisition | b561f838667f4bc7753b1f89dfbdd545d0f00ada | [
"MIT"
] | 32 | 2020-10-05T19:46:56.000Z | 2022-02-15T10:37:13.000Z | activemri/experimental/cvpr19_models/data/masking_utils.py | qinliuliuqin/active-mri-acquisition | b561f838667f4bc7753b1f89dfbdd545d0f00ada | [
"MIT"
] | 2 | 2020-12-28T21:05:57.000Z | 2022-01-22T17:56:50.000Z | activemri/experimental/cvpr19_models/data/masking_utils.py | qinliuliuqin/active-mri-acquisition | b561f838667f4bc7753b1f89dfbdd545d0f00ada | [
"MIT"
] | 9 | 2020-11-22T18:15:04.000Z | 2022-02-11T06:07:38.000Z | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import numpy as np
import torch
def get_mask_func(mask_type, which_dataset, rnl_params=None):
# Whether the number of lin... | 35.456731 | 89 | 0.608949 |
import logging
import numpy as np
import torch
def get_mask_func(mask_type, which_dataset, rnl_params=None):
random_num_lines = mask_type[-4:] == "_rnl"
if "symmetric_basic" in mask_type:
logging.info(
f"Mask is symmetric uniform choice with random_num_lines={random_num_lines}."... | true | true |
f71e53cc65fda9fdbec30eb8bdaa1bf278ded2d8 | 602 | py | Python | Company_Based_Questions/Extras/Sum_of_bit_differences.py | Satyam-Bhalla/Competitive-Coding | 5814f5f60572f1e76495efe751b94bf4d2845198 | [
"MIT"
] | 1 | 2021-12-09T10:36:48.000Z | 2021-12-09T10:36:48.000Z | Company_Based_Questions/Extras/Sum_of_bit_differences.py | Satyam-Bhalla/Competitive-Coding | 5814f5f60572f1e76495efe751b94bf4d2845198 | [
"MIT"
] | null | null | null | Company_Based_Questions/Extras/Sum_of_bit_differences.py | Satyam-Bhalla/Competitive-Coding | 5814f5f60572f1e76495efe751b94bf4d2845198 | [
"MIT"
] | null | null | null | t = int(input())
# Python program to compute sum of pairwise bit differences
def sumBitDifferences(arr,n):
ans = 0 # Initialize result
# traverse over all bits
for i in range(0, 32):
# count number of elements with i'th bit set
count = 0
for j in range(0,n):
if... | 26.173913 | 59 | 0.528239 | t = int(input())
def sumBitDifferences(arr,n):
ans = 0
for i in range(0, 32):
count = 0
for j in range(0,n):
if ( (arr[j] & (1 << i)) ):
count+=1
# Add "count * (n - count) * 2" to the answer
ans += (count * (n - count) * 2... | true | true |
f71e53e205f5ac04b5c06e079190727d551ec4a4 | 11,777 | py | Python | src/engine/SCons/SConsignTests.py | andrewyoung1991/scons | 7517c277e23bc04e3809a9bf0793cdfe00097a58 | [
"MIT"
] | null | null | null | src/engine/SCons/SConsignTests.py | andrewyoung1991/scons | 7517c277e23bc04e3809a9bf0793cdfe00097a58 | [
"MIT"
] | null | null | null | src/engine/SCons/SConsignTests.py | andrewyoung1991/scons | 7517c277e23bc04e3809a9bf0793cdfe00097a58 | [
"MIT"
] | null | null | null | #
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicen... | 29.516291 | 81 | 0.585888 |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import sys
import unittest
import TestCmd
import TestUnit
import SCons.dblite
import SCons.SConsign
class BuildInfo(object):
def merge(self, object):
pass
class DummySConsignEntry(object):
def __init__(s... | true | true |
f71e5460155bd9f16fa19e166afd300b1c1a08f8 | 1,469 | py | Python | setup.py | inducer/pyfft | 3780b30aebcd2c056f8c6bdd2ad7572e04d6b886 | [
"AML"
] | 1 | 2016-08-26T07:12:54.000Z | 2016-08-26T07:12:54.000Z | setup.py | inducer/pyfft | 3780b30aebcd2c056f8c6bdd2ad7572e04d6b886 | [
"AML"
] | null | null | null | setup.py | inducer/pyfft | 3780b30aebcd2c056f8c6bdd2ad7572e04d6b886 | [
"AML"
] | null | null | null | import sys
major, minor, micro, releaselevel, serial = sys.version_info
if not (major == 2 and minor >= 5):
print("Python >=2.5 is required to use this module.")
sys.exit(1)
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import os.path
import logging
setup_dir = os.p... | 27.716981 | 85 | 0.704561 | import sys
major, minor, micro, releaselevel, serial = sys.version_info
if not (major == 2 and minor >= 5):
print("Python >=2.5 is required to use this module.")
sys.exit(1)
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import os.path
import logging
setup_dir = os.p... | true | true |
f71e5477d9830202d03e82ec5b932891a0558a54 | 22,305 | py | Python | test/functional/test_framework/util.py | Guinea1/AnotherScryptCoin | 58bae163e23da7468a9854073231a512a4d037ee | [
"MIT"
] | null | null | null | test/functional/test_framework/util.py | Guinea1/AnotherScryptCoin | 58bae163e23da7468a9854073231a512a4d037ee | [
"MIT"
] | 2 | 2021-01-14T16:29:02.000Z | 2022-03-03T22:55:41.000Z | test/functional/test_framework/util.py | Guinea1/AnotherScryptCoin | 58bae163e23da7468a9854073231a512a4d037ee | [
"MIT"
] | 1 | 2022-01-09T08:44:40.000Z | 2022-01-09T08:44:40.000Z | #!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Helpful routines for regression testing."""
from base64 import b64encode
from binascii import hexlify,... | 38.926702 | 140 | 0.652589 |
from base64 import b64encode
from binascii import hexlify, unhexlify
from decimal import Decimal, ROUND_DOWN
import hashlib
import inspect
import json
import logging
import os
import random
import re
from subprocess import CalledProcessError
import time
from . import coverage
from .authproxy import AuthServicePro... | true | true |
f71e55cfd055438d6c39116f56d41f4f94768b6f | 75,527 | py | Python | models/networks.py | izhorvath/MetGAN | aca85fb3306d2515a65c8d525cd78e1147ba7e1b | [
"BSD-3-Clause"
] | null | null | null | models/networks.py | izhorvath/MetGAN | aca85fb3306d2515a65c8d525cd78e1147ba7e1b | [
"BSD-3-Clause"
] | null | null | null | models/networks.py | izhorvath/MetGAN | aca85fb3306d2515a65c8d525cd78e1147ba7e1b | [
"BSD-3-Clause"
] | null | null | null | import torch
import torch.nn as nn
from torch.nn import init
import functools
from torch.optim import lr_scheduler
from math import floor, log2
from functools import partial
from linear_attention_transformer import ImageLinearAttention
###
from random import random
import numpy as np
import torch.nn.functional as F... | 41.959444 | 215 | 0.600421 | import torch
import torch.nn as nn
from torch.nn import init
import functools
from torch.optim import lr_scheduler
from math import floor, log2
from functools import partial
from linear_attention_transformer import ImageLinearAttention
rom random import random
import numpy as np
import torch.nn.functional as F
rom... | true | true |
f71e55d3cf3aa4932ba68a34b333db3adb118d95 | 3,235 | py | Python | tests/unittests/test_extension.py | kontur/psautohint | 69bab0df4eac8c4a88d9ac4dce94c2d6c61aba99 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | tests/unittests/test_extension.py | kontur/psautohint | 69bab0df4eac8c4a88d9ac4dce94c2d6c61aba99 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | tests/unittests/test_extension.py | kontur/psautohint | 69bab0df4eac8c4a88d9ac4dce94c2d6c61aba99 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | import pytest
from psautohint import _psautohint
INFO = b"FontName Foo"
NAME = b"Foo"
GLYPH = b"""% square
0 500 rb
60 500 ry
sc
560 500 mt
560 0 dt
60 0 dt
60 500 dt
cp
ed
"""
def test_autohint_good_args():
_psautohint.autohint(INFO, GLYPH)
def test_autohintmm_good_args():
_psautohint.autohintmm((GLYPH,... | 29.953704 | 74 | 0.605255 | import pytest
from psautohint import _psautohint
INFO = b"FontName Foo"
NAME = b"Foo"
GLYPH = b"""% square
0 500 rb
60 500 ry
sc
560 500 mt
560 0 dt
60 0 dt
60 500 dt
cp
ed
"""
def test_autohint_good_args():
_psautohint.autohint(INFO, GLYPH)
def test_autohintmm_good_args():
_psautohint.autohintmm((GLYPH,... | true | true |
f71e55d60e509a916cc25b65b45816137179e94a | 1,085 | py | Python | MNIST_convert.py | actionLUO/mnist_handwriting | fa8958417960978fa6230085950dc75e36697fdc | [
"Apache-2.0"
] | 1 | 2019-01-03T06:50:49.000Z | 2019-01-03T06:50:49.000Z | MNIST_convert.py | actionLUO/mnist_handwriting | fa8958417960978fa6230085950dc75e36697fdc | [
"Apache-2.0"
] | null | null | null | MNIST_convert.py | actionLUO/mnist_handwriting | fa8958417960978fa6230085950dc75e36697fdc | [
"Apache-2.0"
] | null | null | null | """
Created by Jacky LUO
Using python3.5
Reference: https://pjreddie.com/projects/mnist-in-csv
"""
def convert_mnist_csv(img_file, label_file, output_file, n):
imgf = open(img_file, 'rb')
labelf = open(label_file, 'rb')
outputf = open(output_file, 'w')
imgf.read(16)
labelf.read(8)
images = []... | 21.7 | 69 | 0.560369 |
def convert_mnist_csv(img_file, label_file, output_file, n):
imgf = open(img_file, 'rb')
labelf = open(label_file, 'rb')
outputf = open(output_file, 'w')
imgf.read(16)
labelf.read(8)
images = []
for i in range(n):
image = [ord(labelf.read(1))]
for j in range(28 * 28):
... | true | true |
f71e566e04bc0d00ac8b0de8f6db0abb216cd3ab | 71,850 | py | Python | sdks/python/apache_beam/runners/dataflow/dataflow_runner.py | stephenoken/beam | 4797f310b6671de6fd703502520f4b012b655c82 | [
"Apache-2.0"
] | 1 | 2020-05-29T12:37:18.000Z | 2020-05-29T12:37:18.000Z | sdks/python/apache_beam/runners/dataflow/dataflow_runner.py | stephenoken/beam | 4797f310b6671de6fd703502520f4b012b655c82 | [
"Apache-2.0"
] | null | null | null | sdks/python/apache_beam/runners/dataflow/dataflow_runner.py | stephenoken/beam | 4797f310b6671de6fd703502520f4b012b655c82 | [
"Apache-2.0"
] | null | null | null | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 42.691622 | 95 | 0.708281 |
from __future__ import absolute_import
from __future__ import division
import base64
import json
import logging
import os
import subprocess
import sys
import threading
import time
import traceback
import urllib
from builtins import hex
from collections import defaultdict
from typing import TYPE_CHEC... | true | true |
f71e568dd0e667d488a561c5ed72e8b96933814c | 507 | py | Python | setup.py | thejohnfreeman/picard | 09b39d6655e1df071ea9f3f63eaf35ddbd2f0e0f | [
"MIT"
] | 3 | 2018-12-28T03:14:49.000Z | 2019-05-24T21:05:13.000Z | setup.py | thejohnfreeman/picard | 09b39d6655e1df071ea9f3f63eaf35ddbd2f0e0f | [
"MIT"
] | null | null | null | setup.py | thejohnfreeman/picard | 09b39d6655e1df071ea9f3f63eaf35ddbd2f0e0f | [
"MIT"
] | null | null | null | # WARNING: DO NOT USE THIS.
# This setup.py exists only to satisfy Read the Docs until they can support
# pyproject.toml (PEP 517):
# https://github.com/rtfd/readthedocs.org/issues/4912#issuecomment-444198329
# https://github.com/pypa/pip/pull/5743
from setuptools import setup
setup(
name='picard',
version='0.1... | 28.166667 | 76 | 0.637081 |
t setup
setup(
name='picard',
version='0.1.3',
packages=['picard'],
install_requires=[
'boto3>=1.9,<1.10',
'tabulate>=0.8,<0.9',
'toml>=0.10,<0.11',
'typing_extensions>=3.6,<3.7',
],
)
| true | true |
f71e58148d9d1a173dc56feacc564d5b197c059c | 2,488 | py | Python | httpstream/numbers.py | technige/httpstream | 8be13f52fc4f031dfed281963f4313c3c9b4729a | [
"Apache-2.0"
] | 2 | 2017-09-21T10:41:17.000Z | 2019-06-27T13:23:11.000Z | httpstream/numbers.py | technige/httpstream | 8be13f52fc4f031dfed281963f4313c3c9b4729a | [
"Apache-2.0"
] | null | null | null | httpstream/numbers.py | technige/httpstream | 8be13f52fc4f031dfed281963f4313c3c9b4729a | [
"Apache-2.0"
] | 1 | 2019-02-18T13:57:22.000Z | 2019-02-18T13:57:22.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012-2015, Nigel Small
#
# 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... | 24.88 | 74 | 0.791801 |
HTTP_PORT = 80
HTTPS_PORT = 443
CONTINUE = 100
SWITCHING_PROTOCOLS = 101
PROCESSING = 102
OK = 200
CREATED = 201
ACCEPTED = 202
NON_AUTHORITATIVE_INFORMATION = 203
NO_CONTENT = 204
RESET_CONTENT = 205
PARTIAL_CONTENT = 206
MULTI_STATUS = 207
ALREADY_REPORTED = 208
IM_USED = 226
MULTIPLE_... | true | true |
f71e5834283c296de8eb47d6ad42b9957168b32a | 2,078 | py | Python | carga_contadores.py | robzoros/tienda_online | 86fa8533f068559e845f867330ad2ba24a2d3601 | [
"MIT"
] | null | null | null | carga_contadores.py | robzoros/tienda_online | 86fa8533f068559e845f867330ad2ba24a2d3601 | [
"MIT"
] | null | null | null | carga_contadores.py | robzoros/tienda_online | 86fa8533f068559e845f867330ad2ba24a2d3601 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from cassandra.cluster import Cluster
# Conectamos al Cluster
cluster = Cluster()
session = cluster.connect('tienda_online')
#******************************************************
# CONTADORES
#******************************************************
# Cargamos l... | 53.282051 | 163 | 0.674687 |
from cassandra.cluster import Cluster
cluster = Cluster()
session = cluster.connect('tienda_online')
session.execute("TRUNCATE productos_mas_vendidos")
session.execute("TRUNCATE productos_vendidos_juntos")
result = session.execute('SELECT * FROM contador_productos_vendidos')
productos_vendidos = sorted(result... | true | true |
f71e58d321e14ad0e343e03cdeed51884bcfe901 | 5,207 | py | Python | official/core/base_trainer_test.py | xxia-kathy/models | 157faae1af5d89c53a5699b601dc68fee274ef09 | [
"Apache-2.0"
] | 1 | 2021-02-22T13:05:55.000Z | 2021-02-22T13:05:55.000Z | official/core/base_trainer_test.py | xxia-kathy/models | 157faae1af5d89c53a5699b601dc68fee274ef09 | [
"Apache-2.0"
] | null | null | null | official/core/base_trainer_test.py | xxia-kathy/models | 157faae1af5d89c53a5699b601dc68fee274ef09 | [
"Apache-2.0"
] | 3 | 2021-02-22T13:24:07.000Z | 2021-02-26T02:06:24.000Z | # Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | 37.460432 | 80 | 0.668907 |
import os
from absl.testing import parameterized
import tensorflow as tf
from tensorflow.python.distribute import combinations
from tensorflow.python.distribute import strategy_combinations
from official.core import base_trainer as trainer_lib
from official.core import train_lib
from official.modeling... | true | true |
f71e591c2ff6a50a381fad44e154010bbb850217 | 7,849 | py | Python | tools/mo/openvino/tools/mo/middle/passes/convert_data_type.py | pazamelin/openvino | b7e8ef910d7ed8e52326d14dc6fd53b71d16ed48 | [
"Apache-2.0"
] | 1 | 2019-09-22T01:05:07.000Z | 2019-09-22T01:05:07.000Z | tools/mo/openvino/tools/mo/middle/passes/convert_data_type.py | pazamelin/openvino | b7e8ef910d7ed8e52326d14dc6fd53b71d16ed48 | [
"Apache-2.0"
] | 58 | 2020-11-06T12:13:45.000Z | 2022-03-28T13:20:11.000Z | tools/mo/openvino/tools/mo/middle/passes/convert_data_type.py | pazamelin/openvino | b7e8ef910d7ed8e52326d14dc6fd53b71d16ed48 | [
"Apache-2.0"
] | 2 | 2021-07-14T07:40:50.000Z | 2021-07-27T01:40:03.000Z | # Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging as log
import numpy as np
from openvino.tools.mo.front.extractor import get_new_placeholder_name
from openvino.tools.mo.graph.graph import Node, Graph
from openvino.tools.mo.utils.error import Error
from openvino.tools.m... | 42.89071 | 122 | 0.659829 |
import logging as log
import numpy as np
from openvino.tools.mo.front.extractor import get_new_placeholder_name
from openvino.tools.mo.graph.graph import Node, Graph
from openvino.tools.mo.utils.error import Error
from openvino.tools.mo.utils.utils import refer_to_faq_msg
class packed_U1(np.generic):
pas... | true | true |
f71e59893a5ea3504751b1c52828d7f9e9fbe96e | 3,718 | py | Python | python/lib/packet/path_mgmt/rev_info.py | stschwar/scion | f15933081b4947ed46a032d34e9b9c563f2989c4 | [
"Apache-2.0"
] | null | null | null | python/lib/packet/path_mgmt/rev_info.py | stschwar/scion | f15933081b4947ed46a032d34e9b9c563f2989c4 | [
"Apache-2.0"
] | null | null | null | python/lib/packet/path_mgmt/rev_info.py | stschwar/scion | f15933081b4947ed46a032d34e9b9c563f2989c4 | [
"Apache-2.0"
] | null | null | null | # Copyright 2015 ETH Zurich
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | 37.18 | 84 | 0.649274 |
import logging
import capnp
import proto.rev_info_capnp as P
from lib.defines import HASHTREE_EPOCH_TIME
from lib.errors import SCIONBaseError
from lib.packet.packet_base import Cerealizable
from lib.packet.scion_addr import ISD_AS
class RevInfoValidationError(SCIONBaseError):
class RevocationInf... | true | true |
f71e5c0ef766848ef073a7722f2396d351009ea4 | 11,159 | py | Python | lib/models.py | prkriley/neurips2019_intrus | 3e36930246347e6b80a583d2ab378054ea3b9f7a | [
"MIT"
] | 18 | 2019-11-04T06:43:47.000Z | 2021-10-04T15:02:52.000Z | lib/models.py | prkriley/neurips2019_intrus | 3e36930246347e6b80a583d2ab378054ea3b9f7a | [
"MIT"
] | 9 | 2019-11-25T06:35:20.000Z | 2022-02-09T23:32:20.000Z | lib/models.py | prkriley/neurips2019_intrus | 3e36930246347e6b80a583d2ab378054ea3b9f7a | [
"MIT"
] | 5 | 2020-01-24T09:12:58.000Z | 2021-10-04T20:14:11.000Z | """
Transformer encoder / decoder layer chain
"""
import numpy as np
import tensorflow as tf
import lib.layers
from . import layers, ops
from .data import linelen
class Transformer:
def __init__(
self, name, inp_voc, out_voc,
logits_bias=False, share_emb=False, dst_rand_offset=False,
... | 45.546939 | 120 | 0.595663 | import numpy as np
import tensorflow as tf
import lib.layers
from . import layers, ops
from .data import linelen
class Transformer:
def __init__(
self, name, inp_voc, out_voc,
logits_bias=False, share_emb=False, dst_rand_offset=False,
rescale_emb=True, inp_emb_bias=False, emb... | true | true |
f71e5cd99b7d4e33658c397072d56eb1f5d3bd35 | 11,969 | py | Python | desktop/core/ext-py/Django/django/db/backends/mysql/base.py | civascu/hue | 82f2de44789ff5a981ed725175bae7944832d1e9 | [
"Apache-2.0"
] | 2 | 2021-04-27T03:57:00.000Z | 2021-06-18T09:39:58.000Z | django/db/backends/mysql/base.py | joetyson/django | c3699190186561d5c216b2a77ecbfc487d42a734 | [
"BSD-3-Clause"
] | null | null | null | django/db/backends/mysql/base.py | joetyson/django | c3699190186561d5c216b2a77ecbfc487d42a734 | [
"BSD-3-Clause"
] | 2 | 2021-09-06T18:44:45.000Z | 2022-02-24T04:10:10.000Z | """
MySQL database backend for Django.
Requires MySQLdb: http://sourceforge.net/projects/mysql-python
"""
import re
try:
import MySQLdb as Database
except ImportError, e:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
# We want ... | 39.50165 | 127 | 0.636728 | """
MySQL database backend for Django.
Requires MySQLdb: http://sourceforge.net/projects/mysql-python
"""
import re
try:
import MySQLdb as Database
except ImportError, e:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
# lexicog... | false | true |
f71e5cfe3706fc69791aed22bc1afc781220530b | 14,652 | py | Python | test/torch/pointers/test_pointer_tensor.py | Prtfw/PySyft | 82eede90acf09f26de389237524897e2b142f9ff | [
"Apache-2.0"
] | 1 | 2020-04-11T06:46:49.000Z | 2020-04-11T06:46:49.000Z | test/torch/pointers/test_pointer_tensor.py | haofanwang/PySyft | 653d31001dbc0c611d486c6c5543fce0abf9b27d | [
"Apache-2.0"
] | 1 | 2020-04-07T13:36:44.000Z | 2020-04-07T13:36:44.000Z | test/torch/pointers/test_pointer_tensor.py | JMBehnken/PySyft | 35012f5bf55628bb19761d5f40d03181fbbb1766 | [
"Apache-2.0"
] | 1 | 2020-03-11T09:52:47.000Z | 2020-03-11T09:52:47.000Z | import torch
import torch as th
import syft
from syft.frameworks.torch.tensors.interpreters.additive_shared import AdditiveSharingTensor
from syft.frameworks.torch.tensors.interpreters.precision import FixedPrecisionTensor
from syft.generic.pointers.pointer_tensor import PointerTensor
import pytest
def test_init(wor... | 26.305206 | 93 | 0.648034 | import torch
import torch as th
import syft
from syft.frameworks.torch.tensors.interpreters.additive_shared import AdditiveSharingTensor
from syft.frameworks.torch.tensors.interpreters.precision import FixedPrecisionTensor
from syft.generic.pointers.pointer_tensor import PointerTensor
import pytest
def test_init(wor... | true | true |
f71e5df787aa25c35b48b6c65a4730286ccce326 | 3,762 | py | Python | python/paddle/fluid/tests/unittests/ir/inference/auto_scan_test.py | MissPenguin/Paddle | 70a9b6522bdbd8ce36be763d8c2866fc8095f1b9 | [
"Apache-2.0"
] | 1 | 2021-09-06T15:52:29.000Z | 2021-09-06T15:52:29.000Z | python/paddle/fluid/tests/unittests/ir/inference/auto_scan_test.py | glisca/Paddle | 266fcbe0aed3e566c167ea8de5114f62c428c013 | [
"Apache-2.0"
] | null | null | null | python/paddle/fluid/tests/unittests/ir/inference/auto_scan_test.py | glisca/Paddle | 266fcbe0aed3e566c167ea8de5114f62c428c013 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 35.490566 | 103 | 0.661882 |
import numpy as np
import unittest
import abc
import os
import enum
import logging
import paddle
import paddle.fluid as fluid
from paddle.fluid.initializer import NumpyArrayInitializer
import paddle.fluid.core as core
from paddle import compat as cpt
import paddle.inference as paddle_infer
from typing imp... | true | true |
f71e5df90847f1507f8858e74f83696283613d19 | 52,912 | py | Python | snakemake/io.py | nikostr/snakemake | 99d2517b3456771574c26a40da0cff0e611ad99a | [
"MIT"
] | null | null | null | snakemake/io.py | nikostr/snakemake | 99d2517b3456771574c26a40da0cff0e611ad99a | [
"MIT"
] | null | null | null | snakemake/io.py | nikostr/snakemake | 99d2517b3456771574c26a40da0cff0e611ad99a | [
"MIT"
] | null | null | null | __author__ = "Johannes Köster"
__copyright__ = "Copyright 2021, Johannes Köster"
__email__ = "johannes.koester@uni-due.de"
__license__ = "MIT"
import collections
import os
import shutil
from pathlib import Path
import re
import stat
import time
import datetime
import json
import copy
import functools
import subprocess... | 31.951691 | 124 | 0.584933 | __author__ = "Johannes Köster"
__copyright__ = "Copyright 2021, Johannes Köster"
__email__ = "johannes.koester@uni-due.de"
__license__ = "MIT"
import collections
import os
import shutil
from pathlib import Path
import re
import stat
import time
import datetime
import json
import copy
import functools
import subprocess... | true | true |
f71e5ea1ec662b1ee9b1d78de3fc6bfa709dc4fd | 2,100 | py | Python | src/compas_plotters/artists/pointartist.py | funkchaser/compas | b58de8771484aa0c6068d43df78b1679503215de | [
"MIT"
] | 235 | 2017-11-07T07:33:22.000Z | 2022-03-25T16:20:00.000Z | src/compas_plotters/artists/pointartist.py | funkchaser/compas | b58de8771484aa0c6068d43df78b1679503215de | [
"MIT"
] | 770 | 2017-09-22T13:42:06.000Z | 2022-03-31T21:26:45.000Z | src/compas_plotters/artists/pointartist.py | funkchaser/compas | b58de8771484aa0c6068d43df78b1679503215de | [
"MIT"
] | 99 | 2017-11-06T23:15:28.000Z | 2022-03-25T16:05:36.000Z | from typing import Tuple
from typing import List
from typing import Any
from matplotlib.patches import Circle
from matplotlib.transforms import ScaledTranslation
from compas.geometry import Point
from compas.artists import PrimitiveArtist
from .artist import PlotterArtist
Color = Tuple[float, float, float]
class P... | 26.25 | 88 | 0.601905 | from typing import Tuple
from typing import List
from typing import Any
from matplotlib.patches import Circle
from matplotlib.transforms import ScaledTranslation
from compas.geometry import Point
from compas.artists import PrimitiveArtist
from .artist import PlotterArtist
Color = Tuple[float, float, float]
class P... | true | true |
f71e5fdeb867d750cbfc67468c01f5b8fc81fd15 | 9,510 | py | Python | modules/s3/s3fields.py | apocsantos/eden | 8b71af6b4dc72e2c4d656dbe1bb3943426705422 | [
"MIT"
] | 1 | 2017-03-15T23:29:41.000Z | 2017-03-15T23:29:41.000Z | modules/s3/s3fields.py | apocsantos/eden | 8b71af6b4dc72e2c4d656dbe1bb3943426705422 | [
"MIT"
] | null | null | null | modules/s3/s3fields.py | apocsantos/eden | 8b71af6b4dc72e2c4d656dbe1bb3943426705422 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
S3 Extensions for gluon.dal.Field, reusable fields
@requires: U{B{I{gluon}} <http://web2py.com>}
@author: Dominic König <dominic[at]aidiq.com>
@copyright: 2009-2012 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any ... | 33.020833 | 93 | 0.465089 |
"""
S3 Extensions for gluon.dal.Field, reusable fields
@requires: U{B{I{gluon}} <http://web2py.com>}
@author: Dominic König <dominic[at]aidiq.com>
@copyright: 2009-2012 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a ... | false | true |
f71e5fe49a6e3ab2639977a6bb855247cd56baa2 | 5,565 | py | Python | train/exp_configs/rl/singleagent/test-stl-nw-profit-mid.py | mepear/flow | 4fc6ceaf64ca522b5a5c4104a3098b20cf207dd4 | [
"MIT"
] | 1 | 2021-03-05T07:39:51.000Z | 2021-03-05T07:39:51.000Z | train/exp_configs/rl/singleagent/test-stl-nw-profit-mid.py | mepear/flow | 4fc6ceaf64ca522b5a5c4104a3098b20cf207dd4 | [
"MIT"
] | 1 | 2021-09-13T02:16:02.000Z | 2021-09-13T02:16:02.000Z | train/exp_configs/rl/singleagent/test-stl-nw-profit-mid.py | mepear/flow | 4fc6ceaf64ca522b5a5c4104a3098b20cf207dd4 | [
"MIT"
] | 1 | 2021-08-21T13:58:30.000Z | 2021-08-21T13:58:30.000Z | """Grid example."""
from flow.controllers import GridRouter, IDMController, RLController
from flow.controllers.routing_controllers import MinicityRouter
from flow.core.params import SumoParams, EnvParams, InitialConfig, NetParams
from flow.core.params import VehicleParams, PersonParams
from flow.core.params import Traf... | 29.919355 | 119 | 0.709793 | from flow.controllers import GridRouter, IDMController, RLController
from flow.controllers.routing_controllers import MinicityRouter
from flow.core.params import SumoParams, EnvParams, InitialConfig, NetParams
from flow.core.params import VehicleParams, PersonParams
from flow.core.params import TrafficLightParams
from ... | true | true |
f71e607e4f8c3f3efd904c8c5129e23baa35a350 | 9,240 | py | Python | source/setup.py | asaranprasad/nvda | e9609694acbfb06398eb6552067a0dcd532d67af | [
"bzip2-1.0.6"
] | 2 | 2020-08-24T17:41:45.000Z | 2020-08-25T16:48:52.000Z | source/setup.py | asaranprasad/nvda | e9609694acbfb06398eb6552067a0dcd532d67af | [
"bzip2-1.0.6"
] | 3 | 2017-09-29T17:14:18.000Z | 2019-05-20T16:13:39.000Z | source/setup.py | asaranprasad/nvda | e9609694acbfb06398eb6552067a0dcd532d67af | [
"bzip2-1.0.6"
] | 1 | 2017-09-29T08:53:52.000Z | 2017-09-29T08:53:52.000Z | # -*- coding: UTF-8 -*-
#setup.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2006-2018 NV Access Limited, Peter Vágner, Joseph Lee
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
import os
import copy
import gettext
gettext.install("nvda", unico... | 38.987342 | 231 | 0.695238 |
import os
import copy
import gettext
gettext.install("nvda", unicode=True)
from distutils.core import setup
import py2exe as py2exeModule
from glob import glob
import fnmatch
from versionInfo import *
from py2exe import build_exe
import wx
import imp
MAIN_MANIFEST_EXTRA = r"""
<file name="braille... | true | true |
f71e607e7707662acad32327b1147a6236003db1 | 14,288 | py | Python | api/resources/v2/containers.py | mythwm/yardstick | ea13581f450c9c44f6f73d383e6a192697a95cc1 | [
"Apache-2.0"
] | 28 | 2017-02-07T07:46:42.000Z | 2021-06-30T08:11:06.000Z | api/resources/v2/containers.py | mythwm/yardstick | ea13581f450c9c44f6f73d383e6a192697a95cc1 | [
"Apache-2.0"
] | 6 | 2018-01-18T08:00:54.000Z | 2019-04-11T04:51:41.000Z | api/resources/v2/containers.py | mythwm/yardstick | ea13581f450c9c44f6f73d383e6a192697a95cc1 | [
"Apache-2.0"
] | 46 | 2016-12-13T10:05:47.000Z | 2021-02-18T07:33:06.000Z | ##############################################################################
# Copyright (c) 2017 Huawei Technologies Co.,Ltd.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is avai... | 37.798942 | 91 | 0.597424 | arser.set('dispatcher_influxdb', 'target',
'http://{}:{}'.format(ip, 8086))
LOG.info('Writing to %s', consts.CONF_FILE)
with open(consts.CONF_FILE, 'w') as f:
parser.write(f)
def create_grafana(self, args):
try:
environment_id = args['environment_... | true | true |
f71e60c12f87497872af1c06e0fc7e53274e7bbd | 27,815 | py | Python | pymatgen/core/units.py | adozier/pymatgen | f1cc4d8db24ec11063be2fd84b4ea911f006eeb7 | [
"MIT"
] | null | null | null | pymatgen/core/units.py | adozier/pymatgen | f1cc4d8db24ec11063be2fd84b4ea911f006eeb7 | [
"MIT"
] | null | null | null | pymatgen/core/units.py | adozier/pymatgen | f1cc4d8db24ec11063be2fd84b4ea911f006eeb7 | [
"MIT"
] | null | null | null | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
"""
This module implements a FloatWithUnit, which is a subclass of float. It
also defines supported units for some commonly used units for energy, length,
temp... | 31.971264 | 97 | 0.565846 |
from __future__ import division, unicode_literals
from six.moves import filter, zip
__author__ = "Shyue Ping Ong, Matteo Giantomassi"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Shyue Ping Ong, Matteo Giantomassi"
__status__ = "Production"
__date__ = "Aug 30, 201... | true | true |
f71e616278962d75c4364a4c48d685060d730488 | 32,900 | py | Python | panel/param.py | marcelflygare/panel | 75ece664ebc55d482d74abc9b56028cea5218a40 | [
"BSD-3-Clause"
] | null | null | null | panel/param.py | marcelflygare/panel | 75ece664ebc55d482d74abc9b56028cea5218a40 | [
"BSD-3-Clause"
] | null | null | null | panel/param.py | marcelflygare/panel | 75ece664ebc55d482d74abc9b56028cea5218a40 | [
"BSD-3-Clause"
] | null | null | null | """
Defines the Param pane which converts Parameterized classes into a
set of widgets.
"""
from __future__ import absolute_import, division, unicode_literals
import os
import sys
import json
import types
import inspect
import itertools
from collections import OrderedDict, defaultdict, namedtuple
from six import strin... | 41.331658 | 106 | 0.565015 | from __future__ import absolute_import, division, unicode_literals
import os
import sys
import json
import types
import inspect
import itertools
from collections import OrderedDict, defaultdict, namedtuple
from six import string_types
import param
from bokeh.io import curdoc as _curdoc
from param.parameterized impo... | true | true |
f71e6172fb408174fe4da5ba6b742421a696d4dc | 1,235 | py | Python | python/dir/move_file.py | tagwan/scripts | f88846f13b1e3d05c093aff9124d927d6873280c | [
"MIT"
] | null | null | null | python/dir/move_file.py | tagwan/scripts | f88846f13b1e3d05c093aff9124d927d6873280c | [
"MIT"
] | null | null | null | python/dir/move_file.py | tagwan/scripts | f88846f13b1e3d05c093aff9124d927d6873280c | [
"MIT"
] | null | null | null | import shutil
import sys
import time
import os
import argparse
"""
将源目录240天以上的所有文件移动到目标目录
"""
usage = 'python move_files_over_x_days.py -src [SRC] -dst [DST] -days [DAYS]'
description = 'Move files from src to dst if they are older than a certain number of days. Default is 240 days'
args_parser = argparse.ArgumentP... | 36.323529 | 171 | 0.702024 | import shutil
import sys
import time
import os
import argparse
usage = 'python move_files_over_x_days.py -src [SRC] -dst [DST] -days [DAYS]'
description = 'Move files from src to dst if they are older than a certain number of days. Default is 240 days'
args_parser = argparse.ArgumentParser(usage=usage, description=... | true | true |
f71e61cc8a120b27b799496cc36516d8bdc3d5e3 | 582 | py | Python | advanced/image_processing/examples/plot_numpy_array.py | rossbar/scipy-lecture-notes | 7f74e6925721c43bd81bf0bee34b4805ac4a3b57 | [
"CC-BY-4.0"
] | 2,538 | 2015-01-01T04:58:41.000Z | 2022-03-31T21:06:05.000Z | advanced/image_processing/examples/plot_numpy_array.py | rossbar/scipy-lecture-notes | 7f74e6925721c43bd81bf0bee34b4805ac4a3b57 | [
"CC-BY-4.0"
] | 362 | 2015-01-18T14:16:23.000Z | 2021-11-18T16:24:34.000Z | advanced/image_processing/examples/plot_numpy_array.py | rossbar/scipy-lecture-notes | 7f74e6925721c43bd81bf0bee34b4805ac4a3b57 | [
"CC-BY-4.0"
] | 1,127 | 2015-01-05T14:39:29.000Z | 2022-03-25T08:38:39.000Z | """
Image manipulation and numpy arrays
====================================
This example shows how to do image manipulation using common numpy arrays
tricks.
"""
import numpy as np
import scipy
import scipy.misc
import matplotlib.pyplot as plt
face = scipy.misc.face(gray=True)
face[10:13, 20:23]
face[100:120] = 25... | 18.774194 | 73 | 0.632302 |
import numpy as np
import scipy
import scipy.misc
import matplotlib.pyplot as plt
face = scipy.misc.face(gray=True)
face[10:13, 20:23]
face[100:120] = 255
lx, ly = face.shape
X, Y = np.ogrid[0:lx, 0:ly]
mask = (X - lx/2)**2 + (Y - ly/2)**2 > lx*ly/4
face[mask] = 0
face[range(400), range(400)] = 255
plt.figure(figsi... | true | true |
f71e63d7fd418ca42a509c3b118e17c51808dd04 | 7,066 | py | Python | python/mxnet/_ctypes/ndarray.py | litaotju/incubator-mxnet | 83b28911cbc4a49521c69d8c4330a7234436b2fa | [
"Apache-2.0"
] | 3 | 2018-07-31T02:44:39.000Z | 2019-03-10T01:36:47.000Z | python/mxnet/_ctypes/ndarray.py | litaotju/incubator-mxnet | 83b28911cbc4a49521c69d8c4330a7234436b2fa | [
"Apache-2.0"
] | 3 | 2019-01-31T07:48:00.000Z | 2019-02-14T02:02:18.000Z | python/mxnet/_ctypes/ndarray.py | litaotju/incubator-mxnet | 83b28911cbc4a49521c69d8c4330a7234436b2fa | [
"Apache-2.0"
] | 1 | 2019-12-02T04:16:13.000Z | 2019-12-02T04:16:13.000Z | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 35.507538 | 106 | 0.647891 |
from __future__ import absolute_import as _abs
import ctypes
from ..base import _LIB
from ..base import c_str_array, c_handle_array
from ..base import NDArrayHandle, CachedOpHandle
from ..base import check_call
def _monitor_callback_wrapper(callback):
def callback_handle(name, opr_name, arra... | true | true |
f71e655c0d5a42907e4e8c54df2f89045dda2ece | 988 | py | Python | leadmanager/accounts/serializers.py | Nerrdii/lead-manager | 391a698ee4f2f389e57527e460f9f20b5fd73060 | [
"MIT"
] | null | null | null | leadmanager/accounts/serializers.py | Nerrdii/lead-manager | 391a698ee4f2f389e57527e460f9f20b5fd73060 | [
"MIT"
] | 3 | 2021-04-08T19:11:07.000Z | 2021-06-11T15:13:02.000Z | leadmanager/accounts/serializers.py | Nerrdii/lead-manager | 391a698ee4f2f389e57527e460f9f20b5fd73060 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'username', 'email')
class RegisterSerializer(serializers.ModelSerializer):
... | 28.228571 | 92 | 0.678138 | from rest_framework import serializers
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'username', 'email')
class RegisterSerializer(serializers.ModelSerializer):
... | true | true |
f71e6662c54d213d3019b65fbc96d3cbbbbdac09 | 6,350 | py | Python | google/cloud/vision_v1p2beta1/services/image_annotator/transports/base.py | dylancaponi/python-vision | f94fb5b03bf8932e75967249292d23fed2ae2213 | [
"Apache-2.0"
] | null | null | null | google/cloud/vision_v1p2beta1/services/image_annotator/transports/base.py | dylancaponi/python-vision | f94fb5b03bf8932e75967249292d23fed2ae2213 | [
"Apache-2.0"
] | 1 | 2021-02-23T12:41:14.000Z | 2021-02-23T12:41:14.000Z | google/cloud/vision_v1p2beta1/services/image_annotator/transports/base.py | dylancaponi/python-vision | f94fb5b03bf8932e75967249292d23fed2ae2213 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 37.797619 | 85 | 0.639685 |
import abc
import typing
import pkg_resources
from google import auth
from google.api_core import exceptions
from google.api_core import gapic_v1
from google.api_core import retry as retries
from google.api_core import operations_v1
from google.auth import credentials
from google.cloud.vi... | true | true |
f71e6798c5685f6274a337abf79482e269315bdc | 85,692 | py | Python | uhd_restpy/testplatform/sessions/ixnetwork/topology/pppoxclient_57c51b5ca094121e33c3a9ba5033980f.py | Vibaswan/ixnetwork_restpy | 239fedc7050890746cbabd71ea1e91c68d9e5cad | [
"MIT"
] | null | null | null | uhd_restpy/testplatform/sessions/ixnetwork/topology/pppoxclient_57c51b5ca094121e33c3a9ba5033980f.py | Vibaswan/ixnetwork_restpy | 239fedc7050890746cbabd71ea1e91c68d9e5cad | [
"MIT"
] | null | null | null | uhd_restpy/testplatform/sessions/ixnetwork/topology/pppoxclient_57c51b5ca094121e33c3a9ba5033980f.py | Vibaswan/ixnetwork_restpy | 239fedc7050890746cbabd71ea1e91c68d9e5cad | [
"MIT"
] | null | null | null | # MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify,... | 43.832225 | 1,709 | 0.667437 |
from uhd_restpy.base import Base
from uhd_restpy.files import Files
class Pppoxclient(Base):
__slots__ = ()
_SDM_NAME = 'pppoxclient'
_SDM_ATT_MAP = {
'AcMatchMac': 'acMatchMac',
'AcMatchName': 'acMatchName',
'AcOptions': 'acOptions',
'ActualRateDownst... | true | true |
f71e695a37aca1817dcabfee1b7c4e42d4724bff | 35,646 | py | Python | panel/reactive.py | Jacob-Barhak/panel | 04cad38ea703e4e69fb76f063a27f4ffe40688e8 | [
"BSD-3-Clause"
] | 1 | 2021-03-09T04:46:05.000Z | 2021-03-09T04:46:05.000Z | panel/reactive.py | Jacob-Barhak/panel | 04cad38ea703e4e69fb76f063a27f4ffe40688e8 | [
"BSD-3-Clause"
] | null | null | null | panel/reactive.py | Jacob-Barhak/panel | 04cad38ea703e4e69fb76f063a27f4ffe40688e8 | [
"BSD-3-Clause"
] | null | null | null | """
Declares Syncable and Reactive classes which provides baseclasses
for Panel components which sync their state with one or more bokeh
models rendered on the frontend.
"""
import difflib
import sys
import threading
from collections import namedtuple
from functools import partial
import numpy as np
import param
fr... | 38.329032 | 141 | 0.558464 |
import difflib
import sys
import threading
from collections import namedtuple
from functools import partial
import numpy as np
import param
from bokeh.models import LayoutDOM
from tornado import gen
from .config import config
from .io.callbacks import PeriodicCallback
from .io.model import hold
from .io.notebook i... | true | true |
f71e697a978e3d9c4101aee1b43bf18c1e22305d | 8,966 | py | Python | docs/examples/batzle_wang_1992.py | trhallam/digirock | 05b1199d741a384345a4930605be97369c9ec270 | [
"MIT"
] | null | null | null | docs/examples/batzle_wang_1992.py | trhallam/digirock | 05b1199d741a384345a4930605be97369c9ec270 | [
"MIT"
] | 2 | 2022-02-28T08:51:53.000Z | 2022-02-28T13:24:33.000Z | docs/examples/batzle_wang_1992.py | trhallam/digirock | 05b1199d741a384345a4930605be97369c9ec270 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.13.6
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name:... | 29.11039 | 320 | 0.65135 |
import numpy as np
from digirock.fluids import bw92
import matplotlib.pyplot as plt
from matplotlib import rc
rc("font", size=14)
figsize = (15, 5)
temp_ar = np.arange(10, 350, 5)
pres_ar = np.arange(1, 100, 0.1)
sal_ar = np.arange(0, 0.3, 0.01)
pres = np.array([0.1, ... | true | true |
f71e69d9aaba3771528b04fae2b24551b321c43d | 25,996 | py | Python | homeassistant/components/simplisafe/__init__.py | stravinci/AIS-home-assistant | ead4dafd3f801ebeb32860bd34443ed24a4f4167 | [
"Apache-2.0"
] | null | null | null | homeassistant/components/simplisafe/__init__.py | stravinci/AIS-home-assistant | ead4dafd3f801ebeb32860bd34443ed24a4f4167 | [
"Apache-2.0"
] | null | null | null | homeassistant/components/simplisafe/__init__.py | stravinci/AIS-home-assistant | ead4dafd3f801ebeb32860bd34443ed24a4f4167 | [
"Apache-2.0"
] | null | null | null | """Support for SimpliSafe alarm systems."""
import asyncio
from uuid import UUID
from simplipy import API
from simplipy.entity import EntityTypes
from simplipy.errors import EndpointUnavailable, InvalidCredentialsError, SimplipyError
from simplipy.websocket import (
EVENT_CAMERA_MOTION_DETECTED,
EVENT_CONNECTI... | 34.52324 | 88 | 0.637021 | import asyncio
from uuid import UUID
from simplipy import API
from simplipy.entity import EntityTypes
from simplipy.errors import EndpointUnavailable, InvalidCredentialsError, SimplipyError
from simplipy.websocket import (
EVENT_CAMERA_MOTION_DETECTED,
EVENT_CONNECTION_LOST,
EVENT_CONNECTION_RESTORED,
... | true | true |
f71e69e86ee5de49d09df8256001723a4356642b | 4,280 | py | Python | parsing/tracking_logs/generate_course_tracking_logs.py | andyzsf/edx_data_research | 07a587edb1dc4797f116bfeb60ffecbf4ce5bd7a | [
"MIT"
] | null | null | null | parsing/tracking_logs/generate_course_tracking_logs.py | andyzsf/edx_data_research | 07a587edb1dc4797f116bfeb60ffecbf4ce5bd7a | [
"MIT"
] | null | null | null | parsing/tracking_logs/generate_course_tracking_logs.py | andyzsf/edx_data_research | 07a587edb1dc4797f116bfeb60ffecbf4ce5bd7a | [
"MIT"
] | null | null | null | '''
This module will extract tracking logs for a given course and date range
between when course enrollment start and when the course ended. For each log,
the parent_data and meta_data from the course_structure collection will be
appended to the log based on the event key in the log
'''
import pymongo
import sys
fr... | 40 | 132 | 0.642991 |
import pymongo
import sys
from datetime import datetime
import json
def connect_to_db_collection(db_name, collection_name):
connection = pymongo.Connection('localhost', 27017)
db = connection[db_name]
collection = db[collection_name]
return collection
def load_config(config_file):
with open(con... | true | true |
f71e6aa4cc52a591b3bd382a510f0d28274d8670 | 2,419 | py | Python | tests/test_endians.py | bwoodsend/rockhopper | 7a4de06de69d68beed6f0f5d2961e8fb07fd62e6 | [
"MIT"
] | 1 | 2021-07-07T18:21:38.000Z | 2021-07-07T18:21:38.000Z | tests/test_endians.py | bwoodsend/rockhopper | 7a4de06de69d68beed6f0f5d2961e8fb07fd62e6 | [
"MIT"
] | null | null | null | tests/test_endians.py | bwoodsend/rockhopper | 7a4de06de69d68beed6f0f5d2961e8fb07fd62e6 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
"""
import sys
import ctypes
import pytest
from rockhopper._ragged_array import slug
pytestmark = pytest.mark.order(1)
def log_range(start, stop, base):
while start < stop:
# These sequences give a quick way to test the full range of an
# integer type.
yield... | 29.5 | 76 | 0.646135 |
import sys
import ctypes
import pytest
from rockhopper._ragged_array import slug
pytestmark = pytest.mark.order(1)
def log_range(start, stop, base):
while start < stop:
yield start
start *= base
def test_log_range():
assert list(log_range(1, 10, 3)) == [1, 3, 9]
@pyt... | true | true |
f71e6b23d7feba00b1926a7f43eb59a12d8f6a40 | 5,720 | py | Python | utils/catgirlmoe.py | Papyrus12/nekosu | d83315caf764376361cb9680b4297a0061d02305 | [
"MIT"
] | null | null | null | utils/catgirlmoe.py | Papyrus12/nekosu | d83315caf764376361cb9680b4297a0061d02305 | [
"MIT"
] | null | null | null | utils/catgirlmoe.py | Papyrus12/nekosu | d83315caf764376361cb9680b4297a0061d02305 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import re
from cmyui.discord import Webhook
from cmyui.discord import Embed
from objects import glob
from objects.score import Score
from objects.score import Grade
from objects.player import Player
from objects.beatmap import Beatmap
from objects.match import Match
from objects.match import Sl... | 33.255814 | 184 | 0.65542 |
import re
from cmyui.discord import Webhook
from cmyui.discord import Embed
from objects import glob
from objects.score import Score
from objects.score import Grade
from objects.player import Player
from objects.beatmap import Beatmap
from objects.match import Match
from objects.match import Slot
from constants.gamem... | true | true |
f71e6b80047cea9a2670020af62cbeb40bc92652 | 1,412 | py | Python | pygears/lib/reduce2.py | bogdanvuk/pygears | a0b21d445e1d5c89ad66751447b8253536b835ee | [
"MIT"
] | 120 | 2018-04-23T08:29:04.000Z | 2022-03-30T14:41:52.000Z | pygears/lib/reduce2.py | FZP1607152286/pygears | a0b21d445e1d5c89ad66751447b8253536b835ee | [
"MIT"
] | 12 | 2019-07-09T17:12:58.000Z | 2022-03-18T09:05:10.000Z | pygears/lib/reduce2.py | FZP1607152286/pygears | a0b21d445e1d5c89ad66751447b8253536b835ee | [
"MIT"
] | 12 | 2019-05-10T19:42:08.000Z | 2022-03-28T18:26:44.000Z | from pygears import gear, Intf
from pygears.lib import czip
from pygears.typing import Tuple, Uint, Union, Queue
from pygears.lib import fmap, demux, decouple, fifo, union_collapse
from pygears.lib import priority_mux, replicate
TCfg = Tuple[{'reduce_size': Uint['w_reduce_size'], 'init': 't_acc'}]
@gear
def reduce2(... | 33.619048 | 79 | 0.67847 | from pygears import gear, Intf
from pygears.lib import czip
from pygears.typing import Tuple, Uint, Union, Queue
from pygears.lib import fmap, demux, decouple, fifo, union_collapse
from pygears.lib import priority_mux, replicate
TCfg = Tuple[{'reduce_size': Uint['w_reduce_size'], 'init': 't_acc'}]
@gear
def reduce2(... | true | true |
f71e6cf1c4c87d2f388c85fe5d06ee0e82f8e1e9 | 13,098 | py | Python | examples/char-lstm-classification.py | iamgroot42/opacus | 51708309e71c030aa2bf15d6dccc7bcbbe9ed570 | [
"Apache-2.0"
] | 195 | 2019-12-11T23:55:47.000Z | 2020-08-27T04:17:29.000Z | examples/char-lstm-classification.py | iamgroot42/opacus | 51708309e71c030aa2bf15d6dccc7bcbbe9ed570 | [
"Apache-2.0"
] | 35 | 2020-01-21T11:04:29.000Z | 2020-08-27T05:30:57.000Z | examples/char-lstm-classification.py | iamgroot42/opacus | 51708309e71c030aa2bf15d6dccc7bcbbe9ed570 | [
"Apache-2.0"
] | 39 | 2020-01-04T20:05:20.000Z | 2020-08-25T23:09:38.000Z | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# 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 requi... | 27.574737 | 117 | 0.595358 |
import argparse
from collections import Counter
from pathlib import Path
from statistics import mean
import torch
import torch.nn as nn
from opacus import PrivacyEngine
from opacus.layers import DPGRU, DPLSTM, DPRNN
from torch.nn.utils.rnn import pad_sequence
from torch.utils.data import DataLoader, Dat... | true | true |
f71e6d57516ab998da824cc8373fa30884176384 | 8,384 | py | Python | tensorflow_datasets/object_detection/voc.py | ChAnYaNG97/datasets | 0a45e2ea98716d325fc1c5e5494f2575f3bdb908 | [
"Apache-2.0"
] | 1 | 2020-10-11T19:15:49.000Z | 2020-10-11T19:15:49.000Z | tensorflow_datasets/object_detection/voc.py | ChAnYaNG97/datasets | 0a45e2ea98716d325fc1c5e5494f2575f3bdb908 | [
"Apache-2.0"
] | null | null | null | tensorflow_datasets/object_detection/voc.py | ChAnYaNG97/datasets | 0a45e2ea98716d325fc1c5e5494f2575f3bdb908 | [
"Apache-2.0"
] | 1 | 2020-08-03T20:19:12.000Z | 2020-08-03T20:19:12.000Z | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets 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 appl... | 34.933333 | 109 | 0.637643 |
import os
import xml.etree.ElementTree
import tensorflow.compat.v2 as tf
import tensorflow_datasets.public_api as tfds
_VOC_CITATION = """\
@misc{{pascal-voc-{year},
author = "Everingham, M. and Van~Gool, L. and Williams, C. K. I. and Winn, J. and Zisserman, A.",
title = "The {{PASCAL}} {{V}}isual ... | true | true |
f71e6de94e01412e6319d7bc86f671f1d05aba6e | 82,678 | py | Python | electrum_dash/dash_ps.py | STR1017/electrum-dash | f0e3f16c506239bb2f7cf6920464a24706760876 | [
"MIT"
] | 1 | 2021-04-05T15:50:33.000Z | 2021-04-05T15:50:33.000Z | electrum_dash/dash_ps.py | STR1017/electrum-dash | f0e3f16c506239bb2f7cf6920464a24706760876 | [
"MIT"
] | null | null | null | electrum_dash/dash_ps.py | STR1017/electrum-dash | f0e3f16c506239bb2f7cf6920464a24706760876 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import asyncio
import copy
import random
import time
import threading
from collections import deque
from uuid import uuid4
from . import util
from .dash_msg import PRIVATESEND_ENTRY_MAX_SIZE
from .dash_ps_net import PSMixSession, PRIVATESEND_SESSION_MSG_TIMEOUT
from .dash_ps_wallet import (PSD... | 43.151357 | 83 | 0.550037 |
import asyncio
import copy
import random
import time
import threading
from collections import deque
from uuid import uuid4
from . import util
from .dash_msg import PRIVATESEND_ENTRY_MAX_SIZE
from .dash_ps_net import PSMixSession, PRIVATESEND_SESSION_MSG_TIMEOUT
from .dash_ps_wallet import (PSDataMixin, PSKeystoreMix... | true | true |
f71e6e34a925999aadf7dbefd40bb6d81463830a | 6,170 | py | Python | src/gpgodzilla.py | yirzhou/gpgodzilla | b7d4e4d8db730f99d7ad6caab126ff1f14b2d39c | [
"Apache-2.0"
] | 1 | 2020-12-12T00:36:31.000Z | 2020-12-12T00:36:31.000Z | src/gpgodzilla.py | yirzhou/gpgodzilla | b7d4e4d8db730f99d7ad6caab126ff1f14b2d39c | [
"Apache-2.0"
] | null | null | null | src/gpgodzilla.py | yirzhou/gpgodzilla | b7d4e4d8db730f99d7ad6caab126ff1f14b2d39c | [
"Apache-2.0"
] | null | null | null | import logging
import subprocess
from multiprocessing import Process
logging.basicConfig(format='gpgeternal: %(asctime)s - %(message)s', level=logging.DEBUG)
def load_public_key(key_path):
try:
output = subprocess.check_output(['gpg2', '--import', key_path])
(output)
except Exception as e:
... | 45.703704 | 184 | 0.702269 | import logging
import subprocess
from multiprocessing import Process
logging.basicConfig(format='gpgeternal: %(asctime)s - %(message)s', level=logging.DEBUG)
def load_public_key(key_path):
try:
output = subprocess.check_output(['gpg2', '--import', key_path])
(output)
except Exception as e:
... | true | true |
f71e6eba44d1c7020f68f989ac6bd44651c6a4e7 | 14,293 | py | Python | windows_packages_gpu/torch/nn/grad.py | codeproject/DeepStack | d96368a3db1bc0266cb500ba3701d130834da0e6 | [
"Apache-2.0"
] | 353 | 2020-12-10T10:47:17.000Z | 2022-03-31T23:08:29.000Z | windows_packages_gpu/torch/nn/grad.py | codeproject/DeepStack | d96368a3db1bc0266cb500ba3701d130834da0e6 | [
"Apache-2.0"
] | 80 | 2020-12-10T09:54:22.000Z | 2022-03-30T22:08:45.000Z | windows_packages_gpu/torch/nn/grad.py | codeproject/DeepStack | d96368a3db1bc0266cb500ba3701d130834da0e6 | [
"Apache-2.0"
] | 63 | 2020-12-10T17:10:34.000Z | 2022-03-28T16:27:07.000Z | """Gradient interface"""
import torch
from .modules.utils import _single, _pair, _triple
import warnings
def _grad_input_padding(grad_output, input_size, stride, padding, kernel_size, dilation=None):
if dilation is None:
# For backward compatibility
warnings.warn("_grad_input_padding 'd... | 45.519108 | 113 | 0.639894 |
import torch
from .modules.utils import _single, _pair, _triple
import warnings
def _grad_input_padding(grad_output, input_size, stride, padding, kernel_size, dilation=None):
if dilation is None:
warnings.warn("_grad_input_padding 'dilation' argument not provided. Default of 1 is used.")... | true | true |
f71e6fc0c4a210acb51488a7f006a032db64566a | 873 | py | Python | Introduction/Game - Card/UVa 10646 - What is the card.py | ServioTRC/Competitive-Programming | ddc4ed61d4a826932a65ca6d3d033ad29c36491d | [
"Unlicense"
] | null | null | null | Introduction/Game - Card/UVa 10646 - What is the card.py | ServioTRC/Competitive-Programming | ddc4ed61d4a826932a65ca6d3d033ad29c36491d | [
"Unlicense"
] | null | null | null | Introduction/Game - Card/UVa 10646 - What is the card.py | ServioTRC/Competitive-Programming | ddc4ed61d4a826932a65ca6d3d033ad29c36491d | [
"Unlicense"
] | null | null | null | def card_value(card):
if card[0] == "2":
return 2
elif card[0] == "3":
return 3
elif card[0] == "4":
return 4
elif card[0] == "5":
return 5
elif card[0] == "6":
return 6
elif card[0] == "7":
return 7
elif card[0] == "8":
return 8
el... | 23.594595 | 96 | 0.419244 | def card_value(card):
if card[0] == "2":
return 2
elif card[0] == "3":
return 3
elif card[0] == "4":
return 4
elif card[0] == "5":
return 5
elif card[0] == "6":
return 6
elif card[0] == "7":
return 7
elif card[0] == "8":
return 8
el... | true | true |
f71e7051a5a6fe161b39223bd50385377292a238 | 733 | py | Python | appengine-with-cron/appengine_config.py | DoryZi/gcp-optimized-jobs | e88abd4a7b42235e1135230cf3dbd29f3a73fb4f | [
"Apache-2.0"
] | null | null | null | appengine-with-cron/appengine_config.py | DoryZi/gcp-optimized-jobs | e88abd4a7b42235e1135230cf3dbd29f3a73fb4f | [
"Apache-2.0"
] | null | null | null | appengine-with-cron/appengine_config.py | DoryZi/gcp-optimized-jobs | e88abd4a7b42235e1135230cf3dbd29f3a73fb4f | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# Copyright 2015 Google Inc. 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 require... | 31.869565 | 74 | 0.755798 |
from google.appengine.ext import vendor
vendor.add('lib')
| true | true |
f71e70cfe09fcd5ce5b22d8790636643baa10130 | 9,847 | py | Python | ruqqus/client.py | richardARPANET/python-ruqqus | 4eadc5ae89217c63abc8566bbcbc87b39784b905 | [
"MIT"
] | 1 | 2021-01-02T09:49:28.000Z | 2021-01-02T09:49:28.000Z | ruqqus/client.py | richardARPANET/python-ruqqus | 4eadc5ae89217c63abc8566bbcbc87b39784b905 | [
"MIT"
] | null | null | null | ruqqus/client.py | richardARPANET/python-ruqqus | 4eadc5ae89217c63abc8566bbcbc87b39784b905 | [
"MIT"
] | 1 | 2021-03-21T02:52:38.000Z | 2021-03-21T02:52:38.000Z | #!/usr/bin/env python3
from time import time
import requests
class RuqqusClient:
def __init__(
self,
client_id,
client_secret,
code=None,
access_token=None,
refresh_token=None,
):
self.headers = {}
self.url = 'https://ruqqus.com'
self.c... | 28.459538 | 79 | 0.487864 |
from time import time
import requests
class RuqqusClient:
def __init__(
self,
client_id,
client_secret,
code=None,
access_token=None,
refresh_token=None,
):
self.headers = {}
self.url = 'https://ruqqus.com'
self.client_id = client_id
... | true | true |
f71e70f75ef74e8cb49110de6c03e5a4a3b5570e | 663 | py | Python | test/test_container_image.py | hyperonecom/h1-client-python | 4ce355852ba3120ec1b8f509ab5894a5c08da730 | [
"MIT"
] | null | null | null | test/test_container_image.py | hyperonecom/h1-client-python | 4ce355852ba3120ec1b8f509ab5894a5c08da730 | [
"MIT"
] | null | null | null | test/test_container_image.py | hyperonecom/h1-client-python | 4ce355852ba3120ec1b8f509ab5894a5c08da730 | [
"MIT"
] | null | null | null | """
HyperOne
HyperOne API # noqa: E501
The version of the OpenAPI document: 0.1.0
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import h1
from h1.model.container_image import ContainerImage
class TestContainerImage(unittest.TestCase):
"""ContainerImage unit test... | 18.416667 | 79 | 0.660633 |
import sys
import unittest
import h1
from h1.model.container_image import ContainerImage
class TestContainerImage(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testContainerImage(self):
s
if __name__ == '__main__':
unittest.main()
| true | true |
f71e725e0b349de80543e5aa9d59479b592d89d0 | 180 | py | Python | krit/invitations/urls.py | huroncg/krit-teams | ce96a49de44496c2f86e37dd917c51952fbbdeed | [
"BSD-3-Clause"
] | null | null | null | krit/invitations/urls.py | huroncg/krit-teams | ce96a49de44496c2f86e37dd917c51952fbbdeed | [
"BSD-3-Clause"
] | null | null | null | krit/invitations/urls.py | huroncg/krit-teams | ce96a49de44496c2f86e37dd917c51952fbbdeed | [
"BSD-3-Clause"
] | 1 | 2021-02-26T01:38:35.000Z | 2021-02-26T01:38:35.000Z | from django.conf.urls import url
from .views import InvitationDetailView
urlpatterns = [
url(r'^(?P<pk>[0-9]+)/$', InvitationDetailView.as_view(), name='invitations-detail')
] | 30 | 88 | 0.722222 | from django.conf.urls import url
from .views import InvitationDetailView
urlpatterns = [
url(r'^(?P<pk>[0-9]+)/$', InvitationDetailView.as_view(), name='invitations-detail')
] | true | true |
f71e725fcb44ac801a9366c707c6df99559a91f7 | 10,027 | py | Python | homeassistant/components/stream/__init__.py | mikan-megane/core | 837220cce40890e296920d33a623adbc11bd15a6 | [
"Apache-2.0"
] | 2 | 2020-03-29T05:32:57.000Z | 2021-06-13T06:55:05.000Z | homeassistant/components/stream/__init__.py | mikan-megane/core | 837220cce40890e296920d33a623adbc11bd15a6 | [
"Apache-2.0"
] | 79 | 2020-07-23T07:13:37.000Z | 2022-03-22T06:02:37.000Z | homeassistant/components/stream/__init__.py | mikan-megane/core | 837220cce40890e296920d33a623adbc11bd15a6 | [
"Apache-2.0"
] | 1 | 2020-11-18T21:04:18.000Z | 2020-11-18T21:04:18.000Z | """Provide functionality to stream video source.
Components use create_stream with a stream source (e.g. an rtsp url) to create
a new Stream object. Stream manages:
- Background work to fetch and decode a stream
- Desired output formats
- Home Assistant URLs for viewing a stream
- Access tokens for URLs for vi... | 35.306338 | 92 | 0.64057 | from __future__ import annotations
import logging
import re
import secrets
import threading
import time
from types import MappingProxyType
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.core import callback
from homeassistant.exceptions import HomeAssistantError
from .const import (
... | true | true |
f71e7345c9a8dac9495e2a62af51ecf868c01bbb | 253 | py | Python | tests/factories/test_acf.py | fedorpashin/statistical-modeling | 2630e6811afca29cf8a616bab130ae7f9547a043 | [
"MIT"
] | 2 | 2021-05-21T15:29:05.000Z | 2021-08-11T14:08:31.000Z | tests/factories/test_acf.py | fedorpashin/statistical-modeling | 2630e6811afca29cf8a616bab130ae7f9547a043 | [
"MIT"
] | 59 | 2021-08-11T14:08:36.000Z | 2021-09-30T11:15:33.000Z | tests/factories/test_acf.py | fedorpashin/statistical-modeling | 2630e6811afca29cf8a616bab130ae7f9547a043 | [
"MIT"
] | null | null | null | import statistical_modeling as sm
from typing import Final
import unittest
class TestACF(unittest.TestCase):
def test(self):
s: Final = sm.Sample([1, 2, 3])
f: Final = 3
self.assertEqual(sm.ACF(s, f), sm.SampleACF(s, f))
| 19.461538 | 58 | 0.644269 | import statistical_modeling as sm
from typing import Final
import unittest
class TestACF(unittest.TestCase):
def test(self):
s: Final = sm.Sample([1, 2, 3])
f: Final = 3
self.assertEqual(sm.ACF(s, f), sm.SampleACF(s, f))
| true | true |
f71e73f8ed45ce097a4bf846642a7b1f9267abc3 | 17,332 | py | Python | tf_pose/slim/nets/mobilenet/mobilenet.py | gpspelle/pose-estimation | b817dcc120092002984d8a41431046f323bc02c8 | [
"Apache-2.0"
] | 3,442 | 2017-11-20T08:39:51.000Z | 2019-05-06T10:51:19.000Z | tf_pose/slim/nets/mobilenet/mobilenet.py | bvanelli/tf-pose-estimation | 1dec506ac8abf00616dc0fe76bf476ccdfd6b93e | [
"Apache-2.0"
] | 430 | 2017-11-29T04:21:48.000Z | 2019-05-06T05:37:37.000Z | tf_pose/slim/nets/mobilenet/mobilenet.py | bvanelli/tf-pose-estimation | 1dec506ac8abf00616dc0fe76bf476ccdfd6b93e | [
"Apache-2.0"
] | 683 | 2017-11-20T08:50:34.000Z | 2019-05-04T04:25:14.000Z | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 37.034188 | 80 | 0.687111 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import contextlib
import copy
import os
import tensorflow as tf
slim = tf.contrib.slim
@slim.add_arg_scope
def apply_activation(x, name=None, activation_fn=None):
return ... | true | true |
f71e74274134242cf53d0a9f6b3fddeae6b917de | 2,269 | py | Python | PythonSource/pythoncore/antlr4/Utils.py | dean2191/JavaLove | fb0be1e829b7400aff50334f49bc4e9db7d6cb1a | [
"MIT"
] | 1 | 2021-04-29T06:40:54.000Z | 2021-04-29T06:40:54.000Z | src/antlr4/Utils.py | arminnh/ba3-c-to-p-compiler | 2c649e1d3643471bac681c2656c1c7d6249be4d7 | [
"MIT"
] | 2 | 2021-06-23T21:23:04.000Z | 2021-06-23T21:23:11.000Z | src/antlr4/Utils.py | arminnh/ba3-c-to-p-compiler | 2c649e1d3643471bac681c2656c1c7d6249be4d7 | [
"MIT"
] | 1 | 2019-12-16T07:21:49.000Z | 2019-12-16T07:21:49.000Z | #[The "BSD license"]
# Copyright (c) 2012 Terence Parr
# Copyright (c) 2012 Sam Harwell
# Copyright (c) 2014 Eric Vergnaud
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions ... | 38.457627 | 75 | 0.662406 |
from io import StringIO
def str_list(val):
with StringIO() as buf:
buf.write('[')
first = True
for item in val:
if not first:
buf.write(', ')
buf.write(str(item))
first = False
buf.write(']')
r... | true | true |
f71e742c4e9898a942e1c505a387b4ebc7b12bb1 | 3,945 | py | Python | ml/rl/workflow/dqn_workflow.py | tao2020/Horizon | 0f9a1b16ddd6e5a8ac98e61acd227aae7c201b57 | [
"BSD-3-Clause"
] | 1 | 2020-09-27T08:48:14.000Z | 2020-09-27T08:48:14.000Z | ml/rl/workflow/dqn_workflow.py | tao2020/Horizon | 0f9a1b16ddd6e5a8ac98e61acd227aae7c201b57 | [
"BSD-3-Clause"
] | null | null | null | ml/rl/workflow/dqn_workflow.py | tao2020/Horizon | 0f9a1b16ddd6e5a8ac98e61acd227aae7c201b57 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import logging
import sys
from typing import Dict
import numpy as np
from ml.rl.evaluation.evaluator import Evaluator
from ml.rl.preprocessing.preprocessor import Preprocessor
from ml.rl.preprocessing.sparse_to_dense import... | 31.814516 | 88 | 0.714068 |
import logging
import sys
from typing import Dict
import numpy as np
from ml.rl.evaluation.evaluator import Evaluator
from ml.rl.preprocessing.preprocessor import Preprocessor
from ml.rl.preprocessing.sparse_to_dense import PandasSparseToDenseProcessor
from ml.rl.readers.json_dataset_reader import JSONDatasetReader... | true | true |
f71e7468d92a80a2d5be03a087cf20fb8d906f17 | 1,476 | py | Python | translate.py | kolk/qa_factoid2natural | ccdd0096217c8e88b148f353f0c89628b85f9c4d | [
"MIT"
] | 4 | 2019-11-28T17:49:19.000Z | 2022-02-23T17:07:08.000Z | translate.py | kolk/qa_factoid2natural | ccdd0096217c8e88b148f353f0c89628b85f9c4d | [
"MIT"
] | 5 | 2019-11-28T17:49:09.000Z | 2022-02-28T16:37:17.000Z | translate.py | kolk/qa_factoid2natural | ccdd0096217c8e88b148f353f0c89628b85f9c4d | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import configargparse
from onmt.utils.logging import init_logger
from onmt.utils.misc import split_corpus
from onmt.translate.translator import build_translator
import onmt.opts as opts
def main(opt):
translator = build_transl... | 32.086957 | 71 | 0.682927 |
from __future__ import unicode_literals
import configargparse
from onmt.utils.logging import init_logger
from onmt.utils.misc import split_corpus
from onmt.translate.translator import build_translator
import onmt.opts as opts
def main(opt):
translator = build_translator(opt, report_score=True)
src_shards ... | true | true |
f71e752ba12c161e76ce30e5f042ecabae71c44d | 1,251 | py | Python | evaluation.py | yphsieh/rPPG_blink | 31be5b818d34892eb9f2c1abd3b00f370413e3db | [
"Apache-2.0"
] | null | null | null | evaluation.py | yphsieh/rPPG_blink | 31be5b818d34892eb9f2c1abd3b00f370413e3db | [
"Apache-2.0"
] | null | null | null | evaluation.py | yphsieh/rPPG_blink | 31be5b818d34892eb9f2c1abd3b00f370413e3db | [
"Apache-2.0"
] | null | null | null | import os
import argparse
from keras.models import load_model
import numpy as np
from sklearn.metrics import accuracy_score, f1_score
from data_preprocessing import *
parser = argparse.ArgumentParser()
parser.add_argument('-m', '--model_name', default='save/RDNN.h5', type=str)
parser.add_argument('--smooth', type=boo... | 28.431818 | 75 | 0.730616 | import os
import argparse
from keras.models import load_model
import numpy as np
from sklearn.metrics import accuracy_score, f1_score
from data_preprocessing import *
parser = argparse.ArgumentParser()
parser.add_argument('-m', '--model_name', default='save/RDNN.h5', type=str)
parser.add_argument('--smooth', type=boo... | true | true |
f71e757c93cf4638a9270e5f34353dc31a8e6ed9 | 3,064 | py | Python | tests/test_util/test_calibration.py | decarlof/algotom | f357ae5a71d6bc11471da7b3f80505d52918b610 | [
"Apache-2.0"
] | 6 | 2021-05-13T15:20:03.000Z | 2022-01-08T11:36:03.000Z | tests/test_util/test_calibration.py | decarlof/algotom | f357ae5a71d6bc11471da7b3f80505d52918b610 | [
"Apache-2.0"
] | 4 | 2021-05-17T09:15:14.000Z | 2021-07-08T19:38:34.000Z | tests/test_util/test_calibration.py | algotom/algotom | 3dce086bcc0c4df97700c60f8ec90e07ee95d040 | [
"Apache-2.0"
] | 5 | 2021-05-20T16:28:55.000Z | 2021-06-11T23:40:57.000Z | # ============================================================================
# ============================================================================
# Copyright (c) 2021 Nghia T. Vo. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in c... | 40.315789 | 80 | 0.570496 |
import unittest
import numpy as np
import scipy.ndimage as ndi
import algotom.util.calibration as cali
class CalibrationMethods(unittest.TestCase):
def setUp(self):
self.eps = 10 ** (-6)
self.var = 0.05
sigma = 30
(self.hei, self.wid) = (64, 64)
(ycen... | true | true |
f71e76a107f72063c37f240137d16371ad528ba9 | 2,353 | py | Python | third_party/chromite/cros_bisect/manual_evaluator.py | zipated/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 2,151 | 2020-04-18T07:31:17.000Z | 2022-03-31T08:39:18.000Z | third_party/chromite/cros_bisect/manual_evaluator.py | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 395 | 2020-04-18T08:22:18.000Z | 2021-12-08T13:04:49.000Z | third_party/chromite/cros_bisect/manual_evaluator.py | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 338 | 2020-04-18T08:03:10.000Z | 2022-03-29T12:33:22.000Z | # -*- coding: utf-8 -*-
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Asks users if the commit is good or bad."""
from __future__ import print_function
import os
from chromite.cros_bisect import... | 29.78481 | 80 | 0.689333 |
from __future__ import print_function
import os
from chromite.cros_bisect import common
from chromite.cros_bisect import evaluator
from chromite.lib import cros_build_lib
from chromite.lib import osutils
class ManualEvaluator(evaluator.Evaluator):
THRESHOLD = 0.5
def __init__(self, options):
supe... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.