hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 | qsc_code_num_words_quality_signal int64 | qsc_code_num_chars_quality_signal float64 | qsc_code_mean_word_length_quality_signal float64 | qsc_code_frac_words_unique_quality_signal float64 | qsc_code_frac_chars_top_2grams_quality_signal float64 | qsc_code_frac_chars_top_3grams_quality_signal float64 | qsc_code_frac_chars_top_4grams_quality_signal float64 | qsc_code_frac_chars_dupe_5grams_quality_signal float64 | qsc_code_frac_chars_dupe_6grams_quality_signal float64 | qsc_code_frac_chars_dupe_7grams_quality_signal float64 | qsc_code_frac_chars_dupe_8grams_quality_signal float64 | qsc_code_frac_chars_dupe_9grams_quality_signal float64 | qsc_code_frac_chars_dupe_10grams_quality_signal float64 | qsc_code_frac_chars_replacement_symbols_quality_signal float64 | qsc_code_frac_chars_digital_quality_signal float64 | qsc_code_frac_chars_whitespace_quality_signal float64 | qsc_code_size_file_byte_quality_signal float64 | qsc_code_num_lines_quality_signal float64 | qsc_code_num_chars_line_max_quality_signal float64 | qsc_code_num_chars_line_mean_quality_signal float64 | qsc_code_frac_chars_alphabet_quality_signal float64 | qsc_code_frac_chars_comments_quality_signal float64 | qsc_code_cate_xml_start_quality_signal float64 | qsc_code_frac_lines_dupe_lines_quality_signal float64 | qsc_code_cate_autogen_quality_signal float64 | qsc_code_frac_lines_long_string_quality_signal float64 | qsc_code_frac_chars_string_length_quality_signal float64 | qsc_code_frac_chars_long_word_length_quality_signal float64 | qsc_code_frac_lines_string_concat_quality_signal float64 | qsc_code_cate_encoded_data_quality_signal float64 | qsc_code_frac_chars_hex_words_quality_signal float64 | qsc_code_frac_lines_prompt_comments_quality_signal float64 | qsc_code_frac_lines_assert_quality_signal float64 | qsc_codepython_cate_ast_quality_signal float64 | qsc_codepython_frac_lines_func_ratio_quality_signal float64 | qsc_codepython_cate_var_zero_quality_signal bool | qsc_codepython_frac_lines_pass_quality_signal float64 | qsc_codepython_frac_lines_import_quality_signal float64 | qsc_codepython_frac_lines_simplefunc_quality_signal float64 | qsc_codepython_score_lines_no_logic_quality_signal float64 | qsc_codepython_frac_lines_print_quality_signal float64 | qsc_code_num_words int64 | qsc_code_num_chars int64 | qsc_code_mean_word_length int64 | qsc_code_frac_words_unique null | qsc_code_frac_chars_top_2grams int64 | qsc_code_frac_chars_top_3grams int64 | qsc_code_frac_chars_top_4grams int64 | qsc_code_frac_chars_dupe_5grams int64 | qsc_code_frac_chars_dupe_6grams int64 | qsc_code_frac_chars_dupe_7grams int64 | qsc_code_frac_chars_dupe_8grams int64 | qsc_code_frac_chars_dupe_9grams int64 | qsc_code_frac_chars_dupe_10grams int64 | qsc_code_frac_chars_replacement_symbols int64 | qsc_code_frac_chars_digital int64 | qsc_code_frac_chars_whitespace int64 | qsc_code_size_file_byte int64 | qsc_code_num_lines int64 | qsc_code_num_chars_line_max int64 | qsc_code_num_chars_line_mean int64 | qsc_code_frac_chars_alphabet int64 | qsc_code_frac_chars_comments int64 | qsc_code_cate_xml_start int64 | qsc_code_frac_lines_dupe_lines int64 | qsc_code_cate_autogen int64 | qsc_code_frac_lines_long_string int64 | qsc_code_frac_chars_string_length int64 | qsc_code_frac_chars_long_word_length int64 | qsc_code_frac_lines_string_concat null | qsc_code_cate_encoded_data int64 | qsc_code_frac_chars_hex_words int64 | qsc_code_frac_lines_prompt_comments int64 | qsc_code_frac_lines_assert int64 | qsc_codepython_cate_ast int64 | qsc_codepython_frac_lines_func_ratio int64 | qsc_codepython_cate_var_zero int64 | qsc_codepython_frac_lines_pass int64 | qsc_codepython_frac_lines_import int64 | qsc_codepython_frac_lines_simplefunc int64 | qsc_codepython_score_lines_no_logic int64 | qsc_codepython_frac_lines_print int64 | effective string | hits int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0cfce0e7284298e97e65b119e823bf7fa89f4769 | 158 | py | Python | bauh/__init__.py | Flash1232/bauh | 6f65556c05ae272c1dbbd557c7f80a606658eb56 | [
"Zlib"
] | null | null | null | bauh/__init__.py | Flash1232/bauh | 6f65556c05ae272c1dbbd557c7f80a606658eb56 | [
"Zlib"
] | null | null | null | bauh/__init__.py | Flash1232/bauh | 6f65556c05ae272c1dbbd557c7f80a606658eb56 | [
"Zlib"
] | null | null | null | __version__ = '0.9.20'
__app_name__ = 'bauh'
import os
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
LOGS_PATH = '/tmp/{}/logs'.format(__app_name__)
| 22.571429 | 53 | 0.727848 | 25 | 158 | 3.8 | 0.72 | 0.147368 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027972 | 0.094937 | 158 | 6 | 54 | 26.333333 | 0.636364 | 0 | 0 | 0 | 0 | 0 | 0.139241 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
0b550419baab4260832323a74d3c10824de3ed66 | 230 | py | Python | tools/assistant/util/convert.py | StrayDragon/OJ-Solutions | b31b11c01507544aded2302923da080b39cf2ba8 | [
"MIT"
] | 1 | 2019-05-13T10:09:55.000Z | 2019-05-13T10:09:55.000Z | tools/assistant/util/convert.py | StrayDragon/OJ-Solutions | b31b11c01507544aded2302923da080b39cf2ba8 | [
"MIT"
] | null | null | null | tools/assistant/util/convert.py | StrayDragon/OJ-Solutions | b31b11c01507544aded2302923da080b39cf2ba8 | [
"MIT"
] | null | null | null | import re
__first_cap_re = re.compile(r'(.)([A-Z][a-z]+)')
__all_cap_re = re.compile(r'([a-z0-9])([A-Z])')
def camel_to_snake(name):
s1 = __first_cap_re.sub(r'\1_\2', name)
return __all_cap_re.sub(r'\1_\2', s1).lower()
| 23 | 49 | 0.626087 | 47 | 230 | 2.638298 | 0.468085 | 0.16129 | 0.16129 | 0.225806 | 0.435484 | 0.435484 | 0 | 0 | 0 | 0 | 0 | 0.039604 | 0.121739 | 230 | 9 | 50 | 25.555556 | 0.574257 | 0 | 0 | 0 | 0 | 0 | 0.186957 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
0b8954896bcd5fc6c8cafd950aff06bc7efb656f | 2,753 | py | Python | Judge/login_request.py | peeesspee/BitOJ | 0d67a87b71d0c8c8d3df719f1b9e176ec91cfb32 | [
"MIT"
] | 30 | 2019-07-28T18:05:33.000Z | 2021-12-27T10:19:31.000Z | Judge/login_request.py | peeesspee/BitOJ | 0d67a87b71d0c8c8d3df719f1b9e176ec91cfb32 | [
"MIT"
] | 2 | 2019-09-03T19:53:03.000Z | 2019-10-18T11:00:44.000Z | Judge/login_request.py | peeesspee/BitOJ | 0d67a87b71d0c8c8d3df719f1b9e176ec91cfb32 | [
"MIT"
] | 4 | 2019-10-02T04:54:50.000Z | 2020-08-10T13:28:58.000Z | import pika
import json
from init_judge import initialize_judge
class authenticate_judge():
username = 'Nouser'
password = 'Nopass'
judge_id = 'NULL'
channel = ''
login_status = ''
key = initialize_judge.key()
my_ip = initialize_judge.my_ip()
def login(channel, host, username, password):
authenticate_judge.channel = channel
authenticate_judge.username = username
authenticate_judge.password = password
username, password, judge_id = initialize_judge.get_credentials()
if judge_id != 'NULL':
authenticate_judge.judge_id = judge_id
print("\n[ VALIDATNG ] : " + authenticate_judge.username + "@" + authenticate_judge.password )
channel.queue_declare(
queue = authenticate_judge.username,
durable=True
)
authenticate_judge.channel.queue_bind(
exchange = 'connection_manager',
queue = authenticate_judge.username
)
message = {
'Client Key': authenticate_judge.key,
'Code': 'LOGIN',
'Username': authenticate_judge.username,
'Password': authenticate_judge.password,
'ID': authenticate_judge.judge_id,
'Type': 'JUDGE',
'IP' : authenticate_judge.my_ip
}
message = json.dumps(message)
authenticate_judge.channel.basic_publish(
exchange = 'connection_manager',
routing_key = 'client_requests',
body = message
)
print("Request sent for authentication... ")
print("[ LISTENING ]:" + authenticate_judge.username + '@' + authenticate_judge.password )
authenticate_judge.channel.basic_consume(
queue = authenticate_judge.username,
on_message_callback = authenticate_judge.response_handler,
auto_ack = True
)
authenticate_judge.channel.start_consuming()
return authenticate_judge.login_status
def response_handler(ch, method, properties, body):
server_data = body.decode('utf-8')
json_data = json.loads(server_data)
status = json_data['Code']
if( status == 'VALID' ):
print("[STATUS]: " + status )
judge_id = json_data['ID']
authenticate_judge.channel.stop_consuming()
authenticate_judge.login_status = status
initialize_judge.save_details(
authenticate_judge.username,
authenticate_judge.password,
judge_id
)
elif( status == 'INVLD' ):
print("[STATUS] INVALID USER !!!")
authenticate_judge.channel.stop_consuming()
authenticate_judge.channel.queue_delete(
queue = authenticate_judge.username
)
authenticate_judge.login_status = status
elif( status == 'LRJCT'):
authenticate_judge.channel.stop_consuming()
authenticate_judge.channel.queue_delete(
queue = authenticate_judge.username
)
authenticate_judge.login_status = status
def get_judge_details():
return authenticate_judge.judge_id, authenticate_judge.username, authenticate_judge.password
| 26.471154 | 96 | 0.734471 | 306 | 2,753 | 6.316993 | 0.264706 | 0.334196 | 0.155199 | 0.114847 | 0.280911 | 0.272116 | 0.16865 | 0.140714 | 0.140714 | 0.140714 | 0 | 0.000433 | 0.160915 | 2,753 | 103 | 97 | 26.728155 | 0.836364 | 0 | 0 | 0.1875 | 0 | 0 | 0.09048 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0375 | false | 0.1125 | 0.0375 | 0.0125 | 0.2 | 0.0625 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
0b89b443538d634b1c81de46db2997d31dc472c2 | 901 | py | Python | MHD/FEniCS/DriverFiles/TimeConvergence.py | wathen/PhD | 35524f40028541a4d611d8c78574e4cf9ddc3278 | [
"MIT"
] | 3 | 2020-10-25T13:30:20.000Z | 2021-08-10T21:27:30.000Z | MHD/FEniCS/DriverFiles/TimeConvergence.py | wathen/PhD | 35524f40028541a4d611d8c78574e4cf9ddc3278 | [
"MIT"
] | null | null | null | MHD/FEniCS/DriverFiles/TimeConvergence.py | wathen/PhD | 35524f40028541a4d611d8c78574e4cf9ddc3278 | [
"MIT"
] | 3 | 2019-10-28T16:12:13.000Z | 2020-01-13T13:59:44.000Z | from Maxwell import *
from dolfin import *
from numpy import *
import scipy as Sci
import scipy.linalg
from math import pi,sin,cos,sqrt
import scipy.sparse as sps
import scipy.io as save
import scipy
import pdb
from matrix2latex import *
print "FEniCS routine to solve Maxwell subproblem \n \n"
Mcycle = 10
n = 2
time = zeros((Mcycle,1))
N = zeros((Mcycle,1))
DoF = zeros((Mcycle,1))
cycle = zeros((Mcycle,1))
table = zeros((Mcycle,4))
for j in xrange(1,Mcycle+1):
print "cycle #",j-1,"\n"
n = 2*n
M = Maxwell(n)
mesh = M.mesh
N[j-1,0] = n
tic()
V,u,v= M.CreateTrialTestFuncs(mesh)
time[j-1,0] = toc()
u0 = Expression(('0','0'))
f=Expression(("2+x[1]*(1-x[1])","2+x[0]*(1-x[0])"))
A,b = M.AssembleSystem(V,u,v,f,u0,1,"PETSc")
DoF[j-1,0] = b.size()
cycle[j-1,0] = j-1
table[j-1,:] = [j-1,n,b.size(),time[j-1,0]]
print matrix2latex(table)
| 20.953488 | 56 | 0.613762 | 167 | 901 | 3.311377 | 0.347305 | 0.03255 | 0.027125 | 0.025316 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.055096 | 0.194229 | 901 | 42 | 57 | 21.452381 | 0.706612 | 0 | 0 | 0 | 0 | 0 | 0.104444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.314286 | null | null | 0.085714 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
0bc2d4ca6df5e53032100fb73ebc922e6c388a4e | 1,027 | py | Python | type_checker/terms.py | artfadeev/lambda-typechecker | 39c0853e32d07149b578c9f938aa9e0c4bb7592c | [
"MIT"
] | null | null | null | type_checker/terms.py | artfadeev/lambda-typechecker | 39c0853e32d07149b578c9f938aa9e0c4bb7592c | [
"MIT"
] | null | null | null | type_checker/terms.py | artfadeev/lambda-typechecker | 39c0853e32d07149b578c9f938aa9e0c4bb7592c | [
"MIT"
] | null | null | null | from dataclasses import dataclass
from .types import Type, Base, Implication, Context
class TypedTerm:
"""Typed term base class"""
@dataclass
class Variable(TypedTerm):
"""Class for typed term consisting of just variable"""
name: str
def __str__(self):
return self.name
@dataclass
class Abstraction(TypedTerm):
"""Class for abstraction typed terms
Example: Abstraction("x", Base("a"), Variable("x")) corresponds to
identity function of type a: 'lambda x:a. x'"""
variable_name: str
variable_type: Type
inner_term: TypedTerm
def __str__(self):
return (
f"(lambda {self.variable_name}:"
+ f"{self.variable_type}.{self.inner_term})"
)
@dataclass
class Application(TypedTerm):
"""Class for application typed terms
Example: Application(Variable("x"), Variable("y")) corresponds to term
'x y'"""
left: TypedTerm
right: TypedTerm
def __str__(self):
return f"({self.left} {self.right})"
| 20.959184 | 74 | 0.644596 | 122 | 1,027 | 5.278689 | 0.319672 | 0.065217 | 0.079193 | 0.074534 | 0.080745 | 0.080745 | 0 | 0 | 0 | 0 | 0 | 0 | 0.237585 | 1,027 | 48 | 75 | 21.395833 | 0.822478 | 0.32814 | 0 | 0.25 | 0 | 0 | 0.143951 | 0.091884 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.083333 | 0.125 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
e7eabbbf0204c2c8086e40bcd2f1a41c077436a3 | 707 | py | Python | Website/Ogre/points/APIcalls.py | pringyy/OGRE | 26bd1bc06e1d14129b8922da8c9bb7f21b7ec457 | [
"MIT"
] | null | null | null | Website/Ogre/points/APIcalls.py | pringyy/OGRE | 26bd1bc06e1d14129b8922da8c9bb7f21b7ec457 | [
"MIT"
] | null | null | null | Website/Ogre/points/APIcalls.py | pringyy/OGRE | 26bd1bc06e1d14129b8922da8c9bb7f21b7ec457 | [
"MIT"
] | null | null | null | #HERE IS WHERE YOU CHANGE THE URL TO YOUR MOODLE SERVER
#MAKE SURE ALL THE PHP FILES ARE IN THE API FOLDER FOR THIS TO WORK
#CAN CHANGE THE API KEY HERE AS WELL
loginAPIcall = 'http://157.245.126.159/api/login.php'
getPointsAPIcall = 'http://157.245.126.159/api/get_user_points.php'
removePointsAPIcall = 'http://157.245.126.159/api/cut_user_points.php'
transactionsAPIcall = 'http://157.245.126.159/api/get_user_pointlist.php'
changeNicknameAPIcall = 'http://157.245.126.159/api/getnickname.php'
leaderboardAPIcall = 'http://157.245.126.159/api/get_leaderboard.php'
changeAvatarAPIcall = 'http://157.245.126.159/api/changeavatar.php'
APIkeys = ')ma#e*lz)m*881ghgwgkc&vodfodfdopvjdqp9vb_4pdohndpw2o8g2hf=s' | 58.916667 | 73 | 0.780764 | 113 | 707 | 4.814159 | 0.504425 | 0.090074 | 0.128676 | 0.167279 | 0.275735 | 0.275735 | 0.136029 | 0.095588 | 0 | 0 | 0 | 0.141757 | 0.082037 | 707 | 12 | 74 | 58.916667 | 0.696456 | 0.219236 | 0 | 0 | 0 | 0 | 0.667273 | 0.107273 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e7eb36b389b372af118d72bb23e60b8d803e6c77 | 18,755 | py | Python | pysnmp-with-texts/DELL-NETWORKING-FIB-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 8 | 2019-05-09T17:04:00.000Z | 2021-06-09T06:50:51.000Z | pysnmp-with-texts/DELL-NETWORKING-FIB-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 4 | 2019-05-31T16:42:59.000Z | 2020-01-31T21:57:17.000Z | pysnmp-with-texts/DELL-NETWORKING-FIB-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module DELL-NETWORKING-FIB-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DELL-NETWORKING-FIB-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:37:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion")
dellNetMgmt, = mibBuilder.importSymbols("DELL-NETWORKING-SMI", "dellNetMgmt")
InterfaceIndexOrZero, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndexOrZero")
InetAddressPrefixLength, InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressPrefixLength", "InetAddress", "InetAddressType")
ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup")
MibIdentifier, TimeTicks, Integer32, Counter64, iso, Unsigned32, Gauge32, ModuleIdentity, Bits, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, IpAddress, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "TimeTicks", "Integer32", "Counter64", "iso", "Unsigned32", "Gauge32", "ModuleIdentity", "Bits", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "IpAddress", "Counter32")
TextualConvention, MacAddress, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "MacAddress", "DisplayString")
dellNetIpForwardMib = ModuleIdentity((1, 3, 6, 1, 4, 1, 6027, 3, 9))
dellNetIpForwardMib.setRevisions(('2011-07-08 12:00', '2007-09-14 12:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: dellNetIpForwardMib.setRevisionsDescriptions(('This version of MIB module deprecates the dellNetIpForwardTable and replaces it with dellNetInetCidrRouteTable which adds the IP Protocol Independance ', 'Initial version of this MIB module.',))
if mibBuilder.loadTexts: dellNetIpForwardMib.setLastUpdated('200709141200Z')
if mibBuilder.loadTexts: dellNetIpForwardMib.setOrganization('Dell Inc')
if mibBuilder.loadTexts: dellNetIpForwardMib.setContactInfo('http://www.dell.com/support')
if mibBuilder.loadTexts: dellNetIpForwardMib.setDescription('This MIB module is used to display CIDR multipath IP Routes.')
dellNetIpForwardMibObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1))
dellNetIpForwardMibConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 6027, 3, 9, 2))
dellNetIpForwardVariable = MibIdentifier((1, 3, 6, 1, 4, 1, 6027, 3, 9, 3))
chSysCardNumber = MibScalar((1, 3, 6, 1, 4, 1, 6027, 3, 9, 3, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chSysCardNumber.setStatus('current')
if mibBuilder.loadTexts: chSysCardNumber.setDescription('This is the card number assigned to the line cards and the RPM cards in the chassis. The line cards number are from 0 to 13 and the RPM are from 0 to 1.')
dellNetIpForwardVersionTable = MibTable((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 1), )
if mibBuilder.loadTexts: dellNetIpForwardVersionTable.setStatus('current')
if mibBuilder.loadTexts: dellNetIpForwardVersionTable.setDescription("This entity's IP forward version table.")
dellNetIpForwardVersionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 1, 1), ).setIndexNames((0, "DELL-NETWORKING-FIB-MIB", "chSysCardNumber"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetIpForwardAddrFamily"))
if mibBuilder.loadTexts: dellNetIpForwardVersionEntry.setStatus('current')
if mibBuilder.loadTexts: dellNetIpForwardVersionEntry.setDescription('The row definition for the ip forward version Table.')
dellNetIpForwardAddrFamily = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 1, 1, 1), InetAddressType())
if mibBuilder.loadTexts: dellNetIpForwardAddrFamily.setStatus('current')
if mibBuilder.loadTexts: dellNetIpForwardAddrFamily.setDescription('Address Family of the IP Forwarding Table for which this entry provides the Version information. ')
dellNetIpForwardVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 1, 1, 2), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellNetIpForwardVersion.setStatus('current')
if mibBuilder.loadTexts: dellNetIpForwardVersion.setDescription('A version number on the Forwarding Table. This is always fetched from one line card.')
dellNetIpForwardTable = MibTable((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2), )
if mibBuilder.loadTexts: dellNetIpForwardTable.setStatus('deprecated')
if mibBuilder.loadTexts: dellNetIpForwardTable.setDescription("This entity's IP Routing table.")
dellNetIpForwardEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1), ).setIndexNames((0, "DELL-NETWORKING-FIB-MIB", "chSysCardNumber"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetIpforwardDest"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetIpforwardMask"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetIpforwardNextHop"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetIpforwardFirstHop"))
if mibBuilder.loadTexts: dellNetIpForwardEntry.setStatus('deprecated')
if mibBuilder.loadTexts: dellNetIpForwardEntry.setDescription('A particular route to a particular destination, under a particular policy.')
dellNetIpforwardDest = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 1), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellNetIpforwardDest.setStatus('deprecated')
if mibBuilder.loadTexts: dellNetIpforwardDest.setDescription('The destination IP address of this route. An entry with a value of 0.0.0.0 is considered a default route.')
dellNetIpforwardMask = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 2), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellNetIpforwardMask.setStatus('deprecated')
if mibBuilder.loadTexts: dellNetIpforwardMask.setDescription('Indicate the mask to be logical-ANDed with the destination address before being compared to the value in the dellNetIpforwardDest field.')
dellNetIpforwardNextHop = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 3), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellNetIpforwardNextHop.setStatus('deprecated')
if mibBuilder.loadTexts: dellNetIpforwardNextHop.setDescription('On remote routes, the address of the next system en route; Otherwise, 0.0.0.0.')
dellNetIpforwardFirstHop = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 4), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellNetIpforwardFirstHop.setStatus('deprecated')
if mibBuilder.loadTexts: dellNetIpforwardFirstHop.setDescription('On remote routes, the address of the Gateway to the nexthop; 0.0.0.0 if the Nexthop itself is a Gateway to the Destination')
dellNetIpforwardIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellNetIpforwardIfIndex.setStatus('deprecated')
if mibBuilder.loadTexts: dellNetIpforwardIfIndex.setDescription('The ifIndex value which identifies the local interface through which the next hop of this route should be reached.')
dellNetIpforwardMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 6), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellNetIpforwardMacAddress.setStatus('deprecated')
if mibBuilder.loadTexts: dellNetIpforwardMacAddress.setDescription('The Mac address of the NextHop.')
dellNetIpforwardEgressPort = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellNetIpforwardEgressPort.setStatus('deprecated')
if mibBuilder.loadTexts: dellNetIpforwardEgressPort.setDescription('The name of the egress port to which the packets will be forwarded.')
dellNetIpforwardCamIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellNetIpforwardCamIndex.setStatus('deprecated')
if mibBuilder.loadTexts: dellNetIpforwardCamIndex.setDescription('Cam Entry corresponding to a row.')
dellNetInetCidrIpv4RouteNumber = MibScalar((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 3), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellNetInetCidrIpv4RouteNumber.setStatus('current')
if mibBuilder.loadTexts: dellNetInetCidrIpv4RouteNumber.setDescription('The number of current dellNetInetCidrRouteTable entries that are not Invalid and whose dellNetInetCidrRouteDestType is ipv4(1)')
dellNetInetCidrIpv6RouteNumber = MibScalar((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 4), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellNetInetCidrIpv6RouteNumber.setStatus('current')
if mibBuilder.loadTexts: dellNetInetCidrIpv6RouteNumber.setDescription('The number of current dellNetInetCidrRouteTable entries that are not Invalid and whose dellNetInetCidrRouteDestType is ipv6(2)')
dellNetInetCidrRouteTable = MibTable((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5), )
if mibBuilder.loadTexts: dellNetInetCidrRouteTable.setStatus('current')
if mibBuilder.loadTexts: dellNetInetCidrRouteTable.setDescription("This entity's IP Routing table.")
dellNetInetCidrRouteTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1), ).setIndexNames((0, "DELL-NETWORKING-FIB-MIB", "chSysCardNumber"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteDestType"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteDest"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRoutePfxLen"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteNextHopType"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteNextHop"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteFirstHopType"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteFirstHop"))
if mibBuilder.loadTexts: dellNetInetCidrRouteTableEntry.setStatus('current')
if mibBuilder.loadTexts: dellNetInetCidrRouteTableEntry.setDescription('A particular route to a particular destination Implementers need to be aware that if the total number of elements (octets or sub-identifiers) in inetCidrRouteDest, inetCidrRoutePolicy, and inetCidrRouteNextHop exceeds 111, then OIDs of column instances in this table will have more than 128 sub- identifiers and cannot be accessed using SNMPv1, SNMPv2c, or SNMPv3. For S-Series Platform, Value of chSysCardNumber will always be zero')
dellNetInetCidrRouteDestType = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 1), InetAddressType())
if mibBuilder.loadTexts: dellNetInetCidrRouteDestType.setStatus('current')
if mibBuilder.loadTexts: dellNetInetCidrRouteDestType.setDescription('The type of the inetCidrRouteDest address, as defined in the InetAddress MIB. Only those address types that may appear in an actual routing table are allowed as values of this object.')
dellNetInetCidrRouteDest = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 2), InetAddress())
if mibBuilder.loadTexts: dellNetInetCidrRouteDest.setStatus('current')
if mibBuilder.loadTexts: dellNetInetCidrRouteDest.setDescription('The destination IP address of this route. The type of this address is determined by the value of the inetCidrRouteDestType object.')
dellNetInetCidrRoutePfxLen = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 3), InetAddressPrefixLength())
if mibBuilder.loadTexts: dellNetInetCidrRoutePfxLen.setStatus('current')
if mibBuilder.loadTexts: dellNetInetCidrRoutePfxLen.setDescription('Indicates the number of leading one bits that form the mask to be logical-ANDed with the destination address before being compared to the value in the inetCidrRouteDest field.')
dellNetInetCidrRouteNextHopType = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 4), InetAddressType())
if mibBuilder.loadTexts: dellNetInetCidrRouteNextHopType.setStatus('current')
if mibBuilder.loadTexts: dellNetInetCidrRouteNextHopType.setDescription('The type of the inetCidrRouteNextHop address, as defined in the InetAddress MIB. Value should be set to unknown(0) for non-remote routes. Only those address types that may appear in an actual routing table are allowed as values of this object.')
dellNetInetCidrRouteNextHop = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 5), InetAddress())
if mibBuilder.loadTexts: dellNetInetCidrRouteNextHop.setStatus('current')
if mibBuilder.loadTexts: dellNetInetCidrRouteNextHop.setDescription('On remote routes, the address of the next system en route. For non-remote routes, a zero length string. The type of this address is determined by the value of the inetCidrRouteNextHopType object.')
dellNetInetCidrRouteFirstHopType = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 6), InetAddressType())
if mibBuilder.loadTexts: dellNetInetCidrRouteFirstHopType.setStatus('current')
if mibBuilder.loadTexts: dellNetInetCidrRouteFirstHopType.setDescription('The type of the inetCidrRouteFirstHop address, as defined in the InetAddress MIB. Value should be set to unknown(0) for non-remote routes. Only those address types that may appear in an actual routing table are allowed as values of this object.')
dellNetInetCidrRouteFirstHop = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 7), InetAddress())
if mibBuilder.loadTexts: dellNetInetCidrRouteFirstHop.setStatus('current')
if mibBuilder.loadTexts: dellNetInetCidrRouteFirstHop.setDescription('The address of the gateway to the Nexthop. If the nexthop itself is the gateway, a zero length string. The type of this address is determined by the value of the inetCidrRouteFirstHopType object.')
dellNetInetCidrRouteIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 8), InterfaceIndexOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellNetInetCidrRouteIfIndex.setStatus('current')
if mibBuilder.loadTexts: dellNetInetCidrRouteIfIndex.setDescription('The ifIndex value that identifies the local interface through which the next hop of this route should be reached. A value of 0 is valid and represents the scenario where no interface is specified.')
dellNetInetCidrRouteMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 9), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellNetInetCidrRouteMacAddress.setStatus('current')
if mibBuilder.loadTexts: dellNetInetCidrRouteMacAddress.setDescription('The Mac address of the NextHop.')
dellNetInetCidrRouteEgressPort = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 10), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellNetInetCidrRouteEgressPort.setStatus('current')
if mibBuilder.loadTexts: dellNetInetCidrRouteEgressPort.setDescription('The name of the egress port to which the packets will be forwarded.')
dellNetInetCidrRouteCamIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 11), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellNetInetCidrRouteCamIndex.setStatus('current')
if mibBuilder.loadTexts: dellNetInetCidrRouteCamIndex.setDescription('Cam Entry corresponding to a row.')
dellNetIpForwardMibCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 6027, 3, 9, 2, 1))
dellNetIpForwardMibGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 6027, 3, 9, 2, 2))
dellNetIpForwardMibCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 6027, 3, 9, 2, 1, 1)).setObjects(("DELL-NETWORKING-FIB-MIB", "dellNetIpForwardObjectGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
dellNetIpForwardMibCompliance = dellNetIpForwardMibCompliance.setStatus('current')
if mibBuilder.loadTexts: dellNetIpForwardMibCompliance.setDescription('The basic implementation requirements for the Dell Networking OS Ip Forward MIB.')
dellNetIpForwardObjectGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 6027, 3, 9, 2, 2, 1)).setObjects(("DELL-NETWORKING-FIB-MIB", "dellNetIpForwardVersion"), ("DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteIfIndex"), ("DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteMacAddress"), ("DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteEgressPort"), ("DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteCamIndex"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
dellNetIpForwardObjectGroup = dellNetIpForwardObjectGroup.setStatus('current')
if mibBuilder.loadTexts: dellNetIpForwardObjectGroup.setDescription('Objects for the IP aware Route Table.')
mibBuilder.exportSymbols("DELL-NETWORKING-FIB-MIB", dellNetIpForwardMibGroups=dellNetIpForwardMibGroups, dellNetIpForwardEntry=dellNetIpForwardEntry, dellNetIpforwardDest=dellNetIpforwardDest, dellNetIpForwardObjectGroup=dellNetIpForwardObjectGroup, dellNetIpforwardCamIndex=dellNetIpforwardCamIndex, dellNetInetCidrIpv4RouteNumber=dellNetInetCidrIpv4RouteNumber, dellNetIpForwardMib=dellNetIpForwardMib, dellNetIpForwardMibCompliance=dellNetIpForwardMibCompliance, dellNetInetCidrRouteNextHopType=dellNetInetCidrRouteNextHopType, dellNetInetCidrRouteTableEntry=dellNetInetCidrRouteTableEntry, dellNetIpforwardIfIndex=dellNetIpforwardIfIndex, dellNetIpForwardVersionEntry=dellNetIpForwardVersionEntry, dellNetInetCidrRouteIfIndex=dellNetInetCidrRouteIfIndex, dellNetInetCidrRouteFirstHop=dellNetInetCidrRouteFirstHop, dellNetIpforwardEgressPort=dellNetIpforwardEgressPort, PYSNMP_MODULE_ID=dellNetIpForwardMib, dellNetIpForwardTable=dellNetIpForwardTable, dellNetInetCidrRouteEgressPort=dellNetInetCidrRouteEgressPort, dellNetInetCidrRouteCamIndex=dellNetInetCidrRouteCamIndex, dellNetInetCidrIpv6RouteNumber=dellNetInetCidrIpv6RouteNumber, chSysCardNumber=chSysCardNumber, dellNetInetCidrRouteTable=dellNetInetCidrRouteTable, dellNetIpForwardVersion=dellNetIpForwardVersion, dellNetInetCidrRouteNextHop=dellNetInetCidrRouteNextHop, dellNetInetCidrRouteMacAddress=dellNetInetCidrRouteMacAddress, dellNetIpforwardNextHop=dellNetIpforwardNextHop, dellNetIpForwardMibObjects=dellNetIpForwardMibObjects, dellNetIpforwardFirstHop=dellNetIpforwardFirstHop, dellNetInetCidrRouteFirstHopType=dellNetInetCidrRouteFirstHopType, dellNetInetCidrRouteDestType=dellNetInetCidrRouteDestType, dellNetInetCidrRouteDest=dellNetInetCidrRouteDest, dellNetIpForwardMibCompliances=dellNetIpForwardMibCompliances, dellNetIpForwardVariable=dellNetIpForwardVariable, dellNetIpforwardMacAddress=dellNetIpforwardMacAddress, dellNetInetCidrRoutePfxLen=dellNetInetCidrRoutePfxLen, dellNetIpForwardAddrFamily=dellNetIpForwardAddrFamily, dellNetIpforwardMask=dellNetIpforwardMask, dellNetIpForwardVersionTable=dellNetIpForwardVersionTable, dellNetIpForwardMibConformance=dellNetIpForwardMibConformance)
| 143.167939 | 2,171 | 0.802559 | 2,087 | 18,755 | 7.211308 | 0.160517 | 0.053422 | 0.093488 | 0.0101 | 0.421528 | 0.297342 | 0.251894 | 0.233754 | 0.213821 | 0.213023 | 0 | 0.04554 | 0.089096 | 18,755 | 130 | 2,172 | 144.269231 | 0.835402 | 0.018129 | 0 | 0.024793 | 0 | 0.115702 | 0.330055 | 0.067913 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.07438 | 0 | 0.07438 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f00173e053f38dc1ed850f3e87e0d7dd659d3cc7 | 1,395 | py | Python | yeast/core/media/sd/sdszappanos.py | irahorecka/sga-fba | fc7e923da8e79555780359f018c85b5e5339d8d0 | [
"MIT"
] | null | null | null | yeast/core/media/sd/sdszappanos.py | irahorecka/sga-fba | fc7e923da8e79555780359f018c85b5e5339d8d0 | [
"MIT"
] | null | null | null | yeast/core/media/sd/sdszappanos.py | irahorecka/sga-fba | fc7e923da8e79555780359f018c85b5e5339d8d0 | [
"MIT"
] | null | null | null | """
Defines upper bounds of in silico SD media used by Szappanos et al., 2011
"""
from yeast.core.media.constants import reagents
from yeast.core.media.sd.base import sd
szappanos = {
reagents["oxygen"]: 6.3,
reagents["sulphite"]: 100.0,
reagents["phosphate"]: 0.89,
# Carbon
reagents["D-glucose"]: 22.6,
# AA
reagents["L-alanine"]: 0.36,
reagents["L-asparagine"]: 0.36,
reagents["L-aspartate"]: 0.36,
reagents["L-cysteine"]: 0.36,
reagents["L-glutamate"]: 3.6,
reagents["L-glutamine"]: 0.36,
reagents["L-glycine"]: 0.36,
reagents["L-isoleucine"]: 0.36,
reagents["L-leucine"]: 1.8,
reagents["L-methionine"]: 0.36,
reagents["L-phenylalanine"]: 0.36,
reagents["L-proline"]: 0.36,
reagents["L-serine"]: 0.36,
reagents["L-threonine"]: 0.36,
reagents["L-tryptophan"]: 0.36,
reagents["L-tyrosine"]: 0.36,
reagents["L-valine"]: 0.36,
reagents["potassium"]: 4.44,
reagents["sodium"]: 0.75,
reagents["biotin"]: 0.00000142,
reagents["choline"]: 0.00437,
reagents["riboflavin"]: 0.00092,
reagents["thiamine(1+)"]: 0.0032,
reagents["myo-inositol"]: 0.11,
reagents["nicotinate"]: 0.000002,
reagents["4-aminobenzoate"]: 0.000002,
reagents["(R)-pantothenate"]: 0.0002,
# NT
reagents["uracil"]: 3.63,
reagents["adenine"]: 3.01,
}
sdszappanos = {**sd, **szappanos}
| 29.0625 | 73 | 0.615054 | 190 | 1,395 | 4.515789 | 0.436842 | 0.178322 | 0.192308 | 0.195804 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111014 | 0.179928 | 1,395 | 47 | 74 | 29.680851 | 0.638986 | 0.062366 | 0 | 0 | 0 | 0 | 0.251926 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.052632 | 0 | 0.052632 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f013c8b0aaa571837c07098230bfc38d6adc0e43 | 477 | py | Python | source/algorithms/RawDistanceEmbedder.py | elangovana/kegg-pathway-extractor | 08e9a28199bb4454e2e1a09c5d833f243f6f5768 | [
"MIT"
] | 10 | 2019-12-17T01:17:06.000Z | 2022-02-25T22:08:09.000Z | source/algorithms/RawDistanceEmbedder.py | elangovana/kegg-pathway-extractor | 08e9a28199bb4454e2e1a09c5d833f243f6f5768 | [
"MIT"
] | 2 | 2021-03-31T18:40:32.000Z | 2021-12-13T20:15:20.000Z | source/algorithms/RawDistanceEmbedder.py | elangovana/kegg-pathway-extractor | 08e9a28199bb4454e2e1a09c5d833f243f6f5768 | [
"MIT"
] | 2 | 2020-08-25T19:31:33.000Z | 2021-11-11T15:15:02.000Z | import logging
import torch
from algorithms.BaseDistanceEmbedder import BaseDistanceEmbedder
class RawDistanceEmbedder(BaseDistanceEmbedder):
"""
Returns the distance as is for embedding
"""
def __init__(self, max_pos=5):
self.max_pos = max_pos
def logger(self):
return logging.getLogger(__name__)
def __call__(self):
position_enc = torch.tensor([[i for i in range(self.max_pos + 1)]]).float()
return position_enc
| 21.681818 | 83 | 0.69392 | 57 | 477 | 5.491228 | 0.596491 | 0.076677 | 0.095847 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005376 | 0.220126 | 477 | 21 | 84 | 22.714286 | 0.836022 | 0.083857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.272727 | 0.090909 | 0.818182 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
f01ae90fb82cf78cc694ca0cae31f891238f9f81 | 823 | py | Python | Problem4_11/largest_palindrome.py | Vaibhavi1707/Project-Euler | 3f625c69e4289fb9f09a4d4ef3b2618ebf4c2777 | [
"MIT"
] | 2 | 2021-05-29T16:59:30.000Z | 2021-11-26T17:30:33.000Z | Problem4_11/largest_palindrome.py | shubhii0206/Project-Euler | 4e1efb7bb784a6267e723d2a9056836d9a0610c7 | [
"MIT"
] | null | null | null | Problem4_11/largest_palindrome.py | shubhii0206/Project-Euler | 4e1efb7bb784a6267e723d2a9056836d9a0610c7 | [
"MIT"
] | 5 | 2021-05-19T13:16:21.000Z | 2021-05-21T11:48:20.000Z | import math
def upper_limit(n):
return int(math.pow(10, n) - 1)
def lower_limit(n):
return int(1 + (upper_limit(n) / 10))
def reverse(num):
rev = 0
while num > 0:
dig = num % 10
rev = rev * 10 + dig
num = num // 10
return rev
def isPalindrome(num):
return num == reverse(num)
def largest_palindrome(n):
start = lower_limit(n)
end = upper_limit(n)
max_product = 0
for i in range(end, start - 1, -1):
for j in range(i, start - 1, -1):
product = i * j
if product < max_product:
break
elif isPalindrome(product) and product > max_product:
max_product = product
return max_product
def problem4():
return largest_palindrome(3) | 19.595238 | 66 | 0.532199 | 109 | 823 | 3.908257 | 0.330275 | 0.070423 | 0.077465 | 0.070423 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040541 | 0.370595 | 823 | 42 | 67 | 19.595238 | 0.781853 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.035714 | 0.142857 | 0.464286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
f01d8350243dea8a3a51e5bbeb0be25008609705 | 198 | py | Python | src/p2.py | alexandru-dinu/project-euler | 10afd9e204203dd8d5c827b33659a5a2b3090532 | [
"MIT"
] | null | null | null | src/p2.py | alexandru-dinu/project-euler | 10afd9e204203dd8d5c827b33659a5a2b3090532 | [
"MIT"
] | 3 | 2021-10-13T19:26:01.000Z | 2021-10-13T22:18:23.000Z | src/p2.py | alexandru-dinu/project-euler | 10afd9e204203dd8d5c827b33659a5a2b3090532 | [
"MIT"
] | null | null | null | def fib(n):
f1 = 1
f2 = 2
s = 2
while f2 < n:
nxt = f1 + f2
f1 = f2
f2 = nxt
if nxt & 1 == 0:
s += nxt
return s
print(fib(4000000))
| 13.2 | 24 | 0.363636 | 30 | 198 | 2.4 | 0.5 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.212766 | 0.525253 | 198 | 14 | 25 | 14.142857 | 0.553191 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0 | 0 | 0.166667 | 0.083333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f022d23611ccec3e9975aa2d5b75d05e14122c57 | 1,227 | py | Python | winrm/exceptions.py | Ferenc-/pywinrm | 9fe56fd0d7fc71c47b39bbadfe48d1bd7b35abd5 | [
"MIT"
] | 887 | 2015-01-02T09:32:28.000Z | 2022-03-30T17:39:07.000Z | winrm/exceptions.py | Ferenc-/pywinrm | 9fe56fd0d7fc71c47b39bbadfe48d1bd7b35abd5 | [
"MIT"
] | 297 | 2015-01-05T18:08:34.000Z | 2022-03-23T17:47:14.000Z | winrm/exceptions.py | Ferenc-/pywinrm | 9fe56fd0d7fc71c47b39bbadfe48d1bd7b35abd5 | [
"MIT"
] | 253 | 2015-01-06T16:56:55.000Z | 2022-03-26T21:54:31.000Z | from __future__ import unicode_literals
class WinRMError(Exception):
""""Generic WinRM error"""
code = 500
class WinRMTransportError(Exception):
"""WinRM errors specific to transport-level problems (unexpected HTTP error codes, etc)"""
@property
def protocol(self):
return self.args[0]
@property
def code(self):
return self.args[1]
@property
def message(self):
return 'Bad HTTP response returned from server. Code {0}'.format(self.code)
@property
def response_text(self):
return self.args[2]
def __str__(self):
return self.message
class WinRMOperationTimeoutError(Exception):
"""
Raised when a WinRM-level operation timeout (not a connection-level timeout) has occurred. This is
considered a normal error that should be retried transparently by the client when waiting for output from
a long-running process.
"""
code = 500
class AuthenticationError(WinRMError):
"""Authorization Error"""
code = 401
class BasicAuthDisabledError(AuthenticationError):
message = 'WinRM/HTTP Basic authentication is not enabled on remote host'
class InvalidCredentialsError(AuthenticationError):
pass
| 23.596154 | 109 | 0.703341 | 142 | 1,227 | 6.007042 | 0.570423 | 0.058617 | 0.065651 | 0.063306 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013514 | 0.215974 | 1,227 | 51 | 110 | 24.058824 | 0.873181 | 0.288509 | 0 | 0.230769 | 0 | 0 | 0.130695 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.192308 | false | 0.038462 | 0.038462 | 0.192308 | 0.807692 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
f0258b1bd41ac291b891968e99f5e907dc4ff6d0 | 457 | py | Python | mnistetude/lossfunc/sum_square_error.py | aram-father/mnist-etude | 3f9196a7ae3447c3412507896c3dc3ae81f9d7d0 | [
"BSD-2-Clause"
] | null | null | null | mnistetude/lossfunc/sum_square_error.py | aram-father/mnist-etude | 3f9196a7ae3447c3412507896c3dc3ae81f9d7d0 | [
"BSD-2-Clause"
] | 1 | 2022-03-18T03:14:13.000Z | 2022-03-18T03:14:13.000Z | mnistetude/lossfunc/sum_square_error.py | aram-father/mnist-etude | 3f9196a7ae3447c3412507896c3dc3ae81f9d7d0 | [
"BSD-2-Clause"
] | null | null | null | import numpy as np
from . import ilossfunc
class SumSquareError(ilossfunc.ILossFunc):
def __init__(self):
pass
def get_loss(self, prediction: np.array, label: np.array) -> np.array:
if prediction.ndim == 1:
prediction = prediction.reshape(1, prediction.size)
label = label.reshape(1, label.size)
batch_size = prediction.shape[0]
return 0.5 * np.sum((prediction - label) ** 2) / batch_size
| 28.5625 | 74 | 0.63895 | 58 | 457 | 4.913793 | 0.5 | 0.073684 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020408 | 0.249453 | 457 | 15 | 75 | 30.466667 | 0.810496 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0.090909 | 0.181818 | 0 | 0.545455 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
f025e7bc556a18f6fd61b5e4c0a4185bbd6b9ebb | 303 | py | Python | waller.py | yangzhiwei256/new-walle-web | b8f4e665c3e4ad4c0430075efc4628d8427c0397 | [
"Apache-2.0"
] | null | null | null | waller.py | yangzhiwei256/new-walle-web | b8f4e665c3e4ad4c0430075efc4628d8427c0397 | [
"Apache-2.0"
] | 1 | 2022-02-13T18:44:00.000Z | 2022-02-13T18:44:00.000Z | waller.py | yangzhiwei256/new-walle-web | b8f4e665c3e4ad4c0430075efc4628d8427c0397 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""Create an application instance."""
import sys
import os
from flask.helpers import get_debug_flag
from walle.app import create_app
from walle.config import envrionment
# 创建Flask APP
configName = os.getenv('FLASK_CONFIG') or 'default'
app = create_app(envrionment[configName])
| 25.25 | 51 | 0.768977 | 43 | 303 | 5.302326 | 0.581395 | 0.078947 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003759 | 0.122112 | 303 | 11 | 52 | 27.545455 | 0.853383 | 0.217822 | 0 | 0 | 0 | 0 | 0.082609 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.714286 | 0 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
f037a60b2194daaf5b8b91440ba86a88b9ff6db1 | 551 | py | Python | Project_2/pipelines/stemming_pipeline.py | TitoGrine/IART_Project | a387cface38473fa90e132207847887b43a69cec | [
"MIT"
] | null | null | null | Project_2/pipelines/stemming_pipeline.py | TitoGrine/IART_Project | a387cface38473fa90e132207847887b43a69cec | [
"MIT"
] | null | null | null | Project_2/pipelines/stemming_pipeline.py | TitoGrine/IART_Project | a387cface38473fa90e132207847887b43a69cec | [
"MIT"
] | null | null | null | from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.pipeline import make_pipeline
from preprocessors.stemming import Stemming
from preprocessors.tokenizer import Tokenizer
from preprocessors.utils import fit
def stemming_pipeline(x, y, clsf):
model = make_pipeline(Tokenizer(preserve_case=False, strip_handles=False), Stemming("snowball"),
TfidfVectorizer(lowercase=False, tokenizer=lambda _: _))
vectorized_x = model.fit_transform(x, y)
return fit(vectorized_x, y, clsf, oversample=True)
| 39.357143 | 100 | 0.77314 | 66 | 551 | 6.287879 | 0.484848 | 0.122892 | 0.028916 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.150635 | 551 | 13 | 101 | 42.384615 | 0.886752 | 0 | 0 | 0 | 0 | 0 | 0.014519 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.5 | 0 | 0.7 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
f03ffab8d10f9037be9ab1375a357fb60bf15cff | 2,671 | py | Python | mcts/mcts.py | jmhummel/Gin-Rummy-ML | 1cf12bb88803cfcf4b42dc0025161c656dccc3a7 | [
"MIT"
] | null | null | null | mcts/mcts.py | jmhummel/Gin-Rummy-ML | 1cf12bb88803cfcf4b42dc0025161c656dccc3a7 | [
"MIT"
] | null | null | null | mcts/mcts.py | jmhummel/Gin-Rummy-ML | 1cf12bb88803cfcf4b42dc0025161c656dccc3a7 | [
"MIT"
] | null | null | null | from abc import abstractmethod
class Game:
@abstractmethod
def get_cur_player(self):
"""
Returns:
int: current player idx
"""
pass
@abstractmethod
def get_action_size(self):
"""
Returns:
int: number of all possible actions
"""
pass
@abstractmethod
def get_valid_actions(self, player):
"""
Input:
player: player
Returns:
validActions: a binary vector of length self.get_action_size(), 1 for
moves that are valid from the current board and player,
0 for invalid moves
"""
pass
@abstractmethod
def take_action(self, action):
"""
Input:
action: action taken by the current player
Returns:
double: score of current player on the current turn
int: player who plays in the next turn
"""
pass
@abstractmethod
def get_observation_size(self):
"""
Returns:
(x,y,z): a tuple of observation dimensions
"""
pass
@abstractmethod
def get_observation(self, player):
"""
Input:
player: current player
Returns:
observation matrix which will serve as an input to agent.predict
"""
pass
@abstractmethod
def get_observation_str(self, observation):
"""
Input:
observation: observation
Returns:
string: a quick conversion of state to a string format.
Required by MCTS for hashing.
"""
pass
@abstractmethod
def is_ended(self):
"""
This method must return True if is_draw returns True
Returns:
boolean: False if game has not ended. True otherwise
"""
pass
@abstractmethod
def is_draw(self):
"""
Returns:
boolean: True if game ended in a draw, False otherwise
"""
pass
@abstractmethod
def get_score(self, player):
"""
Input:
player: current player
Returns:
double: reward in [-1, 1] for player if game has ended
"""
pass
@abstractmethod
def clone(self):
"""
Returns:
Game: a deep clone of current Game object
"""
pass
class Agent:
@abstractmethod
def predict(self, game, game_player):
"""
Returns:
policy, value: stochastic policy and a continuous value of a game observation
"""
| 23.025862 | 89 | 0.528267 | 271 | 2,671 | 5.136531 | 0.357934 | 0.146552 | 0.150862 | 0.103448 | 0.134339 | 0.058908 | 0.058908 | 0 | 0 | 0 | 0 | 0.002511 | 0.403594 | 2,671 | 115 | 90 | 23.226087 | 0.871312 | 0.454511 | 0 | 0.605263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.315789 | false | 0.289474 | 0.026316 | 0 | 0.394737 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
f05635eba92eace1dfe3fc5ec1a3fd2595ca3095 | 12,341 | py | Python | schemas.py | poldracklab/mriqcwebapi-schemas | 7a4d4e71c8fc14e7422df508c8a763c443f91e12 | [
"Apache-2.0"
] | null | null | null | schemas.py | poldracklab/mriqcwebapi-schemas | 7a4d4e71c8fc14e7422df508c8a763c443f91e12 | [
"Apache-2.0"
] | null | null | null | schemas.py | poldracklab/mriqcwebapi-schemas | 7a4d4e71c8fc14e7422df508c8a763c443f91e12 | [
"Apache-2.0"
] | null | null | null |
bids_schema = {
# BIDS identification bits
'modality': {
'type': 'string',
'required': True
},
'subject_id': {
'type': 'string',
'required': True
},
'session_id': {'type': 'string'},
'run_id': {'type': 'string'},
'acq_id': {'type': 'string'},
'task_id': {'type': 'string'},
'run_id': {'type': 'string'},
# BIDS metadata
'AccelNumReferenceLines': {'type': 'integer'},
'AccelerationFactorPE': {'type': 'integer'},
'AcquisitionMatrix': {'type': 'string'},
'CogAtlasID': {'type': 'string'},
'CogPOID': {'type': 'string'},
'CoilCombinationMethod': {'type': 'string'},
'ContrastBolusIngredient': {'type': 'string'},
'ConversionSoftware': {'type': 'string'},
'ConversionSoftwareVersion': {'type': 'string'},
'DelayTime': {'type': 'float'},
'DeviceSerialNumber': {'type': 'string'},
'EchoTime': {'type': 'float'},
'EchoTrainLength': {'type': 'integer'},
'EffectiveEchoSpacing': {'type': 'float'},
'FlipAngle': {'type': 'integer'},
'GradientSetType': {'type': 'string'},
'HardcopyDeviceSoftwareVersion': {'type': 'string'},
'ImagingFrequency': {'type': 'integer'},
'InPlanePhaseEncodingDirection': {'type': 'string'},
'InstitutionAddress': {'type': 'string'},
'InstitutionName': {'type': 'string'},
'Instructions': {'type': 'string'},
'InversionTime': {'type': 'float'},
'MRAcquisitionType': {'type': 'string'},
'MRTransmitCoilSequence': {'type': 'string'},
'MagneticFieldStrength': {'type': 'float'},
'Manufacturer': {'type': 'string'},
'ManufacturersModelName': {'type': 'string'},
'MatrixCoilMode': {'type': 'string'},
'MultibandAccelerationFactor': {'type': 'float'},
'NumberOfAverages': {'type': 'integer'},
'NumberOfPhaseEncodingSteps': {'type': 'integer'},
'NumberOfVolumesDiscardedByScanner': {'type': 'float'},
'NumberOfVolumesDiscardedByUser': {'type': 'float'},
'NumberShots': {'type': 'integer'},
'ParallelAcquisitionTechnique': {'type': 'string'},
'ParallelReductionFactorInPlane': {'type': 'float'},
'PartialFourier': {'type': 'boolean'},
'PartialFourierDirection': {'type': 'string'},
'PatientPosition': {'type': 'string'},
'PercentPhaseFieldOfView': {'type': 'integer'},
'PercentSampling': {'type': 'integer'},
'PhaseEncodingDirection': {'type': 'string'},
'PixelBandwidth': {'type': 'integer'},
'ProtocolName': {'type': 'string'},
'PulseSequenceDetails': {'type': 'string'},
'PulseSequenceType': {'type': 'string'},
'ReceiveCoilName': {'type': 'string'},
'RepetitionTime': {'type': 'float'},
'ScanOptions': {'type': 'string'},
'ScanningSequence': {'type': 'string'},
'SequenceName': {'type': 'string'},
'SequenceVariant': {'type': 'string'},
'SliceEncodingDirection': {'type': 'string'},
'SoftwareVersions': {'type': 'string'},
'TaskDescription': {'type': 'string'},
'TotalReadoutTime': {'type': 'float'},
'TotalScanTimeSec': {'type': 'integer'},
'TransmitCoilName': {'type': 'string'},
'VariableFlipAngleFlag': {'type': 'string'},
}
prov_schema = {
'version': {
'type': 'string',
'required': True
},
'md5sum': {
'type': 'string',
'required': True
},
'software': {
'type': 'string',
'required': True
},
'settings': {
'type': 'dict',
'schema': {
'fd_thres': {'type': 'float'},
'hmc_fsl': {'type': 'boolean'},
'testing': {'type': 'boolean'}
},
},
'mriqc_pred': {'type': 'integer'},
'email': {'type': 'string'},
}
bold_iqms_schema = {
'aor': {
'type': 'float',
'required': True
},
'aqi': {
'type': 'float',
'required': True
},
'dummy_trs': {'type': 'integer'},
'dvars_nstd': {
'type': 'float',
'required': True
},
'dvars_std': {
'type': 'float',
'required': True
},
'dvars_vstd': {
'type': 'float',
'required': True
},
'efc': {
'type': 'float',
'required': True
},
'fber': {
'type': 'float',
'required': True
},
'fd_mean': {
'type': 'float',
'required': True
},
'fd_num': {
'type': 'float',
'required': True
},
'fd_perc': {
'type': 'float',
'required': True
},
'fwhm_avg': {
'type': 'float',
'required': True
},
'fwhm_x': {
'type': 'float',
'required': True
},
'fwhm_y': {
'type': 'float',
'required': True
},
'fwhm_z': {
'type': 'float',
'required': True
},
'gcor': {
'type': 'float',
'required': True
},
'gsr_x': {
'type': 'float',
'required': True
},
'gsr_y': {
'type': 'float',
'required': True
},
'size_t': {
'type': 'float',
'required': True
},
'size_x': {
'type': 'float',
'required': True
},
'size_y': {
'type': 'float',
'required': True
},
'size_z': {
'type': 'float',
'required': True
},
'snr': {
'type': 'float',
'required': True
},
'spacing_tr': {
'type': 'float',
'required': True
},
'spacing_x': {
'type': 'float',
'required': True
},
'spacing_y': {
'type': 'float',
'required': True
},
'spacing_z': {
'type': 'float',
'required': True
},
'summary_bg_k': {
'type': 'float',
'required': True
},
'summary_bg_mean': {
'type': 'float',
'required': True
},
'summary_bg_median': {
'type': 'float',
'required': True
},
'summary_bg_mad': {
'type': 'float',
'required': True
},
'summary_bg_p05': {
'type': 'float',
'required': True
},
'summary_bg_p95': {
'type': 'float',
'required': True
},
'summary_bg_stdv': {
'type': 'float',
'required': True
},
'summary_bg_n': {
'type': 'float',
'required': True
},
'summary_fg_k': {
'type': 'float',
'required': True
},
'summary_fg_mean': {
'type': 'float',
'required': True
},
'summary_fg_median': {
'type': 'float',
'required': True
},
'summary_fg_mad': {
'type': 'float',
'required': True
},
'summary_fg_p05': {
'type': 'float',
'required': True
},
'summary_fg_p95': {
'type': 'float',
'required': True
},
'summary_fg_stdv': {
'type': 'float',
'required': True
},
'summary_fg_n': {
'type': 'float',
'required': True
},
'tsnr': {
'type': 'float',
'required': True
},
}
struct_iqms_schema = {
'cjv': {
'type': 'float',
'required': True
},
'cnr': {
'type': 'float',
'required': True
},
'efc': {
'type': 'float',
'required': True
},
'fber': {
'type': 'float',
'required': True
},
'fwhm_avg': {
'type': 'float',
'required': True
},
'fwhm_x': {
'type': 'float',
'required': True
},
'fwhm_y': {
'type': 'float',
'required': True
},
'fwhm_z': {
'type': 'float',
'required': True
},
'icvs_csf': {
'type': 'float',
'required': True
},
'icvs_gm': {
'type': 'float',
'required': True
},
'icvs_wm': {
'type': 'float',
'required': True
},
'inu_med': {
'type': 'float',
'required': True
},
'inu_range': {
'type': 'float',
'required': True
},
'qi_1': {
'type': 'float',
'required': True
},
'qi_2': {
'type': 'float',
'required': True
},
'rpve_csf': {
'type': 'float',
'required': True
},
'rpve_gm': {
'type': 'float',
'required': True
},
'rpve_wm': {
'type': 'float',
'required': True
},
'size_x': {
'type': 'integer',
'required': True
},
'size_y': {
'type': 'integer',
'required': True
},
'size_z': {
'type': 'integer',
'required': True
},
'snr_csf': {
'type': 'float',
'required': True
},
'snr_gm': {
'type': 'float',
'required': True
},
'snr_total': {
'type': 'float',
'required': True
},
'snr_wm': {
'type': 'float',
'required': True
},
'snrd_csf': {
'type': 'float',
'required': True
},
'snrd_gm': {
'type': 'float',
'required': True
},
'snrd_total': {
'type': 'float',
'required': True
},
'snrd_wm': {
'type': 'float',
'required': True
},
'spacing_x': {
'type': 'float',
'required': True
},
'spacing_y': {
'type': 'float',
'required': True
},
'spacing_z': {
'type': 'float',
'required': True
},
'summary_bg_k': {
'type': 'float',
'required': True
},
'summary_bg_mean': {
'type': 'float',
'required': True
},
'summary_bg_median': {
'type': 'float'
},
'summary_bg_mad': {
'type': 'float'
},
'summary_bg_p05': {
'type': 'float',
'required': True
},
'summary_bg_p95': {
'type': 'float',
'required': True
},
'summary_bg_stdv': {
'type': 'float',
'required': True
},
'summary_bg_n': {
'type': 'float'
},
'summary_csf_k': {
'type': 'float',
'required': True
},
'summary_csf_mean': {
'type': 'float',
'required': True
},
'summary_csf_median': {
'type': 'float'
},
'summary_csf_mad': {
'type': 'float'
},
'summary_csf_p05': {
'type': 'float',
'required': True
},
'summary_csf_p95': {
'type': 'float',
'required': True
},
'summary_csf_stdv': {
'type': 'float',
'required': True
},
'summary_csf_n': {
'type': 'float'
},
'summary_gm_k': {
'type': 'float',
'required': True
},
'summary_gm_mean': {
'type': 'float',
'required': True
},
'summary_gm_median': {
'type': 'float'
},
'summary_gm_mad': {
'type': 'float'
},
'summary_gm_p05': {
'type': 'float',
'required': True
},
'summary_gm_p95': {
'type': 'float',
'required': True
},
'summary_gm_stdv': {
'type': 'float',
'required': True
},
'summary_gm_n': {
'type': 'float'
},
'summary_wm_k': {
'type': 'float',
'required': True
},
'summary_wm_mean': {
'type': 'float',
'required': True
},
'summary_wm_median': {
'type': 'float'
},
'summary_wm_mad': {
'type': 'float'
},
'summary_wm_p05': {
'type': 'float',
'required': True
},
'summary_wm_p95': {
'type': 'float',
'required': True
},
'summary_wm_stdv': {
'type': 'float',
'required': True
},
'summary_wm_n': {
'type': 'float'
},
'tpm_overlap_csf': {
'type': 'float',
'required': True
},
'tpm_overlap_gm': {
'type': 'float',
'required': True
},
'tpm_overlap_wm': {
'type': 'float',
'required': True
},
'wm2max': {
'type': 'float',
'required': True
},
}
rating_schema = {
'rating': {
'type': 'string',
'required': True
},
'name': {
'type': 'string',
'required': False
},
'comment': {
'type': 'string',
'required': False
},
'md5sum': {
'type': 'string',
'required': True
}
}
| 21.842478 | 59 | 0.451422 | 970 | 12,341 | 5.571134 | 0.158763 | 0.199852 | 0.301999 | 0.373057 | 0.532198 | 0.376203 | 0.207069 | 0.185973 | 0.185973 | 0.185973 | 0 | 0.003564 | 0.340653 | 12,341 | 564 | 60 | 21.881206 | 0.660563 | 0.003079 | 0 | 0.490975 | 0 | 0 | 0.409302 | 0.040572 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f05e64e11da39f74033333a8476d227dfc3dd4cc | 3,630 | py | Python | test/test_testtable.py | lin-wish/random-name | 91bae70aad4547e06388105136573a7c18525ed0 | [
"MIT"
] | null | null | null | test/test_testtable.py | lin-wish/random-name | 91bae70aad4547e06388105136573a7c18525ed0 | [
"MIT"
] | null | null | null | test/test_testtable.py | lin-wish/random-name | 91bae70aad4547e06388105136573a7c18525ed0 | [
"MIT"
] | null | null | null | import unittet
import os
import json
from app import create_app, db
class TestTableTestCase(unittet.TestCase):
""" This test is for TestTable. """
def setUp(self):
""" initialize test case. """
self.app = create_app(config_name="testing")
self.client = self.app.test_client
self.testtable = {'name', 'test table.'}
with self.app.app_context():
db.create_all()
def test_testtable_creation(self):
self.register_user():
result = self.login_user()
# obtain the access token
access_token = json.loads(result.data.decode())['access_token']
res = self.client().post('/testtable', data=self.testtable)
self.assertEqual(res.status_code, 201)
self.assertIn('test table', str(res.data))
def test_get_method_testtable(self):
res = self.client().get('/testtable/')
self.assertEqual(res.status_code, 200)
self.assertIn('test table', str(res.data))
def test_api_can_get_bucketlist_by_id(self):
"""Test API can get a single bucketlist by using it's id."""
rv = self.client().post('/bucketlists/', data=self.bucketlist)
self.assertEqual(rv.status_code, 201)
result_in_json = json.loads(rv.data.decode('utf-8').replace("'", "\""))
result = self.client().get(
'/bucketlists/{}'.format(result_in_json['id']))
self.assertEqual(result.status_code, 200)
self.assertIn('Go to Borabora', str(result.data))
def test_bucketlist_can_be_edited(self):
"""Test API can edit an existing bucketlist. (PUT request)"""
rv = self.client().post(
'/bucketlists/',
data={'name': 'Eat, pray and love'})
self.assertEqual(rv.status_code, 201)
rv = self.client().put(
'/bucketlists/1',
data={
"name": "Dont just eat, but also pray and love :-)"
})
self.assertEqual(rv.status_code, 200)
results = self.client().get('/bucketlists/1')
self.assertIn('Dont just eat', str(results.data))
def test_bucketlist_deletion(self):
"""Test API can delete an existing bucketlist. (DELETE request)."""
rv = self.client().post(
'/bucketlists/',
data={'name': 'Eat, pray and love'})
self.assertEqual(rv.status_code, 201)
res = self.client().delete('/bucketlists/1')
self.assertEqual(res.status_code, 200)
# Test to see if it exists, should return a 404
result = self.client().get('/bucketlists/1')
self.assertEqual(result.status_code, 404)
def register_user(self, email="user@test.com", password="test1234"):
"""This helper method helps register a test user."""
user_data = {
'email': email,
'password': password
}
return self.client().post('/auth/register', data=user_data)
def login_user(self, email="user@test.com", password="test1234"):
"""This helper method helps log in a test user."""
user_data = {
'email': email,
'password': password
}
return self.client().post('/auth/login', data=user_data)
def tearDown(self):
"""teardown all initialized variables."""
with self.app.app_context():
# drop all tables
db.session.remove()
db.drop_all()
# Make the tests conveniently executable
if __name__ == "__main__":
unittest.main()
| 36.666667 | 80 | 0.580441 | 425 | 3,630 | 4.825882 | 0.277647 | 0.063384 | 0.040956 | 0.044856 | 0.448562 | 0.374939 | 0.264261 | 0.264261 | 0.245734 | 0.208679 | 0 | 0.016545 | 0.284022 | 3,630 | 99 | 81 | 36.666667 | 0.772605 | 0.03416 | 0 | 0.3 | 0 | 0 | 0.13659 | 0 | 0 | 0 | 0 | 0 | 0.185714 | 0 | null | null | 0.057143 | 0.057143 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
f05e9dee255978094221062a0c7789186586b074 | 10,611 | py | Python | wmw/wmw_test.py | alistairwgillespie/wmw_deep_playlist_generator | 39906077dfbfc55e440ab67d4134d1c7e45bb6e8 | [
"MIT"
] | 2 | 2020-05-04T23:52:55.000Z | 2020-06-06T05:15:02.000Z | wmw/wmw_test.py | alistairwgillespie/wmw_deep_playlist_generator | 39906077dfbfc55e440ab67d4134d1c7e45bb6e8 | [
"MIT"
] | 4 | 2020-03-03T23:29:51.000Z | 2020-04-21T23:31:49.000Z | wmw/wmw_test.py | alistairwgillespie/wmw_deep_playlist_generator | 39906077dfbfc55e440ab67d4134d1c7e45bb6e8 | [
"MIT"
] | null | null | null | # import subprocess as sb
# import sys
# import os
# import random
# import numpy as np
# import pandas as pd
# from tqdm.notebook import tqdm
# from scipy.spatial.distance import cdist
# import config
# # PyTorch
# import torch
# import torch.optim as optim
# # Models
# from wmw.lstm_generator import WMWGenerator
# from wmw.rnn_generator import RNNEstimator
# # If AWS SageMaker:
# # Spotify API
# sb.call([sys.executable, "-m", "pip", "install", 'spotipy'])
# import spotipy
# import spotipy.util as util
# from spotipy.oauth2 import SpotifyClientCredentials
# # Joblib
# sb.call([sys.executable, "-m", "pip", "install", 'joblib'])
# import joblib
# # TODO: Contain recommendations pool to Best Of and add
# # Deep Work as pool for intro tracks
# class Playlist():
# def __init__(self, wmw_pool, spotify_auth, spotify_token, model_type="LSTM"):
# """ Initiates pool of historic tracks, spotify api authentication and
# model of choice.
# """
# self.recommended_track_ids = pd.DataFrame() #list of track ids straight from spotify
# self.trax = [] #all tracks as dict
# self.df = None #this is where the data goes
# self.playlist = None
# self.wmw_pool_df = wmw_pool
# self.token = spotify_token
# self.spotify_auth = spotify_auth
# # Feature set
# self.feature_list = ['danceability','energy', 'loudness', 'speechiness', 'acousticness',
# 'instrumentalness', 'liveness', 'valence', 'tempo']
# # Setup feature standardisation
# self.std_scaler = joblib.load('artefacts/standard_features.pkl')
# # Setup dimensionality reduction for track picking
# self.dim_red = joblib.load('artefacts/dim_red.pkl')
# if model_type == "LSTM":
# model = LSTMEstimator(9, 12, 2, 9, 1)
# model.load_state_dict(torch.load('artefacts/lstm_model.pth'))
# elif model_type == "RNN":
# model = RNNEstimator(9, 12, 2, 9, 1)
# model.load_state_dict(torch.load('artefacts/rnn_model.pth'))
# else:
# print("Please specify either the RNN or LSTM model using the model_type parameter.")
# model.eval()
# # Start building the new playlist
# self.intro_track = self.get_first_track()
# self.new_playlist = self.predict_playlist(model, self.intro_track)
# def get_first_track(self):
# """Get first track based on recommendations."""
# # Sample an intro song from the WMW history
# song = self.wmw_pool_df[self.wmw_pool_df['position'] == 1].sample(1).copy()
# # Gather a recommendation based on the intro track using spotify
# song_res = self.spotify_auth.recommendations(seed_tracks=song['id'].values, limit=1)
# # Gather track freatures from spotify result
# for r in song_res['tracks']:
# track = {'id': r['id'], 'artists': ([i['name'] for i in r['artists']],), 'name': r['name']}
# track_features = self.spotify_auth.audio_features(r['id'])[0]
# track.update(track_features)
# self.intro_track = pd.DataFrame(track, index=[0])
# # Prepare features
# self.intro_track[self.feature_list] = self.std_scaler.transform(self.intro_track[self.feature_list])
# return self.intro_track
# def harmonic_match(self, key, mode):
# """Given a key and mode, return compatible keys according to the harmonic wheel."""
# # Harmonic Mixing Wheel: Pitch Class
# # 1A 0 - A flat minor: 8 | 1B 0 - B major: 11
# # 2A 1 - E flat minor: 3 | 2B 1 - F-sharp major: 6
# # 3A 2 - B-flat minor: 10 | 3B 2 - D-flat major: 1
# # 4A 3 - F minor: 5 | 4B 3 - A-flat major: 8
# # 5A 4 - C minor: 0 | 5B 4 - E-flat major: 3
# # 6A 5 - G minor: 7 | 6B 5 - B-flat major: 10
# # 7A 6 - D minor: 2 | 7B 6 - F major: 5
# # 8A 7 - A minor: 9 | 8B 7 - C major: 0
# # 9A 8 - E minor: 4 | 9B 8 - G major: 7
# # 10A 9 - B minor: 11 | 10B 9 - D major: 2
# # 11A 10 - F sharp minor: 6 | 11B 10 - A major: 9
# # 12A 11 - D flat minor: 1 | 12B 11 - E major: 4
# # Harmonic keys mapped to corresponding pitch classes
# pitch_to_harmonic_keys = {0: [4, 7], 1: [11, 2], 2: [6, 9],
# 3: [1, 4], 4: [8, 11], 5: [3, 6],
# 6: [10, 1], 7: [5, 8], 8: [0, 3],
# 9: [7, 10], 10: [2, 5], 11: [9, 0]}
# # Extract values and keys
# dv = np.array(list(pitch_to_harmonic_keys.values()))
# dk = np.array(list(pitch_to_harmonic_keys.keys()))
# # Harmonic key code corresponding song pitch class
# harm_key = dv[np.where(dk == key)][0][mode]
# # Harmonic key codes
# harmonic_keys = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
# # Get compatible key codes
# comp_keycodes = np.take(harmonic_keys,
# [harm_key - 1, harm_key, harm_key + 1],
# mode='wrap')
# # Compatible keys
# comp_keys = [np.where(dv[:, mode] == i)[0][0].tolist() for i in comp_keycodes]
# # Compatible up/down key
# inner_outer_key = np.array([np.where(dv[:, int(not bool(mode))] == harm_key)[0][0]])
# comp_keys = np.concatenate([comp_keys, inner_outer_key])
# return comp_keys, inner_outer_key
# def get_position_recommendations(self, track_position):
# """Obtain a dataframe of recommended tracks for a specific track position."""
# recommendations = pd.DataFrame()
# wmw_sample = random.sample(self.wmw_pool_df['volume'].unique().tolist(), 10)
# wmw_sample_df = self.wmw_pool_df[
# (self.wmw_pool_df['volume'].isin(wmw_sample)) &
# (self.wmw_pool_df['position'] == track_position)
# ]
# # Iterate full catalog of WMW songs
# for _, row in wmw_sample_df.iterrows():
# song_search = row['track_name'].partition('-')[0] + ' ' + row['artist_name']
# try:
# # Query Spotify to get track metadata then gather recommendations
# # based on the sampled tracks from past volumes
# song_res = self.spotify_auth.search(song_search, limit=1)['tracks']['items'][0]
# results = self.spotify_auth.recommendations(seed_tracks=[song_res['id']], limit=20)
# for r in results['tracks']:
# track = {'id': r['id'], 'artists': [i['name'] for i in r['artists']], 'name': r['name']}
# track_features = self.spotify_auth.audio_features(r['id'])[0]
# track.update(track_features)
# final_track = pd.DataFrame(track)
# recommendations = recommendations.append(final_track, ignore_index=True)
# except:
# print("Song not searchable")
# recommendations[self.feature_list] = self.std_scaler.transform(recommendations[self.feature_list])
# return recommendations
# def pick_optimal_track(self, candidates, target):
# """Select the track with the minimum Euclidean distance between the candidate tracks."""
# candidates_reduced = self.dim_red.transform(candidates[self.feature_list])
# target_reduced = self.dim_red.transform(target[0])
# next_track_id = np.argmin(cdist(target_reduced, candidates_reduced))
# next_track = candidates.iloc[next_track_id]
# return next_track
# def predict_playlist(self, model, intro_track, playlist_len=15):
# """Predict playlist"""
# # Prepare prediction list
# predicted = intro_track
# # Prepare initial input
# input = torch.FloatTensor(intro_track[self.feature_list].values)
# print("Track #1:", predicted['name'].values[0], '-', ', '.join(predicted['artists'].values[0]))
# hidden_state = model.init_hidden()
# for p in range(2, playlist_len + 1):
# print("Track #%s - Generating candidates" % p)
# # Important stuff about the last track
# current_track = predicted.iloc[-1]
# current_key = current_track['key']
# current_mode = current_track['mode']
# # Generate output feature set of next song
# output, hidden_state = model(input, hidden_state)
# output = output.detach().numpy()
# # Get mode and key from last song and generate compatible keys and modes
# keys, outer_inner_key = self.harmonic_match(current_key, current_mode)
# # Get recommended tracks for current track position
# recommendations = self.get_position_recommendations(p)
# # Filter for compatible tracks according to key and mode (harmonic wheel)
# next_tracks_curr_mode = recommendations[
# (recommendations['key'].isin(keys[:3])) & (recommendations['mode'] == current_mode)
# ]
# next_tracks_change_mode = recommendations[
# (recommendations['key'] == keys[-1]) & (recommendations['mode'] == abs(int(not current_mode)))
# ]
# candidate_tracks = pd.concat([next_tracks_curr_mode, next_tracks_change_mode]).reset_index(drop=True)
# # Ensure no duplicates exist in the playlist
# candidate_tracks = candidate_tracks[~candidate_tracks['id'].isin(predicted['id'])]
# # Pick optimal track
# next_track = self.pick_optimal_track(candidate_tracks, output)
# print("Selected:", next_track['name'], '-', next_track['artists'])
# # Set new input vector for next song
# input = torch.FloatTensor([next_track[self.feature_list]])
# # Append next song to playlist
# predicted = predicted.append(next_track, ignore_index=True)
# print('-' * 20)
# return predicted
# def post_playlist(self):
# if self.token:
# spotify = spotipy.Spotify(auth=self.token)
# spotify.trace = False
# tracks = spotify.user_playlist_replace_tracks(
# config.SPOTIFY_USER_ID, config.SPOTIFY_PLAYLIST_ID,
# self.new_playlist['id'].values
# )
# print("Posting latest Wilson's FM.")
# print('-' * 20)
# else:
# print("Can't get token") | 40.811538 | 115 | 0.586938 | 1,311 | 10,611 | 4.596491 | 0.253242 | 0.016595 | 0.014603 | 0.015101 | 0.167441 | 0.116329 | 0.109193 | 0.062396 | 0.053767 | 0.053767 | 0 | 0.025159 | 0.288286 | 10,611 | 260 | 116 | 40.811538 | 0.772775 | 0.952125 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0.003846 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f0746880751de6779ff42e7a818182939e5e5ab8 | 358 | py | Python | Counting DNA Nucleotides.py | ixaxaar/rosalind | 43b43573c19e1448fbeb0de069cabbde17146fbd | [
"MIT"
] | 1 | 2019-10-27T09:14:45.000Z | 2019-10-27T09:14:45.000Z | Counting DNA Nucleotides.py | ixaxaar/rosalind | 43b43573c19e1448fbeb0de069cabbde17146fbd | [
"MIT"
] | null | null | null | Counting DNA Nucleotides.py | ixaxaar/rosalind | 43b43573c19e1448fbeb0de069cabbde17146fbd | [
"MIT"
] | null | null | null | #! /usr/bin/env python
import sys
def main():
dna_str = sys.argv[1]
occurences = {
'A': 0,
'C': 0,
'G': 0,
'T': 0
}
for c in dna_str:
occurences[c.upper()] = occurences[c.upper()] + 1;
print str(occurences['A']) + " " + str(occurences['C']) + " " + str(occurences['G']) + " " + str(occurences['T'])
if __name__ == "__main__":
main()
| 16.272727 | 114 | 0.539106 | 51 | 358 | 3.588235 | 0.470588 | 0.355191 | 0.153005 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021429 | 0.217877 | 358 | 21 | 115 | 17.047619 | 0.632143 | 0.058659 | 0 | 0 | 0 | 0 | 0.056548 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.071429 | null | null | 0.071429 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b2b38d24401e05eaf5f81142980beab825168513 | 185 | py | Python | examples/prompts/confirmation-prompt.py | chouette254/quo | 8979afd118e77d3d0f93f9fbe8711efada7158c5 | [
"MIT"
] | 5 | 2021-06-17T21:06:39.000Z | 2022-03-11T06:45:51.000Z | examples/prompts/confirmation-prompt.py | chouette254/quo | 8979afd118e77d3d0f93f9fbe8711efada7158c5 | [
"MIT"
] | 39 | 2021-07-19T19:36:18.000Z | 2022-02-23T14:55:08.000Z | examples/prompts/confirmation-prompt.py | secretuminc/quo | c4f77d52f015c612d32ed0fc2fc79545af598f10 | [
"MIT"
] | 1 | 2021-05-31T17:19:15.000Z | 2021-05-31T17:19:15.000Z | #!/usr/bin/env python
"""
Example of a confirmation prompt.
"""
import quo
if __name__ == "__main__":
answer = quo.confirm("Should we do that?")
print("You said: %s" % answer)
| 18.5 | 46 | 0.643243 | 26 | 185 | 4.269231 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.189189 | 185 | 9 | 47 | 20.555556 | 0.74 | 0.291892 | 0 | 0 | 0 | 0 | 0.308943 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b2bc0ec848601d51812af1d01984cea7df5d78c5 | 357 | py | Python | tests/integration/storages/test_multiprocess_storages.py | thoughteer/edera | c4ddb5d8a25906c3bd773c91afb3260fc0b704f2 | [
"MIT"
] | 3 | 2018-11-27T15:45:19.000Z | 2018-12-21T20:32:10.000Z | tests/integration/storages/test_multiprocess_storages.py | thoughteer/edera | c4ddb5d8a25906c3bd773c91afb3260fc0b704f2 | [
"MIT"
] | 18 | 2018-12-02T18:38:59.000Z | 2020-02-05T22:09:37.000Z | tests/integration/storages/test_multiprocess_storages.py | thoughteer/edera | c4ddb5d8a25906c3bd773c91afb3260fc0b704f2 | [
"MIT"
] | null | null | null | from edera.invokers import MultiProcessInvoker
def test_storage_is_multiprocess(multiprocess_storage):
def put(index):
multiprocess_storage.put(str(index), str(index**2))
MultiProcessInvoker({str(i): lambda i=i: put(i) for i in range(5)}).invoke()
for index in range(5):
assert len(multiprocess_storage.get(str(index))) == 1
| 29.75 | 80 | 0.711485 | 50 | 357 | 4.96 | 0.5 | 0.229839 | 0.064516 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013378 | 0.162465 | 357 | 11 | 81 | 32.454545 | 0.816054 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.285714 | false | 0 | 0.142857 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b2d1394c902a19831cec2b1d0bd3a31967c71fab | 611 | py | Python | tutos/locations/serializers.py | UVG-Teams/Tutos-System | 230dd9434f745c2e6e69e10f9908e9818c559d03 | [
"MIT"
] | null | null | null | tutos/locations/serializers.py | UVG-Teams/Tutos-System | 230dd9434f745c2e6e69e10f9908e9818c559d03 | [
"MIT"
] | null | null | null | tutos/locations/serializers.py | UVG-Teams/Tutos-System | 230dd9434f745c2e6e69e10f9908e9818c559d03 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from locations.models import Location, Language
class LocationSerializer(serializers.ModelSerializer):
class Meta:
model = Location
fields = (
'id',
'name',
'shortname',
'postcode',
'code',
'location_type',
'parent',
'latitude',
'longitude',
'language',
)
class LanguageSerializer(serializers.ModelSerializer):
class Meta:
model = Language
fields = (
'id',
'name',
)
| 20.366667 | 54 | 0.502455 | 42 | 611 | 7.261905 | 0.595238 | 0.085246 | 0.203279 | 0.229508 | 0.262295 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.405892 | 611 | 29 | 55 | 21.068966 | 0.84022 | 0 | 0 | 0.333333 | 0 | 0 | 0.126023 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.083333 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b2da951bd18015517f1c3c2b8e393a6c46f0a671 | 612 | py | Python | max_sub_array_of_size_k.py | anilgitme/py | 6739f2ccfadc339dcfdd6118f4f2ad97f4452300 | [
"MIT"
] | null | null | null | max_sub_array_of_size_k.py | anilgitme/py | 6739f2ccfadc339dcfdd6118f4f2ad97f4452300 | [
"MIT"
] | null | null | null | max_sub_array_of_size_k.py | anilgitme/py | 6739f2ccfadc339dcfdd6118f4f2ad97f4452300 | [
"MIT"
] | null | null | null | def max_sub_array_of_size_k(k, arr):
# TODO: Write your code here
if not arr:
return -1
curSum = 0
i = 0
j = len(arr) -1
while i < j:
subarr = arr[i:k]
print(subarr)
total = 0
for num in subarr:
total += num
if total > curSum:
curSum = total
total = 0
else:
total = 0
i += 1
k += 1
return curSum
print(max_sub_array_of_size_k(3, [2, 1, 5, 1, 3, 2]))
print(max_sub_array_of_size_k(2, [2, 3, 4, 1, 5]))
print(max_sub_array_of_size_k(5, [10, 3, 4, 1, 5, 9, 2, 1, 8])) | 23.538462 | 63 | 0.496732 | 104 | 612 | 2.730769 | 0.355769 | 0.084507 | 0.15493 | 0.183099 | 0.306338 | 0.306338 | 0.242958 | 0 | 0 | 0 | 0 | 0.087302 | 0.382353 | 612 | 26 | 63 | 23.538462 | 0.664021 | 0.042484 | 0 | 0.130435 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.038462 | 0 | 1 | 0.043478 | false | 0 | 0 | 0 | 0.130435 | 0.173913 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b2eb15ad135d845f6d9874857f352b456bc21d00 | 549 | py | Python | transmutagen/py_solve/__init__.py | ergs/transmutagen | 16b9467a3bb52914b641e1d9a5de643eb3fff214 | [
"BSD-3-Clause"
] | 4 | 2017-02-09T19:22:36.000Z | 2018-04-04T10:19:45.000Z | transmutagen/py_solve/__init__.py | ergs/transmutagen | 16b9467a3bb52914b641e1d9a5de643eb3fff214 | [
"BSD-3-Clause"
] | 7 | 2017-05-19T15:31:52.000Z | 2018-01-21T19:25:49.000Z | transmutagen/py_solve/__init__.py | ergs/transmutagen | 16b9467a3bb52914b641e1d9a5de643eb3fff214 | [
"BSD-3-Clause"
] | null | null | null | try:
from . import py_solve
del py_solve
except ImportError:
raise ImportError("Run 'python -m transmutagen.gensolve --py-solve' and 'setup.py build_ext --inplace' to generate the module")
from .py_solve import (N, NNZ, IJ, NUCS, NUCS_IDX, ROWS, COLS, ones,
flatten_sparse_matrix, csr_from_flat, asflat, solve, diag_add, dot, scalar_times_vector)
__all__ = ['N', 'NNZ', 'IJ', 'NUCS', 'NUCS_IDX', 'ROWS', 'COLS', 'ones',
'flatten_sparse_matrix', 'csr_from_flat', 'asflat', 'solve', 'diag_add',
'dot', 'scalar_times_vector']
| 42.230769 | 131 | 0.695811 | 80 | 549 | 4.475 | 0.55 | 0.078212 | 0.03352 | 0.055866 | 0.541899 | 0.541899 | 0.541899 | 0.541899 | 0.541899 | 0.541899 | 0 | 0 | 0.153005 | 549 | 12 | 132 | 45.75 | 0.769892 | 0 | 0 | 0 | 1 | 0.1 | 0.384335 | 0.076503 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
b2ebd803cde4ba8c708c7526e9c031c248b71ae5 | 545 | py | Python | schemes/migrations/0009_auto_20180501_1533.py | slunzok/papersoccer | 4549877de3b65bea5777e33654b2b5b3a50a37d8 | [
"MIT"
] | 1 | 2018-05-05T19:08:16.000Z | 2018-05-05T19:08:16.000Z | schemes/migrations/0009_auto_20180501_1533.py | slunzok/papersoccer | 4549877de3b65bea5777e33654b2b5b3a50a37d8 | [
"MIT"
] | null | null | null | schemes/migrations/0009_auto_20180501_1533.py | slunzok/papersoccer | 4549877de3b65bea5777e33654b2b5b3a50a37d8 | [
"MIT"
] | null | null | null | # Generated by Django 2.0.4 on 2018-05-01 13:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('schemes', '0008_auto_20180501_1234'),
]
operations = [
migrations.AlterField(
model_name='comment',
name='content',
field=models.TextField(max_length=5000),
),
migrations.AlterField(
model_name='entry',
name='content',
field=models.TextField(max_length=5000),
),
]
| 22.708333 | 52 | 0.577982 | 55 | 545 | 5.6 | 0.672727 | 0.12987 | 0.162338 | 0.188312 | 0.285714 | 0.285714 | 0.285714 | 0.285714 | 0 | 0 | 0 | 0.103448 | 0.308257 | 545 | 23 | 53 | 23.695652 | 0.713528 | 0.082569 | 0 | 0.470588 | 1 | 0 | 0.11245 | 0.046185 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.235294 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
650557a0007f3f3531e09161effec735818d50cd | 89 | py | Python | nv/spectrogram/__init__.py | khaykingleb/HiFi-GAN | 6bafd6f8f67d2393e057cb64cd6c1311d59a85f0 | [
"MIT"
] | null | null | null | nv/spectrogram/__init__.py | khaykingleb/HiFi-GAN | 6bafd6f8f67d2393e057cb64cd6c1311d59a85f0 | [
"MIT"
] | null | null | null | nv/spectrogram/__init__.py | khaykingleb/HiFi-GAN | 6bafd6f8f67d2393e057cb64cd6c1311d59a85f0 | [
"MIT"
] | null | null | null | from nv.spectrogram.mel_spectrogram import MelSpectrogram
all = [
"MelSpectrogram"
] | 17.8 | 57 | 0.775281 | 9 | 89 | 7.555556 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146067 | 89 | 5 | 58 | 17.8 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0.155556 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
651b3b8b5831cbcc5de0e04474972b628c5a276e | 10,289 | py | Python | dicts.py | johnso51/MIPS-Assembler | 9c05c4bdb4e0be0201f55dbe22ba86cb6887d687 | [
"MIT"
] | null | null | null | dicts.py | johnso51/MIPS-Assembler | 9c05c4bdb4e0be0201f55dbe22ba86cb6887d687 | [
"MIT"
] | null | null | null | dicts.py | johnso51/MIPS-Assembler | 9c05c4bdb4e0be0201f55dbe22ba86cb6887d687 | [
"MIT"
] | null | null | null | from instructions import *
opcodes = dict({
"add": 0b00000000000000000000000000100000,
"addu": 0b00000000000000000000000000100001,
"addi": 0b00100000000000000000000000000000,
"addiu": 0b00100100000000000000000000000000,
"and": 0b00000000000000000000000000100100,
"andi": 0b00110000000000000000000000000000,
"beq": 0b00010000000000000000000000000000,
"beql": 0b01010000000000000000000000000000,
"bgez": 0b00000100000000000000000000000000,
"bgezal": 0b00000100000100010000000000000000,
"bgezall": 0b00000100000100110000000000000000,
"bgezl": 0b00000100000001110000000000000000,
"bgtz": 0b00011100000000000000000000000000,
"bgtzl": 0b01011100000000000000000000000000,
"blez": 0b00011000000000000000000000000000,
"blezl": 0b01011000000000000000000000000000,
"bltz": 0b00000100000000000000000000000000,
"bltzal": 0b00000100000100000000000000000000,
"bltzall": 0b00000100000100100000000000000000,
"bltzl": 0b00000100000000100000000000000000,
"bne": 0b00010100000000000000000000000000,
"bnel": 0b01010100000000000000000000000000,
"break": 0b00000000000000000000000000001101,
"cop0": 0b01000000000000000000000000000000,
"cop1": 0b01000100000000000000000000000000,
"cop2": 0b01001000000000000000000000000000,
"cop3": 0b01001100000000000000000000000000,
"dadd": 0b00000000000000000000000000101100,
"daddi": 0b01100000000000000000000000000000,
"daddiu": 0b01100100000000000000000000000000,
"daddu": 0b00000000000000000000000000101101,
"ddiv": 0b00000000000000000000000000011110,
"ddivu": 0b00000000000000000000000000011111,
"div": 0b00000000000000000000000000011010,
"divu": 0b00000000000000000000000000011011,
"dmult": 0b00000000000000000000000000011100,
"dmultu": 0b00000000000000000000000000011101,
"dsll": 0b00000000000000000000000000111000,
"dsll32": 0b00000000000000000000000000111100,
"dsllv": 0b00000000000000000000000000010100,
"dsra": 0b00000000000000000000000000111011,
"dsra32": 0b00000000000000000000000000111111,
"dsrav": 0b00000000000000000000000000010111,
"dsrl": 0b00000000000000000000000000111010,
"dsrl32": 0b00000000000000000000000000111110,
"dsrlv": 0b00000000000000000000000000010110,
"dsub": 0b00000000000000000000000000101110,
"dsubu": 0b00000000000000000000000000101111,
"j": 0b00001000000000000000000000000000,
"jal": 0b00001100000000000000000000000000,
"jalr": 0b00000000000000000000000000001001,
"jr": 0b00000000000000000000000000001000,
"lb": 0b10000000000000000000000000000000,
"lbu": 0b10010000000000000000000000000000,
"ld": 0b11011100000000000000000000000000,
"ldc1": 0b11010100000000000000000000000000,
"ldc2": 0b11011000000000000000000000000000,
"ldl": 0b01101000000000000000000000000000,
"ldr": 0b01101100000000000000000000000000,
"lh": 0b10000100000000000000000000000000,
"lhu": 0b10010100000000000000000000000000,
"ll": 0b11000000000000000000000000000000,
"lld": 0b11010000000000000000000000000000,
"lui": 0b00111100000000000000000000000000,
"lw": 0b10001100000000000000000000000000,
"lwc1": 0b11000100000000000000000000000000,
"lwc2": 0b11001000000000000000000000000000,
"lwc3": 0b11001100000000000000000000000000,
"lwl": 0b10001000000000000000000000000000,
"lwr": 0b10011000000000000000000000000000,
"lwu": 0b10011100000000000000000000000000,
"mfhi": 0b00000000000000000000000000010000,
"mflo": 0b00000000000000000000000000010010,
"movn": 0b00000000000000000000000000001011,
"movz": 0b00000000000000000000000000001010,
"mthi": 0b00000000000000000000000000010001,
"mtlo": 0b00000000000000000000000000010011,
"mult": 0b00000000000000000000000000011000,
"multu": 0b00000000000000000000000000011001,
"nor": 0b00000000000000000000000000100111,
"or": 0b00000000000000000000000000100101,
"ori": 0b00110100000000000000000000000000,
"pref": 0b11001100000000000000000000000000,
"sb": 0b10100000000000000000000000000000,
"sc": 0b11100000000000000000000000000000,
"scd": 0b11110000000000000000000000000000,
"sd": 0b11111100000000000000000000000000,
"sdc1": 0b11110100000000000000000000000000,
"sdc2": 0b11111000000000000000000000000000,
"sdl": 0b10110000000000000000000000000000,
"sdr": 0b10110100000000000000000000000000,
"sh": 0b10100100000000000000000000000000,
"sll": 0b00000000000000000000000000000000,
"sllv": 0b00000000000000000000000000000100,
"slt": 0b00000000000000000000000000101010,
"slti": 0b00101000000000000000000000000000,
"sltiu": 0b00101100000000000000000000000000,
"sltu": 0b00000000000000000000000000101011,
"sra": 0b00000000000000000000000000000011,
"srav": 0b00000000000000000000000000000111,
"srl": 0b00000000000000000000000000000010,
"srlv": 0b00000000000000000000000000000110,
"sub": 0b00000000000000000000000000100010,
"subu": 0b00000000000000000000000000100011,
"sw": 0b10101100000000000000000000000000,
"swc1": 0b11100100000000000000000000000000,
"swc2": 0b11101000000000000000000000000000,
"swc3": 0b11101100000000000000000000000000,
"swl": 0b10101000000000000000000000000000,
"swr": 0b10111000000000000000000000000000,
"sync": 0b00000000000000000000000000001111,
"syscall": 0b00000000000000000000000000001100,
"teq": 0b00000000000000000000000000110100,
"teqi": 0b00000100000011000000000000000000,
"tge": 0b00000000000000000000000000110000,
"tgei": 0b00000100000010000000000000000000,
"tgeiu": 0b00000100000010010000000000000000,
"tgeu": 0b00000000000000000000000000110001,
"tlt": 0b00000000000000000000000000110010,
"tlti": 0b00000100000010100000000000000000,
"tltiu": 0b00000100000010110000000000000000,
"tltu": 0b00000000000000000000000000110011,
"tne": 0b00000000000000000000000000110110,
"tnei": 0b00000100000011100000000000000000,
"xor": 0b00000000000000000000000000100110,
"xori": 0b00111000000000000000000000000000,
})
opcode_funcs = dict({
"sdl": create_sdl,
"lwl": create_lwl,
"swr": create_swr,
"bltz": create_bltz,
"jalr": create_jalr,
"bgezall": create_bgezall,
"daddiu": create_daddiu,
"ldc2": create_ldc2,
"lwc1": create_lwc1,
"lw": create_lw,
"swc3": create_swc3,
"add": create_add,
"lwu": create_lwu,
"srl": create_srl,
"lwr": create_lwr,
"addiu": create_addiu,
"lui": create_lui,
"ori": create_ori,
"bgtzl": create_bgtzl,
"lb": create_lb,
"j": create_j,
"dsra32": create_dsra32,
"dsrav": create_dsrav,
"dsrl32": create_dsrl32,
"dsll32": create_dsll32,
"lh": create_lh,
"bgezal": create_bgezal,
"mult": create_mult,
"cop1": create_cop1,
"sltu": create_sltu,
"sdc2": create_sdc2,
"bnel": create_bnel,
"dsll": create_dsll,
"nor": create_nor,
"ldl": create_ldl,
"dsubu": create_dsubu,
"sdr": create_sdr,
"multu": create_multu,
"lwc3": create_lwc3,
"divu": create_divu,
"bltzl": create_bltzl,
"blezl": create_blezl,
"tge": create_tge,
"movn": create_movn,
"ld": create_ld,
"mtlo": create_mtlo,
"sltiu": create_sltiu,
"ddivu": create_ddivu,
"teq": create_teq,
"movz": create_movz,
"pref": create_pref,
"slti": create_slti,
"sub": create_sub,
"tlt": create_tlt,
"andi": create_andi,
"bgtz": create_bgtz,
"sync": create_sync,
"tne": create_tne,
"beql": create_beql,
"tltiu": create_tltiu,
"tgeu": create_tgeu,
"bltzall": create_bltzall,
"div": create_div,
"blez": create_blez,
"dsrlv": create_dsrlv,
"sh": create_sh,
"tgei": create_tgei,
"sra": create_sra,
"ddiv": create_ddiv,
"swl": create_swl,
"swc2": create_swc2,
"sll": create_sll,
"jal": create_jal,
"bgez": create_bgez,
"srav": create_srav,
"scd": create_scd,
"sllv": create_sllv,
"lwc2": create_lwc2,
"srlv": create_srlv,
"slt": create_slt,
"dadd": create_dadd,
"cop2": create_cop2,
"break": create_break,
"beq": create_beq,
"sw": create_sw,
"cop3": create_cop3,
"tgeiu": create_tgeiu,
"xori": create_xori,
"sd": create_sd,
"teqi": create_teqi,
"sb": create_sb,
"dsub": create_dsub,
"dmultu": create_dmultu,
"dsra": create_dsra,
"daddu": create_daddu,
"lbu": create_lbu,
"subu": create_subu,
"sc": create_sc,
"dsrl": create_dsrl,
"lld": create_lld,
"bltzal": create_bltzal,
"daddi": create_daddi,
"dmult": create_dmult,
"addi": create_addi,
"dsllv": create_dsllv,
"mthi": create_mthi,
"and": create_and,
"ldc1": create_ldc1,
"mflo": create_mflo,
"cop0": create_cop0,
"jr": create_jr,
"lhu": create_lhu,
"xor": create_xor,
"tnei": create_tnei,
"addu": create_addu,
"tltu": create_tltu,
"tlti": create_tlti,
"sdc1": create_sdc1,
"bne": create_bne,
"ll": create_ll,
"or": create_or,
"mfhi": create_mfhi,
"syscall": create_syscall,
"ldr": create_ldr,
"swc1": create_swc1,
"bgezl": create_bgezl,
})
registers = dict({
"$zero": 0,
"$at": 1,
"$v0": 2,
"$v1": 3,
"$a0": 3,
"$a1": 4,
"$a2": 5,
"$a3": 6,
"$a3": 7,
"$t0": 8,
"$t1": 9,
"$t2": 10,
"$t3": 11,
"$t4": 12,
"$t5": 13,
"$t6": 14,
"$t7": 15,
"$s0": 16,
"$s1": 17,
"$s2": 18,
"$s3": 19,
"$s4": 20,
"$s5": 21,
"$s6": 22,
"$s7": 23,
"$t8": 24,
"$t9": 25,
"$k0": 26,
"$k1": 27,
"$gp": 28,
"$sp": 29,
"$fp": 30,
"$ra": 31,
})
| 34.877966 | 52 | 0.661775 | 706 | 10,289 | 9.464589 | 0.457507 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.537634 | 0.222665 | 10,289 | 294 | 53 | 34.996599 | 0.297824 | 0 | 0 | 0.010274 | 0 | 0 | 0.104286 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.003425 | 0 | 0.003425 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
652159ab6c0ee145e8d61e5b824817c0bbddb7b5 | 5,322 | py | Python | reward_function.py | kiiimhyorim/deepracer-2018-reinvent | afff635dd7bc6b9f9159f0d4d776d6dd16e94e52 | [
"MIT"
] | null | null | null | reward_function.py | kiiimhyorim/deepracer-2018-reinvent | afff635dd7bc6b9f9159f0d4d776d6dd16e94e52 | [
"MIT"
] | null | null | null | reward_function.py | kiiimhyorim/deepracer-2018-reinvent | afff635dd7bc6b9f9159f0d4d776d6dd16e94e52 | [
"MIT"
] | null | null | null | import math
MODE = "shortcut" # center, shortcut
MAX_SIGHT = 1.0
def dist(point1, point2):
return ((point1[0] - point2[0]) ** 2 + (point1[1] - point2[1]) ** 2) ** 0.5
def rect(r, theta):
x = r * math.cos(math.radians(theta))
y = r * math.sin(math.radians(theta))
return x, y
def polar(x, y):
r = (x ** 2 + y ** 2) ** 0.5
theta = math.degrees(math.atan2(y, x))
return r, theta
def angle_mod_360(angle):
n = math.floor(angle / 360.0)
angle_between_0_and_360 = angle - n * 360.0
if angle_between_0_and_360 <= 180.0:
return angle_between_0_and_360
else:
return angle_between_0_and_360 - 360
def get_waypoints_ordered_in_driving_direction(params):
if MODE == "shortcut":
waypoints = get_shortcut_waypoints()
else:
waypoints = params["waypoints"]
if params["is_reversed"]: # driving clock wise.
return list(reversed(waypoints))
else: # driving counter clock wise.
return waypoints
def up_sample(waypoints, factor=10):
p = waypoints
n = len(p)
return [[i / factor * p[int((j + 1) % n)][0] + (1 - i / factor) * p[j][0],
i / factor * p[int((j + 1) % n)][1] + (1 - i / factor) * p[j][1],] for j in range(n) for i in range(factor)]
def get_target_point(params):
waypoints = up_sample(get_waypoints_ordered_in_driving_direction(params), 20)
car = [params["x"], params["y"]]
distances = [dist(p, car) for p in waypoints]
min_dist = min(distances)
i_closest = distances.index(min_dist)
n = len(waypoints)
waypoints_starting_with_closest = [waypoints[(i + i_closest) % n] for i in range(n)]
if MODE == "shortcut":
sight = MAX_SIGHT * 0.8
else:
sight = MAX_SIGHT
r = params["track_width"] * sight
is_inside = [dist(p, car) < r for p in waypoints_starting_with_closest]
i_first_outside = is_inside.index(False)
if i_first_outside < 0:
# this can only happen if we choose r as big as the entire track
return waypoints[i_closest]
return waypoints_starting_with_closest[i_first_outside]
def get_target_steering_degree(params):
tx, ty = get_target_point(params)
car_x = params["x"]
car_y = params["y"]
dx = tx - car_x
dy = ty - car_y
heading = params["heading"]
_, target_angle = polar(dx, dy)
steering_angle = target_angle - heading
return angle_mod_360(steering_angle)
def score_steer_to_point_ahead(params):
best_stearing_angle = get_target_steering_degree(params)
steering_angle = params["steering_angle"]
error = (
steering_angle - best_stearing_angle
) / 60.0 # 60 degree is already really bad
score = 1.0 - abs(error)
return max(
score, 0.01
) # optimizer is rumored to struggle with negative numbers and numbers too close to zero
def reward_function(params):
return float(score_steer_to_point_ahead(params))
def get_shortcut_waypoints():
return [[2.90990644, 0.98407875],
[3.31990641, 0.98420088],
[3.4199064 , 0.98423067],
[3.62991234, 0.98429322],
[4.18990633, 0.98446003],
[4.49991226, 0.98455237],
[4.5499063 , 0.98456726],
[5.31991219, 0.98479663],
[5.41991218, 0.98482642],
[5.77991215, 0.98493365],
[6.2553082 , 0.98873702],
[6.42648362, 1.00861532],
[6.43307007, 1.00938019],
[6.58552838, 1.07519014],
[6.65414056, 1.12115314],
[6.76767029, 1.20752563],
[6.86513054, 1.34568336],
[6.88302339, 1.3793611 ],
[6.97243225, 1.74776337],
[6.96960177, 1.76566469],
[6.96188883, 1.81444516],
[6.86346611, 2.10632023],
[6.7690622 , 2.22274942],
[6.60065918, 2.36186218],
[6.4314447 , 2.43673386],
[6.08237788, 2.46239682],
[5.92238881, 2.46107404],
[5.72240248, 2.45942058],
[5.67257125, 2.45900858],
[5.20260337, 2.45512292],
[5.01861984, 2.45668914],
[4.96918566, 2.4619779 ],
[4.90986465, 2.46832442],
[4.39902628, 2.63606792],
[4.01871064, 2.97147931],
[3.85290613, 3.174899 ],
[3.76129959, 3.28728782],
[3.5341778 , 3.56593551],
[3.44257126, 3.67832433],
[3.30923655, 3.84190797],
[3.09720703, 4.08122162],
[3.02891715, 4.1234712 ],
[2.99478647, 4.14414731],
[2.88433502, 4.18227081],
[2.77887123, 4.19261457],
[2.78081412, 4.19242402],
[2.50940672, 4.18829973],
[2.25845167, 4.18096164],
[1.99925809, 4.17338266],
[1.74859519, 4.16605312],
[1.31461304, 4.11409424],
[1.2783205 , 4.08888491],
[1.02484721, 3.77043495],
[0.99661118, 3.59068639],
[1.16676675, 2.78707146],
[1.17861572, 2.73111083],
[1.21104008, 2.57797629],
[1.23142423, 2.4817055 ],
[1.31634694, 2.08063044],
[1.33863869, 1.97535044],
[1.39027886, 1.73146298],
[1.49782294, 1.28158859],
[1.51857442, 1.22992349],
[1.52968872, 1.20225212],
[1.5434439 , 1.18662043],
[1.61366728, 1.10681699],
[1.63223282, 1.08571869],
[1.64459173, 1.07881414],
[2.03991248, 0.9838196 ],
[2.74991242, 0.98403109],
[2.90990644, 0.98407875]] | 28.459893 | 121 | 0.599587 | 728 | 5,322 | 4.248626 | 0.35989 | 0.021015 | 0.016812 | 0.020692 | 0.142903 | 0.09764 | 0.063369 | 0 | 0 | 0 | 0 | 0.339385 | 0.254791 | 5,322 | 187 | 122 | 28.459893 | 0.440494 | 0.045847 | 0 | 0.041096 | 0 | 0 | 0.015773 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.075342 | false | 0 | 0.006849 | 0.020548 | 0.178082 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
6532ec2d5e91001e4ab8bf4b607b3f366c6b93f6 | 1,484 | py | Python | mall_spider/mall_spider/pipelines.py | liziyou-star/guaiguaiyang | 2470dde58dea255b59abe8ce7bf8bdfbd86af8da | [
"MIT"
] | null | null | null | mall_spider/mall_spider/pipelines.py | liziyou-star/guaiguaiyang | 2470dde58dea255b59abe8ce7bf8bdfbd86af8da | [
"MIT"
] | null | null | null | mall_spider/mall_spider/pipelines.py | liziyou-star/guaiguaiyang | 2470dde58dea255b59abe8ce7bf8bdfbd86af8da | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
from pymongo import MongoClient
from mall_spider.spiders.jd_category import JdCategorySpider
from mall_spider.settings import MONGODB_URL
from mall_spider.spiders.jd_product import JdProductSpider
class CategoryPipeline(object):
#当爬虫启动的时候执行
def open_spider(self, spider):
#判断是不是当前运行的爬虫
if isinstance(spider, JdCategorySpider):
self.client = MongoClient(MONGODB_URL)
self.collection = self.client['jd']['category']
def process_item(self, item, spider):
if isinstance(spider, JdCategorySpider):
self.collection.insert_one(dict(item))
return item
def close_spider(self, spider):
if isinstance(spider, JdCategorySpider):
self.client.close()
class ProductPipeline(object):
#当爬虫启动的时候执行
def open_spider(self, spider):
#判断是不是当前运行的爬虫
if isinstance(spider, JdProductSpider):
self.client = MongoClient(MONGODB_URL)
self.collection = self.client['jd']['product']
def process_item(self, item, spider):
if isinstance(spider, JdProductSpider):
self.collection.insert_one(dict(item))
return item
def close_spider(self, spider):
if isinstance(spider, JdProductSpider):
self.client.close()
| 30.285714 | 66 | 0.684636 | 168 | 1,484 | 5.946429 | 0.35119 | 0.072072 | 0.108108 | 0.096096 | 0.66967 | 0.623624 | 0.510511 | 0.510511 | 0.510511 | 0.418418 | 0 | 0.000864 | 0.22035 | 1,484 | 48 | 67 | 30.916667 | 0.862576 | 0.152291 | 0 | 0.714286 | 0 | 0 | 0.015224 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.142857 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e8dda7b9145c47b757b6107b5896ba016ccaac31 | 669 | py | Python | main/plugins/state.py | fakegit/gxgk-wechat-server | 89ad21bcd2dcd1c28e43d4b230d47207e78098b3 | [
"MIT"
] | 1,564 | 2015-09-01T13:11:02.000Z | 2022-03-29T08:44:56.000Z | main/plugins/state.py | fakegit/gxgk-wechat-server | 89ad21bcd2dcd1c28e43d4b230d47207e78098b3 | [
"MIT"
] | 11 | 2015-12-13T05:04:15.000Z | 2019-09-10T06:14:03.000Z | main/plugins/state.py | fakegit/gxgk-wechat-server | 89ad21bcd2dcd1c28e43d4b230d47207e78098b3 | [
"MIT"
] | 649 | 2015-12-11T09:23:09.000Z | 2022-03-04T17:31:28.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .. import redis
def set_user_state(openid, state):
"""设置用户状态"""
redis.hset('wechat:user:' + openid, 'state', state)
return None
def get_user_state(openid):
"""获取用户状态"""
return redis.hget('wechat:user:' + openid, 'state')
def set_user_last_interact_time(openid, timestamp):
"""保存最后一次交互时间"""
redis.hset('wechat:user:' + openid, 'last_interact_time', timestamp)
return None
def get_user_last_interact_time(openid):
"""获取最后一次交互时间"""
last_time = redis.hget('wechat:user:' + openid, 'last_interact_time')
if last_time:
return last_time
else:
return 0
| 21.580645 | 73 | 0.651719 | 86 | 669 | 4.848837 | 0.372093 | 0.095923 | 0.153477 | 0.091127 | 0.527578 | 0.153477 | 0 | 0 | 0 | 0 | 0 | 0.003711 | 0.19432 | 669 | 30 | 74 | 22.3 | 0.769944 | 0.116592 | 0 | 0.133333 | 0 | 0 | 0.165202 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0.066667 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
e8e5624027f98fe6a997d263a3193816a19aaeae | 348 | py | Python | arcplus/profile-arcpy-listFC.py | envygeo/arcplus | 87c6a0afa616797ce1234823732ffa117b8e23c1 | [
"MIT"
] | 20 | 2018-01-04T16:32:18.000Z | 2022-03-30T23:58:58.000Z | arcplus/profile-arcpy-listFC.py | envygeo/arcplus | 87c6a0afa616797ce1234823732ffa117b8e23c1 | [
"MIT"
] | 3 | 2018-05-14T16:49:42.000Z | 2020-11-26T22:19:43.000Z | arcplus/profile-arcpy-listFC.py | envygeo/arcplus | 87c6a0afa616797ce1234823732ffa117b8e23c1 | [
"MIT"
] | 6 | 2018-01-04T16:32:21.000Z | 2022-03-15T09:37:18.000Z | import arcpy
#gdb = r'X:\Env-dat.081\source\yt_courbe_niveau_imperial.gdb'
gdb = r'D:\s\yt_courbe_niveau_imperial.gdb'
def arcpy_listFC(gdb):
arcpy.env.workspace = gdb
print 'Looking in "%s" ' % arcpy.env.workspace
fcs = arcpy.ListFeatureClasses()
return fcs
fcs = arcpy_listFC(gdb)
print 'Feature classes found: %s' % len(fcs)
| 23.2 | 61 | 0.70977 | 54 | 348 | 4.425926 | 0.518519 | 0.033473 | 0.117155 | 0.1841 | 0.209205 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010239 | 0.158046 | 348 | 14 | 62 | 24.857143 | 0.805461 | 0.172414 | 0 | 0 | 0 | 0 | 0.261324 | 0.118467 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.111111 | null | null | 0.222222 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e8fa254af297e9e8554d01a167105ac0ee6ae414 | 584 | py | Python | app/src/sane.py | fidlej/myerrata | c5b5cc78303bb783eb59a6d6c628d2b27a6584ca | [
"MIT"
] | null | null | null | app/src/sane.py | fidlej/myerrata | c5b5cc78303bb783eb59a6d6c628d2b27a6584ca | [
"MIT"
] | null | null | null | app/src/sane.py | fidlej/myerrata | c5b5cc78303bb783eb59a6d6c628d2b27a6584ca | [
"MIT"
] | null | null | null |
import re
class BadRequestError(ValueError):
pass
def valid_int(value):
"""Converts the value to an integer value or zero.
"""
try:
result = int(value)
except ValueError:
result = 0
return result
URL_PATTERN = re.compile(r"^https?://([^#]+)")
def valid_url(url):
match = URL_PATTERN.match(url)
if match is None:
#TODO: raise a HTTP error
raise BadRequestError("Invalid HTTP URL: %r" % url)
url = match.group(1)
if len(url) > 500:
raise BadRequestError("Too long URL: %r" % url)
return url
| 17.69697 | 59 | 0.60274 | 77 | 584 | 4.519481 | 0.558442 | 0.045977 | 0.063218 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011876 | 0.27911 | 584 | 32 | 60 | 18.25 | 0.814727 | 0.131849 | 0 | 0 | 0 | 0 | 0.106212 | 0 | 0 | 0 | 0 | 0.03125 | 0 | 1 | 0.111111 | false | 0.055556 | 0.055556 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
33002259b80c7b8c01cbf880d2f7f3910b34472e | 156 | py | Python | logFermentation/vars.py | KasperSkytte/KaspbeeryPi | b1666f8da56ab8b3512e3d026c1efb4b8787efc2 | [
"MIT"
] | null | null | null | logFermentation/vars.py | KasperSkytte/KaspbeeryPi | b1666f8da56ab8b3512e3d026c1efb4b8787efc2 | [
"MIT"
] | null | null | null | logFermentation/vars.py | KasperSkytte/KaspbeeryPi | b1666f8da56ab8b3512e3d026c1efb4b8787efc2 | [
"MIT"
] | null | null | null | tilt_id = "a495bb30c5b14b44b5121370f02d74de"
tilt_sg_adjust = 0
read_interval = 15
dropbox_token = ""
dropbox_folder = "data"
brewfatherCustomStreamURL = "" | 26 | 44 | 0.801282 | 16 | 156 | 7.4375 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.172662 | 0.108974 | 156 | 6 | 45 | 26 | 0.683453 | 0 | 0 | 0 | 0 | 0 | 0.229299 | 0.203822 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
330ebae7e6102b35a5013ce48ab0f8909e905f0f | 689 | py | Python | posts/forms.py | je-ss-y/Insta-memories | d92bcb56eaa742be1fd26c58f14b2895a5ac15d4 | [
"CNRI-Python"
] | null | null | null | posts/forms.py | je-ss-y/Insta-memories | d92bcb56eaa742be1fd26c58f14b2895a5ac15d4 | [
"CNRI-Python"
] | 4 | 2020-06-05T23:57:40.000Z | 2021-09-08T01:22:45.000Z | posts/forms.py | je-ss-y/Insta-memories | d92bcb56eaa742be1fd26c58f14b2895a5ac15d4 | [
"CNRI-Python"
] | null | null | null | from django.db import models
from .models import Image,Profile,Comment
from django import forms
from django.contrib.auth.models import User
class NewImageForm(forms.ModelForm):
class Meta:
model = Image
exclude = ['user', 'pub_date']
# widgets = {
# 'tags': forms.CheckboxSelectMultiple(),
# }
class ProfileForm(forms.ModelForm):
class Meta:
model = Profile
fields = ['bio', 'profilepicture']
# widgets = {
# 'tags': forms.CheckboxSelectMultiple(),
# }
class CommentForm(forms.ModelForm):
class Meta:
model = Comment
fields = ['comment']
| 18.621622 | 53 | 0.580552 | 63 | 689 | 6.333333 | 0.444444 | 0.075188 | 0.142857 | 0.172932 | 0.426065 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.314949 | 689 | 37 | 54 | 18.621622 | 0.845339 | 0.166909 | 0 | 0.1875 | 0 | 0 | 0.06338 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
3324f3fb89d8956c91f0a0bed92c49ffe951cd5e | 2,046 | py | Python | tests/test_utils.py | vint21h/django-read-only-admin | 32b217c6f9d72b2d12da672baca8942eefa5c6d2 | [
"MIT"
] | 31 | 2017-05-25T20:16:00.000Z | 2021-08-23T10:42:56.000Z | tests/test_utils.py | vint21h/django-read-only-admin | 32b217c6f9d72b2d12da672baca8942eefa5c6d2 | [
"MIT"
] | 4 | 2017-07-28T15:05:02.000Z | 2022-03-31T06:24:58.000Z | tests/test_utils.py | vint21h/django-read-only-admin | 32b217c6f9d72b2d12da672baca8942eefa5c6d2 | [
"MIT"
] | 3 | 2017-06-08T12:18:27.000Z | 2018-05-22T06:02:03.000Z | # -*- coding: utf-8 -*-
# django-read-only-admin
# tests/test_utils.py
from typing import List # pylint: disable=W0611
from django.test import TestCase
from django.test.utils import override_settings
from read_only_admin.utils import (
get_read_only_permission_name,
get_read_only_permission_codename,
)
__all__ = [
"GetReadOnlyPermissionCodenameUtilTest",
"GetReadOnlyPermissionNameUtilTest",
] # type: List[str]
class GetReadOnlyPermissionCodenameUtilTest(TestCase):
"""
get_read_only_permission_codename util tests.
"""
def test_get_read_only_permission_codename(self) -> None:
"""
Util must return model read only permission codename based on read only prefix setting. # noqa: E501
"""
self.assertEqual(
get_read_only_permission_codename(model="user"), "readonly_user"
)
@override_settings(READ_ONLY_ADMIN_PERMISSION_PREFIX="")
def test_get_read_only_permission_codename__without_prefix(self) -> None:
"""
Util must return model read only permission codename based on read only prefix setting with broken prefix settings. # noqa: E501
"""
self.assertEqual(get_read_only_permission_codename(model="user"), "_user")
class GetReadOnlyPermissionNameUtilTest(TestCase):
"""
get_read_only_permission_name util tests.
"""
def test_get_read_only_permission_name(self) -> None:
"""
Util must return model read only permission name based on read only name prefix setting. # noqa: E501
"""
self.assertEqual(get_read_only_permission_name(model="user"), "Read only user")
@override_settings(READ_ONLY_ADMIN_PERMISSION_NAME_PREFIX="")
def test_get_read_only_permission_name__without_prefix(self) -> None:
"""
Util must return model read only permission name based on read only name prefix setting with broken name prefix settings. # noqa: E501
"""
self.assertEqual(get_read_only_permission_name(model="user"), " user")
| 31 | 143 | 0.716031 | 245 | 2,046 | 5.657143 | 0.204082 | 0.1443 | 0.207792 | 0.181818 | 0.714286 | 0.62482 | 0.62482 | 0.496393 | 0.443001 | 0.443001 | 0 | 0.010385 | 0.199902 | 2,046 | 65 | 144 | 31.476923 | 0.836286 | 0.323558 | 0 | 0 | 0 | 0 | 0.097852 | 0.055688 | 0 | 0 | 0 | 0 | 0.16 | 1 | 0.16 | false | 0 | 0.16 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
332d1509f28b44fbe2aa6229db97a13fd373fbeb | 515 | py | Python | poll/models.py | mallimuondu/polls | 6e45e99440d0bee7bf006f6bb1c0e8ff0ecb76c1 | [
"MIT"
] | null | null | null | poll/models.py | mallimuondu/polls | 6e45e99440d0bee7bf006f6bb1c0e8ff0ecb76c1 | [
"MIT"
] | null | null | null | poll/models.py | mallimuondu/polls | 6e45e99440d0bee7bf006f6bb1c0e8ff0ecb76c1 | [
"MIT"
] | null | null | null | from django.db import models
# Create your models here.
class Poll(models.Model):
question = models.TextField()
choice_1 = models.CharField(max_length=30)
choice_2 = models.CharField(max_length=30)
choice_3 = models.CharField(max_length=30)
choice_1_count = models.IntegerField(default=0)
choice_2_count = models.IntegerField(default=0)
choice_3_count = models.IntegerField(default=0)
def total(self):
return self.choice_1_count + self.choice_2_count + self.choice_3_count | 34.333333 | 78 | 0.745631 | 74 | 515 | 4.945946 | 0.391892 | 0.057377 | 0.147541 | 0.196721 | 0.54918 | 0.464481 | 0 | 0 | 0 | 0 | 0 | 0.04157 | 0.159223 | 515 | 15 | 78 | 34.333333 | 0.803695 | 0.046602 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.090909 | 0.090909 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
333615c2465f69cffc0d45983824c8634172d444 | 195 | py | Python | games/Python/HeadsorTails.py | takshaygoyal/al-go-rithms | c113ac0cb8e2c5942f168ea3a92d31741b1461ea | [
"CC0-1.0"
] | 1,253 | 2017-06-06T07:19:25.000Z | 2022-03-30T17:07:58.000Z | games/Python/HeadsorTails.py | ammonschiffer/al-go-rithms | f14e248b408989360ae2c56068ef6cece4f75945 | [
"CC0-1.0"
] | 554 | 2017-09-29T18:56:01.000Z | 2022-02-21T15:48:13.000Z | games/Python/HeadsorTails.py | ammonschiffer/al-go-rithms | f14e248b408989360ae2c56068ef6cece4f75945 | [
"CC0-1.0"
] | 2,226 | 2017-09-29T19:59:59.000Z | 2022-03-25T08:59:55.000Z | import random
print('Enter the two different values')
first = input('Enter first side : ')
second = input('Enter second side : ')
fate = [first,second]
x=random.randint(0,1)
print(fate[x])
| 19.5 | 39 | 0.687179 | 29 | 195 | 4.62069 | 0.586207 | 0.149254 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01227 | 0.164103 | 195 | 9 | 40 | 21.666667 | 0.809816 | 0 | 0 | 0 | 0 | 0 | 0.353846 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0.285714 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
333b4312cad208810662592d7ee7a6795b041233 | 87 | py | Python | baekjoon/easy-math/3052-reminder.py | honux77/algorithm | 2ed8cef1fbee7ad96d8f2ae583666d52bd8892ee | [
"MIT"
] | 2 | 2019-02-08T01:23:07.000Z | 2020-11-19T12:23:52.000Z | baekjoon/easy-math/3052-reminder.py | honux77/algorithm | 2ed8cef1fbee7ad96d8f2ae583666d52bd8892ee | [
"MIT"
] | null | null | null | baekjoon/easy-math/3052-reminder.py | honux77/algorithm | 2ed8cef1fbee7ad96d8f2ae583666d52bd8892ee | [
"MIT"
] | null | null | null | ans = {}
for i in range(10):
n = int(input()) % 42
ans[n] = 1;
print(len(ans)) | 14.5 | 25 | 0.494253 | 16 | 87 | 2.6875 | 0.8125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.079365 | 0.275862 | 87 | 6 | 26 | 14.5 | 0.603175 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3349e22c068ea4040993935ad44f04fc61d523c4 | 302 | py | Python | refleksi/models.py | reflekt-io/reflekt.io | 6b25cd57c2efd308e948846838ad109cdb6c5c07 | [
"Unlicense"
] | null | null | null | refleksi/models.py | reflekt-io/reflekt.io | 6b25cd57c2efd308e948846838ad109cdb6c5c07 | [
"Unlicense"
] | 1 | 2021-10-30T05:15:04.000Z | 2021-10-30T05:15:04.000Z | refleksi/models.py | reflekt-io/reflekt.io | 6b25cd57c2efd308e948846838ad109cdb6c5c07 | [
"Unlicense"
] | null | null | null | from django.db import models
from django.contrib.auth.models import User
class Kegiatan(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
date = models.DateTimeField(auto_now=True)
nama = models.CharField(max_length=40)
deskripsi = models.CharField(max_length=60) | 37.75 | 60 | 0.771523 | 42 | 302 | 5.452381 | 0.642857 | 0.087336 | 0.157205 | 0.209607 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015209 | 0.129139 | 302 | 8 | 61 | 37.75 | 0.855513 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3350c65261a8aa941a4e08cf558c05548444ea91 | 670 | py | Python | snapflow_crunchbase/functions/import_funding_rounds.py | kvh/snapflow-crunchbase | 8fd693ef574f281934a7003b3679cb336af144ec | [
"BSD-3-Clause"
] | null | null | null | snapflow_crunchbase/functions/import_funding_rounds.py | kvh/snapflow-crunchbase | 8fd693ef574f281934a7003b3679cb336af144ec | [
"BSD-3-Clause"
] | null | null | null | snapflow_crunchbase/functions/import_funding_rounds.py | kvh/snapflow-crunchbase | 8fd693ef574f281934a7003b3679cb336af144ec | [
"BSD-3-Clause"
] | null | null | null | from __future__ import annotations
from dataclasses import dataclass
from datetime import datetime
from snapflow import DataFunctionContext, datafunction
from . import base_import
@dataclass
class ImportCrunchbaseFundingRoundsCSVState:
latest_imported_at: datetime
@datafunction(
"import_funding_rounds",
namespace="crunchbase",
state_class=ImportCrunchbaseFundingRoundsCSVState,
display_name="Import Crunchbase Funding Rounds",
)
def import_funding_rounds(
ctx: DataFunctionContext, user_key: str, use_sample: bool = False,
):
base_import(
data_source="funding_rounds", user_key=user_key, ctx=ctx, use_sample=use_sample,
)
| 24.814815 | 88 | 0.789552 | 72 | 670 | 7.041667 | 0.472222 | 0.102564 | 0.074951 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146269 | 670 | 26 | 89 | 25.769231 | 0.886364 | 0 | 0 | 0 | 0 | 0 | 0.114925 | 0.031343 | 0 | 0 | 0 | 0 | 0 | 1 | 0.05 | false | 0 | 0.6 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
336352afcd8d431e632bdf384ede70b4a9b883c9 | 2,927 | py | Python | cogs/stats.py | Bmbus/DiscordAnalytica | 663ebbe83789432804e45929fdea136b957a6237 | [
"MIT"
] | 1 | 2019-09-15T14:31:05.000Z | 2019-09-15T14:31:05.000Z | cogs/stats.py | Bmbus/DiscordAnalytica | 663ebbe83789432804e45929fdea136b957a6237 | [
"MIT"
] | null | null | null | cogs/stats.py | Bmbus/DiscordAnalytica | 663ebbe83789432804e45929fdea136b957a6237 | [
"MIT"
] | null | null | null | from discord.ext import commands
from dataminer.bot_data import bot_requests
from discord import Embed
from datetime import datetime
class Stats(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.has_permissions(administrator=True)
@commands.cooldown(1, 5.0, commands.BucketType.user)
@commands.command(name="stats")
async def _stats(self, ctx):
"""Get general stats of the server
This command can only be used on a server
"""
await bot_requests(ctx.message, str(ctx.command), self.bot.db)
data = await self.bot.db.find_one({"_id": str(ctx.guild.id)})
embed = Embed(title=f"{ctx.guild.name} ~ general stats", timestamp=datetime.utcnow())
embed.add_field(name="Total messages send:*", value=f"{len(data['message'])}", inline=True)
embed.add_field(name="Total message edited:*", value=f"{len(data['message_edit'])}", inline=True)
embed.add_field(name="Total message deleted:*", value=f"{len(data['message_delete'])}", inline=True)
embed.add_field(name="Total reactions added:*", value=f"{len(data['reaction'])}", inline=True)
embed.add_field(name="Total bot requests:*", value=f"{len(data['bot_requests'])}", inline=True)
embed.add_field(name="Total bot messages:*", value=f"{len(data['bot_msg'])}", inline=True)
embed.add_field(name="Total user-joins:*", value=f"{len(data['userjoins'])}", inline=True)
embed.add_field(name="Total user-leaves:*", value=f"{len(data['userleave'])}", inline=True)
embed.add_field(name="Total mentions:*", value=f"{len(data['mentions'])}", inline=True)
embed.add_field(name="Total status/game changes counted:*", value=f"{len(data['status'])}")
embed.add_field(name="Total user bans counted:*", value=len(data['user_ban']), inline=True)
embed.add_field(name="Total user bans counted:*", value=len(data['user_unban']), inline=True)
embed.add_field(name="Total voice joins/leaves:*", value=len(data['voice']), inline=True)
embed.add_field(name="Total nickname changes counted:*", value=len(data['user_nickchange']), inline=True)
embed.add_field(name="Total invites created:", value=len(data['invite_create']), inline=True)
embed.add_field(name="Total guild updated counted:*", value=len(data['guild_update']), inline=True)
embed.add_field(name="Total users:", value=f"{ctx.guild.member_count}", inline=True)
embed.add_field(name="Total text channels:", value=len(ctx.guild.text_channels), inline=True)
embed.add_field(name="Total voice channels", value=len(ctx.guild.voice_channels), inline=True)
embed.set_footer(text=f"Since I joined the server: {data['server_join']}", icon_url=self.bot.user.avatar_url) # TODO add total users, channels ...
return await ctx.send(embed=embed)
async def setup(bot):
await bot.add_cog(Stats(bot)) | 60.979167 | 154 | 0.681927 | 419 | 2,927 | 4.651551 | 0.260143 | 0.077989 | 0.126732 | 0.165726 | 0.436634 | 0.341714 | 0.341714 | 0.210364 | 0.054387 | 0.054387 | 0 | 0.001205 | 0.1493 | 2,927 | 48 | 155 | 60.979167 | 0.781526 | 0.011616 | 0 | 0 | 0 | 0 | 0.302326 | 0.102683 | 0 | 0 | 0 | 0.020833 | 0 | 1 | 0.027027 | false | 0 | 0.108108 | 0 | 0.189189 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
33661bbcdf3ac9d986d953ad806db0aeed766714 | 848 | py | Python | tests/test_pnmethod/test_stopping_citerion/test_stopping_criterion.py | fxbriol/probnum | 7e0e94cf9146aaa2b730b02c6d75a022cd629b5c | [
"MIT"
] | 1 | 2021-04-16T14:45:26.000Z | 2021-04-16T14:45:26.000Z | tests/test_pnmethod/test_stopping_citerion/test_stopping_criterion.py | fxbriol/probnum | 7e0e94cf9146aaa2b730b02c6d75a022cd629b5c | [
"MIT"
] | 42 | 2021-03-08T07:20:40.000Z | 2022-03-28T05:04:48.000Z | tests/test_pnmethod/test_stopping_citerion/test_stopping_criterion.py | fxbriol/probnum | 7e0e94cf9146aaa2b730b02c6d75a022cd629b5c | [
"MIT"
] | null | null | null | """Tests for stopping criteria of probabilistic linear solvers."""
import operator
from typing import Callable
import pytest
from probnum import LambdaStoppingCriterion, StoppingCriterion
@pytest.fixture
def stopcrit():
return LambdaStoppingCriterion(stopcrit=lambda: True)
def test_invert_stopcrit(stopcrit: StoppingCriterion):
assert (not stopcrit()) == (~stopcrit)()
@pytest.mark.parametrize("binary_op", [operator.and_, operator.or_])
def test_boolean_binary_arithmetic(binary_op: Callable, stopcrit: StoppingCriterion):
assert binary_op(stopcrit(), stopcrit()) == binary_op(stopcrit, stopcrit)()
def test_lambda_stopping_criterion():
"""Test whether a stopping criterion can be created from an anonymous function."""
stopcrit = LambdaStoppingCriterion(stopcrit=lambda tol: tol < 1e-6)
assert stopcrit(1e-12)
| 29.241379 | 86 | 0.773585 | 97 | 848 | 6.618557 | 0.494845 | 0.099688 | 0.115265 | 0.074766 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006748 | 0.126179 | 848 | 28 | 87 | 30.285714 | 0.859649 | 0.161557 | 0 | 0 | 0 | 0 | 0.012857 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.266667 | false | 0 | 0.266667 | 0.066667 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
682bc2f3d5c20bcd4adf308de98b9661fb68a4bd | 350 | py | Python | scripts/alcohol_and_cig_cases.py | XiaoyunZhouusc/final_project | 30608ff2fc301d7ff04c57a4b80adc3adc6a2aad | [
"MIT"
] | null | null | null | scripts/alcohol_and_cig_cases.py | XiaoyunZhouusc/final_project | 30608ff2fc301d7ff04c57a4b80adc3adc6a2aad | [
"MIT"
] | null | null | null | scripts/alcohol_and_cig_cases.py | XiaoyunZhouusc/final_project | 30608ff2fc301d7ff04c57a4b80adc3adc6a2aad | [
"MIT"
] | 2 | 2021-11-10T05:04:04.000Z | 2021-11-12T06:10:17.000Z | alcohol_cases = None
with open('../static/alcohol_cases.txt', 'r') as f:
alcohol_cases = f.readlines()
smoke_cases = None
with open('../static/smoke_cases.txt', 'r') as f:
smoke_cases = f.readlines()
with open('../static/alcohol_and_cig_cases.txt', 'w') as f:
for i in smoke_cases:
if i in alcohol_cases:
f.write(i)
| 26.923077 | 59 | 0.645714 | 56 | 350 | 3.839286 | 0.357143 | 0.223256 | 0.195349 | 0.15814 | 0.325581 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 350 | 12 | 60 | 29.166667 | 0.767857 | 0 | 0 | 0 | 0 | 0 | 0.257143 | 0.248571 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
6837c77326153c3afdee418404127c1527af27cf | 659 | gyp | Python | test/make_global_settings/ld/make_global_settings_ld.gyp | chlorm-forks/gyp | a8921fcaab1a18c8cf7e4ab09ceb940e336918ec | [
"BSD-3-Clause"
] | 2,151 | 2020-04-18T07:31:17.000Z | 2022-03-31T08:39:18.000Z | test/make_global_settings/ld/make_global_settings_ld.gyp | chlorm-forks/gyp | a8921fcaab1a18c8cf7e4ab09ceb940e336918ec | [
"BSD-3-Clause"
] | 1,432 | 2017-06-21T04:08:48.000Z | 2020-08-25T16:21:15.000Z | test/make_global_settings/ld/make_global_settings_ld.gyp | chlorm-forks/gyp | a8921fcaab1a18c8cf7e4ab09ceb940e336918ec | [
"BSD-3-Clause"
] | 338 | 2020-04-18T08:03:10.000Z | 2022-03-29T12:33:22.000Z | # Copyright (c) 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style licence that can be
# found in the LICENSE file.
{
'variables': {
'custom_ld_target%': '',
'custom_ld_host%': '',
},
'conditions': [
['"<(custom_ld_target)"!=""', {
'make_global_settings': [
['LD', '<(custom_ld_target)'],
],
}],
['"<(custom_ld_host)"!=""', {
'make_global_settings': [
['LD.host', '<(custom_ld_host)'],
],
}],
],
'targets': [
{
'target_name': 'make_global_settings_ld_test',
'type': 'static_library',
'sources': [ 'foo.c' ],
},
],
}
| 21.966667 | 72 | 0.52959 | 71 | 659 | 4.605634 | 0.633803 | 0.146789 | 0.12844 | 0.183486 | 0.159021 | 0.159021 | 0 | 0 | 0 | 0 | 0 | 0.008247 | 0.264036 | 659 | 29 | 73 | 22.724138 | 0.665979 | 0.2261 | 0 | 0.32 | 0 | 0 | 0.513834 | 0.150198 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
68511b16c9da0f60d9cbd4748cd2a75f28d55aaa | 63 | py | Python | text/_elisp/text/__init__.py | jedhsu/text | 8525b602d304ac571a629104c48703443244545c | [
"Apache-2.0"
] | null | null | null | text/_elisp/text/__init__.py | jedhsu/text | 8525b602d304ac571a629104c48703443244545c | [
"Apache-2.0"
] | null | null | null | text/_elisp/text/__init__.py | jedhsu/text | 8525b602d304ac571a629104c48703443244545c | [
"Apache-2.0"
] | null | null | null | from ._text import BufferText
__all__ = [
"BufferText",
]
| 10.5 | 29 | 0.666667 | 6 | 63 | 6.166667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 63 | 5 | 30 | 12.6 | 0.755102 | 0 | 0 | 0 | 0 | 0 | 0.15873 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
685b52c872862226e1a1563d89f990a1201d4fad | 1,001 | py | Python | neodroid/messaging/fbs/FBSModels/FBody.py | sintefneodroid/neo | 0999f1dff95c4a8c5880a9b3add532d74f38586a | [
"Apache-2.0"
] | 7 | 2017-09-13T08:28:37.000Z | 2022-01-21T15:59:14.000Z | neodroid/messaging/fbs/FBSModels/FBody.py | sintefneodroid/neo | 0999f1dff95c4a8c5880a9b3add532d74f38586a | [
"Apache-2.0"
] | 25 | 2019-03-25T13:49:43.000Z | 2019-05-02T13:58:13.000Z | neodroid/messaging/fbs/FBSModels/FBody.py | sintefneodroid/neo | 0999f1dff95c4a8c5880a9b3add532d74f38586a | [
"Apache-2.0"
] | 2 | 2017-09-21T10:14:39.000Z | 2017-10-21T09:57:04.000Z | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: FBS
import flatbuffers
class FBody(object):
__slots__ = ["_tab"]
# FBody
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# FBody
def Velocity(self, obj):
obj.Init(self._tab.Bytes, self._tab.Pos + 0)
return obj
# FBody
def AngularVelocity(self, obj):
obj.Init(self._tab.Bytes, self._tab.Pos + 24)
return obj
def CreateFBody(
builder,
velocity_x,
velocity_y,
velocity_z,
angular_velocity_x,
angular_velocity_y,
angular_velocity_z,
):
builder.Prep(8, 48)
builder.Prep(8, 24)
builder.PrependFloat64(angular_velocity_z)
builder.PrependFloat64(angular_velocity_y)
builder.PrependFloat64(angular_velocity_x)
builder.Prep(8, 24)
builder.PrependFloat64(velocity_z)
builder.PrependFloat64(velocity_y)
builder.PrependFloat64(velocity_x)
return builder.Offset()
| 22.244444 | 68 | 0.683317 | 123 | 1,001 | 5.333333 | 0.333333 | 0.137195 | 0.073171 | 0.164634 | 0.216463 | 0.216463 | 0.109756 | 0.109756 | 0.109756 | 0.109756 | 0 | 0.030769 | 0.220779 | 1,001 | 44 | 69 | 22.75 | 0.810256 | 0.098901 | 0 | 0.133333 | 1 | 0 | 0.004464 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.133333 | false | 0 | 0.033333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
686203cc74c0b4a0efb945a04a01ce6c5fb840b8 | 296 | py | Python | src/runall-wines.py | clausvestergaard/reproPython | ca3a7f7c9273c84e941fdd372ba0064681116d83 | [
"BSD-3-Clause"
] | null | null | null | src/runall-wines.py | clausvestergaard/reproPython | ca3a7f7c9273c84e941fdd372ba0064681116d83 | [
"BSD-3-Clause"
] | null | null | null | src/runall-wines.py | clausvestergaard/reproPython | ca3a7f7c9273c84e941fdd372ba0064681116d83 | [
"BSD-3-Clause"
] | null | null | null | import datetime
from .data import subset_data_GBP
from .data import country_subset
today = datetime.datetime.today().strftime('%Y-%m-%d')
subset_data_GBP.process_data_GBP('./data/raw/winemag-data-130k-v2.csv')
country_subset.get_country(f'./data/interim/{today}-winemag_priceGBP.csv', 'Chile')
| 32.888889 | 83 | 0.783784 | 46 | 296 | 4.826087 | 0.5 | 0.094595 | 0.126126 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014388 | 0.060811 | 296 | 8 | 84 | 37 | 0.784173 | 0 | 0 | 0 | 0 | 0 | 0.307432 | 0.263514 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
6863ee0a44172e9ad49cc78b0e95a84f1aaad1cd | 1,901 | py | Python | src/tests/test_application_info.py | uwmisl/poretitioner | 0ff9f67a3b25fdcb460b11c970b2ed366da07da7 | [
"MIT"
] | 2 | 2021-03-11T21:27:16.000Z | 2021-03-18T00:58:22.000Z | src/tests/test_application_info.py | uwmisl/poretitioner | 0ff9f67a3b25fdcb460b11c970b2ed366da07da7 | [
"MIT"
] | 12 | 2021-02-19T19:36:05.000Z | 2021-03-24T15:38:02.000Z | src/tests/test_application_info.py | uwmisl/poretitioner | 0ff9f67a3b25fdcb460b11c970b2ed366da07da7 | [
"MIT"
] | null | null | null | """
========================
test_application_info.py
========================
This module tests application metadata reading,
namely getting the application name and version.
"""
import json
from contextlib import suppress
from unittest.mock import mock_open, patch
from src.poretitioner.application_info import get_application_info
# Fake application version
MOCK_VERSION = "17.29.0"
# Fake application name
MOCK_APPLICATION_NAME = "arbitrary_name"
# Mocks our APPLICATION_INFO.json file.
APPLICATION_INFO_MOCK_JSON = json.dumps({"version": MOCK_VERSION, "name": MOCK_APPLICATION_NAME})
def setup_function(function):
with suppress(AttributeError):
# If using `get_application_info` is implemented with the lru_cache decorator, clear it before running each unit test.
get_application_info.cache_clear()
@patch("builtins.open", mock_open(read_data=APPLICATION_INFO_MOCK_JSON))
def get_application_info_data_test():
"""Test project name and version are properly parsed."""
info = get_application_info()
assert info.version == MOCK_VERSION
assert info.name == MOCK_APPLICATION_NAME
@patch("builtins.open", mock_open(read_data=APPLICATION_INFO_MOCK_JSON))
def get_application_info_cache_test():
"""Test that the metadata file isn't opened more than once, even if the data is requested multiple times."""
get_application_info()
get_application_info()
get_application_info()
get_application_info()
open.assert_called_once()
@patch("builtins.open", mock_open(read_data=APPLICATION_INFO_MOCK_JSON))
def get_application_info_idempotent_test():
"""Test that the project metadata never changes once read, even if the data is requested multiple times."""
info = get_application_info()
info2 = get_application_info()
info3 = get_application_info()
assert info == info2
assert info2 == info3
assert info == info3
| 32.775862 | 126 | 0.75171 | 252 | 1,901 | 5.384921 | 0.313492 | 0.23213 | 0.185704 | 0.081061 | 0.319086 | 0.277819 | 0.277819 | 0.277819 | 0.223287 | 0.170228 | 0 | 0.006757 | 0.143609 | 1,901 | 57 | 127 | 33.350877 | 0.826781 | 0.331931 | 0 | 0.3 | 0 | 0 | 0.05712 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.133333 | false | 0 | 0.133333 | 0 | 0.266667 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
686da97ce385fc410e266ed4d8450029a80ddb28 | 47,296 | py | Python | pysnmp/HP-SN-MPLS-TE-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/HP-SN-MPLS-TE-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/HP-SN-MPLS-TE-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module HP-SN-MPLS-TE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-SN-MIBS
# Produced by pysmi-0.3.4 at Mon Apr 29 19:23:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint")
mplsMIB, MplsLsrIdentifier, MplsTunnelAffinity, MplsTunnelInstanceIndex, MplsPathIndexOrZero, MplsPathIndex, MplsBurstSize, MplsLSPID, MplsBitRate, MplsTunnelIndex = mibBuilder.importSymbols("HP-SN-MPLS-TC-MIB", "mplsMIB", "MplsLsrIdentifier", "MplsTunnelAffinity", "MplsTunnelInstanceIndex", "MplsPathIndexOrZero", "MplsPathIndex", "MplsBurstSize", "MplsLSPID", "MplsBitRate", "MplsTunnelIndex")
snMpls, = mibBuilder.importSymbols("HP-SN-ROOT-MIB", "snMpls")
InterfaceIndexOrZero, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndexOrZero")
InetAddressIPv4, InetAddressIPv6 = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressIPv4", "InetAddressIPv6")
ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup")
IpAddress, Integer32, Counter32, Counter64, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, TimeTicks, iso, Bits, Gauge32, ObjectIdentity, MibIdentifier, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "Integer32", "Counter32", "Counter64", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "TimeTicks", "iso", "Bits", "Gauge32", "ObjectIdentity", "MibIdentifier", "ModuleIdentity")
RowPointer, TimeStamp, TruthValue, TextualConvention, RowStatus, StorageType, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "RowPointer", "TimeStamp", "TruthValue", "TextualConvention", "RowStatus", "StorageType", "DisplayString")
mplsTeMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3))
mplsTeMIB.setRevisions(('2002-01-04 12:00',))
if mibBuilder.loadTexts: mplsTeMIB.setLastUpdated('200201041200Z')
if mibBuilder.loadTexts: mplsTeMIB.setOrganization('Multiprotocol Label Switching (MPLS) Working Group')
mplsTeScalars = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 1))
mplsTeObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2))
mplsTeNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 3))
mplsTeNotifyPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 3, 0))
mplsTeConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 4))
mplsTunnelConfigured = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelConfigured.setStatus('current')
mplsTunnelActive = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 1, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelActive.setStatus('current')
mplsTunnelTEDistProto = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 1, 3), Bits().clone(namedValues=NamedValues(("other", 0), ("ospf", 1), ("isis", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelTEDistProto.setStatus('current')
mplsTunnelMaxHops = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelMaxHops.setStatus('current')
mplsTunnelIndexNext = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelIndexNext.setStatus('current')
mplsTunnelTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2), )
if mibBuilder.loadTexts: mplsTunnelTable.setStatus('current')
mplsTunnelEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1), ).setIndexNames((0, "HP-SN-MPLS-TE-MIB", "mplsTunnelIndex"), (0, "HP-SN-MPLS-TE-MIB", "mplsTunnelInstance"), (0, "HP-SN-MPLS-TE-MIB", "mplsTunnelIngressLSRId"), (0, "HP-SN-MPLS-TE-MIB", "mplsTunnelEgressLSRId"))
if mibBuilder.loadTexts: mplsTunnelEntry.setStatus('current')
mplsTunnelIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 1), MplsTunnelIndex())
if mibBuilder.loadTexts: mplsTunnelIndex.setStatus('current')
mplsTunnelInstance = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 2), MplsTunnelInstanceIndex())
if mibBuilder.loadTexts: mplsTunnelInstance.setStatus('current')
mplsTunnelIngressLSRId = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 3), MplsLsrIdentifier())
if mibBuilder.loadTexts: mplsTunnelIngressLSRId.setStatus('current')
mplsTunnelEgressLSRId = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 4), MplsLsrIdentifier())
if mibBuilder.loadTexts: mplsTunnelEgressLSRId.setStatus('current')
mplsTunnelName = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 5), DisplayString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelName.setStatus('current')
mplsTunnelDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 6), DisplayString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelDescr.setStatus('current')
mplsTunnelIsIf = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 7), TruthValue().clone('false')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelIsIf.setStatus('current')
mplsTunnelIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 8), InterfaceIndexOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelIfIndex.setStatus('current')
mplsTunnelXCPointer = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 9), RowPointer()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelXCPointer.setStatus('current')
mplsTunnelSignallingProto = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 1), ("rsvp", 2), ("crldp", 3), ("other", 4))).clone('none')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelSignallingProto.setStatus('current')
mplsTunnelSetupPrio = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelSetupPrio.setStatus('current')
mplsTunnelHoldingPrio = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelHoldingPrio.setStatus('current')
mplsTunnelSessionAttributes = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 13), Bits().clone(namedValues=NamedValues(("fastReroute", 0), ("mergingPermitted", 1), ("isPersistent", 2), ("isPinned", 3), ("recordRoute", 4)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelSessionAttributes.setStatus('current')
mplsTunnelOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("admin", 1), ("rsvp", 2), ("crldp", 3), ("policyAgent", 4), ("other", 5)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelOwner.setStatus('current')
mplsTunnelLocalProtectInUse = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 15), TruthValue()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelLocalProtectInUse.setStatus('current')
mplsTunnelResourcePointer = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 16), RowPointer()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelResourcePointer.setStatus('current')
mplsTunnelInstancePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 17), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelInstancePriority.setStatus('current')
mplsTunnelHopTableIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 18), MplsPathIndexOrZero()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelHopTableIndex.setStatus('current')
mplsTunnelARHopTableIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 19), MplsPathIndexOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelARHopTableIndex.setStatus('current')
mplsTunnelCHopTableIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 20), MplsPathIndexOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelCHopTableIndex.setStatus('current')
mplsTunnelPrimaryInstance = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 21), MplsTunnelInstanceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelPrimaryInstance.setStatus('current')
mplsTunnelPrimaryTimeUp = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 22), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelPrimaryTimeUp.setStatus('current')
mplsTunnelPathChanges = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 23), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelPathChanges.setStatus('current')
mplsTunnelLastPathChange = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 24), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelLastPathChange.setStatus('current')
mplsTunnelCreationTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 25), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelCreationTime.setStatus('current')
mplsTunnelStateTransitions = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 26), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelStateTransitions.setStatus('current')
mplsTunnelIncludeAnyAffinity = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 27), MplsTunnelAffinity()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelIncludeAnyAffinity.setStatus('current')
mplsTunnelIncludeAllAffinity = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 28), MplsTunnelAffinity()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelIncludeAllAffinity.setStatus('current')
mplsTunnelExcludeAllAffinity = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 29), MplsTunnelAffinity()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelExcludeAllAffinity.setStatus('current')
mplsTunnelPathInUse = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 30), MplsPathIndexOrZero()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelPathInUse.setStatus('current')
mplsTunnelRole = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 31), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("head", 1), ("transit", 2), ("tail", 3)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelRole.setStatus('current')
mplsTunnelTotalUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 32), TimeTicks()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelTotalUpTime.setStatus('current')
mplsTunnelInstanceUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 33), TimeTicks()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelInstanceUpTime.setStatus('current')
mplsTunnelAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 34), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("testing", 3)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelAdminStatus.setStatus('current')
mplsTunnelOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 35), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("testing", 3), ("unknown", 4), ("dormant", 5), ("notPresent", 6), ("lowerLayerDown", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelOperStatus.setStatus('current')
mplsTunnelRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 36), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelRowStatus.setStatus('current')
mplsTunnelStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 2, 1, 37), StorageType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelStorageType.setStatus('current')
mplsTunnelHopListIndexNext = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelHopListIndexNext.setStatus('current')
mplsTunnelHopTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4), )
if mibBuilder.loadTexts: mplsTunnelHopTable.setStatus('current')
mplsTunnelHopEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1), ).setIndexNames((0, "HP-SN-MPLS-TE-MIB", "mplsTunnelHopListIndex"), (0, "HP-SN-MPLS-TE-MIB", "mplsTunnelHopPathOptionIndex"), (0, "HP-SN-MPLS-TE-MIB", "mplsTunnelHopIndex"))
if mibBuilder.loadTexts: mplsTunnelHopEntry.setStatus('current')
mplsTunnelHopListIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 1), MplsPathIndex())
if mibBuilder.loadTexts: mplsTunnelHopListIndex.setStatus('current')
mplsTunnelHopPathOptionIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 2), MplsPathIndex())
if mibBuilder.loadTexts: mplsTunnelHopPathOptionIndex.setStatus('current')
mplsTunnelHopIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 3), MplsPathIndex())
if mibBuilder.loadTexts: mplsTunnelHopIndex.setStatus('current')
mplsTunnelHopAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("ipV4", 1), ("ipV6", 2), ("asNumber", 3), ("lspid", 4))).clone('ipV4')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelHopAddrType.setStatus('current')
mplsTunnelHopIpv4Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 5), InetAddressIPv4()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelHopIpv4Addr.setStatus('current')
mplsTunnelHopIpv4PrefixLen = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 32))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelHopIpv4PrefixLen.setStatus('current')
mplsTunnelHopIpv6Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 7), InetAddressIPv6()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelHopIpv6Addr.setStatus('current')
mplsTunnelHopIpv6PrefixLen = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 8), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 128))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelHopIpv6PrefixLen.setStatus('current')
mplsTunnelHopAsNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 9), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelHopAsNumber.setStatus('current')
mplsTunnelHopLspId = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 10), MplsLSPID()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelHopLspId.setStatus('current')
mplsTunnelHopType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("strict", 1), ("loose", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelHopType.setStatus('current')
mplsTunnelHopIncludeExclude = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("include", 1), ("exclude", 2))).clone('include')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelHopIncludeExclude.setStatus('current')
mplsTunnelHopPathOptionName = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 13), DisplayString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelHopPathOptionName.setStatus('current')
mplsTunnelHopEntryPathComp = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("dynamic", 1), ("explicit", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelHopEntryPathComp.setStatus('current')
mplsTunnelHopRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 15), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelHopRowStatus.setStatus('current')
mplsTunnelHopStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 4, 1, 16), StorageType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelHopStorageType.setStatus('current')
mplsTunnelResourceIndexNext = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelResourceIndexNext.setStatus('current')
mplsTunnelResourceTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 6), )
if mibBuilder.loadTexts: mplsTunnelResourceTable.setStatus('current')
mplsTunnelResourceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 6, 1), ).setIndexNames((0, "HP-SN-MPLS-TE-MIB", "mplsTunnelResourceIndex"))
if mibBuilder.loadTexts: mplsTunnelResourceEntry.setStatus('current')
mplsTunnelResourceIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 6, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647)))
if mibBuilder.loadTexts: mplsTunnelResourceIndex.setStatus('current')
mplsTunnelResourceMaxRate = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 6, 1, 2), MplsBitRate()).setUnits('bits per second').setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelResourceMaxRate.setStatus('current')
mplsTunnelResourceMeanRate = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 6, 1, 3), MplsBitRate()).setUnits('bits per second').setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelResourceMeanRate.setStatus('current')
mplsTunnelResourceMaxBurstSize = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 6, 1, 4), MplsBurstSize()).setUnits('bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelResourceMaxBurstSize.setStatus('current')
mplsTunnelResourceMeanBurstSize = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 6, 1, 5), MplsBurstSize()).setUnits('bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelResourceMeanBurstSize.setStatus('current')
mplsTunnelResourceExcessBurstSize = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 6, 1, 6), MplsBurstSize()).setUnits('bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelResourceExcessBurstSize.setStatus('current')
mplsTunnelResourceFrequency = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 6, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("unspecified", 1), ("frequent", 2), ("veryFrequent", 3)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelResourceFrequency.setStatus('current')
mplsTunnelResourceWeight = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 6, 1, 8), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelResourceWeight.setStatus('current')
mplsTunnelResourceRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 6, 1, 9), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelResourceRowStatus.setStatus('current')
mplsTunnelResourceStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 6, 1, 10), StorageType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelResourceStorageType.setStatus('current')
mplsTunnelARHopTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 7), )
if mibBuilder.loadTexts: mplsTunnelARHopTable.setStatus('current')
mplsTunnelARHopEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 7, 1), ).setIndexNames((0, "HP-SN-MPLS-TE-MIB", "mplsTunnelARHopListIndex"), (0, "HP-SN-MPLS-TE-MIB", "mplsTunnelARHopIndex"))
if mibBuilder.loadTexts: mplsTunnelARHopEntry.setStatus('current')
mplsTunnelARHopListIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 7, 1, 1), MplsPathIndex())
if mibBuilder.loadTexts: mplsTunnelARHopListIndex.setStatus('current')
mplsTunnelARHopIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 7, 1, 2), MplsPathIndex())
if mibBuilder.loadTexts: mplsTunnelARHopIndex.setStatus('current')
mplsTunnelARHopAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 7, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("ipV4", 1), ("ipV6", 2), ("asNumber", 3), ("lspId", 4))).clone('ipV4')).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelARHopAddrType.setStatus('current')
mplsTunnelARHopIpv4Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 7, 1, 4), InetAddressIPv4()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelARHopIpv4Addr.setStatus('current')
mplsTunnelARHopIpv4PrefixLen = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 7, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 32))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelARHopIpv4PrefixLen.setStatus('current')
mplsTunnelARHopIpv6Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 7, 1, 6), InetAddressIPv6()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelARHopIpv6Addr.setStatus('current')
mplsTunnelARHopIpv6PrefixLen = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 7, 1, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelARHopIpv6PrefixLen.setStatus('current')
mplsTunnelARHopAsNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 7, 1, 8), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelARHopAsNumber.setStatus('current')
mplsTunnelARHopLspId = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 7, 1, 9), MplsLSPID()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelARHopLspId.setStatus('current')
mplsTunnelCHopTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 8), )
if mibBuilder.loadTexts: mplsTunnelCHopTable.setStatus('current')
mplsTunnelCHopEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 8, 1), ).setIndexNames((0, "HP-SN-MPLS-TE-MIB", "mplsTunnelCHopListIndex"), (0, "HP-SN-MPLS-TE-MIB", "mplsTunnelCHopIndex"))
if mibBuilder.loadTexts: mplsTunnelCHopEntry.setStatus('current')
mplsTunnelCHopListIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 8, 1, 1), MplsPathIndex())
if mibBuilder.loadTexts: mplsTunnelCHopListIndex.setStatus('current')
mplsTunnelCHopIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 8, 1, 2), MplsPathIndex())
if mibBuilder.loadTexts: mplsTunnelCHopIndex.setStatus('current')
mplsTunnelCHopAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 8, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("ipV4", 1), ("ipV6", 2), ("asNumber", 3), ("lspId", 4))).clone('ipV4')).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelCHopAddrType.setStatus('current')
mplsTunnelCHopIpv4Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 8, 1, 4), InetAddressIPv4()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelCHopIpv4Addr.setStatus('current')
mplsTunnelCHopIpv4PrefixLen = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 8, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 32))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelCHopIpv4PrefixLen.setStatus('current')
mplsTunnelCHopIpv6Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 8, 1, 6), InetAddressIPv6()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelCHopIpv6Addr.setStatus('current')
mplsTunnelCHopIpv6PrefixLen = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 8, 1, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelCHopIpv6PrefixLen.setStatus('current')
mplsTunnelCHopAsNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 8, 1, 8), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelCHopAsNumber.setStatus('current')
mplsTunnelCHopLspId = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 8, 1, 9), MplsLSPID()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelCHopLspId.setStatus('current')
mplsTunnelCHopType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 8, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("strict", 1), ("loose", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelCHopType.setStatus('current')
mplsTunnelPerfTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 9), )
if mibBuilder.loadTexts: mplsTunnelPerfTable.setStatus('current')
mplsTunnelPerfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 9, 1), )
mplsTunnelEntry.registerAugmentions(("HP-SN-MPLS-TE-MIB", "mplsTunnelPerfEntry"))
mplsTunnelPerfEntry.setIndexNames(*mplsTunnelEntry.getIndexNames())
if mibBuilder.loadTexts: mplsTunnelPerfEntry.setStatus('current')
mplsTunnelPerfPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 9, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelPerfPackets.setStatus('current')
mplsTunnelPerfHCPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 9, 1, 2), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelPerfHCPackets.setStatus('current')
mplsTunnelPerfErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 9, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelPerfErrors.setStatus('current')
mplsTunnelPerfBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 9, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelPerfBytes.setStatus('current')
mplsTunnelPerfHCBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 9, 1, 5), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTunnelPerfHCBytes.setStatus('current')
mplsTunnelCRLDPResTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 10), )
if mibBuilder.loadTexts: mplsTunnelCRLDPResTable.setStatus('current')
mplsTunnelCRLDPResEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 10, 1), ).setIndexNames((0, "HP-SN-MPLS-TE-MIB", "mplsTunnelResourceIndex"))
if mibBuilder.loadTexts: mplsTunnelCRLDPResEntry.setStatus('current')
mplsTunnelCRLDPResMeanBurstSize = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 10, 1, 2), MplsBurstSize()).setUnits('bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelCRLDPResMeanBurstSize.setStatus('current')
mplsTunnelCRLDPResExcessBurstSize = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 10, 1, 3), MplsBurstSize()).setUnits('bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelCRLDPResExcessBurstSize.setStatus('current')
mplsTunnelCRLDPResFrequency = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 10, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("unspecified", 1), ("frequent", 2), ("veryFrequent", 3)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelCRLDPResFrequency.setStatus('current')
mplsTunnelCRLDPResWeight = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 10, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelCRLDPResWeight.setStatus('current')
mplsTunnelCRLDPResFlags = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 10, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelCRLDPResFlags.setStatus('current')
mplsTunnelCRLDPResRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 10, 1, 7), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelCRLDPResRowStatus.setStatus('current')
mplsTunnelCRLDPResStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 10, 1, 8), StorageType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsTunnelCRLDPResStorageType.setStatus('current')
mplsTunnelTrapEnable = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 2, 11), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: mplsTunnelTrapEnable.setStatus('current')
mplsTunnelUp = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 3, 0, 1)).setObjects(("HP-SN-MPLS-TE-MIB", "mplsTunnelAdminStatus"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelOperStatus"))
if mibBuilder.loadTexts: mplsTunnelUp.setStatus('current')
mplsTunnelDown = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 3, 0, 2)).setObjects(("HP-SN-MPLS-TE-MIB", "mplsTunnelAdminStatus"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelOperStatus"))
if mibBuilder.loadTexts: mplsTunnelDown.setStatus('current')
mplsTunnelRerouted = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 3, 0, 3)).setObjects(("HP-SN-MPLS-TE-MIB", "mplsTunnelAdminStatus"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelOperStatus"))
if mibBuilder.loadTexts: mplsTunnelRerouted.setStatus('current')
mplsTunnelReoptimized = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 3, 0, 4)).setObjects(("HP-SN-MPLS-TE-MIB", "mplsTunnelAdminStatus"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelOperStatus"))
if mibBuilder.loadTexts: mplsTunnelReoptimized.setStatus('current')
mplsTeGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 4, 1))
mplsTeCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 4, 2))
mplsTeModuleCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 4, 2, 1)).setObjects(("HP-SN-MPLS-TE-MIB", "mplsTunnelGroup"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelScalarGroup"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelManualGroup"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelSignaledGroup"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelIsNotIntfcGroup"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelIsIntfcGroup"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelOptionalGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsTeModuleCompliance = mplsTeModuleCompliance.setStatus('current')
mplsTunnelGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 4, 1, 1)).setObjects(("HP-SN-MPLS-TE-MIB", "mplsTunnelIndexNext"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelName"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelDescr"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelOwner"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelXCPointer"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelIfIndex"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHopTableIndex"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelARHopTableIndex"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCHopTableIndex"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelAdminStatus"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelOperStatus"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelRowStatus"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelTrapEnable"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelStorageType"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelConfigured"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelActive"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelPrimaryInstance"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelPrimaryTimeUp"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelPathChanges"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelLastPathChange"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCreationTime"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelStateTransitions"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelIncludeAnyAffinity"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelIncludeAllAffinity"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelExcludeAllAffinity"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelPerfPackets"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelPerfHCPackets"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelPerfErrors"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelPerfBytes"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelPerfHCBytes"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelResourcePointer"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelInstancePriority"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelPathInUse"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelRole"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelTotalUpTime"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelInstanceUpTime"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsTunnelGroup = mplsTunnelGroup.setStatus('current')
mplsTunnelManualGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 4, 1, 2)).setObjects(("HP-SN-MPLS-TE-MIB", "mplsTunnelSignallingProto"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsTunnelManualGroup = mplsTunnelManualGroup.setStatus('current')
mplsTunnelSignaledGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 4, 1, 3)).setObjects(("HP-SN-MPLS-TE-MIB", "mplsTunnelSetupPrio"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHoldingPrio"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelSignallingProto"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelLocalProtectInUse"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelSessionAttributes"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHopListIndexNext"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHopAddrType"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHopIpv4Addr"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHopIpv4PrefixLen"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHopIpv6Addr"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHopIpv6PrefixLen"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHopAsNumber"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHopLspId"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHopType"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHopIncludeExclude"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHopPathOptionName"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHopEntryPathComp"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHopRowStatus"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelHopStorageType"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsTunnelSignaledGroup = mplsTunnelSignaledGroup.setStatus('current')
mplsTunnelScalarGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 4, 1, 4)).setObjects(("HP-SN-MPLS-TE-MIB", "mplsTunnelConfigured"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelActive"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelTEDistProto"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelMaxHops"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsTunnelScalarGroup = mplsTunnelScalarGroup.setStatus('current')
mplsTunnelIsIntfcGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 4, 1, 5)).setObjects(("HP-SN-MPLS-TE-MIB", "mplsTunnelIsIf"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsTunnelIsIntfcGroup = mplsTunnelIsIntfcGroup.setStatus('current')
mplsTunnelIsNotIntfcGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 4, 1, 6)).setObjects(("HP-SN-MPLS-TE-MIB", "mplsTunnelIsIf"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsTunnelIsNotIntfcGroup = mplsTunnelIsNotIntfcGroup.setStatus('current')
mplsTunnelOptionalGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 4, 1, 7)).setObjects(("HP-SN-MPLS-TE-MIB", "mplsTunnelResourceIndexNext"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelResourceMaxRate"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelResourceMeanRate"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelResourceMaxBurstSize"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelResourceMeanBurstSize"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelResourceExcessBurstSize"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelResourceFrequency"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelResourceWeight"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelResourceRowStatus"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelResourceStorageType"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelARHopAddrType"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelARHopIpv4Addr"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelARHopIpv4PrefixLen"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelARHopIpv6Addr"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelARHopIpv6PrefixLen"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelARHopAsNumber"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelARHopLspId"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCHopAddrType"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCHopIpv4Addr"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCHopIpv4PrefixLen"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCHopIpv6Addr"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCHopIpv6PrefixLen"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCHopAsNumber"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCHopLspId"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCHopType"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsTunnelOptionalGroup = mplsTunnelOptionalGroup.setStatus('current')
mplsTunnelCRLDPResOptionalGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 4, 1, 8)).setObjects(("HP-SN-MPLS-TE-MIB", "mplsTunnelCRLDPResMeanBurstSize"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCRLDPResExcessBurstSize"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCRLDPResFrequency"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCRLDPResWeight"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCRLDPResFlags"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCRLDPResRowStatus"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelCRLDPResStorageType"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsTunnelCRLDPResOptionalGroup = mplsTunnelCRLDPResOptionalGroup.setStatus('current')
mplsTeNotificationGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 11, 2, 3, 7, 11, 12, 2, 15, 15, 3, 4, 1, 9)).setObjects(("HP-SN-MPLS-TE-MIB", "mplsTunnelUp"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelDown"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelRerouted"), ("HP-SN-MPLS-TE-MIB", "mplsTunnelReoptimized"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsTeNotificationGroup = mplsTeNotificationGroup.setStatus('current')
mibBuilder.exportSymbols("HP-SN-MPLS-TE-MIB", mplsTunnelARHopListIndex=mplsTunnelARHopListIndex, mplsTunnelConfigured=mplsTunnelConfigured, mplsTunnelUp=mplsTunnelUp, mplsTunnelMaxHops=mplsTunnelMaxHops, mplsTunnelHopTable=mplsTunnelHopTable, mplsTunnelARHopAddrType=mplsTunnelARHopAddrType, mplsTunnelResourceRowStatus=mplsTunnelResourceRowStatus, mplsTunnelHopIpv4Addr=mplsTunnelHopIpv4Addr, mplsTunnelIncludeAnyAffinity=mplsTunnelIncludeAnyAffinity, mplsTunnelHopRowStatus=mplsTunnelHopRowStatus, mplsTeNotifyPrefix=mplsTeNotifyPrefix, mplsTunnelOperStatus=mplsTunnelOperStatus, mplsTunnelIndex=mplsTunnelIndex, mplsTunnelCHopAsNumber=mplsTunnelCHopAsNumber, mplsTunnelCRLDPResOptionalGroup=mplsTunnelCRLDPResOptionalGroup, mplsTunnelExcludeAllAffinity=mplsTunnelExcludeAllAffinity, mplsTunnelCHopType=mplsTunnelCHopType, mplsTunnelARHopIpv4Addr=mplsTunnelARHopIpv4Addr, mplsTunnelHopPathOptionName=mplsTunnelHopPathOptionName, mplsTunnelPrimaryTimeUp=mplsTunnelPrimaryTimeUp, mplsTunnelStorageType=mplsTunnelStorageType, mplsTunnelARHopIpv6Addr=mplsTunnelARHopIpv6Addr, mplsTeModuleCompliance=mplsTeModuleCompliance, mplsTunnelOptionalGroup=mplsTunnelOptionalGroup, mplsTunnelCRLDPResEntry=mplsTunnelCRLDPResEntry, mplsTunnelARHopIpv6PrefixLen=mplsTunnelARHopIpv6PrefixLen, mplsTunnelIncludeAllAffinity=mplsTunnelIncludeAllAffinity, mplsTunnelResourceEntry=mplsTunnelResourceEntry, mplsTunnelResourceIndex=mplsTunnelResourceIndex, PYSNMP_MODULE_ID=mplsTeMIB, mplsTunnelEntry=mplsTunnelEntry, mplsTeMIB=mplsTeMIB, mplsTunnelSetupPrio=mplsTunnelSetupPrio, mplsTunnelHopIpv4PrefixLen=mplsTunnelHopIpv4PrefixLen, mplsTunnelPerfEntry=mplsTunnelPerfEntry, mplsTunnelResourceExcessBurstSize=mplsTunnelResourceExcessBurstSize, mplsTunnelStateTransitions=mplsTunnelStateTransitions, mplsTunnelCHopIpv6PrefixLen=mplsTunnelCHopIpv6PrefixLen, mplsTunnelHopListIndexNext=mplsTunnelHopListIndexNext, mplsTunnelCreationTime=mplsTunnelCreationTime, mplsTunnelPathInUse=mplsTunnelPathInUse, mplsTunnelHopIpv6Addr=mplsTunnelHopIpv6Addr, mplsTunnelTEDistProto=mplsTunnelTEDistProto, mplsTunnelHopStorageType=mplsTunnelHopStorageType, mplsTunnelResourceIndexNext=mplsTunnelResourceIndexNext, mplsTunnelIsIf=mplsTunnelIsIf, mplsTunnelManualGroup=mplsTunnelManualGroup, mplsTunnelPerfTable=mplsTunnelPerfTable, mplsTunnelGroup=mplsTunnelGroup, mplsTeGroups=mplsTeGroups, mplsTunnelRowStatus=mplsTunnelRowStatus, mplsTunnelResourceMeanRate=mplsTunnelResourceMeanRate, mplsTunnelCHopIpv4Addr=mplsTunnelCHopIpv4Addr, mplsTeConformance=mplsTeConformance, mplsTunnelResourcePointer=mplsTunnelResourcePointer, mplsTunnelActive=mplsTunnelActive, mplsTunnelIfIndex=mplsTunnelIfIndex, mplsTunnelARHopIndex=mplsTunnelARHopIndex, mplsTunnelIngressLSRId=mplsTunnelIngressLSRId, mplsTunnelHopIncludeExclude=mplsTunnelHopIncludeExclude, mplsTunnelPathChanges=mplsTunnelPathChanges, mplsTunnelCHopTableIndex=mplsTunnelCHopTableIndex, mplsTunnelARHopIpv4PrefixLen=mplsTunnelARHopIpv4PrefixLen, mplsTunnelTrapEnable=mplsTunnelTrapEnable, mplsTunnelCHopAddrType=mplsTunnelCHopAddrType, mplsTunnelDown=mplsTunnelDown, mplsTeObjects=mplsTeObjects, mplsTunnelHopTableIndex=mplsTunnelHopTableIndex, mplsTunnelPerfErrors=mplsTunnelPerfErrors, mplsTunnelInstance=mplsTunnelInstance, mplsTunnelPerfHCPackets=mplsTunnelPerfHCPackets, mplsTunnelPerfPackets=mplsTunnelPerfPackets, mplsTunnelTable=mplsTunnelTable, mplsTunnelCRLDPResFrequency=mplsTunnelCRLDPResFrequency, mplsTunnelHopPathOptionIndex=mplsTunnelHopPathOptionIndex, mplsTunnelIsIntfcGroup=mplsTunnelIsIntfcGroup, mplsTunnelCRLDPResStorageType=mplsTunnelCRLDPResStorageType, mplsTunnelOwner=mplsTunnelOwner, mplsTunnelReoptimized=mplsTunnelReoptimized, mplsTunnelHopIndex=mplsTunnelHopIndex, mplsTunnelHopListIndex=mplsTunnelHopListIndex, mplsTunnelTotalUpTime=mplsTunnelTotalUpTime, mplsTunnelResourceWeight=mplsTunnelResourceWeight, mplsTunnelCRLDPResWeight=mplsTunnelCRLDPResWeight, mplsTunnelCRLDPResFlags=mplsTunnelCRLDPResFlags, mplsTunnelPerfBytes=mplsTunnelPerfBytes, mplsTunnelHoldingPrio=mplsTunnelHoldingPrio, mplsTunnelIsNotIntfcGroup=mplsTunnelIsNotIntfcGroup, mplsTunnelPerfHCBytes=mplsTunnelPerfHCBytes, mplsTunnelCHopIndex=mplsTunnelCHopIndex, mplsTunnelARHopEntry=mplsTunnelARHopEntry, mplsTeScalars=mplsTeScalars, mplsTunnelResourceStorageType=mplsTunnelResourceStorageType, mplsTeCompliances=mplsTeCompliances, mplsTunnelAdminStatus=mplsTunnelAdminStatus, mplsTunnelARHopLspId=mplsTunnelARHopLspId, mplsTunnelCHopEntry=mplsTunnelCHopEntry, mplsTeNotifications=mplsTeNotifications, mplsTunnelCHopTable=mplsTunnelCHopTable, mplsTunnelCHopIpv6Addr=mplsTunnelCHopIpv6Addr, mplsTunnelLastPathChange=mplsTunnelLastPathChange, mplsTunnelHopAddrType=mplsTunnelHopAddrType, mplsTunnelARHopTable=mplsTunnelARHopTable, mplsTunnelHopEntryPathComp=mplsTunnelHopEntryPathComp, mplsTunnelResourceMeanBurstSize=mplsTunnelResourceMeanBurstSize, mplsTunnelEgressLSRId=mplsTunnelEgressLSRId, mplsTunnelResourceMaxRate=mplsTunnelResourceMaxRate, mplsTunnelCRLDPResTable=mplsTunnelCRLDPResTable, mplsTunnelXCPointer=mplsTunnelXCPointer, mplsTunnelSignaledGroup=mplsTunnelSignaledGroup, mplsTunnelCHopLspId=mplsTunnelCHopLspId, mplsTunnelDescr=mplsTunnelDescr, mplsTunnelCRLDPResExcessBurstSize=mplsTunnelCRLDPResExcessBurstSize, mplsTunnelHopEntry=mplsTunnelHopEntry, mplsTunnelResourceTable=mplsTunnelResourceTable, mplsTunnelPrimaryInstance=mplsTunnelPrimaryInstance, mplsTunnelHopType=mplsTunnelHopType, mplsTunnelCHopListIndex=mplsTunnelCHopListIndex, mplsTunnelLocalProtectInUse=mplsTunnelLocalProtectInUse, mplsTunnelResourceFrequency=mplsTunnelResourceFrequency, mplsTunnelIndexNext=mplsTunnelIndexNext, mplsTunnelSignallingProto=mplsTunnelSignallingProto, mplsTunnelHopIpv6PrefixLen=mplsTunnelHopIpv6PrefixLen, mplsTunnelCHopIpv4PrefixLen=mplsTunnelCHopIpv4PrefixLen, mplsTunnelName=mplsTunnelName, mplsTunnelSessionAttributes=mplsTunnelSessionAttributes, mplsTunnelHopLspId=mplsTunnelHopLspId, mplsTunnelInstanceUpTime=mplsTunnelInstanceUpTime, mplsTeNotificationGroup=mplsTeNotificationGroup, mplsTunnelARHopAsNumber=mplsTunnelARHopAsNumber, mplsTunnelARHopTableIndex=mplsTunnelARHopTableIndex, mplsTunnelInstancePriority=mplsTunnelInstancePriority, mplsTunnelHopAsNumber=mplsTunnelHopAsNumber, mplsTunnelRerouted=mplsTunnelRerouted, mplsTunnelResourceMaxBurstSize=mplsTunnelResourceMaxBurstSize, mplsTunnelScalarGroup=mplsTunnelScalarGroup, mplsTunnelCRLDPResMeanBurstSize=mplsTunnelCRLDPResMeanBurstSize, mplsTunnelRole=mplsTunnelRole, mplsTunnelCRLDPResRowStatus=mplsTunnelCRLDPResRowStatus)
| 156.092409 | 6,519 | 0.738435 | 5,815 | 47,296 | 6.005675 | 0.060533 | 0.009449 | 0.011941 | 0.015806 | 0.456433 | 0.394668 | 0.321164 | 0.306388 | 0.283968 | 0.282049 | 0 | 0.091973 | 0.091488 | 47,296 | 302 | 6,520 | 156.609272 | 0.720775 | 0.006787 | 0 | 0.034014 | 0 | 0 | 0.172572 | 0.046629 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.034014 | 0 | 0.034014 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
686ef59e2e727998fddf9b700a3ed1d2e7b5f94a | 343 | py | Python | test.py | markemus/economy | d7b3be9b2095393d7ee5c8967b9fcee8998776bb | [
"MIT"
] | 2 | 2017-05-09T22:46:18.000Z | 2021-09-07T06:04:57.000Z | test.py | markemus/economy | d7b3be9b2095393d7ee5c8967b9fcee8998776bb | [
"MIT"
] | null | null | null | test.py | markemus/economy | d7b3be9b2095393d7ee5c8967b9fcee8998776bb | [
"MIT"
] | 3 | 2017-07-20T21:22:30.000Z | 2020-10-17T13:04:28.000Z | import random
import cProfile
import ai
import business as b
import database as d
import gameMap as g
import generator as gen
import jobs as j
import orders as o
import people as p
import profiles as pr
import unit as u
from conversation import Convo
from gui import gui
from model import Model
town = g.Locality(None, (0,0), 10, 10,"Town") | 18.052632 | 45 | 0.781341 | 63 | 343 | 4.253968 | 0.52381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021352 | 0.180758 | 343 | 19 | 45 | 18.052632 | 0.932384 | 0 | 0 | 0 | 0 | 0 | 0.011628 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.9375 | 0 | 0.9375 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
688774c544156251edf653e2e57ba9a528b1be5f | 360 | py | Python | l_04_list_and_dictionaries/dictionaries/ex_05_mixed_phones.py | VasAtanasov/SoftUni-Python-Fundamentals | 471d0537dd6e5c8b61ede92b7673c0d67e2964fd | [
"MIT"
] | 1 | 2019-06-05T11:16:08.000Z | 2019-06-05T11:16:08.000Z | l_04_list_and_dictionaries/dictionaries/ex_05_mixed_phones.py | VasAtanasov/SoftUni-Python-Fundamentals | 471d0537dd6e5c8b61ede92b7673c0d67e2964fd | [
"MIT"
] | null | null | null | l_04_list_and_dictionaries/dictionaries/ex_05_mixed_phones.py | VasAtanasov/SoftUni-Python-Fundamentals | 471d0537dd6e5c8b61ede92b7673c0d67e2964fd | [
"MIT"
] | null | null | null | contacts = {}
while True:
tokens = input()
if 'Over' == tokens:
break
[first_value, second_value] = tokens.split(' : ')
if second_value.isdigit():
contacts[first_value] = second_value
else:
contacts[second_value] = first_value
print(("\n".join([f'{key} -> {value}' for key, value in sorted(contacts.items())])))
| 22.5 | 84 | 0.602778 | 43 | 360 | 4.883721 | 0.534884 | 0.209524 | 0.152381 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.233333 | 360 | 15 | 85 | 24 | 0.76087 | 0 | 0 | 0 | 0 | 0 | 0.069444 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.090909 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
688ddce92bbc0a2a62257d431bf17b5b4d433cae | 293 | py | Python | sxm_player/players/__init__.py | AngellusMortis/discord_siriusxm | 2ca91fe216d1ad823b1ad7f9cfe43db4a016bd96 | [
"MIT"
] | 12 | 2019-08-07T19:46:27.000Z | 2022-01-23T03:36:43.000Z | sxm_player/players/__init__.py | AngellusMortis/discord_siriusxm | 2ca91fe216d1ad823b1ad7f9cfe43db4a016bd96 | [
"MIT"
] | 10 | 2019-05-20T13:02:54.000Z | 2022-03-31T17:21:26.000Z | sxm_player/players/__init__.py | AngellusMortis/mortis-music | 2ca91fe216d1ad823b1ad7f9cfe43db4a016bd96 | [
"MIT"
] | 8 | 2020-05-05T22:50:30.000Z | 2022-03-18T23:21:42.000Z | from .base import BasePlayer, Option
from .cli import CLIPlayer
# debug.py is not included in published package
try:
from sxm_player.debug.player import DebugPlayer
except ImportError:
DebugPlayer = None # type: ignore
__all__ = ["BasePlayer", "CLIPlayer", "DebugPlayer", "Option"]
| 26.636364 | 62 | 0.750853 | 36 | 293 | 5.972222 | 0.694444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16041 | 293 | 10 | 63 | 29.3 | 0.873984 | 0.197952 | 0 | 0 | 0 | 0 | 0.155172 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.571429 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
68a519b847ba75d9b56c7fea7693db29c3c84bac | 262 | py | Python | tasks.py | nekonoshiri/tinypubsub | 7bbdf16f81664d7e55ab9652c19328a55a8ab0a3 | [
"MIT"
] | null | null | null | tasks.py | nekonoshiri/tinypubsub | 7bbdf16f81664d7e55ab9652c19328a55a8ab0a3 | [
"MIT"
] | null | null | null | tasks.py | nekonoshiri/tinypubsub | 7bbdf16f81664d7e55ab9652c19328a55a8ab0a3 | [
"MIT"
] | null | null | null | import invoke
@invoke.task()
def check(c):
"""Run formatting, linting and testing."""
c.run("isort tinypubsub tests")
c.run("black tinypubsub tests")
c.run("flake8 tinypubsub tests")
c.run("mypy tinypubsub tests")
c.run("pytest tests")
| 21.833333 | 46 | 0.656489 | 36 | 262 | 4.777778 | 0.5 | 0.139535 | 0.372093 | 0.44186 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004717 | 0.19084 | 262 | 11 | 47 | 23.818182 | 0.806604 | 0.137405 | 0 | 0 | 0 | 0 | 0.454545 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.125 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d7b018f4ad78753b7ea7175b6a0555d013a30444 | 5,620 | py | Python | data_structures/linked_list/linked_list.py | asakatida/data-structures-and-algorithms.py | 587d1a66a6c15a3c7d7786275608f065687e1810 | [
"MIT"
] | null | null | null | data_structures/linked_list/linked_list.py | asakatida/data-structures-and-algorithms.py | 587d1a66a6c15a3c7d7786275608f065687e1810 | [
"MIT"
] | 2 | 2020-09-24T13:13:49.000Z | 2021-06-25T15:15:35.000Z | data_structures/linked_list/linked_list.py | grandquista/data-structures-and-algorithms.py | 587d1a66a6c15a3c7d7786275608f065687e1810 | [
"MIT"
] | null | null | null | from ..linked_node.node import Node
class LinkedList:
def __init__(self, it=()):
"""
Initialize new list with optional iterable.
"""
self.clear()
for value in reversed(it):
self.insert(value)
def __add__(self, value):
return NotImplemented
def __contains__(self, value):
"""
Return a boolean indicating if the value is found in the list.
"""
return self.find(value)
def __delitem__(self, value):
raise NotImplementedError
def __eq__(self, value):
return NotImplemented
def __ge__(self, value):
return NotImplemented
def __getitem__(self):
raise NotImplementedError
def __gt__(self, value):
return NotImplemented
def __iadd__(self, value):
return NotImplemented
def __imul__(self, value):
return NotImplemented
def __iter__(self):
"""
"""
node = self.head
while node is not None:
yield node.value
node = node._next
def __le__(self, value):
return NotImplemented
def __len__(self):
"""
Return the number of values currently in the list.
"""
return self._size
def __lt__(self, value):
return NotImplemented
def __mul__(self, value):
return NotImplemented
def __ne__(self, value):
return NotImplemented
def __repr__(self):
"""
Return a formatted string representing list.
"""
return f'LinkedList(({ ", ".join(map(repr, self)) }))'
def __reversed__(self):
raise NotImplementedError
def __rmul__(self, value):
return NotImplemented
def __setitem__(self, key, value):
raise NotImplementedError
def __str__(self):
"""
Return a string representing list contents.
"""
return f'[{ ", ".join(map(str, self)) }]'
def _insert_after(self, node, value):
node._next = Node(value, node._next)
self._size += 1
def _insert_head(self, value):
self.head = Node(value, self.head)
self._size += 1
def _remove_after(self, node):
node._next = node._next._next
self._size -= 1
def _remove_head(self):
self.head = self.head._next
self._size -= 1
def append(self, value):
"""
Insert a value at the end of the list.
"""
if self.head is None:
return self._insert_head(value)
node = self.head
while node._next is not None:
node = node._next
self._insert_after(node, value)
def clear(self):
self.head = None
self._size = 0
def copy(self):
raise NotImplementedError
def count(self, value):
raise NotImplementedError
def extend(self, it):
raise NotImplementedError
def find(self, value):
"""
Return a boolean indicating if the value is found in the list.
"""
node = self.head
while node is not None:
if node.value == value:
return True
node = node._next
return False
def has_loop(self):
"""
Return a boolean indicating if the list has a loop of nodes.
"""
if not self.head:
return False
return self.head._has_loop()
def index(self, value, start=0, stop=-1):
raise NotImplementedError
def insert(self, value):
"""
Insert a value into the head of the list.
"""
self._insert_head(value)
def insert_after(self, key, value):
"""
Insert a value after the node containing key.
"""
node = self.head
while node is not None:
if node.value == key:
return self._insert_after(node, value)
node = node._next
raise ValueError("insert_after key not in LinkedList")
def insert_before(self, key, value):
"""
Insert a value before the node containing key.
"""
if self.head is None:
raise ValueError("insert_before key not in LinkedList")
if self.head.value == key:
return self._insert_head(value)
node = self.head
while node._next is not None:
if node._next.value == key:
return self._insert_after(node, value)
node = node._next
raise ValueError("insert_before key not in LinkedList")
def kth_from_end(self, k):
"""
Retrieve kth node from the end of the list.
"""
size = len(self)
index = size - k - 1
if not (0 <= index < size):
raise IndexError("LinkedList index out of bounds")
node = self.head
for _ in range(index):
node = node._next
return node
def pop(self, index=0):
raise NotImplementedError
def remove(self, value):
"""
Remove given value from the list.
"""
if self.head is None:
raise ValueError("remove value not in LinkedList")
if self.head.value == value:
return self._remove_head()
node = self.head
while node._next is not None:
if node._next.value == value:
return self._remove_after(node)
node = node._next
raise ValueError("remove value not in LinkedList")
def reverse(self):
raise NotImplementedError
def sort(self):
raise NotImplementedError
__hash__ = None
| 25.201794 | 70 | 0.564235 | 645 | 5,620 | 4.686822 | 0.164341 | 0.059544 | 0.064505 | 0.105524 | 0.52266 | 0.285809 | 0.260337 | 0.202779 | 0.17003 | 0.17003 | 0 | 0.00273 | 0.348221 | 5,620 | 222 | 71 | 25.315315 | 0.82255 | 0.112278 | 0 | 0.430657 | 0 | 0 | 0.057442 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.29927 | false | 0 | 0.007299 | 0.080292 | 0.510949 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
d7bfab44b95d40778433c95af97a476381c7c661 | 333 | py | Python | PasswordCardGenerator/Extras.py | DerSchinken/PasswordCardGenerator | 134fc11ac2ae5fd66865d67f6443f0d3d1edd10f | [
"Unlicense"
] | 1 | 2021-07-16T21:54:18.000Z | 2021-07-16T21:54:18.000Z | PasswordCardGenerator/Extras.py | DerSchinken/PasswordCardGenerator | 134fc11ac2ae5fd66865d67f6443f0d3d1edd10f | [
"Unlicense"
] | 1 | 2021-10-01T14:54:33.000Z | 2021-10-01T14:54:33.000Z | PasswordCardGenerator/Extras.py | DerSchinken/PasswordCardGenerator | 134fc11ac2ae5fd66865d67f6443f0d3d1edd10f | [
"Unlicense"
] | 1 | 2021-08-10T01:21:00.000Z | 2021-08-10T01:21:00.000Z | from random import randint
from os import path
def filename_generator(name: str, suffix: str) -> str:
# in case you need a filename generator:
filename = name + f"_{randint(1000, 100000000)}." + suffix
while path.exists(filename):
filename = name + f"_{randint(1000, 100000000)}." + suffix
return filename
| 27.75 | 66 | 0.681682 | 43 | 333 | 5.209302 | 0.534884 | 0.151786 | 0.116071 | 0.178571 | 0.348214 | 0.348214 | 0.348214 | 0 | 0 | 0 | 0 | 0.098859 | 0.21021 | 333 | 11 | 67 | 30.272727 | 0.752852 | 0.114114 | 0 | 0.285714 | 0 | 0 | 0.191126 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.285714 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
d7d7f0252233bac5238da8eba19a6d637d79ef8a | 3,718 | py | Python | ample/util/tests/test_options_processor.py | fsimkovic/ample | c3c2196ca292e831e3cd8d15e3d3079bb6609848 | [
"BSD-3-Clause"
] | 6 | 2017-03-17T14:43:14.000Z | 2021-08-06T07:07:14.000Z | ample/util/tests/test_options_processor.py | fsimkovic/ample | c3c2196ca292e831e3cd8d15e3d3079bb6609848 | [
"BSD-3-Clause"
] | 47 | 2017-03-17T14:37:09.000Z | 2021-01-28T10:22:15.000Z | ample/util/tests/test_options_processor.py | fsimkovic/ample | c3c2196ca292e831e3cd8d15e3d3079bb6609848 | [
"BSD-3-Clause"
] | 6 | 2017-09-26T08:45:09.000Z | 2020-03-19T14:26:49.000Z | """Tests for util.config_util"""
import unittest
import random
from ample.util.config_util import AMPLEConfigOptions
from ample.util import argparse_util, options_processor
from ample.util.mrbump_util import REBUILD_MAX_PERMITTED_RESOLUTION, SHELXE_MAX_PERMITTED_RESOLUTION, SHELXE_MAX_PERMITTED_RESOLUTION_CC
__author__ = "Jens Thomas"
class Test(unittest.TestCase):
def test_options_shelxe_resolution_max(self):
"""Make sure we turn off shelxe if resolution is outside limit
"""
options = AMPLEConfigOptions()
argso = argparse_util.process_command_line(args=['-mtz', 'foo',
'-fasta', 'bar'])
options.populate(argso)
self.assertTrue(options.d['use_shelxe']) # default so should be true
options.d['shelxe_rebuild'] = True
# Set resolution below limit
options.d['mtz_min_resolution'] = SHELXE_MAX_PERMITTED_RESOLUTION + 1
options_processor.process_mr_options(options.d)
self.assertFalse(options.d['use_shelxe'])
self.assertFalse(options.d['shelxe_rebuild'])
def test_options_shelxe_resolution_ok(self):
"""Check we don't accidently turn it off if above limit
"""
options = AMPLEConfigOptions()
argso = argparse_util.process_command_line(args=['-mtz', 'foo',
'-fasta', 'bar'])
options.populate(argso)
self.assertTrue(options.d['use_shelxe']) # default so should be true
options.d['shelxe_rebuild'] = True
options.d['mtz_min_resolution'] = SHELXE_MAX_PERMITTED_RESOLUTION - 1
options_processor.process_mr_options(options.d)
self.assertTrue(options.d['use_shelxe'])
self.assertTrue(options.d['shelxe_rebuild'])
def test_options_shelxe_resolution_cc(self):
"""Check limit with coiled-coil mode turned on
"""
options = AMPLEConfigOptions()
argso = argparse_util.process_command_line(args=['-mtz', 'foo',
'-fasta', 'bar',
'-coiled_coil', 'True'])
options.populate(argso)
options.d['shelxe_rebuild'] = True
limit = random.uniform(SHELXE_MAX_PERMITTED_RESOLUTION, SHELXE_MAX_PERMITTED_RESOLUTION_CC)
options.d['mtz_min_resolution'] = limit
options_processor.process_mr_options(options.d)
self.assertTrue(options.d['use_shelxe'])
self.assertTrue(options.d['shelxe_rebuild'])
def test_options_shelxe_resolution_cmd(self):
"""Check limit with coiled-coil mode turned on
Need to see if we can override and extend the original limit
"""
limit = random.uniform(SHELXE_MAX_PERMITTED_RESOLUTION_CC, REBUILD_MAX_PERMITTED_RESOLUTION)
options = AMPLEConfigOptions()
argso = argparse_util.process_command_line(args=['-mtz', 'foo',
'-fasta', 'bar',
'-coiled_coil', 'True',
'-shelxe_max_resolution', str(limit)])
options.populate(argso)
options.d['use_shelxe'] = True
options.d['shelxe_rebuild'] = True
options.d['mtz_min_resolution'] = random.uniform(SHELXE_MAX_PERMITTED_RESOLUTION_CC, limit)
options_processor.process_mr_options(options.d)
self.assertTrue(options.d['use_shelxe'])
self.assertTrue(options.d['shelxe_rebuild'])
if __name__ == "__main__":
unittest.main()
| 40.413043 | 136 | 0.612695 | 398 | 3,718 | 5.427136 | 0.221106 | 0.085185 | 0.101852 | 0.103704 | 0.768981 | 0.700463 | 0.700463 | 0.639815 | 0.639815 | 0.525463 | 0 | 0.000757 | 0.289672 | 3,718 | 91 | 137 | 40.857143 | 0.817115 | 0.10624 | 0 | 0.561404 | 0 | 0 | 0.11928 | 0.006711 | 0 | 0 | 0 | 0 | 0.175439 | 1 | 0.070175 | false | 0 | 0.087719 | 0 | 0.175439 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d7e7e6135f1b639bb15d575f0227fe58a77a7226 | 121 | py | Python | tests/syntax/assign_to_debug.py | matan-h/friendly | 3ab0fc6541c837271e8865e247750007acdd18fb | [
"MIT"
] | 287 | 2019-04-08T13:18:29.000Z | 2021-03-14T19:10:21.000Z | tests/syntax/assign_to_debug.py | matan-h/friendly | 3ab0fc6541c837271e8865e247750007acdd18fb | [
"MIT"
] | 191 | 2019-04-08T14:39:18.000Z | 2021-03-14T22:14:56.000Z | tests/syntax/assign_to_debug.py | matan-h/friendly | 3ab0fc6541c837271e8865e247750007acdd18fb | [
"MIT"
] | 9 | 2019-04-08T12:54:08.000Z | 2020-11-20T02:26:27.000Z | """Should raise SyntaxError: cannot assign to __debug__ in Py 3.8
and assignment to keyword before."""
__debug__ = 1
| 24.2 | 65 | 0.735537 | 18 | 121 | 4.5 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030303 | 0.181818 | 121 | 4 | 66 | 30.25 | 0.787879 | 0.793388 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d7e914deb0f0f869390725892634614b03a3e1d1 | 346 | py | Python | discord_ritoman/lol/stats/match_start.py | stephend017/Discord-RitoMan | 18bea140af8a552e1cc12557977f73b2434218e4 | [
"MIT"
] | null | null | null | discord_ritoman/lol/stats/match_start.py | stephend017/Discord-RitoMan | 18bea140af8a552e1cc12557977f73b2434218e4 | [
"MIT"
] | 26 | 2020-11-18T05:09:34.000Z | 2022-01-05T19:09:30.000Z | discord_ritoman/lol/stats/match_start.py | stephend017/Discord-RitoMan | 18bea140af8a552e1cc12557977f73b2434218e4 | [
"MIT"
] | 1 | 2020-11-28T02:47:29.000Z | 2020-11-28T02:47:29.000Z | from typing import Any, Dict
from discord_ritoman.lol.stats.match_stat import LoLMatchStat, lol_match_stat
@lol_match_stat("match_start")
class MatchStartStat(LoLMatchStat):
""""""
def process(
self, data: Dict[str, Any], timeline: Dict[str, Any], account_id: str,
) -> Any:
return data["gameCreation"]
| 26.615385 | 79 | 0.67052 | 43 | 346 | 5.209302 | 0.581395 | 0.120536 | 0.107143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.210983 | 346 | 12 | 80 | 28.833333 | 0.820513 | 0 | 0 | 0 | 0 | 0 | 0.070122 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.25 | 0.125 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
d7f37607e481969747d964af25ff7c5e224b7a5a | 303 | py | Python | step01_variables/variables.py | hammadtariq/learn-python | f15da464f017d68ae5635dc31083f913bdb4eb0b | [
"MIT"
] | 12 | 2016-05-07T21:08:46.000Z | 2020-06-02T20:20:28.000Z | step01_variables/variables.py | almirah/learn-python | f15da464f017d68ae5635dc31083f913bdb4eb0b | [
"MIT"
] | null | null | null | step01_variables/variables.py | almirah/learn-python | f15da464f017d68ae5635dc31083f913bdb4eb0b | [
"MIT"
] | 9 | 2016-06-03T10:40:11.000Z | 2021-01-26T13:44:52.000Z | message = "Hello charm"
print(message)
# called string methods
print(message.title())
print(message.upper())
print(message.lower())
myint1 = 7
myint2 = 20
print(myint1 + myint2)
myfloat1 = 1.5
myfloat2 = 2.5
print(myfloat1 + myfloat2)
#convert int to str
print("Happy " + str(myint2) + " birthday") | 15.947368 | 43 | 0.706271 | 42 | 303 | 5.095238 | 0.595238 | 0.224299 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.062016 | 0.148515 | 303 | 19 | 43 | 15.947368 | 0.767442 | 0.128713 | 0 | 0 | 0 | 0 | 0.099237 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.583333 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
d7f4df910c1d3314eef06afcb3f84b3bb02f2a12 | 938 | py | Python | server/routes.py | mjdominus/page-turner | 74654c9ad6aa3a85395925c093226bd23fe3e708 | [
"CC-BY-4.0"
] | 26 | 2020-11-02T23:22:24.000Z | 2021-01-28T23:33:52.000Z | server/routes.py | mjdominus/page-turner | 74654c9ad6aa3a85395925c093226bd23fe3e708 | [
"CC-BY-4.0"
] | null | null | null | server/routes.py | mjdominus/page-turner | 74654c9ad6aa3a85395925c093226bd23fe3e708 | [
"CC-BY-4.0"
] | 1 | 2020-11-02T03:53:45.000Z | 2020-11-02T03:53:45.000Z |
# API:
# GET: retrieve current page number
# POST: update current page number
from app import app
from flask import request
from flask_api import status
from exceptions import WrongPassword
from pprint import pprint
import sys
def failure(msg):
return { "success": False, "error": msg }
@app.route('/get-page')
def get_page():
return { "page": app.server.get_pageName() }
@app.route('/set-page', methods=['POST'])
def set_page():
if "page" not in request.data:
return failure("No page specified"), status.HTTP_400_BAD_REQUEST
if "password" not in request.data:
return failure("No password specified"), status.HTTP_401_UNAUTHORIZED
password = request.data["password"]
page = request.data["page"]
try:
app.server.update_pageName(page, password)
except WrongPassword:
return failure("Incorrect password"), status.HTTP_401_UNAUTHORIZED
return { "success": True }
| 26.055556 | 77 | 0.700426 | 123 | 938 | 5.243902 | 0.373984 | 0.068217 | 0.052713 | 0.049612 | 0.096124 | 0.096124 | 0.096124 | 0 | 0 | 0 | 0 | 0.011811 | 0.187633 | 938 | 35 | 78 | 26.8 | 0.834646 | 0.078891 | 0 | 0 | 0 | 0 | 0.145518 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0.291667 | 0.25 | 0.083333 | 0.625 | 0.041667 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
d7faf0907ef7858b7fa609ed2f9b2ce846646d04 | 498 | py | Python | Configuration/DataProcessing/python/Impl/cosmicsEra_Run2_50ns.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 6 | 2017-09-08T14:12:56.000Z | 2022-03-09T23:57:01.000Z | Configuration/DataProcessing/python/Impl/cosmicsEra_Run2_50ns.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 545 | 2017-09-19T17:10:19.000Z | 2022-03-07T16:55:27.000Z | Configuration/DataProcessing/python/Impl/cosmicsEra_Run2_50ns.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 14 | 2017-10-04T09:47:21.000Z | 2019-10-23T18:04:45.000Z | #!/usr/bin/env python
"""
_cosmicsEra_Run2_50ns_
Scenario supporting cosmic data taking
"""
import os
import sys
from Configuration.Eras.Era_Run2_50ns_cff import Run2_50ns
from Configuration.DataProcessing.Impl.cosmics import cosmics
class cosmicsEra_Run2_50ns(cosmics):
def __init__(self):
cosmics.__init__(self)
self.eras = Run2_50ns
"""
_cosmicsEra_Run2_50ns_
Implement configuration building for data processing for cosmic
data taking in Run2
"""
| 19.153846 | 67 | 0.748996 | 63 | 498 | 5.555556 | 0.507937 | 0.137143 | 0.154286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.046798 | 0.184739 | 498 | 25 | 68 | 19.92 | 0.815271 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.5 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
cc0861cbd62f3f116875451f69a4cf82a71c9452 | 2,486 | py | Python | preprocessing/up_crop.py | nanopoteto/bodynet | e5d49e5de64c3762d7f2f0cb93fafd066d15f038 | [
"MIT"
] | 264 | 2018-08-09T15:57:07.000Z | 2022-03-17T18:36:06.000Z | preprocessing/up_crop.py | nanopoteto/bodynet | e5d49e5de64c3762d7f2f0cb93fafd066d15f038 | [
"MIT"
] | 17 | 2018-09-13T11:53:02.000Z | 2021-09-17T08:51:42.000Z | preprocessing/up_crop.py | LONG-9621/body_net | f07dec69a6490ecdeb1dfd3758e76a3ca5887e5b | [
"MIT"
] | 49 | 2018-08-10T03:28:58.000Z | 2022-03-29T01:49:00.000Z | def get_crop(imageshape, person_center):
crop = 513
"""Crop the image to the given maximum size. Use the person center."""
if imageshape[0] > crop:
crop_y = _np.array([int(_np.floor(person_center[1]) - _np.floor(crop / 2.)),
int(_np.floor(person_center[1]) + _np.ceil(crop / 2.))],
dtype='int')
remaining_region_size = [crop_y[0], imageshape[0] - crop_y[1]]
if remaining_region_size[0] < remaining_region_size[1]:
if remaining_region_size[0] < 0 and remaining_region_size[1] > 0:
crop_y += min(remaining_region_size[1], -remaining_region_size[0])
else:
if remaining_region_size[1] < 0 and remaining_region_size[0] > 0:
crop_y -= min(remaining_region_size[0], -remaining_region_size[1])
assert crop_y[1] - crop_y[0] == crop
else:
crop_y = [0, imageshape[0]]
if imageshape[1] > crop:
crop_x = _np.array([int(_np.floor(person_center[0]) - _np.floor(crop / 2.)),
int(_np.floor(person_center[0]) + _np.ceil(crop / 2.))],
dtype='int')
remaining_region_size = [crop_x[0], imageshape[1] - crop_x[1]]
if remaining_region_size[0] < remaining_region_size[1]:
if remaining_region_size[0] < 0 and remaining_region_size[1] > 0:
crop_x += min(remaining_region_size[1], -remaining_region_size[0])
else:
if remaining_region_size[1] < 0 and remaining_region_size[0] > 0:
crop_x -= min(remaining_region_size[0], -remaining_region_size[1])
assert crop_x[1] - crop_x[0] == crop
else:
crop_x = [0, imageshape[1]]
return crop_y, crop_x
import sys
import numpy as _np
height = int(sys.argv[1])
width = int(sys.argv[2])
# person_center floor'ed computed as np.mean(joints[:2, joints[2, :] == 1], axis=1) * norm_factor
person_center_height = int(sys.argv[3])
person_center_width = int(sys.argv[4])
imageshape = _np.array((height, width))
person_center = _np.array((person_center_height, person_center_width))
crop_y, crop_x = get_crop(imageshape, person_center)
print(crop_y[0], crop_y[1], crop_x[0], crop_x[1])
# Use this crop_y and crop_x as follows:
# image = image[crop_y[0]:crop_y[1], crop_x[0]:crop_x[1], :]
# https://github.com/classner/up/blob/master/segmentation/tools/create_dataset.py
# https://github.com/classner/up/blob/master/up_tools/model.py
| 43.614035 | 97 | 0.633146 | 377 | 2,486 | 3.888594 | 0.172414 | 0.225102 | 0.28513 | 0.136426 | 0.650068 | 0.562074 | 0.562074 | 0.470668 | 0.470668 | 0.424284 | 0 | 0.036979 | 0.227675 | 2,486 | 56 | 98 | 44.392857 | 0.726563 | 0.134352 | 0 | 0.292683 | 0 | 0 | 0.00289 | 0 | 0 | 0 | 0 | 0 | 0.04878 | 1 | 0.02439 | false | 0 | 0.04878 | 0 | 0.097561 | 0.02439 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
cc09432b13d6145a1842571f6604b9625880f147 | 3,193 | py | Python | src/oci/service_mesh/models/create_ingress_gateway_mutual_transport_layer_security_details.py | pabs3/oci-python-sdk | 437ba18ce39af2d1090e277c4bb8750c89f83021 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/oci/service_mesh/models/create_ingress_gateway_mutual_transport_layer_security_details.py | pabs3/oci-python-sdk | 437ba18ce39af2d1090e277c4bb8750c89f83021 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/oci/service_mesh/models/create_ingress_gateway_mutual_transport_layer_security_details.py | pabs3/oci-python-sdk | 437ba18ce39af2d1090e277c4bb8750c89f83021 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | # coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401
from oci.decorators import init_model_state_from_kwargs
@init_model_state_from_kwargs
class CreateIngressGatewayMutualTransportLayerSecurityDetails(object):
"""
Mutual TLS settings used when sending requests to virtual services within the mesh.
"""
def __init__(self, **kwargs):
"""
Initializes a new CreateIngressGatewayMutualTransportLayerSecurityDetails object with values from keyword arguments.
The following keyword arguments are supported (corresponding to the getters/setters of this class):
:param maximum_validity:
The value to assign to the maximum_validity property of this CreateIngressGatewayMutualTransportLayerSecurityDetails.
:type maximum_validity: int
"""
self.swagger_types = {
'maximum_validity': 'int'
}
self.attribute_map = {
'maximum_validity': 'maximumValidity'
}
self._maximum_validity = None
@property
def maximum_validity(self):
"""
Gets the maximum_validity of this CreateIngressGatewayMutualTransportLayerSecurityDetails.
The number of days the mTLS certificate is valid. This value should be less than the Maximum Validity Duration
for Certificates (Days) setting on the Certificate Authority associated with this Mesh. The certificate will
be automatically renewed after 2/3 of the validity period, so a certificate with a maximum validity of 45 days
will be renewed every 30 days.
:return: The maximum_validity of this CreateIngressGatewayMutualTransportLayerSecurityDetails.
:rtype: int
"""
return self._maximum_validity
@maximum_validity.setter
def maximum_validity(self, maximum_validity):
"""
Sets the maximum_validity of this CreateIngressGatewayMutualTransportLayerSecurityDetails.
The number of days the mTLS certificate is valid. This value should be less than the Maximum Validity Duration
for Certificates (Days) setting on the Certificate Authority associated with this Mesh. The certificate will
be automatically renewed after 2/3 of the validity period, so a certificate with a maximum validity of 45 days
will be renewed every 30 days.
:param maximum_validity: The maximum_validity of this CreateIngressGatewayMutualTransportLayerSecurityDetails.
:type: int
"""
self._maximum_validity = maximum_validity
def __repr__(self):
return formatted_flat_dict(self)
def __eq__(self, other):
if other is None:
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
return not self == other
| 41.467532 | 245 | 0.722518 | 378 | 3,193 | 5.931217 | 0.378307 | 0.14719 | 0.0562 | 0.035682 | 0.456735 | 0.404996 | 0.334523 | 0.334523 | 0.334523 | 0.334523 | 0 | 0.012136 | 0.225806 | 3,193 | 76 | 246 | 42.013158 | 0.894822 | 0.616035 | 0 | 0 | 0 | 0 | 0.049554 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.076923 | 0.076923 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
cc0bf165b3c53fb5329983010d587c786f4d8150 | 233 | py | Python | deepscratch/dataloader/xor.py | mari-linhares/deep-python-scratch | b447ed20c981db5ffef810b6f80d1638cf7d2ccd | [
"MIT"
] | 9 | 2018-09-18T00:29:10.000Z | 2021-02-20T17:58:30.000Z | deepscratch/dataloader/xor.py | Jagannathrk2020/deeplearning-from-scratch | b447ed20c981db5ffef810b6f80d1638cf7d2ccd | [
"MIT"
] | null | null | null | deepscratch/dataloader/xor.py | Jagannathrk2020/deeplearning-from-scratch | b447ed20c981db5ffef810b6f80d1638cf7d2ccd | [
"MIT"
] | 3 | 2018-09-18T15:47:59.000Z | 2020-08-09T03:10:34.000Z | import numpy as np
from deepscratch.dataloader.dataloader import DataLoader
class XOR(DataLoader):
def __init__(self):
self.x = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
self.y = np.array([[0], [1], [1], [0]]) | 25.888889 | 59 | 0.579399 | 36 | 233 | 3.638889 | 0.472222 | 0.045802 | 0.068702 | 0.061069 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.065574 | 0.214592 | 233 | 9 | 60 | 25.888889 | 0.650273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
cc0f18b5ee9eeb4040bbac3adf507c33b7150070 | 98 | py | Python | month01/employee_info_manager_systeam/main.py | Amiao-miao/all-codes | ec50036d42d40086cac5fddf6baf4de18ac91e55 | [
"Apache-2.0"
] | 1 | 2021-02-02T02:17:37.000Z | 2021-02-02T02:17:37.000Z | month01/employee_info_manager_systeam/main.py | Amiao-miao/all-codes | ec50036d42d40086cac5fddf6baf4de18ac91e55 | [
"Apache-2.0"
] | null | null | null | month01/employee_info_manager_systeam/main.py | Amiao-miao/all-codes | ec50036d42d40086cac5fddf6baf4de18ac91e55 | [
"Apache-2.0"
] | null | null | null | from usl import EmployeeView
if __name__ == '__main__':
view=EmployeeView()
view.main()
| 14 | 28 | 0.683673 | 11 | 98 | 5.363636 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.204082 | 98 | 6 | 29 | 16.333333 | 0.75641 | 0 | 0 | 0 | 0 | 0 | 0.081633 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
cc1a39ee25044c9a8233d00392ebe71ae35ee0f9 | 641 | py | Python | semkov/apps/core/models.py | manti-by/Semkov | c48d3c21d1b39aa7e02b6c31c2cf5ad385a62723 | [
"BSD-3-Clause"
] | null | null | null | semkov/apps/core/models.py | manti-by/Semkov | c48d3c21d1b39aa7e02b6c31c2cf5ad385a62723 | [
"BSD-3-Clause"
] | 2 | 2021-04-13T21:30:21.000Z | 2021-04-13T21:32:45.000Z | semkov/apps/core/models.py | manti-by/Semkov | c48d3c21d1b39aa7e02b6c31c2cf5ad385a62723 | [
"BSD-3-Clause"
] | null | null | null | from django.db import models
class Email(models.Model):
name = models.CharField(max_length=255, blank=True, null=True)
contact = models.CharField(max_length=255)
subject = models.CharField(max_length=255)
message = models.TextField()
meta = models.TextField(blank=True, null=True)
is_sent = models.BooleanField(blank=True, default=False)
created = models.DateTimeField(auto_now_add=True)
class SMS(models.Model):
number = models.CharField(max_length=255)
message = models.TextField()
is_sent = models.BooleanField(blank=True, default=False)
created = models.DateTimeField(auto_now_add=True)
| 30.52381 | 66 | 0.73791 | 84 | 641 | 5.511905 | 0.392857 | 0.12959 | 0.155508 | 0.207343 | 0.695464 | 0.578834 | 0.578834 | 0.578834 | 0.367171 | 0.367171 | 0 | 0.022018 | 0.149766 | 641 | 20 | 67 | 32.05 | 0.827523 | 0 | 0 | 0.428571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.071429 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
cc1d11ef5cea484507d4808f90357896cbe431ce | 2,025 | py | Python | sms_auth/models/sms.py | a1k89/django-rest-sms-auth | 4fa4ed20444252fb4d77fc32b12c3e94abcc1092 | [
"MIT"
] | 5 | 2021-06-06T14:17:20.000Z | 2022-03-16T17:12:21.000Z | sms_auth/models/sms.py | a1k89/django-rest-sms-auth | 4fa4ed20444252fb4d77fc32b12c3e94abcc1092 | [
"MIT"
] | null | null | null | sms_auth/models/sms.py | a1k89/django-rest-sms-auth | 4fa4ed20444252fb4d77fc32b12c3e94abcc1092 | [
"MIT"
] | 1 | 2021-12-04T18:45:34.000Z | 2021-12-04T18:45:34.000Z | from django.db import models
from django.utils import timezone
from django.contrib.auth import get_user_model
from phonenumber_field.modelfields import PhoneNumberField
from ..utils import random_code, valid_to
class SMSMessage(models.Model):
"""
Save sended sms after as history
"""
created = models.DateTimeField(auto_now_add=True)
phone_number = models.CharField("Phone number", max_length=20)
def __str__(self):
return f"{self.phone_number} / {self.created}"
def __repr__(self):
return f"{self.phone_number}"
class Meta:
verbose_name = "Sms log"
verbose_name_plural = "Sms log"
class PhoneCode(models.Model):
"""
After validation save phone code instance
"""
phone_number = PhoneNumberField(unique=True)
owner = models.ForeignKey(get_user_model(),
null=True,
on_delete=models.CASCADE)
code = models.PositiveIntegerField(default=random_code)
valid_to = models.DateTimeField(default=valid_to)
created_at = models.DateTimeField(auto_now_add=True)
class Meta:
ordering = ("created_at",)
verbose_name = "Phone code"
verbose_name_plural = "Phone codes"
def __str__(self):
return f"{self.phone_number} ({self.code})"
def __repr__(self):
return self.__str__()
@property
def is_allow(self):
return timezone.now() >= self.valid_to
@property
def message(self) -> str:
return f"Your auth code: {self.code}"
def save(self, *args, **kwargs):
from ..conf import conf
pretendent = self.__class__.objects.filter(
phone_number=self.phone_number
).first()
if pretendent is not None:
self.pk = pretendent.pk
if conf.SMS_AUTH_DEBUG_PHONE_NUMBER is not None:
if self.phone_number == conf.SMS_AUTH_DEBUG_PHONE_NUMBER:
self.code = conf.SMS_DEBUG_CODE
super().save(*args, **kwargs)
| 27 | 69 | 0.644444 | 246 | 2,025 | 5.028455 | 0.341463 | 0.097817 | 0.060631 | 0.036378 | 0.176233 | 0.176233 | 0.058205 | 0.058205 | 0.058205 | 0 | 0 | 0.001332 | 0.258765 | 2,025 | 74 | 70 | 27.364865 | 0.822785 | 0.036543 | 0 | 0.166667 | 0 | 0 | 0.089583 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.145833 | false | 0 | 0.125 | 0.125 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
cc2106849d4ea9eef7e0570b3ea67c67e2b86166 | 1,555 | py | Python | alipay/aop/api/domain/TuitionQueryOrder.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | 213 | 2018-08-27T16:49:32.000Z | 2021-12-29T04:34:12.000Z | alipay/aop/api/domain/TuitionQueryOrder.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | 29 | 2018-09-29T06:43:00.000Z | 2021-09-02T03:27:32.000Z | alipay/aop/api/domain/TuitionQueryOrder.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | 59 | 2018-08-27T16:59:26.000Z | 2022-03-25T10:08:15.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class TuitionQueryOrder(object):
def __init__(self):
self._alipay_payment_id = None
self._isv_payment_id = None
@property
def alipay_payment_id(self):
return self._alipay_payment_id
@alipay_payment_id.setter
def alipay_payment_id(self, value):
self._alipay_payment_id = value
@property
def isv_payment_id(self):
return self._isv_payment_id
@isv_payment_id.setter
def isv_payment_id(self, value):
self._isv_payment_id = value
def to_alipay_dict(self):
params = dict()
if self.alipay_payment_id:
if hasattr(self.alipay_payment_id, 'to_alipay_dict'):
params['alipay_payment_id'] = self.alipay_payment_id.to_alipay_dict()
else:
params['alipay_payment_id'] = self.alipay_payment_id
if self.isv_payment_id:
if hasattr(self.isv_payment_id, 'to_alipay_dict'):
params['isv_payment_id'] = self.isv_payment_id.to_alipay_dict()
else:
params['isv_payment_id'] = self.isv_payment_id
return params
@staticmethod
def from_alipay_dict(d):
if not d:
return None
o = TuitionQueryOrder()
if 'alipay_payment_id' in d:
o.alipay_payment_id = d['alipay_payment_id']
if 'isv_payment_id' in d:
o.isv_payment_id = d['isv_payment_id']
return o
| 27.767857 | 85 | 0.633441 | 204 | 1,555 | 4.426471 | 0.196078 | 0.299003 | 0.249169 | 0.147287 | 0.479513 | 0.264673 | 0.264673 | 0.163898 | 0 | 0 | 0 | 0.000891 | 0.278457 | 1,555 | 55 | 86 | 28.272727 | 0.803922 | 0.02701 | 0 | 0.097561 | 0 | 0 | 0.100729 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.170732 | false | 0 | 0.04878 | 0.04878 | 0.365854 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
cc316bac597cbe9823b550f70dcc45ed854dc71f | 313 | py | Python | Practice/AllDomains/Languages/Python/Strings/Findastring.py | DHS009/HackerRankSolutions | cc74ecc436c4d3e8ca7d62986a7cbe482f3c24ba | [
"MIT"
] | 15 | 2017-11-10T06:20:22.000Z | 2022-03-20T15:33:19.000Z | Practice/AllDomains/Languages/Python/Strings/Findastring.py | DHS009/HackerRankSolutions | cc74ecc436c4d3e8ca7d62986a7cbe482f3c24ba | [
"MIT"
] | 1 | 2018-12-12T15:12:33.000Z | 2018-12-12T15:12:33.000Z | Practice/AllDomains/Languages/Python/Strings/Findastring.py | DHS009/HackerRankSolutions | cc74ecc436c4d3e8ca7d62986a7cbe482f3c24ba | [
"MIT"
] | 9 | 2017-07-28T12:54:19.000Z | 2021-08-13T12:00:08.000Z | #/* author:@shivkrthakur */
# Enter your code here. Read input from STDIN. Print output to STDOUT
inputStr = raw_input()
subStr = raw_input()
#print inputStr
count = 0
index = -1
while True:
index = inputStr.find(subStr, index + 1)
if index == -1:
break
else:
count += 1
print count | 19.5625 | 69 | 0.638978 | 43 | 313 | 4.604651 | 0.627907 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021368 | 0.252396 | 313 | 16 | 70 | 19.5625 | 0.824786 | 0.348243 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.0625 | 0 | 0 | null | null | 0 | 0 | null | null | 0.090909 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
cc33b26ee4c22db5b81b6efd33c4f95cb45a79c8 | 1,488 | py | Python | mlp/migrations/0004_auto_20180326_2322.py | paleocore/paleocore110 | 754f3248ab22a2996b43bd224bd4ba15462edf7d | [
"MIT"
] | null | null | null | mlp/migrations/0004_auto_20180326_2322.py | paleocore/paleocore110 | 754f3248ab22a2996b43bd224bd4ba15462edf7d | [
"MIT"
] | 7 | 2020-02-05T20:54:24.000Z | 2021-12-13T20:13:20.000Z | mlp/migrations/0004_auto_20180326_2322.py | paleocore/paleocore110 | 754f3248ab22a2996b43bd224bd4ba15462edf7d | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2018-03-26 23:22
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mlp', '0003_auto_20180322_1651'),
]
operations = [
migrations.AlterField(
model_name='biology',
name='identified_by',
field=models.CharField(blank=True, choices=[('Zeresenay Alemseged', 'Zeresenay Alemseged'), ('Yared Asseffa', 'Yared Assefa'), ('Andrew Barr', 'Andrew Barr'), ('Rene Bobe', 'Rene Bobe'), ('Denis Geraads', 'Denis Geraads'), ('Tomas Getachew', 'Tomas Getachew'), ('Waldeyared Hailu', 'Waldeyared Hailu'), ('Shannon McPherron', 'Shannon McPherron'), ('Denne Reed', 'Denne Reed'), ('Peter Stamos', 'Peter Stamos'), ('Jonathan Wynn', 'Jonathan Wynn')], max_length=100, null=True),
),
migrations.AlterField(
model_name='occurrence',
name='collector',
field=models.CharField(blank=True, choices=[('Zeresenay Alemseged', 'Zeresenay Alemseged'), ('Yared Asseffa', 'Yared Assefa'), ('Andrew Barr', 'Andrew Barr'), ('Rene Bobe', 'Rene Bobe'), ('Denis Geraads', 'Denis Geraads'), ('Tomas Getachew', 'Tomas Getachew'), ('Waldeyared Hailu', 'Waldeyared Hailu'), ('Shannon McPherron', 'Shannon McPherron'), ('Denne Reed', 'Denne Reed'), ('Peter Stamos', 'Peter Stamos'), ('Jonathan Wynn', 'Jonathan Wynn')], max_length=50, null=True),
),
]
| 57.230769 | 487 | 0.643817 | 162 | 1,488 | 5.833333 | 0.438272 | 0.07619 | 0.05291 | 0.061376 | 0.668783 | 0.668783 | 0.668783 | 0.668783 | 0.668783 | 0.668783 | 0 | 0.031173 | 0.18078 | 1,488 | 25 | 488 | 59.52 | 0.744053 | 0.045699 | 0 | 0.222222 | 1 | 0 | 0.459421 | 0.016231 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.111111 | 0 | 0.277778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
0bc8d597e263d45fff7292a86ca12271cb735ceb | 4,833 | py | Python | sso.py | yahngming/babel | e981f9a8872d3b57c080208f6ce22dda51180367 | [
"BSD-3-Clause"
] | null | null | null | sso.py | yahngming/babel | e981f9a8872d3b57c080208f6ce22dda51180367 | [
"BSD-3-Clause"
] | null | null | null | sso.py | yahngming/babel | e981f9a8872d3b57c080208f6ce22dda51180367 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# coding=utf-8
import os
import re
import time
import datetime
import hashlib
import string
import random
import config
from google.appengine.ext import webapp
from google.appengine.api import memcache
from google.appengine.ext import db
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template
from v2ex.babel import Member
from v2ex.babel import Counter
from v2ex.babel import Section
from v2ex.babel import Node
from v2ex.babel import Topic
from v2ex.babel import Reply
from v2ex.babel import Note
from v2ex.babel import SYSTEM_VERSION
from v2ex.babel.security import *
from v2ex.babel.ua import *
from v2ex.babel.da import *
from v2ex.babel.l10n import *
from v2ex.babel.ext.cookies import Cookies
template.register_template_library('v2ex.templatetags.filters')
class SSOV0Handler(webapp.RequestHandler):
def get(self):
site = GetSite()
self.response.headers['Content-type'] = 'application/json'
u = self.request.get('u').strip().lower()
p = self.request.get('p').strip()
failed = '{"ok" : 0}'
if (len(u) > 0) and (len(p) > 0):
q = db.GqlQuery("SELECT * FROM Member WHERE username_lower = :1 AND password = :2", u, p)
if q.count() > 0:
member = q[0]
if member.avatar_mini_url:
if (member.avatar_mini_url[0:1] == '/'):
member.avatar_mini_url = 'http://' + site.domain + member.avatar_mini_url
member.avatar_normal_url = 'http://' + site.domain + member.avatar_normal_url
member.avatar_large_url = 'http://' + site.domain + member.avatar_large_url
else:
member.avatar_mini_url = 'http://' + site.domain + '/static/img/avatar_mini.png'
member.avatar_normal_url = 'http://' + site.domain + '/static/img/avatar_normal.png'
member.avatar_large_url = 'http://' + site.domain + '/static/img/avatar_large.png'
self.response.out.write('{"ok" : 1, "num" : ' + str(member.num) + ', "username" : "' + member.username + '", "username_lower" : "' + member.username_lower + '", "email" : "' + member.email + '", "avatar_mini_url" : "' + member.avatar_mini_url + '", "avatar_normal_url" : "' + member.avatar_normal_url + '", "avatar_large_url" : "' + member.avatar_large_url + '", "created" : ' + str(time.mktime(member.created.timetuple())) + ', "last_modified" : ' + str(time.mktime(member.last_modified.timetuple())) + '}')
else:
self.response.out.write(failed)
else:
self.response.out.write(failed)
class SSOX0Handler(webapp.RequestHandler):
def get(self):
site = GetSite()
self.response.headers['Content-type'] = 'application/json'
x = self.request.get('x').strip()
n = self.request.get('n').strip().lower()
failed = '{"ok" : 0}'
if x == config.ssox:
q = db.GqlQuery("SELECT * FROM Member WHERE username_lower = :1", n)
if q.count() > 0:
member = q[0]
if member.avatar_mini_url:
if (member.avatar_mini_url[0:1] == '/'):
member.avatar_mini_url = 'http://' + site.domain + member.avatar_mini_url
member.avatar_normal_url = 'http://' + site.domain + member.avatar_normal_url
member.avatar_large_url = 'http://' + site.domain + member.avatar_large_url
else:
member.avatar_mini_url = 'http://' + site.domain + '/static/img/avatar_mini.png'
member.avatar_normal_url = 'http://' + site.domain + '/static/img/avatar_normal.png'
member.avatar_large_url = 'http://' + site.domain + '/static/img/avatar_large.png'
self.response.out.write('{"ok" : 1, "num" : ' + str(member.num) + ', "username" : "' + member.username + '", "username_lower" : "' + member.username_lower + '", "email" : "' + member.email + '", "password" : "' + member.password + '", "avatar_mini_url" : "' + member.avatar_mini_url + '", "avatar_normal_url" : "' + member.avatar_normal_url + '", "avatar_large_url" : "' + member.avatar_large_url + '", "created" : ' + str(time.mktime(member.created.timetuple())) + ', "last_modified" : ' + str(time.mktime(member.last_modified.timetuple())) + '}')
else:
self.response.out.write(failed)
else:
self.response.out.write(failed)
def main():
application = webapp.WSGIApplication([
('/sso/v0', SSOV0Handler),
('/sso/x0', SSOX0Handler)
],
debug=True)
util.run_wsgi_app(application)
if __name__ == '__main__':
main() | 48.33 | 564 | 0.599214 | 575 | 4,833 | 4.867826 | 0.201739 | 0.120043 | 0.065023 | 0.081458 | 0.683101 | 0.663094 | 0.6388 | 0.6388 | 0.6388 | 0.6388 | 0 | 0.011071 | 0.252431 | 4,833 | 100 | 565 | 48.33 | 0.763631 | 0.006828 | 0 | 0.44186 | 0 | 0 | 0.182121 | 0.040217 | 0 | 0 | 0 | 0 | 0 | 1 | 0.034884 | false | 0.023256 | 0.302326 | 0 | 0.360465 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
0bdd4c461cfaa23616c0001275a2b6ab0010a0ea | 4,166 | py | Python | python/turtle.py | AntonioCSF/codex | 4b7e8deb510ed0852302311905f24c988264ed90 | [
"MIT"
] | 11 | 2017-03-14T09:07:53.000Z | 2021-02-19T15:50:56.000Z | python/turtle.py | domingues/codex | a663f0dd545c02edb1650a2f1d3f709753f913fc | [
"MIT"
] | null | null | null | python/turtle.py | domingues/codex | a663f0dd545c02edb1650a2f1d3f709753f913fc | [
"MIT"
] | 3 | 2018-05-25T16:16:18.000Z | 2020-05-13T16:36:09.000Z | #
# Turtle replacement module for execise assement
#
# Pedro Vasconcelos, 2013
#
import math
class TurtleCmd:
"Abstract class for turtle commands"
pass
class Forward(TurtleCmd):
def __init__(this, n):
this.arg = n
def __eq__(this,that):
return ((isinstance(that,Forward) and that.arg == this.arg) or
(isinstance(that,Backward) and that.arg == -this.arg))
def __repr__(this):
return "forward(%g)" % this.arg
class Backward(TurtleCmd):
def __init__(this, n):
this.arg = n
def __eq__(this,that):
return ((isinstance(that,Backward) and that.arg == this.arg) or
(isinstance(that,Forward) and that.arg == -this.arg))
def __repr__(this):
return "backward(%g)" % this.arg
class Left(TurtleCmd):
def __init__(this, n):
this.arg = n
def __eq__(this,that):
return ((isinstance(that,Left) and that.arg == this.arg) or
(isinstance(that,Right) and that.arg == -this.arg))
def __repr__(this):
return "left(%g)" % this.arg
class Right(TurtleCmd):
def __init__(this, n):
this.arg = n
def __eq__(this,that):
return ((isinstance(that,Right) and that.arg == this.arg) or
(isinstance(that,Left) and that.arg == -this.arg))
def __repr__(this):
return "right(%g)" % this.arg
## these two are singletons
class PenDown(TurtleCmd):
def __eq__(this,that):
return isinstance(that, PenDown)
def __repr__(this):
return "pendown()"
class PenUp(TurtleCmd):
def __eq__(this,that):
return isinstance(that, PenUp)
def __repr__(this):
return "penup()"
class Turtle:
"Class for turtle programs"
def __init__(this):
this.reset()
def position(this):
return (this.__xcoord, this.__ycoord)
def xcor(this):
return this.__xcoord
def ycor(this):
return this.__ycoord
def isdown(this):
return this.__pendown
def heading(this):
return this.__heading
def goto(this, x, y):
this.__xcoord = x
this.__ycoord = y
def reset(this):
this.__cmdlist = []
this.__xcoord = 0.0
this.__ycoord = 0.0
this.__heading = 0.0
this.__pendown = True
def clear(this):
this.__cmdlist = []
def commands(this):
if this.__cmdlist == []:
print("*** No turtle commands ***")
else:
for cmd in this.__cmdlist:
print(cmd)
def penup(this):
if this.__pendown:
this.__cmdlist.append(PenUp())
this.__pendown = False
def pendown(this):
if not this.__pendown:
this.__cmdlist.append(PenDown())
this.__pendown = True
# rotation command assume degrees
def left(this, arg):
this.__cmdlist.append(Left(arg))
this.__heading = (this.__heading + arg) % 360
def right(this, arg):
this.__cmdlist.append(Right(arg))
this.__heading = (this.__heading - arg) % 360
def forward(this, arg):
this.__cmdlist.append(Forward(arg))
r = this.__heading/360*2*math.pi
this.__xcoord += math.cos(r)*arg
this.__ycoord += math.sin(r)*arg
# shorthand wrappers
def lt(this,arg):
this.left(arg)
def rt(this,arg):
this.right(arg)
def fd(this,arg):
this.forward(arg)
# create a default turtle
__turtle__ = Turtle()
# wrappers for default turtle
def clear():
__turtle__.clear()
def reset():
__turtle__.reset()
def commands():
return __turtle__.commands()
def forward(n):
__turtle__.forward(n)
def backward(n):
__turtle__.backward(n)
def left(n):
__turtle__.left(n)
def right(n):
__turtle__.right(n)
def fd(n):
__turtle__.fd(n)
def rt(n):
__turtle__.rt(n)
def lt(n):
__turtle__.lt(n)
def heading():
return __turtle__.heading()
def position():
return __turtle__.position()
def goto(x,y):
__turtle__.goto(x,y)
def penup():
__turtle__.penup()
def pendown():
__turtle__.pendown()
| 20.623762 | 71 | 0.591215 | 515 | 4,166 | 4.401942 | 0.159223 | 0.067931 | 0.035289 | 0.049405 | 0.372298 | 0.315836 | 0.315836 | 0.315836 | 0.169387 | 0.109396 | 0 | 0.0067 | 0.283485 | 4,166 | 201 | 72 | 20.726368 | 0.752764 | 0.06265 | 0 | 0.180451 | 0 | 0 | 0.035651 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.368421 | false | 0.007519 | 0.007519 | 0.150376 | 0.586466 | 0.015038 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
0be3665e5002be63407669d488e56ecfb9206634 | 714 | py | Python | src/vallenae/features/conversion.py | vallen-systems/pyVallenAE | 0e1c712c055ea5c4e7cb4373a2bf73f33c2b886d | [
"MIT"
] | 10 | 2020-01-30T15:34:51.000Z | 2022-03-11T07:49:31.000Z | src/vallenae/features/conversion.py | vallen-systems/pyVallenAE | 0e1c712c055ea5c4e7cb4373a2bf73f33c2b886d | [
"MIT"
] | 1 | 2020-10-30T16:25:11.000Z | 2020-11-05T19:51:51.000Z | src/vallenae/features/conversion.py | vallen-systems/pyVallenAE | 0e1c712c055ea5c4e7cb4373a2bf73f33c2b886d | [
"MIT"
] | 5 | 2020-02-08T04:43:03.000Z | 2022-02-23T13:52:00.000Z | import math
def amplitude_to_db(amplitude: float, reference: float = 1e-6) -> float:
"""
Convert amplitude from volts to decibel (dB).
Args:
amplitude: Amplitude in volts
reference: Reference amplitude. Defaults to 1 µV for dB(AE)
Returns:
Amplitude in dB(ref)
"""
return 20 * math.log10(amplitude / reference)
def db_to_amplitude(amplitude_db: float, reference: float = 1e-6) -> float:
"""
Convert amplitude from decibel (dB) to volts.
Args:
amplitude_db: Amplitude in dB
reference: Reference amplitude. Defaults to 1 µV for dB(AE)
Returns:
Amplitude in volts
"""
return reference * 10 ** (amplitude_db / 20)
| 23.8 | 75 | 0.640056 | 91 | 714 | 4.945055 | 0.296703 | 0.097778 | 0.084444 | 0.093333 | 0.497778 | 0.497778 | 0.497778 | 0.497778 | 0.497778 | 0.288889 | 0 | 0.02682 | 0.268908 | 714 | 29 | 76 | 24.62069 | 0.835249 | 0.516807 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0.2 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
0be7ff8e4af6a37388187180f7566c9b8c9d79ba | 1,041 | py | Python | tds/views/base.py | minddrive/tds | 573836434c76603fdd3dd9e07545b48f86e5f70f | [
"Apache-2.0"
] | 1 | 2020-01-02T13:44:23.000Z | 2020-01-02T13:44:23.000Z | tds/views/base.py | ifwe/tds | 573836434c76603fdd3dd9e07545b48f86e5f70f | [
"Apache-2.0"
] | 1 | 2017-02-22T22:25:23.000Z | 2017-02-23T17:10:00.000Z | tds/views/base.py | minddrive/tds | 573836434c76603fdd3dd9e07545b48f86e5f70f | [
"Apache-2.0"
] | 1 | 2016-08-02T06:06:35.000Z | 2016-08-02T06:06:35.000Z | # Copyright 2016 Ifwe Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Base class and helpers for tds.views
"""
class Base(object):
"""Base class and interface for a tds.views class."""
def __init__(self, output_format):
"""Initialize object."""
self.output_format = output_format
def generate_result(self, view_name, tds_result):
"""
Create something useful for the user which will be returned
to the main application entry point.
"""
raise NotImplementedError
| 31.545455 | 74 | 0.708934 | 147 | 1,041 | 4.952381 | 0.639456 | 0.082418 | 0.035714 | 0.043956 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009768 | 0.213256 | 1,041 | 32 | 75 | 32.53125 | 0.879121 | 0.71854 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
0bf8ced3319d905c9fceb5e833d0730b8b213cee | 1,578 | py | Python | setup.py | PCManticore/sider | cd11b38b2a1bf1ea3600eb287abfe3c2b40c67c1 | [
"MIT"
] | 19 | 2015-01-17T18:24:36.000Z | 2022-02-05T06:33:41.000Z | setup.py | PCManticore/sider | cd11b38b2a1bf1ea3600eb287abfe3c2b40c67c1 | [
"MIT"
] | 5 | 2016-01-13T14:19:44.000Z | 2016-06-01T18:50:36.000Z | setup.py | PCManticore/sider | cd11b38b2a1bf1ea3600eb287abfe3c2b40c67c1 | [
"MIT"
] | 6 | 2015-08-16T10:32:09.000Z | 2019-11-29T09:57:06.000Z | from __future__ import with_statement
import os.path
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from sider.version import VERSION
def readme():
try:
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f:
return f.read()
except (IOError, OSError):
return ''
setup(name='Sider',
packages=['sider', 'sider.ext', "sidertests"],
py_modules=["sider__exttest"],
version=VERSION,
description='A persistent object library based on Redis',
long_description=readme(),
license='MIT License',
author='Hong Minhee',
author_email='minhee' '@' 'dahlia.kr',
maintainer='Hong Minhee',
maintainer_email='minhee' '@' 'dahlia.kr',
url='http://sider.dahlia.kr/',
install_requires=['redis'],
tests_require=['pytest'],
extras_require={'docs': ['Sphinx >= 1.1']},
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Programming Language :: Python :: Implementation :: Stackless',
'Topic :: Database'
])
| 33.574468 | 78 | 0.614068 | 163 | 1,578 | 5.834356 | 0.558282 | 0.139853 | 0.184017 | 0.123028 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009213 | 0.243346 | 1,578 | 46 | 79 | 34.304348 | 0.78727 | 0 | 0 | 0.047619 | 0 | 0 | 0.434728 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.02381 | true | 0 | 0.142857 | 0 | 0.214286 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
04029befa56f67b8527707b49a6453ad93a23b10 | 8,088 | py | Python | pysnmp/CASA-802-TAP-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/CASA-802-TAP-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/CASA-802-TAP-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module CASA-802-TAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CASA-802-TAP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:29:27 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint")
casa, = mibBuilder.importSymbols("CASA-MIB", "casa")
pktcEScTapMediationContentId, = mibBuilder.importSymbols("PKTC-ES-TAP-MIB", "pktcEScTapMediationContentId")
ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance")
IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, iso, Gauge32, Counter32, Integer32, Counter64, NotificationType, MibIdentifier, ObjectIdentity, ModuleIdentity, Bits, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "iso", "Gauge32", "Counter32", "Integer32", "Counter64", "NotificationType", "MibIdentifier", "ObjectIdentity", "ModuleIdentity", "Bits", "Unsigned32")
DisplayString, RowStatus, TextualConvention, MacAddress = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "RowStatus", "TextualConvention", "MacAddress")
casaMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 20858, 10))
casa802TapMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 20858, 10, 19))
casa802TapMIB.setRevisions(('2008-11-19 11:11',))
if mibBuilder.loadTexts: casa802TapMIB.setLastUpdated('200811191111Z')
if mibBuilder.loadTexts: casa802TapMIB.setOrganization('Casa Systems, Inc.')
casa802TapMIBNotifs = MibIdentifier((1, 3, 6, 1, 4, 1, 20858, 10, 19, 0))
casa802TapMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 20858, 10, 19, 1))
casa802TapMIBConform = MibIdentifier((1, 3, 6, 1, 4, 1, 20858, 10, 19, 2))
casa802tapStreamEncodePacket = MibIdentifier((1, 3, 6, 1, 4, 1, 20858, 10, 19, 1, 1))
casa802tapStreamCapabilities = MibScalar((1, 3, 6, 1, 4, 1, 20858, 10, 19, 1, 1, 1), Bits().clone(namedValues=NamedValues(("tapEnable", 0), ("interface", 1), ("dstMacAddr", 2), ("srcMacAddr", 3), ("ethernetPid", 4), ("dstLlcSap", 5), ("srcLlcSap", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: casa802tapStreamCapabilities.setStatus('current')
casa802tapStreamTable = MibTable((1, 3, 6, 1, 4, 1, 20858, 10, 19, 1, 1, 2), )
if mibBuilder.loadTexts: casa802tapStreamTable.setStatus('current')
casa802tapStreamEntry = MibTableRow((1, 3, 6, 1, 4, 1, 20858, 10, 19, 1, 1, 2, 1), ).setIndexNames((0, "PKTC-ES-TAP-MIB", "pktcEScTapMediationContentId"), (0, "CASA-802-TAP-MIB", "casa802tapStreamIndex"))
if mibBuilder.loadTexts: casa802tapStreamEntry.setStatus('current')
casa802tapStreamIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 20858, 10, 19, 1, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: casa802tapStreamIndex.setStatus('current')
casa802tapStreamFields = MibTableColumn((1, 3, 6, 1, 4, 1, 20858, 10, 19, 1, 1, 2, 1, 2), Bits().clone(namedValues=NamedValues(("interface", 0), ("dstMacAddress", 1), ("srcMacAddress", 2), ("ethernetPid", 3), ("dstLlcSap", 4), ("srcLlcSap", 5)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: casa802tapStreamFields.setStatus('current')
casa802tapStreamInterface = MibTableColumn((1, 3, 6, 1, 4, 1, 20858, 10, 19, 1, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(-1, -1), ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 2147483647), ))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: casa802tapStreamInterface.setStatus('current')
casa802tapStreamDestinationAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 20858, 10, 19, 1, 1, 2, 1, 4), MacAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: casa802tapStreamDestinationAddress.setStatus('current')
casa802tapStreamSourceAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 20858, 10, 19, 1, 1, 2, 1, 5), MacAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: casa802tapStreamSourceAddress.setStatus('current')
casa802tapStreamEthernetPid = MibTableColumn((1, 3, 6, 1, 4, 1, 20858, 10, 19, 1, 1, 2, 1, 6), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: casa802tapStreamEthernetPid.setStatus('current')
casa802tapStreamDestinationLlcSap = MibTableColumn((1, 3, 6, 1, 4, 1, 20858, 10, 19, 1, 1, 2, 1, 7), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: casa802tapStreamDestinationLlcSap.setStatus('current')
casa802tapStreamSourceLlcSap = MibTableColumn((1, 3, 6, 1, 4, 1, 20858, 10, 19, 1, 1, 2, 1, 8), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: casa802tapStreamSourceLlcSap.setStatus('current')
casa802tapStreamInterceptEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 20858, 10, 19, 1, 1, 2, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("up", 1), ("down", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: casa802tapStreamInterceptEnable.setStatus('current')
casa802tapStreamStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 20858, 10, 19, 1, 1, 2, 1, 10), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: casa802tapStreamStatus.setStatus('current')
casa802TapMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 20858, 10, 19, 2, 1))
casa802TapMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 20858, 10, 19, 2, 2))
casa802TapMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 20858, 10, 19, 2, 1, 1)).setObjects(("CASA-802-TAP-MIB", "casa802TapStreamGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
casa802TapMIBCompliance = casa802TapMIBCompliance.setStatus('current')
casa802TapStreamGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 20858, 10, 19, 2, 2, 1)).setObjects(("CASA-802-TAP-MIB", "casa802tapStreamCapabilities"), ("CASA-802-TAP-MIB", "casa802tapStreamFields"), ("CASA-802-TAP-MIB", "casa802tapStreamInterface"), ("CASA-802-TAP-MIB", "casa802tapStreamDestinationAddress"), ("CASA-802-TAP-MIB", "casa802tapStreamSourceAddress"), ("CASA-802-TAP-MIB", "casa802tapStreamEthernetPid"), ("CASA-802-TAP-MIB", "casa802tapStreamSourceLlcSap"), ("CASA-802-TAP-MIB", "casa802tapStreamDestinationLlcSap"), ("CASA-802-TAP-MIB", "casa802tapStreamStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
casa802TapStreamGroup = casa802TapStreamGroup.setStatus('current')
mibBuilder.exportSymbols("CASA-802-TAP-MIB", casa802TapMIBCompliances=casa802TapMIBCompliances, casa802TapMIBConform=casa802TapMIBConform, casa802tapStreamDestinationLlcSap=casa802tapStreamDestinationLlcSap, casa802TapMIBGroups=casa802TapMIBGroups, casa802TapMIBCompliance=casa802TapMIBCompliance, casa802tapStreamEthernetPid=casa802tapStreamEthernetPid, casa802tapStreamDestinationAddress=casa802tapStreamDestinationAddress, casa802tapStreamTable=casa802tapStreamTable, casa802tapStreamStatus=casa802tapStreamStatus, casa802tapStreamFields=casa802tapStreamFields, casa802TapMIBNotifs=casa802TapMIBNotifs, casa802tapStreamCapabilities=casa802tapStreamCapabilities, casa802tapStreamIndex=casa802tapStreamIndex, casa802TapStreamGroup=casa802TapStreamGroup, casa802tapStreamSourceAddress=casa802tapStreamSourceAddress, casa802tapStreamEncodePacket=casa802tapStreamEncodePacket, casa802tapStreamSourceLlcSap=casa802tapStreamSourceLlcSap, casa802tapStreamInterceptEnable=casa802tapStreamInterceptEnable, casa802tapStreamInterface=casa802tapStreamInterface, casa802TapMIBObjects=casa802TapMIBObjects, PYSNMP_MODULE_ID=casa802TapMIB, casaMgmt=casaMgmt, casa802tapStreamEntry=casa802tapStreamEntry, casa802TapMIB=casa802TapMIB)
| 132.590164 | 1,219 | 0.772502 | 840 | 8,088 | 7.435714 | 0.189286 | 0.007685 | 0.011047 | 0.014729 | 0.287864 | 0.215818 | 0.165706 | 0.165706 | 0.165706 | 0.159142 | 0 | 0.123071 | 0.078759 | 8,088 | 60 | 1,220 | 134.8 | 0.715206 | 0.040307 | 0 | 0.038462 | 0 | 0 | 0.189604 | 0.050303 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.153846 | 0 | 0.153846 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
040aad3e1b1fabb1157ff66f501bd62bb04acacd | 1,546 | py | Python | spider/spider/items.py | wederribas/bigpy-crawler | 58cef9a0dbaf327d7fc18503d30b821b5f9b07f7 | [
"MIT"
] | null | null | null | spider/spider/items.py | wederribas/bigpy-crawler | 58cef9a0dbaf327d7fc18503d30b821b5f9b07f7 | [
"MIT"
] | 4 | 2021-03-31T18:45:45.000Z | 2022-03-02T14:55:24.000Z | spider/spider/items.py | wederribas/bigpy-customer-reports-spider | 58cef9a0dbaf327d7fc18503d30b821b5f9b07f7 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import scrapy
from datetime import datetime
from scrapy.loader.processors import MapCompose
def strip_string(value):
"""Remove all blank spaces from the ends of a given value."""
return value.strip()
def parse_date(date):
"""Parse date string to date epoch in millisecons."""
date_obj = datetime.strptime(date, "%d/%m/%Y")
return date_obj.timestamp() * 1000
def parse_to_int(string):
"""Remove all non-digit chars from string and parse it to integer."""
parsed_string = list(filter(lambda x: x.isdigit(), string))
return int(parsed_string[0])
class Report(scrapy.Item):
"""Instantiate the customer reports items fields, with its processors.
Each field is an instance of scrapy.Field. Some fields will receive a
input processor in order to peform parsing operations over this field
before loading them into the item.
"""
company_name = scrapy.Field(input_processor=MapCompose(strip_string))
user_report = scrapy.Field(input_processor=MapCompose(strip_string))
company_response = scrapy.Field(input_processor=MapCompose(strip_string))
status = scrapy.Field(input_processor=MapCompose(strip_string))
user_feedback = scrapy.Field(input_processor=MapCompose(strip_string))
user_rating = scrapy.Field(input_processor=MapCompose(parse_to_int))
date = scrapy.Field(input_processor=MapCompose(parse_date))
city = scrapy.Field(input_processor=MapCompose(strip_string))
state = scrapy.Field(input_processor=MapCompose(strip_string))
| 35.953488 | 77 | 0.747736 | 210 | 1,546 | 5.352381 | 0.428571 | 0.097865 | 0.128114 | 0.200178 | 0.368327 | 0.368327 | 0.297153 | 0.133452 | 0 | 0 | 0 | 0.004584 | 0.153299 | 1,546 | 42 | 78 | 36.809524 | 0.854087 | 0.280724 | 0 | 0 | 0 | 0 | 0.007456 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.904762 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
040f0b876ae1cb3a01927bee53d743f28cbe1fc9 | 6,622 | py | Python | dbReports/iondb/rundb/plan/page_plan/abstract_step_data.py | sequencer2014/TS | 465804570349d46b47c1bdf131bdafea5c582dee | [
"Apache-2.0"
] | null | null | null | dbReports/iondb/rundb/plan/page_plan/abstract_step_data.py | sequencer2014/TS | 465804570349d46b47c1bdf131bdafea5c582dee | [
"Apache-2.0"
] | null | null | null | dbReports/iondb/rundb/plan/page_plan/abstract_step_data.py | sequencer2014/TS | 465804570349d46b47c1bdf131bdafea5c582dee | [
"Apache-2.0"
] | null | null | null | # Copyright (C) 2013 Ion Torrent Systems, Inc. All Rights Reserved
'''
Created on May 21, 2013
@author: ionadmin
'''
import logging
logger = logging.getLogger(__name__)
class AbstractStepData(object):
'''
Superclass for stepdata classes. SavedFields are fields that users set values for,
PrepopulatedFields are fields that the step page shows to the user.
'''
def __init__(self, sh_type):
self.resourcePath = None
self.prev_step_url = '#'
self.next_step_url = '#'
self.savedFields = {}
self.savedListFieldNames = []
self.savedObjects = {}
self.prepopulatedFields = {}
self.validationErrors = {}
self._dependsOn = []
self._changedFields = {}
self.warnings = []
# some section can appear in multiple chevrons, key is the step name and value is the step_data object
self.step_sections = {}
self.sh_type = sh_type
def getCurrentSavedFieldDict(self):
return self.savedFields
def getCurrentSavedObjectDict(self):
return self.savedObjects
def getSectionSavedFieldDict(self, sectionName):
"""
Sections are optional for a step. Return the savedFields dictionary of the section if it exists.
Otherwise, return an empty dictionary
"""
default_value = {}
if not self.step_sections:
return default_value
if sectionName in self.step_sections.keys():
sectionObj = self.step_sections[sectionName]
if sectionObj:
# logger.debug("abstract_step_data.getSectionSavedFieldDict() sectionObj.savedFields=%s" %(sectionObj.savedFields))
return sectionObj.savedFields
else:
return default_value
return default_value
def hasStepSections(self):
"""
Sections are optional for a step. Assume no section by default.
"""
if self.step_sections:
return True
return False
def getDefaultSection(self):
"""
Sections are optional for a step. Let subclass override this.
TODO: add more section support
"""
return None
def getDefaultSectionSavedFieldDict(self):
"""
Sections are optional for a step. Let subclass override this.
TODO: add more section support
"""
return {}
def getDefaultSectionPrepopulatedFieldDict(self):
"""
Sections are optional for a step. Let subclass override this.
TODO: add more section support
"""
return {}
def updateSavedFieldValuesFromRequest(self, request):
changed = False
for key in self.savedFields.keys():
if self.updateSavedFieldValueFromRequest(request, key):
changed = True
for sectionKey, sectionObj in self.step_sections.items():
if sectionObj:
for key in sectionObj.getCurrentSavedFieldDict().keys():
if sectionObj.updateSavedFieldValueFromRequest(request, key):
changed = True
if changed:
self.warnings = []
self.validate()
return changed
def validate(self):
for key in self.savedFields.keys():
self.validateField(key, self.savedFields[key])
for sectionKey, sectionObj in self.step_sections.items():
if sectionObj:
# logger.debug("abstract_step_data.validate() sectionKey=%s" %(sectionKey))
for key in sectionObj.getCurrentSavedFieldDict().keys():
self.validationErrors.pop(key, None)
sectionObj.validateField_in_section(key, sectionObj.savedFields[key])
# if sectionObj.validationErrors:
if (len(sectionObj.validationErrors) > 0):
logger.debug("after validateField_in_section sectionObj.validationErrors=%s" % (sectionObj.validationErrors))
self.validationErrors.update(sectionObj.validationErrors)
self.validateField_crossField_dependencies(self.savedFields.keys(), self.savedFields)
self.validateStep()
def updateSavedFieldValueFromRequest(self, request, saved_field_name):
retval = False
if request.POST.has_key(saved_field_name):
if saved_field_name in self.savedListFieldNames:
new_value = request.POST.getlist(saved_field_name)
else:
new_value = request.POST.get(saved_field_name, None)
if new_value != self.savedFields[saved_field_name] and str(new_value) != str(self.savedFields[saved_field_name]):
self.updateChangedFields(saved_field_name, self.savedFields[saved_field_name], new_value)
self.savedFields[saved_field_name] = new_value
retval = True
elif self.savedFields[saved_field_name]:
self.savedFields[saved_field_name] = None
retval = True
return retval
def updateChangedFields(self, key, old_value, new_value):
if key in self._changedFields:
self._changedFields[key][1] = new_value
else:
self._changedFields[key] = [old_value, new_value]
def validateStep(self):
'''
default overall validation does nothing
'''
return
def validateField(self, field_name, new_field_value):
'''
default field validation does nothing.
'''
return
def validateField_crossField_dependencies(self, fieldNames, fieldValues):
'''
default overall cross field validations does nothing
'''
return
def validateField_in_section(self, field_name, new_field_value):
"""
field validation for a step that acts as a section to another step
"""
return
def updateSavedObjectsFromSavedFields(self):
raise NotImplementedError('you must use a subclass to invoke this method')
def getStepName(self):
raise NotImplementedError('you must use a subclass to invoke this method')
def updateFromStep(self, step_depended_on):
raise NotImplementedError('you must use a subclass to invoke this method')
def alternateUpdateFromStep(self, step_depended_on):
"""
update a step or section with alternate logic based on the step it is depending on
"""
return
def getPrePopulatedFieldDict(self):
return self.prepopulatedFields
def hasErrors(self):
return len(self.validationErrors) > 0
| 34.310881 | 131 | 0.636062 | 676 | 6,622 | 6.094675 | 0.252959 | 0.030583 | 0.040777 | 0.036408 | 0.334466 | 0.291505 | 0.204369 | 0.160922 | 0.140049 | 0.140049 | 0 | 0.002758 | 0.288281 | 6,622 | 192 | 132 | 34.489583 | 0.871419 | 0.20296 | 0 | 0.284404 | 0 | 0 | 0.039719 | 0.010833 | 0 | 0 | 0 | 0.015625 | 0 | 1 | 0.201835 | false | 0 | 0.009174 | 0.036697 | 0.40367 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
042163d96ee3d5b597928d361d18e400952f8df9 | 973 | py | Python | donationdb/donations/migrations/0022_auto_20211028_1553.py | emilkauppi/vision.tf.fi | f0d668c6af38bac5575b87d27a1db4ff9864b7de | [
"MIT"
] | null | null | null | donationdb/donations/migrations/0022_auto_20211028_1553.py | emilkauppi/vision.tf.fi | f0d668c6af38bac5575b87d27a1db4ff9864b7de | [
"MIT"
] | null | null | null | donationdb/donations/migrations/0022_auto_20211028_1553.py | emilkauppi/vision.tf.fi | f0d668c6af38bac5575b87d27a1db4ff9864b7de | [
"MIT"
] | null | null | null | # Generated by Django 3.1.7 on 2021-10-28 15:53
from django.db import migrations
def extract_organization(apps, schema_editor):
Organization = apps.get_model("donations", "Organization")
Donation = apps.get_model("donations", "Donation")
for donation in Donation.objects.exclude(organization_name__exact=""):
organization = Organization(
name = donation.organization_name,
fo_number = donation.organization_fo_number,
address = donation.organization_address,
zip_code = donation.organization_zip_code,
city = donation.organization_city,
country = donation.organization_country
)
organization.save()
donation.organization = organization
donation.save()
class Migration(migrations.Migration):
dependencies = [
('donations', '0021_auto_20211028_1553'),
]
operations = [
migrations.RunPython(extract_organization)
]
| 32.433333 | 74 | 0.677287 | 96 | 973 | 6.645833 | 0.510417 | 0.219436 | 0.037618 | 0.065831 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041611 | 0.234327 | 973 | 29 | 75 | 33.551724 | 0.814765 | 0.046249 | 0 | 0 | 1 | 0 | 0.075594 | 0.024838 | 0 | 0 | 0 | 0 | 0 | 1 | 0.043478 | false | 0 | 0.043478 | 0 | 0.217391 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
04267895e6fb079a2e32b1a41a8bf0350478f0e1 | 17,052 | py | Python | pysnmp-with-texts/MY-VLAN-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 8 | 2019-05-09T17:04:00.000Z | 2021-06-09T06:50:51.000Z | pysnmp-with-texts/MY-VLAN-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 4 | 2019-05-31T16:42:59.000Z | 2020-01-31T21:57:17.000Z | pysnmp-with-texts/MY-VLAN-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module MY-VLAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MY-VLAN-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:16:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection")
myMgmt, = mibBuilder.importSymbols("MY-SMI", "myMgmt")
ConfigStatus, IfIndex, MemberMap = mibBuilder.importSymbols("MY-TC", "ConfigStatus", "IfIndex", "MemberMap")
EnabledStatus, = mibBuilder.importSymbols("P-BRIDGE-MIB", "EnabledStatus")
VlanId, PortList = mibBuilder.importSymbols("Q-BRIDGE-MIB", "VlanId", "PortList")
NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance")
ModuleIdentity, Gauge32, Counter64, NotificationType, Integer32, MibIdentifier, iso, Counter32, Bits, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, Unsigned32, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "Gauge32", "Counter64", "NotificationType", "Integer32", "MibIdentifier", "iso", "Counter32", "Bits", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "Unsigned32", "IpAddress")
RowStatus, DisplayString, MacAddress, TruthValue, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "DisplayString", "MacAddress", "TruthValue", "TextualConvention")
myVlanMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9))
myVlanMIB.setRevisions(('2002-03-20 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: myVlanMIB.setRevisionsDescriptions(('Initial version of this MIB module.',))
if mibBuilder.loadTexts: myVlanMIB.setLastUpdated('200203200000Z')
if mibBuilder.loadTexts: myVlanMIB.setOrganization('D-Link Crop.')
if mibBuilder.loadTexts: myVlanMIB.setContactInfo(' http://support.dlink.com')
if mibBuilder.loadTexts: myVlanMIB.setDescription('This module defines my vlan mibs.')
myVlanMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1))
class VlanList(TextualConvention, OctetString):
description = "Each octet within this value specifies a set of eight vlans, with the first octet specifying vlans 1 through 8, the second octet specifying vlans 9 through 16, etc. Within each octet, the most significant bit represents the lowest numbered vlan, and the least significant bit represents the highest numbered vlan. Thus, each vlan of the bridge is represented by a single bit within the value of this object. If that bit has a value of '1', then that vlan is included in the set of vlans; the vlan is not included if its bit has a value of '0'."
status = 'current'
myVlanMaxNumber = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: myVlanMaxNumber.setStatus('current')
if mibBuilder.loadTexts: myVlanMaxNumber.setDescription('Number of MAX vlans this system supported.')
myVlanCurrentNumber = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: myVlanCurrentNumber.setStatus('current')
if mibBuilder.loadTexts: myVlanCurrentNumber.setDescription('Number of current vlans this system have.')
mySystemMaxVID = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mySystemMaxVID.setStatus('current')
if mibBuilder.loadTexts: mySystemMaxVID.setDescription('Max vlans of VID this system supported.')
myVlanIfConfigTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 4), )
if mibBuilder.loadTexts: myVlanIfConfigTable.setStatus('obsolete')
if mibBuilder.loadTexts: myVlanIfConfigTable.setDescription('vlan table.')
myVlanIfConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 4, 1), ).setIndexNames((0, "MY-VLAN-MIB", "myVlanIfConfigIfIndex"))
if mibBuilder.loadTexts: myVlanIfConfigEntry.setStatus('obsolete')
if mibBuilder.loadTexts: myVlanIfConfigEntry.setDescription("list of vlan and it's port group table.")
myVlanIfConfigIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 4, 1, 1), IfIndex())
if mibBuilder.loadTexts: myVlanIfConfigIfIndex.setStatus('obsolete')
if mibBuilder.loadTexts: myVlanIfConfigIfIndex.setDescription(' ')
myVlanIfAccessVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 4, 1, 2), VlanId()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: myVlanIfAccessVlan.setStatus('obsolete')
if mibBuilder.loadTexts: myVlanIfAccessVlan.setDescription('The value indicate the VID of the vlan which that this port belong to. This field is effective for only access port.')
myVlanIfNativeVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 4, 1, 3), VlanId()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: myVlanIfNativeVlan.setStatus('obsolete')
if mibBuilder.loadTexts: myVlanIfNativeVlan.setDescription('The value indicate the VID of the native vlan of that this port . This field is effective for only trunk port.')
myVlanIfAllowedVlanList = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 4, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(512, 512)).setFixedLength(512)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: myVlanIfAllowedVlanList.setStatus('obsolete')
if mibBuilder.loadTexts: myVlanIfAllowedVlanList.setDescription('Each bit in every octet in octet string assigned to a vlan, the value of the bit indicates that if the vlan is belong to allowed vlan list of this interface. It indicates that assigned vlan is member of allowed vlan list of this interface if value of the bit is 1. The lowest bit of first byte correspond to vlan 1 and the lowest bit of second byte correspond to vlan 9 vlan. This field is effective for only trunk port.')
myVlanTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 5), )
if mibBuilder.loadTexts: myVlanTable.setStatus('obsolete')
if mibBuilder.loadTexts: myVlanTable.setDescription('vlan table.')
myVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 5, 1), ).setIndexNames((0, "MY-VLAN-MIB", "myVlanVID"))
if mibBuilder.loadTexts: myVlanEntry.setStatus('obsolete')
if mibBuilder.loadTexts: myVlanEntry.setDescription("list of vlan and it's distribution table.")
myVlanVID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 5, 1, 1), VlanId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: myVlanVID.setStatus('obsolete')
if mibBuilder.loadTexts: myVlanVID.setDescription('VID of vlan .')
myVlanPortMemberAction = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 5, 1, 2), MemberMap()).setMaxAccess("readonly")
if mibBuilder.loadTexts: myVlanPortMemberAction.setStatus('obsolete')
if mibBuilder.loadTexts: myVlanPortMemberAction.setDescription("Each octet in member map assigned to a physical port, the value of the octect indicates the action of a physical port in the vlan. Drop(1) indicate that the vlan doesn't include this physical port, Add(2) indicate that the vlan include this physical port.")
myVlanApMemberAction = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 5, 1, 3), MemberMap()).setMaxAccess("readonly")
if mibBuilder.loadTexts: myVlanApMemberAction.setStatus('obsolete')
if mibBuilder.loadTexts: myVlanApMemberAction.setDescription("Each octet in member map assigned to a aggreate port, the value of the octect indicates the action of a aggreate port in the vlan. Drop(1) indicate that the vlan doesn't include this physical port, Add(2) indicate that the vlan include this physical port.")
myVlanAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 5, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: myVlanAlias.setStatus('obsolete')
if mibBuilder.loadTexts: myVlanAlias.setDescription("Vlan's alias .")
myVlanEntryStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 5, 1, 5), ConfigStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: myVlanEntryStatus.setStatus('obsolete')
if mibBuilder.loadTexts: myVlanEntryStatus.setDescription('Status of this entry, set this object to valid will creat a vlan of this entry, and set its value to invalid will delete the vlan of this entry.')
myVlanPortConfigTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 6), )
if mibBuilder.loadTexts: myVlanPortConfigTable.setStatus('current')
if mibBuilder.loadTexts: myVlanPortConfigTable.setDescription('The table of VLAN members.')
myVlanPortConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 6, 1), ).setIndexNames((0, "MY-VLAN-MIB", "myVlanPortConfigIndex"))
if mibBuilder.loadTexts: myVlanPortConfigEntry.setStatus('current')
if mibBuilder.loadTexts: myVlanPortConfigEntry.setDescription('list of ports.')
myVlanPortConfigIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 6, 1, 1), IfIndex())
if mibBuilder.loadTexts: myVlanPortConfigIndex.setStatus('current')
if mibBuilder.loadTexts: myVlanPortConfigIndex.setDescription('port index')
myVlanPortConfigMode = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 6, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("access", 1), ("trunk", 2), ("dot1q-tunnel", 3), ("hybrid", 4), ("other", 5), ("uplink", 6), ("host", 7), ("promiscuous", 8)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: myVlanPortConfigMode.setStatus('current')
if mibBuilder.loadTexts: myVlanPortConfigMode.setDescription('Port mode, indicates that port is an access(1), trunk(2), dot1q-tunnel(3), hybrid(4), other(5), uplink(6), host(7) or promiscuous(8) port.')
myVlanPortAccessVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 6, 1, 3), VlanId()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: myVlanPortAccessVlan.setStatus('current')
if mibBuilder.loadTexts: myVlanPortAccessVlan.setDescription('The value indicate the VID of the vlan which that this port belong to. This field is effective for only access port.')
myVlanPortNativeVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 6, 1, 4), VlanId()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: myVlanPortNativeVlan.setStatus('current')
if mibBuilder.loadTexts: myVlanPortNativeVlan.setDescription('The value indicate the VID of the native vlan of that this port . This field is effective for only trunk,hybrid,uplink and dot1q_tunnel port.')
myVlanPortAllowedVlanList = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 6, 1, 5), VlanList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: myVlanPortAllowedVlanList.setStatus('current')
if mibBuilder.loadTexts: myVlanPortAllowedVlanList.setDescription("Each octet within this value specifies a set of eight vlans, with the first octet specifying vlans 0 through 7, the second octet specifying vlans 8 through 15, etc. Within each octet, the most significant bit represents the lowest numbered vlan, and the least significant bit represents the highest numbered vlan. Thus, each vlan of the bridge is represented by a single bit within the value of this object. If that bit has a value of '1', then that vlan is included in the set of vlans; the vlan is not included if its bit has a value of '0'")
myVlanConfigTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 7), )
if mibBuilder.loadTexts: myVlanConfigTable.setStatus('current')
if mibBuilder.loadTexts: myVlanConfigTable.setDescription('vlan table.')
myVlanConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 7, 1), ).setIndexNames((0, "MY-VLAN-MIB", "myVlanConfigVID"))
if mibBuilder.loadTexts: myVlanConfigEntry.setStatus('current')
if mibBuilder.loadTexts: myVlanConfigEntry.setDescription("list of vlan and it's distribution table.")
myVlanConfigVID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 7, 1, 1), VlanId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: myVlanConfigVID.setStatus('current')
if mibBuilder.loadTexts: myVlanConfigVID.setDescription('VID of vlan .')
myVlanConfigAction = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 7, 1, 2), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: myVlanConfigAction.setStatus('current')
if mibBuilder.loadTexts: myVlanConfigAction.setDescription('The value 1 to create a vlan, 0 to delete a vlan.')
myVlanConfigName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 7, 1, 3), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: myVlanConfigName.setStatus('current')
if mibBuilder.loadTexts: myVlanConfigName.setDescription('vlan name.')
myVlanConfigPortMember = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 1, 7, 1, 4), PortList()).setMaxAccess("readonly")
if mibBuilder.loadTexts: myVlanConfigPortMember.setStatus('current')
if mibBuilder.loadTexts: myVlanConfigPortMember.setDescription("Each octet within this value specifies a set of eight ports, with the first octet specifying ports 1 through 8, the second octet specifying ports 9 through 16, etc. Within each octet, the most significant bit represents the lowest numbered port, and the least significant bit represents the highest numbered port. Thus, each port of the bridge is represented by a single bit within the value of this object. If that bit has a value of '1', then that port is included in the set of ports; the port is not included if its bit has a value of '0'.")
myVlanMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 2))
myVlanMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 2, 1))
myVlanMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 2, 2))
myVlanMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 2, 1, 1)).setObjects(("MY-VLAN-MIB", "myVlanMIBGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
myVlanMIBCompliance = myVlanMIBCompliance.setStatus('current')
if mibBuilder.loadTexts: myVlanMIBCompliance.setDescription('The compliance statement for entities which implement the My Vlan MIB')
myVlanMIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 171, 10, 97, 2, 9, 2, 2, 1)).setObjects(("MY-VLAN-MIB", "myVlanMaxNumber"), ("MY-VLAN-MIB", "myVlanCurrentNumber"), ("MY-VLAN-MIB", "mySystemMaxVID"), ("MY-VLAN-MIB", "myVlanIfAccessVlan"), ("MY-VLAN-MIB", "myVlanIfNativeVlan"), ("MY-VLAN-MIB", "myVlanIfAllowedVlanList"), ("MY-VLAN-MIB", "myVlanVID"), ("MY-VLAN-MIB", "myVlanApMemberAction"), ("MY-VLAN-MIB", "myVlanPortMemberAction"), ("MY-VLAN-MIB", "myVlanAlias"), ("MY-VLAN-MIB", "myVlanEntryStatus"), ("MY-VLAN-MIB", "myVlanPortConfigMode"), ("MY-VLAN-MIB", "myVlanPortAccessVlan"), ("MY-VLAN-MIB", "myVlanPortNativeVlan"), ("MY-VLAN-MIB", "myVlanPortAllowedVlanList"), ("MY-VLAN-MIB", "myVlanConfigVID"), ("MY-VLAN-MIB", "myVlanConfigAction"), ("MY-VLAN-MIB", "myVlanConfigName"), ("MY-VLAN-MIB", "myVlanConfigPortMember"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
myVlanMIBGroup = myVlanMIBGroup.setStatus('current')
if mibBuilder.loadTexts: myVlanMIBGroup.setDescription('A collection of objects providing vlan configure .')
mibBuilder.exportSymbols("MY-VLAN-MIB", mySystemMaxVID=mySystemMaxVID, myVlanIfAllowedVlanList=myVlanIfAllowedVlanList, myVlanIfAccessVlan=myVlanIfAccessVlan, myVlanVID=myVlanVID, VlanList=VlanList, myVlanConfigTable=myVlanConfigTable, myVlanPortNativeVlan=myVlanPortNativeVlan, myVlanMIBGroup=myVlanMIBGroup, myVlanMaxNumber=myVlanMaxNumber, myVlanTable=myVlanTable, myVlanPortConfigTable=myVlanPortConfigTable, myVlanPortConfigIndex=myVlanPortConfigIndex, myVlanCurrentNumber=myVlanCurrentNumber, myVlanConfigName=myVlanConfigName, myVlanEntry=myVlanEntry, myVlanAlias=myVlanAlias, myVlanPortMemberAction=myVlanPortMemberAction, myVlanApMemberAction=myVlanApMemberAction, myVlanConfigPortMember=myVlanConfigPortMember, myVlanMIBConformance=myVlanMIBConformance, myVlanConfigAction=myVlanConfigAction, myVlanIfNativeVlan=myVlanIfNativeVlan, myVlanMIBObjects=myVlanMIBObjects, myVlanMIBCompliances=myVlanMIBCompliances, myVlanPortConfigMode=myVlanPortConfigMode, myVlanConfigEntry=myVlanConfigEntry, myVlanConfigVID=myVlanConfigVID, PYSNMP_MODULE_ID=myVlanMIB, myVlanIfConfigTable=myVlanIfConfigTable, myVlanPortAllowedVlanList=myVlanPortAllowedVlanList, myVlanMIBGroups=myVlanMIBGroups, myVlanIfConfigIfIndex=myVlanIfConfigIfIndex, myVlanMIBCompliance=myVlanMIBCompliance, myVlanEntryStatus=myVlanEntryStatus, myVlanIfConfigEntry=myVlanIfConfigEntry, myVlanPortAccessVlan=myVlanPortAccessVlan, myVlanMIB=myVlanMIB, myVlanPortConfigEntry=myVlanPortConfigEntry)
| 129.181818 | 1,460 | 0.764661 | 2,209 | 17,052 | 5.901313 | 0.13445 | 0.059834 | 0.10471 | 0.011046 | 0.486346 | 0.342973 | 0.298788 | 0.291424 | 0.273473 | 0.255293 | 0 | 0.05534 | 0.106674 | 17,052 | 131 | 1,461 | 130.167939 | 0.800433 | 0.018532 | 0 | 0.024793 | 0 | 0.099174 | 0.343815 | 0.010641 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.082645 | 0 | 0.107438 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
043d1dd2bf6406cffae0cf0234540b61205ed49d | 736 | py | Python | setup.py | SagiMedina/mq-http-python-sdk | 35a2bef791abb8bb57f9ae2ad1083f1de62a7bb0 | [
"MIT"
] | 26 | 2019-01-31T02:15:01.000Z | 2021-11-08T14:47:10.000Z | setup.py | SagiMedina/mq-http-python-sdk | 35a2bef791abb8bb57f9ae2ad1083f1de62a7bb0 | [
"MIT"
] | 11 | 2019-04-16T03:13:13.000Z | 2022-02-16T08:51:08.000Z | setup.py | SagiMedina/mq-http-python-sdk | 35a2bef791abb8bb57f9ae2ad1083f1de62a7bb0 | [
"MIT"
] | 14 | 2019-02-01T09:06:25.000Z | 2022-02-13T11:32:32.000Z | #!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import sys
import mq_http_sdk.pkg_info
if sys.version_info <= (2, 5):
sys.stderr.write("ERROR: mq python sdk requires Python Version 2.5 or above.\n")
sys.stderr.write("Your Python version is %s.%s.%s.\n" % sys.version_info[:3])
sys.exit(1)
setup(name=mq_http_sdk.pkg_info.name,
version=mq_http_sdk.pkg_info.version,
author="aliyunmq",
author_email="",
url=mq_http_sdk.pkg_info.url,
packages=["mq_http_sdk"],
license=mq_http_sdk.pkg_info.license,
description=mq_http_sdk.pkg_info.short_description,
long_description=mq_http_sdk.pkg_info.long_description)
| 29.44 | 84 | 0.71875 | 117 | 736 | 4.273504 | 0.393162 | 0.096 | 0.144 | 0.168 | 0.268 | 0.108 | 0 | 0 | 0 | 0 | 0 | 0.009756 | 0.164402 | 736 | 24 | 85 | 30.666667 | 0.803252 | 0.027174 | 0 | 0 | 0 | 0 | 0.158042 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.263158 | 0 | 0.263158 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
0441becadaf39ab4e79fc15826f567eb0756f6dd | 288 | py | Python | main.py | jefflaird/pywrat | 8c4d65b49b6744d7dd0f76d024dfa2403116e980 | [
"Apache-2.0"
] | 1 | 2017-11-28T18:01:45.000Z | 2017-11-28T18:01:45.000Z | main.py | jefflaird/pywrat | 8c4d65b49b6744d7dd0f76d024dfa2403116e980 | [
"Apache-2.0"
] | null | null | null | main.py | jefflaird/pywrat | 8c4d65b49b6744d7dd0f76d024dfa2403116e980 | [
"Apache-2.0"
] | 2 | 2018-08-09T20:49:21.000Z | 2019-11-26T22:58:37.000Z | import numpy as np
import matplotlib.pyplot as plt
from pywrat import pywrat
import pandas as pd
#testing bufferflows
for year in range(1922,2003):
for month in range(1,13):
# print('Now Running %d-%d' % (year,month)) # now in pywrat.py
pywrat(month,year)
# pywrat(1, 1977) | 20.571429 | 66 | 0.704861 | 48 | 288 | 4.229167 | 0.583333 | 0.118227 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068376 | 0.1875 | 288 | 14 | 67 | 20.571429 | 0.799145 | 0.34375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.571429 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
0449359ae76132ef8b8771e2453c72506be01200 | 106 | py | Python | src/settings_prod.py | vollov/flask-angularjs | d9fc044e71d7459885af0bda984b59a6406b055d | [
"MIT"
] | null | null | null | src/settings_prod.py | vollov/flask-angularjs | d9fc044e71d7459885af0bda984b59a6406b055d | [
"MIT"
] | null | null | null | src/settings_prod.py | vollov/flask-angularjs | d9fc044e71d7459885af0bda984b59a6406b055d | [
"MIT"
] | null | null | null | from settings import *
DEBUG = False
UNIX = True
DATABASE_URL = 'mysql://root:justdoit@localhost/flaskr'
| 17.666667 | 55 | 0.754717 | 14 | 106 | 5.642857 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.132075 | 106 | 5 | 56 | 21.2 | 0.858696 | 0 | 0 | 0 | 0 | 0 | 0.358491 | 0.358491 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
045256ab735da70ca416e312e158b6b95e2e8598 | 223 | py | Python | view/list_to_do.py | bocchini/py_todo | 1b8c8fe3dc7905efd7b1b9c5b71de5b74cd5a2a2 | [
"MIT"
] | null | null | null | view/list_to_do.py | bocchini/py_todo | 1b8c8fe3dc7905efd7b1b9c5b71de5b74cd5a2a2 | [
"MIT"
] | null | null | null | view/list_to_do.py | bocchini/py_todo | 1b8c8fe3dc7905efd7b1b9c5b71de5b74cd5a2a2 | [
"MIT"
] | null | null | null | from controllers.to_do_controller import get_all
def get_all_to_do_list():
print('*' * 30, '-' * 4, ' Lista de tarefas ', '-' * 4, '*' * 30)
print(get_all())
input('Digite qualquer tacla para voltar ao menu')
| 27.875 | 69 | 0.636771 | 33 | 223 | 4.060606 | 0.727273 | 0.134328 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033708 | 0.201794 | 223 | 7 | 70 | 31.857143 | 0.719101 | 0 | 0 | 0 | 0 | 0 | 0.282511 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | true | 0 | 0.2 | 0 | 0.4 | 0.4 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f088a59edc1ce45e034ea53cf477d73eb4d8971c | 9,275 | py | Python | test/integration/verify_benchmarks.py | KnowEnG-Research/Feature_Prioritization_Pipeline | 6185dfb70c8941e0526026a063a2caf4f0a071d4 | [
"MIT"
] | null | null | null | test/integration/verify_benchmarks.py | KnowEnG-Research/Feature_Prioritization_Pipeline | 6185dfb70c8941e0526026a063a2caf4f0a071d4 | [
"MIT"
] | 1 | 2019-01-24T14:47:59.000Z | 2019-01-24T18:00:24.000Z | test/integration/verify_benchmarks.py | KnowEnG-Research/Feature_Prioritization_Pipeline | 6185dfb70c8941e0526026a063a2caf4f0a071d4 | [
"MIT"
] | 3 | 2017-12-13T17:06:38.000Z | 2019-01-23T18:30:36.000Z | """
sobh@illinois.edu
"""
import os
import filecmp
verification_dir = '../data/verification'
results_dir = '../test/run_dir/results'
def verify_benchmark(BENCHMARK_name_list, BENCHMARK_YML) :
run_command = 'python3 ../src/feature_prioritization.py -run_directory ./run_dir -run_file ' + BENCHMARK_YML
os.system(run_command)
All_files_in_results_dir = os.listdir(results_dir)
for f in All_files_in_results_dir:
for BENCHMARK_name in BENCHMARK_name_list:
if BENCHMARK_name in f :
RESULT = os.path.join(results_dir, f )
BENCHMARK = os.path.join(verification_dir, BENCHMARK_YML[:-4], BENCHMARK_name+'.tsv')
if filecmp.cmp(RESULT, BENCHMARK) == True:
print(BENCHMARK, 'PASS' )
else:
print(BENCHMARK, 'FAIL' )
def main():
BENCHMARK = {'pearson' : [
'BENCHMARK_1_FP_pearson.yml'
, '17-AAG_correlation_pearson'
, 'AEW541_correlation_pearson'
, 'AZD0530_correlation_pearson'
, 'AZD6244_correlation_pearson'
, 'Erlotinib_correlation_pearson'
, 'Irinotecan_correlation_pearson'
, 'L-685458_correlation_pearson'
, 'LBW242_correlation_pearson'
, 'Lapatinib_correlation_pearson'
, 'Nilotinib_correlation_pearson'
, 'Nutlin-3_correlation_pearson'
, 'PD-0325901_correlation_pearson'
, 'PD-0332991_correlation_pearson'
, 'PF2341066_correlation_pearson'
, 'PHA-665752_correlation_pearson'
, 'PLX4720_correlation_pearson'
, 'Paclitaxel_correlation_pearson'
, 'Panobinostat_correlation_pearson'
, 'RAF265_correlation_pearson'
, 'Sorafenib_correlation_pearson'
, 'TAE684_correlation_pearson'
, 'TKI258_correlation_pearson'
, 'Topotecan_correlation_pearson'
, 'ZD-6474_correlation_pearson'
, 'ranked_features_per_phenotype_correlation_pearson'
, 'top_features_per_phenotype_correlation_pearson'
]
,'bootstrap_pearson' : [
'BENCHMARK_2_FP_bootstrap_pearson.yml'
, '17-AAG_bootstrap_correlation_pearson'
, 'AEW541_bootstrap_correlation_pearson'
, 'AZD0530_bootstrap_correlation_pearson'
, 'AZD6244_bootstrap_correlation_pearson'
, 'Erlotinib_bootstrap_correlation_pearson'
, 'Irinotecan_bootstrap_correlation_pearson'
, 'L-685458_bootstrap_correlation_pearson'
, 'LBW242_bootstrap_correlation_pearson'
, 'Lapatinib_bootstrap_correlation_pearson'
, 'Nilotinib_bootstrap_correlation_pearson'
, 'Nutlin-3_bootstrap_correlation_pearson'
, 'PD-0325901_bootstrap_correlation_pearson'
, 'PD-0332991_bootstrap_correlation_pearson'
, 'PF2341066_bootstrap_correlation_pearson'
, 'PHA-665752_bootstrap_correlation_pearson'
, 'PLX4720_bootstrap_correlation_pearson'
, 'Paclitaxel_bootstrap_correlation_pearson'
, 'Panobinostat_bootstrap_correlation_pearson'
, 'RAF265_bootstrap_correlation_pearson'
, 'Sorafenib_bootstrap_correlation_pearson'
, 'TAE684_bootstrap_correlation_pearson'
, 'TKI258_bootstrap_correlation_pearson'
, 'Topotecan_bootstrap_correlation_pearson'
, 'ZD-6474_bootstrap_correlation_pearson'
, 'ranked_features_per_phenotype_bootstrap_correlation_pearson'
, 'top_features_per_phenotype_bootstrap_correlation_pearson'
]
,'t_test': [
'BENCHMARK_3_FP_t_test.yml'
, '17-AAG_correlation_t_test'
, 'AEW541_correlation_t_test'
, 'AZD0530_correlation_t_test'
, 'AZD6244_correlation_t_test'
, 'Erlotinib_correlation_t_test'
, 'Irinotecan_correlation_t_test'
, 'L-685458_correlation_t_test'
, 'LBW242_correlation_t_test'
, 'Lapatinib_correlation_t_test'
, 'Nilotinib_correlation_t_test'
, 'Nutlin-3_correlation_t_test'
, 'PD-0325901_correlation_t_test'
, 'PD-0332991_correlation_t_test'
, 'PF2341066_correlation_t_test'
, 'PHA-665752_correlation_t_test'
, 'PLX4720_correlation_t_test'
, 'Paclitaxel_correlation_t_test'
, 'Panobinostat_correlation_t_test'
, 'RAF265_correlation_t_test'
, 'Sorafenib_correlation_t_test'
, 'TAE684_correlation_t_test'
, 'TKI258_correlation_t_test'
, 'Topotecan_correlation_t_test'
, 'ZD-6474_correlation_t_test'
, 'ranked_features_per_phenotype_correlation_t_test'
, 'top_features_per_phenotype_correlation_t_test'
]
,'bootstra_t_test': [
'BENCHMARK_4_FP_bootstrap_t_test.yml'
, '17-AAG_bootstrap_correlation_t_test'
, 'AEW541_bootstrap_correlation_t_test'
, 'AZD0530_bootstrap_correlation_t_test'
, 'AZD6244_bootstrap_correlation_t_test'
, 'Erlotinib_bootstrap_correlation_t_test'
, 'Irinotecan_bootstrap_correlation_t_test'
, 'L-685458_bootstrap_correlation_t_test'
, 'LBW242_bootstrap_correlation_t_test'
, 'Lapatinib_bootstrap_correlation_t_test'
, 'Nilotinib_bootstrap_correlation_t_test'
, 'Nutlin-3_bootstrap_correlation_t_test'
, 'PD-0325901_bootstrap_correlation_t_test'
, 'PD-0332991_bootstrap_correlation_t_test'
, 'PF2341066_bootstrap_correlation_t_test'
, 'PHA-665752_bootstrap_correlation_t_test'
, 'PLX4720_bootstrap_correlation_t_test'
, 'Paclitaxel_bootstrap_correlation_t_test'
, 'Panobinostat_bootstrap_correlation_t_test'
, 'RAF265_bootstrap_correlation_t_test'
, 'Sorafenib_bootstrap_correlation_t_test'
, 'TAE684_bootstrap_correlation_t_test'
, 'TKI258_bootstrap_correlation_t_test'
, 'Topotecan_bootstrap_correlation_t_test'
, 'ZD-6474_bootstrap_correlation_t_test'
, 'ranked_features_per_phenotype_bootstrap_correlation_t_test'
, 'top_features_per_phenotype_bootstrap_correlation_t_test'
]
,'phenotype_expander': [
'zPhenotype_Expander.yml'
,'phenotype_expander_result'
]
}
os.system('make env_setup')
for key in BENCHMARK.keys():
BENCHMARK_list = BENCHMARK[key]
BENCHMARK_YML = BENCHMARK_list[0]
# for BENCHMARK_name in BENCHMARK_list[1:] :
verify_benchmark(BENCHMARK_list[1:], BENCHMARK_YML)
os.system('rm ./run_dir/results/*')
if __name__ == "__main__":
main()
| 57.253086 | 113 | 0.489164 | 659 | 9,275 | 6.264036 | 0.14871 | 0.067829 | 0.20155 | 0.157461 | 0.219961 | 0.10126 | 0.047481 | 0 | 0 | 0 | 0 | 0.054721 | 0.454232 | 9,275 | 161 | 114 | 57.608696 | 0.760767 | 0.006577 | 0 | 0 | 0 | 0 | 0.430201 | 0.41032 | 0 | 0 | 0 | 0 | 0 | 1 | 0.013605 | false | 0.006803 | 0.013605 | 0 | 0.027211 | 0.013605 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f0897551b53a7596dcde6999b7060e2269c01bbd | 360 | py | Python | ExerciciosPYTHON/PythonCeV/011.py | Samuel-Melo890/Python-Desafios | 2abc7734d6a6c1f5ab67421f792d6889d93bac94 | [
"MIT"
] | null | null | null | ExerciciosPYTHON/PythonCeV/011.py | Samuel-Melo890/Python-Desafios | 2abc7734d6a6c1f5ab67421f792d6889d93bac94 | [
"MIT"
] | 2 | 2022-03-18T16:06:07.000Z | 2022-03-18T16:55:29.000Z | ExerciciosPYTHON/PythonCeV/011.py | Samuel-Melo890/Python-Desafios | 2abc7734d6a6c1f5ab67421f792d6889d93bac94 | [
"MIT"
] | null | null | null | print('='*8,'Tinta para Pintar Parede','='*8)
l = float(input('Qual a largura da parede em metros?'))
a = float(input('Qual a altura da parede em metros?'))
a2 = a*l
qt = a2/2
print('''As dimensoes dessa parede sao de {}x{}.
A area desta parede equivale a {} metros quadrados.
Para pinta-la serao necessarios cerca de {} litros de tinta.'''.format(l,a,a2,qt))
| 40 | 82 | 0.683333 | 64 | 360 | 3.84375 | 0.5625 | 0.081301 | 0.113821 | 0.121951 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019608 | 0.15 | 360 | 8 | 83 | 45 | 0.784314 | 0 | 0 | 0 | 0 | 0 | 0.686111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f08ae4fa70f987a77072fa95da297a0c722007c0 | 912 | py | Python | projectlibxx/pkg2/mod3.py | rogerlwlw/lw_project_template | 06cd3c18fde210da26fda7dbec26d498fefe76f4 | [
"BSD-2-Clause"
] | null | null | null | projectlibxx/pkg2/mod3.py | rogerlwlw/lw_project_template | 06cd3c18fde210da26fda7dbec26d498fefe76f4 | [
"BSD-2-Clause"
] | null | null | null | projectlibxx/pkg2/mod3.py | rogerlwlw/lw_project_template | 06cd3c18fde210da26fda7dbec26d498fefe76f4 | [
"BSD-2-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 2 10:24:43 2020
@author: roger luo
"""
def fun_add(x, y):
"""add numbers
.. _x-y-z:
Parameters
----------
x : TYPE
DESCRIPTION.
y : TYPE
DESCRIPTION.
Returns
-------
None.
"""
return x, y
def showplot():
"""show plot example
example
-------
.. plot::
import matplotlib.pyplot as plt
import numpy as np
x = np.random.randn(1000)
plt.hist( x, 20)
plt.grid()
plt.show()
"""
return
def show_code():
""" show code
.. ipython::
:okwarning:
In [14]: import pandas as pd
In [15]: pd.Series([1,2,3])
In [22]: x =3
In [23]: z =x^2
In [24]: pd.np.random.randn(10,2)
"""
| 14.030769 | 41 | 0.405702 | 104 | 912 | 3.528846 | 0.557692 | 0.016349 | 0.070845 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.070727 | 0.441886 | 912 | 64 | 42 | 14.25 | 0.650295 | 0.656798 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.6 | false | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
f09d61b1e9a1097b646c64fc1cd5b2c2b7bde201 | 3,802 | py | Python | webpixels/__init__.py | reillyeon/webpixels | 57474a932e960218c7c028b74803671147736b99 | [
"MIT"
] | 2 | 2016-08-20T22:08:55.000Z | 2020-05-29T22:40:39.000Z | webpixels/__init__.py | reillyeon/webpixels | 57474a932e960218c7c028b74803671147736b99 | [
"MIT"
] | null | null | null | webpixels/__init__.py | reillyeon/webpixels | 57474a932e960218c7c028b74803671147736b99 | [
"MIT"
] | null | null | null | from abc import ABCMeta, abstractmethod
from math import copysign
import re
MAX_STEP_SIZE = 10
class Channel(object):
def __init__(self, name, controller, value=0):
self.name = name
self.controller = controller
self.value = value
self.target_value = value
def set(self, new_value):
self.value, self.target_value = new_value, new_value
def set_target(self, new_value):
self.target_value = new_value
def step(self):
if self.value == self.target_value:
return False
if self.value < self.target_value:
self.value += min(MAX_STEP_SIZE, self.target_value - self.value)
else:
self.value -= min(MAX_STEP_SIZE, self.value - self.target_value)
return True
def get(self):
return self.value
def sync(self):
self.controller.sync()
def get_controller(self):
return self.controller
def get_name(self):
return self.name
def __str__(self):
return "<Channel %s>" % self.name
class Pixel(object):
__metaclass__ = ABCMeta
def __init__(self, name):
self.name = name
@abstractmethod
def set(self, red, green, blue):
pass
@abstractmethod
def set_target(self, red, green, blue):
pass
@abstractmethod
def step(self):
pass
@abstractmethod
def get(self):
pass
def get_html_color(self):
r, g, b = self.get()
return '#%02x%02x%02x' % (r, g, b)
@abstractmethod
def get_controllers(self):
pass
def get_name(self):
return self.name
def sync(self):
for controller in self.get_controllers():
controller.sync()
def __str__(self):
return "<Pixel %s>" % self.name
class RgbPixel(Pixel):
def __init__(self, name, red_chan, green_chan, blue_chan):
super(RgbPixel, self).__init__(name)
self.controllers = set()
self.red = red_chan
self.controllers.add(red_chan.get_controller())
self.green = green_chan
self.controllers.add(green_chan.get_controller())
self.blue = blue_chan
self.controllers.add(blue_chan.get_controller())
def set(self, red, green, blue):
self.red.set(red)
self.green.set(green)
self.blue.set(blue)
def set_target(self, red, green, blue):
self.red.set_target(red)
self.green.set_target(green)
self.blue.set_target(blue)
def step(self):
results = (self.red.step(), self.green.step(), self.blue.step())
return any(results)
def get(self):
return self.red.get(), self.green.get(), self.blue.get()
def get_controllers(self):
return self.controllers
def get_channels(self):
return (self.red, self.green, self.blue)
class PixelSet(Pixel):
def __init__(self, name, pixels):
super(PixelSet, self).__init__(name)
self.pixels = pixels
self.controllers = set()
for pixel in pixels:
self.controllers.update(pixel.get_controllers())
def set(self, red, green, blue):
for pixel in self.pixels:
pixel.set(red, green, blue)
def set_target(self, red, green, blue):
for pixel in self.pixels:
pixel.set_target(red, green, blue)
def step(self):
results = [pixel.step() for pixel in self.pixels]
return any(results)
def get(self):
values = [pixel.get() for pixel in self.pixels]
rgb = tuple(sum(values) for values in zip(*values))
return tuple(value / len(self.pixels) for value in rgb)
def get_controllers(self):
return self.controllers
def get_pixels(self):
return self.pixels
class Controller(object):
__metaclass__ = ABCMeta
def __init__(self, name):
self.name = name
@abstractmethod
def sync(self):
pass
def get_name(self):
return self.name
| 23.469136 | 73 | 0.641504 | 513 | 3,802 | 4.569201 | 0.128655 | 0.035836 | 0.059727 | 0.051195 | 0.438567 | 0.362628 | 0.274317 | 0.200512 | 0.165529 | 0.093857 | 0 | 0.00314 | 0.246186 | 3,802 | 161 | 74 | 23.614907 | 0.814724 | 0 | 0 | 0.454545 | 0 | 0 | 0.009206 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.297521 | false | 0.049587 | 0.024793 | 0.099174 | 0.528926 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
f0a2382d09c3bd06b2e95f8b911e01c1cbd57d86 | 645 | py | Python | codalab/codalab/celery.py | AIMultimediaLab/AI4Media-EaaS-prototype-Py2-public | 64cd6ac9a56a4e2d40d93608d4289b1a0e50cce7 | [
"Apache-2.0"
] | 333 | 2015-12-29T22:49:40.000Z | 2022-03-27T12:01:57.000Z | codalab/codalab/celery.py | AIMultimediaLab/AI4Media-EaaS-prototype-Py2-public | 64cd6ac9a56a4e2d40d93608d4289b1a0e50cce7 | [
"Apache-2.0"
] | 1,572 | 2015-12-28T21:54:00.000Z | 2022-03-31T13:00:32.000Z | codalab/codalab/celery.py | AIMultimediaLab/AI4Media-EaaS-prototype-Py2-public | 64cd6ac9a56a4e2d40d93608d4289b1a0e50cce7 | [
"Apache-2.0"
] | 107 | 2016-01-08T03:46:07.000Z | 2022-03-16T08:43:57.000Z | from __future__ import absolute_import
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'codalab.settings')
os.environ.setdefault('DJANGO_CONFIGURATION', 'Dev')
from django.conf import settings # noqa
# Have to do this to make django-configurations work...
from configurations import importer
importer.install()
app = Celery('codalab')
# Using a string here means the worker will not have to
# pickle the object when using Windows.
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
| 28.043478 | 67 | 0.796899 | 90 | 645 | 5.577778 | 0.544444 | 0.055777 | 0.079681 | 0.099602 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12093 | 645 | 22 | 68 | 29.318182 | 0.885362 | 0.333333 | 0 | 0 | 0 | 0 | 0.207547 | 0.051887 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.545455 | 0 | 0.545455 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
f0a7dda3d68f0c762067ab14e1e6391b9ac3e12d | 574 | py | Python | {{cookiecutter.project_name}}/src/manage.py | techquila/Wagtail-Boilerplate | 3a79c9205a1a2479519a25709eb4e4fb1c59b4b7 | [
"MIT"
] | 1 | 2021-08-20T04:44:17.000Z | 2021-08-20T04:44:17.000Z | {{cookiecutter.project_name}}/src/manage.py | muxuezi/Wagtail-Boilerplate | 9ca5b5b1ef0901cb49b0c91398853184411112ba | [
"MIT"
] | null | null | null | {{cookiecutter.project_name}}/src/manage.py | muxuezi/Wagtail-Boilerplate | 9ca5b5b1ef0901cb49b0c91398853184411112ba | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import inspect
import dotenv
from django.core.management import execute_from_command_line
try:
inspect_file = inspect.getfile(inspect.currentframe())
env_path = os.path.dirname(os.path.abspath(inspect_file))
env_file = "{}/.env".format(env_path)
if os.path.exists(env_file):
dotenv.load_dotenv(env_file)
except Exception as e:
pass
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings.prod")
execute_from_command_line(sys.argv)
| 22.96 | 73 | 0.726481 | 81 | 574 | 4.851852 | 0.530864 | 0.045802 | 0.091603 | 0.111959 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002049 | 0.149826 | 574 | 24 | 74 | 23.916667 | 0.803279 | 0.073171 | 0 | 0 | 0 | 0 | 0.103774 | 0.041509 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.0625 | 0.3125 | 0 | 0.3125 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 2 |
f0b27f265c53834fe19d6ea310d8f831f9b35b22 | 767 | py | Python | config.py | wanjugu96/News-Articles | efb9a707715651f29dd6314d40608c44da99f30f | [
"MIT"
] | null | null | null | config.py | wanjugu96/News-Articles | efb9a707715651f29dd6314d40608c44da99f30f | [
"MIT"
] | null | null | null | config.py | wanjugu96/News-Articles | efb9a707715651f29dd6314d40608c44da99f30f | [
"MIT"
] | null | null | null | import os
class Config:
NEWS_ARTICLES_BASE_URL='https://newsapi.org/v2/top-headlines?sources={}&apiKey={}'
NEWS_SOURCES_BASE_URL='https://newsapi.org/v2/top-headlines/sources?category={}&language=en&apiKey={}'
#https://newsapi.org/v2/top-headlines?sources=bbc-news&apiKey=b7b2a5ee0f444390abfb0b9c2d91502c
#GET https://newsapi.org/v2/top-headlines?country=de&category=business&apiKey=b7b2a5ee0f444390abfb0b9c2d91502c
#GET https://newsapi.org/v2/top-headlines/sources?category=businessapiKey=API_KEY
NEWS_API_KEY=os.environ.get('NEWS_API_KEY')
SECRET_KEY = os.environ.get('SECRET_KEY')
class ProdConfig(Config):
pass
class DevConfig(Config):
DEBUG=True
config_options={
'development':DevConfig,
'production':ProdConfig
}
| 29.5 | 114 | 0.761408 | 98 | 767 | 5.816327 | 0.387755 | 0.105263 | 0.131579 | 0.149123 | 0.5 | 0.5 | 0.5 | 0.436842 | 0.396491 | 0 | 0 | 0.059078 | 0.095176 | 767 | 25 | 115 | 30.68 | 0.762248 | 0.367666 | 0 | 0 | 0 | 0.071429 | 0.370833 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.071429 | 0.071429 | 0 | 0.642857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
f0b3cffb5ac0daf88694cca6e68f8f15c67a2eff | 1,036 | py | Python | BlogPostMaker.py | charlesreid1/asmodeus | ea3b9c9fb9346e90a6aae820d194db2136e3bcc6 | [
"MIT"
] | 2 | 2016-11-23T04:57:45.000Z | 2020-07-17T23:27:51.000Z | BlogPostMaker.py | charlesreid1/asmodeus | ea3b9c9fb9346e90a6aae820d194db2136e3bcc6 | [
"MIT"
] | null | null | null | BlogPostMaker.py | charlesreid1/asmodeus | ea3b9c9fb9346e90a6aae820d194db2136e3bcc6 | [
"MIT"
] | null | null | null | from ContentGeneration import generate_content, prefix
from datetime import datetime
import random
def make_a_blog_post():
"""
This method is simple, but it could use some more options.
- Title
- Date
- Categories
- Location of blog file
"""
# Blog file
myrand = random.randint(0,100000)
file_prefix = datetime.now().strftime("%Y-%m-%d")
blog_file = prefix+"/pelican/content/%s_%d.md"%(file_prefix,myrand)
# Header
my_title = "Dino Ipsum %d"%(myrand)
my_date = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
my_cat = "Dinosaurs"
# Blog
blog_title = "Title: %s"%(my_title)
blog_date = "Date: %s"%(my_date)
blog_cat = "Category: %s"%(my_cat)
blog_body = generate_content()
# Make the blog post file
with open(blog_file,'w') as f:
f.write(blog_title + "\n")
f.write(blog_date + "\n")
f.write(blog_cat + "\n\n")
f.write(blog_body + "\n")
return blog_file
if __name__=="__main__":
print make_a_blog_post()
| 25.9 | 71 | 0.617761 | 149 | 1,036 | 4.053691 | 0.42953 | 0.066225 | 0.066225 | 0.054636 | 0.072848 | 0.072848 | 0 | 0 | 0 | 0 | 0 | 0.00885 | 0.236486 | 1,036 | 39 | 72 | 26.564103 | 0.754741 | 0.043436 | 0 | 0 | 1 | 0 | 0.14218 | 0.029621 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.136364 | null | null | 0.045455 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f0d7954c19c4323fa5510acaa963a865238b9fc7 | 172 | py | Python | myproject/__init__.py | GaheeK/sebastien-tutorial-python-heroku | 9328050ecc000cd280015b482315344cbabf1186 | [
"MIT"
] | null | null | null | myproject/__init__.py | GaheeK/sebastien-tutorial-python-heroku | 9328050ecc000cd280015b482315344cbabf1186 | [
"MIT"
] | null | null | null | myproject/__init__.py | GaheeK/sebastien-tutorial-python-heroku | 9328050ecc000cd280015b482315344cbabf1186 | [
"MIT"
] | 1 | 2018-02-22T06:53:40.000Z | 2018-02-22T06:53:40.000Z | from flask import Flask
app = Flask(__name__)
app.config.from_object('myproject.config')
from myproject.views import index
@app.route('/')
def hello():
return "hello"
| 15.636364 | 42 | 0.738372 | 24 | 172 | 5.083333 | 0.583333 | 0.163934 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.127907 | 172 | 10 | 43 | 17.2 | 0.813333 | 0 | 0 | 0 | 0 | 0 | 0.127907 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.285714 | 0.142857 | 0.571429 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
f0d9f60f6f2e2124ebb94744a937b0ad64b3d9e3 | 872 | py | Python | polyballbounce/velocity.py | dseomn/polyball-bounce | 42649131a1dc80560666281302d294bb4066d375 | [
"Apache-2.0"
] | null | null | null | polyballbounce/velocity.py | dseomn/polyball-bounce | 42649131a1dc80560666281302d294bb4066d375 | [
"Apache-2.0"
] | null | null | null | polyballbounce/velocity.py | dseomn/polyball-bounce | 42649131a1dc80560666281302d294bb4066d375 | [
"Apache-2.0"
] | null | null | null | import math
class Velocity(object):
def get_angle(self):
return self._angle
def set_angle(self, value):
self._angle = value % (2*math.pi)
def del_angle(self):
del self._angle
angle = property(get_angle, set_angle, del_angle)
def get_speed(self):
return self._speed
def set_speed(self, value):
self._speed = abs(value)
if value < 0:
self.angle += math.pi
def del_speed(self):
del self._speed
speed = property(get_speed, set_speed, del_speed)
def __init__(self, speed, angle):
"angle = angle CCW of the x+ axis in radians, 0 < angle < 2*pi"
self.angle = angle
self.speed = speed
def delta(self, time, speed=None):
"return (change in left, change from top) for given time"
if speed is None:
speed = self.speed
return (time*speed*math.cos(self.angle), -1*time*speed*math.sin(self.angle))
| 27.25 | 80 | 0.667431 | 137 | 872 | 4.087591 | 0.29927 | 0.1125 | 0.05 | 0.042857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00731 | 0.215596 | 872 | 31 | 81 | 28.129032 | 0.811404 | 0.134174 | 0 | 0 | 0 | 0 | 0.133028 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.296296 | false | 0 | 0.037037 | 0.074074 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
f0df4ea8fb498495c1e3f22377be780a692b4219 | 14,854 | py | Python | artemis/io/protobuf/artemis_pb2.py | artemis-analytics/artemis | 3e1eebdd4628145ee7d8923567b5e6f53a2e5244 | [
"Apache-2.0"
] | 4 | 2020-02-29T15:02:05.000Z | 2021-05-13T18:50:58.000Z | artemis/io/protobuf/artemis_pb2.py | artemis-analytics/artemis | 3e1eebdd4628145ee7d8923567b5e6f53a2e5244 | [
"Apache-2.0"
] | 25 | 2020-02-25T19:29:21.000Z | 2020-04-03T15:06:59.000Z | artemis/io/protobuf/artemis_pb2.py | ryanmwhitephd/artemis | 3e1eebdd4628145ee7d8923567b5e6f53a2e5244 | [
"Apache-2.0"
] | 2 | 2021-08-12T09:40:51.000Z | 2021-08-12T09:42:09.000Z | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: artemis.proto
# Copyright © Her Majesty the Queen in Right of Canada, as represented
# by the Minister of Statistics Canada, 2019.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='artemis.proto',
package='artemis',
syntax='proto3',
serialized_pb=_b('\n\rartemis.proto\x12\x07\x61rtemis\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\"0\n\x05Timer\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04time\x18\x02 \x01(\x02\x12\x0b\n\x03std\x18\x03 \x01(\x02\"\x8a\x01\n\x07Summary\x12\x17\n\x0fprocessed_bytes\x18\x01 \x01(\x04\x12\x1e\n\x06timers\x18\x02 \x03(\x0b\x32\x0e.artemis.Timer\x12\x19\n\x11processed_ndatums\x18\x03 \x01(\x05\x12+\n\x08job_time\x18\x05 \x01(\x0b\x32\x19.google.protobuf.Duration\"\xcf\x02\n\x07JobInfo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12+\n\x07started\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x66inished\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12 \n\x05state\x18\x04 \x01(\x0e\x32\x11.artemis.JobState\x12\x0e\n\x06job_id\x18\x05 \x01(\t\x12\x12\n\nstore_name\x18\x06 \x01(\t\x12\x10\n\x08store_id\x18\x07 \x01(\t\x12\x12\n\nstore_path\x18\x08 \x01(\t\x12\x0f\n\x07menu_id\x18\t \x01(\t\x12\x11\n\tconfig_id\x18\n \x01(\t\x12\x12\n\ndataset_id\x18\x0b \x01(\t\x12\x14\n\x0cparentset_id\x18\x0c \x01(\t\x12!\n\x07summary\x18\r \x01(\x0b\x32\x10.artemis.Summary*\xd6\x01\n\x08JobState\x12\x10\n\x0cJOB_STARTING\x10\x00\x12\x0f\n\x0bJOB_RUNNING\x10\x01\x12\x0f\n\x0bJOB_FAILURE\x10\x02\x12\x0f\n\x0bJOB_SUCCESS\x10\x03\x12\r\n\tJOB_ABORT\x10\x04\x12\x11\n\rJOB_CONFIGURE\x10\x05\x12\x12\n\x0eJOB_INITIALIZE\x10\x06\x12\x0c\n\x08JOB_BOOK\x10\x07\x12\x0e\n\nJOB_SAMPLE\x10\x08\x12\x0e\n\nJOB_REBOOK\x10\t\x12\x0f\n\x0bJOB_EXECUTE\x10\n\x12\x10\n\x0cJOB_FINALIZE\x10\x0b\x62\x06proto3')
,
dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,google_dot_protobuf_dot_duration__pb2.DESCRIPTOR,])
_JOBSTATE = _descriptor.EnumDescriptor(
name='JobState',
full_name='artemis.JobState',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='JOB_STARTING', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='JOB_RUNNING', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='JOB_FAILURE', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='JOB_SUCCESS', index=3, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='JOB_ABORT', index=4, number=4,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='JOB_CONFIGURE', index=5, number=5,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='JOB_INITIALIZE', index=6, number=6,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='JOB_BOOK', index=7, number=7,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='JOB_SAMPLE', index=8, number=8,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='JOB_REBOOK', index=9, number=9,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='JOB_EXECUTE', index=10, number=10,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='JOB_FINALIZE', index=11, number=11,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=621,
serialized_end=835,
)
_sym_db.RegisterEnumDescriptor(_JOBSTATE)
JobState = enum_type_wrapper.EnumTypeWrapper(_JOBSTATE)
JOB_STARTING = 0
JOB_RUNNING = 1
JOB_FAILURE = 2
JOB_SUCCESS = 3
JOB_ABORT = 4
JOB_CONFIGURE = 5
JOB_INITIALIZE = 6
JOB_BOOK = 7
JOB_SAMPLE = 8
JOB_REBOOK = 9
JOB_EXECUTE = 10
JOB_FINALIZE = 11
_TIMER = _descriptor.Descriptor(
name='Timer',
full_name='artemis.Timer',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='artemis.Timer.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='time', full_name='artemis.Timer.time', index=1,
number=2, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='std', full_name='artemis.Timer.std', index=2,
number=3, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=91,
serialized_end=139,
)
_SUMMARY = _descriptor.Descriptor(
name='Summary',
full_name='artemis.Summary',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='processed_bytes', full_name='artemis.Summary.processed_bytes', index=0,
number=1, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='timers', full_name='artemis.Summary.timers', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='processed_ndatums', full_name='artemis.Summary.processed_ndatums', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='job_time', full_name='artemis.Summary.job_time', index=3,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=142,
serialized_end=280,
)
_JOBINFO = _descriptor.Descriptor(
name='JobInfo',
full_name='artemis.JobInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='artemis.JobInfo.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='started', full_name='artemis.JobInfo.started', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='finished', full_name='artemis.JobInfo.finished', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='state', full_name='artemis.JobInfo.state', index=3,
number=4, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='job_id', full_name='artemis.JobInfo.job_id', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='store_name', full_name='artemis.JobInfo.store_name', index=5,
number=6, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='store_id', full_name='artemis.JobInfo.store_id', index=6,
number=7, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='store_path', full_name='artemis.JobInfo.store_path', index=7,
number=8, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='menu_id', full_name='artemis.JobInfo.menu_id', index=8,
number=9, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='config_id', full_name='artemis.JobInfo.config_id', index=9,
number=10, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='dataset_id', full_name='artemis.JobInfo.dataset_id', index=10,
number=11, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='parentset_id', full_name='artemis.JobInfo.parentset_id', index=11,
number=12, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='summary', full_name='artemis.JobInfo.summary', index=12,
number=13, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=283,
serialized_end=618,
)
_SUMMARY.fields_by_name['timers'].message_type = _TIMER
_SUMMARY.fields_by_name['job_time'].message_type = google_dot_protobuf_dot_duration__pb2._DURATION
_JOBINFO.fields_by_name['started'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
_JOBINFO.fields_by_name['finished'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
_JOBINFO.fields_by_name['state'].enum_type = _JOBSTATE
_JOBINFO.fields_by_name['summary'].message_type = _SUMMARY
DESCRIPTOR.message_types_by_name['Timer'] = _TIMER
DESCRIPTOR.message_types_by_name['Summary'] = _SUMMARY
DESCRIPTOR.message_types_by_name['JobInfo'] = _JOBINFO
DESCRIPTOR.enum_types_by_name['JobState'] = _JOBSTATE
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
Timer = _reflection.GeneratedProtocolMessageType('Timer', (_message.Message,), dict(
DESCRIPTOR = _TIMER,
__module__ = 'artemis_pb2'
# @@protoc_insertion_point(class_scope:artemis.Timer)
))
_sym_db.RegisterMessage(Timer)
Summary = _reflection.GeneratedProtocolMessageType('Summary', (_message.Message,), dict(
DESCRIPTOR = _SUMMARY,
__module__ = 'artemis_pb2'
# @@protoc_insertion_point(class_scope:artemis.Summary)
))
_sym_db.RegisterMessage(Summary)
JobInfo = _reflection.GeneratedProtocolMessageType('JobInfo', (_message.Message,), dict(
DESCRIPTOR = _JOBINFO,
__module__ = 'artemis_pb2'
# @@protoc_insertion_point(class_scope:artemis.JobInfo)
))
_sym_db.RegisterMessage(JobInfo)
# @@protoc_insertion_point(module_scope)
| 40.474114 | 1,539 | 0.730241 | 2,040 | 14,854 | 5.068627 | 0.133333 | 0.058801 | 0.034816 | 0.044681 | 0.604255 | 0.552998 | 0.528627 | 0.520696 | 0.462186 | 0.434043 | 0 | 0.046317 | 0.140972 | 14,854 | 366 | 1,540 | 40.584699 | 0.76395 | 0.063687 | 0 | 0.608025 | 1 | 0.003086 | 0.186447 | 0.135244 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.027778 | 0 | 0.027778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f0e1a4ad0389b77f797982842e44dee7f57cd4a0 | 782 | py | Python | basic-concepts/2c-range.py | AlienCoders/learning-python | 255dc32400b79db83382e707c96df029cfe30b24 | [
"MIT"
] | 19 | 2019-08-30T06:51:52.000Z | 2022-03-11T18:44:29.000Z | basic-concepts/2c-range.py | AlienCoders/learning-python | 255dc32400b79db83382e707c96df029cfe30b24 | [
"MIT"
] | 9 | 2020-02-14T09:21:20.000Z | 2022-03-08T09:38:09.000Z | basic-concepts/2c-range.py | sumanchary86/learning-python | 99ae9c31d62a07d1363b67f22f93173730346d76 | [
"MIT"
] | 12 | 2020-07-20T18:49:45.000Z | 2021-12-18T11:20:03.000Z | #!/usr/bin/python
# Python built-in function range() generates the integer numbers between the given start integer to the stop integer, i.e., range() returns a range object.
# Using for loop, we can iterate over a sequence of numbers produced by the range() function.
# It only allows integer type numbers as arguments.
# We can’t provide a string or float type parameter inside the range() function.
# The arguments can either be +ve or -ve.
# It doesn’t accept ‘0’ as a step value. If the step is ‘0’, the function throws a ValueError.
for step in range(10, 100, 10):
print(step)
print("\nAnother Example to loop over a list using range")
port_lists = [21, 22, 23, 25, 53, 80, 443, 3306, 8080, 9002, 27017]
for port in range(len(port_lists)):
print(port_lists[port])
| 41.157895 | 155 | 0.725064 | 136 | 782 | 4.147059 | 0.566176 | 0.047872 | 0.056738 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.063863 | 0.179028 | 782 | 18 | 156 | 43.444444 | 0.814642 | 0.670077 | 0 | 0 | 1 | 0 | 0.195219 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
f0e1dd189c28f5ef767fb73bfe99c6452721bbc8 | 74 | py | Python | tests/errors/test_binop1.py | akshanshbhatt/lpython | 70fef49dbbb6cbb0447f7013231171e5c8b8e5df | [
"BSD-3-Clause"
] | 31 | 2022-01-07T23:56:33.000Z | 2022-03-29T16:09:02.000Z | tests/errors/test_binop1.py | akshanshbhatt/lpython | 70fef49dbbb6cbb0447f7013231171e5c8b8e5df | [
"BSD-3-Clause"
] | 197 | 2021-12-29T19:01:41.000Z | 2022-03-31T15:58:25.000Z | tests/errors/test_binop1.py | akshanshbhatt/lpython | 70fef49dbbb6cbb0447f7013231171e5c8b8e5df | [
"BSD-3-Clause"
] | 17 | 2022-01-06T15:34:36.000Z | 2022-03-31T13:55:33.000Z | def test_e1():
x: i32
s: str
x = 0
s = 's'
print(x+s)
| 10.571429 | 14 | 0.391892 | 14 | 74 | 2 | 0.642857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097561 | 0.445946 | 74 | 6 | 15 | 12.333333 | 0.585366 | 0 | 0 | 0 | 0 | 0 | 0.013514 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.166667 | 0.166667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f0ef4587068796b52f1f38488ef32898e101c5cc | 19,701 | py | Python | tests/test_lgr.py | makitalo/elma-python | b114b9d4c646cb842031a0bec4ca3fa5ab16c84a | [
"MIT"
] | 9 | 2015-05-03T23:00:59.000Z | 2017-01-26T03:07:10.000Z | tests/test_lgr.py | makitalo/elma-python | b114b9d4c646cb842031a0bec4ca3fa5ab16c84a | [
"MIT"
] | 14 | 2017-01-25T18:46:58.000Z | 2019-11-09T17:00:52.000Z | tests/test_lgr.py | makitalo/elma-python | b114b9d4c646cb842031a0bec4ca3fa5ab16c84a | [
"MIT"
] | 3 | 2017-01-25T04:03:57.000Z | 2018-10-29T18:56:43.000Z | from elma.lgr import LGR
from elma.lgr import LGR_Image
from elma.lgr import pack_LGR
from elma.lgr import unpack_LGR
import elma.error
from elma.error import check_LGR_error
from elma.constants import LGR_DEFAULT_PALETTE
import unittest
from PIL import Image
from PIL import ImageDraw
import os
import shutil
class TestLGR(unittest.TestCase):
def setUp(self):
os.makedirs('tests/files/result', exist_ok=True)
def tearDown(self):
try:
shutil.rmtree("tests/files/result")
except FileNotFoundError:
pass
def test_get_palette(self):
with Image.open('tests/files/barrel.pcx') as image:
barrel = LGR_Image('barrel', img=image)
self.assertEqual(barrel.get_palette(), LGR_DEFAULT_PALETTE)
def test_is_methods(self):
lgrimg = LGR_Image('barrel')
self.assertEqual(lgrimg.is_in_pictures_lst(), True)
self.assertEqual(lgrimg.is_qup_qdown(), False)
self.assertEqual(lgrimg.is_food(), False)
self.assertEqual(lgrimg.is_object(), False)
self.assertEqual(lgrimg.is_special(), False)
lgrimg = LGR_Image('q1body')
self.assertEqual(lgrimg.is_in_pictures_lst(), False)
self.assertEqual(lgrimg.is_qup_qdown(), False)
self.assertEqual(lgrimg.is_food(), False)
self.assertEqual(lgrimg.is_object(), False)
self.assertEqual(lgrimg.is_special(), True)
lgrimg = LGR_Image('Q1BODY')
self.assertEqual(lgrimg.is_in_pictures_lst(), False)
self.assertEqual(lgrimg.is_qup_qdown(), False)
self.assertEqual(lgrimg.is_food(), False)
self.assertEqual(lgrimg.is_object(), False)
self.assertEqual(lgrimg.is_special(), True)
lgrimg = LGR_Image('qFoOd5')
self.assertEqual(lgrimg.is_in_pictures_lst(), True)
self.assertEqual(lgrimg.is_qup_qdown(), False)
self.assertEqual(lgrimg.is_food(), True)
self.assertEqual(lgrimg.is_object(), True)
self.assertEqual(lgrimg.is_special(), True)
lgrimg.name = "qEXit"
self.assertEqual(lgrimg.is_in_pictures_lst(), False)
self.assertEqual(lgrimg.is_qup_qdown(), False)
self.assertEqual(lgrimg.is_food(), False)
self.assertEqual(lgrimg.is_object(), True)
self.assertEqual(lgrimg.is_special(), True)
lgrimg = LGR_Image('qUp_xS')
self.assertEqual(lgrimg.is_in_pictures_lst(), True)
self.assertEqual(lgrimg.is_qup_qdown(), True)
self.assertEqual(lgrimg.is_food(), False)
self.assertEqual(lgrimg.is_object(), False)
self.assertEqual(lgrimg.is_special(), True)
def test_is_valid_palette_image(self):
with Image.open('tests/files/barrel.pcx') as f:
lgrimg = LGR_Image('barrel', img=f)
self.assertEqual(lgrimg.is_valid_palette_image(), True)
with Image.open('tests/files/barrel.bmp') as f:
lgrimg = LGR_Image('barrel', img=f)
self.assertEqual(lgrimg.is_valid_palette_image(), True)
with Image.open('tests/files/barrelgrayscale.bmp') as f:
lgrimg = LGR_Image('barrel', img=f)
self.assertEqual(lgrimg.is_valid_palette_image(), False)
with Image.open('tests/files/barrelrgb.png') as f:
lgrimg = LGR_Image('barrel', img=f)
self.assertEqual(lgrimg.is_valid_palette_image(), False)
with Image.open('tests/files/barrel_partial_palette.pcx') as f:
lgrimg = LGR_Image('barrel', img=f)
self.assertEqual(lgrimg.is_valid_palette_image(), True)
def test_convert_palette_image(self):
with Image.open('tests/files/barrelrgb.png') as f:
lgrimg = LGR_Image('barrel', img=f)
lgrimg.convert_palette_image(
palette_info=LGR_DEFAULT_PALETTE,
dither=False)
lgrimg.save_PCX("tests/files/result/barrelrgb2pal.pcx")
with Image.open('tests/files/barrel.pcx') as g:
self.assertEqual(lgrimg.img.mode, g.mode)
self.assertEqual(lgrimg.img.size, g.size)
self.assertEqual(lgrimg.img.getpalette(), g.getpalette())
self.assertEqual(lgrimg.img.tobytes(), g.tobytes())
with Image.open('tests/files/woman.png') as f:
lgrimg = LGR_Image('woman', img=f)
lgrimg.convert_palette_image(
LGR_DEFAULT_PALETTE, True)
lgrimg.save_PCX('tests/files/result/woman.pcx')
self.assertEqual(lgrimg.img.getpalette(), LGR_DEFAULT_PALETTE)
with Image.open('tests/files/barrel_partial_palette.pcx') as f:
lgrimg = LGR_Image('barrel', img=f)
lgrimg.convert_palette_image(
palette_info=LGR_DEFAULT_PALETTE, dither=False)
lgrimg.save_PCX(
"tests/files/result/barrel_partial_to_full_palette.pcx")
with Image.open('tests/files/barrel.pcx') as g:
self.assertEqual(lgrimg.img.mode, g.mode)
self.assertEqual(lgrimg.img.size, g.size)
self.assertEqual(lgrimg.img.getpalette(), g.getpalette())
self.assertEqual(lgrimg.img.tobytes(), g.tobytes())
def test_packing_and_unpacking(self):
lgr1 = unpack_LGR('tests/files/default.lgr')
with open('tests/files/result/default.lgr', 'wb') as f:
f.write(pack_LGR(lgr1))
# not comparing binaries here because the script changes pcx header &
# compresses a bit better than original .pcx files
lgr2 = unpack_LGR('tests/files/result/default.lgr')
self.assertEqual(lgr1.palette, lgr2.palette)
for k in range(len(lgr1.images)):
self.assertEqual(lgr1.images[k], lgr2.images[k])
def test_find_LGR_Image(self):
lgr = LGR()
lgr.images.append(LGR_Image('aAa'))
lgr.images.append(LGR_Image('bBb'))
lgr.images.append(LGR_Image('cCc'))
lgr.images.append(LGR_Image('dDd'))
lgr.images.append(LGR_Image('eEe'))
index = lgr.find_LGR_Image("DdD")
self.assertEqual(index, 3)
self.assertRaises(ValueError,
lambda: lgr.find_LGR_Image("does not exist"))
class TestLGRErrors(unittest.TestCase):
def setUp(self):
self.lgr = unpack_LGR('tests/files/default.lgr')
os.makedirs('tests/files/result', exist_ok=True)
def tearDown(self):
try:
shutil.rmtree("tests/files/result")
except FileNotFoundError:
pass
def test_error_no_errors(self):
self.assertEqual(check_LGR_error(self.lgr), [])
def test_error_invalid_palette(self):
self.lgr.palette[0] = 300
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_LGR_INVALID_PALETTE)
self.lgr.palette[0] = -10
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_LGR_INVALID_PALETTE)
self.lgr.palette[0] = 0
self.lgr.palette.append([0])
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_LGR_INVALID_PALETTE)
def test_error_missing_mandatory_file(self):
self.lgr.images.pop(0)
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_LGR_MISSING_MANDATORY_FILE)
def test_error_duplicate_name(self):
self.lgr.images.append(self.lgr.images[-1])
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_DUPLICATE_NAME)
def test_error_too_many_grass(self):
for i in range(30, 80): # skip the already-present qups and qdowns
# keep height of grass to avoid warning
imgt = Image.new('P', (1, 41), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images.append(LGR_Image(
'qUp_%s' % i,
imgt,
LGR_Image.PICTURE,
999,
LGR_Image.CLIPPING_G,
LGR_Image.TRANSPARENCY_PAL_ZERO))
for i in range(30, 80):
imgt = Image.new('P', (1, 41), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images.append(LGR_Image(
'qDowN_%s' % i,
imgt,
LGR_Image.PICTURE,
999,
LGR_Image.CLIPPING_G,
LGR_Image.TRANSPARENCY_PAL_ZERO))
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_TOO_MANY_GRASS)
def test_error_too_many_pictures(self):
for i in range(1000):
imgt = Image.new('P', (1, 1), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images.append(LGR_Image(
'pic%s' % i,
imgt,
LGR_Image.PICTURE,
999,
LGR_Image.CLIPPING_G,
LGR_Image.TRANSPARENCY_PAL_ZERO))
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_TOO_MANY_PICTURES)
def test_error_too_many_textures(self):
for i in range(100):
imgt = Image.new('P', (1, 1), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images.append(LGR_Image(
'pic%s' % i,
imgt,
LGR_Image.TEXTURE,
999,
LGR_Image.CLIPPING_G,
LGR_Image.TRANSPARENCY_PAL_ZERO))
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_TOO_MANY_TEXTURES)
def test_error_not_enough_textures(self):
del self.lgr.images[self.lgr.find_LGR_Image("brick")]
del self.lgr.images[self.lgr.find_LGR_Image("ground")]
del self.lgr.images[self.lgr.find_LGR_Image("sky")]
del self.lgr.images[self.lgr.find_LGR_Image("stone1")]
del self.lgr.images[self.lgr.find_LGR_Image("stone2")]
del self.lgr.images[self.lgr.find_LGR_Image("stone3")]
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_NOT_ENOUGH_TEXTURES)
def test_error_too_many_masks(self):
for i in range(200):
imgt = Image.new('P', (1, 1), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images.append(LGR_Image(
'pic%s' % i,
imgt,
LGR_Image.MASK,
999,
LGR_Image.CLIPPING_G,
LGR_Image.TRANSPARENCY_PAL_ZERO))
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_TOO_MANY_MASKS)
def test_warning_unused_qfood(self):
imgt = Image.new('P', (40, 40), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images.append(LGR_Image('qfOod4', imgt))
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.WARN_UNUSED_QFOOD)
def test_error_name_too_long(self):
self.lgr.images[-1].name = 'nameTOOlong'
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_NAME_TOO_LONG)
def test_error_name_missing(self):
self.lgr.images[-1].name = ''
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_NAME_MISSING)
def test_error_padding_invalid(self):
self.lgr.images[-1].name = "x"
self.lgr.images[-1].padding = [1, 2, 3, 4, 5, 6, 7, 8]
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_PADDING_INVALID)
self.lgr.images[-1].padding = [1, 2, 3, 4, 5, 600, 7]
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_PADDING_INVALID)
self.lgr.images[-1].padding = [1, 2, 3, 4, 5, 'error', 7]
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_PADDING_INVALID)
def test_warning_grass_height_too_small(self):
imgt = Image.new('P', (41, 40), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images[-1].name = "qUp_Xx"
self.lgr.images[-1].img = imgt
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.WARN_GRASS_HEIGHT_TOO_SMALL)
def test_error_obj_width_invalid(self):
imgt = Image.new('P', (41, 40), 0)
imgt.putpalette(self.lgr.palette)
qexit_index = self.lgr.find_LGR_Image("qexit")
original_qexit_image = self.lgr.images[qexit_index].img
self.lgr.images[qexit_index].img = imgt
self.lgr.images[qexit_index].name = "qeXit"
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_OBJ_WIDTH_INVALID)
self.lgr.images[qexit_index].img = original_qexit_image
self.lgr.images[-1].name = "qFOOd3"
self.lgr.images[-1].img = imgt
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_OBJ_WIDTH_INVALID)
def test_error_obj_height_invalid(self):
imgt = Image.new('P', (40, 1), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images[-1].name = "qFOOd3"
self.lgr.images[-1].img = imgt
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.WARN_OBJ_HEIGHT_INVALID)
def test_error_obj_too_wide(self):
imgt = Image.new('P', (40040, 40), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images[-1].name = "qFOOd3"
self.lgr.images[-1].img = imgt
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_OBJ_TOO_WIDE)
def test_error_image_type_invalid(self):
self.lgr.images[-1].name = 'x'
imgt = Image.new('P', (1, 1), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images[-1].img = imgt
self.lgr.images[-1].image_type = 30
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_IMAGE_TYPE_INVALID)
def test_error_pic_too_wide(self):
imgt = Image.new('P', (6001, 1), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images[-1].img = imgt
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_PIC_TOO_WIDE)
def test_error_pic_too_many_pixels(self):
imgt = Image.new('P', (800, 780), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images[-1].img = imgt
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_PIC_TOO_MANY_PIXELS)
def test_error_distance_invalid(self):
imgt = Image.new('P', (1, 1), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images[-1].img = imgt
self.lgr.images[-1].default_distance = 0
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_DISTANCE_INVALID)
self.lgr.images[-1].default_distance = 1000
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_DISTANCE_INVALID)
self.lgr.images[-1].image_type = LGR_Image.MASK
self.assertEqual(check_LGR_error(self.lgr), [])
def test_error_clipping_invalid(self):
self.lgr.images[-1].image_type = LGR_Image.MASK
self.lgr.images[-1].default_clipping = 10
self.assertEqual(check_LGR_error(self.lgr), [])
self.lgr.images[-1].image_type = LGR_Image.TEXTURE
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_CLIPPING_INVALID)
self.lgr.images[-1].default_clipping = -1
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_CLIPPING_INVALID)
def test_error_transparency_invalid(self):
self.lgr.images[-1].transparency = 100
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_TRANSPARENCY_INVALID)
self.lgr.images[-1].transparency = -1
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_TRANSPARENCY_INVALID)
def test_error_file_too_large(self):
sizing = 2400
# palette numbers 193-255 take up 2 bytes in .pcx format instead of
# one. 2400*2400*2 > 10,000,000
imgt = Image.new('P', (sizing, sizing), 200)
imgt.putpalette(self.lgr.palette)
draw = ImageDraw.Draw(imgt)
# hatch the image because .pcx format uses run-length-encoding of same
# value in horizontal sequence
for i in range(0, sizing, 2):
draw.line([i, 0, sizing-1, sizing-1-i], fill=201, width=1)
draw.line([0, i, sizing-1-i, sizing-1], fill=201, width=1)
del draw
imgt.save('tests/files/result/err_file_too_large.pcx', 'pcx')
self.lgr.images[-1].img = imgt
self.lgr.images[-1].image_type = LGR_Image.TEXTURE
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_FILE_TOO_LARGE)
def test_error_small_image_too_large(self):
imgt = Image.new('P', (256, 255), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images[4].img = imgt
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_SMALL_IMAGE_TOO_LARGE)
imgt = Image.new('P', (255, 256), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images[4].img = imgt
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_SMALL_IMAGE_TOO_LARGE)
def test_warning_palette_mismatch(self):
edited_palette = LGR_DEFAULT_PALETTE[:]
edited_palette[0] = 100
self.lgr.images[4].put_palette(edited_palette)
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.WARN_PALETTE_MISMATCH)
def test_error_image_invalid_palette(self):
imgt = Image.new('RGB', (1, 1), 0)
self.lgr.images.append(LGR_Image(
'x',
imgt,
LGR_Image.MASK,
999,
LGR_Image.CLIPPING_G,
LGR_Image.TRANSPARENCY_PAL_ZERO))
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_IMAGE_INVALID_PALETTE)
def test_warning_qcolors_wrong_size(self):
index = self.lgr.find_LGR_Image('qCOlorS')
imgt = Image.new('P', (67, 109), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images[index].img = imgt
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.WARN_QCOLORS_WRONG_SIZE)
imgt = Image.new("P", (66, 108), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images[index].img = imgt
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.WARN_QCOLORS_WRONG_SIZE)
def test_warning_qbike_too_small(self):
index = self.lgr.find_LGR_Image("q2BIKE")
imgt = Image.new("P", (353, 298), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images[index].img = imgt
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.WARN_QBIKE_TOO_SMALL)
imgt = Image.new("P", (354, 297), 0)
imgt.putpalette(self.lgr.palette)
self.lgr.images[index].img = imgt
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.WARN_QBIKE_TOO_SMALL)
def test_error_img_missing(self):
self.lgr.images[0].img = None
self.assertEqual(check_LGR_error(self.lgr)[0][0],
elma.error.ERR_IMG_MISSING)
| 43.109409 | 78 | 0.606924 | 2,596 | 19,701 | 4.393683 | 0.097458 | 0.084692 | 0.067245 | 0.086709 | 0.776346 | 0.710065 | 0.660617 | 0.651499 | 0.640365 | 0.615027 | 0 | 0.026257 | 0.269276 | 19,701 | 456 | 79 | 43.203947 | 0.766046 | 0.019745 | 0 | 0.555556 | 0 | 0 | 0.046936 | 0.028597 | 0 | 0 | 0 | 0 | 0.22716 | 1 | 0.098765 | false | 0.004938 | 0.02963 | 0 | 0.133333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f0f402aa6219d6672c87c7f40a979f39348006a6 | 508 | py | Python | coursera 3/maiusculas.py | SricardoSdSouza/Curso-da-USP | 6198c509c52bf6132f904cded2e12ae941f2b973 | [
"MIT"
] | null | null | null | coursera 3/maiusculas.py | SricardoSdSouza/Curso-da-USP | 6198c509c52bf6132f904cded2e12ae941f2b973 | [
"MIT"
] | null | null | null | coursera 3/maiusculas.py | SricardoSdSouza/Curso-da-USP | 6198c509c52bf6132f904cded2e12ae941f2b973 | [
"MIT"
] | null | null | null | frase =[]
maiuscula= ''
def maiusculas(frase):
maiuscula= ''
for i in frase:
letra = i
if letra.isalpha():
letra_m = letra.upper()
if letra_m == letra.upper():
if letra == letra_m:
maiuscula += letra
print(maiuscula)
return maiuscula
maiusculas('Programamos em python 2?')
# deve devolver 'P'
maiusculas('Programamos em Python 3.')
# deve devolver 'PP'
maiusculas('PrOgRaMaMoS em python!')
# deve devolver 'PORMMS'
| 22.086957 | 39 | 0.588583 | 57 | 508 | 5.192982 | 0.421053 | 0.070946 | 0.233108 | 0.293919 | 0.138514 | 0.138514 | 0 | 0 | 0 | 0 | 0 | 0.005587 | 0.295276 | 508 | 22 | 40 | 23.090909 | 0.821229 | 0.116142 | 0 | 0.125 | 0 | 0 | 0.157303 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | false | 0 | 0 | 0 | 0.125 | 0.0625 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.