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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f74b81037be83ae7ee405b51f6737b40ceb936cb | 555 | py | Python | regexlib/2021-5-15/python_re2_test_file/regexlib_3613.py | yetingli/ReDoS-Benchmarks | f5b5094d835649e957bf3fec6b8bd4f6efdb35fc | [
"MIT"
] | 1 | 2022-01-24T14:43:23.000Z | 2022-01-24T14:43:23.000Z | regexlib/2021-5-15/python_re2_test_file/regexlib_3613.py | yetingli/ReDoS-Benchmarks | f5b5094d835649e957bf3fec6b8bd4f6efdb35fc | [
"MIT"
] | null | null | null | regexlib/2021-5-15/python_re2_test_file/regexlib_3613.py | yetingli/ReDoS-Benchmarks | f5b5094d835649e957bf3fec6b8bd4f6efdb35fc | [
"MIT"
] | null | null | null | # 3613
# <(?<tag>\w*|\w*\.+\w*)>+((.|[\n\t\f\r\s])*?)<\/\k<tag>>
# EXPONENT
# nums:5
# EXPONENT AttackString:"<>"+"\t\t"*16+"! _1_EOD(i2)"
import re2 as re
from time import perf_counter
regex = """<(?<tag>\w*|\w*\.+\w*)>+((.|[\n\t\f\r\s])*?)<\/\k<tag>>"""
REGEX = re.compile(regex)
for i in range(0, 150000):
ATTAC... | 29.210526 | 69 | 0.52973 |
import re2 as re
from time import perf_counter
regex = """<(?<tag>\w*|\w*\.+\w*)>+((.|[\n\t\f\r\s])*?)<\/\k<tag>>"""
REGEX = re.compile(regex)
for i in range(0, 150000):
ATTACK = "<>" + "\t\t" * i * 1 + "! _1_EOD(i2)"
LEN = len(ATTACK)
BEGIN = perf_counter()
m = REGEX.search(ATTACK)
DURATION =... | true | true |
f74b81141dde7bbe764d03a5dd014712d26d6c61 | 6,925 | py | Python | library/dokku_config.py | weirdaze/ansible-dokku | e2f5a4d93ae124e7f4b1f9ac8d47e3e4ad34e798 | [
"MIT"
] | null | null | null | library/dokku_config.py | weirdaze/ansible-dokku | e2f5a4d93ae124e7f4b1f9ac8d47e3e4ad34e798 | [
"MIT"
] | null | null | null | library/dokku_config.py | weirdaze/ansible-dokku | e2f5a4d93ae124e7f4b1f9ac8d47e3e4ad34e798 | [
"MIT"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8 -*-
# from ansible.module_utils.basic import *
from ansible.module_utils.basic import AnsibleModule
import json
import pipes
import subprocess
import logging
try:
basestring
except NameError:
basestring = str
DOCUMENTATION = '''
---
module: dokku_config
short_description... | 28.265306 | 149 | 0.598556 | from ansible.module_utils.basic import AnsibleModule
import json
import pipes
import subprocess
import logging
try:
basestring
except NameError:
basestring = str
DOCUMENTATION = '''
---
module: dokku_config
short_description: Manage environment variables for a given dokku application
options:
app:
desc... | true | true |
f74b8115b43ea54d3538891ea230e9418ba43a9e | 1,757 | py | Python | notes/algo-ds-practice/problems/array/smallest_not_subset_sum.py | Anmol-Singh-Jaggi/interview-notes | 65af75e2b5725894fa5e13bb5cd9ecf152a0d652 | [
"MIT"
] | 6 | 2020-07-05T05:15:19.000Z | 2021-01-24T20:17:14.000Z | notes/algo-ds-practice/problems/array/smallest_not_subset_sum.py | Anmol-Singh-Jaggi/interview-notes | 65af75e2b5725894fa5e13bb5cd9ecf152a0d652 | [
"MIT"
] | null | null | null | notes/algo-ds-practice/problems/array/smallest_not_subset_sum.py | Anmol-Singh-Jaggi/interview-notes | 65af75e2b5725894fa5e13bb5cd9ecf152a0d652 | [
"MIT"
] | 2 | 2020-09-14T06:46:37.000Z | 2021-06-15T09:17:21.000Z | """
Given a sorted array (sorted in non-decreasing order) of positive numbers, find the smallest positive integer value that cannot be represented as sum of elements of any subset of given set.
Expected time complexity is O(n).
Examples:
Input: arr[] = {1, 3, 6, 10, 11, 15};
Output: 2
Input: arr[] = {1, 1, 1, 1};
... | 32.537037 | 298 | 0.671599 |
def smallest_not_subset_sum(arr):
if arr[0] > 1:
return 1
largest_possible = 1
for i in range(1, len(arr)):
elem = arr[i]
if elem > largest_possible + 1:
break
largest_possible += elem
return largest_possible + 1
def main():
arr = [5]
ans = sma... | true | true |
f74b81b3731a93e08104f940630a3928c4429298 | 20,251 | py | Python | src/app_temp.py | yhchen20/532-group11 | a99d21d053a9f0348a9af314083a037ce0e9bd9c | [
"MIT"
] | null | null | null | src/app_temp.py | yhchen20/532-group11 | a99d21d053a9f0348a9af314083a037ce0e9bd9c | [
"MIT"
] | null | null | null | src/app_temp.py | yhchen20/532-group11 | a99d21d053a9f0348a9af314083a037ce0e9bd9c | [
"MIT"
] | null | null | null | # Dash components
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output, State
# Core data science libraries
import altair as alt
import pandas as pd
import random
# Data loading functions
from temp_data i... | 35.653169 | 145 | 0.316231 | import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output, State
import altair as alt
import pandas as pd
import random
from temp_data import read_data
app = dash.Dash(external_stylesheets=[dbc.themes.BOOTST... | false | true |
f74b81e5299010241285001819e54aa604a06130 | 858 | py | Python | molecool/io/xyz.py | BBarrow31500/molssi-best-practices | 737d46aaab087bb9d5c45d2d76bc6f2e879fa060 | [
"BSD-3-Clause"
] | null | null | null | molecool/io/xyz.py | BBarrow31500/molssi-best-practices | 737d46aaab087bb9d5c45d2d76bc6f2e879fa060 | [
"BSD-3-Clause"
] | null | null | null | molecool/io/xyz.py | BBarrow31500/molssi-best-practices | 737d46aaab087bb9d5c45d2d76bc6f2e879fa060 | [
"BSD-3-Clause"
] | null | null | null | """
This module reads and writes xyz files.
"""
import os
import numpy as np
def open_xyz(file_location):
# Open an xyz file and return symbols and coordinates.
xyz_file = np.genfromtxt(fname=file_location, skip_header=2, dtype='unicode')
symbols = xyz_file[:,0]
coords = (xyz_file[:,1:])
coor... | 29.586207 | 100 | 0.60373 |
import os
import numpy as np
def open_xyz(file_location):
xyz_file = np.genfromtxt(fname=file_location, skip_header=2, dtype='unicode')
symbols = xyz_file[:,0]
coords = (xyz_file[:,1:])
coords = coords.astype(np.float)
return symbols, coords
def write_xyz(file_location, symbols, coordina... | true | true |
f74b82c65b889d59f29bb69b10c44b4182a72054 | 269 | py | Python | cougar/common/loads.py | Swall0w/cougar | 9161b2b1d0c256f4bb952ec190351684f28ec1b7 | [
"MIT"
] | 1 | 2019-11-23T12:20:50.000Z | 2019-11-23T12:20:50.000Z | cougar/common/loads.py | Swall0w/cougar | 9161b2b1d0c256f4bb952ec190351684f28ec1b7 | [
"MIT"
] | 1 | 2022-01-13T01:41:34.000Z | 2022-01-13T01:41:34.000Z | cougar/common/loads.py | Swall0w/cougar | 9161b2b1d0c256f4bb952ec190351684f28ec1b7 | [
"MIT"
] | null | null | null | import hjson
def read_config(filename: str) -> dict:
with open(filename, 'r') as f:
ret = f.read()
return hjson.loads(ret)
def read_labels(filename: str) -> list:
with open(filename) as f:
lines = f.read().splitlines()
return lines
| 17.933333 | 39 | 0.6171 | import hjson
def read_config(filename: str) -> dict:
with open(filename, 'r') as f:
ret = f.read()
return hjson.loads(ret)
def read_labels(filename: str) -> list:
with open(filename) as f:
lines = f.read().splitlines()
return lines
| true | true |
f74b8360107b60a2cd2fbf3da2dedeaae5a912e4 | 391 | py | Python | Spardha/Spardha/wsgi.py | atharvabhatt200/Spardha21-Backend | a88233df8874354b2d38e8620342c6ab0011bc6f | [
"MIT"
] | null | null | null | Spardha/Spardha/wsgi.py | atharvabhatt200/Spardha21-Backend | a88233df8874354b2d38e8620342c6ab0011bc6f | [
"MIT"
] | 9 | 2022-03-03T07:41:38.000Z | 2022-03-19T14:40:41.000Z | Spardha/Spardha/wsgi.py | atharvabhatt200/Spardha21-Backend | a88233df8874354b2d38e8620342c6ab0011bc6f | [
"MIT"
] | 1 | 2022-03-02T21:23:03.000Z | 2022-03-02T21:23:03.000Z | """
WSGI config for Spardha project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTI... | 23 | 78 | 0.785166 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Spardha.settings')
application = get_wsgi_application()
| true | true |
f74b847e172ac2cdc91315fa034599600eeeb726 | 31,942 | py | Python | lte/gateway/python/magma/pipelined/app/enforcement_stats.py | TatvamasiLabs/magma | 045ff1d142009bf172c24f53e15acb526429a346 | [
"BSD-3-Clause"
] | null | null | null | lte/gateway/python/magma/pipelined/app/enforcement_stats.py | TatvamasiLabs/magma | 045ff1d142009bf172c24f53e15acb526429a346 | [
"BSD-3-Clause"
] | null | null | null | lte/gateway/python/magma/pipelined/app/enforcement_stats.py | TatvamasiLabs/magma | 045ff1d142009bf172c24f53e15acb526429a346 | [
"BSD-3-Clause"
] | null | null | null | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... | 36.256527 | 125 | 0.602123 | import ipaddress
import os
from collections import defaultdict, namedtuple
from datetime import datetime, timedelta
from subprocess import check_output
import ryu.app.ofctl.api as ofctl_api
from lte.protos.pipelined_pb2 import RuleModResult
from lte.protos.policydb_pb2 import FlowDescription
from lte.protos.session_ma... | true | true |
f74b851a0072943b5bd5adef5401ea1d1b9e5de5 | 4,452 | py | Python | NaturalLanguageProcessingWithPython/05/practice37.py | t2y/learnnlp | b3c42413deaf5e70c7e7e1ee6d08c9dec114e85e | [
"Artistic-2.0"
] | 4 | 2015-09-19T02:51:06.000Z | 2016-08-18T13:18:49.000Z | NaturalLanguageProcessingWithPython/05/practice37.py | t2y/learnnlp | b3c42413deaf5e70c7e7e1ee6d08c9dec114e85e | [
"Artistic-2.0"
] | null | null | null | NaturalLanguageProcessingWithPython/05/practice37.py | t2y/learnnlp | b3c42413deaf5e70c7e7e1ee6d08c9dec114e85e | [
"Artistic-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import print_function
from pprint import pprint
from nltk import NgramTagger
from nltk import jsontags
from nltk.corpus import brown
import nltk
"""
5 章 単語の分類とタグ付け
37. 1つ前のタグ情報を利用するデフォルトタガーを作る
'I like to blog on Kim's blog' の blog にどうやってタグを付けるか?
a. 1つ前の単語を調べるが、現在の単語は無視... | 33.223881 | 66 | 0.645777 | from __future__ import print_function
from pprint import pprint
from nltk import NgramTagger
from nltk import jsontags
from nltk.corpus import brown
import nltk
@jsontags.register_tag
class PreviousTagTagger(NgramTagger):
json_tag = 'nltk.tag.sequential.PreviousTagTagger'
def __init__(self, train=None, ... | true | true |
f74b856e9159fa3f11441591455a478c985cdaf6 | 271 | py | Python | oi/uoj/P41/gen.py | Riteme/test | b511d6616a25f4ae8c3861e2029789b8ee4dcb8d | [
"BSD-Source-Code"
] | 3 | 2018-08-30T09:43:20.000Z | 2019-12-03T04:53:43.000Z | oi/uoj/P41/gen.py | Riteme/test | b511d6616a25f4ae8c3861e2029789b8ee4dcb8d | [
"BSD-Source-Code"
] | null | null | null | oi/uoj/P41/gen.py | Riteme/test | b511d6616a25f4ae8c3861e2029789b8ee4dcb8d | [
"BSD-Source-Code"
] | null | null | null | #!/usr/bin/env pypy
from sys import argv
from random import *
n = int(argv[1])
print 1
print n, n**2
for i in xrange(n):
P = range(1, n + 1)
shuffle(P)
line = ""
for x in P:
line += "0 " * i + str(x) + " " + "0 " * (n - i - 1)
print line
| 14.263158 | 60 | 0.490775 |
from sys import argv
from random import *
n = int(argv[1])
print 1
print n, n**2
for i in xrange(n):
P = range(1, n + 1)
shuffle(P)
line = ""
for x in P:
line += "0 " * i + str(x) + " " + "0 " * (n - i - 1)
print line
| false | true |
f74b86e67f6430d37ee2c7f55a9b629a172e493f | 3,158 | py | Python | pgAdmin/pgadmin4/tools/copyright_updater.py | WeilerWebServices/PostgreSQL | ae594ed077bebbad1be3c1d95c38b7c2c2683e8c | [
"PostgreSQL"
] | null | null | null | pgAdmin/pgadmin4/tools/copyright_updater.py | WeilerWebServices/PostgreSQL | ae594ed077bebbad1be3c1d95c38b7c2c2683e8c | [
"PostgreSQL"
] | null | null | null | pgAdmin/pgadmin4/tools/copyright_updater.py | WeilerWebServices/PostgreSQL | ae594ed077bebbad1be3c1d95c38b7c2c2683e8c | [
"PostgreSQL"
] | null | null | null | # -*- coding: utf-8 -*-
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
####################################################################... | 30.365385 | 79 | 0.542749 |
import os
import sys
import re
import codecs
ALLOWED_FILE_EXTENSIONS = (
".py", ".js", ".sql", ".cpp", ".h", ".rc", ".am", ".wsgi", ".pro",
".plist", ".rst", ".sh", ".in", ".mako", ".ini", ".jsx", ".rtf", ".rst",
"LICENSE"
)
EXCLUDE_DIR = ("node_modules")
def is_code_file(filename, extensions=ALLOWED... | true | true |
f74b8742b523ab4e459cece29dc0bef34dcb9103 | 7,138 | py | Python | sdk/lusid/models/aggregation_options.py | slemasne/lusid-sdk-python-preview | 94a97951ec2052bc1672b7be21e52ad2fcf6eea0 | [
"MIT"
] | null | null | null | sdk/lusid/models/aggregation_options.py | slemasne/lusid-sdk-python-preview | 94a97951ec2052bc1672b7be21e52ad2fcf6eea0 | [
"MIT"
] | null | null | null | sdk/lusid/models/aggregation_options.py | slemasne/lusid-sdk-python-preview | 94a97951ec2052bc1672b7be21e52ad2fcf6eea0 | [
"MIT"
] | null | null | null | # coding: utf-8
"""
LUSID API
FINBOURNE Technology # noqa: E501
The version of the OpenAPI document: 0.11.3725
Contact: info@finbourne.com
Generated by: https://openapi-generator.tech
"""
try:
from inspect import getfullargspec
except ImportError:
from inspect import getargspec as getf... | 40.327684 | 312 | 0.669936 |
try:
from inspect import getfullargspec
except ImportError:
from inspect import getargspec as getfullargspec
import pprint
import re import six
from lusid.configuration import Configuration
class AggregationOptions(object):
openapi_types = {
'use_ansi_like_syntax': 'bool',
'allow_par... | true | true |
f74b87c2e348557b7516c97c5393d280bb8ef3d4 | 363 | py | Python | onlinecourse/migrations/0002_auto_20210620_0230.py | Krishpandya682/IBMFullStackDjango | 4a1f181d2ee309a1c040c1e51e49b4fccd558d08 | [
"Apache-2.0"
] | null | null | null | onlinecourse/migrations/0002_auto_20210620_0230.py | Krishpandya682/IBMFullStackDjango | 4a1f181d2ee309a1c040c1e51e49b4fccd558d08 | [
"Apache-2.0"
] | null | null | null | onlinecourse/migrations/0002_auto_20210620_0230.py | Krishpandya682/IBMFullStackDjango | 4a1f181d2ee309a1c040c1e51e49b4fccd558d08 | [
"Apache-2.0"
] | null | null | null | # Generated by Django 3.1.3 on 2021-06-19 21:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('onlinecourse', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='submission',
old_name='chocies',
... | 19.105263 | 47 | 0.584022 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('onlinecourse', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='submission',
old_name='chocies',
new_name='choices',
),
]
| true | true |
f74b883dc11e23e3931c0be0f84e6c49c5b4d5c0 | 416 | py | Python | cython_setup.py | paroj/async-ev-cnn | f7e70e75b07f43afef8ffd7eaf6f43ddefab0ae0 | [
"MIT"
] | 6 | 2021-03-04T07:44:10.000Z | 2022-02-28T14:49:53.000Z | cython_setup.py | paroj/async-ev-cnn | f7e70e75b07f43afef8ffd7eaf6f43ddefab0ae0 | [
"MIT"
] | 1 | 2022-03-10T02:12:31.000Z | 2022-03-10T02:12:31.000Z | cython_setup.py | paroj/async-ev-cnn | f7e70e75b07f43afef8ffd7eaf6f43ddefab0ae0 | [
"MIT"
] | 4 | 2021-07-27T06:11:33.000Z | 2022-03-25T03:32:44.000Z | from sys import platform
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy
ext_modules = [
Extension(
"src.libs.cutils",
["src/libs/cutils.pyx"],
extra_compile_args=['/openmp' if platform == "win32" else '-fopenmp']
... | 21.894737 | 77 | 0.697115 | from sys import platform
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy
ext_modules = [
Extension(
"src.libs.cutils",
["src/libs/cutils.pyx"],
extra_compile_args=['/openmp' if platform == "win32" else '-fopenmp']
... | true | true |
f74b88b217b3e7ef06d815c294ed0f2c523f74ed | 3,362 | py | Python | tableauserverclient/server/endpoint/auth_endpoint.py | rrobertsrgare/server-client-python | 3f4db45584fb352e9f21c870027a2302cb824909 | [
"CC0-1.0",
"MIT"
] | null | null | null | tableauserverclient/server/endpoint/auth_endpoint.py | rrobertsrgare/server-client-python | 3f4db45584fb352e9f21c870027a2302cb824909 | [
"CC0-1.0",
"MIT"
] | null | null | null | tableauserverclient/server/endpoint/auth_endpoint.py | rrobertsrgare/server-client-python | 3f4db45584fb352e9f21c870027a2302cb824909 | [
"CC0-1.0",
"MIT"
] | null | null | null | from ..request_factory import RequestFactory
from .exceptions import ServerResponseError
from .endpoint import Endpoint, api
import xml.etree.ElementTree as ET
import logging
logger = logging.getLogger('tableau.endpoint.auth')
class Auth(Endpoint):
class contextmgr(object):
def __init__(self, callback):
... | 44.236842 | 115 | 0.663891 | from ..request_factory import RequestFactory
from .exceptions import ServerResponseError
from .endpoint import Endpoint, api
import xml.etree.ElementTree as ET
import logging
logger = logging.getLogger('tableau.endpoint.auth')
class Auth(Endpoint):
class contextmgr(object):
def __init__(self, callback):
... | true | true |
f74b88d8c4ccbe1c94598053a1c2779a2ebc71d0 | 1,907 | py | Python | v2/user.py | Llf0703/Anti-Cheating | 01c49feaf5d094fa09efd91f7181e027601f1c57 | [
"MIT"
] | 5 | 2018-12-27T05:15:11.000Z | 2020-02-29T10:57:57.000Z | v2/user.py | Llf0703/Anti-Cheating | 01c49feaf5d094fa09efd91f7181e027601f1c57 | [
"MIT"
] | 1 | 2019-01-06T07:05:29.000Z | 2019-01-06T07:05:29.000Z | v2/user.py | Llf0703/Anti-Cheating | 01c49feaf5d094fa09efd91f7181e027601f1c57 | [
"MIT"
] | 2 | 2019-01-06T07:01:16.000Z | 2019-12-24T03:26:48.000Z | # 下载选手代码
import re
import os
from ac.pre import get_yaml
from ac.pre import get_html
from selenium import webdriver
from urllib.request import quote
from selenium.webdriver.firefox.options import Options
config = get_yaml()
contest_url = str(config['oj_url'])+'/contest/'+str(config['contest_id'])
options = Options(... | 30.758065 | 122 | 0.5742 |
import re
import os
from ac.pre import get_yaml
from ac.pre import get_html
from selenium import webdriver
from urllib.request import quote
from selenium.webdriver.firefox.options import Options
config = get_yaml()
contest_url = str(config['oj_url'])+'/contest/'+str(config['contest_id'])
options = Options()
options... | true | true |
f74b88de7259886dce8007d75b04160be6cc2606 | 3,123 | py | Python | aula_ORM/aula_ORM/settings.py | dfvalle/project-si7 | a206cc1f34ec2e80432fc0275e4931270212776a | [
"Apache-2.0"
] | null | null | null | aula_ORM/aula_ORM/settings.py | dfvalle/project-si7 | a206cc1f34ec2e80432fc0275e4931270212776a | [
"Apache-2.0"
] | null | null | null | aula_ORM/aula_ORM/settings.py | dfvalle/project-si7 | a206cc1f34ec2e80432fc0275e4931270212776a | [
"Apache-2.0"
] | 1 | 2019-03-11T20:48:41.000Z | 2019-03-11T20:48:41.000Z | """
Django settings for aula_ORM project.
Generated by 'django-admin startproject' using Django 2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
# ... | 25.598361 | 91 | 0.697727 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '=7n!y$lq-wa5ow8)i68m@z4rvt^_f*v823#s1$(dsvacf^eaj6'
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes... | true | true |
f74b88e96a7545b18a00a7b63944ef1b6b513620 | 1,174 | py | Python | notifications/bgt-traffic-solutions/challenge2.py | jtmorgan/ds4ux | 14c4ece59b367fe7c8db09a126161693b9a640b3 | [
"MIT"
] | null | null | null | notifications/bgt-traffic-solutions/challenge2.py | jtmorgan/ds4ux | 14c4ece59b367fe7c8db09a126161693b9a640b3 | [
"MIT"
] | null | null | null | notifications/bgt-traffic-solutions/challenge2.py | jtmorgan/ds4ux | 14c4ece59b367fe7c8db09a126161693b9a640b3 | [
"MIT"
] | null | null | null | """
What was the busiest hour of any day for northbound bike traffic? How about southbound pedestrian traffic?
"""
import bgt_traffic
busiest_bike_nb = []
busiest_bike_count = 0
busiest_ped_sb = []
busiest_ped_count = 0
for dkey, dval in bgt_traffic.traffic.items():
for hkey, hval in dval.items():
if hva... | 33.542857 | 106 | 0.573254 |
import bgt_traffic
busiest_bike_nb = []
busiest_bike_count = 0
busiest_ped_sb = []
busiest_ped_count = 0
for dkey, dval in bgt_traffic.traffic.items():
for hkey, hval in dval.items():
if hval['bike nb'] > busiest_bike_count:
busiest_bike_count = hval['bike nb']
busiest_bike_nb[:] ... | true | true |
f74b89818f09731a8af701edc5f99e1c12cd3e6e | 21,158 | py | Python | sigutils/plot.py | ryanpdwyer/sigutils | 341513f403dee0b2c49e9630c86f0483c0d2d359 | [
"MIT"
] | null | null | null | sigutils/plot.py | ryanpdwyer/sigutils | 341513f403dee0b2c49e9630c86f0483c0d2d359 | [
"MIT"
] | null | null | null | sigutils/plot.py | ryanpdwyer/sigutils | 341513f403dee0b2c49e9630c86f0483c0d2d359 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
- We should have plotting functions
bode_ba(ba, ...)
Takes an analog transfer function in ba form
bode_z(b, a=1, fs, ...)
Takes a digital transfer function in z form. Is fs, nyq, or dt preferred?
bode_zpk(zpk, fs?, ...)
Use zpk form (or state space?)
... | 33.37224 | 81 | 0.585925 | from __future__ import division, print_function, absolute_import
from collections import Counter
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal
from sigutils._util import (freqresp, freqz, mag_phase)
def adjust_y_ticks(ax, delta):
ylim = np.array(ax.get_yli... | true | true |
f74b89d21bd3d571644c4ae536ac2c19ce6e6f20 | 158,064 | py | Python | core/domain/user_services_test.py | paprajapati9/oppia | 54b2f231043c4b4ef4477bd05b21e347086bfdc9 | [
"Apache-2.0"
] | null | null | null | core/domain/user_services_test.py | paprajapati9/oppia | 54b2f231043c4b4ef4477bd05b21e347086bfdc9 | [
"Apache-2.0"
] | null | null | null | core/domain/user_services_test.py | paprajapati9/oppia | 54b2f231043c4b4ef4477bd05b21e347086bfdc9 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 41.90456 | 116 | 0.684508 |
from __future__ import annotations
import datetime
import logging
import os
import re
from core import feconf
from core import utils
from core.constants import constants
from core.domain import auth_services
from core.domain import collection_services
from core.domain import event_services
from core.domain import e... | true | true |
f74b8a85e6a6cce306d567873336b2497f94deda | 824 | py | Python | datasets/plot.py | cplan082-tech/project_csi4103 | 987d19deacc8cb36c473adf33335fc63ae4aab10 | [
"MIT"
] | 2 | 2022-03-20T21:38:28.000Z | 2022-03-22T21:23:12.000Z | datasets/plot.py | cplan082-tech/project_csi4103 | 987d19deacc8cb36c473adf33335fc63ae4aab10 | [
"MIT"
] | null | null | null | datasets/plot.py | cplan082-tech/project_csi4103 | 987d19deacc8cb36c473adf33335fc63ae4aab10 | [
"MIT"
] | 1 | 2022-03-20T15:32:27.000Z | 2022-03-20T15:32:27.000Z | import csv
import math
import numpy as np
import matplotlib.pyplot as plt
def read_csv_file(name):
file = open(name)
type(file)
csvreader = csv.reader(file)
header = []
header = next(csvreader) #First line of CSV is name of headers
"Populates array with rows from CSV [[shoulder_angle_1,elbow_... | 21.128205 | 79 | 0.626214 | import csv
import math
import numpy as np
import matplotlib.pyplot as plt
def read_csv_file(name):
file = open(name)
type(file)
csvreader = csv.reader(file)
header = []
header = next(csvreader)
rows = []
for row in csvreader:
rows.append(row)
file.close()
return rows
def... | true | true |
f74b8accd9bb269ddf8b01f4579210e6c982fb54 | 12,981 | py | Python | hathor/transaction/resources/push_tx.py | luislhl/hathor-core | 9fe53b5a6ecb6efd3f4e8ce2ba21d591f0402cc6 | [
"Apache-2.0"
] | 51 | 2019-12-28T03:33:27.000Z | 2022-03-10T14:03:03.000Z | hathor/transaction/resources/push_tx.py | luislhl/hathor-core | 9fe53b5a6ecb6efd3f4e8ce2ba21d591f0402cc6 | [
"Apache-2.0"
] | 316 | 2019-09-10T09:20:05.000Z | 2022-03-31T20:18:56.000Z | hathor/transaction/resources/push_tx.py | luislhl/hathor-core | 9fe53b5a6ecb6efd3f4e8ce2ba21d591f0402cc6 | [
"Apache-2.0"
] | 19 | 2020-01-04T00:13:18.000Z | 2022-02-08T21:18:46.000Z | # Copyright 2021 Hathor Labs
#
# 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, s... | 38.749254 | 109 | 0.465912 |
import struct
from json import JSONDecodeError
from typing import TYPE_CHECKING, Any, Dict, Optional, cast
from hathorlib.base_transaction import tx_or_block_from_bytes as lib_tx_or_block_from_bytes
from structlog import get_logger
from twisted.web import resource
from twisted.web.http import Request
from hathor.api... | true | true |
f74b8e010afeb72a0caaa253e324c5b0f9a7a40e | 1,021 | py | Python | eclcli/bare/v2/zone.py | hanasuke/eclcli | a72191799986a02596d0d467253fd9f5ee03c5c8 | [
"Apache-2.0"
] | 32 | 2016-08-31T04:12:40.000Z | 2020-12-11T04:49:57.000Z | eclcli/bare/v2/zone.py | hanasuke/eclcli | a72191799986a02596d0d467253fd9f5ee03c5c8 | [
"Apache-2.0"
] | 27 | 2016-09-06T07:50:36.000Z | 2021-09-14T09:46:03.000Z | eclcli/bare/v2/zone.py | hanasuke/eclcli | a72191799986a02596d0d467253fd9f5ee03c5c8 | [
"Apache-2.0"
] | 24 | 2016-09-02T01:09:09.000Z | 2021-01-19T09:14:16.000Z | from eclcli.common import command
from eclcli.common import utils
from eclcli.bare import bare_utils
class ShowZone(command.Lister):
"""Show availability zone details"""
def get_parser(self, prog_name):
parser = super(ShowZone, self).get_parser(prog_name)
return parser
def take_action(s... | 27.594595 | 66 | 0.545544 | from eclcli.common import command
from eclcli.common import utils
from eclcli.bare import bare_utils
class ShowZone(command.Lister):
def get_parser(self, prog_name):
parser = super(ShowZone, self).get_parser(prog_name)
return parser
def take_action(self, parsed_args):
bare_client = ... | true | true |
f74b8e2765e044fa3458b6266ae46b1debf093b2 | 1,268 | py | Python | UmidadeTemperaturaDB.py | Lang-ger/coldDev | 1b2918b674286c52af041f963f373cd4a87b64dd | [
"MIT"
] | null | null | null | UmidadeTemperaturaDB.py | Lang-ger/coldDev | 1b2918b674286c52af041f963f373cd4a87b64dd | [
"MIT"
] | null | null | null | UmidadeTemperaturaDB.py | Lang-ger/coldDev | 1b2918b674286c52af041f963f373cd4a87b64dd | [
"MIT"
] | null | null | null | import Adafruit_DHT;
import MySQLdb as mysql;
import datetime;
import time;
ts = time.time();
sensor = Adafruit_DHT.DHT22;
pin = 4;
umidade, temperatura = Adafruit_DHT.read_retry(sensor, pin);
db = mysql.connect("localhost","root","","colddev");
while(1):
ts = time.time();
sensor = Adafruit_DHT.DHT22... | 36.228571 | 127 | 0.597003 | import Adafruit_DHT;
import MySQLdb as mysql;
import datetime;
import time;
ts = time.time();
sensor = Adafruit_DHT.DHT22;
pin = 4;
umidade, temperatura = Adafruit_DHT.read_retry(sensor, pin);
db = mysql.connect("localhost","root","","colddev");
while(1):
ts = time.time();
sensor = Adafruit_DHT.DHT22... | false | true |
f74b8e806ab9e15e52eddff33c8141a1ca90da73 | 2,351 | py | Python | coordPredator.py | thctamm/cs289-final-project | 812d40e1af1d51f505d82d4bd649d6daa704fbd7 | [
"MIT"
] | null | null | null | coordPredator.py | thctamm/cs289-final-project | 812d40e1af1d51f505d82d4bd649d6daa704fbd7 | [
"MIT"
] | null | null | null | coordPredator.py | thctamm/cs289-final-project | 812d40e1af1d51f505d82d4bd649d6daa704fbd7 | [
"MIT"
] | null | null | null | import random, math
from agent import Agent
from variables import *
MAX_NEIGHBOR_FORCE = abs(math.log(PREDATOR_SENSING_DISTANCE/PREDATOR_DESIRED_DIST))
## Built on predator that zig-zags.
## Coordinate with other predators.
class CoordPredator(Agent):
def __init__(self, sim, start_loc = None):
random.seed... | 33.585714 | 115 | 0.574649 | import random, math
from agent import Agent
from variables import *
MAX_NEIGHBOR_FORCE = abs(math.log(PREDATOR_SENSING_DISTANCE/PREDATOR_DESIRED_DIST))
class CoordPredator(Agent):
def __init__(self, sim, start_loc = None):
random.seed()
super().__init__(sim, start_loc)
self.nearby_fish = [... | true | true |
f74b90511e76bf3b88d1fc5d0c8d4d4b4a3a1073 | 53,747 | py | Python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_04_01/aio/operations/_express_route_circuits_operations.py | praveenkuttappan/azure-sdk-for-python | 4b79413667b7539750a6c7dde15737013a3d4bd5 | [
"MIT"
] | 2,728 | 2015-01-09T10:19:32.000Z | 2022-03-31T14:50:33.000Z | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_04_01/aio/operations/_express_route_circuits_operations.py | v-xuto/azure-sdk-for-python | 9c6296d22094c5ede410bc83749e8df8694ccacc | [
"MIT"
] | 17,773 | 2015-01-05T15:57:17.000Z | 2022-03-31T23:50:25.000Z | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_04_01/aio/operations/_express_route_circuits_operations.py | v-xuto/azure-sdk-for-python | 9c6296d22094c5ede410bc83749e8df8694ccacc | [
"MIT"
] | 1,916 | 2015-01-19T05:05:41.000Z | 2022-03-31T19:36:44.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 50.993359 | 261 | 0.67507 | from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pi... | true | true |
f74b906a1952f0ebfd7ae4e2e3e57c4a56150472 | 3,739 | py | Python | YamlVariablesLibrary/tests/run_tests.py | jbarnes007/robotframework-yamlvariableslibrary | 7f32a554a84fa039fc505643672edc971bf09b26 | [
"Apache-2.0"
] | 1 | 2015-10-05T10:43:25.000Z | 2015-10-05T10:43:25.000Z | YamlVariablesLibrary/tests/run_tests.py | jbarnes007/robotframework-yamlvariableslibrary | 7f32a554a84fa039fc505643672edc971bf09b26 | [
"Apache-2.0"
] | null | null | null | YamlVariablesLibrary/tests/run_tests.py | jbarnes007/robotframework-yamlvariableslibrary | 7f32a554a84fa039fc505643672edc971bf09b26 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
import env
import os
import sys
from subprocess import Popen, call
from tempfile import TemporaryFile
#from run_unit_tests import run_unit_tests
ROBOT_ARGS = [
'--doc', 'YamlVariablesOutput',
'--outputdir', '%(outdir)s',
'--escape', 'space:SP',
'--report', 'none',
'--log', '... | 33.990909 | 459 | 0.652046 |
import env
import os
import sys
from subprocess import Popen, call
from tempfile import TemporaryFile
ROBOT_ARGS = [
'--doc', 'YamlVariablesOutput',
'--outputdir', '%(outdir)s',
'--escape', 'space:SP',
'--report', 'none',
'--log', 'none',
'--loglevel', 'DEBUG',
'--pythonpath', '%(pythonpa... | false | true |
f74b91c8da1bf15f226d2fcb0d732dff687bcc4d | 2,951 | py | Python | nova/tests/unit/cert/test_rpcapi.py | gabriel-samfira/nova | 5ef07cc04dbf0216452ae358e57d9ddac51f1803 | [
"Apache-2.0"
] | 7 | 2015-09-22T11:27:16.000Z | 2015-11-02T12:33:46.000Z | nova/tests/unit/cert/test_rpcapi.py | gabriel-samfira/nova | 5ef07cc04dbf0216452ae358e57d9ddac51f1803 | [
"Apache-2.0"
] | 2 | 2015-09-07T22:14:46.000Z | 2020-08-12T08:51:56.000Z | nova/tests/unit/cert/test_rpcapi.py | gabriel-samfira/nova | 5ef07cc04dbf0216452ae358e57d9ddac51f1803 | [
"Apache-2.0"
] | 4 | 2015-09-09T16:48:56.000Z | 2022-03-15T20:52:57.000Z | # Copyright 2012, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | 34.717647 | 78 | 0.662148 |
import contextlib
import mock
from oslo.config import cfg
from nova.cert import rpcapi as cert_rpcapi
from nova import context
from nova import test
CONF = cfg.CONF
class CertRpcAPITestCase(test.NoDBTestCase):
def _test_cert_api(self, method, **kwargs):
ctxt = context.RequestContext('fake_user', 'fak... | true | true |
f74b92ffe90b651d08837a36b8ea135b55755c06 | 19,890 | py | Python | jmespath/parser.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | jmespath/parser.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | jmespath/parser.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | """Top down operator precedence parser.
This is an implementation of Vaughan R. Pratt's
"Top Down Operator Precedence" parser.
(http://dl.acm.org/citation.cfm?doid=512927.512931).
These are some additional resources that help explain the
general idea behind a Pratt parser:
* http://effbot.org/zone/simple-to... | 37.741935 | 85 | 0.566918 | import random
from jmespath import lexer
from jmespath.compat import with_repr_method
from jmespath import ast
from jmespath import exceptions
from jmespath import visitor
class Parser(object):
BINDING_POWER = {
'eof': 0,
'unquoted_identifier': 0,
'quoted_identifier': 0,
... | true | true |
f74b937ef012c5f653a2570d530ab477d992c08c | 5,088 | py | Python | source/main.py | JoHyukJun/gdrive-rclone | 310fe3d77843d9e7f732105d6ce068e6602c665e | [
"MIT"
] | null | null | null | source/main.py | JoHyukJun/gdrive-rclone | 310fe3d77843d9e7f732105d6ce068e6602c665e | [
"MIT"
] | null | null | null | source/main.py | JoHyukJun/gdrive-rclone | 310fe3d77843d9e7f732105d6ce068e6602c665e | [
"MIT"
] | null | null | null | import os
import subprocess
from pathlib import Path
from tkinter import *
from tkinter import ttk
from tkinter import font
BASE_DIR = Path(__file__).resolve(strict=True).parent
RCLONE = BASE_DIR / 'rclone/rclone.exe'
# subprocess.run([RCLONE, 'ls'], shell=True)
class Application(Frame):
def __init__(self, ... | 31.407407 | 140 | 0.621855 | import os
import subprocess
from pathlib import Path
from tkinter import *
from tkinter import ttk
from tkinter import font
BASE_DIR = Path(__file__).resolve(strict=True).parent
RCLONE = BASE_DIR / 'rclone/rclone.exe'
class Application(Frame):
def __init__(self, master=None):
super().__init__(master... | true | true |
f74b9383c2c8fc750ef1640d1fd1cf582b26be18 | 5,342 | py | Python | sdk/python/pulumi_azure_native/storagesync/v20191001/get_storage_sync_service.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/storagesync/v20191001/get_storage_sync_service.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/storagesync/v20191001/get_storage_sync_service.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__a... | 37.097222 | 193 | 0.668476 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__all__ = [
'GetStorageSyncServiceResult',
'AwaitableGetStorageSyncServiceResult',
'get_storage_sync_service',
]
@pulumi.output_type
class GetStorageSyncServi... | true | true |
f74b93f2ba91c860ce8e8dca9c307f3dd4f8e782 | 464 | py | Python | toontown/coghq/PaintMixer.py | LittleNed/toontown-stride | 1252a8f9a8816c1810106006d09c8bdfe6ad1e57 | [
"Apache-2.0"
] | 3 | 2020-01-02T08:43:36.000Z | 2020-07-05T08:59:02.000Z | toontown/coghq/PaintMixer.py | NoraTT/Historical-Commits-Project-Altis-Source | fe88e6d07edf418f7de6ad5b3d9ecb3d0d285179 | [
"Apache-2.0"
] | null | null | null | toontown/coghq/PaintMixer.py | NoraTT/Historical-Commits-Project-Altis-Source | fe88e6d07edf418f7de6ad5b3d9ecb3d0d285179 | [
"Apache-2.0"
] | 4 | 2019-06-20T23:45:23.000Z | 2020-10-14T20:30:15.000Z | from toontown.coghq import PlatformEntity
class PaintMixer(PlatformEntity.PlatformEntity):
def start(self):
PlatformEntity.PlatformEntity.start(self)
model = self.platform.model
shaft = model.find('**/PaintMixerBase1')
shaft.setSz(self.shaftScale)
shaft.node().setPreserveTr... | 33.142857 | 52 | 0.689655 | from toontown.coghq import PlatformEntity
class PaintMixer(PlatformEntity.PlatformEntity):
def start(self):
PlatformEntity.PlatformEntity.start(self)
model = self.platform.model
shaft = model.find('**/PaintMixerBase1')
shaft.setSz(self.shaftScale)
shaft.node().setPreserveTr... | true | true |
f74b9466425d36f82dd07f9f29402da81582f421 | 2,835 | py | Python | python/examples/bin_info.py | xavierholt/binaryninja-api | f52f7535c245f33d3c9f569b4a13abc05cf50998 | [
"MIT"
] | null | null | null | python/examples/bin_info.py | xavierholt/binaryninja-api | f52f7535c245f33d3c9f569b4a13abc05cf50998 | [
"MIT"
] | null | null | null | python/examples/bin_info.py | xavierholt/binaryninja-api | f52f7535c245f33d3c9f569b4a13abc05cf50998 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# Copyright (c) 2015-2020 Vector 35 Inc
#
# 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, mo... | 34.573171 | 94 | 0.709347 |
import sys
import os
import binaryninja.log as log
from binaryninja.binaryview import BinaryViewType
import binaryninja.interaction as interaction
from binaryninja.plugin import PluginCommand
from binaryninja import range
def get_bininfo(bv):
if bv is None:
filename = ""
if len(sys.argv) > 1:
filename = sy... | true | true |
f74b9485023e1cf2238de16a01b02978d45009e2 | 1,275 | py | Python | indicators_transformer/EMA_FT.py | vd1371/gram | 065c33c854beea633a833e64a7b80ff727868f2d | [
"Apache-2.0"
] | null | null | null | indicators_transformer/EMA_FT.py | vd1371/gram | 065c33c854beea633a833e64a7b80ff727868f2d | [
"Apache-2.0"
] | 21 | 2020-02-12T07:25:55.000Z | 2020-03-18T21:10:00.000Z | indicators_transformer/EMA_FT.py | vd1371/gram | 065c33c854beea633a833e64a7b80ff727868f2d | [
"Apache-2.0"
] | 1 | 2021-12-04T13:09:46.000Z | 2021-12-04T13:09:46.000Z | # Adding parent directory to the PYTHONPATH
import sys
sys.path.insert(0,'..')
import numpy as np
from utils.GlobalVariables import *
class EMA_FT(object):
# Base class for all of the feature transformers
def __init__(self):
super(EMA_FT, self).__init__()
def transform(self, df, features):
# it construct a set... | 23.611111 | 85 | 0.711373 | import sys
sys.path.insert(0,'..')
import numpy as np
from utils.GlobalVariables import *
class EMA_FT(object):
def __init__(self):
super(EMA_FT, self).__init__()
def transform(self, df, features):
df['EMA_FT'] = np.zeros(len(df))
df.loc[df[CLOSE] > features, 'EMA_FT'] = LONG
df.loc[df[CLOSE] < f... | true | true |
f74b94969e0495f80d10cfcaaa06199c3ccc54cf | 416 | py | Python | vscode-client/syntaxes/build_syntax.py | chrisjsewell/rst-language-server | 56580d878bdaf5e07bc1d189c4472723cbaac782 | [
"MIT"
] | 15 | 2020-03-04T21:28:39.000Z | 2021-11-25T11:11:08.000Z | vscode-client/syntaxes/build_syntax.py | chrisjsewell/rst-language-server | 56580d878bdaf5e07bc1d189c4472723cbaac782 | [
"MIT"
] | 7 | 2020-03-04T16:20:12.000Z | 2022-02-27T00:40:13.000Z | vscode-client/syntaxes/build_syntax.py | chrisjsewell/rst-language-server | 56580d878bdaf5e07bc1d189c4472723cbaac782 | [
"MIT"
] | 1 | 2020-05-24T19:21:07.000Z | 2020-05-24T19:21:07.000Z | #!/usr/bin/env python
import os
import plistlib
import yaml
if __name__ == "__main__":
in_path = os.path.join(
os.path.dirname(__file__), "restructuredtext.tmLanguage.yaml"
)
out_path = os.path.join(os.path.dirname(__file__), "restructuredtext.tmLanguage")
with open(in_path) as fp:
syn... | 26 | 85 | 0.673077 | import os
import plistlib
import yaml
if __name__ == "__main__":
in_path = os.path.join(
os.path.dirname(__file__), "restructuredtext.tmLanguage.yaml"
)
out_path = os.path.join(os.path.dirname(__file__), "restructuredtext.tmLanguage")
with open(in_path) as fp:
syntax = yaml.safe_load(f... | true | true |
f74b949ea03042f6706c8033522d7dd58c6249c1 | 22,285 | py | Python | mac_alias/alias.py | awesome-archive/Alfred3-workflow-recent-documents | c3c5309d872bc5e3da746e756c91e3ba602f9239 | [
"MIT"
] | 5 | 2018-12-22T14:49:13.000Z | 2022-01-13T07:21:46.000Z | mac_alias/alias.py | awesome-archive/Alfred3-workflow-recent-documents | c3c5309d872bc5e3da746e756c91e3ba602f9239 | [
"MIT"
] | null | null | null | mac_alias/alias.py | awesome-archive/Alfred3-workflow-recent-documents | c3c5309d872bc5e3da746e756c91e3ba602f9239 | [
"MIT"
] | 8 | 2018-07-17T03:55:48.000Z | 2021-12-22T06:37:53.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
import struct
import datetime
import io
import re
import os
import os.path
import stat
import sys
if sys.platform == 'darwin':
from . import osx
try:
long
except NameError:
long = int
from .utils import *
... | 36.652961 | 82 | 0.553601 | from __future__ import unicode_literals
from __future__ import division
import struct
import datetime
import io
import re
import os
import os.path
import stat
import sys
if sys.platform == 'darwin':
from . import osx
try:
long
except NameError:
long = int
from .utils import *
ALIAS_KIND_FILE = 0
AL... | true | true |
f74b94fee2175e9d9d3ba4e1389ccf57a4718e89 | 3,094 | py | Python | zhihu_user_info_spider/zhihu_user_info_spider/threadpool/ThreadPool.py | Yourrrrlove/spider_collection | 3b9f3cc8badc01e3f3e3035c14139d4d5fd1382f | [
"MIT"
] | 178 | 2021-10-29T18:42:04.000Z | 2022-03-30T16:44:37.000Z | zhihu_user_info_spider/zhihu_user_info_spider/threadpool/ThreadPool.py | xzmdc/spider_collection | af2d622a9cf9d859ef6f2a48afea346110995be6 | [
"MIT"
] | 20 | 2021-11-09T15:25:55.000Z | 2022-03-25T05:23:39.000Z | zhihu_user_info_spider/zhihu_user_info_spider/threadpool/ThreadPool.py | xzmdc/spider_collection | af2d622a9cf9d859ef6f2a48afea346110995be6 | [
"MIT"
] | 40 | 2021-11-02T01:30:01.000Z | 2022-03-19T12:15:24.000Z | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import queue
import threading
import contextlib
import time
import traceback
StopEvent = object()
class ThreadPool(object):
def __init__(self, max_num):
self.q = queue.Queue() # 存放任务的队列
self.max_num = max_num # 最大线程并发数
self.terminal = Fals... | 29.466667 | 97 | 0.559147 |
import queue
import threading
import contextlib
import time
import traceback
StopEvent = object()
class ThreadPool(object):
def __init__(self, max_num):
self.q = queue.Queue() self.max_num = max_num
self.terminal = False self.generate_list = [] self.free_list = [] ... | true | true |
f74b9550a716d96101bb258c258c4c5f2a786002 | 40,423 | py | Python | sympy/utilities/autowrap.py | tachycline/sympy | abf6fec12012852c7e6fae38461da9723cadc8b9 | [
"BSD-3-Clause"
] | null | null | null | sympy/utilities/autowrap.py | tachycline/sympy | abf6fec12012852c7e6fae38461da9723cadc8b9 | [
"BSD-3-Clause"
] | null | null | null | sympy/utilities/autowrap.py | tachycline/sympy | abf6fec12012852c7e6fae38461da9723cadc8b9 | [
"BSD-3-Clause"
] | null | null | null | """Module for compiling codegen output, and wrap the binary for use in
python.
.. note:: To use the autowrap module it must first be imported
>>> from sympy.utilities.autowrap import autowrap
This module provides a common interface for different external backends, such
as f2py, fwrap, Cython, SWIG(?) etc. (Curren... | 36.748182 | 115 | 0.602899 |
from __future__ import print_function, division
import sys
import os
import shutil
import tempfile
from subprocess import STDOUT, CalledProcessError, check_output
from string import Template
from warnings import warn
from sympy.core.cache import cacheit
from sympy.core.compatibility import range, iterable
from sympy... | true | true |
f74b95596c46d01b7b60db455caef98095c5d8fb | 81,554 | py | Python | curation/adjustments.py | OpenTreeOfLife/reference-taxonomy | 5ae924911c69a8881d31292b213d0f4a84f84c97 | [
"BSD-2-Clause"
] | 8 | 2017-05-20T07:53:09.000Z | 2021-08-16T03:30:59.000Z | curation/adjustments.py | OpenTreeOfLife/reference-taxonomy | 5ae924911c69a8881d31292b213d0f4a84f84c97 | [
"BSD-2-Clause"
] | 257 | 2015-01-11T12:05:12.000Z | 2021-11-04T17:26:02.000Z | curation/adjustments.py | OpenTreeOfLife/reference-taxonomy | 5ae924911c69a8881d31292b213d0f4a84f84c97 | [
"BSD-2-Clause"
] | 4 | 2015-10-23T13:45:23.000Z | 2021-03-12T17:28:53.000Z | # coding=utf-8
from proposition import *
from establish import establish
from org.opentreeoflife.taxa import Rank
this_source = 'https://github.com/OpenTreeOfLife/reference-taxonomy/blob/master/taxonomies.py'
# Don't change the otc() ids!
# ----- Difficult polysemies -----
def deal_with_polysemies(ott):
# Cte... | 44.736149 | 129 | 0.669875 |
from proposition import *
from establish import establish
from org.opentreeoflife.taxa import Rank
this_source = 'https://github.com/OpenTreeOfLife/reference-taxonomy/blob/master/taxonomies.py'
# ----- Difficult polysemies -----
def deal_with_polysemies(ott):
# Ctenophora is seriously messing up the division ... | false | true |
f74b95b8da975e5589d8c375108eebd91ab2bef7 | 2,232 | py | Python | src/dcgan_utils.py | shahviraj/pgdgan | 97fb63547144f02d76ef0c384b9e2fbbb90c9d50 | [
"MIT"
] | 6 | 2019-02-21T07:44:20.000Z | 2021-08-30T05:22:10.000Z | src/dcgan_utils.py | peterjung73/pgdgan | dd5f64260e2959228cb16b463820a80ce62cd20c | [
"MIT"
] | 2 | 2020-06-20T09:08:20.000Z | 2020-06-20T09:10:42.000Z | src/dcgan_utils.py | shahviraj/pgdgan | 97fb63547144f02d76ef0c384b9e2fbbb90c9d50 | [
"MIT"
] | 6 | 2018-03-15T21:41:39.000Z | 2021-04-22T09:04:32.000Z | # Files of this project is modified versions of 'https://github.com/AshishBora/csgm', which
#comes with the MIT licence: https://github.com/AshishBora/csgm/blob/master/LICENSE
"""Utils for the DCGAN model
File based on : https://github.com/carpedm20/DCGAN-tensorflow/blob/master/utils.py
It comes with the following lic... | 31.43662 | 102 | 0.683244 |
from __future__ import division
import math
import json
import random
import pprint
import scipy.misc
import numpy as np
from time import gmtime, strftime
pp = pprint.PrettyPrinter()
get_stddev = lambda x, k_h, k_w: 1/math.sqrt(k_w*k_h*x.get_shape()[-1])
def get_image(image_path, image_size, is_crop=True, resize_w... | true | true |
f74b963936bb5ec44b7f0d5042717eddbf16f55f | 5,199 | py | Python | dataset/cifar10.py | LYHTHU/MixMatch-pytorch | a738cc95aae88f76761aeeb405201bc7ae200e7d | [
"MIT"
] | 4 | 2020-02-16T10:02:01.000Z | 2022-02-13T18:14:36.000Z | dataset/cifar10.py | LYHTHU/MixMatch-pytorch | a738cc95aae88f76761aeeb405201bc7ae200e7d | [
"MIT"
] | null | null | null | dataset/cifar10.py | LYHTHU/MixMatch-pytorch | a738cc95aae88f76761aeeb405201bc7ae200e7d | [
"MIT"
] | null | null | null | import numpy as np
from PIL import Image
import torchvision
import torch
class TransformTwice:
def __init__(self, transform):
self.transform = transform
def __call__(self, inp):
out1 = self.transform(inp)
out2 = self.transform(inp)
return out1, out2
def get_cifar10(root, n_la... | 32.698113 | 130 | 0.640123 | import numpy as np
from PIL import Image
import torchvision
import torch
class TransformTwice:
def __init__(self, transform):
self.transform = transform
def __call__(self, inp):
out1 = self.transform(inp)
out2 = self.transform(inp)
return out1, out2
def get_cifar10(root, n_la... | true | true |
f74b964225387f7ccfcc4fbfec38ac9c3981dba0 | 3,233 | py | Python | tabacchi/config.py | sisco70/tabacchi | ff0d4a2b2b3a6bd0920d2635e9c0eb1484bbf4be | [
"Apache-2.0"
] | null | null | null | tabacchi/config.py | sisco70/tabacchi | ff0d4a2b2b3a6bd0920d2635e9c0eb1484bbf4be | [
"Apache-2.0"
] | null | null | null | tabacchi/config.py | sisco70/tabacchi | ff0d4a2b2b3a6bd0920d2635e9c0eb1484bbf4be | [
"Apache-2.0"
] | null | null | null | #
# Copyright (C) Francesco Guarnieri 2020 <francesco@guarnie.net>
#
# import os
from pathlib import Path
import configparser
from importlib import metadata
import logging
import logging.config
import logging.handlers
from appdirs import AppDirs
# Estraggo il percorso principale da __file__ e deduco il nome del packa... | 26.941667 | 85 | 0.73523 |
from pathlib import Path
import configparser
from importlib import metadata
import logging
import logging.config
import logging.handlers
from appdirs import AppDirs
BASE_PATH = Path(__file__).resolve().parent
PACKAGE_NAME = BASE_PATH.name
dirs = AppDirs(appname=PACKAGE_NAME)
RESOURCE_PATH = BASE_PATH / 'resources'... | true | true |
f74b96797d3060069a0d9bbc54f8a537132dbd42 | 8,867 | py | Python | src/transformKinesis.py | onishtar/amazon-serverless-datalake-workshop | 2fe83c408a8f2e316fdea72b30ddc826f129a88d | [
"MIT-0"
] | 166 | 2018-11-24T21:40:12.000Z | 2022-03-17T23:50:55.000Z | src/transformKinesis.py | onishtar/amazon-serverless-datalake-workshop | 2fe83c408a8f2e316fdea72b30ddc826f129a88d | [
"MIT-0"
] | 3 | 2019-11-01T23:27:44.000Z | 2022-01-26T22:47:49.000Z | src/transformKinesis.py | onishtar/amazon-serverless-datalake-workshop | 2fe83c408a8f2e316fdea72b30ddc826f129a88d | [
"MIT-0"
] | 88 | 2018-11-19T01:59:57.000Z | 2022-01-29T16:11:23.000Z | """
For processing data sent to Firehose by Cloudwatch Logs subscription filters.
Cloudwatch Logs sends to Firehose records that look like this:
{
"messageType": "DATA_MESSAGE",
"owner": "123456789012",
"logGroup": "log_group_name",
"logStream": "log_stream_name",
"subscriptionFilters": [
"subscription_... | 38.552174 | 138 | 0.659862 |
import base64
import json
import gzip
import StringIO
import boto3
def transformLogEvent(log_event):
return log_event['message'] + '\n'
def processRecords(records):
for r in records:
data = base64.b64decode(r['data'])
striodata = StringIO.StringIO(data)
with gzip.GzipFile(fileobj=st... | true | true |
f74b9844575e29c73e234c5170608ceb96832573 | 1,473 | py | Python | chapter4/defined_cross.py | lvwuyunlifan/Tensorflow_to_learn_DL | c534f36b580990342219b300c418ae13c070b9a5 | [
"MIT"
] | null | null | null | chapter4/defined_cross.py | lvwuyunlifan/Tensorflow_to_learn_DL | c534f36b580990342219b300c418ae13c070b9a5 | [
"MIT"
] | null | null | null | chapter4/defined_cross.py | lvwuyunlifan/Tensorflow_to_learn_DL | c534f36b580990342219b300c418ae13c070b9a5 | [
"MIT"
] | null | null | null | #--*--coding: utf-8 --*--
import tensorflow as tf
from numpy.random import RandomState
bacth_size = 8
# 两个输入节点
x = tf.placeholder(tf.float32, shape=[None, 2], name='x-input')
# 回归问题一般只有一个输出节点
y_ = tf.placeholder(tf.float32, shape=[None, 1], name='y-output')
# 定义了一个单层的神经网络前向传播的过程, 这里就是简单的加权和
w1 = tf.Variable(tf.ran... | 27.277778 | 85 | 0.678208 |
import tensorflow as tf
from numpy.random import RandomState
bacth_size = 8
x = tf.placeholder(tf.float32, shape=[None, 2], name='x-input')
y_ = tf.placeholder(tf.float32, shape=[None, 1], name='y-output')
w1 = tf.Variable(tf.random_normal([2, 1], stddev=1, seed=1))
y = tf.matmul(x, w1)
loss_more = 10
loss_less =... | true | true |
f74b98f600bcccc76c62e741256d47929439a5e6 | 39,004 | py | Python | python/google/appengine/ext/mapreduce/model.py | Khan/frankenserver | 08ea9863019eecdbc9e861b4d3ba0baec755f424 | [
"Apache-2.0"
] | 26 | 2015-01-20T08:02:38.000Z | 2020-06-10T04:57:41.000Z | python/google/appengine/ext/mapreduce/model.py | Khan/frankenserver | 08ea9863019eecdbc9e861b4d3ba0baec755f424 | [
"Apache-2.0"
] | 4 | 2016-02-28T05:53:54.000Z | 2017-01-03T07:39:50.000Z | python/google/appengine/ext/mapreduce/model.py | Khan/frankenserver | 08ea9863019eecdbc9e861b4d3ba0baec755f424 | [
"Apache-2.0"
] | 13 | 2016-02-28T00:14:23.000Z | 2021-05-03T15:47:36.000Z | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# 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 o... | 30.980143 | 80 | 0.685494 |
__all__ = ["MapreduceState",
"MapperSpec",
"MapreduceControl",
"MapreduceSpec",
"ShardState",
"CountersMap",
"TransientShardState",
"QuerySpec",
"HugeTask"]
import cgi
import datetime
import urllib
import zlib... | true | true |
f74b990ac8710d382b661f071c3ab13e08fc970c | 270 | py | Python | Task/Largest-int-from-concatenated-ints/Python/largest-int-from-concatenated-ints-4.py | mullikine/RosettaCodeData | 4f0027c6ce83daa36118ee8b67915a13cd23ab67 | [
"Info-ZIP"
] | 5 | 2021-01-29T20:08:05.000Z | 2022-03-22T06:16:05.000Z | Task/Largest-int-from-concatenated-ints/Python/largest-int-from-concatenated-ints-4.py | seanwallawalla-forks/RosettaCodeData | 9ad63ea473a958506c041077f1d810c0c7c8c18d | [
"Info-ZIP"
] | null | null | null | Task/Largest-int-from-concatenated-ints/Python/largest-int-from-concatenated-ints-4.py | seanwallawalla-forks/RosettaCodeData | 9ad63ea473a958506c041077f1d810c0c7c8c18d | [
"Info-ZIP"
] | 1 | 2018-11-09T22:08:40.000Z | 2018-11-09T22:08:40.000Z | from itertools import permutations
def maxnum(x):
return max(int(''.join(n) for n in permutations(str(i) for i in x)))
for numbers in [(1, 34, 3, 98, 9, 76, 45, 4), (54, 546, 548, 60)]:
print('Numbers: %r\n Largest integer: %15s' % (numbers, maxnum(numbers)))
| 38.571429 | 78 | 0.637037 | from itertools import permutations
def maxnum(x):
return max(int(''.join(n) for n in permutations(str(i) for i in x)))
for numbers in [(1, 34, 3, 98, 9, 76, 45, 4), (54, 546, 548, 60)]:
print('Numbers: %r\n Largest integer: %15s' % (numbers, maxnum(numbers)))
| true | true |
f74b9951e59497a2bb4ccd057e9f94d3f5fd5663 | 3,549 | py | Python | web/web/settings.py | din-ge/dinge | 15a15a11234a865ec277cd04ddbd456ec82a4fba | [
"MIT"
] | null | null | null | web/web/settings.py | din-ge/dinge | 15a15a11234a865ec277cd04ddbd456ec82a4fba | [
"MIT"
] | null | null | null | web/web/settings.py | din-ge/dinge | 15a15a11234a865ec277cd04ddbd456ec82a4fba | [
"MIT"
] | null | null | null | """
Django settings for web project.
Generated by 'django-admin startproject' using Django 4.0.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
import os
from pat... | 25.905109 | 91 | 0.685827 |
import os
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-nl%lza$5$b8z2^*9%+f)d=kaq=#6nhiuh!1%=!_#r8dn_h%qd7'
DEBUG = True
ALLOWED_HOSTS = ['localhost','127.0.0.1', 'din.ge','www.din.ge', ]
# Application definition
INSTALLED_APPS = [
'django.contrib... | true | true |
f74b9aad0cb5e5f9ba862f55714a56c3e4ae5767 | 1,345 | py | Python | tests/test_bzr_helper.py | rkoval/SublimeDiffView | 57744b5626851085f49511c225b87c9465c0e7ad | [
"MIT"
] | 23 | 2015-12-14T12:10:49.000Z | 2020-11-28T10:26:52.000Z | tests/test_bzr_helper.py | rkoval/SublimeDiffView | 57744b5626851085f49511c225b87c9465c0e7ad | [
"MIT"
] | 59 | 2015-12-14T08:58:21.000Z | 2021-04-09T11:46:00.000Z | tests/test_bzr_helper.py | rkoval/SublimeDiffView | 57744b5626851085f49511c225b87c9465c0e7ad | [
"MIT"
] | 7 | 2016-01-09T11:47:07.000Z | 2020-03-16T15:11:32.000Z | import sys
import subprocess
from unittest import TestCase
from unittest.mock import patch
diffview = sys.modules["DiffView"]
BzrHelper = diffview.util.vcs.BzrHelper
class test_BzrHelper(TestCase):
def setUp(self):
self.dummy_process = DummyProcess()
def test_init(self):
bzr_helper = BzrHel... | 29.23913 | 75 | 0.637918 | import sys
import subprocess
from unittest import TestCase
from unittest.mock import patch
diffview = sys.modules["DiffView"]
BzrHelper = diffview.util.vcs.BzrHelper
class test_BzrHelper(TestCase):
def setUp(self):
self.dummy_process = DummyProcess()
def test_init(self):
bzr_helper = BzrHel... | true | true |
f74b9acce4849b4adffa0d80154ecef104e4092c | 3,089 | py | Python | tools/set_active_docs.py | CAM-Gerlach/praw | 04600016c886d65206e298d6b503984ed13705e5 | [
"BSD-2-Clause"
] | 1 | 2021-11-30T21:18:52.000Z | 2021-11-30T21:18:52.000Z | tools/set_active_docs.py | CAM-Gerlach/praw | 04600016c886d65206e298d6b503984ed13705e5 | [
"BSD-2-Clause"
] | 2 | 2020-09-15T12:57:44.000Z | 2022-02-10T00:01:27.000Z | tools/set_active_docs.py | CAM-Gerlach/praw | 04600016c886d65206e298d6b503984ed13705e5 | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/env python3
import os
import re
import sys
import time
import packaging.version
import requests
PROJECT = "praw"
HEADERS = {"Authorization": f"token {os.environ.get('READTHEDOCS_TOKEN')}"}
def fetch_versions():
response = requests.get(
f"https://readthedocs.org/api/v3/projects/{PROJECT}/versi... | 32.515789 | 90 | 0.596309 | import os
import re
import sys
import time
import packaging.version
import requests
PROJECT = "praw"
HEADERS = {"Authorization": f"token {os.environ.get('READTHEDOCS_TOKEN')}"}
def fetch_versions():
response = requests.get(
f"https://readthedocs.org/api/v3/projects/{PROJECT}/versions?active=true",
... | true | true |
f74b9addcce56532c673c476eb60649436086af8 | 123,936 | py | Python | tools/shared.py | shravanrn/emscripten_lp64 | 6df2bceb037107bf521305ac18264955ceb2685e | [
"MIT"
] | null | null | null | tools/shared.py | shravanrn/emscripten_lp64 | 6df2bceb037107bf521305ac18264955ceb2685e | [
"MIT"
] | null | null | null | tools/shared.py | shravanrn/emscripten_lp64 | 6df2bceb037107bf521305ac18264955ceb2685e | [
"MIT"
] | null | null | null | # Copyright 2011 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
from __future__ import print_function
from distutils.spawn import fi... | 40.018082 | 393 | 0.673937 |
from __future__ import print_function
from distutils.spawn import find_executable
from subprocess import PIPE, STDOUT
import atexit
import base64
import json
import logging
import math
import multiprocessing
import os
import re
import shlex
import shutil
import subprocess
import sys
import tempfile
from .toolchain_p... | true | true |
f74b9b25c8dd21a207137b8e84070656d555098a | 5,996 | py | Python | idaes/core/base/phases.py | OOAmusat/idaes-pse | ae7d3bb8e372bc32822dcdcb75e9fd96b78da539 | [
"RSA-MD"
] | null | null | null | idaes/core/base/phases.py | OOAmusat/idaes-pse | ae7d3bb8e372bc32822dcdcb75e9fd96b78da539 | [
"RSA-MD"
] | null | null | null | idaes/core/base/phases.py | OOAmusat/idaes-pse | ae7d3bb8e372bc32822dcdcb75e9fd96b78da539 | [
"RSA-MD"
] | 1 | 2022-03-17T11:08:43.000Z | 2022-03-17T11:08:43.000Z | #################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... | 30.748718 | 86 | 0.643429 | from enum import Enum
from pyomo.environ import Set
from pyomo.common.config import ConfigBlock, ConfigValue
from idaes.core.base.process_base import declare_process_block_class, ProcessBlockData
class PhaseType(Enum):
undefined = 0
liquidPhase = 1
vaporPhase = 2
solidPhase = 3
aqueousPhase = 4
... | true | true |
f74b9b46afcd173977e53566b111558a07e14398 | 11,581 | py | Python | python/pcache.py | peeweek/pcache | 358cbeeadf59c55f891b03442cb9424e9417f60e | [
"MIT"
] | 16 | 2018-11-07T09:49:48.000Z | 2021-07-18T09:50:40.000Z | python/pcache.py | peeweek/pcache | 358cbeeadf59c55f891b03442cb9424e9417f60e | [
"MIT"
] | null | null | null | python/pcache.py | peeweek/pcache | 358cbeeadf59c55f891b03442cb9424e9417f60e | [
"MIT"
] | 3 | 2019-06-12T12:19:09.000Z | 2020-07-06T15:00:40.000Z | import os
import sys
import hou
import struct
class pcache(object):
fileName = ""
fileType = 'a'
fileVersion = 1.0
propertyNames = []
propertyTypes = []
propertyData = bytearray()
itemcount = 0
itemstride = 0
defaultBindings = {
'P': 'position',
'N': 'normal',
... | 38.732441 | 115 | 0.504188 | import os
import sys
import hou
import struct
class pcache(object):
fileName = ""
fileType = 'a'
fileVersion = 1.0
propertyNames = []
propertyTypes = []
propertyData = bytearray()
itemcount = 0
itemstride = 0
defaultBindings = {
'P': 'position',
'N': 'normal',
... | false | true |
f74b9b4c6bdc4a44c69840fd6a9974e75d8f6f08 | 1,010 | py | Python | catalog/bindings/gmd/abstract_curve_segment.py | NIVANorge/s-enda-playground | 56ae0a8978f0ba8a5546330786c882c31e17757a | [
"Apache-2.0"
] | null | null | null | catalog/bindings/gmd/abstract_curve_segment.py | NIVANorge/s-enda-playground | 56ae0a8978f0ba8a5546330786c882c31e17757a | [
"Apache-2.0"
] | null | null | null | catalog/bindings/gmd/abstract_curve_segment.py | NIVANorge/s-enda-playground | 56ae0a8978f0ba8a5546330786c882c31e17757a | [
"Apache-2.0"
] | null | null | null | from dataclasses import dataclass
from bindings.gmd.abstract_curve_segment_type import AbstractCurveSegmentType
__NAMESPACE__ = "http://www.opengis.net/gml"
@dataclass
class AbstractCurveSegment(AbstractCurveSegmentType):
"""A curve segment defines a homogeneous segment of a curve.
The attributes numDerivat... | 40.4 | 77 | 0.783168 | from dataclasses import dataclass
from bindings.gmd.abstract_curve_segment_type import AbstractCurveSegmentType
__NAMESPACE__ = "http://www.opengis.net/gml"
@dataclass
class AbstractCurveSegment(AbstractCurveSegmentType):
class Meta:
namespace = "http://www.opengis.net/gml"
| true | true |
f74b9b5eec747e14b16337f47d546aa1bb7b4a5f | 3,100 | py | Python | tests/contracts/KT1E7xh6tvnVMWx7QCZnuWXwcpCJ9UmMWcyK/test_micheline_coding_KT1E7x.py | juztin/pytezos-1 | 7e608ff599d934bdcf129e47db43dbdb8fef9027 | [
"MIT"
] | 1 | 2021-05-20T16:52:08.000Z | 2021-05-20T16:52:08.000Z | tests/contracts/KT1E7xh6tvnVMWx7QCZnuWXwcpCJ9UmMWcyK/test_micheline_coding_KT1E7x.py | juztin/pytezos-1 | 7e608ff599d934bdcf129e47db43dbdb8fef9027 | [
"MIT"
] | 1 | 2020-12-30T16:44:56.000Z | 2020-12-30T16:44:56.000Z | tests/contracts/KT1E7xh6tvnVMWx7QCZnuWXwcpCJ9UmMWcyK/test_micheline_coding_KT1E7x.py | juztin/pytezos-1 | 7e608ff599d934bdcf129e47db43dbdb8fef9027 | [
"MIT"
] | 1 | 2022-03-20T19:01:00.000Z | 2022-03-20T19:01:00.000Z | from unittest import TestCase
from tests import get_data
from pytezos.michelson.converter import build_schema, decode_micheline, encode_micheline
class MichelineCodingTestKT1E7x(TestCase):
@classmethod
def setUpClass(cls):
cls.maxDiff = None
cls.code = get_data(
path='contrac... | 46.268657 | 88 | 0.714839 | from unittest import TestCase
from tests import get_data
from pytezos.michelson.converter import build_schema, decode_micheline, encode_micheline
class MichelineCodingTestKT1E7x(TestCase):
@classmethod
def setUpClass(cls):
cls.maxDiff = None
cls.code = get_data(
path='contrac... | true | true |
f74b9ba2e9f643f1c1099bf73b23de4df3fc271a | 2,346 | py | Python | quickvision/datasets/classification.py | ramaneswaran/quickvision | ff494ea9c6ae09c129603b35236f314b25d56d27 | [
"Apache-2.0"
] | 47 | 2020-11-15T03:36:48.000Z | 2021-04-08T05:28:02.000Z | quickvision/datasets/classification.py | ramaneswaran/quickvision | ff494ea9c6ae09c129603b35236f314b25d56d27 | [
"Apache-2.0"
] | 78 | 2020-11-14T17:55:28.000Z | 2021-04-06T08:55:24.000Z | quickvision/datasets/classification.py | ramaneswaran/quickvision | ff494ea9c6ae09c129603b35236f314b25d56d27 | [
"Apache-2.0"
] | 15 | 2020-11-14T18:01:04.000Z | 2021-02-16T14:50:12.000Z | # Add code for Mapping using dataframe containaing id and target.
# Port from pytorch_cnn_trainer
# https://github.com/oke-aditya/pytorch_cnn_trainer
import torchvision
from torchvision import datasets
from torch.utils.data import Dataset
import os
import torch
from PIL import Image
__all__ = ["create_folder_dataset"... | 32.583333 | 102 | 0.696505 |
import torchvision
from torchvision import datasets
from torch.utils.data import Dataset
import os
import torch
from PIL import Image
__all__ = ["create_folder_dataset", "CSVSingleLabelDataset"]
def create_folder_dataset(root_dir, transforms, split: float = 0.8, **kwargs):
complete_dataset = datasets.ImageFolde... | true | true |
f74b9c09f92d710ef184d51861c2f1aed7400e5a | 2,047 | py | Python | wb/main/pipeline_creators/local_profiling_pipeline_creator.py | apaniukov/workbench | 2f2653ecfd0143d2d53e33ad84379f13443fdfaa | [
"Apache-2.0"
] | 23 | 2022-03-17T12:24:09.000Z | 2022-03-31T09:13:30.000Z | wb/main/pipeline_creators/local_profiling_pipeline_creator.py | apaniukov/workbench | 2f2653ecfd0143d2d53e33ad84379f13443fdfaa | [
"Apache-2.0"
] | 18 | 2022-03-21T08:17:44.000Z | 2022-03-30T12:42:30.000Z | wb/main/pipeline_creators/local_profiling_pipeline_creator.py | apaniukov/workbench | 2f2653ecfd0143d2d53e33ad84379f13443fdfaa | [
"Apache-2.0"
] | 16 | 2022-03-17T12:24:14.000Z | 2022-03-31T12:15:12.000Z | """
OpenVINO DL Workbench
Class for creating ORM local profiling pipeline model and dependent models
Copyright (c) 2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
... | 47.604651 | 112 | 0.762091 |
from sqlalchemy.orm import Session
from wb.main.enumerates import PipelineTypeEnum, PipelineStageEnum
from wb.main.models import CreateProfilingScriptsJobModel, PipelineModel, ProfilingJobModel
from wb.main.pipeline_creators.profiling_pipeline_creator import ProfilingPipelineCreator
class LocalProfilingPipelineCrea... | true | true |
f74b9cc126b9390926d4e3cf653f6d81f33e70d6 | 768 | py | Python | the_project/urls.py | TomasTomecek/django-container | 4d07eb976a113dfd6e89865e490b4fd80310a2ec | [
"MIT"
] | null | null | null | the_project/urls.py | TomasTomecek/django-container | 4d07eb976a113dfd6e89865e490b4fd80310a2ec | [
"MIT"
] | null | null | null | the_project/urls.py | TomasTomecek/django-container | 4d07eb976a113dfd6e89865e490b4fd80310a2ec | [
"MIT"
] | null | null | null | """the_project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | 34.909091 | 79 | 0.705729 | from django.conf.urls import url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
]
| true | true |
f74b9d0b36e9e33eebe1b00cec1833eef505df9b | 12,999 | py | Python | site-packages/cinderclient/tests/unit/test_http.py | hariza17/freezer_libraries | e0bd890eba5e7438976fb3b4d66c41c128bab790 | [
"PSF-2.0"
] | null | null | null | site-packages/cinderclient/tests/unit/test_http.py | hariza17/freezer_libraries | e0bd890eba5e7438976fb3b4d66c41c128bab790 | [
"PSF-2.0"
] | 1 | 2018-09-10T23:44:02.000Z | 2018-09-12T16:28:07.000Z | site-packages/cinderclient/tests/unit/test_http.py | hariza17/freezer_libraries | e0bd890eba5e7438976fb3b4d66c41c128bab790 | [
"PSF-2.0"
] | 2 | 2018-09-07T23:17:23.000Z | 2019-01-11T16:10:08.000Z | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | 33.245524 | 79 | 0.582352 |
import json
import mock
import requests
import uuid
from cinderclient import client
from cinderclient import exceptions
from cinderclient.tests.unit import utils
fake_response = utils.TestResponse({
"status_code": 200,
"text": '{"hi": "there"}',
})
mock_request = mock.Mock(return_value=(fake_response))
fak... | true | true |
f74b9d2ab860c2fc5631d8f338deb9cc79f402e7 | 286 | py | Python | HLS/lib/project.py | AJ9/HomeLightSystem | 0714c9b745dcc0b91051c97cc33bd64ca7d564b2 | [
"BSD-2-Clause"
] | null | null | null | HLS/lib/project.py | AJ9/HomeLightSystem | 0714c9b745dcc0b91051c97cc33bd64ca7d564b2 | [
"BSD-2-Clause"
] | null | null | null | HLS/lib/project.py | AJ9/HomeLightSystem | 0714c9b745dcc0b91051c97cc33bd64ca7d564b2 | [
"BSD-2-Clause"
] | null | null | null | from process import Process
class Project:
def __init__(self):
self.process = Process()
def date(self):
self._get_date()
def _get_date(self):
print self.process.execute("date")
def print_example_arg(self):
print self.options.example
| 17.875 | 42 | 0.63986 | from process import Process
class Project:
def __init__(self):
self.process = Process()
def date(self):
self._get_date()
def _get_date(self):
print self.process.execute("date")
def print_example_arg(self):
print self.options.example
| false | true |
f74b9d2fb964324ada35ab18fd3e8fd7b6e30c7c | 165 | py | Python | echobot/urls.py | konata39/line_app | 621ba979541711febd9c3d2e7435ae48524c12e5 | [
"MIT"
] | null | null | null | echobot/urls.py | konata39/line_app | 621ba979541711febd9c3d2e7435ae48524c12e5 | [
"MIT"
] | null | null | null | echobot/urls.py | konata39/line_app | 621ba979541711febd9c3d2e7435ae48524c12e5 | [
"MIT"
] | null | null | null | from django.conf.urls import url
from . import views
urlpatterns = [
url('^callback/', views.callback),
url('^direct_callback/', views.direct_callback),
]
| 18.333333 | 52 | 0.69697 | from django.conf.urls import url
from . import views
urlpatterns = [
url('^callback/', views.callback),
url('^direct_callback/', views.direct_callback),
]
| true | true |
f74b9e72e6a6befd039f014158bc7af7a8feef12 | 1,550 | py | Python | webots_ros2_core/setup.py | zegangYang/webots_ros2 | c1b3a055f9b3d931066083e561c3dbee5b386c3a | [
"Apache-2.0"
] | null | null | null | webots_ros2_core/setup.py | zegangYang/webots_ros2 | c1b3a055f9b3d931066083e561c3dbee5b386c3a | [
"Apache-2.0"
] | null | null | null | webots_ros2_core/setup.py | zegangYang/webots_ros2 | c1b3a055f9b3d931066083e561c3dbee5b386c3a | [
"Apache-2.0"
] | null | null | null | """webots_ros2 package setup file."""
from setuptools import setup
package_name = 'webots_ros2_core'
data_files = []
data_files.append(('share/ament_index/resource_index/packages', ['resource/' + package_name]))
data_files.append(('share/' + package_name, ['package.xml']))
data_files.append(('share/' + package_name +... | 36.904762 | 105 | 0.68129 |
from setuptools import setup
package_name = 'webots_ros2_core'
data_files = []
data_files.append(('share/ament_index/resource_index/packages', ['resource/' + package_name]))
data_files.append(('share/' + package_name, ['package.xml']))
data_files.append(('share/' + package_name + '/launch', ['launch/robot_launch.py']... | true | true |
f74b9ef74ba97c485bcc4671087b4d4cabf82150 | 2,481 | py | Python | data/p4VQE/R4/benchmark/startQiskit92.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p4VQE/R4/benchmark/startQiskit92.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p4VQE/R4/benchmark/startQiskit92.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=3
# total number=11
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
import networkx as nx
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collectio... | 27.566667 | 118 | 0.635631 |
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
import networkx as nx
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collections import Counter
from qiskit.test.... | true | true |
f74b9f2c87c5f28efe847222aaacfb121a6966e1 | 3,089 | py | Python | hr_doc_expire/hooks.py | ronozoro/hr_doc_expire | 1c481565180249cf883ac49997c07123d21c0c49 | [
"MIT"
] | null | null | null | hr_doc_expire/hooks.py | ronozoro/hr_doc_expire | 1c481565180249cf883ac49997c07123d21c0c49 | [
"MIT"
] | null | null | null | hr_doc_expire/hooks.py | ronozoro/hr_doc_expire | 1c481565180249cf883ac49997c07123d21c0c49 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from . import __version__ as app_version
app_name = "hr_doc_expire"
app_title = "Employee Document Expire"
app_publisher = "Mostafa Mohamed"
app_description = "Manage employee documents within the company"
app_icon = "fa fa-book"
app_color = "grey"
app_em... | 26.401709 | 81 | 0.695371 | from __future__ import unicode_literals
from . import __version__ as app_version
app_name = "hr_doc_expire"
app_title = "Employee Document Expire"
app_publisher = "Mostafa Mohamed"
app_description = "Manage employee documents within the company"
app_icon = "fa fa-book"
app_color = "grey"
app_email = "m.dev.odoo@gmail.... | true | true |
f74ba174d7a445712a75ce74fcbf0c8c6865e15f | 342 | py | Python | api/router.py | JuanDM93/plerk-django-transactions | 1e42ac26cc9b03669ebed58015121b5bb683c280 | [
"MIT"
] | null | null | null | api/router.py | JuanDM93/plerk-django-transactions | 1e42ac26cc9b03669ebed58015121b5bb683c280 | [
"MIT"
] | null | null | null | api/router.py | JuanDM93/plerk-django-transactions | 1e42ac26cc9b03669ebed58015121b5bb683c280 | [
"MIT"
] | null | null | null | from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from .views import SummaryView, CompanyView
urlpatterns = [
path('summary/', SummaryView.as_view(), name='summary'),
path('companies/<int:pk>/', CompanyView.as_view(), name='companies'),
]
urlpatterns = format_suffix_... | 26.307692 | 73 | 0.766082 | from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from .views import SummaryView, CompanyView
urlpatterns = [
path('summary/', SummaryView.as_view(), name='summary'),
path('companies/<int:pk>/', CompanyView.as_view(), name='companies'),
]
urlpatterns = format_suffix_... | true | true |
f74ba17a204c79db66f94d065faba36b942caba9 | 1,649 | py | Python | custom_components/twcmanager/config_flow.py | jherby2k/twcmanager_ha | 017bc6047b7c2783254e7b2cd2d2f8f6b7d1a29f | [
"Apache-2.0"
] | null | null | null | custom_components/twcmanager/config_flow.py | jherby2k/twcmanager_ha | 017bc6047b7c2783254e7b2cd2d2f8f6b7d1a29f | [
"Apache-2.0"
] | 1 | 2021-10-16T16:24:14.000Z | 2021-10-16T17:40:58.000Z | custom_components/twcmanager/config_flow.py | jherby2k/twcmanager_ha | 017bc6047b7c2783254e7b2cd2d2f8f6b7d1a29f | [
"Apache-2.0"
] | null | null | null | """Config flow for TWCManager integration."""
from __future__ import annotations
import logging
from typing import Any
from aiohttp import ClientConnectorError
from twcmanager_client.client import TWCManagerClient
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.data_entry_flow im... | 28.929825 | 85 | 0.667677 | from __future__ import annotations
import logging
from typing import Any
from aiohttp import ClientConnectorError
from twcmanager_client.client import TWCManagerClient
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.data_entry_flow import FlowResult
from .const import DOMAIN
_L... | true | true |
f74ba190368bbe34b097108b2565fb0935464a41 | 1,047 | py | Python | pyinstaller/hook-googleapiclient.model.py | jorisfa/gcpdiag | eaa77fdab1314efb46041e116643576ae2666748 | [
"Apache-2.0"
] | 63 | 2021-09-28T16:29:19.000Z | 2022-03-30T02:01:15.000Z | pyinstaller/hook-googleapiclient.model.py | jorisfa/gcpdiag | eaa77fdab1314efb46041e116643576ae2666748 | [
"Apache-2.0"
] | 10 | 2021-10-06T11:59:44.000Z | 2022-03-24T16:41:38.000Z | pyinstaller/hook-googleapiclient.model.py | jorisfa/gcpdiag | eaa77fdab1314efb46041e116643576ae2666748 | [
"Apache-2.0"
] | 20 | 2021-09-28T18:38:29.000Z | 2022-03-24T10:19:56.000Z | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 43.625 | 74 | 0.758357 |
from PyInstaller.utils.hooks import collect_data_files, copy_metadata
datas = copy_metadata('google_api_python_client')
datas += collect_data_files('googleapiclient.discovery',
excludes=['*.txt', '**/__pycache__'])
| true | true |
f74ba281265cd54446c182571020a460b6715ad2 | 1,377 | py | Python | utils.py | bakwadunka/dunka3 | 265ec0964087bac524da9a3f3b07bc483a466c63 | [
"CC-BY-4.0"
] | 30 | 2020-04-30T15:17:31.000Z | 2022-03-31T08:47:13.000Z | utils.py | bakwadunka/dunka3 | 265ec0964087bac524da9a3f3b07bc483a466c63 | [
"CC-BY-4.0"
] | null | null | null | utils.py | bakwadunka/dunka3 | 265ec0964087bac524da9a3f3b07bc483a466c63 | [
"CC-BY-4.0"
] | 5 | 2020-06-05T21:15:42.000Z | 2022-03-31T08:47:19.000Z | import os
import pickle
import torch
import numpy as np
def save(toBeSaved, filename, mode='wb'):
dirname = os.path.dirname(filename)
if not os.path.exists(dirname):
os.makedirs(dirname)
file = open(filename, mode)
pickle.dump(toBeSaved, file)
file.close()
def load(filename, mode='rb'):
... | 26.480769 | 87 | 0.667393 | import os
import pickle
import torch
import numpy as np
def save(toBeSaved, filename, mode='wb'):
dirname = os.path.dirname(filename)
if not os.path.exists(dirname):
os.makedirs(dirname)
file = open(filename, mode)
pickle.dump(toBeSaved, file)
file.close()
def load(filename, mode='rb'):
... | true | true |
f74ba3baa400ff0da3c059ec80bcb82fcbfadf83 | 899 | py | Python | reflex-algos/components/Python/string-sink/string_sink.py | mlpiper/mlpiper | 0fd2b6773f970c831038db47bf4920ada21a5f51 | [
"Apache-2.0"
] | 7 | 2019-04-08T02:31:55.000Z | 2021-11-15T14:40:49.000Z | reflex-algos/components/Python/string-sink/string_sink.py | mlpiper/mlpiper | 0fd2b6773f970c831038db47bf4920ada21a5f51 | [
"Apache-2.0"
] | 31 | 2019-02-22T22:23:26.000Z | 2021-08-02T17:17:06.000Z | reflex-algos/components/Python/string-sink/string_sink.py | mlpiper/mlpiper | 0fd2b6773f970c831038db47bf4920ada21a5f51 | [
"Apache-2.0"
] | 8 | 2019-03-15T23:46:08.000Z | 2020-02-06T09:16:02.000Z | from parallelm.components import ConnectableComponent
from parallelm.mlops import mlops
class StringSink(ConnectableComponent):
def __init__(self, engine):
super(self.__class__, self).__init__(engine)
def _materialize(self, parent_data_objs, user_data):
expected_str_value = self._params.get(... | 42.809524 | 100 | 0.68743 | from parallelm.components import ConnectableComponent
from parallelm.mlops import mlops
class StringSink(ConnectableComponent):
def __init__(self, engine):
super(self.__class__, self).__init__(engine)
def _materialize(self, parent_data_objs, user_data):
expected_str_value = self._params.get(... | true | true |
f74ba4b75c7e6156bff108b0b731f34530de9040 | 965 | py | Python | utils.py | lalonderodney/D-Caps | 47050505170472abe1ea36e50903ea06054fcf07 | [
"Apache-2.0"
] | 11 | 2020-01-13T09:08:59.000Z | 2020-06-04T23:06:13.000Z | utils.py | lalonderodney/D-Caps | 47050505170472abe1ea36e50903ea06054fcf07 | [
"Apache-2.0"
] | 7 | 2020-09-25T22:42:37.000Z | 2022-02-09T23:40:33.000Z | utils.py | lalonderodney/D-Caps | 47050505170472abe1ea36e50903ea06054fcf07 | [
"Apache-2.0"
] | 2 | 2020-01-21T07:28:55.000Z | 2020-03-04T11:54:47.000Z | import os
import errno
import tensorflow as tf
from keras import backend as K
def safe_mkdir(dir_to_make: str) -> None:
'''
Attempts to make a directory following the Pythonic EAFP strategy which prevents race conditions.
:param dir_to_make: The directory path to attempt to make.
:return: None
''... | 31.129032 | 101 | 0.663212 | import os
import errno
import tensorflow as tf
from keras import backend as K
def safe_mkdir(dir_to_make: str) -> None:
try:
os.makedirs(dir_to_make)
except OSError as e:
if e.errno != errno.EEXIST:
print('ERROR: Unable to create directory: {}'.format(dir_to_make), e)
r... | true | true |
f74ba600f84b2112b3d8fe4718a5cb4691d55184 | 3,780 | py | Python | test/TestRulesCollection.py | slsh1o/ansible-lint | d835ee16a2ea72e20cb0168769af6797d3bf419a | [
"MIT"
] | 1 | 2020-05-14T20:42:37.000Z | 2020-05-14T20:42:37.000Z | test/TestRulesCollection.py | aakashgandham-nucleussoftware/ansible-lint | 7e653c6469712be948fb45c58f818f47161b2f9d | [
"MIT"
] | null | null | null | test/TestRulesCollection.py | aakashgandham-nucleussoftware/ansible-lint | 7e653c6469712be948fb45c58f818f47161b2f9d | [
"MIT"
] | null | null | null | # Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# 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... | 39.789474 | 86 | 0.763492 |
import collections
import os
import pytest
from ansiblelint import RulesCollection
@pytest.fixture
def test_rules_collection():
return RulesCollection([os.path.abspath('./test/rules')])
@pytest.fixture
def ematchtestfile():
return dict(path='test/ematchtest.yml', type='playbook')
@pytest.fixture
def br... | true | true |
f74ba61d58d595b579032b0ac9cd2a95965f2f2a | 4,090 | py | Python | Lesson_5.py | verafes/python_training | 3cf989e5924d40f78f218de323c07efa85f2edcf | [
"Apache-2.0"
] | null | null | null | Lesson_5.py | verafes/python_training | 3cf989e5924d40f78f218de323c07efa85f2edcf | [
"Apache-2.0"
] | null | null | null | Lesson_5.py | verafes/python_training | 3cf989e5924d40f78f218de323c07efa85f2edcf | [
"Apache-2.0"
] | null | null | null | # Lesson 5. String function and methods
# All string methods returns new values. They do not change the original string.
print("--- Searchig position of a specified symbol")
# index() - Searches the string for a specified value and returns the position of where it was found
s = "programming language"
print(s[1:-1])
#... | 32.460317 | 100 | 0.69022 |
print("--- Searchig position of a specified symbol")
s = "programming language"
print(s[1:-1])
index = s.index("g")
print(index)
last_index = s.rindex("g")
print(last_index)
print("\n--- Searchig a specified symbol")
i = s.find("P") print(i)
last_i = s.rfind("a")
print(last_i)
print("\n--- Alphabetic symbol or digi... | true | true |
f74ba7b4d3a3b75a573444f558a4d790e954d12d | 726 | py | Python | mmdet/datasets/__init__.py | maktu6/mmdetection | 4a0a42d4ab1f00732997e58da70c8145b9751bb0 | [
"Apache-2.0"
] | null | null | null | mmdet/datasets/__init__.py | maktu6/mmdetection | 4a0a42d4ab1f00732997e58da70c8145b9751bb0 | [
"Apache-2.0"
] | null | null | null | mmdet/datasets/__init__.py | maktu6/mmdetection | 4a0a42d4ab1f00732997e58da70c8145b9751bb0 | [
"Apache-2.0"
] | null | null | null | from .custom import CustomDataset
from .xml_style import XMLDataset
from .coco import CocoDataset
from .voc import VOCDataset
from .loader import GroupSampler, DistributedGroupSampler, build_dataloader
from .utils import to_tensor, random_scale, show_ann, get_dataset
from .concat_dataset import ConcatDataset
from .repe... | 40.333333 | 79 | 0.80303 | from .custom import CustomDataset
from .xml_style import XMLDataset
from .coco import CocoDataset
from .voc import VOCDataset
from .loader import GroupSampler, DistributedGroupSampler, build_dataloader
from .utils import to_tensor, random_scale, show_ann, get_dataset
from .concat_dataset import ConcatDataset
from .repe... | true | true |
f74ba7d33a4bd37467035582718a2ef271581b2b | 4,701 | py | Python | norm_module.py | antofuller/configaformers | 293253cd35d96c8a24c4004ba3d24fc6dc85a260 | [
"Apache-2.0"
] | 51 | 2021-11-03T19:52:07.000Z | 2021-12-14T16:56:30.000Z | norm_module.py | muddyrains/muddy-nets | 293253cd35d96c8a24c4004ba3d24fc6dc85a260 | [
"Apache-2.0"
] | null | null | null | norm_module.py | muddyrains/muddy-nets | 293253cd35d96c8a24c4004ba3d24fc6dc85a260 | [
"Apache-2.0"
] | 2 | 2021-11-04T01:46:26.000Z | 2021-11-06T08:39:35.000Z | import torch
from torch import nn
from utils import set_default
# This module is dedicated to Norm Macdonald
# Implementations from https://github.com/lucidrains/x-transformer
class RMSNorm(nn.Module):
def __init__(self, dim, eps=1e-8):
super().__init__()
self.scale = dim ** -0.5
self.eps... | 35.08209 | 144 | 0.582429 | import torch
from torch import nn
from utils import set_default
class RMSNorm(nn.Module):
def __init__(self, dim, eps=1e-8):
super().__init__()
self.scale = dim ** -0.5
self.eps = eps
self.g = nn.Parameter(torch.ones(dim))
def forward(self, x):
_norm = torch.norm(x, d... | true | true |
f74ba8104e41c0a41eb3e26478ad7fc97565cdad | 316 | py | Python | caishen_dashboard/auth/utils.py | Kerem-Sami-Coop/caishen-dashboard-be2 | 686717fe1d289164cd85c3f58939443892259046 | [
"MIT"
] | null | null | null | caishen_dashboard/auth/utils.py | Kerem-Sami-Coop/caishen-dashboard-be2 | 686717fe1d289164cd85c3f58939443892259046 | [
"MIT"
] | 10 | 2021-04-12T19:19:58.000Z | 2021-05-19T14:37:57.000Z | caishen_dashboard/auth/utils.py | Kerem-Sami-Coop/caishen_dashboard | 686717fe1d289164cd85c3f58939443892259046 | [
"MIT"
] | null | null | null | from flask import session, redirect, url_for
from functools import wraps
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if session.get("_user_id") is None:
return redirect(url_for("auth.login"))
return f(*args, **kwargs)
return decorated_function
| 26.333333 | 50 | 0.674051 | from flask import session, redirect, url_for
from functools import wraps
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if session.get("_user_id") is None:
return redirect(url_for("auth.login"))
return f(*args, **kwargs)
return decorated_function
| true | true |
f74ba9c232376bbfb2f932b01444008e8cee6a60 | 31,684 | py | Python | mne/tests/test_cov.py | achilleas-k/mne-python | 0078e1af13a92ab47498dd167bc5ec73be864427 | [
"BSD-3-Clause"
] | 1 | 2019-03-22T04:47:45.000Z | 2019-03-22T04:47:45.000Z | mne/tests/test_cov.py | achilleas-k/mne-python | 0078e1af13a92ab47498dd167bc5ec73be864427 | [
"BSD-3-Clause"
] | 4 | 2016-06-04T15:28:08.000Z | 2016-12-22T14:23:13.000Z | mne/tests/test_cov.py | achilleas-k/mne-python | 0078e1af13a92ab47498dd167bc5ec73be864427 | [
"BSD-3-Clause"
] | null | null | null | # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import itertools as itt
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal, assert_... | 42.586022 | 79 | 0.649445 |
import os.path as op
import itertools as itt
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal, assert_allclose)
import pytest
import numpy as np
from scipy import linalg
from mne.cov import (regularize, whiten_evoked,
_auto_low_ran... | true | true |
f74baade0c5da5052cc740cfb45038c8b7fae270 | 362 | py | Python | prediction_api/config/urls.py | YusufBerki/PyImageClassification | eee9a5f76aed5ea81c3c0968a0d4d699f5510bab | [
"MIT"
] | 6 | 2021-08-09T15:56:01.000Z | 2022-03-01T14:31:40.000Z | prediction_api/config/urls.py | YusufBerki/PyImageClassification | eee9a5f76aed5ea81c3c0968a0d4d699f5510bab | [
"MIT"
] | 2 | 2021-08-07T10:59:48.000Z | 2021-08-09T23:21:21.000Z | prediction_api/config/urls.py | YusufBerki/PyImageClassification | eee9a5f76aed5ea81c3c0968a0d4d699f5510bab | [
"MIT"
] | null | null | null | from django.conf import settings
from django.urls import include, path
from django.conf.urls.static import static
urlpatterns = [
path('api/predict/', include('prediction.api.urls')),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_... | 27.846154 | 79 | 0.762431 | from django.conf import settings
from django.urls import include, path
from django.conf.urls.static import static
urlpatterns = [
path('api/predict/', include('prediction.api.urls')),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_... | true | true |
f74bab3132a689aa52d933180a0c9924fcef9d8b | 1,204 | py | Python | app/core/models.py | errnanee/recipe-app-api | cb9f30de88841c6819aa97a81b498ab19fd3b849 | [
"MIT"
] | null | null | null | app/core/models.py | errnanee/recipe-app-api | cb9f30de88841c6819aa97a81b498ab19fd3b849 | [
"MIT"
] | null | null | null | app/core/models.py | errnanee/recipe-app-api | cb9f30de88841c6819aa97a81b498ab19fd3b849 | [
"MIT"
] | null | null | null | from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
""" cria e salva um novo usuário"""
if... | 30.871795 | 76 | 0.664452 | from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
if not email:
raise ValueError('Us... | true | true |
f74bab8ad7c7a9c252f4cf9e62fa25593fe57400 | 18,629 | py | Python | optuna/samplers/_tpe/parzen_estimator.py | masap/optuna | f56cea87c4771d53b39f441e727d733dd1785557 | [
"MIT"
] | 1,300 | 2018-12-03T06:11:11.000Z | 2019-11-15T01:28:25.000Z | optuna/samplers/_tpe/parzen_estimator.py | masap/optuna | f56cea87c4771d53b39f441e727d733dd1785557 | [
"MIT"
] | 274 | 2018-12-04T09:54:07.000Z | 2019-11-15T02:23:18.000Z | optuna/samplers/_tpe/parzen_estimator.py | masap/optuna | f56cea87c4771d53b39f441e727d733dd1785557 | [
"MIT"
] | 148 | 2018-12-03T10:48:50.000Z | 2019-11-11T16:37:51.000Z | from typing import Callable
from typing import Dict
from typing import NamedTuple
from typing import Optional
from typing import Tuple
from typing import TYPE_CHECKING
import numpy as np
from optuna import distributions
from optuna._imports import _LazyImport
from optuna.distributions import BaseDistribution
if TYP... | 40.322511 | 99 | 0.592463 | from typing import Callable
from typing import Dict
from typing import NamedTuple
from typing import Optional
from typing import Tuple
from typing import TYPE_CHECKING
import numpy as np
from optuna import distributions
from optuna._imports import _LazyImport
from optuna.distributions import BaseDistribution
if TYP... | true | true |
f74baba64a377db4e2d4178d11cfe72c436c7065 | 2,118 | py | Python | others/paired/progressive/dataset.py | ericlearning/Progressive-Image-Translation-Network | 972c54dfdbc4c065328f7fc54b2b47c2cefcc609 | [
"MIT"
] | 2 | 2019-05-11T12:25:55.000Z | 2019-10-17T16:10:34.000Z | others/paired/progressive/dataset.py | ericlearning/Progressive-Image-Translation-Network | 972c54dfdbc4c065328f7fc54b2b47c2cefcc609 | [
"MIT"
] | null | null | null | others/paired/progressive/dataset.py | ericlearning/Progressive-Image-Translation-Network | 972c54dfdbc4c065328f7fc54b2b47c2cefcc609 | [
"MIT"
] | null | null | null | import os
import torch
import random
import numpy as np
from torchvision import datasets, transforms
from torch.utils.data import DataLoader
from PIL import Image
class Dataset():
def __init__(self, train_dir, basic_types = None, shuffle = True):
self.train_dir = train_dir
self.basic_types = basic_types
self.sh... | 32.090909 | 111 | 0.717186 | import os
import torch
import random
import numpy as np
from torchvision import datasets, transforms
from torch.utils.data import DataLoader
from PIL import Image
class Dataset():
def __init__(self, train_dir, basic_types = None, shuffle = True):
self.train_dir = train_dir
self.basic_types = basic_types
self.sh... | true | true |
f74babcaf33247edfe3fed1f2dffed5bc9bebed6 | 1,479 | py | Python | src/constants.py | AA-Turner/sphinx-themes.org | 07f700791c2b282dae9439f861abe52f0e6518f9 | [
"BSD-2-Clause"
] | 104 | 2018-01-29T00:44:35.000Z | 2022-03-31T08:11:56.000Z | src/constants.py | AA-Turner/sphinx-themes.org | 07f700791c2b282dae9439f861abe52f0e6518f9 | [
"BSD-2-Clause"
] | 60 | 2018-01-30T22:04:18.000Z | 2022-03-26T10:38:12.000Z | src/constants.py | AA-Turner/sphinx-themes.org | 07f700791c2b282dae9439f861abe52f0e6518f9 | [
"BSD-2-Clause"
] | 37 | 2018-01-30T14:25:23.000Z | 2022-03-31T23:03:23.000Z | from pathlib import Path
# -------------------------------------------------------------------------------
# Locations
# -------------------------------------------------------------------------------
_BASE = Path(__file__).parent.parent.relative_to(Path(".").resolve())
_PUBLIC = _BASE / "public"
_TEMPLATES = _BASE / ... | 29 | 81 | 0.47735 | from pathlib import Path
_BASE = Path(__file__).parent.parent.relative_to(Path(".").resolve())
_PUBLIC = _BASE / "public"
_TEMPLATES = _BASE / "src" / "templates"
FILES = {
"themes.json": _BASE / "themes.json",
}
TEMPLATES = {
"configuration": _TEMPLATES / "conf.template.py",
"preview-image": _TEMPLATES ... | true | true |
f74bacc655df590f149543a23365689cfde98602 | 21,908 | py | Python | main_ardae.py | lim0606/pytorch-ardae-rl | 6e861d8f09ee27fa8f7b42d1eb209788c93395fa | [
"MIT"
] | 7 | 2020-09-13T20:36:24.000Z | 2022-03-31T09:30:36.000Z | main_ardae.py | lim0606/pytorch-ardae-rl | 6e861d8f09ee27fa8f7b42d1eb209788c93395fa | [
"MIT"
] | null | null | null | main_ardae.py | lim0606/pytorch-ardae-rl | 6e861d8f09ee27fa8f7b42d1eb209788c93395fa | [
"MIT"
] | null | null | null | """
PyTorch code for SAC-AR-DAE. Copied and modified from PyTorch code for SAC-NF (Mazoure et al., 2019): https://arxiv.org/abs/1905.06893
"""
import os
import sys
import argparse
import time
import datetime
import itertools
import random
import pickle
import glob
import gym
import numpy as np
import torch
from sac_a... | 45.832636 | 188 | 0.564223 |
import os
import sys
import argparse
import time
import datetime
import itertools
import random
import pickle
import glob
import gym
import numpy as np
import torch
from sac_ardae import SAC
from normalized_actions import NormalizedActions
from replay_memory import ReplayMemory
import pandas as pd
try:
import pyb... | true | true |
f74bae669b410cc7da2f38aecac51fb0faea63f1 | 8,617 | py | Python | lasagne/layers/corrmm.py | lkfo415579/deeplearning_basic_build | 73f8e03a8454571ddeab0152c6b471f89404468e | [
"MIT"
] | 60 | 2015-01-29T21:54:04.000Z | 2019-11-12T07:38:15.000Z | lasagne/layers/corrmm.py | lkfo415579/deeplearning_basic_build | 73f8e03a8454571ddeab0152c6b471f89404468e | [
"MIT"
] | 5 | 2015-06-15T00:21:47.000Z | 2017-09-14T10:24:40.000Z | lasagne/layers/corrmm.py | lkfo415579/deeplearning_basic_build | 73f8e03a8454571ddeab0152c6b471f89404468e | [
"MIT"
] | 20 | 2015-04-28T00:21:41.000Z | 2019-09-16T01:10:37.000Z | import theano
from .. import init
from .. import nonlinearities
from .base import Layer
from .conv import conv_output_length
from ..utils import as_tuple
from theano.sandbox.cuda.basic_ops import gpu_contiguous
from theano.sandbox.cuda.blas import GpuCorrMM
__all__ = [
"MMLayer",
"Conv2DMMLayer",
]
if n... | 39.527523 | 79 | 0.628873 | import theano
from .. import init
from .. import nonlinearities
from .base import Layer
from .conv import conv_output_length
from ..utils import as_tuple
from theano.sandbox.cuda.basic_ops import gpu_contiguous
from theano.sandbox.cuda.blas import GpuCorrMM
__all__ = [
"MMLayer",
"Conv2DMMLayer",
]
if n... | true | true |
f74baf96e92c9b15045da16364f2dfec8a0f8368 | 91 | py | Python | metamvc/__main__.py | danilocgsilva/MetaMVC | 8be57d8e4c153eb7fe94c48509042dd677987560 | [
"Apache-2.0"
] | null | null | null | metamvc/__main__.py | danilocgsilva/MetaMVC | 8be57d8e4c153eb7fe94c48509042dd677987560 | [
"Apache-2.0"
] | null | null | null | metamvc/__main__.py | danilocgsilva/MetaMVC | 8be57d8e4c153eb7fe94c48509042dd677987560 | [
"Apache-2.0"
] | null | null | null | from metamvc.DatabaseUserData import DatabaseUserData
def main():
DatabaseUserData()
| 15.166667 | 53 | 0.791209 | from metamvc.DatabaseUserData import DatabaseUserData
def main():
DatabaseUserData()
| true | true |
f74baf9ba3084c5852c42b7ecc0e5f4a2fca1424 | 338 | py | Python | aula022 - MODULOS e PACOTES/ex109-FormatandoMoedas/ex109.py | miradouro/CursoEmVideo-Python | cc7b05a9a4aad8e6ef3b29453d83370094d75e41 | [
"MIT"
] | null | null | null | aula022 - MODULOS e PACOTES/ex109-FormatandoMoedas/ex109.py | miradouro/CursoEmVideo-Python | cc7b05a9a4aad8e6ef3b29453d83370094d75e41 | [
"MIT"
] | null | null | null | aula022 - MODULOS e PACOTES/ex109-FormatandoMoedas/ex109.py | miradouro/CursoEmVideo-Python | cc7b05a9a4aad8e6ef3b29453d83370094d75e41 | [
"MIT"
] | null | null | null | import moeda
valor = float(input('Digite o preço: '))
p = 20
print(f'A metade de {moeda.moeda(valor)} é {moeda.metade(valor, True)}')
print(f'O dobro de {moeda.moeda(valor)} é {moeda.dobro(valor, True)}')
print(f'Aumentando {p}%, temos {moeda.aumentar(valor, p, True)}')
print(f'Diminuindo 10%, temos {moeda.diminuir(va... | 37.555556 | 72 | 0.689349 | import moeda
valor = float(input('Digite o preço: '))
p = 20
print(f'A metade de {moeda.moeda(valor)} é {moeda.metade(valor, True)}')
print(f'O dobro de {moeda.moeda(valor)} é {moeda.dobro(valor, True)}')
print(f'Aumentando {p}%, temos {moeda.aumentar(valor, p, True)}')
print(f'Diminuindo 10%, temos {moeda.diminuir(va... | true | true |
f74bb1af4a7fa8a1a2bfbc88d40da44f9244a6dd | 965 | py | Python | kubernetes/test/test_logs_api.py | woqer/python | 3a6fe8231cefe1fa39a0a69d4b2f33044ab32745 | [
"Apache-2.0"
] | 1 | 2019-07-12T05:38:06.000Z | 2019-07-12T05:38:06.000Z | kubernetes/test/test_logs_api.py | woqer/python | 3a6fe8231cefe1fa39a0a69d4b2f33044ab32745 | [
"Apache-2.0"
] | null | null | null | kubernetes/test/test_logs_api.py | woqer/python | 3a6fe8231cefe1fa39a0a69d4b2f33044ab32745 | [
"Apache-2.0"
] | 1 | 2021-05-18T12:25:56.000Z | 2021-05-18T12:25:56.000Z | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.11.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | 18.207547 | 105 | 0.660104 |
from __future__ import absolute_import
import os
import sys
import unittest
import kubernetes.client
from kubernetes.client.rest import ApiException
from kubernetes.client.apis.logs_api import LogsApi
class TestLogsApi(unittest.TestCase):
def setUp(self):
self.api = kubernetes.client.apis.logs_api.L... | true | true |
f74bb23e8946597cac4fb1e39ad6467e1e10131e | 1,598 | py | Python | multi-robot/src/multi-robot/src/drone_kinect.py | YanCHEN-fr/DGA_Challenge_Multi_Robot_Control | 5f410f09870dab0cfa0cc64e80de1ce1931e2654 | [
"Apache-2.0"
] | null | null | null | multi-robot/src/multi-robot/src/drone_kinect.py | YanCHEN-fr/DGA_Challenge_Multi_Robot_Control | 5f410f09870dab0cfa0cc64e80de1ce1931e2654 | [
"Apache-2.0"
] | null | null | null | multi-robot/src/multi-robot/src/drone_kinect.py | YanCHEN-fr/DGA_Challenge_Multi_Robot_Control | 5f410f09870dab0cfa0cc64e80de1ce1931e2654 | [
"Apache-2.0"
] | 1 | 2021-03-10T20:53:34.000Z | 2021-03-10T20:53:34.000Z | #!/usr/bin/env python
import rospy
import numpy as np
import cv2, cv_bridge
from sensor_msgs.msg import Image
class drone_camera:
def __init__(self, drone_N):
assert int(drone_N) in {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
rospy.init_node("drone{}_kinect_vision".format(drone_N), anonymous=False)
se... | 35.511111 | 120 | 0.653317 |
import rospy
import numpy as np
import cv2, cv_bridge
from sensor_msgs.msg import Image
class drone_camera:
def __init__(self, drone_N):
assert int(drone_N) in {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
rospy.init_node("drone{}_kinect_vision".format(drone_N), anonymous=False)
self.track_flag = False
... | true | true |
f74bb2ae193fc02a3e6792bbe2853a9a4d811f4a | 262 | py | Python | baekjoon/python/axb.py | yskang/AlgorithmPracticeWithPython | f7129bd1924a7961489198f0ee052d2cd1e9cf40 | [
"MIT"
] | null | null | null | baekjoon/python/axb.py | yskang/AlgorithmPracticeWithPython | f7129bd1924a7961489198f0ee052d2cd1e9cf40 | [
"MIT"
] | null | null | null | baekjoon/python/axb.py | yskang/AlgorithmPracticeWithPython | f7129bd1924a7961489198f0ee052d2cd1e9cf40 | [
"MIT"
] | null | null | null | # A*B
# https://www.acmicpc.net/problem/10998
import sys
# testData = [
# '1 2'
# ]
# testData.reverse()
# rl = lambda: testData.pop()
rl = lambda: input()
line = rl()
a = int(line.split(' ')[0])
b = int(line.split(' ')[1])
print(a*b)
| 13.789474 | 40 | 0.530534 |
import sys
rl = lambda: input()
line = rl()
a = int(line.split(' ')[0])
b = int(line.split(' ')[1])
print(a*b)
| true | true |
f74bb331076da0e006627a400801994986c3924d | 20,182 | py | Python | test/functional/rpc_rawtransaction.py | nondracek/ClipCoin | 80a77d861f931d9f56368581bd1cdb0c1b9f8c59 | [
"MIT"
] | null | null | null | test/functional/rpc_rawtransaction.py | nondracek/ClipCoin | 80a77d861f931d9f56368581bd1cdb0c1b9f8c59 | [
"MIT"
] | null | null | null | test/functional/rpc_rawtransaction.py | nondracek/ClipCoin | 80a77d861f931d9f56368581bd1cdb0c1b9f8c59 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the rawtransaction RPCs.
Test the following RPCs:
- createrawtransaction
- signrawtransacti... | 53.25066 | 233 | 0.646913 |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
class multidict(dict):
def __init__(self, x):
dict.__init__(self, x)
self.x = x
def items(self):
return self.x
class RawTransactionsTest(BitcoinTestFramework):
def set_test_params(... | true | true |
f74bb343c227566413db81bae38229fd233addcd | 17 | py | Python | data/studio21_generated/introductory/3473/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | data/studio21_generated/introductory/3473/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | data/studio21_generated/introductory/3473/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | def doubles(s):
| 8.5 | 15 | 0.647059 | def doubles(s):
| false | true |
f74bb44090a5cac164f0f897b4d822ad1e707a62 | 9,963 | py | Python | my_vim_files/python27/Lib/distutils/tests/test_archive_util.py | satsaeid/dotfiles | 401c3213b31dd941b44e553c6f0441187b01c19a | [
"MIT"
] | null | null | null | my_vim_files/python27/Lib/distutils/tests/test_archive_util.py | satsaeid/dotfiles | 401c3213b31dd941b44e553c6f0441187b01c19a | [
"MIT"
] | null | null | null | my_vim_files/python27/Lib/distutils/tests/test_archive_util.py | satsaeid/dotfiles | 401c3213b31dd941b44e553c6f0441187b01c19a | [
"MIT"
] | null | null | null | """Tests for distutils.archive_util."""
__revision__ = "$Id: test_archive_util.py 75659 2009-10-24 13:29:44Z tarek.ziade $"
import unittest
import os
import tarfile
from os.path import splitdrive
import warnings
from distutils.archive_util import (check_archive_formats, make_tarball,
... | 34.957895 | 84 | 0.573723 | __revision__ = "$Id: test_archive_util.py 75659 2009-10-24 13:29:44Z tarek.ziade $"
import unittest
import os
import tarfile
from os.path import splitdrive
import warnings
from distutils.archive_util import (check_archive_formats, make_tarball,
make_zipfile, make_archive,
... | true | true |
f74bb46c8152db30c377a45a264a7a27f758ca36 | 5,133 | gyp | Python | login_manager/login_manager.gyp | doitmovin/chromiumos-platform2 | 6462aaf43072307b5a40eb045a89e473381b5fda | [
"BSD-3-Clause"
] | null | null | null | login_manager/login_manager.gyp | doitmovin/chromiumos-platform2 | 6462aaf43072307b5a40eb045a89e473381b5fda | [
"BSD-3-Clause"
] | null | null | null | login_manager/login_manager.gyp | doitmovin/chromiumos-platform2 | 6462aaf43072307b5a40eb045a89e473381b5fda | [
"BSD-3-Clause"
] | 2 | 2021-01-26T12:37:19.000Z | 2021-05-18T13:37:57.000Z | {
'target_defaults': {
'defines': [
'OS_CHROMEOS',
'USE_CHEETS=<(USE_cheets)',
'USE_NSS_CERTS',
'USE_SYSTEMD=<(USE_systemd)',
],
'variables': {
'deps': [
'dbus-1',
'libbrillo-<(libbase_ver)',
'libchrome-<(libbase_ver)',
'libchromeos-ui-<(libbas... | 29.67052 | 83 | 0.548023 | {
'target_defaults': {
'defines': [
'OS_CHROMEOS',
'USE_CHEETS=<(USE_cheets)',
'USE_NSS_CERTS',
'USE_SYSTEMD=<(USE_systemd)',
],
'variables': {
'deps': [
'dbus-1',
'libbrillo-<(libbase_ver)',
'libchrome-<(libbase_ver)',
'libchromeos-ui-<(libbas... | true | true |
f74bb47d4c2b521576db557b52fc9ebbd1bec2be | 251 | py | Python | ABC/abc101-abc150/abc114/b.py | KATO-Hiro/AtCoder | cbbdb18e95110b604728a54aed83a6ed6b993fde | [
"CC0-1.0"
] | 2 | 2020-06-12T09:54:23.000Z | 2021-05-04T01:34:07.000Z | ABC/abc101-abc150/abc114/b.py | KATO-Hiro/AtCoder | cbbdb18e95110b604728a54aed83a6ed6b993fde | [
"CC0-1.0"
] | 961 | 2020-06-23T07:26:22.000Z | 2022-03-31T21:34:52.000Z | ABC/abc101-abc150/abc114/b.py | KATO-Hiro/AtCoder | cbbdb18e95110b604728a54aed83a6ed6b993fde | [
"CC0-1.0"
] | null | null | null | # -*- coding: utf-8 -*-
def main():
s = input()
ans = float('inf')
for i in range(len(s) - 3 + 1):
candidate = int(s[i:i + 3])
ans = min(ans, abs(753 - candidate))
print(ans)
if __name__ == '__main__':
main()
| 14.764706 | 44 | 0.482072 |
def main():
s = input()
ans = float('inf')
for i in range(len(s) - 3 + 1):
candidate = int(s[i:i + 3])
ans = min(ans, abs(753 - candidate))
print(ans)
if __name__ == '__main__':
main()
| true | true |
f74bb4c63b6d18dfbb79d83a8a4fbfeba82eb118 | 497 | py | Python | tests/test_news_article.py | Collin9726/Marekani | 10c5432eb8f6612e93a3fb03d2d4cd74f4db556d | [
"MIT"
] | 5 | 2021-10-31T22:04:03.000Z | 2022-01-08T17:42:07.000Z | tests/test_news_article.py | Collin9726/Marekani | 10c5432eb8f6612e93a3fb03d2d4cd74f4db556d | [
"MIT"
] | null | null | null | tests/test_news_article.py | Collin9726/Marekani | 10c5432eb8f6612e93a3fb03d2d4cd74f4db556d | [
"MIT"
] | null | null | null | import unittest
from app.models import NewsArticle
class ArticleTest(unittest.TestCase):
'''
Test Class to test the behaviour of the NewsArticle class
'''
def setUp(self):
'''
Set up method that will run before every Test
'''
self.new_article = NewsArticle("CNN", "John ... | 31.0625 | 133 | 0.651911 | import unittest
from app.models import NewsArticle
class ArticleTest(unittest.TestCase):
def setUp(self):
self.new_article = NewsArticle("CNN", "John Doe", "Christmas in the City", "/home", "/image", "30-05-2020", "Lorem", "Ipsum")
def test_instance(self):
self.assertTrue(isinstance(self.new_... | true | true |
f74bb51594c045c7c4e32e5175eb3df81e96ab5a | 2,756 | py | Python | utils/time_utils.py | faker2cumtb/sentimentanalysis | b4b185bd1d55471ac99664fe890c31fa8a48918b | [
"MIT"
] | 10 | 2019-03-22T07:46:19.000Z | 2021-04-18T12:29:47.000Z | utils/time_utils.py | faker2cumtb/sentimentanalysis | b4b185bd1d55471ac99664fe890c31fa8a48918b | [
"MIT"
] | 1 | 2019-09-21T03:33:26.000Z | 2019-09-21T03:33:26.000Z | utils/time_utils.py | faker2cumtb/sentimentanalysis | b4b185bd1d55471ac99664fe890c31fa8a48918b | [
"MIT"
] | 8 | 2019-04-09T09:59:22.000Z | 2021-12-26T14:08:22.000Z | # -*- coding: utf-8 -*-
#
# 格式为 "%Y-%m-%d %H:%M:%S", 如'2018-10-01 00:00:01'
#
# 常用函数
# (1) 时间戳转为struct_time对象
# time.localtime(ts))
# time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=8, tm_min=0, tm_sec=12,
# tm_wday=3, tm_yday=1, tm_isdst=0)
# (2)
# date_obj = datetime.date(int(... | 25.284404 | 95 | 0.630987 |
import time
import datetime
def datetime_to_string(dt):
return dt.strftime("%Y-%m-%d %H:%M:%S")
def string_to_datetime(str_time):
return time.strptime(str_time, "%Y-%m-%d %H:%M:%S")
def string_to_timestamp(str_time):
return time.mktime(string_to_datetime(str_time))
def timestamp_to_string(stamp):
... | true | true |
f74bb5646fe40f620e3daf9fc58096e5c4e2c5a8 | 3,584 | py | Python | tests/PySys/software_management_end_to_end/sm_mixed_install_remove_multiple/run.py | rina23q/thin-edge.io | 6913365ec2196d0c7f832ebf17bc83b27e60d858 | [
"Apache-2.0"
] | null | null | null | tests/PySys/software_management_end_to_end/sm_mixed_install_remove_multiple/run.py | rina23q/thin-edge.io | 6913365ec2196d0c7f832ebf17bc83b27e60d858 | [
"Apache-2.0"
] | null | null | null | tests/PySys/software_management_end_to_end/sm_mixed_install_remove_multiple/run.py | rina23q/thin-edge.io | 6913365ec2196d0c7f832ebf17bc83b27e60d858 | [
"Apache-2.0"
] | null | null | null | from pysys.basetest import BaseTest
import time
"""
Validate end to end behaviour for the dummy-plugin for multiple packages with mixed versions
When we install a bunch of packages
Then they are installed
When we deinstall them again
Then they are not installed
This test is currently skipped as it needs a speciali... | 32.288288 | 92 | 0.573661 | from pysys.basetest import BaseTest
import time
import json
import requests
import time
import sys
from environment_sm_management import SoftwareManagement
class PySysTest(SoftwareManagement):
def get_packages_with_action(self, act):
mgt = "::fruits"
action = [
{
... | true | true |
f74bb5e364977c6b86a7875d2fa785be4f988aa2 | 5,574 | py | Python | tengi/task.py | qzar02/tengi | 35f900b2ae8be88f6c62cc022adcb4dcac08aa5f | [
"MIT"
] | null | null | null | tengi/task.py | qzar02/tengi | 35f900b2ae8be88f6c62cc022adcb4dcac08aa5f | [
"MIT"
] | null | null | null | tengi/task.py | qzar02/tengi | 35f900b2ae8be88f6c62cc022adcb4dcac08aa5f | [
"MIT"
] | null | null | null | from urllib.parse import urlparse
from datetime import date
class TableNode:
def __init__(self, task, _id):
self.task = task
self.requires = []
self.id = _id
class GraphDependency:
def __init__(self, tasks):
nodes = {}
for task in tasks:
nodes[task.id] = T... | 27.594059 | 100 | 0.570506 | from urllib.parse import urlparse
from datetime import date
class TableNode:
def __init__(self, task, _id):
self.task = task
self.requires = []
self.id = _id
class GraphDependency:
def __init__(self, tasks):
nodes = {}
for task in tasks:
nodes[task.id] = T... | true | true |
f74bb62dc964b00d0c5f083ad035e85eb47c14fd | 3,964 | py | Python | script/eval_1_mean_plot.py | rezeck/grf_transport | 64d68dc18b950575c19e44d91ade87b01a1e9ab0 | [
"Apache-2.0"
] | null | null | null | script/eval_1_mean_plot.py | rezeck/grf_transport | 64d68dc18b950575c19e44d91ade87b01a1e9ab0 | [
"Apache-2.0"
] | null | null | null | script/eval_1_mean_plot.py | rezeck/grf_transport | 64d68dc18b950575c19e44d91ade87b01a1e9ab0 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats
import sys
def mean_confidence_interval(data, confidence=0.95):
a = 1.0 * np.array(data)
n = len(a)
m, se = np.mean(a), scipy.stats.sem(a)
h = se * scipy.stats.t.ppf((1 + confidence) / 2., n-1)
return m, m... | 32.227642 | 164 | 0.636226 |
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats
import sys
def mean_confidence_interval(data, confidence=0.95):
a = 1.0 * np.array(data)
n = len(a)
m, se = np.mean(a), scipy.stats.sem(a)
h = se * scipy.stats.t.ppf((1 + confidence) / 2., n-1)
return m, m-h, m+h
prefix = "ex... | true | true |
f74bb64b4aa566bcf01bb0c7975fea625b199dc3 | 1,831 | py | Python | venv/Lib/site-packages/pyrogram/raw/base/bot_info.py | iamgeorgiy/heroku-userbot | 5a92417d16f8ead949d88cb38da213fc2da5d3a4 | [
"Apache-2.0"
] | null | null | null | venv/Lib/site-packages/pyrogram/raw/base/bot_info.py | iamgeorgiy/heroku-userbot | 5a92417d16f8ead949d88cb38da213fc2da5d3a4 | [
"Apache-2.0"
] | null | null | null | venv/Lib/site-packages/pyrogram/raw/base/bot_info.py | iamgeorgiy/heroku-userbot | 5a92417d16f8ead949d88cb38da213fc2da5d3a4 | [
"Apache-2.0"
] | null | null | null | # Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2020 Dan <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free... | 36.62 | 87 | 0.632987 |
from typing import Union
from pyrogram import raw
from pyrogram.raw.core import TLObject
BotInfo = Union[raw.types.BotInfo]
class BotInfo:
QUALNAME = "pyrogram.raw.base.BotInfo"
def __init__(self):
raise TypeError("Base types can only be used for type checking purposes: "
... | true | true |
f74bb7018fb50beedc7e6d902b50f2da61e6dd08 | 34,038 | py | Python | electrum/address_synchronizer.py | phamels/electrum-nix | 3ca93e399939c36e54bf77c235033b8e77219bfe | [
"MIT"
] | 5 | 2018-10-31T18:47:54.000Z | 2021-09-20T02:04:42.000Z | electrum/address_synchronizer.py | project-mynt/electrum-mynt | ca1548e008854f2a3eff900a69365307cc20bd57 | [
"MIT"
] | null | null | null | electrum/address_synchronizer.py | project-mynt/electrum-mynt | ca1548e008854f2a3eff900a69365307cc20bd57 | [
"MIT"
] | 11 | 2018-10-31T19:46:05.000Z | 2019-09-25T20:18:37.000Z | # Electrum - lightweight Bitcoin client
# Copyright (C) 2018 The Electrum Developers
#
# 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 ... | 41.56044 | 109 | 0.571156 |
import threading
import asyncio
import itertools
from collections import defaultdict
from typing import TYPE_CHECKING
from . import bitcoin
from .bitcoin import COINBASE_MATURITY, TYPE_ADDRESS, TYPE_PUBKEY
from .util import PrintError, profiler, bfh, VerifiedTxInfo, TxMinedStatus
from .transaction import Transaction,... | true | true |
f74bb74c245f6868175909f6c217f1d9bef1c053 | 132,400 | py | Python | src/nifgen/metadata/attributes.py | WhiteLupus/nimi-python | 4e05b9a64f08ed2c929932d8d586c7114c46cf04 | [
"MIT"
] | 1 | 2019-09-18T14:28:47.000Z | 2019-09-18T14:28:47.000Z | src/nifgen/metadata/attributes.py | WhiteLupus/nimi-python | 4e05b9a64f08ed2c929932d8d586c7114c46cf04 | [
"MIT"
] | null | null | null | src/nifgen/metadata/attributes.py | WhiteLupus/nimi-python | 4e05b9a64f08ed2c929932d8d586c7114c46cf04 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# This file is generated from NI-FGEN API metadata version 19.6.0d0
attributes = {
1050002: {
'access': 'read-write',
'channel_based': False,
'codegen_method': 'no',
'documentation': {
'description': '\nSpecifies whether to validate attribute value... | 48.533724 | 971 | 0.638497 | attributes = {
1050002: {
'access': 'read-write',
'channel_based': False,
'codegen_method': 'no',
'documentation': {
'description': '\nSpecifies whether to validate attribute values and function parameters. If enabled, NI-FGEN validates the parameter values that you pas... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.