hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7178a5f0eaaff23bb2efef24ecd4ae204c5ee9e | 638 | py | Python | src/django_backend_api/manage.py | Adityaraj1711/django-backend-architecture | 7f3c270af0cb5dd2ebc097c7436a4958cd48ff7c | [
"MIT"
] | 25 | 2020-04-28T19:25:28.000Z | 2021-07-04T17:24:35.000Z | src/django_backend_api/manage.py | Adityaraj1711/django-backend-architecture | 7f3c270af0cb5dd2ebc097c7436a4958cd48ff7c | [
"MIT"
] | 13 | 2020-08-05T22:40:37.000Z | 2022-03-12T00:24:36.000Z | src/django_backend_api/manage.py | Adityaraj1711/django-backend-architecture | 7f3c270af0cb5dd2ebc097c7436a4958cd48ff7c | [
"MIT"
] | 2 | 2020-10-29T13:10:01.000Z | 2021-11-22T01:55:14.000Z | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_backend_api.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
r... | 29 | 82 | 0.688088 |
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_backend_api.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed ... | true | true |
f7178a80bd5a4eb44808ea505c773373aa6ce545 | 102 | py | Python | example.py | CJSmekens/code-refinery-bq-1 | 12cf67033e82176da665156037204eb405a0f6a7 | [
"Apache-2.0"
] | null | null | null | example.py | CJSmekens/code-refinery-bq-1 | 12cf67033e82176da665156037204eb405a0f6a7 | [
"Apache-2.0"
] | 2 | 2021-06-07T10:01:32.000Z | 2021-06-07T10:10:18.000Z | example.py | CJSmekens/code-refinery-bq-1 | 12cf67033e82176da665156037204eb405a0f6a7 | [
"Apache-2.0"
] | 1 | 2021-06-07T09:53:19.000Z | 2021-06-07T09:53:19.000Z | def add(a,b):
return a + b
def subtract(a,b):
return a - b
def product(a,b):
return a * b
| 11.333333 | 18 | 0.558824 | def add(a,b):
return a + b
def subtract(a,b):
return a - b
def product(a,b):
return a * b
| true | true |
f7178af25c554b1c64de2dc78db065ca48b7edd5 | 10,521 | py | Python | micro_app_sdk/model/ops_automation/job_tasks_pb2.py | easyopsapis/easyops-api-python | adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0 | [
"Apache-2.0"
] | 5 | 2019-07-31T04:11:05.000Z | 2021-01-07T03:23:20.000Z | micro_app_sdk/model/ops_automation/job_tasks_pb2.py | easyopsapis/easyops-api-python | adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0 | [
"Apache-2.0"
] | null | null | null | micro_app_sdk/model/ops_automation/job_tasks_pb2.py | easyopsapis/easyops-api-python | adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: job_tasks.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf i... | 50.581731 | 1,012 | 0.737763 |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
_sym_db ... | true | true |
f7178bb0eb777f6aea029f4307dd32ff4cc85674 | 2,500 | py | Python | mobilecoind/strategies/balances.py | mccobr/mobilecoin | cd7753a0aed838097b456d230151fb34e8cff034 | [
"Apache-2.0"
] | 2 | 2021-03-13T04:41:04.000Z | 2021-03-13T04:42:37.000Z | mobilecoind/strategies/balances.py | mccobr/mobilecoin | cd7753a0aed838097b456d230151fb34e8cff034 | [
"Apache-2.0"
] | 292 | 2020-10-22T00:34:35.000Z | 2022-03-29T09:29:14.000Z | mobilecoind/strategies/balances.py | mccobr/mobilecoin | cd7753a0aed838097b456d230151fb34e8cff034 | [
"Apache-2.0"
] | 1 | 2022-03-26T20:34:00.000Z | 2022-03-26T20:34:00.000Z | #!/usr/bin/env python3
# Copyright (c) 2018-2021 The MobileCoin Foundation
"""
The purpose of this script is to print the balances for all keys in
a given account directory.
Example setup and usage:
```
python3 balances.py --key-dir ../../../target/sample_data/master/keys/
```
"""
import argparse
import grpc
imp... | 34.246575 | 97 | 0.6156 |
import argparse
import grpc
import mobilecoind_api_pb2
import mobilecoind_api_pb2_grpc
import os
from accounts import connect, load_key_and_register
from google.protobuf.empty_pb2 import Empty
def parse_args() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser()
parser.add_argument("--mobilecoin... | true | true |
f7178ca40551efa85c6e00fccc36031532a0273f | 2,864 | py | Python | DataManagement.py | DonCammne/OpenSeesPyAssistant | f380f0f2a2f3d1336320bd8d26fa5efe00a12134 | [
"MIT"
] | null | null | null | DataManagement.py | DonCammne/OpenSeesPyAssistant | f380f0f2a2f3d1336320bd8d26fa5efe00a12134 | [
"MIT"
] | null | null | null | DataManagement.py | DonCammne/OpenSeesPyAssistant | f380f0f2a2f3d1336320bd8d26fa5efe00a12134 | [
"MIT"
] | null | null | null | """
Module with the parent abstract class DataManagement. \n
Carmine Schipani, 2021
"""
from abc import ABC, abstractmethod
from OpenSeesPyAssistant.ErrorHandling import *
import numpy as np
class DataManagement(ABC):
"""
Abstract parent class for data management.
Using the associated MATLAB class \n
... | 39.232877 | 192 | 0.631634 |
from abc import ABC, abstractmethod
from OpenSeesPyAssistant.ErrorHandling import *
import numpy as np
class DataManagement(ABC):
def SaveData(self, f):
if len(self.data[0]) != 2: raise WrongDimension()
delimiter = "##############################" col_delimiter = "\t"
... | true | true |
f7178e22c6a7b86147f3ad4e697f29a6c67dce4f | 826 | py | Python | final exam 2/World Tour.py | DiyanKalaydzhiev23/fundamentals---python | 7fa032d9a3270648ffa383bb00dad8e51613189d | [
"MIT"
] | null | null | null | final exam 2/World Tour.py | DiyanKalaydzhiev23/fundamentals---python | 7fa032d9a3270648ffa383bb00dad8e51613189d | [
"MIT"
] | null | null | null | final exam 2/World Tour.py | DiyanKalaydzhiev23/fundamentals---python | 7fa032d9a3270648ffa383bb00dad8e51613189d | [
"MIT"
] | null | null | null | stops = list(input())
command = input().split(":")
while command[0] != "Travel":
if command[0] == "Add Stop":
if 0 <= int(command[1]) < len(stops):
index = int(command[1])
for letter in command[2]:
stops.insert(index, letter)
index += 1
elif comma... | 35.913043 | 91 | 0.53632 | stops = list(input())
command = input().split(":")
while command[0] != "Travel":
if command[0] == "Add Stop":
if 0 <= int(command[1]) < len(stops):
index = int(command[1])
for letter in command[2]:
stops.insert(index, letter)
index += 1
elif comma... | true | true |
f7178e9db3fd873fbe00c6932d476c7f06e20608 | 3,456 | py | Python | hydrus/core/HydrusExceptions.py | ReAnzu/hydrus | 069f77e1941d13b3bdd969aeeffd7ae003fcb71e | [
"WTFPL"
] | 1 | 2021-02-24T22:12:30.000Z | 2021-02-24T22:12:30.000Z | hydrus/core/HydrusExceptions.py | ReAnzu/hydrus | 069f77e1941d13b3bdd969aeeffd7ae003fcb71e | [
"WTFPL"
] | null | null | null | hydrus/core/HydrusExceptions.py | ReAnzu/hydrus | 069f77e1941d13b3bdd969aeeffd7ae003fcb71e | [
"WTFPL"
] | null | null | null | import collections.abc
import os
class HydrusException( Exception ):
def __str__( self ):
if isinstance( self.args, collections.abc.Iterable ):
s = []
for arg in self.args:
try:
... | 35.265306 | 69 | 0.732928 | import collections.abc
import os
class HydrusException( Exception ):
def __str__( self ):
if isinstance( self.args, collections.abc.Iterable ):
s = []
for arg in self.args:
try:
... | true | true |
f7178ea0d3c97e41fedd16e6e263162427023912 | 8,139 | py | Python | synapse/appservice/__init__.py | mweinelt/synapse | 42a9ea37e4c6ff9d91b530c40d366446b9fc2234 | [
"Apache-2.0"
] | null | null | null | synapse/appservice/__init__.py | mweinelt/synapse | 42a9ea37e4c6ff9d91b530c40d366446b9fc2234 | [
"Apache-2.0"
] | null | null | null | synapse/appservice/__init__.py | mweinelt/synapse | 42a9ea37e4c6ff9d91b530c40d366446b9fc2234 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket Ltd
#
# 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... | 35.854626 | 80 | 0.6158 |
from synapse.api.constants import EventTypes
import logging
import re
logger = logging.getLogger(__name__)
class ApplicationServiceState(object):
DOWN = "down"
UP = "up"
class AppServiceTransaction(object):
def __init__(self, service, id, events):
self.service = service
... | true | true |
f717904cee8dca9e6d25f6ea498b85acd973ab00 | 8,645 | py | Python | src/extractor/make_bb_info_mats.py | lonelu/Metalprot_learning | 8edb2c3e4f6ba129a409d75fd4d15ceb3a9e307b | [
"MIT"
] | null | null | null | src/extractor/make_bb_info_mats.py | lonelu/Metalprot_learning | 8edb2c3e4f6ba129a409d75fd4d15ceb3a9e307b | [
"MIT"
] | null | null | null | src/extractor/make_bb_info_mats.py | lonelu/Metalprot_learning | 8edb2c3e4f6ba129a409d75fd4d15ceb3a9e307b | [
"MIT"
] | null | null | null | from numpy.core.numeric import full
from numpy.lib.function_base import append
import prody as pr
import os
import numpy
import matplotlib as mpl
import pylab
from itertools import combinations, combinations_with_replacement
from docopt import docopt
import itertools
import pickle
import sys
from scipy.linalg.basic imp... | 25.501475 | 131 | 0.682244 | from numpy.core.numeric import full
from numpy.lib.function_base import append
import prody as pr
import os
import numpy
import matplotlib as mpl
import pylab
from itertools import combinations, combinations_with_replacement
from docopt import docopt
import itertools
import pickle
import sys
from scipy.linalg.basic imp... | true | true |
f71791c60cc7fc628325ca20e013c1f715b14cbf | 1,168 | py | Python | openamundsen/__init__.py | openamundsen/openamundsen | 2ac09eb34b0c72c84c421a0dac08d114a05b7b1c | [
"MIT"
] | 3 | 2021-05-28T06:46:36.000Z | 2021-06-14T13:39:25.000Z | openamundsen/__init__.py | openamundsen/openamundsen | 2ac09eb34b0c72c84c421a0dac08d114a05b7b1c | [
"MIT"
] | 22 | 2021-04-28T12:31:58.000Z | 2022-03-09T18:29:12.000Z | openamundsen/__init__.py | openamundsen/openamundsen | 2ac09eb34b0c72c84c421a0dac08d114a05b7b1c | [
"MIT"
] | 1 | 2021-06-01T12:48:54.000Z | 2021-06-01T12:48:54.000Z | from .conf import Configuration, parse_config, read_config
from .model import OpenAmundsen, Model
from . import constants, errors, terrain
# Get version (method as used by matplotlib: https://github.com/matplotlib/matplotlib/blob/bcc1ce8461f5b6e874baaaa02ef776d0243a4abe/lib/matplotlib/__init__.py#L133-L151)
def __get... | 33.371429 | 169 | 0.626712 | from .conf import Configuration, parse_config, read_config
from .model import OpenAmundsen, Model
from . import constants, errors, terrain
ttr__(name):
if name == '__version__':
from pathlib import Path
import setuptools_scm
global __version__
root = Path(__file__).resolve().parent... | true | true |
f71791e019fc01edfa394b5acc7c6d6563b6ea45 | 35,147 | py | Python | tests/components/mqtt/test_light_json.py | jlvaillant/core | ae37f9a1d9c5067957854b3c25dcc73fe9a10bee | [
"Apache-2.0"
] | 2 | 2019-11-20T20:56:59.000Z | 2021-01-03T08:52:18.000Z | tests/components/mqtt/test_light_json.py | jlvaillant/core | ae37f9a1d9c5067957854b3c25dcc73fe9a10bee | [
"Apache-2.0"
] | 2 | 2021-06-08T21:54:21.000Z | 2022-03-12T00:37:59.000Z | tests/components/mqtt/test_light_json.py | sampou/homeassistant | 6c1a5d9e5a72eed3a582457142b1db7867b6ff7b | [
"Apache-2.0"
] | 1 | 2021-04-18T19:36:34.000Z | 2021-04-18T19:36:34.000Z | """The tests for the MQTT JSON light platform.
Configuration with RGB, brightness, color temp, effect, white value and XY:
light:
platform: mqtt_json
name: mqtt_json_light_1
state_topic: "home/rgb1"
command_topic: "home/rgb1/set"
brightness: true
color_temp: true
effect: true
rgb: true
white_value: ... | 30.912049 | 88 | 0.583094 | import json
from unittest import mock
from unittest.mock import patch
from homeassistant.components import light
from homeassistant.const import (
ATTR_ASSUMED_STATE,
ATTR_SUPPORTED_FEATURES,
STATE_OFF,
STATE_ON,
)
import homeassistant.core as ha
from homeassistant.setup import async_setup_component
f... | true | true |
f717922d65b80aab39f063f12af29d0dc7bc2b8a | 4,431 | py | Python | tests/test_settings.py | lulle2007200/EasyClangComplete | 55d2c47d9f1b9f2bc85e6cc6de8b92457d9bbeb6 | [
"MIT"
] | 648 | 2016-04-18T16:10:47.000Z | 2022-03-30T01:48:53.000Z | tests/test_settings.py | lulle2007200/EasyClangComplete | 55d2c47d9f1b9f2bc85e6cc6de8b92457d9bbeb6 | [
"MIT"
] | 672 | 2016-04-24T13:55:35.000Z | 2022-03-23T06:38:42.000Z | tests/test_settings.py | lulle2007200/EasyClangComplete | 55d2c47d9f1b9f2bc85e6cc6de8b92457d9bbeb6 | [
"MIT"
] | 130 | 2016-05-26T19:27:00.000Z | 2022-01-15T10:24:17.000Z | """Tests for settings."""
import sublime
import imp
from os import path
from EasyClangComplete.tests.gui_test_wrapper import GuiTestWrapper
from EasyClangComplete.plugin.settings import settings_manager
from EasyClangComplete.plugin.settings import settings_storage
from EasyClangComplete.plugin.utils import flag
im... | 35.448 | 75 | 0.612051 | import sublime
import imp
from os import path
from EasyClangComplete.tests.gui_test_wrapper import GuiTestWrapper
from EasyClangComplete.plugin.settings import settings_manager
from EasyClangComplete.plugin.settings import settings_storage
from EasyClangComplete.plugin.utils import flag
imp.reload(settings_manager)... | true | true |
f71792385df7b999e78480b6b8bb47ec29d5d377 | 922 | py | Python | arrays/countNumberOfPairsWithAbsoluteDifferenceK.py | kushvr7/High-On-DSA | d424bd48e35ebd1a588d96c1c0dcb5a9c47a0ef1 | [
"MIT"
] | 76 | 2021-12-12T08:42:20.000Z | 2022-03-31T19:48:46.000Z | arrays/countNumberOfPairsWithAbsoluteDifferenceK.py | kushvr7/High-On-DSA | d424bd48e35ebd1a588d96c1c0dcb5a9c47a0ef1 | [
"MIT"
] | 4 | 2022-01-04T09:58:39.000Z | 2022-03-30T17:00:39.000Z | arrays/countNumberOfPairsWithAbsoluteDifferenceK.py | kushvr7/High-On-DSA | d424bd48e35ebd1a588d96c1c0dcb5a9c47a0ef1 | [
"MIT"
] | 13 | 2021-12-12T14:44:41.000Z | 2022-03-10T14:08:20.000Z | # https://leetcode.com/problems/count-number-of-pairs-with-absolute-difference-k/
from collections import Counter
class Solution(object):
# Brute Force Approach
# TC : O(N
# SC : O(N)
def countKDifference(self, nums, k):
"""
:type nums: List[int]
:type k: int
... | 23.05 | 81 | 0.452278 |
from collections import Counter
class Solution(object):
def countKDifference(self, nums, k):
count =0
for i in range(len(nums)):
for j in range(i, len(nums)):
if abs(nums[i]-nums[j])==k:
count +=1
return co... | true | true |
f71792d21101ca8f9fdb2b92a64c021d5e816fea | 28,771 | py | Python | pyspark/bigdl/transform/vision/image.py | twicoder/BigDL | f065db372e1c682fa4a7903e287bba21d5f46750 | [
"Apache-2.0"
] | 55 | 2018-01-12T01:43:29.000Z | 2021-03-09T02:35:56.000Z | pyspark/bigdl/transform/vision/image.py | jason-hzw/BigDL | ef4f4137965147e2bc59e41f40c4acbb50eeda97 | [
"Apache-2.0"
] | 4 | 2018-01-15T07:34:41.000Z | 2018-01-16T05:46:12.000Z | pyspark/bigdl/transform/vision/image.py | jason-hzw/BigDL | ef4f4137965147e2bc59e41f40c4acbb50eeda97 | [
"Apache-2.0"
] | 22 | 2018-01-15T14:18:15.000Z | 2019-12-16T18:51:33.000Z | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 38.310253 | 135 | 0.652184 |
import sys
from bigdl.util.common import JavaValue
from bigdl.util.common import callBigDlFunc
from bigdl.util.common import *
if sys.version >= '3':
long = int
unicode = str
class FeatureTransformer(JavaValue):
def __init__(self, bigdl_type="float", *args):
self.value = callBigD... | true | true |
f71793b555d90d054bf1905d45ea0235b077f075 | 2,312 | py | Python | pyramid_debugtoolbar/panels/traceback.py | rollbar/pyramid_debugtoolbar | dab4278eb68b801b1d3e9679cf1308096c3f849f | [
"Apache-2.0"
] | null | null | null | pyramid_debugtoolbar/panels/traceback.py | rollbar/pyramid_debugtoolbar | dab4278eb68b801b1d3e9679cf1308096c3f849f | [
"Apache-2.0"
] | null | null | null | pyramid_debugtoolbar/panels/traceback.py | rollbar/pyramid_debugtoolbar | dab4278eb68b801b1d3e9679cf1308096c3f849f | [
"Apache-2.0"
] | 1 | 2021-02-21T12:18:04.000Z | 2021-02-21T12:18:04.000Z | import re
from pyramid_debugtoolbar.tbtools import Traceback
from pyramid_debugtoolbar.panels import DebugPanel
from pyramid_debugtoolbar.utils import escape
from pyramid_debugtoolbar.utils import STATIC_PATH
from pyramid_debugtoolbar.utils import ROOT_ROUTE_NAME
from pyramid_debugtoolbar.utils import EXC_ROUTE_NAME
... | 32.111111 | 100 | 0.588668 | import re
from pyramid_debugtoolbar.tbtools import Traceback
from pyramid_debugtoolbar.panels import DebugPanel
from pyramid_debugtoolbar.utils import escape
from pyramid_debugtoolbar.utils import STATIC_PATH
from pyramid_debugtoolbar.utils import ROOT_ROUTE_NAME
from pyramid_debugtoolbar.utils import EXC_ROUTE_NAME
... | true | true |
f717942ddd2886f2dcfba64b6e7601b1de639677 | 571 | py | Python | test/api_test.py | kuro2a/kiku | d4e6500970a20d1955f1773e0e2cfb8e2db819ba | [
"MIT"
] | 2 | 2019-08-14T14:32:36.000Z | 2019-08-15T08:28:15.000Z | test/api_test.py | kuro2a/kiku | d4e6500970a20d1955f1773e0e2cfb8e2db819ba | [
"MIT"
] | 1 | 2019-10-02T16:35:05.000Z | 2019-10-02T16:35:05.000Z | test/api_test.py | kuro2a/kiku | d4e6500970a20d1955f1773e0e2cfb8e2db819ba | [
"MIT"
] | 1 | 2019-08-14T14:33:01.000Z | 2019-08-14T14:33:01.000Z | #!/usr/bin/python3
import sys
import pathlib
from datetime import datetime
import pytest
from falcon import testing
sys.path.append( str(pathlib.Path(__file__).resolve().parent) + '/../' )
import main
@pytest.fixture()
def client():
return testing.TestClient(main.create_service())
def test_api_version(clien... | 18.419355 | 72 | 0.623468 |
import sys
import pathlib
from datetime import datetime
import pytest
from falcon import testing
sys.path.append( str(pathlib.Path(__file__).resolve().parent) + '/../' )
import main
@pytest.fixture()
def client():
return testing.TestClient(main.create_service())
def test_api_version(client):
doc = {
... | true | true |
f7179491275351836a0592d841bc9b9fe7d43c7d | 151 | py | Python | src/GracefulKiller/__init__.py | MaxMaxoff/GracefulKiller | dab06ecc7573211ae7acf90e5f889e37d48a88d2 | [
"MIT"
] | 1 | 2021-10-04T09:09:12.000Z | 2021-10-04T09:09:12.000Z | src/GracefulKiller/__init__.py | MaxMaxoff/GracefulKiller | dab06ecc7573211ae7acf90e5f889e37d48a88d2 | [
"MIT"
] | null | null | null | src/GracefulKiller/__init__.py | MaxMaxoff/GracefulKiller | dab06ecc7573211ae7acf90e5f889e37d48a88d2 | [
"MIT"
] | null | null | null | try:
from GracefulKiller.GracefulKiller import GracefulKiller, Loop
except:
from src.GracefulKiller.GracefulKiller import GracefulKiller, Loop
| 30.2 | 70 | 0.821192 | try:
from GracefulKiller.GracefulKiller import GracefulKiller, Loop
except:
from src.GracefulKiller.GracefulKiller import GracefulKiller, Loop
| true | true |
f71794ea091735736fa90a59266f6bb2161ac032 | 1,897 | py | Python | tests/test_test.py | yehzhang/RapidTest | 2302fc10ddafba1d16ef1d7448d46c66f5a05da2 | [
"MIT"
] | null | null | null | tests/test_test.py | yehzhang/RapidTest | 2302fc10ddafba1d16ef1d7448d46c66f5a05da2 | [
"MIT"
] | null | null | null | tests/test_test.py | yehzhang/RapidTest | 2302fc10ddafba1d16ef1d7448d46c66f5a05da2 | [
"MIT"
] | null | null | null | from unittest import TestCase
from rapidtest import Result, Test, Case, TreeNode
class TestTest(TestCase):
def test_check_result(self):
t = Test(list, operation=True)
t.add_case(Case('append', [1],
'pop', Result(1),
'append', [2],
... | 29.640625 | 62 | 0.470216 | from unittest import TestCase
from rapidtest import Result, Test, Case, TreeNode
class TestTest(TestCase):
def test_check_result(self):
t = Test(list, operation=True)
t.add_case(Case('append', [1],
'pop', Result(1),
'append', [2],
... | true | true |
f7179508810234674ea1f3cf934a800af733803f | 794 | py | Python | gaphor/RAAML/modelinglanguage.py | mrmonkington/gaphor | f0fcd4deb90d24b14723840a689fac901f645a43 | [
"Apache-2.0"
] | 867 | 2018-01-09T00:19:09.000Z | 2022-03-31T02:49:23.000Z | gaphor/RAAML/modelinglanguage.py | mrmonkington/gaphor | f0fcd4deb90d24b14723840a689fac901f645a43 | [
"Apache-2.0"
] | 790 | 2018-01-13T23:47:07.000Z | 2022-03-31T16:04:27.000Z | gaphor/RAAML/modelinglanguage.py | sitedata/gaphor | c83eff0bd595d1a8e766a157f0268e5206eed22c | [
"Apache-2.0"
] | 117 | 2018-01-09T02:24:49.000Z | 2022-03-23T08:07:42.000Z | """The RAAML Modeling Language module is the entrypoint for RAAML related
assets."""
import gaphor.SysML.propertypages # noqa
from gaphor.abc import ModelingLanguage
from gaphor.core import gettext
from gaphor.diagram.diagramtoolbox import ToolboxDefinition
from gaphor.RAAML import diagramitems, raaml
from gaphor.RAA... | 30.538462 | 73 | 0.746851 |
import gaphor.SysML.propertypages
from gaphor.abc import ModelingLanguage
from gaphor.core import gettext
from gaphor.diagram.diagramtoolbox import ToolboxDefinition
from gaphor.RAAML import diagramitems, raaml
from gaphor.RAAML.toolbox import raaml_toolbox_actions
class RAAMLModelingLanguage(ModelingLanguage):
... | true | true |
f717953473fd5d44045b712a4f139e641a8c661b | 27,730 | py | Python | InstallOpenface/fix_sklearn/label.py | s123600g/openfaceInstallscript | 962b4b89c5626318b5701d7297d49df3423b0fe4 | [
"MIT"
] | null | null | null | InstallOpenface/fix_sklearn/label.py | s123600g/openfaceInstallscript | 962b4b89c5626318b5701d7297d49df3423b0fe4 | [
"MIT"
] | null | null | null | InstallOpenface/fix_sklearn/label.py | s123600g/openfaceInstallscript | 962b4b89c5626318b5701d7297d49df3423b0fe4 | [
"MIT"
] | null | null | null | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Joel Nothman <joel.nothman@gmail.com>
# Hamzeh Alsalhi <ha258@cornell.edu>
# Licens... | 33.329327 | 87 | 0.588136 |
from collections import defaultdict
import itertools
import array
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator, TransformerMixin
from ..utils.fixes import sparse_min_max
from ..utils import column_or_1d
from ..utils.validation import check_array
from ..utils.validation import... | true | true |
f71795db955b211e36055a00f084863a0bec4fd7 | 2,307 | py | Python | third_party/webrtc/src/chromium/src/tools/perf/metrics/network.py | bopopescu/webrtc-streaming-node | 727a441204344ff596401b0253caac372b714d91 | [
"MIT"
] | 20 | 2015-08-26T06:46:00.000Z | 2019-02-27T09:05:58.000Z | third_party/webrtc/src/chromium/src/tools/perf/metrics/network.py | bopopescu/webrtc-streaming-node | 727a441204344ff596401b0253caac372b714d91 | [
"MIT"
] | 1 | 2021-05-05T11:11:31.000Z | 2021-05-05T11:11:31.000Z | third_party/webrtc/src/chromium/src/tools/perf/metrics/network.py | bopopescu/webrtc-streaming-node | 727a441204344ff596401b0253caac372b714d91 | [
"MIT"
] | 7 | 2016-02-09T09:28:14.000Z | 2020-07-25T19:03:36.000Z | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.value import scalar
from metrics import Metric
NETWORK_DATA_NOT_FOUND = 'Network data could not be found.'
# This is experimental. crbug.... | 33.434783 | 79 | 0.715648 |
from telemetry.value import scalar
from metrics import Metric
NETWORK_DATA_NOT_FOUND = 'Network data could not be found.'
class NetworkMetric(Metric):
def __init__(self, platform):
super(NetworkMetric, self).__init__()
self._network_snd = None
self._network_rcv = None
self._platform = plat... | true | true |
f71796820dbd5571d7b35348bcdbcfdd286b0af9 | 13,935 | py | Python | utils.py | ravana69/MusicPlayer-1 | 70feb663579c6be63b0e4481bdfd6b41ffe51110 | [
"MIT"
] | 1 | 2021-07-27T04:27:13.000Z | 2021-07-27T04:27:13.000Z | utils.py | ravana69/MusicPlayer-1 | 70feb663579c6be63b0e4481bdfd6b41ffe51110 | [
"MIT"
] | null | null | null | utils.py | ravana69/MusicPlayer-1 | 70feb663579c6be63b0e4481bdfd6b41ffe51110 | [
"MIT"
] | 1 | 2021-09-17T03:43:21.000Z | 2021-09-17T03:43:21.000Z | #MIT License
#Copyright (c) 2021 SUBIN
#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, distr... | 34.32266 | 158 | 0.560603 |
import os
from config import Config
import ffmpeg
from pyrogram import emoji
from pyrogram.methods.messages.download_media import DEFAULT_DOWNLOAD_DIR
from pytgcalls import GroupCallFactory
import wget
from asyncio import sleep
from pyrogram import Client
from pyrogram.utils import MAX_CHANNEL_ID
f... | true | true |
f7179710e50c234d4e503175eb8befff0a20a20a | 221 | py | Python | Zadaniy/zadanie2.py | Dmitry-15/8_laba | f72089ebd16bc890efbfaaee1114fcf3a26d3caf | [
"MIT"
] | null | null | null | Zadaniy/zadanie2.py | Dmitry-15/8_laba | f72089ebd16bc890efbfaaee1114fcf3a26d3caf | [
"MIT"
] | null | null | null | Zadaniy/zadanie2.py | Dmitry-15/8_laba | f72089ebd16bc890efbfaaee1114fcf3a26d3caf | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
words = {
1: 'one',
2: 'two',
3: 'three',
4: 'four'
}
dict_items = words.items()
new_words = dict(zip(words.values(), words.keys()))
print(new_words)
| 11.05 | 51 | 0.542986 |
words = {
1: 'one',
2: 'two',
3: 'three',
4: 'four'
}
dict_items = words.items()
new_words = dict(zip(words.values(), words.keys()))
print(new_words)
| true | true |
f71797e9f253734c08819653230015e46d247936 | 1,856 | py | Python | a3/clean_data.py | CornellDataScience/IntSys-Education | bcd1e519af59a03a1062b8dc2c538231752147de | [
"MIT"
] | 1 | 2021-12-02T21:23:35.000Z | 2021-12-02T21:23:35.000Z | a3/clean_data.py | CornellDataScience/IntSys-Education | bcd1e519af59a03a1062b8dc2c538231752147de | [
"MIT"
] | null | null | null | a3/clean_data.py | CornellDataScience/IntSys-Education | bcd1e519af59a03a1062b8dc2c538231752147de | [
"MIT"
] | 12 | 2020-03-03T00:36:10.000Z | 2021-11-30T19:16:38.000Z | import pickle
import numpy as np
from PIL import Image
def load_pickle_file(path_to_file):
"""
Loads the data from a pickle file and returns that object
"""
## Look up: https://docs.python.org/3/library/pickle.html
## The code should look something like this:
# with open(path_to_file, 'rb') as... | 40.347826 | 94 | 0.72306 | import pickle
import numpy as np
from PIL import Image
def load_pickle_file(path_to_file):
| true | true |
f71797fd5d4ce71e2b817579238f917ae5a8107c | 623 | py | Python | setup.py | kmedian/pdtweak | 27955bb6bb9c5d14eb9126846bb31a945be10245 | [
"MIT"
] | null | null | null | setup.py | kmedian/pdtweak | 27955bb6bb9c5d14eb9126846bb31a945be10245 | [
"MIT"
] | null | null | null | setup.py | kmedian/pdtweak | 27955bb6bb9c5d14eb9126846bb31a945be10245 | [
"MIT"
] | null | null | null | from setuptools import setup
def read(fname):
import os
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name='pdtweak',
version='0.1.1',
description='pandas utility functions',
long_description=read('README.md'),
long_description_content_type='text/markdown',... | 25.958333 | 70 | 0.626003 | from setuptools import setup
def read(fname):
import os
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name='pdtweak',
version='0.1.1',
description='pandas utility functions',
long_description=read('README.md'),
long_description_content_type='text/markdown',... | true | true |
f717984864aea902725da624719b1fb9774e58e4 | 6,794 | py | Python | library/f5bigip_ltm_monitor_mssql.py | erjac77/ansible-role-f5 | c45b5d9d5f34a8ac6d19ded836d0a6b7ee7f8056 | [
"Apache-2.0"
] | 1 | 2020-02-21T06:48:14.000Z | 2020-02-21T06:48:14.000Z | library/f5bigip_ltm_monitor_mssql.py | erjac77/ansible-role-f5 | c45b5d9d5f34a8ac6d19ded836d0a6b7ee7f8056 | [
"Apache-2.0"
] | null | null | null | library/f5bigip_ltm_monitor_mssql.py | erjac77/ansible-role-f5 | c45b5d9d5f34a8ac6d19ded836d0a6b7ee7f8056 | [
"Apache-2.0"
] | 1 | 2021-03-29T03:55:34.000Z | 2021-03-29T03:55:34.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2016 Eric Jacob <erjac77@gmail.com>
#
# 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
#... | 35.570681 | 120 | 0.662644 |
ANSIBLE_METADATA = {
"metadata_version": "1.1",
"status": ["preview"],
"supported_by": "community",
}
DOCUMENTATION = """
---
module: f5bigip_ltm_monitor_mssql
short_description: BIG-IP ltm monitor mssql module
description:
- Configures a Microsoft Windows Structured Query Language (MS... | true | true |
f7179886d96e9c4fe729b281b4c4f32c905628b2 | 1,086 | py | Python | test_1_lineral/personTest.py | NoOneZero/Neuro | a3cf1e2a701ee0096f093d332237dc30f8f83a50 | [
"Apache-2.0"
] | null | null | null | test_1_lineral/personTest.py | NoOneZero/Neuro | a3cf1e2a701ee0096f093d332237dc30f8f83a50 | [
"Apache-2.0"
] | null | null | null | test_1_lineral/personTest.py | NoOneZero/Neuro | a3cf1e2a701ee0096f093d332237dc30f8f83a50 | [
"Apache-2.0"
] | null | null | null | from common.person import Person
from random import randint
class PersonTest(Person):
def __init__(self, position: list = [0, 0], color: list = [255, 255, 255], size: int = 20, default_position_range=None) -> None:
self.color2 = [randint(2, 50), randint(100, 200), randint(10,50)]
self.color3 = [ra... | 51.714286 | 132 | 0.639963 | from common.person import Person
from random import randint
class PersonTest(Person):
def __init__(self, position: list = [0, 0], color: list = [255, 255, 255], size: int = 20, default_position_range=None) -> None:
self.color2 = [randint(2, 50), randint(100, 200), randint(10,50)]
self.color3 = [ra... | true | true |
f717991fd1d5e7f5581e44f8809e73280ace6c29 | 530 | py | Python | infra/apps/catalog/migrations/0005_node.py | datosgobar/infra.datos.gob.ar | 9f6ae7f0fc741aad79d074e7b2eb2a7dddf8b2cf | [
"MIT"
] | 1 | 2019-07-01T19:38:52.000Z | 2019-07-01T19:38:52.000Z | infra/apps/catalog/migrations/0005_node.py | datosgobar/infra.datos.gob.ar | 9f6ae7f0fc741aad79d074e7b2eb2a7dddf8b2cf | [
"MIT"
] | 77 | 2019-05-27T18:16:30.000Z | 2021-09-20T21:25:24.000Z | infra/apps/catalog/migrations/0005_node.py | datosgobar/infra.datos.gob.ar | 9f6ae7f0fc741aad79d074e7b2eb2a7dddf8b2cf | [
"MIT"
] | 3 | 2019-12-09T16:38:18.000Z | 2020-10-30T02:10:20.000Z | # Generated by Django 2.2.2 on 2019-07-18 13:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catalog', '0004_auto_20190718_1315'),
]
operations = [
migrations.CreateModel(
name='Node',
fields=[
... | 25.238095 | 114 | 0.586792 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catalog', '0004_auto_20190718_1315'),
]
operations = [
migrations.CreateModel(
name='Node',
fields=[
('id', models.AutoField(auto_created=True, pri... | true | true |
f71799bb2d2c6c8ba977cf1ec8011ac88bd817c0 | 8,867 | py | Python | infra/ci/build.py | DarthFudd/oss-fuzz | 35e7ac7e18cf87b58dd7d1bf88b1f9846adb92db | [
"Apache-2.0"
] | 1 | 2021-02-22T11:57:12.000Z | 2021-02-22T11:57:12.000Z | infra/ci/build.py | DarthFudd/oss-fuzz | 35e7ac7e18cf87b58dd7d1bf88b1f9846adb92db | [
"Apache-2.0"
] | null | null | null | infra/ci/build.py | DarthFudd/oss-fuzz | 35e7ac7e18cf87b58dd7d1bf88b1f9846adb92db | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 33.714829 | 80 | 0.721101 |
is_enabled('SANITIZER', 'sanitizers', DEFAULT_SANITIZERS) and
is_enabled('ARCHITECTURE', 'architectures', DEFAULT_ARCHITECTURES))
def build_project(project):
root = get_oss_fuzz_root()
project_yaml_path = os.path.join(root, 'projects', project, 'project.yaml')
with open(project_yaml... | true | true |
f7179a9aff5fcbff9e7d9219b960c35806a5e4f8 | 2,214 | py | Python | generate_embeddings.py | yangfengKAUST/cnn-text-classification-tf | 5f552df9887e57a4bc5638b3d36d7393254d2644 | [
"Apache-2.0"
] | null | null | null | generate_embeddings.py | yangfengKAUST/cnn-text-classification-tf | 5f552df9887e57a4bc5638b3d36d7393254d2644 | [
"Apache-2.0"
] | null | null | null | generate_embeddings.py | yangfengKAUST/cnn-text-classification-tf | 5f552df9887e57a4bc5638b3d36d7393254d2644 | [
"Apache-2.0"
] | null | null | null | import numpy as np
import pickle
import argparse
import re
"""
Convert pre-trained Glove embeddings into npy file
Run using:
python3 generate_embeddings.py -d data/glove.6B.300d.txt --npy_output data/embeddings.npy --dict_output data/vocab.pckl --dict_whitelist data/polaritydata.vocab
"""
def parse_args():
parser... | 29.131579 | 160 | 0.590786 | import numpy as np
import pickle
import argparse
import re
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--dataset', '-d', type=str, required=True)
parser.add_argument('--npy_output', type=str, required=True)
parser.add_argument('--dict_output', type=str, required=True)
... | true | true |
f7179ad7cc757ce856fb3920524110f510a8a74a | 2,256 | py | Python | SWIM-Executables/Windows/pyinstaller-2.0 for windows/PyInstaller/hooks/django-import-finder.py | alexsigaras/SWIM | 1a35df8acb26bdcb307a1b8f60e9feba68ed1715 | [
"MIT"
] | 47 | 2020-03-08T08:43:28.000Z | 2022-03-18T18:51:55.000Z | SWIM-Executables/Windows/pyinstaller-2.0 for windows/PyInstaller/hooks/django-import-finder.py | alexsigaras/SWIM | 1a35df8acb26bdcb307a1b8f60e9feba68ed1715 | [
"MIT"
] | null | null | null | SWIM-Executables/Windows/pyinstaller-2.0 for windows/PyInstaller/hooks/django-import-finder.py | alexsigaras/SWIM | 1a35df8acb26bdcb307a1b8f60e9feba68ed1715 | [
"MIT"
] | 16 | 2020-03-08T08:43:30.000Z | 2022-01-10T22:05:57.000Z | # Copyright (C) 2009, Lorenzo Berni
# Based on previous work under copyright (c) 2001, 2002 McMillan Enterprises, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the... | 38.237288 | 96 | 0.724734 |
import os
import PyInstaller.compat as compat
from hookutils import logger
if not compat.getenv("DJANGO_SETTINGS_MODULE"):
compat.setenv("DJANGO_SETTINGS_MODULE", "settings")
from django.conf import settings
hiddenimports = (list(settings.AUTHENTICATION_BACKENDS) +
[settings.DE... | true | true |
f7179b68d16205b5ace838040622bc3f19f99fa8 | 10,342 | py | Python | src/.history/Test/HiwinRT605_test_20190619131630.py | SamKaiYang/2019_Hiwin_Shaking | d599f8c87dc4da89eae266990d12eb3a8b0f3e16 | [
"MIT"
] | null | null | null | src/.history/Test/HiwinRT605_test_20190619131630.py | SamKaiYang/2019_Hiwin_Shaking | d599f8c87dc4da89eae266990d12eb3a8b0f3e16 | [
"MIT"
] | null | null | null | src/.history/Test/HiwinRT605_test_20190619131630.py | SamKaiYang/2019_Hiwin_Shaking | d599f8c87dc4da89eae266990d12eb3a8b0f3e16 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# license removed for brevity
#策略 機械手臂 四點來回跑
import rospy
import os
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import math
import enum
import Hiwin_RT605_ROS as ArmTask
pos_feedback_times = 0
mode_feedback_times = 0
msg_feedback ... | 30.871642 | 145 | 0.579288 |
import rospy
import os
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import math
import enum
import Hiwin_RT605_ROS as ArmTask
pos_feedback_times = 0
mode_feedback_times = 0
msg_feedback = 1
Arm_state_flag = 0
Strategy_flag = 0
arm_move_times = 1
ype,... | true | true |
f7179b7c95704c49d4aaa9e728e5e82df649b8d6 | 596 | py | Python | configs/revbifpn/fcn_s1_512x1024_120k_cityscapes.py | gupta-abhay/mmsegmentation | 03e80db237d12b4d049fe65c6612f2bc741f8135 | [
"Apache-2.0"
] | null | null | null | configs/revbifpn/fcn_s1_512x1024_120k_cityscapes.py | gupta-abhay/mmsegmentation | 03e80db237d12b4d049fe65c6612f2bc741f8135 | [
"Apache-2.0"
] | null | null | null | configs/revbifpn/fcn_s1_512x1024_120k_cityscapes.py | gupta-abhay/mmsegmentation | 03e80db237d12b4d049fe65c6612f2bc741f8135 | [
"Apache-2.0"
] | null | null | null | _base_ = [
'../_base_/models/fcn_hr18.py',
'../_base_/datasets/cityscapes.py',
'../_base_/default_runtime.py',
'../_base_/schedules/schedule_120k.py',
]
model = dict(
pretrained=None,
backbone=dict(
type='RevBiFPN_S',
arch='revbifpn_s1',
strict=False,
classes=Non... | 23.84 | 72 | 0.567114 | _base_ = [
'../_base_/models/fcn_hr18.py',
'../_base_/datasets/cityscapes.py',
'../_base_/default_runtime.py',
'../_base_/schedules/schedule_120k.py',
]
model = dict(
pretrained=None,
backbone=dict(
type='RevBiFPN_S',
arch='revbifpn_s1',
strict=False,
classes=Non... | true | true |
f7179e36f8aee9aeb3010facd15317bf9a7987b3 | 1,075 | py | Python | fewshot/data/compress_tiered_imagenet.py | renmengye/inc-few-shot-attractor-public | c560d5a81480cb22d903fa746ab0cfc2eb964e4c | [
"MIT"
] | 122 | 2019-09-20T05:35:29.000Z | 2022-03-22T06:30:33.000Z | fewshot/data/compress_tiered_imagenet.py | renmengye/inc-few-shot-attractor-public | c560d5a81480cb22d903fa746ab0cfc2eb964e4c | [
"MIT"
] | 10 | 2019-11-10T10:24:06.000Z | 2021-10-06T13:13:26.000Z | fewshot/data/compress_tiered_imagenet.py | renmengye/inc-few-shot-attractor-public | c560d5a81480cb22d903fa746ab0cfc2eb964e4c | [
"MIT"
] | 28 | 2019-10-21T11:38:06.000Z | 2022-01-26T16:55:28.000Z | import cv2
import numpy as np
import six
import sys
import pickle as pkl
from tqdm import tqdm
def compress(path, output):
with np.load(path, mmap_mode="r", encoding='latin1') as data:
images = data["images"]
array = []
for ii in tqdm(six.moves.xrange(images.shape[0]), desc='compress'):
im = imag... | 23.888889 | 71 | 0.633488 | import cv2
import numpy as np
import six
import sys
import pickle as pkl
from tqdm import tqdm
def compress(path, output):
with np.load(path, mmap_mode="r", encoding='latin1') as data:
images = data["images"]
array = []
for ii in tqdm(six.moves.xrange(images.shape[0]), desc='compress'):
im = imag... | true | true |
f7179eb378b819138f77c19337426397d15ce820 | 10,249 | py | Python | rl4net/envs/power_allocation/test_pa_rb_env.py | bupt-ipcr/RL4Net | b1b694361c688f5e0055148a0cdcb4c6253cd7bd | [
"MIT"
] | 17 | 2020-03-19T02:51:48.000Z | 2021-06-15T00:42:29.000Z | vvlab/envs/power_allocation/test_pa_rb_env.py | LampV/Reinforcement-Learning | 0652b9e8c2de428d3508074c6fd640cc14f84a2c | [
"MIT"
] | 13 | 2021-04-05T13:10:25.000Z | 2022-03-12T00:51:15.000Z | rl4net/envs/power_allocation/test_pa_rb_env.py | bupt-ipcr/RL4Net | b1b694361c688f5e0055148a0cdcb4c6253cd7bd | [
"MIT"
] | 12 | 2020-03-31T05:29:25.000Z | 2022-03-08T11:54:07.000Z | from .pa_rb_env import (
PAEnv,
Node
)
import numpy as np
from pathlib import Path
log2 = np.log2
cues = {
0: Node(0.1, 0, 'cue'),
1: Node(-0.1, 0, 'cue'),
}
devices = {
0: {
't_device': Node(0, 0.5, 't_device'),
'r_devices': {
0: Node(0, 0.6, 'r_device')
}
... | 30.502976 | 89 | 0.530296 | from .pa_rb_env import (
PAEnv,
Node
)
import numpy as np
from pathlib import Path
log2 = np.log2
cues = {
0: Node(0.1, 0, 'cue'),
1: Node(-0.1, 0, 'cue'),
}
devices = {
0: {
't_device': Node(0, 0.5, 't_device'),
'r_devices': {
0: Node(0, 0.6, 'r_device')
}
... | true | true |
f717a0e970b2703e99561e27a1e128a2f7e5f983 | 488 | py | Python | tests/testFlip.py | FrankRogalski/Riccchard | 8a1abf6855f874f71df9d101e15c1968394ab38e | [
"MIT"
] | null | null | null | tests/testFlip.py | FrankRogalski/Riccchard | 8a1abf6855f874f71df9d101e15c1968394ab38e | [
"MIT"
] | null | null | null | tests/testFlip.py | FrankRogalski/Riccchard | 8a1abf6855f874f71df9d101e15c1968394ab38e | [
"MIT"
] | null | null | null | import unittest
import commands.flip as flip
import pandas as pd
class TestFlip(unittest.TestCase):
def test_use(self):
cycles = 50000
series = pd.Series(flip.use(None) for _ in range(cycles))
self.assertAlmostEqual(len(series[series == "Heads"]) / cycles, 0.4998, delta=0.01)
self.a... | 44.363636 | 91 | 0.67623 | import unittest
import commands.flip as flip
import pandas as pd
class TestFlip(unittest.TestCase):
def test_use(self):
cycles = 50000
series = pd.Series(flip.use(None) for _ in range(cycles))
self.assertAlmostEqual(len(series[series == "Heads"]) / cycles, 0.4998, delta=0.01)
self.a... | true | true |
f717a0f6acd973f0aa1fdd12d14ebe4d62f6382a | 714 | py | Python | src/detection/dataset/__init__.py | inzva/Traffic-Anomaly-Detection | 09bbfd55f5d375832afcc1994d3b549082830594 | [
"MIT"
] | 4 | 2020-05-31T13:19:58.000Z | 2021-03-11T18:51:06.000Z | src/detection/dataset/__init__.py | inzva/Traffic-Anomaly-Detection | 09bbfd55f5d375832afcc1994d3b549082830594 | [
"MIT"
] | null | null | null | src/detection/dataset/__init__.py | inzva/Traffic-Anomaly-Detection | 09bbfd55f5d375832afcc1994d3b549082830594 | [
"MIT"
] | 3 | 2020-05-31T13:19:58.000Z | 2021-03-16T08:43:23.000Z | from .custom import CustomDataset
from .xml_style import XMLDataset
from .coco import CocoDataset
from .voc import VOCDataset
from .loader import GroupSampler, DistributedGroupSampler, build_dataloader
from .utils import to_tensor, random_scale, show_ann, get_dataset
from .concat_dataset import ConcatDataset
from .repe... | 42 | 96 | 0.802521 | from .custom import CustomDataset
from .xml_style import XMLDataset
from .coco import CocoDataset
from .voc import VOCDataset
from .loader import GroupSampler, DistributedGroupSampler, build_dataloader
from .utils import to_tensor, random_scale, show_ann, get_dataset
from .concat_dataset import ConcatDataset
from .repe... | true | true |
f717a12c03c3130be9f4f39624e011168ba2f2d9 | 419 | py | Python | opencv_py/opencv_morphology/blackhat_operation.py | yinleiCoder/interesting-python | 8448b0731870feed033d845c085576a7d4a3154b | [
"Apache-2.0"
] | null | null | null | opencv_py/opencv_morphology/blackhat_operation.py | yinleiCoder/interesting-python | 8448b0731870feed033d845c085576a7d4a3154b | [
"Apache-2.0"
] | null | null | null | opencv_py/opencv_morphology/blackhat_operation.py | yinleiCoder/interesting-python | 8448b0731870feed033d845c085576a7d4a3154b | [
"Apache-2.0"
] | null | null | null | import cv2
import numpy as np
"""
黑帽:
黑帽= 原图 - 闭运算
morphologyEx(img, MORPH_BLACKHAT, kernel)
保留噪点
"""
img = cv2.imread(r'E:\PycharmProjects\funnyPython\opencv_py\data\imgs\dotinj.png')
# kernel = np.ones((7, 7), np.uint8)# 手动创建
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (7, 7))
print(kernel)
res = cv2.morpholo... | 23.277778 | 82 | 0.725537 | import cv2
import numpy as np
img = cv2.imread(r'E:\PycharmProjects\funnyPython\opencv_py\data\imgs\dotinj.png')
l = cv2.getStructuringElement(cv2.MORPH_RECT, (7, 7))
print(kernel)
res = cv2.morphologyEx(img, cv2.MORPH_BLACKHAT, kernel)
cv2.imshow('img', img)
cv2.imshow('res', res)
cv2.waitKey(0) | true | true |
f717a22f1c27c859185f0569c6622ab8d155e4ac | 1,915 | py | Python | src/trainer.py | Chicco94/crypto-bot | edbc22477544a25d8eb0c90cdd5f03345f11db68 | [
"MIT"
] | null | null | null | src/trainer.py | Chicco94/crypto-bot | edbc22477544a25d8eb0c90cdd5f03345f11db68 | [
"MIT"
] | null | null | null | src/trainer.py | Chicco94/crypto-bot | edbc22477544a25d8eb0c90cdd5f03345f11db68 | [
"MIT"
] | null | null | null | from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
import pandas as pd
import sqlalchemy
from config.config import symbol,backward_steps
import joblib
from df_functions import *
def prepare_single_dataset(df,remove_from_heads:int,remove_from_tails:int,label:int):
... | 33.017241 | 85 | 0.681462 | from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
import pandas as pd
import sqlalchemy
from config.config import symbol,backward_steps
import joblib
from df_functions import *
def prepare_single_dataset(df,remove_from_heads:int,remove_from_tails:int,label:int):
... | true | true |
f717a46b3c38e7a991236ce1bb31333e778f6d48 | 300 | py | Python | backend/app/main.py | alldevic/base-fastapi-postgresql | 7e3a2916910155cd83b10cd7fec42eba7b1d3a95 | [
"MIT"
] | 3 | 2021-06-17T00:06:15.000Z | 2022-01-26T03:53:51.000Z | backend/app/main.py | alldevic/base-fastapi-postgresql | 7e3a2916910155cd83b10cd7fec42eba7b1d3a95 | [
"MIT"
] | null | null | null | backend/app/main.py | alldevic/base-fastapi-postgresql | 7e3a2916910155cd83b10cd7fec42eba7b1d3a95 | [
"MIT"
] | null | null | null | from .routes.users import router as user_router
from .application import app
import sys
sys.path.extend(["./"])
ROUTERS = (user_router,)
for r in ROUTERS:
app.include_router(r)
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8888, log_level="info")
| 16.666667 | 65 | 0.693333 | from .routes.users import router as user_router
from .application import app
import sys
sys.path.extend(["./"])
ROUTERS = (user_router,)
for r in ROUTERS:
app.include_router(r)
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8888, log_level="info")
| true | true |
f717a4b4672f82239831e0aa4b03a4aaca187963 | 11,669 | py | Python | tests/test_storage.py | civviGH/otterwiki | 2ef84aa31f48da144cb0ef7a0116106b982f41d2 | [
"MIT"
] | 3 | 2018-07-15T20:20:31.000Z | 2022-01-09T07:41:39.000Z | tests/test_storage.py | civviGH/otterwiki | 2ef84aa31f48da144cb0ef7a0116106b982f41d2 | [
"MIT"
] | 3 | 2018-07-04T21:38:41.000Z | 2022-03-06T17:03:23.000Z | tests/test_storage.py | civviGH/otterwiki | 2ef84aa31f48da144cb0ef7a0116106b982f41d2 | [
"MIT"
] | 2 | 2021-04-29T13:17:56.000Z | 2022-03-07T09:17:19.000Z | #!/usr/bin/env python
import tempfile
import unittest
from pprint import pprint
import otterwiki.storage
class TestStorage(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.TemporaryDirectory()
self.path = '/tmp/xxx' # self.tempdir.name
self.path = self.tempdir.name
se... | 43.70412 | 115 | 0.646756 |
import tempfile
import unittest
from pprint import pprint
import otterwiki.storage
class TestStorage(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.TemporaryDirectory()
self.path = '/tmp/xxx'
self.path = self.tempdir.name
self.storage = otterwiki.storage.GitStorag... | true | true |
f717a54cab0f7211990d1d0fff0102426e318378 | 4,412 | py | Python | TTY_Utils/StatusLine.py | paul-ollis/cleversheep3 | 86e6ca76ea4e8524f16e2348d38484dcfafb07d0 | [
"Apache-2.0"
] | null | null | null | TTY_Utils/StatusLine.py | paul-ollis/cleversheep3 | 86e6ca76ea4e8524f16e2348d38484dcfafb07d0 | [
"Apache-2.0"
] | null | null | null | TTY_Utils/StatusLine.py | paul-ollis/cleversheep3 | 86e6ca76ea4e8524f16e2348d38484dcfafb07d0 | [
"Apache-2.0"
] | null | null | null | import sys
import time
from cleversheep3.TTY_Utils import RichTerm, registerForWinch
class Status:
"""A fairly general purpose status line for a simple terminal.
"""
def __init__(self, startActive=True):
self.setTerm(RichTerm.RichTerminal(sys.stdout))
self.spinner = None
self.pre... | 29.026316 | 75 | 0.486174 | import sys
import time
from cleversheep3.TTY_Utils import RichTerm, registerForWinch
class Status:
def __init__(self, startActive=True):
self.setTerm(RichTerm.RichTerminal(sys.stdout))
self.spinner = None
self.prevLine = None
self.leftFields = []
self.leftFieldsByName = {}... | true | true |
f717a6a6f7df269ba5f932fb06f6150bdffcbc05 | 2,958 | py | Python | etk/unit_tests/test_filter_results.py | linqyd/etk | dcf0cae4076619f5261573d47b4f5f26baaf15b7 | [
"MIT"
] | null | null | null | etk/unit_tests/test_filter_results.py | linqyd/etk | dcf0cae4076619f5261573d47b4f5f26baaf15b7 | [
"MIT"
] | null | null | null | etk/unit_tests/test_filter_results.py | linqyd/etk | dcf0cae4076619f5261573d47b4f5f26baaf15b7 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import unittest
import sys, os
sys.path.append('../../')
from etk.core import Core
import json
import codecs
class TestExtractionsFilterResults(unittest.TestCase):
def test_filter_results(self):
doc = {
"url":"http:www.testurl.com",
"doc_id": "19B0EAB211CD... | 36.518519 | 129 | 0.373563 |
import unittest
import sys, os
sys.path.append('../../')
from etk.core import Core
import json
import codecs
class TestExtractionsFilterResults(unittest.TestCase):
def test_filter_results(self):
doc = {
"url":"http:www.testurl.com",
"doc_id": "19B0EAB211CD1D3C63063FAB0B2937043EA... | true | true |
f717a6c9a05c6c18f54f5308390fe72e04c86105 | 10,727 | py | Python | dataset/cs_labels.py | ChunGaoY/DSPnet | 8fad61059d85ad0cd1f7790c37b5e0478dccb158 | [
"MIT"
] | 33 | 2018-04-18T06:52:16.000Z | 2021-09-26T20:57:56.000Z | dataset/cs_labels.py | ChunGaoY/DSPnet | 8fad61059d85ad0cd1f7790c37b5e0478dccb158 | [
"MIT"
] | 4 | 2018-07-09T07:09:15.000Z | 2020-04-12T12:43:36.000Z | dataset/cs_labels.py | liangfu/dspnet | 8fad61059d85ad0cd1f7790c37b5e0478dccb158 | [
"MIT"
] | 10 | 2018-04-19T08:17:01.000Z | 2021-09-26T20:57:57.000Z | #!/usr/bin/python
#
# Cityscapes labels
#
from collections import namedtuple
#--------------------------------------------------------------------------------
# Definitions
#--------------------------------------------------------------------------------
# a label and all meta information
Label = namedtuple( 'Label... | 58.617486 | 199 | 0.430223 |
from collections import namedtuple
Label = namedtuple( 'Label' , [
'name' ,
'id' ,
'trainId' ,
... | true | true |
f717a7d323d2826aa7fc0c90ce4ba34258907b10 | 1,050 | py | Python | 0301-0400/0391-Perfect Rectangle/0391-Perfect Rectangle.py | jiadaizhao/LeetCode | 4ddea0a532fe7c5d053ffbd6870174ec99fc2d60 | [
"MIT"
] | 49 | 2018-05-05T02:53:10.000Z | 2022-03-30T12:08:09.000Z | 0301-0400/0391-Perfect Rectangle/0391-Perfect Rectangle.py | jolly-fellow/LeetCode | ab20b3ec137ed05fad1edda1c30db04ab355486f | [
"MIT"
] | 11 | 2017-12-15T22:31:44.000Z | 2020-10-02T12:42:49.000Z | 0301-0400/0391-Perfect Rectangle/0391-Perfect Rectangle.py | jolly-fellow/LeetCode | ab20b3ec137ed05fad1edda1c30db04ab355486f | [
"MIT"
] | 28 | 2017-12-05T10:56:51.000Z | 2022-01-26T18:18:27.000Z | import math
class Solution:
def isRectangleCover(self, rectangles: 'List[List[int]]') -> 'bool':
area = 0
x1 = y1 = math.inf
x2 = y2 = -math.inf
table = set()
for rec in rectangles:
x1 = min(x1, rec[0])
y1 = min(y1, rec[1])
x2 = max(x2, rec... | 37.5 | 93 | 0.414286 | import math
class Solution:
def isRectangleCover(self, rectangles: 'List[List[int]]') -> 'bool':
area = 0
x1 = y1 = math.inf
x2 = y2 = -math.inf
table = set()
for rec in rectangles:
x1 = min(x1, rec[0])
y1 = min(y1, rec[1])
x2 = max(x2, rec... | true | true |
f717a8e5702adf2484d162a384d9cd7e1c5d590d | 2,944 | py | Python | tests/test_sftp.py | lfbos/qftplib | 2a1b79c7f36cc2dfd139a7a3d179fb23f7c6dc1f | [
"MIT"
] | null | null | null | tests/test_sftp.py | lfbos/qftplib | 2a1b79c7f36cc2dfd139a7a3d179fb23f7c6dc1f | [
"MIT"
] | null | null | null | tests/test_sftp.py | lfbos/qftplib | 2a1b79c7f36cc2dfd139a7a3d179fb23f7c6dc1f | [
"MIT"
] | null | null | null | import os
import tempfile
import time
import unittest
from qftplib.client import FTPClient
class FTPTest(unittest.TestCase):
host = os.environ.get('SFTP_HOST_TEST')
user = os.environ.get('SFTP_USER_TEST')
password = os.environ.get('SFTP_PASS_TEST')
dir = os.environ.get('SFTP_DIR_TEST')
port = 22
... | 35.047619 | 117 | 0.605978 | import os
import tempfile
import time
import unittest
from qftplib.client import FTPClient
class FTPTest(unittest.TestCase):
host = os.environ.get('SFTP_HOST_TEST')
user = os.environ.get('SFTP_USER_TEST')
password = os.environ.get('SFTP_PASS_TEST')
dir = os.environ.get('SFTP_DIR_TEST')
port = 22
... | true | true |
f717a96bf2f36b05dfb39bd231a309d8afe03392 | 723 | py | Python | django-rest-framework-quick-start/tutorial/quickstart/views.py | madhikarma/python-django-demo | d18ca7e25d01f12813cd6e011ae253e792ac2d03 | [
"MIT"
] | null | null | null | django-rest-framework-quick-start/tutorial/quickstart/views.py | madhikarma/python-django-demo | d18ca7e25d01f12813cd6e011ae253e792ac2d03 | [
"MIT"
] | null | null | null | django-rest-framework-quick-start/tutorial/quickstart/views.py | madhikarma/python-django-demo | d18ca7e25d01f12813cd6e011ae253e792ac2d03 | [
"MIT"
] | null | null | null | from django.contrib.auth.models import User, Group
from rest_framework import viewsets
from rest_framework import permissions
from tutorial.quickstart.serializers import UserSerializer, GroupSerializer
class UserViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows users to be viewed or edited.
"""... | 31.434783 | 75 | 0.763485 | from django.contrib.auth.models import User, Group
from rest_framework import viewsets
from rest_framework import permissions
from tutorial.quickstart.serializers import UserSerializer, GroupSerializer
class UserViewSet(viewsets.ModelViewSet):
queryset = User.objects.all().order_by('-date_joined')
serializer_... | true | true |
f717a97ac0ae713afc793d70fe3a8c677d331876 | 767 | py | Python | yatube/posts/migrations/0004_auto_20210318_1753.py | Rusich90/yatube | 8593443fe64b0422b2ebbedc9966d347a668e0a3 | [
"BSD-3-Clause"
] | 1 | 2021-06-06T11:15:57.000Z | 2021-06-06T11:15:57.000Z | yatube/posts/migrations/0004_auto_20210318_1753.py | Rusich90/yatube | 8593443fe64b0422b2ebbedc9966d347a668e0a3 | [
"BSD-3-Clause"
] | null | null | null | yatube/posts/migrations/0004_auto_20210318_1753.py | Rusich90/yatube | 8593443fe64b0422b2ebbedc9966d347a668e0a3 | [
"BSD-3-Clause"
] | 1 | 2021-06-06T11:15:58.000Z | 2021-06-06T11:15:58.000Z | # Generated by Django 2.2 on 2021-03-18 17:53
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('posts', '0003_auto_20210307_1711'),
]
operations = [
migrations.AlterField(
model_name='post',
... | 30.68 | 222 | 0.636245 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('posts', '0003_auto_20210307_1711'),
]
operations = [
migrations.AlterField(
model_name='post',
name='group',
field=mod... | true | true |
f717aa4a2dd6cc01429db2f797d20ef18a428275 | 8,080 | py | Python | neutron/services/trunk/rpc/server.py | knodir/neutron | ac4e28478ac8a8a0c9f5c5785f6a6bcf532c66b8 | [
"Apache-2.0"
] | null | null | null | neutron/services/trunk/rpc/server.py | knodir/neutron | ac4e28478ac8a8a0c9f5c5785f6a6bcf532c66b8 | [
"Apache-2.0"
] | 5 | 2019-08-14T06:46:03.000Z | 2021-12-13T20:01:25.000Z | neutron/services/trunk/rpc/server.py | knodir/neutron | ac4e28478ac8a8a0c9f5c5785f6a6bcf532c66b8 | [
"Apache-2.0"
] | 2 | 2020-03-15T01:24:15.000Z | 2020-07-22T20:34:26.000Z | # Copyright 2016 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-2.0
#
# Unless required by applicable... | 41.865285 | 78 | 0.664604 |
import collections
from neutron_lib.api.definitions import portbindings
from neutron_lib.db import api as db_api
from neutron_lib.plugins import directory
from neutron_lib import rpc as n_rpc
from oslo_log import helpers as log_helpers
from oslo_log import log as logging
import oslo_messaging
from neutr... | true | true |
f717aaa141f06ebfe41236718707dffb420687d5 | 11,262 | py | Python | mars/worker/service.py | wdkwyf/mars | 3f750e360e64380eab779301a5103994d4886b6a | [
"Apache-2.0"
] | null | null | null | mars/worker/service.py | wdkwyf/mars | 3f750e360e64380eab779301a5103994d4886b6a | [
"Apache-2.0"
] | null | null | null | mars/worker/service.py | wdkwyf/mars | 3f750e360e64380eab779301a5103994d4886b6a | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 1999-2018 Alibaba Group Holding Ltd.
#
# 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... | 42.659091 | 109 | 0.665335 |
import os
import logging
try:
from pyarrow import plasma
except ImportError:
plasma = None
from ..config import options
from .. import resource
from ..utils import parse_readable_size, readable_size
from ..compat import six
from .status import StatusActor
from .quota import QuotaActor, MemQuo... | true | true |
f717ac92ce24bf53f59cb78906005b06e6b861f3 | 483 | py | Python | final_project/machinetranslation/tests/test_translator.py | BrunoYH/xzceb-flask_eng_fr | a86a32ef56fcae1a8a9e281f17eb73dca05aec10 | [
"Apache-2.0"
] | null | null | null | final_project/machinetranslation/tests/test_translator.py | BrunoYH/xzceb-flask_eng_fr | a86a32ef56fcae1a8a9e281f17eb73dca05aec10 | [
"Apache-2.0"
] | null | null | null | final_project/machinetranslation/tests/test_translator.py | BrunoYH/xzceb-flask_eng_fr | a86a32ef56fcae1a8a9e281f17eb73dca05aec10 | [
"Apache-2.0"
] | null | null | null | import unittest
from translator import english_to_french, french_to_english
class TestEnglishToFrench(unittest.TestCase):
def testE2F(self):
self.assertEqual(english_to_french("Hello"), "Bonjour")
self.assertNotEqual(english_to_french("Null"), "")
class FrenchEnglishToEnglish(unittest.TestCase):... | 30.1875 | 63 | 0.73913 | import unittest
from translator import english_to_french, french_to_english
class TestEnglishToFrench(unittest.TestCase):
def testE2F(self):
self.assertEqual(english_to_french("Hello"), "Bonjour")
self.assertNotEqual(english_to_french("Null"), "")
class FrenchEnglishToEnglish(unittest.TestCase):... | true | true |
f717ad7f8ee5170fed096dfbfb9360232cb0abc4 | 157,342 | py | Python | tests/test_cadquery.py | RubenRubens/cadquery | 94030ad5e4d5489b29cb021282ecc8db34172471 | [
"Apache-2.0"
] | 1 | 2021-09-01T20:16:29.000Z | 2021-09-01T20:16:29.000Z | tests/test_cadquery.py | RubenRubens/cadquery | 94030ad5e4d5489b29cb021282ecc8db34172471 | [
"Apache-2.0"
] | null | null | null | tests/test_cadquery.py | RubenRubens/cadquery | 94030ad5e4d5489b29cb021282ecc8db34172471 | [
"Apache-2.0"
] | null | null | null | """
This module tests cadquery creation and manipulation functions
"""
# system modules
import math, os.path, time, tempfile
from random import choice
from random import random
from random import randrange
from itertools import product
from pytest import approx, raises
# my modules
from cadquery import *
from c... | 33.749893 | 164 | 0.528441 |
import math, os.path, time, tempfile
from random import choice
from random import random
from random import randrange
from itertools import product
from pytest import approx, raises
from cadquery import *
from cadquery import exporters
from cadquery import occ_impl
from tests import (
BaseTest,
writeString... | true | true |
f717ae14e4c0f23eb4e044fafbe02e361dc9be71 | 6,397 | py | Python | src/datadog_api_client/v2/model/incident_service_update_data.py | DataDog/datadog-api-client-python | de2fc57dbde9acf4b8c8eef94ac29911227a62a2 | [
"Apache-2.0"
] | 32 | 2021-01-07T15:09:56.000Z | 2022-01-30T05:49:23.000Z | src/datadog_api_client/v2/model/incident_service_update_data.py | DataDog/datadog-api-client-python | de2fc57dbde9acf4b8c8eef94ac29911227a62a2 | [
"Apache-2.0"
] | 228 | 2020-09-03T14:03:54.000Z | 2022-03-31T20:16:12.000Z | src/datadog_api_client/v2/model/incident_service_update_data.py | DataDog/datadog-api-client-python | de2fc57dbde9acf4b8c8eef94ac29911227a62a2 | [
"Apache-2.0"
] | 12 | 2020-09-15T21:36:03.000Z | 2022-03-31T17:13:17.000Z | # Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from datadog_api_client.v2.model_utils import ( # noqa: F401
ApiTypeError,
Mo... | 41.810458 | 110 | 0.612318 |
from datadog_api_client.v2.model_utils import (
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
)
def lazy_import():
from datadog_api_client.v2... | true | true |
f717ae4b52146d6d410534878463dfe84c747e04 | 1,598 | py | Python | configs/lesa/lesa_mask_rcnn_r50_dconv_c3-c5_8x1_20e.py | Chenglin-Yang/LESA_detection | 3238bd9c6f3eb4a2a746837043cd9b3b56c77216 | [
"Apache-2.0"
] | 4 | 2021-07-18T08:09:09.000Z | 2022-01-06T06:19:00.000Z | configs/lesa/lesa_mask_rcnn_r50_dconv_c3-c5_8x1_20e.py | Chenglin-Yang/LESA_detection | 3238bd9c6f3eb4a2a746837043cd9b3b56c77216 | [
"Apache-2.0"
] | null | null | null | configs/lesa/lesa_mask_rcnn_r50_dconv_c3-c5_8x1_20e.py | Chenglin-Yang/LESA_detection | 3238bd9c6f3eb4a2a746837043cd9b3b56c77216 | [
"Apache-2.0"
] | 1 | 2022-01-06T06:18:53.000Z | 2022-01-06T06:18:53.000Z | _base_ = [
'../_base_/models/mask_rcnn_r50_fpn.py',
'../_base_/datasets/coco_instance_1024.py',
'../_base_/schedules/schedule_20e.py',
'../_base_/default_runtime.py',
]
optimizer = dict(lr=0.01)
model = dict(
pretrained=\
'./checkpoints/lesa_pretrained_imagenet/'+\
'lesa_resnet50_pre... | 28.535714 | 98 | 0.570088 | _base_ = [
'../_base_/models/mask_rcnn_r50_fpn.py',
'../_base_/datasets/coco_instance_1024.py',
'../_base_/schedules/schedule_20e.py',
'../_base_/default_runtime.py',
]
optimizer = dict(lr=0.01)
model = dict(
pretrained=\
'./checkpoints/lesa_pretrained_imagenet/'+\
'lesa_resnet50_pre... | true | true |
f717aeda2009266b9983c6e194696efc982f1189 | 1,312 | py | Python | injectable/testing/clear_injectables_util.py | mt3o/injectable | 0ffc5c758b63d9391134cd822158e1846999b404 | [
"MIT"
] | 71 | 2018-02-05T04:12:27.000Z | 2022-02-15T23:08:16.000Z | injectable/testing/clear_injectables_util.py | Euraxluo/injectable | 74e640f0911480fb06fa97c1a468c3863541c0fd | [
"MIT"
] | 104 | 2018-02-06T23:37:36.000Z | 2021-08-25T04:50:15.000Z | injectable/testing/clear_injectables_util.py | Euraxluo/injectable | 74e640f0911480fb06fa97c1a468c3863541c0fd | [
"MIT"
] | 13 | 2019-02-10T18:52:50.000Z | 2022-01-26T17:12:35.000Z | from typing import Union, Set
from injectable import InjectionContainer
from injectable.common_utils import get_dependency_name
from injectable.container.injectable import Injectable
from injectable.constants import DEFAULT_NAMESPACE
def clear_injectables(
dependency: Union[type, str], namespace: str = None
) ->... | 36.444444 | 86 | 0.747713 | from typing import Union, Set
from injectable import InjectionContainer
from injectable.common_utils import get_dependency_name
from injectable.container.injectable import Injectable
from injectable.constants import DEFAULT_NAMESPACE
def clear_injectables(
dependency: Union[type, str], namespace: str = None
) ->... | true | true |
f717afa83d677a0b51cae1b85b8a1bc081942f7a | 5,143 | py | Python | setup.py | lead-ratings/python-nvd3 | 2e677886d7b36f3aca641bbb2cc1117c3589b849 | [
"MIT"
] | null | null | null | setup.py | lead-ratings/python-nvd3 | 2e677886d7b36f3aca641bbb2cc1117c3589b849 | [
"MIT"
] | null | null | null | setup.py | lead-ratings/python-nvd3 | 2e677886d7b36f3aca641bbb2cc1117c3589b849 | [
"MIT"
] | null | null | null | #! /usr/bin/env python
# coding=utf-8
import os
from setuptools import setup, find_packages
from fnmatch import fnmatchcase
from distutils.util import convert_path
def read(*parts):
return open(os.path.join(os.path.dirname(__file__), *parts)).read()
# Provided as an attribute, so you can append to these instea... | 36.735714 | 88 | 0.569512 |
import os
from setuptools import setup, find_packages
from fnmatch import fnmatchcase
from distutils.util import convert_path
def read(*parts):
return open(os.path.join(os.path.dirname(__file__), *parts)).read()
standard_exclude = ('*.py', '*.pyc', '*$py.class', '*~', '.*', '*.bak')
standard_exclude_direct... | true | true |
f717afcac3389e0e78ff975905922f94ec7b01ce | 55,864 | py | Python | lib/arrow/arrow.py | matke-84/script.module.arrow | 7aa0903bc846541e4d620f10aca52957ba1e0e5b | [
"Apache-2.0"
] | null | null | null | lib/arrow/arrow.py | matke-84/script.module.arrow | 7aa0903bc846541e4d620f10aca52957ba1e0e5b | [
"Apache-2.0"
] | null | null | null | lib/arrow/arrow.py | matke-84/script.module.arrow | 7aa0903bc846541e4d620f10aca52957ba1e0e5b | [
"Apache-2.0"
] | null | null | null | """
Provides the :class:`Arrow <arrow.arrow.Arrow>` class, an enhanced ``datetime``
replacement.
"""
import calendar
import sys
from datetime import date
from datetime import datetime as dt_datetime
from datetime import time as dt_time
from datetime import timedelta
from datetime import tzinfo as dt_tzinfo
from math... | 32.47907 | 132 | 0.551751 |
import calendar
import sys
from datetime import date
from datetime import datetime as dt_datetime
from datetime import time as dt_time
from datetime import timedelta
from datetime import tzinfo as dt_tzinfo
from math import trunc
from time import struct_time
from typing import (
Any,
ClassVar,
Generator,
... | true | true |
f717aff2b542befa776d914dfd5cc573bbed5908 | 2,681 | py | Python | make/photon/prepare/main.py | gaohuag/harbor | ebe2df06c84c3b6be33901e71d9bf14e80a4c003 | [
"Apache-2.0"
] | 1 | 2019-10-24T07:11:38.000Z | 2019-10-24T07:11:38.000Z | make/photon/prepare/main.py | gaohuag/harbor | ebe2df06c84c3b6be33901e71d9bf14e80a4c003 | [
"Apache-2.0"
] | null | null | null | make/photon/prepare/main.py | gaohuag/harbor | ebe2df06c84c3b6be33901e71d9bf14e80a4c003 | [
"Apache-2.0"
] | null | null | null | # pylint: disable=no-value-for-parameter
import click
from utils.misc import delfile
from utils.configs import validate, parse_yaml_config
from utils.cert import prepare_ca, SSL_CERT_KEY_PATH, SSL_CERT_PATH, get_secret_key
from utils.db import prepare_db
from utils.jobservice import prepare_job_service
from utils.reg... | 40.621212 | 128 | 0.806043 |
import click
from utils.misc import delfile
from utils.configs import validate, parse_yaml_config
from utils.cert import prepare_ca, SSL_CERT_KEY_PATH, SSL_CERT_PATH, get_secret_key
from utils.db import prepare_db
from utils.jobservice import prepare_job_service
from utils.registry import prepare_registry
from utils... | true | true |
f717b0f7dc65a5798b28471eda50f0d297865349 | 3,637 | py | Python | dendropy/dataio/nexmlyielder.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | dendropy/dataio/nexmlyielder.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | dendropy/dataio/nexmlyielder.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | #! /usr/bin/env python
##############################################################################
## DendroPy Phylogenetic Computing Library.
##
## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder.
## All rights reserved.
##
## See "LICENSE.rst" for terms and conditions of usage.
##
## If you use this wo... | 40.865169 | 103 | 0.607369 | true | true | |
f717b173935cbd0d7770fed38f1c470436bb75f4 | 970 | py | Python | tests/testNextRule.py | andersonjwan/tltk-mtl-ext | a4f0314df6c55d532b7f9d169b6d08bff3811ef3 | [
"BSD-3-Clause"
] | 1 | 2020-12-11T21:32:46.000Z | 2020-12-11T21:32:46.000Z | tests/testNextRule.py | andersonjwan/tltk-mtl-ext | a4f0314df6c55d532b7f9d169b6d08bff3811ef3 | [
"BSD-3-Clause"
] | null | null | null | tests/testNextRule.py | andersonjwan/tltk-mtl-ext | a4f0314df6c55d532b7f9d169b6d08bff3811ef3 | [
"BSD-3-Clause"
] | null | null | null | import tltk_mtl as MTL
import tltk_mtl_ext as MTLE
def testNextRule():
preds = {}
preds['pred1'] = MTL.Predicate('pred1', 1, 2)
preds['pred2'] = MTL.Predicate('pred2', 2, 4)
preds['pred3'] = MTL.Predicate('pred3', 4, 8)
assert isinstance(MTLE.parse_mtl('next pred1', preds), MTL.Next), printFail(1)
printPass(1)... | 34.642857 | 100 | 0.689691 | import tltk_mtl as MTL
import tltk_mtl_ext as MTLE
def testNextRule():
preds = {}
preds['pred1'] = MTL.Predicate('pred1', 1, 2)
preds['pred2'] = MTL.Predicate('pred2', 2, 4)
preds['pred3'] = MTL.Predicate('pred3', 4, 8)
assert isinstance(MTLE.parse_mtl('next pred1', preds), MTL.Next), printFail(1)
printPass(1)... | true | true |
f717b362c8813b8acd724ce809248566680836c5 | 591 | py | Python | data & result/history.py | robinzixuan/Dialog_Act_Bert_Classification | 014cc8df0545e5bf85a22127e63e8490f3aa9012 | [
"MIT"
] | null | null | null | data & result/history.py | robinzixuan/Dialog_Act_Bert_Classification | 014cc8df0545e5bf85a22127e63e8490f3aa9012 | [
"MIT"
] | null | null | null | data & result/history.py | robinzixuan/Dialog_Act_Bert_Classification | 014cc8df0545e5bf85a22127e63e8490f3aa9012 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 30 20:49:32 2019
@author: rluo
"""
import keras
import matplotlib.pyplot as plt
from keras.models import load_model
import pickle
history = pickle.load(open('history.p','rb'))
plt.plot(history['loss'])
#plt.plot(history['val_loss'])
plt.title('mod... | 19.7 | 48 | 0.683587 |
import keras
import matplotlib.pyplot as plt
from keras.models import load_model
import pickle
history = pickle.load(open('history.p','rb'))
plt.plot(history['loss'])
plt.title('model loss')
plt.ylabel('loss')
plt.xlabel('Epoch')
plt.legend(['train', 'test'], loc='upper left');
plt.plot(history['acc'])
plt.title(... | true | true |
f717b38081c7eaa8fa44370f116ae44f650ba3cb | 689 | py | Python | examples/seq2seq/paraphrasing/predict.py | liorshk/simpletransformers | 226cf4d11edf5157c1beafcc44aaa78f65ccc985 | [
"Apache-2.0"
] | 3,151 | 2019-10-05T11:14:44.000Z | 2022-03-31T17:02:54.000Z | examples/seq2seq/paraphrasing/predict.py | liorshk/simpletransformers | 226cf4d11edf5157c1beafcc44aaa78f65ccc985 | [
"Apache-2.0"
] | 1,165 | 2019-10-05T14:48:55.000Z | 2022-03-31T11:12:58.000Z | examples/seq2seq/paraphrasing/predict.py | liorshk/simpletransformers | 226cf4d11edf5157c1beafcc44aaa78f65ccc985 | [
"Apache-2.0"
] | 739 | 2019-10-06T15:11:54.000Z | 2022-03-28T11:07:36.000Z | import logging
from simpletransformers.seq2seq import Seq2SeqModel
logging.basicConfig(level=logging.INFO)
transformers_logger = logging.getLogger("transformers")
transformers_logger.setLevel(logging.ERROR)
model = Seq2SeqModel(encoder_decoder_type="bart", encoder_decoder_name="outputs")
while True:
original ... | 23.758621 | 81 | 0.593614 | import logging
from simpletransformers.seq2seq import Seq2SeqModel
logging.basicConfig(level=logging.INFO)
transformers_logger = logging.getLogger("transformers")
transformers_logger.setLevel(logging.ERROR)
model = Seq2SeqModel(encoder_decoder_type="bart", encoder_decoder_name="outputs")
while True:
original ... | true | true |
f717b4377f6a9a74d53a66640675d4744b9f7a3a | 2,171 | py | Python | app.py | dennisfarmer/Ensemble-Video-Downloader | fa3cb334f9140b5fecdfcb1c2ee6020743a484a7 | [
"MIT"
] | null | null | null | app.py | dennisfarmer/Ensemble-Video-Downloader | fa3cb334f9140b5fecdfcb1c2ee6020743a484a7 | [
"MIT"
] | 1 | 2021-08-02T19:08:13.000Z | 2021-08-03T02:35:49.000Z | app.py | dennisfarmer/Ensemble-Video-Downloader | fa3cb334f9140b5fecdfcb1c2ee6020743a484a7 | [
"MIT"
] | 1 | 2021-08-03T04:44:13.000Z | 2021-08-03T04:44:13.000Z | from PyQt5.QtWidgets import QApplication,QWidget,QTextEdit,QVBoxLayout,QPushButton
from link_converter import convert_url
import pyperclip
import sys
class LinkConverter(QWidget):
def __init__(self,parent=None):
super().__init__(parent)
self.setWindowTitle("Ensemblevideo Link Converter - Dennis Fa... | 39.472727 | 624 | 0.738369 | from PyQt5.QtWidgets import QApplication,QWidget,QTextEdit,QVBoxLayout,QPushButton
from link_converter import convert_url
import pyperclip
import sys
class LinkConverter(QWidget):
def __init__(self,parent=None):
super().__init__(parent)
self.setWindowTitle("Ensemblevideo Link Converter - Dennis Fa... | true | true |
f717b45b3fbcc04aefd659d8153dad422e2f094b | 3,280 | py | Python | test/optimization/test_vertex_cover.py | kareem1925/qiskit-aqua | 7056f9bdd9ece32c41e162faecdcd24cf483da6f | [
"Apache-2.0"
] | null | null | null | test/optimization/test_vertex_cover.py | kareem1925/qiskit-aqua | 7056f9bdd9ece32c41e162faecdcd24cf483da6f | [
"Apache-2.0"
] | null | null | null | test/optimization/test_vertex_cover.py | kareem1925/qiskit-aqua | 7056f9bdd9ece32c41e162faecdcd24cf483da6f | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | 36.043956 | 90 | 0.655488 |
import unittest
from test.optimization import QiskitOptimizationTestCase
import numpy as np
from qiskit import BasicAer
from qiskit.aqua import aqua_globals, QuantumInstance
from qiskit.optimization.applications.ising import vertex_cover
from qiskit.optimization.applications.ising.common import random_g... | true | true |
f717b6f0791909056e625635779049e23c7cb669 | 1,651 | py | Python | scripts/test.py | JIC-Image-Analysis/find-plasmodesmata-dockerised | 940afd85687b8383203f65da586da58a234e2deb | [
"MIT"
] | null | null | null | scripts/test.py | JIC-Image-Analysis/find-plasmodesmata-dockerised | 940afd85687b8383203f65da586da58a234e2deb | [
"MIT"
] | null | null | null | scripts/test.py | JIC-Image-Analysis/find-plasmodesmata-dockerised | 940afd85687b8383203f65da586da58a234e2deb | [
"MIT"
] | null | null | null | """Functional test."""
import os
import os.path
from jicbioimage.core.image import MicroscopyCollection
from jicbioimage.core.io import (
AutoName,
DataManager,
FileBackend,
_md5_hexdigest_from_file,
)
from plasmodesmata_analysis import plasmodesmata_analysis
def test_plasmodesmata_analysis():
o... | 30.018182 | 75 | 0.69473 |
import os
import os.path
from jicbioimage.core.image import MicroscopyCollection
from jicbioimage.core.io import (
AutoName,
DataManager,
FileBackend,
_md5_hexdigest_from_file,
)
from plasmodesmata_analysis import plasmodesmata_analysis
def test_plasmodesmata_analysis():
output_dir = "/output/tm... | true | true |
f717b71efc824a722853352eee8071fc691d8c22 | 2,118 | py | Python | airflow/providers/amazon/aws/example_dags/example_s3_bucket.py | jpsalado92/airflow | 6776586904ab2a15727dcfc1c8d03c7a32a78444 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 27 | 2019-02-25T14:20:36.000Z | 2022-03-22T09:35:13.000Z | airflow/providers/amazon/aws/example_dags/example_s3_bucket.py | sdwivedi565/airflow | 78e4d16d970dbcb599d9c7f8df2a1a4273649ae8 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 200 | 2019-01-09T15:33:06.000Z | 2022-01-12T09:13:42.000Z | airflow/providers/amazon/aws/example_dags/example_s3_bucket.py | MatrixManAtYrService/airflow-challenge | cef498efe9f4818e5f8e85c179ca730e84b31f4a | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 14 | 2019-06-25T17:08:29.000Z | 2022-03-29T13:25:53.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... | 34.721311 | 100 | 0.742682 |
import os
from datetime import datetime
from airflow.decorators import task
from airflow.models.dag import DAG
from airflow.providers.amazon.aws.hooks.s3 import S3Hook
from airflow.providers.amazon.aws.operators.s3 import S3CreateBucketOperator, S3DeleteBucketOperator
BUCKET_NAME = os.environ.get('BUC... | true | true |
f717b89a3172f1c4b9bc6e5d62033e37e8a5b95c | 753 | py | Python | modulos/utils.py | oliverfaustino/NRPG-DataManager | 71064cb79be304f712aabcceebd6647121d2cb6c | [
"MIT"
] | null | null | null | modulos/utils.py | oliverfaustino/NRPG-DataManager | 71064cb79be304f712aabcceebd6647121d2cb6c | [
"MIT"
] | null | null | null | modulos/utils.py | oliverfaustino/NRPG-DataManager | 71064cb79be304f712aabcceebd6647121d2cb6c | [
"MIT"
] | null | null | null | import pyperclip
import pandas as pd
from modulos.conecao import *
def copiar(objeto): # função para copiar os objetos para área de transferência
global copiar # para resolver o porblema UnboundLocalError: local variable 'copiar' referenced before assignment:
opcao = int(input('Deseja copiar para área de tr... | 25.965517 | 131 | 0.654714 | import pyperclip
import pandas as pd
from modulos.conecao import *
def copiar(objeto):
global copiar
opcao = int(input('Deseja copiar para área de transferência? "1" para sim e qualquer tecla para não\n\nR: '))
if opcao == 1:
copiar = pyperclip.copy(objeto)
print('\nC... | true | true |
f717b8e1b7a02ea373928b5f35b6948527803150 | 5,822 | py | Python | tests/admin_views/test_templatetags.py | downstreamimpact/django | 6686238cdc5c826ca5aab39d771798ff98e90ae8 | [
"CNRI-Python-GPL-Compatible",
"BSD-3-Clause"
] | 7 | 2020-01-13T18:26:41.000Z | 2021-04-20T04:22:26.000Z | tests/admin_views/test_templatetags.py | downstreamimpact/django | 6686238cdc5c826ca5aab39d771798ff98e90ae8 | [
"CNRI-Python-GPL-Compatible",
"BSD-3-Clause"
] | null | null | null | tests/admin_views/test_templatetags.py | downstreamimpact/django | 6686238cdc5c826ca5aab39d771798ff98e90ae8 | [
"CNRI-Python-GPL-Compatible",
"BSD-3-Clause"
] | 4 | 2019-11-07T01:22:16.000Z | 2020-09-16T22:02:16.000Z | import datetime
from django.contrib.admin import ModelAdmin
from django.contrib.admin.templatetags.admin_list import date_hierarchy
from django.contrib.admin.templatetags.admin_modify import submit_row
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.test import R... | 44.442748 | 118 | 0.643422 | import datetime
from django.contrib.admin import ModelAdmin
from django.contrib.admin.templatetags.admin_list import date_hierarchy
from django.contrib.admin.templatetags.admin_modify import submit_row
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.test import R... | true | true |
f717b91705d7d8a081fb14e5a9579959e466aa1f | 28,392 | py | Python | allennlp/models/semantic_parsing/atis/atis_semantic_parser.py | ljch2018/allennlp | 63ba3fb28897578d4798039d1713e2b7995eb753 | [
"Apache-2.0"
] | null | null | null | allennlp/models/semantic_parsing/atis/atis_semantic_parser.py | ljch2018/allennlp | 63ba3fb28897578d4798039d1713e2b7995eb753 | [
"Apache-2.0"
] | null | null | null | allennlp/models/semantic_parsing/atis/atis_semantic_parser.py | ljch2018/allennlp | 63ba3fb28897578d4798039d1713e2b7995eb753 | [
"Apache-2.0"
] | null | null | null | import logging
from typing import Any, Dict, List, Tuple
import difflib
import sqlparse
from overrides import overrides
import torch
from allennlp.common.util import pad_sequence_to_length
from allennlp.data import Vocabulary
from allennlp.data.fields.production_rule_field import ProductionRuleArray
from allennlp.sem... | 54.705202 | 112 | 0.61151 | import logging
from typing import Any, Dict, List, Tuple
import difflib
import sqlparse
from overrides import overrides
import torch
from allennlp.common.util import pad_sequence_to_length
from allennlp.data import Vocabulary
from allennlp.data.fields.production_rule_field import ProductionRuleArray
from allennlp.sem... | true | true |
f717ba6db19fac8fe6c6bc3c5388211b577e2db4 | 871 | py | Python | tests/unit/fake_data_root/kubernetes/var/lib/juju/agents/unit-containerd-2/charm/hooks/relations/untrusted-container-runtime/requires.py | KellenRenshaw/hotsos | e3fc51ab7f8af606a5846a3486a7fda23d761583 | [
"Apache-2.0"
] | 6 | 2021-10-01T19:46:14.000Z | 2022-03-31T17:05:08.000Z | tests/unit/fake_data_root/kubernetes/var/lib/juju/agents/unit-containerd-2/charm/hooks/relations/untrusted-container-runtime/requires.py | KellenRenshaw/hotsos | e3fc51ab7f8af606a5846a3486a7fda23d761583 | [
"Apache-2.0"
] | 111 | 2021-10-01T18:18:17.000Z | 2022-03-29T12:23:20.000Z | tests/unit/fake_data_root/kubernetes/var/lib/juju/agents/unit-containerd-2/charm/hooks/relations/untrusted-container-runtime/requires.py | KellenRenshaw/hotsos | e3fc51ab7f8af606a5846a3486a7fda23d761583 | [
"Apache-2.0"
] | 10 | 2021-09-29T14:47:54.000Z | 2022-03-18T14:52:16.000Z | from charms.reactive import (
Endpoint,
set_flag,
clear_flag
)
from charms.reactive import (
when,
when_not
)
class ContainerRuntimeRequires(Endpoint):
@when('endpoint.{endpoint_name}.changed')
def changed(self):
set_flag(self.expand_name('endpoint.{endpoint_name}.available'))
... | 24.885714 | 74 | 0.626866 | from charms.reactive import (
Endpoint,
set_flag,
clear_flag
)
from charms.reactive import (
when,
when_not
)
class ContainerRuntimeRequires(Endpoint):
@when('endpoint.{endpoint_name}.changed')
def changed(self):
set_flag(self.expand_name('endpoint.{endpoint_name}.available'))
... | true | true |
f717ba7e0a6e1a58c6c5756909c027da10c010bb | 878 | py | Python | read_exif.py | kiyoon/camera-tools | 2e269141597dd27ec7d41e49285e01ef566cb54c | [
"MIT"
] | 1 | 2021-11-14T23:30:47.000Z | 2021-11-14T23:30:47.000Z | read_exif.py | kiyoon/camera-tools | 2e269141597dd27ec7d41e49285e01ef566cb54c | [
"MIT"
] | null | null | null | read_exif.py | kiyoon/camera-tools | 2e269141597dd27ec7d41e49285e01ef566cb54c | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import argparse
class Formatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptionHelpFormatter):
pass
parser = argparse.ArgumentParser(
description='''Read EXIF data
Author: Kiyoon Kim (yoonkr33@gmail.com)''',
formatter_class=Formatter)
parser.add_argument('i... | 24.388889 | 94 | 0.671982 |
import argparse
class Formatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptionHelpFormatter):
pass
parser = argparse.ArgumentParser(
description='''Read EXIF data
Author: Kiyoon Kim (yoonkr33@gmail.com)''',
formatter_class=Formatter)
parser.add_argument('input_files', type=str,... | true | true |
f717bcdd89a1615aae5c49e9f6e2cbe27aa71630 | 458 | py | Python | ProjectShop/ProductApp/urls.py | kolyasalubov/ProjectShop | 41a62d27276542bf65aab51663220ffe88858024 | [
"MIT"
] | 3 | 2021-08-30T09:15:52.000Z | 2022-03-24T14:40:11.000Z | ProjectShop/ProductApp/urls.py | kolyasalubov/ProjectShop | 41a62d27276542bf65aab51663220ffe88858024 | [
"MIT"
] | 150 | 2021-08-30T12:37:17.000Z | 2021-11-17T07:09:19.000Z | ProjectShop/ProductApp/urls.py | kolyasalubov/ProjectShop | 41a62d27276542bf65aab51663220ffe88858024 | [
"MIT"
] | null | null | null | from django.urls import path
from ProductApp.views import (
HomePageView,
CategoriesView,
ProductDetailView,
CategoryDetailView,
)
urlpatterns = [
path("categories/<slug:slug>/", CategoryDetailView.as_view(), name="category-detail"),
path("categories/", CategoriesView.as_view(), name="categor... | 26.941176 | 90 | 0.696507 | from django.urls import path
from ProductApp.views import (
HomePageView,
CategoriesView,
ProductDetailView,
CategoryDetailView,
)
urlpatterns = [
path("categories/<slug:slug>/", CategoryDetailView.as_view(), name="category-detail"),
path("categories/", CategoriesView.as_view(), name="categor... | true | true |
f717bdb31e80489aaefa7fbd595c263379b27f37 | 15,376 | py | Python | src/hub/dataload/sources/chembl/chembl_upload.py | ravila4/mychem.info | 9b63b5f0957b5e7b252ca8122734a363905036b3 | [
"Apache-2.0"
] | null | null | null | src/hub/dataload/sources/chembl/chembl_upload.py | ravila4/mychem.info | 9b63b5f0957b5e7b252ca8122734a363905036b3 | [
"Apache-2.0"
] | null | null | null | src/hub/dataload/sources/chembl/chembl_upload.py | ravila4/mychem.info | 9b63b5f0957b5e7b252ca8122734a363905036b3 | [
"Apache-2.0"
] | null | null | null | """
Chembl uploader
"""
# pylint: disable=E0401, E0611
import os
import glob
import pymongo
import biothings.hub.dataload.storage as storage
from biothings.hub.dataload.uploader import ParallelizedSourceUploader
from hub.dataload.uploader import BaseDrugUploader
from hub.datatransform.keylookup import MyChemKeyLookup
f... | 40.569921 | 95 | 0.280437 |
import os
import glob
import pymongo
import biothings.hub.dataload.storage as storage
from biothings.hub.dataload.uploader import ParallelizedSourceUploader
from hub.dataload.uploader import BaseDrugUploader
from hub.datatransform.keylookup import MyChemKeyLookup
from .chembl_parser import load_data
SRC_META = {
... | true | true |
f717bdc2664f609c84cf83efbdea10b954fadfe4 | 2,307 | py | Python | tools/test_cate_attr_predictor.py | engahmed1190/mmfashion | 34ba2d8a9f2daadb4a04d24287664cebde4b14f9 | [
"Apache-2.0"
] | 6 | 2021-02-04T06:25:28.000Z | 2021-07-16T05:49:13.000Z | tools/test_cate_attr_predictor.py | engahmed1190/mmfashion | 34ba2d8a9f2daadb4a04d24287664cebde4b14f9 | [
"Apache-2.0"
] | null | null | null | tools/test_cate_attr_predictor.py | engahmed1190/mmfashion | 34ba2d8a9f2daadb4a04d24287664cebde4b14f9 | [
"Apache-2.0"
] | 2 | 2021-07-16T19:27:20.000Z | 2021-12-15T09:52:54.000Z | from __future__ import division
import argparse
from mmcv import Config
from mmcv.runner import load_checkpoint
from mmfashion.apis import get_root_logger, init_dist, test_cate_attr_predictor
from mmfashion.datasets.utils import get_dataset
from mmfashion.models import build_predictor
def parse_args():
parser =... | 29.576923 | 79 | 0.638058 | from __future__ import division
import argparse
from mmcv import Config
from mmcv.runner import load_checkpoint
from mmfashion.apis import get_root_logger, init_dist, test_cate_attr_predictor
from mmfashion.datasets.utils import get_dataset
from mmfashion.models import build_predictor
def parse_args():
parser =... | true | true |
f717bedbafbc1c240de6e34e3435337fe00e3c60 | 4,260 | py | Python | app/interfaces/Rubric.py | u8sand/FAIRshake | 8f6f3dde42de29b88e9a43bdd43f848382e3bad7 | [
"Apache-2.0"
] | null | null | null | app/interfaces/Rubric.py | u8sand/FAIRshake | 8f6f3dde42de29b88e9a43bdd43f848382e3bad7 | [
"Apache-2.0"
] | 8 | 2018-06-05T17:01:43.000Z | 2018-06-22T01:19:39.000Z | app/interfaces/Rubric.py | u8sand/FAIRshake | 8f6f3dde42de29b88e9a43bdd43f848382e3bad7 | [
"Apache-2.0"
] | 1 | 2018-06-06T17:22:28.000Z | 2018-06-06T17:22:28.000Z | from ..ioc import interface, model
from ..types import HTTPResponse, UUID, Timestamp, Optional, List
from ..util.generate_spec import generate_spec
@model
class CriterionModel:
'''
type: object
required:
- user
- name
properties:
id:
type: string
description: Criterion ID
example: d29... | 22.303665 | 90 | 0.621831 | from ..ioc import interface, model
from ..types import HTTPResponse, UUID, Timestamp, Optional, List
from ..util.generate_spec import generate_spec
@model
class CriterionModel:
id: UUID
name: str
kind: str
@model
class RubricModel:
id: UUID
user: UUID
name: str
criteria: List[CriterionModel]
descripti... | true | true |
f717c0006f023d6f8d6d6a2811a17dfa5060ba8c | 72,241 | py | Python | mne/bem.py | jdammers/mne-python | 1dc1502215a53385cda15c6c336fcc4341dc4d3b | [
"BSD-3-Clause"
] | null | null | null | mne/bem.py | jdammers/mne-python | 1dc1502215a53385cda15c6c336fcc4341dc4d3b | [
"BSD-3-Clause"
] | null | null | null | mne/bem.py | jdammers/mne-python | 1dc1502215a53385cda15c6c336fcc4341dc4d3b | [
"BSD-3-Clause"
] | 1 | 2021-04-12T12:45:31.000Z | 2021-04-12T12:45:31.000Z | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Matti Hamalainen <msh@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
# Lorenzo De Santis <lorenzo.de-santis@u-psud.fr>
#
# License: BSD (3-clause)
from functools import partial
import glob
import os
impor... | 37.822513 | 79 | 0.584087 |
from functools import partial
import glob
import os
import os.path as op
import shutil
from copy import deepcopy
import numpy as np
from scipy import linalg
from .transforms import _ensure_trans, apply_trans
from .io import Info
from .io.constants import FIFF
from .io.write import (start_file, start_block, wri... | true | true |
f717c05e56131daf3f0bdbca7cbed9fe45f2de19 | 930 | py | Python | src/augment/basic_augmentation/noise.py | TencentYoutuResearch/SelfSupervisedLearning-DSM | 655a0a23a47bf2559f3d435384ae59a8871a5ff5 | [
"Apache-2.0"
] | 27 | 2021-01-07T11:09:33.000Z | 2021-08-31T02:46:23.000Z | src/augment/basic_augmentation/noise.py | TencentYoutuResearch/SelfSupervisedLearning-DSM | 655a0a23a47bf2559f3d435384ae59a8871a5ff5 | [
"Apache-2.0"
] | null | null | null | src/augment/basic_augmentation/noise.py | TencentYoutuResearch/SelfSupervisedLearning-DSM | 655a0a23a47bf2559f3d435384ae59a8871a5ff5 | [
"Apache-2.0"
] | 3 | 2021-01-08T08:31:06.000Z | 2021-11-26T04:10:23.000Z | import torch
import torch.nn as nn
"""
usage
z_rand = generate_noise([1,nzx,nzy], device=opt.device)
z_rand = z_rand.expand(1,3,Z_opt.shape[2],Z_opt.shape[3])
z_prev1 = 0.95*Z_opt +0.05*z_rand
"""
def upsampling(im, sx, sy):
m = nn.Upsample(size=[round(sx), round(sy)], mode='... | 32.068966 | 90 | 0.609677 | import torch
import torch.nn as nn
def upsampling(im, sx, sy):
m = nn.Upsample(size=[round(sx), round(sy)], mode='bilinear', align_corners=True)
return m(im)
def generate_noise(size, num_samp=1, device='cuda', type='gaussian', scale=1):
if type == 'gaussian':
noise = torch.randn(num_samp, size... | true | true |
f717c11ea68b58ce09246f3ab62dcc7714c8c8ca | 1,921 | py | Python | recipes/pneumothorax/binary_classification/train_example_deit.py | lbolanos/HugsVision | c9b1708928916bc413a795590d731308ea8c582b | [
"MIT"
] | 154 | 2021-08-14T00:09:15.000Z | 2022-03-16T02:42:01.000Z | recipes/pneumothorax/binary_classification/train_example_deit.py | lbolanos/HugsVision | c9b1708928916bc413a795590d731308ea8c582b | [
"MIT"
] | 36 | 2021-08-13T23:42:15.000Z | 2022-03-31T03:57:23.000Z | recipes/pneumothorax/binary_classification/train_example_deit.py | lbolanos/HugsVision | c9b1708928916bc413a795590d731308ea8c582b | [
"MIT"
] | 12 | 2021-09-04T00:49:35.000Z | 2022-02-24T13:20:54.000Z | import argparse
from hugsvision.nnet.VisionClassifierTrainer import VisionClassifierTrainer
from hugsvision.dataio.VisionDataset import VisionDataset
from torchvision.datasets import ImageFolder
from transformers import DeiTFeatureExtractor, DeiTForImageClassification
parser = argparse.ArgumentParser(descrip... | 32.559322 | 103 | 0.724623 | import argparse
from hugsvision.nnet.VisionClassifierTrainer import VisionClassifierTrainer
from hugsvision.dataio.VisionDataset import VisionDataset
from torchvision.datasets import ImageFolder
from transformers import DeiTFeatureExtractor, DeiTForImageClassification
parser = argparse.ArgumentParser(descrip... | true | true |
f717c1795cee9e960f89d88b04da89c0fcbb68f9 | 1,593 | py | Python | algorithms/LinkedList/reverseLinkedList.py | gadodia/Algorithms | 714d43ce89b684d8e5c4bb77a654938957957f33 | [
"MIT"
] | null | null | null | algorithms/LinkedList/reverseLinkedList.py | gadodia/Algorithms | 714d43ce89b684d8e5c4bb77a654938957957f33 | [
"MIT"
] | null | null | null | algorithms/LinkedList/reverseLinkedList.py | gadodia/Algorithms | 714d43ce89b684d8e5c4bb77a654938957957f33 | [
"MIT"
] | null | null | null | '''
This problem was recently asked by Google:
Given a singly-linked list, reverse the list. This can be done iteratively or recursively. Can you get both solutions?
Example:
Input: 4 -> 3 -> 2 -> 1 -> 0 -> NULL
Output: 0 -> 1 -> 2 -> 3 -> 4 -> NULL
'''
class ListNode(object):
def __init__(self, x):
self.... | 23.426471 | 118 | 0.591337 | class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
def printList(self):
node = self
output = ''
while node != None:
output += str(node.val)
output += " "
node = node.next
print(output)
... | true | true |
f717c2255fe90f0a652e062275efe541f399cc62 | 22,811 | py | Python | utils/exp_utils.py | NoeSamaille/medical-detection-toolkit | 232d3d1444ccaac04e15a00d8030390560236871 | [
"Apache-2.0"
] | 1 | 2021-04-01T02:15:49.000Z | 2021-04-01T02:15:49.000Z | utils/exp_utils.py | NoeSamaille/medical-detection-toolkit | 232d3d1444ccaac04e15a00d8030390560236871 | [
"Apache-2.0"
] | 2 | 2021-06-02T02:14:01.000Z | 2021-09-06T06:03:25.000Z | utils/exp_utils.py | NoeSamaille/medical-detection-toolkit | 232d3d1444ccaac04e15a00d8030390560236871 | [
"Apache-2.0"
] | 3 | 2020-06-28T14:57:00.000Z | 2021-09-06T08:26:26.000Z | #!/usr/bin/env python
# Copyright 2018 Division of Medical Image Computing, German Cancer Research Center (DKFZ).
#
# 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... | 44.903543 | 287 | 0.639691 |
from typing import Iterable, Tuple, Any, Union
import os, sys
import subprocess
from multiprocessing import Process
import importlib.util
import pickle
import logging
from torch.utils.tensorboard import SummaryWriter
from collections import OrderedDict
import numpy as np
import torch
import pandas as ... | true | true |
f717c2aceaf306d0f7eae56f9df7f70d7fb7e56b | 2,488 | py | Python | usort/util.py | thatch/usort | 2ca1ff63d6cfc79e76ea95b69d162f4579c3fa3c | [
"MIT"
] | null | null | null | usort/util.py | thatch/usort | 2ca1ff63d6cfc79e76ea95b69d162f4579c3fa3c | [
"MIT"
] | null | null | null | usort/util.py | thatch/usort | 2ca1ff63d6cfc79e76ea95b69d162f4579c3fa3c | [
"MIT"
] | null | null | null | # 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.
from contextlib import contextmanager
from contextvars import ContextVar
from pathlib import Path
from time import monotonic
from typing impor... | 30.716049 | 86 | 0.658762 |
from contextlib import contextmanager
from contextvars import ContextVar
from pathlib import Path
from time import monotonic
from typing import Callable, Generator, List, Optional, Tuple
import libcst as cst
TIMINGS: ContextVar[List[Tuple[str, float]]] = ContextVar("TIMINGS")
@contextmanager
def timed(msg: str... | true | true |
f717c2b8fff53fa6c6659e99b4b2a067e7f9823a | 2,440 | py | Python | model/experiment/gaussian_naive_bayes_model.py | theBraindonor/chicago-crime-arrests | 64cdb82fbe828d1316cf945b67ddc205ef190293 | [
"CC-BY-4.0"
] | 1 | 2019-04-29T10:32:26.000Z | 2019-04-29T10:32:26.000Z | model/experiment/gaussian_naive_bayes_model.py | theBraindonor/chicago-crime-arrests | 64cdb82fbe828d1316cf945b67ddc205ef190293 | [
"CC-BY-4.0"
] | 4 | 2020-03-24T16:54:17.000Z | 2021-06-01T23:33:48.000Z | model/experiment/gaussian_naive_bayes_model.py | theBraindonor/chicago-crime-arrests | 64cdb82fbe828d1316cf945b67ddc205ef190293 | [
"CC-BY-4.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Experiment with a gaussian naive bayes model with a variety of balancing techniques on the cleaned data set
"""
__author__ = "John Hoff"
__email__ = "john.hoff@braindonor.net"
__copyright__ = "Copyright 2019, John Hoff"
__license__ = "Creative Commons Attribution-... | 26.813187 | 111 | 0.697951 |
__author__ = "John Hoff"
__email__ = "john.hoff@braindonor.net"
__copyright__ = "Copyright 2019, John Hoff"
__license__ = "Creative Commons Attribution-ShareAlike 4.0 International License"
__version__ = "1.0"
from imblearn.combine import SMOTEENN
from imblearn.over_sampling import SMOTE
from imblearn.under_sampli... | true | true |
f717c597ce99c986760a12c223c014567cf34f38 | 96,886 | py | Python | ThirdParty/ZopeInterface/zope/interface/tests/test_registry.py | OpenGeoscience/VTK | a373e975b9284a022f43a062ebf5042bb17b4e44 | [
"BSD-3-Clause"
] | 3 | 2016-02-01T02:29:51.000Z | 2020-09-04T17:19:24.000Z | ThirdParty/ZopeInterface/zope/interface/tests/test_registry.py | OpenGeoscience/VTK | a373e975b9284a022f43a062ebf5042bb17b4e44 | [
"BSD-3-Clause"
] | 7 | 2021-02-08T20:22:15.000Z | 2022-03-11T23:19:41.000Z | ThirdParty/ZopeInterface/zope/interface/tests/test_registry.py | OpenGeoscience/VTK | a373e975b9284a022f43a062ebf5042bb17b4e44 | [
"BSD-3-Clause"
] | 6 | 2017-02-13T09:11:02.000Z | 2021-06-29T11:22:18.000Z | ##############################################################################
#
# Copyright (c) 2001, 2002, 2009 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution... | 39.464766 | 80 | 0.630783 | e.interface.declarations import directlyProvides
from zope.interface.declarations import InterfaceClass
from zope.interface.interfaces import Registered
from zope.interface.registry import UtilityRegistration
from zope.interface._compat import _u
class IFoo(InterfaceClass):
... | true | true |
f717c69030d602486ed1591a2382be46b01ff559 | 3,373 | py | Python | hw/ip/otbn/dv/otbnsim/sim/csr.py | Jacob-Levy/opentitan | 13ed3e95572168f7db0e3178d06a72e72ee5a745 | [
"Apache-2.0"
] | 2 | 2019-11-21T14:05:14.000Z | 2020-07-10T12:40:54.000Z | hw/ip/otbn/dv/otbnsim/sim/csr.py | Jacob-Levy/opentitan | 13ed3e95572168f7db0e3178d06a72e72ee5a745 | [
"Apache-2.0"
] | null | null | null | hw/ip/otbn/dv/otbnsim/sim/csr.py | Jacob-Levy/opentitan | 13ed3e95572168f7db0e3178d06a72e72ee5a745 | [
"Apache-2.0"
] | null | null | null | # Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
from .flags import FlagGroups
from .wsr import WSRFile
class CSRFile:
'''A model of the CSR file'''
def __init__(self) -> None:
self.flags = FlagGroups()
... | 31.820755 | 79 | 0.555885 |
from .flags import FlagGroups
from .wsr import WSRFile
class CSRFile:
def __init__(self) -> None:
self.flags = FlagGroups()
self._known_indices = set()
self._known_indices.add(0x7c0)
self._known_indices.add(0x7c1)
self._known_indices.add(0x7c8)
for idx in... | true | true |
f717c7a5b3ca5f9a8a20ce7a7c9f7a50b5ae1c68 | 14,021 | py | Python | tests/ci/sync_requirements.py | lolwww/rally | fcb1fb6c608e29dd62549cf6b3cec2e90529932f | [
"Apache-2.0"
] | null | null | null | tests/ci/sync_requirements.py | lolwww/rally | fcb1fb6c608e29dd62549cf6b3cec2e90529932f | [
"Apache-2.0"
] | null | null | null | tests/ci/sync_requirements.py | lolwww/rally | fcb1fb6c608e29dd62549cf6b3cec2e90529932f | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# 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 applicab... | 36.136598 | 79 | 0.57799 |
import collections
import logging
import re
import sys
import textwrap
import requests
LOG = logging.getLogger(__name__)
if not LOG.handlers:
LOG.addHandler(logging.StreamHandler())
LOG.setLevel(logging.INFO)
GLOBAL_REQUIREMENTS_LOCATIONS = (
"https://raw.githubusercontent.com/openstack... | true | true |
f717c8b4305af7242c263a306f933192f7a5b976 | 491 | py | Python | route/api_raw.py | susemeee/openNAMU | 0f3d8acb5f0fe179cc8dbbfea1846da3ca0cd4e1 | [
"BSD-3-Clause"
] | null | null | null | route/api_raw.py | susemeee/openNAMU | 0f3d8acb5f0fe179cc8dbbfea1846da3ca0cd4e1 | [
"BSD-3-Clause"
] | null | null | null | route/api_raw.py | susemeee/openNAMU | 0f3d8acb5f0fe179cc8dbbfea1846da3ca0cd4e1 | [
"BSD-3-Clause"
] | 1 | 2020-01-04T09:43:35.000Z | 2020-01-04T09:43:35.000Z | from .tool.func import *
def api_raw_2(conn, name):
curs = conn.cursor()
if acl_check(name, 'render') != 1:
curs.execute("select data from data where title = ?", [name])
data = curs.fetchall()
if data:
json_data = { "title" : name, "data" : render_set(title = name, data = d... | 30.6875 | 108 | 0.545825 | from .tool.func import *
def api_raw_2(conn, name):
curs = conn.cursor()
if acl_check(name, 'render') != 1:
curs.execute("select data from data where title = ?", [name])
data = curs.fetchall()
if data:
json_data = { "title" : name, "data" : render_set(title = name, data = d... | true | true |
f717ca0d2a58ad1a206f65fb4972fcfb0f68141c | 634 | py | Python | rates/migrations/0003_rating.py | Gichimu/irater | 2da90230368b2aa5b97b9ab84455703e510e51ef | [
"MIT"
] | null | null | null | rates/migrations/0003_rating.py | Gichimu/irater | 2da90230368b2aa5b97b9ab84455703e510e51ef | [
"MIT"
] | 16 | 2020-01-11T08:20:30.000Z | 2022-02-10T09:18:48.000Z | rates/migrations/0003_rating.py | Gichimu/irater | 2da90230368b2aa5b97b9ab84455703e510e51ef | [
"MIT"
] | null | null | null | # Generated by Django 2.2 on 2020-01-15 06:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rates', '0002_auto_20200113_0757'),
]
operations = [
migrations.CreateModel(
name='Rating',
fields=[
(... | 27.565217 | 114 | 0.572555 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rates', '0002_auto_20200113_0757'),
]
operations = [
migrations.CreateModel(
name='Rating',
fields=[
('id', models.AutoField(auto_created=True, pri... | true | true |
f717cc90445df76a8ce5da7e005a9d1637cd561b | 857 | py | Python | setup.py | treamology/sphinx-variations | 1f02e3bf32610ef32cf24748d4f91bab0263c173 | [
"MIT"
] | null | null | null | setup.py | treamology/sphinx-variations | 1f02e3bf32610ef32cf24748d4f91bab0263c173 | [
"MIT"
] | 2 | 2019-10-14T12:17:54.000Z | 2019-11-29T09:06:54.000Z | setup.py | treamology/sphinx-variations | 1f02e3bf32610ef32cf24748d4f91bab0263c173 | [
"MIT"
] | 1 | 2019-10-16T10:45:39.000Z | 2019-10-16T10:45:39.000Z | import setuptools
from variations import __version__
with open('README.md', 'r') as fh:
long_description = fh.read()
setuptools.setup(
name='sphinx-variations',
version=__version__,
author='D. Lawrence',
author_email='trea@treamous.com',
description='Create multiple variations of your Sphinx H... | 30.607143 | 80 | 0.662777 | import setuptools
from variations import __version__
with open('README.md', 'r') as fh:
long_description = fh.read()
setuptools.setup(
name='sphinx-variations',
version=__version__,
author='D. Lawrence',
author_email='trea@treamous.com',
description='Create multiple variations of your Sphinx H... | true | true |
f717ce0bca4aa3ca6519610187210bdcf31b9d6a | 2,934 | py | Python | musicplayer/buttons.py | Gabe-Corral/Music_Player | 9352266aa86e5927e4a603b6238cea4745cc6b26 | [
"MIT"
] | null | null | null | musicplayer/buttons.py | Gabe-Corral/Music_Player | 9352266aa86e5927e4a603b6238cea4745cc6b26 | [
"MIT"
] | null | null | null | musicplayer/buttons.py | Gabe-Corral/Music_Player | 9352266aa86e5927e4a603b6238cea4745cc6b26 | [
"MIT"
] | null | null | null | import tkinter as tk
from PIL import ImageTk, Image
from file_import import FileImport
class Buttons:
def __init__(self, parent, player):
self.player = player
self.parent = parent
#clean these up
unskip_img = ImageTk.PhotoImage(Image.open("assets/unskip.png").resize((25,25)))
... | 44.454545 | 98 | 0.673142 | import tkinter as tk
from PIL import ImageTk, Image
from file_import import FileImport
class Buttons:
def __init__(self, parent, player):
self.player = player
self.parent = parent
unskip_img = ImageTk.PhotoImage(Image.open("assets/unskip.png").resize((25,25)))
unskip_btn = ... | true | true |
f717ce9240361f4597c503f589f1095a203484a7 | 20,067 | py | Python | tests/wallet/did_wallet/test_did.py | Starcoder0x/chia-blockchain | 5b2f5772780d0370f76b0134db6a7fdc7af42862 | [
"Apache-2.0"
] | 1 | 2022-03-04T13:12:39.000Z | 2022-03-04T13:12:39.000Z | tests/wallet/did_wallet/test_did.py | zcomputerwiz/experiments-blockchain | 841754b44494451a9e3e537575eeec431fe533d1 | [
"Apache-2.0"
] | null | null | null | tests/wallet/did_wallet/test_did.py | zcomputerwiz/experiments-blockchain | 841754b44494451a9e3e537575eeec431fe533d1 | [
"Apache-2.0"
] | null | null | null | import asyncio
import pytest
import pytest_asyncio
from chia.simulator.simulator_protocol import FarmNewBlockProtocol
from chia.types.peer_info import PeerInfo
from chia.util.ints import uint16, uint32, uint64
from tests.setup_nodes import self_hostname, setup_simulators_and_wallets
from chia.wallet.did_wallet.did_wall... | 43.623913 | 119 | 0.695819 | import asyncio
import pytest
import pytest_asyncio
from chia.simulator.simulator_protocol import FarmNewBlockProtocol
from chia.types.peer_info import PeerInfo
from chia.util.ints import uint16, uint32, uint64
from tests.setup_nodes import self_hostname, setup_simulators_and_wallets
from chia.wallet.did_wallet.did_wall... | true | true |
f717cec2bb576f4d7ab0e2542c02f2f63a1c8e21 | 582 | py | Python | src/models/gender.py | evdhout/learn_students | 4fe10df13065ae7c46930cb69fa46851c1dca9e6 | [
"MIT"
] | null | null | null | src/models/gender.py | evdhout/learn_students | 4fe10df13065ae7c46930cb69fa46851c1dca9e6 | [
"MIT"
] | null | null | null | src/models/gender.py | evdhout/learn_students | 4fe10df13065ae7c46930cb69fa46851c1dca9e6 | [
"MIT"
] | null | null | null | class Gender:
NEUTRAL = 1
FEMALE = 2
MALE = 3
GENDER_STRINGS = {NEUTRAL: "neutral",
FEMALE: "female",
MALE: "male"
}
def __init__(self, gender: int = 1):
self.gender: int = gender
def __str__(self):
return self.... | 24.25 | 50 | 0.512027 | class Gender:
NEUTRAL = 1
FEMALE = 2
MALE = 3
GENDER_STRINGS = {NEUTRAL: "neutral",
FEMALE: "female",
MALE: "male"
}
def __init__(self, gender: int = 1):
self.gender: int = gender
def __str__(self):
return self.... | true | true |
f717cfc7cab0f458b15996bf3bf047fcffdef11f | 3,950 | py | Python | test/functional/feature_minchainwork.py | bontecoin/bontecoin-core | a7c368cf25339b9495e94651ee2a036e4f3068ae | [
"MIT"
] | null | null | null | test/functional/feature_minchainwork.py | bontecoin/bontecoin-core | a7c368cf25339b9495e94651ee2a036e4f3068ae | [
"MIT"
] | null | null | null | test/functional/feature_minchainwork.py | bontecoin/bontecoin-core | a7c368cf25339b9495e94651ee2a036e4f3068ae | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test logic for setting nMinimumChainWork on command line.
Nodes don't consider themselves out of "initial b... | 43.888889 | 108 | 0.702278 |
import time
from test_framework.test_framework import BontecoinTestFramework
from test_framework.util import connect_nodes, assert_equal
REGTEST_WORK_PER_BLOCK = 2
class MinimumChainWorkTest(BontecoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 3... | true | true |
f717cfc9fd68c709b7614798b5f73cd888527fbd | 2,681 | py | Python | data/LSSVM.py | tejas-9er/SVM-vs-LSSVM | e44f63458680c39df370ddfcdf22e8c450d23128 | [
"MIT"
] | 5 | 2019-12-16T03:29:24.000Z | 2022-02-14T01:26:28.000Z | data/LSSVM.py | tejas-9er/SVM-vs-LSSVM | e44f63458680c39df370ddfcdf22e8c450d23128 | [
"MIT"
] | null | null | null | data/LSSVM.py | tejas-9er/SVM-vs-LSSVM | e44f63458680c39df370ddfcdf22e8c450d23128 | [
"MIT"
] | 5 | 2019-06-18T06:59:35.000Z | 2020-12-19T11:10:56.000Z | import numpy as np
import scipy
from scipy.sparse import linalg
from sklearn.metrics import accuracy_score
class LSSVM:
def __init__(self, kernel = 'linear', C = 1.0,gamma = 1.0, d = 2.0):
kernels = {
'rbf':self.rbf,
'poly':self.polynomial,
'linear':self.linear
}... | 33.098765 | 145 | 0.564342 | import numpy as np
import scipy
from scipy.sparse import linalg
from sklearn.metrics import accuracy_score
class LSSVM:
def __init__(self, kernel = 'linear', C = 1.0,gamma = 1.0, d = 2.0):
kernels = {
'rbf':self.rbf,
'poly':self.polynomial,
'linear':self.linear
}... | true | true |
f717cfcf1da0e79443c3060c50aa0097551bd7be | 1,034 | py | Python | p56_Merge_Intervals.py | bzhou26/leetcode_sol | 82506521e2cc412f96cd1dfc3c8c3ab635f67f73 | [
"MIT"
] | null | null | null | p56_Merge_Intervals.py | bzhou26/leetcode_sol | 82506521e2cc412f96cd1dfc3c8c3ab635f67f73 | [
"MIT"
] | null | null | null | p56_Merge_Intervals.py | bzhou26/leetcode_sol | 82506521e2cc412f96cd1dfc3c8c3ab635f67f73 | [
"MIT"
] | null | null | null | '''
- Leetcode problem: 56
- Difficulty: Medium
- Brief problem description:
Given a collection of intervals, merge all overlapping intervals.
Example 1:
Input: [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6].
Example 2:
Inpu... | 22.478261 | 112 | 0.597679 |
class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
hp = []
for i in intervals:
heapq.heappush(hp, i)
result = []
while hp:
inter = heapq.heappop(hp)
if result and inter[0] <= result[-1][1]:
result[-1]... | true | true |
f717cff9e873f6d4ee6ab179e6d452349b4cd40a | 1,032 | py | Python | env/Lib/site-packages/OpenGL/raw/EGL/EXT/device_query.py | 5gconnectedbike/Navio2 | 8c3f2b5d8bbbcea1fc08739945183c12b206712c | [
"BSD-3-Clause"
] | 210 | 2016-04-09T14:26:00.000Z | 2022-03-25T18:36:19.000Z | env/Lib/site-packages/OpenGL/raw/EGL/EXT/device_query.py | 5gconnectedbike/Navio2 | 8c3f2b5d8bbbcea1fc08739945183c12b206712c | [
"BSD-3-Clause"
] | 72 | 2016-09-04T09:30:19.000Z | 2022-03-27T17:06:53.000Z | env/Lib/site-packages/OpenGL/raw/EGL/EXT/device_query.py | 5gconnectedbike/Navio2 | 8c3f2b5d8bbbcea1fc08739945183c12b206712c | [
"BSD-3-Clause"
] | 64 | 2016-04-09T14:26:49.000Z | 2022-03-21T11:19:47.000Z | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.EGL import _types as _cs
# End users want this...
from OpenGL.raw.EGL._types import *
from OpenGL.raw.EGL import _errors
from OpenGL.constant import Constant as _C
import ctype... | 39.692308 | 115 | 0.814922 | from OpenGL import platform as _p, arrays
from OpenGL.raw.EGL import _types as _cs
from OpenGL.raw.EGL._types import *
from OpenGL.raw.EGL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_EXTENSION_NAME = 'EGL_EXT_device_query'
def _f( function ):
return _p.createFunction( function,_p.PLA... | true | true |
f717d0d34b30202c5d6aa299b38730b144f81368 | 238 | py | Python | chapter1-cam.py | gcruchon/test-opencv | fdf7cb7a86f5606ca6df6170107a0264fbc43e9c | [
"CC0-1.0"
] | null | null | null | chapter1-cam.py | gcruchon/test-opencv | fdf7cb7a86f5606ca6df6170107a0264fbc43e9c | [
"CC0-1.0"
] | null | null | null | chapter1-cam.py | gcruchon/test-opencv | fdf7cb7a86f5606ca6df6170107a0264fbc43e9c | [
"CC0-1.0"
] | null | null | null | import cv2
import numpy as np
cap = cv2.VideoCapture(0)
kernel = np.ones((5, 5), np.uint8)
while True:
success, img = cap.read()
cv2.imshow("Cam", cv2.Canny(img, 100, 100))
if cv2.waitKey(1) & 0xFF == ord('q'):
break
| 21.636364 | 47 | 0.609244 | import cv2
import numpy as np
cap = cv2.VideoCapture(0)
kernel = np.ones((5, 5), np.uint8)
while True:
success, img = cap.read()
cv2.imshow("Cam", cv2.Canny(img, 100, 100))
if cv2.waitKey(1) & 0xFF == ord('q'):
break
| true | true |
f717d2356d90cde15cbb3d0d6e7bc7ef270af89b | 320 | py | Python | Beecrowd/1187.py | Gugarauj07/Algorithms | 21c0fe96c1c870a01644d398c446182ced37eb19 | [
"MIT"
] | null | null | null | Beecrowd/1187.py | Gugarauj07/Algorithms | 21c0fe96c1c870a01644d398c446182ced37eb19 | [
"MIT"
] | null | null | null | Beecrowd/1187.py | Gugarauj07/Algorithms | 21c0fe96c1c870a01644d398c446182ced37eb19 | [
"MIT"
] | null | null | null | O = input()
soma = count = 0
for linha in range(12):
for coluna in range(12):
num = float(input())
if linha <= 4 and (10 - linha) >= coluna > linha:
soma += num
count += 1
if O == "S":
print(f"{soma:.1f}")
elif O == "M":
media = soma / count
print(f"{media:.1f}")
| 22.857143 | 57 | 0.484375 | O = input()
soma = count = 0
for linha in range(12):
for coluna in range(12):
num = float(input())
if linha <= 4 and (10 - linha) >= coluna > linha:
soma += num
count += 1
if O == "S":
print(f"{soma:.1f}")
elif O == "M":
media = soma / count
print(f"{media:.1f}")
| true | true |
f717d265ddfccca7c0bcef14a21dd104634baabd | 189 | py | Python | Lesson/lesson-oo-415.py | v-v-tarasov/python-my-lesson | 57f8985cdfe9d9439452d6d3d0f89cf4bfbf2d14 | [
"MIT"
] | null | null | null | Lesson/lesson-oo-415.py | v-v-tarasov/python-my-lesson | 57f8985cdfe9d9439452d6d3d0f89cf4bfbf2d14 | [
"MIT"
] | null | null | null | Lesson/lesson-oo-415.py | v-v-tarasov/python-my-lesson | 57f8985cdfe9d9439452d6d3d0f89cf4bfbf2d14 | [
"MIT"
] | null | null | null | def isPointInSquare(x, y):
return 1.0 >= x >= -1.0 and 1.0 >= y >= -1.0
x = float(input())
y = float(input())
if isPointInSquare(x, y) == True:
print('YES')
else:
print('NO')
| 17.181818 | 48 | 0.544974 | def isPointInSquare(x, y):
return 1.0 >= x >= -1.0 and 1.0 >= y >= -1.0
x = float(input())
y = float(input())
if isPointInSquare(x, y) == True:
print('YES')
else:
print('NO')
| true | true |
f717d32ab2f0db9bf60e9f86574ade09c2ab6e47 | 208 | py | Python | 3_Django/PROJECT_NAME/APP_NAME/urls.py | kevinbeirne1/CS50-course | b6247cdea50890369a5e0fd60017980643bf6e37 | [
"MIT"
] | 1 | 2021-08-31T20:52:41.000Z | 2021-08-31T20:52:41.000Z | 3_Django/PROJECT_NAME/APP_NAME/urls.py | kevinbeirne1/CS50-course | b6247cdea50890369a5e0fd60017980643bf6e37 | [
"MIT"
] | null | null | null | 3_Django/PROJECT_NAME/APP_NAME/urls.py | kevinbeirne1/CS50-course | b6247cdea50890369a5e0fd60017980643bf6e37 | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name="index"),
path('<str:name>', views.greet, name="greet"),
# path('david/', views.david, name="david"),
] | 26 | 50 | 0.629808 | from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name="index"),
path('<str:name>', views.greet, name="greet"),
] | true | true |
f717d4456b785afc6a7d4ab258496baf58e1cea9 | 2,004 | py | Python | diary/forms.py | j3ygh/ctdb | 3c4b90c5265125fc37aa9ac569b7f39ffd5b13c9 | [
"MIT"
] | 1 | 2021-12-27T02:18:19.000Z | 2021-12-27T02:18:19.000Z | diary/forms.py | j3ygh/ctdb | 3c4b90c5265125fc37aa9ac569b7f39ffd5b13c9 | [
"MIT"
] | null | null | null | diary/forms.py | j3ygh/ctdb | 3c4b90c5265125fc37aa9ac569b7f39ffd5b13c9 | [
"MIT"
] | 1 | 2022-03-14T06:52:48.000Z | 2022-03-14T06:52:48.000Z | from django import forms
from django.utils.translation import gettext_lazy as _
from .models import Diary
class DiaryModelForm(forms.ModelForm):
class Meta:
widgets = {
'date': forms.DateInput(attrs={'type': 'date'}),
'daily_record': forms.Textarea(attrs={'rows': 4, 'class': 'cked... | 42.638298 | 122 | 0.586826 | from django import forms
from django.utils.translation import gettext_lazy as _
from .models import Diary
class DiaryModelForm(forms.ModelForm):
class Meta:
widgets = {
'date': forms.DateInput(attrs={'type': 'date'}),
'daily_record': forms.Textarea(attrs={'rows': 4, 'class': 'cked... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.