hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f703d2a9f3424c2ad908f8b302031b072df6c8fa | 426 | py | Python | rfapi/test/test_errors.py | cestrada-rf/rfapi-python | ca813d652fbfd02e90df2d4b7d280a981bd8d5c3 | [
"Apache-2.0"
] | 32 | 2016-12-09T13:31:31.000Z | 2022-02-12T00:59:44.000Z | rfapi/test/test_errors.py | cestrada-rf/rfapi-python | ca813d652fbfd02e90df2d4b7d280a981bd8d5c3 | [
"Apache-2.0"
] | 5 | 2019-03-21T10:01:19.000Z | 2020-02-13T14:06:54.000Z | rfapi/test/test_errors.py | cestrada-rf/rfapi-python | ca813d652fbfd02e90df2d4b7d280a981bd8d5c3 | [
"Apache-2.0"
] | 10 | 2018-06-25T15:49:28.000Z | 2021-12-03T12:39:44.000Z | import unittest
from rfapi.error import JsonParseError, MissingAuthError
class ApiClientTest(unittest.TestCase):
def test_json_parse_error(self):
resp = type('', (object,), {"content": ""})()
msg = "Could not parse"
e = JsonParseError(msg, resp)
self.assertEqual(str(e), msg)
d... | 28.4 | 56 | 0.650235 | import unittest
from rfapi.error import JsonParseError, MissingAuthError
class ApiClientTest(unittest.TestCase):
def test_json_parse_error(self):
resp = type('', (object,), {"content": ""})()
msg = "Could not parse"
e = JsonParseError(msg, resp)
self.assertEqual(str(e), msg)
d... | true | true |
f703d2c19fb0503f4ba11caa93e47284e1be03ce | 899 | py | Python | src/awkward/_v2/operations/describe/is_valid.py | scikit-hep/awkward-1.0 | a440328f8097d22c2ba053fd117fed543829afc0 | [
"BSD-3-Clause"
] | 519 | 2019-10-17T12:36:22.000Z | 2022-03-26T23:28:19.000Z | src/awkward/_v2/operations/describe/is_valid.py | scikit-hep/awkward-1.0 | a440328f8097d22c2ba053fd117fed543829afc0 | [
"BSD-3-Clause"
] | 924 | 2019-11-03T21:05:01.000Z | 2022-03-31T22:44:30.000Z | src/awkward/_v2/operations/describe/is_valid.py | scikit-hep/awkward-1.0 | a440328f8097d22c2ba053fd117fed543829afc0 | [
"BSD-3-Clause"
] | 56 | 2019-12-17T15:49:22.000Z | 2022-03-09T20:34:06.000Z | # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
from __future__ import absolute_import
import awkward as ak
np = ak.nplike.NumpyMetadata.instance()
def is_valid(array, exception=False):
pass
# """
# Args:
# array (#ak.Array, #ak.Record, #ak.layout.Conte... | 29.966667 | 122 | 0.679644 |
from __future__ import absolute_import
import awkward as ak
np = ak.nplike.NumpyMetadata.instance()
def is_valid(array, exception=False):
pass
# Args:
# array (#ak.Array, #ak.Record, #ak.layout.Content, #ak.layout.Record, #ak.ArrayBuilder, #ak.layout.ArrayBuilder):
# Array or record... | true | true |
f703d2e046e620c84768df767fae33740a8a8fed | 1,338 | py | Python | project/correctiondemos/pythag_test.py | gorff/Toric-Code-Correlated-Error-Decoder | c43cf34c22f03334add078f5d02e6604e5c89cba | [
"MIT"
] | 1 | 2017-11-21T02:55:30.000Z | 2017-11-21T02:55:30.000Z | project/correctiondemos/pythag_test.py | gorff/Toric-Code-Correlated-Error-Decoder | c43cf34c22f03334add078f5d02e6604e5c89cba | [
"MIT"
] | null | null | null | project/correctiondemos/pythag_test.py | gorff/Toric-Code-Correlated-Error-Decoder | c43cf34c22f03334add078f5d02e6604e5c89cba | [
"MIT"
] | null | null | null |
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import numpy as np
import os,sys,inspect
import imageio
sys.path.insert(1, os.path.join(sys.path[0], '..')) #go up a dir to import
import CodePy2.funmath as funmath
#import imageio
n = 1.0
sizes = [i/n for i in range(33*int(n))]
xvals = sizes
filenames ... | 29.086957 | 92 | 0.675635 |
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import numpy as np
import os,sys,inspect
import imageio
sys.path.insert(1, os.path.join(sys.path[0], '..'))
import CodePy2.funmath as funmath
n = 1.0
sizes = [i/n for i in range(33*int(n))]
xvals = sizes
filenames = []
for expectedlength in sizes:
... | true | true |
f703d2f1fc5bfee57fcd5d4184762ae275517939 | 11,005 | py | Python | models/Transformer.py | SunYanCN/nlp-experiments-in-pytorch | 5d05a53146dffd707e4d037230656f980d7be05c | [
"MIT"
] | 35 | 2018-11-19T14:08:16.000Z | 2021-12-23T22:51:43.000Z | models/Transformer.py | SunYanCN/nlp-experiments-in-pytorch | 5d05a53146dffd707e4d037230656f980d7be05c | [
"MIT"
] | null | null | null | models/Transformer.py | SunYanCN/nlp-experiments-in-pytorch | 5d05a53146dffd707e4d037230656f980d7be05c | [
"MIT"
] | 11 | 2019-01-12T06:48:39.000Z | 2021-05-09T16:59:58.000Z | import copy
import math
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from utils.utils import clones
class LayerNormGoogle(nn.Module):
def __init__(self, features, epsilon=1e-6):
super(LayerNormGo... | 37.948276 | 119 | 0.6408 | import copy
import math
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from utils.utils import clones
class LayerNormGoogle(nn.Module):
def __init__(self, features, epsilon=1e-6):
super(LayerNormGo... | true | true |
f703d2f45a05feea75027e7f0d41d7453e9b6fc3 | 3,283 | py | Python | program/model/version/ver1_2.py | donyori/2018ccf_bdci_inter_fund_correlation_prediction | 6e06a3e192e05ae1e9822111cf323eda3a61bf4e | [
"MIT"
] | null | null | null | program/model/version/ver1_2.py | donyori/2018ccf_bdci_inter_fund_correlation_prediction | 6e06a3e192e05ae1e9822111cf323eda3a61bf4e | [
"MIT"
] | 1 | 2018-12-18T05:14:08.000Z | 2019-01-16T06:31:35.000Z | program/model/version/ver1_2.py | donyori/2018ccf_bdci_inter_fund_correlation_prediction | 6e06a3e192e05ae1e9822111cf323eda3a61bf4e | [
"MIT"
] | null | null | null | from tensorflow import keras
from constants import TRADING_DAYS_PER_WEEK, INDEX_RETURN_INDICATOR_NUMBER
from ..constants import *
MODEL_NAME = 'ifcp_model_ver1_2'
ROLLING_WINDOW_SIZE = TRADING_DAYS_PER_WEEK
def build_model():
fund1_return = keras.Input(shape=(ROLLING_WINDOW_SIZE, 1), name=FUND1_RETURN_NAME)
... | 49.742424 | 114 | 0.73378 | from tensorflow import keras
from constants import TRADING_DAYS_PER_WEEK, INDEX_RETURN_INDICATOR_NUMBER
from ..constants import *
MODEL_NAME = 'ifcp_model_ver1_2'
ROLLING_WINDOW_SIZE = TRADING_DAYS_PER_WEEK
def build_model():
fund1_return = keras.Input(shape=(ROLLING_WINDOW_SIZE, 1), name=FUND1_RETURN_NAME)
... | true | true |
f703d302b98ab56a3febdd91cdf7285c913024e2 | 134 | py | Python | fugue/extensions/creator/__init__.py | WangCHX/fugue | bb9758d23b0041d4ed00f6195f317d097a9dd683 | [
"Apache-2.0"
] | null | null | null | fugue/extensions/creator/__init__.py | WangCHX/fugue | bb9758d23b0041d4ed00f6195f317d097a9dd683 | [
"Apache-2.0"
] | null | null | null | fugue/extensions/creator/__init__.py | WangCHX/fugue | bb9758d23b0041d4ed00f6195f317d097a9dd683 | [
"Apache-2.0"
] | null | null | null | # flake8: noqa
from fugue.extensions.creator.creator import Creator
from fugue.extensions.creator.convert import creator, _to_creator
| 33.5 | 65 | 0.843284 |
from fugue.extensions.creator.creator import Creator
from fugue.extensions.creator.convert import creator, _to_creator
| true | true |
f703d38691891112aa274bc0ec16962638b37767 | 2,140 | py | Python | app/utils/process.py | duzhangqiong/AutoLine | 9c32261eb9a47610ee01787420c300b42eee26ac | [
"Apache-2.0"
] | 249 | 2018-05-11T08:43:17.000Z | 2021-08-13T09:32:57.000Z | app/utils/process.py | duzhangqiong/AutoLine | 9c32261eb9a47610ee01787420c300b42eee26ac | [
"Apache-2.0"
] | 31 | 2018-05-15T01:25:18.000Z | 2022-03-12T00:11:29.000Z | app/utils/process.py | duzhangqiong/AutoLine | 9c32261eb9a47610ee01787420c300b42eee26ac | [
"Apache-2.0"
] | 132 | 2018-03-01T02:34:52.000Z | 2021-02-08T02:00:40.000Z | # -*- coding: utf-8 -*-
__author__ = "苦叶子"
"""
公众号: 开源优测
Email: lymking@foxmail.com
"""
import os
import time
import tempfile
import subprocess
class Process:
def __init__(self, command):
self._command = command
self._process = None
self._error = None
self._out_file = None
... | 26.097561 | 99 | 0.600467 |
__author__ = "苦叶子"
import os
import time
import tempfile
import subprocess
class Process:
def __init__(self, command):
self._command = command
self._process = None
self._error = None
self._out_file = None
self._out_path = None
self._out_fd = None
print(c... | true | true |
f703d3e86257aec1a99970afe7f847828a980f0d | 8,382 | py | Python | linnapi/requests/inventory.py | stcstores/linnapi | 88cc1d73444f44b7d901dc1086790a300066ea6e | [
"MIT"
] | null | null | null | linnapi/requests/inventory.py | stcstores/linnapi | 88cc1d73444f44b7d901dc1086790a300066ea6e | [
"MIT"
] | null | null | null | linnapi/requests/inventory.py | stcstores/linnapi | 88cc1d73444f44b7d901dc1086790a300066ea6e | [
"MIT"
] | null | null | null | """Inventory requests."""
from collections import defaultdict
from typing import Any, MutableMapping
import requests
from linnapi.request import LinnworksAPIRequest
class GetStockItemIDsBySKU(LinnworksAPIRequest):
"""Return the stock item ID for a SKU."""
URL = "https://eu-ext.linnworks.net/api/Inventory/... | 34.780083 | 91 | 0.636722 |
from collections import defaultdict
from typing import Any, MutableMapping
import requests
from linnapi.request import LinnworksAPIRequest
class GetStockItemIDsBySKU(LinnworksAPIRequest):
URL = "https://eu-ext.linnworks.net/api/Inventory/GetStockItemIdsBySKU"
METHOD = LinnworksAPIRequest.POST
@classm... | true | true |
f703d55dccf3102a6d3ac6083df3373cec870017 | 9,334 | py | Python | www/Webserver.py | william-stearns/E_ink_dashboard | 1625b213baef336833497c4593157485cfffdad4 | [
"MIT"
] | 67 | 2020-10-06T11:03:51.000Z | 2022-02-14T23:07:45.000Z | www/Webserver.py | william-stearns/E_ink_dashboard | 1625b213baef336833497c4593157485cfffdad4 | [
"MIT"
] | 11 | 2020-11-20T17:44:36.000Z | 2021-03-28T19:10:34.000Z | www/Webserver.py | william-stearns/E_ink_dashboard | 1625b213baef336833497c4593157485cfffdad4 | [
"MIT"
] | 9 | 2020-10-06T15:10:47.000Z | 2021-07-12T14:14:51.000Z | from flask import Flask, render_template, request
from dashboard_forms import Dashform
#import create_pickle as p_j
import json
import os
app = Flask(__name__)
app.secret_key = 'dash_flask_key'
creddir = os.path.join(os.path.dirname(
os.path.dirname(os.path.realpath(__file__))), 'credentials/dash_id.json'... | 43.821596 | 89 | 0.604885 | from flask import Flask, render_template, request
from dashboard_forms import Dashform
import json
import os
app = Flask(__name__)
app.secret_key = 'dash_flask_key'
creddir = os.path.join(os.path.dirname(
os.path.dirname(os.path.realpath(__file__))), 'credentials/dash_id.json')
tempdir = os.path.join(o... | true | true |
f703d5bcb5149ae9902f6dabfb5129e5c54b227c | 548 | py | Python | Thesis@3.9.1/Lib/site-packages/django/db/backends/base/client.py | nverbois/TFE21-232 | 7113837b5263b5c508bfc6903cb6982b48aa7ee4 | [
"MIT"
] | null | null | null | Thesis@3.9.1/Lib/site-packages/django/db/backends/base/client.py | nverbois/TFE21-232 | 7113837b5263b5c508bfc6903cb6982b48aa7ee4 | [
"MIT"
] | null | null | null | Thesis@3.9.1/Lib/site-packages/django/db/backends/base/client.py | nverbois/TFE21-232 | 7113837b5263b5c508bfc6903cb6982b48aa7ee4 | [
"MIT"
] | null | null | null | class BaseDatabaseClient:
"""Encapsulate backend-specific methods for opening a client shell."""
# This should be a string representing the name of the executable
# (e.g., "psql"). Subclasses must override this.
executable_name = None
def __init__(self, connection):
# connection is an inst... | 34.25 | 79 | 0.691606 | class BaseDatabaseClient:
executable_name = None
def __init__(self, connection):
self.connection = connection
def runshell(self, parameters):
raise NotImplementedError(
"subclasses of BaseDatabaseClient must provide a runshell() method"
)
| true | true |
f703d886c8b787f5722852a6e7cd7aa2d38d2ecf | 2,072 | py | Python | tests/abstractions/test_observer.py | symuvia/symupy | e6604c59bb4474f594ef5c997508f0407c9b3870 | [
"MIT"
] | 2 | 2019-07-01T09:58:53.000Z | 2020-06-12T12:12:46.000Z | tests/abstractions/test_observer.py | licit-lab/symupy | 942a17ee78cd12a363a4cd7b7f8363e239ccf7fe | [
"MIT"
] | 33 | 2021-01-18T13:59:01.000Z | 2021-11-29T13:21:10.000Z | tests/abstractions/test_observer.py | licit-lab/symupy | 942a17ee78cd12a363a4cd7b7f8363e239ccf7fe | [
"MIT"
] | 7 | 2018-07-12T13:34:38.000Z | 2019-10-02T13:37:31.000Z | """
Unit tests for symupy.api.stream
"""
# ============================================================================
# STANDARD IMPORTS
# ============================================================================
import pytest
# ============================================================================
#... | 25.9 | 78 | 0.533784 |
import pytest
from symupy.runtime.logic.publisher import Publisher
from symupy.runtime.logic.subscriber import Subscriber
@pytest.fixture
def default_channel():
return ("default",)
@pytest.fixture
def channels():
return ("channel 1", "channel 2")
def test_default_constructor(default_channel)... | true | true |
f703d887e5f0d59a66cda0527be6937a58680515 | 1,666 | gyp | Python | ion/image/tests/image_tests.gyp | RobLoach/ion | 9e659416fb04bb3d3a67df1e018d7c2ccab9d468 | [
"Apache-2.0"
] | null | null | null | ion/image/tests/image_tests.gyp | RobLoach/ion | 9e659416fb04bb3d3a67df1e018d7c2ccab9d468 | [
"Apache-2.0"
] | null | null | null | ion/image/tests/image_tests.gyp | RobLoach/ion | 9e659416fb04bb3d3a67df1e018d7c2ccab9d468 | [
"Apache-2.0"
] | null | null | null | #
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 28.724138 | 74 | 0.620048 |
{
'includes': [
'../../common.gypi',
],
'targets': [
{
'target_name': 'ionimage_test',
'includes': [ '../../dev/test_target.gypi' ],
'sources' : [
'conversionutils_test.cc',
'ninepatch_test.cc',
'renderutils_test.cc',
],
'dependencies' ... | true | true |
f703d8ac1afa839366c06b687eddbcf3c2cbd0eb | 50 | py | Python | test/SIM_test_ip/Modified_data/nested_includes.py | iamthad/trick | 88ac5b5990228e42a653347c9d7a103acea4d137 | [
"NASA-1.3"
] | 647 | 2015-05-07T16:08:16.000Z | 2022-03-30T02:33:21.000Z | test/SIM_test_ip/Modified_data/nested_includes.py | tanglemontree/trick | f182c723495185708434e67789457eb29d52ad58 | [
"NASA-1.3"
] | 995 | 2015-04-30T19:44:31.000Z | 2022-03-31T20:14:44.000Z | test/SIM_test_ip/Modified_data/nested_includes.py | tanglemontree/trick | f182c723495185708434e67789457eb29d52ad58 | [
"NASA-1.3"
] | 251 | 2015-05-15T09:24:34.000Z | 2022-03-22T20:39:05.000Z |
exec(open("Modified_data/next_level.py").read())
| 16.666667 | 48 | 0.74 |
exec(open("Modified_data/next_level.py").read())
| true | true |
f703d8cbc3d8b80905b75b7ed799f9b2c558bc79 | 101 | py | Python | stlearn/tools/microenv/cci/__init__.py | duypham2108/dev_st | 47adcfa5803eba7549b1185ec69d2317b386d9ff | [
"BSD-3-Clause"
] | 67 | 2020-06-01T05:19:23.000Z | 2022-03-31T20:47:50.000Z | stlearn/tools/microenv/cci/__init__.py | duypham2108/dev_st | 47adcfa5803eba7549b1185ec69d2317b386d9ff | [
"BSD-3-Clause"
] | 34 | 2020-11-02T18:01:43.000Z | 2022-03-16T21:58:54.000Z | stlearn/tools/microenv/cci/__init__.py | duypham2108/dev_st | 47adcfa5803eba7549b1185ec69d2317b386d9ff | [
"BSD-3-Clause"
] | 13 | 2020-05-14T05:10:22.000Z | 2022-03-09T14:05:38.000Z | from .base import lr
from . import het
from .merge import merge
from .permutation import permutation
| 20.2 | 36 | 0.80198 | from .base import lr
from . import het
from .merge import merge
from .permutation import permutation
| true | true |
f703da02f25d5ed4cc390c9c56ecc410d25fc0b9 | 2,488 | py | Python | events/tracon8/management/commands/setup_tracon8.py | jlaunonen/turska | fc6ec4e0ae50a823e931152ce8835098b96f5966 | [
"CC-BY-3.0"
] | null | null | null | events/tracon8/management/commands/setup_tracon8.py | jlaunonen/turska | fc6ec4e0ae50a823e931152ce8835098b96f5966 | [
"CC-BY-3.0"
] | null | null | null | events/tracon8/management/commands/setup_tracon8.py | jlaunonen/turska | fc6ec4e0ae50a823e931152ce8835098b96f5966 | [
"CC-BY-3.0"
] | null | null | null | # encoding: utf-8
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.auth.models import Group
from django.core.management.base import BaseCommand
from dateutil.tz import tzlocal
from core.models import Event, Venue
from programme.models import ProgrammeEventMeta, TimeBlock... | 33.621622 | 107 | 0.592042 |
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.auth.models import Group
from django.core.management.base import BaseCommand
from dateutil.tz import tzlocal
from core.models import Event, Venue
from programme.models import ProgrammeEventMeta, TimeBlock, SpecialStartTim... | true | true |
f703da2c8363ee59f03ded7651a552589e14a980 | 470 | py | Python | ml_tutorial/test.py | simonfong6/micro-projects | 5be195ea72ce117df6da041446f11c18e102b5df | [
"MIT"
] | null | null | null | ml_tutorial/test.py | simonfong6/micro-projects | 5be195ea72ce117df6da041446f11c18e102b5df | [
"MIT"
] | null | null | null | ml_tutorial/test.py | simonfong6/micro-projects | 5be195ea72ce117df6da041446f11c18e102b5df | [
"MIT"
] | null | null | null | import svm as SVM
import numpy as np
data_dict = { -1:np.array( [[10,9,1],
[2,8,1],
[3,8,1],]),
1:np.array( [[5,1,1],
[6,-1,1],
[7,3,1],])}
svm = SVM.Support_Vector_Machine()
svm.fit(data=data_dict)
predict_us = [[0,10,1],
[1,3,1],
... | 16.785714 | 37 | 0.412766 | import svm as SVM
import numpy as np
data_dict = { -1:np.array( [[10,9,1],
[2,8,1],
[3,8,1],]),
1:np.array( [[5,1,1],
[6,-1,1],
[7,3,1],])}
svm = SVM.Support_Vector_Machine()
svm.fit(data=data_dict)
predict_us = [[0,10,1],
[1,3,1],
... | true | true |
f703db006bf2006e44c7efb17e8369f7a87596e3 | 3,745 | py | Python | scripts/webui-sc/confeditor.py | lucywitherall/eve-pi | 14f4555d0b89eaf8b4a9aed9f629c9358c4b121d | [
"MIT"
] | null | null | null | scripts/webui-sc/confeditor.py | lucywitherall/eve-pi | 14f4555d0b89eaf8b4a9aed9f629c9358c4b121d | [
"MIT"
] | null | null | null | scripts/webui-sc/confeditor.py | lucywitherall/eve-pi | 14f4555d0b89eaf8b4a9aed9f629c9358c4b121d | [
"MIT"
] | 1 | 2019-10-07T12:56:55.000Z | 2019-10-07T12:56:55.000Z | #!/usr/bin/python3
import configparser
config = configparser.ConfigParser()
config.read('eve-conf.ini')
def int_imp(inp):
while True:
try:
int(inp)
break
except ValueError:
print('Input has to be a number.')
inp = input('Select again: ')
return i... | 27.137681 | 81 | 0.5247 |
import configparser
config = configparser.ConfigParser()
config.read('eve-conf.ini')
def int_imp(inp):
while True:
try:
int(inp)
break
except ValueError:
print('Input has to be a number.')
inp = input('Select again: ')
return int(inp)
def secti... | true | true |
f703db3a5054be83b8f321fde2dfcb1f74eb3ea4 | 3,132 | py | Python | examples/distancePlusAmplitude.py | OnionIoT/tau-lidar-camera | a70b24e18be8e4c5abfe525c6768fbc10a492fd8 | [
"MIT"
] | 31 | 2020-12-18T16:35:15.000Z | 2022-03-25T18:41:19.000Z | examples/distancePlusAmplitude.py | OnionIoT/tau-lidar-camera | a70b24e18be8e4c5abfe525c6768fbc10a492fd8 | [
"MIT"
] | 17 | 2020-11-18T16:10:36.000Z | 2022-02-01T22:19:11.000Z | examples/distancePlusAmplitude.py | OnionIoT/tau-lidar-camera | a70b24e18be8e4c5abfe525c6768fbc10a492fd8 | [
"MIT"
] | 4 | 2021-01-18T17:25:02.000Z | 2021-11-01T13:25:45.000Z | import argparse
import numpy as np
import cv2
from TauLidarCommon.frame import FrameType
from TauLidarCamera.camera import Camera
def setup(serialPort=None):
port = None
camera = None
# if no serial port is specified, scan for available Tau Camera devices
if serialPort is None:
ports = Camera... | 33.319149 | 170 | 0.618455 | import argparse
import numpy as np
import cv2
from TauLidarCommon.frame import FrameType
from TauLidarCamera.camera import Camera
def setup(serialPort=None):
port = None
camera = None
if serialPort is None:
ports = Camera.scan() port = ports[0]
else:
port =... | true | true |
f703dc1425cb1df6daa7defbf0f85faec7d5dac6 | 5,614 | py | Python | minqlx-plugins/branding.py | tjone270/Quake-Live | f3864ab74752218044fbe6f43fba3978d519e3f1 | [
"RSA-MD"
] | 35 | 2015-11-23T22:46:40.000Z | 2021-11-26T08:11:02.000Z | minqlx-plugins/branding.py | tjone270/Quake-Live | f3864ab74752218044fbe6f43fba3978d519e3f1 | [
"RSA-MD"
] | 14 | 2016-01-21T22:17:19.000Z | 2017-12-30T06:34:08.000Z | minqlx-plugins/branding.py | tjone270/Quake-Live | f3864ab74752218044fbe6f43fba3978d519e3f1 | [
"RSA-MD"
] | 24 | 2015-12-10T16:49:28.000Z | 2021-08-15T00:24:25.000Z | # Created by Thomas Jones on 06/11/15 - thomas@tomtecsolutions.com
# branding.py, a plugin for minqlx to brand your server.
# This plugin is released to everyone, for any purpose. It comes with no warranty, no guarantee it works, it's released AS IS.
# You can modify everything, except for lines 1-4 and the !tomtec_ver... | 48.817391 | 167 | 0.63876 |
# You can modify everything, except for lines 1-4 and the !tomtec_versions code. They're there to indicate I whacked this together originally. Please make it better :D
import minqlx
class branding(minqlx.Plugin):
def __init__(self):
self.add_hook("new_game", self.brand_map)
self.add_hook("play... | true | true |
f703dcb4a2d04a5dcb8b6f0e5e190bc6173390ca | 13,974 | py | Python | cartridge/project_template/project_name/settings.py | dsanders11/cartridge | d3a14da3fbbd0c36c589c2abef1bb3364ef28faf | [
"BSD-2-Clause"
] | null | null | null | cartridge/project_template/project_name/settings.py | dsanders11/cartridge | d3a14da3fbbd0c36c589c2abef1bb3364ef28faf | [
"BSD-2-Clause"
] | null | null | null | cartridge/project_template/project_name/settings.py | dsanders11/cartridge | d3a14da3fbbd0c36c589c2abef1bb3364ef28faf | [
"BSD-2-Clause"
] | null | null | null | import os
from django.utils.translation import gettext_lazy as _
######################
# CARTRIDGE SETTINGS #
######################
# The following settings are already defined in cartridge.shop.defaults
# with default values, but are common enough to be put here, commented
# out, for conveniently overriding. Plea... | 35.467005 | 87 | 0.696508 | import os
from django.utils.translation import gettext_lazy as _
is successful and all of the order
# object's data has been created. This is where any custom order
(_("Shop"), ("shop.Product", "shop.ProductOption", "shop.DiscountCode",
# "shop.Sale", "shop.Order")),
# ("Site",... | true | true |
f703dd557ff0c6601e9b1327d30fb5ee5f8ded6a | 3,770 | py | Python | main/hit_object.py | MBmasher/weighted-object | eaaf25338240873b7c4197097b2bb73be256b702 | [
"MIT"
] | null | null | null | main/hit_object.py | MBmasher/weighted-object | eaaf25338240873b7c4197097b2bb73be256b702 | [
"MIT"
] | null | null | null | main/hit_object.py | MBmasher/weighted-object | eaaf25338240873b7c4197097b2bb73be256b702 | [
"MIT"
] | null | null | null | # HitObject class
class HitObject:
def __init__(self, start_x, start_y, end_x, end_y, time, object_type):
self.start_x = start_x
self.start_y = start_y
self.end_x = end_x
self.end_y = end_y
self.time = time
self.object_type = object_type # hit_circle, eve... | 35.233645 | 110 | 0.659947 |
class HitObject:
def __init__(self, start_x, start_y, end_x, end_y, time, object_type):
self.start_x = start_x
self.start_y = start_y
self.end_x = end_x
self.end_y = end_y
self.time = time
self.object_type = object_type
def find_start(lines):
... | true | true |
f703ddc91411d775bc61ad267063c63f00cf2580 | 20,786 | py | Python | src/sage/schemes/elliptic_curves/weierstrass_morphism.py | bopopescu/classic_diff_geom | 2b1d88becbc8cb30962e0995cc78e429e0f5589f | [
"BSL-1.0"
] | null | null | null | src/sage/schemes/elliptic_curves/weierstrass_morphism.py | bopopescu/classic_diff_geom | 2b1d88becbc8cb30962e0995cc78e429e0f5589f | [
"BSL-1.0"
] | null | null | null | src/sage/schemes/elliptic_curves/weierstrass_morphism.py | bopopescu/classic_diff_geom | 2b1d88becbc8cb30962e0995cc78e429e0f5589f | [
"BSL-1.0"
] | 1 | 2020-07-24T12:08:30.000Z | 2020-07-24T12:08:30.000Z | r"""
Isomorphisms between Weierstrass models of elliptic curves
AUTHORS:
- Robert Bradshaw (2007): initial version
- John Cremona (Jan 2008): isomorphisms, automorphisms and twists
in all characteristics
"""
#*****************************************************************************
# Copyright (C) 2007 Rober... | 33.964052 | 150 | 0.531415 |
from sage.categories.morphism import Morphism
from constructor import EllipticCurve
from sage.categories.homset import Hom
class baseWI:
def __init__(self, u=1, r=0, s=0, t=0):
if u==0:
raise ValueError("u!=0 required for baseWI")
self.u=u; self.r=r; self.s=s; self.t=t... | true | true |
f703de5e7d7acf281786e68b60e43bb7dc901b58 | 3,336 | py | Python | conf/configs/deploy.py | HeliumEdu/template-project | f5da3f35d6aa4ba4c3d162e59d195720e8c2101b | [
"MIT"
] | 2 | 2018-12-22T19:09:04.000Z | 2019-01-23T19:09:31.000Z | conf/configs/deploy.py | HeliumEdu/template-project | f5da3f35d6aa4ba4c3d162e59d195720e8c2101b | [
"MIT"
] | 20 | 2019-07-03T20:56:42.000Z | 2022-03-02T22:16:29.000Z | conf/configs/deploy.py | HeliumEdu/template-project | f5da3f35d6aa4ba4c3d162e59d195720e8c2101b | [
"MIT"
] | null | null | null | """
Settings specific to prod-like deployable code, reading values from system environment variables.
"""
import os
from conf.configs import common
from conf.settings import PROJECT_ID
__author__ = "Alex Laird"
__copyright__ = "Copyright 2018, Helium Edu"
__version__ = "1.1.15"
# Define the base working directory o... | 26.0625 | 97 | 0.566847 |
import os
from conf.configs import common
from conf.settings import PROJECT_ID
__author__ = "Alex Laird"
__copyright__ = "Copyright 2018, Helium Edu"
__version__ = "1.1.15"
BASE_DIR = os.path.normpath(os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", ".."))
INSTALLED_APPS = common.INSTALLED_APPS
M... | true | true |
f703dec0139b9f6b76143414797f05175d6cbaa4 | 7,986 | py | Python | recipes/views.py | 4dragunov/foodgram-project | 7a5691522047fe6715e1e560c17dcf77852558fc | [
"MIT"
] | null | null | null | recipes/views.py | 4dragunov/foodgram-project | 7a5691522047fe6715e1e560c17dcf77852558fc | [
"MIT"
] | null | null | null | recipes/views.py | 4dragunov/foodgram-project | 7a5691522047fe6715e1e560c17dcf77852558fc | [
"MIT"
] | null | null | null | import operator
from functools import reduce
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from django.db.models import Q, Sum
from django.shortcuts import HttpResponse, get_object_or_404, redirect, render
from django.views.generic import View
from django.view... | 36.972222 | 79 | 0.576258 | import operator
from functools import reduce
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from django.db.models import Q, Sum
from django.shortcuts import HttpResponse, get_object_or_404, redirect, render
from django.views.generic import View
from django.view... | true | true |
f703df5f0c91bc68a4c4c50b7014ee977351bac8 | 4,958 | py | Python | backend/services/toxic_comment_jigsaw/application/ai/training/src/train.py | R-aryan/Jigsaw-Toxic-Comment-Classification | e5e4da7df379ac1b315f2bde655386180f39c517 | [
"MIT"
] | null | null | null | backend/services/toxic_comment_jigsaw/application/ai/training/src/train.py | R-aryan/Jigsaw-Toxic-Comment-Classification | e5e4da7df379ac1b315f2bde655386180f39c517 | [
"MIT"
] | 1 | 2021-07-08T14:57:25.000Z | 2021-07-08T14:57:25.000Z | backend/services/toxic_comment_jigsaw/application/ai/training/src/train.py | R-aryan/Jigsaw-Toxic-Comment-Classification | e5e4da7df379ac1b315f2bde655386180f39c517 | [
"MIT"
] | null | null | null | import pandas as pd
import numpy as np
import torch
from sklearn.model_selection import train_test_split
from backend.services.toxic_comment_jigsaw.application.ai.model import BERTClassifier
from backend.services.toxic_comment_jigsaw.application.ai.training.src.dataset import BERTDataset
from backend.services.toxic_co... | 42.741379 | 120 | 0.587535 | import pandas as pd
import numpy as np
import torch
from sklearn.model_selection import train_test_split
from backend.services.toxic_comment_jigsaw.application.ai.model import BERTClassifier
from backend.services.toxic_comment_jigsaw.application.ai.training.src.dataset import BERTDataset
from backend.services.toxic_co... | true | true |
f703dfbac51316faf74f9bc6a25208bbba2a78b2 | 22,168 | py | Python | tests/hacking/checks.py | msimonin/rally-openstack | fc899c7262125e4739139f708a830ef975f386a6 | [
"Apache-2.0"
] | null | null | null | tests/hacking/checks.py | msimonin/rally-openstack | fc899c7262125e4739139f708a830ef975f386a6 | [
"Apache-2.0"
] | null | null | null | tests/hacking/checks.py | msimonin/rally-openstack | fc899c7262125e4739139f708a830ef975f386a6 | [
"Apache-2.0"
] | null | null | null | # 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
# distributed under t... | 35.243243 | 79 | 0.621391 |
import functools
import re
import tokenize
re_assert_equal_end_with_true_or_false = re.compile(
r"assertEqual\(.*?, \s+(True|False)\)$")
re_assert_equal_start_with_true_or_false = re.compile(
r"assertEqual\((True|False),")
re_assert_true_instance = re.compile(
r"(.)*assertTrue\(isinstance\((\... | true | true |
f703e067097e7fd54be3a51d8ada504b3532e390 | 357 | py | Python | carafe_layer/setup.py | chensnathan/CARAFE_CUDA | 33d3d3af69b24fc679f6a3a071a19070dc46664b | [
"MIT"
] | 1 | 2019-10-28T15:05:30.000Z | 2019-10-28T15:05:30.000Z | carafe_layer/setup.py | chensnathan/CARAFE_CUDA | 33d3d3af69b24fc679f6a3a071a19070dc46664b | [
"MIT"
] | 1 | 2021-03-25T10:24:19.000Z | 2021-06-08T15:07:34.000Z | carafe_layer/setup.py | chensnathan/CARAFE_CUDA | 33d3d3af69b24fc679f6a3a071a19070dc46664b | [
"MIT"
] | 1 | 2020-01-03T09:42:22.000Z | 2020-01-03T09:42:22.000Z | from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
setup(
name='carafe_layer_cuda',
ext_modules=[
CUDAExtension('carafe_layer_cuda', [
'src/carafe_layer_cuda.cpp',
'src/carafe_layer_kernel.cu',
])
],
cmdclass={
... | 23.8 | 67 | 0.644258 | from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
setup(
name='carafe_layer_cuda',
ext_modules=[
CUDAExtension('carafe_layer_cuda', [
'src/carafe_layer_cuda.cpp',
'src/carafe_layer_kernel.cu',
])
],
cmdclass={
... | true | true |
f703e2683a06f78f7c2643f6719d0e4cc5da5092 | 429 | py | Python | src/saffine/detrending_coeff.py | AU-DATALAB/newsFluxus | 20522b2c8c830d2377a9620d149a515baaaa9cf4 | [
"MIT"
] | 3 | 2020-06-17T07:56:27.000Z | 2021-09-30T09:50:50.000Z | src/saffine/detrending_coeff.py | AU-DATALAB/newsFluxus | 20522b2c8c830d2377a9620d149a515baaaa9cf4 | [
"MIT"
] | null | null | null | src/saffine/detrending_coeff.py | AU-DATALAB/newsFluxus | 20522b2c8c830d2377a9620d149a515baaaa9cf4 | [
"MIT"
] | 2 | 2021-02-23T11:36:55.000Z | 2021-03-04T10:36:19.000Z | from numpy import *
import numpy as np
# from numba import jit
# @jit
def detrending_coeff(win_len , order):
#win_len = 51
#order = 2
n = (win_len-1)/2
A = mat(ones((win_len,order+1)))
x = np.arange(-n , n+1)
for j in range(0 , order + 1):
A[:,j] = mat(x ** j).T
coeff_output = (A.T * A).I * A... | 18.652174 | 41 | 0.599068 | from numpy import *
import numpy as np
def detrending_coeff(win_len , order):
n = (win_len-1)/2
A = mat(ones((win_len,order+1)))
x = np.arange(-n , n+1)
for j in range(0 , order + 1):
A[:,j] = mat(x ** j).T
coeff_output = (A.T * A).I * A.T
return coeff_output , A
| true | true |
f703e2c70bc3ec943e58a06933c76b53f568ea8b | 3,851 | py | Python | opentraj/toolkit/loaders/loader_pets.py | RedTachyon/OpenTraj | 8277f526d714a4e77d0f9f354259ff5b74e59fd2 | [
"MIT"
] | null | null | null | opentraj/toolkit/loaders/loader_pets.py | RedTachyon/OpenTraj | 8277f526d714a4e77d0f9f354259ff5b74e59fd2 | [
"MIT"
] | null | null | null | opentraj/toolkit/loaders/loader_pets.py | RedTachyon/OpenTraj | 8277f526d714a4e77d0f9f354259ff5b74e59fd2 | [
"MIT"
] | null | null | null | # Author: Javad Amirian
# Email: amiryan.j@gmail.com
import xml.etree.ElementTree as et
import numpy as np
import pandas as pd
from opentraj.toolkit.core.trajdataset import TrajDataset
from opentraj.toolkit.utils.calibration.camera_calibration_tsai import *
def load_pets(path, **kwargs):
"""
:param path: a... | 34.693694 | 96 | 0.622176 |
import xml.etree.ElementTree as et
import numpy as np
import pandas as pd
from opentraj.toolkit.core.trajdataset import TrajDataset
from opentraj.toolkit.utils.calibration.camera_calibration_tsai import *
def load_pets(path, **kwargs):
traj_dataset = TrajDataset()
annot_xtree = et.parse(path)
annot_... | true | true |
f703e382437464750f398a5b77d27612a40e8529 | 7,578 | py | Python | config/settings/production.py | danieldourado/estatisticas_facebook_cookiecutter | 896903825998f0dee5a6b5d9aa34160f123bd15d | [
"MIT"
] | 2 | 2017-12-22T01:00:22.000Z | 2017-12-22T11:14:40.000Z | config/settings/production.py | danieldourado/estatisticas_facebook_cookiecutter | 896903825998f0dee5a6b5d9aa34160f123bd15d | [
"MIT"
] | 18 | 2017-12-14T12:04:45.000Z | 2022-03-11T23:23:05.000Z | config/settings/production.py | danieldourado/estatisticas_facebook_cookiecutter | 896903825998f0dee5a6b5d9aa34160f123bd15d | [
"MIT"
] | 1 | 2021-03-27T16:18:56.000Z | 2021-03-27T16:18:56.000Z | """
Production settings for Estatisticas Facebook project.
- Use WhiteNoise for serving static files
- Use Amazon's S3 for storing uploaded media
- Use mailgun to send emails
- Use Redis for cache
- Use sentry for error logging
"""
import logging
from .base import * # noqa
# SECRET CONFIGURATION
# -----------... | 34.921659 | 117 | 0.624571 |
import logging
from .base import *
Y = env('DJANGO_SECRET_KEY')
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
INSTALLED_APPS += ['raven.contrib.django.raven_compat', ]
WHITENOISE_MIDDLEWARE = ['whitenoise.middleware.WhiteNoiseMiddleware', ]
MIDDLEWARE = WHITENOISE_MIDDLEWARE + MIDDLEWA... | true | true |
f703e3a077b4e41b0e27387b9ed3ca54503418ad | 18,606 | py | Python | pyiron/vasp/potential.py | t-brink/pyiron | c07552b54a39e3f036ba395325cd4b372af0f794 | [
"BSD-3-Clause"
] | null | null | null | pyiron/vasp/potential.py | t-brink/pyiron | c07552b54a39e3f036ba395325cd4b372af0f794 | [
"BSD-3-Clause"
] | 1 | 2021-11-02T09:22:56.000Z | 2021-11-02T09:22:56.000Z | pyiron/vasp/potential.py | t-brink/pyiron | c07552b54a39e3f036ba395325cd4b372af0f794 | [
"BSD-3-Clause"
] | 1 | 2021-11-02T08:35:47.000Z | 2021-11-02T08:35:47.000Z | # coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
import os
import posixpath
import numpy as np
import pandas
import tables
import warnings
from pyiron_base import Gener... | 37.063745 | 125 | 0.581587 |
import os
import posixpath
import numpy as np
import pandas
import tables
import warnings
from pyiron_base import GenericParameters, Settings
from pyiron.atomistics.job.potentials import PotentialAbstract, find_potential_file_base
__author__ = "Jan Janssen"
__copyright__ = (
"Copyright 2020, Max-Planck-Instit... | true | true |
f703e4a7028f63373e16c31d94c3f103f420f77b | 18,454 | py | Python | kubernetes/client/models/v1beta1_event.py | iguazio/python | c2684bb479d44a49a2010ec4ede5ffa7b17349dd | [
"Apache-2.0"
] | null | null | null | kubernetes/client/models/v1beta1_event.py | iguazio/python | c2684bb479d44a49a2010ec4ede5ffa7b17349dd | [
"Apache-2.0"
] | null | null | null | kubernetes/client/models/v1beta1_event.py | iguazio/python | c2684bb479d44a49a2010ec4ede5ffa7b17349dd | [
"Apache-2.0"
] | 1 | 2019-01-10T11:13:52.000Z | 2019-01-10T11:13:52.000Z | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... | 32.149826 | 339 | 0.634117 |
from pprint import pformat
from six import iteritems
import re
class V1beta1Event(object):
swagger_types = {
'action': 'str',
'api_version': 'str',
'deprecated_count': 'int',
'deprecated_first_timestamp': 'datetime',
'deprecated_last_timestamp': 'datetime',
'd... | true | true |
f703e4dad2354c26235f39a5db5e721bba4fa7e8 | 788 | py | Python | Lab2/task[1-3].py | ValeriyMartsyshyn/HelloPython | badcf85bc54e889eed0286b420e5cabe68da8572 | [
"MIT"
] | null | null | null | Lab2/task[1-3].py | ValeriyMartsyshyn/HelloPython | badcf85bc54e889eed0286b420e5cabe68da8572 | [
"MIT"
] | null | null | null | Lab2/task[1-3].py | ValeriyMartsyshyn/HelloPython | badcf85bc54e889eed0286b420e5cabe68da8572 | [
"MIT"
] | null | null | null | #task 1
nyaam = float (input('enter a length in cm: '))
if nyaam < 0:
print ('entry is invalid')
else:
res = nyaam / 2.54
print (res, 'inch')
#task 2
whoosh = int (input ('how many credits have you taken? '))
if whoosh > 0 and whoosh < 24:
print ('congrats, you a freshman!')
elif whoosh > 23 and wh... | 21.888889 | 58 | 0.628173 |
nyaam = float (input('enter a length in cm: '))
if nyaam < 0:
print ('entry is invalid')
else:
res = nyaam / 2.54
print (res, 'inch')
whoosh = int (input ('how many credits have you taken? '))
if whoosh > 0 and whoosh < 24:
print ('congrats, you a freshman!')
elif whoosh > 23 and whoosh < 54:
... | true | true |
f703e4f4b3879387dd8d422d53b101ca0ddef7f8 | 16,603 | py | Python | mp/models/continual/model_utils.py | MECLabTUDA/ACS | bb418c5479a3585138c48c63112352f5cc8f64b1 | [
"MIT"
] | 5 | 2021-07-20T16:57:14.000Z | 2022-03-21T23:52:59.000Z | mp/models/continual/model_utils.py | MECLabTUDA/ACS | bb418c5479a3585138c48c63112352f5cc8f64b1 | [
"MIT"
] | null | null | null | mp/models/continual/model_utils.py | MECLabTUDA/ACS | bb418c5479a3585138c48c63112352f5cc8f64b1 | [
"MIT"
] | 1 | 2021-07-20T16:57:15.000Z | 2021-07-20T16:57:15.000Z | import torch
import torch.nn as nn
import torch.nn.functional as F
from mp.models.segmentation.unet_fepegar import UNet2D
### UNet Wrapper ###
class UNet2D_dis(UNet2D):
r"""Wrapper for UNet2D to access encoder and decoder seperately.
"""
def __init__(self, *args, **kwargs):
super(UNet2D_dis, self).... | 45.487671 | 172 | 0.671565 | import torch
import torch.nn as nn
import torch.nn.functional as F
from mp.models.segmentation.unet_fepegar import UNet2D
(self, *args, **kwargs):
super(UNet2D_dis, self).__init__(*args, **kwargs)
def forward_enc(self, x):
skip_connections, encoding = self.encoder(x)
encoding = self.bottom... | true | true |
f703e668f221af1cbe47550132535735de0842cf | 4,121 | py | Python | e2xgrader/server_extensions/assignment_list/handlers.py | divindevaiah/e2xgrader | 19eb4662e4eee5ddef673097517e4bd4fb469e62 | [
"MIT"
] | 2 | 2021-10-02T10:48:47.000Z | 2022-03-02T14:00:48.000Z | e2xgrader/server_extensions/assignment_list/handlers.py | divindevaiah/e2xgrader | 19eb4662e4eee5ddef673097517e4bd4fb469e62 | [
"MIT"
] | 70 | 2020-10-23T16:42:01.000Z | 2022-03-14T16:33:54.000Z | e2xgrader/server_extensions/assignment_list/handlers.py | divindevaiah/e2xgrader | 19eb4662e4eee5ddef673097517e4bd4fb469e62 | [
"MIT"
] | 10 | 2020-11-22T16:36:16.000Z | 2022-03-02T15:51:24.000Z | """Tornado handlers for nbgrader assignment list web service."""
import os
import json
import contextlib
import traceback
from tornado import web
from notebook.utils import url_path_join as ujoin
from nbgrader.exchange import ExchangeFactory
from nbgrader.coursedir import CourseDirectory
from nbgrader.auth import A... | 34.341667 | 87 | 0.61587 |
import os
import json
import contextlib
import traceback
from tornado import web
from notebook.utils import url_path_join as ujoin
from nbgrader.exchange import ExchangeFactory
from nbgrader.coursedir import CourseDirectory
from nbgrader.auth import Authenticator
from nbgrader.server_extensions.assignment_list.han... | true | true |
f703e74b18a0079809bb062fa0b290421b09da2b | 1,815 | py | Python | os_xenapi/client/exception.py | mail2nsrajesh/os-xenapi | 7ac84ec31dd1df6af90b2bf333253848cb4de2c3 | [
"Apache-2.0"
] | null | null | null | os_xenapi/client/exception.py | mail2nsrajesh/os-xenapi | 7ac84ec31dd1df6af90b2bf333253848cb4de2c3 | [
"Apache-2.0"
] | null | null | null | os_xenapi/client/exception.py | mail2nsrajesh/os-xenapi | 7ac84ec31dd1df6af90b2bf333253848cb4de2c3 | [
"Apache-2.0"
] | null | null | null | # Copyright 2016 Citrix Systems
#
# 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 agr... | 32.410714 | 78 | 0.680441 |
from os_xenapi.client.i18n import _
class OsXenApiException(Exception):
msg_fmt = _("An unknown exception occurred.")
code = 500
def __init__(self, message=None, **kwargs):
self.kwargs = kwargs
if 'code' not in self.kwargs:
try:
self.kwargs['code... | true | true |
f703e984390443eba9c7a013798f01dd9ac3fa6f | 2,924 | py | Python | dataset/7scenes-export/7scenes-export-color.py | hashi0203/deep-video-mvs | b3943a9249d522dca3e6cd603e427f611cc7bad5 | [
"MIT"
] | null | null | null | dataset/7scenes-export/7scenes-export-color.py | hashi0203/deep-video-mvs | b3943a9249d522dca3e6cd603e427f611cc7bad5 | [
"MIT"
] | null | null | null | dataset/7scenes-export/7scenes-export-color.py | hashi0203/deep-video-mvs | b3943a9249d522dca3e6cd603e427f611cc7bad5 | [
"MIT"
] | null | null | null | import os
import shutil
from multiprocessing.pool import Pool
import cv2
import numpy as np
from functools import partial
from path import Path
def process_scene(input_directory, output_folder):
K = np.array([[525.0, 0.0, 320.0],
[0.0, 525.0, 240.0],
[0.0, 0.0, 1.0]])
prin... | 33.227273 | 136 | 0.647059 | import os
import shutil
from multiprocessing.pool import Pool
import cv2
import numpy as np
from functools import partial
from path import Path
def process_scene(input_directory, output_folder):
K = np.array([[525.0, 0.0, 320.0],
[0.0, 525.0, 240.0],
[0.0, 0.0, 1.0]])
prin... | true | true |
f703e990bc149d473a221b9a2f1254c9d2a428c5 | 891 | py | Python | interactive_map.py | webmsgr/OneLifeMapper | 9c94f2820c8605372ff4127f8fb2dfd411db3388 | [
"MIT"
] | null | null | null | interactive_map.py | webmsgr/OneLifeMapper | 9c94f2820c8605372ff4127f8fb2dfd411db3388 | [
"MIT"
] | 2 | 2019-10-18T19:19:04.000Z | 2019-10-18T19:59:09.000Z | interactive_map.py | webmsgr/OneLifeMapper | 9c94f2820c8605372ff4127f8fb2dfd411db3388 | [
"MIT"
] | null | null | null | import pygame
import math
import glob
import os
tilesize = 128 # pixels per tile
def tiletosurface(tile):
pass
def maptosurface(sx,sy,ex,ey,oholmap):
pass
def main(windowsize,tilepipe,OHOLMap):
wt = math.floor(windowsize/tilesize)
cx,cy,first = 0,0,True
if OHOLMap.data != {}:
for x in OHOL... | 26.205882 | 62 | 0.597082 | import pygame
import math
import glob
import os
tilesize = 128
def tiletosurface(tile):
pass
def maptosurface(sx,sy,ex,ey,oholmap):
pass
def main(windowsize,tilepipe,OHOLMap):
wt = math.floor(windowsize/tilesize)
cx,cy,first = 0,0,True
if OHOLMap.data != {}:
for x in OHOLMap.data:
... | true | true |
f703e9c0d1a0c2a1c793b2889510d7c6d314ac38 | 58,491 | py | Python | newscout_web/api/v1/views.py | Arch-020/newscout_web | 76b3885f27a346806baf60f5d9a72931140f9e78 | [
"Apache-2.0"
] | 3 | 2019-10-30T07:15:59.000Z | 2021-12-26T20:59:05.000Z | newscout_web/api/v1/views.py | Arch-020/newscout_web | 76b3885f27a346806baf60f5d9a72931140f9e78 | [
"Apache-2.0"
] | 322 | 2019-10-30T07:12:36.000Z | 2022-02-10T10:55:32.000Z | newscout_web/api/v1/views.py | Arch-020/newscout_web | 76b3885f27a346806baf60f5d9a72931140f9e78 | [
"Apache-2.0"
] | 7 | 2019-10-30T13:34:54.000Z | 2021-12-27T12:08:07.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.http import Http404
from core.models import (Category, Article, Source, BaseUserProfile,
BookmarkArticle, ArticleLike, HashTag, Menu, Notification, Devices,
SocialAccount, Category, CategoryAss... | 37.736129 | 121 | 0.601306 |
from __future__ import unicode_literals
from django.http import Http404
from core.models import (Category, Article, Source, BaseUserProfile,
BookmarkArticle, ArticleLike, HashTag, Menu, Notification, Devices,
SocialAccount, Category, CategoryAssociation,
... | true | true |
f703ed2aa1c7638b37cd9459328cc99a0a5f16f3 | 34,077 | py | Python | main.py | RedaLegzali/mr-driller | c944b10ff17ece1445b55cf3b44a4aca411dcc0d | [
"MIT"
] | null | null | null | main.py | RedaLegzali/mr-driller | c944b10ff17ece1445b55cf3b44a4aca411dcc0d | [
"MIT"
] | null | null | null | main.py | RedaLegzali/mr-driller | c944b10ff17ece1445b55cf3b44a4aca411dcc0d | [
"MIT"
] | null | null | null | import pygame, time
from pygame.locals import *
from random import *
pygame.init()
# Variables Pygame
white = (255, 255, 255)
crystal = (162,162,162)
black = (0, 0, 0)
rose = (236,28,115)
red = pygame.Color('#ff0000')
green = pygame.Color('#00ff62')
blue = pygame.Color('#0026ff')
yellow = (222,207,... | 28.186104 | 158 | 0.601726 | import pygame, time
from pygame.locals import *
from random import *
pygame.init()
white = (255, 255, 255)
crystal = (162,162,162)
black = (0, 0, 0)
rose = (236,28,115)
red = pygame.Color('#ff0000')
green = pygame.Color('#00ff62')
blue = pygame.Color('#0026ff')
yellow = (222,207,4)
width = 800
he... | true | true |
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 |
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 |
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.