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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f74ab08e9f1189840bb04a737873179f1cf082be | 7,497 | py | Python | kubernetes/client/models/com_coreos_monitoring_v1_pod_monitor_list.py | mariusgheorghies/python | 68ac7e168963d8b5a81dc493b1973d29e903a15b | [
"Apache-2.0"
] | null | null | null | kubernetes/client/models/com_coreos_monitoring_v1_pod_monitor_list.py | mariusgheorghies/python | 68ac7e168963d8b5a81dc493b1973d29e903a15b | [
"Apache-2.0"
] | null | null | null | kubernetes/client/models/com_coreos_monitoring_v1_pod_monitor_list.py | mariusgheorghies/python | 68ac7e168963d8b5a81dc493b1973d29e903a15b | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1.20.7
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
fr... | 36.393204 | 312 | 0.65026 |
import pprint
import re
import six
from kubernetes.client.configuration import Configuration
class ComCoreosMonitoringV1PodMonitorList(object):
openapi_types = {
'api_version': 'str',
'items': 'list[ComCoreosMonitoringV1PodMonitor]',
'kind': 'str',
'metadata': 'V1ListMeta'
... | true | true |
f74ab0f4b46f53f74a7ec156efbdde35a80d3ab2 | 4,210 | py | Python | benchmark/startQiskit_noisy2660.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit_noisy2660.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit_noisy2660.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=4
# total number=41
import cirq
import qiskit
from qiskit.providers.aer import QasmSimulator
from qiskit.test.mock import FakeVigo
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import ... | 34.508197 | 140 | 0.653444 | import cirq
import qiskit
from qiskit.providers.aer import QasmSimulator
from qiskit.test.mock import FakeVigo
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2
impo... | true | true |
f74ab10f5ec32efdaea5c3f1b1f1bdf486d2e48b | 1,283 | py | Python | generic/time-calculator/time_calculator.py | dalamilla/programming-python | bf30ae752afff810d5cc0dda07694518a510a913 | [
"MIT"
] | null | null | null | generic/time-calculator/time_calculator.py | dalamilla/programming-python | bf30ae752afff810d5cc0dda07694518a510a913 | [
"MIT"
] | null | null | null | generic/time-calculator/time_calculator.py | dalamilla/programming-python | bf30ae752afff810d5cc0dda07694518a510a913 | [
"MIT"
] | null | null | null | def add_time(start, duration, day=""):
start_time = start.split()
dur_time = duration.split()
arr_days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
star_arr = start_time[0].split(":")
dur_arr = dur_time[0].split(":")
hour = int(star_arr[0]) + int(dur_arr[0])
min = int(... | 22.910714 | 91 | 0.55339 | def add_time(start, duration, day=""):
start_time = start.split()
dur_time = duration.split()
arr_days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
star_arr = start_time[0].split(":")
dur_arr = dur_time[0].split(":")
hour = int(star_arr[0]) + int(dur_arr[0])
min = int(... | true | true |
f74ab13373a4651680dd2ed424f2391aff734609 | 196 | py | Python | Python/factors.py | odddollar/Language-benchmarks | c51977dfd3b7b8543fe1de84360cd5d3d12b9d84 | [
"MIT"
] | 4 | 2021-02-14T07:09:35.000Z | 2021-02-16T07:58:56.000Z | Python/factors.py | odddollar/Language-benchmarks | c51977dfd3b7b8543fe1de84360cd5d3d12b9d84 | [
"MIT"
] | 3 | 2021-02-15T08:48:40.000Z | 2021-02-18T13:08:38.000Z | Python/factors.py | odddollar/Language-benchmarks | c51977dfd3b7b8543fe1de84360cd5d3d12b9d84 | [
"MIT"
] | 5 | 2021-02-13T16:38:29.000Z | 2021-02-18T12:53:55.000Z | from time import time
start = time()
num = 2000000000
for i in range(1, num+1):
if num % i == 0:
print(f"{i} is a factor of {num}")
print(f"Time taken: {round(time()-start, 3)}s")
| 16.333333 | 47 | 0.586735 | from time import time
start = time()
num = 2000000000
for i in range(1, num+1):
if num % i == 0:
print(f"{i} is a factor of {num}")
print(f"Time taken: {round(time()-start, 3)}s")
| true | true |
f74ab1405f8355111946260e5a548808341212c9 | 24,652 | py | Python | mitmproxy/console/flowview.py | dolfly/mitmproxy | 4604c25c6055a37e5f25a238d2a089759bd5d98a | [
"MIT"
] | null | null | null | mitmproxy/console/flowview.py | dolfly/mitmproxy | 4604c25c6055a37e5f25a238d2a089759bd5d98a | [
"MIT"
] | null | null | null | mitmproxy/console/flowview.py | dolfly/mitmproxy | 4604c25c6055a37e5f25a238d2a089759bd5d98a | [
"MIT"
] | null | null | null | from __future__ import absolute_import, division
import os
import traceback
import sys
import math
import urwid
from netlib import odict
from netlib.http import CONTENT_MISSING, Headers
from . import common, grideditor, signals, searchable, tabs
from . import flowdetailview
from .. import utils, controller, contentvi... | 34.478322 | 96 | 0.478217 | from __future__ import absolute_import, division
import os
import traceback
import sys
import math
import urwid
from netlib import odict
from netlib.http import CONTENT_MISSING, Headers
from . import common, grideditor, signals, searchable, tabs
from . import flowdetailview
from .. import utils, controller, contentvi... | true | true |
f74ab2b8ece8d455d6b6ad83ca5c434e9c51a66d | 12,339 | py | Python | docs/conf.py | NextThought/nti.webhooks | 2015a02fba8d4ca1811a76872a2266c5e85d5728 | [
"Apache-2.0"
] | 1 | 2020-10-20T09:23:57.000Z | 2020-10-20T09:23:57.000Z | docs/conf.py | NextThought/nti.webhooks | 2015a02fba8d4ca1811a76872a2266c5e85d5728 | [
"Apache-2.0"
] | 7 | 2020-06-23T22:10:37.000Z | 2020-12-04T20:27:45.000Z | docs/conf.py | NextThought/nti.webhooks | 2015a02fba8d4ca1811a76872a2266c5e85d5728 | [
"Apache-2.0"
] | 1 | 2020-10-28T19:58:12.000Z | 2020-10-28T19:58:12.000Z | # -*- coding: utf-8 -*-
#
# nti.webhooks documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 2 08:43:18 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... | 30.8475 | 80 | 0.702407 |
import sys
import os
import pkg_resources
sys.path.append(os.path.abspath('../src'))
sys.path.insert(0, os.path.abspath('.'))
rqmt = pkg_resources.require('nti.webhooks')[0]
needs_sphinx = "1.8"
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.extlinks',
'sphinx.ext.intersphinx... | true | true |
f74ab35c5f65393e69de314b1ab2e0582987377c | 7,264 | py | Python | tests/sai_qualify/sai_infra.py | sumukhatv/sonic-mgmt | 57c1512fcfe24ac27b409730ff87726933a63647 | [
"Apache-2.0"
] | 2 | 2020-07-03T01:16:27.000Z | 2020-10-09T05:38:07.000Z | tests/sai_qualify/sai_infra.py | sumukhatv/sonic-mgmt | 57c1512fcfe24ac27b409730ff87726933a63647 | [
"Apache-2.0"
] | null | null | null | tests/sai_qualify/sai_infra.py | sumukhatv/sonic-mgmt | 57c1512fcfe24ac27b409730ff87726933a63647 | [
"Apache-2.0"
] | 1 | 2020-07-02T02:49:56.000Z | 2020-07-02T02:49:56.000Z | """
SAI testing test bed setup.
Notes:
This test is used to setup the SAI testing environment, and start the SAI test cases
from the PTF.
For running this tests, please specify the sai test case folder via the parameters --sai_test_folder.
"""
import pytest, socket, sys, itertools, lo... | 30.016529 | 109 | 0.668778 |
import pytest, socket, sys, itertools, logging
from struct import pack, unpack
from ptf.mask import Mask
import ptf.packet as scapy
import tests.common.system_utils.docker as docker
import tests.common.fixtures.ptfhost_utils as ptfhost_utils
from conftest import *
from community_cases import *
logger = logging.getLog... | true | true |
f74ab4197806228409f799a0129a93fec16ef273 | 581 | py | Python | simp-py-code/factorial.py | Michaeloye/python-journey | ff8ce0e8796a129994f9a9a9dbb80340fa5790dc | [
"MIT"
] | null | null | null | simp-py-code/factorial.py | Michaeloye/python-journey | ff8ce0e8796a129994f9a9a9dbb80340fa5790dc | [
"MIT"
] | null | null | null | simp-py-code/factorial.py | Michaeloye/python-journey | ff8ce0e8796a129994f9a9a9dbb80340fa5790dc | [
"MIT"
] | null | null | null | #This is to get the factorial of a particular number]
num = int(input("Enter the number to calculate the factorial: "))
'''while i<5:
num = int(input("Enter the number to calculate the factorial: "))
def fact(num):
if num == 0:
return 1
return num * fact(num-1)
print(fact... | 22.346154 | 70 | 0.523236 |
num = int(input("Enter the number to calculate the factorial: "))
def fact(num):
if num < 0:
print("error")
elif num == 0:
return 1
else:
result = 1
for k in range(1,num+1):
result = result * (k)
return result
print(fact(num)) | true | true |
f74ab430dd076f3f5fc885c1897a8cba6d62f060 | 18,422 | py | Python | tests/reg_tests/cumulative_curl_regression_test.py | Bartdoekemeijer/FLORIS | be3c9fbb559354b5bf848792d84caff90606ed05 | [
"Apache-2.0"
] | null | null | null | tests/reg_tests/cumulative_curl_regression_test.py | Bartdoekemeijer/FLORIS | be3c9fbb559354b5bf848792d84caff90606ed05 | [
"Apache-2.0"
] | null | null | null | tests/reg_tests/cumulative_curl_regression_test.py | Bartdoekemeijer/FLORIS | be3c9fbb559354b5bf848792d84caff90606ed05 | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 NREL
# 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
# distri... | 33.555556 | 113 | 0.640864 |
import numpy as np
from floris.simulation import Floris
from floris.simulation import Ct, power, axial_induction, average_velocity
from tests.conftest import N_TURBINES, N_WIND_DIRECTIONS, N_WIND_SPEEDS, print_test_values, assert_results_arrays
DEBUG = True
VELOCITY_MODEL = "cc"
DEFLECTION_MODEL = "gauss"
baseli... | true | true |
f74ab460a4bebe57ae4834bbb3ff2008565bbddc | 712 | py | Python | mt_html/env_creator.py | purplecomputer/Mikrotik_HTML_Documentation | 679531d6d1b335aae68294e01c835620d002553d | [
"MIT"
] | null | null | null | mt_html/env_creator.py | purplecomputer/Mikrotik_HTML_Documentation | 679531d6d1b335aae68294e01c835620d002553d | [
"MIT"
] | null | null | null | mt_html/env_creator.py | purplecomputer/Mikrotik_HTML_Documentation | 679531d6d1b335aae68294e01c835620d002553d | [
"MIT"
] | null | null | null | #helps to create env file
#2021 - Angelo Poggi : angelo.poggi@webair.com
import click
@click.command()
@click.option('--createenv', '-c', help="""Helps you to create the .env file required to use this script.\n
mikrotikhtml --createenv <username> <password>""", required=True)
@click.argument(... | 47.466667 | 107 | 0.686798 | import click
@click.command()
@click.option('--createenv', '-c', help="""Helps you to create the .env file required to use this script.\n
mikrotikhtml --createenv <username> <password>""", required=True)
@click.argument('username')
@click.argument('password')
def create_env_file(username, pas... | true | true |
f74ab4737299a483cede8da523841de98e77dc6f | 49,913 | py | Python | tests/unit/mock.py | arossert/vncdotool | e133a8916efaa0f5ed421e0aa737196624635b0c | [
"MIT"
] | 2 | 2015-11-10T15:02:29.000Z | 2021-09-14T23:34:22.000Z | tests/unit/mock.py | arossert/vncdotool | e133a8916efaa0f5ed421e0aa737196624635b0c | [
"MIT"
] | 3 | 2021-03-19T16:01:36.000Z | 2021-09-08T02:58:53.000Z | tests/unit/mock.py | arossert/vncdotool | e133a8916efaa0f5ed421e0aa737196624635b0c | [
"MIT"
] | 1 | 2021-09-14T23:34:28.000Z | 2021-09-14T23:34:28.000Z | # mock.py
# Test tools for mocking and patching.
# Copyright (C) 2007-2011 Michael Foord & the mock team
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# mock 0.8.0
# http://www.voidspace.org.uk/python/mock/
# Released subject to the BSD License
# Please see http://www.voidspace.org.uk/python/license.shtml
# Scripts... | 31.650602 | 83 | 0.617094 |
__all__ = (
'Mock',
'MagicMock',
'mocksignature',
'patch',
'sentinel',
'DEFAULT',
'ANY',
'call',
'create_autospec',
'FILTER_DIR',
)
__version__ = '0.8.0alpha1'
__unittest = True
import sys
try:
import inspect
except ImportError:
inspect = None
try:
... | true | true |
f74ab6cbc4d6514c26d3c75f6ddf73e62c5c5faa | 7,754 | py | Python | test/functional/test_framework/authproxy.py | ogfuncoin/ogfuncoin | 18d00bc1d93335c86ae6f2971321e93e627ae570 | [
"MIT"
] | null | null | null | test/functional/test_framework/authproxy.py | ogfuncoin/ogfuncoin | 18d00bc1d93335c86ae6f2971321e93e627ae570 | [
"MIT"
] | null | null | null | test/functional/test_framework/authproxy.py | ogfuncoin/ogfuncoin | 18d00bc1d93335c86ae6f2971321e93e627ae570 | [
"MIT"
] | null | null | null | # Copyright (c) 2011 Jeff Garzik
#
# Previous copyright, from python-jsonrpc/jsonrpc/proxy.py:
#
# Copyright (c) 2007 Jan-Klaas Kollhof
#
# This file is part of jsonrpc.
#
# jsonrpc is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# th... | 42.839779 | 155 | 0.644184 |
import base64
import decimal
import http.client
import json
import logging
import socket
import time
import urllib.parse
HTTP_TIMEOUT = 30
USER_AGENT = "AuthServiceProxy/0.1"
log = logging.getLogger("ogfuncoinRPC")
class JSONRPCException(Exception):
def __init__(self, rpc_error):
try:
errmsg... | true | true |
f74ab73dede7ecec5c2750f9a73b52b857e4a0d8 | 396 | py | Python | python/poo_algoritmos/bokeh_1.py | lmonsalve22/Learning-to-Code | 2e32eba3fbd0bd63cc539e1e6d372ca346b765c9 | [
"MIT"
] | null | null | null | python/poo_algoritmos/bokeh_1.py | lmonsalve22/Learning-to-Code | 2e32eba3fbd0bd63cc539e1e6d372ca346b765c9 | [
"MIT"
] | null | null | null | python/poo_algoritmos/bokeh_1.py | lmonsalve22/Learning-to-Code | 2e32eba3fbd0bd63cc539e1e6d372ca346b765c9 | [
"MIT"
] | null | null | null | from bokeh.plotting import figure, output_file, show
if __name__ == '__main__':
output_file('graficado_simple.html')
fig = figure()
total_vals = int(input('Cuantos valores quieres graficar? '))
x_vals = list(range(total_vals))
y_vals = []
for x in x_vals:
val = int(input(f'Valor y para {x}'))
... | 22 | 63 | 0.674242 | from bokeh.plotting import figure, output_file, show
if __name__ == '__main__':
output_file('graficado_simple.html')
fig = figure()
total_vals = int(input('Cuantos valores quieres graficar? '))
x_vals = list(range(total_vals))
y_vals = []
for x in x_vals:
val = int(input(f'Valor y para {x}'))
... | true | true |
f74ab7f5b3a33b9a58b7e754ba039d38cbd5e017 | 27,325 | py | Python | reference_kernels/kernel.py | MarcusJones/kaggle_petfinder_adoption | 2d745b48405f4d4211b523eae272b9169fcf9fa2 | [
"MIT"
] | 1 | 2019-01-24T04:22:39.000Z | 2019-01-24T04:22:39.000Z | reference_kernels/kernel.py | MarcusJones/kaggle_petfinder_adoption | 2d745b48405f4d4211b523eae272b9169fcf9fa2 | [
"MIT"
] | null | null | null | reference_kernels/kernel.py | MarcusJones/kaggle_petfinder_adoption | 2d745b48405f4d4211b523eae272b9169fcf9fa2 | [
"MIT"
] | null | null | null | import gc
import glob
import json
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy as sp
import lightgbm as lgb
from collections import Counter
from functools import partial
from math import sqrt
from joblib import Parallel, delayed
from tqdm import tqdm
from PIL impo... | 40.967016 | 142 | 0.636377 | import gc
import glob
import json
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy as sp
import lightgbm as lgb
from collections import Counter
from functools import partial
from math import sqrt
from joblib import Parallel, delayed
from tqdm import tqdm
from PIL impo... | true | true |
f74ab8863787d9773d1e9c4bb00f7c0201a6bb22 | 2,769 | py | Python | src/metpy/plots/cartopy_utils.py | gerritholl/MetPy | 3f08b770485835982989f34aedb87791af250301 | [
"BSD-3-Clause"
] | 819 | 2016-10-31T17:11:49.000Z | 2022-03-30T05:17:59.000Z | src/metpy/plots/cartopy_utils.py | gerritholl/MetPy | 3f08b770485835982989f34aedb87791af250301 | [
"BSD-3-Clause"
] | 1,557 | 2016-10-31T19:35:26.000Z | 2022-03-31T16:35:22.000Z | src/metpy/plots/cartopy_utils.py | gerritholl/MetPy | 3f08b770485835982989f34aedb87791af250301 | [
"BSD-3-Clause"
] | 336 | 2016-11-04T15:05:08.000Z | 2022-03-31T10:28:50.000Z | # Copyright (c) 2018,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Cartopy specific mapping utilities."""
try:
from cartopy.feature import Feature, Scaler
from ..cbook import get_test_data
class MetPyMapFeature(Feature):
... | 33.768293 | 91 | 0.616829 |
try:
from cartopy.feature import Feature, Scaler
from ..cbook import get_test_data
class MetPyMapFeature(Feature):
def __init__(self, name, scale, **kwargs):
import cartopy.crs as ccrs
super().__init__(ccrs.PlateCarree(), **kwargs)
self.name = name
... | true | true |
f74ab951eaec669f6888682deebeba3d936e2daf | 1,111 | py | Python | cvxpy/cvxcore/tests/python/364A_scripts/act_management.py | bstellato/cvxpy | c954bcfd14f9b131bd55d5c1028e667297a53f76 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | cvxpy/cvxcore/tests/python/364A_scripts/act_management.py | bstellato/cvxpy | c954bcfd14f9b131bd55d5c1028e667297a53f76 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | cvxpy/cvxcore/tests/python/364A_scripts/act_management.py | bstellato/cvxpy | c954bcfd14f9b131bd55d5c1028e667297a53f76 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | from cvxpy import Maximize, Problem, Variable, hstack, vstack
import numpy as np
import time
# Create two scalar optimization variables.
ANSWERS = []
TIME = 0
A = np.array([ [1, 2, 0, 1], \
[0, 0, 3, 1], \
[0, 3, 1, 1], \
[2, 1, 2, 5], \
[1, 0, 3, 2] ])
A_star = hstack(A,A)
c_max = np.array([100] * 5)
p = np.arr... | 20.2 | 105 | 0.616562 | from cvxpy import Maximize, Problem, Variable, hstack, vstack
import numpy as np
import time
ANSWERS = []
TIME = 0
A = np.array([ [1, 2, 0, 1], \
[0, 0, 3, 1], \
[0, 3, 1, 1], \
[2, 1, 2, 5], \
[1, 0, 3, 2] ])
A_star = hstack(A,A)
c_max = np.array([100] * 5)
p = np.array([3, 2, 7, 6])
p_disc = np.array([2, 1, 4,... | true | true |
f74ab9f51fd980ae0e7f5111eb92b54d26839af9 | 3,339 | py | Python | SOACL_Web_Services/Flask_Web_Service/Flask_REST_server.py | SvenBaerten/soacl_project_musicplaylist_svenbaerten | d1892f1703eed82a997602d9dcf45bc59494fbe9 | [
"MIT"
] | null | null | null | SOACL_Web_Services/Flask_Web_Service/Flask_REST_server.py | SvenBaerten/soacl_project_musicplaylist_svenbaerten | d1892f1703eed82a997602d9dcf45bc59494fbe9 | [
"MIT"
] | null | null | null | SOACL_Web_Services/Flask_Web_Service/Flask_REST_server.py | SvenBaerten/soacl_project_musicplaylist_svenbaerten | d1892f1703eed82a997602d9dcf45bc59494fbe9 | [
"MIT"
] | null | null | null | # Reference to Flask: http://flask.pocoo.org/
from flask import Flask, current_app
from flask_restful import Api, Resource
import spotify.Spotify as Spotify
from flask_cors import CORS
# Reference to MySQL connector: https://dev.mysql.com/doc/connector-python/en/
import mysql.connector
from mysql.connector import erro... | 34.071429 | 208 | 0.619647 | from flask import Flask, current_app
from flask_restful import Api, Resource
import spotify.Spotify as Spotify
from flask_cors import CORS
import mysql.connector
from mysql.connector import errorcode
class Start(Resource):
def get(self):
print('/')
return current_app.send_static_file('index.html')... | true | true |
f74aba44c18293e49f85123b51bcb53fdb184d93 | 16,679 | py | Python | main.py | titania7777/3D-ResNets-PyTorch | 45921588bcf70f1b4ace424e754c48c0b5501ad6 | [
"MIT"
] | 3,481 | 2017-09-14T13:30:48.000Z | 2022-03-31T12:28:20.000Z | main.py | titania7777/3D-ResNets-PyTorch | 45921588bcf70f1b4ace424e754c48c0b5501ad6 | [
"MIT"
] | 253 | 2017-09-24T07:20:28.000Z | 2022-03-27T07:24:24.000Z | main.py | titania7777/3D-ResNets-PyTorch | 45921588bcf70f1b4ace424e754c48c0b5501ad6 | [
"MIT"
] | 969 | 2017-09-24T23:56:41.000Z | 2022-03-28T01:07:25.000Z | from pathlib import Path
import json
import random
import os
import numpy as np
import torch
from torch.nn import CrossEntropyLoss
from torch.optim import SGD, lr_scheduler
import torch.multiprocessing as mp
import torch.distributed as dist
from torch.backends import cudnn
import torchvision
from opts import parse_op... | 38.969626 | 86 | 0.623299 | from pathlib import Path
import json
import random
import os
import numpy as np
import torch
from torch.nn import CrossEntropyLoss
from torch.optim import SGD, lr_scheduler
import torch.multiprocessing as mp
import torch.distributed as dist
from torch.backends import cudnn
import torchvision
from opts import parse_op... | true | true |
f74aba467279013e2609f0ea936b92f3d79d1341 | 6,699 | py | Python | data/voc0712.py | IntoxicatedDING/stdn | 1bb9555114c762b09ad65eb16c59b134e1dccb56 | [
"MIT"
] | null | null | null | data/voc0712.py | IntoxicatedDING/stdn | 1bb9555114c762b09ad65eb16c59b134e1dccb56 | [
"MIT"
] | null | null | null | data/voc0712.py | IntoxicatedDING/stdn | 1bb9555114c762b09ad65eb16c59b134e1dccb56 | [
"MIT"
] | null | null | null | """VOC Dataset Classes
Original author: Francisco Massa
https://github.com/fmassa/vision/blob/voc_dataset/torchvision/datasets/voc.py
Updated by: Ellis Brown, Max deGroot
"""
'''
Adapted from https://github.com/amdegroot/ssd.pytorch
'''
from .config import HOME
import os.path as osp
import sys
import torch
import tor... | 35.444444 | 85 | 0.596805 | from .config import HOME
import os.path as osp
import sys
import torch
import torch.utils.data as data
import cv2
import numpy as np
if sys.version_info[0] == 2:
import xml.etree.cElementTree as ET
else:
import xml.etree.ElementTree as ET
VOC_CLASSES = ( 'aeroplane', 'bicycle', 'bird', 'boat',
'bottle... | true | true |
f74aba5b301d4b7f183b255e98f254ffb4a1a2c8 | 4,057 | py | Python | viref/model.py | hazananayurt/viref | f7b5a2278d9211104ea2293077e2b85d7466d63a | [
"CC-BY-4.0",
"MIT"
] | 9 | 2019-08-07T13:06:19.000Z | 2021-12-18T11:46:15.000Z | viref/model.py | hazananayurt/viref | f7b5a2278d9211104ea2293077e2b85d7466d63a | [
"CC-BY-4.0",
"MIT"
] | null | null | null | viref/model.py | hazananayurt/viref | f7b5a2278d9211104ea2293077e2b85d7466d63a | [
"CC-BY-4.0",
"MIT"
] | 2 | 2019-08-28T18:39:32.000Z | 2020-07-15T11:25:52.000Z | import torch
from torch import optim
from torch.nn import Parameter
import torch.nn.functional as F
class Encoder(torch.nn.Module):
def __init__(self, input_size, hidden_size, num_layers, dropout):
super(Encoder, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.num_layers =... | 31.207692 | 129 | 0.708898 | import torch
from torch import optim
from torch.nn import Parameter
import torch.nn.functional as F
class Encoder(torch.nn.Module):
def __init__(self, input_size, hidden_size, num_layers, dropout):
super(Encoder, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.num_layers =... | true | true |
f74abaa82e12ebac8832b5d10e5d0bd6949f10d5 | 1,531 | py | Python | waterflow/ml.py | ademilly/dataflow | 1cffbaf262a023c8db50966e5efae727d52f55d3 | [
"MIT"
] | 3 | 2016-09-06T23:53:56.000Z | 2016-09-11T22:03:15.000Z | waterflow/ml.py | ademilly/dataflow | 1cffbaf262a023c8db50966e5efae727d52f55d3 | [
"MIT"
] | 1 | 2016-09-06T15:06:44.000Z | 2016-09-06T15:06:44.000Z | waterflow/ml.py | ademilly/waterflow | 1cffbaf262a023c8db50966e5efae727d52f55d3 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
class ML(dict):
def __init__(self, classifier=None, name=''):
"""Init ML object
Keyword arguments:
classifier (object) -- sklearn-like classifier
"""
self.clf = classifier
self.meta = {
'name': name
}
def fit(self... | 23.19697 | 77 | 0.512737 |
class ML(dict):
def __init__(self, classifier=None, name=''):
self.clf = classifier
self.meta = {
'name': name
}
def fit(self, X, y):
self.clf.fit(X, y)
return self
def predict_proba(self, X):
self.meta['probabilities'] = self.clf.predict_p... | true | true |
f74abb25a810c9d08c01a520805141da477994a9 | 2,469 | py | Python | base/templatetags/custom_tags.py | amin-da71/Benbb96 | 0c9e37425d0665e403ba6fecf0c4b17669c29ada | [
"MIT"
] | null | null | null | base/templatetags/custom_tags.py | amin-da71/Benbb96 | 0c9e37425d0665e403ba6fecf0c4b17669c29ada | [
"MIT"
] | 13 | 2021-02-13T20:15:18.000Z | 2022-03-11T23:57:07.000Z | base/templatetags/custom_tags.py | amin-da71/Benbb96 | 0c9e37425d0665e403ba6fecf0c4b17669c29ada | [
"MIT"
] | null | null | null | from urllib.parse import quote_plus
from django import template
register = template.Library()
@register.filter
def multiply_10(value):
return int(float(value) * 10)
@register.filter
def color(value):
if value >= 8:
return 'success'
if value >= 6:
return 'info'
if value >= 4:
... | 26.836957 | 117 | 0.633455 | from urllib.parse import quote_plus
from django import template
register = template.Library()
@register.filter
def multiply_10(value):
return int(float(value) * 10)
@register.filter
def color(value):
if value >= 8:
return 'success'
if value >= 6:
return 'info'
if value >= 4:
... | true | true |
f74abb9689339b1e6b719f65908581352351a74d | 115 | py | Python | __init__.py | marat-/python-reporting-services | dd346fae578e97bf16ed66a14739edc17af56b1d | [
"Apache-2.0"
] | 2 | 2017-03-14T18:27:18.000Z | 2017-03-14T18:28:27.000Z | __init__.py | marat-/python-reporting-services | dd346fae578e97bf16ed66a14739edc17af56b1d | [
"Apache-2.0"
] | null | null | null | __init__.py | marat-/python-reporting-services | dd346fae578e97bf16ed66a14739edc17af56b1d | [
"Apache-2.0"
] | 3 | 2016-06-08T17:32:29.000Z | 2018-09-24T12:41:04.000Z | from pyssrs import SSRSReport
from parse_xlsx_xml import ParseXlsx
from xlsx_rc_convertor import convert_rc_formula | 38.333333 | 48 | 0.904348 | from pyssrs import SSRSReport
from parse_xlsx_xml import ParseXlsx
from xlsx_rc_convertor import convert_rc_formula | true | true |
f74abbba79eb52fecc6eafe2c0489bbb9206f98e | 263 | py | Python | testapp/config/desktop.py | emmuchira/kps | 4a81599a1ac17baea68e507794b246f45bf539b4 | [
"MIT"
] | null | null | null | testapp/config/desktop.py | emmuchira/kps | 4a81599a1ac17baea68e507794b246f45bf539b4 | [
"MIT"
] | null | null | null | testapp/config/desktop.py | emmuchira/kps | 4a81599a1ac17baea68e507794b246f45bf539b4 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"module_name": "Testapp",
"color": "grey",
"icon": "octicon octicon-file-directory",
"type": "module",
"label": _("Testapp")
}
]
| 17.533333 | 44 | 0.612167 | from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"module_name": "Testapp",
"color": "grey",
"icon": "octicon octicon-file-directory",
"type": "module",
"label": _("Testapp")
}
]
| true | true |
f74abbf2bea4cbd870bc08fd97a6072b7197bb1d | 784 | py | Python | PARTE_3/EX034/dado.py | 0Fernando0/CursoPython | 1dcfdb6556e41c6dedcba2857aa4382b2f81aa59 | [
"MIT"
] | null | null | null | PARTE_3/EX034/dado.py | 0Fernando0/CursoPython | 1dcfdb6556e41c6dedcba2857aa4382b2f81aa59 | [
"MIT"
] | null | null | null | PARTE_3/EX034/dado.py | 0Fernando0/CursoPython | 1dcfdb6556e41c6dedcba2857aa4382b2f81aa59 | [
"MIT"
] | null | null | null | def leia_int(n):
while True:
try:
nu = int(input(n))
except(ValueError, TypeError):
print('\033[31mERRO: por favor, digite um número inteiro válido.\033[m')
continue
else:
return nu
def leia_float(n):
while True:
try:
nu... | 28 | 84 | 0.524235 | def leia_int(n):
while True:
try:
nu = int(input(n))
except(ValueError, TypeError):
print('\033[31mERRO: por favor, digite um número inteiro válido.\033[m')
continue
else:
return nu
def leia_float(n):
while True:
try:
nu... | true | true |
f74abc94486ddddc08c1e28c21db35c8c45d8d63 | 2,450 | py | Python | QUANTAXIS/QAUtil/QALogs.py | KouLemon/QUANTAXIS_BET | 7b1d6c0c3bed03cfac7724807d70da0e38e43fee | [
"MIT"
] | 1 | 2021-05-20T12:33:46.000Z | 2021-05-20T12:33:46.000Z | QUANTAXIS/QAUtil/QALogs.py | KouLemon/QUANTAXIS_BET | 7b1d6c0c3bed03cfac7724807d70da0e38e43fee | [
"MIT"
] | 2 | 2017-12-27T02:34:32.000Z | 2018-04-18T02:50:13.000Z | QUANTAXIS/QAUtil/QALogs.py | KouLemon/QUANTAXIS_BET | 7b1d6c0c3bed03cfac7724807d70da0e38e43fee | [
"MIT"
] | 1 | 2021-04-01T08:59:46.000Z | 2021-04-01T08:59:46.000Z | # Coding:utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2018 yutiansut/QUANTAXIS
#
# 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 th... | 29.166667 | 80 | 0.7 |
import datetime
from zenlog import logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s QUANTAXIS>>> %(message)s',
datefmt='%H:%M:%S',
filename='quantaxis-' +
str(datetime.datetime.now().strftime(
... | true | true |
f74abd1d3836f5e16a7f319a6c37e75ad49795c1 | 1,950 | py | Python | download_manager.py | deapplegate/wtgpipeline | 9693e8562022cc97bf5a96427e22965e1a5e8497 | [
"MIT"
] | 1 | 2019-03-15T04:01:19.000Z | 2019-03-15T04:01:19.000Z | download_manager.py | deapplegate/wtgpipeline | 9693e8562022cc97bf5a96427e22965e1a5e8497 | [
"MIT"
] | 5 | 2017-12-11T00:11:39.000Z | 2021-07-09T17:05:16.000Z | download_manager.py | deapplegate/wtgpipeline | 9693e8562022cc97bf5a96427e22965e1a5e8497 | [
"MIT"
] | 2 | 2017-08-15T21:19:11.000Z | 2017-10-12T00:36:35.000Z | from ftplib import FTP
import popen2, time, sys
directory = sys.argv[1]
filename = sys.argv[2]
download_dir = sys.argv[3]
host = sys.argv[4]
size_ftp = sys.argv[5]
path_to_cvs = sys.argv[6]
'''this commands needs to be redirected to /dev/null or it won't work, also can't read out from this for debugging b/c process wi... | 32.5 | 139 | 0.585128 | from ftplib import FTP
import popen2, time, sys
directory = sys.argv[1]
filename = sys.argv[2]
download_dir = sys.argv[3]
host = sys.argv[4]
size_ftp = sys.argv[5]
path_to_cvs = sys.argv[6]
'''this commands needs to be redirected to /dev/null or it won't work, also can't read out from this for debugging b/c process wi... | false | true |
f74abddfe5c74cf5f0f98783b2cb3c79c9162c1e | 14,621 | py | Python | roles/validate-tempest/files/tempestmail/tempestmail.py | dp450/tripleo-quickstart-extras | c9151588399a8dd2ed10be301502cf05481d0ef5 | [
"Apache-2.0"
] | 3 | 2018-09-05T08:34:05.000Z | 2019-09-26T19:01:11.000Z | roles/validate-tempest/files/tempestmail/tempestmail.py | dp450/tripleo-quickstart-extras | c9151588399a8dd2ed10be301502cf05481d0ef5 | [
"Apache-2.0"
] | 15 | 2018-10-10T17:53:42.000Z | 2021-03-31T07:55:08.000Z | roles/validate-tempest/files/tempestmail/tempestmail.py | dp450/tripleo-quickstart-extras | c9151588399a8dd2ed10be301502cf05481d0ef5 | [
"Apache-2.0"
] | 4 | 2019-01-03T21:34:34.000Z | 2019-10-04T15:20:49.000Z | #! /usr/bin/env python
# Copyright Red Hat, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | 35.574209 | 79 | 0.54196 |
import argparse
import datetime
import logging
import os
import re
import requests
import smtplib
import sys
import yaml
from email.mime.text import MIMEText
from jinja2 import Environment
from jinja2 import FileSystemLoader
from six.moves.urllib.parse import urljoin
HREF = re.compile('href="([^"]+)"')
JOBRE = re.c... | true | true |
f74abe6b53ee378cbc4310b883c3044ae96c5640 | 5,797 | py | Python | tests/changes/api/test_build_flaky_tests.py | vault-the/changes | 37e23c3141b75e4785cf398d015e3dbca41bdd56 | [
"Apache-2.0"
] | 443 | 2015-01-03T16:28:39.000Z | 2021-04-26T16:39:46.000Z | tests/changes/api/test_build_flaky_tests.py | vault-the/changes | 37e23c3141b75e4785cf398d015e3dbca41bdd56 | [
"Apache-2.0"
] | 12 | 2015-07-30T19:07:16.000Z | 2016-11-07T23:11:21.000Z | tests/changes/api/test_build_flaky_tests.py | vault-the/changes | 37e23c3141b75e4785cf398d015e3dbca41bdd56 | [
"Apache-2.0"
] | 47 | 2015-01-09T10:04:00.000Z | 2020-11-18T17:58:19.000Z | from uuid import uuid4
from changes.constants import Result, Status
from changes.testutils import APITestCase, SAMPLE_DIFF
class BuildFlakyTests(APITestCase):
def setUp(self):
super(BuildFlakyTests, self).setUp()
self.project = self.create_project()
self.create_plan(self.project)
... | 34.505952 | 126 | 0.59203 | from uuid import uuid4
from changes.constants import Result, Status
from changes.testutils import APITestCase, SAMPLE_DIFF
class BuildFlakyTests(APITestCase):
def setUp(self):
super(BuildFlakyTests, self).setUp()
self.project = self.create_project()
self.create_plan(self.project)
... | true | true |
f74abea69e2afe7617605ec41c3b898e125a6889 | 3,250 | py | Python | dikedata_api/testsettings.py | ddsc/dikedata-api | 74776575a848863975793a9fde106161c655ee44 | [
"MIT"
] | null | null | null | dikedata_api/testsettings.py | ddsc/dikedata-api | 74776575a848863975793a9fde106161c655ee44 | [
"MIT"
] | null | null | null | dikedata_api/testsettings.py | ddsc/dikedata-api | 74776575a848863975793a9fde106161c655ee44 | [
"MIT"
] | null | null | null | import os
from lizard_ui.settingshelper import setup_logging
from lizard_ui.settingshelper import STATICFILES_FINDERS
DEBUG = True
TEMPLATE_DEBUG = True
# SETTINGS_DIR allows media paths and so to be relative to this settings file
# instead of hardcoded to c:\only\on\my\computer.
SETTINGS_DIR = os.path.dirname(os.pa... | 33.505155 | 79 | 0.704615 | import os
from lizard_ui.settingshelper import setup_logging
from lizard_ui.settingshelper import STATICFILES_FINDERS
DEBUG = True
TEMPLATE_DEBUG = True
SETTINGS_DIR = os.path.dirname(os.path.realpath(__file__))
BUILDOUT_DIR = os.path.abspath(os.path.join(SETTINGS_DIR, '..'))
LOGGING = setup_logging(BUILDOUT_DIR)
... | true | true |
f74abf403219def567ea69fc0e3534db02913fcf | 1,817 | py | Python | earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/postgres_manager_wrap.py | jsuberza/earthenterprise | e661a41f7cc218c60b269b0c9911df928cd9ce12 | [
"Apache-2.0"
] | 1 | 2020-06-17T12:20:52.000Z | 2020-06-17T12:20:52.000Z | earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/postgres_manager_wrap.py | jsuberza/earthenterprise | e661a41f7cc218c60b269b0c9911df928cd9ce12 | [
"Apache-2.0"
] | null | null | null | earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/postgres_manager_wrap.py | jsuberza/earthenterprise | e661a41f7cc218c60b269b0c9911df928cd9ce12 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
#
# Copyright 2017 Google Inc.
# Copyright 2018 Open GEE Contributors
#
# 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... | 29.306452 | 74 | 0.720969 |
import logging
import os
import sys
sys.path.insert(1, os.path.join(
os.path.dirname(os.path.realpath(__file__)), "../../wsgi-bin/common"))
import postgres_manager
import postgres_properties
class PostgresManagerWrap(object):
DB_PORT = postgres_properties.PostgresProperties().GetPortNumber()
DB_USER = "ge... | true | true |
f74ac0fe24ca0bcfe33198c3b87efbc52d66a3f0 | 2,682 | py | Python | molecule/verifier/ansible.py | westurner/molecule | 1babb77a8785192be38ab122e8206a0e53777b83 | [
"MIT"
] | null | null | null | molecule/verifier/ansible.py | westurner/molecule | 1babb77a8785192be38ab122e8206a0e53777b83 | [
"MIT"
] | null | null | null | molecule/verifier/ansible.py | westurner/molecule | 1babb77a8785192be38ab122e8206a0e53777b83 | [
"MIT"
] | null | null | null | # Copyright (c) 2019 Red Hat, 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, modify, merge, publish, ... | 27.9375 | 79 | 0.650261 |
import os
from molecule import logger
from molecule import util
from molecule.api import Verifier
log = logger.get_logger(__name__)
class Ansible(Verifier):
@property
def name(self):
return 'ansible'
@property
def default_options(self):
return {}
@property
def default_en... | true | true |
f74ac1c1ddc30adef91577c5d4b73557f21736f3 | 605 | py | Python | schreib_project/posts/serializers.py | krishishah/Schreib | 345754c63de17f4d7d06bd339f6def3e52fe71fe | [
"MIT"
] | null | null | null | schreib_project/posts/serializers.py | krishishah/Schreib | 345754c63de17f4d7d06bd339f6def3e52fe71fe | [
"MIT"
] | null | null | null | schreib_project/posts/serializers.py | krishishah/Schreib | 345754c63de17f4d7d06bd339f6def3e52fe71fe | [
"MIT"
] | null | null | null | from rest_framework import serializers
from authentication.serializers import AccountSerializer
from posts.models import Post
class PostSerializer(serializers.ModelSerializer):
author = AccountSerializer(read_only=True, required=False)
class Meta:
model = Post
fields = ('id', 'author', 'con... | 30.25 | 90 | 0.715702 | from rest_framework import serializers
from authentication.serializers import AccountSerializer
from posts.models import Post
class PostSerializer(serializers.ModelSerializer):
author = AccountSerializer(read_only=True, required=False)
class Meta:
model = Post
fields = ('id', 'author', 'con... | true | true |
f74ac1f1008b652c862cdde63299fa0dfc8d87ae | 4,872 | py | Python | tests/test_wlans.py | JohnLahr/aiounifi | e9313a72e7db2f486f6c12634c77fcc2e3ebc138 | [
"MIT"
] | null | null | null | tests/test_wlans.py | JohnLahr/aiounifi | e9313a72e7db2f486f6c12634c77fcc2e3ebc138 | [
"MIT"
] | null | null | null | tests/test_wlans.py | JohnLahr/aiounifi | e9313a72e7db2f486f6c12634c77fcc2e3ebc138 | [
"MIT"
] | null | null | null | """Test wlan configuration API.
pytest --cov-report term-missing --cov=aiounifi.wlan tests/test_wlans.py
"""
from asynctest import Mock
from aiounifi.wlan import Wlans
def test_ports():
"""Test that different types of ports work."""
wlans = Wlans(fixture_wlans, Mock())
assert len(wlans.values()) == 2
... | 34.8 | 72 | 0.649425 |
from asynctest import Mock
from aiounifi.wlan import Wlans
def test_ports():
wlans = Wlans(fixture_wlans, Mock())
assert len(wlans.values()) == 2
key = "SSID 1"
assert wlans[key].id == "012345678910111213141516"
assert wlans[key].bc_filter_enabled == False
assert wlans[key].bc_filter_list ... | true | true |
f74ac326535efc9aeac20c0df42a1b4963432229 | 7,456 | py | Python | test_gilded_rose.py | nathfroech/gilded_rose_refactoring_kata | 305d02ddc87bef172f7c7058f9c0a7b8812f2f50 | [
"MIT"
] | null | null | null | test_gilded_rose.py | nathfroech/gilded_rose_refactoring_kata | 305d02ddc87bef172f7c7058f9c0a7b8812f2f50 | [
"MIT"
] | null | null | null | test_gilded_rose.py | nathfroech/gilded_rose_refactoring_kata | 305d02ddc87bef172f7c7058f9c0a7b8812f2f50 | [
"MIT"
] | null | null | null | import pytest
from hamcrest import assert_that, contains_exactly, equal_to, has_properties, is_ # type: ignore
import gilded_rose
class TestGildedRose:
def test_combined_case(self):
items = [
gilded_rose.Item(name='+5 Dexterity Vest', sell_in=10, quality=20),
gilded_rose.Item(nam... | 48.732026 | 115 | 0.698095 | import pytest
from hamcrest import assert_that, contains_exactly, equal_to, has_properties, is_
import gilded_rose
class TestGildedRose:
def test_combined_case(self):
items = [
gilded_rose.Item(name='+5 Dexterity Vest', sell_in=10, quality=20),
gilded_rose.Item(name=gilded_rose.A... | true | true |
f74ac3c2e3d9d2e9c146f725db8f41c033811ee2 | 1,495 | py | Python | yasir/rt.py | overminder/YASIR | 106140329fd415cab591eb642827021759abd426 | [
"MIT"
] | 1 | 2019-11-21T17:07:49.000Z | 2019-11-21T17:07:49.000Z | yasir/rt.py | overminder/YASIR | 106140329fd415cab591eb642827021759abd426 | [
"MIT"
] | null | null | null | yasir/rt.py | overminder/YASIR | 106140329fd415cab591eb642827021759abd426 | [
"MIT"
] | null | null | null | from rpython.rlib import jit
from . import pretty
class ImmutableEnv(object):
_immutable_fields_ = ['_w_slots[*]', '_prev']
def __init__(self, w_values, prev):
self._w_slots = w_values
self._prev = prev
@jit.unroll_safe
def at_depth(self, depth):
#depth = jit.promote(depth)
... | 22.313433 | 61 | 0.602676 | from rpython.rlib import jit
from . import pretty
class ImmutableEnv(object):
_immutable_fields_ = ['_w_slots[*]', '_prev']
def __init__(self, w_values, prev):
self._w_slots = w_values
self._prev = prev
@jit.unroll_safe
def at_depth(self, depth):
i = depth
it ... | true | true |
f74ac46cd630eedc9d320781bf48a98f1f947bf6 | 37,179 | py | Python | network/model_zoo.py | XiaoJake/DS-Net | 8400da1bd7c7b1ccf4d5c6782b86372957e79a6b | [
"MIT"
] | null | null | null | network/model_zoo.py | XiaoJake/DS-Net | 8400da1bd7c7b1ccf4d5c6782b86372957e79a6b | [
"MIT"
] | null | null | null | network/model_zoo.py | XiaoJake/DS-Net | 8400da1bd7c7b1ccf4d5c6782b86372957e79a6b | [
"MIT"
] | null | null | null | # -*- coding:utf-8 -*-
# author: Hong Fangzhou
# @file: model_zoo.py
# @time: 2020/09/26 17:05
from .modules import BEV_Unet
from .modules import PointNet
from .modules import spconv_unet
from .modules import pytorch_meanshift
from .loss import instance_losses
from .loss import lovasz_losses
from utils.evaluate_panopt... | 47.849421 | 174 | 0.640873 |
from .modules import BEV_Unet
from .modules import PointNet
from .modules import spconv_unet
from .modules import pytorch_meanshift
from .loss import instance_losses
from .loss import lovasz_losses
from utils.evaluate_panoptic import init_eval, eval_one_scan_w_fname, eval_one_scan_vps
from utils.evaluate_panoptic impo... | true | true |
f74ac4894b4e0db9dfa781d12182a6fb0d073eb5 | 1,687 | py | Python | snooper.py | Dregu/gst-dante-flow | 5903af0b8564c61e3dbdb395bf52d49544475e8e | [
"MIT"
] | 17 | 2018-11-17T21:48:19.000Z | 2022-01-04T07:03:28.000Z | snooper.py | Dregu/gst-dante-flow | 5903af0b8564c61e3dbdb395bf52d49544475e8e | [
"MIT"
] | null | null | null | snooper.py | Dregu/gst-dante-flow | 5903af0b8564c61e3dbdb395bf52d49544475e8e | [
"MIT"
] | 2 | 2020-03-16T07:51:35.000Z | 2020-11-16T04:13:36.000Z | #!/usr/bin/env python2
"""
Logging part of a multicast group scanner.
Needs to be run with capabilities allowing it to read
raw data from the network interface. (usually root)
Author: Lasse Karstensen <lasse.karstensen@gmail.com>, April 2013.
"""
import sys
import socket
import pcapy
import impacket
import datetime
f... | 21.0875 | 68 | 0.628334 | """
Logging part of a multicast group scanner.
Needs to be run with capabilities allowing it to read
raw data from the network interface. (usually root)
Author: Lasse Karstensen <lasse.karstensen@gmail.com>, April 2013.
"""
import sys
import socket
import pcapy
import impacket
import datetime
from impacket.ImpactDeco... | false | true |
f74ac5366b7c17a8874cdd778651bc792348ae83 | 226,611 | py | Python | core/domain/exp_services_test.py | soham4abc/oppia | 3b9a71c2142dc0f818fcab00afc749fa0695ad82 | [
"Apache-2.0"
] | null | null | null | core/domain/exp_services_test.py | soham4abc/oppia | 3b9a71c2142dc0f818fcab00afc749fa0695ad82 | [
"Apache-2.0"
] | null | null | null | core/domain/exp_services_test.py | soham4abc/oppia | 3b9a71c2142dc0f818fcab00afc749fa0695ad82 | [
"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... | 40.889751 | 137 | 0.611687 |
from __future__ import absolute_import from __future__ import unicode_literals
import datetime
import logging
import os
import re
import zipfile
from core.domain import classifier_services
from core.domain import draft_upgrade_services
from core.domain import exp_domain
from core.domain import exp_fetchers
from c... | true | true |
f74ac6fcc9b5678b5a9fa4e58ff6c0ec323ee1a3 | 861 | py | Python | email01.py | sgriffith3/2021_05_10_pyna | d732e1dd0fa03f1cef8f72fc9dcc09ec947f31a5 | [
"MIT"
] | null | null | null | email01.py | sgriffith3/2021_05_10_pyna | d732e1dd0fa03f1cef8f72fc9dcc09ec947f31a5 | [
"MIT"
] | null | null | null | email01.py | sgriffith3/2021_05_10_pyna | d732e1dd0fa03f1cef8f72fc9dcc09ec947f31a5 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import smtplib # make the smtplib module avail
import getpass # secret acceptance of password
def send_my_message(subj, txt):
mypass = getpass.getpass("Enter your Password:")
myaddress = input("Enter your mail.com address (ex. pythonstudent01@mail.com):")
content = f"""From:{myaddre... | 35.875 | 84 | 0.702671 | import smtplib import getpass
def send_my_message(subj, txt):
mypass = getpass.getpass("Enter your Password:")
myaddress = input("Enter your mail.com address (ex. pythonstudent01@mail.com):")
content = f"""From:{myaddress}\n
Subject: {subj}\n\n{txt}"""
mail = smtplib.SMTP('smtp.mail.com',587) ... | true | true |
f74ac76b9746d67f335eb56389b3c1acb78b8edf | 13,246 | py | Python | CoreFiles/CaseBuilder_OAT.py | KTH-UrbanT/MUBES_UBEM | 04fee34097a8b8724fac2f5d0d3495230b6af0c1 | [
"MIT"
] | 8 | 2021-09-20T16:14:53.000Z | 2022-01-13T13:36:50.000Z | CoreFiles/CaseBuilder_OAT.py | KTH-UrbanT/MUBES_UBEM | 04fee34097a8b8724fac2f5d0d3495230b6af0c1 | [
"MIT"
] | null | null | null | CoreFiles/CaseBuilder_OAT.py | KTH-UrbanT/MUBES_UBEM | 04fee34097a8b8724fac2f5d0d3495230b6af0c1 | [
"MIT"
] | 1 | 2021-09-20T16:14:56.000Z | 2021-09-20T16:14:56.000Z | # @Author : Xavier Faure
# @Email : xavierf@kth.se
import os
import sys
#add the required path
path2addgeom = os.path.join(os.path.dirname(os.path.dirname(os.getcwd())),'geomeppy')
sys.path.append(path2addgeom)
#add scripts from the project as well
sys.path.append("..")
from subprocess import check_call
from geomep... | 45.993056 | 141 | 0.614903 |
import os
import sys
path2addgeom = os.path.join(os.path.dirname(os.path.dirname(os.getcwd())),'geomeppy')
sys.path.append(path2addgeom)
sys.path.append("..")
from subprocess import check_call
from geomeppy import IDF
import pickleimport pickle5
import CoreFiles.GeneralFunctions as GrlFct
from BuildObject.DB_Building ... | true | true |
f74ac795ee280f0f8bd4711730e8966de9b33f62 | 1,840 | py | Python | main/api/v1/repo.py | AlexRogalskiy/github-stats | 49dbf8841e71a532e504865d5c1226ab158e7f8c | [
"MIT"
] | 99 | 2015-12-21T17:14:44.000Z | 2022-03-18T23:20:45.000Z | main/api/v1/repo.py | lipis/github-graph | 49dbf8841e71a532e504865d5c1226ab158e7f8c | [
"MIT"
] | 7 | 2015-12-26T18:52:16.000Z | 2019-03-13T11:01:32.000Z | main/api/v1/repo.py | AlexRogalskiy/github-stats | 49dbf8841e71a532e504865d5c1226ab158e7f8c | [
"MIT"
] | 16 | 2016-03-12T09:50:55.000Z | 2022-03-18T23:20:45.000Z | # coding: utf-8
from __future__ import absolute_import
from google.appengine.ext import ndb
import flask_restful
import flask
from api import helpers
import auth
import model
import util
from main import api_v1
@api_v1.resource('/repo/', endpoint='api.repo.list')
class RepoListAPI(flask_restful.Resource):
def g... | 31.724138 | 79 | 0.680435 |
from __future__ import absolute_import
from google.appengine.ext import ndb
import flask_restful
import flask
from api import helpers
import auth
import model
import util
from main import api_v1
@api_v1.resource('/repo/', endpoint='api.repo.list')
class RepoListAPI(flask_restful.Resource):
def get(self):
re... | true | true |
f74ac7e5c277f81d44f41463e67899ec318ab72d | 7,128 | py | Python | applications/nightly_build/test_deep_speech.py | vinitra/keras-onnx | 17d86705f566bee56307abd13a60b79776a58c0e | [
"MIT"
] | 1 | 2020-10-26T03:03:02.000Z | 2020-10-26T03:03:02.000Z | applications/nightly_build/test_deep_speech.py | vinitra/keras-onnx | 17d86705f566bee56307abd13a60b79776a58c0e | [
"MIT"
] | null | null | null | applications/nightly_build/test_deep_speech.py | vinitra/keras-onnx | 17d86705f566bee56307abd13a60b79776a58c0e | [
"MIT"
] | null | null | null | ###############################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
###############################################################################
imp... | 41.684211 | 106 | 0.602413 | import os
import sys
import unittest
import keras2onnx
import numpy as np
from keras2onnx.proto import keras
from onnxconverter_common.onnx_ex import get_maximum_opset_supported
from os.path import dirname, abspath
sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../tests/'))
from test_utils import run_k... | true | true |
f74ac855293d6aaa581aed3ef3cd6aabd694a380 | 1,517 | py | Python | floodsystem/flood.py | HSCam/Flood-Warning-Sytem | 1f88dcee38854b327db417835190e55b39de6eb6 | [
"MIT"
] | null | null | null | floodsystem/flood.py | HSCam/Flood-Warning-Sytem | 1f88dcee38854b327db417835190e55b39de6eb6 | [
"MIT"
] | null | null | null | floodsystem/flood.py | HSCam/Flood-Warning-Sytem | 1f88dcee38854b327db417835190e55b39de6eb6 | [
"MIT"
] | 1 | 2022-02-08T13:39:54.000Z | 2022-02-08T13:39:54.000Z | #Contains all the functions required for assessing flood risk
#Exercise 2B - assessing flood risk by level:
def stations_level_over_threshold(stations, tol):
"""returns a list of tuples of stations with relative water level over tol."""
stations_over_threshold = []
for station in stations:
try: ... | 43.342857 | 184 | 0.695452 |
def stations_level_over_threshold(stations, tol):
stations_over_threshold = []
for station in stations:
try: if station.relative_water_level()>tol:
stations_over_threshold.append((station.name, station.relative_water_level()))
if type(station.relative_wat... | true | true |
f74ac8aba771b55c79e3f508c23484786eea91c3 | 1,471 | py | Python | src/niweb/apps/noclook/management/commands/import_service_types.py | SUNET/ni | f652e230524346bf0801cdf8bbb6ee63f4985cc2 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | src/niweb/apps/noclook/management/commands/import_service_types.py | SUNET/ni | f652e230524346bf0801cdf8bbb6ee63f4985cc2 | [
"BSD-2-Clause-FreeBSD"
] | 2 | 2019-07-24T12:41:11.000Z | 2020-03-31T10:10:04.000Z | src/niweb/apps/noclook/management/commands/import_service_types.py | SUNET/ni | f652e230524346bf0801cdf8bbb6ee63f4985cc2 | [
"BSD-2-Clause-FreeBSD"
] | 1 | 2019-02-25T14:58:20.000Z | 2019-02-25T14:58:20.000Z | # -*- coding: utf-8 -*-
__author__ = 'ffuentes'
import argparse
import os
import sys
import csv
import logging
from apps.noclook.models import ServiceType, ServiceClass
from django.core.management.base import BaseCommand, CommandError
logger = logging.getLogger('noclook_service_types_import')
def insert_service_ty... | 30.645833 | 72 | 0.611149 | __author__ = 'ffuentes'
import argparse
import os
import sys
import csv
import logging
from apps.noclook.models import ServiceType, ServiceClass
from django.core.management.base import BaseCommand, CommandError
logger = logging.getLogger('noclook_service_types_import')
def insert_service_type(name, service_class):... | true | true |
f74ac99c2015a184ef1abd6be3207fce3e7eedae | 5,636 | py | Python | main/maintenance/borrower/routes.py | python-02/flask-spa-CoopApp | 8ecd9e22847401c6ee18b76a80c68c8ba5d77401 | [
"MIT"
] | 6 | 2021-04-16T06:37:04.000Z | 2021-11-11T23:37:04.000Z | main/maintenance/borrower/routes.py | python-02/flask-spa-CoopApp | 8ecd9e22847401c6ee18b76a80c68c8ba5d77401 | [
"MIT"
] | null | null | null | main/maintenance/borrower/routes.py | python-02/flask-spa-CoopApp | 8ecd9e22847401c6ee18b76a80c68c8ba5d77401 | [
"MIT"
] | 2 | 2021-06-01T15:35:17.000Z | 2022-03-05T03:50:57.000Z | from flask import Blueprint, render_template, g, request, flash
import flask_sijax
from main.models.borrower import Borrower
from flask_login import LoginManager, login_user, login_required, logout_user, current_user
from main.maintenance.borrower.forms import BorrowerMaintenanceForm
from main.spa_handler.sijax_handler... | 43.689922 | 224 | 0.680625 | from flask import Blueprint, render_template, g, request, flash
import flask_sijax
from main.models.borrower import Borrower
from flask_login import LoginManager, login_user, login_required, logout_user, current_user
from main.maintenance.borrower.forms import BorrowerMaintenanceForm
from main.spa_handler.sijax_handler... | true | true |
f74acacfa5e533c8acbbdc04b222621f1561db4a | 2,748 | py | Python | raspberry_pi/car_control_2/src/encoders/vel_publisher.py | guru-narayana/autonomous-car-SLAM-and-ROS-Navigation- | 6840c9d376d8ebc9504379d3a5244a6bdb203eee | [
"MIT"
] | null | null | null | raspberry_pi/car_control_2/src/encoders/vel_publisher.py | guru-narayana/autonomous-car-SLAM-and-ROS-Navigation- | 6840c9d376d8ebc9504379d3a5244a6bdb203eee | [
"MIT"
] | null | null | null | raspberry_pi/car_control_2/src/encoders/vel_publisher.py | guru-narayana/autonomous-car-SLAM-and-ROS-Navigation- | 6840c9d376d8ebc9504379d3a5244a6bdb203eee | [
"MIT"
] | null | null | null | #! /usr/bin/python
from RPi import GPIO
import signal
import rospy
from geometry_msgs.msg import Twist
clk1 = 13 #left wheel
dt1 = 6
clk2 = 19 #right Wheel
dt2 = 26
def keyboardInterruptHandler(signal, frame):
print("this is velocity publisher signing off ...")
exit(0)
GPIO.setmode(GPIO.BCM)
GPIO.setup(clk1... | 30.876404 | 70 | 0.565866 |
from RPi import GPIO
import signal
import rospy
from geometry_msgs.msg import Twist
clk1 = 13 dt1 = 6
clk2 = 19 dt2 = 26
def keyboardInterruptHandler(signal, frame):
print("this is velocity publisher signing off ...")
exit(0)
GPIO.setmode(GPIO.BCM)
GPIO.setup(clk1, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.... | false | true |
f74acc1e92d1acefc7477fb9eac4f86b79b58d02 | 61,600 | py | Python | Boilermake2018/Lib/site-packages/nltk/parse/chart.py | TejPatel98/voice_your_professional_email | 9cc48f7bcd6576a6962711755e5d5d485832128c | [
"CC0-1.0"
] | 69 | 2020-03-31T06:40:17.000Z | 2022-02-25T11:48:18.000Z | Boilermake2018/Lib/site-packages/nltk/parse/chart.py | TejPatel98/voice_your_professional_email | 9cc48f7bcd6576a6962711755e5d5d485832128c | [
"CC0-1.0"
] | 11 | 2019-12-26T17:21:03.000Z | 2022-03-21T22:17:07.000Z | Boilermake2018/Lib/site-packages/nltk/parse/chart.py | TejPatel98/voice_your_professional_email | 9cc48f7bcd6576a6962711755e5d5d485832128c | [
"CC0-1.0"
] | 28 | 2020-04-15T15:24:17.000Z | 2021-12-26T04:05:02.000Z | # -*- coding: utf-8 -*-
# Natural Language Toolkit: A Chart Parser
#
# Copyright (C) 2001-2018 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# Jean Mark Gawron <gawron@mail.sdsu.edu>
# Peter Ljunglöf <peter.ljunglof@heatherleaf.se>
# URL: <http://n... | 36.601307 | 90 | 0.568149 |
from __future__ import print_function, division, unicode_literals
import itertools
import re
import warnings
from functools import total_ordering
from six.moves import range
from nltk.tree import Tree
from nltk.grammar import PCFG, is_nonterminal, is_terminal
from nltk.util import OrderedDict
from nltk.internals im... | true | true |
f74acd8aa192c83afc388b2a920ee86cdf5f5300 | 2,904 | py | Python | impacket/examples/ntlmrelayx/utils/enum.py | fox-it/impacket | 0b6e23f5edf18d89e513287790f602e356d92235 | [
"Apache-1.1"
] | 10 | 2017-12-11T01:50:59.000Z | 2021-12-30T13:44:37.000Z | impacket/examples/ntlmrelayx/utils/enum.py | fox-it/impacket | 0b6e23f5edf18d89e513287790f602e356d92235 | [
"Apache-1.1"
] | null | null | null | impacket/examples/ntlmrelayx/utils/enum.py | fox-it/impacket | 0b6e23f5edf18d89e513287790f602e356d92235 | [
"Apache-1.1"
] | 2 | 2018-02-27T08:46:19.000Z | 2020-04-14T19:31:27.000Z | # Copyright (c) 2013-2016 CORE Security Technologies
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Config utilities
#
# Author:
# Ronnie Flathers / @ropnop
#
# Description:
# Helpful ... | 40.901408 | 123 | 0.675275 |
from impacket.dcerpc.v5 import transport, lsat, lsad, samr
from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED
from impacket.dcerpc.v5.rpcrt import DCERPCException
from impacket.dcerpc.v5.samr import SID_NAME_USE
class EnumLocalAdmins:
def __init__(self, smbConnection):
self.__smbConnection = ... | true | true |
f74acdbb4597d166304e1d190cd6c005427346ce | 439 | py | Python | spyplugins/ui/__init__.py | SylvainCorlay/spyder | b87bfa08abd53e1c97b59feeb51f665f6a632415 | [
"MIT"
] | 2 | 2016-01-23T11:52:24.000Z | 2021-04-27T03:52:25.000Z | spyplugins/ui/__init__.py | SylvainCorlay/spyder | b87bfa08abd53e1c97b59feeb51f665f6a632415 | [
"MIT"
] | null | null | null | spyplugins/ui/__init__.py | SylvainCorlay/spyder | b87bfa08abd53e1c97b59feeb51f665f6a632415 | [
"MIT"
] | null | null | null | """
'spyplugins' makes uses of namespace packages to keep different plugins
organized in the sitepackages directory and in the user directory.
Spyder plugins can be of 'io' type or 'ui' type. Each type also makes use
of namespace packages.
For more information on namespace packages visit:
- https://www.python.org/dev... | 36.583333 | 73 | 0.776765 | __import__('pkg_resources').declare_namespace(__name__) | true | true |
f74ace4d8c52f5f7c999fa7ea6ee0cc95c2f1689 | 1,010 | py | Python | userbot/plugins/alive.py | SPIDERBHAI/HunterGang | 6c71a7aee52b01fb2b03c3a9af0b0faa40a08cfe | [
"MIT"
] | null | null | null | userbot/plugins/alive.py | SPIDERBHAI/HunterGang | 6c71a7aee52b01fb2b03c3a9af0b0faa40a08cfe | [
"MIT"
] | null | null | null | userbot/plugins/alive.py | SPIDERBHAI/HunterGang | 6c71a7aee52b01fb2b03c3a9af0b0faa40a08cfe | [
"MIT"
] | 1 | 2020-08-05T16:59:42.000Z | 2020-08-05T16:59:42.000Z | """Check if userbot alive. If you change these, you become the gayest gay such that even the gay world will disown you."""
import asyncio
from telethon import events
from telethon.tl.types import ChannelParticipantsAdmins
from platform import uname
from userbot import ALIVE_NAME
from userbot.utils import admin_cmd
ALI... | 50.5 | 122 | 0.639604 | import asyncio
from telethon import events
from telethon.tl.types import ChannelParticipantsAdmins
from platform import uname
from userbot import ALIVE_NAME
from userbot.utils import admin_cmd
ALIVE_NAME = str(ALIVE_NAME) if ALIVE_NAME else "**No Name set yet.**"
@command(outgoing=True, pattern="^.alive$")
async def ... | true | true |
f74ace61335909d5599194850ddd17617a19dcfb | 1,432 | py | Python | exe094.py | libaniaraujo/Python-Curso-em-Video | 593ddbbbdf1e83101f535228fa05351f35b8817f | [
"MIT"
] | null | null | null | exe094.py | libaniaraujo/Python-Curso-em-Video | 593ddbbbdf1e83101f535228fa05351f35b8817f | [
"MIT"
] | null | null | null | exe094.py | libaniaraujo/Python-Curso-em-Video | 593ddbbbdf1e83101f535228fa05351f35b8817f | [
"MIT"
] | null | null | null | # Unindo dicionários e listas
# Crie um programa que leia nome, sexo e idade de várias pessoas, guardando os dados de cada pessoa em um dicionário
# e todos os dicionários em uma lista. No final, mostre:
# A) Quantas pessoas foram cadastradas
# B) A média de idade
# C) Uma lista com as mulheres
# D) Uma lista de pesso... | 31.822222 | 116 | 0.592179 |
galera = list()
pessoa = dict()
soma = média = 0
while True:
pessoa.clear()
pessoa['nome'] = str(input('Nome: '))
while True:
pessoa['sexo'] = str(input('Sexo: [M/F] ')).upper()[0]
if pessoa['sexo'] in 'MF':
break
print('Erro! Por favor, digite apenas M ou F.')
pess... | true | true |
f74acede50729fe4f3f4926ff1465106a3c15b27 | 45,000 | py | Python | homeassistant/config_entries.py | szimszon/core | 1600207f5cd73ecd70bf965f1787a7f5aae6b81d | [
"Apache-2.0"
] | 1 | 2017-05-30T22:21:05.000Z | 2017-05-30T22:21:05.000Z | homeassistant/config_entries.py | szimszon/core | 1600207f5cd73ecd70bf965f1787a7f5aae6b81d | [
"Apache-2.0"
] | 51 | 2020-10-14T01:19:07.000Z | 2022-03-31T06:02:48.000Z | homeassistant/config_entries.py | foxy82/home-assistant | 79ebe930e31a91967928a5642c98e58b522109b0 | [
"Apache-2.0"
] | 1 | 2021-08-16T02:53:15.000Z | 2021-08-16T02:53:15.000Z | """Manage config entries in Home Assistant."""
from __future__ import annotations
import asyncio
import functools
import logging
from types import MappingProxyType, MethodType
from typing import Any, Callable, Dict, List, Optional, Set, Union, cast
import weakref
import attr
from homeassistant import data_entry_flow... | 35.15625 | 125 | 0.623267 | from __future__ import annotations
import asyncio
import functools
import logging
from types import MappingProxyType, MethodType
from typing import Any, Callable, Dict, List, Optional, Set, Union, cast
import weakref
import attr
from homeassistant import data_entry_flow, loader
from homeassistant.core import CALLBAC... | true | true |
f74acf46021754d988a452acdcc5f8e0908e656d | 663 | py | Python | py/t4/demo2.py | firekyrin/train-demo | a949a461bb9324fc2732cdf80c42c26379442c96 | [
"MIT"
] | null | null | null | py/t4/demo2.py | firekyrin/train-demo | a949a461bb9324fc2732cdf80c42c26379442c96 | [
"MIT"
] | null | null | null | py/t4/demo2.py | firekyrin/train-demo | a949a461bb9324fc2732cdf80c42c26379442c96 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import threading
mylock = threading.RLock()
num = 0
class WorkThread(threading.Thread):
def __init__(self, name):
threading.Thread.__init__(self)
self.t_name = name
def run(self):
global num
while True:
mylock.acquire()
print('\n%s locked, number: %d' %(self.t_name, num))
if... | 18.942857 | 58 | 0.648567 |
import threading
mylock = threading.RLock()
num = 0
class WorkThread(threading.Thread):
def __init__(self, name):
threading.Thread.__init__(self)
self.t_name = name
def run(self):
global num
while True:
mylock.acquire()
print('\n%s locked, number: %d' %(self.t_name, num))
if num >= 4:
mylock.... | true | true |
f74ad232ec7a8e2fa67c04b6ea76c4ec10489f84 | 3,734 | py | Python | pycondor/tests/test_utils.py | GregoryAshton/pycondor | 72423eac508c6d5ec79f8f3de71011ba61a38537 | [
"MIT"
] | 23 | 2017-05-16T21:37:07.000Z | 2021-11-15T13:46:03.000Z | pycondor/tests/test_utils.py | GregoryAshton/pycondor | 72423eac508c6d5ec79f8f3de71011ba61a38537 | [
"MIT"
] | 83 | 2017-01-27T21:00:38.000Z | 2022-02-10T16:27:54.000Z | pycondor/tests/test_utils.py | GregoryAshton/pycondor | 72423eac508c6d5ec79f8f3de71011ba61a38537 | [
"MIT"
] | 14 | 2017-04-05T15:40:37.000Z | 2021-11-15T13:38:09.000Z |
import os
import pytest
import pycondor
from pycondor.utils import (clear_pycondor_environment_variables, checkdir,
assert_command_exists, get_condor_version,
parse_condor_version, split_command_string,
decode_string)
from pycondor.com... | 31.378151 | 83 | 0.670059 |
import os
import pytest
import pycondor
from pycondor.utils import (clear_pycondor_environment_variables, checkdir,
assert_command_exists, get_condor_version,
parse_condor_version, split_command_string,
decode_string)
from pycondor.com... | true | true |
f74ad23c4e370ad016ec7755ea76ab3fd4cfe2ce | 1,845 | py | Python | tools/harness-automation/cases/router_5_6_3.py | amccool/openthread | 1e9d3c1dbfd66aa48c4cbb1dda0b41c9f05fefc7 | [
"BSD-3-Clause"
] | null | null | null | tools/harness-automation/cases/router_5_6_3.py | amccool/openthread | 1e9d3c1dbfd66aa48c4cbb1dda0b41c9f05fefc7 | [
"BSD-3-Clause"
] | null | null | null | tools/harness-automation/cases/router_5_6_3.py | amccool/openthread | 1e9d3c1dbfd66aa48c4cbb1dda0b41c9f05fefc7 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
#
# Copyright (c) 2016, Nest Labs, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this ... | 42.906977 | 77 | 0.768022 |
from autothreadharness.harness_case import HarnessCase
import unittest
class Router_5_6_3(HarnessCase):
suite = 2
case = '5 6 3'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
| true | true |
f74ad274cac4a548434406023cafa435a314ba28 | 996 | py | Python | arjuna-samples/arjex/test/pkg/rules/helpers.py | StefanIGit/arjuna | 6c7d9099e0d766e7b30936ef25d32c1414133b96 | [
"Apache-2.0"
] | 13 | 2020-05-12T06:32:51.000Z | 2022-01-24T18:21:19.000Z | arjuna-samples/arjex/test/pkg/rules/helpers.py | StefanIGit/arjuna | 6c7d9099e0d766e7b30936ef25d32c1414133b96 | [
"Apache-2.0"
] | 5 | 2020-02-14T12:51:07.000Z | 2021-12-01T10:39:51.000Z | arjuna-samples/arjex/test/pkg/rules/helpers.py | StefanIGit/arjuna | 6c7d9099e0d766e7b30936ef25d32c1414133b96 | [
"Apache-2.0"
] | 25 | 2020-01-16T10:44:25.000Z | 2022-02-24T13:22:22.000Z | # This file is a part of Arjuna
# Copyright 2015-2021 Rahul Verma
# Website: www.RahulVerma.net
# 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... | 27.666667 | 74 | 0.703815 |
from arjuna.engine.selection.selector import Selector
def get_rule(r):
selector = Selector()
selector.include(r)
rule = selector.irules[0]
print(rule)
return rule
class Empty:
pass
class Obj:
def __init__(self):
self.info = Empty()
self.tags = set()
s... | true | true |
f74ad3ad2fc1e8a4e588a117e6399b7964fb379c | 31 | py | Python | data/studio21_generated/introductory/2921/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | data/studio21_generated/introductory/2921/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | data/studio21_generated/introductory/2921/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | def blocks_to_collect(level):
| 15.5 | 29 | 0.806452 | def blocks_to_collect(level):
| false | true |
f74ad431ba76dd79205e203670c5e222cd51cd37 | 2,858 | py | Python | sbd/sbd.py | am-zed/sbd | cbd358f030a606d341fbf43c8747636b001b641e | [
"MIT"
] | null | null | null | sbd/sbd.py | am-zed/sbd | cbd358f030a606d341fbf43c8747636b001b641e | [
"MIT"
] | null | null | null | sbd/sbd.py | am-zed/sbd | cbd358f030a606d341fbf43c8747636b001b641e | [
"MIT"
] | null | null | null | import argparse
import os
import pdfkit
import re
import validators
from robobrowser import RoboBrowser
def remove_non_ascii_chars(text):
return re.sub(r'[^\x00-\x7F]+', ' ', text)
base_url = 'https://learning.oreilly.com'
parser = argparse.ArgumentParser(
description='A small program to download books fro... | 33.232558 | 116 | 0.613716 | import argparse
import os
import pdfkit
import re
import validators
from robobrowser import RoboBrowser
def remove_non_ascii_chars(text):
return re.sub(r'[^\x00-\x7F]+', ' ', text)
base_url = 'https://learning.oreilly.com'
parser = argparse.ArgumentParser(
description='A small program to download books fro... | true | true |
f74ad4648b930ef617786c51a483a8e75bc14b1e | 1,213 | py | Python | src/utils/removeImg/testRemoveImg.py | FelipeRhoden/gifscreen | dc6a84bd3e72f30b8fa63ee2acaf5ca32d6de8ea | [
"MIT"
] | null | null | null | src/utils/removeImg/testRemoveImg.py | FelipeRhoden/gifscreen | dc6a84bd3e72f30b8fa63ee2acaf5ca32d6de8ea | [
"MIT"
] | 1 | 2021-06-30T12:47:39.000Z | 2021-06-30T13:10:17.000Z | src/utils/removeImg/testRemoveImg.py | FelipeRhoden/gifscreen | dc6a84bd3e72f30b8fa63ee2acaf5ca32d6de8ea | [
"MIT"
] | null | null | null | import unittest, os.path, os
from PIL import ImageGrab
from .removeImg import remove_img
class TestRemove_img(unittest.TestCase):
# Deveria excluir uma imagem
def test_remove_img_remove(self):
img = ImageGrab.grab((0,0,500,500))
path = "tmp.png"
img.save(path)
img.close()
pathExists = os.path.... | 28.209302 | 49 | 0.64798 | import unittest, os.path, os
from PIL import ImageGrab
from .removeImg import remove_img
class TestRemove_img(unittest.TestCase):
def test_remove_img_remove(self):
img = ImageGrab.grab((0,0,500,500))
path = "tmp.png"
img.save(path)
img.close()
pathExists = os.path.exists(path)
self.assertT... | true | true |
f74ad7179d1547d8d9b78022548c24f441589c54 | 303 | py | Python | settings.py | googlewaitme/tg_quote_bot | 72a14e4d473fb859f2cb03a37c2647246bf1bbe2 | [
"MIT"
] | null | null | null | settings.py | googlewaitme/tg_quote_bot | 72a14e4d473fb859f2cb03a37c2647246bf1bbe2 | [
"MIT"
] | null | null | null | settings.py | googlewaitme/tg_quote_bot | 72a14e4d473fb859f2cb03a37c2647246bf1bbe2 | [
"MIT"
] | null | null | null | import os
token = os.environ.get('telegram_token')
channel_chat_id = '-1001479800791'
help_text = """Привет!
Это чат-бот "Мудрые слова".
Нажмите на /quote, для того, чтобы получить новую цитату.
Подписывайтесь на наш телеграм канал @amit_thoughts, чтобы получать ежедневно дозу мудрости.
Удачи!
"""
| 21.642857 | 92 | 0.762376 | import os
token = os.environ.get('telegram_token')
channel_chat_id = '-1001479800791'
help_text = """Привет!
Это чат-бот "Мудрые слова".
Нажмите на /quote, для того, чтобы получить новую цитату.
Подписывайтесь на наш телеграм канал @amit_thoughts, чтобы получать ежедневно дозу мудрости.
Удачи!
"""
| true | true |
f74ad84c8732bc331e47cf8a0bdb048686ddb531 | 184 | py | Python | main_Simple.py | eliezeravihail/linkedList | 5d50fc44433d61171bf51741d3b00357b628b26c | [
"MIT"
] | null | null | null | main_Simple.py | eliezeravihail/linkedList | 5d50fc44433d61171bf51741d3b00357b628b26c | [
"MIT"
] | null | null | null | main_Simple.py | eliezeravihail/linkedList | 5d50fc44433d61171bf51741d3b00357b628b26c | [
"MIT"
] | null | null | null | import linkedList as L
myLL = L.linkedList()
myLL.pushToHead("last item")
myLL.pushToHead("first item")
print(myLL.popFirst())
print(myLL.popFirst())
#output:
#first item
#last item
| 15.333333 | 29 | 0.73913 | import linkedList as L
myLL = L.linkedList()
myLL.pushToHead("last item")
myLL.pushToHead("first item")
print(myLL.popFirst())
print(myLL.popFirst())
| true | true |
f74ada1593d91177e744617ce8926d18d8c5fcdf | 5,821 | py | Python | shaka/tools/version.py | hunter-packages/shaka-player-embedded | ea50a18b337abd5e02ab5c8e06280d36c1ad8fdf | [
"Apache-2.0"
] | null | null | null | shaka/tools/version.py | hunter-packages/shaka-player-embedded | ea50a18b337abd5e02ab5c8e06280d36c1ad8fdf | [
"Apache-2.0"
] | null | null | null | shaka/tools/version.py | hunter-packages/shaka-player-embedded | ea50a18b337abd5e02ab5c8e06280d36c1ad8fdf | [
"Apache-2.0"
] | 6 | 2019-05-02T07:24:53.000Z | 2021-07-01T07:51:27.000Z | #!/usr/bin/python
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | 33.454023 | 80 | 0.650576 |
from __future__ import print_function
import argparse
import os
import re
import subprocess
import sys
import embed_utils
_MAX_VERSION = 2**16 - 1
_MAX_COMMITS = 2**12 - 1
_MAX_BETA_VERSION = 2**3 - 1
def _GetVersion():
if True:
return 'v0.1.0-beta'
try:
cur_dir = os.path.dirname(__file__)
c... | true | true |
f74adc68509ca24ab166e48d54da66f523355831 | 1,509 | py | Python | gmprocess/metrics/transform/differentiate.py | norfordb/groundmotion | 3f714894a34d9d37e1ac236f26b4366e25a05056 | [
"CC0-1.0"
] | 1 | 2019-08-16T16:11:23.000Z | 2019-08-16T16:11:23.000Z | gmprocess/metrics/transform/differentiate.py | vinceq-usgs/gmprocess | 2812dfd1803f8b2e0622c56cd8373b1c3fedb1a6 | [
"CC0-1.0"
] | null | null | null | gmprocess/metrics/transform/differentiate.py | vinceq-usgs/gmprocess | 2812dfd1803f8b2e0622c56cd8373b1c3fedb1a6 | [
"CC0-1.0"
] | null | null | null | # Third party imports
from gmprocess.metrics.transform.transform import Transform
from gmprocess.stationstream import StationStream
from gmprocess.stationtrace import StationTrace
class Differentiate(Transform):
"""Class for computing the derivative."""
def __init__(self, transform_data, damping=None, period=... | 38.692308 | 81 | 0.634195 | from gmprocess.metrics.transform.transform import Transform
from gmprocess.stationstream import StationStream
from gmprocess.stationtrace import StationTrace
class Differentiate(Transform):
def __init__(self, transform_data, damping=None, period=None, times=None):
super().__init__(transform_data, damping=... | true | true |
f74addb4fd01a2ba7399f188f440e60b97adbfb5 | 3,698 | py | Python | python/smap/jobs.py | carlosduarteroa/smap | 5760631dfaf3e85da26ce68bf542bf254bb92c80 | [
"BSD-2-Clause"
] | null | null | null | python/smap/jobs.py | carlosduarteroa/smap | 5760631dfaf3e85da26ce68bf542bf254bb92c80 | [
"BSD-2-Clause"
] | null | null | null | python/smap/jobs.py | carlosduarteroa/smap | 5760631dfaf3e85da26ce68bf542bf254bb92c80 | [
"BSD-2-Clause"
] | null | null | null | """
Copyright (c) 2011, 2012, Regents of the University of California
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this l... | 34.886792 | 76 | 0.632504 | import time
from twisted.internet import task, reactor, defer
from smap import util
class SmapJob:
def __init__(self, job):
self.name = job['Name'] if 'Name' in job else None
self.after = job['After'] if 'After' in job else None
self.start_time = job['StartTime'] if 'StartTime' in job el... | true | true |
f74adef3c7549ceb687f58ffe9259fd6253dbd89 | 1,465 | py | Python | burger_war_dev/scripts/randomRun.py | shendongqiang/burger_war_dev | 5c09e754f06645a438ff37e8c558475c2684d3a6 | [
"BSD-3-Clause"
] | null | null | null | burger_war_dev/scripts/randomRun.py | shendongqiang/burger_war_dev | 5c09e754f06645a438ff37e8c558475c2684d3a6 | [
"BSD-3-Clause"
] | null | null | null | burger_war_dev/scripts/randomRun.py | shendongqiang/burger_war_dev | 5c09e754f06645a438ff37e8c558475c2684d3a6 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This is rumdom run node.
subscribe No topcs.
Publish 'cmd_vel' topic.
mainly use for simple sample program
by Takuya Yamaguhi.
'''
import rospy
import random
from geometry_msgs.msg import Twist
class RandomBot():
def __init__(self, bot_name="NoName"):
... | 21.544118 | 70 | 0.529693 |
import rospy
import random
from geometry_msgs.msg import Twist
class RandomBot():
def __init__(self, bot_name="NoName"):
self.name = bot_name
self.vel_pub = rospy.Publisher('cmd_vel', Twist,queue_size=1)
def calcTwist(self):
value = random.randint(1,1000)
if ... | true | true |
f74adf7e356179a1e22c12b40900af3a993375e0 | 812 | py | Python | duello/urls.py | Lnvictor/duello | a59dbb43b9158bcb1a9e3824d4846b3a673aabc5 | [
"Apache-2.0"
] | null | null | null | duello/urls.py | Lnvictor/duello | a59dbb43b9158bcb1a9e3824d4846b3a673aabc5 | [
"Apache-2.0"
] | null | null | null | duello/urls.py | Lnvictor/duello | a59dbb43b9158bcb1a9e3824d4846b3a673aabc5 | [
"Apache-2.0"
] | null | null | null | """duello URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... | 35.304348 | 77 | 0.705665 | from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path("admin/", admin.site.urls),
path("auth/", include("duello.custom_auth.urls")),
]
| true | true |
f74ae39c3444d276705c0d2af60413a53f6f2206 | 28,582 | py | Python | kivy/config.py | DamonTung/kivy | 81f573ef8de4c341cbf4d7c389f783c36eec91ce | [
"MIT"
] | 1 | 2015-11-05T18:32:14.000Z | 2015-11-05T18:32:14.000Z | kivy/config.py | waderly/kivy | 1bfa50bcbe83350f42f002bc217d381e4878666d | [
"MIT"
] | null | null | null | kivy/config.py | waderly/kivy | 1bfa50bcbe83350f42f002bc217d381e4878666d | [
"MIT"
] | null | null | null | '''
Configuration object
====================
The :class:`Config` object is an instance of a modified Python ConfigParser.
See the `ConfigParser documentation
<http://docs.python.org/library/configparser.html>`_ for more information.
Kivy has a configuration file which determines the default settings. In
order to cha... | 38.365101 | 79 | 0.625149 |
__all__ = ('Config', 'ConfigParser')
try:
from ConfigParser import ConfigParser as PythonConfigParser
except ImportError:
from configparser import RawConfigParser as PythonConfigParser
from os import environ
from os.path import exists
from kivy import kivy_config_fn
from kivy.logger import Logger, logger_conf... | true | true |
f74ae3fe033f7ab85beb25972ec28e355ac8796b | 10,965 | py | Python | Models/Electricity_Market/Tiers/V001/model.py | schmocker/Pyjamas | 52a72d6e8b915f77a2194d4e7d53c46d0ec28c17 | [
"MIT"
] | 2 | 2018-05-31T15:02:08.000Z | 2018-07-11T11:02:44.000Z | Models/Electricity_Market/Tiers/V001/model.py | schmocker/Pyjamas | 52a72d6e8b915f77a2194d4e7d53c46d0ec28c17 | [
"MIT"
] | null | null | null | Models/Electricity_Market/Tiers/V001/model.py | schmocker/Pyjamas | 52a72d6e8b915f77a2194d4e7d53c46d0ec28c17 | [
"MIT"
] | null | null | null | from pyjamas_core import Supermodel
from pyjamas_core.util import Input, Output, Property
from datetime import datetime, timedelta
from Models._utils.time import datetime2utc_time, utc_time2datetime
import numpy as np
from pytz import timezone
import json
from scipy.interpolate import griddata
import pandas as pd
impor... | 39.584838 | 150 | 0.540264 | from pyjamas_core import Supermodel
from pyjamas_core.util import Input, Output, Property
from datetime import datetime, timedelta
from Models._utils.time import datetime2utc_time, utc_time2datetime
import numpy as np
from pytz import timezone
import json
from scipy.interpolate import griddata
import pandas as pd
impor... | true | true |
f74ae48e90f874d6c83be4ce7ecca29772e876c8 | 28,862 | py | Python | Contents/Libraries/Shared/guessit/rules/properties/episodes.py | jippo015/Sub-Zero.bundle | 734e0f7128c05c0f639e11e7dfc77daa1014064b | [
"MIT"
] | 1,553 | 2015-11-09T02:17:06.000Z | 2022-03-31T20:24:52.000Z | Contents/Libraries/Shared/guessit/rules/properties/episodes.py | saiterlz/Sub-Zero.bundle | 1a0bb9c3e4be84be35d46672907783363fe5a87b | [
"MIT"
] | 691 | 2015-11-05T21:32:26.000Z | 2022-03-17T10:52:45.000Z | Contents/Libraries/Shared/guessit/rules/properties/episodes.py | saiterlz/Sub-Zero.bundle | 1a0bb9c3e4be84be35d46672907783363fe5a87b | [
"MIT"
] | 162 | 2015-11-06T19:38:55.000Z | 2022-03-16T02:42:41.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
episode, season, episode_count, season_count and episode_details properties
"""
import copy
from collections import defaultdict
from rebulk import Rebulk, RemoveMatch, Rule, AppendMatch, RenameMatch
from rebulk.match import Match
from rebulk.remodule import re
from reb... | 43.271364 | 120 | 0.584436 | import copy
from collections import defaultdict
from rebulk import Rebulk, RemoveMatch, Rule, AppendMatch, RenameMatch
from rebulk.match import Match
from rebulk.remodule import re
from rebulk.utils import is_iterable
from .title import TitleFromPosition
from ..common import dash, alt_dash, seps
from ..common.formatt... | true | true |
f74ae49f4be1a7ef5b666c3c8d701b06aa1710ec | 2,405 | py | Python | Utils/DiscreteLog.py | 636F57/CryptoAttackers | f6dae7f5c37ab563774a3e2be48dcd840d87bb12 | [
"MIT"
] | 1 | 2021-09-02T10:40:35.000Z | 2021-09-02T10:40:35.000Z | Utils/DiscreteLog.py | 636F57/CryptoAttackers | f6dae7f5c37ab563774a3e2be48dcd840d87bb12 | [
"MIT"
] | null | null | null | Utils/DiscreteLog.py | 636F57/CryptoAttackers | f6dae7f5c37ab563774a3e2be48dcd840d87bb12 | [
"MIT"
] | null | null | null | ### DiscreteLog.py
###
### Compute x when given h, g prime p, and the range of x [0 <= x <= max], such that g**x = h mod p
###
### This uses meet-in-the-middle-attack, namely, expand x as x = x0 * sqrt(max) + x1, find x0 and x1
### such that h/(g**x1) == (g**sqrt(max) )**x0 in mod p, by exausive attack.
###
### MIT L... | 23.578431 | 100 | 0.597089 |
import gmpy2
from gmpy2 import mpz import pickle
import hashlib
import math
bTablefiles = True
def createTable(g, p, B):
print("Creating table...")
table = {}
pp = mpz(p)
gB = (mpz(g)** mpz(B)) % pp
key = mpz(1)
progressbase = int(B/10)
for x0 in range(B+1): table[key] = x0
key = ( key * gB ) % pp
... | true | true |
f74ae4ea694e8b977b4a225c39ec359e201361f4 | 7,532 | py | Python | train.py | Leon-Francis/Script-role-emotion-recognition | e80b8366f1e868b6611c149ad18945a994784b3d | [
"Apache-2.0"
] | null | null | null | train.py | Leon-Francis/Script-role-emotion-recognition | e80b8366f1e868b6611c149ad18945a994784b3d | [
"Apache-2.0"
] | null | null | null | train.py | Leon-Francis/Script-role-emotion-recognition | e80b8366f1e868b6611c149ad18945a994784b3d | [
"Apache-2.0"
] | null | null | null | import torch
import tqdm
from torch.utils.data import DataLoader
import torch.nn.functional as F
from torch import optim, nn
from dataset import Script_dataset
from config import TrainingConfig, CONFIG_PATH
from model import BaseModel
from tools import logging, get_time
from datetime import datetime
import os
from shut... | 44.305882 | 138 | 0.63436 | import torch
import tqdm
from torch.utils.data import DataLoader
import torch.nn.functional as F
from torch import optim, nn
from dataset import Script_dataset
from config import TrainingConfig, CONFIG_PATH
from model import BaseModel
from tools import logging, get_time
from datetime import datetime
import os
from shut... | true | true |
f74ae55c46b85db7df9ac91e450d5241f088c3a0 | 5,269 | py | Python | 2_3_dicision_tree.py | idontwannawork/intro_to_ml_with_python | c32512450e2e637982b0ce126f1ba4440ca2c514 | [
"WTFPL"
] | null | null | null | 2_3_dicision_tree.py | idontwannawork/intro_to_ml_with_python | c32512450e2e637982b0ce126f1ba4440ca2c514 | [
"WTFPL"
] | null | null | null | 2_3_dicision_tree.py | idontwannawork/intro_to_ml_with_python | c32512450e2e637982b0ce126f1ba4440ca2c514 | [
"WTFPL"
] | null | null | null | # %% [markdown]
# ## Dicision tree
# %%
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.datasets import make_moons
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LinearRegression
from sklearn.tree import DecisionTreeRegressor
import os
import graphviz
from skl... | 28.481081 | 104 | 0.741697 |
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.datasets import make_moons
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LinearRegression
from sklearn.tree import DecisionTreeRegressor
import os
import graphviz
from sklearn.tree import export_graphviz
from sk... | false | true |
f74ae5755de54a86a55a02fd50e0b96274be7717 | 4,977 | py | Python | src/olympia/constants/permissions.py | kumar303/addons-server | 5494bfdb4801e87220d17e35e0fa2ab4f017eac9 | [
"BSD-3-Clause"
] | null | null | null | src/olympia/constants/permissions.py | kumar303/addons-server | 5494bfdb4801e87220d17e35e0fa2ab4f017eac9 | [
"BSD-3-Clause"
] | null | null | null | src/olympia/constants/permissions.py | kumar303/addons-server | 5494bfdb4801e87220d17e35e0fa2ab4f017eac9 | [
"BSD-3-Clause"
] | null | null | null | from collections import defaultdict, namedtuple
AclPermission = namedtuple('AclPermission', 'app, action')
# Null rule. Only useful in tests really as no access group should have this.
NONE = AclPermission('None', 'None')
# A special wildcard permission to use when checking if someone has access to
# any admin, or... | 39.5 | 79 | 0.768535 | from collections import defaultdict, namedtuple
AclPermission = namedtuple('AclPermission', 'app, action')
NONE = AclPermission('None', 'None')
ANY_ADMIN = AclPermission('Admin', '%')
SUPERPOWERS = AclPermission('*', '*')
ADMIN_TOOLS = AclPermission('Admin', 'Tools')
ADMIN_CURATION = AclPermission('Admin', 'Curat... | true | true |
f74ae6513d015fb3e2e8361e7e84c4ca9b4c573c | 1,003 | py | Python | Docker/openroberta/scripts/reporting/workflows-test.py | Klkoenig217/openroberta-lab | eb2cab36809fe0d97f717c08588e4089bf8f2028 | [
"Apache-2.0"
] | 96 | 2019-04-29T18:58:11.000Z | 2022-03-21T02:47:33.000Z | Docker/openroberta/scripts/reporting/workflows-test.py | Klkoenig217/openroberta-lab | eb2cab36809fe0d97f717c08588e4089bf8f2028 | [
"Apache-2.0"
] | 1,113 | 2019-04-17T07:49:24.000Z | 2022-03-30T11:22:46.000Z | Docker/openroberta/scripts/reporting/workflows-test.py | Klkoenig217/openroberta-lab | eb2cab36809fe0d97f717c08588e4089bf8f2028 | [
"Apache-2.0"
] | 179 | 2019-05-08T19:52:43.000Z | 2022-03-18T11:30:27.000Z | '''
test/debug the reporting program w.t.h. of this file :-)
@author: rbudde
'''
from datetime import datetime
import time
from util import *
from store import *
from entry import *
if __name__ == "__main__":
logDir = "D:/data/openroberta-lab/server/master/admin/logging/statistics-2020"
logFile = "01.log.zi... | 32.354839 | 119 | 0.659023 |
from datetime import datetime
import time
from util import *
from store import *
from entry import *
if __name__ == "__main__":
logDir = "D:/data/openroberta-lab/server/master/admin/logging/statistics-2020"
logFile = "01.log.zip"
outputFileHandle = open("D:/temp/testoutput.txt", 'w')
printer = lambda ... | true | true |
f74ae6b9925457538b16177136de3888adde735b | 1,635 | py | Python | tensorflow_datasets/scripts/cli/main.py | rushabh-v/datasets | eccdf9dd2b8741e1d2500ae7edb0cb7f5cd59da4 | [
"Apache-2.0"
] | 2 | 2020-10-12T07:09:38.000Z | 2021-03-05T12:48:23.000Z | tensorflow_datasets/scripts/cli/main.py | rushabh-v/datasets | eccdf9dd2b8741e1d2500ae7edb0cb7f5cd59da4 | [
"Apache-2.0"
] | null | null | null | tensorflow_datasets/scripts/cli/main.py | rushabh-v/datasets | eccdf9dd2b8741e1d2500ae7edb0cb7f5cd59da4 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# 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 appl... | 28.189655 | 78 | 0.729052 |
import argparse
from typing import List
from absl import app
from absl.flags import argparse_flags
import tensorflow_datasets.public_api as tfds
def _parse_flags(argv: List[str]) -> argparse.Namespace:
parser = argparse_flags.ArgumentParser(
description='Tensorflow Datasets CLI tool',
)
parser.add_arg... | true | true |
f74ae8436093cfb5d3427035d1521fc06ffb872b | 272 | py | Python | chapter-07/app/src/server.py | khtan-private/Windows-Subsystem-for-Linux-2-WSL-2-Tips-Tricks-and-Techniques | faf64da8bcbc48a1a860902adff6622fec22d52b | [
"MIT"
] | null | null | null | chapter-07/app/src/server.py | khtan-private/Windows-Subsystem-for-Linux-2-WSL-2-Tips-Tricks-and-Techniques | faf64da8bcbc48a1a860902adff6622fec22d52b | [
"MIT"
] | null | null | null | chapter-07/app/src/server.py | khtan-private/Windows-Subsystem-for-Linux-2-WSL-2-Tips-Tricks-and-Techniques | faf64da8bcbc48a1a860902adff6622fec22d52b | [
"MIT"
] | null | null | null | import datetime
from platform import uname
from flask import Flask
server = Flask(__name__)
@server.route("/")
def getgreeting():
return uname()[0] + " | " + uname()[1] + " | " + str(datetime.datetime.now())
if __name__ == "__main__":
server.run(host='0.0.0.0')
| 22.666667 | 81 | 0.647059 | import datetime
from platform import uname
from flask import Flask
server = Flask(__name__)
@server.route("/")
def getgreeting():
return uname()[0] + " | " + uname()[1] + " | " + str(datetime.datetime.now())
if __name__ == "__main__":
server.run(host='0.0.0.0')
| true | true |
f74ae888d573f2dfd19cfa0540751033711781e9 | 4,806 | py | Python | AutomatedTesting/Gem/PythonTests/AWS/common/aws_credentials.py | aaarsene/o3de | 37e3b0226958974defd14dd6d808e8557dcd7345 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-07-20T12:39:24.000Z | 2021-07-20T12:39:24.000Z | AutomatedTesting/Gem/PythonTests/AWS/common/aws_credentials.py | aaarsene/o3de | 37e3b0226958974defd14dd6d808e8557dcd7345 | [
"Apache-2.0",
"MIT"
] | null | null | null | AutomatedTesting/Gem/PythonTests/AWS/common/aws_credentials.py | aaarsene/o3de | 37e3b0226958974defd14dd6d808e8557dcd7345 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-07-20T11:07:25.000Z | 2021-07-20T11:07:25.000Z | """
Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
import boto3
import configparser
import logging
import os
import pytest
import typing
logger = lo... | 43.690909 | 156 | 0.677278 |
import boto3
import configparser
import logging
import os
import pytest
import typing
logger = logging.getLogger(__name__)
logging.getLogger('boto').setLevel(logging.CRITICAL)
class AwsCredentials:
def __init__(self, profile_name: str):
self._profile_name = profile_name
self._cr... | true | true |
f74ae8b94b2f7f4382a11f46fc71d42e3de1d9ac | 1,114 | py | Python | tests/__init__.py | bcdev/ocdb-client | c7d620e00f33fe0cdc7711178e83f789791fd4f8 | [
"MIT"
] | null | null | null | tests/__init__.py | bcdev/ocdb-client | c7d620e00f33fe0cdc7711178e83f789791fd4f8 | [
"MIT"
] | 1 | 2019-06-21T09:43:01.000Z | 2019-06-21T09:43:01.000Z | eocdb/core/seabass/__init__.py | bcdev/ocdb-server | 027078f2b022a06b3a417d76d273514a72f8cac7 | [
"MIT"
] | null | null | null | # The MIT License (MIT)
# Copyright (c) 2018 by EUMETSAT
#
# 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,... | 53.047619 | 81 | 0.777379 | true | true | |
f74ae93b8cc6518cf4988a26caf259e0bc802844 | 564 | py | Python | drawer.py | janakhpon/LearnPyDacity | b096f9a50496a0c01353bf953209e766de312187 | [
"MIT"
] | null | null | null | drawer.py | janakhpon/LearnPyDacity | b096f9a50496a0c01353bf953209e766de312187 | [
"MIT"
] | null | null | null | drawer.py | janakhpon/LearnPyDacity | b096f9a50496a0c01353bf953209e766de312187 | [
"MIT"
] | null | null | null | import turtle
def draw_square(some_turtle):
for i in range(1,5):
some_turtle.forward(100)
some_turtle.right(90)
def draw_art():
window = turtle.Screen()
window.bgcolor("blue")
img_tt = turtle.Turtle()
img_tt.shape("turtle")
img_tt.color("white")
img_tt.speed(2)
for i in... | 20.142857 | 32 | 0.611702 | import turtle
def draw_square(some_turtle):
for i in range(1,5):
some_turtle.forward(100)
some_turtle.right(90)
def draw_art():
window = turtle.Screen()
window.bgcolor("blue")
img_tt = turtle.Turtle()
img_tt.shape("turtle")
img_tt.color("white")
img_tt.speed(2)
for i in... | true | true |
f74ae9c9e53bc414e5245b8a46d222773bdd1843 | 4,936 | py | Python | aoide/make_sky_mask.py | granttremblay/aoide | ea25bdf92013f7dc3b254e261039c43e697ee901 | [
"MIT"
] | 1 | 2018-06-26T12:28:39.000Z | 2018-06-26T12:28:39.000Z | aoide/make_sky_mask.py | granttremblay/Aoide | ea25bdf92013f7dc3b254e261039c43e697ee901 | [
"MIT"
] | null | null | null | aoide/make_sky_mask.py | granttremblay/Aoide | ea25bdf92013f7dc3b254e261039c43e697ee901 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
'''
Aoide | Reduction & Analysis of MUSE observations
-------------------------------------------------
Dr. Grant R. Tremblay | Harvard-Smithsonian Center for Astrophysics
grant.tremblay @ cfa.harvard.edu
See the README associated with this repository for documentation & examples.
'''
from __fu... | 30.097561 | 81 | 0.586507 |
from __future__ import print_function
import os
import sys
import matplotlib.pyplot as plt
import numpy as np
from astropy.io import fits as pyfits
class MaskFrame:
def __init__(self, image, mask_name, cuts=(0, 10), extension=0):
fits_ima = pyfits.open(image)
self.true_arr = fits_ima[extens... | true | true |
f74aec0e09f15795a7e7e273ca1d959c7365d83c | 13,433 | py | Python | src/python/pants/goal/context.py | oseemann/pants | 628c83d5ab2706b0f64d69568c57a718ec7c5e2a | [
"Apache-2.0"
] | null | null | null | src/python/pants/goal/context.py | oseemann/pants | 628c83d5ab2706b0f64d69568c57a718ec7c5e2a | [
"Apache-2.0"
] | null | null | null | src/python/pants/goal/context.py | oseemann/pants | 628c83d5ab2706b0f64d69568c57a718ec7c5e2a | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import sys... | 36.903846 | 109 | 0.711457 |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import sys
from collections import defaultdict
from contextlib import contextmanager
from twitter.common.collections import OrderedSet
from pants.base.bui... | true | true |
f74aec0efe87e5b1b82fad66f95d170f748c878f | 1,324 | py | Python | homeassistant/helpers/__init__.py | PiotrMachowski/core | b9d7d0cae2ccd2d88e90e49cc09e154a27ed809b | [
"Apache-2.0"
] | 4 | 2021-07-11T09:11:00.000Z | 2022-02-27T14:43:50.000Z | homeassistant/helpers/__init__.py | PiotrMachowski/core | b9d7d0cae2ccd2d88e90e49cc09e154a27ed809b | [
"Apache-2.0"
] | 277 | 2021-10-04T06:39:33.000Z | 2021-12-28T22:04:17.000Z | homeassistant/helpers/__init__.py | PiotrMachowski/core | b9d7d0cae2ccd2d88e90e49cc09e154a27ed809b | [
"Apache-2.0"
] | 1 | 2022-02-09T00:30:51.000Z | 2022-02-09T00:30:51.000Z | """Helper methods for components within Home Assistant."""
from __future__ import annotations
from collections.abc import Iterable, Sequence
import re
from typing import TYPE_CHECKING
from homeassistant.const import CONF_PLATFORM
if TYPE_CHECKING:
from .typing import ConfigType
def config_per_platform(
con... | 28.170213 | 77 | 0.664653 | from __future__ import annotations
from collections.abc import Iterable, Sequence
import re
from typing import TYPE_CHECKING
from homeassistant.const import CONF_PLATFORM
if TYPE_CHECKING:
from .typing import ConfigType
def config_per_platform(
config: ConfigType, domain: str
) -> Iterable[tuple[str | None... | true | true |
f74aecabba20f69b5f769ea05bb45d921238aa3e | 701 | py | Python | test/nose_integration_tests/dummy_first_level_pkg_one_tests/dummy_second_level_pkg_A_tests/dummy_test_c.py | denisenkom/teamcity-python | 25d0008596cfc7b895f367d36de5dd95b6722b4c | [
"Apache-2.0"
] | 1 | 2018-08-14T16:29:57.000Z | 2018-08-14T16:29:57.000Z | test/nose_integration_tests/dummy_first_level_pkg_one_tests/dummy_second_level_pkg_A_tests/dummy_test_c.py | denisenkom/teamcity-python | 25d0008596cfc7b895f367d36de5dd95b6722b4c | [
"Apache-2.0"
] | null | null | null | test/nose_integration_tests/dummy_first_level_pkg_one_tests/dummy_second_level_pkg_A_tests/dummy_test_c.py | denisenkom/teamcity-python | 25d0008596cfc7b895f367d36de5dd95b6722b4c | [
"Apache-2.0"
] | null | null | null | from nose.plugins.attrib import attr
@attr('demo_smoke', 'smoke', 'known_bad')
def test_dummy_known_bad_with_assertion_error():
"""
test_dummy_known_bad_with_assertion_error
I'd like to buy the world a Dr Pepper!
"""
assert False
@attr('demo_smoke', 'smoke', 'known_bad')
def test_dummy_known_bad... | 24.172414 | 48 | 0.71184 | from nose.plugins.attrib import attr
@attr('demo_smoke', 'smoke', 'known_bad')
def test_dummy_known_bad_with_assertion_error():
assert False
@attr('demo_smoke', 'smoke', 'known_bad')
def test_dummy_known_bad_with_assertion_pass():
assert True
@attr('demo_smoke', 'smoke', 'known_bad')
def test_dummy_known_... | true | true |
f74aed8886340987aea7be736b1cb328fe7edd71 | 26,079 | py | Python | image_classification/PiT/main_multi_gpu_distill.py | RangeKing/PaddleViT | 0e25958686e04ed8872cf67fba0dfd6918e9b4dd | [
"Apache-2.0"
] | null | null | null | image_classification/PiT/main_multi_gpu_distill.py | RangeKing/PaddleViT | 0e25958686e04ed8872cf67fba0dfd6918e9b4dd | [
"Apache-2.0"
] | null | null | null | image_classification/PiT/main_multi_gpu_distill.py | RangeKing/PaddleViT | 0e25958686e04ed8872cf67fba0dfd6918e9b4dd | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2021 PPViT Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | 44.732419 | 100 | 0.622647 |
import sys
import os
import time
import argparse
import random
import math
import numpy as np
import paddle
from datasets import get_dataloader
from datasets import get_dataset
from config import get_config
from config import update_config
from utils import AverageMeter
from utils import get_logger
from utils import w... | true | true |
f74aee7f8711e0d20ddae7ba72df63f17d3c27c5 | 3,471 | py | Python | saleor/graphql/discount/filters.py | shannenye/saleor | f6a2d35fd8ae8d614edd952cd5c58adb82e56ab2 | [
"CC-BY-4.0"
] | 3 | 2021-06-22T12:38:18.000Z | 2021-07-11T15:01:57.000Z | saleor/graphql/discount/filters.py | shannenye/saleor | f6a2d35fd8ae8d614edd952cd5c58adb82e56ab2 | [
"CC-BY-4.0"
] | 111 | 2021-07-19T04:19:30.000Z | 2022-03-28T04:32:37.000Z | saleor/graphql/discount/filters.py | shannenye/saleor | f6a2d35fd8ae8d614edd952cd5c58adb82e56ab2 | [
"CC-BY-4.0"
] | 6 | 2021-11-08T16:43:05.000Z | 2022-03-22T17:31:16.000Z | from typing import List
import django_filters
from django.db.models import Q
from django.utils import timezone
from ...discount import DiscountValueType
from ...discount.models import Sale, Voucher, VoucherQueryset
from ..core.filters import ListObjectTypeFilter, ObjectTypeFilter
from ..core.types.common import DateT... | 33.375 | 88 | 0.721694 | from typing import List
import django_filters
from django.db.models import Q
from django.utils import timezone
from ...discount import DiscountValueType
from ...discount.models import Sale, Voucher, VoucherQueryset
from ..core.filters import ListObjectTypeFilter, ObjectTypeFilter
from ..core.types.common import DateT... | true | true |
f74aefc2910220fdbeb939c89be3ba2fa5ea25fe | 5,330 | py | Python | tests20/python_client/chaos/checker.py | reyoung/milvus | 7557616fea7ff7a8b093c85a5c17134112fa89f8 | [
"Apache-2.0"
] | null | null | null | tests20/python_client/chaos/checker.py | reyoung/milvus | 7557616fea7ff7a8b093c85a5c17134112fa89f8 | [
"Apache-2.0"
] | null | null | null | tests20/python_client/chaos/checker.py | reyoung/milvus | 7557616fea7ff7a8b093c85a5c17134112fa89f8 | [
"Apache-2.0"
] | null | null | null | import datetime
from enum import Enum
from random import randint
from time import sleep
from base.collection_wrapper import ApiCollectionWrapper
from common import common_func as cf
from common import common_type as ct
import constants
from utils.util_log import test_log as log
class Op(Enum):
create = 'create'
... | 34.166667 | 104 | 0.549719 | import datetime
from enum import Enum
from random import randint
from time import sleep
from base.collection_wrapper import ApiCollectionWrapper
from common import common_func as cf
from common import common_type as ct
import constants
from utils.util_log import test_log as log
class Op(Enum):
create = 'create'
... | true | true |
f74af1aa72de9a35ade54b2b54bc9b70c67fb025 | 1,779 | py | Python | tests/unit/executors/evaluators/rank/test_recall.py | serge-m/jina | 9c9af3cd2982daabc75dd3d3e2f380e17c21aac0 | [
"Apache-2.0"
] | 1 | 2020-11-14T09:54:09.000Z | 2020-11-14T09:54:09.000Z | tests/unit/executors/evaluators/rank/test_recall.py | serge-m/jina | 9c9af3cd2982daabc75dd3d3e2f380e17c21aac0 | [
"Apache-2.0"
] | null | null | null | tests/unit/executors/evaluators/rank/test_recall.py | serge-m/jina | 9c9af3cd2982daabc75dd3d3e2f380e17c21aac0 | [
"Apache-2.0"
] | null | null | null | import numpy as np
import pytest
from jina.executors.evaluators.rank.recall import RecallEvaluator
@pytest.mark.parametrize(
'eval_at, expected',
[
(0, 0.0),
(1, 0.2),
(2, 0.4),
(3, 0.4),
(5, 0.4),
(100, 0.4)
]
)
def test_recall_evaluator(eval_at, expected)... | 28.693548 | 94 | 0.63294 | import numpy as np
import pytest
from jina.executors.evaluators.rank.recall import RecallEvaluator
@pytest.mark.parametrize(
'eval_at, expected',
[
(0, 0.0),
(1, 0.2),
(2, 0.4),
(3, 0.4),
(5, 0.4),
(100, 0.4)
]
)
def test_recall_evaluator(eval_at, expected)... | true | true |
f74af1d8c79bf465f60e37098f6bd8abba93c664 | 7,180 | py | Python | frappe/website/doctype/web_page/web_page.py | oryxsolutions/frappe | d193ea22d17ca40d57432040a8afad72287d9e23 | [
"MIT"
] | null | null | null | frappe/website/doctype/web_page/web_page.py | oryxsolutions/frappe | d193ea22d17ca40d57432040a8afad72287d9e23 | [
"MIT"
] | null | null | null | frappe/website/doctype/web_page/web_page.py | oryxsolutions/frappe | d193ea22d17ca40d57432040a8afad72287d9e23 | [
"MIT"
] | null | null | null | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import re
from jinja2.exceptions import TemplateSyntaxError
import frappe
from frappe import _
from frappe.utils import get_datetime, now, quoted, strip_html
from frappe.utils.jinja import render_template
from frappe.uti... | 30.553191 | 96 | 0.724373 |
import re
from jinja2.exceptions import TemplateSyntaxError
import frappe
from frappe import _
from frappe.utils import get_datetime, now, quoted, strip_html
from frappe.utils.jinja import render_template
from frappe.utils.safe_exec import safe_exec
from frappe.website.doctype.website_slideshow.website_slideshow imp... | true | true |
f74af1f2e1bb7051265e45fb7499f4d303c49795 | 12,528 | py | Python | lib/export_utils.py | nahidupa/grr | 100a9d85ef2abb234e12e3ac2623caffb4116be7 | [
"Apache-2.0"
] | 1 | 2016-02-13T15:40:20.000Z | 2016-02-13T15:40:20.000Z | lib/export_utils.py | nahidupa/grr | 100a9d85ef2abb234e12e3ac2623caffb4116be7 | [
"Apache-2.0"
] | 3 | 2020-09-11T12:54:50.000Z | 2020-09-11T12:55:01.000Z | lib/export_utils.py | nahidupa/grr | 100a9d85ef2abb234e12e3ac2623caffb4116be7 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# Copyright 2012 Google Inc. All Rights Reserved.
"""Utils exporting data from AFF4 to the rest of the world."""
import os
import Queue
import stat
import time
import logging
from grr.lib import aff4
from grr.lib import rdfvalue
from grr.lib import serialize
from grr.lib import threadpool
from... | 33.587131 | 79 | 0.668183 |
import os
import Queue
import stat
import time
import logging
from grr.lib import aff4
from grr.lib import rdfvalue
from grr.lib import serialize
from grr.lib import threadpool
from grr.lib import type_info
from grr.lib import utils
from grr.lib.aff4_objects import aff4_grr
BUFFER_SIZE = 16 * 1024 * 1024
def Ge... | true | true |
f74af20681e6b242051dfdd5a340429508ec18cc | 36,834 | py | Python | redex.py | Harry-L/redex | c5696c06727ff9cb79279a08a3bae0f4553bd04c | [
"MIT"
] | null | null | null | redex.py | Harry-L/redex | c5696c06727ff9cb79279a08a3bae0f4553bd04c | [
"MIT"
] | null | null | null | redex.py | Harry-L/redex | c5696c06727ff9cb79279a08a3bae0f4553bd04c | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import distutils.version
import enum
import errno
import fnmatch
import glob
import itertools
import js... | 32.113339 | 109 | 0.618613 |
import argparse
import distutils.version
import enum
import errno
import fnmatch
import glob
import itertools
import json
import os
import platform
import re
import shutil
import signal
import struct
import subprocess
import sys
import tempfile
import timeit
import zipfile
from os.path import abspath, basename, dirnam... | true | true |
f74af2f8877992abad5ae65c701b25ff09e559ac | 1,605 | py | Python | solutions/0494/0494.py | abawchen/leetcode | 41d3b172a7694a46a860fbcb0565a3acccd000f2 | [
"MIT"
] | null | null | null | solutions/0494/0494.py | abawchen/leetcode | 41d3b172a7694a46a860fbcb0565a3acccd000f2 | [
"MIT"
] | null | null | null | solutions/0494/0494.py | abawchen/leetcode | 41d3b172a7694a46a860fbcb0565a3acccd000f2 | [
"MIT"
] | null | null | null | import unittest
from collections import defaultdict
class Solution:
def findTargetSumWays(self, nums: list[int], target: int) -> int:
dps = []
dp = defaultdict(int, {nums[0]: 1})
dp[-nums[0]] += 1
dps.append(dp)
for i in range(1, len(nums)):
dp = defaultdict(i... | 25.47619 | 69 | 0.555763 | import unittest
from collections import defaultdict
class Solution:
def findTargetSumWays(self, nums: list[int], target: int) -> int:
dps = []
dp = defaultdict(int, {nums[0]: 1})
dp[-nums[0]] += 1
dps.append(dp)
for i in range(1, len(nums)):
dp = defaultdict(i... | true | true |
f74af44f6844165f528484ac745b02d9dd476cd8 | 1,246 | py | Python | coco-caption/pycocoevalcap/bleu/bleu.py | wenhuchen/ethz-bootstrapped-captioner | ee68bbf2bd2f1ec4d2e4163c6ec794005a4a8f1c | [
"BSD-3-Clause"
] | 6 | 2016-12-05T21:27:30.000Z | 2018-07-26T18:19:33.000Z | coco-caption/pycocoevalcap/bleu/bleu.py | wenhuchen/ethz-bootstrapped-captioner | ee68bbf2bd2f1ec4d2e4163c6ec794005a4a8f1c | [
"BSD-3-Clause"
] | 3 | 2016-12-22T07:50:29.000Z | 2018-05-03T10:43:21.000Z | coco-caption/pycocoevalcap/bleu/bleu.py | wenhuchen/ethz-bootstrapped-captioner | ee68bbf2bd2f1ec4d2e4163c6ec794005a4a8f1c | [
"BSD-3-Clause"
] | 3 | 2017-07-23T12:50:43.000Z | 2018-04-22T11:26:53.000Z | #!/usr/bin/env python
#
# File Name : bleu.py
#
# Description : Wrapper for BLEU scorer.
#
# Creation Date : 06-01-2015
# Last Modified : Thu 19 Mar 2015 09:13:28 PM PDT
# Authors : Hao Fang <hfang@uw.edu> and Tsung-Yi Lin <tl483@cornell.edu>
from bleu_scorer import BleuScorer
class Bleu:
def __init__(self, n=4... | 25.958333 | 79 | 0.58427 |
from bleu_scorer import BleuScorer
class Bleu:
def __init__(self, n=4):
self._n = n
self._hypo_for_image = {}
self.ref_for_image = {}
def compute_score(self, gts, res):
assert(gts.keys() == res.keys())
imgIds = gts.keys()
bleu_scorer = BleuScorer(n=s... | true | true |
f74af63f5ccfd54b66af7b96b0177756056c6157 | 240 | py | Python | iterations/enumerate.py | SeanSyue/PythonReferences | 103b2d6934a33e56a5d8fbb14d95282f572b3af7 | [
"MIT"
] | null | null | null | iterations/enumerate.py | SeanSyue/PythonReferences | 103b2d6934a33e56a5d8fbb14d95282f572b3af7 | [
"MIT"
] | null | null | null | iterations/enumerate.py | SeanSyue/PythonReferences | 103b2d6934a33e56a5d8fbb14d95282f572b3af7 | [
"MIT"
] | null | null | null | seasons = ['Spring', 'Summer', 'Fall', 'Winter']
enum = enumerate(seasons)
print(enum)
print(type(enum))
print(list(enum))
my_list = ['apple', 'banana', 'grapes', 'pear']
for c, value in enumerate(my_list, 1):
print(c, value)
| 24 | 49 | 0.629167 | seasons = ['Spring', 'Summer', 'Fall', 'Winter']
enum = enumerate(seasons)
print(enum)
print(type(enum))
print(list(enum))
my_list = ['apple', 'banana', 'grapes', 'pear']
for c, value in enumerate(my_list, 1):
print(c, value)
| true | true |
f74af6452a233b7c3ad8e4cf9cfcb57cf4c2e40c | 780 | py | Python | office365/sharepoint/portal/site_creation_request.py | rikeshtailor/Office365-REST-Python-Client | ca7bfa1b22212137bb4e984c0457632163e89a43 | [
"MIT"
] | 544 | 2016-08-04T17:10:16.000Z | 2022-03-31T07:17:20.000Z | office365/sharepoint/portal/site_creation_request.py | rikeshtailor/Office365-REST-Python-Client | ca7bfa1b22212137bb4e984c0457632163e89a43 | [
"MIT"
] | 438 | 2016-10-11T12:24:22.000Z | 2022-03-31T19:30:35.000Z | office365/sharepoint/portal/site_creation_request.py | rikeshtailor/Office365-REST-Python-Client | ca7bfa1b22212137bb4e984c0457632163e89a43 | [
"MIT"
] | 202 | 2016-08-22T19:29:40.000Z | 2022-03-30T20:26:15.000Z | from office365.runtime.client_value import ClientValue
class SPSiteCreationRequest(ClientValue):
def __init__(self, title, url, owner=None):
super(SPSiteCreationRequest, self).__init__()
self.Title = title
self.Url = url
self.WebTemplate = "SITEPAGEPUBLISHING#0"
self.Owner... | 33.913043 | 76 | 0.685897 | from office365.runtime.client_value import ClientValue
class SPSiteCreationRequest(ClientValue):
def __init__(self, title, url, owner=None):
super(SPSiteCreationRequest, self).__init__()
self.Title = title
self.Url = url
self.WebTemplate = "SITEPAGEPUBLISHING#0"
self.Owner... | true | true |
f74af660078e2ec7c200314717736280e9a2cac0 | 28,392 | py | Python | crc32.py | lukaskuzmiak/DumpFlash | 2b1c7b9da622744d29c8c989ae1aabc625411e6b | [
"Unlicense"
] | 2 | 2017-10-14T11:35:11.000Z | 2021-01-25T10:26:33.000Z | crc32.py | whid-injector/DumpFlash | 2b1c7b9da622744d29c8c989ae1aabc625411e6b | [
"Unlicense"
] | null | null | null | crc32.py | whid-injector/DumpFlash | 2b1c7b9da622744d29c8c989ae1aabc625411e6b | [
"Unlicense"
] | 1 | 2020-10-26T22:32:22.000Z | 2020-10-26T22:32:22.000Z |
crc32table_le=[[
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL,
0x076dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L,
0x0edb8832L, 0x79dcb8a4L, 0xe0d5e91eL, 0x97d2d988L,
0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, 0x90bf1d91L,
0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
0x1adad47dL, 0x6ddde4ebL, 0xf4d... | 50.88172 | 72 | 0.811531 |
crc32table_le=[[
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL,
0x076dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L,
0x0edb8832L, 0x79dcb8a4L, 0xe0d5e91eL, 0x97d2d988L,
0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, 0x90bf1d91L,
0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
0x1adad47dL, 0x6ddde4ebL, 0xf4d... | false | true |
f74af70518fb9eab848d5769836ad85621c4c561 | 1,774 | py | Python | py2/Problem008.py | DanielGarrett/ProjectEuler | ca23f4dbfb2a47ea663fb0858630d3e2fb3b9764 | [
"MIT"
] | null | null | null | py2/Problem008.py | DanielGarrett/ProjectEuler | ca23f4dbfb2a47ea663fb0858630d3e2fb3b9764 | [
"MIT"
] | null | null | null | py2/Problem008.py | DanielGarrett/ProjectEuler | ca23f4dbfb2a47ea663fb0858630d3e2fb3b9764 | [
"MIT"
] | null | null | null | import EulerRunner
digits = ('73167176531330624919225119674426574742355349194934'
+ '96983520312774506326239578318016984801869478851843'
+ '85861560789112949495459501737958331952853208805511'
+ '12540698747158523863050715693290963295227443043557'
+ '66896648950445244523161731856403098711121722383113'
+ '62229893423380... | 36.958333 | 62 | 0.73788 | import EulerRunner
digits = ('73167176531330624919225119674426574742355349194934'
+ '96983520312774506326239578318016984801869478851843'
+ '85861560789112949495459501737958331952853208805511'
+ '12540698747158523863050715693290963295227443043557'
+ '66896648950445244523161731856403098711121722383113'
+ '62229893423380... | true | true |
f74af7ee1f2ba08f20273655e630797fa13e7593 | 3,881 | py | Python | src/spiegelib/features/spectral_summarized.py | spiegel-lib/spiegel | 2a0b606a2f9eba22e25ade96ece249b790ca3b23 | [
"MIT"
] | 10 | 2020-11-12T16:11:03.000Z | 2022-02-02T12:18:07.000Z | src/spiegelib/features/spectral_summarized.py | spiegel-lib/spiegel | 2a0b606a2f9eba22e25ade96ece249b790ca3b23 | [
"MIT"
] | 3 | 2020-12-04T01:43:40.000Z | 2021-02-19T17:08:57.000Z | src/spiegelib/features/spectral_summarized.py | spiegel-lib/spiegel | 2a0b606a2f9eba22e25ade96ece249b790ca3b23 | [
"MIT"
] | 3 | 2020-07-04T02:24:15.000Z | 2021-09-08T14:01:36.000Z | #!/usr/bin/env python
"""
Spectral features summarized over time using mean and variance. Returns a 22-dimension
feature vector for each audio sample.
Features:
- Spectral Centroid
- Spectral Bandwidth
- Spectral Contrast (7 frequency bands)
- Spectral Flatness
- Spectral Rolloff
"""
import numpy ... | 32.341667 | 94 | 0.603195 |
import numpy as np
import librosa
from spiegelib import AudioBuffer
from spiegelib.features.features_base import FeaturesBase
class SpectralSummarized(FeaturesBase):
def __init__(self, frame_size=2048, hop_size=512, scale_axis=0, **kwargs):
self.frame_size = frame_size
self.hop_size = hop_size
... | true | true |
f74afa451689493e81b62e4936de3989f3093218 | 7,909 | py | Python | src/sage/structure/graphics_file.py | switzel/sage | 7eb8510dacf61b691664cd8f1d2e75e5d473e5a0 | [
"BSL-1.0"
] | 2 | 2018-06-30T01:37:35.000Z | 2018-06-30T01:37:39.000Z | src/sage/structure/graphics_file.py | switzel/sage | 7eb8510dacf61b691664cd8f1d2e75e5d473e5a0 | [
"BSL-1.0"
] | null | null | null | src/sage/structure/graphics_file.py | switzel/sage | 7eb8510dacf61b691664cd8f1d2e75e5d473e5a0 | [
"BSL-1.0"
] | 1 | 2020-07-24T12:20:37.000Z | 2020-07-24T12:20:37.000Z | # -*- coding: utf-8 -*-
"""
Wrapper for Graphics Files
"""
import os
import six
from sage.misc.temporary_file import tmp_filename
from sage.structure.sage_object import SageObject
import sage.doctest
class Mime(object):
TEXT = u'text/plain'
HTML = u'text/html'
LATEX = u'text/latex'
JSON = u'applicat... | 28.76 | 80 | 0.595398 |
import os
import six
from sage.misc.temporary_file import tmp_filename
from sage.structure.sage_object import SageObject
import sage.doctest
class Mime(object):
TEXT = u'text/plain'
HTML = u'text/html'
LATEX = u'text/latex'
JSON = u'application/json'
JAVASCRIPT = u'application/javascript'
PD... | true | true |
f74afa5a75bece73499bbe9af1f9903872f12e59 | 173 | py | Python | app/api/v1/__init__.py | camisatx/flasker | affc9fc13742e18434961b8ec15f133cc246dcd5 | [
"MIT"
] | 3 | 2020-12-12T01:30:08.000Z | 2021-10-13T16:47:56.000Z | app/api/v1/__init__.py | camisatx/flasker | affc9fc13742e18434961b8ec15f133cc246dcd5 | [
"MIT"
] | null | null | null | app/api/v1/__init__.py | camisatx/flasker | affc9fc13742e18434961b8ec15f133cc246dcd5 | [
"MIT"
] | 1 | 2020-12-12T01:30:13.000Z | 2020-12-12T01:30:13.000Z | from flask import Blueprint
bp = Blueprint('api.v1', __name__)
# NOTE: Add extra blueprint routes to this import list
from app.api.v1 import errors, planes, tokens, users
| 24.714286 | 54 | 0.763006 | from flask import Blueprint
bp = Blueprint('api.v1', __name__)
from app.api.v1 import errors, planes, tokens, users
| true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.