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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7d2644ca332886ab77c32e7e0f6f69055493b94f | 294 | py | Python | c_registry.py | shemerofir/skaffold-auto-docs | 20a05d79fd5df1e1ca8dc356c627dda06dd4720a | [
"MIT"
] | null | null | null | c_registry.py | shemerofir/skaffold-auto-docs | 20a05d79fd5df1e1ca8dc356c627dda06dd4720a | [
"MIT"
] | null | null | null | c_registry.py | shemerofir/skaffold-auto-docs | 20a05d79fd5df1e1ca8dc356c627dda06dd4720a | [
"MIT"
] | null | null | null | import sh
from dotenv import load_dotenv
import os
load_dotenv()
PASSWORD = os.environ.get("sudo_password")
def c_registry():
with sh.contrib.sudo(password=PASSWORD, _with=True):
sh.docker('run', '-d', '-p', '5000:5000', '--restart=always', '--name', 'registry', 'registry:2')
| 22.615385 | 105 | 0.670068 | 41 | 294 | 4.682927 | 0.609756 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035714 | 0.142857 | 294 | 12 | 106 | 24.5 | 0.72619 | 0 | 0 | 0 | 0 | 0 | 0.234694 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0.25 | 0.375 | 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 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 2 |
7d33735c0c3bfee8be88bd6f1998151e93fe43b3 | 273 | py | Python | answers/Utkarsh Srivastava/Day 12/Question 2.py | arc03/30-DaysOfCode-March-2021 | 6d6e11bf70280a578113f163352fa4fa8408baf6 | [
"MIT"
] | 22 | 2021-03-16T14:07:47.000Z | 2021-08-13T08:52:50.000Z | answers/Utkarsh Srivastava/Day 12/Question 2.py | arc03/30-DaysOfCode-March-2021 | 6d6e11bf70280a578113f163352fa4fa8408baf6 | [
"MIT"
] | 174 | 2021-03-16T21:16:40.000Z | 2021-06-12T05:19:51.000Z | answers/Utkarsh Srivastava/Day 12/Question 2.py | arc03/30-DaysOfCode-March-2021 | 6d6e11bf70280a578113f163352fa4fa8408baf6 | [
"MIT"
] | 135 | 2021-03-16T16:47:12.000Z | 2021-06-27T14:22:38.000Z | n = int(input())
c = [0]*n
for i in range(n):
l = int(input())
S = input()
for j in range(l):
if (S[j]=='0'):
continue
for k in range(j,l):
if (S[k]=='1'):
c[i] = c[i]+1
for i in range(n):
print(c[i])
| 19.5 | 29 | 0.388278 | 49 | 273 | 2.163265 | 0.346939 | 0.264151 | 0.113208 | 0.207547 | 0.226415 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02439 | 0.399267 | 273 | 13 | 30 | 21 | 0.621951 | 0 | 0 | 0.153846 | 0 | 0 | 0.007326 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.076923 | 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 |
7d4204253a754ba266b79ffa36682d9cb36d8ff0 | 1,860 | py | Python | ines.py | FlightDev/YSPA | 5226712ebf305e7a3c686c43c996517a617f748b | [
"MIT"
] | null | null | null | ines.py | FlightDev/YSPA | 5226712ebf305e7a3c686c43c996517a617f748b | [
"MIT"
] | null | null | null | ines.py | FlightDev/YSPA | 5226712ebf305e7a3c686c43c996517a617f748b | [
"MIT"
] | null | null | null | import rebound
import math
from visual import *
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
k = 0.01720209895
how_long = 600
start_pos = vector(0, 0, 1.5)
start_v = vector(0.7, 0.7, 0)
sim = rebound.Simulation()
#sun:
sim.add(m = 1.)
#asteroid:
sim.add(m = 0, x = start_pos.x, y = start_pos.y, z = start_pos.z, vx = start_v.x/k, vy = start_v.y/k, vz = start_v.z/k)
#earth:
sim.add(m = 0.000003003, x = 6.050702901916951E-01, y = -8.085113449604454E-01, z = -5.299403058075317E-05, vx = (1.352973714877966E-02)/k, vy = (1.017946114599288E-02)/k, vz = (2.635007516883264E-07)/k )
#jupiter:
sim.add(m = 0.0009543, x = -3.136171264149830E+00, y = -4.376868856434548E+00, z = 8.830403590272071E-02, vx = 6.044270575179947E-03/k, vy =-4.035730426004453E-03/k, vz = -1.184535381952951E-04/k)
#saturn:
sim.add(m =.0002857, x = 1.152370623788473E+00, y =-9.990803088412557E+00, z = 1.278423486688079E-01, vx = 5.235192499208867E-03/k, vy = 6.213724626462464E-04/k, vz = -2.191864499860967E-04/k )
sim.dt = 0.01
sim.move_to_com()
time = 0
end_time = 2.*math.pi*how_long
ps = sim.particles
#sim.integrate(end_time)
#earth position vector
r = vector (ps[1].x, ps[1].y, ps[1].z )
earth = vector (ps[2].x, ps[2].y, ps[2].z )
e_a_distance = mag(r) - mag(earth)
closest_distance = abs( mag(r) - mag(earth) )
closest_time = time#/k
while time < end_time:
sim.integrate(time)
r = vector(ps[1].x, ps[1].y, ps[1].z )
#see if asteroid hits the earth
earth = vector (ps[2].x, ps[2].y, ps[2].z )
e_a_distance = mag(r) - mag(earth)
if abs(e_a_distance) < closest_distance:
closest_distance = mag(e_a_distance)
closest_time = time#/k
rdot = vector(ps[1].vx, ps[1].vy, ps[1].vz )
time = time + 0.01
print "closest distance = ", closest_distance
print "time = ", closest_time
| 30 | 204 | 0.67043 | 331 | 1,860 | 3.673716 | 0.308157 | 0.022204 | 0.028783 | 0.019737 | 0.126645 | 0.105263 | 0.105263 | 0.105263 | 0.105263 | 0.105263 | 0 | 0.256575 | 0.161828 | 1,860 | 61 | 205 | 30.491803 | 0.523412 | 0.060215 | 0 | 0.210526 | 0 | 0 | 0.01496 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.157895 | null | null | 0.052632 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 |
7d4be85eed72cdda5ea7001420bb48d96b241f0b | 21,722 | py | Python | pysnmp/CHECKPOINT-TRAP-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/CHECKPOINT-TRAP-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/CHECKPOINT-TRAP-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 CHECKPOINT-TRAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CHECKPOINT-TRAP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:31:16 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")
ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint")
tempertureSensorStatus, haProblemVerified, fanSpeedSensorType, multiDiskFreeAvailablePercent, raidDiskID, memActiveReal64, haBlockState, haProblemPriority, voltageSensorName, svnNetIfState, fwLSConnState, fanSpeedSensorValue, haIfName, raidVolumeID, voltageSensorType, voltageSensorValue, raidDiskFlags, multiDiskName, fwLocalLoggingStat, fanSpeedSensorStatus, haIP, fanSpeedSensorUnit, tempertureSensorName, haTrusted, haStatShort, haStatus, multiProcIndex, svnNetIfName, haState, multiProcRunQueue, voltageSensorUnit, multiProcUsage, memTotalReal64, multiProcInterrupts, multiProcSystemTime, voltageSensorStatus, tempertureSensorUnit, haProblemStatus, tempertureSensorValue, fwLSConnOverall, fwLSConnStateDesc, fanSpeedSensorName, raidVolumeState, raidDiskVolumeID, fwLSConnOverallDesc, haIdentifier, memTotalVirtual64, memActiveVirtual64, raidDiskState, haStatCode, haStatLong, haProblemName, multiProcIdleTime, haProblemDescr, fwLSConnName, multiProcUserTime, fwLocalLoggingDesc, tempertureSensorType, haShared, svnNetIfAddress, svnNetIfOperState = mibBuilder.importSymbols("CHECKPOINT-MIB", "tempertureSensorStatus", "haProblemVerified", "fanSpeedSensorType", "multiDiskFreeAvailablePercent", "raidDiskID", "memActiveReal64", "haBlockState", "haProblemPriority", "voltageSensorName", "svnNetIfState", "fwLSConnState", "fanSpeedSensorValue", "haIfName", "raidVolumeID", "voltageSensorType", "voltageSensorValue", "raidDiskFlags", "multiDiskName", "fwLocalLoggingStat", "fanSpeedSensorStatus", "haIP", "fanSpeedSensorUnit", "tempertureSensorName", "haTrusted", "haStatShort", "haStatus", "multiProcIndex", "svnNetIfName", "haState", "multiProcRunQueue", "voltageSensorUnit", "multiProcUsage", "memTotalReal64", "multiProcInterrupts", "multiProcSystemTime", "voltageSensorStatus", "tempertureSensorUnit", "haProblemStatus", "tempertureSensorValue", "fwLSConnOverall", "fwLSConnStateDesc", "fanSpeedSensorName", "raidVolumeState", "raidDiskVolumeID", "fwLSConnOverallDesc", "haIdentifier", "memTotalVirtual64", "memActiveVirtual64", "raidDiskState", "haStatCode", "haStatLong", "haProblemName", "multiProcIdleTime", "haProblemDescr", "fwLSConnName", "multiProcUserTime", "fwLocalLoggingDesc", "tempertureSensorType", "haShared", "svnNetIfAddress", "svnNetIfOperState")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Counter32, NotificationType, iso, Integer32, IpAddress, TimeTicks, ObjectIdentity, Bits, Unsigned32, MibIdentifier, ModuleIdentity, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, enterprises = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "NotificationType", "iso", "Integer32", "IpAddress", "TimeTicks", "ObjectIdentity", "Bits", "Unsigned32", "MibIdentifier", "ModuleIdentity", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "enterprises")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
chkpntTrapMibModule = ModuleIdentity((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 0))
chkpntTrapMibModule.setRevisions(('2013-12-26 13:09',))
if mibBuilder.loadTexts: chkpntTrapMibModule.setLastUpdated('201312261309Z')
if mibBuilder.loadTexts: chkpntTrapMibModule.setOrganization('Check Point')
checkpoint = MibIdentifier((1, 3, 6, 1, 4, 1, 2620))
products = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1))
chkpntTrap = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000))
chkpntTrapInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0))
chkpntTrapNet = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1))
chkpntTrapDisk = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 2))
chkpntTrapCPU = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 3))
chkpntTrapMemory = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 4))
chkpntTrapHWSensor = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5))
chkpntTrapHA = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6))
chkpntTrapLSConn = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 7))
chkpntTrapOID = MibScalar((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 10), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chkpntTrapOID.setStatus('current')
chkpntTrapOIDValue = MibScalar((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 11), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chkpntTrapOIDValue.setStatus('current')
chkpntTrapMsgText = MibScalar((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 12), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chkpntTrapMsgText.setStatus('current')
chkpntTrapSeverity = MibScalar((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: chkpntTrapSeverity.setStatus('current')
chkpntTrapCategory = MibScalar((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 14), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chkpntTrapCategory.setStatus('current')
chkpntDiskSpaceTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 2, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "multiDiskName"), ("CHECKPOINT-MIB", "multiDiskFreeAvailablePercent"))
if mibBuilder.loadTexts: chkpntDiskSpaceTrap.setStatus('current')
chkpntRAIDVolumeTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 2, 2)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "raidVolumeID"), ("CHECKPOINT-MIB", "raidVolumeState"))
if mibBuilder.loadTexts: chkpntRAIDVolumeTrap.setStatus('current')
chkpntRAIDDiskTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 2, 3)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "raidDiskVolumeID"), ("CHECKPOINT-MIB", "raidDiskID"), ("CHECKPOINT-MIB", "raidDiskState"))
if mibBuilder.loadTexts: chkpntRAIDDiskTrap.setStatus('current')
chkpntRAIDDiskFlagsTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 2, 4)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "raidDiskVolumeID"), ("CHECKPOINT-MIB", "raidDiskID"), ("CHECKPOINT-MIB", "raidDiskState"), ("CHECKPOINT-MIB", "raidDiskFlags"))
if mibBuilder.loadTexts: chkpntRAIDDiskFlagsTrap.setStatus('current')
chkpntTrapNetIfState = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "svnNetIfName"), ("CHECKPOINT-MIB", "svnNetIfAddress"), ("CHECKPOINT-MIB", "svnNetIfState"))
if mibBuilder.loadTexts: chkpntTrapNetIfState.setStatus('current')
chkpntTrapNetIfUnplugged = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 2)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "svnNetIfName"), ("CHECKPOINT-MIB", "svnNetIfAddress"))
if mibBuilder.loadTexts: chkpntTrapNetIfUnplugged.setStatus('current')
chkpntTrapNewConnRate = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 3)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"))
if mibBuilder.loadTexts: chkpntTrapNewConnRate.setStatus('current')
chkpntTrapConcurrentConnRate = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 4)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"))
if mibBuilder.loadTexts: chkpntTrapConcurrentConnRate.setStatus('current')
chkpntTrapBytesThroughput = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 5)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"))
if mibBuilder.loadTexts: chkpntTrapBytesThroughput.setStatus('current')
chkpntTrapAcceptedPacketRate = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 6)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"))
if mibBuilder.loadTexts: chkpntTrapAcceptedPacketRate.setStatus('current')
chkpntTrapNetIfOperState = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 7)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "svnNetIfName"), ("CHECKPOINT-MIB", "svnNetIfAddress"), ("CHECKPOINT-MIB", "svnNetIfOperState"))
if mibBuilder.loadTexts: chkpntTrapNetIfOperState.setStatus('current')
chkpntCPUCoreUtilTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 3, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "multiProcIndex"), ("CHECKPOINT-MIB", "multiProcUserTime"), ("CHECKPOINT-MIB", "multiProcSystemTime"), ("CHECKPOINT-MIB", "multiProcIdleTime"), ("CHECKPOINT-MIB", "multiProcUsage"), ("CHECKPOINT-MIB", "multiProcRunQueue"), ("CHECKPOINT-MIB", "multiProcInterrupts"))
if mibBuilder.loadTexts: chkpntCPUCoreUtilTrap.setStatus('current')
chkpntCPUCoreInterruptsTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 3, 2)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "multiProcIndex"), ("CHECKPOINT-MIB", "multiProcUserTime"), ("CHECKPOINT-MIB", "multiProcSystemTime"), ("CHECKPOINT-MIB", "multiProcIdleTime"), ("CHECKPOINT-MIB", "multiProcUsage"), ("CHECKPOINT-MIB", "multiProcRunQueue"), ("CHECKPOINT-MIB", "multiProcInterrupts"))
if mibBuilder.loadTexts: chkpntCPUCoreInterruptsTrap.setStatus('current')
chkpntSwapMemoryTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 4, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "memTotalVirtual64"), ("CHECKPOINT-MIB", "memActiveVirtual64"))
if mibBuilder.loadTexts: chkpntSwapMemoryTrap.setStatus('current')
chkpntRealMemoryTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 4, 2)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "memTotalReal64"), ("CHECKPOINT-MIB", "memActiveReal64"))
if mibBuilder.loadTexts: chkpntRealMemoryTrap.setStatus('current')
chkpntTrapTempertureSensor = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 1))
chkpntTrapFanSpeedSensor = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 2))
chkpntTrapVoltageSensor = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 3))
chkpntTempertureTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 1, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "tempertureSensorName"), ("CHECKPOINT-MIB", "tempertureSensorValue"), ("CHECKPOINT-MIB", "tempertureSensorUnit"), ("CHECKPOINT-MIB", "tempertureSensorType"), ("CHECKPOINT-MIB", "tempertureSensorStatus"))
if mibBuilder.loadTexts: chkpntTempertureTrap.setStatus('current')
chkpntFanSpeedTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 2, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "fanSpeedSensorName"), ("CHECKPOINT-MIB", "fanSpeedSensorValue"), ("CHECKPOINT-MIB", "fanSpeedSensorUnit"), ("CHECKPOINT-MIB", "fanSpeedSensorType"), ("CHECKPOINT-MIB", "fanSpeedSensorStatus"))
if mibBuilder.loadTexts: chkpntFanSpeedTrap.setStatus('current')
chkpntVoltageTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 3, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "voltageSensorName"), ("CHECKPOINT-MIB", "voltageSensorValue"), ("CHECKPOINT-MIB", "voltageSensorUnit"), ("CHECKPOINT-MIB", "voltageSensorType"), ("CHECKPOINT-MIB", "voltageSensorStatus"))
if mibBuilder.loadTexts: chkpntVoltageTrap.setStatus('current')
chkpntClusterMemberStateTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "haIdentifier"), ("CHECKPOINT-MIB", "haState"))
if mibBuilder.loadTexts: chkpntClusterMemberStateTrap.setStatus('current')
chkpntClusterBlockStateTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6, 2)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "haIdentifier"), ("CHECKPOINT-MIB", "haBlockState"), ("CHECKPOINT-MIB", "haState"))
if mibBuilder.loadTexts: chkpntClusterBlockStateTrap.setStatus('current')
chkpntClusterStateTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6, 3)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "haIdentifier"), ("CHECKPOINT-MIB", "haBlockState"), ("CHECKPOINT-MIB", "haState"), ("CHECKPOINT-MIB", "haStatCode"), ("CHECKPOINT-MIB", "haStatShort"), ("CHECKPOINT-MIB", "haStatLong"))
if mibBuilder.loadTexts: chkpntClusterStateTrap.setStatus('current')
chkpntClusterProblemStateTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6, 4)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "haProblemName"), ("CHECKPOINT-MIB", "haProblemStatus"), ("CHECKPOINT-MIB", "haProblemPriority"), ("CHECKPOINT-MIB", "haProblemVerified"), ("CHECKPOINT-MIB", "haProblemDescr"))
if mibBuilder.loadTexts: chkpntClusterProblemStateTrap.setStatus('current')
chkpntClusterInterfaceStateTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6, 5)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "haIfName"), ("CHECKPOINT-MIB", "haIP"), ("CHECKPOINT-MIB", "haStatus"), ("CHECKPOINT-MIB", "haTrusted"), ("CHECKPOINT-MIB", "haShared"))
if mibBuilder.loadTexts: chkpntClusterInterfaceStateTrap.setStatus('current')
chkpntTrapLSConnState = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 7, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "fwLSConnName"), ("CHECKPOINT-MIB", "fwLSConnState"), ("CHECKPOINT-MIB", "fwLSConnStateDesc"), ("CHECKPOINT-MIB", "fwLocalLoggingDesc"), ("CHECKPOINT-MIB", "fwLocalLoggingStat"))
if mibBuilder.loadTexts: chkpntTrapLSConnState.setStatus('current')
chkpntTrapOverallLSConnState = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 7, 2)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "fwLSConnOverall"), ("CHECKPOINT-MIB", "fwLSConnOverallDesc"), ("CHECKPOINT-MIB", "fwLocalLoggingDesc"), ("CHECKPOINT-MIB", "fwLocalLoggingStat"))
if mibBuilder.loadTexts: chkpntTrapOverallLSConnState.setStatus('current')
chkpntTrapLocalLoggingState = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 7, 3)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "fwLSConnOverall"), ("CHECKPOINT-MIB", "fwLSConnOverallDesc"), ("CHECKPOINT-MIB", "fwLocalLoggingDesc"), ("CHECKPOINT-MIB", "fwLocalLoggingStat"))
if mibBuilder.loadTexts: chkpntTrapLocalLoggingState.setStatus('current')
mibBuilder.exportSymbols("CHECKPOINT-TRAP-MIB", chkpntTrapBytesThroughput=chkpntTrapBytesThroughput, chkpntClusterBlockStateTrap=chkpntClusterBlockStateTrap, chkpntTrap=chkpntTrap, chkpntRAIDDiskTrap=chkpntRAIDDiskTrap, chkpntCPUCoreInterruptsTrap=chkpntCPUCoreInterruptsTrap, chkpntTempertureTrap=chkpntTempertureTrap, chkpntTrapConcurrentConnRate=chkpntTrapConcurrentConnRate, chkpntTrapNewConnRate=chkpntTrapNewConnRate, chkpntFanSpeedTrap=chkpntFanSpeedTrap, chkpntSwapMemoryTrap=chkpntSwapMemoryTrap, chkpntVoltageTrap=chkpntVoltageTrap, chkpntTrapFanSpeedSensor=chkpntTrapFanSpeedSensor, chkpntCPUCoreUtilTrap=chkpntCPUCoreUtilTrap, chkpntTrapMsgText=chkpntTrapMsgText, checkpoint=checkpoint, chkpntRealMemoryTrap=chkpntRealMemoryTrap, chkpntTrapOID=chkpntTrapOID, chkpntTrapSeverity=chkpntTrapSeverity, chkpntClusterStateTrap=chkpntClusterStateTrap, chkpntTrapOverallLSConnState=chkpntTrapOverallLSConnState, chkpntTrapTempertureSensor=chkpntTrapTempertureSensor, chkpntClusterProblemStateTrap=chkpntClusterProblemStateTrap, chkpntClusterInterfaceStateTrap=chkpntClusterInterfaceStateTrap, chkpntTrapHWSensor=chkpntTrapHWSensor, chkpntTrapCategory=chkpntTrapCategory, chkpntTrapLocalLoggingState=chkpntTrapLocalLoggingState, chkpntTrapLSConnState=chkpntTrapLSConnState, chkpntTrapLSConn=chkpntTrapLSConn, chkpntTrapMibModule=chkpntTrapMibModule, chkpntTrapMemory=chkpntTrapMemory, chkpntTrapNetIfUnplugged=chkpntTrapNetIfUnplugged, chkpntTrapCPU=chkpntTrapCPU, chkpntDiskSpaceTrap=chkpntDiskSpaceTrap, products=products, chkpntTrapNet=chkpntTrapNet, chkpntTrapAcceptedPacketRate=chkpntTrapAcceptedPacketRate, chkpntTrapNetIfOperState=chkpntTrapNetIfOperState, chkpntTrapNetIfState=chkpntTrapNetIfState, chkpntTrapOIDValue=chkpntTrapOIDValue, chkpntRAIDVolumeTrap=chkpntRAIDVolumeTrap, chkpntClusterMemberStateTrap=chkpntClusterMemberStateTrap, chkpntTrapInfo=chkpntTrapInfo, chkpntRAIDDiskFlagsTrap=chkpntRAIDDiskFlagsTrap, chkpntTrapHA=chkpntTrapHA, chkpntTrapVoltageSensor=chkpntTrapVoltageSensor, chkpntTrapDisk=chkpntTrapDisk, PYSNMP_MODULE_ID=chkpntTrapMibModule)
| 226.270833 | 2,269 | 0.768115 | 1,991 | 21,722 | 8.379206 | 0.112506 | 0.111611 | 0.135527 | 0.011029 | 0.619373 | 0.605047 | 0.589163 | 0.589163 | 0.587784 | 0.58137 | 0 | 0.043867 | 0.063898 | 21,722 | 95 | 2,270 | 228.652632 | 0.776581 | 0.015284 | 0 | 0 | 0 | 0 | 0.41462 | 0.008793 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.079545 | 0 | 0.079545 | 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 |
7d4c5d1e663bf350e478bc71a505fc49721c08e6 | 452 | py | Python | assistant/tests/internetcheck.py | SPARC-Auburn/Lab-Assistant | f86577f4ea53297f3c9febb84d967650d7196e61 | [
"Apache-2.0"
] | 9 | 2017-09-06T13:23:32.000Z | 2020-07-19T17:05:23.000Z | assistant/tests/internetcheck.py | SPARC-Auburn/Lab-Assistant | f86577f4ea53297f3c9febb84d967650d7196e61 | [
"Apache-2.0"
] | 29 | 2017-09-06T21:50:08.000Z | 2017-12-07T00:37:57.000Z | assistant/tests/internetcheck.py | SPARC-Auburn/Lab-Assistant | f86577f4ea53297f3c9febb84d967650d7196e61 | [
"Apache-2.0"
] | 6 | 2016-11-20T01:01:55.000Z | 2019-10-16T16:29:33.000Z | import socket
def is_connected():
REMOTE_SERVER = "www.google.com"
try:
# see if we can resolve the host name -- tells us if there is
# a DNS listening
host = socket.gethostbyname(REMOTE_SERVER)
# connect to the host -- tells us if the host is actually
# reachable
s = socket.create_connection((host, 80), 2)
return True
except:
pass
return False
print is_connected()
| 22.6 | 69 | 0.615044 | 60 | 452 | 4.55 | 0.683333 | 0.076923 | 0.065934 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009677 | 0.314159 | 452 | 19 | 70 | 23.789474 | 0.870968 | 0.311947 | 0 | 0 | 0 | 0 | 0.045752 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.090909 | 0.090909 | 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 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
ada6f90acad0fa32bb41de1376f5746034781a3d | 9,746 | py | Python | main.py | ItsTato/proctrl | 079516e859f777f8698ad9c649fc23ecc1bde48d | [
"MIT"
] | 1 | 2021-09-20T00:32:53.000Z | 2021-09-20T00:32:53.000Z | main.py | ItsTato/proctrl | 079516e859f777f8698ad9c649fc23ecc1bde48d | [
"MIT"
] | null | null | null | main.py | ItsTato/proctrl | 079516e859f777f8698ad9c649fc23ecc1bde48d | [
"MIT"
] | null | null | null | """
MIT License
Copyright (c) 2022 ItsTato
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
import json
import os
print("Loading user config.")
if os.path.exists("config.json") == False:
print("No config file found, ending.")
import sys
sys.exit(0)
with open("config.json") as json_file:
data = json.load(json_file)
you = data["username"]
prefix = data["prefix"]
token = data["token"]
status = data["status"]
guild_id = data["guild"]
client_id = data["client_id"]
PanelPort = data["dashport"]
json_file.close()
print('Importing modules 0/100%')
from discord.ext import commands
from discord.ext.commands import has_permissions
import discord,psutil,sys,threading,platform,socket,datetime
from tabulate import *
from flask import *
print('Importing modules 100/100%')
print(f'Setting prefix to {prefix}, making "client" definition, making "site" definition. 0/100%')
client = commands.Bot(command_prefix=str(prefix), intents=discord.Intents.all(),case_insensitive=True,strip_after_prefix=True)
site = Flask(__name__)
site.config["SECRET_KEY"] = "qIBcq3KHRSwwmBulnJxpmZOTD8zCcEHIAPOck2ieUHoB2mKcrY91uSoIrsGvgsLScrMf8poop1OCH5uVZsEeK2I0oio2RL933bLoK2qDMtvuwASypHxgTSZmm01I5MmRsk2oEsUCh1T03UnISLWazuGGmwoUvLx77lsYvJqcJW5VvZlY9YdgAMuzGdroNp638QlQsGYnLKJsJnr1vg0MRl6ixMpSGYop02yiQMmA4NMERd1SmkL25AuAhIHuXcaIeXPibbzNzBTejtWLMPBcustlADmKEkJMtXLtiet6MWka3iFbdApiySHw39otrc541oj3nD91gmQl0RXL6aJkp0wS7F4zE7xWSrhpmiS6VSwn1rKpmyClBRyAX5BBmGO1QBlPBzO7JxcTtXngPaWG7LQNrUCDRZE7yattXPgKZNXN3EJlV0hYwkexV7wpEaPYDDU6PRpATCyZUNWD6C2lDyxWL2aKNxIoKcKDvjIxtsly9n09PQ3qJBl1WAaLHsIvJkgK5SF2lkr0pTySh6eWes3znMqIBPN0GOfewGbXl1e6vYcu5mqVI4rnyqd7qqFdEJtMNxYoNh6pJcE5JVWdow1TG97fV8RxeEKnv1PcQTy3W3Naym4L6Z1FJqLtmJyoW6SHUBudWg6A4O3cXRvU8gkcCBpz8plNojnIhHQ5TqphJIL1IbX3tJCY72UGEbrQURnITAjZnPDV1wwdD1i8S2zlKL8LkKsehUURei2uqOgM9qAm8PGaMFsFZK6dUpiT9tlUDjmRjbKRJCKF6HwgYGkqpZlkkP32o84s2QYlgv9CncxvtbnlYoXf6Sa8LkhV0SFiGoivJHH0iZb886otY1zxBEofz06WcNj1gKUMgz0J2uEKhSM3sheVVZ6kbmIakVKcjdkEb3AeO4pGNhgtnYNPZlaC772pPhTNZkwDWM074Ede8BdavK8Ll8HZiTIyuGnWNKktN6VZ8cBwi33UywkUJHdDtZCv9VqO2VlTAC8kANQncA1U4b4E3GomrFWV1VicWyBCfdWf8HQFaZrvBhgtZSBkQNMWqfXrL1wwB3w6owcnRS424ne9qRHrKZY1juNzI18l6qJRntu0rq4LnNHe295SuyhUFywFWie6exTYiLMmHsgcrguIwNYhOqp2H7jiQH83s4G00G1E0SohU57oCqWKSNXzYg1zzhMf5i3EXdTYulFLYhawWbTg5umnyflxOkrMQnHreP1gygYj6tsYHNAIogonOKz1bQW2U5fGFo02Xop3hrEaxsF3YjSetxQakqOJjBY7wIedJYGwvLsw53ljzHTKDGYSydHGbiEcIUyt2TaelOQwsWjKO5fQH9lgJjfb4dIA83mpIcaoGYgVjV9yM0JMvVn8GjqaR1wq6HThz1tM0Q2znvnbkj9XjM4Z6D0tp6nnZxfRFJS4KZnswbwhCYpqIwZKq0dz6CyC1Dbo6XTRdJcwnXMyZJbmAi0w82BjyzGTSxjLnotRSfUWGseH3Pny5lXSsoud8Tnw459jmXop2988XqdLWsXlI55mUovzSsOnNbZVycX4169aYVZX4lSIRzdclf7KH1PGW1n3WJy9HV3bIEaeam5HHGiH25yfSGvVbhgTfUPV1yhk9SDwuWRasK74mPl55Yib7bv0PzQx1ORNLqY4DevPnOUjOk6q1IKnVvGrwMzUqfiyHCxOwfwn2D8PJS0faToJkvgsygomhm0iA4sUTxwsMYK4j7vmafZQp952X3WdTNZpZNyy9TzIOS8EcQaNDiswP4uV0JxUjFghSVbTgKUhrxK4W4UpzgFboxwyZM8ZKZBx1tk26pgstf2DGm9hUhhEM7TgFxEF7xyCD60pwIo0Csf7Q65KvaTqfiEeGMp4HmKIhiJ7BrBViP5cj2WqYAqNzFqUaXanUX6GDaiiWYCFtYgdDhg9AIxbBMJYroBNUT2UphAKnhbNAYq4Dnovhu9YqHDr7mECGsp5449POELlqTyfxlO8aLiLalKzE6OoRWbfNuzEJKuWayDwCYWYn2FIHgX1kBRxQFwNnGjnVGQe"
print(f'Setting prefix to {prefix}, making "client" definition, making "site" definition. 100/100%')
def convertSize(bytes, suffix="B"):
for unit in ["", "K", "M", "G", "T", "P"]:
if bytes < 1024:
return {"value":f"{bytes:.2f}","unit":f"{unit}{suffix}"}
bytes /= 1024
def restart():
f = os
a = f.system
a("shutdown /r /t 1")
def shutdown():
f = os
a = f.system
a("shutdown /s /t 1")
# Web Panel
@site.route('/panel', methods=['GET'])
def panelSite():
cpuData=[]
for i, percentage in enumerate(psutil.cpu_percent(percpu=True,interval=1)):
core_name = f"#{i}"
core_usage = f"{percentage}%"
cpuData.append((
core_name,
core_usage
))
return render_template(
"panel.html",
systemNickname=you,
activePythonThreads=threading.active_count(),
latency=round(client.latency*1000),
day=datetime.datetime.fromtimestamp(psutil.boot_time()).day,
month=datetime.datetime.fromtimestamp(psutil.boot_time()).month,
year=datetime.datetime.fromtimestamp(psutil.boot_time()).year,
hour=datetime.datetime.fromtimestamp(psutil.boot_time()).hour,
minute=datetime.datetime.fromtimestamp(psutil.boot_time()).minute,
second=datetime.datetime.fromtimestamp(psutil.boot_time()).second,
systemName=platform.uname().system,
nodeName=platform.uname().node,
release=platform.uname().release,
version=platform.uname().version,
machine=platform.uname().machine,
processor=platform.uname().processor,
cpuCores=psutil.cpu_count(logical=False),
cpuLogicalCores=psutil.cpu_count(logical=True),
cpuMaxFreq=f"{psutil.cpu_freq().max:.2f}",
cpuMinFreq=f"{psutil.cpu_freq().min:.2f}",
cpuCurFreq=f"{psutil.cpu_freq().current:.2f}",
cpuCoreUsage=tabulate(cpuData,headers=("Core #", "Usage %")),
cpuUsage=psutil.cpu_percent(),
memoryTotal=convertSize(psutil.virtual_memory().total)["value"],
memoryTotalUnit=convertSize(psutil.virtual_memory().total)["unit"],
memoryAvailable=convertSize(psutil.virtual_memory().available)["value"],
memoryAvailableUnit=convertSize(psutil.virtual_memory().available)["unit"],
memoryUsed=convertSize(psutil.virtual_memory().used)["value"],
memoryUsedUnit=convertSize(psutil.virtual_memory().used)["unit"],
memoryUsage=psutil.virtual_memory().percent,
swapTotal=convertSize(psutil.swap_memory().total)["value"],
swapTotalUnit=convertSize(psutil.swap_memory().total)["unit"],
swapAvailable=convertSize(psutil.swap_memory().free)["value"],
swapAvailableUnit=convertSize(psutil.swap_memory().free)["unit"],
swapUsed=convertSize(psutil.swap_memory().used)["value"],
swapUsedUnit=convertSize(psutil.swap_memory().used)["unit"],
swapUsage=psutil.swap_memory().percent
)
@site.route('/panel/controls', methods=['GET'])
def controlsSite():
return render_template(
"controls.html",
systemNickname=you
)
@site.route('/panel/controls', methods=['POST'])
def panelSite_post():
try:
if(not request.form["commandVal"]==None):
f = os
a = f.system
a(str(request.form["commandVal"]))
return redirect('/panel/controls')
except:
if(not request.form["evalpythonVal"]==None):
try:
exec(str(request.form["evalpythonVal"]))
except:
print("Oopsie UwU")
return redirect('/panel/controls')
@site.route('/panel/controls/shutdown')
def shutdownSite():
shutdown()
return redirect('/controls',302)
@site.route('/panel/controls/restart')
def restartSite():
restart()
return redirect('/controls',302)
def flaskThread():
global panelStatus
panelStatus = True
site.run(host="0.0.0.0",port=PanelPort,debug=False)
# Discord Bot
@client.event
async def on_ready():
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name=status))
print('Launching BOT 100/100%')
@client.event
async def on_command_error(ctx, error):
embedVar = discord.Embed(title="Failure", description="", color=0x2F3136)
embedVar.add_field(name=f"Failed to execute action", value=f"Error: `{error}`")
await ctx.reply(embed=embedVar, mention_author=True)
@client.command(aliases=['runBash'])
async def bash(ctx,*,cmd):
f = os
a = f.system
await ctx.send(content=a(cmd))
@client.command(aliases=['run','runCode','runEval'])
async def eval(ctx,*,cmd):
exec(cmd)
await ctx.send(content=f"Ran code: ```{cmd}```")
@client.command(aliases=["information","botinfo","botinformation", "sysinfo", "systeminfo", "systeminformation", "sysinformation"])
async def info(ctx):
embedVar = discord.Embed(title="ProCTRL", description=" ", color=0x2F3136)
embedVar.add_field(name=f"Python", value=f"Active Python Threads: {threading.active_count()}",inline=True)
embedVar.add_field(name=f"Discord Bot", value=f"Ping: {round(client.latency*1000)}ms",inline=True)
embedVar.add_field(name=f"Web Panel", value=f"Panel Online: {panelStatus}\nLocal IP Address: [{str(socket.gethostbyname(str(socket.gethostname())))}](http://{str(socket.gethostbyname(str(socket.gethostname())))}:{str(PanelPort)}/panel)\nPort: {str(PanelPort)}",inline=True)
await ctx.reply(embed=embedVar, mention_author=True)
print('Launching BOT 0/100%')
threading.Thread(target=flaskThread).start()
client.run(token)
| 47.77451 | 2,078 | 0.754566 | 960 | 9,746 | 7.595833 | 0.359375 | 0.027976 | 0.018239 | 0.028799 | 0.176221 | 0.105595 | 0.057049 | 0.043061 | 0.018925 | 0.018925 | 0 | 0.047535 | 0.132259 | 9,746 | 203 | 2,079 | 48.009852 | 0.81471 | 0.11143 | 0 | 0.144737 | 0 | 0.019737 | 0.395421 | 0.258527 | 0 | 1 | 0.00185 | 0 | 0 | 1 | 0.059211 | false | 0 | 0.065789 | 0.006579 | 0.171053 | 0.059211 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ada7230865bf42e4c71fa3e36acd38626d2760ea | 365 | py | Python | egs/wsj/s5/steps/libs/nnet3/train/__init__.py | TiagoPellegrini/Kaldi | 8a7918f132c0385c9e922126ecad9c3aa48b5706 | [
"Apache-2.0"
] | null | null | null | egs/wsj/s5/steps/libs/nnet3/train/__init__.py | TiagoPellegrini/Kaldi | 8a7918f132c0385c9e922126ecad9c3aa48b5706 | [
"Apache-2.0"
] | null | null | null | egs/wsj/s5/steps/libs/nnet3/train/__init__.py | TiagoPellegrini/Kaldi | 8a7918f132c0385c9e922126ecad9c3aa48b5706 | [
"Apache-2.0"
] | null | null | null |
# Copyright 2016 Vimal Manohar
# Apache 2.0
""" This library has classes and methods commonly used for training nnet3
neural networks.
It has separate submodules for frame-level objectives and chain objective:
frame_level_objf -- For both recurrent and non-recurrent architectures
chain_objf -- LF-MMI objective training
"""
import common
__all__ = ["common"]
| 22.8125 | 74 | 0.783562 | 51 | 365 | 5.470588 | 0.745098 | 0.071685 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022654 | 0.153425 | 365 | 15 | 75 | 24.333333 | 0.880259 | 0.860274 | 0 | 0 | 0 | 0 | 0.146341 | 0 | 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 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
ada8e3e91d5ceb281c58cfe996d8f629dc28e927 | 6,566 | py | Python | ooobuild/lo/rendering/x_sprite.py | Amourspirit/ooo_uno_tmpl | 64e0c86fd68f24794acc22d63d8d32ae05dd12b8 | [
"Apache-2.0"
] | null | null | null | ooobuild/lo/rendering/x_sprite.py | Amourspirit/ooo_uno_tmpl | 64e0c86fd68f24794acc22d63d8d32ae05dd12b8 | [
"Apache-2.0"
] | null | null | null | ooobuild/lo/rendering/x_sprite.py | Amourspirit/ooo_uno_tmpl | 64e0c86fd68f24794acc22d63d8d32ae05dd12b8 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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.
#
# Interface Class
# this is a auto generated file generated by Cheetah
# Libre Office Version: 7.3
# Namespace: com.sun.star.rendering
import typing
from abc import abstractmethod
from ..uno.x_interface import XInterface as XInterface_8f010a43
if typing.TYPE_CHECKING:
from ..geometry.affine_matrix2_d import AffineMatrix2D as AffineMatrix2D_ff040da8
from ..geometry.real_point2_d import RealPoint2D as RealPoint2D_d6e70c78
from .render_state import RenderState as RenderState_e4490d27
from .view_state import ViewState as ViewState_cab30c62
from .x_poly_polygon2_d import XPolyPolygon2D as XPolyPolygon2D_e1b0e20
class XSprite(XInterface_8f010a43):
"""
Interface to control a sprite object.
This is the basic interface to control a sprite object on a XSpriteCanvas. Sprites are moving, back-buffered objects.
See Also:
`API XSprite <https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1rendering_1_1XSprite.html>`_
"""
__ooo_ns__: str = 'com.sun.star.rendering'
__ooo_full_ns__: str = 'com.sun.star.rendering.XSprite'
__ooo_type_name__: str = 'interface'
__pyunointerface__: str = 'com.sun.star.rendering.XSprite'
@abstractmethod
def clip(self, aClip: 'XPolyPolygon2D_e1b0e20') -> None:
"""
Apply a clipping to the shape output.
The given clip poly-polygon is always interpreted in device coordinate space. As the sprite has its own local coordinate system, with its origin on screen being equal to its current position, the clip poly-polygon's origin will always coincide with the sprite's origin. Furthermore, if any sprite transformation is set via transform(), the clip is subject to this transformation, too. The implementation is free, if it has a cached representation of the sprite at hand, to clip-output only this cached representation (e.g. a bitmap), instead of re-rendering the sprite from first principles. This is usually the case for an implementation of a XCustomSprite interface, since it typically has no other cached pictorial information at hand.
Please note that if this sprite is not animated, the associated XSpriteCanvas does not update changed sprites automatically, but has to be told to do so via XSpriteCanvas.updateScreen().
Specifying an empty interface denotes no clipping, i.e. everything contained in the sprite will be visible (subject to device-dependent constraints, of course). Specifying an empty XPolyPolygon2D, i.e. a poly-polygon containing zero polygons, or an XPolyPolygon2D with any number of empty sub-polygons, denotes the NULL clip. That means, nothing from the sprite will be visible.
"""
@abstractmethod
def hide(self) -> None:
"""
Make the sprite invisible.
This method makes the sprite invisible.
"""
@abstractmethod
def move(self, aNewPos: 'RealPoint2D_d6e70c78', aViewState: 'ViewState_cab30c62', aRenderState: 'RenderState_e4490d27') -> None:
"""
Move sprite to the specified position.
The position specified here is first transformed by the combined view and render transformation. The resulting position is then used as the output position (also in device coordinates) of the rendered sprite content.
Please note that if this sprite is not animated, the associated XSpriteCanvas does not update changed sprites automatically, but has to be told to do so via XSpriteCanvas.updateScreen().
Raises:
com.sun.star.lang.IllegalArgumentException: ``IllegalArgumentException``
"""
@abstractmethod
def setAlpha(self, nAlpha: float) -> None:
"""
Set overall transparency of the sprite.
This method is useful for e.g. fading in/out of animations.
Please note that if this sprite is not animated, the associated XSpriteCanvas does not update changed sprites automatically, but has to be told to do so via XSpriteCanvas.updateScreen().
Raises:
com.sun.star.lang.IllegalArgumentException: ``IllegalArgumentException``
"""
@abstractmethod
def setPriority(self, nPriority: float) -> None:
"""
Set sprite priority.
The sprite priority determines the order of rendering relative to all other sprites of the associated canvas. The higher the priority, the later will the sprite be rendered, or, in other words, the closer to the screen surface the sprite is shown.
"""
@abstractmethod
def show(self) -> None:
"""
Make the sprite visible.
This method makes the sprite visible on the canvas it was created on.
"""
@abstractmethod
def transform(self, aTransformation: 'AffineMatrix2D_ff040da8') -> None:
"""
Apply a local transformation to the sprite.
The given transformation matrix locally transforms the sprite shape. If this transformation contains translational components, be aware that sprite content moved beyond the sprite area (a box from (0,0) to (spriteWidth,spriteHeight)) might (but need not) be clipped. Use XSprite.move() to change the sprite location on screen. The canvas implementations are free, if they have a cached representation of the sprite at hand, to transform only this cached representation (e.g. a bitmap), instead of re-rendering the sprite from first principles. This is usually the case for an implementation of a XCustomSprite interface, since it typically has no other cached pictorial information at hand.
Please note that if this sprite is not animated, the associated XSpriteCanvas does not update changed sprites automatically, but has to be told to do so via XSpriteCanvas.updateScreen().
Raises:
com.sun.star.lang.IllegalArgumentException: ``IllegalArgumentException``
"""
__all__ = ['XSprite']
| 56.603448 | 746 | 0.730429 | 882 | 6,566 | 5.373016 | 0.351474 | 0.037983 | 0.014771 | 0.016037 | 0.342688 | 0.314412 | 0.283604 | 0.283604 | 0.283604 | 0.266723 | 0 | 0.017943 | 0.210631 | 6,566 | 115 | 747 | 57.095652 | 0.896392 | 0.713829 | 0 | 0.241379 | 0 | 0 | 0.140954 | 0.08906 | 0 | 0 | 0 | 0 | 0 | 1 | 0.241379 | false | 0 | 0.275862 | 0 | 0.689655 | 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 |
adabd3e05885daf5de02dbd612d161741ede8bf7 | 548 | py | Python | my_shelter/dog_shelters/serializers.py | seajhawk/DjangoCRUD | 215317e65f6775ea06ffbadf52794b082e5cd978 | [
"CC-BY-4.0",
"MIT"
] | null | null | null | my_shelter/dog_shelters/serializers.py | seajhawk/DjangoCRUD | 215317e65f6775ea06ffbadf52794b082e5cd978 | [
"CC-BY-4.0",
"MIT"
] | null | null | null | my_shelter/dog_shelters/serializers.py | seajhawk/DjangoCRUD | 215317e65f6775ea06ffbadf52794b082e5cd978 | [
"CC-BY-4.0",
"MIT"
] | null | null | null | from rest_framework import serializers
from . import models
class ShelterSerializer(serializers.ModelSerializer):
class Meta:
model = models.Shelter
fields = ('name',
'location')
class DogSerializer(serializers.ModelSerializer):
class Meta:
model = models.Dog
fields = ('shelter',
'name',
'description',
'intake_date')
class ErrorSerializer(serializers.Serializer):
error_message = serializers.CharField(max_length=200)
| 24.909091 | 57 | 0.614964 | 46 | 548 | 7.23913 | 0.608696 | 0.156156 | 0.186186 | 0.21021 | 0.276276 | 0.276276 | 0 | 0 | 0 | 0 | 0 | 0.007833 | 0.301095 | 548 | 21 | 58 | 26.095238 | 0.861619 | 0 | 0 | 0.125 | 0 | 0 | 0.082117 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.5 | 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 |
adb4718bc3b46e088dbc8adf3af6ee95f2ddf3e1 | 954 | py | Python | pyschool/static/libs/importhooks/FileSystemHook.py | niansa/brython-in-the-classroom | a1f132898ed1afd1d1baf8170b99e58e39e87912 | [
"MIT"
] | 14 | 2016-03-16T18:01:52.000Z | 2021-09-24T14:07:20.000Z | pyschool/static/libs/importhooks/FileSystemHook.py | niansa/brython-in-the-classroom | a1f132898ed1afd1d1baf8170b99e58e39e87912 | [
"MIT"
] | 9 | 2015-03-31T00:31:26.000Z | 2021-05-28T06:24:16.000Z | pyschool/static/libs/importhooks/FileSystemHook.py | niansa/brython-in-the-classroom | a1f132898ed1afd1d1baf8170b99e58e39e87912 | [
"MIT"
] | 7 | 2015-05-04T04:06:04.000Z | 2020-10-28T09:54:07.000Z | import BaseHook
from browser import window
from javascript import JSObject
import sys
sys.path.append("../FileSystem")
import FileObject
#define my custom import hook (just to see if it get called etc).
class FileSystemHook(BaseHook.BaseHook):
def __init__(self, fullname, path):
BaseHook.BaseHook.__init__(self, fullname, path)
if not path.startswith('/pyschool'):
raise ImportError
def find_module(self):
if not self._path.startswith('/pyschool'):
raise ImportError
fs=JSObject(window._FS)
for _ext in ('.py', '/__init__.py'):
self._modpath='%s/%s%s' % (self._path, self._fullname, _ext)
_msg=fs._read_file(self._modpath)
if _msg['status'] == 'Okay':
self._module=_msg['fileobj'].get_attribute('contents')
return self
#if we got here, we couldn't find the module
raise ImportError
sys.meta_path.append(FileSystemHook)
| 26.5 | 70 | 0.662474 | 121 | 954 | 4.983471 | 0.495868 | 0.059701 | 0.053068 | 0.066335 | 0.126036 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.224319 | 954 | 35 | 71 | 27.257143 | 0.814865 | 0.112159 | 0 | 0.130435 | 0 | 0 | 0.092308 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.086957 | false | 0 | 0.347826 | 0 | 0.521739 | 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 |
adc6094a6d2837ad691dd4b73802f81c13e2f5a2 | 1,045 | py | Python | spotty/config/abstract_instance_config.py | Inculus/spotty | 56863012668a6c13ad13c2a04f900047e229fbe6 | [
"MIT"
] | 1 | 2020-07-17T07:02:09.000Z | 2020-07-17T07:02:09.000Z | spotty/config/abstract_instance_config.py | Inculus/spotty | 56863012668a6c13ad13c2a04f900047e229fbe6 | [
"MIT"
] | null | null | null | spotty/config/abstract_instance_config.py | Inculus/spotty | 56863012668a6c13ad13c2a04f900047e229fbe6 | [
"MIT"
] | null | null | null | from abc import ABC
class AbstractInstanceConfig(ABC):
def __init__(self, config: dict):
self._name = config['name']
self._provider_name = config['provider']
self._params = config['parameters']
@property
def name(self) -> str:
"""Name of the instance."""
return self._name
@property
def provider_name(self):
"""Provider name."""
return self._provider_name
@property
def volumes(self) -> list:
"""List of volume configs."""
return self._params['volumes']
@property
def docker_data_root(self) -> str:
"""Data root directory for Docker daemon."""
return self._params['dockerDataRoot']
@property
def local_ssh_port(self) -> int:
"""Local SSH port to connect to the instance (in case of a tunnel)."""
return self._params['localSshPort']
@property
def commands(self) -> str:
"""Commands that should be run once an instance is started."""
return self._params['commands']
| 26.125 | 78 | 0.61244 | 121 | 1,045 | 5.123967 | 0.421488 | 0.106452 | 0.103226 | 0.064516 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.266986 | 1,045 | 39 | 79 | 26.794872 | 0.809399 | 0.211483 | 0 | 0.25 | 0 | 0 | 0.079445 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.291667 | false | 0 | 0.041667 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
adc70061227488de161786ea30ee1410bc56c27d | 157 | py | Python | scripts/helper.py | skurscheid/camda2019-workflows | 45b10ef9b4b44655fc4b0c59f73c20bc003f70e2 | [
"MIT"
] | 1 | 2020-04-20T16:39:49.000Z | 2020-04-20T16:39:49.000Z | scripts/helper.py | skurscheid/camda2019-workflows | 45b10ef9b4b44655fc4b0c59f73c20bc003f70e2 | [
"MIT"
] | 1 | 2019-05-03T22:31:32.000Z | 2019-05-03T22:34:01.000Z | scripts/helper.py | skurscheid/camda2019-workflows | 45b10ef9b4b44655fc4b0c59f73c20bc003f70e2 | [
"MIT"
] | null | null | null | def get_failed_ids(txt_file):
id = []
fh = open(txt_file, 'r')
for row in fh:
id.append(row.split('/')[1].split('.')[0])
return(id)
| 19.625 | 50 | 0.528662 | 25 | 157 | 3.16 | 0.72 | 0.177215 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017094 | 0.254777 | 157 | 7 | 51 | 22.428571 | 0.65812 | 0 | 0 | 0 | 0 | 0 | 0.019231 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.166667 | 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 |
adc9d401feb2c0145e7e065ab182fb792dc27133 | 411 | py | Python | calico/datadog_checks/calico/check.py | davidlrosenblum/integrations-extras | 281864a99ae054c91c3e3ea6a8ee8f04f6d7cdf3 | [
"BSD-3-Clause"
] | 158 | 2016-06-02T16:25:31.000Z | 2022-03-16T15:55:14.000Z | calico/datadog_checks/calico/check.py | davidlrosenblum/integrations-extras | 281864a99ae054c91c3e3ea6a8ee8f04f6d7cdf3 | [
"BSD-3-Clause"
] | 554 | 2016-03-15T17:39:12.000Z | 2022-03-31T10:29:16.000Z | calico/datadog_checks/calico/check.py | davidlrosenblum/integrations-extras | 281864a99ae054c91c3e3ea6a8ee8f04f6d7cdf3 | [
"BSD-3-Clause"
] | 431 | 2016-05-13T15:33:13.000Z | 2022-03-31T10:06:46.000Z | from datadog_checks.base import OpenMetricsBaseCheckV2
from .metrics import METRIC_MAP
class CalicoCheck(OpenMetricsBaseCheckV2):
def __init__(self, name, init_config, instances=None):
super(CalicoCheck, self).__init__(
name,
init_config,
instances,
)
def get_default_config(self):
return {'namespace': 'calico', 'metrics': [METRIC_MAP]}
| 24.176471 | 63 | 0.664234 | 41 | 411 | 6.292683 | 0.585366 | 0.069767 | 0.108527 | 0.178295 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006452 | 0.245742 | 411 | 16 | 64 | 25.6875 | 0.825806 | 0 | 0 | 0 | 0 | 0 | 0.053528 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.181818 | 0.090909 | 0.545455 | 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 |
ade08716a0728bd71f409c370ab1b6a0670febc4 | 1,354 | py | Python | setup.py | PiotrRadzinski/envemind | 7eb159e3a9f481b95e26df81595e5c8b7e8485c7 | [
"MIT"
] | null | null | null | setup.py | PiotrRadzinski/envemind | 7eb159e3a9f481b95e26df81595e5c8b7e8485c7 | [
"MIT"
] | null | null | null | setup.py | PiotrRadzinski/envemind | 7eb159e3a9f481b95e26df81595e5c8b7e8485c7 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from distutils.core import Extension
import pathlib
here = pathlib.Path(__file__).parent.resolve()
setup(
name='envemind',
version='0.0.1',
description='Prediction of monoisotopic mass in mass spectra',
# long_description=(here / 'README.md').read_text(encoding='utf-8'),
# long_description_content_type='text/markdown',
url='https://github.com/PiotrRadzinski/envemind',
author='Piotr Radziński, Michał Piotr Startek',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
keywords = 'Mass spectrometry monisotopic mass',
packages=find_packages(),
python_requires='>=3.6',
install_requires='numpy scipy IsoSpecPy pyteomics'.split(),
# entry_points={},
# scripts=[''],
)
| 36.594595 | 71 | 0.619645 | 140 | 1,354 | 5.892857 | 0.621429 | 0.161212 | 0.212121 | 0.220606 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020329 | 0.237075 | 1,354 | 36 | 72 | 37.611111 | 0.778316 | 0.146972 | 0 | 0 | 0 | 0 | 0.520453 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.107143 | 0 | 0.107143 | 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 |
ade4d82b609c594b7c7b2743267ac4e2efc9393b | 227 | py | Python | tests/conftest.py | skarzi/drf-exception-dispatcher | a950f7ce8ca33551b0860fb4c78ced53afd06163 | [
"MIT"
] | null | null | null | tests/conftest.py | skarzi/drf-exception-dispatcher | a950f7ce8ca33551b0860fb4c78ced53afd06163 | [
"MIT"
] | 70 | 2021-02-05T07:20:57.000Z | 2022-03-31T05:11:20.000Z | tests/conftest.py | skarzi/drf-exception-dispatcher | a950f7ce8ca33551b0860fb4c78ced53afd06163 | [
"MIT"
] | null | null | null | import os
import django
from django.conf import settings
def pytest_configure(config):
"""Configure Django."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
settings.configure()
django.setup()
| 17.461538 | 63 | 0.726872 | 26 | 227 | 6.230769 | 0.538462 | 0.185185 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15859 | 227 | 12 | 64 | 18.916667 | 0.848168 | 0.07489 | 0 | 0 | 0 | 0 | 0.147059 | 0.107843 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.428571 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 2 |
ade8f00c2e2f3654ec06ca9013834fd8116c8f47 | 1,743 | py | Python | fight_tracker/arithmetic.py | jm-begon/fight_tracker | 82dc6bbb9e24015e1dc3edbd05ce319b3c88626d | [
"BSD-3-Clause"
] | null | null | null | fight_tracker/arithmetic.py | jm-begon/fight_tracker | 82dc6bbb9e24015e1dc3edbd05ce319b3c88626d | [
"BSD-3-Clause"
] | null | null | null | fight_tracker/arithmetic.py | jm-begon/fight_tracker | 82dc6bbb9e24015e1dc3edbd05ce319b3c88626d | [
"BSD-3-Clause"
] | null | null | null | class Boolable:
def __bool__(self):
return False
class DescriptiveTrue(Boolable):
def __init__(self, description):
self.description = description
def __bool__(self):
return True
def __str__(self):
return f"{self.description}"
def __repr__(self):
return f"{self.__class__.__name__}({repr(self.description)})"
class Intable:
def __int__(self):
return 0
def __add__(self, other):
return Addition(self, other)
def __repr__(self):
return f"{self.__class__.__name__}()"
class DescriptiveInt(Intable):
def __init__(self, value, description):
self.value = value
self.description = description
def __int__(self):
return self.value
def __str__(self):
return f"{self.value} ({self.description})"
def __repr__(self):
return f"{self.__class__.__name__}({repr(self.value)}, " \
f"{repr(self.description)})"
class Addition(Intable):
def __init__(self, *intables):
self.intables = list(intables)
def __int__(self):
return sum(int(i) for i in self.intables)
def __repr__(self):
return f"{self.__class__.__name__}(*{repr(self.intables)})"
def __str__(self):
return " + ".join(str(x) for x in self.intables)
class Subtraction(Intable):
def __init__(self, left_operand, right_operand):
self.left = left_operand
self.right = right_operand
def __int__(self):
return int(self.left) - int(self.right)
def __repr__(self):
return f"{self.__class__.__name__}({repr(self.left)}, " \
f"{repr(self.right)})"
def __str__(self):
return f"{self.left} - {self.right}" | 23.554054 | 69 | 0.619048 | 205 | 1,743 | 4.658537 | 0.170732 | 0.157068 | 0.092147 | 0.125654 | 0.289005 | 0.289005 | 0.227225 | 0.227225 | 0.194764 | 0.194764 | 0 | 0.000767 | 0.252438 | 1,743 | 74 | 70 | 23.554054 | 0.732157 | 0 | 0 | 0.34 | 0 | 0 | 0.196101 | 0.138188 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0.32 | 0.84 | 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 |
aded4518a2f294727acdd53f5c2f5b29c9ac192e | 11,148 | py | Python | test/inprogress/test_ee2_api/test_EE2API.py | eapearson/kbase-skd-module-job-browser-bff | 426445f90569adac16632ef4921f174e51abd42f | [
"MIT"
] | null | null | null | test/inprogress/test_ee2_api/test_EE2API.py | eapearson/kbase-skd-module-job-browser-bff | 426445f90569adac16632ef4921f174e51abd42f | [
"MIT"
] | 6 | 2020-05-26T17:40:07.000Z | 2022-03-11T16:33:11.000Z | test/inprogress/test_ee2_api/test_EE2API.py | eapearson/kbase-skd-module-job-browser-bff | 426445f90569adac16632ef4921f174e51abd42f | [
"MIT"
] | 1 | 2020-05-26T17:12:59.000Z | 2020-05-26T17:12:59.000Z | # -*- coding: utf-8 -*-
from JobBrowserBFF.TestBase import TestBase
from JobBrowserBFF.model.EE2Api import EE2Api
from JobBrowserBFF.schemas.Schema import Schema
ENV = 'ci'
USER_CLASS = 'user'
UPSTREAM_SERVICE = 'ee2'
JOB_ID_HAPPY = '5e8285adefac56a4b4bc2b14'
JOB_ID_LOG_HAPPY = '5e8647c576f5df12d4fa6953'
JOB_ID_NOT_FOUND = '5dcb4324fdf6d14ac59ea916'
WORKSPACE_ID_HAPPY = 47458
# Note timeout in seconds since we are dealing directly with the ee2 api
TIMEOUT = 60
START_TIME_1 = 0
END_TIME_1 = 1609459200000
USER = 'kbaseuitest'
class EE2APITest(TestBase):
# Uncomment to skip this test
# @unittest.skip("skipped test_get_jobs_happy")
def test_ver(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, USER_CLASS)
# impl, context = self.impl_for(ENV, USER_CLASS)
# params = {
# 'job_ids': [JOB_ID_HAPPY],
# 'timeout': TIMEOUT
# }
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
version = api.ver()
self.assertEqual(version, '0.0.1')
except Exception as ex:
self.assert_no_exception(ex)
def test_status(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, USER_CLASS)
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
status = api.status()
self.assertEqual(status['version'], '0.0.1')
self.assertEqual(status['service'], 'KBase Execution Engine')
self.assertIsInstance(status['server_time'], float)
self.assertIsInstance(status['git_commit'], str)
except Exception as ex:
self.assert_no_exception(ex)
def test_list_config(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, USER_CLASS)
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
expected = {
"external-url": "https://ci.kbase.us/services/ee2",
"kbase-endpoint": "https://ci.kbase.us/services",
"workspace-url": "https://ci.kbase.us/services/ws",
"catalog-url": "https://ci.kbase.us/services/catalog",
"shock-url": "https://ci.kbase.us/services/shock-api",
"handle-url": "https://ci.kbase.us/services/handle_service",
"srv-wiz-url": "https://ci.kbase.us/services/service_wizard",
"auth-service-url":
"https://ci.kbase.us/services/auth/api/legacy/KBase/Sessions/Login",
"auth-service-url-v2": "https://ci.kbase.us/services/auth/api/V2/token",
"auth-service-url-allow-insecure": "false",
"scratch": "/kb/module/work/tmp",
"executable": "execute_runner.sh",
"docker_timeout": "604805",
"initialdir": "/condor_shared",
"transfer_input_files": "/condor_shared/JobRunner.tgz"
}
config = api.list_config()
self.assertEqual(config, expected)
except Exception as ex:
self.assert_no_exception(ex)
def test_check_job(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, USER_CLASS)
schema = Schema(schema_dir="ee2_api", load_schemas=True)
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
params = {
'job_id': JOB_ID_HAPPY
}
job = api.check_job(params)
schema.validate('check_job', job)
self.assertEqual(job['user'], 'kbaseuitest')
except Exception as ex:
self.assert_no_exception(ex)
def test_check_jobs(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, USER_CLASS)
schema = Schema(schema_dir="ee2_api", load_schemas=True)
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
params = {
'job_ids': [JOB_ID_HAPPY]
}
jobs = api.check_jobs(params)
schema.validate('check_jobs', jobs)
self.assertEqual(jobs['job_states'][0]['user'], 'kbaseuitest')
except Exception as ex:
self.assert_no_exception(ex)
def test_check_workspace_jobs(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, USER_CLASS)
schema = Schema(schema_dir="ee2_api", load_schemas=True)
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
params = {
'workspace_id': WORKSPACE_ID_HAPPY
}
jobs = api.check_workspace_jobs(params)
schema.validate('check_workspace_jobs', jobs)
self.assertEqual(jobs['job_states'][0]['user'], 'kbaseuitest')
except Exception as ex:
self.assert_no_exception(ex)
def test_cancel_job(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, USER_CLASS)
schema = Schema(schema_dir="ee2_api", load_schemas=True)
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
params = {
'job_id': JOB_ID_HAPPY
}
result = api.cancel_job(params)
schema.validate('cancel_job', result)
self.assertIsNone(result)
except Exception as ex:
self.assert_no_exception(ex)
def test_check_job_canceled(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, USER_CLASS)
schema = Schema(schema_dir="ee2_api", load_schemas=True)
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
params = {
'job_id': JOB_ID_HAPPY
}
result = api.check_job_canceled(params)
schema.validate('check_job_canceled', result)
self.assertEqual(result['canceled'], False)
except Exception as ex:
self.assert_no_exception(ex)
def test_check_job_status(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, USER_CLASS)
schema = Schema(schema_dir="ee2_api", load_schemas=True)
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
params = {
'job_id': JOB_ID_HAPPY
}
result = api.get_job_status(params)
schema.validate('get_job_status', result)
self.assertEqual(result['status'], 'completed')
except Exception as ex:
self.assert_no_exception(ex)
def test_get_job_logs(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, USER_CLASS)
schema = Schema(schema_dir="ee2_api", load_schemas=True)
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
params = {
'job_id': JOB_ID_LOG_HAPPY
}
result = api.get_job_logs(params)
schema.validate('get_job_logs', result)
self.assertEqual(result['lines'][0]['ts'], 1585858534288)
except Exception as ex:
self.assert_no_exception(ex)
def test_check_jobs_date_range_for_user(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, USER_CLASS)
schema = Schema(schema_dir="ee2_api", load_schemas=True)
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
params = {
'start_time': START_TIME_1,
'end_time': END_TIME_1,
'user': USER,
'offset': 0,
'limit': 10
}
result = api.check_jobs_date_range_for_user(params)
schema.validate('check_jobs_date_range_for_user', result)
self.assertEqual(result['jobs'][0]['job_id'], '5e8285adefac56a4b4bc2b14')
except Exception as ex:
self.assert_no_exception(ex)
def test_check_jobs_date_range_for_all(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, 'admin')
schema = Schema(schema_dir="ee2_api", load_schemas=True)
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
params = {
'start_time': START_TIME_1,
'end_time': END_TIME_1,
'user': USER,
'offset': 0,
'limit': 10
}
result = api.check_jobs_date_range_for_all(params)
schema.validate('check_jobs_date_range_for_all', result)
self.assertEqual(result['jobs'][0]['job_id'], '54b02da8e4b06e6b5555476d')
except Exception as ex:
self.assert_no_exception(ex)
def test_is_admin_is_not(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, USER_CLASS)
schema = Schema(schema_dir="ee2_api", load_schemas=True)
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
result = api.is_admin()
schema.validate('is_admin', result)
self.assertEqual(result, False)
except Exception as ex:
self.assert_no_exception(ex)
def test_is_admin_is(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, 'admin')
schema = Schema(schema_dir="ee2_api", load_schemas=True)
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
result = api.is_admin()
schema.validate('is_admin', result)
self.assertEqual(result, True)
except Exception as ex:
self.assert_no_exception(ex)
def test_get_admin_permission_not_admin(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, USER_CLASS)
schema = Schema(schema_dir="ee2_api", load_schemas=True)
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
result = api.get_admin_permission()
schema.validate('get_admin_permission', result)
self.assertEqual(result['permission'], 'n')
except Exception as ex:
self.assert_no_exception(ex)
def test_get_admin_permission_admin(self):
self.set_config('upstream-service', UPSTREAM_SERVICE)
token = self.token_for(ENV, 'admin')
schema = Schema(schema_dir="ee2_api", load_schemas=True)
try:
api = EE2Api(self.get_config('ee2-url'), token, TIMEOUT)
result = api.get_admin_permission()
schema.validate('get_admin_permission', result)
self.assertEqual(result['permission'], 'w')
except Exception as ex:
self.assert_no_exception(ex)
| 39.392226 | 88 | 0.600646 | 1,309 | 11,148 | 4.867074 | 0.120703 | 0.077696 | 0.027625 | 0.042693 | 0.757181 | 0.718725 | 0.685921 | 0.676817 | 0.652331 | 0.645739 | 0 | 0.023302 | 0.283997 | 11,148 | 282 | 89 | 39.531915 | 0.774868 | 0.025117 | 0 | 0.589212 | 0 | 0.004149 | 0.165684 | 0.021919 | 0 | 0 | 0 | 0 | 0.145228 | 1 | 0.06639 | false | 0 | 0.012448 | 0 | 0.082988 | 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 |
adeda8e4831bfdd84daf5ffee1aa3f3be1652de6 | 529 | py | Python | ldeep/views/activedirectory.py | podjackel/ldeep | dac9b6d92b905b66868897da4bcc2ec4fa1d0999 | [
"MIT"
] | 41 | 2018-10-24T12:10:34.000Z | 2022-03-29T08:21:30.000Z | ldeep/views/activedirectory.py | podjackel/ldeep | dac9b6d92b905b66868897da4bcc2ec4fa1d0999 | [
"MIT"
] | 7 | 2018-10-25T16:34:25.000Z | 2021-04-14T01:00:14.000Z | ldeep/views/activedirectory.py | podjackel/ldeep | dac9b6d92b905b66868897da4bcc2ec4fa1d0999 | [
"MIT"
] | 17 | 2019-01-08T15:06:15.000Z | 2022-01-21T00:20:53.000Z |
from ldap3 import ALL_ATTRIBUTES, ALL_OPERATIONAL_ATTRIBUTES
from ldap3.protocol.formatters.validators import validate_sid, validate_guid
ALL_ATTRIBUTES = ALL_ATTRIBUTES
ALL_OPERATIONAL_ATTRIBUTES = ALL_OPERATIONAL_ATTRIBUTES
ALL = [ALL_ATTRIBUTES, ALL_OPERATIONAL_ATTRIBUTES]
validate_sid = validate_sid
validate_guid = validate_guid
class ActiveDirectoryView(object):
"""
Manage a view of a Active Directory.
"""
class ActiveDirectoryInvalidSID(Exception):
pass
class ActiveDirectoryInvalidGUID(Exception):
pass
| 24.045455 | 76 | 0.835539 | 60 | 529 | 7.066667 | 0.416667 | 0.183962 | 0.150943 | 0.320755 | 0.325472 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004246 | 0.109641 | 529 | 21 | 77 | 25.190476 | 0.895966 | 0.068053 | 0 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.166667 | 0.166667 | 0 | 0.416667 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
adfc25dd827903785cf0dc2f054806e377cdcb01 | 1,000 | py | Python | py/py_0067_maximum_path_sum_ii.py | lcsm29/project-euler | fab794ece5aa7a11fc7c2177f26250f40a5b1447 | [
"MIT"
] | null | null | null | py/py_0067_maximum_path_sum_ii.py | lcsm29/project-euler | fab794ece5aa7a11fc7c2177f26250f40a5b1447 | [
"MIT"
] | null | null | null | py/py_0067_maximum_path_sum_ii.py | lcsm29/project-euler | fab794ece5aa7a11fc7c2177f26250f40a5b1447 | [
"MIT"
] | null | null | null | # Solution of;
# Project Euler Problem 67: Maximum path sum II
# https://projecteuler.net/problem=67
#
# By starting at the top of the triangle below and moving to adjacent numbers
# on the row below, the maximum total from top to bottom is 23. 37 42 4 68 5 9
# 3That is, 3 + 7 + 4 + 9 = 23. Find the maximum total from top to bottom in
# triangle. txt (right click and 'Save Link/Target As. . . '), a 15K text file
# containing a triangle with one-hundred rows. NOTE: This is a much more
# difficult version of Problem 18. It is not possible to try every route to
# solve this problem, as there are 299 altogether! If you could check one
# trillion (1012) routes every second it would take over twenty billion years
# to check them all. There is an efficient algorithm to solve it. ;o)
#
# by lcsm29 http://github.com/lcsm29/project-euler
import timed
def dummy(n):
pass
if __name__ == '__main__':
n = 1000
i = 10000
prob_id = 67
timed.caller(dummy, n, i, prob_id)
| 35.714286 | 79 | 0.706 | 173 | 1,000 | 4.023121 | 0.66474 | 0.034483 | 0.043103 | 0.054598 | 0.086207 | 0.086207 | 0.086207 | 0 | 0 | 0 | 0 | 0.061303 | 0.217 | 1,000 | 27 | 80 | 37.037037 | 0.827586 | 0.819 | 0 | 0 | 0 | 0 | 0.048485 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0.125 | 0.125 | 0 | 0.25 | 0 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
bc0820e97035bc22e07e063ecf6170b4f34d25c6 | 640 | py | Python | Chap 1/Class-List-(project2).py | dwhickox/NCHS-Programming-1-Python-Programs | 96eba3826585a81a015740f59329c7a06afc9db7 | [
"MIT"
] | null | null | null | Chap 1/Class-List-(project2).py | dwhickox/NCHS-Programming-1-Python-Programs | 96eba3826585a81a015740f59329c7a06afc9db7 | [
"MIT"
] | null | null | null | Chap 1/Class-List-(project2).py | dwhickox/NCHS-Programming-1-Python-Programs | 96eba3826585a81a015740f59329c7a06afc9db7 | [
"MIT"
] | null | null | null | # David Hickox
# Jan 12 17
# HickoxProject2
# Displayes name and classes
# prints my name and classes in columns and waits for the user to hit enter to end the program
print("David Hickox")
print()
print("1st Band")
print("2nd Programming")
print("3rd Ap Pysics C")
print("4th Lunch")
print("5th Ap Lang")
print("6th TA for R&D")
print("7th Gym")
print("8th AP Calc BC")
print()
input("Press Enter To Continue")
#this works too
#input("David Hickox\n\n1st Band\n2nd Programming\n3rd Ap Pysics C\n4th Lunch\n5th Ap Lang\n6th TA for R&D\n7th Gym\n8th AP Calc BC\n\nPress Enter to continue")
| 27.826087 | 184 | 0.676563 | 107 | 640 | 4.046729 | 0.570093 | 0.076212 | 0.064665 | 0.032333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041916 | 0.217188 | 640 | 22 | 185 | 29.090909 | 0.822355 | 0.553125 | 0 | 0.166667 | 0 | 0 | 0.546763 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0.916667 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
bc1384f21ce9e92bbb5a1b5230fae5b32226449c | 578 | py | Python | bank_ddd_es_cqrs/accounts/app.py | Hyaxia/Bank-DDD-CQRS-ES | 116e3eb3e93d549c1da53e6d506ab47667d77445 | [
"MIT"
] | 8 | 2020-10-27T09:46:20.000Z | 2022-01-27T12:16:48.000Z | bank_ddd_es_cqrs/accounts/app.py | Hyaxia/Bank-DDD-CQRS-ES | 116e3eb3e93d549c1da53e6d506ab47667d77445 | [
"MIT"
] | null | null | null | bank_ddd_es_cqrs/accounts/app.py | Hyaxia/Bank-DDD-CQRS-ES | 116e3eb3e93d549c1da53e6d506ab47667d77445 | [
"MIT"
] | 2 | 2021-05-29T08:11:48.000Z | 2021-07-26T04:44:53.000Z | from flask import Flask
from flask_cors import CORS # type: ignore
from .api import account_blueprint
from .event_handlers import register_event_handlers
from .infrastructure import event_store_db
from .composition_root import event_manager
def account_app_factory(db_string: str):
app = Flask(__name__)
CORS(app)
app.config['SQLALCHEMY_DATABASE_URI'] = db_string
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
event_store_db.init_app(app)
app.register_blueprint(account_blueprint)
register_event_handlers(event_manager)
return app
| 25.130435 | 56 | 0.792388 | 78 | 578 | 5.5 | 0.423077 | 0.090909 | 0.097902 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147059 | 578 | 22 | 57 | 26.272727 | 0.870183 | 0.020761 | 0 | 0 | 0 | 0 | 0.094139 | 0.094139 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0 | 0.4 | 0 | 0.533333 | 0.133333 | 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 |
bc1654338e8c6eee8c72f671de285bccc11be562 | 1,352 | py | Python | tests/TestFiles/fodder.py | ComposableAnalytics/ComposaPy | 6d82f8f953c709dde55e7f055e2f8b4e6765caba | [
"MIT"
] | null | null | null | tests/TestFiles/fodder.py | ComposableAnalytics/ComposaPy | 6d82f8f953c709dde55e7f055e2f8b4e6765caba | [
"MIT"
] | null | null | null | tests/TestFiles/fodder.py | ComposableAnalytics/ComposaPy | 6d82f8f953c709dde55e7f055e2f8b4e6765caba | [
"MIT"
] | null | null | null | # Add this test back later, unfortunately casting errors and no time to deal with them.
# @pytest.mark.parametrize("dataflow_object", ["external_input_int.json"], indirect=True)
# def test_external_input_int(dataflow_object: DataFlowObject, dataflow: DataFlow):
# dataflow_rs = dataflow_object.run(external_inputs={"IntInput": 3})
#
# assert dataflow_rs.modules.first_with_name("Calculator").result.value_obj == 5.0
# @pytest.mark.parametrize("dataflow_id", ["EXTERNAL_INPUT_FILE_ID"], indirect=True)
# def test_external_input_file(dataflow: dataflow, dataflow_id: int):
#
# table_dataflow = dataflow.run(table_dataflow_id)
# table = table_dataflow.modules.first_with_name("Sql Query").result
# test_input = { "TableInput": table }
#
# dataflow_rs = dataflow.run(dataflow_id, external_inputs=test_input)
#
# assert dataflow_rs.modules.first().result.Headers == table.Headers
# assert dataflow_rs.modules.first().result.SqlQuery == table.SqlQuery
# def test_queryview_to_pandas(queryview: queryview):
# df = queryview.queryview_from_id(137072)
# print(df.head())
# print(df.dtypes)
#
#
# def test_queryview_to_pandas_streaming(queryview: queryview):
# t = time()
# df = queryview.queryview_from_id(137072)
# print(time() - t)
# print(df.head())
# print(df.dtypes)
# print(len(df))
| 38.628571 | 89 | 0.727071 | 175 | 1,352 | 5.354286 | 0.354286 | 0.085379 | 0.051227 | 0.073639 | 0.346852 | 0.265742 | 0.078975 | 0 | 0 | 0 | 0 | 0.012898 | 0.139793 | 1,352 | 34 | 90 | 39.764706 | 0.792777 | 0.951923 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | 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 |
bc33e1a164ea02a1949fb5d46cf3c8b6e16f624c | 747 | py | Python | assignments/assignment2/solutions/Nkarnaud/devhub-0.1.0/src/account/forms.py | Nkarnaud/python-mentorship | a00735fc8b63e244b91575540c54d0eea942381f | [
"Apache-2.0"
] | 1 | 2019-04-22T18:42:51.000Z | 2019-04-22T18:42:51.000Z | assignments/assignment2/solutions/Nkarnaud/devhub-0.1.0/src/account/forms.py | Nkarnaud/python-mentorship | a00735fc8b63e244b91575540c54d0eea942381f | [
"Apache-2.0"
] | null | null | null | assignments/assignment2/solutions/Nkarnaud/devhub-0.1.0/src/account/forms.py | Nkarnaud/python-mentorship | a00735fc8b63e244b91575540c54d0eea942381f | [
"Apache-2.0"
] | null | null | null | from django import forms
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from django.contrib.auth.models import User
from account.models import Account
class AccountCreateForm(UserCreationForm):
first_name = forms.CharField(max_length=30, required=False, help_text='Optional.')
last_name = forms.CharField(max_length=30, required=False, help_text='Optional.')
email = forms.EmailField(max_length=254, help_text='Required. Inform a valid email address.')
class Meta:
model = Account
fields = ('username','first_name', 'last_name' ,'email', 'password1', 'password2')
class AccountChangeForm(UserChangeForm):
class Meta:
model = Account
fields = UserChangeForm.Meta.fields | 41.5 | 97 | 0.745649 | 89 | 747 | 6.146067 | 0.438202 | 0.054845 | 0.062157 | 0.076782 | 0.310786 | 0.212066 | 0.212066 | 0.212066 | 0.212066 | 0.212066 | 0 | 0.014218 | 0.15261 | 747 | 18 | 98 | 41.5 | 0.849921 | 0 | 0 | 0.266667 | 0 | 0 | 0.143048 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.066667 | 0.266667 | 0 | 0.733333 | 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 |
70d273f42e3df714bfd7e79274d26f4a44433731 | 3,179 | py | Python | tests/test_parse_string.py | zalmane/copybook | 1afe405ee8466ca87706c6067b227a62ecd61203 | [
"MIT"
] | 12 | 2020-10-27T11:54:51.000Z | 2022-03-06T18:38:05.000Z | tests/test_parse_string.py | zalmane/copybook | 1afe405ee8466ca87706c6067b227a62ecd61203 | [
"MIT"
] | 5 | 2021-01-11T16:01:04.000Z | 2022-03-10T06:37:36.000Z | tests/test_parse_string.py | zalmane/copybook | 1afe405ee8466ca87706c6067b227a62ecd61203 | [
"MIT"
] | 1 | 2021-11-27T03:34:30.000Z | 2021-11-27T03:34:30.000Z | import pytest
# Reader imports
import copybook
#
# Tests
#
tests = {
"extra header text":"""
10 IDENTIFICATION DIVISION.
PROGRAM-ID. 8-REPORT.
AUTHOR. DDT. MODIFIED BY OREN.
DATE WRITTEN. 10/13/2010.
DATE COMPILED. 10/13/2010.
01 WORK-BOOK.
10 TAX-RATE PIC 9(3).
""",
"no header text":"""
01 RECORD.
05 TAX-RATE PIC 9(3).
""",
"numeric pic no precision":"""
01 WORK-BOOK.
10 TAX-RATE PIC 9(3).
""",
"numeric pic precision only":"""
01 WORK-BOOK.
10 TAX-RATE PIC V9(3).
""",
"numeric pic length and precision":"""
01 WORK-BOOK.
10 TAX-RATE PIC 9(13)V9(3).
""",
"numeric pic length and precision with dot":"""
01 WORK-BOOK.
10 TAX-RATE PIC 9(13).9(3).
""",
"numeric pic signed S":"""
01 WORK-BOOK.
10 TAX-RATE PIC S9(13)V9(3).
""",
"numeric pic signed minus":"""
01 WORK-BOOK.
10 TAX-RATE PIC -9(13)V9(3).
""",
"numeric pic with 9s":"""
01 WORK-BOOK.
10 TAX-RATE PIC 9999.
""",
"numeric pic with 9s and precision":"""
01 WORK-BOOK.
10 TAX-RATE PIC 9(2)V99.
""",
"numeric pic with 9s and precision and sign":"""
01 WORK-BOOK.
10 TAX-RATE PIC -9999.99.
""",
"numeric pic with 9s and precision and separate sign":"""
01 WORK-BOOK.
10 TAX-RATE PIC S9(13)V9(2)
SIGN TRAILING SEPARATE.
""",
"numeric pic with 9s and precision and separate leading sign":"""
01 WORK-BOOK.
10 TAX-RATE PIC S9(13)V9(2)
SIGN LEADING SEPARATE.
""",
"string pic with leading 0s":"""
01 WORK-BOOK.
10 TAX-RATE PIC X(005).
""",
}
from pyparsing import ParseException
def test_parse_string():
failed =0
for test_name,test in tests.items():
print(test_name)
try:
root = copybook.parse_string(test)
except ParseException as pe:
failed += 1
print(f"test failed: {test_name}")
print(pe)
assert failed==0
| 36.125 | 82 | 0.35766 | 292 | 3,179 | 3.873288 | 0.284247 | 0.086649 | 0.123784 | 0.137931 | 0.541114 | 0.531388 | 0.517241 | 0.38992 | 0.271441 | 0.198939 | 0 | 0.097544 | 0.551746 | 3,179 | 87 | 83 | 36.54023 | 0.69614 | 0.006291 | 0 | 0.392405 | 0 | 0 | 0.831008 | 0 | 0 | 0 | 0 | 0 | 0.012658 | 1 | 0.012658 | false | 0 | 0.037975 | 0 | 0.050633 | 0.037975 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 |
70d28b57c47afe1c70e1683910f82209fac17a5b | 451 | py | Python | decorators.py | ir0nfelix/async_fileserver | 84d5f329982923855e0e0dc0b12fedcaaf26f1f7 | [
"MIT"
] | 1 | 2020-09-07T22:38:47.000Z | 2020-09-07T22:38:47.000Z | decorators.py | ir0nfelix/minio-async-fileserver | 84d5f329982923855e0e0dc0b12fedcaaf26f1f7 | [
"MIT"
] | null | null | null | decorators.py | ir0nfelix/minio-async-fileserver | 84d5f329982923855e0e0dc0b12fedcaaf26f1f7 | [
"MIT"
] | null | null | null | from werkzeug import exceptions
import settings
from utils import get_class_by_path
def authenticate(f):
def decorator(request):
try:
authentication_backend = get_class_by_path(settings.AUTHENTICATION_BACKEND)
authenticator = authentication_backend()
except Exception:
raise exceptions.Unauthorized()
authenticator.authenticate(request)
return f(request)
return decorator
| 26.529412 | 87 | 0.707317 | 45 | 451 | 6.888889 | 0.533333 | 0.203226 | 0.064516 | 0.090323 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.241685 | 451 | 16 | 88 | 28.1875 | 0.906433 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.230769 | 0 | 0.538462 | 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 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
70ef510161655a6820dfbc438830cb203101745d | 142 | py | Python | src/v2/log.py | Strangemother/project-conceptnet-graphing | 3fd1b3188088090c71c95b1a660770482123ce22 | [
"MIT"
] | null | null | null | src/v2/log.py | Strangemother/project-conceptnet-graphing | 3fd1b3188088090c71c95b1a660770482123ce22 | [
"MIT"
] | null | null | null | src/v2/log.py | Strangemother/project-conceptnet-graphing | 3fd1b3188088090c71c95b1a660770482123ce22 | [
"MIT"
] | null | null | null | import logging
logging.basicConfig(level=logging.DEBUG)
def log(*a):
logging.info(' '.join(map(str, a)))
warn = logging.warn
| 14.2 | 41 | 0.647887 | 19 | 142 | 4.842105 | 0.684211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.197183 | 142 | 9 | 42 | 15.777778 | 0.807018 | 0 | 0 | 0 | 0 | 0 | 0.007519 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.4 | 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 |
cb0dc5cb2397b2b17050683d98107fc206b4c8db | 476 | py | Python | Leetcode/Stacks,_Queues/1_-_Easy/933._Number_of_Recent_Calls.py | Khalid-Sultan/Algorithms-Prep | 7773c5bc0448d8677bf324bd1d9bdc43b813fcd5 | [
"MIT"
] | 1 | 2020-09-21T10:01:26.000Z | 2020-09-21T10:01:26.000Z | Leetcode/Stacks,_Queues/1_-_Easy/933._Number_of_Recent_Calls.py | Khalid-Sultan/Algorithms-Prep | 7773c5bc0448d8677bf324bd1d9bdc43b813fcd5 | [
"MIT"
] | null | null | null | Leetcode/Stacks,_Queues/1_-_Easy/933._Number_of_Recent_Calls.py | Khalid-Sultan/Algorithms-Prep | 7773c5bc0448d8677bf324bd1d9bdc43b813fcd5 | [
"MIT"
] | 2 | 2020-09-01T12:33:55.000Z | 2020-11-30T13:23:50.000Z | from collections import deque
class RecentCounter:
def __init__(self):
self.buffer = deque()
def ping(self, t: int) -> int:
while self.buffer and self.buffer[-1]<t-3000:
self.buffer.pop()
self.buffer.appendleft(t)
return len(self.buffer)
#Your RecentCounter object will be instantiated and called as such:
# Your RecentCounter object will be instantiated and called as such:
# obj = RecentCounter()
# param_1 = obj.ping(t) | 31.733333 | 68 | 0.676471 | 65 | 476 | 4.876923 | 0.476923 | 0.189274 | 0.14511 | 0.170347 | 0.353312 | 0.353312 | 0.353312 | 0.353312 | 0.353312 | 0.353312 | 0 | 0.01626 | 0.22479 | 476 | 15 | 69 | 31.733333 | 0.842818 | 0.371849 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0 | 0.555556 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
cb279012d1ad198dad56cddf7894586685f1a73f | 10,197 | py | Python | limnoria-plugins/SupportNotifications/plugin.py | chevah/ircbot-plugins | b3d7d274600c85ab856880b4ec693ee913c25c8a | [
"MIT"
] | null | null | null | limnoria-plugins/SupportNotifications/plugin.py | chevah/ircbot-plugins | b3d7d274600c85ab856880b4ec693ee913c25c8a | [
"MIT"
] | 2 | 2017-05-24T10:39:28.000Z | 2019-11-21T12:45:20.000Z | limnoria-plugins/SupportNotifications/plugin.py | chevah/ircbot-plugins | b3d7d274600c85ab856880b4ec693ee913c25c8a | [
"MIT"
] | null | null | null | """
Use GMail API to check an Inbox for new emails.
To generate the initial credentials you will need to execute this module from
python with first argument to a patch containing your API client details
and the second argument to the file where to store the credentials.
It uses the `historyID` configuration option to optimize the search.
It will start with searching all messages from Inbox and then will keep the
record of the history id.
So future runs and restarts should resume only from last history_id.
As long as there is no message in In
"""
from __future__ import print_function
from threading import Event, Thread
from supybot import (
ircmsgs,
)
from supybot.callbacks import ArgumentError, Plugin
import httplib2
from apiclient import discovery, errors
from oauth2client.file import Storage
class CancellableTimer(Thread):
"""
A threaded timer which can be closed before the scheduled execution.
"""
def __init__(self, delay, callback, irc, *args, **kwargs):
Thread.__init__(self)
self._event = Event()
self._step = 0.25
self._remaining = delay / self._step
self._irc = irc
self._callback = callback
self._args = args
self._kwargs = kwargs
def run(self):
while (
self._remaining > 0 and
not self._event.is_set()
and not self._irc.zombie
):
self._remaining -= self._step
self._event.wait(self._step)
self._callback(*self._args, **self._kwargs)
def cancel(self):
self._event.set()
def get_credentials(credentials_path):
"""
Gets valid user credentials from storage.
If nothing has been stored, or if the stored credentials are invalid it
returns None.
Returns:
Credentials, the obtained credential or None
"""
store = Storage(credentials_path)
credentials = store.get()
if not credentials or credentials.invalid:
return None
return credentials
class SupportNotifications(Plugin):
"""
Send to the configured channel info about latest support activity.
"""
threaded = True
def __init__(self, irc):
super(SupportNotifications, self).__init__(irc)
self._irc = irc
self._timer = None
self._channel_name = None
self._history_id = self.registryValue('historyID')
self._interval = self.registryValue('pollInterval')
self._target_address = self.registryValue('targetAddress').strip()
self._team_domain = self.registryValue('teamDomain').strip()
if not self._target_address:
raise ArgumentError('targetAddress not configured.')
if not self._team_domain:
raise ArgumentError('teamDomain not configured.')
credentials_path = self.registryValue('credentialsPath')
credentials = get_credentials(credentials_path)
if not credentials:
raise ArgumentError('Failed to load API credentials.')
http = credentials.authorize(httplib2.Http())
self._google = discovery.build('gmail', 'v1', http=http, cache=False)
def die(self):
"""
Called when the plugin should end.
"""
if self._timer is None:
return
self.log.info("Closing plugin. Cancelling the timer")
self._timer.cancel()
def do353(self, irc, msg):
"""
Called when we have joined the channel.
RPL_NAMREPLY - called when we have joined the channel and have
received the list of members.
"""
self._channel_name = msg.args[2]
self.log.info(
'Start polling for %s changes at %d seconds and sending to %s.' % (
self._target_address, self._interval, self._channel_name))
self._scheduleNextCheck()
def _scheduleNextCheck(self):
"""
Called to schedule the next API check.
"""
if self._irc.zombie:
# We are not connected.
return
if self._timer:
return
self._timer = CancellableTimer(self._interval, self._tick, self._irc)
self._timer.start()
self.log.debug('Scheduling a new check.')
def _tick(self):
"""
Called when we should check for new emails.
"""
if self._irc.zombie:
# We are not connected.
return
self._checkInbox()
# Schedule the next tick.
self._timer = None
self._scheduleNextCheck()
def _checkInbox(self):
"""
Emit changes for the new emails from inbox.
"""
inbox_labels = [u'INBOX', u'UNREAD']
details = None
messages = self._getNewMessages()
for message in messages:
details = self._getMessageDetails(msg_id=message['id'])
if set(inbox_labels) - set(details['labelIds']):
# Not a unread message which is in Inbox.
# Just ignore it for now.
continue
headers = {}
for raw_header in details['payload']['headers']:
headers[raw_header['name'].lower()] = raw_header['value']
self._checkMessage(headers)
# Any message is removed so that we will not process it later.
self._trash(msg_id=message['id'])
if details:
self._history_id = int(details['historyId'])
self.setRegistryValue('historyID', value=self._history_id)
def _getNewMessages(self):
"""
Return the new messages since the last run.
"""
if self._history_id:
return self._getMessagesFromHistory()
else:
return self._getMessagesFromInbox()
def _getMessagesFromHistory(self):
"""
Return the new messages based on account history.
"""
start_history_id = self._history_id
messages = []
try:
history = self._google.users().history().list(
userId='me',
startHistoryId=start_history_id,
historyTypes='messageAdded',
).execute()
changes = history['history'] if 'history' in history else []
for change in changes:
messages.extend(change.get('messages', []))
while 'nextPageToken' in history:
page_token = history['nextPageToken']
history = self._google.users().history().list(
userId='me',
startHistoryId=start_history_id,
historyTypes='messageAdded',
pageToken=page_token,
).execute()
for change in history['history']:
messages.extend(change.get('messages', []))
return messages
except errors.HttpError, error:
self.log.error(
'_getMessagesFromHistory: An error occurred: %s' % error)
return []
def _getMessagesFromInbox(self):
"""
Return all the messages from Inbox.
"""
label_ids = ['INBOX']
messages = []
try:
response = self._google.users().messages().list(
userId='me',
labelIds=label_ids,
).execute()
if 'messages' in response:
messages.extend(response['messages'])
while 'nextPageToken' in response:
page_token = response['nextPageToken']
response = self._google.users().messages().list(
userId='me',
labelIds=label_ids,
pageToken=page_token,
).execute()
messages.extend(response['messages'])
return messages
except errors.HttpError, error:
self.log.error(
'_getMessagesFromInbox: An error occurred: %s' % error)
return []
def _trash(self, msg_id):
"""
Delete a message by sending it to trash..
"""
try:
self._google.users().messages().trash(
userId='me', id=msg_id).execute()
except errors.HttpError, error:
self.log.error('_trash: An error occurred: %s' % error)
def _getMessageDetails(self, msg_id):
"""
Get a Message with given ID.
"""
try:
message = self._google.users().messages().get(
userId='me', id=msg_id).execute()
return message
except errors.HttpError, error:
self.log.error('_getMessageDetails: An error occurred: %s' % error)
def _checkMessage(self, headers):
"""
Check message to decide if we should send a notification.
"""
to = headers.get('to', '')
cc = headers.get('cc', '')
if not (self._target_address in to or self._target_address in cc):
# Not a message for our support email,
return
sender = headers.get('from', '')
if self._team_domain not in sender:
# No a message from our team
return
# We will ignore if the email is only to the internal team, that is
# it does not have any outside TO or CC.
has_outside = False
for email in to.split('>, ') + cc.split('>, '):
email = email.strip()
if not email:
continue
if self._team_domain not in email:
has_outside = True
break
if not has_outside:
# Not a message outside the team.
return
subject = headers.get('subject', 'NO SUBJECT')
self._sendStatus(sender, subject)
def _sendStatus(self, sender, subject):
"""
Send an IRC notification.
"""
author = sender.split('@', 1)[0].split('<', 1)[1]
self._irc.queueMsg(ircmsgs.notice(
recipient=self._channel_name,
s='[support-inbox][%s] Replied to: %s' % (author, subject),
prefix='<support-notifications>',
))
Class = SupportNotifications
| 30.9 | 79 | 0.577229 | 1,097 | 10,197 | 5.220602 | 0.251595 | 0.015715 | 0.015715 | 0.01816 | 0.176707 | 0.145626 | 0.122228 | 0.087306 | 0.087306 | 0.074035 | 0 | 0.002338 | 0.32892 | 10,197 | 329 | 80 | 30.993921 | 0.834575 | 0.038541 | 0 | 0.304124 | 1 | 0 | 0.092732 | 0.008647 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.036082 | null | null | 0.005155 | 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 |
cb27ec17609d44f92920d957068c2736f843142c | 777 | py | Python | LobbyService/test/test_get_lobbies.py | Devin0xFFFFFF/singed-feathers | 747eef56fb3ba2a73cb7ba851462894efeddd00b | [
"BSD-3-Clause"
] | 1 | 2017-06-20T15:19:40.000Z | 2017-06-20T15:19:40.000Z | LobbyService/test/test_get_lobbies.py | Devin0xFFFFFF/singed-feathers | 747eef56fb3ba2a73cb7ba851462894efeddd00b | [
"BSD-3-Clause"
] | 3 | 2019-02-13T16:05:25.000Z | 2019-02-15T03:31:06.000Z | LobbyService/test/test_get_lobbies.py | Devin0xFFFFFF/singed-feathers | 747eef56fb3ba2a73cb7ba851462894efeddd00b | [
"BSD-3-Clause"
] | null | null | null | import pytest
from mock import Mock, patch
from service import get_lobbies
@patch('service.lobby_service_common.get_public_lobbies')
def test_get_lobbies(get_public_lobbies_mock):
get_public_lobbies_mock.return_value = {}
response = get_lobbies.lambda_handler({}, None)
valid_response = {'statusCode': 200, 'body': '{"Lobbies": {}}', 'headers': {'Access-Control-Allow-Origin': '*'}}
get_public_lobbies_mock.assert_called()
assert response == valid_response
@patch('service.lobby_service_common.get_public_lobbies')
def test_get_lobbies_dynamo_failure(get_public_lobbies_mock):
with pytest.raises(IOError):
get_public_lobbies_mock.side_effect = Mock(side_effect=IOError('Dynamo Exception'))
get_lobbies.lambda_handler({}, None)
| 29.884615 | 116 | 0.759331 | 100 | 777 | 5.5 | 0.38 | 0.114545 | 0.203636 | 0.181818 | 0.327273 | 0.229091 | 0.229091 | 0.229091 | 0.229091 | 0.229091 | 0 | 0.004412 | 0.124839 | 777 | 25 | 117 | 31.08 | 0.804412 | 0 | 0 | 0.133333 | 0 | 0 | 0.223938 | 0.155727 | 0 | 0 | 0 | 0 | 0.133333 | 1 | 0.133333 | false | 0 | 0.2 | 0 | 0.333333 | 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 |
cb52f297e432ab0e60e0a856d69e25f2ec7d762c | 1,432 | py | Python | svc/ivoiriansAPI.py | Ivoirians/hour-a-day | 1225d6b4548fbf2eebdf28be7eae32c41754b520 | [
"Apache-2.0"
] | null | null | null | svc/ivoiriansAPI.py | Ivoirians/hour-a-day | 1225d6b4548fbf2eebdf28be7eae32c41754b520 | [
"Apache-2.0"
] | null | null | null | svc/ivoiriansAPI.py | Ivoirians/hour-a-day | 1225d6b4548fbf2eebdf28be7eae32c41754b520 | [
"Apache-2.0"
] | null | null | null | import os
import redis
import code
import urlparse
import json
from werkzeug.wrappers import Request, Response
from werkzeug.routing import Map, Rule
from werkzeug.exceptions import HTTPException, NotFound
from werkzeug.wsgi import SharedDataMiddleware
from werkzeug.utils import redirect
from jinja2 import Environment, FileSystemLoader
import random
from api.counter import Counter
from api.comments import Comments
def rollDie(request):
return random.randint(1,6)
def getCounter(request):
return Counter.getCounterValue()
def addCounter(request):
return Counter.addCounterValue()
def getComments(request):
qs = urlparse.parse_qs(request.query_string)
return Comments.getComments(qs["page_number"])
def addComment(request):
formData = json.loads(request.data)
return Comments.addComment(formData["page_number"], formData["username"], formData["comment_text"])
services = {
'/rollDie': rollDie,
'/counter/get': getCounter,
'/counter/add': addCounter,
'/comments/get': getComments,
'/comments/add': addComment,
}
def start(environ, start_response):
request = Request(environ)
responseBody = "Service not found."
try:
responseBody = services[request.path.split("svc")[1]](request)
except Exception as e:
responseBody = "Could not execute service " + request.path.split("svc")[1] + ": \n" + str(e)
response = Response(str(responseBody), mimetype='text/plain')
return response(environ, start_response)
| 26.518519 | 100 | 0.773743 | 175 | 1,432 | 6.291429 | 0.428571 | 0.054496 | 0.036331 | 0.034514 | 0.036331 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00394 | 0.113827 | 1,432 | 53 | 101 | 27.018868 | 0.863672 | 0 | 0 | 0 | 0 | 0 | 0.114605 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.333333 | 0.071429 | 0.619048 | 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 |
cb5837210fd058388e872dafed24e5a5f22d8292 | 386 | py | Python | beamr/parsers/generic.py | teonistor/py-beams | 2b954bc000607cc2b4cd56ac080da90c889f1643 | [
"MIT"
] | 3 | 2019-11-11T13:25:34.000Z | 2021-02-04T14:15:12.000Z | beamr/parsers/generic.py | teonistor/beamr | 2b954bc000607cc2b4cd56ac080da90c889f1643 | [
"MIT"
] | null | null | null | beamr/parsers/generic.py | teonistor/beamr | 2b954bc000607cc2b4cd56ac080da90c889f1643 | [
"MIT"
] | null | null | null | '''
Functionality common to all parsers
Created on 1 Feb 2018
@author: Teodor G Nistor
@copyright: 2018 Teodor G Nistor
@license: MIT License
'''
from beamr.debug import warn
def p_nil(p): # An empty production
'nil :'
pass
def p_error(t): # Parsing error
try:
warn("Syntax error at token value", t.value)
except:
warn("Syntax error at", t)
| 17.545455 | 52 | 0.647668 | 57 | 386 | 4.350877 | 0.666667 | 0.056452 | 0.104839 | 0.137097 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.031359 | 0.256477 | 386 | 21 | 53 | 18.380952 | 0.832753 | 0.489637 | 0 | 0 | 0 | 0 | 0.242268 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0.111111 | 0.111111 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
cb665aa274b71e0f1b9621b1df3278784b362d8f | 223 | py | Python | azdashboard/config/environments/production.py | alinlacea/azdashboard | 3ca41bfdac21c324789937c60491dcbb1d70b05c | [
"MIT"
] | null | null | null | azdashboard/config/environments/production.py | alinlacea/azdashboard | 3ca41bfdac21c324789937c60491dcbb1d70b05c | [
"MIT"
] | null | null | null | azdashboard/config/environments/production.py | alinlacea/azdashboard | 3ca41bfdac21c324789937c60491dcbb1d70b05c | [
"MIT"
] | null | null | null | # server backend
server = 'cherrypy'
# debug error messages
debug = False
# auto-reload
reloader = False
# database url
db_url = 'postgresql://user:pass@localhost/dbname'
# echo database engine messages
db_echo = False
| 14.866667 | 50 | 0.744395 | 29 | 223 | 5.655172 | 0.689655 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.161435 | 223 | 14 | 51 | 15.928571 | 0.877005 | 0.403587 | 0 | 0 | 0 | 0 | 0.370079 | 0.307087 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.2 | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
cb83bfc3bc5471588970f456d7d61bea25c6a0d0 | 1,046 | py | Python | target/opsdev/WEB-INF/classes/shell/updateMobileManagerDataSource.py | ws02752587/opsdev | 1c0ba65defd80af2570e7fcdf1c45277235d7d0d | [
"Apache-2.0"
] | null | null | null | target/opsdev/WEB-INF/classes/shell/updateMobileManagerDataSource.py | ws02752587/opsdev | 1c0ba65defd80af2570e7fcdf1c45277235d7d0d | [
"Apache-2.0"
] | null | null | null | target/opsdev/WEB-INF/classes/shell/updateMobileManagerDataSource.py | ws02752587/opsdev | 1c0ba65defd80af2570e7fcdf1c45277235d7d0d | [
"Apache-2.0"
] | null | null | null | import sys
import re
argvs = list(sys.argv)
result = ''
dataSourceName=argvs[1]
name=argvs[2]
if not dataSourceName or not name:
return
path="/mobile/app/upload/"+name+"/WEB-INF/classes/spring/applicationContext-ibatis.xml"
with open(path) as file:
result = file.read()
result = re.sub('<bean\\s+id\\s*=\\s*"dataSourceFrom".*?org.apache.commons.dbcp.BasicDataSource.*?</bean>', "", result,flags=re.S,count=1)
jndiStr = re.findall('<!--\\s*(<bean\\s+id\\s*=\\s*"dataSourceFrom".*?org.springframework.jndi.JndiObjectFactoryBean.*?)-->', result, flags=re.S)
if not jndiStr:
jndiStr="""
<bean id="dataSourceFrom" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"><value>"""+dataSourceName+"""</value>
</property>
</bean>
"""
else:
jndiStr = jndiStr[0]
result = re.sub('<!--\\s*(<bean\\s+id\\s*=\\s*"dataSourceFrom".*?org.springframework.jndi.JndiObjectFactoryBean.*?)-->',jndiStr ,result, flags=re.S)
with open(path, "w", encoding="UTF-8") as file:
file.write(result)
print "success" | 37.357143 | 148 | 0.681644 | 138 | 1,046 | 5.166667 | 0.442029 | 0.021038 | 0.029453 | 0.033661 | 0.224404 | 0.224404 | 0.224404 | 0.187938 | 0.187938 | 0.187938 | 0 | 0.005291 | 0.096558 | 1,046 | 28 | 149 | 37.357143 | 0.749206 | 0 | 0 | 0 | 0 | 0.115385 | 0.509074 | 0.402101 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.076923 | null | null | 0.038462 | 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 | 1 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
cb9b068c1540439ce7eb94e4bb675995b9770c42 | 76 | py | Python | ajaximage/__init__.py | kitsunefet/django-ajax-image-upload | bca4049b4fd4e1474892561ab170235936fa25d7 | [
"MIT"
] | 11 | 2018-01-29T12:57:58.000Z | 2020-07-27T22:47:14.000Z | ajaximage/__init__.py | kitsunefet/django-ajax-image-upload | bca4049b4fd4e1474892561ab170235936fa25d7 | [
"MIT"
] | 5 | 2021-03-19T03:23:05.000Z | 2022-03-11T23:58:21.000Z | ajaximage/__init__.py | kitsunefet/django-ajax-image-upload | bca4049b4fd4e1474892561ab170235936fa25d7 | [
"MIT"
] | 2 | 2019-09-03T11:22:56.000Z | 2020-04-10T14:20:57.000Z | __version__ = '0.9.4'
default_app_config = 'ajaximage.apps.AjaxImageConfig'
| 25.333333 | 53 | 0.789474 | 10 | 76 | 5.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.042857 | 0.078947 | 76 | 2 | 54 | 38 | 0.728571 | 0 | 0 | 0 | 0 | 0 | 0.460526 | 0.394737 | 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 |
cba336f303822d216fee29cb5e72a4202e1f1e8c | 23,152 | py | Python | sdk/python/pulumi_google_native/clouddeploy/v1/rollout.py | AaronFriel/pulumi-google-native | 75d1cda425e33d4610348972cd70bddf35f1770d | [
"Apache-2.0"
] | 44 | 2021-04-18T23:00:48.000Z | 2022-02-14T17:43:15.000Z | sdk/python/pulumi_google_native/clouddeploy/v1/rollout.py | AaronFriel/pulumi-google-native | 75d1cda425e33d4610348972cd70bddf35f1770d | [
"Apache-2.0"
] | 354 | 2021-04-16T16:48:39.000Z | 2022-03-31T17:16:39.000Z | sdk/python/pulumi_google_native/clouddeploy/v1/rollout.py | AaronFriel/pulumi-google-native | 75d1cda425e33d4610348972cd70bddf35f1770d | [
"Apache-2.0"
] | 8 | 2021-04-24T17:46:51.000Z | 2022-01-05T10:40:21.000Z | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
__all__ = ['RolloutArgs', 'Rollout']
@pulumi.input_type
class RolloutArgs:
def __init__(__self__, *,
delivery_pipeline_id: pulumi.Input[str],
release_id: pulumi.Input[str],
rollout_id: pulumi.Input[str],
target_id: pulumi.Input[str],
annotations: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
description: Optional[pulumi.Input[str]] = None,
etag: Optional[pulumi.Input[str]] = None,
labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
location: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
project: Optional[pulumi.Input[str]] = None,
request_id: Optional[pulumi.Input[str]] = None,
validate_only: Optional[pulumi.Input[str]] = None):
"""
The set of arguments for constructing a Rollout resource.
:param pulumi.Input[str] target_id: The ID of Target to which this `Rollout` is deploying.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] annotations: User annotations. These attributes can only be set and used by the user, and not by Google Cloud Deploy. See https://google.aip.dev/128#annotations for more details such as format and size limitations.
:param pulumi.Input[str] description: Description of the `Rollout` for user purposes. Max length is 255 characters.
:param pulumi.Input[str] etag: This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] labels: Labels are attributes that can be set and used by both the user and by Google Cloud Deploy. Labels must meet the following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values are additionally constrained to be <= 128 bytes.
:param pulumi.Input[str] name: Optional. Name of the `Rollout`. Format is projects/{project}/ locations/{location}/deliveryPipelines/{deliveryPipeline}/ releases/{release}/rollouts/a-z{0,62}.
"""
pulumi.set(__self__, "delivery_pipeline_id", delivery_pipeline_id)
pulumi.set(__self__, "release_id", release_id)
pulumi.set(__self__, "rollout_id", rollout_id)
pulumi.set(__self__, "target_id", target_id)
if annotations is not None:
pulumi.set(__self__, "annotations", annotations)
if description is not None:
pulumi.set(__self__, "description", description)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if labels is not None:
pulumi.set(__self__, "labels", labels)
if location is not None:
pulumi.set(__self__, "location", location)
if name is not None:
pulumi.set(__self__, "name", name)
if project is not None:
pulumi.set(__self__, "project", project)
if request_id is not None:
pulumi.set(__self__, "request_id", request_id)
if validate_only is not None:
pulumi.set(__self__, "validate_only", validate_only)
@property
@pulumi.getter(name="deliveryPipelineId")
def delivery_pipeline_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "delivery_pipeline_id")
@delivery_pipeline_id.setter
def delivery_pipeline_id(self, value: pulumi.Input[str]):
pulumi.set(self, "delivery_pipeline_id", value)
@property
@pulumi.getter(name="releaseId")
def release_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "release_id")
@release_id.setter
def release_id(self, value: pulumi.Input[str]):
pulumi.set(self, "release_id", value)
@property
@pulumi.getter(name="rolloutId")
def rollout_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "rollout_id")
@rollout_id.setter
def rollout_id(self, value: pulumi.Input[str]):
pulumi.set(self, "rollout_id", value)
@property
@pulumi.getter(name="targetId")
def target_id(self) -> pulumi.Input[str]:
"""
The ID of Target to which this `Rollout` is deploying.
"""
return pulumi.get(self, "target_id")
@target_id.setter
def target_id(self, value: pulumi.Input[str]):
pulumi.set(self, "target_id", value)
@property
@pulumi.getter
def annotations(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
User annotations. These attributes can only be set and used by the user, and not by Google Cloud Deploy. See https://google.aip.dev/128#annotations for more details such as format and size limitations.
"""
return pulumi.get(self, "annotations")
@annotations.setter
def annotations(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
pulumi.set(self, "annotations", value)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
"""
Description of the `Rollout` for user purposes. Max length is 255 characters.
"""
return pulumi.get(self, "description")
@description.setter
def description(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "description", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def labels(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
Labels are attributes that can be set and used by both the user and by Google Cloud Deploy. Labels must meet the following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values are additionally constrained to be <= 128 bytes.
"""
return pulumi.get(self, "labels")
@labels.setter
def labels(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
pulumi.set(self, "labels", value)
@property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "location")
@location.setter
def location(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "location", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Optional. Name of the `Rollout`. Format is projects/{project}/ locations/{location}/deliveryPipelines/{deliveryPipeline}/ releases/{release}/rollouts/a-z{0,62}.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def project(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "project")
@project.setter
def project(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "project", value)
@property
@pulumi.getter(name="requestId")
def request_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "request_id")
@request_id.setter
def request_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "request_id", value)
@property
@pulumi.getter(name="validateOnly")
def validate_only(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "validate_only")
@validate_only.setter
def validate_only(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "validate_only", value)
class Rollout(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
annotations: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
delivery_pipeline_id: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
etag: Optional[pulumi.Input[str]] = None,
labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
location: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
project: Optional[pulumi.Input[str]] = None,
release_id: Optional[pulumi.Input[str]] = None,
request_id: Optional[pulumi.Input[str]] = None,
rollout_id: Optional[pulumi.Input[str]] = None,
target_id: Optional[pulumi.Input[str]] = None,
validate_only: Optional[pulumi.Input[str]] = None,
__props__=None):
"""
Creates a new Rollout in a given project and location.
Auto-naming is currently not supported for this resource.
Note - this resource's API doesn't support deletion. When deleted, the resource will persist
on Google Cloud even though it will be deleted from Pulumi state.
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] annotations: User annotations. These attributes can only be set and used by the user, and not by Google Cloud Deploy. See https://google.aip.dev/128#annotations for more details such as format and size limitations.
:param pulumi.Input[str] description: Description of the `Rollout` for user purposes. Max length is 255 characters.
:param pulumi.Input[str] etag: This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] labels: Labels are attributes that can be set and used by both the user and by Google Cloud Deploy. Labels must meet the following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values are additionally constrained to be <= 128 bytes.
:param pulumi.Input[str] name: Optional. Name of the `Rollout`. Format is projects/{project}/ locations/{location}/deliveryPipelines/{deliveryPipeline}/ releases/{release}/rollouts/a-z{0,62}.
:param pulumi.Input[str] target_id: The ID of Target to which this `Rollout` is deploying.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: RolloutArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
Creates a new Rollout in a given project and location.
Auto-naming is currently not supported for this resource.
Note - this resource's API doesn't support deletion. When deleted, the resource will persist
on Google Cloud even though it will be deleted from Pulumi state.
:param str resource_name: The name of the resource.
:param RolloutArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
def __init__(__self__, resource_name: str, *args, **kwargs):
resource_args, opts = _utilities.get_resource_args_opts(RolloutArgs, pulumi.ResourceOptions, *args, **kwargs)
if resource_args is not None:
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
else:
__self__._internal_init(resource_name, *args, **kwargs)
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
annotations: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
delivery_pipeline_id: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
etag: Optional[pulumi.Input[str]] = None,
labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
location: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
project: Optional[pulumi.Input[str]] = None,
release_id: Optional[pulumi.Input[str]] = None,
request_id: Optional[pulumi.Input[str]] = None,
rollout_id: Optional[pulumi.Input[str]] = None,
target_id: Optional[pulumi.Input[str]] = None,
validate_only: Optional[pulumi.Input[str]] = None,
__props__=None):
if opts is None:
opts = pulumi.ResourceOptions()
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.version is None:
opts.version = _utilities.get_version()
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = RolloutArgs.__new__(RolloutArgs)
__props__.__dict__["annotations"] = annotations
if delivery_pipeline_id is None and not opts.urn:
raise TypeError("Missing required property 'delivery_pipeline_id'")
__props__.__dict__["delivery_pipeline_id"] = delivery_pipeline_id
__props__.__dict__["description"] = description
__props__.__dict__["etag"] = etag
__props__.__dict__["labels"] = labels
__props__.__dict__["location"] = location
__props__.__dict__["name"] = name
__props__.__dict__["project"] = project
if release_id is None and not opts.urn:
raise TypeError("Missing required property 'release_id'")
__props__.__dict__["release_id"] = release_id
__props__.__dict__["request_id"] = request_id
if rollout_id is None and not opts.urn:
raise TypeError("Missing required property 'rollout_id'")
__props__.__dict__["rollout_id"] = rollout_id
if target_id is None and not opts.urn:
raise TypeError("Missing required property 'target_id'")
__props__.__dict__["target_id"] = target_id
__props__.__dict__["validate_only"] = validate_only
__props__.__dict__["approval_state"] = None
__props__.__dict__["approve_time"] = None
__props__.__dict__["create_time"] = None
__props__.__dict__["deploy_end_time"] = None
__props__.__dict__["deploy_failure_cause"] = None
__props__.__dict__["deploy_start_time"] = None
__props__.__dict__["deploying_build"] = None
__props__.__dict__["enqueue_time"] = None
__props__.__dict__["failure_reason"] = None
__props__.__dict__["state"] = None
__props__.__dict__["uid"] = None
super(Rollout, __self__).__init__(
'google-native:clouddeploy/v1:Rollout',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None) -> 'Rollout':
"""
Get an existing Rollout resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = RolloutArgs.__new__(RolloutArgs)
__props__.__dict__["annotations"] = None
__props__.__dict__["approval_state"] = None
__props__.__dict__["approve_time"] = None
__props__.__dict__["create_time"] = None
__props__.__dict__["deploy_end_time"] = None
__props__.__dict__["deploy_failure_cause"] = None
__props__.__dict__["deploy_start_time"] = None
__props__.__dict__["deploying_build"] = None
__props__.__dict__["description"] = None
__props__.__dict__["enqueue_time"] = None
__props__.__dict__["etag"] = None
__props__.__dict__["failure_reason"] = None
__props__.__dict__["labels"] = None
__props__.__dict__["name"] = None
__props__.__dict__["state"] = None
__props__.__dict__["target_id"] = None
__props__.__dict__["uid"] = None
return Rollout(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter
def annotations(self) -> pulumi.Output[Mapping[str, str]]:
"""
User annotations. These attributes can only be set and used by the user, and not by Google Cloud Deploy. See https://google.aip.dev/128#annotations for more details such as format and size limitations.
"""
return pulumi.get(self, "annotations")
@property
@pulumi.getter(name="approvalState")
def approval_state(self) -> pulumi.Output[str]:
"""
Approval state of the `Rollout`.
"""
return pulumi.get(self, "approval_state")
@property
@pulumi.getter(name="approveTime")
def approve_time(self) -> pulumi.Output[str]:
"""
Time at which the `Rollout` was approved.
"""
return pulumi.get(self, "approve_time")
@property
@pulumi.getter(name="createTime")
def create_time(self) -> pulumi.Output[str]:
"""
Time at which the `Rollout` was created.
"""
return pulumi.get(self, "create_time")
@property
@pulumi.getter(name="deployEndTime")
def deploy_end_time(self) -> pulumi.Output[str]:
"""
Time at which the `Rollout` finished deploying.
"""
return pulumi.get(self, "deploy_end_time")
@property
@pulumi.getter(name="deployFailureCause")
def deploy_failure_cause(self) -> pulumi.Output[str]:
"""
The reason this deploy failed. This will always be unspecified while the deploy in progress.
"""
return pulumi.get(self, "deploy_failure_cause")
@property
@pulumi.getter(name="deployStartTime")
def deploy_start_time(self) -> pulumi.Output[str]:
"""
Time at which the `Rollout` started deploying.
"""
return pulumi.get(self, "deploy_start_time")
@property
@pulumi.getter(name="deployingBuild")
def deploying_build(self) -> pulumi.Output[str]:
"""
The resource name of the Cloud Build `Build` object that is used to deploy the Rollout. Format is `projects/{project}/locations/{location}/builds/{build}`.
"""
return pulumi.get(self, "deploying_build")
@property
@pulumi.getter
def description(self) -> pulumi.Output[str]:
"""
Description of the `Rollout` for user purposes. Max length is 255 characters.
"""
return pulumi.get(self, "description")
@property
@pulumi.getter(name="enqueueTime")
def enqueue_time(self) -> pulumi.Output[str]:
"""
Time at which the `Rollout` was enqueued.
"""
return pulumi.get(self, "enqueue_time")
@property
@pulumi.getter
def etag(self) -> pulumi.Output[str]:
"""
This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
"""
return pulumi.get(self, "etag")
@property
@pulumi.getter(name="failureReason")
def failure_reason(self) -> pulumi.Output[str]:
"""
Reason the build failed. Empty if the build succeeded.
"""
return pulumi.get(self, "failure_reason")
@property
@pulumi.getter
def labels(self) -> pulumi.Output[Mapping[str, str]]:
"""
Labels are attributes that can be set and used by both the user and by Google Cloud Deploy. Labels must meet the following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values are additionally constrained to be <= 128 bytes.
"""
return pulumi.get(self, "labels")
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
"""
Optional. Name of the `Rollout`. Format is projects/{project}/ locations/{location}/deliveryPipelines/{deliveryPipeline}/ releases/{release}/rollouts/a-z{0,62}.
"""
return pulumi.get(self, "name")
@property
@pulumi.getter
def state(self) -> pulumi.Output[str]:
"""
Current state of the `Rollout`.
"""
return pulumi.get(self, "state")
@property
@pulumi.getter(name="targetId")
def target_id(self) -> pulumi.Output[str]:
"""
The ID of Target to which this `Rollout` is deploying.
"""
return pulumi.get(self, "target_id")
@property
@pulumi.getter
def uid(self) -> pulumi.Output[str]:
"""
Unique identifier of the `Rollout`.
"""
return pulumi.get(self, "uid")
| 47.056911 | 581 | 0.649447 | 2,810 | 23,152 | 5.115302 | 0.096797 | 0.071935 | 0.076944 | 0.065813 | 0.769514 | 0.700431 | 0.641645 | 0.618339 | 0.590789 | 0.532002 | 0 | 0.003551 | 0.24581 | 23,152 | 491 | 582 | 47.152749 | 0.819655 | 0.317294 | 0 | 0.399381 | 1 | 0 | 0.104644 | 0.003876 | 0 | 0 | 0 | 0 | 0 | 1 | 0.151703 | false | 0.003096 | 0.01548 | 0.021672 | 0.26935 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 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 |
cbb368bf34a52b4d1ae95c69d88a1beadca9817c | 903 | py | Python | image/__init__.py | navroz-lamba/Image-Classifier-using-VGG-19-CNN | baceb95297b95be19d7e024eac50d5f754d26fa7 | [
"MIT"
] | 1 | 2020-12-18T18:45:00.000Z | 2020-12-18T18:45:00.000Z | image/__init__.py | navroz-lamba/Image-Classifier-using-VGG-19-CNN | baceb95297b95be19d7e024eac50d5f754d26fa7 | [
"MIT"
] | null | null | null | image/__init__.py | navroz-lamba/Image-Classifier-using-VGG-19-CNN | baceb95297b95be19d7e024eac50d5f754d26fa7 | [
"MIT"
] | null | null | null | import flask
from flask import Flask, url_for
from tensorflow.keras.applications.imagenet_utils import preprocess_input, decode_predictions
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing import image
import numpy as np
# instantiating a class object
app = Flask(__name__)
model_path = 'vgg19.h5'
# load the model
model = load_model(model_path)
# model._make_predict_function()
# preprocessing function
def model_predict(img_path, model):
# load the image and set the size to 224,224
img = image.load_img(img_path, target_size=(224,224))
# change the image to array
x = image.img_to_array(img)
# add dimension so we could pass it as an input to the network
x = np.expand_dims(x, axis=0)
# scale the input
x = preprocess_input(x)
# make predictions
preds = model.predict(x)
return preds
from image import routes | 27.363636 | 93 | 0.746401 | 137 | 903 | 4.744526 | 0.459854 | 0.064615 | 0.087692 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021739 | 0.184939 | 903 | 33 | 94 | 27.363636 | 0.861413 | 0.291251 | 0 | 0 | 0 | 0 | 0.012678 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.058824 | false | 0 | 0.411765 | 0 | 0.529412 | 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 |
cbb6cf178d364c3e00e075d9dd9ffee20b00a722 | 9,680 | py | Python | tests/plugins/inventory/test_simple_inventory.py | kyawmyomin/nornir | 4ae009ac894ec5b412c9859fe699b68747526255 | [
"Apache-2.0"
] | null | null | null | tests/plugins/inventory/test_simple_inventory.py | kyawmyomin/nornir | 4ae009ac894ec5b412c9859fe699b68747526255 | [
"Apache-2.0"
] | null | null | null | tests/plugins/inventory/test_simple_inventory.py | kyawmyomin/nornir | 4ae009ac894ec5b412c9859fe699b68747526255 | [
"Apache-2.0"
] | null | null | null | import os
from nornir.plugins.inventory import SimpleInventory
dir_path = os.path.dirname(os.path.realpath(__file__))
class Test:
def test(self):
host_file = f"{dir_path}/data/hosts.yaml"
group_file = f"{dir_path}/data/groups.yaml"
defaults_file = f"{dir_path}/data/defaults.yaml"
inv = SimpleInventory(host_file, group_file, defaults_file).load()
assert inv.dict() == {
"defaults": {
"connection_options": {
"dummy": {
"extras": {"blah": "from_defaults"},
"hostname": "dummy_from_defaults",
"password": None,
"platform": None,
"port": None,
"username": None,
}
},
"data": {
"my_var": "comes_from_defaults",
"only_default": "only_defined_in_default",
},
"hostname": None,
"password": "docker",
"platform": "linux",
"port": None,
"username": "root",
},
"groups": {
"group_1": {
"connection_options": {},
"data": {"my_var": "comes_from_group_1", "site": "site1"},
"groups": ["parent_group"],
"hostname": None,
"name": "group_1",
"password": "from_group1",
"platform": "linux",
"port": None,
"username": "root",
},
"group_2": {
"connection_options": {},
"data": {"site": "site2"},
"groups": [],
"hostname": None,
"name": "group_2",
"password": "docker",
"platform": "linux",
"port": None,
"username": "root",
},
"group_3": {
"connection_options": {},
"data": {"site": "site2"},
"groups": [],
"hostname": None,
"name": "group_3",
"password": "docker",
"platform": "linux",
"port": None,
"username": "root",
},
"parent_group": {
"connection_options": {
"dummy": {
"extras": {"blah": "from_group"},
"hostname": "dummy_from_parent_group",
"password": None,
"platform": None,
"port": None,
"username": None,
},
"dummy2": {
"extras": {"blah": "from_group"},
"hostname": "dummy2_from_parent_group",
"password": None,
"platform": None,
"port": None,
"username": None,
},
},
"data": {"a_false_var": False, "a_var": "blah"},
"groups": [],
"hostname": None,
"name": "parent_group",
"password": "from_parent_group",
"platform": "linux",
"port": None,
"username": "root",
},
},
"hosts": {
"dev1.group_1": {
"connection_options": {
"dummy": {
"extras": {"blah": "from_host"},
"hostname": "dummy_from_host",
"password": None,
"platform": None,
"port": None,
"username": None,
},
"paramiko": {
"extras": {},
"hostname": None,
"password": "docker",
"platform": "linux",
"port": 65020,
"username": "root",
},
},
"data": {
"my_var": "comes_from_dev1.group_1",
"nested_data": {
"a_dict": {"a": 1, "b": 2},
"a_list": [1, 2],
"a_string": "asdasd",
},
"role": "www",
"www_server": "nginx",
},
"groups": ["group_1"],
"hostname": "localhost",
"name": "dev1.group_1",
"password": "a_password",
"platform": "eos",
"port": 65020,
"username": "root",
},
"dev2.group_1": {
"connection_options": {
"dummy2": {
"extras": None,
"hostname": None,
"password": None,
"platform": None,
"port": None,
"username": "dummy2_from_host",
},
"paramiko": {
"extras": {},
"hostname": None,
"password": "docker",
"platform": "linux",
"port": None,
"username": "root",
},
},
"data": {
"nested_data": {
"a_dict": {"b": 2, "c": 3},
"a_list": [2, 3],
"a_string": "qwe",
},
"role": "db",
},
"groups": ["group_1"],
"hostname": "localhost",
"name": "dev2.group_1",
"password": "from_group1",
"platform": "junos",
"port": 65021,
"username": "root",
},
"dev3.group_2": {
"connection_options": {
"nornir_napalm.napalm": {
"extras": {},
"hostname": None,
"password": None,
"platform": "mock",
"port": None,
"username": None,
}
},
"data": {"role": "www", "www_server": "apache"},
"groups": ["group_2"],
"hostname": "localhost",
"name": "dev3.group_2",
"password": "docker",
"platform": "linux",
"port": 65022,
"username": "root",
},
"dev4.group_2": {
"connection_options": {
"netmiko": {
"extras": {},
"hostname": "localhost",
"password": "docker",
"platform": "linux",
"port": None,
"username": "root",
},
"paramiko": {
"extras": {},
"hostname": "localhost",
"password": "docker",
"platform": "linux",
"port": None,
"username": "root",
},
},
"data": {"my_var": "comes_from_dev4.group_2", "role": "db"},
"groups": ["parent_group", "group_2"],
"hostname": "localhost",
"name": "dev4.group_2",
"password": "from_parent_group",
"platform": "linux",
"port": 65023,
"username": "root",
},
"dev5.no_group": {
"connection_options": {},
"data": {},
"groups": [],
"hostname": "localhost",
"name": "dev5.no_group",
"password": "docker",
"platform": "linux",
"port": 65024,
"username": "root",
},
},
}
def test_simple_inventory_empty(self):
"""Verify completely empty groups.yaml and defaults.yaml doesn't generate exception."""
host_file = f"{dir_path}/data/hosts-nogroups.yaml"
group_file = f"{dir_path}/data/groups-empty.yaml"
defaults_file = f"{dir_path}/data/defaults-empty.yaml"
inv = SimpleInventory(host_file, group_file, defaults_file).load()
assert len(inv.hosts) == 1
assert inv.groups == {}
assert inv.defaults.data == {}
| 39.510204 | 95 | 0.31219 | 575 | 9,680 | 5.053913 | 0.17913 | 0.038541 | 0.077082 | 0.08362 | 0.61287 | 0.535444 | 0.450791 | 0.349277 | 0.255678 | 0.210599 | 0 | 0.018996 | 0.559504 | 9,680 | 244 | 96 | 39.672131 | 0.662523 | 0.008368 | 0 | 0.538136 | 0 | 0 | 0.250078 | 0.031377 | 0 | 0 | 0 | 0 | 0.016949 | 1 | 0.008475 | false | 0.084746 | 0.008475 | 0 | 0.021186 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 |
cbc1c81f810a9f128eb409484181a04a43ba666d | 262 | py | Python | sts/metric.py | LostCow/KLUE | 73b1b0526cf6b1b6f5ef535b9527d8abe6ca1a77 | [
"MIT"
] | 18 | 2021-12-22T09:41:24.000Z | 2022-03-19T12:54:30.000Z | sts/metric.py | LostCow/KLUE | 73b1b0526cf6b1b6f5ef535b9527d8abe6ca1a77 | [
"MIT"
] | null | null | null | sts/metric.py | LostCow/KLUE | 73b1b0526cf6b1b6f5ef535b9527d8abe6ca1a77 | [
"MIT"
] | 4 | 2021-12-26T11:31:46.000Z | 2022-03-28T07:55:45.000Z | from datasets import load_metric
def compute_metrics(pred):
pearson = load_metric("pearsonr").compute
references = pred.label_ids
predictions = pred.predictions
metric = pearson(predictions=predictions, references=references)
return metric
| 26.2 | 68 | 0.763359 | 29 | 262 | 6.758621 | 0.551724 | 0.102041 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164122 | 262 | 9 | 69 | 29.111111 | 0.894977 | 0 | 0 | 0 | 0 | 0 | 0.030534 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.428571 | 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 |
cbc761dabe74f703096f63ce1ad894e6e2334799 | 1,000 | py | Python | app/pages/forms.py | MicroprocessorX069/Todo-web-app | c68f2e26eec1c89ab2257a22071133216c743ca0 | [
"Apache-2.0"
] | null | null | null | app/pages/forms.py | MicroprocessorX069/Todo-web-app | c68f2e26eec1c89ab2257a22071133216c743ca0 | [
"Apache-2.0"
] | 1 | 2021-06-02T00:55:48.000Z | 2021-06-02T00:55:48.000Z | app/pages/forms.py | MicroprocessorX069/Todo-web-app | c68f2e26eec1c89ab2257a22071133216c743ca0 | [
"Apache-2.0"
] | null | null | null | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField, TextAreaField
from wtforms.validators import ValidationError, DataRequired, Email, EqualTo, Length
from app.models import User
from flask import request
class CreateChallengeForm(FlaskForm):
name = StringField('Name', validators = [DataRequired()])
description = TextAreaField('About the challenge', validators = [Length(min = 0, max = 600)])
total_days = StringField('Total days', validators=[DataRequired()])
interval = StringField('Interval')
type = StringField('Type')
submit = SubmitField('Add challenge')
class EditChallengeForm(FlaskForm):
description = TextAreaField('About the challenge', validators = [Length(min = 0, max = 600)])
total_days = StringField('Total days', validators=[DataRequired()])
interval = StringField('Interval')
submit = SubmitField('Edit challenge')
def __init__(self, *args, **kwargs):
super(EditChallengeForm, self).__init__(*args, **kwargs)
| 43.478261 | 94 | 0.766 | 106 | 1,000 | 7.122642 | 0.433962 | 0.047682 | 0.076821 | 0.084768 | 0.384106 | 0.384106 | 0.384106 | 0.384106 | 0.384106 | 0.384106 | 0 | 0.009029 | 0.114 | 1,000 | 22 | 95 | 45.454545 | 0.843115 | 0 | 0 | 0.315789 | 0 | 0 | 0.109 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | false | 0.052632 | 0.263158 | 0 | 0.947368 | 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 |
cbcc9ac8c10c1c0b1c3e2bbf32ea484ec87b41ee | 329 | py | Python | 8/8.10/great_magician.py | singi2016cn/python-scaffold | 274e508d1919da67e599aa73be139800c043bce4 | [
"MIT"
] | null | null | null | 8/8.10/great_magician.py | singi2016cn/python-scaffold | 274e508d1919da67e599aa73be139800c043bce4 | [
"MIT"
] | null | null | null | 8/8.10/great_magician.py | singi2016cn/python-scaffold | 274e508d1919da67e599aa73be139800c043bce4 | [
"MIT"
] | null | null | null | # 魔术师
def show_magicians(magicians):
for magician in magicians:
print('magician\'s name is ' + magician)
def make_great(magicians):
i = 0
for item in magicians:
magicians[i] = 'The Great ' + item
i = i + 1
magicians = ['singi', 'sunjun']
make_great(magicians)
show_magicians(magicians)
| 16.45 | 48 | 0.632219 | 42 | 329 | 4.857143 | 0.47619 | 0.264706 | 0.215686 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008163 | 0.255319 | 329 | 19 | 49 | 17.315789 | 0.82449 | 0.009119 | 0 | 0 | 0 | 0 | 0.092593 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0 | 0 | 0.181818 | 0.090909 | 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 |
cbd7e3697d362246ff728b1ea5a7f422a2d3dc8c | 3,198 | py | Python | sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2_preview/models/__init__.py | vbarbaresi/azure-sdk-for-python | 397ba46c51d001ff89c66b170f5576cf8f49c05f | [
"MIT"
] | 8 | 2021-01-13T23:44:08.000Z | 2021-03-17T10:13:36.000Z | sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2_preview/models/__init__.py | vbarbaresi/azure-sdk-for-python | 397ba46c51d001ff89c66b170f5576cf8f49c05f | [
"MIT"
] | 2 | 2020-03-03T23:11:13.000Z | 2020-03-30T18:50:55.000Z | sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/v7_2_preview/models/__init__.py | vbarbaresi/azure-sdk-for-python | 397ba46c51d001ff89c66b170f5576cf8f49c05f | [
"MIT"
] | 2 | 2020-05-21T22:51:22.000Z | 2020-05-26T20:53:01.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
try:
from ._models_py3 import Attributes
from ._models_py3 import Error
from ._models_py3 import FullBackupOperation
from ._models_py3 import KeyVaultError
from ._models_py3 import Permission
from ._models_py3 import RestoreOperation
from ._models_py3 import RestoreOperationParameters
from ._models_py3 import RoleAssignment
from ._models_py3 import RoleAssignmentCreateParameters
from ._models_py3 import RoleAssignmentFilter
from ._models_py3 import RoleAssignmentListResult
from ._models_py3 import RoleAssignmentProperties
from ._models_py3 import RoleAssignmentPropertiesWithScope
from ._models_py3 import RoleDefinition
from ._models_py3 import RoleDefinitionFilter
from ._models_py3 import RoleDefinitionListResult
from ._models_py3 import SASTokenParameter
from ._models_py3 import SelectiveKeyRestoreOperation
from ._models_py3 import SelectiveKeyRestoreOperationParameters
except (SyntaxError, ImportError):
from ._models import Attributes # type: ignore
from ._models import Error # type: ignore
from ._models import FullBackupOperation # type: ignore
from ._models import KeyVaultError # type: ignore
from ._models import Permission # type: ignore
from ._models import RestoreOperation # type: ignore
from ._models import RestoreOperationParameters # type: ignore
from ._models import RoleAssignment # type: ignore
from ._models import RoleAssignmentCreateParameters # type: ignore
from ._models import RoleAssignmentFilter # type: ignore
from ._models import RoleAssignmentListResult # type: ignore
from ._models import RoleAssignmentProperties # type: ignore
from ._models import RoleAssignmentPropertiesWithScope # type: ignore
from ._models import RoleDefinition # type: ignore
from ._models import RoleDefinitionFilter # type: ignore
from ._models import RoleDefinitionListResult # type: ignore
from ._models import SASTokenParameter # type: ignore
from ._models import SelectiveKeyRestoreOperation # type: ignore
from ._models import SelectiveKeyRestoreOperationParameters # type: ignore
__all__ = [
'Attributes',
'Error',
'FullBackupOperation',
'KeyVaultError',
'Permission',
'RestoreOperation',
'RestoreOperationParameters',
'RoleAssignment',
'RoleAssignmentCreateParameters',
'RoleAssignmentFilter',
'RoleAssignmentListResult',
'RoleAssignmentProperties',
'RoleAssignmentPropertiesWithScope',
'RoleDefinition',
'RoleDefinitionFilter',
'RoleDefinitionListResult',
'SASTokenParameter',
'SelectiveKeyRestoreOperation',
'SelectiveKeyRestoreOperationParameters',
]
| 45.042254 | 94 | 0.735147 | 280 | 3,198 | 8.178571 | 0.246429 | 0.165939 | 0.10786 | 0.157642 | 0.204367 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007519 | 0.16823 | 3,198 | 70 | 95 | 45.685714 | 0.853383 | 0.218574 | 0 | 0 | 0 | 0 | 0.155744 | 0.091828 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.639344 | 0 | 0.639344 | 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 |
cbd972da2a2d979e028c1ffafee8336e9a3e9560 | 447 | py | Python | fitbox/consultas/views.py | ravellys/fitbox | 3ca61bf4d27f47dd7fabb1301afdf5c79284f68b | [
"MIT"
] | null | null | null | fitbox/consultas/views.py | ravellys/fitbox | 3ca61bf4d27f47dd7fabb1301afdf5c79284f68b | [
"MIT"
] | 1 | 2020-10-29T20:03:11.000Z | 2020-10-29T20:03:11.000Z | fitbox/consultas/views.py | ravellys/fitbox | 3ca61bf4d27f47dd7fabb1301afdf5c79284f68b | [
"MIT"
] | 2 | 2020-10-27T16:46:18.000Z | 2020-11-04T02:29:59.000Z | # from django.shortcuts import render
# Create your views here.
from django.urls import reverse_lazy
from django.views.generic import CreateView
from fitbox.consultas.forms import ConsultaForm
from fitbox.consultas.models import Consulta
class ConsultaCreateView(CreateView):
template_name = "consultas/cadastro_consulta.html"
model = Consulta
form_class = ConsultaForm
success_url = reverse_lazy("consulta:cadastro_consulta")
| 27.9375 | 60 | 0.805369 | 54 | 447 | 6.537037 | 0.555556 | 0.084986 | 0.107649 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134228 | 447 | 15 | 61 | 29.8 | 0.912145 | 0.131991 | 0 | 0 | 0 | 0 | 0.150649 | 0.150649 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.444444 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
1db266d927adb6c005db3a33cf6739b15458b37f | 597 | py | Python | astronat/core/__init__.py | nstarman/astronat | 9e1f41c6de1ca6adbd2bf99414a4c9b61838abf6 | [
"BSD-3-Clause"
] | 1 | 2020-11-20T18:25:26.000Z | 2020-11-20T18:25:26.000Z | astronat/core/__init__.py | nstarman/astronat | 9e1f41c6de1ca6adbd2bf99414a4c9b61838abf6 | [
"BSD-3-Clause"
] | 3 | 2020-09-09T06:10:20.000Z | 2020-09-16T05:56:10.000Z | astronat/core/__init__.py | nstarman/astronat | 9e1f41c6de1ca6adbd2bf99414a4c9b61838abf6 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# see LICENSE.rst
"""Basic Astronomy Functions.
.. todo::
change this to C / pyx. whatever astropy's preferred C thing is.
"""
__author__ = ""
# __copyright__ = "Copyright 2018, "
# __credits__ = [""]
# __license__ = ""
# __version__ = "0.0.0"
# __maintainer__ = ""
# __email__ = ""
# __status__ = "Production"
# __all__ = [
# ""
# ]
##############################################################################
# IMPORTS
# BUILT IN
# THIRD PARTY
# PROJECT-SPECIFIC
##############################################################################
# END
| 15.710526 | 78 | 0.440536 | 45 | 597 | 5.044444 | 0.888889 | 0.017621 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016162 | 0.170854 | 597 | 37 | 79 | 16.135135 | 0.442424 | 0.621441 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027027 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1db9945d0a006ee0eef48ac4ca55f27881406e8a | 1,213 | py | Python | O3/_10_bias_variance_tradeoff/bias_variance_tradeoff.py | ShAlireza/ML-Tries | 4516be7a3275c9bdedd7bd258800be384b6b34f0 | [
"MIT"
] | null | null | null | O3/_10_bias_variance_tradeoff/bias_variance_tradeoff.py | ShAlireza/ML-Tries | 4516be7a3275c9bdedd7bd258800be384b6b34f0 | [
"MIT"
] | null | null | null | O3/_10_bias_variance_tradeoff/bias_variance_tradeoff.py | ShAlireza/ML-Tries | 4516be7a3275c9bdedd7bd258800be384b6b34f0 | [
"MIT"
] | null | null | null | """The bias-variance tradeoff
Often, researchers use the terms "bias" and "variance" or "bias-
variance tradeoff" to describe the performance of a model—that
is, you may stumble upon talks, books, or articles where people
say that a model has a "high variance" or "high bias." So, what
does that mean? In general, we might say that "high variance"
is proportional to overfitting and "high bias" is proportional to
underfitting.
In the context of machine learning models, variance measures
the consistency (or variability) of the model prediction for
classifying a particular example if we retrain the model multiple
times, for example, on different subsets of the training dataset.
We can say that the model is sensitive to the randomness
in the training data. In contrast, bias measures how far off
the predictions are from the correct values in general if we
rebuild the model multiple times on different training datasets;
bias is the measure of the systematic error that is not due
to randomness.
Accurate definitions can be found in below link:
https://sebastianraschka.com/pdf/lecture-notes/stat479fs18/08_eval-intro_notes.pdf
"""
| 46.653846 | 82 | 0.751031 | 185 | 1,213 | 4.918919 | 0.535135 | 0.035165 | 0.043956 | 0.046154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007254 | 0.204452 | 1,213 | 25 | 83 | 48.52 | 0.934715 | 0.99258 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | 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 |
1dc23bb69793b971dce241628dbacc086c1774ec | 9,672 | py | Python | pysnmp/HPN-ICF-8021PAE-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/HPN-ICF-8021PAE-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/HPN-ICF-8021PAE-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 HPN-ICF-8021PAE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-8021PAE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:24:57 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, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint")
hpnicfRhw, = mibBuilder.importSymbols("HPN-ICF-OID-MIB", "hpnicfRhw")
dot1xPaePortNumber, = mibBuilder.importSymbols("IEEE8021-PAE-MIB", "dot1xPaePortNumber")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Integer32, Bits, Counter64, Unsigned32, Counter32, ObjectIdentity, iso, NotificationType, MibIdentifier, Gauge32, IpAddress, TimeTicks, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "Bits", "Counter64", "Unsigned32", "Counter32", "ObjectIdentity", "iso", "NotificationType", "MibIdentifier", "Gauge32", "IpAddress", "TimeTicks", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn")
TextualConvention, MacAddress, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "MacAddress", "DisplayString")
hpnicfpaeExtMib = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6))
hpnicfpaeExtMib.setRevisions(('2001-06-29 00:00',))
if mibBuilder.loadTexts: hpnicfpaeExtMib.setLastUpdated('200106290000Z')
if mibBuilder.loadTexts: hpnicfpaeExtMib.setOrganization('')
hpnicfpaeExtMibObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1))
hpnicfdot1xPaeSystem = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1))
hpnicfdot1xPaeAuthenticator = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2))
hpnicfdot1xAuthQuietPeriod = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 1), Unsigned32().clone(60)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfdot1xAuthQuietPeriod.setStatus('current')
hpnicfdot1xAuthTxPeriod = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 2), Unsigned32().clone(30)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfdot1xAuthTxPeriod.setStatus('current')
hpnicfdot1xAuthSuppTimeout = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 3), Unsigned32().clone(30)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfdot1xAuthSuppTimeout.setStatus('current')
hpnicfdot1xAuthServerTimeout = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 4), Unsigned32().clone(100)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfdot1xAuthServerTimeout.setStatus('current')
hpnicfdot1xAuthMaxReq = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 5), Unsigned32().clone(2)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfdot1xAuthMaxReq.setStatus('current')
hpnicfdot1xAuthReAuthPeriod = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 6), Unsigned32().clone(3600)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfdot1xAuthReAuthPeriod.setStatus('current')
hpnicfdot1xAuthMethod = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("chap", 1), ("pap", 2), ("eap", 3))).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfdot1xAuthMethod.setStatus('current')
hpnicfdot1xAuthConfigExtTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1), )
if mibBuilder.loadTexts: hpnicfdot1xAuthConfigExtTable.setStatus('current')
hpnicfdot1xAuthConfigExtEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1), ).setIndexNames((0, "IEEE8021-PAE-MIB", "dot1xPaePortNumber"))
if mibBuilder.loadTexts: hpnicfdot1xAuthConfigExtEntry.setStatus('current')
hpnicfdot1xpaeportAuthAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone(2)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfdot1xpaeportAuthAdminStatus.setStatus('current')
hpnicfdot1xpaeportControlledType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("port", 1), ("mac", 2))).clone(2)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfdot1xpaeportControlledType.setStatus('current')
hpnicfdot1xpaeportMaxUserNum = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 3), Integer32().clone(256)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfdot1xpaeportMaxUserNum.setStatus('current')
hpnicfdot1xpaeportUserNumNow = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfdot1xpaeportUserNumNow.setStatus('current')
hpnicfdot1xpaeportClearStatistics = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("clear", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfdot1xpaeportClearStatistics.setStatus('current')
hpnicfdot1xpaeportMcastTrigStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfdot1xpaeportMcastTrigStatus.setStatus('current')
hpnicfdot1xpaeportHandshakeStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfdot1xpaeportHandshakeStatus.setStatus('current')
hpnicfdot1xPaeTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0))
hpnicfsupplicantproxycheck = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 1)).setObjects(("HPN-ICF-8021PAE-MIB", "hpnicfproxycheckVlanId"), ("HPN-ICF-8021PAE-MIB", "hpnicfproxycheckPortName"), ("HPN-ICF-8021PAE-MIB", "hpnicfproxycheckMacAddr"), ("HPN-ICF-8021PAE-MIB", "hpnicfproxycheckIpaddr"), ("HPN-ICF-8021PAE-MIB", "hpnicfproxycheckUsrName"))
if mibBuilder.loadTexts: hpnicfsupplicantproxycheck.setStatus('current')
hpnicfproxycheckVlanId = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 2), Integer32()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: hpnicfproxycheckVlanId.setStatus('current')
hpnicfproxycheckPortName = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 3), OctetString()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: hpnicfproxycheckPortName.setStatus('current')
hpnicfproxycheckMacAddr = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 4), MacAddress()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: hpnicfproxycheckMacAddr.setStatus('current')
hpnicfproxycheckIpaddr = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 5), IpAddress()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: hpnicfproxycheckIpaddr.setStatus('current')
hpnicfproxycheckUsrName = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 6), OctetString()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: hpnicfproxycheckUsrName.setStatus('current')
mibBuilder.exportSymbols("HPN-ICF-8021PAE-MIB", hpnicfpaeExtMibObjects=hpnicfpaeExtMibObjects, hpnicfpaeExtMib=hpnicfpaeExtMib, hpnicfdot1xAuthServerTimeout=hpnicfdot1xAuthServerTimeout, hpnicfproxycheckUsrName=hpnicfproxycheckUsrName, hpnicfsupplicantproxycheck=hpnicfsupplicantproxycheck, hpnicfproxycheckMacAddr=hpnicfproxycheckMacAddr, PYSNMP_MODULE_ID=hpnicfpaeExtMib, hpnicfdot1xAuthMethod=hpnicfdot1xAuthMethod, hpnicfdot1xpaeportMcastTrigStatus=hpnicfdot1xpaeportMcastTrigStatus, hpnicfdot1xPaeAuthenticator=hpnicfdot1xPaeAuthenticator, hpnicfdot1xPaeSystem=hpnicfdot1xPaeSystem, hpnicfdot1xPaeTraps=hpnicfdot1xPaeTraps, hpnicfdot1xAuthReAuthPeriod=hpnicfdot1xAuthReAuthPeriod, hpnicfdot1xAuthConfigExtEntry=hpnicfdot1xAuthConfigExtEntry, hpnicfdot1xpaeportControlledType=hpnicfdot1xpaeportControlledType, hpnicfdot1xAuthSuppTimeout=hpnicfdot1xAuthSuppTimeout, hpnicfproxycheckVlanId=hpnicfproxycheckVlanId, hpnicfdot1xpaeportClearStatistics=hpnicfdot1xpaeportClearStatistics, hpnicfdot1xAuthTxPeriod=hpnicfdot1xAuthTxPeriod, hpnicfdot1xAuthMaxReq=hpnicfdot1xAuthMaxReq, hpnicfproxycheckIpaddr=hpnicfproxycheckIpaddr, hpnicfproxycheckPortName=hpnicfproxycheckPortName, hpnicfdot1xAuthConfigExtTable=hpnicfdot1xAuthConfigExtTable, hpnicfdot1xpaeportUserNumNow=hpnicfdot1xpaeportUserNumNow, hpnicfdot1xpaeportMaxUserNum=hpnicfdot1xpaeportMaxUserNum, hpnicfdot1xAuthQuietPeriod=hpnicfdot1xAuthQuietPeriod, hpnicfdot1xpaeportHandshakeStatus=hpnicfdot1xpaeportHandshakeStatus, hpnicfdot1xpaeportAuthAdminStatus=hpnicfdot1xpaeportAuthAdminStatus)
| 140.173913 | 1,548 | 0.770678 | 1,065 | 9,672 | 6.997183 | 0.152113 | 0.014224 | 0.01087 | 0.014493 | 0.372383 | 0.302335 | 0.270934 | 0.258052 | 0.229871 | 0.229871 | 0 | 0.093659 | 0.080438 | 9,672 | 68 | 1,549 | 142.235294 | 0.74421 | 0.034326 | 0 | 0 | 0 | 0 | 0.13289 | 0.016933 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.131148 | 0 | 0.131148 | 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 |
1dc275b3994ff3b09ff1c61b8cf96f51f28bcb83 | 5,978 | py | Python | spectools_ir/slab_fitter/helpers.py | erichegonzales/eriche-thesis | d3e1c67e05f4cf8f636a9365c819538f0f0affcb | [
"MIT"
] | 4 | 2021-06-02T10:45:22.000Z | 2022-01-20T13:49:13.000Z | spectools_ir/slab_fitter/helpers.py | erichegonzales/eriche-thesis | d3e1c67e05f4cf8f636a9365c819538f0f0affcb | [
"MIT"
] | null | null | null | spectools_ir/slab_fitter/helpers.py | erichegonzales/eriche-thesis | d3e1c67e05f4cf8f636a9365c819538f0f0affcb | [
"MIT"
] | null | null | null | import numpy as np
from astroquery.hitran import Hitran
from astropy import units as un
from astropy.constants import c, k_B, h, u
def calc_solid_angle(radius,distance):
'''
Convenience function to calculate solid angle from radius and distance, assuming a disk shape.
Parameters
----------
radius : float
radius value in AU
distance : float
distance value in parsec
Returns
----------
solid angle : float
solid angle in steradians
'''
return np.pi*radius**2./(distance*206265.)**2.
def calc_radius(solid_angle,distance):
'''
Convenience function to calculate disk radius from solid angle and distance, assuming a disk shape.
Parameters
----------
solid_angle : float
solid angle value in radians
distance : float
distance value in parsec
Returns
----------
radius : float
disk radius in AU
'''
return (distance*206265)*np.sqrt(solid_angle/np.pi)
def get_molmass(molecule_name,isotopologue_number=1):
'''
For a given input molecular formula, return the corresponding molecular mass, in amu
Parameters
----------
molecular_formula : str
The string describing the molecule.
isotopologue_number : int, optional
The isotopologue number, from most to least common.
Returns
-------
mu : float
Molecular mass in amu
'''
mol_isot_code=molecule_name+'_'+str(isotopologue_number)
#https://hitran.org/docs/iso-meta/
mass = { 'H2O_1':18.010565, 'H2O_2':20.014811, 'H2O_3':19.01478, 'H2O_4':19.01674,
'H2O_5':21.020985, 'H2O_6':20.020956, 'H2O_7':20.022915,
'CO2_1':43.98983,'CO2_2':44.993185,'CO2_3':45.994076,'CO2_4':44.994045,
'CO2_5':46.997431,'CO2_6':45.9974,'CO2_7':47.998322,'CO2_8':46.998291,
'CO2_9':45.998262,'CO2_10':49.001675,'CO2_11':48.001646,'CO2_12':47.0016182378,
'O3_1':47.984745,'O3_2':49.988991,'O3_3':49.988991,'O3_4':48.98896,'O3_5':48.98896,
'N2O_1':44.001062,'N2O_2':44.998096,'N2O_3':44.998096,'N2O_4':46.005308,'N2O_5':45.005278,
'CO_1':27.994915,'CO_2':28.99827,'CO_3':29.999161,'CO_4':28.99913,'CO_5':31.002516,'CO_6':30.002485,
'CH4_1':16.0313,'CH4_2':17.034655,'CH4_3':17.037475,'CH4_4':18.04083,
'O2_1':31.98983,'O2_2':33.994076,'O2_3':32.994045,
'NO_1':29.997989,'NO_2':30.995023,'NO_3':32.002234,
'SO2_1':63.961901,'SO2_2':65.957695,
'NO2_1':45.992904,'NO2_2':46.989938,
'NH3_1':17.026549,'NH3_2':18.023583,
'HNO3_1':62.995644,'HNO3_2':63.99268,
'OH_1':17.00274,'OH_2':19.006986,'OH_3':18.008915,
'HF_1':20.006229,'HF_2':21.012404,
'HCl_1':35.976678,'HCl_2':37.973729,'HCl_3':36.982853,'HCl_4':38.979904,
'HBr_1':79.92616,'HBr_2':81.924115,'HBr_3':80.932336,'HBr_4':82.930289,
'HI_1':127.912297,'HI_2':128.918472,
'ClO_1':50.963768,'ClO_2':52.960819,
'OCS_1':59.966986,'OCS_2':61.96278,'OCS_3':60.970341,'OCS_4':60.966371,'OCS_5':61.971231, 'OCS_6':62.966136,
'H2CO_1':30.010565,'H2CO_2':31.01392,'H2CO_3':32.014811,
'HOCl_1':51.971593,'HOCl_2':53.968644,
'N2_1':28.006148,'N2_2':29.003182,
'HCN_1':27.010899,'HCN_2':28.014254,'HCN_3':28.007933,
'CH3Cl_1':49.992328,'CH3CL_2':51.989379,
'H2O2_1':34.00548,
'C2H2_1':26.01565,'C2H2_2':27.019005,'C2H2_3':27.021825,
'C2H6_1':30.04695,'C2H6_2':31.050305,
'PH3_1':33.997238,
'COF2_1':65.991722,'COF2_2':66.995083,
'SF6_1':145.962492,
'H2S_1':33.987721,'H2S_2':35.983515,'H2S_3':34.987105,
'HCOOH_1':46.00548,
'HO2_1':32.997655,
'O_1':15.994915,
'ClONO2_1':96.956672,'ClONO2_2':98.953723,
'NO+_1':29.997989,
'HOBr_1':95.921076,'HOBr_2':97.919027,
'C2H4_1':28.0313,'C2H4_2':29.034655,
'CH3OH_1':32.026215,
'CH3Br_1':93.941811,'CH3Br_2':95.939764,
'CH3CN_1':41.026549,
'CF4_1':87.993616,
'C4H2_1':50.01565,
'HC3N_1':51.010899,
'H2_1':2.01565,'H2_2':3.021825,
'CS_1':43.971036,'CS_2':45.966787,'CS_3':44.974368,'CS_4':44.970399,
'SO3_1':79.95682,
'C2N2_1':52.006148,
'COCl2_1':97.9326199796,'COCl2_2':99.9296698896,
'CS2_1':75.94414,'CS2_2':77.93994,'CS2_3':76.943256,'CS2_4':76.947495}
return mass[mol_isot_code]
| 50.235294 | 138 | 0.457009 | 722 | 5,978 | 3.574792 | 0.423823 | 0.03487 | 0.020922 | 0.022472 | 0.11081 | 0.061991 | 0.061991 | 0 | 0 | 0 | 0 | 0.36256 | 0.406658 | 5,978 | 118 | 139 | 50.661017 | 0.365097 | 0.328036 | 0 | 0 | 0 | 0 | 0.182014 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.046875 | false | 0 | 0.0625 | 0 | 0.15625 | 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 |
1dc32d294e6a71baf5f6ed3e4a11842ec769ac1d | 1,040 | py | Python | CodeIA/venv/Lib/site-packages/absl/testing/_parameterized_async.py | Finasty-lab/IA-Python | 286113504906fec11a5aa5fd1d12e38536b1c859 | [
"Apache-2.0"
] | 38,667 | 2015-01-01T00:15:34.000Z | 2022-03-31T22:57:03.000Z | update/venv/lib/python3.9/site-packages/absl/testing/_parameterized_async.py | azizhudai/material-design-icons | 63c5cb306073a9ecdfd3579f0f696746ab6305f6 | [
"Apache-2.0"
] | 1,192 | 2015-01-03T07:59:34.000Z | 2022-03-31T13:22:26.000Z | update/venv/lib/python3.9/site-packages/absl/testing/_parameterized_async.py | azizhudai/material-design-icons | 63c5cb306073a9ecdfd3579f0f696746ab6305f6 | [
"Apache-2.0"
] | 11,269 | 2015-01-01T08:41:17.000Z | 2022-03-31T16:12:52.000Z | # Lint as: python3
# Copyright 2020 The Abseil Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by 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.
"""Private module implementing async_wrapped method for wrapping async tests.
This is a separate private module so that parameterized still optionally
supports Python 2 syntax.
"""
import functools
import inspect
def async_wrapped(func):
@functools.wraps(func)
async def wrapper(*args, **kwargs):
return await func(*args, **kwargs)
return wrapper
def iscoroutinefunction(func):
return inspect.iscoroutinefunction(func)
| 30.588235 | 77 | 0.766346 | 149 | 1,040 | 5.33557 | 0.630872 | 0.075472 | 0.032704 | 0.040252 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011481 | 0.1625 | 1,040 | 33 | 78 | 31.515152 | 0.901263 | 0.721154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.222222 | 0.111111 | 0.777778 | 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 |
1dc562d3f5acb7cb3b986082452a776619fd60b4 | 881 | py | Python | kafka/optstest.py | peterhogan/python | bc6764f7794a862ff0d138bad80f1d6313984dcd | [
"MIT"
] | null | null | null | kafka/optstest.py | peterhogan/python | bc6764f7794a862ff0d138bad80f1d6313984dcd | [
"MIT"
] | null | null | null | kafka/optstest.py | peterhogan/python | bc6764f7794a862ff0d138bad80f1d6313984dcd | [
"MIT"
] | null | null | null | from optparse import OptionParser
kafkabroker = ""
kafkatopic = ""
rssfile = ""
helpstring = """Usage: newsreader.py [OPTIONS]... -f <RSS_FILE> <KAFKA_BROKER> <KAFKA_TOPIC>
Read news articles from XML rss feeds specified in <RSS_FILE>
Feeds must be separated by newlines
Feeds to be ignored can be prefixed with #
Mandatory arguments:
-f, --rssfile path to rss feeds file (.xml URLs)
Optional arguments:
-q, --quiet don't print the GUID of every article read (default off)
-l, --live print a running total of how many articles have been sent (default off)
-w, --wait wait for a carriage return before sending to kafka (default off)
-h, --help print this message
Example: newsreader.py -q -f /data/rssfeeds.txt localhost:9092 topic_1
"""
parser = OptionParser()
parser.add_option("-f", "--file",
| 32.62963 | 95 | 0.669694 | 122 | 881 | 4.786885 | 0.680328 | 0.05137 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007386 | 0.231555 | 881 | 26 | 96 | 33.884615 | 0.855244 | 0 | 0 | 0 | 0 | 0 | 0.805902 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.052632 | null | null | 0.157895 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1dc5a50b94883d015b44bc01453e7a7183a5e0f8 | 636 | py | Python | Shuffle an Array.py | HalShaw/Leetcode | 27c52aac5a8ecc5b5f02e54096a001920661b4bb | [
"MIT"
] | 1 | 2016-12-22T04:09:25.000Z | 2016-12-22T04:09:25.000Z | Shuffle an Array.py | HalShaw/Leetcode | 27c52aac5a8ecc5b5f02e54096a001920661b4bb | [
"MIT"
] | null | null | null | Shuffle an Array.py | HalShaw/Leetcode | 27c52aac5a8ecc5b5f02e54096a001920661b4bb | [
"MIT"
] | null | null | null | from random import shuffle#自带洗牌方法
from copy import deepcopy
class Solution(object):
def __init__(self, nums):
"""
:type nums: List[int]
:type size: int
"""
self.nums=nums
def reset(self):
"""
Resets the array to its original configuration and return it.
:rtype: List[int]
"""
return self.nums
def shuffle(self):
"""
Returns a random shuffling of the array.
:rtype: List[int]
"""
nums=deepcopy(self.nums)#导入deepcopy来拷贝引用对象,不然直接用的话会影响reset的输出
shuffle(nums)
return nums
| 21.931034 | 69 | 0.551887 | 68 | 636 | 5.102941 | 0.529412 | 0.092219 | 0.069164 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.355346 | 636 | 28 | 70 | 22.714286 | 0.846341 | 0.34434 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.181818 | 0 | 0.727273 | 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 |
1dc9c27b442dd4cf3069aed11e33ffad02388e03 | 307 | py | Python | test/tests/marshal_test.py | jvkersch/pyston | 2c7e7a5e0ed7a0a8b4528919f855fa8336b43902 | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | test/tests/marshal_test.py | jvkersch/pyston | 2c7e7a5e0ed7a0a8b4528919f855fa8336b43902 | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | test/tests/marshal_test.py | jvkersch/pyston | 2c7e7a5e0ed7a0a8b4528919f855fa8336b43902 | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | import marshal
o = [-1, 1.23456789, complex(1.2, 3.4)]
o += [True, False, None]
o += ["Hello World!", u"Hello World!"]
o += [{ "Key" : "Value" }, set(["Set"]), frozenset(["FrozenSet"]), (1, 2, 3), [1, 2, 3]]
for i in o:
s = marshal.dumps(i)
r = marshal.loads(s)
print "Dumping:", i, "Loaded", r
| 30.7 | 88 | 0.537459 | 51 | 307 | 3.235294 | 0.568627 | 0.036364 | 0.054545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.081301 | 0.198697 | 307 | 9 | 89 | 34.111111 | 0.589431 | 0 | 0 | 0 | 0 | 0 | 0.188925 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.111111 | null | null | 0.111111 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1dcff6dd57331f977b210a82d3eb44c337f97160 | 765 | py | Python | src/util.py | sgtpepperpt/cowrie-qemu | bf03e1a87af24c53290fd626efd7a5865ae0aa2f | [
"BSD-3-Clause"
] | 1 | 2019-06-05T08:33:52.000Z | 2019-06-05T08:33:52.000Z | src/util.py | sgtpepperpt/cowrie-qemu | bf03e1a87af24c53290fd626efd7a5865ae0aa2f | [
"BSD-3-Clause"
] | null | null | null | src/util.py | sgtpepperpt/cowrie-qemu | bf03e1a87af24c53290fd626efd7a5865ae0aa2f | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) 2019 Guilherme Borges <guilhermerosasborges@gmail.com>
# See the COPYRIGHT file for more information
import subprocess
import time
def ping(guest_ip):
out = subprocess.run(['ping', '-c 1', guest_ip], capture_output=True)
return out.returncode == 0
def nmap_ssh(guest_ip):
out = subprocess.run(['nmap', guest_ip, '-PN', '-p ssh'], capture_output=True)
return out.returncode == 0 and b'open' in out.stdout
def read_file(file_name):
with open(file_name, 'r') as file:
return file.read()
def generate_mac_ip(guest_id):
# TODO support more
hex_id = hex(guest_id)[2:]
mac = 'aa:bb:cc:dd:ee:' + hex_id.zfill(2)
ip = '192.168.150.' + str(guest_id)
return mac, ip
def now():
return time.time()
| 23.181818 | 83 | 0.665359 | 120 | 765 | 4.1 | 0.516667 | 0.056911 | 0.04065 | 0.081301 | 0.243902 | 0.150407 | 0.150407 | 0 | 0 | 0 | 0 | 0.029221 | 0.194771 | 765 | 32 | 84 | 23.90625 | 0.769481 | 0.169935 | 0 | 0 | 0 | 0 | 0.083994 | 0 | 0 | 0 | 0 | 0.03125 | 0 | 1 | 0.277778 | false | 0 | 0.111111 | 0.055556 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1ddc7b1c9df94d1d6c3913b9a8bd616213efe883 | 525 | py | Python | Lab2/Exercise3.py | alex99q/python3-lab-exercises | dfa96908f589d2e03ce3a21a3326fd7365d62fcb | [
"MIT"
] | null | null | null | Lab2/Exercise3.py | alex99q/python3-lab-exercises | dfa96908f589d2e03ce3a21a3326fd7365d62fcb | [
"MIT"
] | null | null | null | Lab2/Exercise3.py | alex99q/python3-lab-exercises | dfa96908f589d2e03ce3a21a3326fd7365d62fcb | [
"MIT"
] | null | null | null | import random
secret_num = random.randrange(1, 11, 1)
player_num = int(input("Guess a number from 1 to 10: "))
list_of_player_nums = [player_num]
while player_num != secret_num:
if player_num > secret_num:
print("Too high!")
elif player_num < secret_num:
print("Too low!")
player_num = int(input("Guess again: "))
if player_num not in list_of_player_nums:
list_of_player_nums.append(player_num)
print("You won with " + str(len(list_of_player_nums)) + " tries!") | 27.631579 | 66 | 0.660952 | 80 | 525 | 4.0375 | 0.45 | 0.22291 | 0.148607 | 0.198142 | 0.297214 | 0.160991 | 0 | 0 | 0 | 0 | 0 | 0.017241 | 0.226667 | 525 | 19 | 66 | 27.631579 | 0.778325 | 0 | 0 | 0 | 0 | 0 | 0.155512 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.076923 | 0 | 0.076923 | 0.230769 | 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 |
1de0594f63b502fd9fe8aa8efd742514e03f84cb | 1,453 | py | Python | withings_data/views.py | MPikDev/withings_weight_display | 8d0a91c949cc9c2f1323db9986f68330cf21e4bf | [
"MIT"
] | null | null | null | withings_data/views.py | MPikDev/withings_weight_display | 8d0a91c949cc9c2f1323db9986f68330cf21e4bf | [
"MIT"
] | null | null | null | withings_data/views.py | MPikDev/withings_weight_display | 8d0a91c949cc9c2f1323db9986f68330cf21e4bf | [
"MIT"
] | null | null | null | from django.http import HttpResponse
from django.shortcuts import render, redirect
from models import User
from django.contrib.auth import authenticate, login
from django.conf import settings
from django.contrib.auth.decorators import login_required
def login(request):
username = request.POST['username']
password = request.POST['password']
user = authenticate(username=username, password=password)
print 'user , authenticate ', user
if not request.user.is_authenticated():
return redirect('%s?next=%s' % (settings.LOGIN_URL, request.path))
if user is not None:
if user.is_active:
login(request, user)
return HttpResponse("Sucessful", status=200)
else:
return render(request, 'withings_data/get_data.html')
else:
# Return an 'invalid login' error message.
return HttpResponse("Sucessful", status=200)
def logout_view(request):
logout(request)
# Redirect to a success page.
@login_required
def withings_page(request):
return render(request, 'withings_data/get_data.html')
@login_required
def get_data(request):
email = request.POST.get("email", "")
password = request.POST.get("password", "")
if str(email) is '' or str(password) is '':
return HttpResponse('No Email and/or Password', status=403)
else:
# print 'Email: %s, Password: %s' % (email, password)
User.objects.get_or_create(first_name='fname', last_name='lname', email=email, password=password)
return HttpResponse("Sucessful", status=200)
| 28.490196 | 99 | 0.748107 | 196 | 1,453 | 5.459184 | 0.336735 | 0.046729 | 0.04486 | 0.092523 | 0.179439 | 0.078505 | 0.078505 | 0.078505 | 0 | 0 | 0 | 0.009494 | 0.130076 | 1,453 | 50 | 100 | 29.06 | 0.837025 | 0.082588 | 0 | 0.285714 | 0 | 0 | 0.130926 | 0.040632 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.171429 | 0.171429 | null | null | 0.028571 | 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 |
1df4682ad4e85d7a5440a5f0af1ac4170aeb6c7a | 389 | py | Python | graphgallery/gallery/gallery_model/pytorch/__init__.py | Aria461863631/GraphGallery | 7b62f80ab36b29013bea2538a6581fc696a80201 | [
"MIT"
] | null | null | null | graphgallery/gallery/gallery_model/pytorch/__init__.py | Aria461863631/GraphGallery | 7b62f80ab36b29013bea2538a6581fc696a80201 | [
"MIT"
] | null | null | null | graphgallery/gallery/gallery_model/pytorch/__init__.py | Aria461863631/GraphGallery | 7b62f80ab36b29013bea2538a6581fc696a80201 | [
"MIT"
] | null | null | null | from .gcn import GCN, DenseGCN
from .gat import GAT
from .clustergcn import ClusterGCN
from .fastgcn import FastGCN
from .dagnn import DAGNN
from .pairnorm import *
from .simpgcn import SimPGCN
from .mlp import MLP
from .tagcn import TAGCN
from .appnp import APPNP, PPNP
# experimantal model
from .experimental.median_gcn import MedianGCN
from .experimental.trimmed_gcn import TrimmedGCN
| 25.933333 | 48 | 0.81491 | 55 | 389 | 5.727273 | 0.381818 | 0.085714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138817 | 389 | 14 | 49 | 27.785714 | 0.940299 | 0.046272 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
1dfd5d2386c40b6bce3490e841b7ecb270155298 | 1,051 | py | Python | tests/api/length_dist_api_test.py | himanshur-dev/ribopy | 78846e4140a7aa7b4dc995f39606577efaaf0831 | [
"MIT"
] | 4 | 2020-01-14T01:01:36.000Z | 2022-03-21T16:30:24.000Z | tests/api/length_dist_api_test.py | himanshur-dev/ribopy | 78846e4140a7aa7b4dc995f39606577efaaf0831 | [
"MIT"
] | 9 | 2019-12-17T20:45:08.000Z | 2021-12-15T22:34:06.000Z | tests/api/length_dist_api_test.py | himanshur-dev/ribopy | 78846e4140a7aa7b4dc995f39606577efaaf0831 | [
"MIT"
] | 3 | 2019-12-14T17:51:53.000Z | 2022-01-12T16:09:45.000Z | # -*- coding: utf-8 -*-
import unittest
import os
from io import StringIO, BytesIO
import h5py
from ribopy import Ribo
from ribopy import create
from ribopy.merge import merge_ribos
from ribopy.settings import *
from ribopy.core.exceptions import *
import sys
test_dir_1 = os.path.dirname(os.path.realpath(__file__))
sys.path.append(test_dir_1)
test_dir_2 = os.path.dirname(os.path.realpath(test_dir_1))
sys.path.append(test_dir_2)
from multilength_test_data import *
from api_test_base import ApiTestBase
####################################################################
class TestGetLengthDist(ApiTestBase):
def test_get_length_dist(self):
length_dist = self.sample_ribo.get_length_dist(
region_name = "CDS",
experiments = ["merzifon", "ankara"])
self.assertTrue(np.allclose(length_dist["merzifon"], [3,6,11,6]))
self.assertTrue(np.allclose(length_dist["ankara"], [0,8,0,0]))
if __name__ == '__main__':
unittest.main()
| 28.405405 | 73 | 0.639391 | 134 | 1,051 | 4.738806 | 0.425373 | 0.07874 | 0.037795 | 0.047244 | 0.255118 | 0.192126 | 0 | 0 | 0 | 0 | 0 | 0.018913 | 0.195052 | 1,051 | 36 | 74 | 29.194444 | 0.731678 | 0.019981 | 0 | 0 | 0 | 0 | 0.040625 | 0 | 0 | 0 | 0 | 0 | 0.08 | 1 | 0.04 | false | 0 | 0.48 | 0 | 0.56 | 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 |
3817b5265bdca590b8a4c43a50fd915e4ad3d51f | 448 | py | Python | funcional.py | renzon/novatec | 9b6511217c4972bf8584dea8bca1460d4bcb9d87 | [
"MIT"
] | null | null | null | funcional.py | renzon/novatec | 9b6511217c4972bf8584dea8bca1460d4bcb9d87 | [
"MIT"
] | null | null | null | funcional.py | renzon/novatec | 9b6511217c4972bf8584dea8bca1460d4bcb9d87 | [
"MIT"
] | 2 | 2016-05-21T12:28:13.000Z | 2020-09-06T21:58:36.000Z | from time import time
def profile(funcao):
def funcao_wrapper(*args, **kwargs):
inicio = time()
resultado = funcao(*args, **kwargs)
fim = time()
print(fim - inicio)
return resultado
return funcao_wrapper
@profile
def f(n):
return 'Executei f {}'.format(n)
print(f.__name__)
a = f
print(a(4))
print(a(5))
def g():
def h():
return 'executando h'
return h
print(g()())
| 12.444444 | 43 | 0.566964 | 59 | 448 | 4.20339 | 0.423729 | 0.104839 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006309 | 0.292411 | 448 | 35 | 44 | 12.8 | 0.776025 | 0 | 0 | 0 | 0 | 0 | 0.055804 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.238095 | false | 0 | 0.047619 | 0.095238 | 0.52381 | 0.238095 | 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 |
382e952e0abc26313f1d85400cc6243d40c68ce8 | 238 | py | Python | 01_Python_Basico_Intermediario/Aula030/aula30.py | Joao-Inacio/Curso-de-Python3 | 179d85f43f77dced640ffb143a87214538254cf3 | [
"MIT"
] | 1 | 2021-07-19T12:31:49.000Z | 2021-07-19T12:31:49.000Z | 01_Python_Basico_Intermediario/Aula030/aula30.py | Joao-Inacio/Curso-de-Python3 | 179d85f43f77dced640ffb143a87214538254cf3 | [
"MIT"
] | null | null | null | 01_Python_Basico_Intermediario/Aula030/aula30.py | Joao-Inacio/Curso-de-Python3 | 179d85f43f77dced640ffb143a87214538254cf3 | [
"MIT"
] | null | null | null | """
Funções (def) - *args **kwargs
"""
# def func(a1, a2, a3, a4, a5, nome=None, a6=None):
# print(a1, a2, a3, a4, a5, nome, a6)
def func(*args, **kwargs):
print(args, kwargs)
lista = [1, 2, 3, 4, 5]
func(*lista, nome='João')
| 17 | 51 | 0.55042 | 40 | 238 | 3.275 | 0.525 | 0.229008 | 0.091603 | 0.122137 | 0.21374 | 0.21374 | 0 | 0 | 0 | 0 | 0 | 0.090426 | 0.210084 | 238 | 13 | 52 | 18.307692 | 0.606383 | 0.508403 | 0 | 0 | 0 | 0 | 0.037037 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.25 | 0.25 | 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 |
3839d2bcd20e33a947c357a2d7aab8f090791caf | 454 | py | Python | learning_journal/routes.py | hcodydibble/pyramid-learning-journal | eb7a59526885a420b6818fcb888497c21674cf76 | [
"MIT"
] | null | null | null | learning_journal/routes.py | hcodydibble/pyramid-learning-journal | eb7a59526885a420b6818fcb888497c21674cf76 | [
"MIT"
] | 3 | 2019-12-26T16:39:40.000Z | 2021-06-01T21:57:09.000Z | learning_journal/routes.py | hcodydibble/pyramid-learning-journal | eb7a59526885a420b6818fcb888497c21674cf76 | [
"MIT"
] | null | null | null | """Routes and URIs."""
def includeme(config):
"""Add routes and their URIs."""
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.add_route('about', '/about')
config.add_route('details', '/journal/{id:\d+}')
config.add_route('create', '/journal/new-entry')
config.add_route('update', '/journal/{id:\d+}/edit-entry')
config.add_route('delete', '/journal/{id:\d+}/delete')
| 34.923077 | 66 | 0.640969 | 61 | 454 | 4.606557 | 0.442623 | 0.256228 | 0.298932 | 0.135231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010127 | 0.129956 | 454 | 12 | 67 | 37.833333 | 0.701266 | 0.094714 | 0 | 0 | 0 | 0 | 0.35 | 0.13 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0 | 0 | 0.125 | 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 |
6975897181723160fe0f7a9044875607ac1022c2 | 23,657 | py | Python | scylla/datadog_checks/scylla/metrics.py | tzach/integrations-core | ac9daf60630bea4739947fe1d8df72c20bfcbc22 | [
"BSD-3-Clause"
] | null | null | null | scylla/datadog_checks/scylla/metrics.py | tzach/integrations-core | ac9daf60630bea4739947fe1d8df72c20bfcbc22 | [
"BSD-3-Clause"
] | null | null | null | scylla/datadog_checks/scylla/metrics.py | tzach/integrations-core | ac9daf60630bea4739947fe1d8df72c20bfcbc22 | [
"BSD-3-Clause"
] | null | null | null | # (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
# metrics namespaced under 'scylla'
SCYLLA_ALIEN = {
'scylla_alien_receive_batch_queue_length': 'alien.receive_batch_queue_length',
'scylla_alien_total_received_messages': 'alien.total_received_messages',
'scylla_alien_total_sent_messages': 'alien.total_sent_messages',
}
SCYLLA_BATCHLOG = {
'scylla_batchlog_manager_total_write_replay_attempts': 'batchlog_manager.total_write_replay_attempts',
}
SCYLLA_CACHE = {
'scylla_cache_active_reads': 'cache.active_reads',
'scylla_cache_bytes_total': 'cache.bytes_total',
'scylla_cache_bytes_used': 'cache.bytes_used',
'scylla_cache_concurrent_misses_same_key': 'cache.concurrent_misses_same_key',
'scylla_cache_mispopulations': 'cache.mispopulations',
'scylla_cache_partition_evictions': 'cache.partition_evictions',
'scylla_cache_partition_hits': 'cache.partition_hits',
'scylla_cache_partition_insertions': 'cache.partition_insertions',
'scylla_cache_partition_merges': 'cache.partition_merges',
'scylla_cache_partition_misses': 'cache.partition_misses',
'scylla_cache_partition_removals': 'cache.partition_removals',
'scylla_cache_partitions': 'cache.partitions',
'scylla_cache_pinned_dirty_memory_overload': 'cache.pinned_dirty_memory_overload',
'scylla_cache_reads': 'cache.reads',
'scylla_cache_reads_with_misses': 'cache.reads_with_misses',
'scylla_cache_row_evictions': 'cache.row_evictions',
'scylla_cache_row_hits': 'cache.row_hits',
'scylla_cache_row_insertions': 'cache.row_insertions',
'scylla_cache_row_misses': 'cache.row_misses',
'scylla_cache_row_removals': 'cache.row_removals',
'scylla_cache_rows': 'cache.rows',
'scylla_cache_rows_dropped_from_memtable': 'cache.rows_dropped_from_memtable',
'scylla_cache_rows_merged_from_memtable': 'cache.rows_merged_from_memtable',
'scylla_cache_rows_processed_from_memtable': 'cache.rows_processed_from_memtable',
'scylla_cache_sstable_partition_skips': 'cache.sstable_partition_skips',
'scylla_cache_sstable_reader_recreations': 'cache.sstable_reader_recreations',
'scylla_cache_sstable_row_skips': 'cache.sstable_row_skips',
'scylla_cache_static_row_insertions': 'cache.static_row_insertions',
}
SCYLLA_COMMITLOG = {
'scylla_commitlog_alloc': 'commitlog.alloc',
'scylla_commitlog_allocating_segments': 'commitlog.allocating_segments',
'scylla_commitlog_bytes_written': 'commitlog.bytes_written',
'scylla_commitlog_cycle': 'commitlog.cycle',
'scylla_commitlog_disk_total_bytes': 'commitlog.disk_total_bytes',
'scylla_commitlog_flush': 'commitlog.flush',
'scylla_commitlog_flush_limit_exceeded': 'commitlog.flush_limit_exceeded',
'scylla_commitlog_memory_buffer_bytes': 'commitlog.memory_buffer_bytes',
'scylla_commitlog_pending_allocations': 'commitlog.pending_allocations',
'scylla_commitlog_pending_flushes': 'commitlog.pending_flushes',
'scylla_commitlog_requests_blocked_memory': 'commitlog.requests_blocked_memory',
'scylla_commitlog_segments': 'commitlog.segments',
'scylla_commitlog_slack': 'commitlog.slack',
'scylla_commitlog_unused_segments': 'commitlog.unused_segments',
}
SCYLLA_COMPACTION = {
'scylla_compaction_manager_compactions': 'compaction_manager.compactions',
}
SCYLLA_CQL = {
'scylla_cql_authorized_prepared_statements_cache_evictions': 'cql.authorized_prepared_statements_cache_evictions',
'scylla_cql_authorized_prepared_statements_cache_size': 'cql.authorized_prepared_statements_cache_size',
'scylla_cql_batches': 'cql.batches',
'scylla_cql_batches_pure_logged': 'cql.batches_pure_logged',
'scylla_cql_batches_pure_unlogged': 'cql.batches_pure_unlogged',
'scylla_cql_batches_unlogged_from_logged': 'cql.batches_unlogged_from_logged',
'scylla_cql_deletes': 'cql.deletes',
'scylla_cql_filtered_read_requests': 'cql.filtered_read_requests',
'scylla_cql_filtered_rows_dropped_total': 'cql.filtered_rows_dropped_total',
'scylla_cql_filtered_rows_matched_total': 'cql.filtered_rows_matched_total',
'scylla_cql_filtered_rows_read_total': 'cql.filtered_rows_read_total',
'scylla_cql_inserts': 'cql.inserts',
'scylla_cql_prepared_cache_evictions': 'cql.prepared_cache_evictions',
'scylla_cql_prepared_cache_memory_footprint': 'cql.prepared_cache_memory_footprint',
'scylla_cql_prepared_cache_size': 'cql.prepared_cache_size',
'scylla_cql_reads': 'cql.reads',
'scylla_cql_reverse_queries': 'cql.reverse_queries',
'scylla_cql_rows_read': 'cql.rows_read',
'scylla_cql_secondary_index_creates': 'cql.secondary_index_creates',
'scylla_cql_secondary_index_drops': 'cql.secondary_index_drops',
'scylla_cql_secondary_index_reads': 'cql.secondary_index_reads',
'scylla_cql_secondary_index_rows_read': 'cql.secondary_index_rows_read',
'scylla_cql_statements_in_batches': 'cql.statements_in_batches',
'scylla_cql_unpaged_select_queries': 'cql.unpaged_select_queries',
'scylla_cql_updates': 'cql.updates',
'scylla_cql_user_prepared_auth_cache_footprint': 'cql.user_prepared_auth_cache_footprint',
}
SCYLLA_DATABASE = {
'scylla_database_active_reads': 'database.active_reads',
'scylla_database_active_reads_memory_consumption': 'database.active_reads_memory_consumption',
'scylla_database_clustering_filter_count': 'database.clustering_filter_count',
'scylla_database_clustering_filter_fast_path_count': 'database.clustering_filter_fast_path_count',
'scylla_database_clustering_filter_sstables_checked': 'database.clustering_filter_sstables_checked',
'scylla_database_clustering_filter_surviving_sstables': 'database.clustering_filter_surviving_sstables',
'scylla_database_counter_cell_lock_acquisition': 'database.counter_cell_lock_acquisition',
'scylla_database_counter_cell_lock_pending': 'database.counter_cell_lock_pending',
'scylla_database_dropped_view_updates': 'database.dropped_view_updates',
'scylla_database_large_partition_exceeding_threshold': 'database.large_partition_exceeding_threshold',
'scylla_database_multishard_query_failed_reader_saves': 'database.multishard_query_failed_reader_saves',
'scylla_database_multishard_query_failed_reader_stops': 'database.multishard_query_failed_reader_stops',
'scylla_database_multishard_query_unpopped_bytes': 'database.multishard_query_unpopped_bytes',
'scylla_database_multishard_query_unpopped_fragments': 'database.multishard_query_unpopped_fragments',
'scylla_database_paused_reads': 'database.paused_reads',
'scylla_database_paused_reads_permit_based_evictions': 'database.paused_reads_permit_based_evictions',
'scylla_database_querier_cache_drops': 'database.querier_cache_drops',
'scylla_database_querier_cache_lookups': 'database.querier_cache_lookups',
'scylla_database_querier_cache_memory_based_evictions': 'database.querier_cache_memory_based_evictions',
'scylla_database_querier_cache_misses': 'database.querier_cache_misses',
'scylla_database_querier_cache_population': 'database.querier_cache_population',
'scylla_database_querier_cache_resource_based_evictions': 'database.querier_cache_resource_based_evictions',
'scylla_database_querier_cache_time_based_evictions': 'database.querier_cache_time_based_evictions',
'scylla_database_queued_reads': 'database.queued_reads',
'scylla_database_requests_blocked_memory': 'database.requests_blocked_memory',
'scylla_database_requests_blocked_memory_current': 'database.requests_blocked_memory_current',
'scylla_database_short_data_queries': 'database.short_data_queries',
'scylla_database_short_mutation_queries': 'database.short_mutation_queries',
'scylla_database_sstable_read_queue_overloads': 'database.sstable_read_queue_overloads',
'scylla_database_total_reads': 'database.total_reads',
'scylla_database_total_reads_failed': 'database.total_reads_failed',
'scylla_database_total_result_bytes': 'database.total_result_bytes',
'scylla_database_total_view_updates_failed_local': 'database.total_view_updates_failed_local',
'scylla_database_total_view_updates_failed_remote': 'database.total_view_updates_failed_remote',
'scylla_database_total_view_updates_pushed_local': 'database.total_view_updates_pushed_local',
'scylla_database_total_view_updates_pushed_remote': 'database.total_view_updates_pushed_remote',
'scylla_database_total_writes': 'database.total_writes',
'scylla_database_total_writes_failed': 'database.total_writes_failed',
'scylla_database_total_writes_timedout': 'database.total_writes_timedout',
'scylla_database_view_building_paused': 'database.view_building_paused',
'scylla_database_view_update_backlog': 'database.view_update_backlog',
}
SCYLLA_EXECUTION = {
'scylla_execution_stages_function_calls_enqueued': 'execution_stages.function_calls_enqueued',
'scylla_execution_stages_function_calls_executed': 'execution_stages.function_calls_executed',
'scylla_execution_stages_tasks_preempted': 'execution_stages.tasks_preempted',
'scylla_execution_stages_tasks_scheduled': 'execution_stages.tasks_scheduled',
}
SCYLLA_GOSSIP = {
'scylla_gossip_heart_beat': 'gossip.heart_beat',
}
SCYLLA_HINTS = {
'scylla_hints_for_views_manager_corrupted_files': 'hints.for_views_manager_corrupted_files',
'scylla_hints_for_views_manager_discarded': 'hints.for_views_manager_discarded',
'scylla_hints_for_views_manager_dropped': 'hints.for_views_manager_dropped',
'scylla_hints_for_views_manager_errors': 'hints.for_views_manager_errors',
'scylla_hints_for_views_manager_sent': 'hints.for_views_manager_sent',
'scylla_hints_for_views_manager_size_of_hints_in_progress': 'hints.for_views_manager_size_of_hints_in_progress',
'scylla_hints_for_views_manager_written': 'hints.for_views_manager_written',
'scylla_hints_manager_corrupted_files': 'hints.manager_corrupted_files',
'scylla_hints_manager_discarded': 'hints.manager_discarded',
'scylla_hints_manager_dropped': 'hints.manager_dropped',
'scylla_hints_manager_errors': 'hints.manager_errors',
'scylla_hints_manager_sent': 'hints.manager_sent',
'scylla_hints_manager_size_of_hints_in_progress': 'hints.manager_size_of_hints_in_progress',
'scylla_hints_manager_written': 'hints.manager_written',
}
SCYLLA_HTTPD = {
'scylla_httpd_connections_current': 'httpd.connections_current',
'scylla_httpd_connections_total': 'httpd.connections_total',
'scylla_httpd_read_errors': 'httpd.read_errors',
'scylla_httpd_reply_errors': 'httpd.reply_errors',
'scylla_httpd_requests_served': 'httpd.requests_served',
}
SCYLLA_IO = {
'scylla_io_queue_delay': 'io_queue.delay',
'scylla_io_queue_queue_length': 'io_queue.queue_length',
'scylla_io_queue_shares': 'io_queue.shares',
'scylla_io_queue_total_bytes': 'io_queue.total_bytes',
'scylla_io_queue_total_operations': 'io_queue.total_operations',
}
SCYLLA_LSA = {
'scylla_lsa_free_space': 'lsa.free_space',
'scylla_lsa_large_objects_total_space_bytes': 'lsa.large_objects_total_space_bytes',
'scylla_lsa_memory_allocated': 'lsa.memory_allocated',
'scylla_lsa_memory_compacted': 'lsa.memory_compacted',
'scylla_lsa_non_lsa_used_space_bytes': 'lsa.non_lsa_used_space_bytes',
'scylla_lsa_occupancy': 'lsa.occupancy',
'scylla_lsa_segments_compacted': 'lsa.segments_compacted',
'scylla_lsa_segments_migrated': 'lsa.segments_migrated',
'scylla_lsa_small_objects_total_space_bytes': 'lsa.small_objects_total_space_bytes',
'scylla_lsa_small_objects_used_space_bytes': 'lsa.small_objects_used_space_bytes',
'scylla_lsa_total_space_bytes': 'lsa.total_space_bytes',
'scylla_lsa_used_space_bytes': 'lsa.used_space_bytes',
}
SCYLLA_MEMORY = {
'scylla_memory_allocated_memory': 'memory.allocated_memory',
'scylla_memory_cross_cpu_free_operations': 'memory.cross_cpu_free_operations',
'scylla_memory_dirty_bytes': 'memory.dirty_bytes',
'scylla_memory_free_memory': 'memory.free_memory',
'scylla_memory_free_operations': 'memory.free_operations',
'scylla_memory_malloc_live_objects': 'memory.malloc_live_objects',
'scylla_memory_malloc_operations': 'memory.malloc_operations',
'scylla_memory_reclaims_operations': 'memory.reclaims_operations',
'scylla_memory_regular_dirty_bytes': 'memory.regular_dirty_bytes',
'scylla_memory_regular_virtual_dirty_bytes': 'memory.regular_virtual_dirty_bytes',
'scylla_memory_streaming_dirty_bytes': 'memory.streaming_dirty_bytes',
'scylla_memory_streaming_virtual_dirty_bytes': 'memory.streaming_virtual_dirty_bytes',
'scylla_memory_system_dirty_bytes': 'memory.system_dirty_bytes',
'scylla_memory_system_virtual_dirty_bytes': 'memory.system_virtual_dirty_bytes',
'scylla_memory_total_memory': 'memory.total_memory',
'scylla_memory_virtual_dirty_bytes': 'memory.virtual_dirty_bytes',
}
SCYLLA_MEMTABLES = {
'scylla_memtables_pending_flushes': 'memtables.pending_flushes',
'scylla_memtables_pending_flushes_bytes': 'memtables.pending_flushes_bytes',
}
SCYLLA_NODE = {
'scylla_node_operation_mode': 'node.operation_mode',
}
SCYLLA_QUERY = {
'scylla_query_processor_queries': 'query_processor.queries',
'scylla_query_processor_statements_prepared': 'query_processor.statements_prepared',
}
SCYLLA_REACTOR = {
'scylla_reactor_aio_bytes_read': 'reactor.aio_bytes_read',
'scylla_reactor_aio_bytes_write': 'reactor.aio_bytes_write',
'scylla_reactor_aio_errors': 'reactor.aio_errors',
'scylla_reactor_aio_reads': 'reactor.aio_reads',
'scylla_reactor_aio_writes': 'reactor.aio_writes',
'scylla_reactor_cpp_exceptions': 'reactor.cpp_exceptions',
'scylla_reactor_cpu_busy_ms': 'reactor.cpu_busy_ms',
'scylla_reactor_cpu_steal_time_ms': 'reactor.cpu_steal_time_ms',
'scylla_reactor_fstream_read_bytes': 'reactor.fstream_read_bytes',
'scylla_reactor_fstream_read_bytes_blocked': 'reactor.fstream_read_bytes_blocked',
'scylla_reactor_fstream_reads': 'reactor.fstream_reads',
'scylla_reactor_fstream_reads_ahead_bytes_discarded': 'reactor.fstream_reads_ahead_bytes_discarded',
'scylla_reactor_fstream_reads_aheads_discarded': 'reactor.fstream_reads_aheads_discarded',
'scylla_reactor_fstream_reads_blocked': 'reactor.fstream_reads_blocked',
'scylla_reactor_fsyncs': 'reactor.fsyncs',
'scylla_reactor_io_queue_requests': 'reactor.io_queue_requests',
'scylla_reactor_io_threaded_fallbacks': 'reactor.io_threaded_fallbacks',
'scylla_reactor_logging_failures': 'reactor.logging_failures',
'scylla_reactor_polls': 'reactor.polls',
'scylla_reactor_tasks_pending': 'reactor.tasks_pending',
'scylla_reactor_tasks_processed': 'reactor.tasks_processed',
'scylla_reactor_timers_pending': 'reactor.timers_pending',
'scylla_reactor_utilization': 'reactor.utilization',
}
SCYLLA_SCHEDULER = {
'scylla_scheduler_queue_length': 'scheduler.queue_length',
'scylla_scheduler_runtime_ms': 'scheduler.runtime_ms',
'scylla_scheduler_shares': 'scheduler.shares',
'scylla_scheduler_tasks_processed': 'scheduler.tasks_processed',
'scylla_scheduler_time_spent_on_task_quota_violations_ms': 'scheduler.time_spent_on_task_quota_violations_ms',
}
SCYLLA_SSTABLES = {
'scylla_sstables_capped_local_deletion_time': 'sstables.capped_local_deletion_time',
'scylla_sstables_capped_tombstone_deletion_time': 'sstables.capped_tombstone_deletion_time',
'scylla_sstables_cell_tombstone_writes': 'sstables.cell_tombstone_writes',
'scylla_sstables_cell_writes': 'sstables.cell_writes',
'scylla_sstables_index_page_blocks': 'sstables.index_page_blocks',
'scylla_sstables_index_page_hits': 'sstables.index_page_hits',
'scylla_sstables_index_page_misses': 'sstables.index_page_misses',
'scylla_sstables_partition_reads': 'sstables.partition_reads',
'scylla_sstables_partition_seeks': 'sstables.partition_seeks',
'scylla_sstables_partition_writes': 'sstables.partition_writes',
'scylla_sstables_range_partition_reads': 'sstables.range_partition_reads',
'scylla_sstables_range_tombstone_writes': 'sstables.range_tombstone_writes',
'scylla_sstables_row_reads': 'sstables.row_reads',
'scylla_sstables_row_writes': 'sstables.row_writes',
'scylla_sstables_single_partition_reads': 'sstables.single_partition_reads',
'scylla_sstables_sstable_partition_reads': 'sstables.sstable_partition_reads',
'scylla_sstables_static_row_writes': 'sstables.static_row_writes',
'scylla_sstables_tombstone_writes': 'sstables.tombstone_writes',
}
SCYLLA_STORAGE = {
# Scylla 3.1
'scylla_storage_proxy_coordinator_background_read_repairs': 'storage.proxy.coordinator_background_read_repairs',
'scylla_storage_proxy_coordinator_background_reads': 'storage.proxy.coordinator_background_reads',
'scylla_storage_proxy_coordinator_background_replica_writes_failed_local_node': 'storage.proxy.coordinator_background_replica_writes_failed_local_node', # noqa E501
'scylla_storage_proxy_coordinator_background_write_bytes': 'storage.proxy.coordinator_background_write_bytes',
'scylla_storage_proxy_coordinator_background_writes': 'storage.proxy.coordinator_background_writes',
'scylla_storage_proxy_coordinator_background_writes_failed': 'storage.proxy.coordinator_background_writes_failed',
'scylla_storage_proxy_coordinator_canceled_read_repairs': 'storage.proxy.coordinator_canceled_read_repairs',
'scylla_storage_proxy_coordinator_completed_reads_local_node': 'storage.proxy.coordinator_completed_reads_local_node', # noqa E501
'scylla_storage_proxy_coordinator_current_throttled_base_writes': 'storage.proxy.coordinator_current_throttled_base_writes', # noqa E501
'scylla_storage_proxy_coordinator_current_throttled_writes': 'storage.proxy.coordinator_current_throttled_writes',
'scylla_storage_proxy_coordinator_foreground_read_repair': 'storage.proxy.coordinator_foreground_read_repair',
'scylla_storage_proxy_coordinator_foreground_reads': 'storage.proxy.coordinator_foreground_reads',
'scylla_storage_proxy_coordinator_foreground_writes': 'storage.proxy.coordinator_foreground_writes',
'scylla_storage_proxy_coordinator_last_mv_flow_control_delay': 'storage.proxy.coordinator_last_mv_flow_control_delay', # noqa E501
'scylla_storage_proxy_coordinator_queued_write_bytes': 'storage.proxy.coordinator_queued_write_bytes',
'scylla_storage_proxy_coordinator_range_timeouts': 'storage.proxy.coordinator_range_timeouts',
'scylla_storage_proxy_coordinator_range_unavailable': 'storage.proxy.coordinator_range_unavailable',
'scylla_storage_proxy_coordinator_read_errors_local_node': 'storage.proxy.coordinator_read_errors_local_node',
'scylla_storage_proxy_coordinator_read_latency': 'storage.proxy.coordinator_read_latency',
'scylla_storage_proxy_coordinator_read_repair_write_attempts_local_node': 'storage.proxy.coordinator_read_repair_write_attempts_local_node', # noqa E501
'scylla_storage_proxy_coordinator_read_retries': 'storage.proxy.coordinator_read_retries',
'scylla_storage_proxy_coordinator_read_timeouts': 'storage.proxy.coordinator_read_timeouts',
'scylla_storage_proxy_coordinator_read_unavailable': 'storage.proxy.coordinator_read_unavailable',
'scylla_storage_proxy_coordinator_reads_local_node': 'storage.proxy.coordinator_reads_local_node',
'scylla_storage_proxy_coordinator_speculative_data_reads': 'storage.proxy.coordinator_speculative_data_reads',
'scylla_storage_proxy_coordinator_speculative_digest_reads': 'storage.proxy.coordinator_speculative_digest_reads',
'scylla_storage_proxy_coordinator_throttled_writes': 'storage.proxy.coordinator_throttled_writes',
'scylla_storage_proxy_coordinator_total_write_attempts_local_node': 'storage.proxy.coordinator_total_write_attempts_local_node', # noqa E501
'scylla_storage_proxy_coordinator_write_errors_local_node': 'storage.proxy.coordinator_write_errors_local_node',
'scylla_storage_proxy_coordinator_write_latency': 'storage.proxy.coordinator_write_latency',
'scylla_storage_proxy_coordinator_write_timeouts': 'storage.proxy.coordinator_write_timeouts',
'scylla_storage_proxy_coordinator_write_unavailable': 'storage.proxy.coordinator_write_unavailable',
'scylla_storage_proxy_replica_cross_shard_ops': 'storage.proxy.replica_cross_shard_ops',
'scylla_storage_proxy_replica_forwarded_mutations': 'storage.proxy.replica_forwarded_mutations',
'scylla_storage_proxy_replica_forwarding_errors': 'storage.proxy.replica_forwarding_errors',
'scylla_storage_proxy_replica_reads': 'storage.proxy.replica_reads',
'scylla_storage_proxy_replica_received_counter_updates': 'storage.proxy.replica_received_counter_updates',
'scylla_storage_proxy_replica_received_mutations': 'storage.proxy.replica_received_mutations',
# Scylla 3.2 - renamed
'scylla_storage_proxy_coordinator_foreground_read_repairs': 'storage.proxy.coordinator_foreground_read_repair',
}
SCYLLA_STREAMING = {
'scylla_streaming_total_incoming_bytes': 'streaming.total_incoming_bytes',
'scylla_streaming_total_outgoing_bytes': 'streaming.total_outgoing_bytes',
}
SCYLLA_THRIFT = {
'scylla_thrift_current_connections': 'thrift.current_connections',
'scylla_thrift_served': 'thrift.served',
'scylla_thrift_thrift_connections': 'thrift.thrift_connections',
}
SCYLLA_TRACING = {
'scylla_tracing_active_sessions': 'tracing.active_sessions',
'scylla_tracing_cached_records': 'tracing.cached_records',
'scylla_tracing_dropped_records': 'tracing.dropped_records',
'scylla_tracing_dropped_sessions': 'tracing.dropped_sessions',
'scylla_tracing_flushing_records': 'tracing.flushing_records',
'scylla_tracing_keyspace_helper_bad_column_family_errors': 'tracing.keyspace_helper_bad_column_family_errors',
'scylla_tracing_keyspace_helper_tracing_errors': 'tracing.keyspace_helper_tracing_errors',
'scylla_tracing_pending_for_write_records': 'tracing.pending_for_write_records',
'scylla_tracing_trace_errors': 'tracing.trace_errors',
'scylla_tracing_trace_records_count': 'tracing.trace_records_count',
}
SCYLLA_TRANSPORT = {
'scylla_transport_cql_connections': 'transport.cql_connections',
'scylla_transport_current_connections': 'transport.current_connections',
'scylla_transport_requests_blocked_memory': 'transport.requests_blocked_memory',
'scylla_transport_requests_blocked_memory_current': 'transport.requests_blocked_memory_current',
'scylla_transport_requests_served': 'transport.requests_served',
'scylla_transport_requests_serving': 'transport.requests_serving',
}
INSTANCE_DEFAULT_METRICS = [
SCYLLA_CACHE,
SCYLLA_COMPACTION,
SCYLLA_GOSSIP,
SCYLLA_NODE,
SCYLLA_REACTOR,
SCYLLA_STORAGE,
SCYLLA_STREAMING,
SCYLLA_TRANSPORT,
]
ADDITIONAL_METRICS_MAP = {
'scylla.alien': SCYLLA_ALIEN,
'scylla.batchlog': SCYLLA_BATCHLOG,
'scylla.commitlog': SCYLLA_COMMITLOG,
'scylla.cql': SCYLLA_CQL,
'scylla.database': SCYLLA_DATABASE,
'scylla.execution': SCYLLA_EXECUTION,
'scylla.hints': SCYLLA_HINTS,
'scylla.httpd': SCYLLA_HTTPD,
'scylla.io': SCYLLA_IO,
'scylla.lsa': SCYLLA_LSA,
'scylla.memory': SCYLLA_MEMORY,
'scylla.memtables': SCYLLA_MEMTABLES,
'scylla.query': SCYLLA_QUERY,
'scylla.scheduler': SCYLLA_SCHEDULER,
'scylla.sstables': SCYLLA_SSTABLES,
'scylla.thrift': SCYLLA_THRIFT,
'scylla.tracing': SCYLLA_TRACING,
}
| 59.739899 | 169 | 0.820518 | 2,809 | 23,657 | 6.270559 | 0.107156 | 0.05314 | 0.086181 | 0.054332 | 0.474679 | 0.236516 | 0.081129 | 0.048938 | 0.023277 | 0.006699 | 0 | 0.001249 | 0.085979 | 23,657 | 395 | 170 | 59.891139 | 0.813347 | 0.009891 | 0 | 0 | 0 | 0 | 0.804827 | 0.746262 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.00554 | 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 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
6981e639a7cb29d73552df37a160915f52bb7650 | 1,187 | py | Python | login.py | josip8/EwilTwin-attack | d9bd8444af635177b87e48d7400e73aaf9a17f23 | [
"MIT"
] | null | null | null | login.py | josip8/EwilTwin-attack | d9bd8444af635177b87e48d7400e73aaf9a17f23 | [
"MIT"
] | null | null | null | login.py | josip8/EwilTwin-attack | d9bd8444af635177b87e48d7400e73aaf9a17f23 | [
"MIT"
] | null | null | null | import argparse
import sys
import datetime
import json
import logging
import re
import random
import requests
import shutil
from pyquery import PyQuery as pq
def main(username, password):
logging.basicConfig(filename='logging.log', level=logging.DEBUG)
session = requests.session()
uid, dtsg = login(session, username, password)
def login(session, username, password):
# Navigate to the Facebook homepage
response = session.get('https://facebook.com')
# Construct the DOM
dom = pq(response.text)
# Get the lsd value from the HTML. This is required to make the login request
lsd = dom('[name="lsd"]').val()
# Perform the login request
response = session.post('https://www.facebook.com/login.php?login_attempt=1', data={
'lsd': lsd,
'email': username,
'pass': password,
'default_persistent': '0',
'timezone': '-60',
'lgndim': '',
'lgnrnd': '',
'lgnjs': '',
'locale':'en_GB',
'qsstamp': ''
})
print len(response.text)
sys.stdout.flush()
try:
main(username=sys.argv[1], password=sys.argv[2])
except Exception, e:
logging.exception(e)
| 21.981481 | 88 | 0.6369 | 146 | 1,187 | 5.157534 | 0.547945 | 0.063745 | 0.053121 | 0.074369 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006565 | 0.229992 | 1,187 | 53 | 89 | 22.396226 | 0.817287 | 0.128896 | 0 | 0 | 0 | 0 | 0.165209 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.138889 | 0.277778 | null | null | 0.027778 | 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 |
69826f25e21c7ee10d4ed46dec1e788f5a40e5c2 | 411 | py | Python | seller/models.py | apt-developer/SoloMall | 40cdce6829910aad9955e49a90e386bf5d1b1a5f | [
"MIT"
] | null | null | null | seller/models.py | apt-developer/SoloMall | 40cdce6829910aad9955e49a90e386bf5d1b1a5f | [
"MIT"
] | null | null | null | seller/models.py | apt-developer/SoloMall | 40cdce6829910aad9955e49a90e386bf5d1b1a5f | [
"MIT"
] | null | null | null | from django.db import models
# from themall.models import Customer
# Create your models here.
class Seller(models.Model):
email = models.OneToOneField('themall.Customer', on_delete=models.CASCADE, to_field='email')
store_name = models.CharField(max_length=100)
slug = models.SlugField(max_length=100)
description = models.TextField(max_length=1000)
def __str__(self):
return self.email.__str__() | 25.6875 | 94 | 0.77129 | 56 | 411 | 5.410714 | 0.625 | 0.089109 | 0.079208 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027624 | 0.119221 | 411 | 16 | 95 | 25.6875 | 0.809392 | 0.145985 | 0 | 0 | 0 | 0 | 0.060172 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.125 | 0.125 | 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 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
6986ba8ae10943bbe0a19ad1d63111e25988f309 | 499 | py | Python | dbml_from_api.py | ioatzim/getbigschema | 7ec9cde9099f6f7a9a45232d598b93f55357397b | [
"Apache-2.0"
] | null | null | null | dbml_from_api.py | ioatzim/getbigschema | 7ec9cde9099f6f7a9a45232d598b93f55357397b | [
"Apache-2.0"
] | null | null | null | dbml_from_api.py | ioatzim/getbigschema | 7ec9cde9099f6f7a9a45232d598b93f55357397b | [
"Apache-2.0"
] | null | null | null | import requests
import os
import json
import datetime
'''
Pulls a dbml file from the API. User must manually add the file id, found in the 'response_ids.json' file generated from dbml_post_to_api.py
'''
url='http://ec2-54-167-67-34.compute-1.amazonaws.com/api/dbmls' #url of the API
id = '6192b1f31c2a512293fea940' #id of the file, taken from 'response_ids.json' file generated from dbml_post_to_api.py
res = requests.get(f'{url}/{id}')
dbml_file = json.loads(res.json()['contents'])
| 35.642857 | 141 | 0.735471 | 85 | 499 | 4.211765 | 0.529412 | 0.044693 | 0.083799 | 0.106145 | 0.26257 | 0.26257 | 0.26257 | 0.26257 | 0.26257 | 0.26257 | 0 | 0.065574 | 0.144289 | 499 | 13 | 142 | 38.384615 | 0.772834 | 0.200401 | 0 | 0 | 1 | 0.125 | 0.419492 | 0.101695 | 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 | 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 |
698812bb45241671016a8d814e5ddf45839c4060 | 400 | py | Python | fabfile.py | undertherain/dagen | f4815127bb7b660c4ffadf5f01ad4c5c0f504ddc | [
"Apache-2.0"
] | 2 | 2017-10-21T02:29:21.000Z | 2017-10-21T02:35:50.000Z | fabfile.py | undertherain/dagen | f4815127bb7b660c4ffadf5f01ad4c5c0f504ddc | [
"Apache-2.0"
] | null | null | null | fabfile.py | undertherain/dagen | f4815127bb7b660c4ffadf5f01ad4c5c0f504ddc | [
"Apache-2.0"
] | null | null | null | import os
from fabric.api import local, lcd
def clean():
with lcd(os.path.dirname(__file__)):
local("python3.6 setup.py clean --all")
local("find . | grep -E \"(__pycache__|\.pyc$)\" | xargs rm -rf")
def make():
local("python3.6 setup.py bdist_wheel")
def deploy():
test()
make()
local("twine upload dist/*")
def test():
local("python3.6 -m unittest")
| 17.391304 | 73 | 0.6 | 56 | 400 | 4.125 | 0.642857 | 0.155844 | 0.168831 | 0.155844 | 0.17316 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019355 | 0.225 | 400 | 22 | 74 | 18.181818 | 0.725806 | 0 | 0 | 0 | 0 | 0 | 0.3325 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | true | 0 | 0.142857 | 0 | 0.428571 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
69883b20a029aa25992e0951d51a93d66e81c5a0 | 544 | py | Python | Package1/Util.py | mgi2792/WebTest | c3441c213c97dbd290b948e162fd1560da33bdd6 | [
"MIT"
] | null | null | null | Package1/Util.py | mgi2792/WebTest | c3441c213c97dbd290b948e162fd1560da33bdd6 | [
"MIT"
] | null | null | null | Package1/Util.py | mgi2792/WebTest | c3441c213c97dbd290b948e162fd1560da33bdd6 | [
"MIT"
] | null | null | null | from openpyxl import load_workbook
def getRowCount(file):
wb = load_workbook(file)
sheet = wb.active
return sheet.max_row
def getColumnCount(file):
wb = load_workbook(file)
sheet = wb.active
return sheet.max_column
def getCellData(file, cell):
wb = load_workbook(file)
sheet = wb.active
return sheet.cell(row=cell[0], column=cell[1]).value
def setCellData(file, cell, data):
wb = load_workbook(file)
sheet = wb.active
sheet.cell(row=cell[0], column=cell[1]).value = data
wb.save(file)
| 20.923077 | 56 | 0.681985 | 79 | 544 | 4.607595 | 0.303797 | 0.164835 | 0.153846 | 0.197802 | 0.637363 | 0.637363 | 0.637363 | 0.552198 | 0.552198 | 0.269231 | 0 | 0.009217 | 0.202206 | 544 | 25 | 57 | 21.76 | 0.829493 | 0 | 0 | 0.444444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.055556 | 0 | 0.444444 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
698a0fd866792d3cb9602f07e37599bb1277b5c0 | 399 | py | Python | differential/plugins/gazelle.py | funqc/Differential | 738ebf9a2a54ea04498b3394f80d980aad083ea7 | [
"MIT"
] | 52 | 2021-10-12T11:23:45.000Z | 2022-03-18T04:15:03.000Z | differential/plugins/gazelle.py | funqc/Differential | 738ebf9a2a54ea04498b3394f80d980aad083ea7 | [
"MIT"
] | 4 | 2021-10-15T13:58:42.000Z | 2022-03-15T12:42:35.000Z | differential/plugins/gazelle.py | funqc/Differential | 738ebf9a2a54ea04498b3394f80d980aad083ea7 | [
"MIT"
] | 5 | 2021-11-18T05:41:23.000Z | 2022-03-09T03:13:15.000Z | import argparse
from differential.plugins.base import Base
class Gazelle(Base):
@classmethod
def get_aliases(cls):
return "gz",
@classmethod
def get_help(cls):
return "Gazelle插件,适用于未经过大规模结构改动的Gazelle站点"
@classmethod
def add_parser(cls, parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
super().add_parser(parser)
return parser
| 21 | 84 | 0.691729 | 42 | 399 | 6.47619 | 0.52381 | 0.154412 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.223058 | 399 | 18 | 85 | 22.166667 | 0.877419 | 0 | 0 | 0.230769 | 0 | 0 | 0.087719 | 0.082707 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.153846 | 0.153846 | 0.692308 | 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 |
698b7be724cf94857043bb74abc7ca1f3ac92685 | 2,398 | py | Python | tests/snapshots/snap_test_holidata/test_holidata_produces_holidays_for_locale_and_year[tr_TR-2014] 1.py | gour/holidata | 89c7323f9c5345a3ecbf5cd5a835b0e08cfebc13 | [
"MIT"
] | 32 | 2019-04-12T08:01:34.000Z | 2022-02-28T04:41:50.000Z | tests/snapshots/snap_test_holidata/test_holidata_produces_holidays_for_locale_and_year[tr_TR-2014] 1.py | gour/holidata | 89c7323f9c5345a3ecbf5cd5a835b0e08cfebc13 | [
"MIT"
] | 74 | 2019-07-09T16:35:20.000Z | 2022-03-09T16:41:34.000Z | tests/snapshots/snap_test_holidata/test_holidata_produces_holidays_for_locale_and_year[tr_TR-2014] 1.py | gour/holidata | 89c7323f9c5345a3ecbf5cd5a835b0e08cfebc13 | [
"MIT"
] | 20 | 2019-01-28T07:41:02.000Z | 2022-02-16T02:38:57.000Z | [
{
'date': '2014-01-01',
'description': 'Yılbaşı',
'locale': 'tr-TR',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2014-04-23',
'description': 'Ulusal Egemenlik ve Çocuk Bayramı',
'locale': 'tr-TR',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2014-05-01',
'description': 'Emek ve Dayanışma Günü',
'locale': 'tr-TR',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2014-05-19',
'description': "Atatürk'ü Anma, Gençlik ve Spor Bayramı",
'locale': 'tr-TR',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2014-07-28',
'description': 'Ramazan Bayramı (1. Gün)',
'locale': 'tr-TR',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2014-07-29',
'description': 'Ramazan Bayramı (2. Gün)',
'locale': 'tr-TR',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2014-07-30',
'description': 'Ramazan Bayramı (3. Gün)',
'locale': 'tr-TR',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2014-08-30',
'description': 'Zafer Bayramı',
'locale': 'tr-TR',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2014-10-04',
'description': 'Kurban Bayramı (1. Gün)',
'locale': 'tr-TR',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2014-10-05',
'description': 'Kurban Bayramı (2. Gün)',
'locale': 'tr-TR',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2014-10-06',
'description': 'Kurban Bayramı (3. Gün)',
'locale': 'tr-TR',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2014-10-07',
'description': 'Kurban Bayramı (4. Gün)',
'locale': 'tr-TR',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2014-10-29',
'description': 'Cumhuriyet Bayramı',
'locale': 'tr-TR',
'notes': '',
'region': '',
'type': 'NF'
}
] | 22.622642 | 65 | 0.373228 | 205 | 2,398 | 4.365854 | 0.219512 | 0.116201 | 0.145251 | 0.217877 | 0.63352 | 0.63352 | 0.63352 | 0.63352 | 0.595531 | 0.556425 | 0 | 0.076446 | 0.394495 | 2,398 | 106 | 66 | 22.622642 | 0.539945 | 0 | 0 | 0.490566 | 0 | 0 | 0.413506 | 0 | 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 |
69a221dbea88cda21e34ea6b75e9fa9d44aaad95 | 382 | py | Python | pymockdata/datasets/default.py | vladcalin/py-mock-data-generator | 747a22b1a26b2db3cd3f9d2c4a35b5ba79d943c8 | [
"MIT"
] | 2 | 2016-08-04T13:40:39.000Z | 2016-10-07T20:30:07.000Z | pymockdata/datasets/default.py | vladcalin/py-mock-data-generator | 747a22b1a26b2db3cd3f9d2c4a35b5ba79d943c8 | [
"MIT"
] | 2 | 2016-08-18T08:02:13.000Z | 2016-08-18T08:09:18.000Z | pymockdata/datasets/default.py | vladcalin/pymockdata | 747a22b1a26b2db3cd3f9d2c4a35b5ba79d943c8 | [
"MIT"
] | null | null | null | import string
from ..datasets import Dataset
uppercase_ascii_letters = Dataset("uppercase_letter", None, string.ascii_uppercase)
lowercase_ascii_letters = Dataset("lowercase_letter", None, string.ascii_lowercase)
ascii_letters = Dataset("letter", None, string.ascii_letters)
digits = Dataset("digit", None, string.digits)
hex_digit = Dataset("hex_digit", None, string.hexdigits)
| 34.727273 | 83 | 0.801047 | 48 | 382 | 6.125 | 0.3125 | 0.170068 | 0.193878 | 0.214286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.089005 | 382 | 10 | 84 | 38.2 | 0.844828 | 0 | 0 | 0 | 0 | 0 | 0.136126 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 0.285714 | 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 |
69af023e0e9453a8bc99e8621f0b707e6285701a | 96 | py | Python | FLOW007.py | ankitpipalia/codechef-solutions | d10e7f15b74a11655b0e53953a8e2bc7efbf7377 | [
"MIT"
] | 1 | 2022-01-23T08:13:17.000Z | 2022-01-23T08:13:17.000Z | FLOW007.py | ankitpipalia/codechef-solutions | d10e7f15b74a11655b0e53953a8e2bc7efbf7377 | [
"MIT"
] | null | null | null | FLOW007.py | ankitpipalia/codechef-solutions | d10e7f15b74a11655b0e53953a8e2bc7efbf7377 | [
"MIT"
] | null | null | null | tcase = int(input())
while(tcase):
str= input() [::-1]
print(int(str))
tcase -= 1 | 12 | 23 | 0.510417 | 13 | 96 | 3.769231 | 0.538462 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.028169 | 0.260417 | 96 | 8 | 24 | 12 | 0.661972 | 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 |
69b88545c388c1a97049f68a3c5994f40ec7a709 | 426 | py | Python | setup.py | raghavsub/gtkpass | 1361e1d3204cfc8d51e6027a4f76d038a1ee5d43 | [
"MIT"
] | 1 | 2017-10-30T21:37:06.000Z | 2017-10-30T21:37:06.000Z | setup.py | raghavsub/gtkpass | 1361e1d3204cfc8d51e6027a4f76d038a1ee5d43 | [
"MIT"
] | 10 | 2017-08-07T17:51:54.000Z | 2017-11-07T17:17:39.000Z | setup.py | raghavsub/gtkpass | 1361e1d3204cfc8d51e6027a4f76d038a1ee5d43 | [
"MIT"
] | null | null | null | from setuptools import setup
setup(name='gtkpass',
version='0.2.7',
description='A GTK+ 3 program for the standard unix password manager',
url='http://github.com/raghavsub/gtkpass',
author='Raghav Subramaniam',
author_email='raghavs511@gmail.com',
license='MIT',
packages=['gtkpass'],
entry_points={'console_scripts': ['gtkpass=gtkpass.main:main']},
install_requires=[])
| 32.769231 | 76 | 0.661972 | 50 | 426 | 5.56 | 0.84 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020231 | 0.187793 | 426 | 12 | 77 | 35.5 | 0.783237 | 0 | 0 | 0 | 0 | 0 | 0.446009 | 0.058685 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.454545 | 0.090909 | 0 | 0.090909 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
69bc563b00c3a0dca8969daf6eb573ab788fb25a | 2,033 | py | Python | apps/my_app/handlers.py | opaniagu/fastapi_mongodb | 2a58c89a16efca8f656cc64d923e1eecb4120a80 | [
"MIT"
] | null | null | null | apps/my_app/handlers.py | opaniagu/fastapi_mongodb | 2a58c89a16efca8f656cc64d923e1eecb4120a80 | [
"MIT"
] | null | null | null | apps/my_app/handlers.py | opaniagu/fastapi_mongodb | 2a58c89a16efca8f656cc64d923e1eecb4120a80 | [
"MIT"
] | null | null | null | import datetime
import fastapi
import pymongo
import pymongo.errors
import pymongo.results
from apps.common.enums import CodeAudiences
from apps.common.handlers import PasswordsHandler, TokensHandler
from fastapi_mongodb.exceptions import HandlerException, RepositoryException
from fastapi_mongodb.handlers import BaseHandler, mongo_duplicate_key_error_handler
from fastapi_mongodb.pagination import Paginator
from fastapi_mongodb.projectors import BaseProjector
from fastapi_mongodb.repositories import BaseRepositoryConfig
from fastapi_mongodb.sorting import SortBuilder
from fastapi_mongodb.my_types import OID
from apps.users.models import UserModel
from apps.users.repositories import UserRepository
from apps.users.schemas import JWTPayloadSchema, JWTRefreshSchema, UserCreateSchema, UserLoginSchema, UserUpdateSchema
from apps.my_app.models import DeviceModel
from apps.my_app.repositories import DeviceRepository
from apps.my_app.schemas import DeviceCreateSchema
__all__ = ["DeviceHandler"]
class DeviceHandler(BaseHandler):
def __init__(self, request: fastapi.Request):
super().__init__(request=request)
self.device_repository = DeviceRepository()
async def create_device(self, request: fastapi.Request, device: DeviceCreateSchema) -> dict:
"""Create new device"""
device_model = DeviceModel(**device.dict(exclude_unset=True))
try:
result: pymongo.results.InsertOneResult = await self.device_repository.insert_one(
document=device_model.to_db(),
session=request.state.db_session,
)
except pymongo.errors.DuplicateKeyError as error:
mongo_duplicate_key_error_handler(model_name="Device", fields=["name"], error=error)
else:
return {"acknowledged": result.acknowledged, "inserted_id": result.inserted_id}
#return {"acknowledged": "True", "inserted_id": "000000000000000000000000"}
| 35.051724 | 119 | 0.745696 | 213 | 2,033 | 6.910798 | 0.41784 | 0.043478 | 0.085598 | 0.026495 | 0.039402 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014484 | 0.184948 | 2,033 | 58 | 120 | 35.051724 | 0.873868 | 0.036399 | 0 | 0 | 0 | 0 | 0.024481 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.027778 | false | 0.027778 | 0.555556 | 0 | 0.638889 | 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 |
69ce8902e8aaaf0b89cf2ee81714c5532b36a81f | 417 | py | Python | src/Factory/Abstract/SongFactory.py | jundoll/discordbot-BSPlaylistManager | 38e80a7fc2ab779b4ab9fec33a40c0a7b14ad622 | [
"MIT"
] | null | null | null | src/Factory/Abstract/SongFactory.py | jundoll/discordbot-BSPlaylistManager | 38e80a7fc2ab779b4ab9fec33a40c0a7b14ad622 | [
"MIT"
] | 8 | 2020-10-25T06:07:41.000Z | 2020-12-30T10:03:54.000Z | src/Factory/Abstract/SongFactory.py | jundoll/discordbot-BSPlaylistManager | 38e80a7fc2ab779b4ab9fec33a40c0a7b14ad622 | [
"MIT"
] | null | null | null |
# load modules
from abc import ABCMeta, abstractmethod
from typing import List
from src.Domain.Song import Song, SongHash, Url
# definition
class ISongFactory(metaclass=ABCMeta):
# URLからSongインスタンスのリストを生成する
@abstractmethod
def generateByUrl(self, url: Url) -> List[Song]:
pass
# hash値からSongインスタンスを生成する
@abstractmethod
def generateByHash(self, hash: SongHash) -> Song:
pass
| 20.85 | 53 | 0.717026 | 43 | 417 | 6.953488 | 0.604651 | 0.113712 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.208633 | 417 | 19 | 54 | 21.947368 | 0.906061 | 0.170264 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.2 | 0.3 | 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 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
69fb23cad56b8f09159f3a77a81d10b8408a289b | 72 | py | Python | audiotrans_transform_stft/__init__.py | keik/audiotrans-transform-stft | 76db56dd78589170ea58bd59f8243dee76373ced | [
"MIT"
] | null | null | null | audiotrans_transform_stft/__init__.py | keik/audiotrans-transform-stft | 76db56dd78589170ea58bd59f8243dee76373ced | [
"MIT"
] | null | null | null | audiotrans_transform_stft/__init__.py | keik/audiotrans-transform-stft | 76db56dd78589170ea58bd59f8243dee76373ced | [
"MIT"
] | null | null | null | from .__main__ import STFTTransform
__all__ = [
'STFTTransform'
]
| 10.285714 | 35 | 0.708333 | 6 | 72 | 7.166667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.208333 | 72 | 6 | 36 | 12 | 0.754386 | 0 | 0 | 0 | 0 | 0 | 0.180556 | 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 |
385a1293e848a01d5e145a500532168c2c1b01d7 | 752 | py | Python | game/migrations/0002_table.py | koualsky/texas-holdem | b0c4f84ae5d4b679c870a9312376cfa1e208ec16 | [
"MIT"
] | 4 | 2019-09-05T21:22:46.000Z | 2020-12-19T19:23:08.000Z | game/migrations/0002_table.py | koualsky/texas-holdem | b0c4f84ae5d4b679c870a9312376cfa1e208ec16 | [
"MIT"
] | 34 | 2019-08-07T11:58:07.000Z | 2021-06-10T21:49:00.000Z | game/migrations/0002_table.py | koualsky/texas-holdem | b0c4f84ae5d4b679c870a9312376cfa1e208ec16 | [
"MIT"
] | 4 | 2020-04-05T03:42:10.000Z | 2022-03-03T03:04:40.000Z | # Generated by Django 2.2.4 on 2019-08-03 15:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('game', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Table',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('players', models.CharField(max_length=500)),
('dealer', models.CharField(max_length=200)),
('pool', models.IntegerField(default=0)),
('deck', models.CharField(max_length=500)),
('cards_on_table', models.CharField(max_length=100)),
],
),
]
| 30.08 | 114 | 0.56383 | 77 | 752 | 5.376623 | 0.662338 | 0.144928 | 0.173913 | 0.231884 | 0.130435 | 0 | 0 | 0 | 0 | 0 | 0 | 0.060377 | 0.295213 | 752 | 24 | 115 | 31.333333 | 0.720755 | 0.05984 | 0 | 0 | 1 | 0 | 0.085106 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.055556 | 0 | 0.222222 | 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 |
387bfe5524cac7d7cb21e866fa774cc3212626e2 | 238 | py | Python | msgflow/logging.py | noriyukipy/smilechat | a9c0ef93c35b2a1f3e9d1700391ae865544adfbc | [
"MIT"
] | 5 | 2021-01-01T12:34:23.000Z | 2022-03-08T13:02:11.000Z | msgflow/logging.py | noriyukipy/smilechat | a9c0ef93c35b2a1f3e9d1700391ae865544adfbc | [
"MIT"
] | null | null | null | msgflow/logging.py | noriyukipy/smilechat | a9c0ef93c35b2a1f3e9d1700391ae865544adfbc | [
"MIT"
] | 2 | 2020-09-20T10:41:51.000Z | 2020-11-09T06:15:32.000Z | import json
import datetime
def print_json_log(logger_, level_, message_):
dict_ = {"level": level_, "message": message_, "time": str(datetime.datetime.now())}
json_str = json.dumps(dict_)
getattr(logger_, level_)(json_str)
| 26.444444 | 88 | 0.710084 | 31 | 238 | 5.032258 | 0.483871 | 0.141026 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147059 | 238 | 8 | 89 | 29.75 | 0.768473 | 0 | 0 | 0 | 0 | 0 | 0.067227 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.5 | 0.166667 | 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 |
387ea40c8cd79f5bdddf23799a108f4ee84c715c | 391 | py | Python | JiaLu/learn/list_training9.py | 13022108937/homework | 05b3c0535532766b286976b15245ed1f925da8c5 | [
"Apache-2.0"
] | null | null | null | JiaLu/learn/list_training9.py | 13022108937/homework | 05b3c0535532766b286976b15245ed1f925da8c5 | [
"Apache-2.0"
] | null | null | null | JiaLu/learn/list_training9.py | 13022108937/homework | 05b3c0535532766b286976b15245ed1f925da8c5 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
def bubble_search_func(data_list):
cnt_num_all = len(data_list)
for i in range(cnt_num_all-1):
for j in range(1,cnt_num_all-i):
if(data_list[j-1]>data_list[j]):
data_list[j-1],data_list[j]=data_list[j],data_list[j-1]
data_list = [54, 25, 93, 17, 77, 31, 44, 55, 20, 10]
bubble_search_func(data_list)
print(data_list)
| 20.578947 | 71 | 0.639386 | 75 | 391 | 3.053333 | 0.426667 | 0.384279 | 0.235808 | 0.131004 | 0.49345 | 0.283843 | 0.283843 | 0.283843 | 0.283843 | 0.20524 | 0 | 0.081169 | 0.212276 | 391 | 18 | 72 | 21.722222 | 0.662338 | 0.051151 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0 | 0 | 0.111111 | 0.111111 | 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 |
389f1a7b583f28aabf6b2f6f6dbd7bcfd9b5dc58 | 3,485 | py | Python | ivi/tektronix/__init__.py | sacherjj/python-ivi | 6dd1ba93d65dc30a652a3a1b34c66921d94315e8 | [
"MIT"
] | 161 | 2015-01-23T17:43:01.000Z | 2022-03-29T14:42:42.000Z | ivi/tektronix/__init__.py | sacherjj/python-ivi | 6dd1ba93d65dc30a652a3a1b34c66921d94315e8 | [
"MIT"
] | 45 | 2015-01-15T13:35:04.000Z | 2021-06-03T01:58:55.000Z | ivi/tektronix/__init__.py | sacherjj/python-ivi | 6dd1ba93d65dc30a652a3a1b34c66921d94315e8 | [
"MIT"
] | 87 | 2015-01-31T10:55:23.000Z | 2022-03-17T08:18:47.000Z | """
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2017 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
# Oscilloscopes
# DPO4000
from .tektronixDPO4032 import tektronixDPO4032
from .tektronixDPO4034 import tektronixDPO4034
from .tektronixDPO4054 import tektronixDPO4054
from .tektronixDPO4104 import tektronixDPO4104
# MSO4000
from .tektronixMSO4032 import tektronixMSO4032
from .tektronixMSO4034 import tektronixMSO4034
from .tektronixMSO4054 import tektronixMSO4054
from .tektronixMSO4104 import tektronixMSO4104
# DPO4000B
from .tektronixDPO4014B import tektronixDPO4014B
from .tektronixDPO4034B import tektronixDPO4034B
from .tektronixDPO4054B import tektronixDPO4054B
from .tektronixDPO4102B import tektronixDPO4102B
from .tektronixDPO4104B import tektronixDPO4104B
# MSO4000B
from .tektronixMSO4014B import tektronixMSO4014B
from .tektronixMSO4034B import tektronixMSO4034B
from .tektronixMSO4054B import tektronixMSO4054B
from .tektronixMSO4102B import tektronixMSO4102B
from .tektronixMSO4104B import tektronixMSO4104B
# MDO4000
from .tektronixMDO4054 import tektronixMDO4054
from .tektronixMDO4104 import tektronixMDO4104
# MDO4000B
from .tektronixMDO4014B import tektronixMDO4014B
from .tektronixMDO4034B import tektronixMDO4034B
from .tektronixMDO4054B import tektronixMDO4054B
from .tektronixMDO4104B import tektronixMDO4104B
# MDO3000
from .tektronixMDO3012 import tektronixMDO3012
from .tektronixMDO3014 import tektronixMDO3014
from .tektronixMDO3022 import tektronixMDO3022
from .tektronixMDO3024 import tektronixMDO3024
from .tektronixMDO3032 import tektronixMDO3032
from .tektronixMDO3034 import tektronixMDO3034
from .tektronixMDO3052 import tektronixMDO3052
from .tektronixMDO3054 import tektronixMDO3054
from .tektronixMDO3102 import tektronixMDO3102
from .tektronixMDO3104 import tektronixMDO3104
# Function Generators
from .tektronixAWG2005 import tektronixAWG2005
from .tektronixAWG2020 import tektronixAWG2020
from .tektronixAWG2021 import tektronixAWG2021
from .tektronixAWG2040 import tektronixAWG2040
from .tektronixAWG2041 import tektronixAWG2041
# Power Supplies
from .tektronixPS2520G import tektronixPS2520G
from .tektronixPS2521G import tektronixPS2521G
# Optical attenuators
from .tektronixOA5002 import tektronixOA5002
from .tektronixOA5012 import tektronixOA5012
from .tektronixOA5022 import tektronixOA5022
from .tektronixOA5032 import tektronixOA5032
# Current probe amplifiers
from .tektronixAM5030 import tektronixAM5030
| 39.157303 | 77 | 0.857389 | 375 | 3,485 | 7.968 | 0.44 | 0.029451 | 0.008701 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130871 | 0.114204 | 3,485 | 88 | 78 | 39.602273 | 0.837059 | 0.363271 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
38a129325d66bb189c82f953757e48c8f2208659 | 551 | py | Python | rldb/db/repo__openai_baselines_cbd21ef/algo__ppo2_mpi/entries.py | seungjaeryanlee/sotarl | 8c471c4666d6210c68f3cb468e439a2b168c785d | [
"MIT"
] | 45 | 2019-05-13T17:39:33.000Z | 2022-03-07T23:44:13.000Z | rldb/db/repo__openai_baselines_cbd21ef/algo__ppo2_mpi/entries.py | seungjaeryanlee/sotarl | 8c471c4666d6210c68f3cb468e439a2b168c785d | [
"MIT"
] | 2 | 2019-03-29T01:41:59.000Z | 2019-07-02T02:48:31.000Z | rldb/db/repo__openai_baselines_cbd21ef/algo__ppo2_mpi/entries.py | seungjaeryanlee/sotarl | 8c471c4666d6210c68f3cb468e439a2b168c785d | [
"MIT"
] | 2 | 2020-04-07T20:57:30.000Z | 2020-07-08T12:55:15.000Z | entries = [
{
'env-title': 'atari-enduro',
'score': 207.47,
},
{
'env-title': 'atari-space-invaders',
'score': 459.89,
},
{
'env-title': 'atari-qbert',
'score': 7184.73,
},
{
'env-title': 'atari-seaquest',
'score': 1383.38,
},
{
'env-title': 'atari-pong',
'score': 13.9,
},
{
'env-title': 'atari-beam-rider',
'score': 594.45,
},
{
'env-title': 'atari-breakout',
'score': 81.61,
},
]
| 17.774194 | 44 | 0.399274 | 52 | 551 | 4.230769 | 0.538462 | 0.254545 | 0.413636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.10089 | 0.388385 | 551 | 30 | 45 | 18.366667 | 0.551929 | 0 | 0 | 0 | 0 | 0 | 0.353902 | 0 | 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 |
38a47549892bc58fb1a7bf130c9891fee8294b1b | 298 | py | Python | Python Examples/Example-FunctionWithNestedIFElse.py | crissyg/SCH-PRACTICE | 9f9042d26361a58c90e5d888e4bda30ada906bae | [
"MIT"
] | null | null | null | Python Examples/Example-FunctionWithNestedIFElse.py | crissyg/SCH-PRACTICE | 9f9042d26361a58c90e5d888e4bda30ada906bae | [
"MIT"
] | null | null | null | Python Examples/Example-FunctionWithNestedIFElse.py | crissyg/SCH-PRACTICE | 9f9042d26361a58c90e5d888e4bda30ada906bae | [
"MIT"
] | null | null | null | # Function with Nested IF Else
def printColor(value):
value = value.upper()
if (value == 'Y'):
print "yellow"
elif (value == 'B'):
print "blue"
elif (value == 'R'):
print "red"
else:
print "unknown"
printColor('r') # call function
| 21.285714 | 33 | 0.510067 | 33 | 298 | 4.606061 | 0.575758 | 0.131579 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.345638 | 298 | 13 | 34 | 22.923077 | 0.779487 | 0.14094 | 0 | 0 | 0 | 0 | 0.1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.545455 | 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 | 0 | 0 | 0 | 1 | 0 | 2 |
38a9891c1ed5cf5b3c0c9127391a91763d0ff3d8 | 673 | py | Python | p3d/__init__.py | Derfies/p3d | 93ff52819d778643afe1dc1ccf296e99fc52c59d | [
"MIT"
] | null | null | null | p3d/__init__.py | Derfies/p3d | 93ff52819d778643afe1dc1ccf296e99fc52c59d | [
"MIT"
] | null | null | null | p3d/__init__.py | Derfies/p3d | 93ff52819d778643afe1dc1ccf296e99fc52c59d | [
"MIT"
] | null | null | null | from pandac.PandaModules import Vec3
P3D_VERSION = '0.1'
__version__ = P3D_VERSION
from constants import *
from functions import *
import commonUtils
from object import Object
from singleTask import SingleTask
from nodePathObject import NodePathObject
from pandaObject import *
from pandaBehaviour import PandaBehaviour
from pandaManager import PandaManager
from marquee import Marquee
from camera import *
from editorCamera import EditorCamera
from frameRate import FrameRate
from displayShading import DisplayShading
from mouse import *
from mousePicker import MousePicker
import geometry
try:
import wxPanda as wx
except:
print 'Failed to find wx module' | 21.03125 | 41 | 0.827637 | 83 | 673 | 6.638554 | 0.433735 | 0.072595 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008741 | 0.150074 | 673 | 32 | 42 | 21.03125 | 0.954545 | 0 | 0 | 0 | 0 | 0 | 0.040059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.791667 | null | null | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
38bc9b8fe1468f99ebc3819879722d06bb84ef06 | 3,895 | py | Python | snippet/example/python/sqlalchemy-orm-model.py | yp2800/snippet | 054af596655007cbec81340bd166489e706fffe6 | [
"MIT"
] | 94 | 2016-09-22T09:13:19.000Z | 2022-03-30T07:35:35.000Z | snippet/example/python/sqlalchemy-orm-model.py | yp2800/snippet | 054af596655007cbec81340bd166489e706fffe6 | [
"MIT"
] | 1 | 2020-11-22T03:05:05.000Z | 2020-11-22T03:05:05.000Z | snippet/example/python/sqlalchemy-orm-model.py | yp2800/snippet | 054af596655007cbec81340bd166489e706fffe6 | [
"MIT"
] | 38 | 2017-06-11T22:03:04.000Z | 2022-03-10T07:46:39.000Z | # Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# Copyright 2012 Cloudscaling Group, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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.
from sqlalchemy.orm import object_mapper
try:
import six
Iterator = six.Iterator
except ImportError:
import sys
if sys.version_info[0] >= 3:
Iterator = object
else:
class Iterator(object):
def next(self):
return type(self).__next__(self)
class ModelBase(Iterator):
"""Base class for models."""
__table_initialized__ = False
def save(self, session):
"""Save this object."""
# NOTE(boris-42): This part of code should be look like:
# session.add(self)
# session.flush()
# But there is a bug in sqlalchemy and eventlet that
# raises NoneType exception if there is no running
# transaction and rollback is called. As long as
# sqlalchemy has this bug we have to create transaction
# explicitly.
with session.begin(subtransactions=True):
session.add(self)
session.flush()
def __repr__(self):
attrs = ", ".join(("%s=%s" % (k, v) for k, v in self.items()))
return "%s(%s)" % (self.__tablename__.title(), attrs)
def __setitem__(self, key, value):
setattr(self, key, value)
def __getitem__(self, key):
return getattr(self, key)
def __contains__(self, key):
# Don't use hasattr() because hasattr() catches any exception, not only
# AttributeError. We want to passthrough SQLAlchemy exceptions
# (ex: sqlalchemy.orm.exc.DetachedInstanceError).
try:
getattr(self, key)
except AttributeError:
return False
else:
return True
def get(self, key, default=None):
return getattr(self, key, default)
def __iter__(self):
columns = list(dict(object_mapper(self).columns).keys())
return ModelIterator(self, iter(columns))
def update(self, values):
"""Make the model object behave like a dict."""
for k, v in values.items():
setattr(self, k, v)
def _as_dict(self):
"""Make the model object behave like a dict.
Includes attributes from joins.
"""
local = dict((key, value) for key, value in self)
joined = dict([(k, v) for k, v in self.__dict__.items() if not k[0] == '_'])
local.update(joined)
return local
def items(self):
"""Make the model object behave like a dict."""
return self._as_dict().items()
def keys(self):
"""Make the model object behave like a dict."""
return [key for key, value in self.items()]
class ModelIterator(Iterator):
def __init__(self, model, columns):
self.model = model
self.i = columns
def __iter__(self):
return self
# In Python 3, __next__() has replaced next().
def __next__(self):
n = next(self.i)
return n, getattr(self.model, n)
| 33.577586 | 84 | 0.610013 | 488 | 3,895 | 4.743852 | 0.413934 | 0.02419 | 0.020734 | 0.031102 | 0.115767 | 0.078618 | 0.078618 | 0.067387 | 0.053132 | 0.037149 | 0 | 0.009475 | 0.295507 | 3,895 | 115 | 85 | 33.869565 | 0.834184 | 0.4457 | 0 | 0.103448 | 0 | 0 | 0.006724 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.258621 | false | 0 | 0.068966 | 0.068966 | 0.603448 | 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 |
38cd88d6a9d8806c77424757ca3b6620a2526f67 | 307 | py | Python | algorithms/in_order.py | AutuanLiu/LeetCode2019 | 8efc7c5475fd888f7d86c3b08a3c1c9e55c1ac30 | [
"MIT"
] | 1 | 2019-06-20T07:43:59.000Z | 2019-06-20T07:43:59.000Z | algorithms/in_order.py | AutuanLiu/Code-Storm2019 | 8efc7c5475fd888f7d86c3b08a3c1c9e55c1ac30 | [
"MIT"
] | null | null | null | algorithms/in_order.py | AutuanLiu/Code-Storm2019 | 8efc7c5475fd888f7d86c3b08a3c1c9e55c1ac30 | [
"MIT"
] | null | null | null | # 二叉树中序遍历的 生成器写法
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def mid_order(root):
if not root: return
yield from mid_order(root.left)
yield root.val
yield from mid_order(root.right)
| 21.928571 | 36 | 0.648208 | 46 | 307 | 4.173913 | 0.565217 | 0.125 | 0.1875 | 0.177083 | 0.21875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.270358 | 307 | 13 | 37 | 23.615385 | 0.857143 | 0.159609 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.3 | 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 |
38d929d0301c7b6e0ff15401a2613c1800d9088f | 139 | py | Python | test_project/test_app/urls.py | ninemoreminutes/django-trails | fabe179fc4b5829f8c73805faa027f5e866ade7c | [
"BSD-3-Clause"
] | 2 | 2018-10-18T19:34:40.000Z | 2019-11-13T16:00:53.000Z | test_project/test_app/urls.py | ninemoreminutes/django-trails | fabe179fc4b5829f8c73805faa027f5e866ade7c | [
"BSD-3-Clause"
] | 4 | 2020-02-11T23:21:07.000Z | 2020-06-05T19:21:05.000Z | test_project/test_app/urls.py | ninemoreminutes/django-trails | fabe179fc4b5829f8c73805faa027f5e866ade7c | [
"BSD-3-Clause"
] | null | null | null | # Django
from django.urls import re_path
# Test App
from .views import index
urlpatterns = [
re_path(r'^$', index, name='index'),
]
| 12.636364 | 40 | 0.669065 | 20 | 139 | 4.55 | 0.65 | 0.131868 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.194245 | 139 | 10 | 41 | 13.9 | 0.8125 | 0.107914 | 0 | 0 | 0 | 0 | 0.057851 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 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 | 1 | 0 | 0 | 0 | 0 | 2 |
38da46eb39dadf4a7638b1ed59d690feefc47f80 | 3,655 | py | Python | levels/7/initialize_db.py | industrydive/stripe-ctf-2-vm | 1987516471957a791ed02c70ac4ae6b7aeb72b69 | [
"Apache-2.0"
] | 36 | 2015-05-11T20:22:55.000Z | 2021-09-26T07:36:49.000Z | levels/7/initialize_db.py | industrydive/stripe-ctf-2-vm | 1987516471957a791ed02c70ac4ae6b7aeb72b69 | [
"Apache-2.0"
] | null | null | null | levels/7/initialize_db.py | industrydive/stripe-ctf-2-vm | 1987516471957a791ed02c70ac4ae6b7aeb72b69 | [
"Apache-2.0"
] | 16 | 2016-03-08T16:25:46.000Z | 2022-03-16T06:28:51.000Z | #!/usr/bin/env python
import sys
from datetime import datetime
from random import SystemRandom
import bcrypt
import sqlite3
import client
import db
import settings
conn = db.DB(settings.database)
conn.debug = True
c = conn.cursor
db.rewrite_entropy_file(settings.entropy_file)
rand = SystemRandom()
def rand_choice(alphabet, length):
return ''.join(rand.choice(alphabet) for i in range(length))
alphanum = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
def rand_alnum(length):
return rand_choice(alphanum, length)
def main(level_password):
create_tables()
add_users()
add_waffles(level_password)
add_logs()
def add_users():
add_user(1, 'larry', rand_alnum(16), 1)
add_user(2, 'randall', rand_alnum(16), 1)
add_user(3, 'alice', rand_alnum(16), 0)
add_user(4, 'bob', rand_alnum(16), 0)
add_user(5, 'ctf', 'password', 0)
def add_waffles(level_password):
add_waffle('liege', 1, level_password)
add_waffle('dream', 1, rand_alnum(14))
add_waffle('veritaffle', 0, rand_alnum(14))
add_waffle('chicken', 1, rand_alnum(14))
add_waffle('belgian', 0, rand_alnum(14))
add_waffle('brussels', 0, rand_alnum(14))
add_waffle('eggo', 0, rand_alnum(14))
def add_logs():
gen_log(1, '/orders', {'waffle': 'eggo', 'count': 10,
'lat': 37.351, 'long': -119.827})
gen_log(1, '/orders', {'waffle': 'chicken', 'count': 2,
'lat': 37.351, 'long': -119.827})
gen_log(2, '/orders', {'waffle': 'dream', 'count': 2,
'lat': 42.39561, 'long': -71.13051},
date=datetime(2007, 9, 23, 14, 38, 00))
gen_log(3, '/orders', {'waffle': 'veritaffle', 'count': 1,
'lat': 42.376, 'long': -71.116})
def create_tables():
c.execute('drop table if exists users')
c.execute('''
CREATE TABLE users(
id int not null primary key,
name varchar(255) not null,
password varchar(255) not null,
premium int not null,
secret varchar(255) not null,
unique (name)
)
''')
c.execute('drop table if exists waffles')
c.execute('''
CREATE TABLE waffles(
name varchar(255) not null primary key,
premium int not null,
confirm varchar(255) not null
)
''')
c.execute('drop table if exists logs')
c.execute('''
CREATE TABLE logs(
user_id int not null,
path varchar(255) not null,
body text not null,
date timestamp not null default current_timestamp
)
''')
c.execute('create index user_id on logs (user_id)')
c.execute('create index date on logs (date)')
def add_user(uid, username, password, premium):
hashed = bcrypt.hashpw(password, bcrypt.gensalt(10))
secret = rand_alnum(14)
data = {'id': uid, 'name': username, 'password': hashed,
'premium': premium, 'secret': secret}
conn.insert('users', data)
def get_user(uid):
return conn.select_one('users', {'id': uid})
def add_waffle(name, premium, confirm):
data = {'name': name, 'premium': premium, 'confirm': confirm}
conn.insert('waffles', data)
def gen_log(user_id, path, params, date=None):
user = get_user(user_id)
# generate signature using client library
cl = client.Client(None, user_id, user['secret'])
body = cl._make_post(params)
# prepare data for insert
data = {'user_id': user_id, 'path': path, 'body': body}
if date:
data['date'] = date
conn.insert('logs', data)
if __name__ == '__main__':
if len(sys.argv) < 2:
print 'usage: initialize_db.py LEVEL_PASSWORD'
sys.exit(1)
main(sys.argv[1])
| 28.115385 | 75 | 0.631464 | 503 | 3,655 | 4.445328 | 0.28827 | 0.048301 | 0.034436 | 0.045617 | 0.192308 | 0.135957 | 0.021467 | 0.021467 | 0 | 0 | 0 | 0.049596 | 0.222161 | 3,655 | 129 | 76 | 28.333333 | 0.736898 | 0.022982 | 0 | 0.098039 | 0 | 0 | 0.30213 | 0.017377 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.098039 | 0.078431 | null | null | 0.009804 | 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 |
38dbca903f2a85d1301cee64efa4e83e79d5c1ce | 112 | py | Python | jp.atcoder/abc251/abc251_a/31673235.py | kagemeka/atcoder-submissions | 91d8ad37411ea2ec582b10ba41b1e3cae01d4d6e | [
"MIT"
] | 1 | 2022-02-09T03:06:25.000Z | 2022-02-09T03:06:25.000Z | jp.atcoder/abc251/abc251_a/31673235.py | kagemeka/atcoder-submissions | 91d8ad37411ea2ec582b10ba41b1e3cae01d4d6e | [
"MIT"
] | 1 | 2022-02-05T22:53:18.000Z | 2022-02-09T01:29:30.000Z | jp.atcoder/abc251/abc251_a/31673235.py | kagemeka/atcoder-submissions | 91d8ad37411ea2ec582b10ba41b1e3cae01d4d6e | [
"MIT"
] | null | null | null | def main() -> None:
s = input()
print(s * (6 // len(s)))
if __name__ == "__main__":
main()
| 14 | 29 | 0.446429 | 14 | 112 | 3 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013514 | 0.339286 | 112 | 7 | 30 | 16 | 0.554054 | 0 | 0 | 0 | 0 | 0 | 0.07619 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.2 | 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 |
38e09a14bcf404479b71e05553e37caf4d388eb7 | 3,417 | py | Python | oo/carros.py | AdnirJunior/pythonbirds | bdc848291c3c6f22e6647768103bf7bd2863145b | [
"MIT"
] | null | null | null | oo/carros.py | AdnirJunior/pythonbirds | bdc848291c3c6f22e6647768103bf7bd2863145b | [
"MIT"
] | null | null | null | oo/carros.py | AdnirJunior/pythonbirds | bdc848291c3c6f22e6647768103bf7bd2863145b | [
"MIT"
] | null | null | null |
"""Voce deve criar uma classe carro que vai assumir dois atributos compostos por duas classes:
1) Motor
2) Direcao
O motor terá a responsabilidade de controlar a velocidade.
Ele Oferece os seguintes atributos:
1) Atribuo de dado velocidade
2) Método acelerar, que deverá incrementar 1 unidade
3) Médoto freardecrementar a velocidade de 2 unidades
A Direcao tera a responsabilidade de controlar a direcao, ela oferece os seguintes atributos:
1) Valor de direcao com valores possiveis norte, sul, leste, oeste
2) Método girar a direita -
2) Método girar a esquerda
N
O L
S
exemplo:
# Testando motor
>>> motor = Motor()
>>> motor.velocidade
0
>>> motor.acelerar()
>>> motor.velocidade
1
>>> motor.acelerar()
>>> motor.velocidade
2
>>> motor.acelerar()
>>> motor.velocidade
3
>>> motor.frear()
>>> motor.velocidade
1
>>> motor.frear()
>>> motor.velocidade
0
>>> #Testando direcao
>>> direcao = Direcao()
>>> direcao.valor
'Norte'
>>> direcao.girar_a_direita()
>>> direcao.valor
'Leste'
>>> direcao.girar_a_direita()
>>> direcao.valor
'Sul'
>>> direcao.girar_a_direita()
>>> direcao.valor
'Oeste'
>>> direcao.girar_a_direita()
>>> direcao.valor
'Norte'
>>> direcao.girar_a_esquerda()
>>> direcao.valor
'Oeste'
>>> direcao.girar_a_esquerda()
>>> direcao.valor
'Sul'
>>> direcao.girar_a_esquerda()
>>> direcao.valor
'Leste'
>>> direcao.girar_a_esquerda()
>>> direcao.valor
'Norte'
>>> carro = Carro(direcao, motor)
>>> carro.calcular_velocidade()
0
>>> carro.acelerar()
>>> carro.calcular_velocidade()
1
>>> carro.acelerar()
>>> carro.calcular_velocidade()
2
>>> carro.frear()
>>> carro.calcular_velocidade()
0
>>> carro.calcular_direcao()
'Norte'
>>> carro.girar_a_direita()
>>> carro.calcular_direcao()
'Leste'
>>> carro.girar_a_esquerda()
>>> carro.calcular_direcao()
'Norte'
>>> carro.girar_a_esquerda()
>>> carro.calcular_direcao()
'Oeste'
"""
NORTE = 'Norte'
LESTE = 'Leste'
SUL = 'Sul'
OESTE = 'Oeste'
class Direcao:
def __init__(self):
self.valor = NORTE
def girar_a_direita(self):
if self.valor == NORTE:
self.valor = LESTE
elif self.valor == LESTE:
self.valor = SUL
elif self.valor == SUL:
self.valor = OESTE
elif self.valor == OESTE:
self.valor = NORTE
def girar_a_esquerda(self):
if self.valor == NORTE:
self.valor = OESTE
elif self.valor == OESTE:
self.valor = SUL
elif self.valor == SUL:
self.valor = LESTE
elif self.valor == LESTE:
self.valor = NORTE
class Carro:
def __init__(self, direcao, motor):
self.direcao = direcao
self.motor = motor
def calcular_velocidade(self):
return self.motor.velocidade
def acelerar(self):
self.motor.acelerar()
def frear(self):
self.motor.frear()
def calcular_direcao(self):
return self.direcao.valor
def girar_a_direita(self):
self.direcao.girar_a_direita()
def girar_a_esquerda(self):
self.direcao.girar_a_esquerda()
class Motor:
def __init__(self):
self.velocidade = 0
def acelerar(self):
self.velocidade += 1
def frear(self):
self.velocidade -= 2
self.velocidade = max(0, self.velocidade) | 21.903846 | 94 | 0.625988 | 412 | 3,417 | 5.055825 | 0.169903 | 0.054729 | 0.067211 | 0.048008 | 0.494479 | 0.338934 | 0.173308 | 0.096976 | 0.096976 | 0 | 0 | 0.009302 | 0.244952 | 3,417 | 156 | 95 | 21.903846 | 0.798062 | 0.581212 | 0 | 0.55102 | 0 | 0 | 0.012649 | 0 | 0 | 0 | 0 | 0.019231 | 0 | 1 | 0.265306 | false | 0 | 0 | 0.040816 | 0.367347 | 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 |
38e2780c1d8295a2aa1e5df333294d92a0dd54a1 | 3,482 | py | Python | src/icon/exception.py | goldworm-icon/gw-iconsdk | b54722b0d19f286c0d0b8d751ff8cbcabd29f86a | [
"Apache-2.0"
] | 2 | 2019-05-28T22:37:49.000Z | 2020-01-07T11:40:15.000Z | src/icon/exception.py | goldworm-icon/gw-iconsdk | b54722b0d19f286c0d0b8d751ff8cbcabd29f86a | [
"Apache-2.0"
] | 1 | 2020-02-04T12:05:31.000Z | 2020-02-04T12:05:31.000Z | src/icon/exception.py | goldworm-icon/gw-iconsdk | b54722b0d19f286c0d0b8d751ff8cbcabd29f86a | [
"Apache-2.0"
] | 1 | 2019-08-01T08:42:15.000Z | 2019-08-01T08:42:15.000Z | # -*- coding: utf-8 -*-
from enum import IntEnum, unique
from typing import Optional, Any
class SDKException(Exception):
@unique
class Code(IntEnum):
OK = 0
KEY_STORE_ERROR = 1
ADDRESS_ERROR = 2
BALANCE_ERROR = 3
DATA_TYPE_ERROR = 4
JSON_RPC_ERROR = 5
ZIP_MEMORY_ERROR = 6
URL_ERROR = 7
BUILDER_ERROR = 8
ARG_ERROR = 9
HOOK_ERROR = 10
def __str__(self) -> str:
return str(self.name).capitalize().replace("_", " ")
def __init__(self, code: Code, message: Optional[str], user_data: Any = None):
self._code = code
self._message = message if isinstance(message, str) else str(code)
self._user_data = user_data
@property
def code(self):
return self._code
@property
def message(self):
return self._message
@property
def user_data(self) -> Any:
return self._user_data
def __str__(self):
return f"{self.message} ({self._code.value})"
class KeyStoreException(SDKException):
""""Error when making or loading a keystore file."""
def __init__(self, message: Optional[str], user_data: Any = None):
super().__init__(SDKException.Code.KEY_STORE_ERROR, message, user_data)
class AddressException(SDKException):
"""Error when having an invalid address."""
def __init__(self, message: Optional[str], user_data: Any = None):
super().__init__(SDKException.Code.ADDRESS_ERROR, message, user_data)
class BalanceException(SDKException):
"""Error when having an invalid balance."""
def __init__(self, message: Optional[str], user_data: Any = None):
super().__init__(SDKException.Code.BALANCE_ERROR, message, user_data)
class DataTypeException(SDKException):
"""Error when data type is invalid."""
def __init__(self, message: Optional[str], user_data: Any = None):
super().__init__(SDKException.Code.DATA_TYPE_ERROR, message, user_data)
class ArgumentException(SDKException):
def __init__(self, message: Optional[str], user_data: Any = None):
super().__init__(SDKException.Code.ARG_ERROR, message, user_data)
class JSONRPCException(SDKException):
"""Error when get JSON-RPC Error Response."""
def __init__(self, message: Optional[str], user_data: Any = None):
super().__init__(SDKException.Code.JSON_RPC_ERROR, message, user_data)
class ZipException(SDKException):
""""Error while write zip in memory"""
def __init__(self, message: Optional[str], user_data: Any = None):
super().__init__(SDKException.Code.ZIP_MEMORY_ERROR, message, user_data)
class URLException(SDKException):
"""Error regarding invalid URL"""
def __init__(self, message: Optional[str], user_data: Any = None):
super().__init__(SDKException.Code.URL_ERROR, message, user_data)
class BuilderException(SDKException):
"""Error for sdk method misuse
"""
def __init__(self, message: Optional[str], user_data: Any = None):
super().__init__(SDKException.Code.BUILDER_ERROR, message, user_data)
class HookException(SDKException):
def __init__(self, message: Optional[str], user_data: Any = None):
super().__init__(SDKException.Code.HOOK_ERROR, message, user_data)
class TimeoutException(SDKException):
def __init__(self, message: Optional[str], user_data: Any = None):
super().__init__(SDKException.Code.HOOK_ERROR, message, user_data)
| 30.017241 | 82 | 0.681505 | 424 | 3,482 | 5.209906 | 0.214623 | 0.097782 | 0.059756 | 0.119511 | 0.533273 | 0.429153 | 0.39656 | 0.381621 | 0.381621 | 0.381621 | 0 | 0.004688 | 0.203619 | 3,482 | 115 | 83 | 30.278261 | 0.791922 | 0.089604 | 0 | 0.242424 | 0 | 0 | 0.011825 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.257576 | false | 0 | 0.030303 | 0.075758 | 0.560606 | 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 |
2a1fc79d624fe31282ea8ff5726da6d9664343bd | 389 | py | Python | training_data.py | zestdoc/echoAI | 2ef96dbd156c94fff0c1d8ff90d0e1706864185e | [
"MIT"
] | null | null | null | training_data.py | zestdoc/echoAI | 2ef96dbd156c94fff0c1d8ff90d0e1706864185e | [
"MIT"
] | null | null | null | training_data.py | zestdoc/echoAI | 2ef96dbd156c94fff0c1d8ff90d0e1706864185e | [
"MIT"
] | null | null | null | # Format of training prompt
defaultPrompt = """I am a Cardiologist. My patient asked me what this means:
Input: Normal left ventricular size and systolic function. EF > 55 %. Normal right ventricular size and systolic function. Normal valve structure and function
Output: Normal pumping function of the left and right side of the heart. Heart valves are normal
-
Input: {}
Output:"""
| 29.923077 | 158 | 0.766067 | 57 | 389 | 5.22807 | 0.631579 | 0.100671 | 0.120805 | 0.174497 | 0.228188 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006231 | 0.174807 | 389 | 12 | 159 | 32.416667 | 0.922118 | 0.064267 | 0 | 0 | 0 | 0.166667 | 0.933702 | 0 | 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 |
2a37076e9a1081b1644f5c10b693cd623705219d | 735 | py | Python | cybox/objects/win_event_object.py | Mattlk13/python-cybox | ee82c7da40ca4638e3ca8d70766150c0dace1b55 | [
"BSD-3-Clause"
] | 40 | 2015-03-05T18:22:51.000Z | 2022-03-06T07:29:25.000Z | cybox/objects/win_event_object.py | Mattlk13/python-cybox | ee82c7da40ca4638e3ca8d70766150c0dace1b55 | [
"BSD-3-Clause"
] | 106 | 2015-01-12T18:52:20.000Z | 2021-04-25T22:57:52.000Z | cybox/objects/win_event_object.py | Mattlk13/python-cybox | ee82c7da40ca4638e3ca8d70766150c0dace1b55 | [
"BSD-3-Clause"
] | 30 | 2015-03-25T07:24:40.000Z | 2021-07-23T17:10:11.000Z | # Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
from mixbox import entities
from mixbox import fields
import cybox.bindings.win_event_object as win_event_binding
from cybox.objects.win_handle_object import WinHandle
from cybox.common import ObjectProperties, String
class WinEvent(ObjectProperties):
_binding = win_event_binding
_binding_class = win_event_binding.WindowsEventObjectType
_namespace = "http://cybox.mitre.org/objects#WinEventObject-2"
_XSI_NS = "WinEventObj"
_XSI_TYPE = "WindowsEventObjectType"
name = fields.TypedField("Name", String)
handle = fields.TypedField("Handle", WinHandle)
type_ = fields.TypedField("Type", String)
| 33.409091 | 66 | 0.779592 | 89 | 735 | 6.224719 | 0.52809 | 0.057762 | 0.081227 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007911 | 0.140136 | 735 | 21 | 67 | 35 | 0.868671 | 0.134694 | 0 | 0 | 0 | 0 | 0.148499 | 0.034755 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.357143 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
2a377186c5cffd5cbf92c4375d940a280d7978d4 | 163 | py | Python | Lab5/try.py | HelloYeew/helloyeew-lab-computer-programming- | 92f643deadcec39ffdf2af2cba43626d40f925cd | [
"MIT"
] | 1 | 2022-01-02T00:47:28.000Z | 2022-01-02T00:47:28.000Z | Lab5/try.py | HelloYeew/helloyeew-lab-computer-programming-ii | 92f643deadcec39ffdf2af2cba43626d40f925cd | [
"MIT"
] | null | null | null | Lab5/try.py | HelloYeew/helloyeew-lab-computer-programming-ii | 92f643deadcec39ffdf2af2cba43626d40f925cd | [
"MIT"
] | null | null | null | import tkinter as tk
root = tk.Tk()
def motion(event):
x, y = event.x, event.y
print('{}, {}'.format(x, y))
root.bind('<Motion>', motion)
root.mainloop() | 18.111111 | 32 | 0.601227 | 26 | 163 | 3.769231 | 0.538462 | 0.122449 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.177914 | 163 | 9 | 33 | 18.111111 | 0.731343 | 0 | 0 | 0 | 0 | 0 | 0.085366 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.285714 | 0.142857 | 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 |
2a3f420858525afd3b6e496ae0a3136e8d138627 | 518 | py | Python | boto3_exceptions/iot1click-devices.py | siteshen/boto3_exceptions | d6174c2577c9d4b17a09a89cd0e4bd1fe555b26b | [
"MIT"
] | 2 | 2021-06-22T00:00:35.000Z | 2021-07-15T03:25:52.000Z | boto3_exceptions/iot1click-devices.py | siteshen/boto3_exceptions | d6174c2577c9d4b17a09a89cd0e4bd1fe555b26b | [
"MIT"
] | null | null | null | boto3_exceptions/iot1click-devices.py | siteshen/boto3_exceptions | d6174c2577c9d4b17a09a89cd0e4bd1fe555b26b | [
"MIT"
] | null | null | null | import boto3
exceptions = boto3.client('iot1click-devices').exceptions
ForbiddenException = exceptions.ForbiddenException
InternalFailureException = exceptions.InternalFailureException
InvalidRequestException = exceptions.InvalidRequestException
PreconditionFailedException = exceptions.PreconditionFailedException
RangeNotSatisfiableException = exceptions.RangeNotSatisfiableException
ResourceConflictException = exceptions.ResourceConflictException
ResourceNotFoundException = exceptions.ResourceNotFoundException
| 43.166667 | 70 | 0.903475 | 29 | 518 | 16.137931 | 0.448276 | 0.119658 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006122 | 0.054054 | 518 | 11 | 71 | 47.090909 | 0.94898 | 0 | 0 | 0 | 0 | 0 | 0.032819 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.111111 | 0 | 0.111111 | 0 | 1 | 0 | 1 | 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 | 0 | 0 | 0 | 0 | 2 |
2a51385674b04ab4c7bc2dc4e750a01f918e381a | 1,511 | py | Python | Assignments/Exam Preparation/Python Advanced Exam - 27 June 2020/03. List Manipulator.py | KaloyankerR/python-fundamentals-repository | b8e69523ea7e6aa352e8398f0202e283374a0f7c | [
"MIT"
] | null | null | null | Assignments/Exam Preparation/Python Advanced Exam - 27 June 2020/03. List Manipulator.py | KaloyankerR/python-fundamentals-repository | b8e69523ea7e6aa352e8398f0202e283374a0f7c | [
"MIT"
] | null | null | null | Assignments/Exam Preparation/Python Advanced Exam - 27 June 2020/03. List Manipulator.py | KaloyankerR/python-fundamentals-repository | b8e69523ea7e6aa352e8398f0202e283374a0f7c | [
"MIT"
] | null | null | null | from collections import deque
def list_manipulator(numbers, *args):
numbers = deque(numbers)
action = args[0]
direction = args[1]
if action == 'add':
parameters = [int(x) for x in args[2:]]
if direction == 'beginning':
[numbers.appendleft(x) for x in parameters[::-1]]
elif direction == 'end':
[numbers.append(x) for x in parameters]
elif action == 'remove':
parameter = None
if len(args) == 3:
parameter = int(args[2])
if parameter:
if parameter >= len(numbers):
numbers.clear()
else:
if direction == 'beginning':
[numbers.popleft() for x in range(parameter)]
elif direction == 'end':
[numbers.pop() for x in range(parameter)]
else:
if direction == 'beginning':
numbers.popleft()
elif direction == 'end':
numbers.pop()
return [int(x) for x in numbers]
print(list_manipulator([1, 2, 3], "remove", "end"))
print(list_manipulator([1, 2, 3], "remove", "beginning"))
print(list_manipulator([1, 2, 3], "add", "beginning", 20))
print(list_manipulator([1, 2, 3], "add", "end", 30))
print(list_manipulator([1, 2, 3], "remove", "end", 2))
print(list_manipulator([1, 2, 3], "remove", "beginning", 2))
print(list_manipulator([1, 2, 3], "add", "beginning", 20, 30, 40))
print(list_manipulator([1, 2, 3], "add", "end", 30, 40, 50))
| 32.847826 | 66 | 0.544011 | 184 | 1,511 | 4.418478 | 0.228261 | 0.166052 | 0.196802 | 0.206642 | 0.615006 | 0.435424 | 0.341943 | 0.339483 | 0.167282 | 0 | 0 | 0.044986 | 0.293845 | 1,511 | 45 | 67 | 33.577778 | 0.716963 | 0 | 0 | 0.216216 | 0 | 0 | 0.085374 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.027027 | false | 0 | 0.027027 | 0 | 0.081081 | 0.216216 | 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 |
2a572edc22a1007d158ae57f509ba56d4cf54a6e | 603 | py | Python | lab01/calculadora/urls.py | josepilco7501/TECSUP-DAE-2021-2 | f6e433193edd2b9547a7385f0e03b0aacdb4dcd0 | [
"MIT"
] | null | null | null | lab01/calculadora/urls.py | josepilco7501/TECSUP-DAE-2021-2 | f6e433193edd2b9547a7385f0e03b0aacdb4dcd0 | [
"MIT"
] | null | null | null | lab01/calculadora/urls.py | josepilco7501/TECSUP-DAE-2021-2 | f6e433193edd2b9547a7385f0e03b0aacdb4dcd0 | [
"MIT"
] | null | null | null | from django.urls import path
from.import views
urlpatterns = [
#ex: localhost:8080/app/
path('', views.index, name='index'),
#ex: localhost:8080/app/sumar/n1+n2/
path('sumar/<int:n1>/<int:n2>', views.sumar, name='suma'),
#ex: localhost:8080/app/sumar/n1-n2/
path('restar/<int:n1>/<int:n2>', views.restar, name='resta'),
#ex: localhost:8080/app/multiplicar/n1*n2/
path('multiplicar/<int:n1>/<int:n2>', views.multiplicar, name='multiplicacion'),
#ex: localhost:8080/app/multiplicar/n1/n2/
path('dividir/<int:n1>/<int:n2>', views.dividir, name='division'),
]
| 33.5 | 84 | 0.650083 | 86 | 603 | 4.55814 | 0.27907 | 0.140306 | 0.191327 | 0.229592 | 0.5 | 0.346939 | 0.346939 | 0.346939 | 0 | 0 | 0 | 0.069098 | 0.135987 | 603 | 17 | 85 | 35.470588 | 0.683301 | 0.290216 | 0 | 0 | 0 | 0 | 0.324645 | 0.239336 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.222222 | 0 | 0.222222 | 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 |
2a58d724de9a2eb16bfc33ebafdd4ad0b59e5837 | 688 | py | Python | kmeans_poc/data/generate_dataset.py | katyamust/with_git_actions | 73d9213be1a1bb626b0062afa165ea73d3283443 | [
"MIT"
] | null | null | null | kmeans_poc/data/generate_dataset.py | katyamust/with_git_actions | 73d9213be1a1bb626b0062afa165ea73d3283443 | [
"MIT"
] | null | null | null | kmeans_poc/data/generate_dataset.py | katyamust/with_git_actions | 73d9213be1a1bb626b0062afa165ea73d3283443 | [
"MIT"
] | 1 | 2020-07-03T02:08:43.000Z | 2020-07-03T02:08:43.000Z | # generate dataset : random data in a two-dimensional space
#https://towardsdatascience.com/understanding-k-means-clustering-in-machine-learning-6a6e67336aa1
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
#%matplotlib inline
def generate_x():
X = -2 * np.random.rand(100,2)
X1 = 1 + 2 * np.random.rand(50,2)
X[50:100, :] = X1
return X
def plot_x(X):
plt.scatter(X[ : , 0], X[ :, 1], s = 50) #, c = ‘b’)
plt.show()
pass
def save_x(X):
np.savetxt("x_poc.csv", X, delimiter=",")
pass
def main():
X = generate_x()
plot_x(X)
save_x(X)
if __name__ == '__main__':
main()
| 17.641026 | 97 | 0.632267 | 108 | 688 | 3.888889 | 0.537037 | 0.02381 | 0.042857 | 0.061905 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.053903 | 0.218023 | 688 | 38 | 98 | 18.105263 | 0.726766 | 0.263081 | 0 | 0.090909 | 1 | 0 | 0.035857 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0.090909 | 0.181818 | 0 | 0.409091 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
2a5f82639377b0ea5dadf1fcd65d906ed85ab902 | 2,190 | py | Python | antlr/SevenBillionHumansParser.py | behrmann/7billionhumans | 36d53daf278ef4f3729bc5cba2f2398d5411bd6d | [
"MIT"
] | 45 | 2018-09-05T04:56:59.000Z | 2021-11-22T08:57:26.000Z | antlr/SevenBillionHumansParser.py | behrmann/7billionhumans | 36d53daf278ef4f3729bc5cba2f2398d5411bd6d | [
"MIT"
] | 36 | 2018-09-01T11:34:26.000Z | 2021-05-19T23:20:49.000Z | antlr/SevenBillionHumansParser.py | behrmann/7billionhumans | 36d53daf278ef4f3729bc5cba2f2398d5411bd6d | [
"MIT"
] | 36 | 2018-09-01T07:44:19.000Z | 2021-09-10T19:07:35.000Z | from antlr4 import *
from antlr4.error.ErrorListener import ErrorListener
from antlr.SBHasmLexer import SBHasmLexer
from antlr.SBHasmListener import SBHasmListener
from antlr.SBHasmParser import SBHasmParser
class MyErrorListener(ErrorListener):
def __init__(self):
super(MyErrorListener, self).__init__()
def syntaxError(self, recognizer, offendingSymbol, line, column, msg, e):
raise Exception("SyntaxError in {},{} msg={}".format(line, column, msg))
def reportAmbiguity(self, recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs):
raise Exception("reportAmbiguity")
def reportAttemptingFullContext(self, recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs):
raise Exception("reportAttemptingFullContext")
def reportContextSensitivity(self, recognizer, dfa, startIndex, stopIndex, prediction, configs):
raise Exception("reportContextSensitivity")
class SBHCodeSizeListener(SBHasmListener):
def __init__(self):
self.cmd_cnt = 0
def enterCmd(self, ctx):
self.cmd_cnt += 1
def enterSonst(self, ctx):
self.cmd_cnt += 1
class Pickup:
def __init__(self, item):
self.item = item
def __str__(self):
return "Pickup"
class Mem:
def __init__(self, slot):
self.slot = slot
def __str__(self):
return self.slot
class Dir:
def __init__(self, direction):
self.dir = direction
class SevenBillionHumansParser:
def __init__(self, filepath=None, source=None):
if source:
self.parse(InputStream(source))
elif filepath:
self.parse(FileStream(filepath))
def parse(self, source_stream):
lexer = SBHasmLexer(source_stream)
stream = CommonTokenStream(lexer)
parser = SBHasmParser(stream)
# parser._listeners = [ MyErrorListener() ]
tree = parser.asm()
printer = SBHCodeSizeListener()
walker = ParseTreeWalker()
walker.walk(printer, tree)
self.cmd_size = printer.cmd_cnt
if __name__ == '__main__':
s = SevenBillionHumansParser("../solutions/55 - Data Flowers/size-10_speed-23.asm")
| 26.707317 | 108 | 0.682192 | 223 | 2,190 | 6.461883 | 0.376682 | 0.029146 | 0.045802 | 0.056211 | 0.099931 | 0.024983 | 0 | 0 | 0 | 0 | 0 | 0.006448 | 0.221005 | 2,190 | 81 | 109 | 27.037037 | 0.838218 | 0.018721 | 0 | 0.113208 | 0 | 0 | 0.073625 | 0.036813 | 0 | 0 | 0 | 0 | 0 | 1 | 0.283019 | false | 0 | 0.09434 | 0.037736 | 0.528302 | 0.056604 | 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 |
2a6c2e36e5eed7008fca91c8906b878bedc5fb28 | 242 | py | Python | 02-Tuples-and-sets/count_same_values.py | nmoskova/Python-advanced | 007f496e868aa151e39d79446b055e76ffb2db95 | [
"MIT"
] | null | null | null | 02-Tuples-and-sets/count_same_values.py | nmoskova/Python-advanced | 007f496e868aa151e39d79446b055e76ffb2db95 | [
"MIT"
] | null | null | null | 02-Tuples-and-sets/count_same_values.py | nmoskova/Python-advanced | 007f496e868aa151e39d79446b055e76ffb2db95 | [
"MIT"
] | null | null | null | numbers = [float(num) for num in input().split()]
nums_dict = {}
for el in numbers:
if el not in nums_dict:
nums_dict[el] = 0
nums_dict[el] += 1
[print(f"{el:.1f} - {occurence} times") for el, occurence in nums_dict.items()] | 26.888889 | 79 | 0.628099 | 41 | 242 | 3.585366 | 0.487805 | 0.272109 | 0.136054 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015707 | 0.210744 | 242 | 9 | 79 | 26.888889 | 0.753927 | 0 | 0 | 0 | 0 | 0 | 0.115226 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.142857 | 0 | 0 | 0 | null | 1 | 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 |
2a6f4b7eb3da6c0aa67838ecc1441c566fdf5e21 | 5,770 | py | Python | third_party/nucleus/io/bedgraph.py | llevar/deepvariant | aba55537eec832e6cea678349422124ef50680f4 | [
"BSD-3-Clause"
] | 1 | 2020-11-28T13:11:08.000Z | 2020-11-28T13:11:08.000Z | third_party/nucleus/io/bedgraph.py | hcxiong/deepvariant | aba55537eec832e6cea678349422124ef50680f4 | [
"BSD-3-Clause"
] | null | null | null | third_party/nucleus/io/bedgraph.py | hcxiong/deepvariant | aba55537eec832e6cea678349422124ef50680f4 | [
"BSD-3-Clause"
] | null | null | null | # Copyright 2018 Google Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
"""Classes for reading and writing BedGraph files.
The BedGraph format is described at
https://genome.ucsc.edu/goldenpath/help/bedgraph.html
API for reading:
```python
from third_party.nucleus.io import bedgraph
# Iterate through all records.
with bed.BedGraphReader(input_path) as reader:
for record in reader:
print(record)
```
where `record` is a `nucleus.genomics.v1.BedGraphRecord` protocol buffer.
API for writing:
```python
from third_party.nucleus.io import bedgraph
from third_party.nucleus.protos import bedgraph_pb2
# records is an iterable of nucleus.genomics.v1.BedGraphRecord protocol buffers.
records = ...
# Write all records to the desired output path.
with bed.BedGraphWriter(output_path) as writer:
for record in records:
writer.write(record)
```
For both reading and writing, if the path provided to the constructor contains
'.tfrecord' as an extension, a `TFRecord` file is assumed and attempted to be
read or written. Otherwise, the filename is treated as a true BedGraph file.
Files that end in a '.gz' suffix cause the file to be treated as compressed
(with BGZF if it is a BedGraph file, and with gzip if it is a TFRecord file).
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from third_party.nucleus.io import genomics_reader
from third_party.nucleus.io import genomics_writer
from third_party.nucleus.io.python import bedgraph_reader
from third_party.nucleus.io.python import bedgraph_writer
from third_party.nucleus.protos import bedgraph_pb2
class NativeBedGraphReader(genomics_reader.GenomicsReader):
"""Class for reading from native BedGraph files.
Most users will want to use BedGraphReader instead, because it dynamically
dispatches between reading native BedGraph files and TFRecord files based on
the filename's extension.
"""
def __init__(self, input_path, num_fields=0):
"""Initializes a NativeBedGraphReader.
Args:
input_path: string. A path to a resource containing BedGraph records.
num_fields: int. The number of fields to read in the BedGraph. If unset or
set to zero, all fields in the input are read.
"""
super(NativeBedGraphReader, self).__init__()
bedgraph_path = input_path.encode('utf8')
self._reader = bedgraph_reader.BedGraphReader.from_file(bedgraph_path)
def query(self):
"""Returns an iterator for going through the records in the region.
NOTE: This function is not currently implemented by NativeBedGraphReader
though it could be implemented for sorted, tabix-indexed BedGraph files.
"""
raise NotImplementedError('Can not currently query a BedGraph file')
def iterate(self):
"""Returns an iterable of BedGraphRecord protos in the file."""
return self._reader.iterate()
def __exit__(self, exit_type, exit_value, exit_traceback):
self._reader.__exit__(exit_type, exit_value, exit_traceback)
class BedGraphReader(genomics_reader.DispatchingGenomicsReader):
"""Class for reading BedGraphRecord protos from BedGraph or TFRecord files."""
def _native_reader(self, input_path, **kwargs):
return NativeBedGraphReader(input_path, **kwargs)
def _record_proto(self):
return bedgraph_pb2.BedGraphRecord
class NativeBedGraphWriter(genomics_writer.GenomicsWriter):
"""Class for writing to native BedGraph files.
Most users will want BedGraphWriter, which will write to either native
BedGraph files or TFRecord files, based on the output filename's extension.
"""
def __init__(self, output_path, header=None):
"""Initializer for NativeBedGraphWriter.
Args:
output_path: str. The path to which to write the BedGraph file.
"""
super(NativeBedGraphWriter, self).__init__()
self._writer = bedgraph_writer.BedGraphWriter.to_file(output_path)
def write(self, proto):
self._writer.write(proto)
def __exit__(self, exit_type, exit_value, exit_traceback):
self._writer.__exit__(exit_type, exit_value, exit_traceback)
class BedGraphWriter(genomics_writer.DispatchingGenomicsWriter):
"""Class for writing BedGraphRecord protos to BedGraph or TFRecord files."""
def _native_writer(self, output_path):
return NativeBedGraphWriter(output_path)
| 36.987179 | 80 | 0.775043 | 799 | 5,770 | 5.460576 | 0.32791 | 0.016502 | 0.02567 | 0.038506 | 0.235618 | 0.193445 | 0.162732 | 0.129269 | 0.051799 | 0.051799 | 0 | 0.002889 | 0.160139 | 5,770 | 155 | 81 | 37.225806 | 0.897441 | 0.662912 | 0 | 0.057143 | 0 | 0 | 0.023783 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.228571 | 0.085714 | 0.742857 | 0.028571 | 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 |
2a860262b33282503fccf38e95544724adfe85c7 | 347 | py | Python | Python/bolha_curta.py | robertogoes/exercicios-coursera-python | 5093cc31ccda764b6131987fa81601b7179a9bfc | [
"MIT"
] | null | null | null | Python/bolha_curta.py | robertogoes/exercicios-coursera-python | 5093cc31ccda764b6131987fa81601b7179a9bfc | [
"MIT"
] | null | null | null | Python/bolha_curta.py | robertogoes/exercicios-coursera-python | 5093cc31ccda764b6131987fa81601b7179a9bfc | [
"MIT"
] | null | null | null | def bolha_curta(self, lista):
fim = len(lista)
for i in range(fim-1, 0, -1):
trocou = False
for j in range(i):
if lista[j] > lista[j+1]:
lista[j], lista[j+1] = lista[j+1], lista[j]
trocou = True
if trocou== False:
return
| 26.692308 | 63 | 0.414986 | 45 | 347 | 3.177778 | 0.422222 | 0.251748 | 0.146853 | 0.251748 | 0.272727 | 0.223776 | 0.223776 | 0 | 0 | 0 | 0 | 0.032258 | 0.463977 | 347 | 12 | 64 | 28.916667 | 0.736559 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0 | 0 | 0.2 | 0 | 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 |
2a8e849bd418c1e14d8f941c5af6a81e0f4c5254 | 15,584 | py | Python | rubika/__init__.py | sajjadsoleimani/rubika | 328e60b76dd04be695285b0735c36e151e65ef5d | [
"MIT"
] | 1 | 2022-01-22T10:29:12.000Z | 2022-01-22T10:29:12.000Z | rubika/__init__.py | Mahdiblackstar/rubika | 328e60b76dd04be695285b0735c36e151e65ef5d | [
"MIT"
] | null | null | null | rubika/__init__.py | Mahdiblackstar/rubika | 328e60b76dd04be695285b0735c36e151e65ef5d | [
"MIT"
] | 1 | 2022-03-21T07:44:49.000Z | 2022-03-21T07:44:49.000Z | from requests import post
from random import randint
from json import loads, dumps
import asyncio,base64,glob,json,math,urllib3,os,pathlib,random,sys,concurrent.futures,time
from tqdm import tqdm
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
class encryption:
def __init__(self, auth):
self.key = bytearray(self.secret(auth), "UTF-8")
self.iv = bytearray.fromhex('00000000000000000000000000000000')
def replaceCharAt(self, e, t, i):
return e[0:t] + i + e[t + len(i):]
def secret(self, e):
t = e[0:8]
i = e[8:16]
n = e[16:24] + t + e[24:32] + i
s = 0
while s < len(n):
e = n[s]
if e >= '0' and e <= '9':
t = chr((ord(e[0]) - ord('0') + 5) % 10 + ord('0'))
n = self.replaceCharAt(n, s, t)
else:
t = chr((ord(e[0]) - ord('a') + 9) % 26 + ord('a'))
n = self.replaceCharAt(n, s, t)
s += 1
return n
def encrypt(self, text):
raw = pad(text.encode('UTF-8'), AES.block_size)
aes = AES.new(self.key, AES.MODE_CBC, self.iv)
enc = aes.encrypt(raw)
result = base64.b64encode(enc).decode('UTF-8')
return result
def decrypt(self, text):
aes = AES.new(self.key, AES.MODE_CBC, self.iv)
dec = aes.decrypt(base64.urlsafe_b64decode(text.encode('UTF-8')))
result = unpad(dec, AES.block_size).decode('UTF-8')
return result
class Bot:
def __init__(self, auth):
self.auth = auth
self.enc = encryption(auth)
def sendMessage(self, chat_id, text, message_id=None):
if message_id == None:
return post(json={"api_version":"5","auth":self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"sendMessage",
"input":{
"object_guid":chat_id,
"rnd":f"{randint(100000,900000)}",
"text":text,
"reply_to_message_id":message_id
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c17.iranlms.ir/")
else:
return post(json={"api_version":"5","auth":self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"sendMessage",
"input":{
"object_guid":chat_id,
"rnd":f"{randint(100000,900000)}",
"text":text,
"reply_to_message_id":message_id
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c17.iranlms.ir/")
def deleteMessages(self, chat_id, message_ids):
return post(json={"api_version":"5","auth":self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"deleteMessages",
"input":{
"object_guid":chat_id,
"message_ids":message_ids,
"type":"Global"
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c66.iranlms.ir/")
def getUserInfo(self, chat_id):
return loads(self.enc.decrypt(post(json={"api_version":"5","auth":self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"getUserInfo",
"input":{
"user_guid":chat_id
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c37.iranlms.ir/").json()["data_enc"]))
def getMessages(self, chat_id,min_id):
return loads(self.enc.decrypt(post(json={"api_version":"5","auth": self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"getMessagesInterval",
"input":{
"object_guid":chat_id,
"middle_message_id":min_id
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c67.iranlms.ir/").json().get("data_enc"))).get("data").get("messages")
def getInfoByUsername(self, username):
''' username should be without @ '''
return loads(self.enc.decrypt(post(json={"api_version":"5","auth": self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"getObjectByUsername",
"input":{
"username":username
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c23.iranlms.ir/").json().get("data_enc")))
def banGroupMember(self, chat_id, user_id):
return post(json={"api_version":"5","auth": self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"banGroupMember",
"input":{
"group_guid": chat_id,
"member_guid": user_id,
"action":"Set"
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c21.iranlms.ir/")
def invite(self, chat_id, user_ids):
return post(json={"api_version":"5","auth": self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"addGroupMembers",
"input":{
"group_guid": chat_id,
"member_guids": user_ids
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c22.iranlms.ir/")
def getGroupAdmins(self, chat_id):
return loads(self.enc.decrypt(post(json={"api_version":"5","auth": self.auth,"data_enc":self.enc.encrypt(dumps({
"client":{
"app_name":"Main",
"app_version":"2.9.5",
"lang_code":"fa",
"package":"ir.resaneh1.iptv",
"platform":"Android"
},
"input":{
"group_guid":chat_id
},
"method":"getGroupAdminMembers"
}))},url="https://messengerg2c22.iranlms.ir/").json().get("data_enc")))
def getMessagesInfo(self, chat_id, message_ids):
return loads(self.enc.decrypt(post(json={"api_version":"5","auth": self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"getMessagesByID",
"input":{
"object_guid": chat_id,
"message_ids": message_ids
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))}, url="https://messengerg2c24.iranlms.ir/").json()["data_enc"])).get("data").get("messages")
def setMembersAccess(self, chat_id, access_list):
return post(json={
"api_version": "4",
"auth": self.auth,
"client": {
"app_name": "Main",
"app_version": "2.9.5",
"lang_code": "fa",
"package": "ir.resaneh1.iptv",
"platform": "Android"
},
"data_enc": self.enc.encrypt(dumps({
"access_list": access_list,
"group_guid": chat_id
})),
"method": "setGroupDefaultAccess"
}, url="https://messengerg2c24.iranlms.ir/")
def getGroupMembers(self, chat_id):
return loads(self.enc.decrypt(post(json={
"api_version":"5",
"auth": self.auth,
"data_enc": self.enc.encrypt(dumps({
"method":"getGroupAllMembers",
"input":{
"group_guid": chat_id,
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))
}, url="https://messengerg2c17.iranlms.ir/").json()["data_enc"]))["data"]["in_chat_members"]
def getGroupInfo(self, chat_id):
return loads(self.enc.decrypt(post(
json={
"api_version":"5",
"auth": self.auth,
"data_enc": self.enc.encrypt(dumps({
"method":"getGroupInfo",
"input":{
"group_guid": chat_id,
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))}, url="https://messengerg2c24.iranlms.ir/").json()["data_enc"]))
def getGroupLink(self, chat_id):
return loads(self.enc.decrypt(post(json={"api_version":"5","auth": self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"getGroupLink",
"input":{
"group_guid":chat_id
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c67.iranlms.ir/").json().get("data_enc"))).get("data").get("join_link")
# thanks for Sajjad Soleymani
def get_updates_all_chats(self):
time_stamp = str(random._floor(datetime.datetime.today().timestamp()) - 200)
return loads(self.enc.decrypt(post(json={"api_version":"5","auth": self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"getChatsUpdates",
"input":{
"state":time_stamp,
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c67.iranlms.ir/").json().get("data_enc"))).get("data").get("chats")
def get_updates_chat(self, chat_id):
time_stamp = str(random._floor(datetime.datetime.today().timestamp()) - 200)
return loads(self.enc.decrypt(post(json={"api_version":"5","auth": self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"getMessagesUpdates",
"input":{
"object_guid":chat_id,
"state":time_stamp
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c67.iranlms.ir/").json().get("data_enc"))).get("data").get("updated_messages")
def my_sticker_set(self):
time_stamp = str(random._floor(datetime.datetime.today().timestamp()) - 200)
return loads(self.enc.decrypt(post(json={"api_version":"5","auth": self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"getMyStickerSets",
"input":{},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c67.iranlms.ir/").json().get("data_enc"))).get("data")
def requestFile(name, size , mime):
o = ''
while str(o) != '<Response [200]>':
o = post(json={"api_version":"5","auth":self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"requestSendFile",
"input":{
"file_name":name,
"size":size,
"mime":mime
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c66.iranlms.ir/")
try:
k = loads(self.enc.decrypt(o.json()["data_enc"]))
if k['status'] != 'OK' or k['status_det'] != 'OK':
o = '502'
except:
o = '502'
return k['data']
def fileUpload(bytef ,hash_send ,file_id ,url):
if len(bytef) <= 131072:
h = {
'auth':self.auth,
'chunk-size':str(len(bytef)),
'file-id':str(file_id),
'access-hash-send':hash_send,
'total-part':str(1),
'part-number':str(1)
}
t = False
while t == False:
try:
j = post(data=bytef,url=url,headers=h).text
j = loads(j)['data']['access_hash_rec']
t = True
except:
t = False
return j
else:
t = len(bytef) / 131072
t += 1
t = random._floor(t)
for i in range(1,t+1):
if i != t:
k = i - 1
k = k * 131072
t2 = False
while t2 == False:
try:
o = post(data=bytef[k:k + 131072],url=url,headers={
'auth':self.auth,
'chunk-size':str(131072),
'file-id':file_id,
'access-hash-send':hash_send,
'total-part':str(t),
'part-number':str(i)
}).text
o = loads(o)['data']
t2 = True
except:
t2 = False
j = k + 131072
j = round(j / 1024)
j2 = round(len(bytef) / 1024)
print(str(j) + 'kb / ' + str(j2) + ' kb')
else:
k = i - 1
k = k * 131072
t2 = False
while t2 == False:
try:
p = post(data=bytef[k:],url=url,headers={
'auth':self.auth,
'chunk-size':str(len(bytef[k:])),
'file-id':file_id,
'access-hash-send':hash_send,
'total-part':str(t),
'part-number':str(i)
}).text
p = loads(p)['data']['access_hash_rec']
t2 = True
except:
t2 = False
j2 = round(len(bytef) / 1024)
print(str(j2) + 'kb / ' + str(j2) + ' kb')
return p
def sendFile(chat_id, file_id , mime , dc_id, access_hash_rec, file_name, size, text=None, message_id=None):
if text == None:
if message_id == None:
t = False
while t == False:
try:
p = loads(self.enc.decrypt(loads(post(json={"api_version":"5","auth":self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"sendMessage",
"input":{
"object_guid":chat_id,
"rnd":f"{randint(100000,900000)}",
"file_inline":{
"dc_id":str(dc_id),
"file_id":str(file_id),
"type":"File",
"file_name":file_name,
"size":size,
"mime":mime,
"access_hash_rec":access_hash_rec
}
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c17.iranlms.ir/").text)['data_enc']))
t = True
except:
t = False
return p
else:
return loads(self.enc.decrypt(loads(post(json={"api_version":"5","auth":self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"sendMessage",
"input":{
"object_guid":chat_id,
"rnd":f"{randint(100000,900000)}",
"reply_to_message_id":message_id,
"file_inline":{
"dc_id":str(dc_id),
"file_id":str(file_id),
"type":"File",
"file_name":file_name,
"size":size,
"mime":mime,
"access_hash_rec":access_hash_rec
}
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c17.iranlms.ir/").text)['data_enc']))
else:
if message_id == None:
return loads(self.enc.decrypt(loads(post(json={"api_version":"5","auth":self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"sendMessage",
"input":{
"object_guid":chat_id,
"rnd":f"{randint(100000,900000)}",
"text":text,
"file_inline":{
"dc_id":str(dc_id),
"file_id":str(file_id),
"type":"File",
"file_name":file_name,
"size":size,
"mime":mime,
"access_hash_rec":access_hash_rec
}
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c17.iranlms.ir/").text)['data_enc']))
else:
return loads(self.enc.decrypt(loads(post(json={"api_version":"5","auth":self.auth,"data_enc":self.enc.encrypt(dumps({
"method":"sendMessage",
"input":{
"object_guid":chat_id,
"rnd":f"{randint(100000,900000)}",
"text":text,
"reply_to_message_id":message_id,
"file_inline":{
"dc_id":str(dc_id),
"file_id":str(file_id),
"type":"File",
"file_name":file_name,
"size":size,
"mime":mime,
"access_hash_rec":access_hash_rec
}
},
"client":{
"app_name":"Main",
"app_version":"3.2.1",
"platform":"Web",
"package":"web.rubika.ir",
"lang_code":"fa"
}
}))},url="https://messengerg2c17.iranlms.ir/").text)['data_enc'])) | 28.752768 | 121 | 0.57681 | 2,041 | 15,584 | 4.250857 | 0.11661 | 0.031466 | 0.035961 | 0.045643 | 0.752305 | 0.70597 | 0.672199 | 0.656293 | 0.651683 | 0.634048 | 0 | 0.032376 | 0.211178 | 15,584 | 542 | 122 | 28.752768 | 0.673391 | 0.003722 | 0 | 0.637965 | 0 | 0 | 0.315657 | 0.012693 | 0 | 0 | 0 | 0 | 0 | 1 | 0.048924 | false | 0 | 0.013699 | 0.023483 | 0.121331 | 0.003914 | 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 |
aa4ce841fb5c0a7a5017a31ae4183d5366d1cbf9 | 1,209 | py | Python | datamodel_code_generator/model/pydantic/__init__.py | languitar/datamodel-code-generator | ddd909746a66df5c8268d782f3ae24bee636be92 | [
"MIT"
] | null | null | null | datamodel_code_generator/model/pydantic/__init__.py | languitar/datamodel-code-generator | ddd909746a66df5c8268d782f3ae24bee636be92 | [
"MIT"
] | null | null | null | datamodel_code_generator/model/pydantic/__init__.py | languitar/datamodel-code-generator | ddd909746a66df5c8268d782f3ae24bee636be92 | [
"MIT"
] | null | null | null | from pathlib import Path
from typing import List, Optional
from jinja2 import Environment, FileSystemLoader, Template
from pydantic import BaseModel as _BaseModel
from ..base import TEMPLATE_DIR
from .base_model import BaseModel, DataModelField
from .custom_root_type import CustomRootType
from .dataclass import DataClass
def dump_resolve_reference_action(class_names: List[str]) -> str:
return '\n'.join(
f'{class_name}.update_forward_refs()' for class_name in class_names
)
class Config(_BaseModel):
extra: Optional[str] = None
title: Optional[str] = None
allow_population_by_field_name: Optional[bool] = None
# def get_validator_template() -> Template:
# template_file_path: Path = Path('pydantic') / 'one_of_validator.jinja2'
# loader = FileSystemLoader(str(TEMPLATE_DIR / template_file_path.parent))
# environment: Environment = Environment(loader=loader, autoescape=True)
# return environment.get_template(template_file_path.name)
#
#
# VALIDATOR_TEMPLATE: Template = get_validator_template()
__all__ = [
'BaseModel',
'DataModelField',
'CustomRootType',
'DataClass',
'dump_resolve_reference_action',
'VALIDATOR_TEMPLATE',
]
| 28.116279 | 78 | 0.753515 | 142 | 1,209 | 6.119718 | 0.422535 | 0.078251 | 0.055236 | 0.059839 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001957 | 0.154673 | 1,209 | 42 | 79 | 28.785714 | 0.848337 | 0.319272 | 0 | 0 | 0 | 0 | 0.158477 | 0.077396 | 0 | 0 | 0 | 0 | 0 | 1 | 0.041667 | false | 0 | 0.333333 | 0.041667 | 0.583333 | 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 |
aa4cf8c4cd4ceb51b8a674e955be5c558d98e6e8 | 2,313 | py | Python | tools/test_everything.py | cdleary/bazel_rules_hdl | 3ef172ce63cecf43bb4f3648bfc8cd887030d1a4 | [
"Apache-2.0"
] | null | null | null | tools/test_everything.py | cdleary/bazel_rules_hdl | 3ef172ce63cecf43bb4f3648bfc8cd887030d1a4 | [
"Apache-2.0"
] | null | null | null | tools/test_everything.py | cdleary/bazel_rules_hdl | 3ef172ce63cecf43bb4f3648bfc8cd887030d1a4 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, 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.
'''This script builds and tests everything that rules_hdl has.
This is what the CI builds do, and the script also works locally. Run it with
`tools/test_everything.py`.'''
import os
import subprocess
import sys
ALL_TARGETS = [
'//...',
'@at_clifford_icestorm//...',
'@at_clifford_yosys//...',
'@com_github_westes_flex//...',
'@com_github_yosyshq_nextpnr//...',
'@com_github_yosyshq_prjtrellis//...',
'@com_github_yosyshq_prjtrellis_db//...',
'@com_google_skywater_pdk//...',
'@com_google_skywater_pdk_sky130_fd_sc_ms//...',
'@com_google_skywater_pdk_sky130_fd_sc_ls//...',
'@com_google_skywater_pdk_sky130_fd_sc_lp//...',
'@com_google_skywater_pdk_sky130_fd_sc_hvl//...',
'@com_google_skywater_pdk_sky130_fd_sc_hs//...',
'@com_google_skywater_pdk_sky130_fd_sc_hdll//...',
'@com_google_skywater_pdk_sky130_fd_sc_hd//...',
'@com_google_skywater_pdk_sky130_fd_pr//...',
'@com_google_skywater_pdk_sky130_fd_io//...',
'@com_icarus_iverilog//...',
'@com_opencircuitdesign_magic//...',
'@com_opencircuitdesign_netgen//...',
'@edu_berkeley_abc//...',
'@net_sourceforge_ngspice//...',
'@net_zlib//...',
'@org_fftw//...',
'@org_gnu_bison//...',
'@org_gnu_gperf//...',
'@org_gnu_m4//...',
'@org_gnu_readline//...',
'@org_sourceware_bzip2//...',
'@org_sourceware_libffi//...',
'@org_tuxfamily_eigen//...',
'@pybind11//...',
'@tk_tcl//...',
]
for action in ['build', 'test']:
command = ' '.join([
'bazel', action, os.environ.get('EXTRA_BAZEL_ARGS', ''), os.environ.get('EXTRA_%s_BAZEL_ARGS' % action.upper(), '')
] + ALL_TARGETS)
print(command)
return_code = subprocess.call(command, shell=True)
if return_code != 0:
sys.exit(return_code)
| 33.521739 | 119 | 0.695633 | 315 | 2,313 | 4.726984 | 0.514286 | 0.060443 | 0.114171 | 0.134318 | 0.178643 | 0.178643 | 0.141034 | 0 | 0 | 0 | 0 | 0.020267 | 0.125378 | 2,313 | 68 | 120 | 34.014706 | 0.715769 | 0.318634 | 0 | 0 | 0 | 0 | 0.654464 | 0.549775 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.065217 | 0 | 0.065217 | 0.021739 | 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 | 1 | 1 | 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.