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.97 618k | max_line_length int64 1 1.02M | alphanum_fraction float64 0 1 | original_content stringlengths 7 1.04M | filtered:remove_classes int64 -45 1.01M | filtered:remove_unused_imports int64 -354 44.8k | filtered:remove_delete_markers int64 0 24.8k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e7e9653d546ade6c8ce9b53c49b25b1b21568a5c | 5,267 | py | Python | VisualGimp/Markup.py | duangsuse/VisualGimp | 79776fded12595ab3c56855b5ae56e2242780b2e | [
"MIT"
] | 2 | 2019-05-07T12:09:11.000Z | 2019-05-08T09:31:44.000Z | VisualGimp/Markup.py | duangsuse-valid-projects/VisualGimp | 79776fded12595ab3c56855b5ae56e2242780b2e | [
"MIT"
] | null | null | null | VisualGimp/Markup.py | duangsuse-valid-projects/VisualGimp | 79776fded12595ab3c56855b5ae56e2242780b2e | [
"MIT"
] | null | null | null | #!/usr/bin/env python2
# -*- encoding: utf-8 -*-
# Gimp Markup Builder
# author: duangsuse
# date: Thu May 02 2019 CST
| 24.962085 | 106 | 0.584204 | #!/usr/bin/env python2
# -*- encoding: utf-8 -*-
# Gimp Markup Builder
# author: duangsuse
# date: Thu May 02 2019 CST
from os import linesep
from Util import stream_join
class MarkupBuilder:
''' Gimp Markup SGML builder '''
def __init__(self, indent = -1, nl = linesep, buffer = str):
self.marks = buffer()
... | 5,069 | 8 | 69 |
8796a12ade2e6974f6dfc98adc77e755604d7da8 | 895 | py | Python | sqlalchemy_redshift/__init__.py | Hivestack/sqlalchemy-redshift | 6226ffe4c6f3583606016492641e1bd5d351933a | [
"MIT"
] | null | null | null | sqlalchemy_redshift/__init__.py | Hivestack/sqlalchemy-redshift | 6226ffe4c6f3583606016492641e1bd5d351933a | [
"MIT"
] | null | null | null | sqlalchemy_redshift/__init__.py | Hivestack/sqlalchemy-redshift | 6226ffe4c6f3583606016492641e1bd5d351933a | [
"MIT"
] | null | null | null | from pkg_resources import DistributionNotFound, get_distribution, parse_version
try:
except ImportError:
raise ImportError(
'No module named psycopg2. Please install either '
'psycopg2 or psycopg2-binary package for CPython '
'or psycopg2cffi for Pypy.'
)
for package in ['psycopg2', 'p... | 31.964286 | 79 | 0.727374 | from pkg_resources import DistributionNotFound, get_distribution, parse_version
try:
import psycopg2 # noqa: F401
except ImportError:
raise ImportError(
'No module named psycopg2. Please install either '
'psycopg2 or psycopg2-binary package for CPython '
'or psycopg2cffi for Pypy.'
... | 0 | -6 | 40 |
fdbf1c941811766f3c215aa9700b09effe98e5e6 | 134 | py | Python | ch2/chapter2_features_of_fastapi_02.py | PacktPublishing/Understanding-How-Web-APIs-Work | 63220e7bf6b31315c46650e45c670ca9a01011fc | [
"MIT"
] | 2 | 2021-10-03T09:34:34.000Z | 2021-10-04T04:52:48.000Z | ch2/chapter2_features_of_fastapi_02.py | PacktPublishing/Understanding-How-Web-APIs-Work | 63220e7bf6b31315c46650e45c670ca9a01011fc | [
"MIT"
] | 1 | 2021-04-25T05:57:34.000Z | 2021-04-25T14:49:24.000Z | ch2/chapter2_features_of_fastapi_02.py | PacktPublishing/Understanding-How-Web-APIs-Work | 63220e7bf6b31315c46650e45c670ca9a01011fc | [
"MIT"
] | 3 | 2021-05-13T09:39:27.000Z | 2021-06-29T05:51:46.000Z | # -*- coding: utf-8 -*-
def message(age: int = 0, name: str = 'stranger') -> str:
return f'Hello {name}, you are {age} years old'
| 33.5 | 57 | 0.58209 | # -*- coding: utf-8 -*-
def message(age: int = 0, name: str = 'stranger') -> str:
return f'Hello {name}, you are {age} years old'
| 0 | 0 | 0 |
515654029ae48e70e4487c739d107ea440403f1d | 8,124 | py | Python | Lib/site-packages/hackedit/app/templates.py | fochoao/cpython | 3dc84b260e5bced65ebc2c45c40c8fa65f9b5aa9 | [
"bzip2-1.0.6",
"0BSD"
] | null | null | null | Lib/site-packages/hackedit/app/templates.py | fochoao/cpython | 3dc84b260e5bced65ebc2c45c40c8fa65f9b5aa9 | [
"bzip2-1.0.6",
"0BSD"
] | 20 | 2021-05-03T18:02:23.000Z | 2022-03-12T12:01:04.000Z | Lib/site-packages/hackedit/app/templates.py | fochoao/cpython | 3dc84b260e5bced65ebc2c45c40c8fa65f9b5aa9 | [
"bzip2-1.0.6",
"0BSD"
] | null | null | null | """
This module contains the top level API for managing the project/file templates.
"""
import json
import logging
import os
import re
from binaryornot.check import is_binary
from hackedit.app import settings
def create(template, dest_dir, answers):
"""
Creates a file/project from the specified template, at... | 31.126437 | 100 | 0.563269 | """
This module contains the top level API for managing the project/file templates.
"""
import json
import logging
import os
import re
from binaryornot.check import is_binary
from hackedit.app import settings
def create(template, dest_dir, answers):
"""
Creates a file/project from the specified template, at... | 0 | 0 | 0 |
1a60970d1a4cf3ecc7aacdd16b38eca549a34840 | 1,845 | py | Python | src/tubize/videotomp4.py | olivervinn/tubizescripts | 8756f322d3e31f76f8b77cb8e084ded5941e29fa | [
"MIT"
] | null | null | null | src/tubize/videotomp4.py | olivervinn/tubizescripts | 8756f322d3e31f76f8b77cb8e084ded5941e29fa | [
"MIT"
] | null | null | null | src/tubize/videotomp4.py | olivervinn/tubizescripts | 8756f322d3e31f76f8b77cb8e084ded5941e29fa | [
"MIT"
] | null | null | null | """
Convert video format x to MP4/H.264.
"""
import logging
logger = logging.getLogger(__name__)
| 32.368421 | 107 | 0.571816 | """
Convert video format x to MP4/H.264.
"""
import os
import sys
import logging
from .videometainfo import VideoMetaInfo
from .utils import sizeof_fmt, time_fmt, find_files, check_dependencies, call, ffmpeg
logger = logging.getLogger(__name__)
class VideoToMP4:
"""To Mp4"""
SUPPORTED_EXTENSIONS = ".wmv, .... | 1,573 | 60 | 113 |
8052d0446907259540de210ff2c92410c7342f2e | 117 | py | Python | setup.py | snasiriany/parasol | 88b99704676fb1253b8bc6402665a3174a00072d | [
"MIT"
] | 66 | 2019-01-07T23:59:26.000Z | 2021-12-29T16:51:56.000Z | setup.py | snasiriany/parasol | 88b99704676fb1253b8bc6402665a3174a00072d | [
"MIT"
] | 8 | 2019-01-09T01:35:54.000Z | 2021-08-23T20:05:03.000Z | setup.py | snasiriany/parasol | 88b99704676fb1253b8bc6402665a3174a00072d | [
"MIT"
] | 21 | 2019-03-26T01:02:33.000Z | 2022-01-26T20:34:34.000Z | from setuptools import setup
setup(
name='parasol',
dependency_links=[
],
install_requires=[
]
)
| 13 | 28 | 0.623932 | from setuptools import setup
setup(
name='parasol',
dependency_links=[
],
install_requires=[
]
)
| 0 | 0 | 0 |
79299c770a188b579e6412af89f2263960e65f50 | 568 | py | Python | app/migrations/0007_auto_20211102_1946.py | Rqwannn/Rudemy | fe2d84540f3cc64c0ff6821e5f2fac22675fd381 | [
"MIT"
] | 3 | 2021-12-27T06:16:26.000Z | 2022-01-20T02:13:03.000Z | app/migrations/0007_auto_20211102_1946.py | Rqwannn/Rudemy | fe2d84540f3cc64c0ff6821e5f2fac22675fd381 | [
"MIT"
] | null | null | null | app/migrations/0007_auto_20211102_1946.py | Rqwannn/Rudemy | fe2d84540f3cc64c0ff6821e5f2fac22675fd381 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.8 on 2021-11-02 12:46
| 21.846154 | 67 | 0.549296 | # Generated by Django 3.2.8 on 2021-11-02 12:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0006_auto_20211102_1928'),
]
operations = [
migrations.RemoveField(
model_name='profile',
name='skill',
... | 454 | 19 | 46 |
752ee840202809a32e9848a1a2c9a1828e74e71c | 5,132 | py | Python | oasislmf/model_execution/conf.py | ibailey-SCOR/OasisLMF | 966b4de4e1e64851970f4291c5bdfe7edc20cb7a | [
"BSD-3-Clause"
] | null | null | null | oasislmf/model_execution/conf.py | ibailey-SCOR/OasisLMF | 966b4de4e1e64851970f4291c5bdfe7edc20cb7a | [
"BSD-3-Clause"
] | null | null | null | oasislmf/model_execution/conf.py | ibailey-SCOR/OasisLMF | 966b4de4e1e64851970f4291c5bdfe7edc20cb7a | [
"BSD-3-Clause"
] | null | null | null | import csv
import io
import json
import logging
import os
import warnings
from collections import defaultdict
from ..utils.exceptions import OasisException
from ..utils.log import oasis_log
from .files import GENERAL_SETTINGS_FILE, GUL_SUMMARIES_FILE, IL_SUMMARIES_FILE, MODEL_SETTINGS_FILE
def _get_summaries(summar... | 36.657143 | 100 | 0.677319 | import csv
import io
import json
import logging
import os
import warnings
from collections import defaultdict
from ..utils.exceptions import OasisException
from ..utils.log import oasis_log
from .files import GENERAL_SETTINGS_FILE, GUL_SUMMARIES_FILE, IL_SUMMARIES_FILE, MODEL_SETTINGS_FILE
def _get_summaries(summar... | 0 | 0 | 0 |
cb8ea6149e57e707c1ee331f670e37c8feb61914 | 6,815 | py | Python | codes/functions.py | Wenupi/protoplanetary_disks | 51f8decbec5415e1da9893316f03d32ca5ab27de | [
"MIT"
] | null | null | null | codes/functions.py | Wenupi/protoplanetary_disks | 51f8decbec5415e1da9893316f03d32ca5ab27de | [
"MIT"
] | null | null | null | codes/functions.py | Wenupi/protoplanetary_disks | 51f8decbec5415e1da9893316f03d32ca5ab27de | [
"MIT"
] | null | null | null | #!/usr/bin/env python
#--------------------------------------------------------------------------------
#Changes the sky coordinates (x,y,z) to the disk coordinates (x_d,y_d,z_d)
#The x axis is the rotation axis
def FUN_rotation(x,y,z):
x_d = x
y_d = y*np.cos(inc) - z*np.sin(inc)
z_d = y*np.sin(inc) + ... | 43.685897 | 134 | 0.501981 | #!/usr/bin/env python
#--------------------------------------------------------------------------------
#Changes the sky coordinates (x,y,z) to the disk coordinates (x_d,y_d,z_d)
#The x axis is the rotation axis
def FUN_rotation(x,y,z):
x_d = x
y_d = y*np.cos(inc) - z*np.sin(inc)
z_d = y*np.sin(inc) + ... | 0 | 0 | 0 |
d281bf9d519356903906b4ce02f43f84e40f8147 | 2,893 | py | Python | F0AM_Tools/TUV_to_mat.py | jdhask/pyMCM | 32b65e1dff2e9626df5d52623fd1ac4af29f8c57 | [
"MIT"
] | 1 | 2021-11-15T19:24:40.000Z | 2021-11-15T19:24:40.000Z | F0AM_Tools/TUV_to_mat.py | jdhask/pyMCM | 32b65e1dff2e9626df5d52623fd1ac4af29f8c57 | [
"MIT"
] | null | null | null | F0AM_Tools/TUV_to_mat.py | jdhask/pyMCM | 32b65e1dff2e9626df5d52623fd1ac4af29f8c57 | [
"MIT"
] | 2 | 2021-11-15T19:23:46.000Z | 2021-11-29T12:42:26.000Z | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 16 18:06:05 2021
@author: jhask
"""
import csv
import pandas as pd
import numpy as np
import re
import scipy.io as sio
import os
# Map MCM names to TUV labels
j_vals_dict= dict({
'O3 -> O2 + O(1D)':'J1',
'O3 -> O2 + O(3P)':'J2',
'H2O2 -> 2 OH':'J3',... | 30.452632 | 105 | 0.5458 | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 16 18:06:05 2021
@author: jhask
"""
import csv
import pandas as pd
import numpy as np
import re
import scipy.io as sio
import os
# Map MCM names to TUV labels
j_vals_dict= dict({
'O3 -> O2 + O(1D)':'J1',
'O3 -> O2 + O(3P)':'J2',
'H2O2 -> 2 OH':'J3',... | 0 | 0 | 0 |
1d7b25e9a1db4f378a05b7199423917d7b5b9f81 | 1,343 | py | Python | extract_url.py | nickinack/extract_url | d084ca0a791d5c50ab2accaee7cb4d0b981bd132 | [
"MIT"
] | 2 | 2022-02-07T05:51:36.000Z | 2022-02-07T05:52:11.000Z | extract_url.py | nickinack/extract_url | d084ca0a791d5c50ab2accaee7cb4d0b981bd132 | [
"MIT"
] | null | null | null | extract_url.py | nickinack/extract_url | d084ca0a791d5c50ab2accaee7cb4d0b981bd132 | [
"MIT"
] | 1 | 2020-05-18T08:29:22.000Z | 2020-05-18T08:29:22.000Z | '''
Imports
'''
import sys as sys
import csv
from collections import defaultdict
import re
'''
URL Extract
'''
columns = defaultdict(list)
with open('SecurityIDRBT.csv') as f:
reader = csv.DictReader(f) # read rows into a dictionary format
for row in reader: # read a row as {column1: value1, column... | 29.844444 | 95 | 0.603127 | '''
Imports
'''
from config import *
from newspaper import Article
import sys as sys
import pandas as pd
import csv
from collections import defaultdict
import re
'''
URL Extract
'''
columns = defaultdict(list)
with open('SecurityIDRBT.csv') as f:
reader = csv.DictReader(f) # read rows into a diction... | 0 | 5 | 70 |
56b682792eb61ccb189ac68b9d7a874cbd6c0a60 | 3,279 | py | Python | test/python/test_mapper_coupling.py | kifumi/qiskit-terra | 203fca6d694a18824a6b12cbabd3dd2c64dd12ae | [
"Apache-2.0"
] | 1 | 2018-11-01T01:35:43.000Z | 2018-11-01T01:35:43.000Z | test/python/test_mapper_coupling.py | a-amaral/qiskit-terra | e73beba1e68de2617046a7e1e9eeac375b61de81 | [
"Apache-2.0"
] | null | null | null | test/python/test_mapper_coupling.py | a-amaral/qiskit-terra | e73beba1e68de2617046a7e1e9eeac375b61de81 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
# pylint: disable=missing-docstring
| 36.433333 | 88 | 0.633425 | # -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
# pylint: disable=missing-docstring
from qiskit.mapper import _coupling
from .common import QiskitTestCase
class Coupling... | 2,951 | 27 | 68 |
b9bba5bf54a9320d3bc8a8acd4f1c2d5d0aaa83f | 66,268 | py | Python | discretisedfield/tests/test_field.py | StephenPotato/discretisedfield | de49577b47acadd9372854252688194c348844a3 | [
"BSD-3-Clause"
] | 1 | 2021-03-13T09:43:52.000Z | 2021-03-13T09:43:52.000Z | discretisedfield/tests/test_field.py | StephenPotato/discretisedfield | de49577b47acadd9372854252688194c348844a3 | [
"BSD-3-Clause"
] | null | null | null | discretisedfield/tests/test_field.py | StephenPotato/discretisedfield | de49577b47acadd9372854252688194c348844a3 | [
"BSD-3-Clause"
] | null | null | null | import re
import types
import numbers
import numpy as np
import discretisedfield as df
def check_field(field):
assert isinstance(field.mesh, df.Mesh)
assert isinstance(field.dim, int)
assert field.dim > 0
assert isinstance(field.array, np.ndarray)
assert field.array.shape == (*field.mesh.n, fiel... | 33.621512 | 79 | 0.470333 | import os
import re
import k3d
import types
import random
import pytest
import numbers
import tempfile
import itertools
import numpy as np
import discretisedfield as df
import matplotlib.pyplot as plt
from .test_mesh import TestMesh
def check_field(field):
assert isinstance(field.mesh, df.Mesh)
assert isinst... | 62,657 | -30 | 199 |
d991aedad470b351e70cf5b10b085c74cc95e474 | 462 | py | Python | env/Lib/site-packages/values/__init__.py | KaceyHirth/Library-DBMS-System | 40b425ed5c7b46627b7c48724b2d20e7a64cf025 | [
"MIT"
] | 4 | 2022-02-06T00:54:58.000Z | 2022-02-25T12:44:43.000Z | env/Lib/site-packages/values/__init__.py | KaceyHirth/Library-DBMS-System | 40b425ed5c7b46627b7c48724b2d20e7a64cf025 | [
"MIT"
] | 3 | 2021-03-23T04:58:47.000Z | 2021-04-02T02:40:54.000Z | env/Lib/site-packages/values/__init__.py | KaceyHirth/Library-DBMS-System | 40b425ed5c7b46627b7c48724b2d20e7a64cf025 | [
"MIT"
] | 1 | 2022-02-08T13:43:20.000Z | 2022-02-08T13:43:20.000Z | __all__ = ['get']
import collections
def _iterable(obj):
return isinstance(obj, collections.Iterable)
def _string(value):
try:
return isinstance(value, basestring)
except NameError:
return isinstance(value, str)
def get(input):
"""return a list with input values or [] if input is... | 18.48 | 64 | 0.645022 | __all__ = ['get']
import collections
def _iterable(obj):
return isinstance(obj, collections.Iterable)
def _string(value):
try:
return isinstance(value, basestring)
except NameError:
return isinstance(value, str)
def get(input):
"""return a list with input values or [] if input is... | 0 | 0 | 0 |
d0e19b396bd5c3861e79601ace321dbbd96d9384 | 165 | py | Python | vnpy/app/strategy_reviewer/ui/__init__.py | xyh888/vnpy | 7b51716928ab9574f171a2eda190b37b4f393bb1 | [
"MIT"
] | 5 | 2019-05-24T05:19:55.000Z | 2020-07-29T13:21:49.000Z | vnpy/app/strategy_reviewer/ui/__init__.py | xyh888/vnpy | 7b51716928ab9574f171a2eda190b37b4f393bb1 | [
"MIT"
] | null | null | null | vnpy/app/strategy_reviewer/ui/__init__.py | xyh888/vnpy | 7b51716928ab9574f171a2eda190b37b4f393bb1 | [
"MIT"
] | 2 | 2019-07-01T02:14:04.000Z | 2020-07-29T13:21:53.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/8/20 0020 16:49
# @Author : Hadrianl
# @File : __init__.py | 23.571429 | 36 | 0.630303 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/8/20 0020 16:49
# @Author : Hadrianl
# @File : __init__.py
from .widget import StrategyReviewer | 0 | 15 | 23 |
4a04e22adafbd1373a9d9fc82325fd3d15005b8b | 647 | py | Python | Lesson 13.gf/xml_Leader2.py | gfoo003/programming-together | 225e0a2255dd8da1f1ef32d2a88deea27c050f10 | [
"MIT"
] | null | null | null | Lesson 13.gf/xml_Leader2.py | gfoo003/programming-together | 225e0a2255dd8da1f1ef32d2a88deea27c050f10 | [
"MIT"
] | null | null | null | Lesson 13.gf/xml_Leader2.py | gfoo003/programming-together | 225e0a2255dd8da1f1ef32d2a88deea27c050f10 | [
"MIT"
] | null | null | null | import xml.etree.ElementTree as ET
xml_string = '''
<stuff>
<users>
<user x = "2">
<id>001</id>
<name>Chuck</name>
</user>
<user x = "7">
<id>007</id>
<name>Brent</name>
</user>
</users>
</stuff>
'''
root_stuff = ET.fromstring(xml... | 23.107143 | 48 | 0.565688 | import xml.etree.ElementTree as ET
xml_string = '''
<stuff>
<users>
<user x = "2">
<id>001</id>
<name>Chuck</name>
</user>
<user x = "7">
<id>007</id>
<name>Brent</name>
</user>
</users>
</stuff>
'''
root_stuff = ET.fromstring(xml... | 0 | 0 | 0 |
bebc974c59298f013c68b5d5e434ba4b2d82a0a8 | 213 | py | Python | 第4章/program/Chapter_4_dummy.py | kingname/SourceCodeOfBook | ab7275108994dca564905818b678bbd2f771c18e | [
"MIT"
] | 274 | 2018-10-01T11:07:25.000Z | 2022-03-17T13:48:45.000Z | 第4章/program/Chapter_4_dummy.py | kingname/SourceCodeOfBook | ab7275108994dca564905818b678bbd2f771c18e | [
"MIT"
] | 6 | 2019-02-28T14:18:21.000Z | 2022-03-02T14:57:39.000Z | 第4章/program/Chapter_4_dummy.py | kingname/SourceCodeOfBook | ab7275108994dca564905818b678bbd2f771c18e | [
"MIT"
] | 110 | 2018-10-16T06:08:37.000Z | 2022-03-16T08:19:29.000Z | from multiprocessing.dummy import Pool
def calc_power2(num):
return num * num
pool = Pool(3)
origin_num = [x for x in range(10)]
result = pool.map(calc_power2, origin_num)
print(f'计算1-10的平方分别为:{result}')
| 16.384615 | 42 | 0.71831 | from multiprocessing.dummy import Pool
def calc_power2(num):
return num * num
pool = Pool(3)
origin_num = [x for x in range(10)]
result = pool.map(calc_power2, origin_num)
print(f'计算1-10的平方分别为:{result}')
| 0 | 0 | 0 |
cee8341ee37a27bddc6bb669594ab3c522880752 | 11,688 | py | Python | pystiche_papers/li_wand_2016/_loss.py | pystiche/papers | 0d8179dc51f6eda0b27fa525dc0b86b866bc88e1 | [
"BSD-3-Clause"
] | 1 | 2021-09-30T09:30:07.000Z | 2021-09-30T09:30:07.000Z | pystiche_papers/li_wand_2016/_loss.py | pystiche/papers | 0d8179dc51f6eda0b27fa525dc0b86b866bc88e1 | [
"BSD-3-Clause"
] | 20 | 2021-10-10T13:37:25.000Z | 2022-03-31T07:31:45.000Z | pystiche_papers/li_wand_2016/_loss.py | pystiche/papers | 0d8179dc51f6eda0b27fa525dc0b86b866bc88e1 | [
"BSD-3-Clause"
] | null | null | null | from typing import Optional
from pystiche import enc, loss
from pystiche_papers.utils import HyperParameters
from ._utils import (hyper_parameters as _hyper_parameters, multi_layer_encoder as _multi_layer_encoder, target_transforms as _target_transforms)
__all__ = [
"FeatureReconstructionLoss",
"content_loss"... | 37.461538 | 110 | 0.693703 | from typing import Any, Optional, Tuple, Union
import torch
from torch.nn.functional import mse_loss
import pystiche
import pystiche.loss.functional as F
from pystiche import enc, loss
from pystiche_papers.utils import HyperParameters
from ._utils import (
extract_normalized_patches2d,
hyper_parameters as _h... | 5,385 | 87 | 159 |
1b3186c99a60818dc9d24b438538877520aa1347 | 2,640 | py | Python | tests/conftest.py | Z2PackDev/bands_inspect | 76fdb0130d9ff64c738365a1911bc61f035927f2 | [
"Apache-2.0"
] | 1 | 2017-12-19T07:21:56.000Z | 2017-12-19T07:21:56.000Z | tests/conftest.py | Z2PackDev/bands-inspect | 76fdb0130d9ff64c738365a1911bc61f035927f2 | [
"Apache-2.0"
] | 3 | 2018-02-27T09:07:46.000Z | 2018-03-06T12:26:04.000Z | tests/conftest.py | Z2PackDev/bands_inspect | 76fdb0130d9ff64c738365a1911bc61f035927f2 | [
"Apache-2.0"
] | 1 | 2017-12-19T07:21:55.000Z | 2017-12-19T07:21:55.000Z | # -*- coding: utf-8 -*-
# (c) 2017-2019, ETH Zurich, Institut fuer Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
"""
Configuration file for the pytest tests.
"""
import os
import json
import pytest
import numpy as np
import bands_inspect as bi
import parameters # pylint: disable=wrong-import-order... | 30.697674 | 168 | 0.659848 | # -*- coding: utf-8 -*-
# (c) 2017-2019, ETH Zurich, Institut fuer Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
"""
Configuration file for the pytest tests.
"""
import os
import json
import pytest
import numpy as np
import bands_inspect as bi
import parameters # pylint: disable=wrong-import-order... | 0 | 0 | 0 |
a365ad738e2f0d42460bbe15195bfcc181ad7c09 | 3,518 | py | Python | src/tensorrt/tools/caffe_engine/call_engine_to_infer_all.py | aimuch/AIEnvConfig | 4ccd54e9c601e8c91efebcec1a50115d75d0cf96 | [
"MIT"
] | 250 | 2019-06-14T16:12:20.000Z | 2022-03-27T09:56:26.000Z | src/tensorrt/tools/caffe_engine/call_engine_to_infer_all.py | aimuch/AIEnvConfig | 4ccd54e9c601e8c91efebcec1a50115d75d0cf96 | [
"MIT"
] | 6 | 2018-08-10T07:15:39.000Z | 2018-10-23T01:51:17.000Z | src/tensorrt/tools/caffe_engine/call_engine_to_infer_all.py | aimuch/AIEnvConfig | 4ccd54e9c601e8c91efebcec1a50115d75d0cf96 | [
"MIT"
] | 41 | 2019-08-16T13:42:13.000Z | 2022-02-23T03:38:09.000Z | import os
# import tensorflow as tf
import tensorrt as trt
import pycuda.driver as cuda
# import uff
import cv2
import numpy as np
from tqdm import tqdm
TEST_PATH = "/media/andy/Data/DevWorkSpace/Projects/imageClassifier/data/test/"
LABEL = 0
ENGINE_PATH = "/home/andy/caffe/examples/mydata/slot_classifier/engine/px2... | 30.327586 | 105 | 0.677658 | import os
# import tensorflow as tf
import tensorrt as trt
from tensorrt.parsers import uffparser
import pycuda.driver as cuda
# import uff
import cv2
import numpy as np
from tqdm import tqdm
TEST_PATH = "/media/andy/Data/DevWorkSpace/Projects/imageClassifier/data/test/"
LABEL = 0
ENGINE_PATH = "/home/andy/caffe/exa... | 0 | 17 | 22 |
3db8ec872b628c2d5573b83d71f828295df1aa7e | 2,054 | py | Python | machineLearning.py | z-Wind/EQOptimum | c046daec2c6218277a3fec9fa0c87bea0b30ff2f | [
"MIT"
] | null | null | null | machineLearning.py | z-Wind/EQOptimum | c046daec2c6218277a3fec9fa0c87bea0b30ff2f | [
"MIT"
] | null | null | null | machineLearning.py | z-Wind/EQOptimum | c046daec2c6218277a3fec9fa0c87bea0b30ff2f | [
"MIT"
] | null | null | null | import filters
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import freqz
from sklearn.neural_network import MLPRegressor
def filterModel(x):
# [fc, bandwidth, gain]
w_final = None
db_final = 0
fs = 44100
for fc, BW, gain in x:
b, a = filters.bandpass_... | 27.026316 | 82 | 0.556962 | import filters
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import freqz
from sklearn.neural_network import MLPRegressor
def filterModel(x):
# [fc, bandwidth, gain]
w_final = None
db_final = 0
fs = 44100
for fc, BW, gain in x:
b, a = filters.bandpass_... | 0 | 0 | 0 |
6f7dc504b463999eb2e9b24300c31ee083334da5 | 980 | py | Python | src/utils/dist.py | shaoeric/torch-atom | 7688fc38c0d19fe4d13a9773115df911ffe6eaaa | [
"MIT"
] | 28 | 2022-03-06T06:04:54.000Z | 2022-03-27T04:14:33.000Z | src/utils/dist.py | shaoeric/torch-atom | 7688fc38c0d19fe4d13a9773115df911ffe6eaaa | [
"MIT"
] | null | null | null | src/utils/dist.py | shaoeric/torch-atom | 7688fc38c0d19fe4d13a9773115df911ffe6eaaa | [
"MIT"
] | 3 | 2022-03-11T07:01:58.000Z | 2022-03-17T05:34:41.000Z | import torch.distributed as dist
import torch
def get_world_size():
if not dist.is_available():
return 1
if not dist.is_initialized():
return 1
return dist.get_world_size()
def get_rank():
if not dist.is_available():
return 0
if not dist.is_initialized():
return 0
... | 22.790698 | 72 | 0.626531 | import torch.distributed as dist
import torch
def get_world_size():
if not dist.is_available():
return 1
if not dist.is_initialized():
return 1
return dist.get_world_size()
def get_rank():
if not dist.is_available():
return 0
if not dist.is_initialized():
return 0
... | 0 | 0 | 0 |
7d4f4e96803718430d878ca088bcaed92b3079cc | 3,822 | py | Python | base_pool/mysql_pool/mysql_views.py | zhanzhangwei/kafka-study | 6be4167319b855c9560e92932aae628f87a5e680 | [
"Apache-2.0"
] | null | null | null | base_pool/mysql_pool/mysql_views.py | zhanzhangwei/kafka-study | 6be4167319b855c9560e92932aae628f87a5e680 | [
"Apache-2.0"
] | null | null | null | base_pool/mysql_pool/mysql_views.py | zhanzhangwei/kafka-study | 6be4167319b855c9560e92932aae628f87a5e680 | [
"Apache-2.0"
] | null | null | null | import pymysql
mysql_client = MysqlClient()
| 30.576 | 113 | 0.545526 | import json
import pymysql
import datetime
from dbutils.pooled_db import PooledDB
import pymysql
from conf.common import *
class MysqlClient(object):
__pool = None
def __init__(self):
"""
:param mincached:连接池中空闲连接的初始数量
:param maxcached:连接池中空闲连接的最大数量
:param maxshared:共享连接的最大数... | 3,971 | -2 | 134 |
fbbdf9d38ba25ab279b3c1a4de1e0e092ad03325 | 8,998 | py | Python | scripts/jupyter_vdi.py | ScottWales/cosima-cookbook | 0ed83e2165efe5badfca59e2dccf835ab7acecca | [
"Apache-2.0"
] | null | null | null | scripts/jupyter_vdi.py | ScottWales/cosima-cookbook | 0ed83e2165efe5badfca59e2dccf835ab7acecca | [
"Apache-2.0"
] | null | null | null | scripts/jupyter_vdi.py | ScottWales/cosima-cookbook | 0ed83e2165efe5badfca59e2dccf835ab7acecca | [
"Apache-2.0"
] | 1 | 2020-01-30T05:36:08.000Z | 2020-01-30T05:36:08.000Z | #!/usr/bin/env python
"""
Script to launch a VDI session (or connect to already running session)
and start a Jupyter server on the VDI
A ssh tunnel from the local machine to the VDI is set up and the local
webbrowser is spawned.
This is a python3 script (uses unicode strings). If you don't have
python3 on your local... | 33.574627 | 146 | 0.629362 | #!/usr/bin/env python
"""
Script to launch a VDI session (or connect to already running session)
and start a Jupyter server on the VDI
A ssh tunnel from the local machine to the VDI is set up and the local
webbrowser is spawned.
This is a python3 script (uses unicode strings). If you don't have
python3 on your local... | 0 | 0 | 0 |
1fa6873ff966dcc647833979508b75f9d44bd7bd | 2,703 | py | Python | utils/data.py | YOUSIKI/PyTorch-FBS | 5e94c3183f064ef5ed7f4b7d82b076056200b368 | [
"Apache-2.0"
] | 10 | 2020-09-14T02:40:37.000Z | 2022-01-13T11:13:36.000Z | utils/data.py | YOUSIKI/PyTorch-FBS | 5e94c3183f064ef5ed7f4b7d82b076056200b368 | [
"Apache-2.0"
] | 2 | 2020-11-28T05:48:45.000Z | 2022-03-11T13:44:50.000Z | utils/data.py | YOUSIKI/PyTorch-FBS | 5e94c3183f064ef5ed7f4b7d82b076056200b368 | [
"Apache-2.0"
] | 2 | 2020-11-28T02:27:08.000Z | 2021-11-24T03:10:10.000Z | # -*- coding=utf-8 -*-
__all__ = [
'tiny_imagenet',
'imagewoof2',
'imagenette2'
]
import os
import torch
import torchvision
_default_batch_size = 32
_default_num_workers = 4
def _transform(train=True):
mean = [0.485, 0.456, 0.406]
std = [0.229, 0.224, 0.225]
if train:
return torchvi... | 34.653846 | 69 | 0.532741 | # -*- coding=utf-8 -*-
__all__ = [
'tiny_imagenet',
'imagewoof2',
'imagenette2'
]
import os
import torch
import torchvision
_default_batch_size = 32
_default_num_workers = 4
def _transform(train=True):
mean = [0.485, 0.456, 0.406]
std = [0.229, 0.224, 0.225]
if train:
return torchvi... | 0 | 0 | 0 |
838d22d0dea3f0cea788de6ba72e416ad4ef2add | 1,917 | py | Python | tests/e2e/runner.py | wilzbach/storyscript-sls | d71d74a53852ebae54bdaab341678b04f2775411 | [
"Apache-2.0"
] | null | null | null | tests/e2e/runner.py | wilzbach/storyscript-sls | d71d74a53852ebae54bdaab341678b04f2775411 | [
"Apache-2.0"
] | null | null | null | tests/e2e/runner.py | wilzbach/storyscript-sls | d71d74a53852ebae54bdaab341678b04f2775411 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env pytest
import io
import json
from os import path
from pytest import fixture, mark
from sls import App
import storyscript.hub.Hub as StoryHub
from storyhub.sdk.AutoUpdateThread import AutoUpdateThread
from tests.e2e.utils.features import parse_options
from tests.e2e.utils.fixtures import find_test_fi... | 28.191176 | 77 | 0.720396 | #!/usr/bin/env pytest
import io
import json
from os import path
from pytest import fixture, mark
from sls import App
import storyscript.hub.Hub as StoryHub
from storyhub.sdk.AutoUpdateThread import AutoUpdateThread
from tests.e2e.utils.features import parse_options
from tests.e2e.utils.fixtures import find_test_fi... | 0 | 0 | 0 |
a028f9eab21f99b975a3ac640714e3b636189bcc | 342 | py | Python | Misc/Become_a_Python_Developer/2_Programming Fundamentals in the Real World/Ex_Files_Programming_Realworld/Exercise Files/Ch05/05_03/start_05_03_coordinates.py | specter01wj/LAB-Lynda | 1915ada66f4498cdf15a0e2a068c938e325e9ba3 | [
"MIT"
] | null | null | null | Misc/Become_a_Python_Developer/2_Programming Fundamentals in the Real World/Ex_Files_Programming_Realworld/Exercise Files/Ch05/05_03/start_05_03_coordinates.py | specter01wj/LAB-Lynda | 1915ada66f4498cdf15a0e2a068c938e325e9ba3 | [
"MIT"
] | 8 | 2020-07-08T06:20:03.000Z | 2022-03-02T10:05:06.000Z | Misc/Become_a_Python_Developer/2_Programming Fundamentals in the Real World/Ex_Files_Programming_Realworld/Exercise Files/Ch05/05_03/start_05_03_coordinates.py | specter01wj/LAB-Lynda | 1915ada66f4498cdf15a0e2a068c938e325e9ba3 | [
"MIT"
] | null | null | null | """ Where's My Mouse? """
import tkinter
def mouse_click(event):
# retrieve XY coords as a tuple
coords = root.winfo_pointerxy()
print('coords: {}'.format(coords))
print('X: {}'.format(coords[0]))
print('Y: {}'.format(coords[1]))
root = tkinter.Tk()
root.bind('<Button>', mouse_cli... | 22.8 | 39 | 0.599415 | """ Where's My Mouse? """
import tkinter
def mouse_click(event):
# retrieve XY coords as a tuple
coords = root.winfo_pointerxy()
print('coords: {}'.format(coords))
print('X: {}'.format(coords[0]))
print('Y: {}'.format(coords[1]))
root = tkinter.Tk()
root.bind('<Button>', mouse_cli... | 0 | 0 | 0 |
b485f685ca90029c0dd0acd04f32bc0b55820f14 | 2,906 | py | Python | examples/fsm/bot/middleware.py | ExpressApp/pybotx | 97c8b1ce5d45a05567ed01d545cb43174a2dcbb9 | [
"MIT"
] | 13 | 2021-01-21T12:43:10.000Z | 2022-03-23T11:11:59.000Z | examples/fsm/bot/middleware.py | ExpressApp/pybotx | 97c8b1ce5d45a05567ed01d545cb43174a2dcbb9 | [
"MIT"
] | 259 | 2020-02-26T08:51:03.000Z | 2022-03-23T11:08:36.000Z | examples/fsm/bot/middleware.py | ExpressApp/pybotx | 97c8b1ce5d45a05567ed01d545cb43174a2dcbb9 | [
"MIT"
] | 5 | 2019-12-02T16:19:22.000Z | 2021-11-22T20:33:34.000Z | from dataclasses import dataclass
from enum import Enum
from typing import Final, Optional
from botx import Message
_default_transition: Final = object()
@dataclass
def change_state(message: Message, new_state: Optional[Enum]) -> None:
message.bot.state.fsm_state[(message.user_huid, message.group_chat_id)] ... | 32.651685 | 87 | 0.639023 | from dataclasses import dataclass
from enum import Enum
from typing import Callable, Dict, Final, Optional, Type, Union
from botx import Bot, Collector, Message
from botx.concurrency import callable_to_coroutine
from botx.middlewares.base import BaseMiddleware
from botx.typing import Executor
_default_transition: Fin... | 2,304 | 112 | 157 |
42f3981074dbd8b6458eb716c4608442ffca1db6 | 6,411 | py | Python | webenmr/lib/convrdc.py | andreagia/WEBNMR | 512a8cc04cf69300796585feae722614501389a9 | [
"Apache-2.0"
] | null | null | null | webenmr/lib/convrdc.py | andreagia/WEBNMR | 512a8cc04cf69300796585feae722614501389a9 | [
"Apache-2.0"
] | null | null | null | webenmr/lib/convrdc.py | andreagia/WEBNMR | 512a8cc04cf69300796585feae722614501389a9 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
'''
This program attempts to convert XPLOR Pseudocontact shift restraints in AMBER format
XPLOR:
assign ( resid 200 and name OO ) ( resid 200 and name Z ) ( resid 200 and name X ) (resid 200 and name Y ) ( resid 13 and name C ) 0.2400 0.2000
assign ( resid 200 and name OO ) ( resid 200 ... | 31.426471 | 154 | 0.511777 | #!/usr/bin/env python
'''
This program attempts to convert XPLOR Pseudocontact shift restraints in AMBER format
XPLOR:
assign ( resid 200 and name OO ) ( resid 200 and name Z ) ( resid 200 and name X ) (resid 200 and name Y ) ( resid 13 and name C ) 0.2400 0.2000
assign ( resid 200 and name OO ) ( resid 200 ... | 0 | 3 | 22 |
1441c3ed71c2dc67d784d782e0dab2d91d827d06 | 2,134 | py | Python | lptrack/versions.py | gieseladev/lptrack | fb4c64021c23522f96733db41ceb69f0ccb9b713 | [
"MIT"
] | null | null | null | lptrack/versions.py | gieseladev/lptrack | fb4c64021c23522f96733db41ceb69f0ccb9b713 | [
"MIT"
] | null | null | null | lptrack/versions.py | gieseladev/lptrack | fb4c64021c23522f96733db41ceb69f0ccb9b713 | [
"MIT"
] | null | null | null | """Versioned body readers and writers for track message bodies.
Attributes:
LATEST_VERSION (int): Latest version supported by the library.
"""
from typing import Callable, Tuple
from . import TrackInfo, codec
LATEST_VERSION = 2
def _read_body_v1_2(stream: codec.Reader, version: int) -> TrackInfo:
return T... | 25.404762 | 83 | 0.698219 | """Versioned body readers and writers for track message bodies.
Attributes:
LATEST_VERSION (int): Latest version supported by the library.
"""
from typing import Callable, Tuple
from . import TrackInfo, codec
LATEST_VERSION = 2
def _read_body_v1_2(stream: codec.Reader, version: int) -> TrackInfo:
return T... | 0 | 0 | 0 |
45b20d04060d1b766f35010e3ce9fedfd6a34eba | 96 | py | Python | venv/lib/python3.8/site-packages/poetry/core/toml/__init__.py | Retraces/UkraineBot | 3d5d7f8aaa58fa0cb8b98733b8808e5dfbdb8b71 | [
"MIT"
] | 2 | 2022-03-13T01:58:52.000Z | 2022-03-31T06:07:54.000Z | venv/lib/python3.8/site-packages/poetry/core/toml/__init__.py | DesmoSearch/Desmobot | b70b45df3485351f471080deb5c785c4bc5c4beb | [
"MIT"
] | 19 | 2021-11-20T04:09:18.000Z | 2022-03-23T15:05:55.000Z | venv/lib/python3.8/site-packages/poetry/core/toml/__init__.py | DesmoSearch/Desmobot | b70b45df3485351f471080deb5c785c4bc5c4beb | [
"MIT"
] | null | null | null | /home/runner/.cache/pip/pool/f3/de/85/7dca1e096a43e00e6ff1ca900dda1ca91c8c5c3a1d6798e466a9173a00 | 96 | 96 | 0.895833 | /home/runner/.cache/pip/pool/f3/de/85/7dca1e096a43e00e6ff1ca900dda1ca91c8c5c3a1d6798e466a9173a00 | 0 | 0 | 0 |
4053282fdcb4c61c6094cfb3f6a832822c2a096c | 2,371 | py | Python | venv/lib/python2.7/site-packages/cement/ext/ext_alarm.py | zwachtel11/fruitful-backend | 45b8994917182e7b684b9e25944cc79c9494c9f3 | [
"MIT"
] | 95 | 2018-06-05T10:49:32.000Z | 2019-12-31T11:07:36.000Z | v_env/lib/python3.7/site-packages/cement/ext/ext_alarm.py | buds-lab/expanded-psychrometric-chart | e7267f57584d8ba645507189ea4a8e474c67e0de | [
"MIT"
] | 51 | 2019-10-08T01:53:02.000Z | 2021-06-04T22:02:21.000Z | v_env/lib/python3.7/site-packages/cement/ext/ext_alarm.py | buds-lab/expanded-psychrometric-chart | e7267f57584d8ba645507189ea4a8e474c67e0de | [
"MIT"
] | 29 | 2018-09-17T06:10:32.000Z | 2022-03-19T13:15:30.000Z | """
The Alarm Extension provides easy access to setting an application alarm to
handle timing out operations. See the
`Python Signal Library <https://docs.python.org/3.5/library/signal.html>`_.
Requirements
------------
* No external dependencies.
* Only available on Unix/Linux
Configuration
-------------
This ... | 22.158879 | 75 | 0.619148 | """
The Alarm Extension provides easy access to setting an application alarm to
handle timing out operations. See the
`Python Signal Library <https://docs.python.org/3.5/library/signal.html>`_.
Requirements
------------
* No external dependencies.
* Only available on Unix/Linux
Configuration
-------------
This ... | 853 | 0 | 23 |
c4fb2fe7e75e47425721a49f845719bb9e6c655f | 1,634 | py | Python | tests/test_highiq.py | ClariNerd617/HighIQ | 0305902f889da869535834620bb4fb15ac54b11d | [
"BSD-3-Clause"
] | 6 | 2020-03-16T14:14:45.000Z | 2021-09-21T06:39:57.000Z | tests/test_highiq.py | ClariNerd617/HighIQ | 0305902f889da869535834620bb4fb15ac54b11d | [
"BSD-3-Clause"
] | null | null | null | tests/test_highiq.py | ClariNerd617/HighIQ | 0305902f889da869535834620bb4fb15ac54b11d | [
"BSD-3-Clause"
] | 3 | 2019-12-16T19:56:35.000Z | 2021-06-09T14:14:47.000Z | import highiq
import numpy as np
def test_io():
my_ds = highiq.io.load_arm_netcdf(highiq.testing.TEST_FILE)
assert 'acf' in my_ds.variables.keys()
assert 'acf_bkg' in my_ds.variables.keys()
my_ds.close()
def test_spectra():
my_ds = highiq.io.load_arm_netcdf(highiq.testing.TEST_FILE)
my_spect... | 32.68 | 77 | 0.719706 | import highiq
import numpy as np
def test_io():
my_ds = highiq.io.load_arm_netcdf(highiq.testing.TEST_FILE)
assert 'acf' in my_ds.variables.keys()
assert 'acf_bkg' in my_ds.variables.keys()
my_ds.close()
def test_spectra():
my_ds = highiq.io.load_arm_netcdf(highiq.testing.TEST_FILE)
my_spect... | 0 | 0 | 0 |
77ab3b36a849175fa4c24f12a76941077ea58584 | 570 | py | Python | scripts/docker/migrate.py | guligon90/uac-registry | cb5afe941919c2d9ceffa8d8bf220613b7a20613 | [
"MIT"
] | null | null | null | scripts/docker/migrate.py | guligon90/uac-registry | cb5afe941919c2d9ceffa8d8bf220613b7a20613 | [
"MIT"
] | null | null | null | scripts/docker/migrate.py | guligon90/uac-registry | cb5afe941919c2d9ceffa8d8bf220613b7a20613 | [
"MIT"
] | null | null | null | # Base imports
from typing import Iterable, Optional
# Project imports
from docker import common
from docker.run import run
def migrate(arguments: Iterable[str], deps: Optional[bool] = True) -> int:
print(">>>>>>>>>> Running database migration <<<<<<<<<<")
run(['backend', 'python3', common.MANAGE_PY, 'migrat... | 31.666667 | 82 | 0.670175 | # Base imports
import subprocess
from typing import Iterable, Optional
# Project imports
from docker import common
from docker.run import run
def migrate(arguments: Iterable[str], deps: Optional[bool] = True) -> int:
print(">>>>>>>>>> Running database migration <<<<<<<<<<")
run(['backend', 'python3', common.... | 0 | -4 | 22 |
f979d82751598eba221d7677df764b4451b8c896 | 971 | py | Python | adw_test/make_small_dataset.py | clinfo/DeepKF | ee4f1be28e5f3bfa46bb47dbdc4d5f678eed36c1 | [
"MIT"
] | 5 | 2019-12-19T13:33:36.000Z | 2021-06-01T06:08:16.000Z | adw_test/make_small_dataset.py | clinfo/DeepKF | ee4f1be28e5f3bfa46bb47dbdc4d5f678eed36c1 | [
"MIT"
] | 24 | 2020-03-03T19:40:55.000Z | 2021-05-26T15:27:38.000Z | adw_test/make_small_dataset.py | clinfo/DeepKF | ee4f1be28e5f3bfa46bb47dbdc4d5f678eed36c1 | [
"MIT"
] | 1 | 2019-12-19T13:35:07.000Z | 2019-12-19T13:35:07.000Z | import json
import glob
import numpy as np
import os
path = "data_state_space_v3/"
out_path = "small_data/"
files = glob.glob(path + "*.npy") # ワイルドカードが使用可能
train_data_num = 100
test_data_num = 10
train_data = {}
test_data = {}
for filename in files:
obj = np.load(filename)
if filename.find("_test.npy") >= 0:... | 26.243243 | 62 | 0.669413 | import json
import glob
import numpy as np
import os
path = "data_state_space_v3/"
out_path = "small_data/"
files = glob.glob(path + "*.npy") # ワイルドカードが使用可能
train_data_num = 100
test_data_num = 10
train_data = {}
test_data = {}
for filename in files:
obj = np.load(filename)
if filename.find("_test.npy") >= 0:... | 0 | 0 | 0 |
991fa516fb5524187777ee16359f8b1f0cb6ad59 | 859 | py | Python | 3M/W9/7.py | allenalvin333/Hackerrank_Prep | 26ed5b874daba4775d006824d36f9e82ea5ff1ea | [
"MIT"
] | 2 | 2021-11-25T13:38:36.000Z | 2021-11-25T13:42:56.000Z | 3M/W9/7.py | allenalvin333/Hackerrank_Prep | 26ed5b874daba4775d006824d36f9e82ea5ff1ea | [
"MIT"
] | null | null | null | 3M/W9/7.py | allenalvin333/Hackerrank_Prep | 26ed5b874daba4775d006824d36f9e82ea5ff1ea | [
"MIT"
] | 1 | 2021-11-25T13:38:43.000Z | 2021-11-25T13:38:43.000Z | # https://www.hackerrank.com/challenges/three-month-preparation-kit-maxsubarray/problem
#!/bin/python3
import os
#
# Complete the 'maxSubarray' function below.
#
# The function is expected to return an INTEGER_ARRAY.
# The function accepts INTEGER_ARRAY arr as parameter.
#
def maxSubarray(arr):
p = max(0,arr[0])... | 21.475 | 87 | 0.615832 | # https://www.hackerrank.com/challenges/three-month-preparation-kit-maxsubarray/problem
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'maxSubarray' function below.
#
# The function is expected to return an INTEGER_ARRAY.
# The function accepts INTEGER_ARRAY arr as parameter... | 0 | -41 | 89 |
be789e67d9aef4a43064ec6b0aac240e98f4e74f | 4,286 | py | Python | hep_cnn/tensorrt/convert_tensorrt_tf_integrated.py | NERSC/inference_benchmarks | e51453a755aaece91f7e08e92453a4050722071a | [
"BSD-3-Clause"
] | 1 | 2019-08-29T03:33:58.000Z | 2019-08-29T03:33:58.000Z | hep_cnn/tensorrt/convert_tensorrt_tf_integrated.py | NERSC/inference_benchmarks | e51453a755aaece91f7e08e92453a4050722071a | [
"BSD-3-Clause"
] | null | null | null | hep_cnn/tensorrt/convert_tensorrt_tf_integrated.py | NERSC/inference_benchmarks | e51453a755aaece91f7e08e92453a4050722071a | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import tensorflow.contrib.tensorrt as trt
import numpy as np
from tensorflow.python.platform import gfile
import argparse, sys
tf.logging.set_verbosity(tf.logging.INFO)
import os
def ... | 41.61165 | 168 | 0.704153 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.python.ops import data_flow_ops
import tensorflow.contrib.tensorrt as trt
import numpy as np
import time
from tensorflow.python.platform import gfile
from tensorflow.pyt... | 0 | 48 | 111 |
745b720c7aee2c3450c7326ecfc4595bc580fc48 | 1,812 | py | Python | SSD1306.py | krandor/weather_station | 06a0c88d92893a95aaabd5bbc2892a99ae4be8e1 | [
"MIT"
] | null | null | null | SSD1306.py | krandor/weather_station | 06a0c88d92893a95aaabd5bbc2892a99ae4be8e1 | [
"MIT"
] | null | null | null | SSD1306.py | krandor/weather_station | 06a0c88d92893a95aaabd5bbc2892a99ae4be8e1 | [
"MIT"
] | null | null | null |
# I2C ADDRESS / BITS
SSD1306_ADDRESS = 0x3C
| 27.876923 | 89 | 0.631898 | import Adafruit_SSD1306
import Image
import ImageDraw
import ImageFont
# I2C ADDRESS / BITS
SSD1306_ADDRESS = 0x3C
class Ssd1306(object):
_display = None
_draw = None
_image = None
_font = None
_height = 0
_width = 0
def __init__(self, i2c_bus = 0, ssd1306_rst = "22"):
"""
... | 1,672 | -17 | 111 |
9235c6c3f07aa312f105c296304b0e62256a9961 | 260 | py | Python | sandbox/flask/multi_page_form/compute.py | carlosal1015/proofofconcept | 579873aff082e6fa497a387e0d0a5f8e5ec3ecd2 | [
"CC-BY-4.0"
] | 14 | 2015-01-02T19:39:36.000Z | 2022-03-09T06:08:10.000Z | sandbox/flask/multi_page_form/compute.py | carlosal1015/proofofconcept | 579873aff082e6fa497a387e0d0a5f8e5ec3ecd2 | [
"CC-BY-4.0"
] | 242 | 2015-01-02T13:59:58.000Z | 2022-03-27T17:22:21.000Z | sandbox/flask/multi_page_form/compute.py | carlosal1015/proofofconcept | 579873aff082e6fa497a387e0d0a5f8e5ec3ecd2 | [
"CC-BY-4.0"
] | 6 | 2015-02-13T16:00:25.000Z | 2020-08-05T17:51:26.000Z |
def arg_count(inference_rule):
# these should be determined based on string match in CSV file
num_input=2
num_feed=1
num_output=1
return num_input,num_feed,num_output
if __name__ == '__main__':
print compute(1, 0.1) # default values
| 21.666667 | 66 | 0.711538 |
def arg_count(inference_rule):
# these should be determined based on string match in CSV file
num_input=2
num_feed=1
num_output=1
return num_input,num_feed,num_output
if __name__ == '__main__':
print compute(1, 0.1) # default values
| 0 | 0 | 0 |
53fad1f9197d87945dd3f90bc49bebbc3ce82648 | 6,042 | py | Python | nevergrad/functions/corefuncs.py | se4u/nevergrad | 38924bc7b0bff834316ccf974922db2c22be1606 | [
"MIT"
] | 1 | 2021-04-21T09:19:44.000Z | 2021-04-21T09:19:44.000Z | nevergrad/functions/corefuncs.py | se4u/nevergrad | 38924bc7b0bff834316ccf974922db2c22be1606 | [
"MIT"
] | null | null | null | nevergrad/functions/corefuncs.py | se4u/nevergrad | 38924bc7b0bff834316ccf974922db2c22be1606 | [
"MIT"
] | 1 | 2019-12-12T10:36:54.000Z | 2019-12-12T10:36:54.000Z | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
from ..optimization import discretization
from ..common.decorators import Registry
registry = Regist... | 26.269565 | 94 | 0.677756 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
from ..optimization import discretization
from ..common.decorators import Registry
registry = Regist... | 0 | 0 | 0 |
13c3bb6deea1739d745d8f14fbc2523bef0ec1cb | 187 | py | Python | HackerRank/Python/Collections/CompanyLogo.py | AdityaChirravuri/CompetitiveProgramming | 642550e8916b3f7939a1fdd52d10f5f8ae43f161 | [
"MIT"
] | 1 | 2021-07-13T01:49:25.000Z | 2021-07-13T01:49:25.000Z | HackerRank/Python/Collections/CompanyLogo.py | AdityaChirravuri/CompetitiveProgramming | 642550e8916b3f7939a1fdd52d10f5f8ae43f161 | [
"MIT"
] | null | null | null | HackerRank/Python/Collections/CompanyLogo.py | AdityaChirravuri/CompetitiveProgramming | 642550e8916b3f7939a1fdd52d10f5f8ae43f161 | [
"MIT"
] | null | null | null | string = input()
d = {}
for i in string:
if i in d:
d[i] += 1
else:
d[i] = 1
s = sorted(sorted(d), key = d.get, reverse = True)
for i in s[:3]:
print(i, d[i])
| 17 | 50 | 0.470588 | string = input()
d = {}
for i in string:
if i in d:
d[i] += 1
else:
d[i] = 1
s = sorted(sorted(d), key = d.get, reverse = True)
for i in s[:3]:
print(i, d[i])
| 0 | 0 | 0 |
559efba2e8c036ea8426a51546bc4e2aa0ff4a87 | 775 | py | Python | src/arrays/spiral-order-matrix.py | vighnesh153/ds-algo | 79c401dad2d2e575ce1913184ca8665f2712a5b8 | [
"MIT"
] | null | null | null | src/arrays/spiral-order-matrix.py | vighnesh153/ds-algo | 79c401dad2d2e575ce1913184ca8665f2712a5b8 | [
"MIT"
] | null | null | null | src/arrays/spiral-order-matrix.py | vighnesh153/ds-algo | 79c401dad2d2e575ce1913184ca8665f2712a5b8 | [
"MIT"
] | 1 | 2020-08-09T06:37:21.000Z | 2020-08-09T06:37:21.000Z | def solve(n):
result = [[0 for _ in range(n)] for __ in range(n)]
counter = 1
iteration = 0
while counter <= n * n:
i = j = iteration
while j < n - iteration:
result[i][j] = counter
counter += 1
j += 1
j -= 1
i += 1
while i < ... | 18.902439 | 55 | 0.390968 | def solve(n):
result = [[0 for _ in range(n)] for __ in range(n)]
counter = 1
iteration = 0
while counter <= n * n:
i = j = iteration
while j < n - iteration:
result[i][j] = counter
counter += 1
j += 1
j -= 1
i += 1
while i < ... | 0 | 0 | 0 |
992cbbffb5ba87a6ff522180da17ac5a5f6a4ccf | 181 | py | Python | codesignal/arcade/python/intro_52_longest_word.py | tinesife94/random | b802924dce4635ae074d30dc03962d4301bd6d8b | [
"MIT"
] | null | null | null | codesignal/arcade/python/intro_52_longest_word.py | tinesife94/random | b802924dce4635ae074d30dc03962d4301bd6d8b | [
"MIT"
] | null | null | null | codesignal/arcade/python/intro_52_longest_word.py | tinesife94/random | b802924dce4635ae074d30dc03962d4301bd6d8b | [
"MIT"
] | null | null | null | def solution(text):
letters = string.ascii_letters
s = ''
for c in text:
s = '{}{}'.format(s, c if c in letters else ' ')
return max(s.split(), key=len)
| 25.857143 | 60 | 0.541436 | def solution(text):
letters = string.ascii_letters
s = ''
for c in text:
s = '{}{}'.format(s, c if c in letters else ' ')
return max(s.split(), key=len)
| 0 | 0 | 0 |
521e8eaf2200d791a592c600d965d7937ff762c4 | 10,855 | py | Python | src/database.py | vimc/montagu | c9682b3e57cf25e75b5b7688f748c8dbe882666d | [
"MIT"
] | null | null | null | src/database.py | vimc/montagu | c9682b3e57cf25e75b5b7688f748c8dbe882666d | [
"MIT"
] | 59 | 2017-07-28T09:27:15.000Z | 2021-11-01T17:16:59.000Z | src/database.py | vimc/montagu | c9682b3e57cf25e75b5b7688f748c8dbe882666d | [
"MIT"
] | 1 | 2020-09-23T11:08:34.000Z | 2020-09-23T11:08:34.000Z | from subprocess import run
import psycopg2
import versions
from docker_helpers import pull, exec_safely
from service_config import api_db_user
root_user = "vimc"
# these tables should only be modified via sql migrations
protected_tables = ["gavi_support_level", "activity_type",
"burden_outcome",
... | 35.825083 | 120 | 0.64597 | import random
import string
from subprocess import run
from types import SimpleNamespace
import psycopg2
import versions
from docker_helpers import get_image_name, pull, exec_safely
from service_config import api_db_user
from settings import get_secret
root_user = "vimc"
# these tables should only be modified via sq... | 1,757 | 22 | 157 |
d81293ab153a2b3620035047792f5df592c73a94 | 1,225 | py | Python | Chapter05/poplib/mailbox_basic_params.py | yangwawa0323/Learning-Python-Networking-Second-Edition | 5460fe4fb6acc5d0df19bf36e52ac09e9a11eb8b | [
"MIT"
] | 52 | 2018-12-17T19:33:06.000Z | 2022-03-25T18:14:02.000Z | Chapter05/poplib/mailbox_basic_params.py | barretthugh/Learning-Python-Networking-Second-Edition | 0f00b8b20c1c85e76754e47113dff8ca9e99d5ca | [
"MIT"
] | null | null | null | Chapter05/poplib/mailbox_basic_params.py | barretthugh/Learning-Python-Networking-Second-Edition | 0f00b8b20c1c85e76754e47113dff8ca9e99d5ca | [
"MIT"
] | 38 | 2018-12-18T09:08:43.000Z | 2022-02-06T02:53:05.000Z | #!/usr/bin/env python3
import poplib
import argparse
def main(hostname,port,user,password):
mailbox = poplib.POP3_SSL(hostname,port)
try:
mailbox.user(user)
mailbox.pass_(password)
response, listings, octet_count = mailbox.list()
for li... | 30.625 | 76 | 0.59102 | #!/usr/bin/env python3
import poplib
import argparse
def main(hostname,port,user,password):
mailbox = poplib.POP3_SSL(hostname,port)
try:
mailbox.user(user)
mailbox.pass_(password)
response, listings, octet_count = mailbox.list()
for li... | 0 | 0 | 0 |
9b34dbdf2931cc53d5622eda4c91b6c6fb2da69b | 6,219 | py | Python | openob/manager.py | sreimers/openob | 8b82e38c37f0a7d748c076a0dc14fc8994bb5998 | [
"Unlicense"
] | 2 | 2018-04-26T11:27:10.000Z | 2021-06-01T03:59:41.000Z | openob/manager.py | sreimers/openob | 8b82e38c37f0a7d748c076a0dc14fc8994bb5998 | [
"Unlicense"
] | null | null | null | openob/manager.py | sreimers/openob | 8b82e38c37f0a7d748c076a0dc14fc8994bb5998 | [
"Unlicense"
] | null | null | null | # OpenOB Link Manager
# One of these runs at each end and negotiates everything (RX pushes config info to TX), reconnects when links fail, and so on.
| 57.583333 | 286 | 0.589323 | import sys
import time
import redis
from openob.rtp.tx import RTPTransmitter
from openob.rtp.rx import RTPReceiver
import gst
from colorama import Fore, Back, Style
# OpenOB Link Manager
# One of these runs at each end and negotiates everything (RX pushes config info to TX), reconnects when links fail, and so o... | 5,872 | 11 | 184 |
ad9efb2e6f4829da3b80bcc3b918afaea610d7d7 | 10,777 | py | Python | tests/test_packages/test_skills/test_confirmation_aw2/test_strategy.py | bryanchriswhite/agents-aea | d3f177a963eb855d9528555167255bf2b478f4ba | [
"Apache-2.0"
] | 126 | 2019-09-07T09:32:44.000Z | 2022-03-29T14:28:41.000Z | tests/test_packages/test_skills/test_confirmation_aw2/test_strategy.py | salman6049/agents-aea | d3f177a963eb855d9528555167255bf2b478f4ba | [
"Apache-2.0"
] | 1,814 | 2019-08-24T10:08:07.000Z | 2022-03-31T14:28:36.000Z | tests/test_packages/test_skills/test_confirmation_aw2/test_strategy.py | salman6049/agents-aea | d3f177a963eb855d9528555167255bf2b478f4ba | [
"Apache-2.0"
] | 46 | 2019-09-03T22:13:58.000Z | 2022-03-22T01:25:16.000Z | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... | 41.133588 | 143 | 0.661409 | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... | 9,423 | 221 | 247 |
4a05ac857f23cb032431dca22e9f9dc234c173f4 | 370 | py | Python | pype9/utils/mpi.py | tclose/Pype9 | 23f96c0885fd9df12d9d11ff800f816520e4b17a | [
"MIT"
] | null | null | null | pype9/utils/mpi.py | tclose/Pype9 | 23f96c0885fd9df12d9d11ff800f816520e4b17a | [
"MIT"
] | null | null | null | pype9/utils/mpi.py | tclose/Pype9 | 23f96c0885fd9df12d9d11ff800f816520e4b17a | [
"MIT"
] | 1 | 2021-04-08T12:46:21.000Z | 2021-04-08T12:46:21.000Z |
try:
from mpi4py import MPI # @UnusedImport @IgnorePep8 This is imported before NEURON to avoid a bug in NEURON
except ImportError:
mpi_comm = DummyMPICom()
else:
mpi_comm = MPI.COMM_WORLD
MPI_ROOT = 0
def is_mpi_master():
return (mpi_comm.rank == MPI_ROOT)
| 17.619048 | 111 | 0.678378 | class DummyMPICom(object):
rank = 0
size = 1
def barrier(self):
pass
try:
from mpi4py import MPI # @UnusedImport @IgnorePep8 This is imported before NEURON to avoid a bug in NEURON
except ImportError:
mpi_comm = DummyMPICom()
else:
mpi_comm = MPI.COMM_WORLD
MPI_ROOT = 0
def is_mpi... | 69 | 0 | 22 |
ab0bdc4d6adc83eb5ef6b8b6083e23fb449db951 | 9,480 | py | Python | Trajectory_Mining/Bag_of_Words/unpack_items_all_victims.py | AdamCoscia/eve-trajectory-mining | 134f142a5665f66fbf92aada8dd6252fab64ddff | [
"MIT"
] | null | null | null | Trajectory_Mining/Bag_of_Words/unpack_items_all_victims.py | AdamCoscia/eve-trajectory-mining | 134f142a5665f66fbf92aada8dd6252fab64ddff | [
"MIT"
] | null | null | null | Trajectory_Mining/Bag_of_Words/unpack_items_all_victims.py | AdamCoscia/eve-trajectory-mining | 134f142a5665f66fbf92aada8dd6252fab64ddff | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Unpacks Raw API data from zkillboard into victim files that contain
TEST - 10/02/2019
Params: 10000002201505.csv | 61MB | 28208 rows x 8 columns
Output:
```
(+0.000s|t:0.000s) Importing modules...
(+2.209s|t:2.209s) Loading CSV data from local file...
(+1.132s|t:3.341s) Converting DataFrame... | 38.380567 | 99 | 0.539873 | # -*- coding: utf-8 -*-
"""Unpacks Raw API data from zkillboard into victim files that contain
TEST - 10/02/2019
Params: 10000002201505.csv | 61MB | 28208 rows x 8 columns
Output:
```
(+0.000s|t:0.000s) Importing modules...
(+2.209s|t:2.209s) Loading CSV data from local file...
(+1.132s|t:3.341s) Converting DataFrame... | 0 | -11 | 22 |
6a00d837f8f2733589c99f7342b4ddb14ce14281 | 848 | py | Python | iqps/report/views.py | thealphadollar/iqps | 187f6b134d82e2dce951b356cb0c7151994ca3ab | [
"MIT"
] | null | null | null | iqps/report/views.py | thealphadollar/iqps | 187f6b134d82e2dce951b356cb0c7151994ca3ab | [
"MIT"
] | null | null | null | iqps/report/views.py | thealphadollar/iqps | 187f6b134d82e2dce951b356cb0c7151994ca3ab | [
"MIT"
] | null | null | null | from django.shortcuts import render, get_object_or_404
from django.contrib import messages
from .forms import ReportForm
from data.models import Paper
def reportPaper(request, paperId):
paper = get_object_or_404(Paper, pk=paperId)
form = None
try:
assert request.method == "POST"
form = Repo... | 30.285714 | 74 | 0.607311 | from django.shortcuts import render, get_object_or_404
from django.contrib import messages
from .forms import ReportForm
from data.models import Paper
def reportPaper(request, paperId):
paper = get_object_or_404(Paper, pk=paperId)
form = None
try:
assert request.method == "POST"
form = Repo... | 0 | 0 | 0 |
72598642d175089036d9345be8dbcafd77a05743 | 19,963 | py | Python | build/lib/geonomics/sim/stats.py | AnushaPB/geonomics-1 | deee0c377e81f509463eaf6f9d0b2f0809f2ddc3 | [
"MIT"
] | null | null | null | build/lib/geonomics/sim/stats.py | AnushaPB/geonomics-1 | deee0c377e81f509463eaf6f9d0b2f0809f2ddc3 | [
"MIT"
] | null | null | null | build/lib/geonomics/sim/stats.py | AnushaPB/geonomics-1 | deee0c377e81f509463eaf6f9d0b2f0809f2ddc3 | [
"MIT"
] | null | null | null | #!/usr/bin/python
#stats.py
'''
Classes and functons to implement calculation and output of statistics
'''
#geonomics imports
from geonomics.ops.selection import _calc_fitness
from geonomics.utils.viz import _check_display
#other imports
import numpy as np
_check_display()
######################################
#... | 45.786697 | 80 | 0.539698 | #!/usr/bin/python
#stats.py
'''
Classes and functons to implement calculation and output of statistics
'''
#geonomics imports
from geonomics.utils.io import (_append_array2d_to_array_stack,
_append_row_to_csv, _write_dict_to_csv)
from geonomics.ops.selection import _calc_fitness
from ... | 15,775 | 147 | 154 |
4d14eb208318979b2b03eac311b90a75532fc290 | 1,743 | py | Python | quantz_ground/app.py | zhangyuz/quantz_ground | a3c10aceaa9da537ff5d1fc015f198945bf9d6f0 | [
"Apache-2.0"
] | 1 | 2020-10-20T15:45:20.000Z | 2020-10-20T15:45:20.000Z | quantz_ground/app.py | zhangyuz/quantz_ground | a3c10aceaa9da537ff5d1fc015f198945bf9d6f0 | [
"Apache-2.0"
] | null | null | null | quantz_ground/app.py | zhangyuz/quantz_ground | a3c10aceaa9da537ff5d1fc015f198945bf9d6f0 | [
"Apache-2.0"
] | null | null | null | from eve import Eve
from .db_domains import db_domains
import os
def isInDocker():
return os.environ.get('AM_I_IN_A_DOCKER_CONTAINER', False)
SETTINGS = {
'DOMAIN': db_domains,
'MONGO_HOST': 'localhost',
'MONGO_PORT': 27017,
# MONGO_USERNAME': os.environ.get(...),
# MONGO_PASSWORD': os.env... | 24.208333 | 62 | 0.624785 | from eve import Eve
from .db_domains import db_domains
import os
def isInDocker():
return os.environ.get('AM_I_IN_A_DOCKER_CONTAINER', False)
SETTINGS = {
'DOMAIN': db_domains,
'MONGO_HOST': 'localhost',
'MONGO_PORT': 27017,
# MONGO_USERNAME': os.environ.get(...),
# MONGO_PASSWORD': os.env... | 0 | 0 | 0 |
5304b9a306a30a7e2cf57d01ceb4e53e6ccd0bca | 1,869 | py | Python | databird/dtutil.py | jonas-hagen/databird | cfb358e74da62bb9d7ea0e6c7ac984671472120b | [
"MIT"
] | 1 | 2021-11-05T00:12:00.000Z | 2021-11-05T00:12:00.000Z | databird/dtutil.py | jonas-hagen/databird | cfb358e74da62bb9d7ea0e6c7ac984671472120b | [
"MIT"
] | null | null | null | databird/dtutil.py | jonas-hagen/databird | cfb358e74da62bb9d7ea0e6c7ac984671472120b | [
"MIT"
] | null | null | null | import datetime as dt
import calendar
import time
def parse_timedelta(s):
valid_units = [
"weeks",
"days",
"hours",
"seconds",
"minutes",
"miliseconds",
"microseconds",
]
try:
if s == "0":
return dt.timedelta()
value, un... | 24.92 | 139 | 0.543606 | import datetime as dt
import calendar
import time
def parse_timedelta(s):
valid_units = [
"weeks",
"days",
"hours",
"seconds",
"minutes",
"miliseconds",
"microseconds",
]
try:
if s == "0":
return dt.timedelta()
value, un... | 0 | 0 | 0 |
5922ee45b768da565c33dd1950061bcdab97ffc8 | 662 | py | Python | coding_interviews/leetcode/easy/remove_duplicates/remove_duplicates.py | LeandroTk/Algorithms | 569ed68eba3eeff902f8078992099c28ce4d7cd6 | [
"MIT"
] | 205 | 2018-12-01T17:49:49.000Z | 2021-12-22T07:02:27.000Z | coding_interviews/leetcode/easy/remove_duplicates/remove_duplicates.py | LeandroTk/Algorithms | 569ed68eba3eeff902f8078992099c28ce4d7cd6 | [
"MIT"
] | 2 | 2020-01-01T16:34:29.000Z | 2020-04-26T19:11:13.000Z | coding_interviews/leetcode/easy/remove_duplicates/remove_duplicates.py | LeandroTk/Algorithms | 569ed68eba3eeff902f8078992099c28ce4d7cd6 | [
"MIT"
] | 50 | 2018-11-28T20:51:36.000Z | 2021-11-29T04:08:25.000Z | # https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string
def remove_duplicates(S):
if len(S) <= 1: return S
start, end = 0, 1
while end < len(S):
if S[start] != S[end]:
start = end
end = start + 1
elif S[start] == S[end] and end + 1 == len(S):
... | 21.354839 | 72 | 0.487915 | # https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string
def remove_duplicates(S):
if len(S) <= 1: return S
start, end = 0, 1
while end < len(S):
if S[start] != S[end]:
start = end
end = start + 1
elif S[start] == S[end] and end + 1 == len(S):
... | 0 | 0 | 0 |
b82ae840a377927194b91a181787f7527c4df71f | 271 | py | Python | py3wirecard/entities/acquirerdetails.py | robertons/py3wirecard | 8a9b541a67ee96d75b1c864762fce7148cccb8b4 | [
"MIT"
] | 2 | 2019-09-05T20:20:44.000Z | 2020-01-14T18:20:45.000Z | py3wirecard/entities/acquirerdetails.py | robertons/py3wirecard | 8a9b541a67ee96d75b1c864762fce7148cccb8b4 | [
"MIT"
] | 1 | 2020-01-15T12:27:56.000Z | 2020-01-16T12:26:13.000Z | py3wirecard/entities/acquirerdetails.py | robertons/py3wirecard | 8a9b541a67ee96d75b1c864762fce7148cccb8b4 | [
"MIT"
] | null | null | null | #-*- coding: utf-8 -*-
| 22.583333 | 56 | 0.782288 | #-*- coding: utf-8 -*-
from py3wirecard.entities.lib.wireentity import *
from py3wirecard.entities.taxdocument import TaxDocument
class AcquirerDetails(WireEntity):
@String()
def authorizationNumber(self): pass
@Object(type=TaxDocument)
def taxDocument(self):pass
| 118 | 63 | 67 |
a55666e686775ea98506356ddf52aca3da3da5cf | 1,119 | py | Python | clpc.py | CnybTseng/LPRNet | 5983ae3e3445d121c2ac31ac396287aa134545ab | [
"MIT"
] | null | null | null | clpc.py | CnybTseng/LPRNet | 5983ae3e3445d121c2ac31ac396287aa134545ab | [
"MIT"
] | null | null | null | clpc.py | CnybTseng/LPRNet | 5983ae3e3445d121c2ac31ac396287aa134545ab | [
"MIT"
] | null | null | null | chinese_strings = [
'京', '津', '冀', '晋', '蒙', '辽', '吉', '黑', '沪', '苏',
'浙', '皖', '闽', '赣', '鲁', '豫', '鄂', '湘', '粤', '桂',
'琼', '渝', '川', '贵', '云', '藏', '陕', '甘', '青', '宁',
'新', '港', '澳', '台', '警', 'WJ']
# 36
chinese = [
'Beijing',
'Tianjin',
'Hebei',
'Shanxi',
'InnerMongolia',
'Li... | 18.966102 | 56 | 0.392315 | chinese_strings = [
'京', '津', '冀', '晋', '蒙', '辽', '吉', '黑', '沪', '苏',
'浙', '皖', '闽', '赣', '鲁', '豫', '鄂', '湘', '粤', '桂',
'琼', '渝', '川', '贵', '云', '藏', '陕', '甘', '青', '宁',
'新', '港', '澳', '台', '警', 'WJ']
# 36
chinese = [
'Beijing',
'Tianjin',
'Hebei',
'Shanxi',
'InnerMongolia',
'Li... | 0 | 0 | 0 |
fb16e31bf96d01e63ade275800859d1d3efc6eef | 2,319 | py | Python | core/migrations/0001_initial.py | atthana/restapi_q_udemy | f49df5a614ac1b88a3bea975aea9498b8e85d504 | [
"MIT"
] | null | null | null | core/migrations/0001_initial.py | atthana/restapi_q_udemy | f49df5a614ac1b88a3bea975aea9498b8e85d504 | [
"MIT"
] | null | null | null | core/migrations/0001_initial.py | atthana/restapi_q_udemy | f49df5a614ac1b88a3bea975aea9498b8e85d504 | [
"MIT"
] | null | null | null | # Generated by Django 3.1.7 on 2021-04-05 14:35
| 38.65 | 131 | 0.564899 | # Generated by Django 3.1.7 on 2021-04-05 14:35
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Customer',
fields=[
... | 2,172 | 30 | 68 |
9f663f59a9673a49aadc92ab4dc19bf0f2475490 | 2,918 | py | Python | virtool_workflow/workflow.py | eroberts9789/virtool-workflow | 18219eec2b9b934cedd3770ac319f40305c165f2 | [
"MIT"
] | 5 | 2020-09-24T20:29:08.000Z | 2022-03-17T14:50:56.000Z | virtool_workflow/workflow.py | eroberts9789/virtool-workflow | 18219eec2b9b934cedd3770ac319f40305c165f2 | [
"MIT"
] | 126 | 2020-10-01T23:38:34.000Z | 2022-03-31T08:26:28.000Z | virtool_workflow/workflow.py | eroberts9789/virtool-workflow | 18219eec2b9b934cedd3770ac319f40305c165f2 | [
"MIT"
] | 5 | 2020-09-29T21:29:46.000Z | 2021-07-27T20:34:58.000Z | """Main definitions for Virtool Workflows."""
from typing import Any, Callable, Coroutine
WorkflowStep = Callable[..., Coroutine[Any, Any, None]]
| 34.329412 | 87 | 0.642221 | """Main definitions for Virtool Workflows."""
from typing import Any, Callable, Coroutine, Iterable, Optional, Sequence
from virtool_workflow.utils import coerce_to_coroutine_function
from fixtures import FixtureScope
WorkflowStep = Callable[..., Coroutine[Any, Any, None]]
class Workflow:
"""
A Workflow is ... | 2,618 | 84 | 68 |
daa5b4decdea31a15e43a756422b8f10fbdeb296 | 1,637 | py | Python | test/test_pool.py | viverlxl/resource_pool | 6fa226e0ac504df604362bf0ef84cb3a9f21109c | [
"MIT"
] | 2 | 2019-10-09T10:30:23.000Z | 2020-01-20T01:36:10.000Z | test/test_pool.py | viverlxl/resource_pool | 6fa226e0ac504df604362bf0ef84cb3a9f21109c | [
"MIT"
] | null | null | null | test/test_pool.py | viverlxl/resource_pool | 6fa226e0ac504df604362bf0ef84cb3a9f21109c | [
"MIT"
] | 1 | 2020-07-28T22:57:50.000Z | 2020-07-28T22:57:50.000Z | #coding:utf-8
import threading
import time
from concurrent.futures import ThreadPoolExecutor
app = None
DATABASECONFIG = {
"test":{
"host": "localhost",
"port": 3306,
"username": "root",
"password": "",
"schema" : "test"
}
}
def print_func(lock):
global app
... | 23.385714 | 82 | 0.568112 | #coding:utf-8
import threading
import time
import pytest
from .connect import DataClient, DataBase
from ..psrc import ConnPool
from concurrent.futures import ProcessPoolExecutor,ThreadPoolExecutor,as_completed
app = None
DATABASECONFIG = {
"test":{
"host": "localhost",
"port": 3306,
"usern... | 747 | 51 | 89 |
5dbd873944ee57a896246371918c17eb040e68d8 | 5,614 | py | Python | org/apache/helix/HelixProperty.py | davzhang/helix-python-binding | 11a9ecf730bce07720e0b0bcf7f0ec1cd2b25878 | [
"Apache-2.0"
] | 3 | 2015-04-08T22:51:04.000Z | 2015-05-03T06:42:35.000Z | org/apache/helix/HelixProperty.py | zzhang5/helix-python-binding | 11a9ecf730bce07720e0b0bcf7f0ec1cd2b25878 | [
"Apache-2.0"
] | null | null | null | org/apache/helix/HelixProperty.py | zzhang5/helix-python-binding | 11a9ecf730bce07720e0b0bcf7f0ec1cd2b25878 | [
"Apache-2.0"
] | 1 | 2020-03-31T21:43:01.000Z | 2020-03-31T21:43:01.000Z | # package org.apache.helix
#from org.apache.helix import *
#from java.lang.reflect import Constructor
#from java.util import ArrayList
#from java.util import Collection
#from java.util import Collections
#from java.util import HashMap
#from java.util import List
#from java.util import Map
from org.apache.helix.util.mi... | 20.792593 | 86 | 0.543997 | # package org.apache.helix
#from org.apache.helix import *
#from java.lang.reflect import Constructor
#from java.util import ArrayList
#from java.util import Collection
#from java.util import Collections
#from java.util import HashMap
#from java.util import List
#from java.util import Map
from org.apache.helix.util.mi... | 5,121 | 20 | 67 |
674b67bec6ee90176fbdee9879dd043d45c1fa36 | 2,431 | py | Python | modules/runtime/tests/py_importer_tests.py | ctonic/bark | 35591e69310a0f0c9e6e72b8a9ee71713901b12e | [
"MIT"
] | null | null | null | modules/runtime/tests/py_importer_tests.py | ctonic/bark | 35591e69310a0f0c9e6e72b8a9ee71713901b12e | [
"MIT"
] | null | null | null | modules/runtime/tests/py_importer_tests.py | ctonic/bark | 35591e69310a0f0c9e6e72b8a9ee71713901b12e | [
"MIT"
] | null | null | null | # Copyright (c) 2019 fortiss GmbH
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
import unittest
if __name__ == '__main__':
unittest.main()
| 34.239437 | 122 | 0.647882 | # Copyright (c) 2019 fortiss GmbH
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
import unittest
import matplotlib.pyplot as plt
from bark.world.agent import *
from bark.models.behavior import *
from bark.world import *
from bark.geometry import *
from bark.models.dynamic im... | 1,728 | 193 | 309 |
7e8d210f5257d00943ef0de386a015fecb1a21ab | 215 | py | Python | scripts/portal/Pianus.py | G00dBye/YYMS | 1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb | [
"MIT"
] | 54 | 2019-04-16T23:24:48.000Z | 2021-12-18T11:41:50.000Z | scripts/portal/Pianus.py | G00dBye/YYMS | 1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb | [
"MIT"
] | 3 | 2019-05-19T15:19:41.000Z | 2020-04-27T16:29:16.000Z | scripts/portal/Pianus.py | G00dBye/YYMS | 1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb | [
"MIT"
] | 49 | 2020-11-25T23:29:16.000Z | 2022-03-26T16:20:24.000Z | if sm.hasQuest(1666):
sm.warpInstanceIn(931050429)
sm.createClock(6*60)
sm.invokeAfterDelay(6*60*1000, "warpInstanceOut", 230040410, 0)
else:
map = 230040420
portal = 2
sm.warp(map, portal)
| 21.5 | 67 | 0.674419 | if sm.hasQuest(1666):
sm.warpInstanceIn(931050429)
sm.createClock(6*60)
sm.invokeAfterDelay(6*60*1000, "warpInstanceOut", 230040410, 0)
else:
map = 230040420
portal = 2
sm.warp(map, portal)
| 0 | 0 | 0 |
b0d90b1d516b0e0847b2cd536c61131786cada83 | 926 | py | Python | pysbr/queries/marketsbymarketids.py | power-edge/PySBR | f768c24e539557c08dfcaf39ce1eaca7d730cf25 | [
"MIT"
] | 49 | 2020-12-13T07:07:50.000Z | 2022-02-09T18:54:39.000Z | pysbr/queries/marketsbymarketids.py | power-edge/PySBR | f768c24e539557c08dfcaf39ce1eaca7d730cf25 | [
"MIT"
] | 11 | 2021-01-08T05:04:52.000Z | 2022-03-16T12:51:28.000Z | pysbr/queries/marketsbymarketids.py | power-edge/PySBR | f768c24e539557c08dfcaf39ce1eaca7d730cf25 | [
"MIT"
] | 9 | 2021-01-18T02:03:24.000Z | 2022-01-29T04:47:01.000Z | import pysbr.utils as utils
| 30.866667 | 78 | 0.661987 | from typing import List, Union
from pysbr.queries.query import Query
import pysbr.utils as utils
class MarketsByMarketIds(Query):
"""Get information about a number of leagues from their league ids.
Market name, description, and market type id are included in the response.
Args:
market_ids: SBR ... | 804 | 25 | 68 |
e34b7a0941162e0522b0241ed24bb6257057d4d6 | 108 | py | Python | examples/play_e2e4.py | certik/chess | dc806fccc0fb9acc57c40db56e620f2c55157425 | [
"MIT"
] | 1 | 2016-05-09T00:40:16.000Z | 2016-05-09T00:40:16.000Z | examples/play_e2e4.py | certik/chess | dc806fccc0fb9acc57c40db56e620f2c55157425 | [
"MIT"
] | null | null | null | examples/play_e2e4.py | certik/chess | dc806fccc0fb9acc57c40db56e620f2c55157425 | [
"MIT"
] | null | null | null | from py_uci import UCIEngine
e = UCIEngine()
e.new_game()
e.set_position(moves=["e2e4"])
e.find_best_move()
| 18 | 30 | 0.75 | from py_uci import UCIEngine
e = UCIEngine()
e.new_game()
e.set_position(moves=["e2e4"])
e.find_best_move()
| 0 | 0 | 0 |
24c03418435a7ac547e14c75a900568329890bf9 | 87 | py | Python | BranchBound/__init__.py | jskeet314/branch_bound_helper | 9336c47db2cf448fb8d8ef3b8b1c617bb56ff52a | [
"MIT"
] | null | null | null | BranchBound/__init__.py | jskeet314/branch_bound_helper | 9336c47db2cf448fb8d8ef3b8b1c617bb56ff52a | [
"MIT"
] | null | null | null | BranchBound/__init__.py | jskeet314/branch_bound_helper | 9336c47db2cf448fb8d8ef3b8b1c617bb56ff52a | [
"MIT"
] | null | null | null | name = "branch_bound"
if __name__ == "__main__":
print("branch bound installed!")
| 17.4 | 36 | 0.678161 | name = "branch_bound"
if __name__ == "__main__":
print("branch bound installed!")
| 0 | 0 | 0 |
5bb02276122f217a1d8c0e497fdf9aa0ae10602a | 750 | py | Python | createPb_v2.py | ats05/hmr | e6f2e7843a120ee2143c77a70bb1e82ae681b255 | [
"MIT"
] | null | null | null | createPb_v2.py | ats05/hmr | e6f2e7843a120ee2143c77a70bb1e82ae681b255 | [
"MIT"
] | null | null | null | createPb_v2.py | ats05/hmr | e6f2e7843a120ee2143c77a70bb1e82ae681b255 | [
"MIT"
] | null | null | null | # coding:utf-8
# tensorflow version1.13.1
import tensorflow as tf
saver = tf.train.import_meta_graph('models/model.ckpt-667589.meta', clear_devices=True)
with tf.Session() as sess:
chpt_state = tf.train.get_checkpoint_state('models/model.ckpt-667589')
# if chpt_state:
# last_model = chpt_state.model_checkpoi... | 28.846154 | 92 | 0.722667 | # coding:utf-8
# tensorflow version1.13.1
import tensorflow as tf
saver = tf.train.import_meta_graph('models/model.ckpt-667589.meta', clear_devices=True)
with tf.Session() as sess:
chpt_state = tf.train.get_checkpoint_state('models/model.ckpt-667589')
# if chpt_state:
# last_model = chpt_state.model_checkpoi... | 0 | 0 | 0 |
709dbb247538d10b3eb2ae120e003e5a4a33d3f1 | 11,460 | py | Python | seesaw/externalprocess.py | Ghostofapacket/seesaw-kit | a3d8395167eb38ec2c446aad254d940d621fbd98 | [
"Unlicense"
] | null | null | null | seesaw/externalprocess.py | Ghostofapacket/seesaw-kit | a3d8395167eb38ec2c446aad254d940d621fbd98 | [
"Unlicense"
] | null | null | null | seesaw/externalprocess.py | Ghostofapacket/seesaw-kit | a3d8395167eb38ec2c446aad254d940d621fbd98 | [
"Unlicense"
] | null | null | null | '''Running subprocesses asynchronously.'''
from __future__ import print_function
import os
import atexit
import tornado.ioloop
import time
_all_procs = set()
@atexit.register
def cleanup():
if _all_procs:
print('Subprocess did not exit properly!')
for proc in _all_procs:
print('Killing', p... | 32.10084 | 108 | 0.584991 | '''Running subprocesses asynchronously.'''
from __future__ import print_function
import fcntl
import os
import os.path
import subprocess
import functools
import datetime
import pty
import signal
import atexit
import tornado.ioloop
from tornado.ioloop import IOLoop, PeriodicCallback
import tornado.process
from seesaw... | 10,299 | 9 | 404 |
2a77bb600b7c374939281efcdc2822c2bb1565e6 | 10,337 | py | Python | face2anime/train_utils.py | davidleonfdez/face2anime | 896bf85a7aa28322cc9e9e586685db8cbbf39d89 | [
"MIT"
] | null | null | null | face2anime/train_utils.py | davidleonfdez/face2anime | 896bf85a7aa28322cc9e9e586685db8cbbf39d89 | [
"MIT"
] | 1 | 2022-01-15T23:57:33.000Z | 2022-01-15T23:57:33.000Z | face2anime/train_utils.py | davidleonfdez/face2anime | 896bf85a7aa28322cc9e9e586685db8cbbf39d89 | [
"MIT"
] | null | null | null | import gc
import torch
from typing import Callable
__all__ = ['EMAAverager', 'EMACallback', 'add_ema_to_gan_learner', 'custom_save_model',
'custom_load_model', 'SaveCheckpointsCallback', 'clean_mem']
def _default_forward_batch(model, batch, device):
input = batch
if isinstance(input, (list, tupl... | 43.432773 | 93 | 0.676695 | from fastai.vision.all import *
import gc
import torch
from typing import Callable
__all__ = ['EMAAverager', 'EMACallback', 'add_ema_to_gan_learner', 'custom_save_model',
'custom_load_model', 'SaveCheckpointsCallback', 'clean_mem']
class EMAAverager():
"""Callable class that calculates the EMA of a p... | 4,094 | 10 | 114 |
040c7f55302a46486df83f60b08c0f12421da7b6 | 5,027 | py | Python | spinnaker_csp/puzzles/sudoku_puzzles.py | neworderofjamie/SpiNNakerCSPs | 56af0782d0bb83fd6e9934021e4007604f107993 | [
"BSD-3-Clause-Clear"
] | 3 | 2018-03-14T08:53:20.000Z | 2020-05-28T17:28:18.000Z | spinnaker_csp/puzzles/sudoku_puzzles.py | neworderofjamie/SpiNNakerCSPs | 56af0782d0bb83fd6e9934021e4007604f107993 | [
"BSD-3-Clause-Clear"
] | null | null | null | spinnaker_csp/puzzles/sudoku_puzzles.py | neworderofjamie/SpiNNakerCSPs | 56af0782d0bb83fd6e9934021e4007604f107993 | [
"BSD-3-Clause-Clear"
] | 6 | 2019-04-11T16:00:58.000Z | 2021-07-03T14:48:16.000Z | """A set of sudoku puzzles to experiment with the spinnaker_csp package.
the puzzles are containned on the dictionary puzzles, keys are the name of the puzzle and values are tuples with the
puzzle as first element and solution as second element.
"""
puzzles={
#----------------------------------------------------------... | 38.374046 | 116 | 0.282475 | """A set of sudoku puzzles to experiment with the spinnaker_csp package.
the puzzles are containned on the dictionary puzzles, keys are the name of the puzzle and values are tuples with the
puzzle as first element and solution as second element.
"""
puzzles={
#----------------------------------------------------------... | 0 | 0 | 0 |
06fff0cc841bc55f26d1376b8560f7a8a4ac31ac | 707 | py | Python | bin/print_busco_config.py | ewels/nf-core-neutronstar | c64a04a2422b3a113b8b45774b8045cf874af3fe | [
"MIT"
] | 4 | 2018-10-02T09:44:02.000Z | 2019-09-13T11:19:33.000Z | bin/print_busco_config.py | ewels/nf-core-neutronstar | c64a04a2422b3a113b8b45774b8045cf874af3fe | [
"MIT"
] | 14 | 2018-10-05T14:43:03.000Z | 2020-09-15T08:45:59.000Z | bin/print_busco_config.py | ewels/nf-core-neutronstar | c64a04a2422b3a113b8b45774b8045cf874af3fe | [
"MIT"
] | 4 | 2018-11-06T08:30:07.000Z | 2020-02-11T13:00:38.000Z | #!/usr/bin/env python
from __future__ import print_function
import os
print(
"""[busco]
out_path = {0}
tmp_path = {0}/tmp
[tblastn]
# path to tblastn
path = /usr/bin/
[makeblastdb]
# path to makeblastdb
path = /usr/bin/
[augustus]
# path to augustus
path = /opt/augustus/bin/
[etraining]
# path to augustus etraining... | 17.243902 | 65 | 0.704385 | #!/usr/bin/env python
from __future__ import print_function
import os
print(
"""[busco]
out_path = {0}
tmp_path = {0}/tmp
[tblastn]
# path to tblastn
path = /usr/bin/
[makeblastdb]
# path to makeblastdb
path = /usr/bin/
[augustus]
# path to augustus
path = /opt/augustus/bin/
[etraining]
# path to augustus etraining... | 0 | 0 | 0 |
3119fab8ff4c8283e3ff2a1b33aa787a926adf2f | 3,234 | py | Python | parlai/core/build_data.py | rockingdingo/ParlAI | ceb009e1d81d2fec22454667559c6ff02a5624b9 | [
"BSD-3-Clause"
] | null | null | null | parlai/core/build_data.py | rockingdingo/ParlAI | ceb009e1d81d2fec22454667559c6ff02a5624b9 | [
"BSD-3-Clause"
] | null | null | null | parlai/core/build_data.py | rockingdingo/ParlAI | ceb009e1d81d2fec22454667559c6ff02a5624b9 | [
"BSD-3-Clause"
] | 1 | 2019-10-10T01:17:09.000Z | 2019-10-10T01:17:09.000Z | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
"""
Utilities for downloadi... | 34.404255 | 80 | 0.660482 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
"""
Utilities for downloadi... | 0 | 0 | 0 |
8d4636f7e70195eab6c8489ce3351b6b03573fe7 | 732 | py | Python | pi/firebase_utils.py | sastels/pi-temp | 9f56ed1f14129884fd72ec0d36cfa05657170f1c | [
"MIT"
] | null | null | null | pi/firebase_utils.py | sastels/pi-temp | 9f56ed1f14129884fd72ec0d36cfa05657170f1c | [
"MIT"
] | 8 | 2020-09-04T17:19:36.000Z | 2022-02-26T10:03:49.000Z | pi/firebase_utils.py | sastels/pi-temp | 9f56ed1f14129884fd72ec0d36cfa05657170f1c | [
"MIT"
] | null | null | null | from datetime import datetime
import pytz
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
def setup_firebase(service_account_path):
cred = credentials.Certificate(service_account_path)
firebase_admin.initialize_app(cred)
db = firestore.client()
return d... | 30.5 | 74 | 0.719945 | from datetime import datetime
import pytz
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
def setup_firebase(service_account_path):
cred = credentials.Certificate(service_account_path)
firebase_admin.initialize_app(cred)
db = firestore.client()
return d... | 0 | 0 | 0 |
5c417606898496b4f5606f5108cdcc3a843ec79b | 5,172 | py | Python | eyed/driver/bacnet/bacnet.py | ThousandMileEye/Eye | b0eca371fed5e01353ebddf7e4c400927decf0d2 | [
"Apache-2.0"
] | null | null | null | eyed/driver/bacnet/bacnet.py | ThousandMileEye/Eye | b0eca371fed5e01353ebddf7e4c400927decf0d2 | [
"Apache-2.0"
] | 55 | 2017-12-21T15:20:36.000Z | 2019-01-20T02:49:41.000Z | eyed/driver/bacnet/bacnet.py | ThousandMileEye/Eye | b0eca371fed5e01353ebddf7e4c400927decf0d2 | [
"Apache-2.0"
] | 3 | 2018-05-18T09:02:36.000Z | 2019-12-29T10:27:44.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# BACnet Client
#
| 18.083916 | 81 | 0.691415 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from bacpypes.iocb import IOCB
from bacpypes.pdu import Address, GlobalBroadcast
from bacpypes.apdu import WhoIsRequest, ReadPropertyRequest, ReadPropertyACK
from bacpypes.object import get_object_class, get_datatype
from bacpypes.object import ObjectType, registered_object... | 5,565 | 219 | 176 |
f285c95b7e4057a14af0bdee70433ff402fc6437 | 11,535 | py | Python | src/forms/users.py | Dourv/tornado-mongo | 95dbd1151abac2831d98b6d768a86f59b11c273d | [
"MIT"
] | 2 | 2015-04-21T14:49:05.000Z | 2015-04-21T15:15:40.000Z | src/forms/users.py | Dourv/tornado-mongo | 95dbd1151abac2831d98b6d768a86f59b11c273d | [
"MIT"
] | null | null | null | src/forms/users.py | Dourv/tornado-mongo | 95dbd1151abac2831d98b6d768a86f59b11c273d | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
forms constructor.
* Es necesario crear una variable tipo dict() que debe llevar la siguiente estructura.
{
'config(requerido)':{
'method(requerido)': 'valores POST o GET',
'action(requerido)': 'url para enviar la data',
'class' : 'Clases de css',
'err... | 25.690423 | 118 | 0.570438 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from bson.objectid import ObjectId
from pymongo import MongoClient
from validate_email import validate_email
from views.base import base
import config
import hashlib
'''
forms constructor.
* Es necesario crear una variable tipo dict() que debe llevar la siguiente estruc... | 10,496 | 34 | 158 |
f2d93262ed8c5501a226a28e3d0ba7c98b7c26e2 | 175 | py | Python | python/Twisted/krondo Twisted Introduction/basic-twisted/stack.py | RitamDey/My-Simple-Programs | 147b455a6a40c371ec894ce979e8a61d242e03bd | [
"Unlicense"
] | 2 | 2016-10-14T16:58:05.000Z | 2017-05-04T04:59:18.000Z | python/Twisted/krondo Twisted Introduction/basic-twisted/stack.py | GreenJoey/My-Simple-Programs | 147b455a6a40c371ec894ce979e8a61d242e03bd | [
"Unlicense"
] | null | null | null | python/Twisted/krondo Twisted Introduction/basic-twisted/stack.py | GreenJoey/My-Simple-Programs | 147b455a6a40c371ec894ce979e8a61d242e03bd | [
"Unlicense"
] | null | null | null | import traceback
from twisted.internet import reactor
def stack():
print("The Python Stack.")
traceback.print_stack()
reactor.callWhenRunning(stack)
reactor.run()
| 14.583333 | 36 | 0.748571 | import traceback
from twisted.internet import reactor
def stack():
print("The Python Stack.")
traceback.print_stack()
reactor.callWhenRunning(stack)
reactor.run()
| 0 | 0 | 0 |
ab96b071bc740f843d9faa533a1f2a73a5589c9b | 2,775 | py | Python | src/ralph_scrooge/plugins/collect/blade_server.py | xliiv/ralph_pricing | 88a295b6f0af66ae03c145205ada99f17ab51dd0 | [
"Apache-2.0"
] | null | null | null | src/ralph_scrooge/plugins/collect/blade_server.py | xliiv/ralph_pricing | 88a295b6f0af66ae03c145205ada99f17ab51dd0 | [
"Apache-2.0"
] | null | null | null | src/ralph_scrooge/plugins/collect/blade_server.py | xliiv/ralph_pricing | 88a295b6f0af66ae03c145205ada99f17ab51dd0 | [
"Apache-2.0"
] | 1 | 2021-11-15T21:21:17.000Z | 2021-11-15T21:21:17.000Z | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from ralph.util import plugin
from ralph.util.api_scrooge import get_blade_servers
from ralph_scrooge.models import (AssetInfo, D... | 25.227273 | 75 | 0.623423 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from ralph.util import plugin
from ralph.util.api_scrooge import get_blade_servers
from ralph_scrooge.models import (
AssetIn... | 61 | 19 | 46 |
969a4e2c193cd1b6ea7f45a8a1316bd133df7a37 | 663 | py | Python | get_pavlick_dict.py | bhaddow/pmindia-crawler | 1282b1151f4d41f2c817d2df3f718889384ea95f | [
"MIT"
] | 11 | 2020-01-29T05:29:59.000Z | 2022-02-21T09:38:24.000Z | get_pavlick_dict.py | bhaddow/pmindia-crawler | 1282b1151f4d41f2c817d2df3f718889384ea95f | [
"MIT"
] | null | null | null | get_pavlick_dict.py | bhaddow/pmindia-crawler | 1282b1151f4d41f2c817d2df3f718889384ea95f | [
"MIT"
] | 3 | 2020-03-24T20:50:18.000Z | 2020-11-30T02:33:05.000Z | #!/usr/bin/env python3
#
# Convert Pavlick's dictionary to hunalign
#
import argparse
import re
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--dict", default="/home/bhaddow/data/pavlick-dicts/dict.hi")
args = parser.parse_args()
brackets = re.compile("\[[^\]]*\]")
delim = re.co... | 22.862069 | 89 | 0.576169 | #!/usr/bin/env python3
#
# Convert Pavlick's dictionary to hunalign
#
import argparse
import re
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--dict", default="/home/bhaddow/data/pavlick-dicts/dict.hi")
args = parser.parse_args()
brackets = re.compile("\[[^\]]*\]")
delim = re.co... | 0 | 0 | 0 |
8203e968123e42ef425551ec0f073dd160a7b50d | 762 | py | Python | rp/models/route_filter_list.py | stellaraf/rp | c4d7a23001060d11dbd1a1c4f285a58a28ed4326 | [
"BSD-3-Clause"
] | 1 | 2020-03-08T08:22:37.000Z | 2020-03-08T08:22:37.000Z | rp/models/route_filter_list.py | stellaraf/rp | c4d7a23001060d11dbd1a1c4f285a58a28ed4326 | [
"BSD-3-Clause"
] | null | null | null | rp/models/route_filter_list.py | stellaraf/rp | c4d7a23001060d11dbd1a1c4f285a58a28ed4326 | [
"BSD-3-Clause"
] | null | null | null | # Standard Library
# Third Party
# Project
| 22.411765 | 63 | 0.71916 | # Standard Library
from typing import List, Union, Optional
from ipaddress import IPv4Network, IPv6Network
# Third Party
from pydantic import StrictStr
# Project
from rp.models._common import Flag, RPModel
class RouteFilterEntry(RPModel):
"""JunOS route-filter-list item JSON model."""
address: Union[IPv4Ne... | 506 | 75 | 134 |
420c7338283bf739005666061a1028136dc3f7ba | 3,234 | py | Python | bcs-ui/backend/templatesets/legacy_apps/configuration/validator.py | laodiu/bk-bcs | 2a956a42101ff6487ff521fb3ef429805bfa7e26 | [
"Apache-2.0"
] | 599 | 2019-06-25T03:20:46.000Z | 2022-03-31T12:14:33.000Z | bcs-ui/backend/templatesets/legacy_apps/configuration/validator.py | laodiu/bk-bcs | 2a956a42101ff6487ff521fb3ef429805bfa7e26 | [
"Apache-2.0"
] | 537 | 2019-06-27T06:03:44.000Z | 2022-03-31T12:10:01.000Z | bcs-ui/backend/templatesets/legacy_apps/configuration/validator.py | laodiu/bk-bcs | 2a956a42101ff6487ff521fb3ef429805bfa7e26 | [
"Apache-2.0"
] | 214 | 2019-06-25T03:26:05.000Z | 2022-03-31T07:52:03.000Z | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | 37.172414 | 115 | 0.732839 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | 0 | 0 | 0 |
a44c6e197f39d490a7a355053f89a213c3c72549 | 10,410 | py | Python | jocular/devicemanager.py | MartinCooke/jocular | 635816d4ef6aa6ea75187137e25386dad2d551e9 | [
"MIT"
] | 6 | 2021-03-21T16:46:44.000Z | 2021-11-27T14:07:06.000Z | jocular/devicemanager.py | MartinCooke/jocular | 635816d4ef6aa6ea75187137e25386dad2d551e9 | [
"MIT"
] | null | null | null | jocular/devicemanager.py | MartinCooke/jocular | 635816d4ef6aa6ea75187137e25386dad2d551e9 | [
"MIT"
] | null | null | null | '''
DeviceManager:
a Component that manages different device families e.g. Telescope, Camera, FilterWheel
via a GUI element that permits selection/connection/disconnection
DeviceFamily:
superclass of e.g. Camera, Telescope, FilterWheel
handles communication with devices for generic functions such as
sele... | 28.598901 | 99 | 0.708165 | '''
DeviceManager:
a Component that manages different device families e.g. Telescope, Camera, FilterWheel
via a GUI element that permits selection/connection/disconnection
DeviceFamily:
superclass of e.g. Camera, Telescope, FilterWheel
handles communication with devices for generic functions such as
sele... | 8,793 | 276 | 470 |
68b6b85d463890a467a9a4397e9accc324f29eae | 567 | py | Python | use-cases/plc+opc/camera.py | TiagoDaFonseca/plc-machine-vision | 22864d2e09bcc52971fbd2a0088f38878f6b59e3 | [
"MIT"
] | null | null | null | use-cases/plc+opc/camera.py | TiagoDaFonseca/plc-machine-vision | 22864d2e09bcc52971fbd2a0088f38878f6b59e3 | [
"MIT"
] | null | null | null | use-cases/plc+opc/camera.py | TiagoDaFonseca/plc-machine-vision | 22864d2e09bcc52971fbd2a0088f38878f6b59e3 | [
"MIT"
] | null | null | null | import cv2
import time
def connect( channel):
return cv2.VideoCapture(channel)
def capture_image (device,exposition):
cam= connect(device)
for i in range(exposition):
ret, bgr_img = cam.read()
cam.release()
return bgr_img
#Test unit
if __name__ == '__m... | 22.68 | 41 | 0.536155 | import numpy as np
import cv2
import time
def connect( channel):
return cv2.VideoCapture(channel)
def capture_image (device,exposition):
cam= connect(device)
for i in range(exposition):
ret, bgr_img = cam.read()
cam.release()
return bgr_img
#Test unit... | 0 | -3 | 23 |
f20b27cf456d5eeefe90b7cde2cb3bf4272e1e3f | 129 | py | Python | tests/inputs/misc/81-builtin-funcs.py | helq/pytropos | 497ed5902e6e4912249ca0a46b477f9bfa6ae80a | [
"MIT"
] | 4 | 2019-10-06T18:01:24.000Z | 2020-07-03T05:27:35.000Z | tests/inputs/misc/81-builtin-funcs.py | helq/pytropos | 497ed5902e6e4912249ca0a46b477f9bfa6ae80a | [
"MIT"
] | 5 | 2021-06-07T15:50:04.000Z | 2021-06-07T15:50:06.000Z | tests/inputs/misc/81-builtin-funcs.py | helq/pytropos | 497ed5902e6e4912249ca0a46b477f9bfa6ae80a | [
"MIT"
] | null | null | null | a = float(2)
b = int(2.0)
c = bool(a)
d = float(None) # fails
e = int(None) # fails
f = bool(None) # fails
# show_store()
| 14.333333 | 24 | 0.550388 | a = float(2)
b = int(2.0)
c = bool(a)
d = float(None) # fails
e = int(None) # fails
f = bool(None) # fails
# show_store()
| 0 | 0 | 0 |
971441945df4116d6f750cbc934993c8e55ff602 | 605 | py | Python | Curso_Python_3_UDEMY/banco_dados/contatos_grupo.py | DanilooSilva/Cursos_de_Python | 8f167a4c6e16f01601e23b6f107578aa1454472d | [
"MIT"
] | null | null | null | Curso_Python_3_UDEMY/banco_dados/contatos_grupo.py | DanilooSilva/Cursos_de_Python | 8f167a4c6e16f01601e23b6f107578aa1454472d | [
"MIT"
] | null | null | null | Curso_Python_3_UDEMY/banco_dados/contatos_grupo.py | DanilooSilva/Cursos_de_Python | 8f167a4c6e16f01601e23b6f107578aa1454472d | [
"MIT"
] | null | null | null | from db import nova_conexao
from mysql.connector.errors import ProgrammingError
sql = '''
SELECT A.NOME,
A.TEL,
B.DESCRICAO
FROM CONTATOS A
INNER JOIN GRUPOS B ON A.IDGRUPO = B.ID
ORDER BY B.DESCRICAO, A.NOME
'''
with nova_conexao() as conexao:
try:
c... | 27.5 | 86 | 0.591736 | from db import nova_conexao
from mysql.connector.errors import ProgrammingError
sql = '''
SELECT A.NOME,
A.TEL,
B.DESCRICAO
FROM CONTATOS A
INNER JOIN GRUPOS B ON A.IDGRUPO = B.ID
ORDER BY B.DESCRICAO, A.NOME
'''
with nova_conexao() as conexao:
try:
c... | 0 | 0 | 0 |
048f47a7d570fbb6837142446eb4b40f6f3b3111 | 2,924 | py | Python | logger/readers/mqtt_reader.py | anshika-agarwal/openrvdas | 69c0c53902a988b790faad8baa21a5f299d033df | [
"BSD-2-Clause"
] | null | null | null | logger/readers/mqtt_reader.py | anshika-agarwal/openrvdas | 69c0c53902a988b790faad8baa21a5f299d033df | [
"BSD-2-Clause"
] | null | null | null | logger/readers/mqtt_reader.py | anshika-agarwal/openrvdas | 69c0c53902a988b790faad8baa21a5f299d033df | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/env python3
import logging
import sys
from os.path import dirname, realpath; sys.path.append(dirname(dirname(dirname(realpath(__file__)))))
# Don't barf if they don't have redis installed. Only complain if
# they actually try to use it, below
try:
PAHO_ENABLED = True
except ModuleNotFoundError:
PAHO_EN... | 27.327103 | 104 | 0.624487 | #!/usr/bin/env python3
import json
import logging
import socket
import sys
from os.path import dirname, realpath; sys.path.append(dirname(dirname(dirname(realpath(__file__)))))
from logger.utils.formats import Text
from logger.readers.reader import Reader
# Don't barf if they don't have redis installed. Only compla... | 1,833 | 27 | 198 |
1ead3e61c0cfb9c1f187dba1bb471881875c24e4 | 1,167 | py | Python | synch/replication/consumer.py | luolin0313/synch | 1a4a1262c20a85fe06f2cb40291f0a066572518b | [
"Apache-2.0"
] | null | null | null | synch/replication/consumer.py | luolin0313/synch | 1a4a1262c20a85fe06f2cb40291f0a066572518b | [
"Apache-2.0"
] | null | null | null | synch/replication/consumer.py | luolin0313/synch | 1a4a1262c20a85fe06f2cb40291f0a066572518b | [
"Apache-2.0"
] | 1 | 2020-09-28T01:37:00.000Z | 2020-09-28T01:37:00.000Z | import logging
from synch.enums import ClickHouseEngine
from synch.factory import Global
from synch.replication.etl import etl_full
from synch.writer.collapsing_merge_tree import ClickHouseCollapsingMergeTree
from synch.writer.merge_tree import ClickHouseMergeTree
logger = logging.getLogger("synch.replication.consume... | 32.416667 | 78 | 0.75407 | import logging
from synch.enums import ClickHouseEngine
from synch.factory import Global
from synch.replication.etl import etl_full
from synch.writer.collapsing_merge_tree import ClickHouseCollapsingMergeTree
from synch.writer.merge_tree import ClickHouseMergeTree
logger = logging.getLogger("synch.replication.consume... | 0 | 0 | 0 |
5005e0852fc10d13f279f0d30c991920b9d07e96 | 71,131 | py | Python | jumeg/decompose/fourier_ica_plot.py | fboers/jumeg | e04896989faf72f4dbe7adf136e4d158d212f24a | [
"BSD-3-Clause"
] | 6 | 2015-04-10T07:13:07.000Z | 2021-12-12T04:04:37.000Z | jumeg/decompose/fourier_ica_plot.py | fboers/jumeg | e04896989faf72f4dbe7adf136e4d158d212f24a | [
"BSD-3-Clause"
] | 112 | 2015-01-07T10:19:24.000Z | 2022-02-01T15:48:16.000Z | jumeg/decompose/fourier_ica_plot.py | fboers/jumeg | e04896989faf72f4dbe7adf136e4d158d212f24a | [
"BSD-3-Clause"
] | 22 | 2015-03-11T12:19:50.000Z | 2021-11-20T04:24:42.000Z | # Authors: Lukas Breuer <l.breuer@fz-juelich.de>
"""
----------------------------------------------------------------------
--- jumeg.decompose.fourier_ica_plot ---------------------------------
----------------------------------------------------------------------
autor : Lukas Breuer
email : l.breuer@fz-... | 39.605234 | 132 | 0.505152 | # Authors: Lukas Breuer <l.breuer@fz-juelich.de>
"""
----------------------------------------------------------------------
--- jumeg.decompose.fourier_ica_plot ---------------------------------
----------------------------------------------------------------------
autor : Lukas Breuer
email : l.breuer@fz-... | 0 | -9 | 26 |
363cd66c50b81a1f02268cecb470ac1771146697 | 2,194 | py | Python | experiments/tabular_benchmarks/process_HB.py | auto-flow/oxygen | 6ff221027c4b1b022499d0b7d46b65f18815ada8 | [
"BSD-3-Clause"
] | 90 | 2020-12-14T23:35:40.000Z | 2022-03-04T05:20:36.000Z | experiments/tabular_benchmarks/process_HB.py | auto-flow/oxygen | 6ff221027c4b1b022499d0b7d46b65f18815ada8 | [
"BSD-3-Clause"
] | 1 | 2021-02-14T03:09:23.000Z | 2021-02-17T03:39:40.000Z | experiments/tabular_benchmarks/process_HB.py | auto-flow/oxygen | 6ff221027c4b1b022499d0b7d46b65f18815ada8 | [
"BSD-3-Clause"
] | 15 | 2020-12-22T09:54:58.000Z | 2022-03-15T11:16:03.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : qichun tang
# @Contact : tqichun@gmail.com
import json
import os
from pathlib import Path
import pandas as pd
from joblib import Parallel, delayed
from joblib import dump
info = {
"bohb": ("HpBandSter-BOHB", "r",),
"ultraopt_BOHB": ("UltraOpt-BOHB"... | 28.493506 | 68 | 0.597995 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : qichun tang
# @Contact : tqichun@gmail.com
import json
import os
from pathlib import Path
import pandas as pd
from joblib import Parallel, delayed
from joblib import dump
info = {
"bohb": ("HpBandSter-BOHB", "r",),
"ultraopt_BOHB": ("UltraOpt-BOHB"... | 0 | 0 | 0 |
cf2f5303e12688810ef838f064e43fa35b43f0f1 | 4,776 | py | Python | docs/conf.py | Sohl-Dickstein/learned_optimization | cd929359a51d09444665021387c058aac11b63ba | [
"Apache-2.0"
] | 70 | 2021-12-16T07:12:11.000Z | 2022-03-31T19:13:36.000Z | docs/conf.py | Sohl-Dickstein/learned_optimization | cd929359a51d09444665021387c058aac11b63ba | [
"Apache-2.0"
] | 10 | 2021-12-29T10:03:37.000Z | 2022-03-22T15:59:55.000Z | docs/conf.py | Sohl-Dickstein/learned_optimization | cd929359a51d09444665021387c058aac11b63ba | [
"Apache-2.0"
] | 5 | 2021-12-16T04:52:35.000Z | 2022-03-22T03:45:31.000Z | # coding=utf-8
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | 31.421053 | 80 | 0.695352 | # coding=utf-8
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | 0 | 0 | 0 |
f0dbbe1279aab50b7683686f8eb0d599271d1d74 | 4,229 | py | Python | tfsnippet/layers/convolutional/shifted.py | QianLiGui/tfsnippet | 63adaf04d2ffff8dec299623627d55d4bacac598 | [
"MIT"
] | 63 | 2018-06-06T11:56:40.000Z | 2022-03-22T08:00:59.000Z | tfsnippet/layers/convolutional/shifted.py | QianLiGui/tfsnippet | 63adaf04d2ffff8dec299623627d55d4bacac598 | [
"MIT"
] | 39 | 2018-07-04T12:40:53.000Z | 2022-02-09T23:48:44.000Z | tfsnippet/layers/convolutional/shifted.py | QianLiGui/tfsnippet | 63adaf04d2ffff8dec299623627d55d4bacac598 | [
"MIT"
] | 34 | 2018-06-25T09:59:22.000Z | 2022-02-23T12:46:33.000Z | import tensorflow as tf
from tensorflow.contrib.framework import add_arg_scope
from tfsnippet.utils import (add_name_and_scope_arg_doc, get_static_shape, get_default_scope_name)
from .conv2d_ import conv2d
from .utils import validate_conv2d_size_tuple, validate_conv2d_input
__all__ = ['shifted_conv2d']
@add_arg_sco... | 38.099099 | 78 | 0.594703 | import tensorflow as tf
from tensorflow.contrib.framework import add_arg_scope
from tfsnippet.utils import (add_name_and_scope_arg_doc, get_static_shape,
get_default_scope_name)
from .conv2d_ import conv2d
from .utils import validate_conv2d_size_tuple, validate_conv2d_input
__all__ = ['sh... | 0 | 29 | 0 |
0a1e0a42a99ee6178be40181a0dbd0ab8c1ffad0 | 1,651 | py | Python | ietf/meeting/feeds.py | unofficial-mirror/ietfdb | ce54adb30dc7299c6eb4d42b9aa9d2c2929c1a81 | [
"BSD-3-Clause"
] | null | null | null | ietf/meeting/feeds.py | unofficial-mirror/ietfdb | ce54adb30dc7299c6eb4d42b9aa9d2c2929c1a81 | [
"BSD-3-Clause"
] | null | null | null | ietf/meeting/feeds.py | unofficial-mirror/ietfdb | ce54adb30dc7299c6eb4d42b9aa9d2c2929c1a81 | [
"BSD-3-Clause"
] | null | null | null | # Copyright The IETF Trust 2007-2019, All Rights Reserved
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
| 28.465517 | 122 | 0.623864 | # Copyright The IETF Trust 2007-2019, All Rights Reserved
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from django.conf import settings
from django.utils.h... | 1,252 | 84 | 158 |
2319e91137f9efd7f01e9d5c2b0581591fd6d9c7 | 3,560 | py | Python | Controller/DatabaseManager.py | TheConstructRIT/Machine-Swipe-System | 857e5c5205638a212736d58ac9e1ae27fa300946 | [
"MIT"
] | null | null | null | Controller/DatabaseManager.py | TheConstructRIT/Machine-Swipe-System | 857e5c5205638a212736d58ac9e1ae27fa300946 | [
"MIT"
] | null | null | null | Controller/DatabaseManager.py | TheConstructRIT/Machine-Swipe-System | 857e5c5205638a212736d58ac9e1ae27fa300946 | [
"MIT"
] | null | null | null | """
Zachary Cook
Manages calls to the databases.
"""
from Controller import ConfigurationManager
from Model import User
"""
Class representing the database.
"""
staticDatabaseManager = None
"""
Returns the static database instance.
"""
def getDatabase():
# Create the static instance.
global staticDatabaseMana... | 25.248227 | 184 | 0.72191 | """
Zachary Cook
Manages calls to the databases.
"""
import sqlite3
from Controller import ConfigurationManager
from Model import Time,User
"""
Class representing the database.
"""
class DatabaseManager:
"""
Creates a database manager.
"""
def __init__(self,location="database.sqlite"):
self.database = sqlite... | 2,385 | -2 | 45 |
ca15d3a39d10b75749c3989ddaa269a5e7fa2f8d | 1,739 | py | Python | src/hacenada/abstract.py | corydodt/Hacenada | 32421d071bf684e56e629c84cfb6d585be5be846 | [
"MIT"
] | 1 | 2021-03-23T10:21:27.000Z | 2021-03-23T10:21:27.000Z | src/hacenada/abstract.py | corydodt/Hacenada | 32421d071bf684e56e629c84cfb6d585be5be846 | [
"MIT"
] | 1 | 2021-01-15T04:12:12.000Z | 2021-01-15T04:12:12.000Z | src/hacenada/abstract.py | corydodt/Hacenada | 32421d071bf684e56e629c84cfb6d585be5be846 | [
"MIT"
] | null | null | null | """
Abstract types
"""
| 20.702381 | 81 | 0.592869 | """
Abstract types
"""
from abc import ABC, abstractmethod
import typing
from hacenada.const import STR_DICT
class SessionStorage(ABC):
"""
Provide access to the session's underlying storage through any mechanism
"""
answer: typing.Any
meta: typing.Any
@property
def script_path(self):
... | 1,581 | 20 | 113 |
4a5f5f16ca4b191cb32bb78237a6ad6567772ab5 | 6,965 | py | Python | compounddb/tools.py | gitanna/chemminetools | 1cfef18bcd773421c95f8662857f31e363211cdc | [
"BSD-4-Clause-UC"
] | 2 | 2017-12-11T23:17:40.000Z | 2020-08-17T08:35:01.000Z | compounddb/tools.py | gitanna/chemminetools | 1cfef18bcd773421c95f8662857f31e363211cdc | [
"BSD-4-Clause-UC"
] | null | null | null | compounddb/tools.py | gitanna/chemminetools | 1cfef18bcd773421c95f8662857f31e363211cdc | [
"BSD-4-Clause-UC"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import User
from logging import root, basicConfig
import openbabel
import sys
import re
import tempfile
import os
import codecs
import md5
import compounddb.sdfiterator
import string
import random
cur_dir = os.path.... | 21.902516 | 162 | 0.560086 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import User
from logging import root, basicConfig
import openbabel
import sys
import re
import tempfile
import os
import codecs
import md5
import compounddb.sdfiterator
import string
import random
cur_dir = os.path.... | 0 | 10 | 23 |
7333e00acece91b14003ff4ab485dc5fbb7d6ece | 725 | py | Python | reservation_units/migrations/0040_reservationunit_tax_percentage.py | SuviVappula/tilavarauspalvelu-core | ad7dec36e392a7b2927e2f825c3b0eb29b700793 | [
"MIT"
] | null | null | null | reservation_units/migrations/0040_reservationunit_tax_percentage.py | SuviVappula/tilavarauspalvelu-core | ad7dec36e392a7b2927e2f825c3b0eb29b700793 | [
"MIT"
] | null | null | null | reservation_units/migrations/0040_reservationunit_tax_percentage.py | SuviVappula/tilavarauspalvelu-core | ad7dec36e392a7b2927e2f825c3b0eb29b700793 | [
"MIT"
] | null | null | null | # Generated by Django 3.1.14 on 2021-12-13 11:06
| 32.954545 | 302 | 0.721379 | # Generated by Django 3.1.14 on 2021-12-13 11:06
import django.db.models.deletion
from django.db import migrations, models
import reservation_units.models
class Migration(migrations.Migration):
dependencies = [
('reservation_units', '0039_taxpercentage'),
]
operations = [
migrations.Ad... | 544 | 40 | 91 |
a1a9646cdfbe9e115bc034e382782125b3a992b9 | 569 | py | Python | xtapi/__init__.py | istommao/xtapi | acc81493a11adea7f3bb75773bf8683a3ea74b9d | [
"MIT"
] | null | null | null | xtapi/__init__.py | istommao/xtapi | acc81493a11adea7f3bb75773bf8683a3ea74b9d | [
"MIT"
] | null | null | null | xtapi/__init__.py | istommao/xtapi | acc81493a11adea7f3bb75773bf8683a3ea74b9d | [
"MIT"
] | null | null | null | """xtapi"""
from fastapi import (Query, Path, Body, Cookie, Header, Form, File, UploadFile, Request, Response, status, Depends, APIRouter, HTTPException, BackgroundTasks)
from .main import MainApp
from .templates import Templates
__all__ = [
'Query',
'Path',
'Body',
'Cookie',
'Header',
'Form'... | 12.931818 | 32 | 0.544815 | """xtapi"""
from fastapi import (
Query,
Path,
Body,
Cookie,
Header,
Form,
File,
UploadFile,
Request,
Response,
status,
Depends,
APIRouter,
HTTPException,
BackgroundTasks
)
from .main import MainApp
from .templates import Templates
__all__ = [
'Query',
... | 0 | 62 | 0 |
360b9d69d4522185d1aa103f09cae5f806771a7a | 314 | py | Python | sample/fun.py | henryneu/Python | 41bdbe73944116dc5bbb27d5770d6f45c20276a5 | [
"Apache-2.0"
] | 1 | 2017-03-02T02:59:47.000Z | 2017-03-02T02:59:47.000Z | sample/fun.py | henryneu/Python | 41bdbe73944116dc5bbb27d5770d6f45c20276a5 | [
"Apache-2.0"
] | null | null | null | sample/fun.py | henryneu/Python | 41bdbe73944116dc5bbb27d5770d6f45c20276a5 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from math import sqrt
from math import sin
# 函数作为参数传入
# 使用可变参数
def same(x, *fs):
f = [f(x) for f in fs]
return f
def do_fun(x=[], *fu):
fx = [f(x_i) for x_i in x for f in fu]
return fx
print(same(3, abs, sqrt, sin))
print(do_fun([1, 2, 4, 9], abs, sqrt, sin)) | 17.444444 | 43 | 0.60828 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from math import sqrt
from math import sin
# 函数作为参数传入
# 使用可变参数
def same(x, *fs):
f = [f(x) for f in fs]
return f
def do_fun(x=[], *fu):
fx = [f(x_i) for x_i in x for f in fu]
return fx
print(same(3, abs, sqrt, sin))
print(do_fun([1, 2, 4, 9], abs, sqrt, sin)) | 0 | 0 | 0 |
d503b7c3004d0aec97a03aa45fb4af6a06bd8cfd | 1,537 | py | Python | stepic_rec_2.py | pis2pis2/stepik_auto_tests_course | 5bd5df105848582b58620373055e2f4fc945e5e2 | [
"MIT"
] | null | null | null | stepic_rec_2.py | pis2pis2/stepik_auto_tests_course | 5bd5df105848582b58620373055e2f4fc945e5e2 | [
"MIT"
] | null | null | null | stepic_rec_2.py | pis2pis2/stepik_auto_tests_course | 5bd5df105848582b58620373055e2f4fc945e5e2 | [
"MIT"
] | null | null | null | from selenium import webdriver
import time
try:
# link = "http://suninjuly.github.io/registration1.html"
link = "http://suninjuly.github.io/registration2.html"
browser = webdriver.Chrome()
browser.get(link)
# Ваш код, который заполняет обязательные поля
input_first_name = browser.find_element... | 37.487805 | 103 | 0.745608 | from selenium import webdriver
import time
try:
# link = "http://suninjuly.github.io/registration1.html"
link = "http://suninjuly.github.io/registration2.html"
browser = webdriver.Chrome()
browser.get(link)
# Ваш код, который заполняет обязательные поля
input_first_name = browser.find_element... | 0 | 0 | 0 |
a513ba215a5ee45deeea7edac6742335f7fa9630 | 919 | py | Python | stock_rv_ranker/metrics/ranknet.py | Sci-Inference/stock-return-volatility-ranker | 96dd865cac146c2cadea369df9552b9698dd05be | [
"Apache-2.0"
] | null | null | null | stock_rv_ranker/metrics/ranknet.py | Sci-Inference/stock-return-volatility-ranker | 96dd865cac146c2cadea369df9552b9698dd05be | [
"Apache-2.0"
] | null | null | null | stock_rv_ranker/metrics/ranknet.py | Sci-Inference/stock-return-volatility-ranker | 96dd865cac146c2cadea369df9552b9698dd05be | [
"Apache-2.0"
] | 1 | 2022-01-23T06:35:44.000Z | 2022-01-23T06:35:44.000Z | import numpy as np
# https://gist.github.com/bwhite/3726239
def precision_at_k(r, k):
assert k >= 1
r = np.asarray(r)[:k] != 0
if r.size != k:
raise ValueError('Relevance score length < k')
return np.mean(r)
def average_precision(r):
r = np.asarray(r) != 0
out = [precision_at_k(r, k + 1) for k in range(r.... | 21.372093 | 66 | 0.64309 | import numpy as np
# https://gist.github.com/bwhite/3726239
def precision_at_k(r, k):
assert k >= 1
r = np.asarray(r)[:k] != 0
if r.size != k:
raise ValueError('Relevance score length < k')
return np.mean(r)
def average_precision(r):
r = np.asarray(r) != 0
out = [precision_at_k(r, k + 1) for k in range(r.... | 0 | 0 | 0 |
0b90e2988d72868e586b38128130fb3bcab2cdf2 | 1,486 | py | Python | training/components/data/data_split.py | anifort/vertex-mlops-airlines | 5a213836070bcbe72419239f05dd15a42bdebd19 | [
"MIT"
] | null | null | null | training/components/data/data_split.py | anifort/vertex-mlops-airlines | 5a213836070bcbe72419239f05dd15a42bdebd19 | [
"MIT"
] | null | null | null | training/components/data/data_split.py | anifort/vertex-mlops-airlines | 5a213836070bcbe72419239f05dd15a42bdebd19 | [
"MIT"
] | null | null | null | from kfp.v2.dsl import (component, Input, Output, Dataset)
@component(
packages_to_install=[
"dask[dataframe]==2021.12.0",
"gcsfs==2021.11.1"]
)
def data_split_comp(
dataset: Input[Dataset],
train_set: Output[Dataset],
validation_set: Output[Dataset],
test_set: Output[Dataset],
... | 28.037736 | 185 | 0.658816 | from kfp.v2.dsl import (
component,
Input,
Output,
Dataset,
Artifact,
HTML,
)
@component(
packages_to_install=[
"dask[dataframe]==2021.12.0",
"gcsfs==2021.11.1"]
)
def data_split_comp(
dataset: Input[Dataset],
train_set: Output[Dataset],
validation_set: Output[Da... | 0 | 43 | 0 |
8f5bbfeb8bfe3c37315237b9e16a94e21b9c4579 | 723 | py | Python | projects/rpg/src/ex_teams_generator2/config/config.py | japinol7/some-examples | a31ab64f861a7e37685582a9fb92ac58f86295d9 | [
"MIT"
] | 1 | 2020-07-25T23:28:56.000Z | 2020-07-25T23:28:56.000Z | projects/rpg/src/ex_teams_generator2/config/config.py | japinol7/some_examples | a31ab64f861a7e37685582a9fb92ac58f86295d9 | [
"MIT"
] | null | null | null | projects/rpg/src/ex_teams_generator2/config/config.py | japinol7/some_examples | a31ab64f861a7e37685582a9fb92ac58f86295d9 | [
"MIT"
] | null | null | null | import logging
GROUP_SEPARATOR = f"{'-' * 10}"
N_TEAMS = 42
N_MEMBERS = 3
N_TEAMS_MAX = 50
N_MEMBERS_MAX = 15
BODY_TEAMS_KEY = 'teams'
BODY_ERRORS_KEY = 'errors'
ERROR_TAG = 'Error'
ERROR_MAX_MSG = f"User input Error. Maximum {N_TEAMS_MAX} teams and {N_MEMBERS_MAX} members for team. " \
f"Values mu... | 27.807692 | 112 | 0.748271 | import logging
GROUP_SEPARATOR = f"{'-' * 10}"
N_TEAMS = 42
N_MEMBERS = 3
N_TEAMS_MAX = 50
N_MEMBERS_MAX = 15
BODY_TEAMS_KEY = 'teams'
BODY_ERRORS_KEY = 'errors'
ERROR_TAG = 'Error'
ERROR_MAX_MSG = f"User input Error. Maximum {N_TEAMS_MAX} teams and {N_MEMBERS_MAX} members for team. " \
f"Values mu... | 0 | 0 | 0 |