hexsha stringlengths 40 40 | size int64 10 805k | ext stringclasses 6
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 176 | max_stars_repo_name stringlengths 7 114 | 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 176 | max_issues_repo_name stringlengths 7 114 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 48.5k ⌀ | 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 176 | max_forks_repo_name stringlengths 7 114 | 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 10 805k | avg_line_length float64 5.53 11k | max_line_length int64 10 129k | alphanum_fraction float64 0.13 0.93 | content_no_comment stringlengths 0 449k | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f703ed40d35384b8567eb44be81ef99bdda43a53 | 5,508 | py | Python | src/cogs/normal/owner-normal.py | ChrisKalahiki/ruger-bot | 40043094890e88956e3252a83b5c15ac108a5187 | [
"MIT"
] | null | null | null | src/cogs/normal/owner-normal.py | ChrisKalahiki/ruger-bot | 40043094890e88956e3252a83b5c15ac108a5187 | [
"MIT"
] | null | null | null | src/cogs/normal/owner-normal.py | ChrisKalahiki/ruger-bot | 40043094890e88956e3252a83b5c15ac108a5187 | [
"MIT"
] | null | null | null | import json
import os
import sys
import disnake
from disnake.ext import commands
from disnake.ext.commands import Context
from helpers import json_manager, checks
import logging
if not os.path.isfile("../config.json"):
sys.exit("'config.json' not found by general-normal! Please add it and try again.")
else:
... | 34 | 112 | 0.562818 | import json
import os
import sys
import disnake
from disnake.ext import commands
from disnake.ext.commands import Context
from helpers import json_manager, checks
import logging
if not os.path.isfile("../config.json"):
sys.exit("'config.json' not found by general-normal! Please add it and try again.")
else:
... | true | true |
f703edede08ad35c0ea1f34204d1139fd51ad639 | 89 | py | Python | markers/apps.py | pabulumm/neighbors | 59f3f3ae727fe52c7897beaf73d157b02cdcb7a3 | [
"BSD-3-Clause"
] | null | null | null | markers/apps.py | pabulumm/neighbors | 59f3f3ae727fe52c7897beaf73d157b02cdcb7a3 | [
"BSD-3-Clause"
] | null | null | null | markers/apps.py | pabulumm/neighbors | 59f3f3ae727fe52c7897beaf73d157b02cdcb7a3 | [
"BSD-3-Clause"
] | null | null | null | from django.apps import AppConfig
class MarkersConfig(AppConfig):
name = 'markers'
| 14.833333 | 33 | 0.752809 | from django.apps import AppConfig
class MarkersConfig(AppConfig):
name = 'markers'
| true | true |
f703edfd294b009350efb017aa9f635fff7cb725 | 30,396 | py | Python | treetopper/stand.py | zacharybeebe/treetopper | 9302d9c482eb2209c516c79100be98614666f8c1 | [
"MIT"
] | null | null | null | treetopper/stand.py | zacharybeebe/treetopper | 9302d9c482eb2209c516c79100be98614666f8c1 | [
"MIT"
] | null | null | null | treetopper/stand.py | zacharybeebe/treetopper | 9302d9c482eb2209c516c79100be98614666f8c1 | [
"MIT"
] | null | null | null | from os import (
startfile,
getcwd
)
from os.path import join
from io import BytesIO
from csv import (
writer,
excel
)
from openpyxl import (
Workbook,
load_workbook
)
from statistics import (
mean,
variance,
stdev
)
from treetopper.plot import Plot
from treetopper.timber import (
... | 41.46794 | 150 | 0.565469 | from os import (
startfile,
getcwd
)
from os.path import join
from io import BytesIO
from csv import (
writer,
excel
)
from openpyxl import (
Workbook,
load_workbook
)
from statistics import (
mean,
variance,
stdev
)
from treetopper.plot import Plot
from treetopper.timber import (
... | true | true |
f703ee65ebc49d049639276ee2bcc8f8f67095eb | 992 | py | Python | pyclopedia/p01_beginner/p03_data_structure/p02_list/p02_slice_operator.py | MacHu-GWU/pyclopedia-project | c6ee156eb40bc5a4ac5f51aa735b6fd004cb68ee | [
"MIT"
] | null | null | null | pyclopedia/p01_beginner/p03_data_structure/p02_list/p02_slice_operator.py | MacHu-GWU/pyclopedia-project | c6ee156eb40bc5a4ac5f51aa735b6fd004cb68ee | [
"MIT"
] | null | null | null | pyclopedia/p01_beginner/p03_data_structure/p02_list/p02_slice_operator.py | MacHu-GWU/pyclopedia-project | c6ee156eb40bc5a4ac5f51aa735b6fd004cb68ee | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def example1():
"""Slice operator.
seq[::stride] # [seq[0], seq[stride], ..., seq[-1] ]
seq[low::stride] # [seq[low], seq[low+stride], ..., seq[-1] ]
seq[:high:stride] # [seq[0], seq[stride], ..., seq[high-1]]
seq[lo... | 29.176471 | 73 | 0.519153 |
def example1():
l = list("01234567")
assert l[::2] == list("0246")
assert l[1::2] == list("1357")
assert l[:4:2] == list("02")
assert l[2:6:2] == list("24")
example1()
def example2():
l = list("01234567")
assert l[::-1] == list("76543210")
assert l[::-2] == list("7531")... | true | true |
f703ee7b1e643155e7210026f57c5e7574579547 | 12,192 | py | Python | salt/utils/dockermod/__init__.py | markgras/salt | d66cd3c935533c63870b83228b978ce43e0ef70d | [
"Apache-2.0"
] | 9,425 | 2015-01-01T05:59:24.000Z | 2022-03-31T20:44:05.000Z | salt/utils/dockermod/__init__.py | markgras/salt | d66cd3c935533c63870b83228b978ce43e0ef70d | [
"Apache-2.0"
] | 33,507 | 2015-01-01T00:19:56.000Z | 2022-03-31T23:48:20.000Z | salt/utils/dockermod/__init__.py | markgras/salt | d66cd3c935533c63870b83228b978ce43e0ef70d | [
"Apache-2.0"
] | 5,810 | 2015-01-01T19:11:45.000Z | 2022-03-31T02:37:20.000Z | """
Common logic used by the docker state and execution module
This module contains logic to accommodate docker/salt CLI usage, as well as
input as formatted by states.
"""
import copy
import logging
import salt.utils.args
import salt.utils.data
import salt.utils.dockermod.translate
from salt.exceptions import Comm... | 35.44186 | 88 | 0.613845 |
import copy
import logging
import salt.utils.args
import salt.utils.data
import salt.utils.dockermod.translate
from salt.exceptions import CommandExecutionError, SaltInvocationError
from salt.utils.args import get_function_argspec as _argspec
from salt.utils.dockermod.translate.helpers import split as _split
try:
... | true | true |
f703eede52c715495446e14a5f0c12b74f4ccf5b | 2,834 | py | Python | quantlab/COCO/YOLOv3Tiny/postprocess.py | lukasc-ch/QuantLab | 7ddcc51ec1131a58269768cd898ce04e8b49beb6 | [
"Apache-2.0"
] | 6 | 2019-05-24T17:39:07.000Z | 2021-11-06T22:19:55.000Z | quantlab/COCO/YOLOv3Tiny/postprocess.py | lukasc-ch/QuantLab | 7ddcc51ec1131a58269768cd898ce04e8b49beb6 | [
"Apache-2.0"
] | null | null | null | quantlab/COCO/YOLOv3Tiny/postprocess.py | lukasc-ch/QuantLab | 7ddcc51ec1131a58269768cd898ce04e8b49beb6 | [
"Apache-2.0"
] | 4 | 2019-05-24T17:39:15.000Z | 2021-04-02T07:13:11.000Z | # Copyright (c) 2019 UniMoRe, Matteo Spallanzani
import torch
from ..utils.utils import xywh2xyxy, bbox_iou
def clip_boxes(boxes):
boxes[:, [0, 2]] = boxes[:, [0, 2]].clamp(min=0, max=1)
boxes[:, [1, 3]] = boxes[:, [1, 3]].clamp(min=0, max=1)
def postprocess_pr(pr_outs, conf_thres=0.001, overlap_thres=0.5... | 42.298507 | 119 | 0.583275 |
import torch
from ..utils.utils import xywh2xyxy, bbox_iou
def clip_boxes(boxes):
boxes[:, [0, 2]] = boxes[:, [0, 2]].clamp(min=0, max=1)
boxes[:, [1, 3]] = boxes[:, [1, 3]].clamp(min=0, max=1)
def postprocess_pr(pr_outs, conf_thres=0.001, overlap_thres=0.5):
pr_outs = [p.vie... | true | true |
f703ef7c34d74366644a557d1ded65ad43afd065 | 12,320 | py | Python | syft/frameworks/torch/mpc/fss.py | NicoSerranoP/PySyft | 87fcd566c46fce4c16d363c94396dd26bd82a016 | [
"Apache-2.0"
] | 3 | 2020-11-24T05:15:57.000Z | 2020-12-07T09:52:45.000Z | syft/frameworks/torch/mpc/fss.py | NicoSerranoP/PySyft | 87fcd566c46fce4c16d363c94396dd26bd82a016 | [
"Apache-2.0"
] | 1 | 2020-09-29T00:24:31.000Z | 2020-09-29T00:24:31.000Z | syft/frameworks/torch/mpc/fss.py | NicoSerranoP/PySyft | 87fcd566c46fce4c16d363c94396dd26bd82a016 | [
"Apache-2.0"
] | 1 | 2021-09-04T16:27:41.000Z | 2021-09-04T16:27:41.000Z | """
This is an implementation of Function Secret Sharing
Useful papers are:
- Function Secret Sharing- Improvements and Extensions, Boyle 2017
Link: https://eprint.iacr.org/2018/707.pdf
- Secure Computation with Preprocessing via Function Secret Sharing, Boyle 2019
Link: https://eprint.iacr.org/2019/1095
Note tha... | 30.419753 | 91 | 0.561607 | import hashlib
import torch as th
import syft as sy
λ = 110 ker):
eq_plan_1 = sy.Plan(
forward_func=lambda x, y: mask_builder(x, y, "eq"),
owner=worker,
tags=["#fss_eq_plan_1"],
is_built=True,
)
worker.register_obj(eq_plan_1)
eq_plan_2 = sy.Plan(
forward_func=... | true | true |
f703f1fd222c2a9e77a5a7e4c6b60bababcf5e23 | 1,742 | py | Python | python-pscheduler/pscheduler/tests/limitprocessor_identifier_localsubnet_test.py | krihal/pscheduler | e69e0357797d88d290c78b92b1d99048e73a63e8 | [
"Apache-2.0"
] | 47 | 2016-09-28T14:19:10.000Z | 2022-03-21T13:26:47.000Z | python-pscheduler/pscheduler/tests/limitprocessor_identifier_localsubnet_test.py | krihal/pscheduler | e69e0357797d88d290c78b92b1d99048e73a63e8 | [
"Apache-2.0"
] | 993 | 2016-07-07T19:30:32.000Z | 2022-03-21T10:25:52.000Z | python-pscheduler/pscheduler/tests/limitprocessor_identifier_localsubnet_test.py | mfeit-internet2/pscheduler-dev | d2cd4065a6fce88628b0ca63edc7a69f2672dad2 | [
"Apache-2.0"
] | 36 | 2016-09-15T09:39:45.000Z | 2021-06-23T15:05:13.000Z | #!/usr/bin/env python3
"""
Test for local-subnet identifier
"""
import unittest
import netifaces
from base_test import PschedTestBase
from pscheduler.limitprocessor.identifier.localsubnet import *
DATA = {
}
class TestLimitprocessorIdentifierLocalSubnet(PschedTestBase):
"""
Test the Identifier
"""
... | 24.885714 | 122 | 0.539036 |
import unittest
import netifaces
from base_test import PschedTestBase
from pscheduler.limitprocessor.identifier.localsubnet import *
DATA = {
}
class TestLimitprocessorIdentifierLocalSubnet(PschedTestBase):
def test_data_is_valid(self):
self.assertEqual(data_is_valid(DATA), (True, "OK"))
... | true | true |
f703f2014bff202689cdafa2e3aaea89acf87846 | 173 | py | Python | Hip/Kernels/RadixSort.py | EmilPi/PuzzleLib | 31aa0fab3b5e9472b9b9871ca52e4d94ea683fa9 | [
"Apache-2.0"
] | 52 | 2020-02-28T20:40:15.000Z | 2021-08-25T05:35:17.000Z | Hip/Kernels/RadixSort.py | EmilPi/PuzzleLib | 31aa0fab3b5e9472b9b9871ca52e4d94ea683fa9 | [
"Apache-2.0"
] | 2 | 2021-02-14T15:57:03.000Z | 2021-10-05T12:21:34.000Z | Hip/Kernels/RadixSort.py | EmilPi/PuzzleLib | 31aa0fab3b5e9472b9b9871ca52e4d94ea683fa9 | [
"Apache-2.0"
] | 8 | 2020-02-28T20:40:11.000Z | 2020-07-09T13:27:23.000Z | from PuzzleLib.Cuda.Kernels.RadixSort import backendTest
def unittest():
from PuzzleLib.Hip import Backend
backendTest(Backend)
if __name__ == "__main__":
unittest()
| 15.727273 | 56 | 0.774566 | from PuzzleLib.Cuda.Kernels.RadixSort import backendTest
def unittest():
from PuzzleLib.Hip import Backend
backendTest(Backend)
if __name__ == "__main__":
unittest()
| true | true |
f703f23f6d1cd8016330bee76599c757747a9bf8 | 1,249 | py | Python | setup.py | charlon/axdd-django-vue | 86c1ca4a6be4e1f4ae1d534296c7d2f58d0c6fb7 | [
"Apache-2.0"
] | null | null | null | setup.py | charlon/axdd-django-vue | 86c1ca4a6be4e1f4ae1d534296c7d2f58d0c6fb7 | [
"Apache-2.0"
] | 5 | 2020-12-29T18:52:27.000Z | 2020-12-29T19:33:29.000Z | setup.py | charlon/axdd-django-vue | 86c1ca4a6be4e1f4ae1d534296c7d2f58d0c6fb7 | [
"Apache-2.0"
] | null | null | null | import os
from setuptools import setup
README = """
See the README on `GitHub
<https://github.com/uw-it-aca/app_name>`_.
"""
# The VERSION file is created by travis-ci, based on the tag name
version_path = "app_name/VERSION"
print(os.path.join(os.path.dirname(__file__), version_path))
VERSION = open(os.path.join(os.p... | 29.738095 | 78 | 0.670136 | import os
from setuptools import setup
README = """
See the README on `GitHub
<https://github.com/uw-it-aca/app_name>`_.
"""
version_path = "app_name/VERSION"
print(os.path.join(os.path.dirname(__file__), version_path))
VERSION = open(os.path.join(os.path.dirname(__file__), version_path)).read()
VERSION = VERSION.re... | true | true |
f703f3cff99eda5f18479dfe895420bc183bdc50 | 2,301 | py | Python | ml/helpers.py | JamesXChang/label_tool | f62470a2bf677a2dd1d18054baf2d651d69c83a9 | [
"Apache-2.0"
] | null | null | null | ml/helpers.py | JamesXChang/label_tool | f62470a2bf677a2dd1d18054baf2d651d69c83a9 | [
"Apache-2.0"
] | 4 | 2021-06-02T02:33:35.000Z | 2022-03-12T00:42:39.000Z | ml/helpers.py | JamesXChang/label_tool | f62470a2bf677a2dd1d18054baf2d651d69c83a9 | [
"Apache-2.0"
] | null | null | null | from abc import abstractmethod
from ml import LabelStudioMLBase
class LabelStudioMLBaseHelper(LabelStudioMLBase):
@abstractmethod
def prepare_tasks(self, tasks, workdir=None, **kwargs):
pass
@abstractmethod
def convert_predictions(self, predictions, **kwargs):
pass
@abstractmeth... | 32.408451 | 81 | 0.592351 | from abc import abstractmethod
from ml import LabelStudioMLBase
class LabelStudioMLBaseHelper(LabelStudioMLBase):
@abstractmethod
def prepare_tasks(self, tasks, workdir=None, **kwargs):
pass
@abstractmethod
def convert_predictions(self, predictions, **kwargs):
pass
@abstractmeth... | true | true |
f703f43c75dc352fffd4d9a11fd1a6923562ac59 | 6,295 | py | Python | mercadobitcoin/trade_api.py | carlettibruno/python-mercadobitcoin | dda94ba0b6f2a545e3ceb4480f6a51900322a031 | [
"MIT"
] | null | null | null | mercadobitcoin/trade_api.py | carlettibruno/python-mercadobitcoin | dda94ba0b6f2a545e3ceb4480f6a51900322a031 | [
"MIT"
] | null | null | null | mercadobitcoin/trade_api.py | carlettibruno/python-mercadobitcoin | dda94ba0b6f2a545e3ceb4480f6a51900322a031 | [
"MIT"
] | null | null | null | import requests
import urllib
import time
import hashlib
import hmac
import itertools
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
from .api import Base
from .errors import ApiError, ArgumentError
def check_values(value, arg, arg_value):
if type(value) == type... | 39.099379 | 213 | 0.660524 | import requests
import urllib
import time
import hashlib
import hmac
import itertools
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
from .api import Base
from .errors import ApiError, ArgumentError
def check_values(value, arg, arg_value):
if type(value) == type... | true | true |
f703f4a799b82e96118311c0cdc441dd57f0bada | 89 | py | Python | tests/test_umonitor.py | RuslanSergeev/uMonitor | f1d4f8e5981d436b8405968ce6273edc0ee0b83a | [
"MIT"
] | null | null | null | tests/test_umonitor.py | RuslanSergeev/uMonitor | f1d4f8e5981d436b8405968ce6273edc0ee0b83a | [
"MIT"
] | null | null | null | tests/test_umonitor.py | RuslanSergeev/uMonitor | f1d4f8e5981d436b8405968ce6273edc0ee0b83a | [
"MIT"
] | null | null | null | from umonitor import __version__
def test_version():
assert __version__ == '0.1.5'
| 14.833333 | 33 | 0.719101 | from umonitor import __version__
def test_version():
assert __version__ == '0.1.5'
| true | true |
f703f5954f5053b294d9b57829d8c3ce8017ee49 | 3,126 | py | Python | main10.py | jsievert73/E01a-Control-Structues | 46ec89d0e7bcf09312127a29586d746c2d0033fc | [
"MIT"
] | null | null | null | main10.py | jsievert73/E01a-Control-Structues | 46ec89d0e7bcf09312127a29586d746c2d0033fc | [
"MIT"
] | null | null | null | main10.py | jsievert73/E01a-Control-Structues | 46ec89d0e7bcf09312127a29586d746c2d0033fc | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import sys, utils, random # import the modules we will need
utils.check_version((3,7)) # make sure we are running at least Python 3.7
utils.clear() # clear the screen
print('Greetings!') # prints out "Greetings!" in the terminal.
colors = ['red','orang... | 104.2 | 205 | 0.712732 |
import sys, utils, random
utils.check_version((3,7))
utils.clear()
print('Greetings!')
colors = ['red','orange','yellow','green','blue','violet','purple']
play_again = ''
best_count = sys.maxsize
while (play_again != 'n' and play_again != 'no'):
match... | true | true |
f703f682b15e75b60b527c82494bd2fdcf1e44d9 | 17,612 | py | Python | test/functional/test_framework/test_node.py | bitcoinexodus/bitcoinexodus-source | 742661b3dc9abce61c05fa1561b7fd9496629866 | [
"MIT"
] | null | null | null | test/functional/test_framework/test_node.py | bitcoinexodus/bitcoinexodus-source | 742661b3dc9abce61c05fa1561b7fd9496629866 | [
"MIT"
] | null | null | null | test/functional/test_framework/test_node.py | bitcoinexodus/bitcoinexodus-source | 742661b3dc9abce61c05fa1561b7fd9496629866 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Class for bitcoinexodusd node under test"""
import contextlib
import decimal
import errno
from enum im... | 42.541063 | 165 | 0.634397 |
import contextlib
import decimal
import errno
from enum import Enum
import http.client
import json
import logging
import os
import re
import subprocess
import tempfile
import time
import urllib.parse
from .authproxy import JSONRPCException
from .util import (
append_config,
delete_cookie_file,
get_rpc... | true | true |
f703f846d570efe5c6dfdbe6dbeed9ff291746db | 10,554 | py | Python | skimage/exposure/exposure.py | neurodebian/scikits.image-1 | 33206f87c5e0208e7ff0d5910ac082b3353fe04e | [
"BSD-3-Clause"
] | null | null | null | skimage/exposure/exposure.py | neurodebian/scikits.image-1 | 33206f87c5e0208e7ff0d5910ac082b3353fe04e | [
"BSD-3-Clause"
] | null | null | null | skimage/exposure/exposure.py | neurodebian/scikits.image-1 | 33206f87c5e0208e7ff0d5910ac082b3353fe04e | [
"BSD-3-Clause"
] | null | null | null | import warnings
import numpy as np
from skimage import img_as_float
from skimage.util.dtype import dtype_range, dtype_limits
from skimage._shared.utils import deprecated
__all__ = ['histogram', 'cumulative_distribution', 'equalize',
'rescale_intensity', 'adjust_gamma',
'adjust_log', 'adjust_sig... | 29.646067 | 90 | 0.631325 | import warnings
import numpy as np
from skimage import img_as_float
from skimage.util.dtype import dtype_range, dtype_limits
from skimage._shared.utils import deprecated
__all__ = ['histogram', 'cumulative_distribution', 'equalize',
'rescale_intensity', 'adjust_gamma',
'adjust_log', 'adjust_sig... | true | true |
f703f87ff915b3932ce7f6187f17cfb3996faefe | 8,468 | py | Python | tests/sources/tools/perception/object_tracking_2d/deep_sort/test_object_tracking_2d_deep_sort.py | daoran/opendr | bca25f6a43244fe9c219a24576181f94a0726923 | [
"Apache-2.0"
] | null | null | null | tests/sources/tools/perception/object_tracking_2d/deep_sort/test_object_tracking_2d_deep_sort.py | daoran/opendr | bca25f6a43244fe9c219a24576181f94a0726923 | [
"Apache-2.0"
] | null | null | null | tests/sources/tools/perception/object_tracking_2d/deep_sort/test_object_tracking_2d_deep_sort.py | daoran/opendr | bca25f6a43244fe9c219a24576181f94a0726923 | [
"Apache-2.0"
] | null | null | null | # Copyright 2020-2022 OpenDR European Project
#
# 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 agree... | 31.479554 | 99 | 0.571682 |
import sys
import unittest
import shutil
import torch
from opendr.perception.object_tracking_2d import ObjectTracking2DDeepSortLearner
from opendr.perception.object_tracking_2d import (
Market1501Dataset,
Market1501DatasetIterator,
)
from opendr.perception.object_tracking_2d import (
MotDatase... | true | true |
f703f900fdeb2d460fabac0b14ae0aab32185ff9 | 95,093 | py | Python | ibflex/Types.py | tobigs/ibflex | 1d2f9e99a40db6c8bc561a35899a62246e98edf0 | [
"MIT"
] | null | null | null | ibflex/Types.py | tobigs/ibflex | 1d2f9e99a40db6c8bc561a35899a62246e98edf0 | [
"MIT"
] | null | null | null | ibflex/Types.py | tobigs/ibflex | 1d2f9e99a40db6c8bc561a35899a62246e98edf0 | [
"MIT"
] | null | null | null | # coding: utf-8
"""Python data types for IB Flex format XML data.
These class definitions are introspected by ibflex.parser to type-convert
IB data. They're dataclasses, made immutable by passing `Frozen=True` to the
class decorator. Class attributes are annotated with PEP 484 type hints.
Except for the top-level ... | 41.891189 | 86 | 0.718875 |
ons
__all__ = [
"FlexElement",
"FlexQueryResponse",
"FlexStatement",
"AccountInformation",
"ChangeInNAV",
"MTMPerformanceSummaryUnderlying",
"EquitySummaryByReportDateInBase",
"MTDYTDPerformanceSummaryUnderlying",
"CashReportCurrency",
"FIFOPerformanceSummaryUnderlying",
"... | true | true |
f703fa3f53c5913ed04533abc3463b282d9d8fb7 | 3,343 | py | Python | examples/oauth2_async.py | Nobyx/pyfy | e18a7b7e48eefc4cb58e5d826c341bce99452a66 | [
"MIT"
] | 48 | 2019-02-13T19:53:39.000Z | 2021-05-04T20:56:34.000Z | examples/oauth2_async.py | Nobyx/pyfy | e18a7b7e48eefc4cb58e5d826c341bce99452a66 | [
"MIT"
] | 21 | 2019-01-09T17:46:13.000Z | 2021-08-22T12:38:59.000Z | examples/oauth2_async.py | Nobyx/pyfy | e18a7b7e48eefc4cb58e5d826c341bce99452a66 | [
"MIT"
] | 15 | 2019-01-03T01:30:24.000Z | 2022-01-30T09:53:18.000Z | import os
import aiofiles
import webbrowser
import json as stdlib_json
from sanic import Sanic, response
from sanic.exceptions import abort
from sanic.response import json
from pyfy import AsyncSpotify, ClientCreds, AuthError
try:
from spt_keys import KEYS
except: # noqa: E722
from spt_keys_template import ... | 28.57265 | 179 | 0.643733 | import os
import aiofiles
import webbrowser
import json as stdlib_json
from sanic import Sanic, response
from sanic.exceptions import abort
from sanic.response import json
from pyfy import AsyncSpotify, ClientCreds, AuthError
try:
from spt_keys import KEYS
except:
from spt_keys_template import KEYS
app =... | true | true |
f703fa90e2d737ae58f0bbbe0f32941d8edab9d8 | 1,652 | py | Python | firmware/adafruit-circuitpython-bundle-5.x-mpy-20200915/examples/ili9341_simpletest.py | freeglow/microcontroller-cpy | 5adfda49da6eefaece81be2a2f26122d68736355 | [
"MIT"
] | null | null | null | firmware/adafruit-circuitpython-bundle-5.x-mpy-20200915/examples/ili9341_simpletest.py | freeglow/microcontroller-cpy | 5adfda49da6eefaece81be2a2f26122d68736355 | [
"MIT"
] | null | null | null | firmware/adafruit-circuitpython-bundle-5.x-mpy-20200915/examples/ili9341_simpletest.py | freeglow/microcontroller-cpy | 5adfda49da6eefaece81be2a2f26122d68736355 | [
"MIT"
] | null | null | null | """
This test will initialize the display using displayio and draw a solid green
background, a smaller purple rectangle, and some yellow text. All drawing is done
using native displayio modules.
Pinouts are for the 2.4" TFT FeatherWing or Breakout with a Feather M4 or M0.
"""
import board
import terminalio
im... | 30.036364 | 88 | 0.757869 | import board
import terminalio
import displayio
from adafruit_display_text import label
import adafruit_ili9341
displayio.release_displays()
spi = board.SPI()
tft_cs = board.D9
tft_dc = board.D10
display_bus = displayio.FourWire(
spi, command=tft_dc, chip_select=tft_cs, reset=board.D6
)
display =... | true | true |
f703fb6b4a046fbf6ff6a8ee312a5201ae8c1525 | 14,119 | py | Python | contrib/gitian-build.py | minblock/CBreezycoin | ea83e04d2e1eff4823f36234f98cae107210cc58 | [
"MIT"
] | null | null | null | contrib/gitian-build.py | minblock/CBreezycoin | ea83e04d2e1eff4823f36234f98cae107210cc58 | [
"MIT"
] | null | null | null | contrib/gitian-build.py | minblock/CBreezycoin | ea83e04d2e1eff4823f36234f98cae107210cc58 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import argparse
import os
import subprocess
import sys
def setup():
global args, workdir
programs = ['ruby', 'git', 'apt-cacher-ng', 'make', 'wget']
if args.kvm:
programs += ['python-vm-builder', 'qemu-kvm', 'qemu-utils']
elif args.docker:
dockers = ['docker.io',... | 60.337607 | 239 | 0.662157 |
import argparse
import os
import subprocess
import sys
def setup():
global args, workdir
programs = ['ruby', 'git', 'apt-cacher-ng', 'make', 'wget']
if args.kvm:
programs += ['python-vm-builder', 'qemu-kvm', 'qemu-utils']
elif args.docker:
dockers = ['docker.io', 'docker-ce']
... | true | true |
f703fe3302fd8e97b2aba9b8d194ec5033b5a3f2 | 1,353 | py | Python | autobahntestsuite/autobahntestsuite/case/case1_2_5.py | rishabh-bector/autobahn-testsuite | 57030060630c10b22be44774973eaa61987b716c | [
"Apache-2.0"
] | 595 | 2015-10-20T09:01:18.000Z | 2022-03-28T08:48:27.000Z | autobahntestsuite/autobahntestsuite/case/case1_2_5.py | rishabh-bector/autobahn-testsuite | 57030060630c10b22be44774973eaa61987b716c | [
"Apache-2.0"
] | 73 | 2015-12-03T14:21:56.000Z | 2022-02-05T01:53:05.000Z | autobahntestsuite/autobahntestsuite/case/case1_2_5.py | rishabh-bector/autobahn-testsuite | 57030060630c10b22be44774973eaa61987b716c | [
"Apache-2.0"
] | 65 | 2015-11-04T15:58:37.000Z | 2022-02-09T03:49:24.000Z | ###############################################################################
##
## Copyright (c) Crossbar.io Technologies GmbH
##
## 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... | 41 | 113 | 0.606061 | true | true | |
f703fe79f2870b477658e585c0a8cec88df6106d | 101 | py | Python | Simples/Multiplos.py | AlexDeSaran/Python | 6c4ce2ad49fafa1d1d5e543d14e94a9e13463321 | [
"MIT"
] | null | null | null | Simples/Multiplos.py | AlexDeSaran/Python | 6c4ce2ad49fafa1d1d5e543d14e94a9e13463321 | [
"MIT"
] | null | null | null | Simples/Multiplos.py | AlexDeSaran/Python | 6c4ce2ad49fafa1d1d5e543d14e94a9e13463321 | [
"MIT"
] | null | null | null | a = int(input())
for i in range(1,11):
total = i*a
print('{} x {} = {}'.format(i, a,total))
| 16.833333 | 44 | 0.485149 | a = int(input())
for i in range(1,11):
total = i*a
print('{} x {} = {}'.format(i, a,total))
| true | true |
f7040147311911bc74b5f09fef490f0f55ddd7ee | 8,220 | py | Python | tests/DifferentialGame/masac_gnn_gaussian.py | maxiaoba/rlk | 3e23473f6bbc59552b6b2bcd97245e024d7ca95d | [
"MIT"
] | 1 | 2021-09-28T21:16:54.000Z | 2021-09-28T21:16:54.000Z | tests/DifferentialGame/masac_gnn_gaussian.py | maxiaoba/rlkit | 3e23473f6bbc59552b6b2bcd97245e024d7ca95d | [
"MIT"
] | null | null | null | tests/DifferentialGame/masac_gnn_gaussian.py | maxiaoba/rlkit | 3e23473f6bbc59552b6b2bcd97245e024d7ca95d | [
"MIT"
] | null | null | null | import copy
import torch.nn as nn
from rlkit.launchers.launcher_util import setup_logger
import rlkit.torch.pytorch_util as ptu
from rlkit.core.ma_eval_util import get_generic_ma_path_information
def experiment(variant):
num_agent = variant['num_agent']
from differential_game import DifferentialGame
expl_e... | 40.895522 | 101 | 0.647324 | import copy
import torch.nn as nn
from rlkit.launchers.launcher_util import setup_logger
import rlkit.torch.pytorch_util as ptu
from rlkit.core.ma_eval_util import get_generic_ma_path_information
def experiment(variant):
num_agent = variant['num_agent']
from differential_game import DifferentialGame
expl_e... | true | true |
f70402c5d37a8546f11db5fc5373c0510be77024 | 6,232 | py | Python | corehq/apps/reports/v2/formatters/cases.py | dimagilg/commcare-hq | ea1786238eae556bb7f1cbd8d2460171af1b619c | [
"BSD-3-Clause"
] | 1 | 2020-07-14T13:00:23.000Z | 2020-07-14T13:00:23.000Z | corehq/apps/reports/v2/formatters/cases.py | dimagilg/commcare-hq | ea1786238eae556bb7f1cbd8d2460171af1b619c | [
"BSD-3-Clause"
] | 94 | 2020-12-11T06:57:31.000Z | 2022-03-15T10:24:06.000Z | corehq/apps/reports/v2/formatters/cases.py | dimagilg/commcare-hq | ea1786238eae556bb7f1cbd8d2460171af1b619c | [
"BSD-3-Clause"
] | null | null | null | from django.urls import NoReverseMatch
from django.utils import html
from django.utils.translation import ugettext as _
from couchdbkit import ResourceNotFound
from casexml.apps.case.models import CommCareCaseAction
from corehq.apps.case_search.const import (
CASE_COMPUTED_METADATA,
SPECIAL_CASE_PROPERTIES,
... | 31.316583 | 80 | 0.627246 | from django.urls import NoReverseMatch
from django.utils import html
from django.utils.translation import ugettext as _
from couchdbkit import ResourceNotFound
from casexml.apps.case.models import CommCareCaseAction
from corehq.apps.case_search.const import (
CASE_COMPUTED_METADATA,
SPECIAL_CASE_PROPERTIES,
... | true | true |
f704031ca2654ce12a768055b21aa14bfcf015c4 | 4,595 | py | Python | megaman/geometry/tests/test_adjacency.py | jrsassen/megaman | 6583e462bc05c003c6c5e030ba993c5e30477720 | [
"BSD-2-Clause"
] | 303 | 2016-03-03T00:44:37.000Z | 2022-03-14T03:43:38.000Z | megaman/geometry/tests/test_adjacency.py | YifuLiuL/megaman | faccaf267aad0a8b18ec8a705735fd9dd838ca1e | [
"BSD-2-Clause"
] | 52 | 2016-02-26T21:41:31.000Z | 2021-06-27T08:33:51.000Z | megaman/geometry/tests/test_adjacency.py | YifuLiuL/megaman | faccaf267aad0a8b18ec8a705735fd9dd838ca1e | [
"BSD-2-Clause"
] | 67 | 2016-03-03T22:38:35.000Z | 2022-01-12T08:03:47.000Z | # LICENSE: Simplified BSD https://github.com/mmp2/megaman/blob/master/LICENSE
from nose import SkipTest
import numpy as np
from numpy.testing import assert_allclose, assert_raises, assert_equal
from scipy.sparse import isspmatrix
from scipy.spatial.distance import cdist, pdist, squareform
from megaman.geometry impor... | 33.540146 | 84 | 0.618063 |
from nose import SkipTest
import numpy as np
from numpy.testing import assert_allclose, assert_raises, assert_equal
from scipy.sparse import isspmatrix
from scipy.spatial.distance import cdist, pdist, squareform
from megaman.geometry import (Geometry, compute_adjacency_matrix, Adjacency,
... | true | true |
f70403b3d7e36b7ccf92e57b61371b2e90ceba89 | 982 | py | Python | predictor/connectivity/similarity/protein-kernel/smith-waterman/pull_uniprot_fasta.py | tttor/csipb-jamu-prj | 33b08a8a12054c8a5a7240681a28c8b233b329ba | [
"MIT"
] | 5 | 2017-03-31T03:25:09.000Z | 2021-12-17T02:28:24.000Z | predictor/connectivity/similarity/protein-kernel/smith-waterman/pull_uniprot_fasta.py | tttor/csipb-jamu-prj | 33b08a8a12054c8a5a7240681a28c8b233b329ba | [
"MIT"
] | 165 | 2016-08-11T01:59:47.000Z | 2017-10-10T06:32:12.000Z | predictor/connectivity/similarity/protein-kernel/smith-waterman/pull_uniprot_fasta.py | tttor/csipb-jamu-prj | 33b08a8a12054c8a5a7240681a28c8b233b329ba | [
"MIT"
] | 11 | 2015-06-15T04:25:59.000Z | 2021-04-18T09:39:16.000Z | import numpy as np
import urllib2 as ulib
import csv
import time
if __name__ == '__main__':
start_time = time.time()
outDir = "Fasta/"
listDir = "protein.csv"
urlDomain = "http://www.uniprot.org/uniprot/"
protList = []
it = 0 #flag for parsing and counter for download variable
#Parse csv
... | 27.277778 | 66 | 0.54277 | import numpy as np
import urllib2 as ulib
import csv
import time
if __name__ == '__main__':
start_time = time.time()
outDir = "Fasta/"
listDir = "protein.csv"
urlDomain = "http://www.uniprot.org/uniprot/"
protList = []
it = 0
with open(listDir,'r') as f:
csvContent = csv.rea... | false | true |
f704055f4bf5d04061e90afcc1d8780eda8a5540 | 3,944 | py | Python | certbot/compat/os.py | daramousk/certbot | 082040afb4c6542445ee8437a3dea61171706a80 | [
"Apache-2.0"
] | null | null | null | certbot/compat/os.py | daramousk/certbot | 082040afb4c6542445ee8437a3dea61171706a80 | [
"Apache-2.0"
] | null | null | null | certbot/compat/os.py | daramousk/certbot | 082040afb4c6542445ee8437a3dea61171706a80 | [
"Apache-2.0"
] | null | null | null | """
This compat modules is a wrapper of the core os module that forbids usage of specific operations
(e.g. chown, chmod, getuid) that would be harmful to the Windows file security model of Certbot.
This module is intended to replace standard os module throughout certbot projects (except acme).
"""
# pylint: disable=fun... | 58 | 128 | 0.751775 |
from __future__ import absolute_import
from os import * tribute in dir(std_os):
if not hasattr(ourselves, attribute):
setattr(ourselves, attribute, getattr(std_os, attribute))
std_sys.modules[__name__ + '.path'] = path
del ourselves, std_os, std_sys
def chmod(*unused_... | true | true |
f704059b08f3fa4d248919124abf5b44bc1ec892 | 1,331 | py | Python | pgp_stuff.py | d7d4af8/2047 | bd6781b9502c6fdbd4745be5084977f679fa3fc5 | [
"MIT"
] | 35 | 2020-09-01T00:34:50.000Z | 2022-03-29T13:14:15.000Z | pgp_stuff.py | d7d4af8/2047 | bd6781b9502c6fdbd4745be5084977f679fa3fc5 | [
"MIT"
] | 3 | 2020-08-19T20:47:19.000Z | 2021-09-06T23:55:49.000Z | pgp_stuff.py | d7d4af8/2047 | bd6781b9502c6fdbd4745be5084977f679fa3fc5 | [
"MIT"
] | 10 | 2020-08-07T02:20:09.000Z | 2022-01-30T06:43:45.000Z | from commons import *
import os
def pgp_check():
init_directory('./temp')
# gpg must exist on your system
status = os.system('gpg --version')
if status==0:
print_up('gpg is found')
else:
print_err('can\'t find gpg')
def verify_publickey_message(pk, msg):
# obtain a temp filena... | 28.319149 | 167 | 0.623591 | from commons import *
import os
def pgp_check():
init_directory('./temp')
status = os.system('gpg --version')
if status==0:
print_up('gpg is found')
else:
print_err('can\'t find gpg')
def verify_publickey_message(pk, msg):
# obtain a temp filename
fn = get_random_hex_stri... | true | true |
f704068d246cb619970447be75314858f1109080 | 7,182 | py | Python | venv/Tests/TupleTests.py | matthijsvanvliet/raytracing-python | 73d692b47330ab94eedde579a51063e3a907e92b | [
"MIT"
] | 1 | 2021-06-03T11:34:15.000Z | 2021-06-03T11:34:15.000Z | venv/Tests/TupleTests.py | matthijsvanvliet/raytracing-python | 73d692b47330ab94eedde579a51063e3a907e92b | [
"MIT"
] | null | null | null | venv/Tests/TupleTests.py | matthijsvanvliet/raytracing-python | 73d692b47330ab94eedde579a51063e3a907e92b | [
"MIT"
] | null | null | null | import unittest
import math
from Include.Tuple import *
#
# Tuple Unit tests
#
class TestTuplePointVector(unittest.TestCase):
def test_Tuple_ifWArgumentIsOneTupleIsPoint(self):
self.a = Tuple(4.3, -4.2, 3.1, 1.0)
self.assertEqual(self.a.x, 4.3)
self.assertEqual(self.a.y, -4.2)
self... | 34.528846 | 99 | 0.628376 | import unittest
import math
from Include.Tuple import *
class TestTuplePointVector(unittest.TestCase):
def test_Tuple_ifWArgumentIsOneTupleIsPoint(self):
self.a = Tuple(4.3, -4.2, 3.1, 1.0)
self.assertEqual(self.a.x, 4.3)
self.assertEqual(self.a.y, -4.2)
self.assertEqual(self.a.... | true | true |
f704069f25b67e230b29ca48e4aa09f87f29dab3 | 4,481 | py | Python | matchms/Metadata.py | maximskorik/matchms | 922f5afaef123a793194bdd74391027477cbb844 | [
"Apache-2.0"
] | null | null | null | matchms/Metadata.py | maximskorik/matchms | 922f5afaef123a793194bdd74391027477cbb844 | [
"Apache-2.0"
] | null | null | null | matchms/Metadata.py | maximskorik/matchms | 922f5afaef123a793194bdd74391027477cbb844 | [
"Apache-2.0"
] | null | null | null | from collections.abc import Mapping
import numpy as np
from pickydict import PickyDict
from .utils import load_known_key_conversions
_key_regex_replacements = {r"\s": "_",
r"[!?.,;:]": ""}
_key_replacements = load_known_key_conversions()
class Metadata:
"""Class to handle spectrum met... | 32.007143 | 98 | 0.60366 | from collections.abc import Mapping
import numpy as np
from pickydict import PickyDict
from .utils import load_known_key_conversions
_key_regex_replacements = {r"\s": "_",
r"[!?.,;:]": ""}
_key_replacements = load_known_key_conversions()
class Metadata:
def __init__(self, metadata: di... | true | true |
f70406af9f6a92249029dee780ff1c94a4916a76 | 10,990 | py | Python | config/settings/base.py | kmvicky/webscrape | 92ca9100e21de276ed8470621e1e3a7a6495d54d | [
"MIT"
] | null | null | null | config/settings/base.py | kmvicky/webscrape | 92ca9100e21de276ed8470621e1e3a7a6495d54d | [
"MIT"
] | null | null | null | config/settings/base.py | kmvicky/webscrape | 92ca9100e21de276ed8470621e1e3a7a6495d54d | [
"MIT"
] | null | null | null | """
Base settings to build other settings files upon.
"""
import environ
ROOT_DIR = (
environ.Path(__file__) - 3
) # (webscrape/config/settings/base.py - 3 = webscrape/)
APPS_DIR = ROOT_DIR.path("webscrape")
env = environ.Env()
READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_ENV_FILE", default=False)
if READ_DOT... | 39.818841 | 93 | 0.624477 |
import environ
ROOT_DIR = (
environ.Path(__file__) - 3
)
APPS_DIR = ROOT_DIR.path("webscrape")
env = environ.Env()
READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_ENV_FILE", default=False)
if READ_DOT_ENV_FILE:
env.read_env(str(ROOT_DIR.path(".env")))
= env.bool("DJANGO_DEBUG", False)
TIME_ZONE... | true | true |
f70406ba633b169d9b426b484db582d346a358e5 | 1,250 | py | Python | bench/create-large-number-objects.py | scopatz/PyTables | 05a74def785688abd802224a5ba44393a701ebc7 | [
"BSD-3-Clause"
] | 9 | 2021-09-28T05:20:22.000Z | 2022-03-16T11:09:06.000Z | bench/create-large-number-objects.py | scopatz/PyTables | 05a74def785688abd802224a5ba44393a701ebc7 | [
"BSD-3-Clause"
] | null | null | null | bench/create-large-number-objects.py | scopatz/PyTables | 05a74def785688abd802224a5ba44393a701ebc7 | [
"BSD-3-Clause"
] | 9 | 2018-09-14T02:42:36.000Z | 2021-07-12T02:37:45.000Z | "This creates an HDF5 file with a potentially large number of objects"
import sys
import numpy
import tables
filename = sys.argv[1]
# Open a new empty HDF5 file
fileh = tables.open_file(filename, mode="w")
# nlevels -- Number of levels in hierarchy
# ngroups -- Number of groups on each level
# ndatasets -- Number o... | 29.069767 | 70 | 0.6576 |
import sys
import numpy
import tables
filename = sys.argv[1]
fileh = tables.open_file(filename, mode="w")
nlevels, ngroups, ndatasets = (3, 10, 100)
a = numpy.array([-1, 2, 4], numpy.int16)
group = fileh.root
group2 = fileh.root
for k in range(nlevels):
for j in range(ngroups):
for i in ran... | true | true |
f70406eb9b9fe364a7fb8937344dde40982c8523 | 1,391 | py | Python | test/test_logging.py | LukasSp/pyPESTO | f4260ff6cacce982bb25fe104e04fb761efdf0ec | [
"BSD-3-Clause"
] | null | null | null | test/test_logging.py | LukasSp/pyPESTO | f4260ff6cacce982bb25fe104e04fb761efdf0ec | [
"BSD-3-Clause"
] | null | null | null | test/test_logging.py | LukasSp/pyPESTO | f4260ff6cacce982bb25fe104e04fb761efdf0ec | [
"BSD-3-Clause"
] | null | null | null | import logging
import os
import unittest
import pypesto
import pypesto.logging
class LoggingTest(unittest.TestCase):
def test_optimize(self):
# logging
pypesto.logging.log_to_console(logging.WARN)
filename = ".test_logging.tmp"
pypesto.logging.log_to_file(logging.DEBUG, filename)
... | 26.245283 | 64 | 0.629763 | import logging
import os
import unittest
import pypesto
import pypesto.logging
class LoggingTest(unittest.TestCase):
def test_optimize(self):
pypesto.logging.log_to_console(logging.WARN)
filename = ".test_logging.tmp"
pypesto.logging.log_to_file(logging.DEBUG, filename)
l... | true | true |
f7040787cfab454ed3ba0eff92e82d5a1f9ab64d | 116 | py | Python | Django/tasking-and-analysis-system-django/tasking-and-analysis-system/apps/audit_trail/urls.py | Yeva9/ITC-projects | 19e967d656c86c64f04cc1ffbe03540f97c6eb34 | [
"MIT"
] | null | null | null | Django/tasking-and-analysis-system-django/tasking-and-analysis-system/apps/audit_trail/urls.py | Yeva9/ITC-projects | 19e967d656c86c64f04cc1ffbe03540f97c6eb34 | [
"MIT"
] | null | null | null | Django/tasking-and-analysis-system-django/tasking-and-analysis-system/apps/audit_trail/urls.py | Yeva9/ITC-projects | 19e967d656c86c64f04cc1ffbe03540f97c6eb34 | [
"MIT"
] | null | null | null | from django.urls import path
from .views import audit_view
urlpatterns = [
path('', audit_view, name="audit")
] | 19.333333 | 38 | 0.715517 | from django.urls import path
from .views import audit_view
urlpatterns = [
path('', audit_view, name="audit")
] | true | true |
f70407ea056eccf4a4115cfa0cb37026b3d9e89b | 5,777 | py | Python | dashboard/views.py | rossm6/accounts | 74633ce4038806222048d85ef9dfe97a957a6a71 | [
"MIT"
] | 11 | 2021-01-23T01:09:54.000Z | 2021-01-25T07:16:30.000Z | dashboard/views.py | rossm6/accounts | 74633ce4038806222048d85ef9dfe97a957a6a71 | [
"MIT"
] | 7 | 2021-04-06T18:19:10.000Z | 2021-09-22T19:45:03.000Z | dashboard/views.py | rossm6/accounts | 74633ce4038806222048d85ef9dfe97a957a6a71 | [
"MIT"
] | 3 | 2021-01-23T18:55:32.000Z | 2021-02-16T17:47:59.000Z | from cashbook.models import CashBookTransaction
from controls.models import ModuleSettings, Period
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db.models import F, OuterRef, Subquery, Sum
from django.db.models.functions import Coalesce
from django.views.generic import TemplateView
from purchase... | 35.660494 | 112 | 0.57677 | from cashbook.models import CashBookTransaction
from controls.models import ModuleSettings, Period
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db.models import F, OuterRef, Subquery, Sum
from django.db.models.functions import Coalesce
from django.views.generic import TemplateView
from purchase... | true | true |
f70409d59ca7a839a4f7c3eb33d954c30b63472a | 9,299 | py | Python | Lib/site-packages/deriva/transfer/download/processors/query/base_query_processor.py | fochoao/cpython | 3dc84b260e5bced65ebc2c45c40c8fa65f9b5aa9 | [
"bzip2-1.0.6",
"0BSD"
] | 3 | 2018-11-18T19:33:53.000Z | 2019-10-03T18:27:49.000Z | deriva/transfer/download/processors/query/base_query_processor.py | informatics-isi-edu/deriva-py | e7e18e3d65a01a530ed52bb94e8710ae57026e6d | [
"Apache-2.0"
] | 81 | 2017-06-13T18:46:47.000Z | 2022-01-13T01:16:33.000Z | Lib/site-packages/deriva/transfer/download/processors/query/base_query_processor.py | fochoao/cpython | 3dc84b260e5bced65ebc2c45c40c8fa65f9b5aa9 | [
"bzip2-1.0.6",
"0BSD"
] | 4 | 2018-06-25T18:23:33.000Z | 2021-01-15T19:38:52.000Z | import os
import errno
import certifi
import requests
from deriva.core import urlsplit, get_new_requests_session, stob, make_dirs, DEFAULT_SESSION_CONFIG
from deriva.transfer.download import DerivaDownloadError, DerivaDownloadConfigurationError, \
DerivaDownloadAuthenticationError, DerivaDownloadAuthorizationError
... | 43.657277 | 119 | 0.586515 | import os
import errno
import certifi
import requests
from deriva.core import urlsplit, get_new_requests_session, stob, make_dirs, DEFAULT_SESSION_CONFIG
from deriva.transfer.download import DerivaDownloadError, DerivaDownloadConfigurationError, \
DerivaDownloadAuthenticationError, DerivaDownloadAuthorizationError
... | true | true |
f7040abddca02a13cd30d3cee4c8d59277d78dfe | 383 | py | Python | sampleproject_tests/testBasics.py | viktorasm/maya-tdd-toolkit-sampleproject | 00e0b686f19b9cd5c8ddacd2084e9f0c11acf2f3 | [
"Apache-2.0"
] | null | null | null | sampleproject_tests/testBasics.py | viktorasm/maya-tdd-toolkit-sampleproject | 00e0b686f19b9cd5c8ddacd2084e9f0c11acf2f3 | [
"Apache-2.0"
] | null | null | null | sampleproject_tests/testBasics.py | viktorasm/maya-tdd-toolkit-sampleproject | 00e0b686f19b9cd5c8ddacd2084e9f0c11acf2f3 | [
"Apache-2.0"
] | null | null | null | import unittest
from sampleproject_tests import mayaTest
from mayatdd.mayatest import insideMaya
if insideMaya:
from maya import cmds
@mayaTest
class Test(unittest.TestCase):
def testMinimal(self):
'''
do something with maya.cmds to prove we're actually running this test in Maya.
'''
... | 22.529412 | 86 | 0.673629 | import unittest
from sampleproject_tests import mayaTest
from mayatdd.mayatest import insideMaya
if insideMaya:
from maya import cmds
@mayaTest
class Test(unittest.TestCase):
def testMinimal(self):
'''
do something with maya.cmds to prove we're actually running this test in Maya.
'''
... | false | true |
f7040b9b8b2205c05f39974dc23dd90767f1595b | 1,659 | py | Python | tests/test_audio.py | Lisafiluz/calendar | a88e34f7ab9dd25753ca041461e56d20a7f9fd1e | [
"Apache-2.0"
] | null | null | null | tests/test_audio.py | Lisafiluz/calendar | a88e34f7ab9dd25753ca041461e56d20a7f9fd1e | [
"Apache-2.0"
] | null | null | null | tests/test_audio.py | Lisafiluz/calendar | a88e34f7ab9dd25753ca041461e56d20a7f9fd1e | [
"Apache-2.0"
] | null | null | null | from app.routers.audio import router
AUDIO_SETTINGS_URL = router.url_path_for("audio_settings")
GET_CHOICES_URL = router.url_path_for("get_choices")
START_AUDIO_URL = router.url_path_for("start_audio")
def test_get_settings(audio_test_client):
response = audio_test_client.get(url=AUDIO_SETTINGS_URL)
assert r... | 29.105263 | 69 | 0.705244 | from app.routers.audio import router
AUDIO_SETTINGS_URL = router.url_path_for("audio_settings")
GET_CHOICES_URL = router.url_path_for("get_choices")
START_AUDIO_URL = router.url_path_for("start_audio")
def test_get_settings(audio_test_client):
response = audio_test_client.get(url=AUDIO_SETTINGS_URL)
assert r... | true | true |
f7040c6cca5a86749407c6d12a090a8e1288ff52 | 6,990 | py | Python | src/teleop_tools/mouse_teleop/scripts/mouse_teleop.py | aljanabim/svea | 37d27089237af3777456d7664473ffb811dabf33 | [
"MIT"
] | 5 | 2021-06-25T13:09:30.000Z | 2022-03-15T11:33:07.000Z | src/teleop_tools/mouse_teleop/scripts/mouse_teleop.py | aljanabim/svea | 37d27089237af3777456d7664473ffb811dabf33 | [
"MIT"
] | null | null | null | src/teleop_tools/mouse_teleop/scripts/mouse_teleop.py | aljanabim/svea | 37d27089237af3777456d7664473ffb811dabf33 | [
"MIT"
] | 17 | 2019-09-29T10:22:41.000Z | 2021-04-08T12:38:37.000Z | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Enrique Fernandez
# Released under the BSD License.
#
# Authors:
# * Enrique Fernandez
import Tkinter
import rospy
from geometry_msgs.msg import Twist, Vector3
import numpy
class MouseTeleop():
def __init__(self):
# Retrieve params... | 28.884298 | 78 | 0.572246 |
import Tkinter
import rospy
from geometry_msgs.msg import Twist, Vector3
import numpy
class MouseTeleop():
def __init__(self):
self._frequency = rospy.get_param('~frequency', 0.0)
self._scale = rospy.get_param('~scale', 1.0)
self._holonomic = rospy.get_param('~holonomic... | true | true |
f7040c7d07a67dcc16f387e658425ea49720e40f | 10,718 | py | Python | tests/image/test_segmentation.py | dnjst/squidpy | ca765d04b9621debb8752d3d4693dd68f6909513 | [
"BSD-3-Clause"
] | 161 | 2021-02-15T15:14:22.000Z | 2022-03-30T10:06:06.000Z | tests/image/test_segmentation.py | dnjst/squidpy | ca765d04b9621debb8752d3d4693dd68f6909513 | [
"BSD-3-Clause"
] | 214 | 2021-02-14T18:20:37.000Z | 2022-03-31T18:23:41.000Z | tests/image/test_segmentation.py | dnjst/squidpy | ca765d04b9621debb8752d3d4693dd68f6909513 | [
"BSD-3-Clause"
] | 36 | 2021-02-14T18:46:52.000Z | 2022-03-17T04:25:37.000Z | from typing import Tuple, Union, Callable, Optional, Sequence
from pytest_mock import MockerFixture
import pytest
import numpy as np
import dask.array as da
from squidpy.im import (
segment,
ImageContainer,
SegmentationCustom,
SegmentationWatershed,
)
from squidpy.im._segment import _SEG_DTYPE
from sq... | 41.065134 | 119 | 0.630528 | from typing import Tuple, Union, Callable, Optional, Sequence
from pytest_mock import MockerFixture
import pytest
import numpy as np
import dask.array as da
from squidpy.im import (
segment,
ImageContainer,
SegmentationCustom,
SegmentationWatershed,
)
from squidpy.im._segment import _SEG_DTYPE
from sq... | true | true |
f7040cb7f34ead1a89da8de11b06d15adf9b3e85 | 6,381 | py | Python | restler-quick-start.py | mkleshchenok/restler-fuzzer | 1bd7bc68a6c4de997e9fda9a9db5ffb0504b864c | [
"MIT"
] | null | null | null | restler-quick-start.py | mkleshchenok/restler-fuzzer | 1bd7bc68a6c4de997e9fda9a9db5ffb0504b864c | [
"MIT"
] | null | null | null | restler-quick-start.py | mkleshchenok/restler-fuzzer | 1bd7bc68a6c4de997e9fda9a9db5ffb0504b864c | [
"MIT"
] | null | null | null | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import argparse
import contextlib
import os
import subprocess
from pathlib import Path
RESTLER_TEMP_DIR = 'restler_working_dir'
@contextlib.contextmanager
def usedir(dir):
""" Helper for 'with' statements that changes the current directory t... | 40.132075 | 135 | 0.640025 |
import argparse
import contextlib
import os
import subprocess
from pathlib import Path
RESTLER_TEMP_DIR = 'restler_working_dir'
@contextlib.contextmanager
def usedir(dir):
curr = os.getcwd()
os.chdir(dir)
try:
yield
finally:
os.chdir(curr)
def compile_spec(api_spec_path, restler_dll... | true | true |
f7040db7824984867af73d9593ba82caf858530e | 5,146 | py | Python | src/pretalx/common/views.py | martinheidegger/pretalx | d812e665c1c5ce29df3eafc1985af08e4d986fef | [
"Apache-2.0"
] | null | null | null | src/pretalx/common/views.py | martinheidegger/pretalx | d812e665c1c5ce29df3eafc1985af08e4d986fef | [
"Apache-2.0"
] | null | null | null | src/pretalx/common/views.py | martinheidegger/pretalx | d812e665c1c5ce29df3eafc1985af08e4d986fef | [
"Apache-2.0"
] | null | null | null | import urllib
from contextlib import suppress
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import login
from django.core.exceptions import PermissionDenied, SuspiciousOperation
from django.http import FileResponse, Http404, HttpResponseServerError
from django.shortcuts ... | 35.246575 | 114 | 0.695103 | import urllib
from contextlib import suppress
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import login
from django.core.exceptions import PermissionDenied, SuspiciousOperation
from django.http import FileResponse, Http404, HttpResponseServerError
from django.shortcuts ... | true | true |
f7040e2527e38d67c7c5bc0c51b708b2619ef854 | 630 | py | Python | companies/migrations/0001_initial.py | pankleshwaria/Django-REST-API | 3844234036e3d6906f0ca8656d559be3dd8bcc95 | [
"MIT"
] | 1 | 2020-07-16T08:12:27.000Z | 2020-07-16T08:12:27.000Z | companies/migrations/0001_initial.py | pankleshwaria/Django-REST-API | 3844234036e3d6906f0ca8656d559be3dd8bcc95 | [
"MIT"
] | null | null | null | companies/migrations/0001_initial.py | pankleshwaria/Django-REST-API | 3844234036e3d6906f0ca8656d559be3dd8bcc95 | [
"MIT"
] | null | null | null | # Generated by Django 2.1 on 2019-10-12 09:44
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Stock',
fields=[
('id', models.AutoField(auto... | 25.2 | 114 | 0.544444 |
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Stock',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=Fa... | true | true |
f7040ee3a06bea6765545d11b6476c3e3b070742 | 97,839 | py | Python | cinder/tests/unit/test_image_utils.py | stackhpc/cinder | 93f0ca4dc9eedee10df2f03dad834a31b7f09847 | [
"Apache-2.0"
] | null | null | null | cinder/tests/unit/test_image_utils.py | stackhpc/cinder | 93f0ca4dc9eedee10df2f03dad834a31b7f09847 | [
"Apache-2.0"
] | 28 | 2017-08-17T14:46:05.000Z | 2022-03-29T12:42:12.000Z | cinder/tests/unit/test_image_utils.py | alokchandra11/cinder | 121d9f512b4a6d1afe6a690effb7c2b379040a7b | [
"Apache-2.0"
] | 3 | 2017-04-27T16:11:40.000Z | 2020-02-12T21:27:00.000Z | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | 45.847704 | 79 | 0.621296 |
import errno
import math
import cryptography
import ddt
import mock
from oslo_concurrency import processutils
from oslo_utils import units
from six.moves import builtins
from cinder import exception
from cinder.image import image_utils
from cinder import test
from cinder.tests.unit import fake_constants ... | true | true |
f7040ee5ec86a17f46a2c70c781f165631fe9b72 | 1,119 | py | Python | src/models/model.py | schibsen/MLops_exercises_organized | 2c9b386fed7b1e400524905cb68f220caf9d015b | [
"MIT"
] | null | null | null | src/models/model.py | schibsen/MLops_exercises_organized | 2c9b386fed7b1e400524905cb68f220caf9d015b | [
"MIT"
] | null | null | null | src/models/model.py | schibsen/MLops_exercises_organized | 2c9b386fed7b1e400524905cb68f220caf9d015b | [
"MIT"
] | null | null | null | import torch
import torch.nn as nn
import torch.nn.functional as F
class MyAwesomeModel(nn.Module):
def __init__(self, n_classes):
super(MyAwesomeModel, self).__init__()
self.feature_extractor = nn.Sequential(
nn.Conv2d(in_channels=1, out_channels=6, kernel_size=4, stride=1),
... | 31.083333 | 81 | 0.592493 | import torch
import torch.nn as nn
import torch.nn.functional as F
class MyAwesomeModel(nn.Module):
def __init__(self, n_classes):
super(MyAwesomeModel, self).__init__()
self.feature_extractor = nn.Sequential(
nn.Conv2d(in_channels=1, out_channels=6, kernel_size=4, stride=1),
... | true | true |
f704100c34d2b9a3829c69e2437756a4a7bef023 | 403 | py | Python | tests/year_2021/test_day_2021_01.py | gansanay/adventofcode | 2ef8a50d9d8805ff780271559d43a9036a38f041 | [
"MIT"
] | null | null | null | tests/year_2021/test_day_2021_01.py | gansanay/adventofcode | 2ef8a50d9d8805ff780271559d43a9036a38f041 | [
"MIT"
] | null | null | null | tests/year_2021/test_day_2021_01.py | gansanay/adventofcode | 2ef8a50d9d8805ff780271559d43a9036a38f041 | [
"MIT"
] | null | null | null | from adventofcode.year_2021.day_2021_01 import readable, short
def test_readable_part_one():
answer = readable.part1()
assert answer == 1616
def test_readable_part_two():
answer = readable.part2()
assert answer == 1645
def test_short_part_one():
answer = short.part1()
assert answer == 1616... | 18.318182 | 62 | 0.702233 | from adventofcode.year_2021.day_2021_01 import readable, short
def test_readable_part_one():
answer = readable.part1()
assert answer == 1616
def test_readable_part_two():
answer = readable.part2()
assert answer == 1645
def test_short_part_one():
answer = short.part1()
assert answer == 1616... | true | true |
f70410f3a9b940b89f700e9a61dff38a26375e5f | 808 | py | Python | djangoecommerce/urls.py | ijohnnysa/djangoecommerce | 53b72915bf3f36fb7e75fbd8caa87d08d860b8d5 | [
"MIT"
] | null | null | null | djangoecommerce/urls.py | ijohnnysa/djangoecommerce | 53b72915bf3f36fb7e75fbd8caa87d08d860b8d5 | [
"MIT"
] | null | null | null | djangoecommerce/urls.py | ijohnnysa/djangoecommerce | 53b72915bf3f36fb7e75fbd8caa87d08d860b8d5 | [
"MIT"
] | null | null | null | """djangoecommerce URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Cla... | 32.32 | 77 | 0.707921 | from django.contrib import admin
from django.urls import path
from core.views import index
urlpatterns = [
path('', index),
path('admin/', admin.site.urls),
]
| true | true |
f7041307e33cd1201a9c5c859e8fdf222c915063 | 10,525 | py | Python | stable_baselines/cmaes/cma_redo.py | hugerepo-tianhang/low_dim_update_stable | 565f6cbf886d266d0633bc112ccae28f1d116ee1 | [
"MIT"
] | null | null | null | stable_baselines/cmaes/cma_redo.py | hugerepo-tianhang/low_dim_update_stable | 565f6cbf886d266d0633bc112ccae28f1d116ee1 | [
"MIT"
] | null | null | null | stable_baselines/cmaes/cma_redo.py | hugerepo-tianhang/low_dim_update_stable | 565f6cbf886d266d0633bc112ccae28f1d116ee1 | [
"MIT"
] | null | null | null | from stable_baselines.ppo2.run_mujoco import eval_return
import cma
import numpy as np
from stable_baselines.low_dim_analysis.eval_util import *
from stable_baselines.low_dim_analysis.common import do_pca, plot_2d, \
dump_rows_write_csv, generate_run_dir, do_proj_on_first_n_IPCA, get_allinone_concat_df
from sklear... | 34.966777 | 157 | 0.67924 | from stable_baselines.ppo2.run_mujoco import eval_return
import cma
import numpy as np
from stable_baselines.low_dim_analysis.eval_util import *
from stable_baselines.low_dim_analysis.common import do_pca, plot_2d, \
dump_rows_write_csv, generate_run_dir, do_proj_on_first_n_IPCA, get_allinone_concat_df
from sklear... | true | true |
f7041309a6dc5d310a94af04643b0d5d9782e963 | 4,502 | py | Python | tests/test_tub_latex_converter.py | pooya-raz/TubLatexMaker | 9b9f9803286e6acf2f41ec89f7bc8c98fbd4ba72 | [
"MIT"
] | null | null | null | tests/test_tub_latex_converter.py | pooya-raz/TubLatexMaker | 9b9f9803286e6acf2f41ec89f7bc8c98fbd4ba72 | [
"MIT"
] | null | null | null | tests/test_tub_latex_converter.py | pooya-raz/TubLatexMaker | 9b9f9803286e6acf2f41ec89f7bc8c98fbd4ba72 | [
"MIT"
] | null | null | null | import tublatexmaker.latex_creater as convert
dict_of_entries = {
"(Bahth fī) uṣūl al-fiqh": {
"displaytitle": "",
"exists": "1",
"fulltext": "(Bahth fī) uṣūl al-fiqh",
"fullurl": "http://144.173.140.108:8080/tub/index.php/(Bahth_f%C4%AB)_u%E1%B9%A3%C5%ABl_al-fiqh",
"namespa... | 30.418919 | 123 | 0.506886 | import tublatexmaker.latex_creater as convert
dict_of_entries = {
"(Bahth fī) uṣūl al-fiqh": {
"displaytitle": "",
"exists": "1",
"fulltext": "(Bahth fī) uṣūl al-fiqh",
"fullurl": "http://144.173.140.108:8080/tub/index.php/(Bahth_f%C4%AB)_u%E1%B9%A3%C5%ABl_al-fiqh",
"namespa... | true | true |
f70413c4323d2f687002c19fdbba7cf96105d340 | 1,116 | py | Python | icclim/user_indices/stat.py | larsbarring/icclim | f3685c77a1a3aaff58b0d05609380c9387e9aa99 | [
"Apache-2.0"
] | null | null | null | icclim/user_indices/stat.py | larsbarring/icclim | f3685c77a1a3aaff58b0d05609380c9387e9aa99 | [
"Apache-2.0"
] | null | null | null | icclim/user_indices/stat.py | larsbarring/icclim | f3685c77a1a3aaff58b0d05609380c9387e9aa99 | [
"Apache-2.0"
] | null | null | null | from typing import Sequence
import numpy as np
import xarray
from xarray import DataArray
from xclim.indices.run_length import rle_1d
def get_longest_run_start_index(
arr: DataArray,
window: int = 1,
dim: str = "time",
) -> DataArray:
return xarray.apply_ufunc(
get_index_of_longest_run,
... | 25.953488 | 75 | 0.646057 | from typing import Sequence
import numpy as np
import xarray
from xarray import DataArray
from xclim.indices.run_length import rle_1d
def get_longest_run_start_index(
arr: DataArray,
window: int = 1,
dim: str = "time",
) -> DataArray:
return xarray.apply_ufunc(
get_index_of_longest_run,
... | true | true |
f70416665959ee4ad95fac5c75f5677bc388a177 | 419 | py | Python | explorer/notes/migrations/0002_auto_20191120_0948.py | UPstartDeveloper/explorer_buddy | 467fa77307a588645e7a9fd269ae13b6b24d4efc | [
"MIT"
] | null | null | null | explorer/notes/migrations/0002_auto_20191120_0948.py | UPstartDeveloper/explorer_buddy | 467fa77307a588645e7a9fd269ae13b6b24d4efc | [
"MIT"
] | 22 | 2019-12-05T01:10:16.000Z | 2022-03-12T00:06:51.000Z | explorer/notes/migrations/0002_auto_20191120_0948.py | UPstartDeveloper/explorer_buddy | 467fa77307a588645e7a9fd269ae13b6b24d4efc | [
"MIT"
] | null | null | null | # Generated by Django 2.2.7 on 2019-11-20 17:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('notes', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='note',
name='media',
field=... | 22.052632 | 99 | 0.599045 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('notes', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='note',
name='media',
field=models.ImageField(help_text='Optional image to ... | true | true |
f70416bbb2afaed37a9719131b77e72a373efab2 | 3,366 | py | Python | lpot/data/dataloaders/sampler.py | daisyden/lpot | d8709bb73ce13cfc0fd760845e0be40af22f5a45 | [
"Apache-2.0"
] | null | null | null | lpot/data/dataloaders/sampler.py | daisyden/lpot | d8709bb73ce13cfc0fd760845e0be40af22f5a45 | [
"Apache-2.0"
] | null | null | null | lpot/data/dataloaders/sampler.py | daisyden/lpot | d8709bb73ce13cfc0fd760845e0be40af22f5a45 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 Intel Corporation
#
# 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... | 30.324324 | 97 | 0.663102 |
from abc import abstractmethod
class Sampler(object):
def __init__(self, data_source):
pass
@abstractmethod
def __iter__(self):
raise NotImplementedError
class IterableSampler(Sampler):
def __init__(self):
super(IterableSampler, self).__init__(None)
d... | true | true |
f704175b0bd869defb393f07da425d180b3841da | 33,040 | py | Python | mytrading/utils/bettingdb.py | joeledwardson/betfair-browser | b641f134e60307250a0e51bafa849422ecf5264b | [
"MIT"
] | 3 | 2021-11-23T19:03:02.000Z | 2021-11-24T08:44:23.000Z | mytrading/utils/bettingdb.py | joeledwardson/betfair-browser | b641f134e60307250a0e51bafa849422ecf5264b | [
"MIT"
] | 2 | 2021-11-23T18:47:31.000Z | 2021-12-08T15:36:11.000Z | mytrading/utils/bettingdb.py | joeledwardson/betfair-browser | b641f134e60307250a0e51bafa849422ecf5264b | [
"MIT"
] | null | null | null | from __future__ import annotations
import shutil
from betfairlightweight.resources.streamingresources import MarketDefinition
from betfairlightweight.resources.bettingresources import MarketCatalogue, MarketBook
from betfairlightweight.streaming.listener import StreamListener
import sqlalchemy
from sqlalchemy.sql.expr... | 38.553092 | 122 | 0.618341 | from __future__ import annotations
import shutil
from betfairlightweight.resources.streamingresources import MarketDefinition
from betfairlightweight.resources.bettingresources import MarketCatalogue, MarketBook
from betfairlightweight.streaming.listener import StreamListener
import sqlalchemy
from sqlalchemy.sql.expr... | true | true |
f70419112d1be61668bdf2e4076d94273508b66b | 838 | py | Python | rest_vk_api/urls.py | vadimk2016/rest_vk_api | a21a30469b29208bf7f3386d07af6ff6ed14aae0 | [
"MIT"
] | null | null | null | rest_vk_api/urls.py | vadimk2016/rest_vk_api | a21a30469b29208bf7f3386d07af6ff6ed14aae0 | [
"MIT"
] | 2 | 2020-06-05T18:09:34.000Z | 2021-03-19T21:59:24.000Z | rest_vk_api/urls.py | vadimk2016/rest-vk-api | a21a30469b29208bf7f3386d07af6ff6ed14aae0 | [
"MIT"
] | null | null | null | """rest_vk_api URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-b... | 36.434783 | 77 | 0.696897 | from django.conf.urls import url
from main import views
urlpatterns = [
url(r'^users/(?P<user_ids>[0-9]+).*', views.get_user, name='get_users'),
url(r'^status$', views.status, name='status'),
]
| true | true |
f7041992e58e0432873e5f2a1e78ad8538963b77 | 262 | py | Python | tests/test_portscan_ssh.py | lynxis/testWrt | 072ba9236f6a392d924d838454beb60504b3e554 | [
"BSD-3-Clause"
] | 2 | 2019-05-24T23:27:16.000Z | 2019-05-25T08:10:31.000Z | tests/test_portscan_ssh.py | lynxis/testWrt | 072ba9236f6a392d924d838454beb60504b3e554 | [
"BSD-3-Clause"
] | 1 | 2022-03-29T21:52:54.000Z | 2022-03-29T21:52:54.000Z | tests/test_portscan_ssh.py | lynxis/testWrt | 072ba9236f6a392d924d838454beb60504b3e554 | [
"BSD-3-Clause"
] | 1 | 2016-05-15T03:36:55.000Z | 2016-05-15T03:36:55.000Z | #!/usr/bin/env python
from testWrt import testsetup
from testWrt.lib import SSHOpenWrt
if __name__ == "__main__":
ts = testsetup.create_generic()
device = SSHOpenWrt(hostname="192.168.1.1", password="test")
ret = device.portscan(22)
print(ret)
| 23.818182 | 64 | 0.706107 |
from testWrt import testsetup
from testWrt.lib import SSHOpenWrt
if __name__ == "__main__":
ts = testsetup.create_generic()
device = SSHOpenWrt(hostname="192.168.1.1", password="test")
ret = device.portscan(22)
print(ret)
| true | true |
f7041a0db9cf7f2e654b1f17074c45eb5fb92436 | 4,833 | py | Python | opennem/pipelines/wem/facility_scada.py | paulculmsee/opennem | 9ebe4ab6d3b97bdeebc352e075bbd5c22a8ddea1 | [
"MIT"
] | 22 | 2020-06-30T05:27:21.000Z | 2022-02-21T12:13:51.000Z | opennem/pipelines/wem/facility_scada.py | paulculmsee/opennem | 9ebe4ab6d3b97bdeebc352e075bbd5c22a8ddea1 | [
"MIT"
] | 71 | 2020-08-07T13:06:30.000Z | 2022-03-15T06:44:49.000Z | opennem/pipelines/wem/facility_scada.py | paulculmsee/opennem | 9ebe4ab6d3b97bdeebc352e075bbd5c22a8ddea1 | [
"MIT"
] | 13 | 2020-06-30T03:28:32.000Z | 2021-12-30T08:17:16.000Z | import csv
import logging
from datetime import datetime, timedelta
from typing import Any, Dict, Optional
from scrapy import Spider
from sqlalchemy.dialects.postgresql import insert
from opennem.core.normalizers import normalize_duid
from opennem.db import SessionLocal, get_database_engine
from opennem.db.models.open... | 30.783439 | 94 | 0.578523 | import csv
import logging
from datetime import datetime, timedelta
from typing import Any, Dict, Optional
from scrapy import Spider
from sqlalchemy.dialects.postgresql import insert
from opennem.core.normalizers import normalize_duid
from opennem.db import SessionLocal, get_database_engine
from opennem.db.models.open... | true | true |
f7041a14cedc1d07490ad87b40b99d090c5fa1b2 | 8,677 | py | Python | indico/modules/attachments/forms.py | UNOG-Indico/UNOG-Indico-v2 | 4fa4393cc1f3b453a69f5e0ea3b52c18337831a5 | [
"MIT"
] | null | null | null | indico/modules/attachments/forms.py | UNOG-Indico/UNOG-Indico-v2 | 4fa4393cc1f3b453a69f5e0ea3b52c18337831a5 | [
"MIT"
] | null | null | null | indico/modules/attachments/forms.py | UNOG-Indico/UNOG-Indico-v2 | 4fa4393cc1f3b453a69f5e0ea3b52c18337831a5 | [
"MIT"
] | null | null | null | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from w... | 53.561728 | 120 | 0.618071 |
from __future__ import unicode_literals
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.fields import BooleanField, TextAreaField
from wtforms.fields.html5 import URLField
from wtforms.fields.simple import HiddenField, StringField
from wtforms.validators import DataRequired, Optional, Va... | true | true |
f7041a1e02aa41849a5ec7f6bedf4701c0481e97 | 749 | py | Python | RecipeParser_Scraper.py | pherodeon/recipe-scrapers | 816ee1cfd777149efff60ca01d377ab5e141e24b | [
"MIT"
] | null | null | null | RecipeParser_Scraper.py | pherodeon/recipe-scrapers | 816ee1cfd777149efff60ca01d377ab5e141e24b | [
"MIT"
] | null | null | null | RecipeParser_Scraper.py | pherodeon/recipe-scrapers | 816ee1cfd777149efff60ca01d377ab5e141e24b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 6 20:55:32 2020
@author: arosso
"""
from recipe_scrapers import scrape_me
# give the url as a string, it can be url from any site listed below
# scraper = scrape_me('http://allrecipes.com/Recipe/Apple-Cake-Iv/Detail.aspx')
scraper = scrape_me('https://www.101cookbooks.... | 25.827586 | 84 | 0.700935 |
from recipe_scrapers import scrape_me
scraper = scrape_me('https://www.101cookbooks.com/instant-pot-mushroom-stroganoff/')
dict_recipe = dict()
dict_recipe['title'] = scraper.title()
dict_recipe['total_time'] = scraper.total_time()
dict_recipe['yields'] = scraper.yields()
dict_recipe['ingredients']... | true | true |
f7041a9f74821dafed13acb12aa043265464c9cb | 9,581 | py | Python | DC_method/util.py | Ikerlz/dcd | 056e5c4060f9d655ce4f6234b86481ae4b3f7106 | [
"MIT"
] | null | null | null | DC_method/util.py | Ikerlz/dcd | 056e5c4060f9d655ce4f6234b86481ae4b3f7106 | [
"MIT"
] | null | null | null | DC_method/util.py | Ikerlz/dcd | 056e5c4060f9d655ce4f6234b86481ae4b3f7106 | [
"MIT"
] | null | null | null | import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
import itertools
import findspark
import pyspark
from pyspark.sql.functions import pandas_udf, PandasUDFType
from pyspark.sql.types import *
import time
def simulate_sbm_dc_data(sbm_matrix, sample_size=1000, partition_num=10, cluster_num=3):
... | 38.324 | 106 | 0.600355 | import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
import itertools
import findspark
import pyspark
from pyspark.sql.functions import pandas_udf, PandasUDFType
from pyspark.sql.types import *
import time
def simulate_sbm_dc_data(sbm_matrix, sample_size=1000, partition_num=10, cluster_num=3):
... | true | true |
f7041bf911e595ee4a13e3144de596f82f262cd3 | 5,452 | py | Python | src/sentry/models/eventerror.py | JannKleen/sentry | 8b29c8234bb51a81d5cab821a1f2ed4ea8e8bd88 | [
"BSD-3-Clause"
] | 1 | 2019-02-27T15:13:06.000Z | 2019-02-27T15:13:06.000Z | src/sentry/models/eventerror.py | rmax/sentry | 8b29c8234bb51a81d5cab821a1f2ed4ea8e8bd88 | [
"BSD-3-Clause"
] | 5 | 2020-07-17T11:20:41.000Z | 2021-05-09T12:16:53.000Z | src/sentry/models/eventerror.py | zaasmi/codeerrorhelp | 1ab8d3e314386b9b2d58dad9df45355bf6014ac9 | [
"BSD-3-Clause"
] | 2 | 2021-01-26T09:53:39.000Z | 2022-03-22T09:01:47.000Z | from __future__ import absolute_import
import six
from string import Formatter
class dontexplodedict(object):
"""
A dictionary that won't throw a KeyError and will
return back a sensible default value to be used in
string formatting.
"""
def __init__(self, d=None):
self.data = d or {... | 50.018349 | 99 | 0.721937 | from __future__ import absolute_import
import six
from string import Formatter
class dontexplodedict(object):
def __init__(self, d=None):
self.data = d or {}
def __getitem__(self, key):
return self.data.get(key, '')
class EventError(object):
INVALID_DATA = 'invalid_data'
INVALID_A... | true | true |
f7041c77708c3d11ea491231f4684dd0218200ea | 3,864 | py | Python | python/fcdd/datasets/outlier_exposure/emnist.py | denix56/fcdd | d110aa8b141dc13f47156da913a6b4f9d64ddc74 | [
"MIT"
] | null | null | null | python/fcdd/datasets/outlier_exposure/emnist.py | denix56/fcdd | d110aa8b141dc13f47156da913a6b4f9d64ddc74 | [
"MIT"
] | null | null | null | python/fcdd/datasets/outlier_exposure/emnist.py | denix56/fcdd | d110aa8b141dc13f47156da913a6b4f9d64ddc74 | [
"MIT"
] | null | null | null | import os.path as pt
import numpy as np
import torchvision.transforms as transforms
import torch
from torch.utils.data import DataLoader
from torchvision.datasets import EMNIST
def ceil(x: float):
return int(np.ceil(x))
class MyEMNIST(EMNIST):
""" Reimplements get_item to transform tensor input to pil imag... | 42.933333 | 116 | 0.61206 | import os.path as pt
import numpy as np
import torchvision.transforms as transforms
import torch
from torch.utils.data import DataLoader
from torchvision.datasets import EMNIST
def ceil(x: float):
return int(np.ceil(x))
class MyEMNIST(EMNIST):
def __getitem__(self, index):
img, target = self.data[i... | true | true |
f7041c9a2d72c9bd22b94e66ee3c74d5036d345c | 867 | py | Python | rgb_stacking/contrib/common.py | ava6969/rgb_stacking_extend | a36f1e35aa796e77201321161056e174966e7707 | [
"Apache-2.0"
] | null | null | null | rgb_stacking/contrib/common.py | ava6969/rgb_stacking_extend | a36f1e35aa796e77201321161056e174966e7707 | [
"Apache-2.0"
] | null | null | null | rgb_stacking/contrib/common.py | ava6969/rgb_stacking_extend | a36f1e35aa796e77201321161056e174966e7707 | [
"Apache-2.0"
] | null | null | null | import numpy as np
import torch
import torch.nn as nn
from rgb_stacking.utils.utils import init
class Flatten(nn.Module):
def forward(self, x):
return x.view(x.size(0), -1)
class Sum(nn.Module):
def __init__(self, dim):
super().__init__()
self.dim = dim
def forward(self, x):
... | 19.704545 | 58 | 0.596309 | import numpy as np
import torch
import torch.nn as nn
from rgb_stacking.utils.utils import init
class Flatten(nn.Module):
def forward(self, x):
return x.view(x.size(0), -1)
class Sum(nn.Module):
def __init__(self, dim):
super().__init__()
self.dim = dim
def forward(self, x):
... | true | true |
f7041d491bfe36a21ac0fe91f27199165aa38729 | 1,226 | py | Python | index_flask_qr/core/types23.py | lishnih/index_flask_qr | ac00346724d785d23a8991d760e831d89c746d2a | [
"MIT"
] | null | null | null | index_flask_qr/core/types23.py | lishnih/index_flask_qr | ac00346724d785d23a8991d760e831d89c746d2a | [
"MIT"
] | null | null | null | index_flask_qr/core/types23.py | lishnih/index_flask_qr | ac00346724d785d23a8991d760e831d89c746d2a | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# coding=utf-8
# Stan 2018-08-04
import sys
if sys.version_info >= (3,):
class aStr():
def __str__(self):
return self.__unicode__()
def cmp(a, b):
return (a > b) - (a < b)
# range = range
def b(s):
return s.encode('utf-8')
def u(s):
... | 20.779661 | 67 | 0.584013 |
import sys
if sys.version_info >= (3,):
class aStr():
def __str__(self):
return self.__unicode__()
def cmp(a, b):
return (a > b) - (a < b)
def b(s):
return s.encode('utf-8')
def u(s):
return s.decode('utf-8')
unicode = str
string_types =... | true | true |
f7041d686ea10e1bb192185c43073045a408c440 | 552 | py | Python | sum_even.py | Mr-Umidjon/even_and_odd_numbers | 2ad28c671db64d474afaffc444a1e807a7b82be7 | [
"MIT"
] | null | null | null | sum_even.py | Mr-Umidjon/even_and_odd_numbers | 2ad28c671db64d474afaffc444a1e807a7b82be7 | [
"MIT"
] | null | null | null | sum_even.py | Mr-Umidjon/even_and_odd_numbers | 2ad28c671db64d474afaffc444a1e807a7b82be7 | [
"MIT"
] | null | null | null | # A four-digit integer is given. Find the sum of even digits in it.
# Create a variable "var_int" and assign it a four-digit integer value.
# Create a variable "sum_even" and assign it 0.
# Find the sum of the even digits in the variable "var_int".
var_int = 1184
sum_even = 0
x1 = var_int % 10
var_int //= 10
sum_ev... | 20.444444 | 71 | 0.641304 |
var_int = 1184
sum_even = 0
x1 = var_int % 10
var_int //= 10
sum_even += (x1 + 1) % 2 * x1
x2 = var_int % 10
var_int //= 10
sum_even += (x2 + 1) % 2 * x2
x3 = var_int % 10
var_int //= 10
sum_even += (x3 + 1) % 2 * x3
x4 = var_int % 10
var_int //= 10
sum_even += (x4 + 1) % 2 * x4
print(sum_even) | true | true |
f7041dd4ace8385d6825cd0952034069e9abc390 | 5,354 | py | Python | permafrost/forms.py | renderbox/django-permafrost | a3858d248e4ee2abac55e3663c2da68b8a52cea6 | [
"MIT"
] | 7 | 2020-06-01T21:00:45.000Z | 2021-11-14T18:20:04.000Z | permafrost/forms.py | renderbox/django-permafrost | a3858d248e4ee2abac55e3663c2da68b8a52cea6 | [
"MIT"
] | 11 | 2020-11-20T21:35:41.000Z | 2022-02-01T16:49:03.000Z | permafrost/forms.py | renderbox/django-permafrost | a3858d248e4ee2abac55e3663c2da68b8a52cea6 | [
"MIT"
] | 1 | 2020-11-20T21:26:00.000Z | 2020-11-20T21:26:00.000Z | # Permafrost Forms
from django.conf import settings
from django.contrib.auth.models import Permission
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.forms import ModelForm
from django.forms.fields import CharField, ChoiceField, BooleanField
from django.forms.... | 33.672956 | 111 | 0.621965 |
from django.conf import settings
from django.contrib.auth.models import Permission
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.forms import ModelForm
from django.forms.fields import CharField, ChoiceField, BooleanField
from django.forms.models import Mode... | true | true |
f7041e9f4cda9730adee3c84e52ce84f4085adad | 3,070 | py | Python | qlib/contrib/data/highfreq_processor.py | SunsetWolf/qlib | 89972f6c6f9fa629b4f74093d4ba1e93c9f7a5e5 | [
"MIT"
] | 1 | 2021-12-14T13:48:38.000Z | 2021-12-14T13:48:38.000Z | qlib/contrib/data/highfreq_processor.py | SunsetWolf/qlib | 89972f6c6f9fa629b4f74093d4ba1e93c9f7a5e5 | [
"MIT"
] | null | null | null | qlib/contrib/data/highfreq_processor.py | SunsetWolf/qlib | 89972f6c6f9fa629b4f74093d4ba1e93c9f7a5e5 | [
"MIT"
] | null | null | null | import os
import numpy as np
import pandas as pd
from qlib.data.dataset.processor import Processor
from qlib.data.dataset.utils import fetch_df_by_index
from typing import Dict
class HighFreqTrans(Processor):
def __init__(self, dtype: str = "bool"):
self.dtype = dtype
def fit(self, df_features):
... | 37.439024 | 114 | 0.625081 | import os
import numpy as np
import pandas as pd
from qlib.data.dataset.processor import Processor
from qlib.data.dataset.utils import fetch_df_by_index
from typing import Dict
class HighFreqTrans(Processor):
def __init__(self, dtype: str = "bool"):
self.dtype = dtype
def fit(self, df_features):
... | true | true |
f7041fa17dca2b34640f4e235828199807afd246 | 1,487 | py | Python | network/cnn.py | hgKwak/SeriesSleepNet- | 1e90c3a0ed6244c2b876979194d7cd94056f5c8a | [
"MIT"
] | null | null | null | network/cnn.py | hgKwak/SeriesSleepNet- | 1e90c3a0ed6244c2b876979194d7cd94056f5c8a | [
"MIT"
] | null | null | null | network/cnn.py | hgKwak/SeriesSleepNet- | 1e90c3a0ed6244c2b876979194d7cd94056f5c8a | [
"MIT"
] | null | null | null | import torch
import torch.nn as nn
use_cuda = torch.cuda.is_available()
class CNNClassifier(nn.Module):
def __init__(self, channel, SHHS=False):
super(CNNClassifier, self).__init__()
conv1 = nn.Conv2d(1, 10, (1, 200))
pool1 = nn.MaxPool2d((1, 2))
if channel == 1:
conv2 =... | 33.044444 | 126 | 0.511096 | import torch
import torch.nn as nn
use_cuda = torch.cuda.is_available()
class CNNClassifier(nn.Module):
def __init__(self, channel, SHHS=False):
super(CNNClassifier, self).__init__()
conv1 = nn.Conv2d(1, 10, (1, 200))
pool1 = nn.MaxPool2d((1, 2))
if channel == 1:
conv2 =... | true | true |
f7042094ef12f628d0134a2a1e1460a0150617e1 | 1,017 | py | Python | lessons/functions.py | Friction-Log/learning_python_frictionlog | 6850c8873517254650c456ce78dfc5afd542fa4b | [
"MIT"
] | null | null | null | lessons/functions.py | Friction-Log/learning_python_frictionlog | 6850c8873517254650c456ce78dfc5afd542fa4b | [
"MIT"
] | null | null | null | lessons/functions.py | Friction-Log/learning_python_frictionlog | 6850c8873517254650c456ce78dfc5afd542fa4b | [
"MIT"
] | null | null | null | from math import sqrt
# function with int parameter
def my_function(a: str):
print(a)
my_function(3)
# function with type annotation
def my_function2(a: str) -> str:
return a
print(my_function2(3))
# import sqrt from math and use it
print(sqrt(9.4323))
# import alias from math
# from math import sqrt as square_... | 17.237288 | 38 | 0.687316 | from math import sqrt
def my_function(a: str):
print(a)
my_function(3)
def my_function2(a: str) -> str:
return a
print(my_function2(3))
print(sqrt(9.4323))
def my_function3(a: list):
for i in a:
print(i)
my_function3([1, 2, 3, 4, 5])
def my_function4(a: dict):
for key, value in a.items():
print(... | true | true |
f704217e9f7c9de573130b7171c75317e1a0a859 | 29,216 | py | Python | cv_utils/core.py | WildflowerSchools/wf-cv-utils | 647a2a46e3d6e6e14a1f813d17064cb33a3ced92 | [
"MIT"
] | null | null | null | cv_utils/core.py | WildflowerSchools/wf-cv-utils | 647a2a46e3d6e6e14a1f813d17064cb33a3ced92 | [
"MIT"
] | 4 | 2020-01-10T01:28:39.000Z | 2022-01-20T03:31:11.000Z | cv_utils/core.py | WildflowerSchools/wf-cv-utils | 647a2a46e3d6e6e14a1f813d17064cb33a3ced92 | [
"MIT"
] | 2 | 2019-12-06T19:46:01.000Z | 2019-12-11T22:37:43.000Z | import cv_datetime_utils
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize
import json
import os
def compose_transformations(
rotation_vector_1,
translation_vector_1,
rotation_vector_2,
translation_vector_2):
rotation_vector_1 = np.asarray(rot... | 37.217834 | 127 | 0.70013 | import cv_datetime_utils
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize
import json
import os
def compose_transformations(
rotation_vector_1,
translation_vector_1,
rotation_vector_2,
translation_vector_2):
rotation_vector_1 = np.asarray(rot... | true | true |
f70422428d41dc6563266192de2998e6f21fc6af | 4,188 | py | Python | plugins/esni/client.py | tgragnato/geneva | 2fc5b2f2f4766278902cff25af50b753d1d26a76 | [
"BSD-3-Clause"
] | 1,182 | 2019-11-15T02:56:47.000Z | 2022-03-30T16:09:04.000Z | plugins/esni/client.py | Nekotekina/geneva | 3eb6b7342f9afd7add1f4aba9e2aadf0b9a5f196 | [
"BSD-3-Clause"
] | 21 | 2019-11-15T15:08:02.000Z | 2022-01-03T16:22:45.000Z | plugins/esni/client.py | Nekotekina/geneva | 3eb6b7342f9afd7add1f4aba9e2aadf0b9a5f196 | [
"BSD-3-Clause"
] | 102 | 2019-11-15T15:01:07.000Z | 2022-03-30T13:52:47.000Z | """
Client
Run by the evaluator, sends a TLS Client Hello with the ESNI extension, followed by two test packets.
"""
import argparse
import binascii as bi
import os
import socket
import time
socket.setdefaulttimeout(1)
from plugins.plugin_client import ClientPlugin
class ESNIClient(ClientPlugin):
"""
Defi... | 51.073171 | 1,911 | 0.773878 |
import argparse
import binascii as bi
import os
import socket
import time
socket.setdefaulttimeout(1)
from plugins.plugin_client import ClientPlugin
class ESNIClient(ClientPlugin):
name = "esni"
def __init__(self, args):
ClientPlugin.__init__(self)
self.args = args
@staticmethod
d... | true | true |
f7042265d6e1253b3102acc3edcb9d1e660f92e1 | 3,860 | py | Python | ichnaea/scripts/dump.py | crankycoder/ichnaea | fb54000e92c605843b7a41521e36fd648c11ae94 | [
"Apache-2.0"
] | 1 | 2019-05-12T05:51:19.000Z | 2019-05-12T05:51:19.000Z | ichnaea/scripts/dump.py | crankycoder/ichnaea | fb54000e92c605843b7a41521e36fd648c11ae94 | [
"Apache-2.0"
] | null | null | null | ichnaea/scripts/dump.py | crankycoder/ichnaea | fb54000e92c605843b7a41521e36fd648c11ae94 | [
"Apache-2.0"
] | null | null | null | """
Dump/export our own data to a local file.
Script is installed as `location_dump`.
"""
import argparse
import os
import os.path
import sys
from sqlalchemy import text
from ichnaea.db import (
configure_db,
db_worker_session,
)
from ichnaea.geocalc import bbox
from ichnaea.log import (
configure_loggi... | 29.922481 | 76 | 0.589119 |
import argparse
import os
import os.path
import sys
from sqlalchemy import text
from ichnaea.db import (
configure_db,
db_worker_session,
)
from ichnaea.geocalc import bbox
from ichnaea.log import (
configure_logging,
LOGGER,
)
from ichnaea.models import (
BlueShard,
CellShard,
WifiShard,... | true | true |
f704245cfebd32dde87c35a40024697c586c21ce | 430 | py | Python | pi/python_scripts/read_arduino.py | jonathantobi/starcore-hackomation-2017 | 585cca88c60b33e87b217c02c5b86aafe658321f | [
"MIT"
] | null | null | null | pi/python_scripts/read_arduino.py | jonathantobi/starcore-hackomation-2017 | 585cca88c60b33e87b217c02c5b86aafe658321f | [
"MIT"
] | null | null | null | pi/python_scripts/read_arduino.py | jonathantobi/starcore-hackomation-2017 | 585cca88c60b33e87b217c02c5b86aafe658321f | [
"MIT"
] | null | null | null | #!/usr/bin/python
import serial
import time
ser = serial.Serial(
port = '/dev/ttyACM1',
baudrate = 9600,
parity = serial.PARITY_NONE,
stopbits = serial.STOPBITS_ONE,
bytesize = serial.EIGHTBITS
)
while 1:
ser.flush()
line = ser.readline().decode().strip()
gas... | 17.916667 | 42 | 0.574419 |
import serial
import time
ser = serial.Serial(
port = '/dev/ttyACM1',
baudrate = 9600,
parity = serial.PARITY_NONE,
stopbits = serial.STOPBITS_ONE,
bytesize = serial.EIGHTBITS
)
while 1:
ser.flush()
line = ser.readline().decode().strip()
gas, fire = line.spl... | true | true |
f70424690ab9ff0152bd6626bc23b9b94c8fdc03 | 12,043 | py | Python | sparqlkernel/drawgraph.py | alexisdimi/sparql-kernel | 7acd28810d48ef127a716f00bd76f67d59d7ba69 | [
"BSD-3-Clause"
] | 93 | 2016-09-13T21:50:30.000Z | 2022-02-13T09:46:40.000Z | sparqlkernel/drawgraph.py | alexisdimi/sparql-kernel | 7acd28810d48ef127a716f00bd76f67d59d7ba69 | [
"BSD-3-Clause"
] | 33 | 2017-03-30T10:12:32.000Z | 2021-08-12T12:23:36.000Z | sparqlkernel/drawgraph.py | alexisdimi/sparql-kernel | 7acd28810d48ef127a716f00bd76f67d59d7ba69 | [
"BSD-3-Clause"
] | 18 | 2017-02-12T17:09:08.000Z | 2022-02-02T08:32:48.000Z | """
Convert an RDF graph into an image for displaying in the notebook, via GraphViz
It has two parts:
- conversion from rdf into dot language. Code based in rdflib.utils.rdf2dot
- rendering of the dot graph into an image. Code based on
ipython-hierarchymagic, which in turn bases it from Sphinx
See https://... | 37.990536 | 167 | 0.663456 |
import errno
import base64
import re
from io import StringIO
import rdflib
from .utils import escape
import logging
LOG = logging.getLogger(__name__)
LABEL_PROPERTIES = [
rdflib.RDFS.label,
rdflib.URIRef('http://schema.org/name'),
rdflib.URIRef('http://www.w3.org/2000/01/rdf-schema#label'),
rdfli... | true | true |
f704250e86256c23937f52f4509e295bb75c89c6 | 15,560 | py | Python | genesis/genesis.py | nneveu/lume-genesis | 2df9a246dcc7752c60f3439c651e35aaf81006d3 | [
"Apache-2.0"
] | null | null | null | genesis/genesis.py | nneveu/lume-genesis | 2df9a246dcc7752c60f3439c651e35aaf81006d3 | [
"Apache-2.0"
] | null | null | null | genesis/genesis.py | nneveu/lume-genesis | 2df9a246dcc7752c60f3439c651e35aaf81006d3 | [
"Apache-2.0"
] | null | null | null | """
LUME-Genesis primary class
"""
from genesis import archive, lattice, parsers, tools, writers
import h5py
import tempfile
from time import time
import shutil
import os
def find_genesis2_executable(genesis_exe=None, verbose=False):
"""
Searches for the genesis2 executable.
"""
if ge... | 29.303202 | 131 | 0.507326 | from genesis import archive, lattice, parsers, tools, writers
import h5py
import tempfile
from time import time
import shutil
import os
def find_genesis2_executable(genesis_exe=None, verbose=False):
if genesis_exe:
exe = tools.full_path(genesis_exe)
if os.path.exists(exe):
... | true | true |
f70426e7636a41481d4afd382f74991b955ea9c2 | 527 | py | Python | tools/telemetry/telemetry/core/backends/chrome/websocket.py | nagineni/chromium-crosswalk | 5725642f1c67d0f97e8613ec1c3e8107ab53fdf8 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 2 | 2015-03-04T02:36:53.000Z | 2016-06-25T11:22:17.000Z | tools/telemetry/telemetry/core/backends/chrome/websocket.py | j4ckfrost/android_external_chromium_org | a1a3dad8b08d1fcf6b6b36c267158ed63217c780 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | tools/telemetry/telemetry/core/backends/chrome/websocket.py | j4ckfrost/android_external_chromium_org | a1a3dad8b08d1fcf6b6b36c267158ed63217c780 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 4 | 2015-02-09T08:49:30.000Z | 2017-08-26T02:03:34.000Z | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import absolute_import
from telemetry.core import util
util.AddDirToPythonPath(
util.GetTelemetryDir(), 'third_party', 'websocket-client... | 40.538462 | 72 | 0.806452 |
from __future__ import absolute_import
from telemetry.core import util
util.AddDirToPythonPath(
util.GetTelemetryDir(), 'third_party', 'websocket-client')
from websocket import create_connection
from websocket import WebSocketException
from websocket import WebSocketTimeoutException
| true | true |
f704278c8ede91d34c07a8b24640a36ec58b289c | 1,227 | py | Python | tests/test_visitors/test_ast/test_keywords/test_base_exception.py | bekemaydin/wemake-python-styleguide | fad6a1d2b66012d623fe0e0bba9b5561622deeb0 | [
"MIT"
] | null | null | null | tests/test_visitors/test_ast/test_keywords/test_base_exception.py | bekemaydin/wemake-python-styleguide | fad6a1d2b66012d623fe0e0bba9b5561622deeb0 | [
"MIT"
] | null | null | null | tests/test_visitors/test_ast/test_keywords/test_base_exception.py | bekemaydin/wemake-python-styleguide | fad6a1d2b66012d623fe0e0bba9b5561622deeb0 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
BaseExceptionViolation,
)
from wemake_python_styleguide.visitors.ast.keywords import (
WrongExceptionTypeVisitor,
)
use_base_exception = """
try:
execute()
except BaseException:
raise
"""
use_excep... | 19.47619 | 69 | 0.711491 |
import pytest
from wemake_python_styleguide.violations.best_practices import (
BaseExceptionViolation,
)
from wemake_python_styleguide.visitors.ast.keywords import (
WrongExceptionTypeVisitor,
)
use_base_exception = """
try:
execute()
except BaseException:
raise
"""
use_except_exception = """
try:
... | true | true |
f704280d77be35f7fcce108be106fa90c46c3518 | 26 | py | Python | gnutools/utils/__init__.py | JeanMaximilienCadic/gnutools-python | c247788c988f4aa14904f63df71743b75adaa16d | [
"MIT"
] | null | null | null | gnutools/utils/__init__.py | JeanMaximilienCadic/gnutools-python | c247788c988f4aa14904f63df71743b75adaa16d | [
"MIT"
] | null | null | null | gnutools/utils/__init__.py | JeanMaximilienCadic/gnutools-python | c247788c988f4aa14904f63df71743b75adaa16d | [
"MIT"
] | null | null | null | from .functional import *
| 13 | 25 | 0.769231 | from .functional import *
| true | true |
f70428bf036f48285ac70f7871aab75dca937d2d | 1,035 | py | Python | pomfrlFOR/examples/battle_model/algo/__init__.py | Sriram94/pomfrl | c6728f8ef6bafb0cb9e0c5007734ccb51ca341af | [
"MIT"
] | 7 | 2021-03-24T06:14:57.000Z | 2022-02-09T15:27:26.000Z | pomfrlFOR/examples/battle_model/algo/__init__.py | Sriram94/pomfrl | c6728f8ef6bafb0cb9e0c5007734ccb51ca341af | [
"MIT"
] | 1 | 2021-11-24T16:55:08.000Z | 2021-11-26T16:14:38.000Z | pomfrlFOR/examples/battle_model/algo/__init__.py | Sriram94/pomfrl | c6728f8ef6bafb0cb9e0c5007734ccb51ca341af | [
"MIT"
] | null | null | null | from . import ac
from . import q_learning
from . import rnnq_learning
AC = ac.ActorCritic
MFAC = ac.MFAC
IL = q_learning.DQN
MFQ = q_learning.MFQ
POMFQ = q_learning.POMFQ
rnnIL = rnnq_learning.DQN
rnnMFQ = rnnq_learning.MFQ
def spawn_ai(algo_name, sess, env, handle, human_name, max_steps):
if algo_name == 'mfq':
... | 35.689655 | 83 | 0.677295 | from . import ac
from . import q_learning
from . import rnnq_learning
AC = ac.ActorCritic
MFAC = ac.MFAC
IL = q_learning.DQN
MFQ = q_learning.MFQ
POMFQ = q_learning.POMFQ
rnnIL = rnnq_learning.DQN
rnnMFQ = rnnq_learning.MFQ
def spawn_ai(algo_name, sess, env, handle, human_name, max_steps):
if algo_name == 'mfq':
... | true | true |
f7042a28b38dfb50a0e690fac89b4181327b724e | 4,329 | py | Python | src/main.py | RIZY101/ctf-nc-framework | faf088169f58514f79c0088568019b3db5a9307b | [
"MIT"
] | null | null | null | src/main.py | RIZY101/ctf-nc-framework | faf088169f58514f79c0088568019b3db5a9307b | [
"MIT"
] | null | null | null | src/main.py | RIZY101/ctf-nc-framework | faf088169f58514f79c0088568019b3db5a9307b | [
"MIT"
] | null | null | null | from lib.types import IStdin, IStdout
def main(stdin: IStdin, stdout: IStdout):
stdout.write('*** You are a student at PWN_University and you are all set to graduate at the end of the semester. Unfortunately the night before graduation you learned you were going to fail your last class and now you’re afraid the sc... | 77.303571 | 513 | 0.639871 | from lib.types import IStdin, IStdout
def main(stdin: IStdin, stdout: IStdout):
stdout.write('*** You are a student at PWN_University and you are all set to graduate at the end of the semester. Unfortunately the night before graduation you learned you were going to fail your last class and now you’re afraid the sc... | true | true |
f7042a5860ad67696f9ad5fbfa41b846180239c3 | 18,293 | py | Python | homeassistant/components/isy994/const.py | Wohlraj/core | feed095e5bb4be0d31991530378fe48fcafbbf9c | [
"Apache-2.0"
] | 2 | 2021-09-13T21:44:02.000Z | 2021-12-17T21:20:51.000Z | homeassistant/components/isy994/const.py | Wohlraj/core | feed095e5bb4be0d31991530378fe48fcafbbf9c | [
"Apache-2.0"
] | 5 | 2021-02-08T20:51:16.000Z | 2022-03-12T00:43:18.000Z | homeassistant/components/isy994/const.py | klauern/home-assistant-core | c18ba6aec0627e6afb6442c678edb5ff2bb17db6 | [
"Apache-2.0"
] | 2 | 2020-11-04T07:40:01.000Z | 2021-09-13T21:44:03.000Z | """Constants for the ISY994 Platform."""
import logging
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_COLD,
DEVICE_CLASS_DOOR,
DEVICE_CLASS_GAS,
DEVICE_CLASS_HEAT,
DEVICE_CLASS_MOISTURE,
DEVICE_CLASS_MOTION,
DEVICE_CLASS_OPENING,
DEVICE_CLAS... | 28.229938 | 87 | 0.583939 | import logging
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_COLD,
DEVICE_CLASS_DOOR,
DEVICE_CLASS_GAS,
DEVICE_CLASS_HEAT,
DEVICE_CLASS_MOISTURE,
DEVICE_CLASS_MOTION,
DEVICE_CLASS_OPENING,
DEVICE_CLASS_PROBLEM,
DEVICE_CLASS_SAFETY,
D... | true | true |
f7042aae1c5991d42b4fceb79304a0ff5d0e7579 | 398 | py | Python | scfmsp/controlflowanalysis/instructions/InstructionJz.py | sepidehpouyan/SCF-MSP430 | 1d7565bf38d9f42e775031d4ea8515ff99bef778 | [
"MIT"
] | 1 | 2020-07-03T21:26:52.000Z | 2020-07-03T21:26:52.000Z | scfmsp/controlflowanalysis/instructions/InstructionJz.py | sepidehpouyan/SCF-MSP430 | 1d7565bf38d9f42e775031d4ea8515ff99bef778 | [
"MIT"
] | null | null | null | scfmsp/controlflowanalysis/instructions/InstructionJz.py | sepidehpouyan/SCF-MSP430 | 1d7565bf38d9f42e775031d4ea8515ff99bef778 | [
"MIT"
] | null | null | null | from scfmsp.controlflowanalysis.StatusRegister import StatusRegister
from scfmsp.controlflowanalysis.instructions.AbstractInstructionBranching import AbstractInstructionBranching
class InstructionJz(AbstractInstructionBranching):
name = 'jz'
def get_execution_time(self):
return 2
def get_branchi... | 30.615385 | 109 | 0.806533 | from scfmsp.controlflowanalysis.StatusRegister import StatusRegister
from scfmsp.controlflowanalysis.instructions.AbstractInstructionBranching import AbstractInstructionBranching
class InstructionJz(AbstractInstructionBranching):
name = 'jz'
def get_execution_time(self):
return 2
def get_branchi... | true | true |
f7042b01cfb71a99764931d3f29e9d6ab437938d | 2,363 | py | Python | data_preprocessing/tweet_api.py | teomores/kafka-twitter | 778539c8f2d705c3fc75dfc8e00f9b81750b6d05 | [
"Apache-2.0"
] | 4 | 2019-09-22T22:03:41.000Z | 2021-03-17T22:36:25.000Z | data_preprocessing/tweet_api.py | tmscarla/kafka-twitter | 29d7c48fd1d225e33ec06be9bfed1826fa4d6b60 | [
"Apache-2.0"
] | 8 | 2020-03-24T17:31:21.000Z | 2022-03-11T23:59:52.000Z | data_preprocessing/tweet_api.py | tmscarla/kafka-twitter | 29d7c48fd1d225e33ec06be9bfed1826fa4d6b60 | [
"Apache-2.0"
] | null | null | null | # Import the Twython class
from twython import Twython
import json
import os
import pandas as pd
from tqdm import tqdm
try:
os.remove('twitter_dataset.csv')
except OSError:
pass
def main():
old_df = pd.read_csv('data/twitter_dataset_2.csv', lineterminator='\n')
#first load the dictonary with the top u... | 32.819444 | 122 | 0.61532 |
from twython import Twython
import json
import os
import pandas as pd
from tqdm import tqdm
try:
os.remove('twitter_dataset.csv')
except OSError:
pass
def main():
old_df = pd.read_csv('data/twitter_dataset_2.csv', lineterminator='\n')
with open('improved_dict.txt') as d:
word_list = d.re... | true | true |
f7042c05b0bdadade8cd2ea76a032a0075ad7e9d | 4,867 | py | Python | pygmt/src/grdfilter.py | GenericMappingTools/gmt-python | c9c44854f0968dead5c8c8b5eaa0cb0b04907aa1 | [
"BSD-3-Clause"
] | 168 | 2017-03-27T01:13:57.000Z | 2019-01-19T02:37:36.000Z | pygmt/src/grdfilter.py | GenericMappingTools/gmt-python | c9c44854f0968dead5c8c8b5eaa0cb0b04907aa1 | [
"BSD-3-Clause"
] | 167 | 2017-07-01T02:26:19.000Z | 2019-01-22T18:39:13.000Z | pygmt/src/grdfilter.py | GenericMappingTools/gmt-python | c9c44854f0968dead5c8c8b5eaa0cb0b04907aa1 | [
"BSD-3-Clause"
] | 51 | 2017-06-08T17:39:09.000Z | 2019-01-16T17:33:11.000Z | """
grdfilter - Filter a grid in the space (or time) domain.
"""
from pygmt.clib import Session
from pygmt.helpers import (
GMTTempFile,
build_arg_string,
fmt_docstring,
kwargs_to_strings,
use_alias,
)
from pygmt.io import load_dataarray
@fmt_docstring
@use_alias(
D="distance",
F="filter"... | 31.810458 | 85 | 0.614547 |
from pygmt.clib import Session
from pygmt.helpers import (
GMTTempFile,
build_arg_string,
fmt_docstring,
kwargs_to_strings,
use_alias,
)
from pygmt.io import load_dataarray
@fmt_docstring
@use_alias(
D="distance",
F="filter",
G="outgrid",
I="spacing",
N="nans",
R="region",... | true | true |
f7042c2ecf2c1579ad078c46d2e6471a39efed06 | 4,251 | py | Python | shingetsu/rss.py | acemomiage/saku | 66ab704106d368f7c916f9ba71b28fe9bef62c48 | [
"BSD-2-Clause"
] | 78 | 2015-01-09T10:49:10.000Z | 2022-02-16T03:06:28.000Z | shingetsu/rss.py | acemomiage/saku | 66ab704106d368f7c916f9ba71b28fe9bef62c48 | [
"BSD-2-Clause"
] | 5 | 2015-01-11T16:24:33.000Z | 2019-02-18T15:02:32.000Z | shingetsu/rss.py | acemomiage/saku | 66ab704106d368f7c916f9ba71b28fe9bef62c48 | [
"BSD-2-Clause"
] | 24 | 2015-01-07T08:29:47.000Z | 2022-03-23T07:22:20.000Z | """Data structure of RSS and useful functions.
"""
#
# Copyright (c) 2005-2020 shinGETsu Project.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain ... | 30.148936 | 76 | 0.567866 |
import html
import re
import cgi
from .template import Template
class Item:
title = ""
link = ""
description = ""
date = 0
def __init__(self, link="", title="", date=0, creator='', subject=None,
description="", content=""):
del_eos... | true | true |
f7042cc11b1d56e506098d13c8d748a89e62133e | 10,272 | py | Python | GPy/kern/src/static.py | RaulAstudillo/bocf | cd84eab2d1b4ea5a4bdeeb452df92296afbafb87 | [
"BSD-3-Clause"
] | 9 | 2019-06-16T01:18:52.000Z | 2021-11-03T15:43:55.000Z | GPy/kern/src/static.py | RaulAstudillo/bocf | cd84eab2d1b4ea5a4bdeeb452df92296afbafb87 | [
"BSD-3-Clause"
] | 3 | 2020-09-09T06:12:51.000Z | 2021-06-01T23:46:18.000Z | GPy/kern/src/static.py | RaulAstudillo/bocf | cd84eab2d1b4ea5a4bdeeb452df92296afbafb87 | [
"BSD-3-Clause"
] | 5 | 2019-07-07T13:17:44.000Z | 2020-09-09T06:06:17.000Z | # Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
from .kern import Kern
import numpy as np
from ...core.parameterization import Param
from paramz.transformations import Logexp
from paramz.caching import Cache_this
class Static(Kern):
def __init__(se... | 38.328358 | 163 | 0.639408 |
from .kern import Kern
import numpy as np
from ...core.parameterization import Param
from paramz.transformations import Logexp
from paramz.caching import Cache_this
class Static(Kern):
def __init__(self, input_dim, variance, active_dims, name):
super(Static, self).__init__(input_dim, active_dims, name)... | true | true |
f7042de1f100aeb375f867dcd8fb140922a67444 | 640 | py | Python | setup.py | thanakritju/python-slack-events-sdk | 67bdb55e07fd5c76845bad37ea88e506d42f1b2c | [
"MIT"
] | null | null | null | setup.py | thanakritju/python-slack-events-sdk | 67bdb55e07fd5c76845bad37ea88e506d42f1b2c | [
"MIT"
] | null | null | null | setup.py | thanakritju/python-slack-events-sdk | 67bdb55e07fd5c76845bad37ea88e506d42f1b2c | [
"MIT"
] | null | null | null | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="slacksdk",
version="0.0.1a",
author="Thanakrit Juthamongkhon",
author_email="thanakrit.ju.work@gmail.com",
description="A minimal slack sdk",
long_description=long_description,
lon... | 30.47619 | 65 | 0.675 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="slacksdk",
version="0.0.1a",
author="Thanakrit Juthamongkhon",
author_email="thanakrit.ju.work@gmail.com",
description="A minimal slack sdk",
long_description=long_description,
lon... | true | true |
f7042e073beb294e8fce962829b920896e385e2e | 5,559 | py | Python | inside/pipelines/clevr.py | jacenkow/inside | 8b277e2744233a23eb8f55a29417135729fc531d | [
"Apache-2.0"
] | 6 | 2020-08-26T13:15:15.000Z | 2021-08-02T22:07:49.000Z | inside/pipelines/clevr.py | SLEEP-CO/inside | 6f860420644b50b78981158a59ceed8cdbd209bf | [
"Apache-2.0"
] | 13 | 2020-09-25T22:26:45.000Z | 2022-03-12T00:47:04.000Z | inside/pipelines/clevr.py | SLEEP-CO/inside | 6f860420644b50b78981158a59ceed8cdbd209bf | [
"Apache-2.0"
] | 2 | 2020-10-07T17:11:57.000Z | 2021-05-22T13:20:14.000Z | # -*- coding: utf-8 -*-
#
# Copyright (C) 2020 Grzegorz Jacenków.
#
# 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... | 34.314815 | 79 | 0.572585 |
import csv
import os
import tensorflow as tf
from tensorflow.keras.metrics import Mean
from inside import config
from inside.callbacks import setup_callbacks
from inside.constructor import setup_comet_ml, setup_model
from inside.loaders import CLEVR
from inside.metrics import DiceScore
def _write_res... | true | true |
f7042e33a6e4a8e11c00eba052a8af8e91c9a9a7 | 4,115 | py | Python | dataset/generate_tip4p_data.py | BaratiLab/GAMD | 7de91526f1c8c06ea005920e6a55c3cf031c26b2 | [
"MIT"
] | null | null | null | dataset/generate_tip4p_data.py | BaratiLab/GAMD | 7de91526f1c8c06ea005920e6a55c3cf031c26b2 | [
"MIT"
] | null | null | null | dataset/generate_tip4p_data.py | BaratiLab/GAMD | 7de91526f1c8c06ea005920e6a55c3cf031c26b2 | [
"MIT"
] | 1 | 2022-03-17T19:39:18.000Z | 2022-03-17T19:39:18.000Z | from openmmtools import testsystems
from simtk.openmm.app import *
import simtk.unit as unit
import logging
import numpy as np
from openmmtools.constants import kB
from openmmtools import respa, utils
logger = logging.getLogger(__name__)
# Energy unit used by OpenMM unit system
from openmmtools import states, inte... | 36.741071 | 121 | 0.600243 | from openmmtools import testsystems
from simtk.openmm.app import *
import simtk.unit as unit
import logging
import numpy as np
from openmmtools.constants import kB
from openmmtools import respa, utils
logger = logging.getLogger(__name__)
from openmmtools import states, integrators
import time
import numpy as np
i... | true | true |
f7042e390a07e1c0d3c7ad4c593ca6540931ac90 | 966 | py | Python | hashing.py | bernardosulzbach/scripts | 9c91d9688873d5a41fdc4ff54688f5b042866867 | [
"BSD-2-Clause"
] | null | null | null | hashing.py | bernardosulzbach/scripts | 9c91d9688873d5a41fdc4ff54688f5b042866867 | [
"BSD-2-Clause"
] | 5 | 2015-12-29T14:35:42.000Z | 2016-02-06T04:55:48.000Z | hashing.py | mafagafogigante/scripts | 9c91d9688873d5a41fdc4ff54688f5b042866867 | [
"BSD-2-Clause"
] | null | null | null | import os
import hashlib
def _update_sha256(filename, sha256):
"""
Updates a SHA-256 algorithm with the filename and the contents of a file.
"""
block_size = 64 * 1024 # 64 KB
with open(filename, 'rb') as input_file:
while True:
data = input_file.read(block_size)
i... | 28.411765 | 119 | 0.643892 | import os
import hashlib
def _update_sha256(filename, sha256):
block_size = 64 * 1024
with open(filename, 'rb') as input_file:
while True:
data = input_file.read(block_size)
if not data:
break
sha256.update(data)
sha256.update(filename.encode("... | true | true |
f7042e6c3b8b3bbe394ec0ff65053648fc05d117 | 1,139 | py | Python | core/functions/__init__.py | annapoulakos/advent-of-code | 95bf7eb282045194af46f482c3ab847c91f62c44 | [
"MIT"
] | 3 | 2020-12-03T19:56:50.000Z | 2021-11-19T00:20:04.000Z | core/functions/__init__.py | annapoulakos/advent-of-code | 95bf7eb282045194af46f482c3ab847c91f62c44 | [
"MIT"
] | null | null | null | core/functions/__init__.py | annapoulakos/advent-of-code | 95bf7eb282045194af46f482c3ab847c91f62c44 | [
"MIT"
] | null | null | null | def destructure(obj, *params):
import operator
return operator.itemgetter(*params)(obj)
def greet(**kwargs):
year, day, puzzle = destructure(kwargs, 'year', 'day', 'puzzle')
print('Advent of Code')
print(f'-> {year}-{day}-{puzzle}')
print('--------------')
def load_data(filename):
with fil... | 27.119048 | 77 | 0.568042 | def destructure(obj, *params):
import operator
return operator.itemgetter(*params)(obj)
def greet(**kwargs):
year, day, puzzle = destructure(kwargs, 'year', 'day', 'puzzle')
print('Advent of Code')
print(f'-> {year}-{day}-{puzzle}')
print('--------------')
def load_data(filename):
with fil... | true | true |
f7042f27a52d9b6035ccb6bdd9f2e40115fbae3f | 3,170 | py | Python | stix/common/information_source.py | santosomar/python-stix | cf0ea6861d9fd4dec6003d948b6901cada954c4d | [
"BSD-3-Clause"
] | 4 | 2019-02-25T18:18:16.000Z | 2020-12-19T06:23:28.000Z | stix/common/information_source.py | santosomar/python-stix | cf0ea6861d9fd4dec6003d948b6901cada954c4d | [
"BSD-3-Clause"
] | null | null | null | stix/common/information_source.py | santosomar/python-stix | cf0ea6861d9fd4dec6003d948b6901cada954c4d | [
"BSD-3-Clause"
] | 1 | 2019-02-25T18:18:18.000Z | 2019-02-25T18:18:18.000Z | # Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
# external
from mixbox import fields
import cybox.common
from cybox.common.tools import ToolInformationList
# internal
import stix
import stix.bindings.stix_common as stix_common_binding
# relative
from .vocabs im... | 32.346939 | 128 | 0.712303 |
from mixbox import fields
import cybox.common
from cybox.common.tools import ToolInformationList
import stix
import stix.bindings.stix_common as stix_common_binding
from .vocabs import VocabField
from .references import References
from .identity import Identity, IdentityFactory
from .structured_text import Stru... | true | true |
f7042f70611897f37c769bc82c9c072a8a0174f4 | 16,025 | py | Python | django/utils/datastructures.py | graingert/django | 784d0c261c76535dc760bc8d76793d92f35c1513 | [
"BSD-3-Clause"
] | 1 | 2015-11-11T12:20:45.000Z | 2015-11-11T12:20:45.000Z | django/utils/datastructures.py | graingert/django | 784d0c261c76535dc760bc8d76793d92f35c1513 | [
"BSD-3-Clause"
] | null | null | null | django/utils/datastructures.py | graingert/django | 784d0c261c76535dc760bc8d76793d92f35c1513 | [
"BSD-3-Clause"
] | null | null | null | import copy
from types import GeneratorType
class MergeDict(object):
"""
A simple class for creating new "virtual" dictionaries that actually look
up values in more than one dictionary, passed in the constructor.
If a key appears in more than one of the given dictionaries, only the
first occurrenc... | 31.237817 | 131 | 0.566365 | import copy
from types import GeneratorType
class MergeDict(object):
def __init__(self, *dicts):
self.dicts = dicts
def __getitem__(self, key):
for dict_ in self.dicts:
try:
return dict_[key]
except KeyError:
pass
raise KeyError
... | true | true |
f7042fc40e681680f30a61dd7dd41d217592fd03 | 5,291 | py | Python | src/basic1.py | harika-24/Image-Processing-and-Machine-Learning-using-Parallel-Computing | b13b8f20551a9d5960b146713182b167e35d65e7 | [
"MIT"
] | null | null | null | src/basic1.py | harika-24/Image-Processing-and-Machine-Learning-using-Parallel-Computing | b13b8f20551a9d5960b146713182b167e35d65e7 | [
"MIT"
] | null | null | null | src/basic1.py | harika-24/Image-Processing-and-Machine-Learning-using-Parallel-Computing | b13b8f20551a9d5960b146713182b167e35d65e7 | [
"MIT"
] | null | null | null | import os
import sys
import dlib
import glob
import csv
import pickle as pp
from sklearn.neighbors import KNeighborsClassifier
import pandas as pd
from sklearn import preprocessing
# from sklearn.model_selection import train_test_split
import webbrowser
from timeit import Timer
from keras.preprocessing.image import img... | 31.682635 | 122 | 0.558307 | import os
import sys
import dlib
import glob
import csv
import pickle as pp
from sklearn.neighbors import KNeighborsClassifier
import pandas as pd
from sklearn import preprocessing
import webbrowser
from timeit import Timer
from keras.preprocessing.image import img_to_array
from keras.models import load_model
import n... | true | true |
f7042fdc0b2e66c421515786c31e873a156f7422 | 262 | py | Python | dyn2sel/dcs_techniques/desdd_selection.py | luccaportes/Scikit-DYN2SEL | 3e102f4fff5696277c57997fb811139c5e6f8b4d | [
"MIT"
] | 1 | 2021-08-21T21:21:29.000Z | 2021-08-21T21:21:29.000Z | dyn2sel/dcs_techniques/desdd_selection.py | luccaportes/Scikit-DYN2SEL | 3e102f4fff5696277c57997fb811139c5e6f8b4d | [
"MIT"
] | 10 | 2020-10-27T13:37:36.000Z | 2021-09-11T02:40:51.000Z | dyn2sel/dcs_techniques/desdd_selection.py | luccaportes/Scikit-DYN2SEL | 3e102f4fff5696277c57997fb811139c5e6f8b4d | [
"MIT"
] | 1 | 2021-11-24T07:20:42.000Z | 2021-11-24T07:20:42.000Z | from dyn2sel.dcs_techniques import DCSTechnique
import numpy as np
from scipy.stats import mode
class DESDDSel(DCSTechnique):
def predict(self, ensemble, instances, real_labels=None):
return ensemble[ensemble.get_max_accuracy()].predict(instances)
| 29.111111 | 71 | 0.790076 | from dyn2sel.dcs_techniques import DCSTechnique
import numpy as np
from scipy.stats import mode
class DESDDSel(DCSTechnique):
def predict(self, ensemble, instances, real_labels=None):
return ensemble[ensemble.get_max_accuracy()].predict(instances)
| true | true |
f7042fe61841ae00fa3573f79327e8f2bc2dcb99 | 1,421 | py | Python | tests/tests/test_vm_coexist.py | jurobystricky/tdx-tools | c4eedb04a784fdfff724453499045ea6e369a818 | [
"Apache-2.0"
] | 11 | 2021-12-21T01:32:59.000Z | 2022-03-30T14:37:45.000Z | tests/tests/test_vm_coexist.py | jurobystricky/tdx-tools | c4eedb04a784fdfff724453499045ea6e369a818 | [
"Apache-2.0"
] | 15 | 2022-01-12T00:40:59.000Z | 2022-03-31T17:03:42.000Z | tests/tests/test_vm_coexist.py | jurobystricky/tdx-tools | c4eedb04a784fdfff724453499045ea6e369a818 | [
"Apache-2.0"
] | 7 | 2021-12-20T11:45:46.000Z | 2022-03-15T06:22:52.000Z | """
This module provide the case to test the coexistance between TDX guest and non TD
guest. There are two types of non-TD guest:
1. Boot with legacy BIOS, it is default loader without pass "-loader" or "-bios"
option
2. Boot with OVMF UEFI BIOS, will boot with "-loader" => OVMFD.fd compiled from
the late... | 29 | 82 | 0.695285 |
import logging
import pytest
from pycloudstack.vmparam import VM_TYPE_LEGACY, VM_TYPE_EFI, VM_TYPE_TD
__author__ = 'cpio'
LOG = logging.getLogger(__name__)
pytestmark = [
pytest.mark.vm_image("latest-guest-image"),
pytest.mark.vm_kernel("latest-guest-kernel"),
]
def test_tdguest_with_leg... | true | true |
f70430b6d3a2a0dae8784dc1baf8f2c60b7a5d8d | 2,002 | py | Python | pre_commit_hooks/loaderon_hooks/tests/general_hooks/check_location_test.py | alvaroscelza/pre-commit-hooks | fc9a7a376dc733a1e3cc00b5ed35936bcb3c3b3b | [
"MIT"
] | null | null | null | pre_commit_hooks/loaderon_hooks/tests/general_hooks/check_location_test.py | alvaroscelza/pre-commit-hooks | fc9a7a376dc733a1e3cc00b5ed35936bcb3c3b3b | [
"MIT"
] | null | null | null | pre_commit_hooks/loaderon_hooks/tests/general_hooks/check_location_test.py | alvaroscelza/pre-commit-hooks | fc9a7a376dc733a1e3cc00b5ed35936bcb3c3b3b | [
"MIT"
] | null | null | null | import sys
import pytest
from pre_commit_hooks.loaderon_hooks.tests.util.test_helpers import perform_test_on_file_expecting_result
from pre_commit_hooks.loaderon_hooks.general_hooks.check_location import main
@pytest.fixture(autouse=True)
def clean_sys_argv():
sys.argv = []
# Each line is a directory that ... | 31.777778 | 132 | 0.758741 | import sys
import pytest
from pre_commit_hooks.loaderon_hooks.tests.util.test_helpers import perform_test_on_file_expecting_result
from pre_commit_hooks.loaderon_hooks.general_hooks.check_location import main
@pytest.fixture(autouse=True)
def clean_sys_argv():
sys.argv = []
sys.argv.append('--director... | true | true |
f704311c1696242df8f2316227f5b99a2b3d08b4 | 506 | py | Python | Week1/Lecture2/Fexes/l2f1.py | MorbidValkyria/MIT6.0001x | 3c80ffd50871387f560c2e820ad1fa05c61d9132 | [
"MIT"
] | null | null | null | Week1/Lecture2/Fexes/l2f1.py | MorbidValkyria/MIT6.0001x | 3c80ffd50871387f560c2e820ad1fa05c61d9132 | [
"MIT"
] | null | null | null | Week1/Lecture2/Fexes/l2f1.py | MorbidValkyria/MIT6.0001x | 3c80ffd50871387f560c2e820ad1fa05c61d9132 | [
"MIT"
] | null | null | null | """
1) "a" + "bc" -> abc
2) 3 * "bc" -> bcbcbc
3) "3" * "bc" -> error as we can't use the * operator on two strings
4) abcd"[2] -> c (Just takes the character at index 2 in the string. a has index 0 and b index 1)
5) "abcd"[0:2] -> ab (Returns the substring from index 0 all the way to index n -1 in this case b)
6)... | 31.625 | 98 | 0.626482 | true | true | |
f7043401959412943bac256ec0284c88028ab154 | 4,508 | py | Python | configs/restorers/basicvsr/basicvsr_vimeo90k_bd.py | wangna11BD/mmediting | 25410895914edc5938f526fc41b1776a36ac1b51 | [
"Apache-2.0"
] | 1 | 2021-04-20T02:24:02.000Z | 2021-04-20T02:24:02.000Z | configs/restorers/basicvsr/basicvsr_vimeo90k_bd.py | wangna11BD/mmediting | 25410895914edc5938f526fc41b1776a36ac1b51 | [
"Apache-2.0"
] | null | null | null | configs/restorers/basicvsr/basicvsr_vimeo90k_bd.py | wangna11BD/mmediting | 25410895914edc5938f526fc41b1776a36ac1b51 | [
"Apache-2.0"
] | null | null | null | exp_name = 'basicvsr_vimeo90k_bd'
# model settings
model = dict(
type='BasicVSR',
generator=dict(
type='BasicVSRNet',
mid_channels=64,
num_blocks=30,
spynet_pretrained='pretrained_models/spynet.pth'),
pixel_loss=dict(type='CharbonnierLoss', loss_weight=1.0, reduction='mean')... | 28.713376 | 79 | 0.618234 | exp_name = 'basicvsr_vimeo90k_bd'
model = dict(
type='BasicVSR',
generator=dict(
type='BasicVSRNet',
mid_channels=64,
num_blocks=30,
spynet_pretrained='pretrained_models/spynet.pth'),
pixel_loss=dict(type='CharbonnierLoss', loss_weight=1.0, reduction='mean'))
train_cfg = d... | true | true |
f704346d161ef25a72528a244f15f8a8a9895a9f | 1,531 | py | Python | setup.py | dbradf/evgflip | 5e7408d817ee1cb7823dd299b50d5959126756d4 | [
"Apache-2.0"
] | null | null | null | setup.py | dbradf/evgflip | 5e7408d817ee1cb7823dd299b50d5959126756d4 | [
"Apache-2.0"
] | null | null | null | setup.py | dbradf/evgflip | 5e7408d817ee1cb7823dd299b50d5959126756d4 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from glob import glob
from os.path import basename
from os.path import splitext
from setuptools import find_packages
from setuptools import setup
with open("README.md", "r") as fh:
long_d... | 28.351852 | 74 | 0.636185 |
from __future__ import absolute_import
from __future__ import print_function
from glob import glob
from os.path import basename
from os.path import splitext
from setuptools import find_packages
from setuptools import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='evgfl... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.