hexsha stringlengths 40 40 | size int64 4 996k | ext stringclasses 8
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 4 996k | avg_line_length float64 1.33 58.2k | max_line_length int64 2 323k | alphanum_fraction float64 0 0.97 | content_no_comment stringlengths 0 946k | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7f4613700e79755fd22a4351d1131f23a104c76 | 253 | py | Python | classwork/05_01_2021/plt.py | Katsute/Baruch-CIS-3120-Assignments | 2cb470a7e3b7bf2d49da520fdff079f832624c06 | [
"CC0-1.0"
] | null | null | null | classwork/05_01_2021/plt.py | Katsute/Baruch-CIS-3120-Assignments | 2cb470a7e3b7bf2d49da520fdff079f832624c06 | [
"CC0-1.0"
] | null | null | null | classwork/05_01_2021/plt.py | Katsute/Baruch-CIS-3120-Assignments | 2cb470a7e3b7bf2d49da520fdff079f832624c06 | [
"CC0-1.0"
] | 1 | 2022-01-12T18:19:11.000Z | 2022-01-12T18:19:11.000Z | import matplotlib.pyplot as plt
import pandas as pd
x = [5, 2, 9, 4, 7]
y = [10, 5, 8, 4, 2]
plt.plot(x, y)
plt.show()
plt.bar(x, y)
plt.show()
plt.hist(x)
plt.show()
df = pd.DataFrame({'x': x, 'y': y})
df.plot('x', 'y', kind="scatter")
plt.show()
| 13.315789 | 35 | 0.573123 | import matplotlib.pyplot as plt
import pandas as pd
x = [5, 2, 9, 4, 7]
y = [10, 5, 8, 4, 2]
plt.plot(x, y)
plt.show()
plt.bar(x, y)
plt.show()
plt.hist(x)
plt.show()
df = pd.DataFrame({'x': x, 'y': y})
df.plot('x', 'y', kind="scatter")
plt.show()
| true | true |
f7f462936a168049d71b80aef6e95a105a250120 | 2,066 | py | Python | fairscale/optim/grad_scaler.py | jessijzhao/fairscale | d6a8fc6dadc5d5ab4e3ee3f42f8cd570d70d30ec | [
"Apache-2.0",
"BSD-3-Clause"
] | 6 | 2020-11-09T11:24:26.000Z | 2021-01-15T13:35:06.000Z | fairscale/optim/grad_scaler.py | jessijzhao/fairscale | d6a8fc6dadc5d5ab4e3ee3f42f8cd570d70d30ec | [
"Apache-2.0",
"BSD-3-Clause"
] | 1 | 2021-02-16T13:42:50.000Z | 2021-02-16T13:42:50.000Z | fairscale/optim/grad_scaler.py | jessijzhao/fairscale | d6a8fc6dadc5d5ab4e3ee3f42f8cd570d70d30ec | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from typing import Dict
import torch
from torch.cuda.amp import GradScaler as TorchGradScaler
import torch.distributed as dist... | 37.563636 | 116 | 0.712488 |
import logging
from typing import Dict
import torch
from torch.cuda.amp import GradScaler as TorchGradScaler
import torch.distributed as dist
from torch.optim import Optimizer
from .oss import OSS
class GradScaler(TorchGradScaler):
def _unscale_grads_(
self, optimizer: Optimizer, inv_scale: torch.T... | true | true |
f7f462e3193e9d12342db25d876628e4fc92b9ca | 4,282 | py | Python | backend/CodeSimilar/plot.py | Ridhii/SyncdSim | 4cd120e9f7d4db348d405db4608ef9c6f9499d01 | [
"BSD-3-Clause"
] | 50 | 2015-10-21T23:16:35.000Z | 2021-09-27T12:52:04.000Z | backend/CodeSimilar/plot.py | Ridhii/SyncdSim | 4cd120e9f7d4db348d405db4608ef9c6f9499d01 | [
"BSD-3-Clause"
] | 187 | 2015-01-08T22:24:54.000Z | 2020-04-17T17:23:50.000Z | backend/CodeSimilar/plot.py | Ridhii/SyncdSim | 4cd120e9f7d4db348d405db4608ef9c6f9499d01 | [
"BSD-3-Clause"
] | 25 | 2015-11-02T17:54:49.000Z | 2020-06-16T07:28:11.000Z | #!/usr/bin/env python
import os
import sys
sys.path.append(os.path.join(os.environ["CONTECH_HOME"], "scripts"))
import util
import subprocess
import shutil
import time
import datetime
import glob
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib as matplotlib
impor... | 31.955224 | 130 | 0.459832 |
import os
import sys
sys.path.append(os.path.join(os.environ["CONTECH_HOME"], "scripts"))
import util
import subprocess
import shutil
import time
import datetime
import glob
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib as matplotlib
import json
import math
im... | false | true |
f7f4641d5cc2b222475caef2c4a28b050470889b | 6,535 | py | Python | src/sage/categories/cw_complexes.py | fredstro/sage | c936d2cda81ec7ec3552a3bdb29c994b40d1bb24 | [
"BSL-1.0"
] | 2 | 2018-06-30T01:37:35.000Z | 2018-06-30T01:37:39.000Z | src/sage/categories/cw_complexes.py | boothby/sage | 1b1e6f608d1ef8ee664bb19e991efbbc68cbd51f | [
"BSL-1.0"
] | null | null | null | src/sage/categories/cw_complexes.py | boothby/sage | 1b1e6f608d1ef8ee664bb19e991efbbc68cbd51f | [
"BSL-1.0"
] | null | null | null | r"""
CW Complexes
"""
#*****************************************************************************
# Copyright (C) 2015 Travis Scrimshaw <tscrim at ucdavis.edu>
#
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/licenses/
#**********************************... | 30.25463 | 86 | 0.543688 |
from sage.misc.abstract_method import abstract_method
from sage.misc.cachefunc import cached_method
from sage.categories.category_singleton import Category_singleton
from sage.categories.category_with_axiom import CategoryWithAxiom
from sage.categories.sets_cat import Sets
class CWComplexes(Category_singleton):... | true | true |
f7f464b25b8b98e0e0a928116eefef17c121f027 | 12,734 | py | Python | ost/helpers/vector.py | AnglinaBhambra/OpenSarToolkit | b2d6562a77eea86b4c236cc14f81f73ff4e75c17 | [
"MIT"
] | null | null | null | ost/helpers/vector.py | AnglinaBhambra/OpenSarToolkit | b2d6562a77eea86b4c236cc14f81f73ff4e75c17 | [
"MIT"
] | null | null | null | ost/helpers/vector.py | AnglinaBhambra/OpenSarToolkit | b2d6562a77eea86b4c236cc14f81f73ff4e75c17 | [
"MIT"
] | null | null | null | import os
import sys
import json
from functools import partial
import osr
import ogr
import pyproj
import geopandas as gpd
from shapely.ops import transform
from shapely.wkt import loads
from shapely.geometry import Point, Polygon, mapping, shape
from fiona import collection
from fiona.crs import from_epsg
def get_... | 28.940909 | 120 | 0.598084 | import os
import sys
import json
from functools import partial
import osr
import ogr
import pyproj
import geopandas as gpd
from shapely.ops import transform
from shapely.wkt import loads
from shapely.geometry import Point, Polygon, mapping, shape
from fiona import collection
from fiona.crs import from_epsg
def get_... | true | true |
f7f4653ef1fedbd383fbf309cdb3cb4c7e7ab8d6 | 8,208 | py | Python | ceilometer/tests/alarm/test_notifier.py | rackerlabs/instrumented-ceilometer | 6ac5215ac0476120d9c99adcabc9cad0d32963da | [
"Apache-2.0"
] | 3 | 2021-04-18T00:37:48.000Z | 2021-07-21T10:20:11.000Z | ceilometer/tests/alarm/test_notifier.py | lexxito/monitoring | bec8dfb8d3610331c7ae5ec543e0b8da0948c164 | [
"Apache-2.0"
] | null | null | null | ceilometer/tests/alarm/test_notifier.py | lexxito/monitoring | bec8dfb8d3610331c7ae5ec543e0b8da0948c164 | [
"Apache-2.0"
] | null | null | null | # -*- encoding: utf-8 -*-
#
# Copyright © 2013 eNovance
#
# Author: Julien Danjou <julien@danjou.info>
#
# 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/... | 41.454545 | 79 | 0.58175 |
import urlparse
import mock
import requests
from ceilometer.alarm import service
from ceilometer.openstack.common import context
from ceilometer.openstack.common.fixture import config
from ceilometer.openstack.common import test
DATA_JSON = ('{"current": "ALARM", "alarm_id": "foobar",'
... | true | true |
f7f465ffcebce3e7751317b4e3674b66de601daa | 1,313 | py | Python | nipype/interfaces/freesurfer/tests/test_auto_WatershedSkullStrip.py | HussainAther/nipype | 7e33d086fd5cea6ef6de99ee3e35929c1d5730d4 | [
"Apache-2.0"
] | null | null | null | nipype/interfaces/freesurfer/tests/test_auto_WatershedSkullStrip.py | HussainAther/nipype | 7e33d086fd5cea6ef6de99ee3e35929c1d5730d4 | [
"Apache-2.0"
] | null | null | null | nipype/interfaces/freesurfer/tests/test_auto_WatershedSkullStrip.py | HussainAther/nipype | 7e33d086fd5cea6ef6de99ee3e35929c1d5730d4 | [
"Apache-2.0"
] | null | null | null | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..preprocess import WatershedSkullStrip
def test_WatershedSkullStrip_inputs():
input_map = dict(args=dict(argstr='%s',
),
brain_atlas=dict(argstr='-brain_atlas %s',
position=-4,
),
environ=dict(n... | 25.25 | 67 | 0.644326 |
from __future__ import unicode_literals
from ..preprocess import WatershedSkullStrip
def test_WatershedSkullStrip_inputs():
input_map = dict(args=dict(argstr='%s',
),
brain_atlas=dict(argstr='-brain_atlas %s',
position=-4,
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_ex... | true | true |
f7f466bd72a0eaa0a511aa3d25a842958c9c502b | 94,414 | py | Python | selfdrive/car/toyota/values.py | birdman6450/openpilot | 2429f86bed65cca163122ac9f7a0c1d53597d463 | [
"MIT"
] | 1 | 2021-01-12T01:38:25.000Z | 2021-01-12T01:38:25.000Z | selfdrive/car/toyota/values.py | birdman6450/openpilot | 2429f86bed65cca163122ac9f7a0c1d53597d463 | [
"MIT"
] | null | null | null | selfdrive/car/toyota/values.py | birdman6450/openpilot | 2429f86bed65cca163122ac9f7a0c1d53597d463 | [
"MIT"
] | null | null | null | # flake8: noqa
from cereal import car
from selfdrive.car import dbc_dict
from selfdrive.config import Conversions as CV
Ecu = car.CarParams.Ecu
MIN_ACC_SPEED = 19. * CV.MPH_TO_MS
PEDAL_HYST_GAP = 3. * CV.MPH_TO_MS
class CarControllerParams:
ACCEL_HYST_GAP = 0.02 # don't change accel command for small oscilalitons... | 56.603118 | 1,108 | 0.61368 |
from cereal import car
from selfdrive.car import dbc_dict
from selfdrive.config import Conversions as CV
Ecu = car.CarParams.Ecu
MIN_ACC_SPEED = 19. * CV.MPH_TO_MS
PEDAL_HYST_GAP = 3. * CV.MPH_TO_MS
class CarControllerParams:
ACCEL_HYST_GAP = 0.02
ACCEL_MAX = 2.0 # m/s2
ACCEL_MIN = -3.5 # m/s2
ACCEL_SCA... | true | true |
f7f467cd151229f394535966299954701d485511 | 1,216 | py | Python | staffs/urls.py | Landgate/Staff-Calibration | d4a929526604e4de086e3d7f8783ea66a68b4ece | [
"Apache-2.0"
] | 1 | 2021-11-23T05:48:41.000Z | 2021-11-23T05:48:41.000Z | staffs/urls.py | Landgate/Staff-Calibration | d4a929526604e4de086e3d7f8783ea66a68b4ece | [
"Apache-2.0"
] | null | null | null | staffs/urls.py | Landgate/Staff-Calibration | d4a929526604e4de086e3d7f8783ea66a68b4ece | [
"Apache-2.0"
] | null | null | null | from django.urls import path
from . import views
app_name = 'staffs'
urlpatterns = [
# path('', views.index, name='home-page'),
path('', views.staff_list, name = 'staff-list'),
path('stafftype/', views.stafftype_list, name = 'stafftype-list'),
path('levels/', views.level_list, name = 'level-list'),
... | 46.769231 | 85 | 0.667763 | from django.urls import path
from . import views
app_name = 'staffs'
urlpatterns = [
path('', views.staff_list, name = 'staff-list'),
path('stafftype/', views.stafftype_list, name = 'stafftype-list'),
path('levels/', views.level_list, name = 'level-list'),
path('stafftype_create/', views.staffty... | true | true |
f7f4682bb1ff9d2905f7276a06d5ff73ee1451f3 | 618 | py | Python | HomeComponents/PathImage.py | Snake-GGJJWP/osr2mp4-app | cee93a29ed6b426b33e5d849b8679075cc60456b | [
"MIT"
] | null | null | null | HomeComponents/PathImage.py | Snake-GGJJWP/osr2mp4-app | cee93a29ed6b426b33e5d849b8679075cc60456b | [
"MIT"
] | null | null | null | HomeComponents/PathImage.py | Snake-GGJJWP/osr2mp4-app | cee93a29ed6b426b33e5d849b8679075cc60456b | [
"MIT"
] | null | null | null | from PyQt5.QtWidgets import QLabel
from Parents import Button, PathImage
class OsrPath(PathImage):
def __init__(self, parent):
super(OsrPath, self).__init__(parent)
self.default_x = 544
self.default_y = 165
self.default_size = 4.5
self.img = "res/OsrPath.png"
self.img_shadow = "res/OsrPath_Shadow.png"... | 19.3125 | 47 | 0.721683 | from PyQt5.QtWidgets import QLabel
from Parents import Button, PathImage
class OsrPath(PathImage):
def __init__(self, parent):
super(OsrPath, self).__init__(parent)
self.default_x = 544
self.default_y = 165
self.default_size = 4.5
self.img = "res/OsrPath.png"
self.img_shadow = "res/OsrPath_Shadow.png"... | true | true |
f7f468a38ca608590b664dbccab5f34a070f450e | 2,315 | py | Python | dependencies/amitools-0.1.0/amitools/vamos/lib/lexec/SemaphoreManager.py | limi/AGSImager | d3771800308e61a7a07df4a9b361e5bd5ba9e409 | [
"MIT"
] | null | null | null | dependencies/amitools-0.1.0/amitools/vamos/lib/lexec/SemaphoreManager.py | limi/AGSImager | d3771800308e61a7a07df4a9b361e5bd5ba9e409 | [
"MIT"
] | null | null | null | dependencies/amitools-0.1.0/amitools/vamos/lib/lexec/SemaphoreManager.py | limi/AGSImager | d3771800308e61a7a07df4a9b361e5bd5ba9e409 | [
"MIT"
] | null | null | null | from ExecStruct import SignalSemaphoreDef
from amitools.vamos.AccessStruct import AccessStruct
from amitools.vamos.Exceptions import *
class SemaphoreManager:
NT_SIGNALSEM = 15
def __init__(self, alloc, mem):
self.alloc = alloc
self.mem = mem
self.semaphores = {}
self.semaphores_by_name = {... | 30.460526 | 92 | 0.708423 | from ExecStruct import SignalSemaphoreDef
from amitools.vamos.AccessStruct import AccessStruct
from amitools.vamos.Exceptions import *
class SemaphoreManager:
NT_SIGNALSEM = 15
def __init__(self, alloc, mem):
self.alloc = alloc
self.mem = mem
self.semaphores = {}
self.semaphores_by_name = {... | true | true |
f7f46912996ab22bb0a1986cf67d8293a3079047 | 364 | py | Python | _bak/v0.2.0/Util/Message.py | hello-sea/DeepLearning_Wavelet-LSTM | 1606c16005a5338333b4943f782f57311c6b5e49 | [
"MIT"
] | 95 | 2018-04-13T03:34:51.000Z | 2022-03-30T10:10:28.000Z | _bak/v0.2.0/Util/Message.py | Dlaiven/DeepLearning_Wavelet-LSTM | 1606c16005a5338333b4943f782f57311c6b5e49 | [
"MIT"
] | 3 | 2019-07-18T11:19:53.000Z | 2020-12-28T05:45:19.000Z | _bak/v0.2.0/Util/Message.py | Dlaiven/DeepLearning_Wavelet-LSTM | 1606c16005a5338333b4943f782f57311c6b5e49 | [
"MIT"
] | 35 | 2018-07-27T09:21:18.000Z | 2021-11-30T02:13:01.000Z | # -*- coding: utf-8 -*-
class Message():
def __init__(self):
self.dict = {
# 正常
0 : '0',
# 软件运行错误
'Error(0001)': 'Error(0001): 软件运行错误,请连续管理员!',
# 文件数据错误
'Error(1000)': 'Error(1000): Seg文件读取错误,请检测Seg数据!',
'Error(1001)': 'Er... | 22.75 | 62 | 0.442308 |
class Message():
def __init__(self):
self.dict = {
0 : '0',
'Error(0001)': 'Error(0001): 软件运行错误,请连续管理员!',
'Error(1000)': 'Error(1000): Seg文件读取错误,请检测Seg数据!',
'Error(1001)': 'Error(1001): Seg文件数据为空,请检测Seg数据!',
}
... | true | true |
f7f469142409e4dc1d3fc30988bf4b7a4cbd4538 | 1,231 | py | Python | analyze_results.py | tawatts1/chess | cb2917ec689bb8db1dc2436ed2ef6463319876a7 | [
"MIT"
] | null | null | null | analyze_results.py | tawatts1/chess | cb2917ec689bb8db1dc2436ed2ef6463319876a7 | [
"MIT"
] | null | null | null | analyze_results.py | tawatts1/chess | cb2917ec689bb8db1dc2436ed2ef6463319876a7 | [
"MIT"
] | null | null | null | import os
import numpy as np
import matplotlib.pyplot as plt
def get_data(fname):
out = []
with open(fname, 'r') as f:
for line in f:
datum = []
for entry in line.split(','):
datum.append(float(entry))
out.append(datum)
return np.array(out... | 29.309524 | 133 | 0.538587 | import os
import numpy as np
import matplotlib.pyplot as plt
def get_data(fname):
out = []
with open(fname, 'r') as f:
for line in f:
datum = []
for entry in line.split(','):
datum.append(float(entry))
out.append(datum)
return np.array(out... | true | true |
f7f469558fc3165e13feacf537a2a5e512eb5e76 | 81,670 | py | Python | ironic/tests/unit/common/test_pxe_utils.py | mpardhi23/ironic | 66b07398310db1b4c26e1ba9fda247328478ed67 | [
"Apache-2.0"
] | null | null | null | ironic/tests/unit/common/test_pxe_utils.py | mpardhi23/ironic | 66b07398310db1b4c26e1ba9fda247328478ed67 | [
"Apache-2.0"
] | null | null | null | ironic/tests/unit/common/test_pxe_utils.py | mpardhi23/ironic | 66b07398310db1b4c26e1ba9fda247328478ed67 | [
"Apache-2.0"
] | null | null | null | #
# Copyright 2014 Rackspace, 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 ... | 47.399884 | 79 | 0.598335 |
import os
import tempfile
from ironic_lib import utils as ironic_utils
import mock
from oslo_config import cfg
from oslo_utils import fileutils
from oslo_utils import uuidutils
import six
from ironic.common import exception
from ironic.common.glance_service import image_service
from ironic.common impo... | true | true |
f7f46a8e28a98db46b887ffca14b7e6f5f918a8d | 177 | py | Python | pretrain/contrastive_scene_contexts/model/modules/__init__.py | ut-amrl/ContrastiveSceneContexts | 622b9cd32ea2dcf8307d25eb2e7ee1c09d220134 | [
"MIT"
] | 135 | 2021-05-25T00:07:04.000Z | 2022-03-24T02:52:22.000Z | pretrain/contrastive_scene_contexts/model/modules/__init__.py | ut-amrl/ContrastiveSceneContexts | 622b9cd32ea2dcf8307d25eb2e7ee1c09d220134 | [
"MIT"
] | 25 | 2021-06-17T03:45:44.000Z | 2022-03-04T16:04:42.000Z | pretrain/contrastive_scene_contexts/model/modules/__init__.py | ut-amrl/ContrastiveSceneContexts | 622b9cd32ea2dcf8307d25eb2e7ee1c09d220134 | [
"MIT"
] | 21 | 2021-05-25T07:52:36.000Z | 2022-02-18T06:10:45.000Z | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree. | 44.25 | 65 | 0.757062 | true | true | |
f7f46adee8d9df42744c92d77b1d2dee52160b78 | 21,286 | py | Python | Opioid_app_backend/medication.py | drwitt/Mayo_Clinic_Opioid_Taper_Project | d816f01d7ad592ee2ff7ee54df960a536f38dcd1 | [
"Apache-2.0"
] | null | null | null | Opioid_app_backend/medication.py | drwitt/Mayo_Clinic_Opioid_Taper_Project | d816f01d7ad592ee2ff7ee54df960a536f38dcd1 | [
"Apache-2.0"
] | null | null | null | Opioid_app_backend/medication.py | drwitt/Mayo_Clinic_Opioid_Taper_Project | d816f01d7ad592ee2ff7ee54df960a536f38dcd1 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 6 11:05:22 2019
@author: dannywitt
"""
class Medication:
def __init__(self,
med_name,
combination_state,
combination_drug_unit_doses,
delivery_rate,
drug... | 42.40239 | 81 | 0.496242 |
class Medication:
def __init__(self,
med_name,
combination_state,
combination_drug_unit_doses,
delivery_rate,
drug_delivery_form,
available_opioid_doses,
available_combination_doses,
... | true | true |
f7f46b73f8b40ac7cae2436f27742acbd9ecce21 | 1,640 | py | Python | byslib/data/cumulative_sum.py | bayashi-cl/byslib-python | d7cbb1cb75904e85c353227def7c99a2bceea12c | [
"CC0-1.0"
] | null | null | null | byslib/data/cumulative_sum.py | bayashi-cl/byslib-python | d7cbb1cb75904e85c353227def7c99a2bceea12c | [
"CC0-1.0"
] | null | null | null | byslib/data/cumulative_sum.py | bayashi-cl/byslib-python | d7cbb1cb75904e85c353227def7c99a2bceea12c | [
"CC0-1.0"
] | null | null | null | # @title Cumulative Sum
from itertools import chain
from typing import List
class CumulativeSum:
"""Cumulative Sum
Notes
-----
Get sum of semi-open interval [left, right)
Time complexity
* Build : :math:`O(N)`
* fold : :math:`O(1)`
Examples
--------
>>> cs = CumulativeSum([3... | 23.098592 | 69 | 0.472561 |
from itertools import chain
from typing import List
class CumulativeSum:
def __init__(self, data: List[int]) -> None:
n = len(data)
self.__data = [0] * (n + 1)
for i in range(n):
self.__data[i + 1] = self.__data[i] + data[i]
def fold(self, left: int, right: int) -> int:
... | true | true |
f7f46bbf8aeafd461462c8bacebf43e0f81464aa | 5,681 | py | Python | curve25519.py | jake-b/burstcoin-python-wallet | b54be463a9cdf44ff4d0cd238b336b50500399a7 | [
"MIT"
] | 5 | 2018-04-07T10:57:32.000Z | 2019-10-08T11:15:07.000Z | curve25519.py | jake-b/burstcoin-python-wallet | b54be463a9cdf44ff4d0cd238b336b50500399a7 | [
"MIT"
] | null | null | null | curve25519.py | jake-b/burstcoin-python-wallet | b54be463a9cdf44ff4d0cd238b336b50500399a7 | [
"MIT"
] | null | null | null | # a pedagogical implementation of curve25519 with ec-kcdsa
# coded by doctorevil to validate nxt's port of Matthijs van Duin's implementation
# warning: this implementation is not timing attack resistant
# ec arithmetic equations from http://hyperelliptic.org/EFD/g1p/auto-montgom.html
# Modified slightly to support ... | 36.88961 | 108 | 0.662559 |
from hashlib import sha256
from ecdsa.numbertheory import square_root_mod_prime, SquareRootError, inverse_mod
CURVE_P = 2**255 - 19
CURVE_A = 486662
CURVE_ORDER = 7237005577332262213973186563042994240857116359379907606001950938285454250989
CURVE_G_X = 9
CURVE_G_Y = 147816194475895447910205935... | true | true |
f7f46bf020511a4f03524af47070176c37123866 | 955 | py | Python | designate/objects/quota.py | infobloxopen/designate | 531a28b8453cfe5641284a16e0342db8d709ab36 | [
"Apache-2.0"
] | null | null | null | designate/objects/quota.py | infobloxopen/designate | 531a28b8453cfe5641284a16e0342db8d709ab36 | [
"Apache-2.0"
] | null | null | null | designate/objects/quota.py | infobloxopen/designate | 531a28b8453cfe5641284a16e0342db8d709ab36 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2014 Rackspace Hosting
# 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 req... | 32.931034 | 78 | 0.701571 |
from designate.objects import base
class Quota(base.DictObjectMixin, base.PersistentObjectMixin,
base.DesignateObject):
FIELDS = {
'tenant_id': {},
'resource': {},
'hard_limit': {}
}
class QuotaList(base.ListObjectMixin, base.DesignateObject):
LIST_ITEM_... | true | true |
f7f46c9071b1a13cfedc915a4492e1bb29c96c39 | 9,918 | py | Python | NAA/web.py | AlbertUnruh/NAA-API | c2e79c01951b4fb2ae4b4e4f6d27f544891bd5a0 | [
"MIT"
] | null | null | null | NAA/web.py | AlbertUnruh/NAA-API | c2e79c01951b4fb2ae4b4e4f6d27f544891bd5a0 | [
"MIT"
] | null | null | null | NAA/web.py | AlbertUnruh/NAA-API | c2e79c01951b4fb2ae4b4e4f6d27f544891bd5a0 | [
"MIT"
] | null | null | null | import typing
from werkzeug.serving import run_simple
from werkzeug.wrappers import Request, Response
from json import dumps
from warnings import warn
from .models import Node, APIRequest, APIResponse
__all__ = (
"API",
"HTTP_METHODS",
"ALLOWED_LIBS",
)
HTTP_METHODS = [
"GET",
"HEAD",
"POS... | 27.626741 | 98 | 0.527022 | import typing
from werkzeug.serving import run_simple
from werkzeug.wrappers import Request, Response
from json import dumps
from warnings import warn
from .models import Node, APIRequest, APIResponse
__all__ = (
"API",
"HTTP_METHODS",
"ALLOWED_LIBS",
)
HTTP_METHODS = [
"GET",
"HEAD",
"POS... | true | true |
f7f46e2b3c6e42b33eb61ceb086623c097b17c00 | 21,617 | py | Python | pvpn/crypto.py | qwj/python-vpn | b09e4ab180e3cb4c6b480e9693e8f19854c7b6ec | [
"MIT"
] | 125 | 2018-12-25T12:18:55.000Z | 2022-03-26T17:56:31.000Z | pvpn/crypto.py | Open-ATS-Github/python-vpn | b09e4ab180e3cb4c6b480e9693e8f19854c7b6ec | [
"MIT"
] | 6 | 2019-01-08T09:12:28.000Z | 2022-01-11T15:39:24.000Z | pvpn/crypto.py | Open-ATS-Github/python-vpn | b09e4ab180e3cb4c6b480e9693e8f19854c7b6ec | [
"MIT"
] | 36 | 2018-12-29T15:40:12.000Z | 2022-03-25T21:37:04.000Z | import hashlib, os, random, hmac
from Crypto.Cipher import AES, ChaCha20_Poly1305
from . import enums
class Prf:
DIGESTS_1 = {
enums.HashId_1.MD5: (hashlib.md5, 16),
enums.HashId_1.SHA: (hashlib.sha1, 20),
enums.HashId_1.SHA2_256: (hashlib.sha256, 32),
enums.HashId_1.SHA2_384: (hash... | 96.075556 | 2,084 | 0.825554 | import hashlib, os, random, hmac
from Crypto.Cipher import AES, ChaCha20_Poly1305
from . import enums
class Prf:
DIGESTS_1 = {
enums.HashId_1.MD5: (hashlib.md5, 16),
enums.HashId_1.SHA: (hashlib.sha1, 20),
enums.HashId_1.SHA2_256: (hashlib.sha256, 32),
enums.HashId_1.SHA2_384: (hash... | true | true |
f7f46e4ff4964d7d39f36c9ec844a49fda3d2b4d | 3,051 | py | Python | test/functional/rpc_deprecated.py | tngc-one/tngcoin | 1382521c4f897cf798e840fee2ce9abd70bbb99b | [
"MIT"
] | null | null | null | test/functional/rpc_deprecated.py | tngc-one/tngcoin | 1382521c4f897cf798e840fee2ce9abd70bbb99b | [
"MIT"
] | null | null | null | test/functional/rpc_deprecated.py | tngc-one/tngcoin | 1382521c4f897cf798e840fee2ce9abd70bbb99b | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2017-2019 The TNGC Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test deprecation of RPC calls."""
from test_framework.test_framework import TNGCTestFramework
from test_fr... | 50.016393 | 254 | 0.6588 |
from test_framework.test_framework import TNGCTestFramework
from test_framework.util import assert_raises_rpc_error, find_vout_for_address
class DeprecatedRpcTest(TNGCTestFramework):
def set_test_params(self):
self.num_nodes = 2
self.setup_clean_chain = True
self.extra_args = [[], ['-de... | true | true |
f7f46eaef097dec88622d986d7af48ad362ccfca | 3,141 | py | Python | python_modules/libraries/dagster-dbt/dagster_dbt/rpc/utils.py | asamoal/dagster | 08fad28e4b608608ce090ce2e8a52c2cf9dd1b64 | [
"Apache-2.0"
] | null | null | null | python_modules/libraries/dagster-dbt/dagster_dbt/rpc/utils.py | asamoal/dagster | 08fad28e4b608608ce090ce2e8a52c2cf9dd1b64 | [
"Apache-2.0"
] | null | null | null | python_modules/libraries/dagster-dbt/dagster_dbt/rpc/utils.py | asamoal/dagster | 08fad28e4b608608ce090ce2e8a52c2cf9dd1b64 | [
"Apache-2.0"
] | null | null | null | import logging
from collections import defaultdict
from enum import Enum
from typing import Dict, List
from requests import Response
from requests.exceptions import RequestException
from dagster import Failure, RetryRequested
from dagster.core.execution.context.compute import SolidExecutionContext
def fmt_rpc_logs(... | 36.103448 | 80 | 0.590895 | import logging
from collections import defaultdict
from enum import Enum
from typing import Dict, List
from requests import Response
from requests.exceptions import RequestException
from dagster import Failure, RetryRequested
from dagster.core.execution.context.compute import SolidExecutionContext
def fmt_rpc_logs(... | true | true |
f7f46eb2d5ae6aec92a804bbec911097120e9188 | 581 | py | Python | first_site/blog/migrations/0001_initial.py | babu-thomas/django-tutorial | 9f650f50ec481ffbac051760f5117ba8ce3b7101 | [
"MIT"
] | null | null | null | first_site/blog/migrations/0001_initial.py | babu-thomas/django-tutorial | 9f650f50ec481ffbac051760f5117ba8ce3b7101 | [
"MIT"
] | null | null | null | first_site/blog/migrations/0001_initial.py | babu-thomas/django-tutorial | 9f650f50ec481ffbac051760f5117ba8ce3b7101 | [
"MIT"
] | null | null | null | # Generated by Django 2.0.2 on 2018-02-14 09:02
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Post',
fields=[
('id', models.AutoField(aut... | 24.208333 | 114 | 0.550775 |
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Post',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=Fal... | true | true |
f7f46f7e353ff8dfc8217b04b6e66ca2847063d8 | 2,873 | py | Python | Battle/Monsters.py | micro164/AdvGame | cf27f86b5773b97de195596c512879f9e8be1a04 | [
"MIT"
] | 3 | 2017-12-31T02:41:34.000Z | 2018-02-18T23:56:44.000Z | Battle/Monsters.py | micro164/AdvGame | cf27f86b5773b97de195596c512879f9e8be1a04 | [
"MIT"
] | null | null | null | Battle/Monsters.py | micro164/AdvGame | cf27f86b5773b97de195596c512879f9e8be1a04 | [
"MIT"
] | null | null | null | from Classes.Classes import Player
from Classes.Classes import Monster
# Stats for monsters
# 0-HP, 1-attack, 2-defense, 3-exp, 4.lvl, 5.MaxHP
Monsters = {'rat': list((50, 12, 7, 10, 1, 50)),
'Wild Chicken': list((40, 10, 5, 5, 1, 10)),
'Spi... | 58.632653 | 83 | 0.405848 | from Classes.Classes import Player
from Classes.Classes import Monster
Monsters = {'rat': list((50, 12, 7, 10, 1, 50)),
'Wild Chicken': list((40, 10, 5, 5, 1, 10)),
'Spider': list((65, 15, 10, 15, 3, 25)),
... | true | true |
f7f4707e31db79b9223f44141a5bb02dc06f3d78 | 1,089 | py | Python | generate_matrix_pairs/create_random_matrix.py | bentondrew/demo_software | 33c9bc9c0fc94b9c7910f7c1f348d5282546c845 | [
"Apache-2.0"
] | null | null | null | generate_matrix_pairs/create_random_matrix.py | bentondrew/demo_software | 33c9bc9c0fc94b9c7910f7c1f348d5282546c845 | [
"Apache-2.0"
] | null | null | null | generate_matrix_pairs/create_random_matrix.py | bentondrew/demo_software | 33c9bc9c0fc94b9c7910f7c1f348d5282546c845 | [
"Apache-2.0"
] | null | null | null | # Copyright 2016
# Drewan Tech, LLC
# ALL RIGHTS RESERVED
def create_matrix(number_of_rows,
number_of_columns,
scaling_factor):
"""Will create a matrix with the given size. The random numbers generated
will be in the range of 0 to the scaling factor.
"""
import random
... | 36.3 | 77 | 0.678604 |
def create_matrix(number_of_rows,
number_of_columns,
scaling_factor):
import random
from drewantech_common.value_checks import is_number_type_not_complex
if type(number_of_rows) is not int:
raise TypeError('Number of rows arg passed to create_matrix function is '
... | true | true |
f7f47179de699961d9f8b77e8fa295cf2e988277 | 406 | py | Python | secrets.py | jimbobbennett/mandmcounter | 1edc39d42e0cd8249695a7f6397675b3291957bb | [
"MIT"
] | 1 | 2021-08-16T07:25:43.000Z | 2021-08-16T07:25:43.000Z | secrets.py | jimbobbennett/mandmcounter | 1edc39d42e0cd8249695a7f6397675b3291957bb | [
"MIT"
] | 2 | 2020-04-30T16:46:24.000Z | 2020-04-30T16:46:51.000Z | secrets.py | jimbobbennett/mandmcounter | 1edc39d42e0cd8249695a7f6397675b3291957bb | [
"MIT"
] | null | null | null | # This file is where you keep secret settings, passwords, and tokens!
# If you put them in the code you risk committing that info or sharing it
# which would be not great. So, instead, keep it all in this one file and
# keep it a secret.
secrets = {
'ssid' : '<ssid>',
'password' : '<password>',
'prediction... | 33.833333 | 73 | 0.67734 |
secrets = {
'ssid' : '<ssid>',
'password' : '<password>',
'prediction_key' : '<prediction_key>',
'prediction_endpoint' : '<prediction_endpoint>'
}
| true | true |
f7f471983f80ead50724ee0c4ebf677c8cdf1a09 | 1,659 | py | Python | catalyst/rl/scripts/dump_redis.py | Felix-neko/catalyst | df80986f1c12ef6a3776637453a0c04aaef0068c | [
"Apache-2.0"
] | 1 | 2022-03-13T21:40:17.000Z | 2022-03-13T21:40:17.000Z | catalyst/rl/scripts/dump_redis.py | Felix-neko/catalyst | df80986f1c12ef6a3776637453a0c04aaef0068c | [
"Apache-2.0"
] | null | null | null | catalyst/rl/scripts/dump_redis.py | Felix-neko/catalyst | df80986f1c12ef6a3776637453a0c04aaef0068c | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
import argparse
import pickle
from tqdm import tqdm
from redis import Redis
from catalyst import utils
def build_args(parser):
parser.add_argument("--host", type=str, default="127.0.0.1")
parser.add_argument("--port", type=int, default=12000)
parser.add_argument("--out-pkl", type=st... | 29.105263 | 67 | 0.639542 |
import argparse
import pickle
from tqdm import tqdm
from redis import Redis
from catalyst import utils
def build_args(parser):
parser.add_argument("--host", type=str, default="127.0.0.1")
parser.add_argument("--port", type=int, default=12000)
parser.add_argument("--out-pkl", type=str, required=True)
... | true | true |
f7f472f1f362d209cfc3f18e5f76d0bcbdb75c33 | 15,792 | py | Python | test/hummingbot/strategy/dev_simple_trade/test_simple_trade.py | joedomino874/hummingbot | cb3ee5a30a2feb0a55ceca9d200c59662d7e3057 | [
"Apache-2.0"
] | 3,027 | 2019-04-04T18:52:17.000Z | 2022-03-30T09:38:34.000Z | test/hummingbot/strategy/dev_simple_trade/test_simple_trade.py | joedomino874/hummingbot | cb3ee5a30a2feb0a55ceca9d200c59662d7e3057 | [
"Apache-2.0"
] | 4,080 | 2019-04-04T19:51:11.000Z | 2022-03-31T23:45:21.000Z | test/hummingbot/strategy/dev_simple_trade/test_simple_trade.py | joedomino874/hummingbot | cb3ee5a30a2feb0a55ceca9d200c59662d7e3057 | [
"Apache-2.0"
] | 1,342 | 2019-04-04T20:50:53.000Z | 2022-03-31T15:22:36.000Z | #!/usr/bin/env python
from hummingbot.strategy.market_trading_pair_tuple import MarketTradingPairTuple
from decimal import Decimal
import logging; logging.basicConfig(level=logging.ERROR)
import pandas as pd
from typing import List
import unittest
from hummingbot.core.clock import (
Clock,
ClockMode
)
from humm... | 49.35 | 117 | 0.670276 |
from hummingbot.strategy.market_trading_pair_tuple import MarketTradingPairTuple
from decimal import Decimal
import logging; logging.basicConfig(level=logging.ERROR)
import pandas as pd
from typing import List
import unittest
from hummingbot.core.clock import (
Clock,
ClockMode
)
from hummingbot.core.event.eve... | true | true |
f7f473a09d9667c168457528d798080dfdbdb6d7 | 1,539 | py | Python | updaterjob.py | bzaczynski/autoautelion | 5f60b74c64eb29d162b0ba8c2f3386e24bb7a11b | [
"MIT"
] | null | null | null | updaterjob.py | bzaczynski/autoautelion | 5f60b74c64eb29d162b0ba8c2f3386e24bb7a11b | [
"MIT"
] | 4 | 2018-12-27T13:32:30.000Z | 2021-04-21T14:19:33.000Z | updaterjob.py | bzaczynski/autoautelion | 5f60b74c64eb29d162b0ba8c2f3386e24bb7a11b | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""
Parse Autelion, update Redis and send notification via email if necessary.
Usage:
$ export AUTELION_USERNAME=<your-username>
$ export AUTELION_PASSWORD=<your-password>
$ export REDIS_URL=redis://localhost
$ export SENDGRID_API_KEY=<your-api-key>
$ export EMAIL_ADDRESS=<your-email>
$ python u... | 26.084746 | 74 | 0.610136 |
import os
import logging
import cache
import parser
import mailer
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def main():
logger.info('Updater job started')
try:
status = parser.parse_autelion()
if status is None:
logger.error('Updater job f... | true | true |
f7f474576db9fc12c99ece1134fc7235cb750c99 | 37,459 | py | Python | luna/gateware/interface/ulpi.py | ktemkin/luna | 661dc89f7f60ba8a51165f7f8037ad2d5854cf34 | [
"BSD-3-Clause"
] | 4 | 2020-02-11T18:40:02.000Z | 2020-04-03T13:07:38.000Z | luna/gateware/interface/ulpi.py | ktemkin/luna | 661dc89f7f60ba8a51165f7f8037ad2d5854cf34 | [
"BSD-3-Clause"
] | null | null | null | luna/gateware/interface/ulpi.py | ktemkin/luna | 661dc89f7f60ba8a51165f7f8037ad2d5854cf34 | [
"BSD-3-Clause"
] | null | null | null | # nmigen: UnusedElaboratable=no
#
# This file is part of LUNA.
#
""" ULPI interfacing hardware. """
from nmigen import Signal, Module, Cat, Elaboratable, ClockSignal, Record, ResetSignal, Const
import unittest
from nmigen.back.pysim import Simulator
from ..test import LunaGatewareTestCase, ulpi_domain_test_case, sy... | 38.106816 | 117 | 0.602419 |
from nmigen import Signal, Module, Cat, Elaboratable, ClockSignal, Record, ResetSignal, Const
import unittest
from nmigen.back.pysim import Simulator
from ..test import LunaGatewareTestCase, ulpi_domain_test_case, sync_test_case
from ..utils import rising_edge_detector, falling_edge_detector
class ULPIRegist... | true | true |
f7f4749dcf3bfc4f04d3741a736ed87925969e4b | 193 | py | Python | examples_elo_ratings/latex_cov_elo_ratings_2.py | MarcoGorelli/precise | 227d017d45f1c4b39887a85133f3d62950a1e341 | [
"MIT"
] | 40 | 2022-01-13T00:40:59.000Z | 2022-03-31T20:33:19.000Z | examples_elo_ratings/latex_cov_elo_ratings_2.py | MarcoGorelli/precise | 227d017d45f1c4b39887a85133f3d62950a1e341 | [
"MIT"
] | 14 | 2022-01-08T16:00:12.000Z | 2022-03-16T00:12:04.000Z | examples_elo_ratings/latex_cov_elo_ratings_2.py | MarcoGorelli/precise | 227d017d45f1c4b39887a85133f3d62950a1e341 | [
"MIT"
] | 9 | 2022-01-26T21:14:43.000Z | 2022-03-21T17:32:02.000Z | from precise.skatervaluation.battlelatex.tables import elo_latex_table
if __name__=='__main__':
ltx = elo_latex_table(genre='manager_var',category='stocks_20_days_p2_n60')
print(ltx) | 38.6 | 80 | 0.792746 | from precise.skatervaluation.battlelatex.tables import elo_latex_table
if __name__=='__main__':
ltx = elo_latex_table(genre='manager_var',category='stocks_20_days_p2_n60')
print(ltx) | true | true |
f7f474efa1179d1343e1690744401425b2e9ed31 | 783 | py | Python | unit_tests/python_lib/test_create_roles_cf.py | adrianmkng/watchmen | 4be15ad64a5d54d4f546ca8c139fa41fd42dd6aa | [
"Apache-2.0"
] | 190 | 2017-12-13T05:01:42.000Z | 2021-11-15T23:35:54.000Z | unit_tests/python_lib/test_create_roles_cf.py | adrianmkng/watchmen | 4be15ad64a5d54d4f546ca8c139fa41fd42dd6aa | [
"Apache-2.0"
] | 2 | 2018-08-31T04:53:03.000Z | 2018-11-14T00:13:49.000Z | unit_tests/python_lib/test_create_roles_cf.py | adrianmkng/watchmen | 4be15ad64a5d54d4f546ca8c139fa41fd42dd6aa | [
"Apache-2.0"
] | 22 | 2017-12-13T04:36:46.000Z | 2021-07-29T07:37:41.000Z | # Copyright 2017 Insurance Australia Group Limited
#
# 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 ag... | 37.285714 | 74 | 0.780332 |
from mock import patch
import python_lib.create_roles_cf as roles_cf
@patch("python_lib.get_accounts.get_accounts")
def test_main(mock_get_accounts):
assert roles_cf.main() is None
| true | true |
f7f4752faa807dd34b3fca8daacd73ca74bacc7b | 2,486 | py | Python | linear.py | jasonrobwebster/sampling-importance-resampling-example | 250e54815f73ccf071a4dad8d62a2bd7ec38c0c2 | [
"MIT"
] | null | null | null | linear.py | jasonrobwebster/sampling-importance-resampling-example | 250e54815f73ccf071a4dad8d62a2bd7ec38c0c2 | [
"MIT"
] | null | null | null | linear.py | jasonrobwebster/sampling-importance-resampling-example | 250e54815f73ccf071a4dad8d62a2bd7ec38c0c2 | [
"MIT"
] | null | null | null | import numpy as np
from scipy.special import softmax
import seaborn as sns
import matplotlib.pyplot as plt
if __name__ == '__main__':
data_size = 100
true_grad = 3
true_intercept = 1
true_sig = 1
x = np.linspace(0, 10, data_size)
# y = m x + c
y_obs = true_grad * x + true_intercept + np.ra... | 37.666667 | 116 | 0.65889 | import numpy as np
from scipy.special import softmax
import seaborn as sns
import matplotlib.pyplot as plt
if __name__ == '__main__':
data_size = 100
true_grad = 3
true_intercept = 1
true_sig = 1
x = np.linspace(0, 10, data_size)
y_obs = true_grad * x + true_intercept + np.random.normal(l... | true | true |
f7f475ab6e1f740c4c2b4435ac10911c22345637 | 1,637 | py | Python | Plateau/preprocess_image.py | RichardLeeK/CNM | a3c15cb0a0373d6ad03c5a815a7e020f90ab8522 | [
"Apache-2.0"
] | null | null | null | Plateau/preprocess_image.py | RichardLeeK/CNM | a3c15cb0a0373d6ad03c5a815a7e020f90ab8522 | [
"Apache-2.0"
] | null | null | null | Plateau/preprocess_image.py | RichardLeeK/CNM | a3c15cb0a0373d6ad03c5a815a7e020f90ab8522 | [
"Apache-2.0"
] | null | null | null | import numpy as np
from env import Env
def fill(image,x_idx,y_idx,bound,value):
if (x_idx<0) or (x_idx>=900):
return image
elif (y_idx<0) or (y_idx>=110):
return image
elif image[x_idx][y_idx]>=bound:
return image
else:
image[x_idx][y_idx]=value
return image
... | 32.74 | 80 | 0.661576 | import numpy as np
from env import Env
def fill(image,x_idx,y_idx,bound,value):
if (x_idx<0) or (x_idx>=900):
return image
elif (y_idx<0) or (y_idx>=110):
return image
elif image[x_idx][y_idx]>=bound:
return image
else:
image[x_idx][y_idx]=value
return image
... | true | true |
f7f47717f8bea61e7631353678087d94dea1474a | 9,039 | py | Python | test/test_conv_encoding.py | NVlabs/sionna | 488e6c3ff6ff2b3313d0ca0f94e4247b8dd6ff35 | [
"Apache-2.0"
] | 163 | 2022-03-22T19:47:47.000Z | 2022-03-31T23:56:45.000Z | test/test_conv_encoding.py | Maryammhsnv/sionna | 527d0f7866b379afffad34a6bef7ed3bf6f33ad2 | [
"Apache-2.0"
] | 2 | 2022-03-24T12:43:07.000Z | 2022-03-29T07:17:16.000Z | test/test_conv_encoding.py | Maryammhsnv/sionna | 527d0f7866b379afffad34a6bef7ed3bf6f33ad2 | [
"Apache-2.0"
] | 19 | 2022-03-23T02:31:22.000Z | 2022-03-30T06:35:12.000Z | #
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
try:
import sionna
except ImportError as e:
import sys
sys.path.append("../")
import unittest
import numpy as np
import tensorflow as tf
gpus = tf.config.list_phy... | 32.397849 | 146 | 0.538666 |
try:
import sionna
except ImportError as e:
import sys
sys.path.append("../")
import unittest
import numpy as np
import tensorflow as tf
gpus = tf.config.list_physical_devices('GPU')
print('Number of GPUs available :', len(gpus))
if gpus:
gpu_num = 0
try:
tf.config.set_visible_devices(g... | true | true |
f7f477391091346bfb78da2e8f38930aa03f7abf | 2,715 | py | Python | sky.py | cthulahoops/vrc3d | bc9b2e7c6cd4bfccb90385e8d33d893686bae9cf | [
"MIT"
] | 2 | 2021-06-28T16:04:25.000Z | 2021-06-30T05:03:37.000Z | sky.py | cthulahoops/vrc3d | bc9b2e7c6cd4bfccb90385e8d33d893686bae9cf | [
"MIT"
] | null | null | null | sky.py | cthulahoops/vrc3d | bc9b2e7c6cd4bfccb90385e8d33d893686bae9cf | [
"MIT"
] | 1 | 2021-06-29T16:45:56.000Z | 2021-06-29T16:45:56.000Z | from math import cos, sin, radians
from collections import namedtuple
from skyfield import api
from textures import Texture
from scene import Scene, Quad
from shader import Shader
from vector import Vector
from matrix import Matrix
# Bridge St
LONGITUDE = -73.985
LATITUDE = 39.6913
TS = api.load.timescale()
PLANETS... | 33.109756 | 118 | 0.692818 | from math import cos, sin, radians
from collections import namedtuple
from skyfield import api
from textures import Texture
from scene import Scene, Quad
from shader import Shader
from vector import Vector
from matrix import Matrix
LONGITUDE = -73.985
LATITUDE = 39.6913
TS = api.load.timescale()
PLANETS = api.load... | true | true |
f7f47929860f53cf30c2375dc6743b8f548a3e00 | 663 | py | Python | catalog/migrations/0002_bookinstance_borrower.py | vlms/django_local_library | 755775f8bfafa08440453247d21a42ec72c48eab | [
"MIT"
] | null | null | null | catalog/migrations/0002_bookinstance_borrower.py | vlms/django_local_library | 755775f8bfafa08440453247d21a42ec72c48eab | [
"MIT"
] | null | null | null | catalog/migrations/0002_bookinstance_borrower.py | vlms/django_local_library | 755775f8bfafa08440453247d21a42ec72c48eab | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-19 14:31
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depende... | 27.625 | 134 | 0.68175 |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('catalog', '0001_initial'),
... | true | true |
f7f47991f4fa640cc0eca0031ccfa55625f84abc | 4,510 | py | Python | example/ner/few-shot/run.py | hphphp123321/DeepKE | 94b39a20db0d848ccea81ea56fef4587ac31e2bc | [
"MIT"
] | 1 | 2021-11-10T07:57:11.000Z | 2021-11-10T07:57:11.000Z | example/ner/few-shot/run.py | 807953261/DeepKE | f7efd3fc87d3bf88783a41efc3c09dca7a986013 | [
"MIT"
] | 1 | 2021-11-05T04:25:25.000Z | 2021-11-05T04:25:25.000Z | example/ner/few-shot/run.py | 807953261/DeepKE | f7efd3fc87d3bf88783a41efc3c09dca7a986013 | [
"MIT"
] | null | null | null | import os
import hydra
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]='1'
import logging
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
from hydra import utils
from torch.utils.data import DataLoader
from deepke.name_entity_re.few_shot.mode... | 40.630631 | 140 | 0.688248 | import os
import hydra
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]='1'
import logging
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
from hydra import utils
from torch.utils.data import DataLoader
from deepke.name_entity_re.few_shot.mode... | true | true |
f7f479aad3d4b6a023500f79e3d8289e8e4cd552 | 1,910 | py | Python | code/model_zoo/basset.py | p-koo/exponential_activations | 7e48054b64a565364439c45932338a09eb2eb4d3 | [
"MIT"
] | 1 | 2021-09-18T04:09:07.000Z | 2021-09-18T04:09:07.000Z | code/model_zoo/basset.py | koo-lab/exponential_activations | 9032a360c1abb0f07b824e3ce6d20707efe306fd | [
"MIT"
] | null | null | null | code/model_zoo/basset.py | koo-lab/exponential_activations | 9032a360c1abb0f07b824e3ce6d20707efe306fd | [
"MIT"
] | 4 | 2020-08-03T02:08:42.000Z | 2021-10-01T18:46:47.000Z | from tensorflow import keras
from tfomics import layers, utils
def model(activation='relu'):
# input layer
inputs = keras.layers.Input(shape=(600,4))
activation = utils.activation_fn(activation)
# layer 1
nn = layers.conv_layer(inputs,
num_filters=300,
... | 31.833333 | 97 | 0.469634 | from tensorflow import keras
from tfomics import layers, utils
def model(activation='relu'):
inputs = keras.layers.Input(shape=(600,4))
activation = utils.activation_fn(activation)
nn = layers.conv_layer(inputs,
num_filters=300,
k... | true | true |
f7f47a92fd7c1d74ca751cff56758e0579e38e65 | 825 | py | Python | agroop/agroop.py | arcsecond-io/agroop | 8c0db4ffa37d9f45985394e52bb5f06eb4bebe6a | [
"MIT"
] | null | null | null | agroop/agroop.py | arcsecond-io/agroop | 8c0db4ffa37d9f45985394e52bb5f06eb4bebe6a | [
"MIT"
] | null | null | null | agroop/agroop.py | arcsecond-io/agroop | 8c0db4ffa37d9f45985394e52bb5f06eb4bebe6a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import click
import json
from astropy.coordinates import SkyCoord
from agroop.options import State
ECHO_PREFIX = u' • '
__all__ = [""]
def parse_coord_string(s, state):
try:
if state.verbose:
click.echo(ECHO_PREFIX + 'Parsing REF coordinates input "{}"...'.format(s)... | 31.730769 | 120 | 0.652121 |
import click
import json
from astropy.coordinates import SkyCoord
from agroop.options import State
ECHO_PREFIX = u' • '
__all__ = [""]
def parse_coord_string(s, state):
try:
if state.verbose:
click.echo(ECHO_PREFIX + 'Parsing REF coordinates input "{}"...'.format(s))
return SkyCoo... | true | true |
f7f47ad8f1967d539e5880a2674e047fef43b42d | 132,890 | py | Python | zerver/tests/test_markdown.py | usnp/zulip | 594f2d4086f2d50d7caffc9c9693cc0ac920e047 | [
"Apache-2.0"
] | null | null | null | zerver/tests/test_markdown.py | usnp/zulip | 594f2d4086f2d50d7caffc9c9693cc0ac920e047 | [
"Apache-2.0"
] | null | null | null | zerver/tests/test_markdown.py | usnp/zulip | 594f2d4086f2d50d7caffc9c9693cc0ac920e047 | [
"Apache-2.0"
] | null | null | null | import copy
import os
import re
from textwrap import dedent
from typing import Any, Dict, List, Optional, Set, Tuple, cast
from unittest import mock
import orjson
from django.conf import settings
from django.test import override_settings
from markdown import Markdown
from zerver.lib.actions import (
change_user_i... | 46.693605 | 1,845 | 0.630506 | import copy
import os
import re
from textwrap import dedent
from typing import Any, Dict, List, Optional, Set, Tuple, cast
from unittest import mock
import orjson
from django.conf import settings
from django.test import override_settings
from markdown import Markdown
from zerver.lib.actions import (
change_user_i... | true | true |
f7f47b8f369825a78e4be3c7da841cc9b76c5cef | 2,140 | py | Python | P_rect.py | grhsxy21/Insect_Identification | 3b9ffe3ba91c2271bd663c327e384a6679c67bc8 | [
"Apache-2.0"
] | null | null | null | P_rect.py | grhsxy21/Insect_Identification | 3b9ffe3ba91c2271bd663c327e384a6679c67bc8 | [
"Apache-2.0"
] | null | null | null | P_rect.py | grhsxy21/Insect_Identification | 3b9ffe3ba91c2271bd663c327e384a6679c67bc8 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# 先读图,然后二值化,
# 矩形度
import cv2
import numpy as np
from matplotlib import pyplot as plt
# 此处读入图片,作为接口
origin = cv2.imread('D:/GitHub/ZRB/Insect_Identification/picture/butterfly.png') #TODO改为绝对路径
grayimage = cv2.imread('D:/GitHub/ZRB/Insect_Identification/picture/butterfly.png', 0)
# 高斯滤波
#*img = cv... | 30.140845 | 134 | 0.724766 |
import cv2
import numpy as np
from matplotlib import pyplot as plt
origin = cv2.imread('D:/GitHub/ZRB/Insect_Identification/picture/butterfly.png')
grayimage = cv2.imread('D:/GitHub/ZRB/Insect_Identification/picture/butterfly.png', 0)
blur = cv2.GaussianBlur(grayimage, (5, 5), 0)
ret, otsu = cv2.threshol... | true | true |
f7f47c0aae1e220d20eec7c8265f52bc8bf4903e | 1,091 | py | Python | dream/server/models.py | icyblade/dream | 818e77f1c25e51f8cd966f7aa4eb1bcd4207b208 | [
"MIT"
] | null | null | null | dream/server/models.py | icyblade/dream | 818e77f1c25e51f8cd966f7aa4eb1bcd4207b208 | [
"MIT"
] | null | null | null | dream/server/models.py | icyblade/dream | 818e77f1c25e51f8cd966f7aa4eb1bcd4207b208 | [
"MIT"
] | null | null | null | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Agent(db.Model):
id = db.Column(db.Integer, primary_key=True)
type = db.Column(db.Integer, nullable=False)
name = db.Column(db.Integer, unique=True, nullable=False)
port = db.Column(db.Integer, unique=True, nullable=False)
def __re... | 27.275 | 78 | 0.661778 | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Agent(db.Model):
id = db.Column(db.Integer, primary_key=True)
type = db.Column(db.Integer, nullable=False)
name = db.Column(db.Integer, unique=True, nullable=False)
port = db.Column(db.Integer, unique=True, nullable=False)
def __re... | true | true |
f7f47c53a2a933b72826ea833613e7de93158dc2 | 799 | py | Python | sdk/python/pulumi_azure_native/datalakestore/__init__.py | sebtelko/pulumi-azure-native | 711ec021b5c73da05611c56c8a35adb0ce3244e4 | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/datalakestore/__init__.py | sebtelko/pulumi-azure-native | 711ec021b5c73da05611c56c8a35adb0ce3244e4 | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/datalakestore/__init__.py | sebtelko/pulumi-azure-native | 711ec021b5c73da05611c56c8a35adb0ce3244e4 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from .. import _utilities
import typing
# Export this package's modules as members:
from ._enums import *
from .account import *
from .firewall_rule im... | 30.730769 | 85 | 0.779725 |
from .. import _utilities
import typing
# Export this package's modules as members:
from ._enums import *
from .account import *
from .firewall_rule import *
from .get_account import *
from .get_firewall_rule import *
from .get_trusted_id_provider import *
from .get_virtual_network_rule import *
from .trusted_id_pr... | true | true |
f7f47e525497e7534d89c7741a3282ccf0b6f148 | 3,777 | py | Python | src/oci/database_migration/models/update_host_dump_transfer_details.py | LaudateCorpus1/oci-python-sdk | b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/oci/database_migration/models/update_host_dump_transfer_details.py | LaudateCorpus1/oci-python-sdk | b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/oci/database_migration/models/update_host_dump_transfer_details.py | LaudateCorpus1/oci-python-sdk | b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | # coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 34.651376 | 245 | 0.660842 |
from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel
from oci.decorators import init_model_state_from_kwargs
@init_model_state_from_kwargs
class UpdateHostDumpTransferDetails(object):
KIND_CURL = "CURL"
KIND_OCI_CLI = "OCI_CLI"
def __in... | true | true |
f7f47f046953df24126d669292bd4188fe84bc9c | 1,113 | py | Python | cloudkitty/storage/v1/sqlalchemy/alembic/versions/c703a1bad612_improve_qty_digit.py | wanghuiict/cloudkitty | 11ff713042eb0354f497f7051130630c46860735 | [
"Apache-2.0"
] | 97 | 2015-10-18T02:53:17.000Z | 2022-03-07T05:15:39.000Z | cloudkitty/storage/v1/sqlalchemy/alembic/versions/c703a1bad612_improve_qty_digit.py | shanafang9/cloudkitty | 911c90569ccb09ecf0d7aa11a5a707c8ebda09cf | [
"Apache-2.0"
] | 1 | 2017-11-29T15:39:27.000Z | 2017-11-29T15:39:27.000Z | cloudkitty/storage/v1/sqlalchemy/alembic/versions/c703a1bad612_improve_qty_digit.py | shanafang9/cloudkitty | 911c90569ccb09ecf0d7aa11a5a707c8ebda09cf | [
"Apache-2.0"
] | 54 | 2015-10-27T10:55:02.000Z | 2022-02-18T08:23:19.000Z | # Copyright 2017 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | 29.289474 | 78 | 0.709793 |
revision = 'c703a1bad612'
down_revision = '307430ab38bc'
from alembic import op
import sqlalchemy as sa
def upgrade():
with op.batch_alter_table('rated_data_frames') as batch_op:
batch_op.alter_column(
'qty',
type_=sa.Numeric(15, 5),
existing_type=... | true | true |
f7f47fda0f76310bb8c936fc43fa52df2e6e3415 | 775 | py | Python | workflow/scripts/compress_mrsfast.py | mrvollger/fastCN-smk | a835dbd72b6ca411f9d6b7c060a6aa15ff690ee4 | [
"MIT"
] | 2 | 2021-09-12T01:34:38.000Z | 2022-03-24T22:07:14.000Z | workflow/scripts/compress_mrsfast.py | mrvollger/fastCN-smk | a835dbd72b6ca411f9d6b7c060a6aa15ff690ee4 | [
"MIT"
] | null | null | null | workflow/scripts/compress_mrsfast.py | mrvollger/fastCN-smk | a835dbd72b6ca411f9d6b7c060a6aa15ff690ee4 | [
"MIT"
] | 1 | 2021-11-17T21:50:57.000Z | 2021-11-17T21:50:57.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: William T. Harvey
import gzip
file = gzip.open(snakemake.input.sam, "rt")
count = 0
line_cols = []
with gzip.open(snakemake.output.comp, "wt") as outfile:
outfile.write("qname,flag,rname,pos,mapq\n")
while True:
line = file.readline().rstrip(... | 22.794118 | 59 | 0.513548 |
import gzip
file = gzip.open(snakemake.input.sam, "rt")
count = 0
line_cols = []
with gzip.open(snakemake.output.comp, "wt") as outfile:
outfile.write("qname,flag,rname,pos,mapq\n")
while True:
line = file.readline().rstrip()
if not line:
break
if line[0] == "@":
... | true | true |
f7f4802beab0324e70a6c8fef04694f90d3b7654 | 1,761 | py | Python | gocardless_pro/resources/bank_authorisation.py | gdvalderrama/gocardless-pro-python | 0ff8001f5bba11673c4fa0f30d26eca61a1219ba | [
"MIT"
] | null | null | null | gocardless_pro/resources/bank_authorisation.py | gdvalderrama/gocardless-pro-python | 0ff8001f5bba11673c4fa0f30d26eca61a1219ba | [
"MIT"
] | null | null | null | gocardless_pro/resources/bank_authorisation.py | gdvalderrama/gocardless-pro-python | 0ff8001f5bba11673c4fa0f30d26eca61a1219ba | [
"MIT"
] | null | null | null | # WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#
class BankAuthorisation(object):
"""A thin wrapper around a bank_authorisation, providing easy access to its
attributes.
Example:
bank_authorisation = client.bank_authorisations.get()
... | 17.969388 | 79 | 0.621806 |
class BankAuthorisation(object):
def __init__(self, attributes, api_response):
self.attributes = attributes
self.api_response = api_response
@property
def authorisation_type(self):
return self.attributes.get('authorisation_type')
@property
def authorised_at(self):
... | true | true |
f7f480e3deb206a2dcffde930d3268460f088215 | 32,079 | py | Python | kartothek/io/eager.py | steffen-schroeder-by/kartothek | 1821ea5df60d4079d3911b3c2f17be11d8780e22 | [
"MIT"
] | null | null | null | kartothek/io/eager.py | steffen-schroeder-by/kartothek | 1821ea5df60d4079d3911b3c2f17be11d8780e22 | [
"MIT"
] | null | null | null | kartothek/io/eager.py | steffen-schroeder-by/kartothek | 1821ea5df60d4079d3911b3c2f17be11d8780e22 | [
"MIT"
] | null | null | null | import warnings
from functools import partial
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union, cast
import deprecation
import pandas as pd
from simplekv import KeyValueStore
from kartothek.core.common_metadata import (
empty_dataframe_from_schema,
make_meta,
store_schema_met... | 31.824405 | 193 | 0.687989 | import warnings
from functools import partial
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union, cast
import deprecation
import pandas as pd
from simplekv import KeyValueStore
from kartothek.core.common_metadata import (
empty_dataframe_from_schema,
make_meta,
store_schema_met... | true | true |
f7f48105fe1cdb06aa9f6fc1ec60545a296ae843 | 82,949 | py | Python | meraki/merakiapi.py | storybook808/Meraki-Bulk-Configuration-Tool | 65e240b89f16e02fd767f1e1a1742728c0f2cc0a | [
"MIT"
] | 1 | 2018-06-28T17:00:07.000Z | 2018-06-28T17:00:07.000Z | meraki/merakiapi.py | storybook808/Meraki-Bulk-Configuration-Tool | 65e240b89f16e02fd767f1e1a1742728c0f2cc0a | [
"MIT"
] | null | null | null | meraki/merakiapi.py | storybook808/Meraki-Bulk-Configuration-Tool | 65e240b89f16e02fd767f1e1a1742728c0f2cc0a | [
"MIT"
] | null | null | null | #######################################################################################################################
#
# Cisco Meraki Provisioning API Python 3.x Module
#
# Overview
# The purpose of this Python module is to provide a standard Python module to interact with the Meraki Provisioning API.
# Each method... | 33.153078 | 120 | 0.603383 | 'Europe/Zaporozhye',
'Europe/Zurich',
'GB',
'GB-Eire',
'GMT',
'GMT+0',
'GMT0',
'GMT-0',
'Greenwich',
'Hongkong',
'HST',
'Iceland',
'Indian/Antananarivo',
'Indian/Chagos',
'Indian/... | true | true |
f7f481bc75236984cfe082cef91a414189fb19b0 | 3,509 | py | Python | evaluation/parameterstudy.py | ChristianSchorr/InertialFlowCutter | baac26aa394e6bb58ed43d122b820dd963cfb303 | [
"BSD-3-Clause"
] | 14 | 2019-07-03T00:20:01.000Z | 2022-03-15T02:28:58.000Z | evaluation/parameterstudy.py | ChristianSchorr/InertialFlowCutter | baac26aa394e6bb58ed43d122b820dd963cfb303 | [
"BSD-3-Clause"
] | 9 | 2019-07-04T08:32:16.000Z | 2021-07-09T09:19:47.000Z | evaluation/parameterstudy.py | ChristianSchorr/InertialFlowCutter | baac26aa394e6bb58ed43d122b820dd963cfb303 | [
"BSD-3-Clause"
] | 9 | 2019-07-03T00:20:53.000Z | 2022-03-22T11:41:25.000Z | import configurable_inertialflowcutter_order as ifc
import pandas as pd
import numpy as np
import re
import subprocess
import os
experiments_folder = ""
graph = "col" #TODO replace again with europe
graph_path = experiments_folder + graph + "/"
metric_path = graph_path + "travel_time"
query_sources = experiments... | 39.426966 | 199 | 0.680536 | import configurable_inertialflowcutter_order as ifc
import pandas as pd
import numpy as np
import re
import subprocess
import os
experiments_folder = ""
graph = "col"
graph_path = experiments_folder + graph + "/"
metric_path = graph_path + "travel_time"
query_sources = experiments_folder + graph + ".q.s"
query_... | true | true |
f7f4820a4bb7a25a72c3ec091c69573d08929fa5 | 124 | py | Python | main.py | ReanGD/docker-x11-chrome | 13bace121b3580b57228ead0adb3aea6759f7cc5 | [
"Apache-2.0"
] | null | null | null | main.py | ReanGD/docker-x11-chrome | 13bace121b3580b57228ead0adb3aea6759f7cc5 | [
"Apache-2.0"
] | null | null | null | main.py | ReanGD/docker-x11-chrome | 13bace121b3580b57228ead0adb3aea6759f7cc5 | [
"Apache-2.0"
] | null | null | null | # import one_neuron
import digits
import digits2
import utils
# one_neuron.run()
# digits.run()
digits2.run()
# utils.run() | 13.777778 | 19 | 0.741935 |
import digits
import digits2
import utils
digits2.run()
| true | true |
f7f482792f236c165342ca6efea07fc1651d1130 | 25,632 | py | Python | tensorflow/python/eager/wrap_function.py | abhaikollara/tensorflow | 4f96df3659696990cb34d0ad07dc67843c4225a9 | [
"Apache-2.0"
] | 27 | 2020-02-29T04:13:22.000Z | 2022-02-07T21:54:50.000Z | tensorflow/python/eager/wrap_function.py | abhaikollara/tensorflow | 4f96df3659696990cb34d0ad07dc67843c4225a9 | [
"Apache-2.0"
] | 6 | 2022-01-15T07:17:47.000Z | 2022-02-14T15:28:22.000Z | tensorflow/python/eager/wrap_function.py | abhaikollara/tensorflow | 4f96df3659696990cb34d0ad07dc67843c4225a9 | [
"Apache-2.0"
] | 10 | 2020-12-15T03:55:24.000Z | 2021-12-17T23:14:11.000Z | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 40.301887 | 107 | 0.71676 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import weakref
from tensorflow.core.protobuf import meta_graph_pb2
from tensorflow.core.protobuf import struct_pb2
from tensorflow.python.eager import context
from tensorflow.python.eager impor... | true | true |
f7f482b1498c5cfbfa908a852befa2a66d858761 | 3,753 | py | Python | fastmot/models/reid.py | 6DammK9/FastMOT | ff5febf4f4bac576db6e5846479bdc0891fa740b | [
"MIT"
] | null | null | null | fastmot/models/reid.py | 6DammK9/FastMOT | ff5febf4f4bac576db6e5846479bdc0891fa740b | [
"MIT"
] | null | null | null | fastmot/models/reid.py | 6DammK9/FastMOT | ff5febf4f4bac576db6e5846479bdc0891fa740b | [
"MIT"
] | null | null | null | from pathlib import Path
import logging
import tensorrt as trt
EXPLICIT_BATCH = 1 << int(trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH)
logger = logging.getLogger(__name__)
class ReID:
"""Base class for ReID models.
Attributes
----------
PLUGIN_PATH : Path, optional
Path to TensorRT plug... | 34.118182 | 101 | 0.618439 | from pathlib import Path
import logging
import tensorrt as trt
EXPLICIT_BATCH = 1 << int(trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH)
logger = logging.getLogger(__name__)
class ReID:
__registry = {}
PLUGIN_PATH = None
ENGINE_PATH = None
MODEL_PATH = None
INPUT_SHAPE = None
OUTPUT_LAYOU... | true | true |
f7f482f3a9471f430426dbbf3fda05cafdf34fda | 4,405 | py | Python | webowl.py | pelaohxc/webowl | 6f4154ec126dbad39eb7406fadfe8522e379f168 | [
"MIT"
] | 5 | 2019-02-24T14:16:21.000Z | 2022-02-20T21:35:05.000Z | webowl.py | pelaohxc/webowl | 6f4154ec126dbad39eb7406fadfe8522e379f168 | [
"MIT"
] | null | null | null | webowl.py | pelaohxc/webowl | 6f4154ec126dbad39eb7406fadfe8522e379f168 | [
"MIT"
] | 1 | 2019-02-21T09:44:48.000Z | 2019-02-21T09:44:48.000Z | from selenium import webdriver
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--file", help="File containing the url list")
parser.add_argument("--output", help="The path of the folder for the output files")
parser.add_argument("--webdriver", help="The path of the webdriver binary")
... | 58.733333 | 89 | 0.3437 | from selenium import webdriver
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--file", help="File containing the url list")
parser.add_argument("--output", help="The path of the folder for the output files")
parser.add_argument("--webdriver", help="The path of the webdriver binary")
... | true | true |
f7f4834c1dac54ee79265b60a45f9c7fbc413a40 | 403 | py | Python | DjangoRESTAPI/wsgi.py | Thecapable/DjangoRESTAPI-Bank | 454fb6858f8f8820f3bc0b503d5ada46ca84b633 | [
"MIT"
] | null | null | null | DjangoRESTAPI/wsgi.py | Thecapable/DjangoRESTAPI-Bank | 454fb6858f8f8820f3bc0b503d5ada46ca84b633 | [
"MIT"
] | null | null | null | DjangoRESTAPI/wsgi.py | Thecapable/DjangoRESTAPI-Bank | 454fb6858f8f8820f3bc0b503d5ada46ca84b633 | [
"MIT"
] | null | null | null | """
WSGI config for DjangoRESTAPI project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO... | 23.705882 | 78 | 0.791563 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'DjangoRESTAPI.settings')
application = get_wsgi_application()
| true | true |
f7f483b60767e1276340637def1a89aaba6e87a4 | 485 | py | Python | server/python/exceptions.py | GjjvdBurg/wrattler | 1e4937b42fbe15a87a8204a61dbdd0b4526d9b6c | [
"MIT"
] | 56 | 2018-03-21T07:04:44.000Z | 2021-12-26T15:01:42.000Z | server/python/exceptions.py | GjjvdBurg/wrattler | 1e4937b42fbe15a87a8204a61dbdd0b4526d9b6c | [
"MIT"
] | 181 | 2018-06-07T10:35:23.000Z | 2022-02-26T10:22:54.000Z | server/python/exceptions.py | GjjvdBurg/wrattler | 1e4937b42fbe15a87a8204a61dbdd0b4526d9b6c | [
"MIT"
] | 9 | 2018-05-04T10:04:49.000Z | 2019-10-07T15:53:50.000Z | """
Define custom exceptions for the API
"""
class ApiException(Exception):
status_code = 500
def __init__(self, message, status_code=None, payload=None):
Exception.__init__(self)
self.message = message
if status_code is not None:
self.status_code = status_code
self... | 24.25 | 64 | 0.610309 |
class ApiException(Exception):
status_code = 500
def __init__(self, message, status_code=None, payload=None):
Exception.__init__(self)
self.message = message
if status_code is not None:
self.status_code = status_code
self.payload = payload
def to_dict(self):
... | true | true |
f7f48475f968e504ce866d12667918c23541dd05 | 4,316 | py | Python | google/ads/google_ads/v3/proto/resources/parental_status_view_pb2.py | jphanwebstaurant/google-ads-python | 600812b2afcc4d57f00b47dfe436620ce50bfe9b | [
"Apache-2.0"
] | 1 | 2019-11-30T23:42:39.000Z | 2019-11-30T23:42:39.000Z | google/ads/google_ads/v3/proto/resources/parental_status_view_pb2.py | jphanwebstaurant/google-ads-python | 600812b2afcc4d57f00b47dfe436620ce50bfe9b | [
"Apache-2.0"
] | null | null | null | google/ads/google_ads/v3/proto/resources/parental_status_view_pb2.py | jphanwebstaurant/google-ads-python | 600812b2afcc4d57f00b47dfe436620ce50bfe9b | [
"Apache-2.0"
] | 1 | 2020-09-30T17:04:06.000Z | 2020-09-30T17:04:06.000Z | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads_v3/proto/resources/parental_status_view.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobu... | 48.494382 | 821 | 0.797266 |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
_sym_db ... | true | true |
f7f484a600d59feb460a0d54800060b9f17601bc | 1,217 | py | Python | module_3/df_test.py | JedersonLuz/Codenation_AceleraDev_DataScience | a23137ba7f1349bdc544647ef680ea6f822f797b | [
"MIT"
] | 6 | 2020-03-30T23:40:18.000Z | 2020-08-20T16:48:38.000Z | module_3/df_test.py | JedersonLuz/Codenation_AceleraDev_DataScience | a23137ba7f1349bdc544647ef680ea6f822f797b | [
"MIT"
] | 26 | 2021-02-03T01:19:53.000Z | 2021-04-24T19:51:53.000Z | module_3/df_test.py | JedersonLuz/Codenation_AceleraDev_DataScience | a23137ba7f1349bdc544647ef680ea6f822f797b | [
"MIT"
] | 7 | 2020-04-24T15:07:55.000Z | 2020-08-24T04:47:20.000Z | import pandas as pd
import altair as alt
import streamlit as st
@st.cache
def get_UN_data():
AWS_BUCKET_URL = "https://streamlit-demo-data.s3-us-west-2.amazonaws.com"
df = pd.read_csv(AWS_BUCKET_URL + "/agri.csv.gz")
return df.set_index("Region")
try:
df = get_UN_data()
except urllib.error... | 25.354167 | 78 | 0.612983 | import pandas as pd
import altair as alt
import streamlit as st
@st.cache
def get_UN_data():
AWS_BUCKET_URL = "https://streamlit-demo-data.s3-us-west-2.amazonaws.com"
df = pd.read_csv(AWS_BUCKET_URL + "/agri.csv.gz")
return df.set_index("Region")
try:
df = get_UN_data()
except urllib.error... | true | true |
f7f484d1bbeadd341cdcf12d1a3dd530c4a78b88 | 9,585 | py | Python | sample/simple_pyhlm_sample.py | kishiyamat/npbdaa | c13a97b32635e00b192b7075fdc09875710c5029 | [
"MIT"
] | null | null | null | sample/simple_pyhlm_sample.py | kishiyamat/npbdaa | c13a97b32635e00b192b7075fdc09875710c5029 | [
"MIT"
] | 2 | 2020-07-05T02:11:53.000Z | 2020-07-08T00:00:37.000Z | sample/simple_pyhlm_sample.py | kishiyamat/npbdaa | c13a97b32635e00b192b7075fdc09875710c5029 | [
"MIT"
] | null | null | null | import time
import warnings
from pathlib import Path
import numpy as np
import pyhsmm
from tqdm import trange
from util.config_parser import ConfigParser_with_eval
from pyhlm.model import WeakLimitHDPHLM
from pyhlm.word_model import LetterHSMM
warnings.filterwarnings('ignore')
# import pyximport;
# pyximport.insta... | 35.898876 | 119 | 0.664371 | import time
import warnings
from pathlib import Path
import numpy as np
import pyhsmm
from tqdm import trange
from util.config_parser import ConfigParser_with_eval
from pyhlm.model import WeakLimitHDPHLM
from pyhlm.word_model import LetterHSMM
warnings.filterwarnings('ignore')
d(filename)
return cp
def load... | true | true |
f7f485e4fc9f4c6d551adf746bf8b9cc82c5f85b | 1,008 | py | Python | stanza/tests/test_prepare_resources.py | asears/stanza | f91ca215e175d4f7b202259fe789374db7829395 | [
"Apache-2.0"
] | 3,633 | 2016-01-21T17:29:13.000Z | 2022-03-31T13:36:47.000Z | stanza/tests/test_prepare_resources.py | asears/stanza | f91ca215e175d4f7b202259fe789374db7829395 | [
"Apache-2.0"
] | 593 | 2016-01-19T07:16:05.000Z | 2022-03-31T20:23:58.000Z | stanza/tests/test_prepare_resources.py | asears/stanza | f91ca215e175d4f7b202259fe789374db7829395 | [
"Apache-2.0"
] | 525 | 2016-01-20T03:22:19.000Z | 2022-03-24T05:51:56.000Z | import pytest
import stanza
import stanza.resources.prepare_resources as prepare_resources
from stanza.tests import *
pytestmark = [pytest.mark.travis, pytest.mark.pipeline]
def test_split_model_name():
# Basic test
lang, package, processor = prepare_resources.split_model_name('ro_nonstandard_tagger.pt')
... | 32.516129 | 97 | 0.733135 | import pytest
import stanza
import stanza.resources.prepare_resources as prepare_resources
from stanza.tests import *
pytestmark = [pytest.mark.travis, pytest.mark.pipeline]
def test_split_model_name():
lang, package, processor = prepare_resources.split_model_name('ro_nonstandard_tagger.pt')
assert lan... | true | true |
f7f486a57186930e852420b301713c394d58d21b | 710 | py | Python | tests/psd_tools/api/test_mask.py | mrstephenneal/psd-tools2 | fde1c9768b8d2a232e5afd5f1b58983ec675b960 | [
"MIT"
] | 19 | 2019-11-21T09:26:52.000Z | 2022-03-16T13:51:29.000Z | tests/psd_tools/api/test_mask.py | sfneal/psd-tools3 | 61e780a2b8dd34b4d9be2d2ffea6274ab17d6051 | [
"MIT"
] | 1 | 2018-10-01T14:14:50.000Z | 2018-10-01T14:14:50.000Z | tests/psd_tools/api/test_mask.py | mrstephenneal/psd-tools3 | fde1c9768b8d2a232e5afd5f1b58983ec675b960 | [
"MIT"
] | 1 | 2021-12-24T06:42:05.000Z | 2021-12-24T06:42:05.000Z | from __future__ import absolute_import, unicode_literals
import logging
import pytest
from psd_tools.api.psd_image import PSDImage
from ..utils import full_name
logger = logging.getLogger(__name__)
@pytest.fixture
def layer_mask_data():
return PSDImage.open(full_name('layer_mask_data.psd'))
def test_layer_m... | 20.882353 | 58 | 0.687324 | from __future__ import absolute_import, unicode_literals
import logging
import pytest
from psd_tools.api.psd_image import PSDImage
from ..utils import full_name
logger = logging.getLogger(__name__)
@pytest.fixture
def layer_mask_data():
return PSDImage.open(full_name('layer_mask_data.psd'))
def test_layer_m... | true | true |
f7f48798927c69521134ccd477a2b5496589c1c9 | 4,421 | py | Python | admin_tools/dashboard/south_migrations/0002_auto__add_field_dashboardpreferences_dashboard_id.py | asherf/django-admin-tools | 26a993545de7d68286be56ac640fe12acf1a1abe | [
"MIT"
] | 711 | 2015-06-21T10:08:06.000Z | 2022-03-25T08:46:37.000Z | admin_tools/dashboard/south_migrations/0002_auto__add_field_dashboardpreferences_dashboard_id.py | asherf/django-admin-tools | 26a993545de7d68286be56ac640fe12acf1a1abe | [
"MIT"
] | 102 | 2015-06-22T12:38:21.000Z | 2022-03-29T14:00:54.000Z | admin_tools/dashboard/south_migrations/0002_auto__add_field_dashboardpreferences_dashboard_id.py | asherf/django-admin-tools | 26a993545de7d68286be56ac640fe12acf1a1abe | [
"MIT"
] | 149 | 2015-06-21T10:16:49.000Z | 2022-03-28T13:11:47.000Z | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.conf import settings
user_model = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field '... | 61.402778 | 182 | 0.589686 |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.conf import settings
user_model = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
class Migration(SchemaMigration):
def forwards(self, orm):
db.add_column('admin_too... | true | true |
f7f487d8c6dc1e5cfa4a1510ee7c3e19029fda9e | 3,167 | py | Python | tests/test_licenses.py | richard-dinh/ricecooker | 1de27c9c01aa2c65b2109ada2b790b23cbc3b0dd | [
"MIT"
] | 14 | 2017-01-10T09:33:03.000Z | 2021-11-28T12:11:27.000Z | tests/test_licenses.py | richard-dinh/ricecooker | 1de27c9c01aa2c65b2109ada2b790b23cbc3b0dd | [
"MIT"
] | 174 | 2016-09-29T17:32:54.000Z | 2022-03-29T15:02:48.000Z | tests/test_licenses.py | richard-dinh/ricecooker | 1de27c9c01aa2c65b2109ada2b790b23cbc3b0dd | [
"MIT"
] | 41 | 2016-08-29T23:26:17.000Z | 2021-11-29T17:12:03.000Z | """ Tests for license getting and serialization """
import json
import pytest
from le_utils.constants.licenses import (
CC_BY, CC_BY_SA, CC_BY_ND, CC_BY_NC, CC_BY_NC_SA, CC_BY_NC_ND,
ALL_RIGHTS_RESERVED,
PUBLIC_DOMAIN,
SPECIAL_PERMISSIONS
)
from ricecooker.classes.licenses import get_license
""" **... | 32.316327 | 88 | 0.689927 |
import json
import pytest
from le_utils.constants.licenses import (
CC_BY, CC_BY_SA, CC_BY_ND, CC_BY_NC, CC_BY_NC_SA, CC_BY_NC_ND,
ALL_RIGHTS_RESERVED,
PUBLIC_DOMAIN,
SPECIAL_PERMISSIONS
)
from ricecooker.classes.licenses import get_license
@pytest.fixture
def license_objects():
regular_ids = [... | true | true |
f7f4886da19fb94e741c0e55063fff72c525e77d | 18,384 | py | Python | src/docmail/client.py | ancoris/docmail-api-wrapper | 1dbc4d1136f3052eaf17795e84fdd668378280ec | [
"MIT"
] | null | null | null | src/docmail/client.py | ancoris/docmail-api-wrapper | 1dbc4d1136f3052eaf17795e84fdd668378280ec | [
"MIT"
] | null | null | null | src/docmail/client.py | ancoris/docmail-api-wrapper | 1dbc4d1136f3052eaf17795e84fdd668378280ec | [
"MIT"
] | 1 | 2022-01-21T13:30:41.000Z | 2022-01-21T13:30:41.000Z | #!/usr/bin/env python
#
# Docmail API Wrapper (Python)
#
#Copyright (c) 2011 Appogee (www.appogee.co.uk)
#
#Permission is hereby granted, free of charge, to any person obtaining
#a copy of this software and associated documentation files (the
#"Software"), to deal in the Software without restriction, including
#withou... | 46.659898 | 144 | 0.553742 |
__author__ = 'gwyn.howell@appogee.co.uk (Gwyn Howell)'
__version__ = '1.0'
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
from xml.dom.minidom import parseString
import base64
import datetime
import os.path
import re
import suds.client
from docmail import enu... | true | true |
f7f4894932b6cea8f41ce5dc47d58d60b353f5b0 | 552 | py | Python | oldp/utils/limited_paginator.py | docsuleman/oldp | 8dcaa8e6e435794c872346b5014945ace885adb4 | [
"MIT"
] | 66 | 2018-05-07T12:34:39.000Z | 2022-02-23T20:14:24.000Z | oldp/utils/limited_paginator.py | Justice-PLP-DHV/oldp | eadf235bb0925453d9a5b81963a0ce53afeb17fd | [
"MIT"
] | 68 | 2018-06-11T16:13:17.000Z | 2022-02-10T08:03:26.000Z | oldp/utils/limited_paginator.py | Justice-PLP-DHV/oldp | eadf235bb0925453d9a5b81963a0ce53afeb17fd | [
"MIT"
] | 15 | 2018-06-23T19:41:13.000Z | 2021-08-18T08:21:49.000Z | from math import ceil
from django.conf import settings
from django.core.paginator import Paginator
from django.utils.functional import cached_property
class LimitedPaginator(Paginator):
"""Limits the number of pages to avoid slow DB queries"""
@cached_property
def num_pages(self):
"""Return the t... | 30.666667 | 71 | 0.706522 | from math import ceil
from django.conf import settings
from django.core.paginator import Paginator
from django.utils.functional import cached_property
class LimitedPaginator(Paginator):
@cached_property
def num_pages(self):
if self.count == 0 and not self.allow_empty_first_page:
return 0
... | true | true |
f7f4895cf92cfb30274d315d1364a4edda968c07 | 65,867 | py | Python | geosoft/gxpy/tests/test_group.py | fearaschiarrai/gxpy | 4c5e7594b24e530a8cd94df1eef562c5c6ce3e92 | [
"BSD-2-Clause"
] | 25 | 2017-07-14T06:39:37.000Z | 2022-03-09T21:39:51.000Z | geosoft/gxpy/tests/test_group.py | fearaschiarrai/gxpy | 4c5e7594b24e530a8cd94df1eef562c5c6ce3e92 | [
"BSD-2-Clause"
] | 100 | 2016-12-13T17:30:41.000Z | 2021-08-01T20:21:13.000Z | geosoft/gxpy/tests/test_group.py | fearaschiarrai/gxpy | 4c5e7594b24e530a8cd94df1eef562c5c6ce3e92 | [
"BSD-2-Clause"
] | 28 | 2016-12-12T17:34:40.000Z | 2022-03-16T15:39:39.000Z | import unittest
import os
import numpy as np
import geosoft
import geosoft.gxapi as gxapi
import geosoft.gxpy.system as gsys
import geosoft.gxpy.map as gxmap
import geosoft.gxpy.geometry as gxgm
import geosoft.gxpy.grid as gxgrd
import geosoft.gxpy.agg as gxagg
import geosoft.gxpy.system as gxsys
import geosoft.gxpy.v... | 41.425786 | 133 | 0.5127 | import unittest
import os
import numpy as np
import geosoft
import geosoft.gxapi as gxapi
import geosoft.gxpy.system as gsys
import geosoft.gxpy.map as gxmap
import geosoft.gxpy.geometry as gxgm
import geosoft.gxpy.grid as gxgrd
import geosoft.gxpy.agg as gxagg
import geosoft.gxpy.system as gxsys
import geosoft.gxpy.v... | true | true |
f7f48a2ec24bfc793c81134fe471b959c169fcdd | 5,250 | py | Python | nethud/proto/tee.py | ryansb/netHUD | 87f80a1beccad50c832028e2e57105fe277d37d6 | [
"MIT"
] | 1 | 2015-11-05T14:34:01.000Z | 2015-11-05T14:34:01.000Z | nethud/proto/tee.py | ryansb/netHUD | 87f80a1beccad50c832028e2e57105fe277d37d6 | [
"MIT"
] | null | null | null | nethud/proto/tee.py | ryansb/netHUD | 87f80a1beccad50c832028e2e57105fe277d37d6 | [
"MIT"
] | null | null | null | from __future__ import unicode_literals
from twisted.internet import reactor, defer
from twisted.internet.protocol import Protocol, ClientFactory, Factory
from nethud.controller import Controller
try:
import ultrajson as json
except:
import json
"""
tee.py
nethud.proto.tee
tee.py acts kinda like a tee and co... | 30.882353 | 79 | 0.653333 | from __future__ import unicode_literals
from twisted.internet import reactor, defer
from twisted.internet.protocol import Protocol, ClientFactory, Factory
from nethud.controller import Controller
try:
import ultrajson as json
except:
import json
class TeeFromClientProtocol(Protocol):
def connectionMad... | true | true |
f7f48ac87388f3180e6acb887393e4c5eed7c890 | 2,001 | py | Python | vultr/vultr.py | mgodiya/python-vultr | 4c314b426a2c5920276ad81a69757fa6ce72b73b | [
"MIT"
] | null | null | null | vultr/vultr.py | mgodiya/python-vultr | 4c314b426a2c5920276ad81a69757fa6ce72b73b | [
"MIT"
] | null | null | null | vultr/vultr.py | mgodiya/python-vultr | 4c314b426a2c5920276ad81a69757fa6ce72b73b | [
"MIT"
] | null | null | null | '''Python library for the Vultr cloud API'''
from .utils import VultrBase
from .v2_account import VultrAcc
from .v2_applications import VultrApp
from .v2_backup import VultrBackup
from .v2_baremetal import VultrBareMetal
#from .v2_billing import VultrBilling
from .v2_blockstorage import VultrBlockStorage
from .v2_dns i... | 39.235294 | 56 | 0.825087 | from .utils import VultrBase
from .v2_account import VultrAcc
from .v2_applications import VultrApp
from .v2_backup import VultrBackup
from .v2_baremetal import VultrBareMetal
from .v2_blockstorage import VultrBlockStorage
from .v2_dns import VultrDNS
from .v2_firewall import VultrFirewall
from .v2_instances import Vu... | true | true |
f7f48b3413d138f5b0a697ac5cb1fd9ca5047463 | 968 | py | Python | search/views.py | taedori81/stylishclothing | 5ef8a978a9f7636ed0f1c840d4926e76d46c4c1a | [
"BSD-3-Clause"
] | null | null | null | search/views.py | taedori81/stylishclothing | 5ef8a978a9f7636ed0f1c840d4926e76d46c4c1a | [
"BSD-3-Clause"
] | null | null | null | search/views.py | taedori81/stylishclothing | 5ef8a978a9f7636ed0f1c840d4926e76d46c4c1a | [
"BSD-3-Clause"
] | null | null | null | from django.shortcuts import render
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from wagtail.wagtailcore.models import Page
from wagtail.wagtailsearch.models import Query
def search(request):
search_query = request.GET.get('query', None)
page = request.GET.get('page', 1)
# S... | 26.888889 | 72 | 0.688017 | from django.shortcuts import render
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from wagtail.wagtailcore.models import Page
from wagtail.wagtailsearch.models import Query
def search(request):
search_query = request.GET.get('query', None)
page = request.GET.get('page', 1)
... | true | true |
f7f48b4141432e98b74e9e645404b960f772bb32 | 998 | py | Python | pol/api/v0/me.py | xwu64/server | d358db21db4a8faf33a3681fc499aeea07e9784b | [
"BSD-3-Clause"
] | null | null | null | pol/api/v0/me.py | xwu64/server | d358db21db4a8faf33a3681fc499aeea07e9784b | [
"BSD-3-Clause"
] | null | null | null | pol/api/v0/me.py | xwu64/server | d358db21db4a8faf33a3681fc499aeea07e9784b | [
"BSD-3-Clause"
] | null | null | null | from fastapi import Depends, APIRouter
from pydantic import Field, BaseModel
from pol import res
from pol.res import ErrorDetail
from pol.models import Avatar
from pol.router import ErrorCatchRoute
from pol.permission import UserGroup
from pol.api.v0.depends.auth import User, get_current_user
__all__ = ["Me", "get_us... | 24.341463 | 73 | 0.700401 | from fastapi import Depends, APIRouter
from pydantic import Field, BaseModel
from pol import res
from pol.res import ErrorDetail
from pol.models import Avatar
from pol.router import ErrorCatchRoute
from pol.permission import UserGroup
from pol.api.v0.depends.auth import User, get_current_user
__all__ = ["Me", "get_us... | true | true |
f7f48b47c2b71997c4dd6bf685a9fc6aeeae6330 | 390 | py | Python | PBMSupport.py | jakehyvonen/PaintByMotors | 6ec568633e0f8bbddeb5d1731d21144a2b6a5ced | [
"MIT"
] | null | null | null | PBMSupport.py | jakehyvonen/PaintByMotors | 6ec568633e0f8bbddeb5d1731d21144a2b6a5ced | [
"MIT"
] | null | null | null | PBMSupport.py | jakehyvonen/PaintByMotors | 6ec568633e0f8bbddeb5d1731d21144a2b6a5ced | [
"MIT"
] | null | null | null | from decimal import *
def MakeDec(num,places = 2):
p = '0.1'
if(places == 0):
p = '0'
else:
for i in range(1,places) :
l = p.split('.')[1]
p = '0.0' + l
#print('p: %s' % p)
r = Decimal(str(num)).quantize(Decimal(p), rounding=ROUND_HALF_DOWN)
return r
if ... | 22.941176 | 72 | 0.502564 | from decimal import *
def MakeDec(num,places = 2):
p = '0.1'
if(places == 0):
p = '0'
else:
for i in range(1,places) :
l = p.split('.')[1]
p = '0.0' + l
r = Decimal(str(num)).quantize(Decimal(p), rounding=ROUND_HALF_DOWN)
return r
if __name__ == '__main... | true | true |
f7f48bc9c8fbea58839822ea4d61ccfd009ac531 | 6,931 | py | Python | AppServer/lib/django-1.4/tests/regressiontests/conditional_processing/models.py | loftwah/appscale | 586fc1347ebc743d7a632de698f4dbfb09ae38d6 | [
"Apache-2.0"
] | 790 | 2015-01-03T02:13:39.000Z | 2020-05-10T19:53:57.000Z | AppServer/lib/django-1.4/tests/regressiontests/conditional_processing/models.py | nlake44/appscale | 6944af660ca4cb772c9b6c2332ab28e5ef4d849f | [
"Apache-2.0"
] | 1,361 | 2015-01-08T23:09:40.000Z | 2020-04-14T00:03:04.000Z | AppServer/lib/django-1.4/tests/regressiontests/conditional_processing/models.py | nlake44/appscale | 6944af660ca4cb772c9b6c2332ab28e5ef4d849f | [
"Apache-2.0"
] | 155 | 2015-01-08T22:59:31.000Z | 2020-04-08T08:01:53.000Z | # -*- coding:utf-8 -*-
from datetime import datetime
from django.test import TestCase
from django.utils import unittest
from django.utils.http import parse_etags, quote_etag, parse_http_date
FULL_RESPONSE = 'Test conditional get response'
LAST_MODIFIED = datetime(2007, 10, 21, 23, 21, 47)
LAST_MODIFIED_STR = 'Sun, 2... | 44.146497 | 88 | 0.68172 |
from datetime import datetime
from django.test import TestCase
from django.utils import unittest
from django.utils.http import parse_etags, quote_etag, parse_http_date
FULL_RESPONSE = 'Test conditional get response'
LAST_MODIFIED = datetime(2007, 10, 21, 23, 21, 47)
LAST_MODIFIED_STR = 'Sun, 21 Oct 2007 23:21:47 GM... | false | true |
f7f48d4ee06aa1913ab8bad70c5c82603cf93037 | 155 | py | Python | navigation/scripts/tests/context.py | archit2604/Trotbot | 8ff34049b9c81fa50d29493b5669140b0f75d0d5 | [
"MIT"
] | 1 | 2020-08-04T12:00:18.000Z | 2020-08-04T12:00:18.000Z | navigation/scripts/tests/context.py | archit2604/Trotbot | 8ff34049b9c81fa50d29493b5669140b0f75d0d5 | [
"MIT"
] | null | null | null | navigation/scripts/tests/context.py | archit2604/Trotbot | 8ff34049b9c81fa50d29493b5669140b0f75d0d5 | [
"MIT"
] | null | null | null | #! /usr/bin/env python2.7
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import RRT
import utils | 19.375 | 82 | 0.722581 |
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import RRT
import utils | true | true |
f7f48dbf813350bf83b765bc98d6621a3b87e62c | 281 | py | Python | iris_data_set.py | karolinaszafranbelzowska/Fisher-s-Iris-Data-Set-2019 | 5ad7fb98ab65d268dd7a9ebebd13eb00970ddc4b | [
"Apache-2.0"
] | null | null | null | iris_data_set.py | karolinaszafranbelzowska/Fisher-s-Iris-Data-Set-2019 | 5ad7fb98ab65d268dd7a9ebebd13eb00970ddc4b | [
"Apache-2.0"
] | null | null | null | iris_data_set.py | karolinaszafranbelzowska/Fisher-s-Iris-Data-Set-2019 | 5ad7fb98ab65d268dd7a9ebebd13eb00970ddc4b | [
"Apache-2.0"
] | null | null | null | # Karolina Szafran-Belzowska, 2019/04/15
# Iris flower Data analysis
# This code will print the whole Fisher's iris flower data
import csv
with open('irisdata.csv') as data:
readCSV = csv.reader(data, delimiter=',')
for columns in readCSV:
print(columns)
| 18.733333 | 58 | 0.690391 |
import csv
with open('irisdata.csv') as data:
readCSV = csv.reader(data, delimiter=',')
for columns in readCSV:
print(columns)
| true | true |
f7f48ddedfe460350379700a3c32617aea44c469 | 587 | py | Python | contact/tests/test_admin.py | uktrade/help | b9c433e639191768e42a7ef4915100a2485fcba9 | [
"MIT"
] | 1 | 2017-05-09T14:45:41.000Z | 2017-05-09T14:45:41.000Z | contact/tests/test_admin.py | uktrade/help | b9c433e639191768e42a7ef4915100a2485fcba9 | [
"MIT"
] | 29 | 2016-11-10T11:15:42.000Z | 2018-11-14T18:40:45.000Z | contact/tests/test_admin.py | uktrade/help | b9c433e639191768e42a7ef4915100a2485fcba9 | [
"MIT"
] | null | null | null | from django.test import TestCase
from django.urls import reverse
class AdminViewTests(TestCase):
def test_admin_restricted(self):
with self.settings(RESTRICT_ADMIN=True):
response = self.client.get(
reverse('admin:login'),
**{'HTTP_X_FORWARDED_FOR': '74.125.224... | 30.894737 | 62 | 0.632027 | from django.test import TestCase
from django.urls import reverse
class AdminViewTests(TestCase):
def test_admin_restricted(self):
with self.settings(RESTRICT_ADMIN=True):
response = self.client.get(
reverse('admin:login'),
**{'HTTP_X_FORWARDED_FOR': '74.125.224... | true | true |
f7f48dfe15e52f4c215a87c215bad982fec434c2 | 2,507 | py | Python | call_map/custom_typing.py | ajylee/call_map | 21e7684b0814eae6f16cd4bc75597dc4e9239ec0 | [
"BSD-2-Clause"
] | 20 | 2017-12-24T00:19:15.000Z | 2021-11-15T07:42:25.000Z | call_map/custom_typing.py | ajylee/call_map | 21e7684b0814eae6f16cd4bc75597dc4e9239ec0 | [
"BSD-2-Clause"
] | 1 | 2017-10-22T21:03:41.000Z | 2017-12-24T04:26:22.000Z | call_map/custom_typing.py | ajylee/call_map | 21e7684b0814eae6f16cd4bc75597dc4e9239ec0 | [
"BSD-2-Clause"
] | 2 | 2017-11-04T10:06:59.000Z | 2019-08-01T22:24:49.000Z | import toolz as tz
import typing
import abc
class TypeSpec(metaclass=abc.ABCMeta):
'''Used to classify objects, but is not an actual Python type
Instead of `isinstance`, use `matches_spec` with `TypeSpec`s. Does not implement any
other interface.
For example, this is useful for specifying a list of ... | 29.494118 | 98 | 0.668528 | import toolz as tz
import typing
import abc
class TypeSpec(metaclass=abc.ABCMeta):
@abc.abstractmethod
def __matches_spec__(self, obj):
pass
def matches_spec(obj: typing.Any, type_spec: typing.Union[type, TypeSpec, typing.Iterable]):
if isinstance(type_spec, type):
return isinstance(obj... | true | true |
f7f48e9ef1ec08ddb43ac6924e1001278169e594 | 29,599 | py | Python | pyvips/tests/test_foreign.py | kleisauke/pyvips | ae3b0c09669cfb662e773e8ae69cf589ac15e320 | [
"MIT"
] | null | null | null | pyvips/tests/test_foreign.py | kleisauke/pyvips | ae3b0c09669cfb662e773e8ae69cf589ac15e320 | [
"MIT"
] | null | null | null | pyvips/tests/test_foreign.py | kleisauke/pyvips | ae3b0c09669cfb662e773e8ae69cf589ac15e320 | [
"MIT"
] | null | null | null | # vim: set fileencoding=utf-8 :
import gc
import os
import shutil
import tempfile
import unittest
import pyvips
from .helpers import PyvipsTester, JPEG_FILE, SRGB_FILE, \
MATLAB_FILE, PNG_FILE, TIF_FILE, OME_FILE, ANALYZE_FILE, \
GIF_FILE, WEBP_FILE, EXR_FILE, FITS_FILE, OPENSLIDE_FILE, \
PDF_FILE, SVG_FIL... | 38.340674 | 79 | 0.597453 |
import gc
import os
import shutil
import tempfile
import unittest
import pyvips
from .helpers import PyvipsTester, JPEG_FILE, SRGB_FILE, \
MATLAB_FILE, PNG_FILE, TIF_FILE, OME_FILE, ANALYZE_FILE, \
GIF_FILE, WEBP_FILE, EXR_FILE, FITS_FILE, OPENSLIDE_FILE, \
PDF_FILE, SVG_FILE, SVGZ_FILE, SVG_GZ_FILE, GIF_... | true | true |
f7f4903170bc28980b022117038c403c77986aa6 | 5,079 | py | Python | src/sima/metocean/longtermstatisticswindcalculation.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | src/sima/metocean/longtermstatisticswindcalculation.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | src/sima/metocean/longtermstatisticswindcalculation.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | # This an autogenerated file
#
# Generated with LongTermStatisticsWindCalculation
from __future__ import annotations
from typing import Dict,Sequence,List
from dmt.entity import Entity
from dmt.blueprint import Blueprint
from .blueprints.longtermstatisticswindcalculation import LongTermStatisticsWindCalculationBluepri... | 28.694915 | 214 | 0.648356 |
from __future__ import annotations
from typing import Dict,Sequence,List
from dmt.entity import Entity
from dmt.blueprint import Blueprint
from .blueprints.longtermstatisticswindcalculation import LongTermStatisticsWindCalculationBlueprint
from typing import Dict
from sima.metocean.calculationlevel import Calculatio... | true | true |
f7f49076c724598ea89e1dcd89f7e4ac8848ae2c | 3,075 | py | Python | mido/backends/amidi.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | mido/backends/amidi.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | mido/backends/amidi.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | """Mido amidi backend
Very experimental backend using amidi to access the ALSA rawmidi
interface.
Todo:
* use parser instead of from_hex()?
* default port name
* do sysex messages work?
* starting amidi for every message sent is costly
"""
import os
import select
import threading
import subprocess
from ..messages im... | 25.204918 | 67 | 0.54439 | import os
import select
import threading
import subprocess
from ..messages import Message
from ._common import PortMethods, InputMethods, OutputMethods
def get_devices():
devices = []
lines = os.popen('amidi -l').read().splitlines()
for line in lines[1:]:
mode, device, name = line.strip().split(No... | true | true |
f7f4909fb6c9c23377a7a9b32ab9888dd4b1da6c | 2,308 | py | Python | etc/config.py | madcat1991/imagester | 5383f2a307bd848b0fe8fa9aab750ca170eb4189 | [
"MIT"
] | null | null | null | etc/config.py | madcat1991/imagester | 5383f2a307bd848b0fe8fa9aab750ca170eb4189 | [
"MIT"
] | 4 | 2021-06-08T22:34:24.000Z | 2022-03-12T00:25:38.000Z | etc/config.py | madcat1991/imagester | 5383f2a307bd848b0fe8fa9aab750ca170eb4189 | [
"MIT"
] | null | null | null | # coding: utf-8
import sys
# logging
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'message_only': {
'format': '%(asctime)s: %(message)s',
'datefmt': '%d-%m-%Y %H:%M:%S',
},
'basic': {
'format': '%(asctime)s:%(leveln... | 21.773585 | 97 | 0.54766 |
import sys
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'message_only': {
'format': '%(asctime)s: %(message)s',
'datefmt': '%d-%m-%Y %H:%M:%S',
},
'basic': {
'format': '%(asctime)s:%(levelname)s: %(message)s',
... | true | true |
f7f493fa99a53ff4aca67b8dcc658ead713cf656 | 289 | py | Python | solutions/1556_thousand_separator.py | YiqunPeng/leetcode_pro | 7e6376984f9baec49a5e827d98330fe3d1b656f0 | [
"MIT"
] | null | null | null | solutions/1556_thousand_separator.py | YiqunPeng/leetcode_pro | 7e6376984f9baec49a5e827d98330fe3d1b656f0 | [
"MIT"
] | null | null | null | solutions/1556_thousand_separator.py | YiqunPeng/leetcode_pro | 7e6376984f9baec49a5e827d98330fe3d1b656f0 | [
"MIT"
] | null | null | null | class Solution:
def thousandSeparator(self, n: int) -> str:
"""String.
"""
res = ''
n = str(n)
for i in range(len(n)):
res += n[i]
if i != len(n) - 1 and (len(n) - i - 1) % 3 == 0:
res += '.'
return res
| 24.083333 | 61 | 0.377163 | class Solution:
def thousandSeparator(self, n: int) -> str:
"""String.
"""
res = ''
n = str(n)
for i in range(len(n)):
res += n[i]
if i != len(n) - 1 and (len(n) - i - 1) % 3 == 0:
res += '.'
return res
| false | true |
f7f494c1677525090b9e250e933973c395f7f18c | 10,267 | py | Python | storage/emulated/0/qpython/lib/python3.2/site-packages/requests/packages/urllib3/util/retry.py | wangkaibiao/SettlersFinancialData3 | 498249e14f24bfa3186f07e8f66ee624d08c6ff1 | [
"MIT"
] | null | null | null | storage/emulated/0/qpython/lib/python3.2/site-packages/requests/packages/urllib3/util/retry.py | wangkaibiao/SettlersFinancialData3 | 498249e14f24bfa3186f07e8f66ee624d08c6ff1 | [
"MIT"
] | null | null | null | storage/emulated/0/qpython/lib/python3.2/site-packages/requests/packages/urllib3/util/retry.py | wangkaibiao/SettlersFinancialData3 | 498249e14f24bfa3186f07e8f66ee624d08c6ff1 | [
"MIT"
] | null | null | null | from __future__ import absolute_import
import time
import logging
from ..exceptions import (
ConnectTimeoutError,
MaxRetryError,
ProtocolError,
ReadTimeoutError,
ResponseError,
)
from ..packages import six
log = logging.getLogger(__name__)
class Retry(object):
""" Retry co... | 35.773519 | 85 | 0.615175 | from __future__ import absolute_import
import time
import logging
from ..exceptions import (
ConnectTimeoutError,
MaxRetryError,
ProtocolError,
ReadTimeoutError,
ResponseError,
)
from ..packages import six
log = logging.getLogger(__name__)
class Retry(object):
DEFAULT_ME... | true | true |
f7f49512c92e6a844967653ccbe4a65c43cf4d4e | 790 | py | Python | meta/generate-docs-index.py | ukpds/ontologies | 46ca9c5e2c476dec9e8fddd37daebbef2719a2c0 | [
"OML"
] | 1 | 2016-11-09T00:38:06.000Z | 2016-11-09T00:38:06.000Z | meta/generate-docs-index.py | ukpds/ontologies | 46ca9c5e2c476dec9e8fddd37daebbef2719a2c0 | [
"OML"
] | null | null | null | meta/generate-docs-index.py | ukpds/ontologies | 46ca9c5e2c476dec9e8fddd37daebbef2719a2c0 | [
"OML"
] | null | null | null | import os
from datetime import datetime
from pathlib import Path
from jinja2 import Environment, FileSystemLoader, select_autoescape
from markupsafe import Markup
from urllib.parse import urlparse
def stemonly(pathvalue):
return Markup(pathvalue.stem)
env = Environment(
loader=FileSystemLoader("./meta/temp... | 20.789474 | 67 | 0.705063 | import os
from datetime import datetime
from pathlib import Path
from jinja2 import Environment, FileSystemLoader, select_autoescape
from markupsafe import Markup
from urllib.parse import urlparse
def stemonly(pathvalue):
return Markup(pathvalue.stem)
env = Environment(
loader=FileSystemLoader("./meta/temp... | true | true |
f7f4952d8d2d6c3b53ecda8af91d722c5251464a | 1,188 | py | Python | students/migrations/0001_initial.py | SoftwareSecureGroup/students_website | 79403878a0158f56e168ec8d5f43bfa6af1ec86a | [
"MIT"
] | null | null | null | students/migrations/0001_initial.py | SoftwareSecureGroup/students_website | 79403878a0158f56e168ec8d5f43bfa6af1ec86a | [
"MIT"
] | 1 | 2016-09-17T15:45:35.000Z | 2016-09-17T15:45:35.000Z | students/migrations/0001_initial.py | SoftwareSecureGroup/students_website | 79403878a0158f56e168ec8d5f43bfa6af1ec86a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-15 14:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Admin',... | 33.942857 | 114 | 0.558923 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Admin',
fields=[
('id', models.AutoField(auto_crea... | true | true |
f7f4957c7ff53f1ff1469f8d139d4270f1828c07 | 14,623 | py | Python | tests/filecheck/math.filecheck.py | konstin/jax | c3581a221842c09dc1b2f301012c3a01734f6b43 | [
"Apache-2.0"
] | 1 | 2022-03-18T17:32:13.000Z | 2022-03-18T17:32:13.000Z | tests/filecheck/math.filecheck.py | konstin/jax | c3581a221842c09dc1b2f301012c3a01734f6b43 | [
"Apache-2.0"
] | 2 | 2022-02-14T05:19:04.000Z | 2022-03-28T04:40:54.000Z | tests/filecheck/math.filecheck.py | yotarok/jax | f7df3ee9c4221a202959e67816d485c35eb98102 | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 30.720588 | 76 | 0.689735 |
from absl import app
from functools import partial
import jax
from jax import numpy as jnp
from jax import lax
import numpy as np
from jax.tests.filecheck.jax_filecheck_helpers import print_ir
jax.config.update("jax_enable_mlir", True)
jax.config.update("jax_enable_x64", True)
def main(_):
... | true | true |
f7f495fbab1aed24d7a26f51a90487121dd47172 | 6,331 | py | Python | optuna/storages/base.py | shikiponn/optuna | a151fafc4d816d9ba7d6740adf8892a7832f83a9 | [
"MIT"
] | 1 | 2019-01-16T23:59:31.000Z | 2019-01-16T23:59:31.000Z | optuna/storages/base.py | shikiponn/optuna | a151fafc4d816d9ba7d6740adf8892a7832f83a9 | [
"MIT"
] | null | null | null | optuna/storages/base.py | shikiponn/optuna | a151fafc4d816d9ba7d6740adf8892a7832f83a9 | [
"MIT"
] | 1 | 2022-01-24T11:42:24.000Z | 2022-01-24T11:42:24.000Z | import abc
import numpy as np
import six
from typing import Any # NOQA
from typing import Dict # NOQA
from typing import List # NOQA
from typing import Optional # NOQA
from typing import Tuple # NOQA
from optuna import distributions # NOQA
from optuna import structs # NOQA
DEFAULT_STUDY_NAME_PREFIX = 'no-name-... | 27.406926 | 90 | 0.652977 | import abc
import numpy as np
import six
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
from typing import Tuple
from optuna import distributions
from optuna import structs
DEFAULT_STUDY_NAME_PREFIX = 'no-name-'
@six.add_metaclass(abc.ABCMeta)
class ... | true | true |
f7f4968c66715212e8397add0cd94790f88ab497 | 5,992 | py | Python | fjord/feedback/south_migrations/0043_fix_android_browser.py | DESHRAJ/fjord | 8899b6286b23347c9b024334e61c33fe133e836d | [
"BSD-3-Clause"
] | null | null | null | fjord/feedback/south_migrations/0043_fix_android_browser.py | DESHRAJ/fjord | 8899b6286b23347c9b024334e61c33fe133e836d | [
"BSD-3-Clause"
] | null | null | null | fjord/feedback/south_migrations/0043_fix_android_browser.py | DESHRAJ/fjord | 8899b6286b23347c9b024334e61c33fe133e836d | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
import os
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.conf import settings
class Migration(DataMigration):
def forwards(self, orm):
rows = (
orm.Response.objects
.filter(browser='... | 63.744681 | 153 | 0.554907 |
import os
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.conf import settings
class Migration(DataMigration):
def forwards(self, orm):
rows = (
orm.Response.objects
.filter(browser='Firefox', browser_platf... | true | true |
f7f497c39223e7705f5781c0b5fe0ceb076b8ff5 | 3,590 | py | Python | isso/tests/test_html.py | Konzertheld/isso | 2ba721790056b252f0752d535e174bd3ab607df2 | [
"MIT"
] | 4 | 2019-12-27T01:54:04.000Z | 2021-02-03T17:04:58.000Z | isso/tests/test_html.py | Konzertheld/isso | 2ba721790056b252f0752d535e174bd3ab607df2 | [
"MIT"
] | null | null | null | isso/tests/test_html.py | Konzertheld/isso | 2ba721790056b252f0752d535e174bd3ab607df2 | [
"MIT"
] | null | null | null | # -*- encoding: utf-8 -*-
import unittest
import textwrap
from isso import config
from isso.utils import html
class TestHTML(unittest.TestCase):
def test_markdown(self):
convert = html.Markdown(extensions=())
examples = [
("*Ohai!*", "<p><em>Ohai!</em></p>"),
("<em>Hi</e... | 35.544554 | 131 | 0.512813 |
import unittest
import textwrap
from isso import config
from isso.utils import html
class TestHTML(unittest.TestCase):
def test_markdown(self):
convert = html.Markdown(extensions=())
examples = [
("*Ohai!*", "<p><em>Ohai!</em></p>"),
("<em>Hi</em>", "<p><em>Hi</em></p>"... | true | true |
f7f497c422aedc0ee5dd0263e662fc41984db5bf | 8,334 | py | Python | autoPyTorch/components/networks/feature/shapedmlpnet.py | thomascherickal/Auto-PyTorch | 9e25a3bdef8e836e63979229eef77830cd64bb53 | [
"BSD-3-Clause"
] | 1 | 2019-09-02T00:37:52.000Z | 2019-09-02T00:37:52.000Z | autoPyTorch/components/networks/feature/shapedmlpnet.py | thomascherickal/Auto-PyTorch | 9e25a3bdef8e836e63979229eef77830cd64bb53 | [
"BSD-3-Clause"
] | null | null | null | autoPyTorch/components/networks/feature/shapedmlpnet.py | thomascherickal/Auto-PyTorch | 9e25a3bdef8e836e63979229eef77830cd64bb53 | [
"BSD-3-Clause"
] | 1 | 2019-09-02T00:40:30.000Z | 2019-09-02T00:40:30.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Multilayer Perceptrons in fancy shapes.
"""
import ConfigSpace as CS
import ConfigSpace.hyperparameters as CSH
import torch.nn as nn
from autoPyTorch.components.networks.feature.mlpnet import MlpNet
__author__ = "Max Dippel, Michael Burkart and Matthias Urban"
__ver... | 37.04 | 165 | 0.562275 |
import ConfigSpace as CS
import ConfigSpace.hyperparameters as CSH
import torch.nn as nn
from autoPyTorch.components.networks.feature.mlpnet import MlpNet
__author__ = "Max Dippel, Michael Burkart and Matthias Urban"
__version__ = "0.0.1"
__license__ = "BSD"
class ShapedMlpNet(MlpNet):
def __init__(self, *arg... | true | true |
f7f498d46d88a2fa701629d90e262b2a95c71211 | 1,128 | py | Python | dumpster.py | Dark-PRINCESS/Dark-PRINCESS- | 0ad9c67960c8f88745442d264fdcd113b9925807 | [
"MIT"
] | 1 | 2020-10-23T09:35:36.000Z | 2020-10-23T09:35:36.000Z | dumpster.py | Dark-PRINCESS/Dark-PRINCESS- | 0ad9c67960c8f88745442d264fdcd113b9925807 | [
"MIT"
] | null | null | null | dumpster.py | Dark-PRINCESS/Dark-PRINCESS- | 0ad9c67960c8f88745442d264fdcd113b9925807 | [
"MIT"
] | null | null | null | from telethon import events
import asyncio
from userbot.utils import admin_cmd
@borg.on(admin_cmd(pattern="dump ?(.*)"))
async def _(message):
try:
obj = message.pattern_match.group(1)
if len(obj) != 3:
raise IndexError
inp = ' '.join(obj)
except IndexError:
... | 40.285714 | 97 | 0.446809 | from telethon import events
import asyncio
from userbot.utils import admin_cmd
@borg.on(admin_cmd(pattern="dump ?(.*)"))
async def _(message):
try:
obj = message.pattern_match.group(1)
if len(obj) != 3:
raise IndexError
inp = ' '.join(obj)
except IndexError:
... | true | true |
f7f49ac27526cadce47c6bf488bc8e3e0b841214 | 66,594 | py | Python | samtranslator/swagger/swagger.py | JiteshKanojia/serverless-application-model | 034e7b8ac10d9c5aaa3a5f7999db57308ffc1a2f | [
"Apache-2.0"
] | null | null | null | samtranslator/swagger/swagger.py | JiteshKanojia/serverless-application-model | 034e7b8ac10d9c5aaa3a5f7999db57308ffc1a2f | [
"Apache-2.0"
] | null | null | null | samtranslator/swagger/swagger.py | JiteshKanojia/serverless-application-model | 034e7b8ac10d9c5aaa3a5f7999db57308ffc1a2f | [
"Apache-2.0"
] | null | null | null | import copy
import json
import re
from samtranslator.model.intrinsics import ref
from samtranslator.model.intrinsics import make_conditional, fnSub
from samtranslator.model.exceptions import InvalidDocumentException, InvalidTemplateException
from samtranslator.utils.py27hash_fix import Py27Dict, Py27UniStr
class Sw... | 46.149688 | 145 | 0.652326 | import copy
import json
import re
from samtranslator.model.intrinsics import ref
from samtranslator.model.intrinsics import make_conditional, fnSub
from samtranslator.model.exceptions import InvalidDocumentException, InvalidTemplateException
from samtranslator.utils.py27hash_fix import Py27Dict, Py27UniStr
class Sw... | false | true |
f7f49ae0612ea6ce2c2d85e5627d99592aab56dd | 9,240 | py | Python | venv/lib/python3.9/site-packages/jupyter_client/threaded.py | CMU-IDS-2022/final-project-the-evaluators | 3b9262ad1a0f7315208a94a05ea1ce38e679d01d | [
"BSD-3-Clause"
] | null | null | null | venv/lib/python3.9/site-packages/jupyter_client/threaded.py | CMU-IDS-2022/final-project-the-evaluators | 3b9262ad1a0f7315208a94a05ea1ce38e679d01d | [
"BSD-3-Clause"
] | null | null | null | venv/lib/python3.9/site-packages/jupyter_client/threaded.py | CMU-IDS-2022/final-project-the-evaluators | 3b9262ad1a0f7315208a94a05ea1ce38e679d01d | [
"BSD-3-Clause"
] | null | null | null | """ Defines a KernelClient that provides thread-safe sockets with async callbacks on message
replies.
"""
import asyncio
import atexit
import errno
import time
from threading import Event
from threading import Thread
from typing import Any
from typing import Awaitable
from typing import Dict
from typing import List
fro... | 30.394737 | 99 | 0.616667 | import asyncio
import atexit
import errno
import time
from threading import Event
from threading import Thread
from typing import Any
from typing import Awaitable
from typing import Dict
from typing import List
from typing import Optional
from typing import Union
import zmq
from traitlets import Instance
from traitl... | true | true |
f7f49b05f568e898e2e49fcbc9f65349029a35c5 | 5,589 | py | Python | tests/python/gaia-ui-tests/gaiatest/tests/functional/ftu/test_ftu_with_tour.py | BReduardokramer/gaia | c00302cdcd435ab193e8365917cfc6abac9e4f2e | [
"Apache-2.0"
] | null | null | null | tests/python/gaia-ui-tests/gaiatest/tests/functional/ftu/test_ftu_with_tour.py | BReduardokramer/gaia | c00302cdcd435ab193e8365917cfc6abac9e4f2e | [
"Apache-2.0"
] | null | null | null | tests/python/gaia-ui-tests/gaiatest/tests/functional/ftu/test_ftu_with_tour.py | BReduardokramer/gaia | c00302cdcd435ab193e8365917cfc6abac9e4f2e | [
"Apache-2.0"
] | null | null | null | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette.by import By
from gaiatest import GaiaTestCase
class TestFtu(GaiaTestCase):
_next_button_locator... | 47.769231 | 103 | 0.724638 |
from marionette.by import By
from gaiatest import GaiaTestCase
class TestFtu(GaiaTestCase):
_next_button_locator = (By.ID, 'forward')
_section_languages_locator = (By.ID, 'languages')
_section_cell_data_locator = (By.ID, 'data_3g')
_section_wifi_locator = (By.ID, 'wifi')
_found_wifi_network... | true | true |
f7f49b6c543f031d1c2df30b1dd79d02325a9495 | 6,252 | py | Python | research/maskgan/losses/losses.py | jdavidagudelo/tensorflow-models | 6f019beec73b01861363bf717706e27f4210b979 | [
"Apache-2.0"
] | 1 | 2021-05-17T01:42:29.000Z | 2021-05-17T01:42:29.000Z | research/maskgan/losses/losses.py | jdavidagudelo/tensorflow-models | 6f019beec73b01861363bf717706e27f4210b979 | [
"Apache-2.0"
] | null | null | null | research/maskgan/losses/losses.py | jdavidagudelo/tensorflow-models | 6f019beec73b01861363bf717706e27f4210b979 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 33.433155 | 80 | 0.709853 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
def discriminator_loss(predictions, labels, missing_tokens):
loss = tf.losses.sigmoid_cross_entropy(labels,
predictions,
... | true | true |
f7f49d47138b60513d496a49ccdf62a4af486eeb | 11,164 | py | Python | tests/attacks/evasion/test_dpatch_robust.py | monshri/adversarial-robustness-toolbox | 6465240cb6a71bc376dae52459a7133e403df8d2 | [
"MIT"
] | 1,350 | 2020-07-14T08:06:55.000Z | 2022-03-31T19:22:25.000Z | tests/attacks/evasion/test_dpatch_robust.py | monshri/adversarial-robustness-toolbox | 6465240cb6a71bc376dae52459a7133e403df8d2 | [
"MIT"
] | 936 | 2020-07-14T03:33:00.000Z | 2022-03-31T23:05:29.000Z | tests/attacks/evasion/test_dpatch_robust.py | monshri/adversarial-robustness-toolbox | 6465240cb6a71bc376dae52459a7133e403df8d2 | [
"MIT"
] | 413 | 2020-07-16T16:00:16.000Z | 2022-03-29T10:31:12.000Z | # MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2020
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# r... | 34.996865 | 120 | 0.620924 |
import logging
import numpy as np
import pytest
from art.attacks.evasion import RobustDPatch
from art.estimators.estimator import BaseEstimator, LossGradientsMixin
from art.estimators.object_detection.object_detector import ObjectDetectorMixin
from tests.attacks.utils import backend_test_classifier_... | true | true |
f7f49e7f3d8753122ece7ea1d03f1e16f8545ebd | 3,120 | py | Python | dataset.py | bklppr/yolo2_onnx | fcb85bd94e22c1c47f20fc13bb6ae3ac1ccd10f4 | [
"MIT"
] | null | null | null | dataset.py | bklppr/yolo2_onnx | fcb85bd94e22c1c47f20fc13bb6ae3ac1ccd10f4 | [
"MIT"
] | null | null | null | dataset.py | bklppr/yolo2_onnx | fcb85bd94e22c1c47f20fc13bb6ae3ac1ccd10f4 | [
"MIT"
] | 1 | 2018-07-11T22:44:11.000Z | 2018-07-11T22:44:11.000Z | #!/usr/bin/python
# encoding: utf-8
import os
import random
import torch
import numpy as np
from torch.utils.data import Dataset
from PIL import Image
from utils import read_truths_args, read_truths
from image import *
class listDataset(Dataset):
def __init__(self, root, shape=None, shuffle=True, transform=None,... | 33.548387 | 144 | 0.549359 |
import os
import random
import torch
import numpy as np
from torch.utils.data import Dataset
from PIL import Image
from utils import read_truths_args, read_truths
from image import *
class listDataset(Dataset):
def __init__(self, root, shape=None, shuffle=True, transform=None, target_transform=None, train=Fals... | true | true |
f7f4a0858fe848911aa0c1a54269a299d7536d5a | 2,021 | py | Python | tests/backends/django/testapp/migrations/0001_initial.py | bitner/pygeofilter | 140aee2f3197044cc18dd111c71e2fcdc516a200 | [
"MIT"
] | 19 | 2021-03-30T18:18:10.000Z | 2022-03-23T13:53:55.000Z | tests/backends/django/testapp/migrations/0001_initial.py | bitner/pygeofilter | 140aee2f3197044cc18dd111c71e2fcdc516a200 | [
"MIT"
] | 20 | 2021-04-25T10:32:41.000Z | 2022-01-21T10:48:30.000Z | tests/backends/django/testapp/migrations/0001_initial.py | bitner/pygeofilter | 140aee2f3197044cc18dd111c71e2fcdc516a200 | [
"MIT"
] | 6 | 2021-06-09T01:07:17.000Z | 2022-02-27T16:29:55.000Z | # flake8: noqa
# Generated by Django 2.2.5 on 2019-09-09 07:18
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateMode... | 45.931818 | 141 | 0.613063 |
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Record',
fields=[
... | true | true |
f7f4a1884584bcd3f47bbe36d93f495b8cdc7a6f | 75,507 | py | Python | neurora/rsa_plot.py | ZitongLu1996/NeuroRA | 4e72f5b37ff308a4a068107b35f7555df6b7df0d | [
"MIT"
] | 110 | 2019-04-30T03:52:48.000Z | 2022-03-19T08:23:38.000Z | neurora/rsa_plot.py | ZitongLu1996/NeuroRA | 4e72f5b37ff308a4a068107b35f7555df6b7df0d | [
"MIT"
] | 2 | 2020-07-23T14:31:30.000Z | 2022-01-14T08:30:00.000Z | neurora/rsa_plot.py | ZitongLu1996/NeuroRA | 4e72f5b37ff308a4a068107b35f7555df6b7df0d | [
"MIT"
] | 20 | 2020-03-02T11:58:30.000Z | 2021-12-31T08:29:53.000Z | # -*- coding: utf-8 -*-
' a module for plotting the NeuroRA results '
__author__ = 'Zitong Lu'
import numpy as np
import copy
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
from scipy import signal
from scipy.stats import ttest_1samp, ttest_rel
from nilearn import plotting, datasets, surface
... | 37.049558 | 134 | 0.596673 |
__author__ = 'Zitong Lu'
import numpy as np
import copy
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
from scipy import signal
from scipy.stats import ttest_1samp, ttest_rel
from nilearn import plotting, datasets, surface
import nibabel as nib
from neurora.stuff import get_affine, get_bg_ch... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.