hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c0cfa3220f1e2d6d3535712a373a68586b0c0d5 | 1,889 | py | Python | src/anyconfig/__init__.py | Terrance-forks/python-anyconfig | 21d7c0e30287569b394972557b5a54fab03bcd5c | [
"MIT"
] | 213 | 2015-01-14T22:09:20.000Z | 2022-02-02T17:23:41.000Z | src/anyconfig/__init__.py | Terrance-forks/python-anyconfig | 21d7c0e30287569b394972557b5a54fab03bcd5c | [
"MIT"
] | 120 | 2015-03-13T15:47:43.000Z | 2022-03-31T01:55:34.000Z | src/anyconfig/__init__.py | Terrance-forks/python-anyconfig | 21d7c0e30287569b394972557b5a54fab03bcd5c | [
"MIT"
] | 34 | 2015-01-12T05:03:30.000Z | 2021-09-09T14:40:56.000Z | #
# Copyright (C) 2012 - 2021 Satoru SATOH <satoru.satoh@gmail.com>
# SPDX-License-Identifier: MIT
#
# For 'anyconfig.open':
# pylint: disable=redefined-builtin
r"""
.. module:: anyconfig
:platform: Unix, Windows
:synopsis: Generic interface to loaders for various config file formats.
python-anyconfig is a `MIT ... | 30.467742 | 79 | 0.718899 | from .api import (
dump, dumps, single_load, multi_load, load, loads,
open, version,
UnknownFileTypeError, UnknownParserTypeError,
UnknownProcessorTypeError, ValidationError,
MS_REPLACE, MS_NO_REPLACE, MS_DICTS, MS_DICTS_AND_LISTS, MERGE_STRATEGIES,
merge, get, set_,
load_plugins, list_types... | true | true |
1c0cfb1b02a5c0c0b6f758817b673935f9c2fd0d | 1,066 | py | Python | court_scraper/sites_meta.py | gitter-badger/court-scraper | f89b86d07d39d99c8c123717227fbc773d4933c3 | [
"0BSD"
] | 30 | 2020-09-08T23:59:34.000Z | 2022-03-24T03:02:47.000Z | court_scraper/sites_meta.py | gitter-badger/court-scraper | f89b86d07d39d99c8c123717227fbc773d4933c3 | [
"0BSD"
] | 111 | 2020-09-16T23:42:40.000Z | 2022-02-19T01:25:55.000Z | court_scraper/sites_meta.py | gitter-badger/court-scraper | f89b86d07d39d99c8c123717227fbc773d4933c3 | [
"0BSD"
] | 9 | 2020-10-05T13:19:03.000Z | 2021-12-11T12:12:13.000Z | import csv
import io
import pkgutil
class SitesMeta:
def __init__(self):
self.data = self._get_sites_data()
def get(self, place_id):
state = place_id[:2]
county = place_id[3:].replace('_', ' ')
key = (state, county)
return self.data[key]
def get_url(self, state=N... | 24.790698 | 47 | 0.515947 | import csv
import io
import pkgutil
class SitesMeta:
def __init__(self):
self.data = self._get_sites_data()
def get(self, place_id):
state = place_id[:2]
county = place_id[3:].replace('_', ' ')
key = (state, county)
return self.data[key]
def get_url(self, state=N... | true | true |
1c0cfb7f0199bc7433ce8d4aafe4262f0bb53a00 | 12,388 | py | Python | back of PSSM/PSSM/index # back of short save.py | lidongyv/PSSM | 61ef78bc465fd53fb128d0aa1b913f787c8c7f74 | [
"Apache-2.0"
] | null | null | null | back of PSSM/PSSM/index # back of short save.py | lidongyv/PSSM | 61ef78bc465fd53fb128d0aa1b913f787c8c7f74 | [
"Apache-2.0"
] | null | null | null | back of PSSM/PSSM/index # back of short save.py | lidongyv/PSSM | 61ef78bc465fd53fb128d0aa1b913f787c8c7f74 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# @Author: yulidong
# @Date: 2018-08-31 17:25:26
# @Last Modified by: yulidong
# @Last Modified time: 2018-09-03 23:33:51
import torch
import numpy as np
import os
import time
import matplotlib.pyplot as plt
from multiprocessing import Process,Lock
from multiprocessing import Pool
thread_num... | 40.616393 | 136 | 0.572328 | import torch
import numpy as np
import os
import time
import matplotlib.pyplot as plt
from multiprocessing import Process,Lock
from multiprocessing import Pool
thread_num=10
def crop(object):
ground=np.array((object==1).nonzero())
x1=np.min(ground[0,:])
x2=np.max(ground[0,:])
y1=np.min(ground[1,:])
... | true | true |
1c0cfbd85b2671e37025b3dcd38feb458dd44530 | 6,588 | py | Python | class_pack/database.py | fiorentinogiuseppe/ClassPack | 64dc6a93456569145f0fc1846b4f8b12e6db1232 | [
"MIT"
] | null | null | null | class_pack/database.py | fiorentinogiuseppe/ClassPack | 64dc6a93456569145f0fc1846b4f8b12e6db1232 | [
"MIT"
] | null | null | null | class_pack/database.py | fiorentinogiuseppe/ClassPack | 64dc6a93456569145f0fc1846b4f8b12e6db1232 | [
"MIT"
] | null | null | null | from hashlib import sha256
from random import random
from time import time
from cloudant.client import CouchDB
from flask import g, request
DB_SOL_NAME = 'classpack'
DB_USR_NAME = 'users'
DB_PRB_NAME = 'problems'
__DB_USERNAME = None
__DB_PASSWORD = None
__DB_ADDRESS = None
def init_db(config, app):
global __D... | 23.783394 | 86 | 0.585155 | from hashlib import sha256
from random import random
from time import time
from cloudant.client import CouchDB
from flask import g, request
DB_SOL_NAME = 'classpack'
DB_USR_NAME = 'users'
DB_PRB_NAME = 'problems'
__DB_USERNAME = None
__DB_PASSWORD = None
__DB_ADDRESS = None
def init_db(config, app):
global __D... | true | true |
1c0cfbde7389926835c3786d37ce37ae3586fb7d | 4,183 | py | Python | wallstreet/blackandscholes.py | Mr-Elysium/wallstreet | 621c2dd966baf1b062ae0af197e0119ae8b6c1f8 | [
"MIT"
] | 835 | 2016-01-25T14:23:50.000Z | 2022-03-30T17:03:21.000Z | wallstreet/blackandscholes.py | Mr-Elysium/wallstreet | 621c2dd966baf1b062ae0af197e0119ae8b6c1f8 | [
"MIT"
] | 38 | 2016-07-04T20:38:01.000Z | 2022-03-10T18:58:20.000Z | wallstreet/blackandscholes.py | Mr-Elysium/wallstreet | 621c2dd966baf1b062ae0af197e0119ae8b6c1f8 | [
"MIT"
] | 173 | 2016-01-25T16:51:14.000Z | 2022-03-27T20:28:48.000Z | import requests
from bs4 import BeautifulSoup
from scipy.interpolate import interp1d
from scipy import sqrt, log, exp
from scipy.stats import norm
from scipy.optimize import fsolve
from wallstreet.constants import *
def riskfree():
try:
r = requests.get(TREASURY_URL)
soup = BeautifulSoup(r.text,... | 38.027273 | 123 | 0.573034 | import requests
from bs4 import BeautifulSoup
from scipy.interpolate import interp1d
from scipy import sqrt, log, exp
from scipy.stats import norm
from scipy.optimize import fsolve
from wallstreet.constants import *
def riskfree():
try:
r = requests.get(TREASURY_URL)
soup = BeautifulSoup(r.text,... | true | true |
1c0cfc4441563519694589356578c46b2dd10172 | 12,003 | py | Python | Lib/fontbakery/profiles/shared_conditions.py | yanone/fontbakery | a7b30854019b897b6ec948176f0a0854bae2e08b | [
"Apache-2.0"
] | 1 | 2017-09-23T12:07:50.000Z | 2017-09-23T12:07:50.000Z | Lib/fontbakery/profiles/shared_conditions.py | yanone/fontbakery | a7b30854019b897b6ec948176f0a0854bae2e08b | [
"Apache-2.0"
] | 1 | 2019-01-18T03:31:49.000Z | 2019-01-18T03:31:49.000Z | Lib/fontbakery/profiles/shared_conditions.py | madig/fontbakery | 0d341b76f28c49ef9c92bb847bfd0fd40637eca1 | [
"Apache-2.0"
] | 2 | 2016-09-07T00:27:51.000Z | 2017-09-23T12:08:39.000Z | import os
from typing import List
from collections import Counter
from fontbakery.callable import condition
# used to inform get_module_profile whether and how to create a profile
from fontbakery.fonts_profile import profile_factory # NOQA pylint: disable=unused-import,cyclic-import
@condition
def ttFont(font):
... | 30.387342 | 103 | 0.627343 | import os
from typing import List
from collections import Counter
from fontbakery.callable import condition
from fontbakery.fonts_profile import profile_factory
@condition
def ttFont(font):
from fontTools.ttLib import TTFont
return TTFont(font)
@condition
def is_ttf(ttFont):
return 'glyf' in ttFont
@... | true | true |
1c0cfc8b9f0bff0deba9a32b1cdb2f1110e52826 | 984 | py | Python | demo/__main__.py | MaxChangInnodisk/itao | b0745eb48bf67718ef00db566c4cc19896d903a7 | [
"MIT"
] | null | null | null | demo/__main__.py | MaxChangInnodisk/itao | b0745eb48bf67718ef00db566c4cc19896d903a7 | [
"MIT"
] | null | null | null | demo/__main__.py | MaxChangInnodisk/itao | b0745eb48bf67718ef00db566c4cc19896d903a7 | [
"MIT"
] | null | null | null | #!/usr/bin/python3
# -*- coding: utf-8 -*-
from PyQt5 import QtWidgets
import sys
import argparse
from qt_tabs import Tab1, Tab2, Tab3, Tab4
class UI(Tab1, Tab2, Tab3, Tab4):
def __init__(self, debug=False, debug_page=None, debug_opt=None, is_docker=False):
super(UI, self).__init__() # Call the inherited ... | 30.75 | 92 | 0.661585 | from PyQt5 import QtWidgets
import sys
import argparse
from qt_tabs import Tab1, Tab2, Tab3, Tab4
class UI(Tab1, Tab2, Tab3, Tab4):
def __init__(self, debug=False, debug_page=None, debug_opt=None, is_docker=False):
super(UI, self).__init__()
if __name__ == '__main__':
app = QtWidgets.QApplication([]... | true | true |
1c0d0048418b4d8569dbedb0af3dbd457269a4bf | 975 | py | Python | mask/parse/filters/simple/enum_filter.py | Eastwu5788/Mask | 6df8d6c26ec095e6c6c78101087c452e7bc713df | [
"MIT"
] | 38 | 2021-06-23T05:28:35.000Z | 2021-12-15T08:29:43.000Z | mask/parse/filters/simple/enum_filter.py | Eastwu5788/Mask | 6df8d6c26ec095e6c6c78101087c452e7bc713df | [
"MIT"
] | null | null | null | mask/parse/filters/simple/enum_filter.py | Eastwu5788/Mask | 6df8d6c26ec095e6c6c78101087c452e7bc713df | [
"MIT"
] | 1 | 2021-06-23T05:19:20.000Z | 2021-06-23T05:19:20.000Z | # !/usr/local/python/bin/python
# -*- coding: utf-8 -*-
# (C) Wu Dong, 2019
# All rights reserved
# @Author: 'Wu Dong <wudong@eastwu.cn>'
# @Time: '2020-03-17 15:44'
from mask.parse.exception import ParamsValueError
from mask.parse.filters.base import BaseFilter
class EnumFilter(BaseFilter):
"""枚举过滤器"""
erro... | 25 | 95 | 0.615385 | from mask.parse.exception import ParamsValueError
from mask.parse.filters.base import BaseFilter
class EnumFilter(BaseFilter):
error_code = 563
def fmt_error_message(self, _):
return "%s field value can only be the following %s!" % (self.key, str(self.rule.enum))
def filter_required(self):
... | true | true |
1c0d01007b49b3641889c544cd9bf86f8095c9fd | 76,470 | py | Python | salt/modules/state.py | jflowers84/salt | cbe1cfa4d94b1b39679f5b8a06335675152ef80e | [
"Apache-2.0",
"MIT"
] | 12 | 2015-01-21T00:18:25.000Z | 2021-07-11T07:35:26.000Z | salt/modules/state.py | jflowers84/salt | cbe1cfa4d94b1b39679f5b8a06335675152ef80e | [
"Apache-2.0",
"MIT"
] | 1 | 2015-02-23T19:37:47.000Z | 2015-02-23T19:37:47.000Z | salt/modules/state.py | jflowers84/salt | cbe1cfa4d94b1b39679f5b8a06335675152ef80e | [
"Apache-2.0",
"MIT"
] | 12 | 2015-01-05T09:50:42.000Z | 2019-08-19T01:43:40.000Z | # -*- coding: utf-8 -*-
'''
Control the state system on the minion.
State Caching
-------------
When a highstate is called, the minion automatically caches a copy of the last
high data. If you then run a highstate with cache=True it will use that cached
highdata and won't hit the fileserver except for ``salt://`` lin... | 32.457555 | 108 | 0.601138 |
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import shutil
import sys
import tarfile
import tempfile
import time
import salt.config
import salt.payload
import salt.state
import salt.utils.args
import salt.utils.data
import salt.utils.event
import salt.utils.files
i... | true | true |
1c0d01114b5832365c690e93ecfd05c2281ee918 | 4,291 | py | Python | turtle_shell.py | Yuqian-Shi/1 | af242aa8ed882078b271acb6e7ac98707ace38d9 | [
"Apache-2.0"
] | null | null | null | turtle_shell.py | Yuqian-Shi/1 | af242aa8ed882078b271acb6e7ac98707ace38d9 | [
"Apache-2.0"
] | null | null | null | turtle_shell.py | Yuqian-Shi/1 | af242aa8ed882078b271acb6e7ac98707ace38d9 | [
"Apache-2.0"
] | null | null | null | # Turtle-shell program
# fill the picture with given pattern
# Author: Yuqian Shi
# ====================================
# Approach:
# All pixels can be divided into three groups: background, line and
# cross points.
# The cross points (point) were separated into two types: A and B,
# depending on which side the horizo... | 29.190476 | 79 | 0.591471 |
import PIL.Image as pim
def list2tuple(l):
l = [int(x) for x in l]
return tuple(l)
def drawL(pos, dire):
for i in range(3):
try:
pos = ( pos[0]W+ dire[0], pos[1] + dire[1])
img.putpixel((pos[0], pos[1]), l_c)
except:
pass
if pos[0] < width and p... | false | true |
1c0d016a791739564180bd9d6f5215f7e31a1a25 | 287 | py | Python | ds-exponential-growth.py | RachidStat/PyCX | a1a597e61d03b25cf138dd11ab136db8202e1243 | [
"BSD-2-Clause-FreeBSD"
] | 176 | 2019-12-18T11:44:28.000Z | 2022-03-27T09:09:33.000Z | ds-exponential-growth.py | RachidStat/PyCX | a1a597e61d03b25cf138dd11ab136db8202e1243 | [
"BSD-2-Clause-FreeBSD"
] | 2 | 2020-03-29T00:51:25.000Z | 2020-07-19T11:08:32.000Z | ds-exponential-growth.py | RachidStat/PyCX | a1a597e61d03b25cf138dd11ab136db8202e1243 | [
"BSD-2-Clause-FreeBSD"
] | 56 | 2019-12-18T19:04:12.000Z | 2022-03-22T09:35:33.000Z | from pylab import *
a = 1.1
def initialize():
global x, result
x = 1.
result = [x]
def observe():
global x, result
result.append(x)
def update():
global x, result
x = a * x
initialize()
for t in range(30):
update()
observe()
plot(result)
show()
| 11.48 | 20 | 0.571429 | from pylab import *
a = 1.1
def initialize():
global x, result
x = 1.
result = [x]
def observe():
global x, result
result.append(x)
def update():
global x, result
x = a * x
initialize()
for t in range(30):
update()
observe()
plot(result)
show()
| true | true |
1c0d02202c79b8fc710422118f3a1384658d3f80 | 132 | py | Python | tests/roots/test-ext-autosummary-recursive/conf.py | samdoran/sphinx | 4c91c038b220d07bbdfe0c1680af42fe897f342c | [
"BSD-2-Clause"
] | 4,973 | 2015-01-03T15:44:00.000Z | 2022-03-31T03:11:51.000Z | tests/roots/test-ext-autosummary-recursive/conf.py | samdoran/sphinx | 4c91c038b220d07bbdfe0c1680af42fe897f342c | [
"BSD-2-Clause"
] | 7,850 | 2015-01-02T08:09:25.000Z | 2022-03-31T18:57:40.000Z | tests/roots/test-ext-autosummary-recursive/conf.py | samdoran/sphinx | 4c91c038b220d07bbdfe0c1680af42fe897f342c | [
"BSD-2-Clause"
] | 2,179 | 2015-01-03T15:26:53.000Z | 2022-03-31T12:22:44.000Z | import os
import sys
sys.path.insert(0, os.path.abspath('.'))
extensions = ['sphinx.ext.autosummary']
autosummary_generate = True
| 16.5 | 40 | 0.742424 | import os
import sys
sys.path.insert(0, os.path.abspath('.'))
extensions = ['sphinx.ext.autosummary']
autosummary_generate = True
| true | true |
1c0d022f5eafdd3f3401b32a8ec0f65ae8ad5ab8 | 2,046 | py | Python | src/tasks/harvest.py | gaybro8777/lr-data | 659f620426e6218b09ece21ba5b2939a6de06a60 | [
"Apache-2.0"
] | null | null | null | src/tasks/harvest.py | gaybro8777/lr-data | 659f620426e6218b09ece21ba5b2939a6de06a60 | [
"Apache-2.0"
] | null | null | null | src/tasks/harvest.py | gaybro8777/lr-data | 659f620426e6218b09ece21ba5b2939a6de06a60 | [
"Apache-2.0"
] | 1 | 2019-01-30T04:51:36.000Z | 2019-01-30T04:51:36.000Z | import json
import urllib2
import urllib
import urlparse
import redis
import os
from datetime import datetime
from celery.task import task
from celery.execute import send_task
from celery.log import get_default_logger
log = get_default_logger()
@task
def startHarvest(config):
lrUrl = config['lrUrl']
r = redis.S... | 35.894737 | 112 | 0.531769 | import json
import urllib2
import urllib
import urlparse
import redis
import os
from datetime import datetime
from celery.task import task
from celery.execute import send_task
from celery.log import get_default_logger
log = get_default_logger()
@task
def startHarvest(config):
lrUrl = config['lrUrl']
r = redis.S... | true | true |
1c0d0283f3372b13f38bf1f446b625226e89a9bf | 30,223 | py | Python | BU/qtile_toc/config.py | ToCarbajal/DotFiles | 59d353414bef452b1a22b173d01e6bfe89b01378 | [
"MIT"
] | null | null | null | BU/qtile_toc/config.py | ToCarbajal/DotFiles | 59d353414bef452b1a22b173d01e6bfe89b01378 | [
"MIT"
] | null | null | null | BU/qtile_toc/config.py | ToCarbajal/DotFiles | 59d353414bef452b1a22b173d01e6bfe89b01378 | [
"MIT"
] | null | null | null | # Copyright (c) 2010 Aldo Cortesi
# Copyright (c) 2010, 2014 dequis
# Copyright (c) 2012 Randall Ma
# Copyright (c) 2012-2014 Tycho Andersen
# Copyright (c) 2012 Craig Barnes
# Copyright (c) 2013 horsik
# Copyright (c) 2013 Tao Sauvage
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# o... | 35.348538 | 143 | 0.475863 |
import os
import re
import socket
import subprocess
from typing import List from libqtile import layout, bar, widget, hook
from libqtile.config import Click, Drag, Group, Key, Match, Screen, Rule
from libqtile.command import lazy
from libqtile.widget import Spacer
import arcobattery
from qtile_extras import widget
... | true | true |
1c0d032ee9bbb219b529f2179934ca5608fda972 | 9,877 | py | Python | docs/conf.py | hmaarrfk/zarr-python | 5bf61efc533c880d6b991eb2eec1cf147e6d5e61 | [
"MIT"
] | null | null | null | docs/conf.py | hmaarrfk/zarr-python | 5bf61efc533c880d6b991eb2eec1cf147e6d5e61 | [
"MIT"
] | null | null | null | docs/conf.py | hmaarrfk/zarr-python | 5bf61efc533c880d6b991eb2eec1cf147e6d5e61 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# zarr documentation build configuration file, created by
# sphinx-quickstart on Mon May 2 21:40:09 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... | 31.86129 | 80 | 0.718943 |
import os
import sys
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
import zarr
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# d... | true | true |
1c0d037d22e7d9f486d55bcf1051cbe7e8be0295 | 3,340 | py | Python | CGAT/Motifs.py | 861934367/cgat | 77fdc2f819320110ed56b5b61968468f73dfc5cb | [
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | CGAT/Motifs.py | 861934367/cgat | 77fdc2f819320110ed56b5b61968468f73dfc5cb | [
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | CGAT/Motifs.py | 861934367/cgat | 77fdc2f819320110ed56b5b61968468f73dfc5cb | [
"BSD-2-Clause",
"BSD-3-Clause"
] | 1 | 2019-08-04T22:46:38.000Z | 2019-08-04T22:46:38.000Z | ##########################################################################
#
# MRC FGU Computational Genomics Group
#
# $Id$
#
# Copyright (C) 2009 Andreas Heger
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by ... | 25.112782 | 79 | 0.541916 | import collections
from CGAT import Genomics as Genomics
from CGAT import FastaIterator as FastaIterator
def countMotifs(infile, motifs):
it = FastaIterator.FastaIterator(infile)
positions = []
while 1:
try:
seq = it.next()
except StopIteration:
break
if no... | true | true |
1c0d03bf60495a660121b4548a345d717866dbed | 34 | py | Python | src/agent/utils/OUNoise.py | Lukeeeeee/AlphaDriver | 93635f5c22f8d1c9d1fca41328565f2c1e2f98ab | [
"MIT"
] | null | null | null | src/agent/utils/OUNoise.py | Lukeeeeee/AlphaDriver | 93635f5c22f8d1c9d1fca41328565f2c1e2f98ab | [
"MIT"
] | null | null | null | src/agent/utils/OUNoise.py | Lukeeeeee/AlphaDriver | 93635f5c22f8d1c9d1fca41328565f2c1e2f98ab | [
"MIT"
] | null | null | null |
class OUNoise(object):
pass
| 6.8 | 22 | 0.647059 |
class OUNoise(object):
pass
| true | true |
1c0d04dd9cf8dffa7d1915ebe3a35edfdbe95cf0 | 16,190 | py | Python | platformio/managers/lib.py | pfeerick/platformio-core | a504a13fa8a66c307f8573623ec893776ad9ad9a | [
"Apache-2.0"
] | null | null | null | platformio/managers/lib.py | pfeerick/platformio-core | a504a13fa8a66c307f8573623ec893776ad9ad9a | [
"Apache-2.0"
] | null | null | null | platformio/managers/lib.py | pfeerick/platformio-core | a504a13fa8a66c307f8573623ec893776ad9ad9a | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 37.651163 | 79 | 0.509574 |
import json
import re
from glob import glob
from os.path import isdir, join
import click
from platformio import app, commands, exception, util
from platformio.compat import glob_escape, string_types
from platformio.managers.package import BasePkgManager
from platformio.managers.platform import PlatformFactory, Plat... | true | true |
1c0d05c966112d72c5d2efdac909f177b8404ac7 | 2,417 | py | Python | proofingBox.py | krunpli/proofingBox | 43f9f7110a6dab592f7eb3a916d2ea3db59bad8e | [
"MIT"
] | 1 | 2021-11-28T21:24:34.000Z | 2021-11-28T21:24:34.000Z | proofingBox.py | krunpli/proofingBox | 43f9f7110a6dab592f7eb3a916d2ea3db59bad8e | [
"MIT"
] | null | null | null | proofingBox.py | krunpli/proofingBox | 43f9f7110a6dab592f7eb3a916d2ea3db59bad8e | [
"MIT"
] | null | null | null | # encoding: utf-8
from OmegaExpansion import oledExp
import math, time, os
## initialisation
print('Starting the program proofingBox...')
# initialisation the oled expansion
lcd = oledExp.driverInit()
if lcd != 0:
print('Error initalizing OLED Expansion')
# set verbosity
oledExp.setVerbosity(0)
# set the brightnes... | 26.56044 | 101 | 0.710385 | from OmegaExpansion import oledExp
import math, time, os
print('Starting the program proofingBox...')
lcd = oledExp.driverInit()
if lcd != 0:
print('Error initalizing OLED Expansion')
oledExp.setVerbosity(0)
lcd = oledExp.setBrightness(127)
if lcd != 0:
print('Error setting the brightness for the OLED Expansi... | false | true |
1c0d0650c788e6200cc30aa8f3ae946ce4de9c56 | 24,874 | py | Python | src/sage/geometry/linear_expression.py | vbraun/sage | 07d6c37d18811e2b377a9689790a7c5e24da16ba | [
"BSL-1.0"
] | 3 | 2016-06-19T14:48:31.000Z | 2022-01-28T08:46:01.000Z | src/sage/geometry/linear_expression.py | vbraun/sage | 07d6c37d18811e2b377a9689790a7c5e24da16ba | [
"BSL-1.0"
] | null | null | null | src/sage/geometry/linear_expression.py | vbraun/sage | 07d6c37d18811e2b377a9689790a7c5e24da16ba | [
"BSL-1.0"
] | 7 | 2021-11-08T10:01:59.000Z | 2022-03-03T11:25:52.000Z | """
Linear Expressions
A linear expression is just a linear polynomial in some (fixed)
variables (allowing a nonzero constant term). This class only implements
linear expressions for others to use.
EXAMPLES::
sage: from sage.geometry.linear_expression import LinearExpressionModule
sage: L.<x,y,z> = LinearExp... | 31.131414 | 124 | 0.534856 | from six.moves import zip
from sage.structure.parent import Parent
from sage.structure.richcmp import richcmp
from sage.structure.element import ModuleElement
from sage.structure.unique_representation import UniqueRepresentation
from sage.misc.cachefunc import cached_method
class LinearExpression(ModuleElement):
... | true | true |
1c0d06a9f0015eef7fff727a3e183d9df9b88a3a | 13,429 | py | Python | strings/sort.py | gaosanyong/algorithms | 09987f7b58648bfeeff3315f35b51e6e6fa5d072 | [
"MIT"
] | 3 | 2021-03-27T07:54:16.000Z | 2021-11-13T13:21:44.000Z | strings/sort.py | gaosanyong/algorithms | 09987f7b58648bfeeff3315f35b51e6e6fa5d072 | [
"MIT"
] | null | null | null | strings/sort.py | gaosanyong/algorithms | 09987f7b58648bfeeff3315f35b51e6e6fa5d072 | [
"MIT"
] | 2 | 2021-05-31T18:20:36.000Z | 2021-10-31T04:22:49.000Z | """STRING SORT
STRING -- sequence of characters
C : 7-bit ASCII (letters|numbers|punctuations)
unicode : 16-bit unsigned integer
unicode 3.0 : 21-bit unsigned integer
Java : immutable sequence of characters
Python : immutable sequence of characters
sublinear time
"""
"""CONSTANTS
name | R() | lgR() ... | 27.350305 | 126 | 0.624097 |
LOWERCASE = "abcdefghijklmnopqrstuvwxyz"
UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
RADIX = 256
def kicount(keys):
n = len(keys)
count = [0] * (RADIX + 1)
for key in keys: count[key+1] += 1
for i in range(RADIX): count[i+1] += count[i]
aux = keys[:]
for key in keys:
aux[count[key]] = key
count[key] += ... | true | true |
1c0d0707b7144afad7d4f957d4a127368025b73f | 2,304 | py | Python | medium/house-robber.py | therealabdi2/LeetcodeQuestions | 4c45ee836482a2c7b59906f7a7a99b5b3fa17317 | [
"MIT"
] | null | null | null | medium/house-robber.py | therealabdi2/LeetcodeQuestions | 4c45ee836482a2c7b59906f7a7a99b5b3fa17317 | [
"MIT"
] | null | null | null | medium/house-robber.py | therealabdi2/LeetcodeQuestions | 4c45ee836482a2c7b59906f7a7a99b5b3fa17317 | [
"MIT"
] | null | null | null | '''
You are a professional robber planning to rob houses along a street.
Each house has a certain amount of money stashed,
the only constraint stopping you from robbing each of them is that
adjacent houses have security systems connected and i
t will automatically contact the police if two adjacent houses were broken i... | 32.914286 | 100 | 0.610677 | from typing import List
class Solution:
def rob(self, nums: List[int]) -> int:
n = len(nums)
if n == 0:
return 0
dp = [0] * n dp[0] = nums[0]
for i in range(1, n):
if i == 1:
dp[i] = max(nums[0], nums[1])
... | true | true |
1c0d084c48525f7a2863227167e235412d9e5e59 | 7,722 | py | Python | ax/early_stopping/strategies/threshold.py | sparks-baird/Ax | 57ba8714902ac218eb87dc2f90090678aa307a43 | [
"MIT"
] | null | null | null | ax/early_stopping/strategies/threshold.py | sparks-baird/Ax | 57ba8714902ac218eb87dc2f90090678aa307a43 | [
"MIT"
] | null | null | null | ax/early_stopping/strategies/threshold.py | sparks-baird/Ax | 57ba8714902ac218eb87dc2f90090678aa307a43 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple
import pandas as pd
from ax.core.experiment impor... | 41.294118 | 88 | 0.643227 |
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple
import pandas as pd
from ax.core.experiment import Experiment
from ax.early_stopping.strategies.base import BaseEarlyStoppingStrategy
from ax.exceptions.core import UnsupportedError
from ax.utils.common.logger import get_logger
from ax.utils.common.ty... | true | true |
1c0d0d44383f2a03f2f9d00c3996f2a193d9a7f8 | 9,474 | py | Python | relaax/common/rlx_message.py | deeplearninc/relaax | a0cf280486dc74dca3857c85ec0e4c34e88d6b2b | [
"MIT"
] | 71 | 2017-01-25T00:26:20.000Z | 2021-02-17T12:39:20.000Z | relaax/common/rlx_message.py | deeplearninc/relaax | a0cf280486dc74dca3857c85ec0e4c34e88d6b2b | [
"MIT"
] | 69 | 2017-01-23T19:29:23.000Z | 2018-08-21T13:26:39.000Z | relaax/common/rlx_message.py | deeplearninc/relaax | a0cf280486dc74dca3857c85ec0e4c34e88d6b2b | [
"MIT"
] | 13 | 2017-01-23T21:18:09.000Z | 2019-01-29T23:48:30.000Z | from builtins import object
import numpy as np
from PIL import Image
from struct import pack, unpack_from
V = True
class RLXMessageImage(object):
def __init__(self, image):
self.image = image
class RLXMessage(object):
# types: https://docs.python.org/3.5/library/struct.html#struct.pack_into
TY... | 34.079137 | 108 | 0.57642 | from builtins import object
import numpy as np
from PIL import Image
from struct import pack, unpack_from
V = True
class RLXMessageImage(object):
def __init__(self, image):
self.image = image
class RLXMessage(object):
TYPE_NONE = 0
TYPE_NULL = 1
TYPE_INT4 = 2
TYPE_STRING_UTF8 = 3
... | true | true |
1c0d0d67d8f93706433f31a41e57b370f3a73cbd | 97 | py | Python | cvtron/trainers/base/BaseTrainer.py | opencollective/CVTron | fd111d734fed4008ba9d04d18c359dbd441a1897 | [
"Apache-2.0"
] | 94 | 2018-03-31T06:32:50.000Z | 2020-09-25T10:19:23.000Z | cvtron/trainers/base/BaseTrainer.py | opencollective/CVTron | fd111d734fed4008ba9d04d18c359dbd441a1897 | [
"Apache-2.0"
] | 98 | 2018-04-02T15:55:25.000Z | 2020-04-06T09:35:36.000Z | cvtron/trainers/base/BaseTrainer.py | opencollective/CVTron | fd111d734fed4008ba9d04d18c359dbd441a1897 | [
"Apache-2.0"
] | 18 | 2018-07-10T22:54:19.000Z | 2021-03-23T05:17:39.000Z | class BaseTrainer(object):
def __init__(self):
pass
def start(self):
pass | 19.4 | 26 | 0.587629 | class BaseTrainer(object):
def __init__(self):
pass
def start(self):
pass | true | true |
1c0d0eaebd70ee35f08cff8fdf8bcb424187f71a | 1,009 | py | Python | c7n/resources/gamelift.py | dnouri/cloud-custodian | 4e8b3b45f60731df942ffe6b61645416d7a67daa | [
"Apache-2.0"
] | 1 | 2020-09-07T21:10:29.000Z | 2020-09-07T21:10:29.000Z | c7n/resources/gamelift.py | dnouri/cloud-custodian | 4e8b3b45f60731df942ffe6b61645416d7a67daa | [
"Apache-2.0"
] | 1 | 2021-02-10T02:20:45.000Z | 2021-02-10T02:20:45.000Z | c7n/resources/gamelift.py | dnouri/cloud-custodian | 4e8b3b45f60731df942ffe6b61645416d7a67daa | [
"Apache-2.0"
] | 1 | 2021-05-02T01:49:36.000Z | 2021-05-02T01:49:36.000Z | # Copyright 2016-2017 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from c7n.manager import resources
from c7n.query import QueryResourceManager, TypeInfo
@resources.register('gamelift-build')
class GameLiftBuild(QueryResourceManager):
class resource_typ... | 29.676471 | 83 | 0.655104 | from c7n.manager import resources
from c7n.query import QueryResourceManager, TypeInfo
@resources.register('gamelift-build')
class GameLiftBuild(QueryResourceManager):
class resource_type(TypeInfo):
service = 'gamelift'
enum_spec = ('list_builds', 'Builds', None)
id = 'BuildId'
na... | true | true |
1c0d0edef866c3a870cefadfdf2890aa3a116efd | 2,788 | py | Python | Initial Testing/RLC Test.py | MrAttoAttoAtto/CircuitSimulatorC2 | 4d821c86404fe3271363fd8c1438e4ca29c17a13 | [
"MIT"
] | 2 | 2020-02-25T14:46:19.000Z | 2020-06-25T07:58:33.000Z | Initial Testing/RLC Test.py | MrAttoAttoAtto/CircuitSimulatorC2 | 4d821c86404fe3271363fd8c1438e4ca29c17a13 | [
"MIT"
] | null | null | null | Initial Testing/RLC Test.py | MrAttoAttoAtto/CircuitSimulatorC2 | 4d821c86404fe3271363fd8c1438e4ca29c17a13 | [
"MIT"
] | null | null | null |
import math
import subprocess
import time
from copy import deepcopy
import matplotlib.pyplot as plt
import numpy as np
import scipy.linalg
# Initial guess
input_vec = [3, 0, 0, 1e-3]
# Resistance in Ohms
R = 30
# Capacitance in Farads
C = 2e-6
# Inductance in Henrys
L = 20e-3
# Initial current
I_0 = 0
# Freque... | 24.034483 | 173 | 0.586083 |
import math
import subprocess
import time
from copy import deepcopy
import matplotlib.pyplot as plt
import numpy as np
import scipy.linalg
input_vec = [3, 0, 0, 1e-3]
R = 30
C = 2e-6
L = 20e-3
I_0 = 0
f = 909
Vin_AC_peak = 9*math.sqrt(2)
Vin_DC = 0
sin_multiplier = f*2*math.pi
def get_Vin(t):
return Vi... | true | true |
1c0d0f808232214a3ba0b4c771eb896476257749 | 11,642 | py | Python | tools/update_cc4_includes.py | snowladygirl2013/creativecommons.org | fddb66e0d34ce845bef190860ee5b8870bba868a | [
"MIT"
] | 1 | 2019-10-24T06:18:01.000Z | 2019-10-24T06:18:01.000Z | tools/update_cc4_includes.py | snowladygirl2013/creativecommons.org | fddb66e0d34ce845bef190860ee5b8870bba868a | [
"MIT"
] | null | null | null | tools/update_cc4_includes.py | snowladygirl2013/creativecommons.org | fddb66e0d34ce845bef190860ee5b8870bba868a | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright 2017 Creative Commons
# Written by Affinity Bridge
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | 45.834646 | 133 | 0.581945 |
import re, sys, re, getopt
from pathlib import Path
class UpdateLicenseCode(object):
placeholders = {\
'head': ('<!-- Head Start - DO NOT DELETE -->', '<!-- Head End - DO NOT DELETE -->'), \
'header': ('<!-- Site Header Start - DO NOT DELETE -->', '<!-- Site Header End - DO NOT DELETE -->'), \
... | true | true |
1c0d1004677e39a03005cfb8dc0fd52b57ef4156 | 625 | py | Python | var/spack/repos/builtin/packages/py-clipboard/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 11 | 2015-10-04T02:17:46.000Z | 2018-02-07T18:23:00.000Z | var/spack/repos/builtin/packages/py-clipboard/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 22 | 2017-08-01T22:45:10.000Z | 2022-03-10T07:46:31.000Z | var/spack/repos/builtin/packages/py-clipboard/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 4 | 2016-06-10T17:57:39.000Z | 2018-09-11T04:59:38.000Z | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyClipboard(PythonPackage):
"""A cross platform clipboard operation library of Python."""
... | 32.894737 | 95 | 0.736 |
from spack import *
class PyClipboard(PythonPackage):
homepage = "https://github.com/terryyin/clipboard"
pypi = "clipboard/clipboard-0.0.4.tar.gz"
version('0.0.4', sha256='a72a78e9c9bf68da1c3f29ee022417d13ec9e3824b511559fd2b702b1dd5b817')
depends_on('py-setuptools', type='build')
depends_on('p... | true | true |
1c0d12cca9f1dd2b5467e358774640237b3211c1 | 1,699 | py | Python | data/cirq_new/cirq_program/startCirq_Class68.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/cirq_new/cirq_program/startCirq_Class68.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/cirq_new/cirq_program/startCirq_Class68.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=10
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
def make_circuit(n: int, input_qubit):
c = cirq.Ci... | 27.403226 | 80 | 0.666863 |
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
def make_circuit(n: int, input_qubit):
c = cirq.Circuit()
c.append(cirq.H.on(input_qubit[0])) c.append(cirq.H.on(input_qubit[1])) c.append(cirq.H.on(input_qubit[1])) c.append(ci... | true | true |
1c0d12ccb72720bc05e914b0fc5142ea8a82a431 | 1,392 | py | Python | tests/test_visitors/test_ast/test_classes/test_base_classes/test_expression_base_class.py | sourya/wemake-python-styleguide | 313a11a62fac2fb2067252db4e6a6530e070e382 | [
"MIT"
] | null | null | null | tests/test_visitors/test_ast/test_classes/test_base_classes/test_expression_base_class.py | sourya/wemake-python-styleguide | 313a11a62fac2fb2067252db4e6a6530e070e382 | [
"MIT"
] | null | null | null | tests/test_visitors/test_ast/test_classes/test_base_classes/test_expression_base_class.py | sourya/wemake-python-styleguide | 313a11a62fac2fb2067252db4e6a6530e070e382 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.oop import WrongBaseClassViolation
from wemake_python_styleguide.visitors.ast.classes import WrongClassVisitor
class_with_base = """
class Meta({0}):
'''Docs.'''
"""
@pytest.mark.parametrize('base', [
'(lambda: object)()',
'... | 22.819672 | 78 | 0.677443 |
import pytest
from wemake_python_styleguide.violations.oop import WrongBaseClassViolation
from wemake_python_styleguide.visitors.ast.classes import WrongClassVisitor
class_with_base = """
class Meta({0}):
'''Docs.'''
"""
@pytest.mark.parametrize('base', [
'(lambda: object)()',
'method.call()',
'-Na... | true | true |
1c0d13013e3dc0308426860e9ba57d1d248981d4 | 544 | py | Python | tests/test_data.py | hexatester/covid19-id | 8d8aa3f9092a40461a308f4db054ab4f95374849 | [
"MIT"
] | null | null | null | tests/test_data.py | hexatester/covid19-id | 8d8aa3f9092a40461a308f4db054ab4f95374849 | [
"MIT"
] | null | null | null | tests/test_data.py | hexatester/covid19-id | 8d8aa3f9092a40461a308f4db054ab4f95374849 | [
"MIT"
] | null | null | null | from datetime import date
from covid19_id import get_data
from covid19_id.data import Data
from covid19_id.data import Kasus
from covid19_id.data import Sembuh
from covid19_id.data import Meninggal
from covid19_id.data import Perawatan
def test_get_data():
data = get_data()
assert isinstance(data, Data)
... | 28.631579 | 48 | 0.786765 | from datetime import date
from covid19_id import get_data
from covid19_id.data import Data
from covid19_id.data import Kasus
from covid19_id.data import Sembuh
from covid19_id.data import Meninggal
from covid19_id.data import Perawatan
def test_get_data():
data = get_data()
assert isinstance(data, Data)
... | true | true |
1c0d13390aa12cb37b8c5ab4006fee4e2373bec8 | 2,255 | py | Python | src/mbed_cloud/_backends/update_service/__init__.py | GQMai/mbed-cloud-sdk-python | 76ef009903415f37f69dcc5778be8f5fb14c08fe | [
"Apache-2.0"
] | 12 | 2017-12-28T11:18:43.000Z | 2020-10-04T12:11:15.000Z | src/mbed_cloud/_backends/update_service/__init__.py | GQMai/mbed-cloud-sdk-python | 76ef009903415f37f69dcc5778be8f5fb14c08fe | [
"Apache-2.0"
] | 50 | 2017-12-21T12:50:41.000Z | 2020-01-13T16:07:08.000Z | src/mbed_cloud/_backends/update_service/__init__.py | GQMai/mbed-cloud-sdk-python | 76ef009903415f37f69dcc5778be8f5fb14c08fe | [
"Apache-2.0"
] | 8 | 2018-04-25T17:47:29.000Z | 2019-08-29T06:38:27.000Z | # coding: utf-8
"""
Update Service API
This is the API documentation for the Device Management deployment service, which is part of the Update service.
OpenAPI spec version: 3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# import ... | 43.365385 | 116 | 0.873614 |
from __future__ import absolute_import
from .models.campaign_device_metadata import CampaignDeviceMetadata
from .models.campaign_device_metadata_page import CampaignDeviceMetadataPage
from .models.campaign_metrics import CampaignMetrics
from .models.error_response import ErrorResponse
from .models.error_response_fi... | true | true |
1c0d13473394185a4fa84634837617471cffbe2a | 16,645 | py | Python | tests/simple_itk_helper_test.py | gift-surg/PySiTK | 6bb9419b9e5ec7c20aab443172b86da69a268b9a | [
"BSD-3-Clause"
] | 4 | 2018-01-25T10:36:14.000Z | 2021-08-06T17:04:23.000Z | tests/simple_itk_helper_test.py | gift-surg/PySiTK | 6bb9419b9e5ec7c20aab443172b86da69a268b9a | [
"BSD-3-Clause"
] | null | null | null | tests/simple_itk_helper_test.py | gift-surg/PySiTK | 6bb9419b9e5ec7c20aab443172b86da69a268b9a | [
"BSD-3-Clause"
] | 4 | 2018-01-25T10:38:18.000Z | 2021-08-06T17:04:26.000Z | # \file simple_itk_helper_test.py
# \brief Class containing unit tests for module SimpleITKHelper
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date December 2015
# Import libraries
import SimpleITK as sitk
import itk
import numpy as np
import unittest
import os
import sys
# Import modules
import pys... | 38.352535 | 80 | 0.681166 |
import SimpleITK as sitk
import itk
import numpy as np
import unittest
import os
import sys
import pysitk.simple_itk_helper as sitkh
from pysitk.definitions import DIR_TEST, DIR_TMP
def get_registration_transform(fixed_sitk,
moving_sitk,
transform_type... | true | true |
1c0d136d6ef7267303ea7ed6d034dda787f439e4 | 40,710 | py | Python | ml3d/torch/models/point_pillars.py | kylevedder/SparsePointPillars | 00d73c9ae5153d3a108fc05c6dface93c5b5ef47 | [
"MIT"
] | 7 | 2021-08-11T02:21:37.000Z | 2022-01-15T19:32:04.000Z | ml3d/torch/models/point_pillars.py | kylevedder/SparsePointPillars | 00d73c9ae5153d3a108fc05c6dface93c5b5ef47 | [
"MIT"
] | null | null | null | ml3d/torch/models/point_pillars.py | kylevedder/SparsePointPillars | 00d73c9ae5153d3a108fc05c6dface93c5b5ef47 | [
"MIT"
] | null | null | null | #***************************************************************************************/
#
# Based on MMDetection3D Library (Apache 2.0 license):
# https://github.com/open-mmlab/mmdetection3d
#
# Copyright 2018-2019 Open-MMLab.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ma... | 38.189493 | 152 | 0.562319 |
import torch
import pickle
import time
from torch import nn
from torch.nn import functional as F
from torch.nn.modules.utils import _pair
from functools import partial
import numpy as np
import os
from open3d.ml.torch.ops import voxelize, ragged_to_dense
from .base_model_objdet import BaseModel
from ...utils impor... | true | true |
1c0d13807f20384c7164a36aeac1e06719e2b43a | 1,313 | py | Python | renku/_compat.py | vigsterkr/renku-python | fb443d752436478a2903c4403ba6c702949b1b59 | [
"Apache-2.0"
] | 2 | 2019-03-09T17:56:57.000Z | 2019-07-03T15:20:22.000Z | renku/_compat.py | vigsterkr/renku-python | fb443d752436478a2903c4403ba6c702949b1b59 | [
"Apache-2.0"
] | null | null | null | renku/_compat.py | vigsterkr/renku-python | fb443d752436478a2903c4403ba6c702949b1b59 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright 2018-2019 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in c... | 29.840909 | 75 | 0.720487 |
import os
import sys
from pathlib import Path
if sys.version_info < (3, 6):
original_resolve = Path.resolve
def resolve(self, strict=False):
if strict:
return original_resolve(self)
return Path(os.path.realpath(os.path.abspath(str(self))))
Path.resolve = resolve
try:
Fil... | true | true |
1c0d14464d8a0cd812edca35fed529a7cf1b044b | 20,012 | py | Python | synthesizer/hparams.py | mgerhards/Real-Time-Voice-Cloning | c7defceed16fc7c3e0798331c740d121e2a76129 | [
"MIT"
] | 158 | 2020-03-12T02:14:54.000Z | 2022-03-13T16:42:06.000Z | synthesizer/hparams.py | mgerhards/Real-Time-Voice-Cloning | c7defceed16fc7c3e0798331c740d121e2a76129 | [
"MIT"
] | 9 | 2020-07-27T21:46:42.000Z | 2022-02-10T02:33:34.000Z | synthesizer/hparams.py | mgerhards/Real-Time-Voice-Cloning | c7defceed16fc7c3e0798331c740d121e2a76129 | [
"MIT"
] | 57 | 2020-02-28T03:28:50.000Z | 2022-02-23T09:23:32.000Z | from tensorflow.contrib.training import HParams
# Default hyperparameters
hparams = HParams(
# Comma-separated list of cleaners to run on text prior to training and eval. For non-English
# text, you may want to use "basic_cleaners" or "transliteration_cleaners".
cleaners="english_cleaners",
# If y... | 56.531073 | 159 | 0.695533 | from tensorflow.contrib.training import HParams
hparams = HParams(
cleaners="english_cleaners",
# resources related decisions.
# Acknowledgement:
# Many thanks to @MlWoo for his... | true | true |
1c0d14d746c4dff942a7de10109873d01083229b | 316 | py | Python | stubs/micropython-v1_9_3-esp8266/ujson.py | mattytrentini/micropython-stubs | 4d596273823b69e9e5bcf5fa67f249c374ee0bbc | [
"MIT"
] | null | null | null | stubs/micropython-v1_9_3-esp8266/ujson.py | mattytrentini/micropython-stubs | 4d596273823b69e9e5bcf5fa67f249c374ee0bbc | [
"MIT"
] | null | null | null | stubs/micropython-v1_9_3-esp8266/ujson.py | mattytrentini/micropython-stubs | 4d596273823b69e9e5bcf5fa67f249c374ee0bbc | [
"MIT"
] | null | null | null | """
Module: 'ujson' on esp8266 v1.9.3
"""
# MCU: (sysname='esp8266', nodename='esp8266', release='2.0.0(5a875ba)', version='v1.9.3-8-g63826ac5c on 2017-11-01', machine='ESP module with ESP8266')
# Stubber: 1.1.2 - updated
from typing import Any
def dumps():
pass
def load():
pass
def loads():
pass
| 16.631579 | 152 | 0.642405 | from typing import Any
def dumps():
pass
def load():
pass
def loads():
pass
| true | true |
1c0d15aab8bf31c070540165d8130ac6bc08bd73 | 552 | py | Python | src/dsalgo_numpy/sieve_of_eratosthenes.py | kagemeka/python-algorithms | dface89b8c618845cf524429aa8e97c4b2b10ceb | [
"MIT"
] | 1 | 2022-02-10T02:13:07.000Z | 2022-02-10T02:13:07.000Z | src/dsalgo_numpy/sieve_of_eratosthenes.py | kagemeka/python-algorithms | dface89b8c618845cf524429aa8e97c4b2b10ceb | [
"MIT"
] | 6 | 2022-01-05T09:15:54.000Z | 2022-01-09T05:48:43.000Z | src/dsalgo_numpy/sieve_of_eratosthenes.py | kagemeka/python-algorithms | dface89b8c618845cf524429aa8e97c4b2b10ceb | [
"MIT"
] | null | null | null | import numpy as np
def least_prime_factor_np(n: int) -> np.ndarray:
s = np.arange(n)
s[:2] = -1
i = 0
while i * i < n - 1:
i += 1
if s[i] == i:
np.minimum(s[i * i :: i], i, out=s[i * i :: i])
return s
def sieve_of_eratosthenes_np(n: int) -> np.ndarray:
return leas... | 19.714286 | 59 | 0.487319 | import numpy as np
def least_prime_factor_np(n: int) -> np.ndarray:
s = np.arange(n)
s[:2] = -1
i = 0
while i * i < n - 1:
i += 1
if s[i] == i:
np.minimum(s[i * i :: i], i, out=s[i * i :: i])
return s
def sieve_of_eratosthenes_np(n: int) -> np.ndarray:
return leas... | true | true |
1c0d164d4b58180fc654fbd72f45b90b620a9a53 | 4,531 | py | Python | _scripts/genus_species_collections.py | soybase/jekyll-legumeinfo | 14e8b73ddd14ff890655b339dd3d8259b1acb4e9 | [
"Apache-2.0"
] | null | null | null | _scripts/genus_species_collections.py | soybase/jekyll-legumeinfo | 14e8b73ddd14ff890655b339dd3d8259b1acb4e9 | [
"Apache-2.0"
] | 2 | 2021-11-30T17:13:31.000Z | 2022-01-17T01:52:30.000Z | _scripts/genus_species_collections.py | soybase/jekyll-legumeinfo | 14e8b73ddd14ff890655b339dd3d8259b1acb4e9 | [
"Apache-2.0"
] | null | null | null | import yaml
import requests
from html.parser import HTMLParser
class CollectionsParser(HTMLParser):
collections = []
# Start tag: a
# attr: ('href', '/data/v2/Arachis/hypogaea/annotations/Fuhuasheng.gnm1.XX5Y/')
# attr: ('href', '/data/v2/Arachis/hypogaea/diversity/Fuhuasheng.gnm1.XX5Y/')
... | 47.694737 | 114 | 0.595895 | import yaml
import requests
from html.parser import HTMLParser
class CollectionsParser(HTMLParser):
collections = []
def handle_starttag(self, tag, attrs):
for attr in attrs:
if ((attr[0]=='href' and "/annotations/" in attr[1])
or (attr[0]=='href'... | true | true |
1c0d1b4f9defd8ee785820223d19aa21f0e3007f | 4,738 | py | Python | chat_command_handler.py | NEUChatbot/new-Module | b1de946a754d39ca7318638af2374b320593c8af | [
"MIT"
] | 1 | 2018-06-08T10:58:12.000Z | 2018-06-08T10:58:12.000Z | chat_command_handler.py | NEUChatbot/new-model | b1de946a754d39ca7318638af2374b320593c8af | [
"MIT"
] | null | null | null | chat_command_handler.py | NEUChatbot/new-model | b1de946a754d39ca7318638af2374b320593c8af | [
"MIT"
] | null | null | null | """
Command handler for chat session
"""
import os
def append_to_chatlog(chatlog_filepath, question, answer):
"""Append a question and answer to the chat log.
Args:
chatlog_filepath: Path to the chat log file
question: the question string entered by the user
answer: the ... | 43.87037 | 140 | 0.651963 | import os
def append_to_chatlog(chatlog_filepath, question, answer):
chatlog_dir = os.path.dirname(chatlog_filepath)
if not os.path.isdir(chatlog_dir):
os.makedirs(chatlog_dir)
with open(chatlog_filepath, "a") as file:
file.write("You: {0}".format(question))
file.write('\n')... | true | true |
1c0d1bf8bdd355f066c8f090a8f2ce28e79f3693 | 2,886 | py | Python | mailing/mail/migrations/0001_initial.py | todd-sudo/mailing | 722827e373a4190698669f5787c2b8619773371d | [
"MIT"
] | null | null | null | mailing/mail/migrations/0001_initial.py | todd-sudo/mailing | 722827e373a4190698669f5787c2b8619773371d | [
"MIT"
] | null | null | null | mailing/mail/migrations/0001_initial.py | todd-sudo/mailing | 722827e373a4190698669f5787c2b8619773371d | [
"MIT"
] | null | null | null | # Generated by Django 3.2.12 on 2022-03-14 14:03
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Client',
fields=[
... | 48.1 | 170 | 0.59806 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Client',
fields=[
('id', models.BigAutoField(auto_created=... | true | true |
1c0d1c3afead3d0ad88c8df108dd49017d1953f9 | 112 | py | Python | authors/apps/authentication/admin.py | andela/ah-backend-odin | 0e9ef1a10c8a3f6736999a5111736f7bd7236689 | [
"BSD-3-Clause"
] | null | null | null | authors/apps/authentication/admin.py | andela/ah-backend-odin | 0e9ef1a10c8a3f6736999a5111736f7bd7236689 | [
"BSD-3-Clause"
] | 43 | 2018-10-25T10:14:52.000Z | 2022-03-11T23:33:46.000Z | authors/apps/authentication/admin.py | andela/ah-backend-odin | 0e9ef1a10c8a3f6736999a5111736f7bd7236689 | [
"BSD-3-Clause"
] | 4 | 2018-10-29T07:04:58.000Z | 2020-04-02T14:15:10.000Z | from django.contrib import admin
from authors.apps.authentication.models import User
admin.site.register(User) | 22.4 | 51 | 0.839286 | from django.contrib import admin
from authors.apps.authentication.models import User
admin.site.register(User) | true | true |
1c0d1c732096ec7f86e66471f87c76f7305efeaf | 2,210 | py | Python | cfripper/rules/s3_public_access.py | Morrolan/cfripper | 4ed32c7fce919e3873317d213595976e60e285f7 | [
"Apache-2.0"
] | null | null | null | cfripper/rules/s3_public_access.py | Morrolan/cfripper | 4ed32c7fce919e3873317d213595976e60e285f7 | [
"Apache-2.0"
] | null | null | null | cfripper/rules/s3_public_access.py | Morrolan/cfripper | 4ed32c7fce919e3873317d213595976e60e285f7 | [
"Apache-2.0"
] | null | null | null | """
Copyright 2018-2019 Skyscanner Ltd
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwar... | 38.103448 | 112 | 0.694118 | import logging
import re
from pycfmodel.model.resources.s3_bucket_policy import S3BucketPolicy
from cfripper.model.enums import RuleRisk
from ..model.enums import RuleMode
from ..model.rule import Rule
logger = logging.getLogger(__file__)
class S3BucketPublicReadAclAndListStatementRule(Rule):
REASON = "S3 Bu... | true | true |
1c0d1eb0a87de5b11a4728c94e56e0fa89791753 | 698 | py | Python | migrations/versions/e4c242d00e2a_.py | chick0/todo | f3d32e5406514a828b1f0ada57d053f765a6f967 | [
"MIT"
] | 1 | 2021-03-20T13:47:58.000Z | 2021-03-20T13:47:58.000Z | migrations/versions/e4c242d00e2a_.py | chick0/todo | f3d32e5406514a828b1f0ada57d053f765a6f967 | [
"MIT"
] | null | null | null | migrations/versions/e4c242d00e2a_.py | chick0/todo | f3d32e5406514a828b1f0ada57d053f765a6f967 | [
"MIT"
] | null | null | null | """empty message
Revision ID: e4c242d00e2a
Revises: 313aad67267d
Create Date: 2021-03-29 15:48:20.506240
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = 'e4c242d00e2a'
down_revision = '313aad67267d'
branch_labels = None
depe... | 24.068966 | 86 | 0.703438 | from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
revision = 'e4c242d00e2a'
down_revision = '313aad67267d'
branch_labels = None
depends_on = None
def upgrade():
op.add_column('member', sa.Column('secret', sa.String(length=32), nullable=False))
def downgrade():
... | true | true |
1c0d1f61d1e8d27ab7eb4bc54b9d3eaab01556ae | 3,194 | py | Python | pyvolt/models/asset.py | Gael-devv/Pyvolt | 1d84ba95f1fd3f959a933051c25f8a3e60500c5d | [
"MIT"
] | null | null | null | pyvolt/models/asset.py | Gael-devv/Pyvolt | 1d84ba95f1fd3f959a933051c25f8a3e60500c5d | [
"MIT"
] | null | null | null | pyvolt/models/asset.py | Gael-devv/Pyvolt | 1d84ba95f1fd3f959a933051c25f8a3e60500c5d | [
"MIT"
] | null | null | null | from __future__ import annotations
import io
import os
from typing import TYPE_CHECKING, Optional, Union
import mimetypes
from ..enums import AssetType
if TYPE_CHECKING:
from ..cache import CacheManager
from ..types.file import File as FilePayload
__all__ = ("Asset",)
class AssetMixin:
url: str
_c... | 26.616667 | 124 | 0.578585 | from __future__ import annotations
import io
import os
from typing import TYPE_CHECKING, Optional, Union
import mimetypes
from ..enums import AssetType
if TYPE_CHECKING:
from ..cache import CacheManager
from ..types.file import File as FilePayload
__all__ = ("Asset",)
class AssetMixin:
url: str
_c... | true | true |
1c0d1f97ca951e508b0f5056ad1edee5d51ce235 | 8,395 | py | Python | media.py | dramoslance/movies | f57274fd6418269296aa2bf3cad10247ec4aa1dd | [
"MIT"
] | null | null | null | media.py | dramoslance/movies | f57274fd6418269296aa2bf3cad10247ec4aa1dd | [
"MIT"
] | null | null | null | media.py | dramoslance/movies | f57274fd6418269296aa2bf3cad10247ec4aa1dd | [
"MIT"
] | null | null | null | import webbrowser
class Movie(object):
"""This class represents movies entity, created to storage all information
related."""
def __init__(self):
""" Inits the movie instance."""
self.data = []
self._visits = 0
@property
def title(self):
"""Gets the title for a mo... | 18.82287 | 78 | 0.515307 | import webbrowser
class Movie(object):
def __init__(self):
self.data = []
self._visits = 0
@property
def title(self):
return self._title
@title.setter
def title(self, value):
self._title = value
@title.deleter
def title(self):
del self._title
... | true | true |
1c0d1fb626d134c9d76b51dfdf346d76ce430fcd | 11,400 | py | Python | cornflow/commands/commands.py | baobabsoluciones/cornflow-server | 704f23be569a95b62c88b598742963d71361781b | [
"MIT"
] | 5 | 2021-11-24T02:43:22.000Z | 2021-12-10T09:28:32.000Z | cornflow/commands/commands.py | baobabsoluciones/cornflow-server | 704f23be569a95b62c88b598742963d71361781b | [
"MIT"
] | 125 | 2021-09-01T12:06:48.000Z | 2022-03-30T11:32:57.000Z | cornflow/commands/commands.py | baobabsoluciones/corn | 70adc20a95e1dbc0ec3908a1cddf8fa1829ee537 | [
"MIT"
] | 1 | 2021-06-15T19:43:16.000Z | 2021-06-15T19:43:16.000Z | """
File with the different defined commands
"""
# Import from libraries
from flask_script import Command, Option
# Import from internal modules
from cornflow.models import (
ActionModel,
ApiViewModel,
PermissionViewRoleModel,
RoleModel,
UserModel,
UserRoleModel,
)
from cornflow.shared.const im... | 29.61039 | 118 | 0.587456 | from flask_script import Command, Option
from cornflow.models import (
ActionModel,
ApiViewModel,
PermissionViewRoleModel,
RoleModel,
UserModel,
UserRoleModel,
)
from cornflow.shared.const import (
ADMIN_ROLE,
ACTIONS_MAP,
BASE_PERMISSION_ASSIGNATION,
EXTRA_PERMISSION_ASSIGNATIO... | true | true |
1c0d1ff5f13d91df643f86bfc80b64406ca80d4c | 2,576 | py | Python | src/make_gallery_test.py | CvlabAssignment/WRcan | e77571472f5a3928b1e9cee5440d52f702e59a41 | [
"MIT"
] | null | null | null | src/make_gallery_test.py | CvlabAssignment/WRcan | e77571472f5a3928b1e9cee5440d52f702e59a41 | [
"MIT"
] | null | null | null | src/make_gallery_test.py | CvlabAssignment/WRcan | e77571472f5a3928b1e9cee5440d52f702e59a41 | [
"MIT"
] | null | null | null | from PIL import Image
import xml.etree.ElementTree as ET
import re
import glob
file_path = '/data1/KIST/data/20200904_KIST_DATA/'
# file_names = glob.glob(file_path+'*_FrameInfo.xml')
# file_names2 = []
images_path = './images_ex/'
# images_file_names = glob.glob(images_path+'*.jpeg')
# images_file_names = glob.glob(... | 35.777778 | 117 | 0.560947 | from PIL import Image
import xml.etree.ElementTree as ET
import re
import glob
file_path = '/data1/KIST/data/20200904_KIST_DATA/'
images_path = './images_ex/'
images_file_names = ['카메라01_20200904170300_20200904172800_0|24602.jpeg']
images_frame = []
for f in images_file_names:
f = f.split("|")
frame_no =... | true | true |
1c0d21efe5b24dfa0194ca09457fda639ab895e1 | 252 | py | Python | sdk/python/pulumi_azure/mediaservices/__init__.py | kenny-wealth/pulumi-azure | e57e3a81f95bf622e7429c53f0bff93e33372aa1 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure/mediaservices/__init__.py | kenny-wealth/pulumi-azure | e57e3a81f95bf622e7429c53f0bff93e33372aa1 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure/mediaservices/__init__.py | kenny-wealth/pulumi-azure | e57e3a81f95bf622e7429c53f0bff93e33372aa1 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
# Export this package's modules as members:
from .account import *
| 36 | 87 | 0.706349 |
# Export this package's modules as members:
from .account import *
| true | true |
1c0d2255e7a63362bf236c50dcf7987eea97633f | 4,998 | py | Python | cairis/gui/PersonaCharacteristicPanel.py | nathanjenx/cairis | 06d2d592b64af20746b9a2713551db597af46805 | [
"Apache-2.0"
] | null | null | null | cairis/gui/PersonaCharacteristicPanel.py | nathanjenx/cairis | 06d2d592b64af20746b9a2713551db597af46805 | [
"Apache-2.0"
] | null | null | null | cairis/gui/PersonaCharacteristicPanel.py | nathanjenx/cairis | 06d2d592b64af20746b9a2713551db597af46805 | [
"Apache-2.0"
] | null | null | null | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | 46.277778 | 189 | 0.772309 |
import wx
from cairis.core.armid import *
from BasePanel import BasePanel
from DimensionNameDialog import DimensionNameDialog
from DialogClassParameters import DialogClassParameters
from DocumentReferenceDialog import DocumentReferenceDialog
from ConceptReferenceDialog import ConceptReferenceDialog
from cairis.core.B... | true | true |
1c0d233f7887247900a2b4c1f6c3b395e3f8d167 | 192 | py | Python | day02/hw/lhl/4-13.py | zsh2401/hello-python | 6082071335123251cc653cf5667bce02031bb91f | [
"MulanPSL-1.0"
] | 1 | 2020-08-07T12:05:40.000Z | 2020-08-07T12:05:40.000Z | day02/hw/lhl/4-13.py | zsh2401/hello-python | 6082071335123251cc653cf5667bce02031bb91f | [
"MulanPSL-1.0"
] | null | null | null | day02/hw/lhl/4-13.py | zsh2401/hello-python | 6082071335123251cc653cf5667bce02031bb91f | [
"MulanPSL-1.0"
] | null | null | null | foods = ('yu','wa','fan','cai','tang')
for foods2 in foods:
print(foods2)
foods = ('yu','wa','fan','cai','tang')
print(foods)
foods = ('yu','wa','fan','cai','tang','xia')
print(foods)
# 4 | 21.333333 | 44 | 0.5625 | foods = ('yu','wa','fan','cai','tang')
for foods2 in foods:
print(foods2)
foods = ('yu','wa','fan','cai','tang')
print(foods)
foods = ('yu','wa','fan','cai','tang','xia')
print(foods)
| true | true |
1c0d23a574c1d9d68a6dc04b1806bdaff65897be | 6,059 | py | Python | allennlp/models/archival.py | unendin/allennlp | 0dcbaea6dbc6cc43e24a3564d6d37f8a1421484c | [
"Apache-2.0"
] | 1 | 2018-06-14T10:11:20.000Z | 2018-06-14T10:11:20.000Z | allennlp/models/archival.py | unendin/allennlp | 0dcbaea6dbc6cc43e24a3564d6d37f8a1421484c | [
"Apache-2.0"
] | 1 | 2019-07-31T20:12:41.000Z | 2019-07-31T20:12:41.000Z | allennlp/models/archival.py | unendin/allennlp | 0dcbaea6dbc6cc43e24a3564d6d37f8a1421484c | [
"Apache-2.0"
] | 1 | 2018-06-14T10:35:02.000Z | 2018-06-14T10:35:02.000Z | """
Helper functions for archiving models and restoring archived models.
"""
from typing import NamedTuple, Dict
import json
import logging
import os
import tempfile
import tarfile
import shutil
import pyhocon
from allennlp.common import Params
from allennlp.common.file_utils import cached_path
from allennlp.models.... | 38.839744 | 94 | 0.677505 |
from typing import NamedTuple, Dict
import json
import logging
import os
import tempfile
import tarfile
import shutil
import pyhocon
from allennlp.common import Params
from allennlp.common.file_utils import cached_path
from allennlp.models.model import Model, _DEFAULT_WEIGHTS
logger = logging.getLogger(__name__)
... | true | true |
1c0d23a8e816d49629d675e2a8731eb425656f33 | 1,120 | py | Python | apps/users/utils.py | Curiou/classify_email | 1fa3162ec6cb499fdda2e51d4c6d7fbd934813db | [
"Apache-2.0"
] | null | null | null | apps/users/utils.py | Curiou/classify_email | 1fa3162ec6cb499fdda2e51d4c6d7fbd934813db | [
"Apache-2.0"
] | null | null | null | apps/users/utils.py | Curiou/classify_email | 1fa3162ec6cb499fdda2e51d4c6d7fbd934813db | [
"Apache-2.0"
] | 1 | 2020-11-24T05:34:14.000Z | 2020-11-24T05:34:14.000Z | # !/usr/bin/python
# -*- coding: utf-8 -*-
"""
Author: Conglin Du
Contact: gduxiansheng@gmail.com or 2544284522@qq.com
File: jwt_auth.py
Time: 2020/8/23 16:11
File Intro: 自定义的 jwt 的 登陆验证
"""
from django.conf import settings
from django.core.cache import cache
def jwt_response_payload_handler(toke... | 23.829787 | 90 | 0.584821 |
from django.conf import settings
from django.core.cache import cache
def jwt_response_payload_handler(token, user=None, request=None):
code = 200
if not user or not token:
code = 400
return {
"code": code,
"msg": "ok",
"data": {
'token': token,
... | true | true |
1c0d24059043063c10ec0a2c06ad31894bfb846d | 987 | py | Python | model-optimizer/mo/utils/ir_reader/extenders/non_max_suppression_extender.py | anton-potapov/openvino | 84119afe9a8c965e0a0cd920fff53aee67b05108 | [
"Apache-2.0"
] | 2 | 2020-11-18T14:14:06.000Z | 2020-11-28T04:55:57.000Z | model-optimizer/mo/utils/ir_reader/extenders/non_max_suppression_extender.py | anton-potapov/openvino | 84119afe9a8c965e0a0cd920fff53aee67b05108 | [
"Apache-2.0"
] | 30 | 2020-11-13T11:44:07.000Z | 2022-02-21T13:03:16.000Z | model-optimizer/mo/utils/ir_reader/extenders/non_max_suppression_extender.py | mmakridi/openvino | 769bb7709597c14debdaa356dd60c5a78bdfa97e | [
"Apache-2.0"
] | 3 | 2021-03-09T08:27:29.000Z | 2021-04-07T04:58:54.000Z | """
Copyright (C) 2018-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... | 35.25 | 80 | 0.766971 | from mo.middle.passes.convert_data_type import destination_type_to_np_data_type
from mo.utils.graph import Node
from mo.utils.ir_reader.extender import Extender
class NonMaxSuppressionExtender(Extender):
op = 'NonMaxSuppression'
@staticmethod
def extend(op: Node):
if op.has_valid('output_type'):
... | true | true |
1c0d250665cc8af6337bd9d4b5c2ed555825bc1b | 1,738 | py | Python | WhatManager2/management/commands/transmission_delete.py | OdinGitDat/WhatManager2 | ddbce0fa1ff4e1fc44bfa726c4f7eace4adbe8a9 | [
"MIT"
] | 1 | 2018-03-23T13:11:30.000Z | 2018-03-23T13:11:30.000Z | WhatManager2/management/commands/transmission_delete.py | SavageCore/WhatManager2 | 5a0fc5af8c9168fa199124aaa2aa56495dc0a40b | [
"MIT"
] | null | null | null | WhatManager2/management/commands/transmission_delete.py | SavageCore/WhatManager2 | 5a0fc5af8c9168fa199124aaa2aa56495dc0a40b | [
"MIT"
] | null | null | null | #!/usr/bin/env python
from django.core.management.base import BaseCommand, CommandError
from WhatManager2.management.commands.transmission_provision import confirm, TransInstanceManager, ensure_root
from home.models import TransInstance
class Command(BaseCommand):
help = u'Removes existing Transmission instances... | 41.380952 | 119 | 0.640391 | from django.core.management.base import BaseCommand, CommandError
from WhatManager2.management.commands.transmission_provision import confirm, TransInstanceManager, ensure_root
from home.models import TransInstance
class Command(BaseCommand):
help = u'Removes existing Transmission instances'
def add_argumen... | false | true |
1c0d262a557c4557a2094d7daf554e39ea83aee8 | 2,235 | py | Python | backend/sneaker_spot_32152/urls.py | crowdbotics-apps/sneaker-spot-32152 | 34c2544824c3c48417d0b84531bed35425893355 | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | backend/sneaker_spot_32152/urls.py | crowdbotics-apps/sneaker-spot-32152 | 34c2544824c3c48417d0b84531bed35425893355 | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | backend/sneaker_spot_32152/urls.py | crowdbotics-apps/sneaker-spot-32152 | 34c2544824c3c48417d0b84531bed35425893355 | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | """sneaker_spot_32152 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
... | 35.47619 | 87 | 0.713199 |
from django.contrib import admin
from django.urls import path, include, re_path
from django.views.generic.base import TemplateView
from allauth.account.views import confirm_email
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
urlpatterns = [
path("",... | true | true |
1c0d26e6d08508d55f8423cfe69a30f119659ccd | 1,222 | py | Python | _scripts/reporter.py | jtpio/robotframework-jupyterlibrary | 942b6d1cba5b6939332eb6b8736a581a327ba720 | [
"BSD-3-Clause"
] | 15 | 2019-01-15T17:20:58.000Z | 2022-01-17T00:37:21.000Z | _scripts/reporter.py | jtpio/robotframework-jupyterlibrary | 942b6d1cba5b6939332eb6b8736a581a327ba720 | [
"BSD-3-Clause"
] | 30 | 2019-05-30T00:04:15.000Z | 2022-03-10T12:23:26.000Z | _scripts/reporter.py | jtpio/robotframework-jupyterlibrary | 942b6d1cba5b6939332eb6b8736a581a327ba720 | [
"BSD-3-Clause"
] | 8 | 2019-01-07T00:40:08.000Z | 2022-02-27T01:28:29.000Z | from doit.reporter import ConsoleReporter
from datetime import datetime
from . import project as P
START = "::group::" if P.CI else ""
END = "::endgroup::" if P.CI else ""
TIMEFMT = "%H:%M:%S"
SKIP = "--------"
class GithubActionsReporter(ConsoleReporter):
_gh_timings = {}
def execute_task(self, task):
... | 26.565217 | 84 | 0.591653 | from doit.reporter import ConsoleReporter
from datetime import datetime
from . import project as P
START = "::group::" if P.CI else ""
END = "::endgroup::" if P.CI else ""
TIMEFMT = "%H:%M:%S"
SKIP = "--------"
class GithubActionsReporter(ConsoleReporter):
_gh_timings = {}
def execute_task(self, task):
... | true | true |
1c0d29bdda1028df7259f080fcc5ef8b077f6c98 | 9,268 | py | Python | enclave_manager/avalon_enclave_manager/attestation/epid/epid_attestation.py | MarkYQJ/avalon | ce962a09bda033d9e33c219bb1f2452f091e28dd | [
"Apache-2.0"
] | 127 | 2019-10-25T08:43:26.000Z | 2022-03-20T15:33:32.000Z | enclave_manager/avalon_enclave_manager/attestation/epid/epid_attestation.py | Mateus-dang/avalon | 3f6f4f4b892753cf2ae9f3cab839664ed6e7512c | [
"Apache-2.0"
] | 275 | 2019-10-24T23:36:21.000Z | 2022-01-24T20:38:07.000Z | enclave_manager/avalon_enclave_manager/attestation/epid/epid_attestation.py | Mateus-dang/avalon | 3f6f4f4b892753cf2ae9f3cab839664ed6e7512c | [
"Apache-2.0"
] | 110 | 2019-10-30T07:09:25.000Z | 2022-01-28T09:40:44.000Z | # Copyright 2020 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | 39.438298 | 79 | 0.577795 |
import time
import logging
import random
import json
import importlib
from ssl import SSLError
from requests.exceptions import HTTPError, Timeout
import avalon_enclave_manager.attestation_common.ias_client as ias_client
from avalon_enclave_manager.attestation.attestation import Attestation
from avalon_enclave_manager... | true | true |
1c0d2a5bbf68d0c6356b240c5606da544157401b | 2,880 | py | Python | t_speech_assisstant/venv/lib/python3.7/site-packages/CoreWLAN/__init__.py | TEgo17/SpeechAssistant | 0e16dd4757f1b05f08ecbb4f4956b2ccd1a63c10 | [
"MIT"
] | 1 | 2020-09-01T16:24:50.000Z | 2020-09-01T16:24:50.000Z | t_speech_assisstant/venv/lib/python3.7/site-packages/CoreWLAN/__init__.py | TEgo17/SpeechAssistant | 0e16dd4757f1b05f08ecbb4f4956b2ccd1a63c10 | [
"MIT"
] | 1 | 2021-01-28T20:40:19.000Z | 2021-01-28T20:40:19.000Z | t_speech_assisstant/venv/lib/python3.7/site-packages/CoreWLAN/__init__.py | TEgo17/SpeechAssistant | 0e16dd4757f1b05f08ecbb4f4956b2ccd1a63c10 | [
"MIT"
] | null | null | null | """
Python mapping for the CoreWLAN framework.
This module does not contain docstrings for the wrapped code, check Apple's
documentation for details on how to use these functions and classes.
"""
import objc
import sys
import Foundation
from CoreWLAN import _metadata, _CoreWLAN
def _CW8021XProfile__eq__(self, othe... | 21.818182 | 79 | 0.708681 |
import objc
import sys
import Foundation
from CoreWLAN import _metadata, _CoreWLAN
def _CW8021XProfile__eq__(self, other):
if not isinstance(other, type(self)):
return False
return self.isEqualToProfile_(other)
def _CW8021XProfile__ne__(self, other):
if not isinstance(other, type(self)):
... | true | true |
1c0d2bf5af743072f7326e88d7083353ad5d3207 | 268 | py | Python | kattis/hardwoodspecies.py | terror/Solutions | 1ad33daec95b565a38ac4730261593bcf249ac86 | [
"CC0-1.0"
] | 2 | 2021-04-05T14:26:37.000Z | 2021-06-10T04:22:01.000Z | kattis/hardwoodspecies.py | terror/Solutions | 1ad33daec95b565a38ac4730261593bcf249ac86 | [
"CC0-1.0"
] | null | null | null | kattis/hardwoodspecies.py | terror/Solutions | 1ad33daec95b565a38ac4730261593bcf249ac86 | [
"CC0-1.0"
] | null | null | null | import sys
from collections import Counter
d = Counter()
for i in sys.stdin:
if i.rstrip() == '': break
d[str(i).replace('\n', '')] += 1
tot = sum(d.values())
for i in sorted([key for key, val in d.items()]):
print('{} {:.6f}'.format(i, (100 * d[i]) / tot))
| 19.142857 | 50 | 0.574627 | import sys
from collections import Counter
d = Counter()
for i in sys.stdin:
if i.rstrip() == '': break
d[str(i).replace('\n', '')] += 1
tot = sum(d.values())
for i in sorted([key for key, val in d.items()]):
print('{} {:.6f}'.format(i, (100 * d[i]) / tot))
| true | true |
1c0d31094ed6ae3ff5237955dac76296f4eccf4a | 679 | py | Python | 02-20-Cumartesi/exam-3.py | cihatdev/misha-staj | d0ee95d5e77a7d7a1f16611d49c87be429a25b31 | [
"MIT"
] | 9 | 2021-03-16T20:21:54.000Z | 2022-01-08T09:15:10.000Z | 02-20-Cumartesi/exam-3.py | cihatdev/misha-staj | d0ee95d5e77a7d7a1f16611d49c87be429a25b31 | [
"MIT"
] | 1 | 2021-02-28T21:27:17.000Z | 2021-02-28T21:27:17.000Z | 02-20-Cumartesi/exam-3.py | cihatdev/misha-staj | d0ee95d5e77a7d7a1f16611d49c87be429a25b31 | [
"MIT"
] | 1 | 2021-05-24T11:34:48.000Z | 2021-05-24T11:34:48.000Z | from typing import Type
school = input("Lütfen Okulunuzun İsmini Giriniz: ")
words = school.split(" ")
words = words[::-1]
for word in words:
if word.lower() == "üniversitesi" or word.lower() == "unıversitesı" or word.lower() == "üniversite" or word.lower() == "unıversıte":
print("Üniversite öğrencisisi... | 35.736842 | 136 | 0.617084 | from typing import Type
school = input("Lütfen Okulunuzun İsmini Giriniz: ")
words = school.split(" ")
words = words[::-1]
for word in words:
if word.lower() == "üniversitesi" or word.lower() == "unıversitesı" or word.lower() == "üniversite" or word.lower() == "unıversıte":
print("Üniversite öğrencisisi... | true | true |
1c0d314d1a8023a50fe7e7da7af5093a53230b74 | 280 | py | Python | rvTools/dailyPanelWidgetStandalone.py | mathieuassemat123/dailyTool | 59c12c400cc02930c270a220f2055f7ecbdfdaf3 | [
"Apache-2.0"
] | null | null | null | rvTools/dailyPanelWidgetStandalone.py | mathieuassemat123/dailyTool | 59c12c400cc02930c270a220f2055f7ecbdfdaf3 | [
"Apache-2.0"
] | null | null | null | rvTools/dailyPanelWidgetStandalone.py | mathieuassemat123/dailyTool | 59c12c400cc02930c270a220f2055f7ecbdfdaf3 | [
"Apache-2.0"
] | null | null | null | import sys
sys.path.append(r"c:\mytools")
import rvTools.widgets.dailyPanelWidget as dailyPanelWidget
from PySide2 import QtWidgets, QtCore, QtGui, QtUiTools
app = QtWidgets.QApplication([])
window = dailyPanelWidget.DailiesPanel()
window.show()
sys.exit(app.exec_())
| 25.454545 | 60 | 0.764286 | import sys
sys.path.append(r"c:\mytools")
import rvTools.widgets.dailyPanelWidget as dailyPanelWidget
from PySide2 import QtWidgets, QtCore, QtGui, QtUiTools
app = QtWidgets.QApplication([])
window = dailyPanelWidget.DailiesPanel()
window.show()
sys.exit(app.exec_())
| true | true |
1c0d31542fca61610c44233ca203070382223f69 | 417 | py | Python | tests/fixtures/suites.py | heylouiz/spidermon | 3ae2c46d1cf5b46efb578798b881264be3e68394 | [
"BSD-3-Clause"
] | 2 | 2019-10-03T16:47:11.000Z | 2022-02-22T11:56:02.000Z | tests/fixtures/suites.py | heylouiz/spidermon | 3ae2c46d1cf5b46efb578798b881264be3e68394 | [
"BSD-3-Clause"
] | 23 | 2019-05-30T20:27:38.000Z | 2019-08-20T07:23:09.000Z | tests/fixtures/suites.py | heylouiz/spidermon | 3ae2c46d1cf5b46efb578798b881264be3e68394 | [
"BSD-3-Clause"
] | 1 | 2022-03-24T03:01:19.000Z | 2022-03-24T03:01:19.000Z | from __future__ import absolute_import
from spidermon import MonitorSuite
from .cases import *
class EmptySuite(MonitorSuite):
pass
class Suite01(MonitorSuite):
monitors = [Monitor01]
class Suite02(MonitorSuite):
monitors = [Suite01, Monitor02]
class Suite03(MonitorSuite):
monitors = [Suite01,... | 16.038462 | 55 | 0.745803 | from __future__ import absolute_import
from spidermon import MonitorSuite
from .cases import *
class EmptySuite(MonitorSuite):
pass
class Suite01(MonitorSuite):
monitors = [Monitor01]
class Suite02(MonitorSuite):
monitors = [Suite01, Monitor02]
class Suite03(MonitorSuite):
monitors = [Suite01,... | true | true |
1c0d326a933aa371500416f257933667ef34860a | 313 | py | Python | month02/多进程并发模型/IO/day16/select_test.py | chaofan-zheng/python_leanring_code | 0af44ff39b9ded2c1d2cc96c6d356d21170ac04d | [
"Apache-2.0"
] | 4 | 2021-01-07T14:25:10.000Z | 2021-02-01T10:36:01.000Z | month02/day16/select_test.py | chaofan-zheng/tedu-python-demo | abe983ddc52690f4726cf42cc6390cba815026d8 | [
"Apache-2.0"
] | null | null | null | month02/day16/select_test.py | chaofan-zheng/tedu-python-demo | abe983ddc52690f4726cf42cc6390cba815026d8 | [
"Apache-2.0"
] | null | null | null | """
IO多路复用演示
"""
from socket import *
from select import select
# 准备一些IO
file = open("my.log")
udp_sock = socket(AF_INET,SOCK_DGRAM)
tcp_sock = socket()
tcp_sock.bind(('0.0.0.0',8888))
tcp_sock.listen(5)
print("开始监控")
rs,ws,xs=select([tcp_sock],[],[])
print("rlist:",rs)
print("wlist:",ws)
print("xlist:",xs)
| 14.904762 | 37 | 0.670927 | from socket import *
from select import select
file = open("my.log")
udp_sock = socket(AF_INET,SOCK_DGRAM)
tcp_sock = socket()
tcp_sock.bind(('0.0.0.0',8888))
tcp_sock.listen(5)
print("开始监控")
rs,ws,xs=select([tcp_sock],[],[])
print("rlist:",rs)
print("wlist:",ws)
print("xlist:",xs)
| true | true |
1c0d3397984b38ed5e5ebf6674245f9473f2fecf | 6,457 | py | Python | PEPit/examples/nonconvex_optimization/no_lips_2.py | bgoujaud/PEPit | 7352607069f5e90fb1919fc689ec5e9d745c3bac | [
"MIT"
] | 44 | 2021-11-18T16:41:20.000Z | 2022-02-14T09:59:13.000Z | PEPit/examples/nonconvex_optimization/no_lips_2.py | bgoujaud/PEPit | 7352607069f5e90fb1919fc689ec5e9d745c3bac | [
"MIT"
] | 2 | 2021-10-05T09:20:25.000Z | 2022-02-19T13:58:01.000Z | PEPit/examples/nonconvex_optimization/no_lips_2.py | bgoujaud/PEPit | 7352607069f5e90fb1919fc689ec5e9d745c3bac | [
"MIT"
] | 1 | 2022-02-08T12:03:29.000Z | 2022-02-08T12:03:29.000Z | import numpy as np
from PEPit import PEP
from PEPit.functions import ConvexFunction
from PEPit.functions import ConvexIndicatorFunction
from PEPit.primitive_steps import bregman_gradient_step
def wc_no_lips_2(L, gamma, n, verbose=1):
"""
Consider the constrainted composite convex minimization problem
... | 43.92517 | 163 | 0.631563 | import numpy as np
from PEPit import PEP
from PEPit.functions import ConvexFunction
from PEPit.functions import ConvexIndicatorFunction
from PEPit.primitive_steps import bregman_gradient_step
def wc_no_lips_2(L, gamma, n, verbose=1):
problem = PEP()
d1 = problem.declare_function(ConvexFunction, reu... | true | true |
1c0d33df77b1512306bba511ba0922f96d03cbaa | 8,587 | py | Python | docs/conf.py | SamStudio8/labbook | 330ab38e197e615b27368695a9eaad85b03b9e51 | [
"MIT"
] | 61 | 2016-11-15T20:38:27.000Z | 2021-10-12T16:53:48.000Z | docs/conf.py | SamStudio8/labbook | 330ab38e197e615b27368695a9eaad85b03b9e51 | [
"MIT"
] | 40 | 2016-11-10T00:08:59.000Z | 2019-11-20T11:58:57.000Z | docs/conf.py | SamStudio8/labbook | 330ab38e197e615b27368695a9eaad85b03b9e51 | [
"MIT"
] | 5 | 2016-11-15T20:43:25.000Z | 2019-07-24T01:24:53.000Z | # -*- coding: utf-8 -*-
#
# Chitin documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 18 00:44:25 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... | 31.225455 | 79 | 0.717363 |
import sys
import os
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../'))
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
]
napoleon_google_docstring = False
napoleon_use_param = F... | true | true |
1c0d345a46e63ba1f73cee353b7b6d39a21d15c3 | 1,776 | py | Python | uhd_restpy/testplatform/sessions/ixnetwork/topology/learnedlspindex_c701313bed13ee8aba049d45e00b1355.py | Vibaswan/ixnetwork_restpy | 239fedc7050890746cbabd71ea1e91c68d9e5cad | [
"MIT"
] | null | null | null | uhd_restpy/testplatform/sessions/ixnetwork/topology/learnedlspindex_c701313bed13ee8aba049d45e00b1355.py | Vibaswan/ixnetwork_restpy | 239fedc7050890746cbabd71ea1e91c68d9e5cad | [
"MIT"
] | null | null | null | uhd_restpy/testplatform/sessions/ixnetwork/topology/learnedlspindex_c701313bed13ee8aba049d45e00b1355.py | Vibaswan/ixnetwork_restpy | 239fedc7050890746cbabd71ea1e91c68d9e5cad | [
"MIT"
] | null | null | null | # MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify,... | 37 | 155 | 0.726351 | from uhd_restpy.base import Base
from uhd_restpy.files import Files
class LearnedLspIndex(Base):
__slots__ = ()
_SDM_NAME = 'learnedLspIndex'
_SDM_ATT_MAP = {
'Count': 'count',
}
def __init__(self, parent):
super(LearnedLspIndex, self).__init__(parent)
@property
def Coun... | true | true |
1c0d34ca400da06a1a4645cffe20ceab29f37719 | 476 | py | Python | tests/test_cli.py | atudomain/git-conventional-version | 37de40b05ace5b9f1e320866b9abe828323d17ef | [
"MIT"
] | null | null | null | tests/test_cli.py | atudomain/git-conventional-version | 37de40b05ace5b9f1e320866b9abe828323d17ef | [
"MIT"
] | null | null | null | tests/test_cli.py | atudomain/git-conventional-version | 37de40b05ace5b9f1e320866b9abe828323d17ef | [
"MIT"
] | null | null | null | import subprocess
import pytest
from git_conventional_version.api import version_types
commands = tuple(
[
f"gcv -t {version_type} {old}"
for version_type in version_types
for old in ("--old", "")
]
)
@pytest.mark.parametrize(
"command",
commands
)
def test_gcv(repo, comman... | 19.04 | 63 | 0.676471 | import subprocess
import pytest
from git_conventional_version.api import version_types
commands = tuple(
[
f"gcv -t {version_type} {old}"
for version_type in version_types
for old in ("--old", "")
]
)
@pytest.mark.parametrize(
"command",
commands
)
def test_gcv(repo, comman... | true | true |
1c0d350474edb196c678c5a207ceae1dd16121a6 | 3,320 | py | Python | test/qa/rpc-tests/bip65-cltv.py | MagnaChain/MagnaChain-dev-master | c83e7a8b9e8f9ae8684a0e3a11f1eeb42dfa1272 | [
"MIT"
] | 26 | 2018-11-30T09:01:34.000Z | 2020-03-11T00:41:52.000Z | test/qa/rpc-tests/bip65-cltv.py | MagnaChain/MagnaChain-dev-master | c83e7a8b9e8f9ae8684a0e3a11f1eeb42dfa1272 | [
"MIT"
] | 3 | 2019-01-01T09:06:22.000Z | 2019-04-01T10:06:01.000Z | test/qa/rpc-tests/bip65-cltv.py | MagnaChain/MagnaChain-dev-master | c83e7a8b9e8f9ae8684a0e3a11f1eeb42dfa1272 | [
"MIT"
] | 24 | 2018-11-30T03:32:53.000Z | 2020-03-20T04:30:34.000Z | #!/usr/bin/env python3
# Copyright (c) 2015-2016 The MagnaChain Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test the CHECKLOCKTIMEVERIFY (BIP65) soft-fork logic
#
from test_framework.test_framework import ... | 35.698925 | 98 | 0.624096 |
from test_framework.test_framework import MagnaChainTestFramework
from test_framework.util import *
class BIP65Test(MagnaChainTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 3
self.setup_clean_chain = False
def setup_network(self):
self.nodes = []
... | true | true |
1c0d361e8337d02f5fbc92a1db2b014025d1f86f | 943 | py | Python | scripts/upsampling_demo.py | always-newbie161/pyprobml | eb70c84f9618d68235ef9ba7da147c009b2e4a80 | [
"MIT"
] | 2 | 2021-02-26T04:36:10.000Z | 2021-02-26T04:36:24.000Z | scripts/upsampling_demo.py | always-newbie161/pyprobml | eb70c84f9618d68235ef9ba7da147c009b2e4a80 | [
"MIT"
] | 9 | 2021-03-31T20:18:21.000Z | 2022-03-12T00:52:47.000Z | scripts/upsampling_demo.py | always-newbie161/pyprobml | eb70c84f9618d68235ef9ba7da147c009b2e4a80 | [
"MIT"
] | 1 | 2021-06-21T01:18:07.000Z | 2021-06-21T01:18:07.000Z | # Illustrate upsampling in 2d
# Code from Jason Brownlee
# https://machinelearningmastery.com/generative_adversarial_networks/
import tensorflow as tf
from tensorflow import keras
from numpy import asarray
#from keras.models import Sequential
from tensorflow.keras.models import Sequential
#from keras.layers import... | 22.452381 | 74 | 0.709438 |
import tensorflow as tf
from tensorflow import keras
from numpy import asarray
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import UpSampling2D
X = asarray([[1, 2],
[3, 4]])
X = asarray([[1, 2, 3],
[4, 5, 6],
[7,8,9]])
print(X)
nr = X.shape[0]
nc = X.shape[1]
... | true | true |
1c0d36821303aa565803926f0c2fc62aad40a125 | 4,868 | py | Python | spatial_reasoning/environment/MDP.py | MarcCote/spatial-reasoning | 06c57cfafbd1c24b68d6ab634d19806964d867f3 | [
"MIT"
] | null | null | null | spatial_reasoning/environment/MDP.py | MarcCote/spatial-reasoning | 06c57cfafbd1c24b68d6ab634d19806964d867f3 | [
"MIT"
] | null | null | null | spatial_reasoning/environment/MDP.py | MarcCote/spatial-reasoning | 06c57cfafbd1c24b68d6ab634d19806964d867f3 | [
"MIT"
] | null | null | null | import numpy as np
class MDP:
def __init__(self, world, rewards, terminal):
self.world = world
self.reward_map = rewards
self.terminal_map = terminal
self.shape = self.reward_map.shape
self.M, self.N = self.shape
self.states = [(i,j) for i in range(self.M) for j in... | 30.810127 | 89 | 0.524445 | import numpy as np
class MDP:
def __init__(self, world, rewards, terminal):
self.world = world
self.reward_map = rewards
self.terminal_map = terminal
self.shape = self.reward_map.shape
self.M, self.N = self.shape
self.states = [(i,j) for i in range(self.M) for j in... | true | true |
1c0d3702dba7d2c679587e4538a25de25a7afec2 | 922 | py | Python | setup.py | fakegit/gradio | fdf679c4fa34c778bfda8977be6d4860d082322f | [
"Apache-2.0"
] | null | null | null | setup.py | fakegit/gradio | fdf679c4fa34c778bfda8977be6d4860d082322f | [
"Apache-2.0"
] | null | null | null | setup.py | fakegit/gradio | fdf679c4fa34c778bfda8977be6d4860d082322f | [
"Apache-2.0"
] | null | null | null | try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='gradio',
version='2.6.3',
include_package_data=True,
description='Python library for easily interacting with trained machine learning models',
author='Abubakar Abid, Ali Abid, Ali Abdalla, Da... | 26.342857 | 93 | 0.597614 | try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='gradio',
version='2.6.3',
include_package_data=True,
description='Python library for easily interacting with trained machine learning models',
author='Abubakar Abid, Ali Abid, Ali Abdalla, Da... | true | true |
1c0d37c41a71935925c832758560feb3e12a44fe | 7,391 | py | Python | home_logs/custom_auth/views.py | tsaklidis/LogingAPI | 4a77fc3685e6ec369e2a4037a81a3fffcc3056c6 | [
"MIT"
] | 9 | 2019-09-27T22:20:40.000Z | 2019-11-07T22:16:30.000Z | home_logs/custom_auth/views.py | tsaklidis/LogingAPI | 4a77fc3685e6ec369e2a4037a81a3fffcc3056c6 | [
"MIT"
] | null | null | null | home_logs/custom_auth/views.py | tsaklidis/LogingAPI | 4a77fc3685e6ec369e2a4037a81a3fffcc3056c6 | [
"MIT"
] | 2 | 2019-09-27T22:20:44.000Z | 2019-10-04T08:11:45.000Z | from django.utils import timezone
from django.shortcuts import get_object_or_404
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.response import Response
from rest_framework import status
from home_logs.custom_auth.models import Token
from home_logs.custom_auth.permissions import Exceed... | 36.408867 | 104 | 0.587607 | from django.utils import timezone
from django.shortcuts import get_object_or_404
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.response import Response
from rest_framework import status
from home_logs.custom_auth.models import Token
from home_logs.custom_auth.permissions import Exceed... | true | true |
1c0d37c90df003d0d1a29d2acb6fb91d0d30310a | 8,593 | py | Python | homeassistant/components/tado/water_heater.py | domwillcode/home-assistant | f170c80bea70c939c098b5c88320a1c789858958 | [
"Apache-2.0"
] | 4 | 2020-07-29T17:47:10.000Z | 2020-09-16T13:39:13.000Z | homeassistant/components/tado/water_heater.py | domwillcode/home-assistant | f170c80bea70c939c098b5c88320a1c789858958 | [
"Apache-2.0"
] | 6 | 2020-11-08T19:40:10.000Z | 2022-03-01T11:11:07.000Z | homeassistant/components/tado/water_heater.py | klauern/home-assistant-core | c18ba6aec0627e6afb6442c678edb5ff2bb17db6 | [
"Apache-2.0"
] | 5 | 2020-03-29T00:29:13.000Z | 2021-09-06T20:58:40.000Z | """Support for Tado hot water zones."""
import logging
from homeassistant.components.water_heater import (
SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE,
WaterHeaterEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
from homeas... | 29.327645 | 88 | 0.654137 | import logging
from homeassistant.components.water_heater import (
SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE,
WaterHeaterEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
from homeassistant.core import HomeAssistant, callb... | true | true |
1c0d37d1d4fcb85f529a734cdaaac2218f63b63d | 830 | py | Python | pyinstaller/install-from-git.py | mstim/glycresoft | 1d305c42c7e6cba60326d8246e4a485596a53513 | [
"Apache-2.0"
] | 4 | 2019-04-26T15:47:57.000Z | 2021-04-20T22:53:58.000Z | pyinstaller/install-from-git.py | mstim/glycresoft | 1d305c42c7e6cba60326d8246e4a485596a53513 | [
"Apache-2.0"
] | 8 | 2017-11-22T19:20:20.000Z | 2022-02-14T01:49:58.000Z | pyinstaller/install-from-git.py | mstim/glycresoft | 1d305c42c7e6cba60326d8246e4a485596a53513 | [
"Apache-2.0"
] | 3 | 2017-11-21T18:05:28.000Z | 2021-09-23T18:38:33.000Z | from os import path as ospath
import sys
import os
import shutil
repos = [
"https://github.com/mobiusklein/pysqlite.git",
"https://github.com/mobiusklein/glypy.git",
"https://github.com/mobiusklein/glycopeptidepy.git",
"https://github.com/mobiusklein/ms_peak_picker.git",
"https://github.com/mobiusk... | 30.740741 | 80 | 0.69759 | from os import path as ospath
import sys
import os
import shutil
repos = [
"https://github.com/mobiusklein/pysqlite.git",
"https://github.com/mobiusklein/glypy.git",
"https://github.com/mobiusklein/glycopeptidepy.git",
"https://github.com/mobiusklein/ms_peak_picker.git",
"https://github.com/mobiusk... | true | true |
1c0d38099558b246c68efb1ec4e00b77c4d263cd | 427 | py | Python | r360_py/util/enum/TravelType.py | route360/r360-py | 60501d1dd3d763e63e9c831292d3fb22d69195a5 | [
"MIT"
] | 7 | 2017-05-03T15:47:25.000Z | 2018-09-12T19:14:05.000Z | targomo_python/util/enum/TravelType.py | yingzh08/targomo-python | f5b36439113b56a6139b93306eea6bb87ee61527 | [
"MIT"
] | 5 | 2016-11-21T15:16:25.000Z | 2018-05-29T09:01:55.000Z | targomo_python/util/enum/TravelType.py | yingzh08/targomo-python | f5b36439113b56a6139b93306eea6bb87ee61527 | [
"MIT"
] | 3 | 2016-10-05T13:12:10.000Z | 2018-08-10T14:37:54.000Z | from enum import Enum
class TravelType(Enum):
CAR = "car"
WALK = "walk"
BIKE = "bike"
TRANSIT = "transit"
@classmethod
def parse(clazz, str):
if str is None:
raise Exception('Travel type: "None" not supported!')
type = getattr(clazz, str.upper(), None)
if ... | 22.473684 | 72 | 0.562061 | from enum import Enum
class TravelType(Enum):
CAR = "car"
WALK = "walk"
BIKE = "bike"
TRANSIT = "transit"
@classmethod
def parse(clazz, str):
if str is None:
raise Exception('Travel type: "None" not supported!')
type = getattr(clazz, str.upper(), None)
if ... | true | true |
1c0d387a91dd0654945f47e4a57d799b6651749f | 1,016 | py | Python | source/ImgDecoder.py | programpro-ars/ImgCode | c16fb510ff292e4a4f995c68ac1474af519e21eb | [
"MIT"
] | null | null | null | source/ImgDecoder.py | programpro-ars/ImgCode | c16fb510ff292e4a4f995c68ac1474af519e21eb | [
"MIT"
] | null | null | null | source/ImgDecoder.py | programpro-ars/ImgCode | c16fb510ff292e4a4f995c68ac1474af519e21eb | [
"MIT"
] | null | null | null | from PIL import Image
def get_chr(code):
return chr(int(code, 2))
def main():
img = Image.open("source/output.png")
pixels = img.load()
curren_code = ''
data = ''
index = 0
with open('source/Output_Text.txt', 'w') as out_file:
for i in range(img.size[0]):
for j in rang... | 30.787879 | 65 | 0.42126 | from PIL import Image
def get_chr(code):
return chr(int(code, 2))
def main():
img = Image.open("source/output.png")
pixels = img.load()
curren_code = ''
data = ''
index = 0
with open('source/Output_Text.txt', 'w') as out_file:
for i in range(img.size[0]):
for j in rang... | true | true |
1c0d38b6f6810370ad4d18258a5507d7ec167493 | 55,908 | py | Python | openrave/sympy/core/numbers.py | jdsika/TUM_HOly | a2ac55fa1751a3a8038cf61d29b95005f36d6264 | [
"MIT"
] | 2 | 2015-11-13T16:40:57.000Z | 2017-09-15T15:37:19.000Z | openrave/sympy/core/numbers.py | jdsika/holy | a2ac55fa1751a3a8038cf61d29b95005f36d6264 | [
"MIT"
] | 1 | 2016-06-13T01:29:51.000Z | 2016-06-14T00:38:27.000Z | openrave/sympy/core/numbers.py | jdsika/holy | a2ac55fa1751a3a8038cf61d29b95005f36d6264 | [
"MIT"
] | null | null | null | from core import C
from sympify import converter, sympify, _sympify, SympifyError
from basic import Basic
from singleton import S, Singleton
from expr import Expr, AtomicExpr
from decorators import _sympifyit, deprecated
from cache import cacheit, clear_cache
import sympy.mpmath as mpmath
import sympy.mpmath.libmp as m... | 27.967984 | 103 | 0.541193 | from core import C
from sympify import converter, sympify, _sympify, SympifyError
from basic import Basic
from singleton import S, Singleton
from expr import Expr, AtomicExpr
from decorators import _sympifyit, deprecated
from cache import cacheit, clear_cache
import sympy.mpmath as mpmath
import sympy.mpmath.libmp as m... | false | true |
1c0d38d55c3f9e968615a5b33310a29982d834ea | 1,229 | py | Python | Chapter 06/Binary_tree_level_order.py | bpbpublications/Python-Quick-Interview-Guide | ab4ff3e670b116a4db6b9e1f0ccba8424640704d | [
"MIT"
] | 1 | 2021-05-14T19:53:41.000Z | 2021-05-14T19:53:41.000Z | Chapter 06/Binary_tree_level_order.py | bpbpublications/Python-Quick-Interview-Guide | ab4ff3e670b116a4db6b9e1f0ccba8424640704d | [
"MIT"
] | null | null | null | Chapter 06/Binary_tree_level_order.py | bpbpublications/Python-Quick-Interview-Guide | ab4ff3e670b116a4db6b9e1f0ccba8424640704d | [
"MIT"
] | null | null | null | from typing import List
class TreeNode:
def __init__(self, v):
self.val = v
self.left = None
self.right = None
class Solution:
def levelOrder(self, root: TreeNode) -> List[List[int]]:
if root is None:return root
q = []
List = []
q.append(r... | 30.725 | 67 | 0.515867 | from typing import List
class TreeNode:
def __init__(self, v):
self.val = v
self.left = None
self.right = None
class Solution:
def levelOrder(self, root: TreeNode) -> List[List[int]]:
if root is None:return root
q = []
List = []
q.append(r... | true | true |
1c0d3924ee67fa06a4d54304846373a943b4c1a7 | 3,336 | py | Python | src/utils/img_ranking_evaluate.py | hthieu166/cs547-final-proj-image-ranking | 81c6d3ebccae77df1d2e8421927a1a2684f80c98 | [
"MIT"
] | null | null | null | src/utils/img_ranking_evaluate.py | hthieu166/cs547-final-proj-image-ranking | 81c6d3ebccae77df1d2e8421927a1a2684f80c98 | [
"MIT"
] | null | null | null | src/utils/img_ranking_evaluate.py | hthieu166/cs547-final-proj-image-ranking | 81c6d3ebccae77df1d2e8421927a1a2684f80c98 | [
"MIT"
] | null | null | null | import torch
from sklearn.metrics import average_precision_score
import ipdb
import numpy as np
def img_ranking_evaluate_tinyImageNet(img_embs, labels, export_result = False):
#Pair-wise L2 distance between each pair
c_dist = torch.cdist(img_embs, img_embs)
#Sort the image id in ascending order by its d... | 35.115789 | 107 | 0.633094 | import torch
from sklearn.metrics import average_precision_score
import ipdb
import numpy as np
def img_ranking_evaluate_tinyImageNet(img_embs, labels, export_result = False):
c_dist = torch.cdist(img_embs, img_embs)
img_rank = torch.argsort(c_dist, dim = 1)
img_label_pred = (labels[img_rank]).s... | true | true |
1c0d39db8341f19625403b3cfac3d3e0404e4a90 | 1,098 | py | Python | gameye_database_viewer/contrib/sites/migrations/0003_set_site_domain_and_name.py | tr00st/gameye_database_viewer | ae37a4849aeffba9013613a4e5fede93ec1ab29e | [
"MIT"
] | null | null | null | gameye_database_viewer/contrib/sites/migrations/0003_set_site_domain_and_name.py | tr00st/gameye_database_viewer | ae37a4849aeffba9013613a4e5fede93ec1ab29e | [
"MIT"
] | 5 | 2021-06-08T19:13:10.000Z | 2022-03-11T23:26:44.000Z | gameye_database_viewer/contrib/sites/migrations/0003_set_site_domain_and_name.py | tr00st/gameye_database_viewer | ae37a4849aeffba9013613a4e5fede93ec1ab29e | [
"MIT"
] | null | null | null | """
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site d... | 25.534884 | 129 | 0.644809 | from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
Site = apps.get_model('sites', 'Site')
Site.objects.update_or_create(
id=settings.SITE_ID,
defaults={
'domain': 'gameye.tr00st.co.uk',
'name': 'GAMEYE Databas... | true | true |
1c0d3b04ae8a01ac9a4c9d90c9c9f44a8fa724dc | 4,834 | py | Python | src/query_strategies/vae.py | zeyademam/active_learning | fc90eaed32ba5aeb88542fa4f6e8fa9d4fdd80ee | [
"MIT"
] | 41 | 2021-11-25T02:58:56.000Z | 2022-03-21T02:44:58.000Z | src/query_strategies/vae.py | zeyademam/active_learning | fc90eaed32ba5aeb88542fa4f6e8fa9d4fdd80ee | [
"MIT"
] | 1 | 2021-12-01T07:46:44.000Z | 2021-12-08T02:07:10.000Z | src/query_strategies/vae.py | zeyademam/active_learning | fc90eaed32ba5aeb88542fa4f6e8fa9d4fdd80ee | [
"MIT"
] | 2 | 2021-11-29T06:09:56.000Z | 2021-12-12T10:35:58.000Z | import torch
import torch.nn as nn
import torch.nn.init as init
import numpy as np
CROP_H = 64
CROP_W = 64
class View(nn.Module):
def __init__(self, size):
super(View, self).__init__()
self.size = size
def forward(self, tensor):
return tensor.view(self.size)
class VAE(nn.Module):
... | 38.672 | 109 | 0.491105 | import torch
import torch.nn as nn
import torch.nn.init as init
import numpy as np
CROP_H = 64
CROP_W = 64
class View(nn.Module):
def __init__(self, size):
super(View, self).__init__()
self.size = size
def forward(self, tensor):
return tensor.view(self.size)
class VAE(nn.Module):
... | true | true |
1c0d3b8aad537ea778154a1be1e4a6e4ae0831e1 | 51,219 | py | Python | src/protect/pipeline/ProTECT.py | swp930/squashrebase | 80efa9c6d01efbe8ffafc3d9110d6f279734ea42 | [
"Apache-2.0"
] | null | null | null | src/protect/pipeline/ProTECT.py | swp930/squashrebase | 80efa9c6d01efbe8ffafc3d9110d6f279734ea42 | [
"Apache-2.0"
] | null | null | null | src/protect/pipeline/ProTECT.py | swp930/squashrebase | 80efa9c6d01efbe8ffafc3d9110d6f279734ea42 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python2.7
# Copyright 2016 Arjun Arkal Rao
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | 50.913519 | 100 | 0.613503 | from __future__ import print_function
from collections import defaultdict
from multiprocessing import cpu_count
from protect.addons.assess_car_t_validity import run_car_t_validity_assessment
from protect.addons.assess_immunotherapy_resistance import run_itx_resistance_assessment
from protect.addons.assess_mhc_pathway ... | true | true |
1c0d3b9fa2416d3bac88fd07201c87078447d4d2 | 35,636 | py | Python | tests/test_api_client.py | pyansys/openapi-common | 869869b6b8d59165e46d3357e44e07c70f18a294 | [
"MIT"
] | 1 | 2022-02-17T21:03:18.000Z | 2022-02-17T21:03:18.000Z | tests/test_api_client.py | pyansys/openapi-common | 869869b6b8d59165e46d3357e44e07c70f18a294 | [
"MIT"
] | 46 | 2022-02-09T17:29:18.000Z | 2022-03-21T13:42:59.000Z | tests/test_api_client.py | pyansys/openapi-common | 869869b6b8d59165e46d3357e44e07c70f18a294 | [
"MIT"
] | null | null | null | import copy
import datetime
import json
import os
import tempfile
import uuid
from typing import Dict, List, Tuple
import pytest
import requests_mock
import requests
from requests.packages.urllib3.response import HTTPResponse
from requests_mock.response import _IOReader, _FakeConnection
import secrets
from ansys.open... | 37.393494 | 120 | 0.625182 | import copy
import datetime
import json
import os
import tempfile
import uuid
from typing import Dict, List, Tuple
import pytest
import requests_mock
import requests
from requests.packages.urllib3.response import HTTPResponse
from requests_mock.response import _IOReader, _FakeConnection
import secrets
from ansys.open... | true | true |
1c0d3c17f290e0ec89b6c5ac1a08626e1e4093bd | 555 | py | Python | eegbci/data_containers/mixins/collatefunction_mixin.py | neergaard/eegbci-data | d3270d500b5eba452ed6647ec42a9af404e17b0a | [
"MIT"
] | null | null | null | eegbci/data_containers/mixins/collatefunction_mixin.py | neergaard/eegbci-data | d3270d500b5eba452ed6647ec42a9af404e17b0a | [
"MIT"
] | null | null | null | eegbci/data_containers/mixins/collatefunction_mixin.py | neergaard/eegbci-data | d3270d500b5eba452ed6647ec42a9af404e17b0a | [
"MIT"
] | null | null | null | from typing import TypedDict
import torch
class CollateFnMixin:
def collate_fn(self, batch) -> TypedDict:
subject_id_map = [int(x[2][1:4]) - 1 for x in batch]
waveforms = torch.stack([torch.as_tensor(x[0]) for x in batch])
targets = torch.stack([torch.as_tensor(x[1]) for x in batch])
... | 29.210526 | 95 | 0.695495 | from typing import TypedDict
import torch
class CollateFnMixin:
def collate_fn(self, batch) -> TypedDict:
subject_id_map = [int(x[2][1:4]) - 1 for x in batch]
waveforms = torch.stack([torch.as_tensor(x[0]) for x in batch])
targets = torch.stack([torch.as_tensor(x[1]) for x in batch])
... | true | true |
1c0d3c5089a139de5c5ca4d2a4eda4de9404d09e | 408 | py | Python | modules/nltk_contrib/tiger/utils/db.py | h4ck3rm1k3/NLP-project | aeba6302f60d27a8b9e65ad28d2d74e1276c7cd6 | [
"MIT"
] | 123 | 2015-01-06T10:46:18.000Z | 2022-02-01T10:05:16.000Z | nltk_contrib/tiger/utils/db.py | silky/nltk_contrib | c152bde901f05915e90b07a615b232adb123bed8 | [
"Apache-2.0"
] | 12 | 2015-01-13T06:27:18.000Z | 2020-07-30T23:00:41.000Z | nltk_contrib/tiger/utils/db.py | silky/nltk_contrib | c152bde901f05915e90b07a615b232adb123bed8 | [
"Apache-2.0"
] | 114 | 2015-01-13T04:47:49.000Z | 2021-11-13T08:16:02.000Z | # -*- coding: utf-8 -*-
# Copyright © 2007-2008 Stockholm TreeAligner Project
# Author: Torsten Marek <shlomme@gmx.net>
# Licensed under the GNU GPLv2
"""Utilities for SQLite3 database handling."""
try:
from pysqlite2 import dbapi2 as sqlite3
except ImportError:
import sqlite3
def create_inmem_db():
"""Cre... | 29.142857 | 58 | 0.720588 | try:
from pysqlite2 import dbapi2 as sqlite3
except ImportError:
import sqlite3
def create_inmem_db():
return sqlite3.connect(":memory:")
| true | true |
1c0d3cdc00c0dfd4b4371cb0e8744c1b13bb5883 | 6,193 | py | Python | models/_sources/logistic_regression_207b05cd2ed83ee471bd1fd9fb4270d4.py | catniplab/ML-music-analysis | 793d54ed16166fbcd9acf4eec24998892334e064 | [
"MIT"
] | null | null | null | models/_sources/logistic_regression_207b05cd2ed83ee471bd1fd9fb4270d4.py | catniplab/ML-music-analysis | 793d54ed16166fbcd9acf4eec24998892334e064 | [
"MIT"
] | null | null | null | models/_sources/logistic_regression_207b05cd2ed83ee471bd1fd9fb4270d4.py | catniplab/ML-music-analysis | 793d54ed16166fbcd9acf4eec24998892334e064 | [
"MIT"
] | 1 | 2021-12-01T22:57:56.000Z | 2021-12-01T22:57:56.000Z | import sys
import math
import numpy as np
import sklearn.linear_model as lm
from scipy.io import loadmat
from tqdm import tqdm
# For JSB_Chorales, notes 27 through 75 are the ones which are actually played
def get_dataset(dataname: str, key: str, lag=1, window=1, format='flattened'):
"""
:param dataname: w... | 27.402655 | 137 | 0.598579 | import sys
import math
import numpy as np
import sklearn.linear_model as lm
from scipy.io import loadmat
from tqdm import tqdm
def get_dataset(dataname: str, key: str, lag=1, window=1, format='flattened'):
data_dict = loadmat('data/' + dataname)
arrays = data_dict[key][0]
offset = lag + window - ... | true | true |
1c0d3fb99dd20e945b0da5591d70094b7842b7f0 | 6,060 | py | Python | funny/hardgame/hardgame.py | tekhnus/misc | cf4c6e29434c546e3c29f24f7bb16a0ac65005f5 | [
"Unlicense"
] | null | null | null | funny/hardgame/hardgame.py | tekhnus/misc | cf4c6e29434c546e3c29f24f7bb16a0ac65005f5 | [
"Unlicense"
] | null | null | null | funny/hardgame/hardgame.py | tekhnus/misc | cf4c6e29434c546e3c29f24f7bb16a0ac65005f5 | [
"Unlicense"
] | null | null | null | from __future__ import division
from collections import namedtuple
from random import uniform
import pyglet
from pyglet.window import key
class Unit:
def __init__(self, radius):
self.radius = radius
self.x, self.y, self.dx, self.dy = 0.0, 0.0, 0.0, 0.0
def set_location(self, x, y):
... | 33.114754 | 99 | 0.642409 | from __future__ import division
from collections import namedtuple
from random import uniform
import pyglet
from pyglet.window import key
class Unit:
def __init__(self, radius):
self.radius = radius
self.x, self.y, self.dx, self.dy = 0.0, 0.0, 0.0, 0.0
def set_location(self, x, y):
... | true | true |
1c0d3ff39cc5412fff2c6b94d53b79ed70ce9bd7 | 21,120 | py | Python | example/ui/example_pyqt5_ui.py | xiongbigboss/PyQt5_stylesheets | fa4ceb5c6fcd598b0d400b9d11525175d98d560b | [
"Apache-2.0"
] | 59 | 2017-04-16T06:29:10.000Z | 2022-03-25T09:28:31.000Z | example/ui/example_pyqt5_ui.py | yushirui/PyQt5_stylesheets | fa4ceb5c6fcd598b0d400b9d11525175d98d560b | [
"Apache-2.0"
] | 1 | 2020-02-17T03:04:05.000Z | 2020-02-17T03:04:05.000Z | example/ui/example_pyqt5_ui.py | yushirui/PyQt5_stylesheets | fa4ceb5c6fcd598b0d400b9d11525175d98d560b | [
"Apache-2.0"
] | 23 | 2017-08-31T14:41:30.000Z | 2022-03-06T15:12:45.000Z | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'example.ui'
#
# Created: Sat Dec 3 14:05:30 2016
# by: PyQt5 UI code generator 5.4
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self,... | 56.927224 | 108 | 0.715341 |
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1068, 824)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
s... | true | true |
1c0d40390849e82efbf1ed248ca49f8945fb3d8a | 1,649 | py | Python | utils.py | YutongWangUMich/tf_multiclass | 69f3cd638da87fc0fcad87b732fcb30dde51ce07 | [
"MIT"
] | null | null | null | utils.py | YutongWangUMich/tf_multiclass | 69f3cd638da87fc0fcad87b732fcb30dde51ce07 | [
"MIT"
] | null | null | null | utils.py | YutongWangUMich/tf_multiclass | 69f3cd638da87fc0fcad87b732fcb30dde51ce07 | [
"MIT"
] | 1 | 2022-01-17T15:28:12.000Z | 2022-01-17T15:28:12.000Z | from tensorflow.keras.utils import to_categorical
import tensorflow.keras.backend as K
import tensorflow as tf
def add_constant_column(x,val):
# return K.concatenate([x,K.constant(val,shape=(x.shape[0],1))],axis=-1)
# return K.concatenate([x,K.constant(val,shape=(x.shape[0],1))],axis=-1)
return tf.pad( x, ... | 28.929825 | 89 | 0.657368 | from tensorflow.keras.utils import to_categorical
import tensorflow.keras.backend as K
import tensorflow as tf
def add_constant_column(x,val):
return tf.pad( x, [[0,0],[0,1]], constant_values = val )
def to_t_categorical(y_raw,num_classes=None, dtype='float32'):
return to_categorical(y_raw, num_classes, dt... | true | true |
1c0d4122fe5e5537dbd1e3bc5f70d0b2ca39e3d5 | 2,554 | py | Python | Mac/Modules/fm/fmscan.py | arvindm95/unladen-swallow | 8175e37eaea7ca66ed03283b46bc1d2db0d3f9c3 | [
"PSF-2.0"
] | 2,293 | 2015-01-02T12:46:10.000Z | 2022-03-29T09:45:43.000Z | python/src/Mac/Modules/fm/fmscan.py | weiqiangzheng/sl4a | d3c17dca978cbeee545e12ea240a9dbf2a6999e9 | [
"Apache-2.0"
] | 315 | 2015-05-31T11:55:46.000Z | 2022-01-12T08:36:37.000Z | python/src/Mac/Modules/fm/fmscan.py | weiqiangzheng/sl4a | d3c17dca978cbeee545e12ea240a9dbf2a6999e9 | [
"Apache-2.0"
] | 1,033 | 2015-01-04T07:48:40.000Z | 2022-03-24T09:34:37.000Z | # Scan an Apple header file, generating a Python file of generator calls.
import sys
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
LONG = "Fonts"
SHORT = "fm"
def main():
input = "Fonts.h"
output = SHORT + "gen.py"
defsoutput = TOOLBOXDIR + LONG + ".... | 35.472222 | 108 | 0.54307 |
import sys
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
LONG = "Fonts"
SHORT = "fm"
def main():
input = "Fonts.h"
output = SHORT + "gen.py"
defsoutput = TOOLBOXDIR + LONG + ".py"
scanner = MyScanner(input, output, defsoutput)
scanner.scan()
... | false | true |
1c0d4158fa5c6622ea31faf0a19a721eb593a429 | 2,021 | py | Python | lightning_plus/api_basebone/drf/routers.py | twocucao/lightning-plus | e69c81da9c15fdfc37355e0362ff7ed804e94b2a | [
"MIT"
] | 1 | 2021-04-15T14:52:12.000Z | 2021-04-15T14:52:12.000Z | lightning_plus/api_basebone/drf/routers.py | twocucao/lightning | e69c81da9c15fdfc37355e0362ff7ed804e94b2a | [
"MIT"
] | null | null | null | lightning_plus/api_basebone/drf/routers.py | twocucao/lightning | e69c81da9c15fdfc37355e0362ff7ed804e94b2a | [
"MIT"
] | null | null | null | from rest_framework.routers import (
DynamicRoute,
Route,
SimpleRouter as OriginSimpleRouter,
)
class SimpleRouter(OriginSimpleRouter):
def __init__(self, **kwargs):
self.custom_base_name = kwargs.pop("custom_base_name")
super(SimpleRouter, self).__init__(**kwargs)
def get_default... | 30.164179 | 75 | 0.547254 | from rest_framework.routers import (
DynamicRoute,
Route,
SimpleRouter as OriginSimpleRouter,
)
class SimpleRouter(OriginSimpleRouter):
def __init__(self, **kwargs):
self.custom_base_name = kwargs.pop("custom_base_name")
super(SimpleRouter, self).__init__(**kwargs)
def get_default... | true | true |
1c0d41ba919114676706f6724291acecefb7c846 | 11,143 | py | Python | server/FPVtest.py | AgDude/Adeept_RaspTank | 1c22e4681233f859c638716054ac7a9dc394862b | [
"MIT"
] | null | null | null | server/FPVtest.py | AgDude/Adeept_RaspTank | 1c22e4681233f859c638716054ac7a9dc394862b | [
"MIT"
] | null | null | null | server/FPVtest.py | AgDude/Adeept_RaspTank | 1c22e4681233f859c638716054ac7a9dc394862b | [
"MIT"
] | null | null | null | #!/usr/bin/env/python3
# File name : server.py
# Description : for FPV video and OpenCV functions
# Website : www.gewbot.com
# Author : William(Based on Adrian Rosebrock's OpenCV code on pyimagesearch.com)
# Date : 2019/08/28
import time
import threading
import cv2
import zmq
import base64
import picamera
from p... | 27.78803 | 123 | 0.667863 | # Date : 2019/08/28
import time
import threading
import cv2
import zmq
import base64
import picamera
from picamera.array import PiRGBArray
import argparse
import imutils
from collections import deque
import psutil
import os
import servo
import PID
import LED
import datetime
from rpi_ws281x import *
import move
import... | true | true |
1c0d4379e7b16dcc051b45b2ad56090d0214b778 | 376 | py | Python | blockchain/broadcast/alice.py | cliffton/Fractal | 95dd9cd24494f0f668dcdfa6e734d360207f7435 | [
"MIT"
] | null | null | null | blockchain/broadcast/alice.py | cliffton/Fractal | 95dd9cd24494f0f668dcdfa6e734d360207f7435 | [
"MIT"
] | null | null | null | blockchain/broadcast/alice.py | cliffton/Fractal | 95dd9cd24494f0f668dcdfa6e734d360207f7435 | [
"MIT"
] | null | null | null | from pyp2p.net import *
import time
# Setup Alice's p2p node.
alice = Net(passive_bind="127.0.0.1", passive_port=44444, debug=1,
servers=[{'addr': '127.0.0.1', 'port': '8000'}])
alice.start()
alice.bootstrap()
alice.advertise()
# Event loop.
while 1:
print("alice")
for con in alice:
for re... | 19.789474 | 66 | 0.609043 | from pyp2p.net import *
import time
alice = Net(passive_bind="127.0.0.1", passive_port=44444, debug=1,
servers=[{'addr': '127.0.0.1', 'port': '8000'}])
alice.start()
alice.bootstrap()
alice.advertise()
# Event loop.
while 1:
print("alice")
for con in alice:
for reply in con:
pr... | true | true |
1c0d43914935c28a2a31678c3f27508a1a8958e6 | 484 | py | Python | tests/log_test.py | chencoyote/owasp-pysec | ed37e4fc5968c7ab17fa55aca3958e72c963ea78 | [
"Apache-2.0"
] | 1 | 2015-08-06T14:39:47.000Z | 2015-08-06T14:39:47.000Z | tests/log_test.py | chencoyote/owasp-pysec | ed37e4fc5968c7ab17fa55aca3958e72c963ea78 | [
"Apache-2.0"
] | null | null | null | tests/log_test.py | chencoyote/owasp-pysec | ed37e4fc5968c7ab17fa55aca3958e72c963ea78 | [
"Apache-2.0"
] | null | null | null | print "========"
print "LOG TEST"
print "========"
import pysec
from pysec import log
log.register_actions(
'LOG_TEST',
'LOG_MAIN'
)
log.register_errors(
'IS_FALSE'
)
log.start_log(log.actions.LOG_TEST)
log.add_global_emit(log.print_emitter)
NUM = 0
with log.ctx(log.actions.LOG_MAIN):
if NUM == 0:... | 16.689655 | 47 | 0.64876 | print "========"
print "LOG TEST"
print "========"
import pysec
from pysec import log
log.register_actions(
'LOG_TEST',
'LOG_MAIN'
)
log.register_errors(
'IS_FALSE'
)
log.start_log(log.actions.LOG_TEST)
log.add_global_emit(log.print_emitter)
NUM = 0
with log.ctx(log.actions.LOG_MAIN):
if NUM == 0:... | false | true |
1c0d44d74a72dbb2172a7fb8dd8536351d7ed33e | 957 | py | Python | testing/tests/001-main/001-empty/001-anonymous/100-preferences/002-review.defaultOptOut.py | fekblom/critic | a6b60c9053e13d4c878d50531860d7389568626d | [
"Apache-2.0"
] | 216 | 2015-01-05T12:48:10.000Z | 2022-03-08T00:12:23.000Z | testing/tests/001-main/001-empty/001-anonymous/100-preferences/002-review.defaultOptOut.py | fekblom/critic | a6b60c9053e13d4c878d50531860d7389568626d | [
"Apache-2.0"
] | 55 | 2015-02-28T12:10:26.000Z | 2020-11-18T17:45:16.000Z | testing/tests/001-main/001-empty/001-anonymous/100-preferences/002-review.defaultOptOut.py | fekblom/critic | a6b60c9053e13d4c878d50531860d7389568626d | [
"Apache-2.0"
] | 34 | 2015-05-02T15:15:10.000Z | 2020-06-15T19:20:37.000Z | # Check existence of preference review.defaultOptOut, added by
#
# http://critic-review.org/r/40
def check_heading(document):
headings = document.findAll("td", attrs={ "class": "heading" })
for heading in headings:
if heading.find(text="review.defaultOptOut:"):
return
testing.expect... | 33 | 76 | 0.624869 |
def check_heading(document):
headings = document.findAll("td", attrs={ "class": "heading" })
for heading in headings:
if heading.find(text="review.defaultOptOut:"):
return
testing.expect.check("<preference heading>",
"<expected content not found>")
def check_... | true | true |
1c0d48c1919d821cd6a12f983716ec5c11e76d20 | 9,637 | py | Python | cogs/owner.py | blueYOSHI9000/SchwiRSS | 7577d9c585fb419a5e372df0fc51d24c2a934b40 | [
"MIT"
] | null | null | null | cogs/owner.py | blueYOSHI9000/SchwiRSS | 7577d9c585fb419a5e372df0fc51d24c2a934b40 | [
"MIT"
] | null | null | null | cogs/owner.py | blueYOSHI9000/SchwiRSS | 7577d9c585fb419a5e372df0fc51d24c2a934b40 | [
"MIT"
] | null | null | null | from discord.ext import commands
import json
import sys
import os
import time
from modules.log import log
import modules.activity as activity
from modules.misc import get_args
from modules.misc import is_owner
class Owner(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands... | 44.823256 | 212 | 0.613054 | from discord.ext import commands
import json
import sys
import os
import time
from modules.log import log
import modules.activity as activity
from modules.misc import get_args
from modules.misc import is_owner
class Owner(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands... | true | true |
1c0d4936335e57fa364d7c6b8e21b7b8d87b375f | 933 | py | Python | AdaptiveGridFTPClient/auto_collect.py | arif-zaman/JGlobus | 877bd7df7edbe0765d8df4dafc9e2abcacbdbc54 | [
"Apache-2.0"
] | null | null | null | AdaptiveGridFTPClient/auto_collect.py | arif-zaman/JGlobus | 877bd7df7edbe0765d8df4dafc9e2abcacbdbc54 | [
"Apache-2.0"
] | null | null | null | AdaptiveGridFTPClient/auto_collect.py | arif-zaman/JGlobus | 877bd7df7edbe0765d8df4dafc9e2abcacbdbc54 | [
"Apache-2.0"
] | null | null | null | import os
#src = "gsiftp://oasis-dm.sdsc.xsede.org//oasis/scratch-comet/earslan/temp_project/1G-"
base_format = "timeout 65 mvn exec:java -Dexec.args=\"src/main/resources/config.cfg -s {0} -d {1} -maxcc {2}\""
src_format = "gsiftp://gridftp.stampede2.tacc.xsede.org:2811/scratch/06979/mazaman/data/{0}/"
dest_format = "... | 40.565217 | 121 | 0.644159 | import os
base_format = "timeout 65 mvn exec:java -Dexec.args=\"src/main/resources/config.cfg -s {0} -d {1} -maxcc {2}\""
src_format = "gsiftp://gridftp.stampede2.tacc.xsede.org:2811/scratch/06979/mazaman/data/{0}/"
dest_format = "gsiftp://oasis-dm.sdsc.xsede.org/expanse/lustre/scratch/mazaman/temp_project/data/"
ccs ... | true | true |
1c0d4942ea1ee451da72292cc2f80990721192fc | 3,508 | py | Python | flask_rest_api/utils.py | anson-vandoren/flask-rest-api | cb64869176e4831c8a70b5b9c6ba657b7afef6ce | [
"MIT"
] | 163 | 2018-05-01T19:08:41.000Z | 2022-03-13T09:54:54.000Z | flask_rest_api/utils.py | anson-vandoren/flask-rest-api | cb64869176e4831c8a70b5b9c6ba657b7afef6ce | [
"MIT"
] | 100 | 2018-05-20T03:34:53.000Z | 2020-05-24T13:46:03.000Z | flask_rest_api/utils.py | anson-vandoren/flask-rest-api | cb64869176e4831c8a70b5b9c6ba657b7afef6ce | [
"MIT"
] | 26 | 2018-07-27T07:31:47.000Z | 2020-05-04T01:11:12.000Z | """Utils"""
from collections.abc import Mapping
from werkzeug.datastructures import Headers
from flask import _app_ctx_stack
from apispec.utils import trim_docstring, dedent
# https://stackoverflow.com/a/3233356
def deepupdate(original, update):
"""Recursively update a dict.
Subdict's won't be overwritten ... | 31.044248 | 74 | 0.626568 |
from collections.abc import Mapping
from werkzeug.datastructures import Headers
from flask import _app_ctx_stack
from apispec.utils import trim_docstring, dedent
def deepupdate(original, update):
for key, value in update.items():
if isinstance(value, Mapping):
original[key] = deepupdate(orig... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.