hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f746c4856da5c257bd5aa8b3d66a805cf965b560 | 776 | py | Python | tests/src/components/finder_opponent_tab.py | Alpaca00/alpaca_web | 1db33978f774addbe456f750ffadf32d2f223610 | [
"MIT"
] | 4 | 2021-09-14T07:36:27.000Z | 2021-09-18T15:10:24.000Z | tests/src/components/finder_opponent_tab.py | Alpaca00/alpaca_web | 1db33978f774addbe456f750ffadf32d2f223610 | [
"MIT"
] | 1 | 2021-12-14T20:32:29.000Z | 2021-12-15T13:28:29.000Z | tests/src/components/finder_opponent_tab.py | Alpaca00/squash-opponent | 1db33978f774addbe456f750ffadf32d2f223610 | [
"MIT"
] | null | null | null | from tests.src import BasePage
from tests.src.elements.select import SelectList
from tests.src.validator_error import ValidatorPhoneMixin
class FinderOpponentTab(BasePage):
def __init__(self, phone: str, district: str, category: str, datetime_: str,):
super().__init__()
self.phone = phone
... | 33.73913 | 82 | 0.681701 | from tests.src import BasePage
from tests.src.elements.select import SelectList
from tests.src.validator_error import ValidatorPhoneMixin
class FinderOpponentTab(BasePage):
def __init__(self, phone: str, district: str, category: str, datetime_: str,):
super().__init__()
self.phone = phone
... | true | true |
f746c55cc51ffe8a3b29ab38f492d3f6384765e5 | 1,575 | py | Python | lab2/packet_generator.py | xtutran/python-labs | 252041d26125cfed300905a028f1c72e62a6e048 | [
"BSD-3-Clause"
] | null | null | null | lab2/packet_generator.py | xtutran/python-labs | 252041d26125cfed300905a028f1c72e62a6e048 | [
"BSD-3-Clause"
] | null | null | null | lab2/packet_generator.py | xtutran/python-labs | 252041d26125cfed300905a028f1c72e62a6e048 | [
"BSD-3-Clause"
] | null | null | null | import random, sys
from socket import *
hostsA = ['192.168.128.7', '192.168.128.1']
hostsC = ['192.224.0.5', '192.224.0.7', '192.224.10.5', '192.224.15.6']
def gen_packets(packet_num=5):
packets = []
for i in range(0, packet_num):
packet_id = i
source = random.choice(hostsA)
... | 28.125 | 90 | 0.556825 | import random, sys
from socket import *
hostsA = ['192.168.128.7', '192.168.128.1']
hostsC = ['192.224.0.5', '192.224.0.7', '192.224.10.5', '192.224.15.6']
def gen_packets(packet_num=5):
packets = []
for i in range(0, packet_num):
packet_id = i
source = random.choice(hostsA)
... | false | true |
f746c5c2afd3843e9b80c3352787b32e53811725 | 8,117 | py | Python | argoverse/evaluation/eval_forecasting.py | alliecc/argoverse-api | 8d96ebd92195a4fdb228d45b4584fdc61d4522c9 | [
"MIT"
] | 1 | 2021-09-19T15:24:40.000Z | 2021-09-19T15:24:40.000Z | argoverse/evaluation/eval_forecasting.py | alliecc/argoverse-api | 8d96ebd92195a4fdb228d45b4584fdc61d4522c9 | [
"MIT"
] | null | null | null | argoverse/evaluation/eval_forecasting.py | alliecc/argoverse-api | 8d96ebd92195a4fdb228d45b4584fdc61d4522c9 | [
"MIT"
] | null | null | null | # <Copyright 2019, Argo AI, LLC. Released under the MIT license.>
"""This module evaluates the forecasted trajectories against the ground truth."""
import math
import pickle as pkl
from typing import Dict, List, Optional, Tuple
import numpy as np
from argoverse.map_representation.map_api import ArgoverseMap
LOW_PR... | 39.789216 | 118 | 0.665517 |
import math
import pickle as pkl
from typing import Dict, List, Optional, Tuple
import numpy as np
from argoverse.map_representation.map_api import ArgoverseMap
LOW_PROB_THRESHOLD_FOR_METRICS = 0.05
def get_ade(forecasted_trajectory: np.ndarray, gt_trajectory: np.ndarray) -> float:
pred_len = forecasted_tra... | true | true |
f746c5e2032e96da058f5e6f19297a8d8d66e2b9 | 1,219 | py | Python | hood/migrations/0008_posts.py | fkinyae/vigilante-hood | cb151dc99d27bf3b0a4e6976ed7dd9878b82e8c3 | [
"MIT"
] | null | null | null | hood/migrations/0008_posts.py | fkinyae/vigilante-hood | cb151dc99d27bf3b0a4e6976ed7dd9878b82e8c3 | [
"MIT"
] | null | null | null | hood/migrations/0008_posts.py | fkinyae/vigilante-hood | cb151dc99d27bf3b0a4e6976ed7dd9878b82e8c3 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.7 on 2021-09-25 06:33
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('hood', '0007_rename_user_business_owner'),
]
operations = [
migrations.CreateModel(
name='Posts... | 46.884615 | 333 | 0.636587 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('hood', '0007_rename_user_business_owner'),
]
operations = [
migrations.CreateModel(
name='Posts',
fields=[
('id', ... | true | true |
f746c6a43189381f0cb0b1696ee33906961bc7c6 | 1,288 | py | Python | app/auth/forms.py | HenryKanyoro/Pitch | 919eb200717081c7dff5f6b7db1bc76653193501 | [
"MIT"
] | 1 | 2020-09-21T07:02:24.000Z | 2020-09-21T07:02:24.000Z | app/auth/forms.py | HenryKanyoro/Pitch | 919eb200717081c7dff5f6b7db1bc76653193501 | [
"MIT"
] | null | null | null | app/auth/forms.py | HenryKanyoro/Pitch | 919eb200717081c7dff5f6b7db1bc76653193501 | [
"MIT"
] | null | null | null | from flask_wtf import FlaskForm
from wtforms import StringField,PasswordField,BooleanField ,SubmitField,TextAreaField
from wtforms.validators import Required, Email, EqualTo
from ..models import User
from wtforms import ValidationError
class RegistrationForm(FlaskForm):
email = StringField('Your Email Address',val... | 44.413793 | 128 | 0.736801 | from flask_wtf import FlaskForm
from wtforms import StringField,PasswordField,BooleanField ,SubmitField,TextAreaField
from wtforms.validators import Required, Email, EqualTo
from ..models import User
from wtforms import ValidationError
class RegistrationForm(FlaskForm):
email = StringField('Your Email Address',val... | true | true |
f746c6e050d40ab412f2e3704c46255dc17120bf | 7,411 | py | Python | hexrd/ui/list_editor.py | HEXRD/hexrdgui | d92915463f237e0521b5830655ae73bc5bcd9f80 | [
"BSD-3-Clause"
] | 13 | 2020-02-18T00:23:02.000Z | 2022-02-24T20:04:36.000Z | hexrd/ui/list_editor.py | HEXRD/hexrdgui | d92915463f237e0521b5830655ae73bc5bcd9f80 | [
"BSD-3-Clause"
] | 656 | 2020-01-14T02:33:40.000Z | 2022-03-26T15:31:17.000Z | hexrd/ui/list_editor.py | HEXRD/hexrdgui | d92915463f237e0521b5830655ae73bc5bcd9f80 | [
"BSD-3-Clause"
] | 6 | 2020-01-17T15:02:53.000Z | 2020-11-01T22:02:48.000Z | from PySide2.QtCore import QItemSelectionModel, QObject, Signal
from PySide2.QtWidgets import QDialog, QTableWidgetItem, QVBoxLayout
from hexrd.ui.ui_loader import UiLoader
from hexrd.ui.utils import block_signals, unique_name
class ListEditor(QObject):
"""A string list editor that doesn't allow duplicates"""
... | 27.756554 | 77 | 0.640669 | from PySide2.QtCore import QItemSelectionModel, QObject, Signal
from PySide2.QtWidgets import QDialog, QTableWidgetItem, QVBoxLayout
from hexrd.ui.ui_loader import UiLoader
from hexrd.ui.utils import block_signals, unique_name
class ListEditor(QObject):
items_rearranged = Signal()
items_dele... | true | true |
f746c7b0b9182fcbc1c8b3ae1b739ff13adb6ac5 | 7,320 | py | Python | utils/cCirc.py | rscalzo/sami | 7ac5632e018cdf2384f5ff067c503177684f61c8 | [
"BSD-3-Clause"
] | 1 | 2021-12-07T08:30:38.000Z | 2021-12-07T08:30:38.000Z | utils/cCirc.py | rscalzo/sami | 7ac5632e018cdf2384f5ff067c503177684f61c8 | [
"BSD-3-Clause"
] | null | null | null | utils/cCirc.py | rscalzo/sami | 7ac5632e018cdf2384f5ff067c503177684f61c8 | [
"BSD-3-Clause"
] | 3 | 2021-02-15T19:51:59.000Z | 2021-05-04T05:48:46.000Z | from __future__ import print_function
"""
Wrapper for the C++ drizzle overlap code.
History
-------
Created by Jon Nielsen in 2012
Updated for the new cubing algorithm by Francesco D'Eugenio 16/02/2017
Notes
-----
This module contains a testing function. At the moment it requires that the libraries path be hardcode... | 35.023923 | 110 | 0.614071 | from __future__ import print_function
import ctypes as C
import numpy as np
import os.path
try:
libcm = C.CDLL(os.path.join(os.path.dirname(__file__), "libcCirc.so"))
except:
raise ImportError
pass
libcm.weight_map.argtypes = [
C.c_long, C.c_long, C.c_double, C.c_double, C.c_double,
np... | true | true |
f746c7e1ae687d20d173dd2f81cb14285a2f5ee8 | 2,206 | py | Python | scripts/preprocessing_squad.py | xiye17/diffmask | 6ae62ce58bf9bf5ea0b0ac23b196c52b7ee97c48 | [
"MIT"
] | 45 | 2020-05-01T08:44:19.000Z | 2022-03-25T12:18:03.000Z | scripts/preprocessing_squad.py | xiye17/diffmask | 6ae62ce58bf9bf5ea0b0ac23b196c52b7ee97c48 | [
"MIT"
] | 1 | 2020-09-04T03:33:41.000Z | 2020-09-27T12:21:09.000Z | scripts/preprocessing_squad.py | xiye17/diffmask | 6ae62ce58bf9bf5ea0b0ac23b196c52b7ee97c48 | [
"MIT"
] | 2 | 2021-02-04T17:21:32.000Z | 2021-03-05T12:46:16.000Z | #!/usr/bin/env python
# coding: utf-8
import argparse
import json
from tqdm.auto import tqdm
from transformers import AutoTokenizer
def pre_processing(tokenizer, file_input, file_output):
with open(file_input, "r") as f:
data = json.load(f)["data"]
new_data = {}
for p in tqdm([p for d in data fo... | 32.441176 | 103 | 0.558024 |
import argparse
import json
from tqdm.auto import tqdm
from transformers import AutoTokenizer
def pre_processing(tokenizer, file_input, file_output):
with open(file_input, "r") as f:
data = json.load(f)["data"]
new_data = {}
for p in tqdm([p for d in data for p in d["paragraphs"]]):
fo... | true | true |
f746c90708a5201580f7801d6612a3abbb008154 | 45,087 | py | Python | tests/compute/test_transform.py | ShihanYang/dgl | ec2e24be6dcc3bcc3d4ad5dff78212735f9db00f | [
"Apache-2.0"
] | 1 | 2020-07-26T01:21:45.000Z | 2020-07-26T01:21:45.000Z | tests/compute/test_transform.py | ShihanYang/dgl | ec2e24be6dcc3bcc3d4ad5dff78212735f9db00f | [
"Apache-2.0"
] | null | null | null | tests/compute/test_transform.py | ShihanYang/dgl | ec2e24be6dcc3bcc3d4ad5dff78212735f9db00f | [
"Apache-2.0"
] | null | null | null | from scipy import sparse as spsp
import unittest
import networkx as nx
import numpy as np
import dgl
import dgl.function as fn
import backend as F
from dgl.graph_index import from_scipy_sparse_matrix
import unittest
from utils import parametrize_dtype
D = 5
# line graph related
def test_line_graph():
N = 5
G... | 42.375 | 168 | 0.600195 | from scipy import sparse as spsp
import unittest
import networkx as nx
import numpy as np
import dgl
import dgl.function as fn
import backend as F
from dgl.graph_index import from_scipy_sparse_matrix
import unittest
from utils import parametrize_dtype
D = 5
def test_line_graph():
N = 5
G = dgl.DGLGraph(nx.s... | true | true |
f746c90f8434ef6641634d7b1b3a48ce8effce9e | 1,051 | py | Python | tests/pksetup_data/pksetupunit2/setup.py | radiasoft/pykern | bf5946e20d77d13ceab387c33ac75c59b6579de6 | [
"Apache-2.0"
] | 8 | 2016-10-26T13:23:44.000Z | 2022-03-02T22:03:01.000Z | tests/pksetup_data/pksetupunit2/setup.py | radiasoft/pykern | bf5946e20d77d13ceab387c33ac75c59b6579de6 | [
"Apache-2.0"
] | 124 | 2016-03-01T15:32:54.000Z | 2022-03-31T17:42:40.000Z | tests/pksetup_data/pksetupunit2/setup.py | radiasoft/pykern | bf5946e20d77d13ceab387c33ac75c59b6579de6 | [
"Apache-2.0"
] | 10 | 2015-05-09T14:17:36.000Z | 2020-02-10T18:42:53.000Z | # -*- coding: utf-8 -*-
u"""pksetupunit2 setup script
:copyright: Copyright (c) 2016 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
import pykern.pksetup
pykern.pksetup.setup(
name='pksetupunit2',
author='RadiaSoft LLC',
author_email='pip@radiasoft.net',... | 31.848485 | 67 | 0.62607 |
import pykern.pksetup
pykern.pksetup.setup(
name='pksetupunit2',
author='RadiaSoft LLC',
author_email='pip@radiasoft.net',
description='optional args like extras_require',
license='http://www.apache.org/licenses/LICENSE-2.0.html',
url='https://github.com/radiasoft/pksetupunit2',
extras_req... | true | true |
f746c9e0decce08b8c6a476cccb6e9f662237d61 | 27,828 | py | Python | tests/sandbox/.venv_ccf_sandbox/lib/python3.8/site-packages/sklearn/base.py | iLuSIAnn/test | 10d0a20dc1a646b5c1f6c7bff2960e3f5df0510e | [
"Apache-2.0"
] | 76 | 2020-07-06T14:44:05.000Z | 2022-02-14T15:30:21.000Z | tests/sandbox/.venv_ccf_sandbox/lib/python3.8/site-packages/sklearn/base.py | iLuSIAnn/test | 10d0a20dc1a646b5c1f6c7bff2960e3f5df0510e | [
"Apache-2.0"
] | 37 | 2020-10-20T08:30:53.000Z | 2020-12-22T13:15:45.000Z | tests/sandbox/.venv_ccf_sandbox/lib/python3.8/site-packages/sklearn/base.py | iLuSIAnn/test | 10d0a20dc1a646b5c1f6c7bff2960e3f5df0510e | [
"Apache-2.0"
] | 13 | 2020-09-07T07:24:35.000Z | 2022-02-24T04:56:16.000Z | """
Base classes for all estimators.
Used for VotingClassifier
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
import copy
import warnings
from collections import defaultdict
import platform
import inspect
import re
import numpy as np
from . import __version__
from ._config imp... | 34.483271 | 79 | 0.58301 |
import copy
import warnings
from collections import defaultdict
import platform
import inspect
import re
import numpy as np
from . import __version__
from ._config import get_config
from .utils import _IS_32BIT
from .utils.validation import check_X_y
from .utils.validation import check_array
from .utils._estimato... | true | true |
f746cafdce0739db79c62b049f4e11a0a905558c | 1,220 | py | Python | setup.py | smn/heatherrd | 1c02b8e2c9ce8297570326cb539b9361790450ab | [
"BSD-3-Clause"
] | 1 | 2016-02-12T13:13:23.000Z | 2016-02-12T13:13:23.000Z | setup.py | praekeltfoundation/heatherrd | 1c02b8e2c9ce8297570326cb539b9361790450ab | [
"BSD-3-Clause"
] | 1 | 2016-02-12T19:20:56.000Z | 2016-02-12T19:20:56.000Z | setup.py | praekeltfoundation/heatherrd | 1c02b8e2c9ce8297570326cb539b9361790450ab | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('requirements.txt') as req_file:
requirements = req_file.read().split('\n')
with open('... | 24.4 | 64 | 0.644262 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('requirements.txt') as req_file:
requirements = req_file.read().split('\n')
with open('requirements-dev.txt') as req_file:
requ... | true | true |
f746cb79af044b042985e917b6ae63f19c028b52 | 22,147 | py | Python | plugins/taskwarrior/__init__.py | bergercookie/-awesome-albert-plugins | 7cd62f80681f0063821d46bc635bc5475cc96370 | [
"MIT"
] | null | null | null | plugins/taskwarrior/__init__.py | bergercookie/-awesome-albert-plugins | 7cd62f80681f0063821d46bc635bc5475cc96370 | [
"MIT"
] | null | null | null | plugins/taskwarrior/__init__.py | bergercookie/-awesome-albert-plugins | 7cd62f80681f0063821d46bc635bc5475cc96370 | [
"MIT"
] | null | null | null | """Interact with Taskwarrior."""
import datetime
import os
import re
import threading
import traceback
from pathlib import Path
from shutil import which
from subprocess import PIPE, Popen
from typing import List, Optional, Tuple, Union
import albert as v0 # type: ignore
import dateutil
import gi
import taskw
from fu... | 33.303759 | 2,001 | 0.585903 |
import datetime
import os
import re
import threading
import traceback
from pathlib import Path
from shutil import which
from subprocess import PIPE, Popen
from typing import List, Optional, Tuple, Union
import albert as v0
import dateutil
import gi
import taskw
from fuzzywuzzy import process
from overrides import o... | true | true |
f746cbba413a8b795c67d5fef94f88d070614d5b | 1,200 | py | Python | HTTP_scan/async_http_response_code_checker.py | esirotinski/py3 | 313552b9e66319e6c4a0a53f8c6accfd34b2a7b0 | [
"MIT"
] | null | null | null | HTTP_scan/async_http_response_code_checker.py | esirotinski/py3 | 313552b9e66319e6c4a0a53f8c6accfd34b2a7b0 | [
"MIT"
] | null | null | null | HTTP_scan/async_http_response_code_checker.py | esirotinski/py3 | 313552b9e66319e6c4a0a53f8c6accfd34b2a7b0 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""
Read a lists of IP addresses from file and performs a HEAD request.
Outputs HTTP response code, IP address and HTTP headers.
"""
import asyncio
import time
import aiohttp
from pathlib import Path
import sys
async def get_header(session, ip):
async with session.head(f"http://{ip}/", all... | 33.333333 | 105 | 0.7 |
import asyncio
import time
import aiohttp
from pathlib import Path
import sys
async def get_header(session, ip):
async with session.head(f"http://{ip}/", allow_redirects=False) as response:
print(response.status, ip, response.raw_headers)
async def get_headers(ip_addresses):
headers = {"Connection"... | true | true |
f746cc147481dcc19818d569f3afcfaa2aff19bb | 14,625 | py | Python | nova/virt/powervm/driver.py | citrix-openstack-build/nova | e5fc28adda4b95325f74402fe63ea969e816e6c3 | [
"Apache-2.0"
] | null | null | null | nova/virt/powervm/driver.py | citrix-openstack-build/nova | e5fc28adda4b95325f74402fe63ea969e816e6c3 | [
"Apache-2.0"
] | null | null | null | nova/virt/powervm/driver.py | citrix-openstack-build/nova | e5fc28adda4b95325f74402fe63ea969e816e6c3 | [
"Apache-2.0"
] | null | null | null | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 IBM Corp.
#
# 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
#
# ... | 41.905444 | 79 | 0.626667 |
import socket
import time
from oslo.config import cfg
from nova.compute import flavors
from nova.compute import utils as compute_utils
from nova.image import glance
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.virt import driver
from nova.... | true | true |
f746cc417321e735747a850facbc561320ffce92 | 3,086 | py | Python | src/mixed-reality/azext_mixed_reality/tests/latest/test_spatial_anchors_account.py | haroonf/azure-cli-extensions | 61c044d34c224372f186934fa7c9313f1cd3a525 | [
"MIT"
] | 207 | 2017-11-29T06:59:41.000Z | 2022-03-31T10:00:53.000Z | src/mixed-reality/azext_mixed_reality/tests/latest/test_spatial_anchors_account.py | haroonf/azure-cli-extensions | 61c044d34c224372f186934fa7c9313f1cd3a525 | [
"MIT"
] | 4,061 | 2017-10-27T23:19:56.000Z | 2022-03-31T23:18:30.000Z | src/mixed-reality/azext_mixed_reality/tests/latest/test_spatial_anchors_account.py | haroonf/azure-cli-extensions | 61c044d34c224372f186934fa7c9313f1cd3a525 | [
"MIT"
] | 802 | 2017-10-11T17:36:26.000Z | 2022-03-31T22:24:32.000Z | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 50.590164 | 120 | 0.61698 |
from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer)
from .recording_processors import KeyReplacer
class SpatialAnchorsAccountScenarioTest(ScenarioTest):
def __init__(self, method_name):
super(SpatialAnchorsAccountScenarioTest, self).__init__(
method_name, recording_proces... | true | true |
f746cd6ddaaa49cc813bf8783c9a5b14f88666e1 | 325 | py | Python | arcade_solutions/the_core/alphabet_subsequence.py | nickaigi/automatic-dollop | eb8222475c7871c1d5710242c5aed8c70ea0d2c8 | [
"Unlicense"
] | null | null | null | arcade_solutions/the_core/alphabet_subsequence.py | nickaigi/automatic-dollop | eb8222475c7871c1d5710242c5aed8c70ea0d2c8 | [
"Unlicense"
] | null | null | null | arcade_solutions/the_core/alphabet_subsequence.py | nickaigi/automatic-dollop | eb8222475c7871c1d5710242c5aed8c70ea0d2c8 | [
"Unlicense"
] | null | null | null | def alphabet_subsequence(s):
return ''.join(sorted(s)) == s and len(set(s)) == len(s)
def alphabet_subsequence_two(s):
""" I like this solution better.
Clear and concise
"""
return all(s[i]<s[i+1] for i in range(len(s) -1))
if __name__ == '__main__':
s = 'effg'
print(alphabet_subsequence... | 21.666667 | 60 | 0.618462 | def alphabet_subsequence(s):
return ''.join(sorted(s)) == s and len(set(s)) == len(s)
def alphabet_subsequence_two(s):
return all(s[i]<s[i+1] for i in range(len(s) -1))
if __name__ == '__main__':
s = 'effg'
print(alphabet_subsequence(s))
| true | true |
f746cdc252f121d71b7228e30ebe61102ebbbc77 | 10,426 | py | Python | calm segment extractor py34 v5 20170918.py | realchrisward/RodentPlethysmography | 6b27e08a65b4c0b399e5b20173c0d134f5dbca38 | [
"MIT"
] | null | null | null | calm segment extractor py34 v5 20170918.py | realchrisward/RodentPlethysmography | 6b27e08a65b4c0b399e5b20173c0d134f5dbca38 | [
"MIT"
] | 3 | 2017-12-21T22:42:56.000Z | 2018-09-18T15:04:34.000Z | calm segment extractor py34 v5 20170918.py | realchrisward/RodentPlethysmography | 6b27e08a65b4c0b399e5b20173c0d134f5dbca38 | [
"MIT"
] | null | null | null | #!usr/bin/env python3
## /\ compatability line
## distribution notes - Calm Segment Extractor py34 v4.py
"""
Calm Segment Extractor by Chris Ward (C) 2015
updated for python 3.4 compatability by Chris Ward (C) 2016
provided free for non-commercial/fair use.
This program attempts to define periods of calm beh... | 42.040323 | 171 | 0.610589 |
y
imestamps,movement,pd,bs,rt):
timestamps=[float(i) for i in timestamps]
movement=[float(i) for i in movement]
thresh=numpy.percentile(movement,bs)*rt
crossings=wardcode.getbelowthresh(movement,thresh)
diffcross=wardcode.getdifflist(crossings)
starts=wardcode.getlistfromfilt... | true | true |
f746ceb00e5bbac4e5f1d0161b3c2c401174c11f | 3,144 | py | Python | pyrfu/mms/eis_skymap_combine_sc.py | ablotekar/irfu-python | 740cb51ca9ce2ab0d62cb6fef3a7a722d430d79e | [
"MIT"
] | null | null | null | pyrfu/mms/eis_skymap_combine_sc.py | ablotekar/irfu-python | 740cb51ca9ce2ab0d62cb6fef3a7a722d430d79e | [
"MIT"
] | null | null | null | pyrfu/mms/eis_skymap_combine_sc.py | ablotekar/irfu-python | 740cb51ca9ce2ab0d62cb6fef3a7a722d430d79e | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 3rd party imports
import numpy as np
import xarray as xr
__author__ = "Louis Richard"
__email__ = "louisr@irfu.se"
__copyright__ = "Copyright 2020-2021"
__license__ = "MIT"
__version__ = "2.3.7"
__status__ = "Prototype"
def _idx_closest(lst0, lst1):
return [(np.ab... | 32.081633 | 78 | 0.648537 |
import numpy as np
import xarray as xr
__author__ = "Louis Richard"
__email__ = "louisr@irfu.se"
__copyright__ = "Copyright 2020-2021"
__license__ = "MIT"
__version__ = "2.3.7"
__status__ = "Prototype"
def _idx_closest(lst0, lst1):
return [(np.abs(np.asarray(lst0) - k)).argmin() for k in lst1]
def eis_skym... | true | true |
f746d0a6dd0eec87ac2f9e941b807709b7c42219 | 4,483 | py | Python | graph_objs/treemap/marker/_pad.py | wwwidonja/changed_plotly | 1bda35a438539a97c84a3ab3952e95e8848467bd | [
"MIT"
] | null | null | null | graph_objs/treemap/marker/_pad.py | wwwidonja/changed_plotly | 1bda35a438539a97c84a3ab3952e95e8848467bd | [
"MIT"
] | null | null | null | graph_objs/treemap/marker/_pad.py | wwwidonja/changed_plotly | 1bda35a438539a97c84a3ab3952e95e8848467bd | [
"MIT"
] | null | null | null | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Pad(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "treemap.marker"
_path_str = "treemap.marker.pad"
_valid_props = {"b", "l", "r", "t"}
# b
... | 24.36413 | 82 | 0.47892 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Pad(_BaseTraceHierarchyType):
_parent_path_str = "treemap.marker"
_path_str = "treemap.marker.pad"
_valid_props = {"b", "l", "r", "t"}
@property
def b(self):
... | true | true |
f746d2008e10f3ca7d9d0b33c92077ded4f75f65 | 3,274 | py | Python | homeassistant/components/fixer/sensor.py | VirtualL/home-assistant | 301829d02be8d865ab46c8901ac046d060849320 | [
"Apache-2.0"
] | null | null | null | homeassistant/components/fixer/sensor.py | VirtualL/home-assistant | 301829d02be8d865ab46c8901ac046d060849320 | [
"Apache-2.0"
] | 3 | 2021-09-08T03:34:57.000Z | 2022-03-12T00:59:48.000Z | homeassistant/components/fixer/sensor.py | VirtualL/home-assistant | 301829d02be8d865ab46c8901ac046d060849320 | [
"Apache-2.0"
] | null | null | null | """Currency exchange rate support that comes from fixer.io."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY, CONF_NAME
import homeassistant.helpers.config_validation as ... | 28.224138 | 74 | 0.667074 | from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY, CONF_NAME
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
REQUIREMENT... | true | true |
f746d20bd889d84a6a251f5d3e2537625a0effa0 | 17,838 | py | Python | routes.py | charukiewicz/beer-manager | edde7139e31a5b6cb38f5e83b04050b8254fb97b | [
"MIT"
] | null | null | null | routes.py | charukiewicz/beer-manager | edde7139e31a5b6cb38f5e83b04050b8254fb97b | [
"MIT"
] | null | null | null | routes.py | charukiewicz/beer-manager | edde7139e31a5b6cb38f5e83b04050b8254fb97b | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import os
import hashlib
from flask import Flask, request, make_response, abort
from flask.ext.sqlalchemy import SQLAlchemy
from flask import jsonify
from sqlalchemy import desc, asc, Table, insert
# Author: Christian Charukiewicz
# Email: c.charukiewicz@gmail.com
app = Flask(__name__)
db = SQLA... | 27.275229 | 106 | 0.659659 |
import os
import hashlib
from flask import Flask, request, make_response, abort
from flask.ext.sqlalchemy import SQLAlchemy
from flask import jsonify
from sqlalchemy import desc, asc, Table, insert
app = Flask(__name__)
db = SQLAlchemy(app)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://username:passwo... | true | true |
f746d2176a82a3dcd6b37bae54c5b35de5cc7231 | 23,261 | py | Python | csv2po.py | might-and-magic/mm678_i18n | ddc37c743ac37169908641dcd5328a7ccae5138f | [
"MIT"
] | 17 | 2020-02-25T14:37:23.000Z | 2022-02-21T15:33:09.000Z | csv2po.py | might-and-magic/mm678_i18n | ddc37c743ac37169908641dcd5328a7ccae5138f | [
"MIT"
] | 1 | 2022-01-09T02:14:56.000Z | 2022-02-13T10:08:11.000Z | csv2po.py | might-and-magic/mm678_i18n | ddc37c743ac37169908641dcd5328a7ccae5138f | [
"MIT"
] | 3 | 2020-10-06T20:38:13.000Z | 2021-02-17T02:11:17.000Z | # CSV2PO Python (csv2po.py) v1.0.0
# By Tom CHEN <tomchen.org@gmail.com> (tomchen.org)
# MIT License
# Python 3.8+
import re
import glob
import os
import time
import random
import importlib.util
import gettext
import polib
from pathlib import Path
from pluralforms import pluralforms
import settings
__version__ = '1.... | 34.00731 | 196 | 0.662783 |
import re
import glob
import os
import time
import random
import importlib.util
import gettext
import polib
from pathlib import Path
from pluralforms import pluralforms
import settings
__version__ = '1.0.0'
import sys
sys.setrecursionlimit(10000)
def setDefaults(defaultsDict):
for key in defaultsDict:
if ... | true | true |
f746d45a7d11ecb1d470cccbbda3bbed6ec093e2 | 14,949 | py | Python | venv/lib/python3.6/site-packages/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/bgp_global/bgp_global.py | usegalaxy-no/usegalaxy | 75dad095769fe918eb39677f2c887e681a747f3a | [
"MIT"
] | 1 | 2020-01-22T13:11:23.000Z | 2020-01-22T13:11:23.000Z | venv/lib/python3.6/site-packages/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/bgp_global/bgp_global.py | usegalaxy-no/usegalaxy | 75dad095769fe918eb39677f2c887e681a747f3a | [
"MIT"
] | 12 | 2020-02-21T07:24:52.000Z | 2020-04-14T09:54:32.000Z | venv/lib/python3.6/site-packages/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/bgp_global/bgp_global.py | usegalaxy-no/usegalaxy | 75dad095769fe918eb39677f2c887e681a747f3a | [
"MIT"
] | null | null | null | #
# -*- coding: utf-8 -*-
# Copyright 2021 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
from __future__ import absolute_import, division, print_function
__metaclass__ = type
"""
The nxos_bgp_global config file.
It is in this file where the current configura... | 34.92757 | 103 | 0.533748 |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from copy import deepcopy
from ansible.module_utils.six import iteritems
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import (
dict_merge,
)
from ansible_collections.ansible.netco... | true | true |
f746d46b7e017f77221a964663de7c42aa9b4b48 | 282 | py | Python | app.py | mcvenkat/Python-Programs | 2ff66bbd5b07c8e093b11360e1dcac06740a5024 | [
"CC0-1.0",
"MIT"
] | null | null | null | app.py | mcvenkat/Python-Programs | 2ff66bbd5b07c8e093b11360e1dcac06740a5024 | [
"CC0-1.0",
"MIT"
] | 5 | 2020-05-22T14:10:02.000Z | 2022-03-25T19:13:05.000Z | app.py | mcvenkat/Python-Programs | 2ff66bbd5b07c8e093b11360e1dcac06740a5024 | [
"CC0-1.0",
"MIT"
] | null | null | null | #flask app
from flask import Flask, render_template
#instantiate the flask app
app = Flask(__name__)
#create index page function
@app.route("/")
def index():
return render_template("index.html")
#run the app
if __name__ == "__main__":
app.run(debug=True)
| 17.625 | 41 | 0.680851 |
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def index():
return render_template("index.html")
if __name__ == "__main__":
app.run(debug=True)
| true | true |
f746d5769a9e3a9cee3eb1fd17bb1dbca207d6fe | 998 | py | Python | azure/mgmt/network/v2017_08_01/models/application_gateway_available_waf_rule_sets_result.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | 1 | 2022-01-25T22:52:58.000Z | 2022-01-25T22:52:58.000Z | azure/mgmt/network/v2017_08_01/models/application_gateway_available_waf_rule_sets_result.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | azure/mgmt/network/v2017_08_01/models/application_gateway_available_waf_rule_sets_result.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 34.413793 | 83 | 0.624248 |
from msrest.serialization import Model
class ApplicationGatewayAvailableWafRuleSetsResult(Model):
_attribute_map = {
'value': {'key': 'value', 'type': '[ApplicationGatewayFirewallRuleSet]'},
}
def __init__(self, value=None):
self.value = value
| true | true |
f746d672279269b5cf3831d23906b4f0d4b3b1ec | 805 | py | Python | sublimetext/FSharp/sublime_plugin_lib/context.py | ShalokShalom/zarchive-fsharpbinding | e3e1fc00c6bb027030c63c4b0d25abbb28b39797 | [
"Apache-2.0"
] | 182 | 2017-03-05T07:43:13.000Z | 2022-03-15T13:09:07.000Z | sublimetext/FSharp/sublime_plugin_lib/context.py | ShalokShalom/zarchive-fsharpbinding | e3e1fc00c6bb027030c63c4b0d25abbb28b39797 | [
"Apache-2.0"
] | 141 | 2015-01-01T19:39:18.000Z | 2017-04-13T14:36:18.000Z | sublimetext/FSharp/sublime_plugin_lib/context.py | ShalokShalom/zarchive-fsharpbinding | e3e1fc00c6bb027030c63c4b0d25abbb28b39797 | [
"Apache-2.0"
] | 37 | 2015-01-08T14:23:09.000Z | 2017-09-10T20:58:57.000Z | # Copyright (c) 2014, Guillermo López-Anglada. Please see the AUTHORS file for details.
# All rights reserved. Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.)
import sublime
class ContextProviderMixin(object):
'''Provides a method to evaluate contexts.
Us... | 33.541667 | 87 | 0.632298 |
import sublime
class ContextProviderMixin(object):
def _check(self, value, operator, operand, match_all):
if operator == sublime.OP_EQUAL:
if operand == True:
return value
elif operand == False:
return not value
elif operator == sublime.O... | true | true |
f746d7d6cffee5503e603ec229c85d2a644dd56f | 28,459 | py | Python | datatableview/tests/test_datatables.py | Virako/django-datatable-view | 6fda8318f146fbe8b45b8f89b0c221641975841e | [
"Apache-2.0"
] | null | null | null | datatableview/tests/test_datatables.py | Virako/django-datatable-view | 6fda8318f146fbe8b45b8f89b0c221641975841e | [
"Apache-2.0"
] | null | null | null | datatableview/tests/test_datatables.py | Virako/django-datatable-view | 6fda8318f146fbe8b45b8f89b0c221641975841e | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from inspect import isgenerator
from django.apps import apps
from .testcase import DatatableViewTestCase
from datatableview.exceptions import ColumnError
from datatableview.datatables import Datatable, ValuesDatatable
from datatableview.views import DatatableJSONResponseMixin, DatatableView
fr... | 38.878415 | 160 | 0.592045 |
from inspect import isgenerator
from django.apps import apps
from .testcase import DatatableViewTestCase
from datatableview.exceptions import ColumnError
from datatableview.datatables import Datatable, ValuesDatatable
from datatableview.views import DatatableJSONResponseMixin, DatatableView
from datatableview.column... | true | true |
f746d8249849f52561e169f7b73fe85761cae5db | 4,857 | py | Python | homeassistant/components/shelly/button.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 30,023 | 2016-04-13T10:17:53.000Z | 2020-03-02T12:56:31.000Z | homeassistant/components/shelly/button.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 24,710 | 2016-04-13T08:27:26.000Z | 2020-03-02T12:59:13.000Z | homeassistant/components/shelly/button.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 11,956 | 2016-04-13T18:42:31.000Z | 2020-03-02T09:32:12.000Z | """Button for Shelly."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from typing import Final, cast
from homeassistant.components.button import (
ButtonDeviceClass,
ButtonEntity,
ButtonEntityDescription,
)
from homeassistant.config_entries impo... | 33.267123 | 85 | 0.70558 | from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from typing import Final, cast
from homeassistant.components.button import (
ButtonDeviceClass,
ButtonEntity,
ButtonEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homea... | true | true |
f746d83c54b7d92516127ee83926b651806f07ca | 534 | py | Python | altair/vegalite/v2/examples/scatter_tooltips.py | alchemyst/altair | cf6284408b2828e1989712ea1e0a0c18f56db1bf | [
"BSD-3-Clause"
] | 1 | 2019-03-08T09:29:59.000Z | 2019-03-08T09:29:59.000Z | altair/vegalite/v2/examples/scatter_tooltips.py | Zhujunnan/altair | 3ee552ad672eb54e7c92d8ad9dd1dfdaf60f7d26 | [
"BSD-3-Clause"
] | null | null | null | altair/vegalite/v2/examples/scatter_tooltips.py | Zhujunnan/altair | 3ee552ad672eb54e7c92d8ad9dd1dfdaf60f7d26 | [
"BSD-3-Clause"
] | null | null | null | """
Scatter Plot with Tooltips
--------------------------
A scatter plot of the cars dataset, with tooltips showing selected column
values when you hover over points. We make the points larger so that it is
easier to hover over them.
"""
# category: simple charts
import altair as alt
from vega_datasets import data
so... | 25.428571 | 74 | 0.696629 |
import altair as alt
from vega_datasets import data
source = data.cars()
alt.Chart(source).mark_circle(size=60).encode(
x='Horsepower',
y='Miles_per_Gallon',
color='Origin',
tooltip=['Name', 'Origin', 'Horsepower', 'Miles_per_Gallon']
).interactive()
| true | true |
f746d8c779f24e0457e8bf6fc1904e3949a959ff | 8,431 | py | Python | merge.py | DrPlantabyte/better-git | f53db17a0ba5956270f35a9b0f0254caa22cca31 | [
"CC-BY-4.0"
] | null | null | null | merge.py | DrPlantabyte/better-git | f53db17a0ba5956270f35a9b0f0254caa22cca31 | [
"CC-BY-4.0"
] | null | null | null | merge.py | DrPlantabyte/better-git | f53db17a0ba5956270f35a9b0f0254caa22cca31 | [
"CC-BY-4.0"
] | null | null | null | #!/usr/bin/python3
# Author: Dr. Christopher C. Hall, aka DrPlantabyte
# Copyright 2021 Christopher C. Hall
# Permission granted to use and redistribute this code in accordance with the Creative Commons (CC BY 4.0) License:
# https://creativecommons.org/licenses/by/4.0/
from subprocess import call, Popen, PIPE, STDOUT
... | 39.957346 | 122 | 0.666113 |
from subprocess import call, Popen, PIPE, STDOUT
import os, sys, re
from os import path
def main():
if not merge_in_progress():
changes = run('git', 'status', '-uall', '--porcelain', capture_stdout=True,
fail_msg='Cannot merge, current working directory is not in a git repository!')
short', '-q',... | true | true |
f746d9164d8d117bd5633aafdc008724f0680784 | 185 | py | Python | lab3/17.bin_triangle.py | aritra1911/tnt | 0ea75cc0b9e20fa3b608ac413d3b142548826a52 | [
"MIT"
] | null | null | null | lab3/17.bin_triangle.py | aritra1911/tnt | 0ea75cc0b9e20fa3b608ac413d3b142548826a52 | [
"MIT"
] | null | null | null | lab3/17.bin_triangle.py | aritra1911/tnt | 0ea75cc0b9e20fa3b608ac413d3b142548826a52 | [
"MIT"
] | null | null | null | def main():
n = int(input("Enter no. of rows: "))
for i in range(n):
for j in range(i+1):
print(str((i + j + 1) % 2) + " ", end='')
print()
if __name__ == '__main__':
main()
| 18.5 | 44 | 0.518919 | def main():
n = int(input("Enter no. of rows: "))
for i in range(n):
for j in range(i+1):
print(str((i + j + 1) % 2) + " ", end='')
print()
if __name__ == '__main__':
main()
| true | true |
f746d9b3ddfaafbeb897a2a63bc06617d2f3ff0c | 3,627 | py | Python | study.py | heikal-b/BirdNameStudy | e4d900e4ea55ba6691246c6eeaf93d60b5beb7fe | [
"MIT"
] | null | null | null | study.py | heikal-b/BirdNameStudy | e4d900e4ea55ba6691246c6eeaf93d60b5beb7fe | [
"MIT"
] | null | null | null | study.py | heikal-b/BirdNameStudy | e4d900e4ea55ba6691246c6eeaf93d60b5beb7fe | [
"MIT"
] | null | null | null | import pickle
import nltk
import measurements as msr
import csv
def main():
"""
Collect and present data on the names of North American birds (US + Canada)
:return:
"""
# Load list of NamedBirds
birds_pickle = open('built_birds.pickle', 'rb')
birds = pickle.load(birds_pickle)
# Divide... | 34.216981 | 103 | 0.670527 | import pickle
import nltk
import measurements as msr
import csv
def main():
birds_pickle = open('built_birds.pickle', 'rb')
birds = pickle.load(birds_pickle)
bop_names = [b.mod_name for b in birds if b.is_bop()]
nbop_names = [b.mod_name for b in birds if not b.is_bop()]
cond_obs =... | true | true |
f746dabd55d61f7c61004c59513948e2daa6dcc5 | 14,457 | py | Python | ansible_collections/arista/cvp/plugins/modules/cv_facts.py | apollocreed/ansible-cvp | 13c8d2e0b5e2f32807a1bcba16a66effb9f228e5 | [
"Apache-2.0"
] | null | null | null | ansible_collections/arista/cvp/plugins/modules/cv_facts.py | apollocreed/ansible-cvp | 13c8d2e0b5e2f32807a1bcba16a66effb9f228e5 | [
"Apache-2.0"
] | null | null | null | ansible_collections/arista/cvp/plugins/modules/cv_facts.py | apollocreed/ansible-cvp | 13c8d2e0b5e2f32807a1bcba16a66effb9f228e5 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
# coding: utf-8 -*-
#
# FIXME: required to pass ansible-test
# GNU General Public License v3.0+
#
# Copyright 2019 Arista Networks AS-EMEA
#
# 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 t... | 32.270089 | 112 | 0.627862 |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'
}
import logging
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.conne... | true | true |
f746dafbbd33064edfde29842763046ad52d3214 | 1,671 | py | Python | solarviewer/app/plot.py | RobertJaro/qt-solar-viewer | dcecdc8040f457abf8d978a5ecbff61396358c32 | [
"BSD-3-Clause"
] | null | null | null | solarviewer/app/plot.py | RobertJaro/qt-solar-viewer | dcecdc8040f457abf8d978a5ecbff61396358c32 | [
"BSD-3-Clause"
] | null | null | null | solarviewer/app/plot.py | RobertJaro/qt-solar-viewer | dcecdc8040f457abf8d978a5ecbff61396358c32 | [
"BSD-3-Clause"
] | null | null | null | from abc import abstractmethod
from matplotlib import pyplot as plt
from matplotlib.backends.backend_qt5 import NavigationToolbar2QT
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from qtpy import QtWidgets
from solarviewer.config.base import Viewer, DataModel
from solarviewer.ui.plo... | 29.315789 | 80 | 0.664273 | from abc import abstractmethod
from matplotlib import pyplot as plt
from matplotlib.backends.backend_qt5 import NavigationToolbar2QT
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from qtpy import QtWidgets
from solarviewer.config.base import Viewer, DataModel
from solarviewer.ui.plo... | true | true |
f746db58442ca9eda351988cd889fb7097c29789 | 10,508 | py | Python | glanceclient/common/http.py | darren-wang/glc | dd00d2b21e81a6472b3a76d6a1c0ca56ff5391b3 | [
"Apache-2.0"
] | null | null | null | glanceclient/common/http.py | darren-wang/glc | dd00d2b21e81a6472b3a76d6a1c0ca56ff5391b3 | [
"Apache-2.0"
] | null | null | null | glanceclient/common/http.py | darren-wang/glc | dd00d2b21e81a6472b3a76d6a1c0ca56ff5391b3 | [
"Apache-2.0"
] | null | null | null | # Copyright 2012 OpenStack Foundation
# 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 requ... | 36.741259 | 79 | 0.591073 |
import copy
import logging
import socket
from oslo_utils import importutils
from oslo_utils import netutils
import requests
try:
from requests.packages.urllib3.exceptions import ProtocolError
except ImportError:
ProtocolError = requests.exceptions.ConnectionError
import six
from six.moves.urllib... | true | true |
f746dc7dad357acb09f04caba4451d2162cf3379 | 425 | py | Python | buidl/buidl/__init__.py | rugrah/ru | ebe5451709ebcc94e58f4de368fd66cc91c92d21 | [
"Unlicense"
] | null | null | null | buidl/buidl/__init__.py | rugrah/ru | ebe5451709ebcc94e58f4de368fd66cc91c92d21 | [
"Unlicense"
] | null | null | null | buidl/buidl/__init__.py | rugrah/ru | ebe5451709ebcc94e58f4de368fd66cc91c92d21 | [
"Unlicense"
] | null | null | null | # TODO: specify what specifically to import
from .block import *
from .bloomfilter import *
from .ecc import *
from .hd import *
from .helper import *
from .merkleblock import *
from .mnemonic import *
from .network import *
from .op import *
from .pbkdf2 import *
from .psbt import *
from .script import *
from .tx impo... | 22.368421 | 43 | 0.745882 |
from .block import *
from .bloomfilter import *
from .ecc import *
from .hd import *
from .helper import *
from .merkleblock import *
from .mnemonic import *
from .network import *
from .op import *
from .pbkdf2 import *
from .psbt import *
from .script import *
from .tx import *
from .witness import *
from .hd impor... | true | true |
f746ddff3c589b685b17d323599ac311199c3997 | 1,138 | py | Python | server/feedback/wsgi.py | mvdbroek/geo-userfeedback | 1eefa8dada63ba93a928cfd7f11fe3e6fce35243 | [
"BSD-3-Clause"
] | null | null | null | server/feedback/wsgi.py | mvdbroek/geo-userfeedback | 1eefa8dada63ba93a928cfd7f11fe3e6fce35243 | [
"BSD-3-Clause"
] | null | null | null | server/feedback/wsgi.py | mvdbroek/geo-userfeedback | 1eefa8dada63ba93a928cfd7f11fe3e6fce35243 | [
"BSD-3-Clause"
] | null | null | null | """
WSGI config for feedback project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | 39.241379 | 79 | 0.807557 | import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "feedback.settings")
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(applic... | true | true |
f746deb5a729885bcafd104b241845b8fe92920c | 1,177 | py | Python | DeepLearning/Python/Chapter 1/Ch01-01-interpreter.py | BlueWay-KU/Study | a86405cdc3011eaed1b980b562b75df1e9ce90a8 | [
"MIT"
] | null | null | null | DeepLearning/Python/Chapter 1/Ch01-01-interpreter.py | BlueWay-KU/Study | a86405cdc3011eaed1b980b562b75df1e9ce90a8 | [
"MIT"
] | null | null | null | DeepLearning/Python/Chapter 1/Ch01-01-interpreter.py | BlueWay-KU/Study | a86405cdc3011eaed1b980b562b75df1e9ce90a8 | [
"MIT"
] | null | null | null | # terminal
# > python --version
# > python
# >>> 1 + 2
# >>> 1 - 2
# >>> 4 * 5
# >>> 7 / 5
# >>> 3 ** 2
# >>> type(10)
# >>> type(2.718)
# >>> type("hello")
# >>> x = 10
# >>> print(x)
# >>> x = 100
# >>> print(x)
# >>> y = 3.14
# >>> x * y
# >>> type(x * y)
# >>> a = [1, 2, 3, 4, 5]
# >>> print(a)
... | 18.390625 | 41 | 0.372133 |
# ...
# >>> hungry = False
# >>> if hungry:
# ... print("I'm hungry")
# ... print("I;m sleepy")
# ...
# >>> for i in [1, 2, 3]:
# ... print(i)
# >>> def hello():
# ... print("Hello World!")
# ...
# >>> hello()
# >>> def hello(object):
# ... ... | true | true |
f746df3be6a1197b1cf4c5aba9f89091ece573b4 | 4,096 | py | Python | src/build/android/gyp/util/diff_utils.py | Mr-Sheep/naiveproxy | 9f6e9768295f6d1d41517a15a621d4756bd7d6be | [
"BSD-3-Clause"
] | 6 | 2020-12-22T05:48:31.000Z | 2022-02-08T19:49:49.000Z | src/build/android/gyp/util/diff_utils.py | Mr-Sheep/naiveproxy | 9f6e9768295f6d1d41517a15a621d4756bd7d6be | [
"BSD-3-Clause"
] | 54 | 2020-06-23T17:34:04.000Z | 2022-03-31T02:04:06.000Z | src/build/android/gyp/util/diff_utils.py | Mr-Sheep/naiveproxy | 9f6e9768295f6d1d41517a15a621d4756bd7d6be | [
"BSD-3-Clause"
] | 12 | 2020-07-14T23:59:57.000Z | 2022-03-22T09:59:18.000Z | #!/usr/bin/env python
#
# Copyright 2019 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.
import os
import sys
import difflib
from util import build_utils
def _SkipOmitted(line):
"""
Skip lines that are to be intenti... | 33.032258 | 91 | 0.689453 |
import os
import sys
import difflib
from util import build_utils
def _SkipOmitted(line):
if line.rstrip().endswith('# OMIT FROM EXPECTATIONS'):
return '# THIS LINE WAS OMITTED\n'
return line
def _GenerateDiffWithOnlyAdditons(expected_path, actual_data):
# whitespace).
with open(expected_... | true | true |
f746dfe1c696899e4e45e7b2d4141ff280b9df0a | 5,815 | py | Python | fastgame/widget/label.py | stripepython/fastgame | 6bf399753600ba4745b181b5256c6ff7e1c9cf88 | [
"MIT"
] | 1 | 2022-01-31T05:28:53.000Z | 2022-01-31T05:28:53.000Z | fastgame/widget/label.py | stripepython/fastgame | 6bf399753600ba4745b181b5256c6ff7e1c9cf88 | [
"MIT"
] | null | null | null | fastgame/widget/label.py | stripepython/fastgame | 6bf399753600ba4745b181b5256c6ff7e1c9cf88 | [
"MIT"
] | null | null | null | """
fastgame.widget.label
Fastgame文本组件。
"""
from typing import Tuple
import pygame
import fastgame
from fastgame.exceptions import *
from fastgame.utils.color import *
__all__ = ['Label']
class Label(pygame.sprite.Sprite):
def __init__(self, text: str, font: str = None, size: int = 16, use_... | 26.674312 | 112 | 0.505761 |
from typing import Tuple
import pygame
import fastgame
from fastgame.exceptions import *
from fastgame.utils.color import *
__all__ = ['Label']
class Label(pygame.sprite.Sprite):
def __init__(self, text: str, font: str = None, size: int = 16, use_sys_font: bool = False,
color: C... | true | true |
f746e02febfbccf656590eb5278fec9de3c4a34a | 37 | py | Python | src/dosertools/image_processing/__init__.py | rlearsch/dosertools | 9cd3784dabdcea3f8c54e9e2236025755493e0fd | [
"MIT"
] | 1 | 2022-03-10T18:37:31.000Z | 2022-03-10T18:37:31.000Z | src/dosertools/image_processing/__init__.py | rlearsch/dosertools | 9cd3784dabdcea3f8c54e9e2236025755493e0fd | [
"MIT"
] | 2 | 2022-03-07T22:36:23.000Z | 2022-03-29T23:49:42.000Z | src/dosertools/image_processing/__init__.py | rlearsch/dosertools | 9cd3784dabdcea3f8c54e9e2236025755493e0fd | [
"MIT"
] | null | null | null | __all__ = ["tiff_handling","binary"]
| 18.5 | 36 | 0.702703 | __all__ = ["tiff_handling","binary"]
| true | true |
f746e080e25ffb5ffc2b66fee911decc544da3e6 | 6,629 | py | Python | azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account.py | jmalobicky/azure-sdk-for-python | 61234a3d83f8fb481d1dd2386e54e888864878fd | [
"MIT"
] | 1 | 2018-07-23T08:59:24.000Z | 2018-07-23T08:59:24.000Z | azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account.py | jmalobicky/azure-sdk-for-python | 61234a3d83f8fb481d1dd2386e54e888864878fd | [
"MIT"
] | null | null | null | azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/database_account.py | jmalobicky/azure-sdk-for-python | 61234a3d83f8fb481d1dd2386e54e888864878fd | [
"MIT"
] | 1 | 2018-08-28T14:36:47.000Z | 2018-08-28T14:36:47.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 50.992308 | 122 | 0.683361 |
from .resource import Resource
class DatabaseAccount(Resource):
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
'document_endpoint': {'readonly': True},
'database_account_o... | true | true |
f746e0d0b3d6b11eed2e77ec136a44ed5b9ede78 | 84 | py | Python | Python/School/C3/exercise 6.py | abdalrhmanyasser/Abdalrhman_Rep | e0fc3caa2cc04e92f591ccd7934586986d194000 | [
"CC0-1.0"
] | null | null | null | Python/School/C3/exercise 6.py | abdalrhmanyasser/Abdalrhman_Rep | e0fc3caa2cc04e92f591ccd7934586986d194000 | [
"CC0-1.0"
] | null | null | null | Python/School/C3/exercise 6.py | abdalrhmanyasser/Abdalrhman_Rep | e0fc3caa2cc04e92f591ccd7934586986d194000 | [
"CC0-1.0"
] | null | null | null | sec = eval(input("input secs"))
print(sec, "seconds", sec//60, "min", sec%60, "sec") | 42 | 52 | 0.619048 | sec = eval(input("input secs"))
print(sec, "seconds", sec//60, "min", sec%60, "sec") | true | true |
f746e1fca8dd854b219341f61188e5f948f1ebf7 | 2,336 | py | Python | git/__init__.py | zengqingfu1442/GitPython | f0c6e1164f390081a27de952552aa83d34035f2a | [
"BSD-3-Clause"
] | null | null | null | git/__init__.py | zengqingfu1442/GitPython | f0c6e1164f390081a27de952552aa83d34035f2a | [
"BSD-3-Clause"
] | null | null | null | git/__init__.py | zengqingfu1442/GitPython | f0c6e1164f390081a27de952552aa83d34035f2a | [
"BSD-3-Clause"
] | null | null | null | # __init__.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
# flake8: noqa
# @PydevCodeAnalysisIgnore
from git.exc import * # @NoMove @IgnorePep8
import inspec... | 25.11828 | 105 | 0.65839 |
from git.exc import *
import inspect
import os
import sys
import os.path as osp
from typing import Optional
from git.types import PathLike
__version__ = "git"
def _init_externals() -> None:
if __version__ == "git" and "PYOXIDIZER" not in os.environ:
sys.path.insert(1, osp.join(osp.dirname(__fi... | true | true |
f746e2417be82e26e63f723ad3dda8c4de184a51 | 14,432 | py | Python | python/ccxt/__init__.py | yw910915/ccxt | fb4115b1b90a23a87687789f6715f11ac9d4fb1e | [
"MIT"
] | 1 | 2021-06-13T06:49:03.000Z | 2021-06-13T06:49:03.000Z | python/ccxt/__init__.py | yw910915/ccxt | fb4115b1b90a23a87687789f6715f11ac9d4fb1e | [
"MIT"
] | null | null | null | python/ccxt/__init__.py | yw910915/ccxt | fb4115b1b90a23a87687789f6715f11ac9d4fb1e | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""CCXT: CryptoCurrency eXchange Trading Library"""
# MIT License
# Copyright (c) 2017 Igor Kroitor
# 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 restricti... | 46.25641 | 80 | 0.535754 |
__version__ = '1.50.91'
from ccxt.base.exchange import Exchange
from ccxt.base.decimal_to_precision import decimal_to_precision
from ccxt.base.decimal_to_precision import TRUNCATE
from ccxt.base.decimal_to_precision import ROUND
from ccxt.... | true | true |
f746e353028bfde5efb882a546886705ad672b84 | 346 | py | Python | ep009_generatornotcomprehension.py | jpch89/effectivepython | 97ba297bf987f346219bf8de5198c0817f5146e0 | [
"MIT"
] | null | null | null | ep009_generatornotcomprehension.py | jpch89/effectivepython | 97ba297bf987f346219bf8de5198c0817f5146e0 | [
"MIT"
] | null | null | null | ep009_generatornotcomprehension.py | jpch89/effectivepython | 97ba297bf987f346219bf8de5198c0817f5146e0 | [
"MIT"
] | null | null | null | value = [len(x) for x in open('ep001_version.py')]
print(value)
"""
[11, 24, 19, 1, 4, 76, 77, 4]
"""
it = (len(x) for x in open('ep001_version.py'))
print(it)
print(next(it))
print(next(it))
"""
<generator object <genexpr> at 0x0000023D58EAAA40>
11
24
"""
roots = ((x, x ** 0.5) for x in it)
print(next(roots))
"""
(1... | 15.727273 | 50 | 0.612717 | value = [len(x) for x in open('ep001_version.py')]
print(value)
it = (len(x) for x in open('ep001_version.py'))
print(it)
print(next(it))
print(next(it))
roots = ((x, x ** 0.5) for x in it)
print(next(roots))
| true | true |
f746e375889bcd3575888cb97d35b19739a76953 | 2,267 | py | Python | popbl_servicesapp/flask_app/order/application/models.py | xetxezarreta/master-popbl1 | 253880b9ba358f63f666893cdbbffe7391fcd096 | [
"MIT"
] | null | null | null | popbl_servicesapp/flask_app/order/application/models.py | xetxezarreta/master-popbl1 | 253880b9ba358f63f666893cdbbffe7391fcd096 | [
"MIT"
] | 1 | 2021-06-02T00:57:11.000Z | 2021-06-02T00:57:11.000Z | popbl_servicesapp/flask_app/order/application/models.py | xetxezarreta/master-popbl1 | 253880b9ba358f63f666893cdbbffe7391fcd096 | [
"MIT"
] | null | null | null | from sqlalchemy import Column, DateTime, Integer, String, TEXT, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class BaseModel(Base):
__abstract__ = True
creation_date = Column(DateTime(timez... | 34.876923 | 98 | 0.676224 | from sqlalchemy import Column, DateTime, Integer, String, TEXT, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class BaseModel(Base):
__abstract__ = True
creation_date = Column(DateTime(timez... | true | true |
f746e3a5ab649ccd995197e2bbba67bad42f2923 | 1,602 | py | Python | python/architectures/sentinel2-ndwi.py | geotrellis/deeplab-nlcd | 9444299597e1d1bc34ee187f2092890449c188be | [
"MIT"
] | null | null | null | python/architectures/sentinel2-ndwi.py | geotrellis/deeplab-nlcd | 9444299597e1d1bc34ee187f2092890449c188be | [
"MIT"
] | 7 | 2019-08-21T20:01:12.000Z | 2020-07-15T19:59:23.000Z | python/architectures/sentinel2-ndwi.py | geotrellis/deeplab-nlcd | 9444299597e1d1bc34ee187f2092890449c188be | [
"MIT"
] | 2 | 2019-08-21T20:44:18.000Z | 2021-01-29T02:58:15.000Z | # The MIT License (MIT)
# =====================
#
# Copyright © 2020 Azavea
#
# 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... | 37.255814 | 87 | 0.716604 |
class SentinelNDWI(torch.nn.Module):
def __init__(self, band_count):
super(SentinelNDWI, self).__init__()
self.no_weights = True
def forward(self, x):
self.nir = x[:, 7:8, :, :]
self.green = x[:, 2:3, :, :]
return (self.green - self.nir)/(self... | true | true |
f746e3e3e112fbe4d817f76958e6cb48a6f9f1db | 10,437 | py | Python | src/fireo/managers/managers.py | site-hopper/FireO | 17fc675f587402c26621bcbb1c5c695ec31e3a66 | [
"Apache-2.0"
] | null | null | null | src/fireo/managers/managers.py | site-hopper/FireO | 17fc675f587402c26621bcbb1c5c695ec31e3a66 | [
"Apache-2.0"
] | null | null | null | src/fireo/managers/managers.py | site-hopper/FireO | 17fc675f587402c26621bcbb1c5c695ec31e3a66 | [
"Apache-2.0"
] | null | null | null | import base64
import json
from fireo.fields import NestedModel
from fireo.fields.errors import FieldNotFound
from fireo.queries import query_set as queries
class ManagerError(Exception):
pass
class ManagerDescriptor:
"""Restrict user to get `Manager` from model instance and from abstract model"""
def _... | 33.451923 | 118 | 0.637444 | import base64
import json
from fireo.fields import NestedModel
from fireo.fields.errors import FieldNotFound
from fireo.queries import query_set as queries
class ManagerError(Exception):
pass
class ManagerDescriptor:
def __init__(self, manager):
self.manager = manager
def __get__(self, instanc... | true | true |
f746e4352d6529cb4d4a7d4626cc9aa0499ca7d6 | 3,242 | py | Python | setup.py | adrianp/citeproc-py | c3d97e2969ecf13e896987cad1c6aeb00fb23abc | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | setup.py | adrianp/citeproc-py | c3d97e2969ecf13e896987cad1c6aeb00fb23abc | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | setup.py | adrianp/citeproc-py | c3d97e2969ecf13e896987cad1c6aeb00fb23abc | [
"BSD-2-Clause-FreeBSD"
] | 4 | 2018-03-18T21:02:24.000Z | 2020-01-14T14:50:51.000Z | #!/usr/bin/env python
"""
Setup script for citeproc-py
"""
import os
import re
import sys
from datetime import datetime
from subprocess import Popen, PIPE
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py
from setuptools.command.develop import develop
PACKAGE = 'citeproc'... | 30.018519 | 71 | 0.631092 |
import os
import re
import sys
from datetime import datetime
from subprocess import Popen, PIPE
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py
from setuptools.command.develop import develop
PACKAGE = 'citeproc'
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
PA... | true | true |
f746e4bbb638722603086c16e55a41ba6db6ba62 | 5,976 | py | Python | sympy/functions/elementary/integers.py | shipci/sympy | 4b59927bed992b980c9b3faac01becb36feef26b | [
"BSD-3-Clause"
] | 1 | 2015-01-14T22:55:45.000Z | 2015-01-14T22:55:45.000Z | sympy/functions/elementary/integers.py | curzel-it/KiPyCalc | 909c783d5e6967ea58ca93f875106d8a8e3ca5db | [
"MIT"
] | null | null | null | sympy/functions/elementary/integers.py | curzel-it/KiPyCalc | 909c783d5e6967ea58ca93f875106d8a8e3ca5db | [
"MIT"
] | null | null | null | from __future__ import print_function, division
from sympy.core.basic import C
from sympy.core.singleton import S
from sympy.core.function import Function
from sympy.core import Add
from sympy.core.evalf import get_integer_part, PrecisionExhausted
from sympy.core.relational import Gt, Lt, Ge, Le, Eq
#################... | 29.009709 | 88 | 0.538487 | from __future__ import print_function, division
from sympy.core.basic import C
from sympy.core.singleton import S
from sympy.core.function import Function
from sympy.core import Add
from sympy.core.evalf import get_integer_part, PrecisionExhausted
from sympy.core.relational import Gt, Lt, Ge, Le, Eq
| true | true |
f746e526bdda90640b97fc58c0d453d2869ab5d8 | 5,174 | py | Python | tests/tangerine_whistle/vm/test_arithmetic_operations.py | petertdavies/execution-specs | fabda289c747f535f1d2851ec7ebd0caa89f423f | [
"CC0-1.0"
] | 102 | 2021-08-19T02:44:03.000Z | 2022-03-27T23:46:00.000Z | tests/tangerine_whistle/vm/test_arithmetic_operations.py | petertdavies/execution-specs | fabda289c747f535f1d2851ec7ebd0caa89f423f | [
"CC0-1.0"
] | 264 | 2021-08-18T14:15:26.000Z | 2022-03-31T12:24:23.000Z | tests/tangerine_whistle/vm/test_arithmetic_operations.py | ultratwo/execution-specs | 55d7fd716fc194b30e37a6e487c191445dfec9bc | [
"CC0-1.0"
] | 30 | 2021-08-20T05:38:34.000Z | 2022-01-19T06:49:29.000Z | from functools import partial
import pytest
from ..vm.vm_test_helpers import run_test
run_arithmetic_vm_test = partial(
run_test,
"tests/fixtures/LegacyTests/Constantinople/VMTests/vmArithmeticTest",
)
@pytest.mark.parametrize(
"test_file",
[
"add0.json",
"add1.json",
"add2.... | 22.111111 | 73 | 0.583301 | from functools import partial
import pytest
from ..vm.vm_test_helpers import run_test
run_arithmetic_vm_test = partial(
run_test,
"tests/fixtures/LegacyTests/Constantinople/VMTests/vmArithmeticTest",
)
@pytest.mark.parametrize(
"test_file",
[
"add0.json",
"add1.json",
"add2.... | true | true |
f746e7bc37e8f7227a9901af431dced8c8d78921 | 15,542 | py | Python | lib/dataset/coco.py | ducongju/HRNet | 8c6e1580d0410c439d16a9f220bf0ac48fb39e9a | [
"MIT"
] | null | null | null | lib/dataset/coco.py | ducongju/HRNet | 8c6e1580d0410c439d16a9f220bf0ac48fb39e9a | [
"MIT"
] | 1 | 2020-02-15T14:53:56.000Z | 2020-02-15T14:53:56.000Z | lib/dataset/coco.py | ducongju/HRNet | 8c6e1580d0410c439d16a9f220bf0ac48fb39e9a | [
"MIT"
] | null | null | null | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __futu... | 34.158242 | 112 | 0.520396 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import defaultdict
from collections import OrderedDict
import logging
import os
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
import json_tricks as json
imp... | true | true |
f746e88951e84fd295fa7583d914254545239826 | 18,171 | py | Python | test/test_path.py | bouke-nederstigt/scriptine | 01b17573efc9c96cbf4016ade657e945279aa075 | [
"MIT"
] | 2 | 2018-11-12T11:57:59.000Z | 2019-04-27T17:52:35.000Z | test/test_path.py | schlichtanders/scriptine | 8dbcd5540007676614eb972a77bea10f9e8c73ad | [
"MIT"
] | null | null | null | test/test_path.py | schlichtanders/scriptine | 8dbcd5540007676614eb972a77bea10f9e8c73ad | [
"MIT"
] | 4 | 2017-09-29T06:14:04.000Z | 2021-09-08T22:27:08.000Z | """ test_path.py - Test the path module.
This only runs on Posix and NT right now. I would like to have more
tests. You can help! Just add appropriate pathnames for your
platform (os.name) in each place where the p() function is called.
Then send me the result. If you can't get the test to run at all on
your... | 35.559687 | 102 | 0.515327 |
import unittest
import codecs, os, random, shutil, tempfile, time, stat, sys
from scriptine._path import path, __version__ as path_version
__version__ = '2.2'
if sys.platform in ('cygwin', 'win32'):
is_windows = True
else:
is_windows = False
def p(**choices):
return choices[os.name]
... | true | true |
f746ea3097b7b326f2fa01df7c61da4f5e6ea7f9 | 15,135 | py | Python | test/test_serialization.py | jkulhanek/torchdata | 2e8b9f613a13c74b424651649f317c7b322131d6 | [
"BSD-3-Clause"
] | null | null | null | test/test_serialization.py | jkulhanek/torchdata | 2e8b9f613a13c74b424651649f317c7b322131d6 | [
"BSD-3-Clause"
] | null | null | null | test/test_serialization.py | jkulhanek/torchdata | 2e8b9f613a13c74b424651649f317c7b322131d6 | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
import pickle
import unittest
import warnings
from functools import partial
from io import StringIO
f... | 40.795148 | 119 | 0.557582 |
import os
import pickle
import unittest
import warnings
from functools import partial
from io import StringIO
from operator import itemgetter
from typing import List
import expecttest
import torchdata.datapipes.iter as iterdp
from _utils._common_utils_for_test import create_temp_dir, create_temp_files
from torch... | true | true |
f746ec87a58fa481e281d78f1fcd3a9255503fa2 | 4,011 | py | Python | scripts/extract_gps.py | frankdvd/curb-monitor | a5ad37a9dd0ca93477dffc647d2dfe7a8d9361e0 | [
"BSD-2-Clause"
] | null | null | null | scripts/extract_gps.py | frankdvd/curb-monitor | a5ad37a9dd0ca93477dffc647d2dfe7a8d9361e0 | [
"BSD-2-Clause"
] | null | null | null | scripts/extract_gps.py | frankdvd/curb-monitor | a5ad37a9dd0ca93477dffc647d2dfe7a8d9361e0 | [
"BSD-2-Clause"
] | null | null | null | from pathlib import Path
import os, sys, shutil
import subprocess
import pandas as pd
import string
if len(sys.argv) != 2:
print("Usage: ./extract_gps.py <video dir>")
sys.exit()
def convert_latlong(in_str):
split_latlong = in_str.split(' ')
return float(split_latlong[0]) + float(split_latlong[2][:-1]... | 40.928571 | 172 | 0.610571 | from pathlib import Path
import os, sys, shutil
import subprocess
import pandas as pd
import string
if len(sys.argv) != 2:
print("Usage: ./extract_gps.py <video dir>")
sys.exit()
def convert_latlong(in_str):
split_latlong = in_str.split(' ')
return float(split_latlong[0]) + float(split_latlong[2][:-1]... | true | true |
f746ee7608169372e1b47ec0ff891d88135d2d04 | 431 | py | Python | app/core/migrations/0005_recipe_image.py | Khande1n/recipe-app-api | 0b2f1f91d18ab51f73b957a92ba46287ce958867 | [
"MIT"
] | null | null | null | app/core/migrations/0005_recipe_image.py | Khande1n/recipe-app-api | 0b2f1f91d18ab51f73b957a92ba46287ce958867 | [
"MIT"
] | null | null | null | app/core/migrations/0005_recipe_image.py | Khande1n/recipe-app-api | 0b2f1f91d18ab51f73b957a92ba46287ce958867 | [
"MIT"
] | null | null | null | # Generated by Django 2.1.15 on 2020-09-04 07:14
import core.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_recipe'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='image',
... | 21.55 | 93 | 0.62181 |
import core.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_recipe'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='image',
field=models.ImageField(null=True, u... | true | true |
f746ee840db95d9b820396b2ce66219f50de535c | 15,296 | py | Python | text/src/autogluon/text/automm/optimization/utils.py | sgdread/autogluon | fa95c72a07066dc5380fccf8bbce04b5c031fc68 | [
"Apache-2.0"
] | null | null | null | text/src/autogluon/text/automm/optimization/utils.py | sgdread/autogluon | fa95c72a07066dc5380fccf8bbce04b5c031fc68 | [
"Apache-2.0"
] | null | null | null | text/src/autogluon/text/automm/optimization/utils.py | sgdread/autogluon | fa95c72a07066dc5380fccf8bbce04b5c031fc68 | [
"Apache-2.0"
] | null | null | null | from typing import Optional, Union, Tuple, List, Dict
import functools
from torch import nn
from torch import optim
from torch.nn import functional as F
from transformers.trainer_pt_utils import get_parameter_names
import torchmetrics
from .lr_scheduler import (
get_cosine_schedule_with_warmup,
get_polynomial_d... | 32.338266 | 119 | 0.623562 | from typing import Optional, Union, Tuple, List, Dict
import functools
from torch import nn
from torch import optim
from torch.nn import functional as F
from transformers.trainer_pt_utils import get_parameter_names
import torchmetrics
from .lr_scheduler import (
get_cosine_schedule_with_warmup,
get_polynomial_d... | true | true |
f746ef6951a392add78efe67132598b22a1b6e10 | 5,323 | py | Python | test/torchaudio_unittest/common_utils/data_utils.py | xiaohui-zhang/audio | 0ec482cedfe82b209d23769a286fcd7d3fd468d2 | [
"BSD-2-Clause"
] | null | null | null | test/torchaudio_unittest/common_utils/data_utils.py | xiaohui-zhang/audio | 0ec482cedfe82b209d23769a286fcd7d3fd468d2 | [
"BSD-2-Clause"
] | null | null | null | test/torchaudio_unittest/common_utils/data_utils.py | xiaohui-zhang/audio | 0ec482cedfe82b209d23769a286fcd7d3fd468d2 | [
"BSD-2-Clause"
] | null | null | null | import os.path
from typing import Union, Optional
import torch
_TEST_DIR_PATH = os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))
def get_asset_path(*paths):
"""Return full path of a test asset"""
return os.path.join(_TEST_DIR_PATH, "assets", *paths)
def convert_tensor_encoding(
tensor:... | 33.26875 | 106 | 0.646816 | import os.path
from typing import Union, Optional
import torch
_TEST_DIR_PATH = os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))
def get_asset_path(*paths):
return os.path.join(_TEST_DIR_PATH, "assets", *paths)
def convert_tensor_encoding(
tensor: torch.tensor,
dtype: torch.dtype,
):
... | true | true |
f746efa5ac00455c419f4ae7e98447c33c821127 | 716 | py | Python | src/genie/libs/parser/bigip/get_ltm_profileserver_ssl.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | 204 | 2018-06-27T00:55:27.000Z | 2022-03-06T21:12:18.000Z | src/genie/libs/parser/bigip/get_ltm_profileserver_ssl.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | 468 | 2018-06-19T00:33:18.000Z | 2022-03-31T23:23:35.000Z | src/genie/libs/parser/bigip/get_ltm_profileserver_ssl.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | 309 | 2019-01-16T20:21:07.000Z | 2022-03-30T12:56:41.000Z | # Global Imports
import json
from collections import defaultdict
# Metaparser
from genie.metaparser import MetaParser
# =============================================
# Collection for '/mgmt/tm/ltm/profile/server-ssl' resources
# =============================================
class LtmProfileServersslSchema(MetaParse... | 21.058824 | 60 | 0.604749 |
import json
from collections import defaultdict
from genie.metaparser import MetaParser
class LtmProfileServersslSchema(MetaParser):
schema = {}
class LtmProfileServerssl(LtmProfileServersslSchema):
cli_command = "/mgmt/tm/ltm/profile/server-ssl"
def rest(self):
response = self.device... | true | true |
f746f1ae51aadb8b04701033f1ace965902af4ed | 36,262 | py | Python | mesonbuild/cmake/interpreter.py | Simske/meson | 29a25266aa3c5723f4454b4bd9aa19dc3c952def | [
"Apache-2.0"
] | null | null | null | mesonbuild/cmake/interpreter.py | Simske/meson | 29a25266aa3c5723f4454b4bd9aa19dc3c952def | [
"Apache-2.0"
] | null | null | null | mesonbuild/cmake/interpreter.py | Simske/meson | 29a25266aa3c5723f4454b4bd9aa19dc3c952def | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to ... | 41.020362 | 150 | 0.582125 |
from .common import CMakeException
from .client import CMakeClient, RequestCMakeInputs, RequestConfigure, RequestCompute, RequestCodeModel, CMakeTarget
from .executor import CMakeExecutor
from .traceparser import CMakeTraceParser, CMakeGeneratorTarget
from .. import mlog
from ..environment import Envir... | true | true |
f746f1f5e639f6e1f511d105080750061fa4c502 | 1,506 | py | Python | nordlys/tagme/test_coll.py | tc64/TAGME-Reproducibility | 79011798bb155555b1b164722693a6b9ae487e4f | [
"MIT"
] | 47 | 2016-09-15T21:56:19.000Z | 2022-03-17T20:48:44.000Z | nordlys/tagme/test_coll.py | tc64/TAGME-Reproducibility | 79011798bb155555b1b164722693a6b9ae487e4f | [
"MIT"
] | 1 | 2021-05-21T20:16:03.000Z | 2021-05-26T09:07:10.000Z | nordlys/tagme/test_coll.py | tc64/TAGME-Reproducibility | 79011798bb155555b1b164722693a6b9ae487e4f | [
"MIT"
] | 16 | 2016-09-10T12:45:08.000Z | 2021-06-22T13:05:51.000Z | """
Reads queries from test collections
@author: Faegheh Hasibi (faegheh.hasibi@idi.ntnu.no)
"""
import csv
from nordlys.tagme import config
def read_yerd_queries(y_erd_file=config.Y_ERD):
"""
Reads queries from Erd query file.
:return dictionary {query_id : query_content}
"""
queries = {}
... | 24.290323 | 78 | 0.61089 | """
Reads queries from test collections
@author: Faegheh Hasibi (faegheh.hasibi@idi.ntnu.no)
"""
import csv
from nordlys.tagme import config
def read_yerd_queries(y_erd_file=config.Y_ERD):
"""
Reads queries from Erd query file.
:return dictionary {query_id : query_content}
"""
queries = {}
... | false | true |
f746f1fb7f9bde50ad55d41864e13d371dcfee52 | 1,595 | py | Python | fastapi_app/main.py | DanNduati/AT-USSD | 03036928f73414d36dd09ae7b32c3d9169df6c4d | [
"MIT"
] | 1 | 2022-02-26T19:40:49.000Z | 2022-02-26T19:40:49.000Z | fastapi_app/main.py | DanNduati/at-ussd | 03036928f73414d36dd09ae7b32c3d9169df6c4d | [
"MIT"
] | null | null | null | fastapi_app/main.py | DanNduati/at-ussd | 03036928f73414d36dd09ae7b32c3d9169df6c4d | [
"MIT"
] | null | null | null | from fastapi import FastAPI, Form
from fastapi.responses import HTMLResponse
from pydantic import BaseModel
from typing import Optional
app = FastAPI()
class UssdParams(BaseModel):
session_id: str
service_code: str
phone_number: str
text: str
# dummy acc. data
accounts = {
"A001": {
"bi... | 25.725806 | 144 | 0.587461 | from fastapi import FastAPI, Form
from fastapi.responses import HTMLResponse
from pydantic import BaseModel
from typing import Optional
app = FastAPI()
class UssdParams(BaseModel):
session_id: str
service_code: str
phone_number: str
text: str
accounts = {
"A001": {
"bill": "420"
},... | true | true |
f746f2479058ca4ff9f8b1c08a7ee8b05cb4d0a3 | 5,004 | py | Python | session/speaker-change/finetune-vggvox-v2.py | ishine/malaya-speech | fd34afc7107af1656dff4b3201fa51dda54fde18 | [
"MIT"
] | 111 | 2020-08-31T04:58:54.000Z | 2022-03-29T15:44:18.000Z | session/speaker-change/finetune-vggvox-v2.py | ishine/malaya-speech | fd34afc7107af1656dff4b3201fa51dda54fde18 | [
"MIT"
] | 14 | 2020-12-16T07:27:22.000Z | 2022-03-15T17:39:01.000Z | session/speaker-change/finetune-vggvox-v2.py | ishine/malaya-speech | fd34afc7107af1656dff4b3201fa51dda54fde18 | [
"MIT"
] | 29 | 2021-02-09T08:57:15.000Z | 2022-03-12T14:09:19.000Z | import os
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = '../gcs/mesolitica-storage.json'
os.environ['CUDA_VISIBLE_DEVICES'] = '1'
import tensorflow as tf
import malaya_speech.train as train
import malaya_speech.train.model.vggvox_v2 as vggvox_v2
import malaya_speech
from glob import glob
import librosa
import numpy ... | 26.903226 | 90 | 0.653477 | import os
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = '../gcs/mesolitica-storage.json'
os.environ['CUDA_VISIBLE_DEVICES'] = '1'
import tensorflow as tf
import malaya_speech.train as train
import malaya_speech.train.model.vggvox_v2 as vggvox_v2
import malaya_speech
from glob import glob
import librosa
import numpy ... | true | true |
f746f33e8660040cbfab363fcd1ee072a3a13503 | 3,859 | py | Python | test/unit/pulled_search/config_override.py | mjpernot/pulled-search | 2c8f4dee420f0c2fc12867b2a642e3a530d2f24c | [
"MIT"
] | null | null | null | test/unit/pulled_search/config_override.py | mjpernot/pulled-search | 2c8f4dee420f0c2fc12867b2a642e3a530d2f24c | [
"MIT"
] | null | null | null | test/unit/pulled_search/config_override.py | mjpernot/pulled-search | 2c8f4dee420f0c2fc12867b2a642e3a530d2f24c | [
"MIT"
] | null | null | null | #!/usr/bin/python
# Classification (U)
"""Program: config_override.py
Description: Unit testing of config_override in pulled_search.py.
Usage:
test/unit/pulled_search/config_override.py
Arguments:
"""
# Libraries and Global Variables
# Standard
import sys
import os
if sys.version_info < (2... | 24.424051 | 78 | 0.614926 |
import sys
import os
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
sys.path.append(os.getcwd())
import pulled_search
import version
__version__ = version.__version__
class UnitTest(unittest.TestCase):
def setUp(self):
class CfgTest(object):
... | true | true |
f746f3d2041b6c28eecb891511342788e67d7188 | 1,353 | py | Python | 1-50/13_roman-to-integer.py | ChenhaoJiang/LeetCode-Solution | b2119ad938c18f75948d0f5cf4ae3773820dcc93 | [
"MIT"
] | 16 | 2019-03-30T07:25:27.000Z | 2020-07-28T15:34:53.000Z | 1-50/13_roman-to-integer.py | ChenhaoJiang/LeetCode-Solution | b2119ad938c18f75948d0f5cf4ae3773820dcc93 | [
"MIT"
] | null | null | null | 1-50/13_roman-to-integer.py | ChenhaoJiang/LeetCode-Solution | b2119ad938c18f75948d0f5cf4ae3773820dcc93 | [
"MIT"
] | 2 | 2020-06-26T13:02:14.000Z | 2020-07-28T04:59:15.000Z | """
Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999.
Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
Note:There are six instances where subtraction is used:
I can be pla... | 24.6 | 107 | 0.501848 |
class Solution(object):
def romanToInt(self, s):
num=0
dict={'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000}
for i in range(len(s)):
num=num+dict[s[i]]
if i>0:
if (s[i]=='M' or s[i]=='D') and s[i-1]=='C':
num=num-200
... | true | true |
f746f427bba97aebd5f9a7a3e487a80eb93af046 | 1,141 | py | Python | Image Processing/11_Template_Matching.py | siddarthjha/Opencv | ccf26ade18a4a04da464acbbc15f074904fab208 | [
"MIT"
] | 2 | 2020-08-03T13:24:04.000Z | 2020-08-27T16:32:21.000Z | Image Processing/11_Template_Matching.py | siddarthjha/Opencv | ccf26ade18a4a04da464acbbc15f074904fab208 | [
"MIT"
] | null | null | null | Image Processing/11_Template_Matching.py | siddarthjha/Opencv | ccf26ade18a4a04da464acbbc15f074904fab208 | [
"MIT"
] | null | null | null | import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('a.jpg',0)
img2 = img.copy()
template = cv2.imread('b.jpg',0)
w, h = template.shape[::-1]
# All the 6 methods for comparison in a list
methods = ['cv2.TM_CCOEFF', 'cv2.TM_CCOEFF_NORMED', 'cv2.TM_CCORR',
'cv2.TM_CCORR_NORME... | 30.026316 | 75 | 0.66433 | import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('a.jpg',0)
img2 = img.copy()
template = cv2.imread('b.jpg',0)
w, h = template.shape[::-1]
methods = ['cv2.TM_CCOEFF', 'cv2.TM_CCOEFF_NORMED', 'cv2.TM_CCORR',
'cv2.TM_CCORR_NORMED', 'cv2.TM_SQDIFF', 'cv2.TM_SQDIFF_NORMED']... | true | true |
f746f495848266e9d529539941dfced8de42c923 | 1,060 | py | Python | app/backend/commands/commands.py | alexraileanu/yacms | e95f90416d91abf7e379149eaa5d1485eaa7657c | [
"MIT"
] | 2 | 2017-09-29T18:08:55.000Z | 2017-10-06T04:00:26.000Z | app/backend/commands/commands.py | alexraileanu/yacms | e95f90416d91abf7e379149eaa5d1485eaa7657c | [
"MIT"
] | 9 | 2017-10-02T07:31:23.000Z | 2019-10-24T08:05:45.000Z | app/backend/commands/commands.py | alexraileanu/yacms | e95f90416d91abf7e379149eaa5d1485eaa7657c | [
"MIT"
] | 2 | 2017-10-02T12:06:42.000Z | 2017-10-19T19:23:53.000Z | import click
from app import app, db
from app.backend.models.user import User
from app.backend.models.cms import CMS
from app.backend import user_manager
from sqlalchemy.exc import SQLAlchemyError
from redis.exceptions import RedisError
@app.cli.command()
def seed():
"""
Add initial users to the db.
"""
... | 26.5 | 77 | 0.663208 | import click
from app import app, db
from app.backend.models.user import User
from app.backend.models.cms import CMS
from app.backend import user_manager
from sqlalchemy.exc import SQLAlchemyError
from redis.exceptions import RedisError
@app.cli.command()
def seed():
user = User(username='demo', password=user_man... | true | true |
f746f503723de667eed901200ef02a87e39998d1 | 5,779 | py | Python | shopify/products/api_wrapper.py | alikhan126/python-shopify-api | 656cdf1af99485b25be545e2ed527bcb653076fd | [
"Unlicense"
] | 10 | 2016-12-29T06:53:21.000Z | 2022-03-01T10:35:32.000Z | shopify/products/api_wrapper.py | alikhan126/python-shopify-api | 656cdf1af99485b25be545e2ed527bcb653076fd | [
"Unlicense"
] | 4 | 2016-12-30T15:12:47.000Z | 2021-07-24T07:14:20.000Z | shopify/products/api_wrapper.py | alikhan126/python-shopify-api | 656cdf1af99485b25be545e2ed527bcb653076fd | [
"Unlicense"
] | 8 | 2016-12-29T19:13:39.000Z | 2022-03-22T18:02:58.000Z | import json
import requests
from .objects import Product
from ..base import ShopifyApiWrapper, ShopifyApiError, datetime_to_string
class ProductsApiWrapper(ShopifyApiWrapper):
valid_published_status_values = [
'published',
'unpublished',
'any'
]
max_results_limit = 250
def... | 35.89441 | 111 | 0.622426 | import json
import requests
from .objects import Product
from ..base import ShopifyApiWrapper, ShopifyApiError, datetime_to_string
class ProductsApiWrapper(ShopifyApiWrapper):
valid_published_status_values = [
'published',
'unpublished',
'any'
]
max_results_limit = 250
def... | true | true |
f746f6523423abe8f573f31eeaf9983aad86dca3 | 19,236 | py | Python | package/models.py | dmoney/djangopackages | 746cd47f8171229da3276b81d3c8454bdd887928 | [
"MIT"
] | null | null | null | package/models.py | dmoney/djangopackages | 746cd47f8171229da3276b81d3c8454bdd887928 | [
"MIT"
] | null | null | null | package/models.py | dmoney/djangopackages | 746cd47f8171229da3276b81d3c8454bdd887928 | [
"MIT"
] | null | null | null | from datetime import datetime, timedelta
import json
import re
import math
from dateutil import relativedelta
from django.core.cache import cache
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.postgres.fields import ArrayField
from django.core.exceptions import ObjectD... | 33.222798 | 136 | 0.617124 | from datetime import datetime, timedelta
import json
import re
import math
from dateutil import relativedelta
from django.core.cache import cache
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.postgres.fields import ArrayField
from django.core.exceptions import ObjectD... | true | true |
f746f723768c11ef7989faf5833fd13abfefb6e0 | 148 | py | Python | tests/test_example.py | Luzkan/MessengerNotifier | 462c6b1a9aa0a29a0dd6b5fc77d0677c61962d5d | [
"Linux-OpenIB"
] | 4 | 2020-06-01T09:01:47.000Z | 2021-04-16T20:07:29.000Z | tests/test_example.py | Luzkan/NotifAyy | 462c6b1a9aa0a29a0dd6b5fc77d0677c61962d5d | [
"Linux-OpenIB"
] | 20 | 2020-06-05T16:54:36.000Z | 2020-06-09T13:25:59.000Z | tests/test_example.py | Luzkan/MessengerNotifier | 462c6b1a9aa0a29a0dd6b5fc77d0677c61962d5d | [
"Linux-OpenIB"
] | 2 | 2020-05-07T04:51:00.000Z | 2020-05-08T17:52:55.000Z | from web.msnotifier.example import add
def test_add_correct():
assert add(5, 7) == 12
def test_add_incorrect():
assert add(15, 8) != 21
| 14.8 | 38 | 0.675676 | from web.msnotifier.example import add
def test_add_correct():
assert add(5, 7) == 12
def test_add_incorrect():
assert add(15, 8) != 21
| true | true |
f746f7dd89f0ea21772cf57a1d5fcb0095ad25f8 | 3,423 | py | Python | evaluate.py | terry97-guel/SMInet | e4c158fb03096a12723bb474c3e468044eca46a6 | [
"MIT"
] | 1 | 2022-02-24T06:57:55.000Z | 2022-02-24T06:57:55.000Z | evaluate.py | terry97-guel/SMInet | e4c158fb03096a12723bb474c3e468044eca46a6 | [
"MIT"
] | null | null | null | evaluate.py | terry97-guel/SMInet | e4c158fb03096a12723bb474c3e468044eca46a6 | [
"MIT"
] | null | null | null | import torch
from model import *
from dataloader import *
from utils.pyart import *
import argparse
import numpy as np
from pathlib import Path
def main(args):
print("Processing...")
# set device:
if torch.cuda.is_available():
device = torch.device('cuda:0')
else:
device = torch.device... | 35.65625 | 119 | 0.672509 | import torch
from model import *
from dataloader import *
from utils.pyart import *
import argparse
import numpy as np
from pathlib import Path
def main(args):
print("Processing...")
if torch.cuda.is_available():
device = torch.device('cuda:0')
else:
device = torch.device('cpu')
... | true | true |
f746f7f83960eb5c68fa83f73cc1db5a6aaa40df | 96 | py | Python | flask_app/run.py | nablabits/fareharbor-webhook | 70e415b9ccd45220693eecb6a668746a1282dd03 | [
"MIT"
] | null | null | null | flask_app/run.py | nablabits/fareharbor-webhook | 70e415b9ccd45220693eecb6a668746a1282dd03 | [
"MIT"
] | 1 | 2021-06-02T18:26:18.000Z | 2021-06-02T18:26:18.000Z | flask_app/run.py | nablabits/fareharbor-webhook | 70e415b9ccd45220693eecb6a668746a1282dd03 | [
"MIT"
] | null | null | null | from fh_webhook import create_app
app = create_app()
if __name__ == "__main__":
app.run()
| 13.714286 | 33 | 0.697917 | from fh_webhook import create_app
app = create_app()
if __name__ == "__main__":
app.run()
| true | true |
f746f8ec414a8056497ca226e519aa79ef26a968 | 925 | py | Python | django_lazifier2/utils/builtin_types/param.py | hotmit/-django-lazifier2 | b290e0423966db030ee01df7a65890ca36e10ba8 | [
"MIT"
] | 1 | 2017-04-27T19:25:34.000Z | 2017-04-27T19:25:34.000Z | django_lazifier2/utils/builtin_types/param.py | hotmit/-django-lazifier2 | b290e0423966db030ee01df7a65890ca36e10ba8 | [
"MIT"
] | 3 | 2021-03-19T00:25:53.000Z | 2021-09-22T18:40:00.000Z | django_lazifier2/utils/builtin_types/param.py | hotmit/-django-lazifier2 | b290e0423966db030ee01df7a65890ca36e10ba8 | [
"MIT"
] | null | null | null |
class Prm:
@classmethod
def get_prefix_kwargs(cls, kwargs: dict, prefix: str, default_param: dict, new_prefix=''):
"""
Remove param from kwargs and return the extracted result.
Eg. column_kwargs = Prm.get_prefix_kwargs(kwargs, 'col_', {'size': 10})
This will remove all the ... | 28.90625 | 94 | 0.563243 |
class Prm:
@classmethod
def get_prefix_kwargs(cls, kwargs: dict, prefix: str, default_param: dict, new_prefix=''):
result = default_param
prefix_length = len(prefix)
removed_keys = []
for k, v in kwargs.items():
key = str(k)
if key.startswith(prefix):
... | true | true |
f746f9287a2845c624d37539f21a0498c24c1707 | 281 | py | Python | test/test_inject.py | Bharat23/secret-manager-env-injector | 6915912557d66ddde8b5cb15487ced674c0555ea | [
"MIT"
] | null | null | null | test/test_inject.py | Bharat23/secret-manager-env-injector | 6915912557d66ddde8b5cb15487ced674c0555ea | [
"MIT"
] | null | null | null | test/test_inject.py | Bharat23/secret-manager-env-injector | 6915912557d66ddde8b5cb15487ced674c0555ea | [
"MIT"
] | null | null | null | import unittest
import os
from SecretManagerEnvInjector import inject
class InjectTest(unittest.TestCase):
@inject('arn:aws:secretsmanager:us-east-1:xxxxxxxxxxxxxx:secret:bogus-dj3g0R')
def test_inject(self):
self.assertEquals(os.getenv('bogus-dj3g0R'), 'test2') | 28.1 | 82 | 0.765125 | import unittest
import os
from SecretManagerEnvInjector import inject
class InjectTest(unittest.TestCase):
@inject('arn:aws:secretsmanager:us-east-1:xxxxxxxxxxxxxx:secret:bogus-dj3g0R')
def test_inject(self):
self.assertEquals(os.getenv('bogus-dj3g0R'), 'test2') | true | true |
f746fa05b74a528b441d4359b66fbd6cde78d545 | 18,733 | py | Python | tests/shared/nlu/training_data/test_training_data.py | pranavdurai10/rasa | b66909c34e53c07260a0f28e71ed8096ff7fb418 | [
"Apache-2.0"
] | null | null | null | tests/shared/nlu/training_data/test_training_data.py | pranavdurai10/rasa | b66909c34e53c07260a0f28e71ed8096ff7fb418 | [
"Apache-2.0"
] | null | null | null | tests/shared/nlu/training_data/test_training_data.py | pranavdurai10/rasa | b66909c34e53c07260a0f28e71ed8096ff7fb418 | [
"Apache-2.0"
] | null | null | null | import asyncio
from pathlib import Path
from typing import Text
import pytest
import rasa.shared.utils.io
from rasa.core.domain import Domain
from rasa.core.events import UserUttered, ActionExecuted
from rasa.core.training.structures import StoryStep, StoryGraph
from rasa.importers.importer import E2EImporter, Traini... | 31.27379 | 88 | 0.64389 | import asyncio
from pathlib import Path
from typing import Text
import pytest
import rasa.shared.utils.io
from rasa.core.domain import Domain
from rasa.core.events import UserUttered, ActionExecuted
from rasa.core.training.structures import StoryStep, StoryGraph
from rasa.importers.importer import E2EImporter, Traini... | true | true |
f746fade785d133f870c0bc36f32f09c3dca4ce3 | 9,937 | py | Python | mistral/workflow/data_flow.py | soda-research/mistral | 550a3de9c2defc7ce26336cb705d9c8d87bbaddd | [
"Apache-2.0"
] | null | null | null | mistral/workflow/data_flow.py | soda-research/mistral | 550a3de9c2defc7ce26336cb705d9c8d87bbaddd | [
"Apache-2.0"
] | null | null | null | mistral/workflow/data_flow.py | soda-research/mistral | 550a3de9c2defc7ce26336cb705d9c8d87bbaddd | [
"Apache-2.0"
] | null | null | null | # Copyright 2013 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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
#
# Unl... | 28.970845 | 78 | 0.674348 |
from oslo_config import cfg
from oslo_log import log as logging
from mistral import context as auth_ctx
from mistral.db.v2 import api as db_api
from mistral.db.v2.sqlalchemy import models
from mistral import exceptions as exc
from mistral import expressions as expr
from mistral.lang import parser as spe... | true | true |
f746fb2ce63a72a3b89e3d9f663f211378e4b507 | 1,042 | py | Python | papermerge/core/lib/mime.py | papermerge/papermerge-core | e377441a8e5ddb748fa3861f686fa22c00d407fe | [
"Apache-2.0"
] | 45 | 2021-01-10T14:33:52.000Z | 2022-03-27T14:02:56.000Z | papermerge/core/lib/mime.py | papermerge/papermerge-core | e377441a8e5ddb748fa3861f686fa22c00d407fe | [
"Apache-2.0"
] | 8 | 2021-01-08T20:02:21.000Z | 2022-02-01T13:12:24.000Z | papermerge/core/lib/mime.py | papermerge/papermerge-core | e377441a8e5ddb748fa3861f686fa22c00d407fe | [
"Apache-2.0"
] | 12 | 2021-01-07T20:03:07.000Z | 2022-03-24T04:07:51.000Z | import logging
from . import wrapper
from ..app_settings import settings
logger = logging.getLogger(__name__)
class Mime(wrapper.Wrapper):
def __init__(self, filepath):
super().__init__(exec_name=settings.BINARY_FILE)
self.filepath = filepath
def get_cmd(self):
cmd = super().get_cmd... | 22.170213 | 71 | 0.581574 | import logging
from . import wrapper
from ..app_settings import settings
logger = logging.getLogger(__name__)
class Mime(wrapper.Wrapper):
def __init__(self, filepath):
super().__init__(exec_name=settings.BINARY_FILE)
self.filepath = filepath
def get_cmd(self):
cmd = super().get_cmd... | true | true |
f746fb6113e2bc9fc7f6daa8706b6171808513f1 | 23,285 | py | Python | nbconvert/tests/test_nbconvertapp.py | agoose77/nbconvert | 3baec1068353fb7a589e2467f4a226e7af579f39 | [
"BSD-3-Clause-Clear"
] | 1 | 2021-03-18T17:06:06.000Z | 2021-03-18T17:06:06.000Z | nbconvert/tests/test_nbconvertapp.py | agoose77/nbconvert | 3baec1068353fb7a589e2467f4a226e7af579f39 | [
"BSD-3-Clause-Clear"
] | null | null | null | nbconvert/tests/test_nbconvertapp.py | agoose77/nbconvert | 3baec1068353fb7a589e2467f4a226e7af579f39 | [
"BSD-3-Clause-Clear"
] | null | null | null | # -*- coding: utf-8 -*-
"""Test NbConvertApp"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import io
import nbformat
from .base import TestsBase
from ..postprocessors import PostProcessorBase
from ..tests.utils import onlyif_cmds_exist
from nbconver... | 42.182971 | 156 | 0.563324 |
import os
import io
import nbformat
from .base import TestsBase
from ..postprocessors import PostProcessorBase
from ..tests.utils import onlyif_cmds_exist
from nbconvert import nbconvertapp
from nbconvert.exporters import Exporter
from traitlets.tests.utils import check_help_all_output
from testpath import tempd... | true | true |
f746fc514b7f16980835c430db26d8fa34a04dda | 13,678 | py | Python | tests/dashboard/test_menu.py | dedhio/bellastore | 03cad4d11c039c6c33291021def812570c09fe36 | [
"BSD-3-Clause"
] | 3 | 2019-06-09T18:00:54.000Z | 2019-06-18T10:07:39.000Z | tests/dashboard/test_menu.py | dedhio/bellastore | 03cad4d11c039c6c33291021def812570c09fe36 | [
"BSD-3-Clause"
] | 2 | 2019-07-02T13:39:49.000Z | 2019-07-07T09:38:27.000Z | tests/dashboard/test_menu.py | dedhio/bellastore | 03cad4d11c039c6c33291021def812570c09fe36 | [
"BSD-3-Clause"
] | 1 | 2019-05-02T17:30:49.000Z | 2019-05-02T17:30:49.000Z | import json
from unittest import mock
import pytest
from django.urls import reverse
from django.utils import timezone
from django.utils.formats import localize
from saleor.dashboard.menu.forms import AssignMenuForm
from saleor.dashboard.menu.utils import (
get_menu_as_json,
get_menu_item_as_dict,
get_menu... | 33.118644 | 88 | 0.69981 | import json
from unittest import mock
import pytest
from django.urls import reverse
from django.utils import timezone
from django.utils.formats import localize
from saleor.dashboard.menu.forms import AssignMenuForm
from saleor.dashboard.menu.utils import (
get_menu_as_json,
get_menu_item_as_dict,
get_menu... | true | true |
f746fc67ef7153db450b43ce64dd35ec074e6390 | 21,329 | py | Python | octavia/common/jinja/haproxy/combined_listeners/jinja_cfg.py | spencerharmon/octavia | 92038b24b6480fe11ea80fc96c2d5f01c964763a | [
"Apache-2.0"
] | null | null | null | octavia/common/jinja/haproxy/combined_listeners/jinja_cfg.py | spencerharmon/octavia | 92038b24b6480fe11ea80fc96c2d5f01c964763a | [
"Apache-2.0"
] | null | null | null | octavia/common/jinja/haproxy/combined_listeners/jinja_cfg.py | spencerharmon/octavia | 92038b24b6480fe11ea80fc96c2d5f01c964763a | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2015 Rackspace
#
# 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 a... | 41.821569 | 79 | 0.615078 |
import os
import re
import jinja2
from octavia_lib.common import constants as lib_consts
from octavia.common.config import cfg
from octavia.common import constants
from octavia.common import utils as octavia_utils
PROTOCOL_MAP = {
constants.PROTOCOL_TCP: 'tcp',
constants.PROTOCOL_HTTP: 'http',
... | true | true |
f746fce398e52473f9e6e9a195a7bd0cf2dfad31 | 1,267 | py | Python | setup.py | zhengp0/regm | 0072af6de57331c76da4e467174185f83c1a17ec | [
"BSD-2-Clause"
] | 2 | 2022-03-02T21:48:11.000Z | 2022-03-02T21:48:15.000Z | setup.py | zhengp0/regm | 0072af6de57331c76da4e467174185f83c1a17ec | [
"BSD-2-Clause"
] | 2 | 2021-08-11T21:01:47.000Z | 2021-08-18T15:54:37.000Z | setup.py | zhengp0/regm | 0072af6de57331c76da4e467174185f83c1a17ec | [
"BSD-2-Clause"
] | 1 | 2021-01-20T18:43:49.000Z | 2021-01-20T18:43:49.000Z | import sys
from pathlib import Path
from setuptools import setup, find_packages
if __name__ == '__main__':
base_dir = Path(__file__).parent
src_dir = base_dir/'src'/'regmod'
sys.path.insert(0, src_dir.as_posix())
import __about__ as about
with (base_dir/'README.rst').open() as f:
long_de... | 23.90566 | 57 | 0.595896 | import sys
from pathlib import Path
from setuptools import setup, find_packages
if __name__ == '__main__':
base_dir = Path(__file__).parent
src_dir = base_dir/'src'/'regmod'
sys.path.insert(0, src_dir.as_posix())
import __about__ as about
with (base_dir/'README.rst').open() as f:
long_de... | true | true |
f746fcf4f254bb87758ee7b628aac64f092b7d48 | 429 | py | Python | waitlist/serializers.py | rodbv/kamu | f390d91f7d7755b49176cf5d504648e3fe572237 | [
"MIT"
] | 70 | 2018-05-23T16:44:44.000Z | 2021-12-05T21:48:10.000Z | waitlist/serializers.py | rodbv/kamu | f390d91f7d7755b49176cf5d504648e3fe572237 | [
"MIT"
] | 122 | 2018-10-06T21:31:24.000Z | 2020-11-09T15:04:56.000Z | waitlist/serializers.py | rodbv/kamu | f390d91f7d7755b49176cf5d504648e3fe572237 | [
"MIT"
] | 50 | 2018-05-23T05:49:10.000Z | 2021-11-22T07:53:42.000Z | from rest_framework import serializers
from books.serializers import UserSerializer, BookSerializer, LibrarySerializer
from waitlist.models import WaitlistItem
class WaitlistItemSerializer(serializers.ModelSerializer):
user = UserSerializer()
library = LibrarySerializer()
book = BookSerializer()
adde... | 28.6 | 79 | 0.764569 | from rest_framework import serializers
from books.serializers import UserSerializer, BookSerializer, LibrarySerializer
from waitlist.models import WaitlistItem
class WaitlistItemSerializer(serializers.ModelSerializer):
user = UserSerializer()
library = LibrarySerializer()
book = BookSerializer()
adde... | true | true |
f746fe2f93f05b8ef9d9235651134bd8e6f9838f | 745 | py | Python | config.py | IFB-ElixirFr/fair-checker | f762aef02cf3a43ba0ba20570eab842e75fc9d98 | [
"MIT"
] | 3 | 2020-06-11T15:44:15.000Z | 2021-06-04T09:25:33.000Z | config.py | IFB-ElixirFr/fair-checker | f762aef02cf3a43ba0ba20570eab842e75fc9d98 | [
"MIT"
] | 23 | 2020-11-25T11:33:51.000Z | 2022-01-31T15:43:39.000Z | config.py | IFB-ElixirFr/fair-checker | f762aef02cf3a43ba0ba20570eab842e75fc9d98 | [
"MIT"
] | 1 | 2022-02-02T10:04:37.000Z | 2022-02-02T10:04:37.000Z | from os import environ, path
from dotenv import load_dotenv
basedir = path.abspath(path.dirname(__file__))
load_dotenv(path.join(basedir, ".env"))
class Config(object):
# You have to config your apikey for bioportal in a separate .env file that must not be in git
# e.g. BIOPORTAL_APIKEY='xxxxxx-xxxxx-xxxx-x... | 24.833333 | 98 | 0.711409 | from os import environ, path
from dotenv import load_dotenv
basedir = path.abspath(path.dirname(__file__))
load_dotenv(path.join(basedir, ".env"))
class Config(object):
BIOPORTAL_APIKEY = environ.get("BIOPORTAL_APIKEY")
DEBUG = False
TESTING = False
SERVER_NAME = "0.0.0.0:5000"
class Pro... | true | true |
f74700aff34b2c3ec22739c1678ab10c892fe9b6 | 1,375 | py | Python | configs/cbis_ddsm_mass/faster_rcnn_r50_caffe_fpn_mstrain_1x_ddsm_extend_bbox_0.2_aug.py | Hung304-WBLEM/mmdetection | 6ac4d90c867cdd8b3cd2bc284a73205c7ce3c80e | [
"Apache-2.0"
] | null | null | null | configs/cbis_ddsm_mass/faster_rcnn_r50_caffe_fpn_mstrain_1x_ddsm_extend_bbox_0.2_aug.py | Hung304-WBLEM/mmdetection | 6ac4d90c867cdd8b3cd2bc284a73205c7ce3c80e | [
"Apache-2.0"
] | null | null | null | configs/cbis_ddsm_mass/faster_rcnn_r50_caffe_fpn_mstrain_1x_ddsm_extend_bbox_0.2_aug.py | Hung304-WBLEM/mmdetection | 6ac4d90c867cdd8b3cd2bc284a73205c7ce3c80e | [
"Apache-2.0"
] | null | null | null | _base_ = '../faster_rcnn/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco.py'
model = dict(
roi_head=dict(bbox_head=dict(num_classes=2))
)
# Dataset path
DDSM_TRAIN_DATASET = '/home/hqvo2/Projects/Breast_Cancer/data/processed_data/mass/train'
DDSM_TRAIN_ANNOTATION = DDSM_TRAIN_DATASET + '/annotation_coco_with_classes_ex... | 39.285714 | 184 | 0.784727 | _base_ = '../faster_rcnn/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco.py'
model = dict(
roi_head=dict(bbox_head=dict(num_classes=2))
)
DDSM_TRAIN_DATASET = '/home/hqvo2/Projects/Breast_Cancer/data/processed_data/mass/train'
DDSM_TRAIN_ANNOTATION = DDSM_TRAIN_DATASET + '/annotation_coco_with_classes_extend_bbox_0.2_... | true | true |
f74700b56454b7123c1ce8e494c30c4b8aec9669 | 645 | py | Python | tests/unit/more/debian/database/test_redis.py | timgates42/provy | ca3d5e96a2210daf3c1fd4b96e047efff152db14 | [
"MIT"
] | 15 | 2015-01-28T15:49:28.000Z | 2021-09-02T18:49:46.000Z | tests/unit/more/debian/database/test_redis.py | timgates42/provy | ca3d5e96a2210daf3c1fd4b96e047efff152db14 | [
"MIT"
] | null | null | null | tests/unit/more/debian/database/test_redis.py | timgates42/provy | ca3d5e96a2210daf3c1fd4b96e047efff152db14 | [
"MIT"
] | 3 | 2016-12-05T07:08:11.000Z | 2021-12-26T04:31:05.000Z | from mock import call
from nose.tools import istest
from provy.more.debian import AptitudeRole, RedisRole
from tests.unit.tools.helpers import ProvyTestCase
class RedisRoleTest(ProvyTestCase):
def setUp(self):
super(RedisRoleTest, self).setUp()
self.role = RedisRole(prov=None, context={})
@i... | 33.947368 | 89 | 0.725581 | from mock import call
from nose.tools import istest
from provy.more.debian import AptitudeRole, RedisRole
from tests.unit.tools.helpers import ProvyTestCase
class RedisRoleTest(ProvyTestCase):
def setUp(self):
super(RedisRoleTest, self).setUp()
self.role = RedisRole(prov=None, context={})
@i... | true | true |
f7470103f913d724eecff9cd63f99d09b3ca4ec0 | 96,153 | py | Python | trove/taskmanager/models.py | zh-f/trove | 4998becb4da14547798cece21858282761409052 | [
"Apache-2.0"
] | 1 | 2017-11-24T10:28:48.000Z | 2017-11-24T10:28:48.000Z | trove/taskmanager/models.py | 2020human/trove-new | 012da9a334bc4e9c7711dc918eea3f011463ec82 | [
"Apache-2.0"
] | null | null | null | trove/taskmanager/models.py | 2020human/trove-new | 012da9a334bc4e9c7711dc918eea3f011463ec82 | [
"Apache-2.0"
] | null | null | null | # Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | 44.127123 | 79 | 0.580585 |
import os.path
import time
import traceback
from cinderclient import exceptions as cinder_exceptions
from eventlet import greenthread
from eventlet.timeout import Timeout
from heatclient import exc as heat_exceptions
from novaclient import exceptions as nova_exceptions
from oslo_log import log as logging... | true | true |
f747016ef477946806c1d818d38cadb8c27e681e | 12,988 | py | Python | exchanges/virtualExchangeService.py | AshWorkshop/Trandash | a96b523fbd171ba2d43a6720ef2e2a496a0cf75a | [
"MIT"
] | 1 | 2018-07-25T03:43:35.000Z | 2018-07-25T03:43:35.000Z | exchanges/virtualExchangeService.py | AshWorkshop/Trandash | a96b523fbd171ba2d43a6720ef2e2a496a0cf75a | [
"MIT"
] | null | null | null | exchanges/virtualExchangeService.py | AshWorkshop/Trandash | a96b523fbd171ba2d43a6720ef2e2a496a0cf75a | [
"MIT"
] | null | null | null | from twisted.internet import defer, task
from twisted.python.failure import Failure
from exchanges.base import ExchangeService
from exchange import calcVirtualOrderBooks
import copy
import time
def defaultErrHandler(failure):
print(failure.getBriefTraceback())
return failure
def handleMultipleErr(data):
... | 34.542553 | 97 | 0.495303 | from twisted.internet import defer, task
from twisted.python.failure import Failure
from exchanges.base import ExchangeService
from exchange import calcVirtualOrderBooks
import copy
import time
def defaultErrHandler(failure):
print(failure.getBriefTraceback())
return failure
def handleMultipleErr(data):
... | true | true |
f74701fcc3657c0354a5ce167bcd47f614d819f5 | 1,741 | py | Python | pii-manager/test/unit/api/test_manager_ctx.py | ruinunca/data_tooling | 297e1f8c2898d00b523ccafb7bdd19c6d6aac9ff | [
"Apache-2.0"
] | 23 | 2021-10-21T14:23:40.000Z | 2022-03-27T01:06:13.000Z | pii-manager/test/unit/api/test_manager_ctx.py | ruinunca/data_tooling | 297e1f8c2898d00b523ccafb7bdd19c6d6aac9ff | [
"Apache-2.0"
] | 331 | 2021-11-02T00:30:56.000Z | 2022-03-08T16:48:13.000Z | pii-manager/test/unit/api/test_manager_ctx.py | ruinunca/data_tooling | 297e1f8c2898d00b523ccafb7bdd19c6d6aac9ff | [
"Apache-2.0"
] | 33 | 2021-08-07T18:53:38.000Z | 2022-02-11T13:38:11.000Z | """
Test base objects with context
"""
from pii_manager import PiiEnum, PiiEntity
from pii_manager.api import PiiManager
def _pii(pos):
return PiiEntity(PiiEnum.GOV_ID, pos, "3451-K", country="vo", name="vogonian ID")
TEST = [
("my Vogon ID is 3451-K", [_pii(15)]),
("the number 3451-K is my Vogonian ID... | 24.871429 | 85 | 0.532453 |
from pii_manager import PiiEnum, PiiEntity
from pii_manager.api import PiiManager
def _pii(pos):
return PiiEntity(PiiEnum.GOV_ID, pos, "3451-K", country="vo", name="vogonian ID")
TEST = [
("my Vogon ID is 3451-K", [_pii(15)]),
("the number 3451-K is my Vogonian ID", [_pii(11)]),
("the Vogon ID are ... | true | true |
f747020128784716762950af1d4d76dc0b286709 | 3,369 | py | Python | benchmark/startCirq3226.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startCirq3226.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startCirq3226.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=47
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for... | 37.433333 | 77 | 0.678836 |
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
from cirq.contrib.svg import SVGCircuit
def make_circuit(n: int, input_qubit):
c = cirq.Circuit()
c.append(cirq.H.on(input_qubit[0]))
c.append(cirq.H.on(input_qubit[2]))
... | true | true |
f7470334cab69437b4ec62e4ac0a28475cccfa22 | 1,133 | py | Python | lib/galaxy/model/orm/__init__.py | blankenberg/galaxy-data-resource | ca32a1aafd64948f489a4e5cf88096f32391b1d9 | [
"CC-BY-3.0"
] | null | null | null | lib/galaxy/model/orm/__init__.py | blankenberg/galaxy-data-resource | ca32a1aafd64948f489a4e5cf88096f32391b1d9 | [
"CC-BY-3.0"
] | 1 | 2015-02-21T18:48:19.000Z | 2015-02-27T15:50:32.000Z | lib/galaxy/model/orm/__init__.py | blankenberg/galaxy-data-resource | ca32a1aafd64948f489a4e5cf88096f32391b1d9 | [
"CC-BY-3.0"
] | 3 | 2015-02-22T13:34:16.000Z | 2020-10-01T01:28:04.000Z | import pkg_resources
pkg_resources.require( "SQLAlchemy >= 0.4" )
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.interfaces import *
import logging
log = logging.getLogger( __name__ )
dialect_to_egg = {
"sqlite": "pysqlite>=2",
"postgres": "psycopg2",
"postgresql": "psycopg2",
... | 29.815789 | 110 | 0.649603 | import pkg_resources
pkg_resources.require( "SQLAlchemy >= 0.4" )
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.interfaces import *
import logging
log = logging.getLogger( __name__ )
dialect_to_egg = {
"sqlite": "pysqlite>=2",
"postgres": "psycopg2",
"postgresql": "psycopg2",
... | true | true |
f747043e30182d6e6e8d7145a5f8badfc24fe22d | 1,182 | py | Python | tests/test_data/impl_stubs.py | surevs/gauge-python | 2d91295c59d8cbbd3aec221cc1349805fbc01697 | [
"MIT"
] | null | null | null | tests/test_data/impl_stubs.py | surevs/gauge-python | 2d91295c59d8cbbd3aec221cc1349805fbc01697 | [
"MIT"
] | null | null | null | tests/test_data/impl_stubs.py | surevs/gauge-python | 2d91295c59d8cbbd3aec221cc1349805fbc01697 | [
"MIT"
] | null | null | null | from getgauge.python import (before_step, step, after_step, before_scenario,
after_scenario, before_spec, after_spec,
before_suite, after_suite, custom_screen_grabber,
continue_on_failure)
@step("Step 1")
def step1():
pass
@c... | 12.989011 | 78 | 0.652284 | from getgauge.python import (before_step, step, after_step, before_scenario,
after_scenario, before_spec, after_spec,
before_suite, after_suite, custom_screen_grabber,
continue_on_failure)
@step("Step 1")
def step1():
pass
@c... | true | true |
f7470513546ac52103f116b498ea7d1d0b08991b | 2,219 | py | Python | drf_admin/apps/system/serializers/permissions.py | guohaihan/myproject | 0ec105d0bd48477faddf93bd62a8ede800419ae6 | [
"MIT"
] | 228 | 2020-06-20T10:07:03.000Z | 2022-03-29T07:11:01.000Z | drf_admin/apps/system/serializers/permissions.py | guohaihan/myproject | 0ec105d0bd48477faddf93bd62a8ede800419ae6 | [
"MIT"
] | 25 | 2020-07-16T12:29:04.000Z | 2022-02-16T06:31:06.000Z | drf_admin/apps/system/serializers/permissions.py | guohaihan/myproject | 0ec105d0bd48477faddf93bd62a8ede800419ae6 | [
"MIT"
] | 82 | 2020-10-26T07:14:15.000Z | 2022-03-29T07:53:23.000Z | # -*- coding: utf-8 -*-
"""
@author : Wang Meng
@github : https://github.com/tianpangji
@software : PyCharm
@file : permissions.py
@create : 2020/7/22 21:44
"""
from rest_framework import serializers
from drf_admin.common.models import get_child_ids
from drf_admin.utils.views import TreeSerializer
from sys... | 34.671875 | 87 | 0.628211 |
from rest_framework import serializers
from drf_admin.common.models import get_child_ids
from drf_admin.utils.views import TreeSerializer
from system.models import Permissions
class PermissionsSerializer(serializers.ModelSerializer):
class Meta:
model = Permissions
fields = '__all__'
def v... | true | true |
f747059b81616fc5fa3ec56a6cb75e8901caa8eb | 65,942 | py | Python | tensor2tensor/layers/common_attention_test.py | levskaya/tensor2tensor | 4643800137f802693f880a1fab9e10de7ba32e66 | [
"Apache-2.0"
] | 34 | 2018-12-19T01:00:57.000Z | 2021-03-26T09:36:37.000Z | tensor2tensor/layers/common_attention_test.py | levskaya/tensor2tensor | 4643800137f802693f880a1fab9e10de7ba32e66 | [
"Apache-2.0"
] | 11 | 2018-12-25T03:37:59.000Z | 2021-08-25T14:43:58.000Z | tensor2tensor/layers/common_attention_test.py | levskaya/tensor2tensor | 4643800137f802693f880a1fab9e10de7ba32e66 | [
"Apache-2.0"
] | 9 | 2018-12-27T08:00:44.000Z | 2020-06-08T03:05:14.000Z | # coding=utf-8
# Copyright 2019 The Tensor2Tensor 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... | 42.216389 | 80 | 0.559052 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
import kfac
import numpy as np
from tensor2tensor.layers import common_attention
from tensor2tensor.layers import common_layers
from tensor2tensor.utils i... | true | true |
f74705b7133baa5bdcfd4b0e97c7a61d2c354acb | 15,460 | py | Python | pymatgen/analysis/tests/test_reaction_calculator.py | mailhexu/pymatgen | 70da55dd860771eb9d38c306dbcd3f6b074b7a54 | [
"MIT"
] | 18 | 2019-06-15T18:08:21.000Z | 2022-01-30T05:01:29.000Z | ComRISB/pyextern/pymatgen/pymatgen/analysis/tests/test_reaction_calculator.py | comscope/Comsuite | b80ca9f34c519757d337487c489fb655f7598cc2 | [
"BSD-3-Clause"
] | null | null | null | ComRISB/pyextern/pymatgen/pymatgen/analysis/tests/test_reaction_calculator.py | comscope/Comsuite | b80ca9f34c519757d337487c489fb655f7598cc2 | [
"BSD-3-Clause"
] | 11 | 2019-06-05T02:57:55.000Z | 2021-12-29T02:54:25.000Z | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import unicode_literals
import unittest
from pymatgen import Composition
from pymatgen.analysis.reaction_calculator import Reaction, BalancedReaction, \
ReactionError, ComputedReaction
fro... | 42.356164 | 90 | 0.556662 |
from __future__ import unicode_literals
import unittest
from pymatgen import Composition
from pymatgen.analysis.reaction_calculator import Reaction, BalancedReaction, \
ReactionError, ComputedReaction
from pymatgen.entries.computed_entries import ComputedEntry
class ReactionTest(unittest.TestCase):
def ... | true | true |
f7470607a67b80300e215c86301fadd942f43f61 | 1,318 | py | Python | tests/gui/fracdim_isolated_test_e2e.py | demid5111/approximate-enthropy | 2ec331087a1af0279a429656890d44a04c734903 | [
"MIT"
] | null | null | null | tests/gui/fracdim_isolated_test_e2e.py | demid5111/approximate-enthropy | 2ec331087a1af0279a429656890d44a04c734903 | [
"MIT"
] | 7 | 2019-03-02T08:23:11.000Z | 2019-07-06T14:18:23.000Z | tests/gui/fracdim_isolated_test_e2e.py | demid5111/approximate-enthropy | 2ec331087a1af0279a429656890d44a04c734903 | [
"MIT"
] | null | null | null | from gui_version import App
from tests.gui.app_testing_bed import FracDimTestingBed
from tests.gui.common import check_report
def test_fracdim_wo_windows(qtbot):
window = App()
qtbot.addWidget(window)
test_app = FracDimTestingBed(qtbot=qtbot, window=window)
qtbot.waitForWindowShown(window)
tes... | 24.407407 | 60 | 0.759484 | from gui_version import App
from tests.gui.app_testing_bed import FracDimTestingBed
from tests.gui.common import check_report
def test_fracdim_wo_windows(qtbot):
window = App()
qtbot.addWidget(window)
test_app = FracDimTestingBed(qtbot=qtbot, window=window)
qtbot.waitForWindowShown(window)
tes... | true | true |
f74707f3f5c4d71f877b72f559c5a4d81c4e610e | 2,595 | py | Python | modules/dials/util/pprint.py | jorgediazjr/dials-dev20191018 | 77d66c719b5746f37af51ad593e2941ed6fbba17 | [
"BSD-3-Clause"
] | null | null | null | modules/dials/util/pprint.py | jorgediazjr/dials-dev20191018 | 77d66c719b5746f37af51ad593e2941ed6fbba17 | [
"BSD-3-Clause"
] | null | null | null | modules/dials/util/pprint.py | jorgediazjr/dials-dev20191018 | 77d66c719b5746f37af51ad593e2941ed6fbba17 | [
"BSD-3-Clause"
] | 1 | 2020-02-04T15:39:06.000Z | 2020-02-04T15:39:06.000Z | from __future__ import absolute_import, division, print_function
def profile2d(p, vmin=None, vmax=None):
from dials.array_family import flex
import string
if vmin is None:
vmin = flex.min(p)
if vmax is None:
vmax = flex.max(p)
assert vmax >= vmin
dv = vmax - vmin
if dv == ... | 22.37069 | 64 | 0.380347 | from __future__ import absolute_import, division, print_function
def profile2d(p, vmin=None, vmax=None):
from dials.array_family import flex
import string
if vmin is None:
vmin = flex.min(p)
if vmax is None:
vmax = flex.max(p)
assert vmax >= vmin
dv = vmax - vmin
if dv == ... | true | true |
f747085912a3c4705ebdba43269f0d403e76c4f4 | 607 | py | Python | test1/test2/test27.py | qwert-f/flask | 00c350f8190c2a6c0eee55031aca0873eb4c91ee | [
"MIT"
] | null | null | null | test1/test2/test27.py | qwert-f/flask | 00c350f8190c2a6c0eee55031aca0873eb4c91ee | [
"MIT"
] | 1 | 2022-01-18T02:54:04.000Z | 2022-01-18T02:54:44.000Z | test1/test2/test27.py | qwert-f/flask | 00c350f8190c2a6c0eee55031aca0873eb4c91ee | [
"MIT"
] | null | null | null | from flask import Flask, g
app = Flask(__name__)
# arg = 'i'
@app.before_request
def sd():
arg = 123
bf(arg)
def bf(arg):
# global arg
g.x = arg
return arg
@app.route("/index", methods=["POST", "GET"])
def index():
g.x = 123
return "index"
@app.route("/test", methods=["POST", "GET"]... | 13.488889 | 45 | 0.61285 | from flask import Flask, g
app = Flask(__name__)
@app.before_request
def sd():
arg = 123
bf(arg)
def bf(arg):
g.x = arg
return arg
@app.route("/index", methods=["POST", "GET"])
def index():
g.x = 123
return "index"
@app.route("/test", methods=["POST", "GET"])
def test():
... | true | true |
f747087b3ae00264af4707c86c0ebc25aa5ff397 | 4,824 | py | Python | python/fedml/cross_silo/hierarchical/trainer_dist_adapter.py | NCLPhD/FedML | ffa15262ee963b9c856f34f0b2202f4dfeb3a76b | [
"Apache-2.0"
] | null | null | null | python/fedml/cross_silo/hierarchical/trainer_dist_adapter.py | NCLPhD/FedML | ffa15262ee963b9c856f34f0b2202f4dfeb3a76b | [
"Apache-2.0"
] | null | null | null | python/fedml/cross_silo/hierarchical/trainer_dist_adapter.py | NCLPhD/FedML | ffa15262ee963b9c856f34f0b2202f4dfeb3a76b | [
"Apache-2.0"
] | null | null | null | from torch.nn.parallel import DistributedDataParallel as DDP
import torch.distributed as dist
from .fedml_trainer import FedMLTrainer
from .process_group_manager import ProcessGroupManager
from torch.nn.parallel import DistributedDataParallel as DDP
from .trainer.my_model_trainer_classification import MyModelTrainer a... | 34.956522 | 106 | 0.69631 | from torch.nn.parallel import DistributedDataParallel as DDP
import torch.distributed as dist
from .fedml_trainer import FedMLTrainer
from .process_group_manager import ProcessGroupManager
from torch.nn.parallel import DistributedDataParallel as DDP
from .trainer.my_model_trainer_classification import MyModelTrainer a... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.