hexsha stringlengths 40 40 | size int64 7 1.04M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 247 | max_stars_repo_name stringlengths 4 125 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 368k ⌀ | 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 247 | max_issues_repo_name stringlengths 4 125 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 116k ⌀ | 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 247 | max_forks_repo_name stringlengths 4 125 | max_forks_repo_head_hexsha stringlengths 40 78 | 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 1 1.04M | avg_line_length float64 1.77 618k | max_line_length int64 1 1.02M | alphanum_fraction float64 0 1 | original_content stringlengths 7 1.04M | filtered:remove_function_no_docstring int64 -102 942k | filtered:remove_class_no_docstring int64 -354 977k | filtered:remove_delete_markers int64 0 60.1k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9629e7a7a9bef340102ccfb4ccbdd868576c42f6 | 7,336 | py | Python | cirq-core/cirq/sim/clifford/act_on_clifford_tableau_args.py | livenson/Cirq | b2fa642895089fba385999d675ab65d57a53e0df | [
"Apache-2.0"
] | 1 | 2022-02-02T07:13:54.000Z | 2022-02-02T07:13:54.000Z | cirq-core/cirq/sim/clifford/act_on_clifford_tableau_args.py | bradyb/Cirq | 610b0d4ea3a7862169610797266734c844ddcc1f | [
"Apache-2.0"
] | null | null | null | cirq-core/cirq/sim/clifford/act_on_clifford_tableau_args.py | bradyb/Cirq | 610b0d4ea3a7862169610797266734c844ddcc1f | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 The Cirq Developers
#
# 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 ... | 40.98324 | 91 | 0.594193 | # Copyright 2018 The Cirq Developers
#
# 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 ... | 4,852 | 0 | 243 |
b9ae65bc8f8cdccfa8ec57ea6f590f702a485148 | 5,875 | py | Python | openGaussBase/testcase/CONNECTORS/PYTHON/PYOG/Opengauss_Function_Connect_Python_Case0005.py | opengauss-mirror/Yat | aef107a8304b94e5d99b4f1f36eb46755eb8919e | [
"MulanPSL-1.0"
] | null | null | null | openGaussBase/testcase/CONNECTORS/PYTHON/PYOG/Opengauss_Function_Connect_Python_Case0005.py | opengauss-mirror/Yat | aef107a8304b94e5d99b4f1f36eb46755eb8919e | [
"MulanPSL-1.0"
] | null | null | null | openGaussBase/testcase/CONNECTORS/PYTHON/PYOG/Opengauss_Function_Connect_Python_Case0005.py | opengauss-mirror/Yat | aef107a8304b94e5d99b4f1f36eb46755eb8919e | [
"MulanPSL-1.0"
] | null | null | null | """
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... | 37.660256 | 84 | 0.621787 | """
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... | 4,784 | 16 | 103 |
961d257aa7ee40fc569bdad4eceb6e9d5d1eb49c | 6,178 | py | Python | main/environment.py | zzong2006/space-filling-curve-with-RF-learning | 30823745dae91240c0977185fb1831c9b4771a40 | [
"MIT"
] | 1 | 2021-05-15T23:27:58.000Z | 2021-05-15T23:27:58.000Z | main/environment.py | zzong2006/space-filling-curve-with-RF-learning | 30823745dae91240c0977185fb1831c9b4771a40 | [
"MIT"
] | null | null | null | main/environment.py | zzong2006/space-filling-curve-with-RF-learning | 30823745dae91240c0977185fb1831c9b4771a40 | [
"MIT"
] | null | null | null | from itertools import combinations
import numpy as np
import matplotlib.pyplot as plt
from utils import *
import configparser
import torch
class CurveEnvironment:
"""
Curve 환경, 강화 학습 모델이 생성한 action을 기반으로 커브의 순서를 바꾸고, 바뀐 커브를 기반으로 reward를 측정
"""
def __init__(self, order=3, dim=2, data_size=10, ini... | 33.215054 | 111 | 0.570411 | from itertools import combinations
import numpy as np
import matplotlib.pyplot as plt
from utils import *
import configparser
import torch
class CurveEnvironment:
"""
Curve 환경, 강화 학습 모델이 생성한 action을 기반으로 커브의 순서를 바꾸고, 바뀐 커브를 기반으로 reward를 측정
"""
def __init__(self, order=3, dim=2, data_size=10, ini... | 947 | 0 | 80 |
145d5556f43decc68e22fba23de0af8fd6b8a78f | 806 | py | Python | template_engine/jinja2_filters.py | samuelcouch/the-blue-alliance | 8c7977071dbe9d9745ffdfbb03e37bd016792511 | [
"MIT"
] | null | null | null | template_engine/jinja2_filters.py | samuelcouch/the-blue-alliance | 8c7977071dbe9d9745ffdfbb03e37bd016792511 | [
"MIT"
] | null | null | null | template_engine/jinja2_filters.py | samuelcouch/the-blue-alliance | 8c7977071dbe9d9745ffdfbb03e37bd016792511 | [
"MIT"
] | null | null | null | from email import utils
import re
import time
import urllib
def strftime(datetime, formatstr):
"""
Uses Python's strftime with some tweaks
"""
return datetime.strftime(formatstr).lstrip("0").replace(" 0", " ")
# def slugify(s):
# """
# Use Django's slugify method
# """
# return ... | 17.148936 | 70 | 0.611663 | from email import utils
import re
import time
import urllib
def digits(s):
if not s:
return ''
if type(s) is int:
return s
return re.sub('[^0-9]', '', s)
def floatformat(num, num_decimals):
return "%.{}f".format(num_decimals) % num
def strftime(datetime, formatstr):
"""
Use... | 345 | 0 | 115 |
4d02e68b8ef0c65c77338fd1b55733f17d364293 | 12,812 | py | Python | custom_components/openmediavault/omv_controller.py | firstof9/homeassistant-openmediavault | 3a0cd5ae34b045e90b06b15760329e987c87b5fd | [
"Apache-2.0"
] | 41 | 2020-04-20T15:57:14.000Z | 2022-03-24T18:16:28.000Z | custom_components/openmediavault/omv_controller.py | firstof9/homeassistant-openmediavault | 3a0cd5ae34b045e90b06b15760329e987c87b5fd | [
"Apache-2.0"
] | 68 | 2020-04-27T08:36:47.000Z | 2022-03-31T07:04:47.000Z | custom_components/openmediavault/omv_controller.py | firstof9/homeassistant-openmediavault | 3a0cd5ae34b045e90b06b15760329e987c87b5fd | [
"Apache-2.0"
] | 13 | 2020-09-11T12:45:51.000Z | 2022-03-30T06:58:05.000Z | """OpenMediaVault Controller."""
import asyncio
import time
from datetime import timedelta
from homeassistant.const import (
CONF_HOST,
CONF_NAME,
CONF_PASSWORD,
CONF_SSL,
CONF_USERNAME,
CONF_VERIFY_SSL,
)
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import asy... | 36.501425 | 90 | 0.46956 | """OpenMediaVault Controller."""
import asyncio
import time
from datetime import timedelta
from homeassistant.const import (
CONF_HOST,
CONF_NAME,
CONF_PASSWORD,
CONF_SSL,
CONF_USERNAME,
CONF_VERIFY_SSL,
)
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import asy... | 1,433 | 0 | 52 |
79540db7343cd37c04169f2c2a9534f0c0ea7d5c | 1,187 | py | Python | code/math_examples.py | rustam-fork/ml-course-uz | e1554d4c69bf0e421aa596d77aab65639df1ff73 | [
"MIT"
] | 21 | 2018-01-05T09:24:49.000Z | 2021-04-24T03:25:25.000Z | code/math_examples.py | rustam-fork/ml-course-uz | e1554d4c69bf0e421aa596d77aab65639df1ff73 | [
"MIT"
] | 1 | 2019-11-11T18:34:53.000Z | 2019-11-13T15:56:10.000Z | code/math_examples.py | rustam-fork/ml-course-uz | e1554d4c69bf0e421aa596d77aab65639df1ff73 | [
"MIT"
] | 13 | 2018-01-05T10:26:47.000Z | 2022-01-25T07:48:33.000Z | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
| 27.604651 | 118 | 0.57877 | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
def draw_parabola(steps=50):
x = np.linspace(-4, 4, steps)
plt.plot(x, x ** 2)
plt.axvline(x=0, color='b', linestyle='dashed')
def draw_paraboloid(steps=50):
fig = plt.figure(figsize=... | 975 | 0 | 92 |
246e0749cdd1714c65c0961416623be200a020e0 | 3,849 | py | Python | trees/trees.py | patinousward/machine-learning | 124b6c2e1a317f21238985ee4b74b638f5358b81 | [
"MIT"
] | null | null | null | trees/trees.py | patinousward/machine-learning | 124b6c2e1a317f21238985ee4b74b638f5358b81 | [
"MIT"
] | null | null | null | trees/trees.py | patinousward/machine-learning | 124b6c2e1a317f21238985ee4b74b638f5358b81 | [
"MIT"
] | null | null | null | from math import log
import operator
# 计算香农熵
# axis 表示第几列的纬度index ,value表示这个纬度的值作为分界
# 多数表决
# 创建树的函数代码
| 37.009615 | 97 | 0.665887 | from math import log
import operator
# 计算香农熵
def calcShannonEnt(dataSet):
numEntries = len(dataSet)
labelCounts = {}
for featVec in dataSet:
currentLabel = featVec[-1] # 数据的最后一列
if currentLabel not in labelCounts.keys():
labelCounts[currentLabel] = 0 # 默认值为0
labelCounts... | 4,815 | 0 | 135 |
504a306dad3ee3153b338e1d454699034e9ee967 | 1,850 | py | Python | code/Solution_0052_totalNQueens.py | qizhenkang/myLeetCode | cb9edce69567eba9d96ce756507a5a7ac6e74293 | [
"MIT"
] | null | null | null | code/Solution_0052_totalNQueens.py | qizhenkang/myLeetCode | cb9edce69567eba9d96ce756507a5a7ac6e74293 | [
"MIT"
] | null | null | null | code/Solution_0052_totalNQueens.py | qizhenkang/myLeetCode | cb9edce69567eba9d96ce756507a5a7ac6e74293 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 16 20:00:44 2021
@author: qizhe
"""
if __name__ == '__main__':
solu = Solution()
input_List = [[5,1,9,11],[2,4,8,10],[13,3,6,7],[15,14,12,16]]
input_List = [[0,1,2,3],[4,5,6,7],[8,9,10,11],[12,13,14,15]]
# input_List = 1
result = solu.solveNQueen... | 27.61194 | 114 | 0.463784 | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 16 20:00:44 2021
@author: qizhe
"""
class Solution:
def solveNQueens(self, n: int):
"""
典型的回溯问题
读题目,他要的是,所有解,不是找到一个就可以
第三个思路对了,但性能很差,想办法剪枝一下,感觉主要问题在于valid 的恢复上面
答案:
核心思路:
1、答案搞了3个集合,也就是三个约束来构造,就很简单了,然后优... | 850 | 1,233 | 23 |
5ebadfa1130eda16e18e9a569211fa885b32c271 | 1,835 | py | Python | preprocess_hdf5_data.py | trane293/multimodal_brain_synthesis | 29291f091c15121707fd0fdcb1245d2ad8b944e2 | [
"MIT"
] | null | null | null | preprocess_hdf5_data.py | trane293/multimodal_brain_synthesis | 29291f091c15121707fd0fdcb1245d2ad8b944e2 | [
"MIT"
] | null | null | null | preprocess_hdf5_data.py | trane293/multimodal_brain_synthesis | 29291f091c15121707fd0fdcb1245d2ad8b944e2 | [
"MIT"
] | null | null | null | import h5py
import numpy as np
'''
if 't1.'
i = 0
seq_name = 't1'
elif 't2.' in imagefile:
i = 1
seq_name = 't2'
elif 't1ce.' in imagefile:
i = 2
seq_name = 't1ce'
elif 'flair.' in imagefile:
i = 3
seq_name = 'flair'
'''
import platform
# to make the code portable even on cedar,you ne... | 28.230769 | 112 | 0.683379 | import h5py
import numpy as np
'''
if 't1.'
i = 0
seq_name = 't1'
elif 't2.' in imagefile:
i = 1
seq_name = 't2'
elif 't1ce.' in imagefile:
i = 2
seq_name = 't1ce'
elif 'flair.' in imagefile:
i = 3
seq_name = 'flair'
'''
import platform
# to make the code portable even on cedar,you ne... | 0 | 0 | 0 |
e81417a710f461b78ac0a327b034ccca776c6883 | 1,035 | py | Python | tests/test_hessian.py | blevine37/pySpawn17 | 4fa65cfc3b4d399bcb586506782d00f86b453139 | [
"MIT"
] | 18 | 2018-03-30T16:11:13.000Z | 2021-08-22T18:57:12.000Z | tests/test_hessian.py | dfedorov1988/MCDMS | 215e18327ad9f806d82eb54d101d657d0ac29bd6 | [
"MIT"
] | 3 | 2018-03-30T17:26:51.000Z | 2021-08-17T08:49:24.000Z | tests/test_hessian.py | dfedorov1988/MCDMS | 215e18327ad9f806d82eb54d101d657d0ac29bd6 | [
"MIT"
] | 6 | 2018-11-21T15:30:38.000Z | 2021-07-05T05:37:15.000Z | import numpy as np
import pyspawn
pyspawn.import_methods.into_hessian(pyspawn.potential.terachem_cas)
hess = pyspawn.hessian()
ndims = 18
istate = 0
pos = np.asarray([ 0.000000000, 0.000000000, 0.101944554,
0.000000000, 0.000000000, 2.598055446,
0.000... | 23 | 67 | 0.547826 | import numpy as np
import pyspawn
pyspawn.import_methods.into_hessian(pyspawn.potential.terachem_cas)
hess = pyspawn.hessian()
ndims = 18
istate = 0
pos = np.asarray([ 0.000000000, 0.000000000, 0.101944554,
0.000000000, 0.000000000, 2.598055446,
0.000... | 0 | 0 | 0 |
0037bdf517203ae654e04612f90ba818f7dbac6d | 2,434 | py | Python | setup.py | mmcauliffe/Conch | 7668612d7a610d0f5ae3332f990e71b26c5e8b34 | [
"MIT"
] | 33 | 2015-06-10T19:36:54.000Z | 2017-09-18T23:57:46.000Z | setup.py | mmcauliffe/Conch | 7668612d7a610d0f5ae3332f990e71b26c5e8b34 | [
"MIT"
] | 5 | 2015-03-22T07:05:21.000Z | 2017-08-16T03:48:19.000Z | setup.py | mmcauliffe/Conch | 7668612d7a610d0f5ae3332f990e71b26c5e8b34 | [
"MIT"
] | 10 | 2015-04-29T05:51:51.000Z | 2017-07-12T18:52:18.000Z | import sys
import os
from setuptools import setup
from setuptools.command.test import test as TestCommand
import conch
if __name__ == '__main__':
setup(name='conch-sounds',
version=conch.__version__,
description='Analyze acoustic similarity in Python',
classifiers=[
... | 34.28169 | 91 | 0.527116 | import sys
import os
from setuptools import setup
from setuptools.command.test import test as TestCommand
import conch
def readme():
with open('README.md') as f:
return f.read()
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args ... | 499 | 5 | 99 |
0b85d81800350d0c5bcb9d6960d0c2633d6cec54 | 1,121 | py | Python | pobx/aio/operators.py | nardi/pobx | 91a0ce371def5ba8622c41faae5faa1199f16118 | [
"MIT"
] | 2 | 2021-01-31T06:45:59.000Z | 2021-02-01T01:20:10.000Z | pobx/aio/operators.py | nardi/pobx | 91a0ce371def5ba8622c41faae5faa1199f16118 | [
"MIT"
] | null | null | null | pobx/aio/operators.py | nardi/pobx | 91a0ce371def5ba8622c41faae5faa1199f16118 | [
"MIT"
] | null | null | null | import aioreactive as rx
from aioreactive import AsyncAnonymousObserver
from aioreactive.subject import AsyncSubject
from ..utils import dropargs, asyncinit
@asyncinit | 29.5 | 95 | 0.67083 | import aioreactive as rx
from aioreactive import AsyncAnonymousObserver
from aioreactive.subject import AsyncSubject
from ..utils import dropargs, asyncinit
@asyncinit
class BufferOperator():
async def __init__(self, boundaries):
self.emitter = AsyncSubject()
self.buffer = []
async def em... | 798 | 2 | 152 |
2dc21830f816f4bcf684cb12098052219e1f3815 | 6,400 | py | Python | router/run.py | Financial-Times/paasport | 9f5ec95b99f03c06dc800907f6f0750f5eec7a35 | [
"MIT"
] | 2 | 2015-04-21T10:50:15.000Z | 2015-04-22T15:48:45.000Z | router/run.py | Financial-Times/paasport | 9f5ec95b99f03c06dc800907f6f0750f5eec7a35 | [
"MIT"
] | null | null | null | router/run.py | Financial-Times/paasport | 9f5ec95b99f03c06dc800907f6f0750f5eec7a35 | [
"MIT"
] | 1 | 2020-07-30T14:50:38.000Z | 2020-07-30T14:50:38.000Z | #!/usr/bin/python
# Layer 7 Router
#
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
import json, re, os, subprocess
PORT_NUMBER = 8080
# Writes config for a given service
globaladdons = {
'example': [
'ec2-52-16-13-243.eu-west-1.compute.amazonaws.com',
],
}
for name, machines in globaladdons.it... | 29.090909 | 175 | 0.66375 | #!/usr/bin/python
# Layer 7 Router
#
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
import json, re, os, subprocess
PORT_NUMBER = 8080
class UserError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
def writedefaultvcl():
vcl = "vcl 4.0;\n\... | 5,288 | 163 | 136 |
4c771c595f5a2b799d9ea019a22c62e966df3bf9 | 1,849 | py | Python | tests/unit/test_compact.py | armon/pypred | 4f96575a9c05ab2829c0808737b146d8cc632cb7 | [
"BSD-3-Clause"
] | 40 | 2015-03-16T02:15:51.000Z | 2022-02-04T20:54:47.000Z | tests/unit/test_compact.py | armon/pypred | 4f96575a9c05ab2829c0808737b146d8cc632cb7 | [
"BSD-3-Clause"
] | 10 | 2015-01-02T16:23:37.000Z | 2021-07-15T07:28:12.000Z | tests/unit/test_compact.py | armon/pypred | 4f96575a9c05ab2829c0808737b146d8cc632cb7 | [
"BSD-3-Clause"
] | 17 | 2015-06-11T14:25:09.000Z | 2021-07-14T07:30:04.000Z | from pypred import ast, compact
| 31.87931 | 93 | 0.566252 | from pypred import ast, compact
class TestCompact(object):
def test_compact(self):
l = ast.Literal('foo')
v = ast.Number(42)
gt = ast.CompareOperator('>', l, v)
l1 = ast.Literal('foo')
v1 = ast.Number(42)
lt = ast.CompareOperator('<', l1, v1)
n = ast.Logica... | 1,734 | 5 | 77 |
ba89dd4cb6362cf1ebc95ae0ce94f8263fa0dede | 2,621 | py | Python | docs/build_cli_docs.py | TedrosGitHub/TSA-yatsm | 8e328f366c8fd94d5cc57cd2cc42080c43d1f391 | [
"MIT"
] | 59 | 2015-02-03T19:56:17.000Z | 2022-03-17T13:45:23.000Z | docs/build_cli_docs.py | TedrosGitHub/TSA-yatsm | 8e328f366c8fd94d5cc57cd2cc42080c43d1f391 | [
"MIT"
] | 97 | 2015-02-12T05:18:38.000Z | 2020-06-09T16:10:38.000Z | docs/build_cli_docs.py | TedrosGitHub/TSA-yatsm | 8e328f366c8fd94d5cc57cd2cc42080c43d1f391 | [
"MIT"
] | 35 | 2015-02-27T19:43:23.000Z | 2021-06-21T02:29:14.000Z | #!/usr/bin/env python
""" Build CLI help pages to RST for dynamic inclusion of help messages
This solves the problem of not being able to install YATSM on readthedocs
because of its complicated dependencies without the need to mock out
basically every import. Just run this script before pushing any new changes
to the ... | 30.126437 | 79 | 0.638306 | #!/usr/bin/env python
""" Build CLI help pages to RST for dynamic inclusion of help messages
This solves the problem of not being able to install YATSM on readthedocs
because of its complicated dependencies without the need to mock out
basically every import. Just run this script before pushing any new changes
to the ... | 504 | 0 | 46 |
2e975b39468ca0ba983a654b851314f2a36a1b84 | 151 | py | Python | Python3/DebuggingAndErrorHandling/try_except.py | norbertosanchezdichi/TIL | 2e9719ddd288022f53b094a42679e849bdbcc625 | [
"MIT"
] | null | null | null | Python3/DebuggingAndErrorHandling/try_except.py | norbertosanchezdichi/TIL | 2e9719ddd288022f53b094a42679e849bdbcc625 | [
"MIT"
] | null | null | null | Python3/DebuggingAndErrorHandling/try_except.py | norbertosanchezdichi/TIL | 2e9719ddd288022f53b094a42679e849bdbcc625 | [
"MIT"
] | null | null | null | try:
foobar
except: #"catch all", highly discourage due to not being able to identify what went wrong
print("PROBLEM")
print("after the try") | 30.2 | 91 | 0.708609 | try:
foobar
except: #"catch all", highly discourage due to not being able to identify what went wrong
print("PROBLEM")
print("after the try") | 0 | 0 | 0 |
2e644c0780b72db35e413e1216b0bdcb7a87ce73 | 3,895 | py | Python | src/onnxruntime_numpy/einsum_helper.py | gf712/onnxruntime-numpy | 752ecb90e97295384c96ff339165c461ba4caf87 | [
"MIT"
] | 2 | 2021-04-24T07:50:31.000Z | 2021-09-07T18:56:51.000Z | src/onnxruntime_numpy/einsum_helper.py | gf712/onnxruntime-numpy | 752ecb90e97295384c96ff339165c461ba4caf87 | [
"MIT"
] | null | null | null | src/onnxruntime_numpy/einsum_helper.py | gf712/onnxruntime-numpy | 752ecb90e97295384c96ff339165c461ba4caf87 | [
"MIT"
] | null | null | null | import re
import string
# obtained and modified from
# https://github.com/tensorflow/tensorflow/blob/590d6eef7e91a6a7392c8ffffb7b58f2e0c8bc6b/tensorflow/python/ops/special_math_ops.py#L311
def einsum_parse_and_resolve_equation(equation, input_shapes):
"""Helper for einsum() that splits/resolves inputs & outputs.... | 45.290698 | 135 | 0.618485 | import re
import string
# obtained and modified from
# https://github.com/tensorflow/tensorflow/blob/590d6eef7e91a6a7392c8ffffb7b58f2e0c8bc6b/tensorflow/python/ops/special_math_ops.py#L311
def einsum_parse_and_resolve_equation(equation, input_shapes):
"""Helper for einsum() that splits/resolves inputs & outputs.... | 0 | 0 | 0 |
3a061df687e9af5bce3beb7af1dbd2d6be9f9a0c | 2,837 | py | Python | src/lib/gcode_preview.py | utitankaspk/SPKCAM | a1ac8121e93faaecd0132d16b3c3a5ae7fa84343 | [
"Apache-2.0"
] | 1 | 2018-12-05T22:44:48.000Z | 2018-12-05T22:44:48.000Z | src/lib/gcode_preview.py | utitankaspk/SPKCAM | a1ac8121e93faaecd0132d16b3c3a5ae7fa84343 | [
"Apache-2.0"
] | null | null | null | src/lib/gcode_preview.py | utitankaspk/SPKCAM | a1ac8121e93faaecd0132d16b3c3a5ae7fa84343 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rhinoscriptsyntax as rs
import Rhino
import os
color_palette = {"cut":(153,204,255),"plunge":(254,184,0),"point":(153,204,255)}
LAYER_NAME = "vector_from_gcode"
if __name__=="__main__":
main() | 31.175824 | 113 | 0.602749 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rhinoscriptsyntax as rs
import Rhino
import os
color_palette = {"cut":(153,204,255),"plunge":(254,184,0),"point":(153,204,255)}
LAYER_NAME = "vector_from_gcode"
def parse_line(line):
line = line.lower().replace("\n","")
point = []
if line.sta... | 2,477 | 0 | 100 |
fae7b0157a18871e061420658fff8d1d8058b250 | 460 | py | Python | dictionary_from_book5.py | AmitSuresh/learning-python | f1ea5b9f3659f21504b1b0e452c03239b03cde85 | [
"MIT"
] | null | null | null | dictionary_from_book5.py | AmitSuresh/learning-python | f1ea5b9f3659f21504b1b0e452c03239b03cde85 | [
"MIT"
] | null | null | null | dictionary_from_book5.py | AmitSuresh/learning-python | f1ea5b9f3659f21504b1b0e452c03239b03cde85 | [
"MIT"
] | null | null | null | #A dictionary in a Dictionary
users = {
'aeinstein':{
'first':'albert',
'last':'einstein',
'location':'princeton',
},
'mcurie':{
'first':'mary',
'last':'curie',
'location':'paris',
},
}
for username,user_info in users.items():
print(f'Username: {username}')
full_name=f"{user_info['firs... | 24.210526 | 55 | 0.621739 | #A dictionary in a Dictionary
users = {
'aeinstein':{
'first':'albert',
'last':'einstein',
'location':'princeton',
},
'mcurie':{
'first':'mary',
'last':'curie',
'location':'paris',
},
}
for username,user_info in users.items():
print(f'Username: {username}')
full_name=f"{user_info['firs... | 0 | 0 | 0 |
9308ccd54291ef3ae5d3f45ec6555591f94d6baa | 36,724 | py | Python | adi_study_watch/nrf5_sdk_15.2.0/validation/common.py | ArrowElectronics/Vital-Signs-Monitoring | ba43fe9a116d94170561433910fd7bffba5726e7 | [
"Unlicense"
] | 5 | 2021-06-13T17:11:19.000Z | 2021-12-01T18:20:38.000Z | adi_study_watch/nrf5_sdk_15.2.0/validation/common.py | ArrowElectronics/Vital-Signs-Monitoring | ba43fe9a116d94170561433910fd7bffba5726e7 | [
"Unlicense"
] | null | null | null | adi_study_watch/nrf5_sdk_15.2.0/validation/common.py | ArrowElectronics/Vital-Signs-Monitoring | ba43fe9a116d94170561433910fd7bffba5726e7 | [
"Unlicense"
] | 1 | 2022-01-08T15:01:44.000Z | 2022-01-08T15:01:44.000Z | import os
import sys
try:
import tkinter
import time
import yaml
from tkinter import messagebox
from utils.serial_comm import SerialIface
from datetime import datetime
from utils.test_utils import util_logger
from matplotlib import pyplot as plt
from robot.libraries.BuiltIn import B... | 35.176245 | 124 | 0.61856 | import os
import sys
try:
import tkinter
import time
import yaml
from tkinter import messagebox
from utils.serial_comm import SerialIface
from datetime import datetime
from utils.test_utils import util_logger
from matplotlib import pyplot as plt
from robot.libraries.BuiltIn import B... | 2,115 | 0 | 275 |
14901fa8b5972d2f082360e0f570d6b3d0cb7fd3 | 3,826 | py | Python | robustcode/models/modules/iterators.py | david-maine/robust-code | 971b7336813bb856fafab368320be47a16919e4c | [
"Apache-2.0"
] | 8 | 2020-08-16T23:26:37.000Z | 2021-11-03T06:52:56.000Z | robustcode/models/modules/iterators.py | david-maine/robust-code | 971b7336813bb856fafab368320be47a16919e4c | [
"Apache-2.0"
] | 2 | 2020-08-16T23:11:46.000Z | 2021-03-30T02:12:23.000Z | robustcode/models/modules/iterators.py | eth-sri/robust-code | 971b7336813bb856fafab368320be47a16919e4c | [
"Apache-2.0"
] | 2 | 2021-03-31T04:17:50.000Z | 2021-10-21T20:49:27.000Z | import collections
import copy
from typing import Iterable
import dgl
import torch
import torchtext
| 32.423729 | 108 | 0.553581 | import collections
import copy
from typing import Iterable
import dgl
import torch
import torchtext
class MiniBatch(
collections.namedtuple(
"MiniBatch", ["X", "Y", "lengths", "masks", "P", "data", "ids"]
)
):
__slots__ = ()
def clone(self):
assert self.P is None, "clone not implemen... | 2,368 | 1,285 | 69 |
f5950857c677b000860033c3cad22749b7050775 | 181,473 | py | Python | chesstab/tools/chesstab-4-1-1_castling-option-correction.py | RogerMarsh/chesstab | 01d375dc6bf025b621612a84513e55c4640a78ad | [
"BSD-3-Clause"
] | null | null | null | chesstab/tools/chesstab-4-1-1_castling-option-correction.py | RogerMarsh/chesstab | 01d375dc6bf025b621612a84513e55c4640a78ad | [
"BSD-3-Clause"
] | null | null | null | chesstab/tools/chesstab-4-1-1_castling-option-correction.py | RogerMarsh/chesstab | 01d375dc6bf025b621612a84513e55c4640a78ad | [
"BSD-3-Clause"
] | null | null | null | # chesstab-4-1-1_castling-option-correction.py
# Copyright 2020 Roger Marsh
# Licence: See LICENCE (BSD licence)
"""Read games from a ChessTab database and report games with FENs where the
castling options are not consistent with the piece placement, and attempt
correction on request.
The database must be compatible ... | 34.738323 | 80 | 0.555603 | # chesstab-4-1-1_castling-option-correction.py
# Copyright 2020 Roger Marsh
# Licence: See LICENCE (BSD licence)
"""Read games from a ChessTab database and report games with FENs where the
castling options are not consistent with the piece placement, and attempt
correction on request.
The database must be compatible ... | 140,774 | 10,414 | 797 |
95267cbca2f7b75442e0d4693416ef0ee8ad422a | 4,439 | py | Python | game/Hangman2.0.py | archu2020/python-2 | 19c626ca9fd37168db8a7ac075fd80c8e2971313 | [
"Apache-2.0"
] | 48 | 2017-12-24T12:19:55.000Z | 2022-02-26T13:14:27.000Z | game/Hangman2.0.py | 17610178081/python | 3975c678d985c468deecd03560d882e9d316bb63 | [
"Apache-2.0"
] | 3 | 2018-12-05T08:48:14.000Z | 2020-07-29T01:56:16.000Z | game/Hangman2.0.py | 17610178081/python | 3975c678d985c468deecd03560d882e9d316bb63 | [
"Apache-2.0"
] | 113 | 2017-08-09T03:10:04.000Z | 2022-03-26T16:05:01.000Z | '''
made by YeahKun in 2017-7-22 11:50:42
猜字谜游戏2.0
增加了提示,扩展了单词的种类和数量
'''
import random
HANGMANPICS = [
'''
=====
+---+
| |
|
|
|
|
=====''',
'''
=====
+---+
| |
O |
|
|
|
=====''',
'''
=====
+---+
| |
O |
| |
|
|
... | 22.195 | 161 | 0.478937 | '''
made by YeahKun in 2017-7-22 11:50:42
猜字谜游戏2.0
增加了提示,扩展了单词的种类和数量
'''
import random
HANGMANPICS = [
'''
=====
+---+
| |
|
|
|
|
=====''',
'''
=====
+---+
| |
O |
|
|
|
=====''',
'''
=====
+---+
| |
O |
| |
|
|
... | 1,603 | 0 | 99 |
ed5cb3b2ba71d67a9a4146c3d8fa1453b913f27b | 13,743 | py | Python | dt-learn.py | atasipanda/Decision-Trees | 6719d5d4ff282b8858f0bf8222af6660a3c113d2 | [
"MIT"
] | null | null | null | dt-learn.py | atasipanda/Decision-Trees | 6719d5d4ff282b8858f0bf8222af6660a3c113d2 | [
"MIT"
] | null | null | null | dt-learn.py | atasipanda/Decision-Trees | 6719d5d4ff282b8858f0bf8222af6660a3c113d2 | [
"MIT"
] | null | null | null | import sys
import math
import re
from collections import OrderedDict
import random
import numpy
import matplotlib.pyplot as plt
features = OrderedDict({})
trainingData = []
testFeatures = OrderedDict({})
testData = []
class_attribute = []
# returns
# feature index of the best feature
# information gain by that... | 34.27182 | 150 | 0.594266 | import sys
import math
import re
from collections import OrderedDict
import random
import numpy
import matplotlib.pyplot as plt
features = OrderedDict({})
trainingData = []
testFeatures = OrderedDict({})
testData = []
class_attribute = []
def parse_file(filename):
global lines, f, lines_read, l, m, fvalues, values,... | 11,868 | -20 | 499 |
787f01363f8f53606c734d695875b0fc99b9907f | 392 | py | Python | code/class.py | spartam/basic_python_course | 5e940c2363ba01880386244ad17692b4593611f8 | [
"MIT"
] | null | null | null | code/class.py | spartam/basic_python_course | 5e940c2363ba01880386244ad17692b4593611f8 | [
"MIT"
] | null | null | null | code/class.py | spartam/basic_python_course | 5e940c2363ba01880386244ad17692b4593611f8 | [
"MIT"
] | null | null | null |
if __name__ == '__main__':
P = coordinate()
print(P)
P = coordinate(x=2)
print(P)
P = coordinate(y=3)
print(P)
P = coordinate(x=5, y=7)
print(P)
| 14.518519 | 42 | 0.57398 |
class coordinate:
x = 0
y = 0
def __init__(self, **kwargs):
keys = kwargs.keys()
if 'x' in keys:
self.x = kwargs['x']
if 'y' in keys:
self.y = kwargs['y']
def __str__(self):
return 'x : %s\ty: %s' %(self.x, self.y)
if __name__ == '__main__':
P = coordinate()
print(P)
P = coordinate(x=2)
print... | 155 | 58 | 23 |
3d084a7fbfa072a06df92b18c57c17c769087e2c | 623 | py | Python | ClickKaleidoscope.py | avinja/python-samples | 0f4f94dbc1a886926ad31719a4f34b21c56f2056 | [
"Apache-2.0"
] | null | null | null | ClickKaleidoscope.py | avinja/python-samples | 0f4f94dbc1a886926ad31719a4f34b21c56f2056 | [
"Apache-2.0"
] | null | null | null | ClickKaleidoscope.py | avinja/python-samples | 0f4f94dbc1a886926ad31719a4f34b21c56f2056 | [
"Apache-2.0"
] | null | null | null | #ClickKaleidoscope.py
import random
import turtle
t = turtle.Pen()
t.speed(0)
t.hideturtle()
turtle.bgcolor("black")
colors = ["red", "yellow", "blue", "green", "orange", "purple",
"white", "gray"]
turtle.onscreenclick(draw_kaleido)
| 23.074074 | 63 | 0.598716 | #ClickKaleidoscope.py
import random
import turtle
t = turtle.Pen()
t.speed(0)
t.hideturtle()
turtle.bgcolor("black")
colors = ["red", "yellow", "blue", "green", "orange", "purple",
"white", "gray"]
def draw_kaleido(x,y):
t.pencolor(random.choice(colors))
size = random.randint(10,40)
draw_sp... | 334 | 0 | 44 |
0823e3f1378a191c96f2c6e83021f577431436d6 | 812 | py | Python | tests/submodules/run.py | jonnyrocks/pyangbind | 7a7c6df6ddad7cbec941800431840253b5e2f186 | [
"Apache-2.0"
] | 176 | 2015-06-17T15:44:07.000Z | 2022-03-18T01:16:19.000Z | tests/submodules/run.py | jonnyrocks/pyangbind | 7a7c6df6ddad7cbec941800431840253b5e2f186 | [
"Apache-2.0"
] | 245 | 2015-05-29T07:04:13.000Z | 2022-03-25T14:44:37.000Z | tests/submodules/run.py | jonnyrocks/pyangbind | 7a7c6df6ddad7cbec941800431840253b5e2f186 | [
"Apache-2.0"
] | 118 | 2015-07-02T07:04:36.000Z | 2022-03-31T20:32:38.000Z | #!/usr/bin/env python
import unittest
from tests.base import PyangBindTestCase
if __name__ == "__main__":
unittest.main()
| 23.2 | 55 | 0.644089 | #!/usr/bin/env python
import unittest
from tests.base import PyangBindTestCase
class PyangbindSubmoduleTests(PyangBindTestCase):
yang_files = ["mod-a.yang"]
pyang_flags = ["--use-extmethods"]
def setUp(self):
self.mod_a = self.bindings.mod_a()
def test_001_check_correct_import(self):
... | 451 | 207 | 23 |
c33950bf8d2032710832c6024b8e90c72bb403b7 | 5,340 | py | Python | src/eduid_userdb/support/models.py | SUNET/eduid-userdb | 5970880caf0b0e2bdee6c23869ef287acc87af2a | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | src/eduid_userdb/support/models.py | SUNET/eduid-userdb | 5970880caf0b0e2bdee6c23869ef287acc87af2a | [
"BSD-2-Clause-FreeBSD"
] | 12 | 2015-08-28T12:05:32.000Z | 2020-06-23T13:31:29.000Z | src/eduid_userdb/support/models.py | SUNET/eduid-userdb | 5970880caf0b0e2bdee6c23869ef287acc87af2a | [
"BSD-2-Clause-FreeBSD"
] | 2 | 2016-10-24T06:37:33.000Z | 2016-11-21T11:39:39.000Z | # -*- coding: utf-8 -*-
from copy import deepcopy
from typing import List, Optional
__author__ = 'lundberg'
# Models for filtering out unneeded or unwanted data from eduID database objects
| 28.55615 | 113 | 0.63633 | # -*- coding: utf-8 -*-
from copy import deepcopy
from typing import List, Optional
__author__ = 'lundberg'
# Models for filtering out unneeded or unwanted data from eduID database objects
class GenericFilterDict(dict):
add_keys: Optional[List[str]] = None
remove_keys: Optional[List[str]] = None
def __... | 2,330 | 2,460 | 344 |
7996acf87911f57f60db3c91ce56015c83a551c3 | 4,414 | py | Python | skspec/pandas_utils/dataframeserial.py | hugadams/scikit-spectra | c451be6d54080fbcc2a3bc5daf8846b83b7343ee | [
"BSD-3-Clause"
] | 83 | 2015-01-15T18:57:22.000Z | 2022-01-18T11:43:55.000Z | skspec/pandas_utils/dataframeserial.py | hugadams/scikit-spectra | c451be6d54080fbcc2a3bc5daf8846b83b7343ee | [
"BSD-3-Clause"
] | 18 | 2015-02-02T22:46:51.000Z | 2019-04-29T17:23:32.000Z | skspec/pandas_utils/dataframeserial.py | hugadams/scikit-spectra | c451be6d54080fbcc2a3bc5daf8846b83b7343ee | [
"BSD-3-Clause"
] | 43 | 2015-01-02T20:47:11.000Z | 2021-12-18T16:14:40.000Z | ''' Serialization interface for custom DataFrame objects. Allows to save/load
for memory streams or files. Because one cannot serialize DataFrames with
custom attributes, this uses an intermediate object for that process. Plan
it implement pickling saved methods later (requires more work). These are meant to
... | 35.031746 | 97 | 0.698006 | ''' Serialization interface for custom DataFrame objects. Allows to save/load
for memory streams or files. Because one cannot serialize DataFrames with
custom attributes, this uses an intermediate object for that process. Plan
it implement pickling saved methods later (requires more work). These are meant to
... | 84 | 0 | 26 |
2de5ea2e9bf0051ad8a8662c57ae610be26ed5ad | 378 | py | Python | SSH.example.py | WikiCommunityHealth/wikimedia-user-metrics | 1bf643a37d5066932dcad71a465d2c4b4a4a1a92 | [
"MIT"
] | null | null | null | SSH.example.py | WikiCommunityHealth/wikimedia-user-metrics | 1bf643a37d5066932dcad71a465d2c4b4a4a1a92 | [
"MIT"
] | null | null | null | SSH.example.py | WikiCommunityHealth/wikimedia-user-metrics | 1bf643a37d5066932dcad71a465d2c4b4a4a1a92 | [
"MIT"
] | null | null | null | import pymongo
from sshtunnel import SSHTunnelForwarder | 27 | 79 | 0.65873 | import pymongo
from sshtunnel import SSHTunnelForwarder
def get_mongo_client():
server = SSHTunnelForwarder(
('192.168.184.92',22),
ssh_username='<USER>',
ssh_password='<PWD>',
remote_bind_address=('127.0.0.1', 27017)
)
server.start()
client = pymongo.MongoClient(host='... | 300 | 0 | 23 |
6fb6af1bd89cf83860901987794468bea5e527d0 | 21,167 | py | Python | src/omniglot/wrapper.py | rcmalli/warpgrad | d9ef72af10eec62ae92bc24595cb1a4a0207e319 | [
"Apache-2.0"
] | 80 | 2020-02-18T09:55:10.000Z | 2022-02-10T12:59:49.000Z | src/omniglot/wrapper.py | rcmalli/warpgrad | d9ef72af10eec62ae92bc24595cb1a4a0207e319 | [
"Apache-2.0"
] | 5 | 2020-07-21T16:47:42.000Z | 2021-05-31T06:19:36.000Z | src/omniglot/wrapper.py | rcmalli/warpgrad | d9ef72af10eec62ae92bc24595cb1a4a0207e319 | [
"Apache-2.0"
] | 14 | 2020-02-18T13:19:48.000Z | 2022-01-05T23:52:11.000Z | """Meta-learners for Omniglot experiment.
Based on original implementation:
https://github.com/amzn/metalearn-leap
"""
import random
from abc import abstractmethod
from torch import nn
from torch import optim
import maml
import warpgrad
from leap import Leap
from leap.utils import clone_state_dict
from utils import R... | 33.073438 | 79 | 0.58081 | """Meta-learners for Omniglot experiment.
Based on original implementation:
https://github.com/amzn/metalearn-leap
"""
import random
from abc import abstractmethod
from torch import nn
from torch import optim
import maml
import warpgrad
from leap import Leap
from leap.utils import clone_state_dict
from utils import R... | 9,290 | 0 | 701 |
3206936433ce667f0ce4f6df51f664f04496ea93 | 9,077 | py | Python | coinbase.py | foppini975/FinRL | aead943817d1387dc3654de2c189767d10140b78 | [
"MIT"
] | null | null | null | coinbase.py | foppini975/FinRL | aead943817d1387dc3654de2c189767d10140b78 | [
"MIT"
] | null | null | null | coinbase.py | foppini975/FinRL | aead943817d1387dc3654de2c189767d10140b78 | [
"MIT"
] | null | null | null | # Coinbase Pro library:
# https://github.com/danpaquin/coinbasepro-python
#curl "https://api.pro.coinbase.com/products/BTC-USD/candles?start=2021-01-01T12:00:00&end=2021-01-12T12:00:00&granularity=3600"
import cbpro
import numpy as np
import pandas as pd
import logging
from datetime import datetime, timedelta
imp... | 46.076142 | 128 | 0.593588 | # Coinbase Pro library:
# https://github.com/danpaquin/coinbasepro-python
#curl "https://api.pro.coinbase.com/products/BTC-USD/candles?start=2021-01-01T12:00:00&end=2021-01-12T12:00:00&granularity=3600"
import cbpro
import numpy as np
import pandas as pd
import logging
from datetime import datetime, timedelta
imp... | 8,418 | 262 | 23 |
c5b03901171c853c7fa793d7b36da4ea9b2c603e | 2,407 | py | Python | links/models.py | gminds/rapidnewsng | 7528f751f657f29f2da23a1dd160479947f87977 | [
"BSD-3-Clause"
] | null | null | null | links/models.py | gminds/rapidnewsng | 7528f751f657f29f2da23a1dd160479947f87977 | [
"BSD-3-Clause"
] | null | null | null | links/models.py | gminds/rapidnewsng | 7528f751f657f29f2da23a1dd160479947f87977 | [
"BSD-3-Clause"
] | null | null | null | from django.db import models
from django.contrib.auth.models import User
from django.db.models import Count
from django.core.urlresolvers import reverse
from django.utils.timezone import now
'''
def votes(self):
num_submissions = Submission.objects.filter(uploaded_by=self).count()
return num_submi... | 32.972603 | 113 | 0.705442 | from django.db import models
from django.contrib.auth.models import User
from django.db.models import Count
from django.core.urlresolvers import reverse
from django.utils.timezone import now
class LinkVoteCountManager(models.Manager):
def get_query_set(self):
return super(LinkVoteCountManager, self).get_q... | 803 | 803 | 191 |
5c8d4feb6829f166cf531181b9ddbbc0f14f1120 | 1,393 | py | Python | driver_support.py | yhamidullah/alphormdownloader | d520ec5d6d3289acb184308471a38d2b196a708d | [
"MIT"
] | 2 | 2020-04-07T10:59:23.000Z | 2020-12-24T09:18:56.000Z | driver_support.py | yhamidullah/alphormdownloader | d520ec5d6d3289acb184308471a38d2b196a708d | [
"MIT"
] | 5 | 2020-04-07T11:04:43.000Z | 2021-01-05T16:48:09.000Z | driver_support.py | yhamidullah/alphormdownloader | d520ec5d6d3289acb184308471a38d2b196a708d | [
"MIT"
] | 3 | 2020-04-04T04:56:24.000Z | 2020-04-08T12:26:11.000Z | from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from bs4 import BeautifulSoup
import urllib.request,re,os
import config | 46.433333 | 142 | 0.698492 | from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from bs4 import BeautifulSoup
import urllib.request,re,os
import config
def get_available_driver():
driver = ""
if config.firefox_driver_path != "":
try:
driver = webdriver.Firefox(executable_path=config.f... | 1,213 | 0 | 22 |
2f564c5e8b5c38b1f42fe2b874cd512a34b4cd79 | 569 | py | Python | nested.py | codingwithahmad/FastAPI | 4453fa74a1164161a1528f20c9ead5dccdd494a2 | [
"MIT"
] | null | null | null | nested.py | codingwithahmad/FastAPI | 4453fa74a1164161a1528f20c9ead5dccdd494a2 | [
"MIT"
] | null | null | null | nested.py | codingwithahmad/FastAPI | 4453fa74a1164161a1528f20c9ead5dccdd494a2 | [
"MIT"
] | null | null | null | from typing import Optional, List, Set
from fastapi import FastAPI
from pydantic import BaseModel, HttpUrl
app = FastAPI()
@app.put('/items/{item_id}') | 23.708333 | 113 | 0.724077 | from typing import Optional, List, Set
from fastapi import FastAPI
from pydantic import BaseModel, HttpUrl
app = FastAPI()
class Image(BaseModel):
url: HttpUrl
name: str
class Item(BaseModel):
name: str
description: Optional[str] = None
price: float
image: Optional[Image] = None
tax: Optional[float] = None... | 83 | 262 | 69 |
810d9276dbbb5e8d7b50ea6c272bd5caea7cf779 | 4,262 | py | Python | demo.py | soarodo/flappy_yolo | f4747528e707b18dffcc84f814aea9c41990344f | [
"MIT"
] | 1 | 2020-01-08T16:41:39.000Z | 2020-01-08T16:41:39.000Z | demo.py | soarodo/flappy_yolo | f4747528e707b18dffcc84f814aea9c41990344f | [
"MIT"
] | null | null | null | demo.py | soarodo/flappy_yolo | f4747528e707b18dffcc84f814aea9c41990344f | [
"MIT"
] | null | null | null | import cv2
import os
import time
import numpy as np
from keras import backend as K
from keras.models import load_model
from yad2k.models.keras_yolo import yolo_eval, yolo_head
| 35.22314 | 132 | 0.641248 | import cv2
import os
import time
import numpy as np
from keras import backend as K
from keras.models import load_model
from yad2k.models.keras_yolo import yolo_eval, yolo_head
class YOLO(object):
def __init__(self):
self.model_path = 'model_data/yolo.h5'
self.anchors_path = 'model_data/yolo_ancho... | 3,850 | -2 | 230 |
c7ed802b7ea74b20fb7005a7225b0eec42837fbc | 1,053 | py | Python | homeassistant/components/doorbird/logbook.py | erogleva/core | 994ae09f69afe772150a698953c0d7386a745de2 | [
"Apache-2.0"
] | 6 | 2016-11-25T06:36:27.000Z | 2021-11-16T11:20:23.000Z | homeassistant/components/doorbird/logbook.py | erogleva/core | 994ae09f69afe772150a698953c0d7386a745de2 | [
"Apache-2.0"
] | 56 | 2020-08-03T07:30:54.000Z | 2022-03-31T06:02:04.000Z | homeassistant/components/doorbird/logbook.py | erogleva/core | 994ae09f69afe772150a698953c0d7386a745de2 | [
"Apache-2.0"
] | 3 | 2016-10-03T20:14:06.000Z | 2019-04-19T15:56:56.000Z | """Describe logbook events."""
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import callback
from .const import DOMAIN, DOOR_STATION, DOOR_STATION_EVENT_ENTITY_IDS
@callback
def async_describe_events(hass, async_describe_event):
"""Describe logbook events."""
@callback
def asyn... | 30.085714 | 78 | 0.665717 | """Describe logbook events."""
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import callback
from .const import DOMAIN, DOOR_STATION, DOOR_STATION_EVENT_ENTITY_IDS
@callback
def async_describe_events(hass, async_describe_event):
"""Describe logbook events."""
@callback
def asyn... | 0 | 0 | 0 |
46f0c5324d010240f717ecc52ef5a0820704904a | 661 | py | Python | gigfinder/config/wsgi.py | casamfiml/django_Pruebas | 6a2d0e17fcbd4c3428037c2354ce9e5ce19c4d4b | [
"Apache-2.0"
] | null | null | null | gigfinder/config/wsgi.py | casamfiml/django_Pruebas | 6a2d0e17fcbd4c3428037c2354ce9e5ce19c4d4b | [
"Apache-2.0"
] | null | null | null | gigfinder/config/wsgi.py | casamfiml/django_Pruebas | 6a2d0e17fcbd4c3428037c2354ce9e5ce19c4d4b | [
"Apache-2.0"
] | null | null | null | """
WSGI config for gigfinder 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/2.0/howto/deployment/wsgi/
"""
import os,sys
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | 30.045455 | 78 | 0.779123 | """
WSGI config for gigfinder 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/2.0/howto/deployment/wsgi/
"""
import os,sys
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | 0 | 0 | 0 |
6fcb9a39da1d14723888c9560f273ac52d31e6a3 | 2,453 | py | Python | src/z3c/testsetup/tests/layered_cave/layer.py | zopefoundation/z3c.testsetup | 7a07939b5df33d2124916385efdc9c82495d1b32 | [
"ZPL-2.1"
] | 1 | 2020-09-08T06:51:02.000Z | 2020-09-08T06:51:02.000Z | src/z3c/testsetup/tests/layered_cave/layer.py | zopefoundation/z3c.testsetup | 7a07939b5df33d2124916385efdc9c82495d1b32 | [
"ZPL-2.1"
] | 2 | 2015-04-14T18:00:03.000Z | 2020-05-15T08:56:34.000Z | src/z3c/testsetup/tests/layered_cave/layer.py | zopefoundation/z3c.testsetup | 7a07939b5df33d2124916385efdc9c82495d1b32 | [
"ZPL-2.1"
] | 1 | 2020-09-08T06:19:35.000Z | 2020-09-08T06:19:35.000Z | """Layer definitions.
This could also be done in the setup file itself.
"""
import os
from zope.app.testing.functional import ZCMLLayer
# We define a ZCML test layer. ZCML layers are special as they define
# some setup code for creation of empty ZODBs and more. If you only
# want some ZCML registrations to be done, y... | 33.60274 | 73 | 0.681614 | """Layer definitions.
This could also be done in the setup file itself.
"""
import os
from zope.app.testing.functional import ZCMLLayer
# We define a ZCML test layer. ZCML layers are special as they define
# some setup code for creation of empty ZODBs and more. If you only
# want some ZCML registrations to be done, y... | 0 | 0 | 0 |
271e2acdf71604e7da0fc06ab6eab405b21c08fd | 1,086 | py | Python | hpc_acm_cli/async_op.py | coin8086/hpc_acm_cli | 688c68e23df1ffae3430d1807c5ba1b67c5dc857 | [
"MIT"
] | 2 | 2018-10-06T04:15:06.000Z | 2020-06-01T14:25:40.000Z | hpc_acm_cli/async_op.py | coin8086/hpc_acm_cli | 688c68e23df1ffae3430d1807c5ba1b67c5dc857 | [
"MIT"
] | 2 | 2018-10-05T15:30:20.000Z | 2018-11-02T08:35:46.000Z | hpc_acm_cli/async_op.py | coin8086/hpc_acm_cli | 688c68e23df1ffae3430d1807c5ba1b67c5dc857 | [
"MIT"
] | 3 | 2018-10-05T14:54:20.000Z | 2021-01-10T10:09:30.000Z | from tqdm import tqdm
import time
import platform
# ops is a list of AsyncOp object
| 25.857143 | 79 | 0.513812 | from tqdm import tqdm
import time
import platform
class AsyncOp:
class NotReady(Exception):
pass
def get_result(self):
pass
# ops is a list of AsyncOp object
def async_wait(ops, handler=None, desc=None):
total = len(ops)
done = [False for i in range(total)]
done_count = 0
prog... | 891 | 64 | 45 |
460b0ad8437549783c4db4fc6f7378a14379d77a | 2,282 | py | Python | takahe/SFR.py | Krytic/Takahe | 6d6bdf234ae7e3cfe8ef40e48d4621dc9a9a2f6c | [
"MIT"
] | 1 | 2020-12-09T02:34:43.000Z | 2020-12-09T02:34:43.000Z | takahe/SFR.py | Krytic/Takahe | 6d6bdf234ae7e3cfe8ef40e48d4621dc9a9a2f6c | [
"MIT"
] | 8 | 2020-03-02T06:22:43.000Z | 2020-11-10T03:20:46.000Z | takahe/SFR.py | Krytic/Takahe | 6d6bdf234ae7e3cfe8ef40e48d4621dc9a9a2f6c | [
"MIT"
] | 1 | 2020-05-13T00:41:24.000Z | 2020-05-13T00:41:24.000Z | import matplotlib.pyplot as plt
from numba import njit
import numpy as np
import pandas as pd
from scipy.special import gamma, gammainc
import takahe
from tqdm import tqdm
def MadauDickinson(Z, z):
"""Computes the Madau & Dickinson SFRD at metallicity Z and redshift z.
Implements the SFRD given by eqn(15) of ... | 27.166667 | 81 | 0.565294 | import matplotlib.pyplot as plt
from numba import njit
import numpy as np
import pandas as pd
from scipy.special import gamma, gammainc
import takahe
from tqdm import tqdm
def MadauDickinson(Z, z):
"""Computes the Madau & Dickinson SFRD at metallicity Z and redshift z.
Implements the SFRD given by eqn(15) of ... | 0 | 0 | 0 |
b94e0588527afb6e0682a3ad466fe2b23170f529 | 1,391 | py | Python | src/mapstp/cli/logging.py | MC-kit/map-stp | a82b6560358a37f704fd0fe76c76def27a15458d | [
"MIT"
] | null | null | null | src/mapstp/cli/logging.py | MC-kit/map-stp | a82b6560358a37f704fd0fe76c76def27a15458d | [
"MIT"
] | 19 | 2021-11-29T10:29:30.000Z | 2022-03-17T11:21:08.000Z | src/mapstp/cli/logging.py | MC-kit/map-stp | a82b6560358a37f704fd0fe76c76def27a15458d | [
"MIT"
] | null | null | null | """Intercept log messages from the used libraries and pass them to `loguru`.
See https://github.com/Delgan/loguru
"""
import logging
from loguru import logger
# class PropagateHandler(logging.Handler):
# """Send events from loguru to standard logging"""
# def emit(self, record):
# logging.getLogger(... | 27.82 | 76 | 0.64486 | """Intercept log messages from the used libraries and pass them to `loguru`.
See https://github.com/Delgan/loguru
"""
import logging
from loguru import logger
# class PropagateHandler(logging.Handler):
# """Send events from loguru to standard logging"""
# def emit(self, record):
# logging.getLogger(... | 0 | 0 | 0 |
da9ba344b9f98f766776e34ee07106326af77c14 | 91 | py | Python | src/housie/models/__init__.py | Eclair24/housie | 7892002914c2ced422f89cd8c050993c2f931deb | [
"Apache-2.0"
] | 1 | 2020-08-10T07:44:01.000Z | 2020-08-10T07:44:01.000Z | src/housie/models/__init__.py | Eclair24/housie | 7892002914c2ced422f89cd8c050993c2f931deb | [
"Apache-2.0"
] | 1 | 2020-12-07T16:31:05.000Z | 2020-12-09T09:04:58.000Z | src/housie/models/__init__.py | Eclair24/housie | 7892002914c2ced422f89cd8c050993c2f931deb | [
"Apache-2.0"
] | 1 | 2020-10-01T17:54:19.000Z | 2020-10-01T17:54:19.000Z | from .board import Board, demo_board
from .ticket import Ticket, load_tickets, demo_ticket
| 30.333333 | 53 | 0.824176 | from .board import Board, demo_board
from .ticket import Ticket, load_tickets, demo_ticket
| 0 | 0 | 0 |
0d7e6c92009db30a4a0cda37191f99149779e2a9 | 616 | py | Python | examples/example1.py | va-dudnikov/pygraph7 | bf3469ca75f44283ee647dc10fa7d94bb7834cf3 | [
"MIT"
] | 2 | 2018-08-02T10:15:39.000Z | 2018-08-02T17:32:11.000Z | examples/example1.py | va-dudnikov/pygraph7 | bf3469ca75f44283ee647dc10fa7d94bb7834cf3 | [
"MIT"
] | null | null | null | examples/example1.py | va-dudnikov/pygraph7 | bf3469ca75f44283ee647dc10fa7d94bb7834cf3 | [
"MIT"
] | null | null | null | # Example 1
# This example show how to encoding matrix in graph7 format
import graph7 as g7
import random
order = 10
# Matrix contains only 0 and 1, so for encoding a matrix on one element
# needed only 1 bit
rand_mat = [[random.randint(0, 1) for _ in range(order)] for _ in range(order)]
directed = g7.encode(rand_ma... | 22.814815 | 79 | 0.672078 | # Example 1
# This example show how to encoding matrix in graph7 format
import graph7 as g7
import random
order = 10
# Matrix contains only 0 and 1, so for encoding a matrix on one element
# needed only 1 bit
rand_mat = [[random.randint(0, 1) for _ in range(order)] for _ in range(order)]
directed = g7.encode(rand_ma... | 0 | 0 | 0 |
c8f3bc6c094eeb66cdada903f9c92d378863e6b8 | 6,369 | py | Python | pybot/plugins/message/__init__.py | jkent/pybot | 0c70a7c29caa709413e04a411a5fdb22a8dbdb12 | [
"MIT"
] | 1 | 2017-06-01T00:52:44.000Z | 2017-06-01T00:52:44.000Z | pybot/plugins/message/__init__.py | jkent/pybot | 0c70a7c29caa709413e04a411a5fdb22a8dbdb12 | [
"MIT"
] | 17 | 2015-03-21T19:35:45.000Z | 2019-04-14T05:17:49.000Z | pybot/plugins/message/__init__.py | jkent/jkent-pybot | 0c70a7c29caa709413e04a411a5fdb22a8dbdb12 | [
"MIT"
] | 1 | 2015-03-27T22:52:42.000Z | 2015-03-27T22:52:42.000Z | # -*- coding: utf-8 -*-
# vim: set ts=4 et
from datetime import datetime, timedelta
import re
from sqlalchemy import or_, and_, func
from pybot.plugin import *
from . import models
from .models import *
RETRY_INTERVAL = 3600
| 27.934211 | 80 | 0.508714 | # -*- coding: utf-8 -*-
# vim: set ts=4 et
from datetime import datetime, timedelta
import re
from sqlalchemy import or_, and_, func
from pybot.plugin import *
from . import models
from .models import *
RETRY_INTERVAL = 3600
class Plugin(BasePlugin):
def on_load(self):
self.db = models.init(self.bot)
... | 5,737 | 379 | 23 |
c3e380b03a6306239eeb08e10db96af6e13a5bd6 | 6,879 | py | Python | main.py | sharyar/symmetrical-waffle | f7de2c11849c841363dc60e225133818ca5423eb | [
"MIT"
] | null | null | null | main.py | sharyar/symmetrical-waffle | f7de2c11849c841363dc60e225133818ca5423eb | [
"MIT"
] | null | null | null | main.py | sharyar/symmetrical-waffle | f7de2c11849c841363dc60e225133818ca5423eb | [
"MIT"
] | null | null | null | # Token types
# EOF (end-of-file) token -> indicates that no more input is left for lexical analysis.
# Lexical Analysis: Breaking input strings into tokens -> scanner, tokenizer, lexical analyzer, lexer
# Lexeme -> a sequence of characters that form a token. This is for multidigit for example. Here we implement the i... | 30.986486 | 145 | 0.573775 | # Token types
# EOF (end-of-file) token -> indicates that no more input is left for lexical analysis.
# Lexical Analysis: Breaking input strings into tokens -> scanner, tokenizer, lexical analyzer, lexer
# Lexeme -> a sequence of characters that form a token. This is for multidigit for example. Here we implement the i... | 1,395 | 3,782 | 92 |
a57dea131ef9158b8695a6ed87ec825cd29d695d | 3,063 | py | Python | tools/changelog_to_deb.py | thusoy/laim | 01b02f5910d046603df8e50ba513b28673fbd3cf | [
"MIT"
] | 2 | 2019-12-26T19:45:04.000Z | 2019-12-26T20:40:18.000Z | tools/changelog_to_deb.py | thusoy/laim | 01b02f5910d046603df8e50ba513b28673fbd3cf | [
"MIT"
] | 4 | 2020-03-24T17:56:56.000Z | 2021-04-06T18:02:10.000Z | tools/changelog_to_deb.py | thusoy/laim | 01b02f5910d046603df8e50ba513b28673fbd3cf | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import argparse
import datetime
import re
VERSION_HEADER_RE = re.compile(r'(?P<version>\d+\.\d+\.\d+) ?- ?(?P<date>\d{4}-\d{2}-\d{2})')
CHANGE_TYPE_RE = re.compile(r'^### ?(?P<change_type>.*)')
SKIP_LINE_RE = re.compile(r'^-{2,}|^$')
LIST_LINE_RE = re.compile(r'^[-*] ?(?P<line_item>.*)')
CONTIN... | 31.255102 | 118 | 0.640875 | #!/usr/bin/env python3
import argparse
import datetime
import re
VERSION_HEADER_RE = re.compile(r'(?P<version>\d+\.\d+\.\d+) ?- ?(?P<date>\d{4}-\d{2}-\d{2})')
CHANGE_TYPE_RE = re.compile(r'^### ?(?P<change_type>.*)')
SKIP_LINE_RE = re.compile(r'^-{2,}|^$')
LIST_LINE_RE = re.compile(r'^[-*] ?(?P<line_item>.*)')
CONTIN... | 2,454 | 0 | 69 |
d3d378e95dac58f6824d81d41bd8200f128f3554 | 11,406 | py | Python | src/app/views.py | pk400/pick-a-spot | 7d2a5db2bcad91f86d3b40097494b74f4b45483f | [
"MIT"
] | 2 | 2016-02-02T06:41:34.000Z | 2016-04-11T21:22:39.000Z | src/app/views.py | pk400/pick-a-spot | 7d2a5db2bcad91f86d3b40097494b74f4b45483f | [
"MIT"
] | null | null | null | src/app/views.py | pk400/pick-a-spot | 7d2a5db2bcad91f86d3b40097494b74f4b45483f | [
"MIT"
] | 1 | 2016-02-24T01:16:05.000Z | 2016-02-24T01:16:05.000Z | from django.shortcuts import render
from .models import UserProfile, Friend, RoomInstance
from django.contrib.auth.models import User, Group
from django.contrib.sessions.models import Session
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, HttpResponse
from regist... | 30.994565 | 139 | 0.701385 | from django.shortcuts import render
from .models import UserProfile, Friend, RoomInstance
from django.contrib.auth.models import User, Group
from django.contrib.sessions.models import Session
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, HttpResponse
from regist... | 9,899 | 0 | 291 |
3f7eb8fc684d5efb045fee5916f9de74f361d25e | 366 | py | Python | src/middleware.py | cibinsb/EMBL_task | 6d9d42f7fdf6a4cacb6393f1ac793ebc4f3279ae | [
"Apache-2.0"
] | null | null | null | src/middleware.py | cibinsb/EMBL_task | 6d9d42f7fdf6a4cacb6393f1ac793ebc4f3279ae | [
"Apache-2.0"
] | null | null | null | src/middleware.py | cibinsb/EMBL_task | 6d9d42f7fdf6a4cacb6393f1ac793ebc4f3279ae | [
"Apache-2.0"
] | null | null | null | import falcon
import json
from helper.log import logger
from helper.utils import Constants
| 28.153846 | 87 | 0.663934 | import falcon
import json
from helper.log import logger
from helper.utils import Constants
class HttpMethodValidator(object):
def process_request(self, req, resp):
if req.method not in ["GET"]:
logger.info("")
resp.status = falcon.HTTP_405
resp.body = json.dumps({Consta... | 212 | 13 | 49 |
cb23e1f88750c0a157d04ee4d7eb7300fc61bf1c | 201 | py | Python | carat/audio.py | giovana-morais/carat | 982af4dde63e8560ccc9120f3767f1420a545b67 | [
"MIT"
] | 11 | 2019-08-08T13:54:59.000Z | 2021-12-09T19:15:12.000Z | carat/audio.py | giovana-morais/carat | 982af4dde63e8560ccc9120f3767f1420a545b67 | [
"MIT"
] | 42 | 2019-07-01T19:17:24.000Z | 2022-03-15T19:46:09.000Z | carat/audio.py | giovana-morais/carat | 982af4dde63e8560ccc9120f3767f1420a545b67 | [
"MIT"
] | 3 | 2021-02-10T13:21:59.000Z | 2022-02-17T11:47:06.000Z | # encoding: utf-8
# pylint: disable=C0103
"""Utility functions to deal with audio."""
import librosa
__all__ = ['load']
# simply use librosa.load (this may change in the future)
load = librosa.load
| 18.272727 | 57 | 0.716418 | # encoding: utf-8
# pylint: disable=C0103
"""Utility functions to deal with audio."""
import librosa
__all__ = ['load']
# simply use librosa.load (this may change in the future)
load = librosa.load
| 0 | 0 | 0 |
494a1b25d074708072f6aa1625114ff6dece6b72 | 493 | py | Python | flights-tracker/flights_tracker/tracker.py | rafalstepien/flights-tracker | 9ba1339a6c3e50a4671f41de8714fe854d044e9d | [
"MIT"
] | 1 | 2022-01-26T04:59:36.000Z | 2022-01-26T04:59:36.000Z | flights-tracker/flights_tracker/tracker.py | rafalstepien/flights-tracker | 9ba1339a6c3e50a4671f41de8714fe854d044e9d | [
"MIT"
] | null | null | null | flights-tracker/flights_tracker/tracker.py | rafalstepien/flights-tracker | 9ba1339a6c3e50a4671f41de8714fe854d044e9d | [
"MIT"
] | null | null | null | import uvicorn
from fastapi import FastAPI
from email_sender.service.email_sender import EmailSender
from flights_tracker.routes import router
from flights_tracker.services.weekend_flights_service import WeekendFlightsService
app = FlightsTracker()
app.include_router(router)
if __name__ == "__main__":
uvicorn.... | 25.947368 | 82 | 0.803245 | import uvicorn
from fastapi import FastAPI
from email_sender.service.email_sender import EmailSender
from flights_tracker.routes import router
from flights_tracker.services.weekend_flights_service import WeekendFlightsService
class FlightsTracker(FastAPI):
weekend_flights_service = WeekendFlightsService()
em... | 0 | 96 | 23 |
e5181cd8bd4999ebfed2a270ac6316f18fff22b2 | 1,051 | py | Python | src/denzel/app/tasks.py | eliorc/denzel | 429a7c277b1a4ee515e3a112a8734b58fc89f53a | [
"Apache-2.0"
] | 17 | 2018-10-02T07:09:45.000Z | 2021-11-30T11:02:28.000Z | src/denzel/app/tasks.py | eliorc/denzel | 429a7c277b1a4ee515e3a112a8734b58fc89f53a | [
"Apache-2.0"
] | 4 | 2018-10-22T10:18:17.000Z | 2020-09-02T14:31:31.000Z | src/denzel/app/tasks.py | eliorc/denzel | 429a7c277b1a4ee515e3a112a8734b58fc89f53a | [
"Apache-2.0"
] | 2 | 2018-10-28T10:17:57.000Z | 2020-02-05T22:12:04.000Z | import os
import celery
import requests
from app.logic.pipeline import process, load_model, predict
CELERY_BROKER = os.environ.get('CELERY_BROKER')
CELERY_BACKEND = os.environ.get('CELERY_BACKEND')
app = celery.Celery('tasks', broker=CELERY_BROKER, backend=CELERY_BACKEND)
@app.task(base=Model)
Model = app.regis... | 22.847826 | 103 | 0.681256 | import os
import celery
import requests
from app.logic.pipeline import process, load_model, predict
CELERY_BROKER = os.environ.get('CELERY_BROKER')
CELERY_BACKEND = os.environ.get('CELERY_BACKEND')
app = celery.Celery('tasks', broker=CELERY_BROKER, backend=CELERY_BACKEND)
class Model(celery.Task):
def __init_... | 596 | 72 | 45 |
0e0050f065ebfc4a804ecbc5ca6fa59531b95360 | 2,791 | py | Python | stationaryschrodinger/tfAPI.py | cteerara/StationarySchrodinger | 247a6fefdb7d2f5b09444d59a1862c4053db9ad6 | [
"MIT"
] | null | null | null | stationaryschrodinger/tfAPI.py | cteerara/StationarySchrodinger | 247a6fefdb7d2f5b09444d59a1862c4053db9ad6 | [
"MIT"
] | null | null | null | stationaryschrodinger/tfAPI.py | cteerara/StationarySchrodinger | 247a6fefdb7d2f5b09444d59a1862c4053db9ad6 | [
"MIT"
] | null | null | null | import tensorflow as tf
tf.enable_eager_execution();
| 37.213333 | 123 | 0.620208 | import tensorflow as tf
tf.enable_eager_execution();
def compare(t1,t2,tol):
# Compare two 2D tensorflow arrays
# INPUT: tensorflow arrays t1,t2
# tolerence tol
# OUTPUT: true if (t1-t2) < tol, else false
t1size = t1.get_shape();
t2size = t2.get_shape();
if (len(t1size) != len(t2siz... | 2,636 | 0 | 100 |
2ccb1bca281aebfdaa7f2da47ea35be6e589abad | 267 | py | Python | crudapp/crudapp/views.py | nitinprakash96/zeolearn-tut | a6202115d9a32225b9e76f290d9b6f8430725375 | [
"Apache-2.0"
] | null | null | null | crudapp/crudapp/views.py | nitinprakash96/zeolearn-tut | a6202115d9a32225b9e76f290d9b6f8430725375 | [
"Apache-2.0"
] | null | null | null | crudapp/crudapp/views.py | nitinprakash96/zeolearn-tut | a6202115d9a32225b9e76f290d9b6f8430725375 | [
"Apache-2.0"
] | 1 | 2019-11-01T03:03:32.000Z | 2019-11-01T03:03:32.000Z |
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponse
| 24.272727 | 64 | 0.696629 |
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponse
def home(request):
html = """
<h1>Django CRUD Example</h1>
<a href="/blog_posts/">Blog post CRUD example</a><br>
"""
return HttpResponse(html)
| 141 | 0 | 23 |
4f8d038bdaafd675342a535381e26b7f9aaa0b8d | 3,254 | py | Python | main.py | jondye/rfid-squeezebox-py | ad5bf9e5c96cac188e455a7aa2fed536cfb582b8 | [
"MIT"
] | null | null | null | main.py | jondye/rfid-squeezebox-py | ad5bf9e5c96cac188e455a7aa2fed536cfb582b8 | [
"MIT"
] | null | null | null | main.py | jondye/rfid-squeezebox-py | ad5bf9e5c96cac188e455a7aa2fed536cfb582b8 | [
"MIT"
] | null | null | null | import db
import mfrc522
import network
import speaker
import squeezebox
import squeezebox
import time
import ujson
from machine import Pin, PWM
if __name__ == '__main__':
main()
| 28.79646 | 76 | 0.556853 | import db
import mfrc522
import network
import speaker
import squeezebox
import squeezebox
import time
import ujson
from machine import Pin, PWM
def read(reader):
while True:
stat, tag_type = reader.request(reader.REQIDL)
if stat == reader.OK:
stat, raw_uid = reader.anticoll()
... | 2,926 | 0 | 138 |
0f1b8fca9391ed6855a3fd18e5f8db0ff1d75274 | 204 | py | Python | openregistry/lots/core/tests/fixtures.py | EBRD-ProzorroSale/openregistry.lots.core | dd54376ac15858ea6d44cf792d1d87328495b9b8 | [
"Apache-2.0"
] | null | null | null | openregistry/lots/core/tests/fixtures.py | EBRD-ProzorroSale/openregistry.lots.core | dd54376ac15858ea6d44cf792d1d87328495b9b8 | [
"Apache-2.0"
] | 48 | 2017-08-19T13:22:59.000Z | 2019-03-12T07:52:37.000Z | openregistry/lots/core/tests/fixtures.py | EBRD-ProzorroSale/openregistry.lots.core | dd54376ac15858ea6d44cf792d1d87328495b9b8 | [
"Apache-2.0"
] | 9 | 2017-08-03T09:29:57.000Z | 2018-09-14T10:59:32.000Z | PARTIAL_MOCK_CONFIG = {
"api":{
"plugins":{
"lots.core": None,
"transferring":{
"plugins":{
"lots.transferring":None
}
},
}
}
}
| 15.692308 | 36 | 0.392157 | PARTIAL_MOCK_CONFIG = {
"api":{
"plugins":{
"lots.core": None,
"transferring":{
"plugins":{
"lots.transferring":None
}
},
}
}
}
| 0 | 0 | 0 |
dae2afc7991f13605a9cad9f36b257c5723f013a | 622 | py | Python | docs/chap6/code/floatrange.py | marble-git/python-laoqi | 74c4bb5459113e54ce64443e5da5a9c6a3052d6a | [
"MIT"
] | null | null | null | docs/chap6/code/floatrange.py | marble-git/python-laoqi | 74c4bb5459113e54ce64443e5da5a9c6a3052d6a | [
"MIT"
] | null | null | null | docs/chap6/code/floatrange.py | marble-git/python-laoqi | 74c4bb5459113e54ce64443e5da5a9c6a3052d6a | [
"MIT"
] | null | null | null | #coding:utf-8
'''
filename:floatrange.py
generate a sequence of parmeters with floating-point numbers.
'''
import itertools
f = frange(1.2,9)
print(list(f))
f = frange(1.2)
print(list(f))
f = frange(1.2,9,-1)
print(list(f))
f = frange(1.2,None,-1)
print(list(f))
f = frange(1.2,None,0)
print(list(f))... | 12.44 | 71 | 0.573955 | #coding:utf-8
'''
filename:floatrange.py
generate a sequence of parmeters with floating-point numbers.
'''
import itertools
def frange(start,end=None,step=1.0):
if end is None:
end = float(start)
start = 0.0
assert step
for i in itertools.count():
next = start+ i*step
... | 268 | 0 | 23 |
9ba96374077cc6b6b051eb3cef2d42ee720e73a1 | 2,926 | py | Python | cmake/spirv_num_to_cpp.py | orrkarl/rasterizer | 8ff356a6344336d8cd2250cbf488b0d853b26cda | [
"MIT"
] | 2 | 2019-08-16T09:12:30.000Z | 2019-08-18T20:57:33.000Z | cmake/spirv_num_to_cpp.py | orrkarl/rasterizer | 8ff356a6344336d8cd2250cbf488b0d853b26cda | [
"MIT"
] | 12 | 2019-09-13T17:26:09.000Z | 2020-02-13T12:34:40.000Z | cmake/spirv_num_to_cpp.py | orrkarl/vkr | 8ff356a6344336d8cd2250cbf488b0d853b26cda | [
"MIT"
] | null | null | null | import argparse
import os
import re
import sys
SOURCE_FMT = """// AUTOGENERATED
// Generated by spirv_num_to_cpp.py, from '{file_name}'
#include <stddef.h>
#include <stdint.h>
namespace {namespace} {{
const volatile uint32_t {var_name}[] = {{
{raw_lines}
}};
const volatile size_t {var_name}_count = {total_data_co... | 27.603774 | 123 | 0.697539 | import argparse
import os
import re
import sys
SOURCE_FMT = """// AUTOGENERATED
// Generated by spirv_num_to_cpp.py, from '{file_name}'
#include <stddef.h>
#include <stdint.h>
namespace {namespace} {{
const volatile uint32_t {var_name}[] = {{
{raw_lines}
}};
const volatile size_t {var_name}_count = {total_data_co... | 2,063 | 0 | 138 |
7db64e2d008d8a948c335e4ef44b123ff8349784 | 1,228 | py | Python | transfer-system/transfer_system/server/app.py | beasley-weather/beasley-weather-station | 5834429506c9cff82833a70d017c2ce51c8ded54 | [
"MIT"
] | null | null | null | transfer-system/transfer_system/server/app.py | beasley-weather/beasley-weather-station | 5834429506c9cff82833a70d017c2ce51c8ded54 | [
"MIT"
] | null | null | null | transfer-system/transfer_system/server/app.py | beasley-weather/beasley-weather-station | 5834429506c9cff82833a70d017c2ce51c8ded54 | [
"MIT"
] | null | null | null | import json
from json import JSONDecodeError
import subprocess as sp
from traceback import print_exc
from ..dbi import WeewxDB
from flask import Flask, request
def create_app(database):
"""
:param database: Name of database to save into
"""
app = Flask(__name__)
weewx_db = WeewxDB(database)
... | 23.169811 | 81 | 0.610749 | import json
from json import JSONDecodeError
import subprocess as sp
from traceback import print_exc
from ..dbi import WeewxDB
from flask import Flask, request
def create_app(database):
"""
:param database: Name of database to save into
"""
app = Flask(__name__)
weewx_db = WeewxDB(database)
... | 691 | 0 | 101 |
38d650ecab150ae7367ae4f5f43a45e22bee985c | 1,617 | py | Python | dglib/generalization/irm.py | billzhonggz/Transfer-Learning-Library | d7a6e4298e571d5101e05515a2ab1f171160ef89 | [
"MIT"
] | 1,474 | 2020-07-24T02:55:55.000Z | 2022-03-31T12:35:56.000Z | dglib/generalization/irm.py | mxliu/Transfer-Learning-Library | 7b0ccb3a8087ecc65daf4b1e815e5a3f42106641 | [
"MIT"
] | 70 | 2020-08-05T10:47:33.000Z | 2022-03-31T03:48:54.000Z | dglib/generalization/irm.py | mxliu/Transfer-Learning-Library | 7b0ccb3a8087ecc65daf4b1e815e5a3f42106641 | [
"MIT"
] | 312 | 2020-08-01T11:08:39.000Z | 2022-03-30T06:03:47.000Z | """
Modified from https://github.com/facebookresearch/DomainBed
@author: Baixu Chen
@contact: cbx_99_hasta@outlook.com
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.autograd as autograd
class InvariancePenaltyLoss(nn.Module):
r"""Invariance Penalty Loss from `Invariant Risk M... | 41.461538 | 119 | 0.681509 | """
Modified from https://github.com/facebookresearch/DomainBed
@author: Baixu Chen
@contact: cbx_99_hasta@outlook.com
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.autograd as autograd
class InvariancePenaltyLoss(nn.Module):
r"""Invariance Penalty Loss from `Invariant Risk M... | 513 | 0 | 54 |
5575f2112eec09893ca26f17e183ed4317d31a74 | 1,521 | py | Python | test/test_multipush.py | brentschroeter/parallel | 8465e2fab51596e0cfee5d0c216d85914b0bcd00 | [
"MIT"
] | 1 | 2021-06-22T07:38:13.000Z | 2021-06-22T07:38:13.000Z | test/test_multipush.py | brentschroeter/parallel | 8465e2fab51596e0cfee5d0c216d85914b0bcd00 | [
"MIT"
] | 1 | 2018-02-20T03:54:33.000Z | 2018-02-20T05:33:14.000Z | test/test_multipush.py | brentschroeter/parallel | 8465e2fab51596e0cfee5d0c216d85914b0bcd00 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import parallel
import unittest
import thread
import testing_lib
import time
import uuid
import config
from multiprocessing import RawValue
if __name__ == '__main__':
unittest.main()
| 33.8 | 207 | 0.737015 | #!/usr/bin/env python
import parallel
import unittest
import thread
import testing_lib
import time
import uuid
import config
from multiprocessing import RawValue
def wait_job(ms):
time.sleep(ms * 0.001)
return 1
def get_timeout(num_workers):
transportation_time = testing_lib.TRANSPORT_MS * config.NUM_JOB... | 435 | 760 | 115 |
34090411f9334b063de9fa2e34c7176d14b5fdaf | 164 | py | Python | intro/part03-02_countdown/src/countdown.py | Hannah-Abi/python-pro-21 | 2ce32c4bf118054329d19afdf83c50561be1ada8 | [
"MIT"
] | null | null | null | intro/part03-02_countdown/src/countdown.py | Hannah-Abi/python-pro-21 | 2ce32c4bf118054329d19afdf83c50561be1ada8 | [
"MIT"
] | null | null | null | intro/part03-02_countdown/src/countdown.py | Hannah-Abi/python-pro-21 | 2ce32c4bf118054329d19afdf83c50561be1ada8 | [
"MIT"
] | null | null | null | # Fix the program
print("Are you ready?")
number = int(input("Please type in a number: "))
while number != 0:
print(number)
number = number -1
print("Now!") | 23.428571 | 48 | 0.646341 | # Fix the program
print("Are you ready?")
number = int(input("Please type in a number: "))
while number != 0:
print(number)
number = number -1
print("Now!") | 0 | 0 | 0 |
bf8eddc2251b4fdf476a1eb2917f0565b810547c | 1,708 | py | Python | 11_data_science/pdf/test_pymupdf.py | edgardeng/python-advance-interview | 59fd7bee8e871acdc7fdfecf2a110db840c47ebb | [
"Apache-2.0"
] | 1 | 2022-03-06T13:03:56.000Z | 2022-03-06T13:03:56.000Z | 11_data_science/pdf/test_pymupdf.py | edgardeng/python-advance-interview | 59fd7bee8e871acdc7fdfecf2a110db840c47ebb | [
"Apache-2.0"
] | null | null | null | 11_data_science/pdf/test_pymupdf.py | edgardeng/python-advance-interview | 59fd7bee8e871acdc7fdfecf2a110db840c47ebb | [
"Apache-2.0"
] | null | null | null | import datetime
import os
import fitz # fitz就是pip install PyMuPDF -i https://mirrors.aliyun.com/pypi/simple (PyMuPDF-1.18.17)
if __name__ == "__main__":
path = r'D:\聚均科技-研发\2021 聚均科技AI平台\OCR\上市公司财报.pdf'
# path = r'D:\聚均科技-研发\2021 聚均科技AI平台\OCR\热力公司2016年审计报告.pdf'
pdf_to_img(path)
# list_img = ['热力公... | 35.583333 | 111 | 0.622365 | import datetime
import os
import fitz # fitz就是pip install PyMuPDF -i https://mirrors.aliyun.com/pypi/simple (PyMuPDF-1.18.17)
def pdf_to_img(path_file):
with fitz.open(path_file) as pdf:
print(pdf.metadata)
for i in range(pdf.pageCount):
# if i < 118 or i > 120:
# co... | 1,035 | 0 | 46 |
fe75b254c08503ec5cca082f0fb15c9c89d1faff | 5,233 | py | Python | userbot/modules/spammer.py | deepak99911/SpyderzzBot | f8b9a447df3f3a33c9c7ec157ebf446c3f9cd4b2 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 1 | 2020-05-27T14:57:14.000Z | 2020-05-27T14:57:14.000Z | userbot/modules/spammer.py | deepak99911/SpyderzzBot | f8b9a447df3f3a33c9c7ec157ebf446c3f9cd4b2 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | userbot/modules/spammer.py | deepak99911/SpyderzzBot | f8b9a447df3f3a33c9c7ec157ebf446c3f9cd4b2 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 57 | 2019-12-01T17:03:16.000Z | 2021-04-30T01:50:35.000Z | # Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.b (the "License");
# you may not use this file except in compliance with the License.
#
import asyncio
from asyncio import wait
from userbot import BOTLOG_CHATID, BOTLOG, CMD_HELP
from userbot.events impor... | 30.964497 | 78 | 0.563921 | # Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.b (the "License");
# you may not use this file except in compliance with the License.
#
import asyncio
from asyncio import wait
from userbot import BOTLOG_CHATID, BOTLOG, CMD_HELP
from userbot.events impor... | 3,660 | 0 | 198 |
137ab97ad5e7c8c06e0212b7937a1621ff946721 | 5,669 | py | Python | lte/gateway/python/magma/mobilityd/ip_descriptor_map.py | saurabhsoni88/magma | 4236c9d8edb7bd203707ff7e861b1f7c12fb84c7 | [
"BSD-3-Clause"
] | 1 | 2021-08-04T16:40:05.000Z | 2021-08-04T16:40:05.000Z | lte/gateway/python/magma/mobilityd/ip_descriptor_map.py | saurabhsoni88/magma | 4236c9d8edb7bd203707ff7e861b1f7c12fb84c7 | [
"BSD-3-Clause"
] | 112 | 2020-09-03T06:41:43.000Z | 2022-03-31T12:07:08.000Z | lte/gateway/python/magma/mobilityd/ip_descriptor_map.py | saurabhsoni88/magma | 4236c9d8edb7bd203707ff7e861b1f7c12fb84c7 | [
"BSD-3-Clause"
] | 1 | 2021-05-26T03:41:46.000Z | 2021-05-26T03:41:46.000Z | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... | 39.096552 | 77 | 0.665726 | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... | 0 | 3,711 | 23 |
d3ca9f458a2ea28861bbef896ef4e0e8828dcbae | 2,444 | py | Python | model_zoo/official/nlp/bert_thor/src/lr_generator.py | Joejiong/mindspore | 083fd6565cab1aa1d3114feeacccf1cba0d55e80 | [
"Apache-2.0"
] | null | null | null | model_zoo/official/nlp/bert_thor/src/lr_generator.py | Joejiong/mindspore | 083fd6565cab1aa1d3114feeacccf1cba0d55e80 | [
"Apache-2.0"
] | null | null | null | model_zoo/official/nlp/bert_thor/src/lr_generator.py | Joejiong/mindspore | 083fd6565cab1aa1d3114feeacccf1cba0d55e80 | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 34.422535 | 110 | 0.6473 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 383 | 0 | 45 |
914862d616409da7f4b40a4e8c797e4288b7d1e5 | 121 | py | Python | cwesecurity/__init__.py | johnlwhiteman/cwe-security | fdb53e5ef2b296d612824c6abe48c7a5be8844bb | [
"Apache-2.0"
] | null | null | null | cwesecurity/__init__.py | johnlwhiteman/cwe-security | fdb53e5ef2b296d612824c6abe48c7a5be8844bb | [
"Apache-2.0"
] | null | null | null | cwesecurity/__init__.py | johnlwhiteman/cwe-security | fdb53e5ef2b296d612824c6abe48c7a5be8844bb | [
"Apache-2.0"
] | null | null | null | import sys
from pathlib import Path
sys.path.append(str(Path(__file__).resolve().parent))
from cwesecurity.cwe import Cwe | 30.25 | 53 | 0.809917 | import sys
from pathlib import Path
sys.path.append(str(Path(__file__).resolve().parent))
from cwesecurity.cwe import Cwe | 0 | 0 | 0 |
38b212aebca5df92320025b051c573a9846ac9fc | 40,510 | py | Python | bed_reader/_open_bed.py | TedDriggs/bed-reader | 6b6309d45234cd04feccd2362e60e1138555bf4e | [
"Apache-2.0"
] | null | null | null | bed_reader/_open_bed.py | TedDriggs/bed-reader | 6b6309d45234cd04feccd2362e60e1138555bf4e | [
"Apache-2.0"
] | null | null | null | bed_reader/_open_bed.py | TedDriggs/bed-reader | 6b6309d45234cd04feccd2362e60e1138555bf4e | [
"Apache-2.0"
] | null | null | null | import logging
import multiprocessing
import os
from dataclasses import dataclass
from itertools import repeat, takewhile
from pathlib import Path
from typing import Any, List, Mapping, Optional, Union
import numpy as np
import pandas as pd
from .bed_reader import read_f32, read_f64, read_i8
# https://stackoverflow... | 31.33024 | 107 | 0.532782 | import logging
import multiprocessing
import os
from dataclasses import dataclass
from itertools import repeat, takewhile
from pathlib import Path
from typing import Any, List, Mapping, Optional, Union
import numpy as np
import pandas as pd
from .bed_reader import read_f32, read_f64, read_i8
# https://stackoverflow... | 8,811 | 95 | 511 |
d1e47a5ecac5656e9c1c3ebf9c8b3158717cbecc | 152 | py | Python | karaoke-server.py | AetherUnbound/pikaraoke | d4af46c55e4425ad6398c25ab6b108c8ce0277fc | [
"MIT"
] | null | null | null | karaoke-server.py | AetherUnbound/pikaraoke | d4af46c55e4425ad6398c25ab6b108c8ce0277fc | [
"MIT"
] | null | null | null | karaoke-server.py | AetherUnbound/pikaraoke | d4af46c55e4425ad6398c25ab6b108c8ce0277fc | [
"MIT"
] | null | null | null | # Author: Matthew Bowden bowdenm@spu.edu
import flask as fsk
app = fsk.Flask(__name__)
@app.route('/')
| 13.818182 | 40 | 0.690789 | # Author: Matthew Bowden bowdenm@spu.edu
import flask as fsk
app = fsk.Flask(__name__)
@app.route('/')
def show_songs():
return 'List of songs'
| 23 | 0 | 22 |
6dffa14bc17cbcb187baf012649a6b72553290cd | 23,202 | py | Python | level3/find_the_access_codes/solution.py | lcsm29/goog-foobar | 6ea44879d9d9f3483fa320d92d6c25b14565c899 | [
"MIT"
] | null | null | null | level3/find_the_access_codes/solution.py | lcsm29/goog-foobar | 6ea44879d9d9f3483fa320d92d6c25b14565c899 | [
"MIT"
] | null | null | null | level3/find_the_access_codes/solution.py | lcsm29/goog-foobar | 6ea44879d9d9f3483fa320d92d6c25b14565c899 | [
"MIT"
] | null | null | null |
if __name__ == '__main__':
from time import perf_counter_ns
basic_tests = (
([1, 1, 1], 1),
([1, 2, 3, 4, 5, 6], 3)
)
additional_tests = (
([1, 2], 0),
([2, 3, 5, 7], 0),
([1] * 100 + [2] + [4], 4),
([10, 20, 23, 27, 45, 69, 118, 138, 161, 166, 167, 170,... | 565.902439 | 15,778 | 0.700888 | def solution(l, counter=0): # although this solution passed the Google's test, and I submitted this one for Invitation #A1, but I don't think 171700 is the correct answer for l = [1] * 100 + [2] + [4]
ll = len(l)
arr = [0 for _ in range(ll)]
for i, k in enumerate(l):
for j in range(i):
... | 397 | 0 | 22 |
b814d40bced5d99185eb2d635cb5f9eff67c1cb0 | 6,820 | py | Python | gips/scripts/run_mapout.py | wutobias/gips | 93485caef46b39f9bd01edf58e306658bcee884b | [
"MIT"
] | 1 | 2021-04-24T10:29:39.000Z | 2021-04-24T10:29:39.000Z | gips/scripts/run_mapout.py | wutobias/gips | 93485caef46b39f9bd01edf58e306658bcee884b | [
"MIT"
] | null | null | null | gips/scripts/run_mapout.py | wutobias/gips | 93485caef46b39f9bd01edf58e306658bcee884b | [
"MIT"
] | 2 | 2021-02-16T14:18:59.000Z | 2021-06-04T05:09:22.000Z | import numpy as np
import copy
import pygmo
from gips.gistmodel.mode0 import mode0
from gips.gistmodel.mode1 import mode1
from gips.gistmodel.mode3 import mode3
from gips.gistmodel.mode4 import mode4
from gips.gistmodel.mode5 import mode5
from gips.gistmodel.mode6 import mode6
from gips.gistmodel.mode7 import mode7
f... | 31.574074 | 101 | 0.523021 | import numpy as np
import copy
import pygmo
from gips.gistmodel.mode0 import mode0
from gips.gistmodel.mode1 import mode1
from gips.gistmodel.mode3 import mode3
from gips.gistmodel.mode4 import mode4
from gips.gistmodel.mode5 import mode5
from gips.gistmodel.mode6 import mode6
from gips.gistmodel.mode7 import mode7
f... | 6,294 | 0 | 23 |
809e92f4e235a27adf79ef06050b790247a40ee6 | 4,431 | py | Python | tests/models/test_artifacts.py | Sohamkayal4103/mlflow | 4e444efdf73c710644ee039b44fa36a31d716f69 | [
"Apache-2.0"
] | 1 | 2022-01-11T02:51:17.000Z | 2022-01-11T02:51:17.000Z | tests/models/test_artifacts.py | Sohamkayal4103/mlflow | 4e444efdf73c710644ee039b44fa36a31d716f69 | [
"Apache-2.0"
] | null | null | null | tests/models/test_artifacts.py | Sohamkayal4103/mlflow | 4e444efdf73c710644ee039b44fa36a31d716f69 | [
"Apache-2.0"
] | 2 | 2019-05-11T08:13:38.000Z | 2019-05-14T13:33:54.000Z | from mlflow.exceptions import MlflowException
from mlflow.models.evaluation.artifacts import (
ImageEvaluationArtifact,
JsonEvaluationArtifact,
NumpyEvaluationArtifact,
CsvEvaluationArtifact,
ParquetEvaluationArtifact,
TextEvaluationArtifact,
PickleEvaluationArtifact,
)
import matplotlib.py... | 37.871795 | 99 | 0.682013 | from mlflow.exceptions import MlflowException
from mlflow.models.evaluation.artifacts import (
ImageEvaluationArtifact,
JsonEvaluationArtifact,
NumpyEvaluationArtifact,
CsvEvaluationArtifact,
ParquetEvaluationArtifact,
TextEvaluationArtifact,
PickleEvaluationArtifact,
)
import matplotlib.py... | 1,992 | -2 | 208 |
6317f3a48b6c684ec729ccc0512a3cbb1cb0ad18 | 1,424 | py | Python | src/ReadingtipLibrary.py | Berries-M/Ohtu_miniprojekti | fd763f996830cc99e832167951b9cb77a3e58731 | [
"MIT"
] | null | null | null | src/ReadingtipLibrary.py | Berries-M/Ohtu_miniprojekti | fd763f996830cc99e832167951b9cb77a3e58731 | [
"MIT"
] | null | null | null | src/ReadingtipLibrary.py | Berries-M/Ohtu_miniprojekti | fd763f996830cc99e832167951b9cb77a3e58731 | [
"MIT"
] | null | null | null | # pylint: disable=invalid-name
"""Hyväksymistestausluokka
"""
#Pylint disablettu toistaiseksi
from stub_io import StubIO # pylint: disable=import-error
class ReadingtipLibrary: # pylint: disable=invalid-name
"""Luokka joka vastaa vaatimusten testaamisesta
"""
def __init__(self):
"""Luokan konstru... | 24.551724 | 62 | 0.561798 | # pylint: disable=invalid-name
"""Hyväksymistestausluokka
"""
#Pylint disablettu toistaiseksi
from stub_io import StubIO # pylint: disable=import-error
class ReadingtipLibrary: # pylint: disable=invalid-name
"""Luokka joka vastaa vaatimusten testaamisesta
"""
def __init__(self):
"""Luokan konstru... | 0 | 0 | 0 |
a082368f583d73a70ea1e02f28ceaf3004ac72c2 | 1,500 | py | Python | test/test_cv_conversions.py | proboscis/omni-cv-rules | 0a3d4763c0c50bc32974a16531b3d0a1d396c05a | [
"MIT"
] | 2 | 2022-01-28T13:37:08.000Z | 2022-03-03T20:29:20.000Z | test/test_cv_conversions.py | proboscis/omni-cv-rules | 0a3d4763c0c50bc32974a16531b3d0a1d396c05a | [
"MIT"
] | null | null | null | test/test_cv_conversions.py | proboscis/omni-cv-rules | 0a3d4763c0c50bc32974a16531b3d0a1d396c05a | [
"MIT"
] | null | null | null | import frozendict
from loguru import logger
from omni_converter import AutoDataFactory
from omni_converter.solver.astar import AstarSolver
from omni_cv_rules.coconut.omni_converter import AutoList
from omni_cv_rules.rulebook import CV_RULEBOOK
target_conversions=[
("[image_path]","numpy_rgb"),
("pix2pix_batch... | 37.5 | 189 | 0.66 | import frozendict
from loguru import logger
from omni_converter import AutoDataFactory
from omni_converter.solver.astar import AstarSolver
from omni_cv_rules.coconut.omni_converter import AutoList
from omni_cv_rules.rulebook import CV_RULEBOOK
target_conversions=[
("[image_path]","numpy_rgb"),
("pix2pix_batch... | 426 | 0 | 46 |
cc7b17bf2ed9de52a8928eacc68c93e0d029b4b9 | 5,776 | py | Python | src/train_triplet.py | yumatsuoka/triplet-net_label-spreading | 7e7c1f31d3f22ab77ecdcb7eae1d959d0e9b7d36 | [
"Apache-2.0"
] | null | null | null | src/train_triplet.py | yumatsuoka/triplet-net_label-spreading | 7e7c1f31d3f22ab77ecdcb7eae1d959d0e9b7d36 | [
"Apache-2.0"
] | null | null | null | src/train_triplet.py | yumatsuoka/triplet-net_label-spreading | 7e7c1f31d3f22ab77ecdcb7eae1d959d0e9b7d36 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
train triplet net and get feature vectors
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
import time
import argparse
# from tqdm import tqdm
import matplotlib
matplotlib.use('Agg')
import ma... | 35.875776 | 100 | 0.631752 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
train triplet net and get feature vectors
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
import time
import argparse
# from tqdm import tqdm
import matplotlib
matplotlib.use('Agg')
import ma... | 3,436 | 0 | 69 |
3becdb32e6fc5a6e1682833cf8b1b539ef46ae75 | 2,704 | py | Python | pythonravil10/Main.py | thekupidman/pythonravil10 | 8bf069e78e75311de45b5792fc0b383e07c8bebc | [
"Unlicense"
] | null | null | null | pythonravil10/Main.py | thekupidman/pythonravil10 | 8bf069e78e75311de45b5792fc0b383e07c8bebc | [
"Unlicense"
] | null | null | null | pythonravil10/Main.py | thekupidman/pythonravil10 | 8bf069e78e75311de45b5792fc0b383e07c8bebc | [
"Unlicense"
] | null | null | null | #!/usr/bin/env python3
# coding=utf-8
import sys
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import pyqtSlot,QTimer
from PyQt5 import uic,QtGui
import random
import math
if __name__=='__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
| 25.509434 | 98 | 0.571006 | #!/usr/bin/env python3
# coding=utf-8
import sys
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import pyqtSlot,QTimer
from PyQt5 import uic,QtGui
import random
import math
class Example(QWidget):
def __init__(self):
super().__init__()
QWidget.__init__(self)
... | 2,225 | 2 | 158 |
213c75f949c20ce93af983e60de6bcc7ff886b5b | 1,497 | py | Python | tools/make_wrapper_types_header.py | sarthak-saxena/cef_node_webkit | cca786066cdc635d2bcfb67315a70a1c40c5d77a | [
"BSD-3-Clause"
] | 1,686 | 2017-04-02T19:51:57.000Z | 2022-03-31T10:08:40.000Z | tools/make_wrapper_types_header.py | sarthak-saxena/cef_node_webkit | cca786066cdc635d2bcfb67315a70a1c40c5d77a | [
"BSD-3-Clause"
] | 16 | 2017-04-21T12:05:52.000Z | 2022-03-01T23:15:13.000Z | tools/make_wrapper_types_header.py | sarthak-saxena/cef_node_webkit | cca786066cdc635d2bcfb67315a70a1c40c5d77a | [
"BSD-3-Clause"
] | 343 | 2017-04-21T11:20:31.000Z | 2022-03-31T07:47:25.000Z | # Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
from __future__ import absolute_import
from cef_parser import *
# test the module
if __name__ == "__main__":
import sys
# ver... | 29.352941 | 79 | 0.684035 | # Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
from __future__ import absolute_import
from cef_parser import *
def make_wrapper_types_header(header):
result = get_copyright()
... | 687 | 0 | 46 |
6cfac4dc66e5ee5540d8165efeefd8941289e305 | 1,307 | py | Python | authenticationApp/backends.py | George-Okumu/IReporter-Django | 5962984ce0069cdf048dbf91686377568a7cf55b | [
"MIT"
] | null | null | null | authenticationApp/backends.py | George-Okumu/IReporter-Django | 5962984ce0069cdf048dbf91686377568a7cf55b | [
"MIT"
] | 1 | 2021-10-06T20:15:11.000Z | 2021-10-06T20:15:11.000Z | authenticationApp/backends.py | George-Okumu/IReporter-Django | 5962984ce0069cdf048dbf91686377568a7cf55b | [
"MIT"
] | null | null | null |
from os import path
from django.conf import settings
from rest_framework import exceptions, authentication
import jwt
from .models import CustomUser
| 39.606061 | 93 | 0.670237 |
from os import path
from django.conf import settings
from rest_framework import exceptions, authentication
import jwt
from .models import CustomUser
class JWTAuthentication(authentication.BaseAuthentication):
def authenticate(self, request):
auth_header = authentication.get_authorization_header(request)
... | 1,054 | 38 | 48 |
998f4a6842c75f878d5d80608bf11dd019ef2830 | 294 | py | Python | src/hw_test/button_test.py | rundhall/ESP-LEGO-SPIKE-Simulator | dc83b895ff2aac5cf2fe576d0ba98426fea60827 | [
"MIT"
] | null | null | null | src/hw_test/button_test.py | rundhall/ESP-LEGO-SPIKE-Simulator | dc83b895ff2aac5cf2fe576d0ba98426fea60827 | [
"MIT"
] | null | null | null | src/hw_test/button_test.py | rundhall/ESP-LEGO-SPIKE-Simulator | dc83b895ff2aac5cf2fe576d0ba98426fea60827 | [
"MIT"
] | null | null | null | import time,machine
BUTTONPIN = 0
buttonpin = machine.Pin(BUTTONPIN, machine.Pin.IN, machine.Pin.PULL_UP)
buttonlast = 0
print("wait_until_pressed: Waits until the button is pressed.")
while buttonpin.value()==1:
print("push the button")
time.sleep_ms(100)
print("button is pressed")
| 26.727273 | 71 | 0.744898 | import time,machine
BUTTONPIN = 0
buttonpin = machine.Pin(BUTTONPIN, machine.Pin.IN, machine.Pin.PULL_UP)
buttonlast = 0
print("wait_until_pressed: Waits until the button is pressed.")
while buttonpin.value()==1:
print("push the button")
time.sleep_ms(100)
print("button is pressed")
| 0 | 0 | 0 |
e9b8a70ff52561f8160b905d6c7d0f6adf09b3f2 | 9,945 | py | Python | src/baseline/baseline_embeddings.py | fshdnc/disease_normalization | 68b8fc118fe0f971fbd056ad2bffb44caa0e7abf | [
"Apache-2.0"
] | 1 | 2021-01-28T09:24:27.000Z | 2021-01-28T09:24:27.000Z | src/baseline/baseline_embeddings.py | fshdnc/disease_normalization | 68b8fc118fe0f971fbd056ad2bffb44caa0e7abf | [
"Apache-2.0"
] | 1 | 2019-07-08T03:25:30.000Z | 2019-12-13T08:33:55.000Z | src/baseline/baseline_embeddings.py | fshdnc/disease_normalization | 68b8fc118fe0f971fbd056ad2bffb44caa0e7abf | [
"Apache-2.0"
] | null | null | null | '''Word2Vec Baseline
python3 baseline_embeddings.py path_to_embedding'''
import logging
import logging.config
import configparser as cp
#import args
import sys
import pickle
import numpy as np
import vectorizer
import load
import sample
#configurations
config = cp.ConfigParser(strict=False)
config.read('defaults.c... | 39.153543 | 159 | 0.668477 | '''Word2Vec Baseline
python3 baseline_embeddings.py path_to_embedding'''
import logging
import logging.config
import configparser as cp
#import args
import sys
import pickle
import numpy as np
import vectorizer
import load
import sample
#configurations
config = cp.ConfigParser(strict=False)
config.read('defaults.c... | 7,077 | 0 | 23 |
cd57085bc6d677111edf3ff6f26a0fb5115f0d21 | 2,336 | py | Python | src/main.py | divelab/gunet | 570dc99fca7a258cb8d38247c3eb34d5cec4201e | [
"MIT"
] | 7 | 2019-06-26T22:06:07.000Z | 2020-09-02T05:04:34.000Z | src/main.py | divelab/gunet | 570dc99fca7a258cb8d38247c3eb34d5cec4201e | [
"MIT"
] | null | null | null | src/main.py | divelab/gunet | 570dc99fca7a258cb8d38247c3eb34d5cec4201e | [
"MIT"
] | null | null | null | import argparse
import random
import time
import torch
import numpy as np
from network import GNet
from trainer import Trainer
from utils.data_loader import FileLoader
if __name__ == "__main__":
main()
| 36.5 | 79 | 0.671233 | import argparse
import random
import time
import torch
import numpy as np
from network import GNet
from trainer import Trainer
from utils.data_loader import FileLoader
def get_args():
parser = argparse.ArgumentParser(description='Args for graph predition')
parser.add_argument('-seed', type=int, default=1, hel... | 2,032 | 0 | 92 |
479934381a06e295d8434572902c2bdc5cf55ae9 | 52 | py | Python | src/__init__.py | treyhunner/pysource | ae54b39cadd4fa108a42f01512fbb07c29585e48 | [
"MIT"
] | null | null | null | src/__init__.py | treyhunner/pysource | ae54b39cadd4fa108a42f01512fbb07c29585e48 | [
"MIT"
] | null | null | null | src/__init__.py | treyhunner/pysource | ae54b39cadd4fa108a42f01512fbb07c29585e48 | [
"MIT"
] | null | null | null | from src.pysource import get_callable, print_source
| 26 | 51 | 0.865385 | from src.pysource import get_callable, print_source
| 0 | 0 | 0 |
21d6d6909499248ae9cc2c10b507830129a742ea | 3,993 | py | Python | qdsl/boolean.py | csams/qdsl | b80c996ad21f5604372622755da9d5b6dc9d35b2 | [
"Apache-2.0"
] | 2 | 2020-11-05T21:48:00.000Z | 2020-12-18T03:13:02.000Z | qdsl/boolean.py | csams/qdsl | b80c996ad21f5604372622755da9d5b6dc9d35b2 | [
"Apache-2.0"
] | null | null | null | qdsl/boolean.py | csams/qdsl | b80c996ad21f5604372622755da9d5b6dc9d35b2 | [
"Apache-2.0"
] | 1 | 2021-09-28T08:22:35.000Z | 2021-09-28T08:22:35.000Z | """
The boolean module lets you create complicated boolean expressions by composing
objects. The compositions can be evaluated against multiple values.
"""
import logging
import operator
import re
from functools import partial, wraps
from itertools import count
log = logging.getLogger(__name__)
__all__ = [
"pred... | 21.819672 | 79 | 0.574255 | """
The boolean module lets you create complicated boolean expressions by composing
objects. The compositions can be evaluated against multiple values.
"""
import logging
import operator
import re
from functools import partial, wraps
from itertools import count
log = logging.getLogger(__name__)
__all__ = [
"pred... | 2,146 | -14 | 585 |
0e501240ff928cf0aab6e8c990701343605ccca5 | 930 | py | Python | check_params_decorate.py | MarionYoung/python | d2ed5be63de344cb689fe00c04cf75f89d91f28a | [
"Apache-2.0"
] | null | null | null | check_params_decorate.py | MarionYoung/python | d2ed5be63de344cb689fe00c04cf75f89d91f28a | [
"Apache-2.0"
] | null | null | null | check_params_decorate.py | MarionYoung/python | d2ed5be63de344cb689fe00c04cf75f89d91f28a | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/8/4 14:15
# @Author : Marrion
#
import functools,inspect
@check
print(add(3,4)) | 35.769231 | 109 | 0.604301 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/8/4 14:15
# @Author : Marrion
#
import functools,inspect
def check(fn):
@functools.wraps(fn)
def warp(*args,**kwargs):
sig = inspect.signature(fn)
parms = inspect.signature(fn).parameters
for k,v in kwargs.items():
... | 742 | 0 | 44 |
ea323d4b5d93a223c92508e50138297ba3a7ebf9 | 1,426 | py | Python | torcms/model/classify_model.py | bukun/TorCMS | 5d7480865fd46e706b84f5f65a5c24cd03bb2142 | [
"MIT"
] | 243 | 2015-02-11T03:22:19.000Z | 2022-03-02T11:13:27.000Z | torcms/model/classify_model.py | bukun/TorCMS | 5d7480865fd46e706b84f5f65a5c24cd03bb2142 | [
"MIT"
] | 8 | 2015-09-09T10:49:52.000Z | 2020-08-30T08:52:48.000Z | torcms/model/classify_model.py | bukun/TorCMS | 5d7480865fd46e706b84f5f65a5c24cd03bb2142 | [
"MIT"
] | 101 | 2015-02-12T02:17:16.000Z | 2021-11-19T09:20:10.000Z | # -*- coding:utf-8 -*-
'''
Model for classify.
'''
from config import CMS_CFG
from torcms.model.core_tab import TabPost, TabPost2Tag, TabTag
class MClassify():
'''
Model for classify.
'''
@staticmethod
@staticmethod
@staticmethod
@staticmethod
| 27.960784 | 75 | 0.587658 | # -*- coding:utf-8 -*-
'''
Model for classify.
'''
from config import CMS_CFG
from torcms.model.core_tab import TabPost, TabPost2Tag, TabTag
class MClassify():
'''
Model for classify.
'''
def __init__(self):
super().__init__()
@staticmethod
def query_pager_by_classify(current_page_nu... | 1,017 | 0 | 130 |
8469b52da50e995d6953b3f007086e6d9fc96c76 | 1,082 | py | Python | frappe-bench/env/lib/python2.7/site-packages/cli_helpers/tabular_output/terminaltables_adapter.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | null | null | null | frappe-bench/env/lib/python2.7/site-packages/cli_helpers/tabular_output/terminaltables_adapter.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | null | null | null | frappe-bench/env/lib/python2.7/site-packages/cli_helpers/tabular_output/terminaltables_adapter.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Format adapter for the terminaltables module."""
import terminaltables
import itertools
from cli_helpers.utils import filter_dict_by_key
from .preprocessors import (convert_to_string, override_missing_value,
style_output)
supported_formats = ('ascii', 'double', ... | 30.914286 | 75 | 0.698706 | # -*- coding: utf-8 -*-
"""Format adapter for the terminaltables module."""
import terminaltables
import itertools
from cli_helpers.utils import filter_dict_by_key
from .preprocessors import (convert_to_string, override_missing_value,
style_output)
supported_formats = ('ascii', 'double', ... | 0 | 0 | 0 |
201b27541ad73178629e7ff21ae7b88cdb35af68 | 1,844 | py | Python | licensePlates.py | matspi/CoolLicensePlates | 0276c9c62afbe928066590c2ac73805d4752c332 | [
"MIT"
] | null | null | null | licensePlates.py | matspi/CoolLicensePlates | 0276c9c62afbe928066590c2ac73805d4752c332 | [
"MIT"
] | null | null | null | licensePlates.py | matspi/CoolLicensePlates | 0276c9c62afbe928066590c2ac73805d4752c332 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import sys
import requests
from google.cloud import translate
REGIST_URL = r"https://www.berlin.de/daten/liste-der-kfz-kennzeichen/kfz-kennz-d.csv"
NUMBERS = (
"null",
"eins",
"zwei",
"drei",
"vier",
"fünf",
"sechs",
"sieben",
"acht",
"neun"
)
csvData ... | 26.724638 | 109 | 0.590564 | #!/usr/bin/env python3
import sys
import requests
from google.cloud import translate
REGIST_URL = r"https://www.berlin.de/daten/liste-der-kfz-kennzeichen/kfz-kennz-d.csv"
NUMBERS = (
"null",
"eins",
"zwei",
"drei",
"vier",
"fünf",
"sechs",
"sieben",
"acht",
"neun"
)
csvData ... | 717 | 0 | 23 |
6a649bec9e4e2327f289422a9b7cb04d2ef6054a | 2,197 | py | Python | env/lib/python3.8/site-packages/celery/worker/heartbeat.py | rajancolab/blogsite | 0721a3ab9b61bfca6fd84d5fae60b0574bfb0287 | [
"MIT"
] | 13 | 2018-03-28T23:07:01.000Z | 2022-03-12T06:01:21.000Z | env/lib/python3.8/site-packages/celery/worker/heartbeat.py | rajancolab/blogsite | 0721a3ab9b61bfca6fd84d5fae60b0574bfb0287 | [
"MIT"
] | 11 | 2018-06-18T15:49:07.000Z | 2021-11-25T01:45:33.000Z | env/lib/python3.9/site-packages/celery/worker/heartbeat.py | simotwo/AbileneParadox-ddd | c85961efb37aba43c0d99ed1c36d083507e2b2d3 | [
"MIT"
] | 5 | 2018-03-28T23:07:05.000Z | 2021-12-09T19:02:00.000Z | # -*- coding: utf-8 -*-
"""Heartbeat service.
This is the internal thread responsible for sending heartbeat events
at regular intervals (may not be an actual thread).
"""
from __future__ import absolute_import, unicode_literals
from celery.signals import heartbeat_sent
from celery.utils.sysinfo import load_average
f... | 33.8 | 70 | 0.616295 | # -*- coding: utf-8 -*-
"""Heartbeat service.
This is the internal thread responsible for sending heartbeat events
at regular intervals (may not be an actual thread).
"""
from __future__ import absolute_import, unicode_literals
from celery.signals import heartbeat_sent
from celery.utils.sysinfo import load_average
f... | 1,327 | 0 | 108 |
dba41e658b9b0dbcd00581e0eb820cc725866c0b | 660 | py | Python | tests/geohash/lib/test_ray.py | nziehn/toolbox-geohash | d397a02cbf0932d3a6463dcc47dfc177c8e35033 | [
"MIT"
] | 1 | 2021-11-21T12:31:38.000Z | 2021-11-21T12:31:38.000Z | tests/geohash/lib/test_ray.py | nziehn/toolbox-geohash | d397a02cbf0932d3a6463dcc47dfc177c8e35033 | [
"MIT"
] | null | null | null | tests/geohash/lib/test_ray.py | nziehn/toolbox-geohash | d397a02cbf0932d3a6463dcc47dfc177c8e35033 | [
"MIT"
] | null | null | null | from toolbox.geohash.lib import ray as _uut
from nose import tools as _tools
from toolbox.geohash.lib import point as _point
| 17.837838 | 48 | 0.568182 | from toolbox.geohash.lib import ray as _uut
from nose import tools as _tools
from toolbox.geohash.lib import point as _point
def test_ray():
origin = _point.Point(x=0, y=0, z=0)
x1 = _point.Point(x=1, y=0, z=0)
x2y1 = _point.Point(x=2, y=1, z=0)
ray1 = _uut.Ray(start=x1, end=x2y1)
_tools.asser... | 508 | 0 | 23 |
f91e7da2b03dd53eb8e9c707369d892377c7d10b | 286 | py | Python | data/mnist_data/create_mnist_imgs.py | felixGer/PySDDR | a7680e7190185ba605df6ad85b4fdf19401473b3 | [
"MIT"
] | 14 | 2021-04-07T17:33:19.000Z | 2022-02-07T14:49:37.000Z | data/mnist_data/create_mnist_imgs.py | felixGer/PySDDR | a7680e7190185ba605df6ad85b4fdf19401473b3 | [
"MIT"
] | 3 | 2021-11-30T15:03:32.000Z | 2022-01-09T06:24:29.000Z | data/mnist_data/create_mnist_imgs.py | felixGer/PySDDR | a7680e7190185ba605df6ad85b4fdf19401473b3 | [
"MIT"
] | 7 | 2021-04-20T08:48:57.000Z | 2022-03-02T10:45:19.000Z | import numpy as np
import os
import imageio
mnist = np.load('mnist.npy')
num_imgs = mnist.shape[0]
for i in range(num_imgs):
img = mnist[i,:,:]
name = 'img_%s.jpg'%(i)
file_path = os.path.join('mnist_images', name)
imageio.imwrite(file_path, (img*255).astype(np.uint8)) | 26 | 58 | 0.671329 | import numpy as np
import os
import imageio
mnist = np.load('mnist.npy')
num_imgs = mnist.shape[0]
for i in range(num_imgs):
img = mnist[i,:,:]
name = 'img_%s.jpg'%(i)
file_path = os.path.join('mnist_images', name)
imageio.imwrite(file_path, (img*255).astype(np.uint8)) | 0 | 0 | 0 |
0d0fa6addcfe5c2847163ce9c815a1679e2eed6b | 1,977 | py | Python | test/selenium/src/lib/rest_facades/roles_rest_facade.py | MikalaiMikalalai/ggrc-core | f0f83b3638574bb64de474f3b70ed27436ca812a | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2019-01-12T23:46:00.000Z | 2019-01-12T23:46:00.000Z | test/selenium/src/lib/rest_facades/roles_rest_facade.py | MikalaiMikalalai/ggrc-core | f0f83b3638574bb64de474f3b70ed27436ca812a | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | test/selenium/src/lib/rest_facades/roles_rest_facade.py | MikalaiMikalalai/ggrc-core | f0f83b3638574bb64de474f3b70ed27436ca812a | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""REST facade for roles."""
from lib import users
from lib.constants import roles, objects, object_states
from lib.decorator import memoize
from lib.entities import entities_factory
from lib.entities.entity ... | 38.019231 | 78 | 0.754679 | # Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""REST facade for roles."""
from lib import users
from lib.constants import roles, objects, object_states
from lib.decorator import memoize
from lib.entities import entities_factory
from lib.entities.entity ... | 0 | 0 | 0 |
420d617f1e058c42ad47f5a158d2d53d46c66af5 | 329 | py | Python | tests/test_pw_hasher.py | jordic/fastapi_iam | aab1815dcb8b93f303fd9a83d85660ac3f92b7af | [
"MIT"
] | 1 | 2021-03-18T22:11:52.000Z | 2021-03-18T22:11:52.000Z | tests/test_pw_hasher.py | jordic/fastapi_iam | aab1815dcb8b93f303fd9a83d85660ac3f92b7af | [
"MIT"
] | null | null | null | tests/test_pw_hasher.py | jordic/fastapi_iam | aab1815dcb8b93f303fd9a83d85660ac3f92b7af | [
"MIT"
] | null | null | null | import pytest
from fastapi_iam import auth
pytestmark = pytest.mark.asyncio
| 25.307692 | 62 | 0.768997 | import pytest
from fastapi_iam import auth
pytestmark = pytest.mark.asyncio
async def test_password_argon_hasher():
service = auth.ArgonPasswordHasher()
password = "1qaz2wsx"
token = await service.hash_password(password)
check_pass = await service.check_password(token, password)
assert check_pass... | 228 | 0 | 23 |
7f0837223c4424fece8121cb0718fcbac587c4f2 | 3,718 | py | Python | pyvlova/op/grouped_conv.py | ModelTC/pyvlova | 080437c80bd995776507f5c9f4975a0420391cb0 | [
"Apache-2.0"
] | 1 | 2021-11-11T03:11:49.000Z | 2021-11-11T03:11:49.000Z | pyvlova/op/grouped_conv.py | ModelTC/pyvlova | 080437c80bd995776507f5c9f4975a0420391cb0 | [
"Apache-2.0"
] | null | null | null | pyvlova/op/grouped_conv.py | ModelTC/pyvlova | 080437c80bd995776507f5c9f4975a0420391cb0 | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 Jiang Shenghu
# SPDX-License-Identifier: Apache-2.0
from tvm import topi
from ..poly import TensorTable, Statement, ScheduleTree
from .conv import PlainConv2d, Conv2d
| 39.136842 | 104 | 0.589295 | # Copyright 2020 Jiang Shenghu
# SPDX-License-Identifier: Apache-2.0
from tvm import topi
from ..poly import TensorTable, Statement, ScheduleTree
from .conv import PlainConv2d, Conv2d
def schedule(**kwargs):
init_t = 'stmt_init[n, c, h, w]'
calc_t = 'stmt_calc[n, c, h, w, i, j, k]'
output_constraints = '... | 2,764 | 623 | 141 |
4ad335965ac7f1188f59a89d4c60cee16b923221 | 1,158 | py | Python | scenic/projects/baselines/detr/main.py | NielsRogge/scenic | 4418bf4c6954fffe61d9bafc802981baa9440e49 | [
"Apache-2.0"
] | 688 | 2021-07-26T21:45:18.000Z | 2022-03-31T11:53:34.000Z | scenic/projects/baselines/detr/main.py | NielsRogge/scenic | 4418bf4c6954fffe61d9bafc802981baa9440e49 | [
"Apache-2.0"
] | 35 | 2021-08-03T11:31:10.000Z | 2022-03-31T21:58:58.000Z | scenic/projects/baselines/detr/main.py | NielsRogge/scenic | 4418bf4c6954fffe61d9bafc802981baa9440e49 | [
"Apache-2.0"
] | 88 | 2021-08-03T13:19:50.000Z | 2022-03-31T08:35:22.000Z | """Main file for DETR."""
from typing import Any
from absl import flags
from clu import metric_writers
import jax
import jax.numpy as jnp
import ml_collections
from scenic import app
from scenic.projects.baselines.detr import model as detr_model
from scenic.projects.baselines.detr import trainer
from scenic.train_lib... | 26.318182 | 78 | 0.741796 | """Main file for DETR."""
from typing import Any
from absl import flags
from clu import metric_writers
import jax
import jax.numpy as jnp
import ml_collections
from scenic import app
from scenic.projects.baselines.detr import model as detr_model
from scenic.projects.baselines.detr import trainer
from scenic.train_lib... | 0 | 0 | 0 |
7821f2ff484f39551a14eddf76087769af5e5a96 | 4,973 | py | Python | students/K33402/Akhmetzhanov Alisher/lr3_4/lab3_4/libraryBackend/main/views.py | AlishKZ/ITMO_ICT_WebDevelopment_2020-2021 | b3ce82e17392d26d815e64343f5103f1bd46cd81 | [
"MIT"
] | null | null | null | students/K33402/Akhmetzhanov Alisher/lr3_4/lab3_4/libraryBackend/main/views.py | AlishKZ/ITMO_ICT_WebDevelopment_2020-2021 | b3ce82e17392d26d815e64343f5103f1bd46cd81 | [
"MIT"
] | null | null | null | students/K33402/Akhmetzhanov Alisher/lr3_4/lab3_4/libraryBackend/main/views.py | AlishKZ/ITMO_ICT_WebDevelopment_2020-2021 | b3ce82e17392d26d815e64343f5103f1bd46cd81 | [
"MIT"
] | null | null | null | from rest_framework.response import Response
from rest_framework import status
from rest_framework.views import APIView
from main.serializers import BookReplicaSerializer, BookSerializer, LibrarianSerializer, LibraryHallSerializer, ReaderSerializer
from main.models import Book, BookReplica, CustomUser, Librarian, Libr... | 36.29927 | 128 | 0.717474 | from rest_framework.response import Response
from rest_framework import status
from rest_framework.views import APIView
from main.serializers import BookReplicaSerializer, BookSerializer, LibrarianSerializer, LibraryHallSerializer, ReaderSerializer
from main.models import Book, BookReplica, CustomUser, Librarian, Libr... | 2,909 | 1,123 | 502 |
6d5e238930e86ae7e01b39e44815055131942fef | 275 | py | Python | predict.py | fhvermei/chemprop_solvation | b6b2ea87440bb600593b5ff50eb8a15cfd79f33d | [
"MIT"
] | null | null | null | predict.py | fhvermei/chemprop_solvation | b6b2ea87440bb600593b5ff50eb8a15cfd79f33d | [
"MIT"
] | 1 | 2022-03-01T19:15:33.000Z | 2022-03-01T19:15:33.000Z | predict.py | fhvermei/chemprop_solvation | b6b2ea87440bb600593b5ff50eb8a15cfd79f33d | [
"MIT"
] | null | null | null | """Loads a trained model checkpoint and makes predictions on a dataset."""
from chemprop_solvation.parsing import parse_predict_args
from chemprop_solvation.train import make_predictions
if __name__ == '__main__':
args = parse_predict_args()
make_predictions(args)
| 30.555556 | 74 | 0.796364 | """Loads a trained model checkpoint and makes predictions on a dataset."""
from chemprop_solvation.parsing import parse_predict_args
from chemprop_solvation.train import make_predictions
if __name__ == '__main__':
args = parse_predict_args()
make_predictions(args)
| 0 | 0 | 0 |
08c5f818e4cec818b0a9461dbd18e340f34b25ce | 175 | py | Python | matrixprofile/exceptions.py | MORE-EU/matrixprofile | 7c598385f7723f337d7bf7d3f90cffb690c6b0df | [
"Apache-2.0"
] | 262 | 2020-02-28T20:42:27.000Z | 2022-03-30T14:02:28.000Z | matrixprofile/exceptions.py | MORE-EU/matrixprofile | 7c598385f7723f337d7bf7d3f90cffb690c6b0df | [
"Apache-2.0"
] | 79 | 2020-03-01T01:42:14.000Z | 2022-03-30T07:15:48.000Z | matrixprofile/exceptions.py | MORE-EU/matrixprofile | 7c598385f7723f337d7bf7d3f90cffb690c6b0df | [
"Apache-2.0"
] | 56 | 2020-03-03T14:56:27.000Z | 2022-03-22T07:18:42.000Z |
class NoSolutionPossible(Exception):
"""A simple class used to explicitly let a user know that a solution is not
possible given the current inputs.
"""
pass
| 21.875 | 79 | 0.702857 |
class NoSolutionPossible(Exception):
"""A simple class used to explicitly let a user know that a solution is not
possible given the current inputs.
"""
pass
| 0 | 0 | 0 |
ecf722da8089f170f217dfec0cc7d3e66aae3380 | 8,753 | py | Python | sdk/python/pulumi_google_native/managedidentities/v1beta1/backup.py | AaronFriel/pulumi-google-native | 75d1cda425e33d4610348972cd70bddf35f1770d | [
"Apache-2.0"
] | 44 | 2021-04-18T23:00:48.000Z | 2022-02-14T17:43:15.000Z | sdk/python/pulumi_google_native/managedidentities/v1beta1/backup.py | AaronFriel/pulumi-google-native | 75d1cda425e33d4610348972cd70bddf35f1770d | [
"Apache-2.0"
] | 354 | 2021-04-16T16:48:39.000Z | 2022-03-31T17:16:39.000Z | sdk/python/pulumi_google_native/managedidentities/v1beta1/backup.py | AaronFriel/pulumi-google-native | 75d1cda425e33d4610348972cd70bddf35f1770d | [
"Apache-2.0"
] | 8 | 2021-04-24T17:46:51.000Z | 2022-01-05T10:40:21.000Z | # 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! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
__... | 37.891775 | 134 | 0.619331 | # 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! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
__... | 2,792 | 5,543 | 45 |
edebeb0f91dc89522eb52c4c79f88ea14cac0264 | 7,331 | py | Python | rpython/rlib/special_value.py | jptomo/pypy-lang-scheme | 55edb2cec69d78f86793282a4566fcbc1ef9fcac | [
"MIT"
] | 34 | 2015-07-09T04:53:27.000Z | 2021-07-19T05:22:27.000Z | rpython/rlib/special_value.py | jptomo/pypy-lang-scheme | 55edb2cec69d78f86793282a4566fcbc1ef9fcac | [
"MIT"
] | 6 | 2015-05-30T17:20:45.000Z | 2017-06-12T14:29:23.000Z | rpython/rlib/special_value.py | jptomo/pypy-lang-scheme | 55edb2cec69d78f86793282a4566fcbc1ef9fcac | [
"MIT"
] | 11 | 2015-09-07T14:26:08.000Z | 2020-04-10T07:20:41.000Z | import math
from rpython.rlib.rfloat import isnan, isinf, copysign
# code to deal with special values (infinities, NaNs, ...)
#
# The special types can be:
ST_NINF = 0 # negative infinity
ST_NEG = 1 # negative finite number (nonzero)
ST_NZERO = 2 # -0.
ST_PZERO = 3 # +0.
ST_P... | 43.123529 | 79 | 0.367753 | import math
from rpython.rlib.rfloat import isnan, isinf, copysign
# code to deal with special values (infinities, NaNs, ...)
#
# The special types can be:
ST_NINF = 0 # negative infinity
ST_NEG = 1 # negative finite number (nonzero)
ST_NZERO = 2 # -0.
ST_PZERO = 3 # +0.
ST_P... | 644 | 0 | 46 |
4043addbcf2a6913bd26e0dcd14ebb7242e74209 | 1,479 | py | Python | torstack/library/compat.py | longniao/torstack | 148139eeca0f3cd8a8c2196ae2a6f8cea519d9b5 | [
"MIT"
] | 7 | 2018-12-11T03:41:04.000Z | 2018-12-11T06:08:45.000Z | torstack/library/compat.py | longniao/torstack | 148139eeca0f3cd8a8c2196ae2a6f8cea519d9b5 | [
"MIT"
] | null | null | null | torstack/library/compat.py | longniao/torstack | 148139eeca0f3cd8a8c2196ae2a6f8cea519d9b5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
'''
torstack.library.compat.py
compat definition.
:copyright: (c) 2018 by longniao <longniao@gmail.com>
:license: MIT, see LICENSE for more details.
'''
import sys
# __all__ = (
# 'text_type', 'string_types', 'izip', 'iteritems', 'itervalues',
# 'with_metaclass',
# )
PY3 = sys.versi... | 20.541667 | 69 | 0.612576 | # -*- coding: utf-8 -*-
'''
torstack.library.compat.py
compat definition.
:copyright: (c) 2018 by longniao <longniao@gmail.com>
:license: MIT, see LICENSE for more details.
'''
import sys
# __all__ = (
# 'text_type', 'string_types', 'izip', 'iteritems', 'itervalues',
# 'with_metaclass',
# )
PY3 = sys.versi... | 390 | 0 | 266 |