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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b6571e24839479003849f0f83df5966a5502440f | 61,285 | py | Python | pysnmp-with-texts/HH3C-RADIUS-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 8 | 2019-05-09T17:04:00.000Z | 2021-06-09T06:50:51.000Z | pysnmp-with-texts/HH3C-RADIUS-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 4 | 2019-05-31T16:42:59.000Z | 2020-01-31T21:57:17.000Z | pysnmp-with-texts/HH3C-RADIUS-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 HH3C-RADIUS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-RADIUS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:29:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint")
hh3cCommon, = mibBuilder.importSymbols("HH3C-OID-MIB", "hh3cCommon")
InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType")
Ipv6Address, = mibBuilder.importSymbols("IPV6-TC", "Ipv6Address")
radiusAccServerAddress, radiusAccClientServerPortNumber, radiusAccServerIndex = mibBuilder.importSymbols("RADIUS-ACC-CLIENT-MIB", "radiusAccServerAddress", "radiusAccClientServerPortNumber", "radiusAccServerIndex")
radiusAuthClientServerPortNumber, radiusAuthServerIndex, radiusAuthServerAddress = mibBuilder.importSymbols("RADIUS-AUTH-CLIENT-MIB", "radiusAuthClientServerPortNumber", "radiusAuthServerIndex", "radiusAuthServerAddress")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
ObjectIdentity, TimeTicks, Unsigned32, MibIdentifier, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, Counter32, Counter64, Gauge32, iso, NotificationType, ModuleIdentity, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "TimeTicks", "Unsigned32", "MibIdentifier", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "Counter32", "Counter64", "Gauge32", "iso", "NotificationType", "ModuleIdentity", "Integer32")
DisplayString, RowStatus, TextualConvention, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "RowStatus", "TextualConvention", "TruthValue")
hh3cRadius = ModuleIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 13))
hh3cRadius.setRevisions(('2014-06-07 18:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: hh3cRadius.setRevisionsDescriptions(('Modified description of hh3cRdSecondaryAuthRowStatus. Modified description of hh3cRdSecondaryAccRowStatus',))
if mibBuilder.loadTexts: hh3cRadius.setLastUpdated('201406071800Z')
if mibBuilder.loadTexts: hh3cRadius.setOrganization('Hangzhou H3C Technologies Co., Ltd.')
if mibBuilder.loadTexts: hh3cRadius.setContactInfo('Platform Team Hangzhou H3C Technologies Co., Ltd. Hai-Dian District Beijing P.R. China http://www.h3c.com Zip:100085 ')
if mibBuilder.loadTexts: hh3cRadius.setDescription('The HH3C-RADIUS-MIB contains objects to Manage configuration and Monitor running state for RADIUS feature.')
hh3cRdObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1))
hh3cRdInfoTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1), )
if mibBuilder.loadTexts: hh3cRdInfoTable.setStatus('current')
if mibBuilder.loadTexts: hh3cRdInfoTable.setDescription('The (conceptual) table listing RADIUS authentication servers.')
hh3cRdInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1), ).setIndexNames((0, "HH3C-RADIUS-MIB", "hh3cRdGroupName"))
if mibBuilder.loadTexts: hh3cRdInfoEntry.setStatus('current')
if mibBuilder.loadTexts: hh3cRdInfoEntry.setDescription('An entry (conceptual row) representing a RADIUS authentication server.')
hh3cRdGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32)))
if mibBuilder.loadTexts: hh3cRdGroupName.setStatus('current')
if mibBuilder.loadTexts: hh3cRdGroupName.setDescription('The name of the RADIUS authentication group referred to in this table entry.')
hh3cRdPrimAuthIp = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 2), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdPrimAuthIp.setStatus('deprecated')
if mibBuilder.loadTexts: hh3cRdPrimAuthIp.setDescription('The IP address of primary RADIUS authentication server.')
hh3cRdPrimUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 3), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdPrimUdpPort.setStatus('current')
if mibBuilder.loadTexts: hh3cRdPrimUdpPort.setDescription('The UDP port the client is using to send requests to primary RADIUS authentication server. Default value is 1812.')
hh3cRdPrimState = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("block", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdPrimState.setStatus('current')
if mibBuilder.loadTexts: hh3cRdPrimState.setDescription('The state of the primary RADIUS authentication server. 1 (active) The primary authentication server is in active state. 2 (block) The primary authentication server is in block state.')
hh3cRdSecAuthIp = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 5), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecAuthIp.setStatus('deprecated')
if mibBuilder.loadTexts: hh3cRdSecAuthIp.setDescription('The IP address of secondary RADIUS authentication server.')
hh3cRdSecUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 6), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecUdpPort.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS authentication server. Default value is 1812.')
hh3cRdSecState = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("block", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecState.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecState.setDescription('The state of the secondary RADIUS authentication server. 1 (active) The secondary authentication server is in active state. 2 (block) The secondary authentication server is in block state.')
hh3cRdKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdKey.setStatus('current')
if mibBuilder.loadTexts: hh3cRdKey.setDescription('The secret shared between the RADIUS client and RADIUS authentication server used in encoding and decoding sensitive data. When read, hh3cRdKey always returns an Octet String of length zero.')
hh3cRdRetry = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 9), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdRetry.setStatus('current')
if mibBuilder.loadTexts: hh3cRdRetry.setDescription('The number of attempts the client will make when trying to send requests to a server before it will consider the attempt failed. Default value is 3.')
hh3cRdTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 10), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdTimeout.setStatus('current')
if mibBuilder.loadTexts: hh3cRdTimeout.setDescription('The timeout value the client will use when sending requests to a server. The unit is second. Default value is 3.')
hh3cRdPrimAuthIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 11), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdPrimAuthIpAddrType.setStatus('current')
if mibBuilder.loadTexts: hh3cRdPrimAuthIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of primary RADIUS authentication server.')
hh3cRdPrimAuthIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 12), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdPrimAuthIpAddr.setStatus('current')
if mibBuilder.loadTexts: hh3cRdPrimAuthIpAddr.setDescription('The IP address of primary RADIUS authentication server.')
hh3cRdSecAuthIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 13), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecAuthIpAddrType.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecAuthIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of secondary RADIUS authentication server.')
hh3cRdSecAuthIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 14), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecAuthIpAddr.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecAuthIpAddr.setDescription('The IP address of secondary RADIUS authentication server.')
hh3cRdServerType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("standard", 1), ("iphotel", 2), ("portal", 3), ("extended", 4)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdServerType.setStatus('current')
if mibBuilder.loadTexts: hh3cRdServerType.setDescription('Specify the type of RADIUS server. 1 (standard) - Server based on RFC protocol(s). 2 (iphotel) - Server for IP-Hotel or 201+ system. 3 (portal) - Server for iTellin Portal system. 4 (extended) - Server based on RADIUS extensions. Default type is standard.')
hh3cRdQuietTime = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdQuietTime.setStatus('current')
if mibBuilder.loadTexts: hh3cRdQuietTime.setDescription('The time for server returning active. The unit is minute. When the value is 0, the server state retains active. Default value is 5.')
hh3cRdUserNameFormat = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 17), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("withoutdomain", 1), ("withdomain", 2), ("keeporignal", 3)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdUserNameFormat.setStatus('current')
if mibBuilder.loadTexts: hh3cRdUserNameFormat.setDescription('Specify the user-name format that is sent to RADIUS server. 1 (withoutdomain) - send the user-name without domain. 2 (withdomain) - send the user-name with domain. 3 (keeporignal) - send the user-name as it is entered. Default format is withdomain.')
hh3cRdRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 18), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdRowStatus.setStatus('current')
if mibBuilder.loadTexts: hh3cRdRowStatus.setDescription('This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRdGroupName must be specified. To destroy an existent row, the hh3cRdGroupName MUST NOT be referred by hh3cDomainTable in hh3cDomainRadiusGroupName column.')
hh3cRdSecKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 19), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecKey.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS authentication server used in encoding and decoding sensitive data. When read, hh3cRdSecKey always returns an Octet String of length zero.')
hh3cRdPrimVpnName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 20), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdPrimVpnName.setStatus('current')
if mibBuilder.loadTexts: hh3cRdPrimVpnName.setDescription('The human-readable name of the VPN in which the primary RADIUS authentication server is placed.')
hh3cRdSecVpnName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 21), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecVpnName.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecVpnName.setDescription('The human-readable name of the VPN in which the secondary RADIUS authentication server is placed.')
hh3cRdAuthNasIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 22), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAuthNasIpAddrType.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAuthNasIpAddrType.setDescription('The type (IPv4 or IPv6) of the source IP used to communicate with RADIUS authentication server.')
hh3cRdAuthNasIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 23), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAuthNasIpAddr.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAuthNasIpAddr.setDescription('The source IPv4 address used to communicate with the RADIUS authentication server.')
hh3cRdAuthNasIpv6Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 24), Ipv6Address()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAuthNasIpv6Addr.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAuthNasIpv6Addr.setDescription('The source IPv6 address used to communicate with the RADIUS authentication server.')
hh3cRdAccInfoTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2), )
if mibBuilder.loadTexts: hh3cRdAccInfoTable.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccInfoTable.setDescription('The (conceptual) table listing RADIUS accounting servers.')
hh3cRdAccInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1), ).setIndexNames((0, "HH3C-RADIUS-MIB", "hh3cRdAccGroupName"))
if mibBuilder.loadTexts: hh3cRdAccInfoEntry.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccInfoEntry.setDescription('An entry (conceptual row) representing a RADIUS accounting server.')
hh3cRdAccGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32)))
if mibBuilder.loadTexts: hh3cRdAccGroupName.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccGroupName.setDescription('The name of the RADIUS group referred to in this table entry.')
hh3cRdPrimAccIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 2), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdPrimAccIpAddrType.setStatus('current')
if mibBuilder.loadTexts: hh3cRdPrimAccIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of primary RADIUS accounting server.')
hh3cRdPrimAccIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 3), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdPrimAccIpAddr.setStatus('current')
if mibBuilder.loadTexts: hh3cRdPrimAccIpAddr.setDescription('The IP address of primary RADIUS accounting server.')
hh3cRdPrimAccUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 4), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdPrimAccUdpPort.setStatus('current')
if mibBuilder.loadTexts: hh3cRdPrimAccUdpPort.setDescription('The UDP port the client is using to send requests to primary RADIUS accounting server. Default value is 1813.')
hh3cRdPrimAccState = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("block", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdPrimAccState.setStatus('current')
if mibBuilder.loadTexts: hh3cRdPrimAccState.setDescription('The state of the primary RADIUS accounting server. 1 (active) The primary accounting server is in active state. 2 (block) The primary accounting server is in block state.')
hh3cRdSecAccIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 6), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecAccIpAddrType.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecAccIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of secondary RADIUS accounting server.')
hh3cRdSecAccIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 7), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecAccIpAddr.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecAccIpAddr.setDescription('The IP address of secondary RADIUS accounting server.')
hh3cRdSecAccUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 8), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecAccUdpPort.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecAccUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS accounting server. Default value is 1813.')
hh3cRdSecAccState = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("block", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecAccState.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecAccState.setDescription('The state of the secondary RADIUS accounting server. 1 (active) The secondary accounting server is in active state. 2 (block) The secondary accounting server is in block state.')
hh3cRdAccKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 10), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccKey.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccKey.setDescription('The secret shared between the RADIUS client and RADIUS accounting server used in encoding and decoding sensitive data. When read, hh3cRdAccKey always returns an Octet String of length zero.')
hh3cRdAccRetry = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 11), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccRetry.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccRetry.setDescription('The number of attempt the client will make when trying to send requests to a server before it will consider the attempt failed. Default value is 3.')
hh3cRdAccTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 12), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccTimeout.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccTimeout.setDescription('The timeout value the client will use when sending requests to a server. The unit is second. Default value is 3.')
hh3cRdAccServerType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("standard", 1), ("iphotel", 2), ("portal", 3), ("extended", 4)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccServerType.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccServerType.setDescription('Specify the type of RADIUS server. 1 (standard) - Server based on RFC protocol(s). 2 (iphotel) - Server for IP-Hotel or 201+ system. 3 (portal) - Server for iTellin Portal system. 4 (extended) - Server based on RADIUS extensions. Default type is standard.')
hh3cRdAccQuietTime = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccQuietTime.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccQuietTime.setDescription('The time for server returning active. The unit is minute. When the value is 0, the server state retains active. Default value is 5.')
hh3cRdAccFailureAction = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ignore", 1), ("reject", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccFailureAction.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccFailureAction.setDescription('Defines the action that authentication should take if authentication succeeds but the associated accounting start fails. 1 (ignore) - treat as authentication success; ignore accounting start failure. 2 (reject) - treat as authentication failed if corresponding accounting start fails. Default value is 1(reject).')
hh3cRdAccRealTime = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 60))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccRealTime.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccRealTime.setDescription("Interval of realtime-accounting packets. The unit is minute. When the value is 0, the device doesn't send realtime-accounting packets. Default value is 12.")
hh3cRdAccRealTimeRetry = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255)).clone(5)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccRealTimeRetry.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccRealTimeRetry.setDescription('The number of attempt the client will make when trying to send realtime-accounting packet to accounting server before it will consider the attempt failed. Default value is 5.')
hh3cRdAccSaveStopPktEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 18), TruthValue()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccSaveStopPktEnable.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccSaveStopPktEnable.setDescription("The control of whether save stop-accounting packet in local buffer and resend later when the accounting server doesn't respond. When SaveStopPktEnable is set to false, the value of AccStopRetry will be ignored. Default value is true.")
hh3cRdAccStopRetry = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 65535))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccStopRetry.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccStopRetry.setDescription('The number of attempt the client will make when trying to send stop-accounting packet to accounting server. Default value is 500.')
hh3cRdAccDataFlowUnit = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("byte", 1), ("kiloByte", 2), ("megaByte", 3), ("gigaByte", 4)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccDataFlowUnit.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccDataFlowUnit.setDescription("Specify data flow format that is sent to RADIUS server. The value SHOULD be set the same as the value of corresponding server. 1 (byte) - Specify 'byte' as the unit of data flow. 2 (kiloByte) - Specify 'kilo-byte' as the unit of data flow. 3 (megaByte) - Specify 'mega-byte' as the unit of data flow. 4 (gigaByte) - Specify 'giga-byte' as the unit of data flow. Default value is 1.")
hh3cRdAccPacketUnit = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 21), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("onePacket", 1), ("kiloPacket", 2), ("megaPacket", 3), ("gigaPacket", 4)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccPacketUnit.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccPacketUnit.setDescription("Specify packet format that is sent to RADIUS server. The value SHOULD be set the same as the value of corresponding server. 1 (onePacket) - Specify 'one-packet' as the unit of packet. 2 (kiloPacket) - Specify 'kilo-packet' as the unit of packet. 3 (megaPacket) - Specify 'mega-packet' as the unit of packet. 4 (gigaPacket) - Specify 'giga-packet' as the unit of packet. Default value is 1.")
hh3cRdAccRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 22), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccRowStatus.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccRowStatus.setDescription('This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRdAccGroupName must be specified. To destroy an existent row, the hh3cRdAccGroupName MUST NOT be referred by hh3cDomainTable in hh3cDomainRadiusGroupName column.')
hh3cRdAcctOnEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 23), TruthValue()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAcctOnEnable.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAcctOnEnable.setDescription('The control of Accounting-On function. The Accounting-On function is used by the client to mark the start of accounting (for example, upon booting) by sending Accounting-On packets and to mark the end of accounting (for example, just before a scheduled reboot) by sending Accounting-Off packets. Default value is false.')
hh3cRdAcctOnSendTimes = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 24), Integer32().clone(50)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAcctOnSendTimes.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAcctOnSendTimes.setDescription('The number of Accounting-On packets the client will send before it considers the accounting server failed. Default value is 50.')
hh3cRdAcctOnSendInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 25), Integer32().clone(3)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAcctOnSendInterval.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAcctOnSendInterval.setDescription('Interval of Accounting-On packets. The unit is second. Default value is 3.')
hh3cRdSecAccKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 26), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecAccKey.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecAccKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS accounting server used in encoding and decoding sensitive data. When read, hh3cRdSecAccKey always returns an Octet String of length zero.')
hh3cRdPrimAccVpnName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 27), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdPrimAccVpnName.setStatus('current')
if mibBuilder.loadTexts: hh3cRdPrimAccVpnName.setDescription('The human-readable name of the VPN in which the primary RADIUS accounting server is placed.')
hh3cRdSecAccVpnName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 28), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecAccVpnName.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecAccVpnName.setDescription('The human-readable name of the VPN in which the secondary RADIUS accounting server is placed.')
hh3cRdAccNasIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 29), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccNasIpAddrType.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccNasIpAddrType.setDescription('The type (IPv4 or IPv6) of the source IP used to communicate with RADIUS accounting server.')
hh3cRdAccNasIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 30), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccNasIpAddr.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccNasIpAddr.setDescription('The source IPv4 address used to communicate with the RADIUS accounting server.')
hh3cRdAccNasIpv6Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 31), Ipv6Address()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdAccNasIpv6Addr.setStatus('current')
if mibBuilder.loadTexts: hh3cRdAccNasIpv6Addr.setDescription('The source IPv6 address used to communicate with the RADIUS accounting server.')
hh3cRadiusGlobalConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 3))
hh3cRadiusAuthErrThreshold = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 3, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 100)).clone(30)).setUnits('percentage').setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cRadiusAuthErrThreshold.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAuthErrThreshold.setDescription('The threshold of authentication failure trap. A trap will be sent when the percent of the unsuccessful authentication exceeds this threshold.')
hh3cRdSecondaryAuthServerTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4), )
if mibBuilder.loadTexts: hh3cRdSecondaryAuthServerTable.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAuthServerTable.setDescription('The (conceptual) table listing RADIUS secondary authentication servers.')
hh3cRdSecondaryAuthServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1), ).setIndexNames((0, "HH3C-RADIUS-MIB", "hh3cRdGroupName"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAuthIpAddrType"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAuthIpAddr"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAuthVpnName"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAuthUdpPort"))
if mibBuilder.loadTexts: hh3cRdSecondaryAuthServerEntry.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAuthServerEntry.setDescription('An entry (conceptual row) representing a RADIUS secondary authentication server.')
hh3cRdSecondaryAuthIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 1), InetAddressType())
if mibBuilder.loadTexts: hh3cRdSecondaryAuthIpAddrType.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAuthIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of secondary RADIUS authentication server.')
hh3cRdSecondaryAuthIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 2), InetAddress())
if mibBuilder.loadTexts: hh3cRdSecondaryAuthIpAddr.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAuthIpAddr.setDescription('The IP address of secondary RADIUS authentication server.')
hh3cRdSecondaryAuthVpnName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31)))
if mibBuilder.loadTexts: hh3cRdSecondaryAuthVpnName.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAuthVpnName.setDescription('The human-readable name of the VPN in which the secondary RADIUS authentication server is placed.')
hh3cRdSecondaryAuthUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: hh3cRdSecondaryAuthUdpPort.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAuthUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS authentication server. Default value is 1812.')
hh3cRdSecondaryAuthState = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("block", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecondaryAuthState.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAuthState.setDescription('The state of the secondary RADIUS authentication server. 1 (active) The secondary authentication server is in active state. 2 (block) The secondary authentication server is in block state.')
hh3cRdSecondaryAuthKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecondaryAuthKey.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAuthKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS authentication server used in encoding and decoding sensitive data. When read, hh3cRdSecondaryAuthKey always returns an Octet String of length zero.')
hh3cRdSecondaryAuthRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 7), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecondaryAuthRowStatus.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAuthRowStatus.setDescription("This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRdGroupName must be specified. The number of rows with the same hh3cRdGroupName can't be more than 16.")
hh3cRdSecondaryAccServerTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5), )
if mibBuilder.loadTexts: hh3cRdSecondaryAccServerTable.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAccServerTable.setDescription('The (conceptual) table listing RADIUS secondary accounting servers.')
hh3cRdSecondaryAccServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1), ).setIndexNames((0, "HH3C-RADIUS-MIB", "hh3cRdAccGroupName"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAccIpAddrType"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAccIpAddr"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAccVpnName"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAccUdpPort"))
if mibBuilder.loadTexts: hh3cRdSecondaryAccServerEntry.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAccServerEntry.setDescription('An entry (conceptual row) representing a RADIUS secondary accounting server.')
hh3cRdSecondaryAccIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 1), InetAddressType())
if mibBuilder.loadTexts: hh3cRdSecondaryAccIpAddrType.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAccIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of secondary RADIUS accounting server.')
hh3cRdSecondaryAccIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 2), InetAddress())
if mibBuilder.loadTexts: hh3cRdSecondaryAccIpAddr.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAccIpAddr.setDescription('The IP address of secondary RADIUS accounting server.')
hh3cRdSecondaryAccVpnName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31)))
if mibBuilder.loadTexts: hh3cRdSecondaryAccVpnName.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAccVpnName.setDescription('The human-readable name of the VPN in which the secondary RADIUS accounting server is placed.')
hh3cRdSecondaryAccUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: hh3cRdSecondaryAccUdpPort.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAccUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS accounting server. Default value is 1813.')
hh3cRdSecondaryAccState = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("block", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecondaryAccState.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAccState.setDescription('The state of the secondary RADIUS accounting server. 1 (active) The secondary accounting server is in active state. 2 (block) The secondary accounting server is in block state.')
hh3cRdSecondaryAccKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecondaryAccKey.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAccKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS accounting server used in encoding and decoding sensitive data. When read, hh3cRdSecondaryAccKey always returns an Octet String of length zero.')
hh3cRdSecondaryAccRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 7), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRdSecondaryAccRowStatus.setStatus('current')
if mibBuilder.loadTexts: hh3cRdSecondaryAccRowStatus.setDescription("This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRdAccGroupName must be specified. The number of rows with the same hh3cRdAccGroupName can't be more than 16.")
hh3cRadiusAccounting = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2))
hh3cRadiusAccClient = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1))
hh3cRadiusAccServerTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1), )
if mibBuilder.loadTexts: hh3cRadiusAccServerTable.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAccServerTable.setDescription('The (conceptual) table listing the RADIUS accounting servers with which the client shares a secret.')
hh3cRadiusAccServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1), ).setIndexNames((0, "RADIUS-ACC-CLIENT-MIB", "radiusAccServerIndex"))
if mibBuilder.loadTexts: hh3cRadiusAccServerEntry.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAccServerEntry.setDescription('An entry (conceptual row) representing a RADIUS accounting server with which a client shares a secret.')
hh3cRadiusAccClientStartRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cRadiusAccClientStartRequests.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAccClientStartRequests.setDescription('The number of RADIUS accounting start request sent to this server.')
hh3cRadiusAccClientStartResponses = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cRadiusAccClientStartResponses.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAccClientStartResponses.setDescription('The number of RADIUS accounting start response received from this server.')
hh3cRadiusAccClientInterimRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cRadiusAccClientInterimRequests.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAccClientInterimRequests.setDescription('The number of RADIUS interim accounting request sent to this server.')
hh3cRadiusAccClientInterimResponses = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cRadiusAccClientInterimResponses.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAccClientInterimResponses.setDescription('The number of RADIUS interim accounting response received from this server.')
hh3cRadiusAccClientStopRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cRadiusAccClientStopRequests.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAccClientStopRequests.setDescription('The number of RADIUS stop accounting request sent to this RADIUS server.')
hh3cRadiusAccClientStopResponses = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cRadiusAccClientStopResponses.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAccClientStopResponses.setDescription('The number of RADIUS stop accounting response received from this server.')
hh3cRadiusServerTrap = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3))
hh3cRadiusAuthServerDownTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 1)).setObjects(("RADIUS-AUTH-CLIENT-MIB", "radiusAuthServerAddress"), ("RADIUS-AUTH-CLIENT-MIB", "radiusAuthClientServerPortNumber"), ("HH3C-RADIUS-MIB", "hh3cRadiusServerFirstTrapTime"))
if mibBuilder.loadTexts: hh3cRadiusAuthServerDownTrap.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAuthServerDownTrap.setDescription("This trap is generated when the authentication RADIUS server doesn't respond client's requests for specified times.")
hh3cRadiusAccServerDownTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 2)).setObjects(("RADIUS-ACC-CLIENT-MIB", "radiusAccServerAddress"), ("RADIUS-ACC-CLIENT-MIB", "radiusAccClientServerPortNumber"), ("HH3C-RADIUS-MIB", "hh3cRadiusServerFirstTrapTime"))
if mibBuilder.loadTexts: hh3cRadiusAccServerDownTrap.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAccServerDownTrap.setDescription("This trap is generated when the accounting RADIUS server doesn't respond client's requests for specified times.")
hh3cRadiusServerTrapPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 0))
hh3cRadiusAuthServerUpTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 0, 1)).setObjects(("RADIUS-AUTH-CLIENT-MIB", "radiusAuthServerAddress"), ("RADIUS-AUTH-CLIENT-MIB", "radiusAuthClientServerPortNumber"), ("HH3C-RADIUS-MIB", "hh3cRadiusServerFirstTrapTime"))
if mibBuilder.loadTexts: hh3cRadiusAuthServerUpTrap.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAuthServerUpTrap.setDescription('This trap is generated when the device finds that the state of RADIUS authentication server becomes reachable from unreachable.')
hh3cRadiusAccServerUpTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 0, 2)).setObjects(("RADIUS-ACC-CLIENT-MIB", "radiusAccServerAddress"), ("RADIUS-ACC-CLIENT-MIB", "radiusAccClientServerPortNumber"), ("HH3C-RADIUS-MIB", "hh3cRadiusServerFirstTrapTime"))
if mibBuilder.loadTexts: hh3cRadiusAccServerUpTrap.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAccServerUpTrap.setDescription('This trap is generated when the device finds that the state of RADIUS accounting server becomes reachable from unreachable.')
hh3cRadiusAuthErrTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 0, 3)).setObjects(("RADIUS-AUTH-CLIENT-MIB", "radiusAuthServerAddress"), ("RADIUS-AUTH-CLIENT-MIB", "radiusAuthClientServerPortNumber"))
if mibBuilder.loadTexts: hh3cRadiusAuthErrTrap.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAuthErrTrap.setDescription('This trap is generated when the device finds that the percent of unsuccessful authentication exceeds a threshold, and the threshold is the value of node hh3cRadiusAuthErrThreshold.')
hh3cRadiusAuthenticating = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4))
hh3cRadiusAuthClient = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1))
hh3cRadiusAuthServerTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1, 1), )
if mibBuilder.loadTexts: hh3cRadiusAuthServerTable.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAuthServerTable.setDescription('The (conceptual) table listing the RADIUS authenticating servers with which the client shares a secret.')
hh3cRadiusAuthServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1, 1, 1), ).setIndexNames((0, "RADIUS-AUTH-CLIENT-MIB", "radiusAuthServerIndex"))
if mibBuilder.loadTexts: hh3cRadiusAuthServerEntry.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAuthServerEntry.setDescription('An entry (conceptual row) representing a RADIUS authenticating server with which a client shares a secret.')
hh3cRadiusAuthFailureTimes = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1, 1, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cRadiusAuthFailureTimes.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAuthFailureTimes.setDescription('The number of RADIUS authenticating failed to this server.')
hh3cRadiusAuthTimeoutTimes = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cRadiusAuthTimeoutTimes.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAuthTimeoutTimes.setDescription('The number of RADIUS authenticating timeout to this server.')
hh3cRadiusAuthRejectTimes = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cRadiusAuthRejectTimes.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusAuthRejectTimes.setDescription('The number of RADIUS authenticating rejected to this server.')
hh3cRadiusExtend = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5))
hh3cRadiusExtendObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 1))
hh3cRadiusExtendTables = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2))
hh3cRadiusExtendTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 3))
hh3cRadiusSchAuthTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1), )
if mibBuilder.loadTexts: hh3cRadiusSchAuthTable.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAuthTable.setDescription('The (conceptual) table listing RADIUS authentication servers.')
hh3cRadiusSchAuthEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1), ).setIndexNames((0, "HH3C-RADIUS-MIB", "hh3cRadiusSchAuthGroupName"))
if mibBuilder.loadTexts: hh3cRadiusSchAuthEntry.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAuthEntry.setDescription('An entry (conceptual row) representing RADIUS authentication servers.')
hh3cRadiusSchAuthGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 1), DisplayString())
if mibBuilder.loadTexts: hh3cRadiusSchAuthGroupName.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAuthGroupName.setDescription('The name of the RADIUS authentication server group referred to in this table entry.')
hh3cRadiusSchAuthPrimIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 2), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimIpAddr.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimIpAddr.setDescription('The IP address of primary RADIUS authenticaiton server.')
hh3cRadiusSchAuthPrimUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 3), Integer32().clone(1812)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimUdpPort.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimUdpPort.setDescription('The UDP port the client is using to send requests to primary RADIUS authentication server. Default value is 1812.')
hh3cRadiusSchAuthPrimKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 4), DisplayString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimKey.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimKey.setDescription('The secret shared between the RADIUS client and the primary RADIUS authentication server used in encoding and decoding sensitive data.')
hh3cRadiusSchAuthSecIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 5), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRadiusSchAuthSecIpAddr.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAuthSecIpAddr.setDescription('The IP address of secondary RADIUS authenticaiton server.')
hh3cRadiusSchAuthSecUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 6), Integer32().clone(1812)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRadiusSchAuthSecUdpPort.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAuthSecUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS authentication server. Default value is 1812.')
hh3cRadiusSchAuthSecKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 7), DisplayString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRadiusSchAuthSecKey.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAuthSecKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS authentication server used in encoding and decoding sensitive data.')
hh3cRadiusSchAuthRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 8), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRadiusSchAuthRowStatus.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAuthRowStatus.setDescription('This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRadiusSchAuthGroupName must be specified, and this action will create a corresponding domain that hh3cDomainRadiusGroupName is the same as hh3cRadiusSchAuthGroupName. To destroy an existent row, the hh3cRadiusSchAuthGroupName MUST NOT be referred by hh3cDomainTable in hh3cDomainRadiusGroupName column.')
hh3cRadiusSchAccTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2), )
if mibBuilder.loadTexts: hh3cRadiusSchAccTable.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAccTable.setDescription('The (conceptual) table listing RADIUS accounting servers.')
hh3cRadiusSchAccEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1), ).setIndexNames((0, "HH3C-RADIUS-MIB", "hh3cRadiusSchAccGroupName"))
if mibBuilder.loadTexts: hh3cRadiusSchAccEntry.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAccEntry.setDescription('An entry (conceptual row) representing RADIUS accounting servers.')
hh3cRadiusSchAccGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 1), DisplayString())
if mibBuilder.loadTexts: hh3cRadiusSchAccGroupName.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAccGroupName.setDescription('The name of the RADIUS accounting server group referred to in this table entry.')
hh3cRadiusSchAccPrimIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 2), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRadiusSchAccPrimIpAddr.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAccPrimIpAddr.setDescription('The IP address of primary RADIUS accounting server.')
hh3cRadiusSchAccPrimUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 3), Integer32().clone(1813)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRadiusSchAccPrimUdpPort.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAccPrimUdpPort.setDescription('The UDP port the client is using to send requests to primary RADIUS accounting server. Default value is 1813.')
hh3cRadiusSchAccPrimKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 4), DisplayString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRadiusSchAccPrimKey.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAccPrimKey.setDescription('The secret shared between the RADIUS client and the primary RADIUS accounting server used in encoding and decoding sensitive data.')
hh3cRadiusSchAccSecIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 5), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRadiusSchAccSecIpAddr.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAccSecIpAddr.setDescription('The IP address of secondary RADIUS accounting server.')
hh3cRadiusSchAccSecUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 6), Integer32().clone(1813)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRadiusSchAccSecUdpPort.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAccSecUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS accounting server. Default value is 1813.')
hh3cRadiusSchAccSecKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 7), DisplayString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRadiusSchAccSecKey.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAccSecKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS accounting server used in encoding and decoding sensitive data.')
hh3cRadiusSchAccRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 8), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cRadiusSchAccRowStatus.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusSchAccRowStatus.setDescription('This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRadiusSchAccGroupName must be specified, and this action will create a corresponding domain that hh3cDomainRadiusGroupName is the same as hh3cRadiusSchAccGroupName. To destroy an existent row, the hh3cRadiusSchAccGroupName MUST NOT be referred by hh3cDomainTable in hh3cDomainRadiusGroupName column.')
hh3cRadiusStatistic = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 6))
hh3cRadiusStatAccReq = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 6, 1), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cRadiusStatAccReq.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusStatAccReq.setDescription('It shows the number of radius account request to the radius server.')
hh3cRadiusStatAccAck = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 6, 2), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cRadiusStatAccAck.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusStatAccAck.setDescription('It shows the number of radius account response from the radius server.')
hh3cRadiusStatLogoutReq = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 6, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cRadiusStatLogoutReq.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusStatLogoutReq.setDescription('It shows the number of logout request to the radius server.')
hh3cRadiusStatLogoutAck = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 6, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cRadiusStatLogoutAck.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusStatLogoutAck.setDescription('It shows the number of logout response from the radius server.')
hh3cRadiusServerTrapVarObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 7))
hh3cRadiusServerFirstTrapTime = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 7, 1), TimeTicks()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: hh3cRadiusServerFirstTrapTime.setStatus('current')
if mibBuilder.loadTexts: hh3cRadiusServerFirstTrapTime.setDescription('Represents the first trap time.')
mibBuilder.exportSymbols("HH3C-RADIUS-MIB", hh3cRdSecondaryAccState=hh3cRdSecondaryAccState, hh3cRdSecAccUdpPort=hh3cRdSecAccUdpPort, hh3cRdSecondaryAccKey=hh3cRdSecondaryAccKey, hh3cRadiusSchAccSecUdpPort=hh3cRadiusSchAccSecUdpPort, hh3cRdSecondaryAuthIpAddr=hh3cRdSecondaryAuthIpAddr, hh3cRdSecondaryAuthVpnName=hh3cRdSecondaryAuthVpnName, hh3cRdAuthNasIpAddrType=hh3cRdAuthNasIpAddrType, hh3cRadiusExtendTraps=hh3cRadiusExtendTraps, hh3cRadiusSchAuthGroupName=hh3cRadiusSchAuthGroupName, hh3cRadiusGlobalConfig=hh3cRadiusGlobalConfig, hh3cRdSecondaryAuthKey=hh3cRdSecondaryAuthKey, hh3cRadiusAccClientInterimResponses=hh3cRadiusAccClientInterimResponses, hh3cRadiusStatAccAck=hh3cRadiusStatAccAck, hh3cRdKey=hh3cRdKey, hh3cRdSecAuthIpAddrType=hh3cRdSecAuthIpAddrType, hh3cRdAccRetry=hh3cRdAccRetry, hh3cRadiusSchAuthSecKey=hh3cRadiusSchAuthSecKey, hh3cRdUserNameFormat=hh3cRdUserNameFormat, hh3cRdAccServerType=hh3cRdAccServerType, hh3cRdAcctOnSendTimes=hh3cRdAcctOnSendTimes, hh3cRadiusSchAccGroupName=hh3cRadiusSchAccGroupName, hh3cRadiusServerFirstTrapTime=hh3cRadiusServerFirstTrapTime, hh3cRdAuthNasIpAddr=hh3cRdAuthNasIpAddr, hh3cRdRowStatus=hh3cRdRowStatus, hh3cRadiusAuthServerDownTrap=hh3cRadiusAuthServerDownTrap, hh3cRdAccNasIpv6Addr=hh3cRdAccNasIpv6Addr, hh3cRdRetry=hh3cRdRetry, hh3cRadiusAccounting=hh3cRadiusAccounting, hh3cRadiusServerTrap=hh3cRadiusServerTrap, hh3cRdAccQuietTime=hh3cRdAccQuietTime, hh3cRadiusAccServerEntry=hh3cRadiusAccServerEntry, hh3cRdAccInfoEntry=hh3cRdAccInfoEntry, hh3cRdAccPacketUnit=hh3cRdAccPacketUnit, hh3cRadiusAuthServerUpTrap=hh3cRadiusAuthServerUpTrap, hh3cRadiusSchAuthEntry=hh3cRadiusSchAuthEntry, hh3cRadiusServerTrapVarObjects=hh3cRadiusServerTrapVarObjects, hh3cRadiusStatLogoutAck=hh3cRadiusStatLogoutAck, hh3cRdPrimAuthIpAddr=hh3cRdPrimAuthIpAddr, hh3cRadiusAccServerDownTrap=hh3cRadiusAccServerDownTrap, hh3cRdPrimState=hh3cRdPrimState, hh3cRadiusExtendObjects=hh3cRadiusExtendObjects, hh3cRdGroupName=hh3cRdGroupName, hh3cRdPrimAccIpAddr=hh3cRdPrimAccIpAddr, hh3cRadiusSchAccEntry=hh3cRadiusSchAccEntry, hh3cRadiusSchAccSecKey=hh3cRadiusSchAccSecKey, hh3cRdAccStopRetry=hh3cRdAccStopRetry, hh3cRdServerType=hh3cRdServerType, hh3cRadiusSchAuthPrimUdpPort=hh3cRadiusSchAuthPrimUdpPort, hh3cRdInfoEntry=hh3cRdInfoEntry, PYSNMP_MODULE_ID=hh3cRadius, hh3cRadiusAuthServerEntry=hh3cRadiusAuthServerEntry, hh3cRadiusSchAuthSecUdpPort=hh3cRadiusSchAuthSecUdpPort, hh3cRdSecUdpPort=hh3cRdSecUdpPort, hh3cRdAccDataFlowUnit=hh3cRdAccDataFlowUnit, hh3cRdPrimAccVpnName=hh3cRdPrimAccVpnName, hh3cRdSecAccVpnName=hh3cRdSecAccVpnName, hh3cRdSecondaryAccVpnName=hh3cRdSecondaryAccVpnName, hh3cRadiusAuthTimeoutTimes=hh3cRadiusAuthTimeoutTimes, hh3cRdAccFailureAction=hh3cRdAccFailureAction, hh3cRdQuietTime=hh3cRdQuietTime, hh3cRdAccGroupName=hh3cRdAccGroupName, hh3cRadiusAccClient=hh3cRadiusAccClient, hh3cRadiusSchAccSecIpAddr=hh3cRadiusSchAccSecIpAddr, hh3cRdSecondaryAuthServerEntry=hh3cRdSecondaryAuthServerEntry, hh3cRdObjects=hh3cRdObjects, hh3cRdAccRowStatus=hh3cRdAccRowStatus, hh3cRdSecondaryAccUdpPort=hh3cRdSecondaryAccUdpPort, hh3cRdSecondaryAccRowStatus=hh3cRdSecondaryAccRowStatus, hh3cRdSecondaryAuthUdpPort=hh3cRdSecondaryAuthUdpPort, hh3cRdSecAuthIp=hh3cRdSecAuthIp, hh3cRadiusSchAccPrimIpAddr=hh3cRadiusSchAccPrimIpAddr, hh3cRadiusExtendTables=hh3cRadiusExtendTables, hh3cRadiusStatAccReq=hh3cRadiusStatAccReq, hh3cRdSecondaryAuthServerTable=hh3cRdSecondaryAuthServerTable, hh3cRadiusSchAuthPrimKey=hh3cRadiusSchAuthPrimKey, hh3cRadiusAccClientStartResponses=hh3cRadiusAccClientStartResponses, hh3cRdSecondaryAccServerEntry=hh3cRdSecondaryAccServerEntry, hh3cRadiusAccServerUpTrap=hh3cRadiusAccServerUpTrap, hh3cRadiusAccClientInterimRequests=hh3cRadiusAccClientInterimRequests, hh3cRdAccRealTimeRetry=hh3cRdAccRealTimeRetry, hh3cRdSecAccIpAddr=hh3cRdSecAccIpAddr, hh3cRdPrimAccState=hh3cRdPrimAccState, hh3cRdInfoTable=hh3cRdInfoTable, hh3cRdPrimAuthIpAddrType=hh3cRdPrimAuthIpAddrType, hh3cRdSecAccState=hh3cRdSecAccState, hh3cRadiusAuthFailureTimes=hh3cRadiusAuthFailureTimes, hh3cRdSecAccKey=hh3cRdSecAccKey, hh3cRadiusAuthErrTrap=hh3cRadiusAuthErrTrap, hh3cRdSecondaryAccIpAddrType=hh3cRdSecondaryAccIpAddrType, hh3cRadiusAccClientStartRequests=hh3cRadiusAccClientStartRequests, hh3cRadiusAuthErrThreshold=hh3cRadiusAuthErrThreshold, hh3cRdPrimAuthIp=hh3cRdPrimAuthIp, hh3cRadiusSchAuthSecIpAddr=hh3cRadiusSchAuthSecIpAddr, hh3cRadiusStatistic=hh3cRadiusStatistic, hh3cRadiusAuthRejectTimes=hh3cRadiusAuthRejectTimes, hh3cRadiusSchAccRowStatus=hh3cRadiusSchAccRowStatus, hh3cRdSecondaryAuthRowStatus=hh3cRdSecondaryAuthRowStatus, hh3cRadiusSchAccPrimKey=hh3cRadiusSchAccPrimKey, hh3cRdSecKey=hh3cRdSecKey, hh3cRdPrimAccIpAddrType=hh3cRdPrimAccIpAddrType, hh3cRdPrimVpnName=hh3cRdPrimVpnName, hh3cRdTimeout=hh3cRdTimeout, hh3cRdAcctOnSendInterval=hh3cRdAcctOnSendInterval, hh3cRdPrimAccUdpPort=hh3cRdPrimAccUdpPort, hh3cRadiusAuthServerTable=hh3cRadiusAuthServerTable, hh3cRadius=hh3cRadius, hh3cRadiusExtend=hh3cRadiusExtend, hh3cRdAccKey=hh3cRdAccKey, hh3cRdSecVpnName=hh3cRdSecVpnName, hh3cRadiusSchAuthRowStatus=hh3cRadiusSchAuthRowStatus, hh3cRadiusServerTrapPrefix=hh3cRadiusServerTrapPrefix, hh3cRadiusSchAuthPrimIpAddr=hh3cRadiusSchAuthPrimIpAddr, hh3cRadiusAccClientStopRequests=hh3cRadiusAccClientStopRequests, hh3cRdAccInfoTable=hh3cRdAccInfoTable, hh3cRdSecondaryAccIpAddr=hh3cRdSecondaryAccIpAddr, hh3cRadiusAuthenticating=hh3cRadiusAuthenticating, hh3cRadiusSchAuthTable=hh3cRadiusSchAuthTable, hh3cRdAccTimeout=hh3cRdAccTimeout, hh3cRadiusAccClientStopResponses=hh3cRadiusAccClientStopResponses, hh3cRdAuthNasIpv6Addr=hh3cRdAuthNasIpv6Addr, hh3cRdAccSaveStopPktEnable=hh3cRdAccSaveStopPktEnable, hh3cRadiusAuthClient=hh3cRadiusAuthClient, hh3cRdPrimUdpPort=hh3cRdPrimUdpPort, hh3cRdSecAccIpAddrType=hh3cRdSecAccIpAddrType, hh3cRdSecondaryAccServerTable=hh3cRdSecondaryAccServerTable, hh3cRadiusSchAccPrimUdpPort=hh3cRadiusSchAccPrimUdpPort, hh3cRdSecAuthIpAddr=hh3cRdSecAuthIpAddr, hh3cRdAccRealTime=hh3cRdAccRealTime, hh3cRadiusAccServerTable=hh3cRadiusAccServerTable, hh3cRdSecondaryAuthState=hh3cRdSecondaryAuthState, hh3cRadiusSchAccTable=hh3cRadiusSchAccTable, hh3cRdSecondaryAuthIpAddrType=hh3cRdSecondaryAuthIpAddrType, hh3cRdAcctOnEnable=hh3cRdAcctOnEnable, hh3cRadiusStatLogoutReq=hh3cRadiusStatLogoutReq, hh3cRdSecState=hh3cRdSecState, hh3cRdAccNasIpAddrType=hh3cRdAccNasIpAddrType, hh3cRdAccNasIpAddr=hh3cRdAccNasIpAddr)
| 150.948276 | 6,416 | 0.79858 | 7,034 | 61,285 | 6.957492 | 0.077481 | 0.060565 | 0.105989 | 0.011116 | 0.597458 | 0.483153 | 0.426163 | 0.396289 | 0.359897 | 0.330391 | 0 | 0.066342 | 0.091442 | 61,285 | 405 | 6,417 | 151.320988 | 0.812575 | 0.005287 | 0 | 0 | 0 | 0.138539 | 0.324107 | 0.025807 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.027708 | 0 | 0.027708 | 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 |
b66baaf758a8898b0a9f8f70aebd2939a051cd70 | 712 | py | Python | src/helpers/preprocessing.py | feiphoon/ner-pipeline | 1c343eea458e9c546bb8b53adcd22118d171aa63 | [
"MIT"
] | null | null | null | src/helpers/preprocessing.py | feiphoon/ner-pipeline | 1c343eea458e9c546bb8b53adcd22118d171aa63 | [
"MIT"
] | null | null | null | src/helpers/preprocessing.py | feiphoon/ner-pipeline | 1c343eea458e9c546bb8b53adcd22118d171aa63 | [
"MIT"
] | null | null | null | import re
import unicodedata
def snakify_text(text: str) -> str:
"""This is to transform a text string so it can be used as a folder name.
The 4 normalisation forms:
https://en.wikipedia.org/wiki/Unicode_equivalence#Normalization
"""
result: str = text.lower().strip()
result = re.sub(r"[\\/&]", "", result)
result = re.sub(r"[,.]", " ", result)
result = re.sub(r"[()]", "", result)
result = result.strip()
result = re.sub(r"[\s]+", " ", result)
result = re.sub(r"[\s-]", "_", result)
result = re.sub(r"[\"'`‘’“”#?!|:;]", "", result)
result = (
unicodedata.normalize("NFKD", result).encode("ascii", "ignore").decode("ascii")
)
return result
| 30.956522 | 87 | 0.573034 | 90 | 712 | 4.5 | 0.511111 | 0.207407 | 0.162963 | 0.177778 | 0.325926 | 0.301235 | 0.301235 | 0.271605 | 0.271605 | 0.271605 | 0 | 0.001779 | 0.210674 | 712 | 22 | 88 | 32.363636 | 0.718861 | 0.227528 | 0 | 0 | 0 | 0 | 0.096045 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0 | 0.133333 | 0 | 0.266667 | 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 |
fcb17350c8285607c8aa233473526499c0834efa | 221 | py | Python | PP4E/Examples/PP4E/Internet/Web/cgi-bin/test-context.py | BeacherHou/Python-_Markdown- | 015d79a02d32f49395b80ca10919b3a09b72c4df | [
"MIT"
] | null | null | null | PP4E/Examples/PP4E/Internet/Web/cgi-bin/test-context.py | BeacherHou/Python-_Markdown- | 015d79a02d32f49395b80ca10919b3a09b72c4df | [
"MIT"
] | null | null | null | PP4E/Examples/PP4E/Internet/Web/cgi-bin/test-context.py | BeacherHou/Python-_Markdown- | 015d79a02d32f49395b80ca10919b3a09b72c4df | [
"MIT"
] | null | null | null | import languages2common # from my dir
f = open('test-context-output.txt', 'w') # in .. server dir
f.write(languages2common.inputkey)
f.close()
print('context-type: text/html\n\nDone.\n')
| 27.625 | 64 | 0.61086 | 29 | 221 | 4.655172 | 0.793103 | 0.059259 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011905 | 0.239819 | 221 | 7 | 65 | 31.571429 | 0.791667 | 0.126697 | 0 | 0 | 0 | 0 | 0.320442 | 0.127072 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 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 |
fcbfa456d7b4d0009a941746aa88d126a64eea59 | 806 | py | Python | docato/docato_proj/celery.py | pavlovma007/docato | 950c30268a8696c5f67ddb85701b2712265af09e | [
"MIT"
] | 1 | 2021-12-09T10:00:29.000Z | 2021-12-09T10:00:29.000Z | docato/docato_proj/celery.py | pavlovma007/docato | 950c30268a8696c5f67ddb85701b2712265af09e | [
"MIT"
] | null | null | null | docato/docato_proj/celery.py | pavlovma007/docato | 950c30268a8696c5f67ddb85701b2712265af09e | [
"MIT"
] | null | null | null | # -*- coding: utf8 -*-
from __future__ import absolute_import
import os
from celery import Celery
from django.conf import settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'docato_proj.settings')
#app = Celery('docato_proj')
app = Celery('docato_proj',backend='rpc://') #,include=['test_celery.tasks'] # broker='amqp://admin:mypass@rabbit:5672'
# Using a string here means the worker will not have to
# pickle the object when using Windows.
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS, force=True)
# подстрахуюсь
try:
import docato.tasks
except ImportError:
import docato.docato.tasks
print('app.tasks=', app.tasks)
app.conf.update(
#
BROKER_URL='amqp://admin:mypass@rabbit:5672',
#BROKER_URL='amqp://admin:mypass@127.0.0.1:5673',
)
| 29.851852 | 119 | 0.761787 | 116 | 806 | 5.146552 | 0.525862 | 0.050251 | 0.075377 | 0.063652 | 0.139028 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026063 | 0.095534 | 806 | 26 | 120 | 31 | 0.792867 | 0.337469 | 0 | 0 | 0 | 0 | 0.229008 | 0.101145 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.0625 | 0.4375 | 0 | 0.4375 | 0.0625 | 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 |
fcc253a57571caa526603e96fd29f4780bc20add | 2,169 | py | Python | jrl/agents/msg/config.py | pedersor/google-research | 6fa751dd261b3f6d918fd2cd35efef5d8bf3eea6 | [
"Apache-2.0"
] | null | null | null | jrl/agents/msg/config.py | pedersor/google-research | 6fa751dd261b3f6d918fd2cd35efef5d8bf3eea6 | [
"Apache-2.0"
] | null | null | null | jrl/agents/msg/config.py | pedersor/google-research | 6fa751dd261b3f6d918fd2cd35efef5d8bf3eea6 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2022 The Google Research 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.
"""Config object for MSG."""
import gin
import dataclasses
import typing
@gin.configurable
@dataclasses.dataclass
class MSGConfig:
"""Configuration options for MSG."""
policy_lr: float = 3e-5
# policy_lr: float = 1e-4
q_lr: float = 3e-4
ensemble_method: str = 'deep_ensembles'
mimo_using_adamw: bool = False
mimo_using_obs_tile: bool = False
mimo_using_act_tile: bool = False
use_double_q: bool = False
ensemble_size: int = 16
beta: float = -1.0
td_target_method: str = 'independent'
perform_sarsa_q_eval: bool = False
num_q_repr_pretrain_iters: int = 0
pretrain_temp: float = 1.
use_sass: bool = False
num_bc_iters: int = 50_000
use_random_weighting_in_critic_loss: bool = True
use_ema_target_critic_params: bool = True
entropy_coefficient: typing.Optional[float] = None
target_entropy: float = 0.0
use_entropy_regularization: bool = True
num_sgd_steps_per_step: int = 1
actor_network_hidden_sizes: typing.Tuple = (256, 256)
critic_network_hidden_sizes: typing.Tuple = (256, 256)
networks_init_type: str = 'glorot_also_dist'
critic_random_init: bool = False
critic_init_scale: float = 1.0 # I dont think it is used anymore
behavior_regularization_type: str = 'none'
behavior_regularization_alpha: float = 1.0
num_cql_actions: int = 2 # if using cql regularization type
eval_with_q_filter: bool = False
num_eval_samples: int = 10
rem_mode: bool = False
use_img_encoder: bool = False
img_encoder_params_ckpt_path: str = ''
img_encoder_fn: typing.Optional[typing.Callable] = None
| 31.434783 | 74 | 0.753343 | 331 | 2,169 | 4.691843 | 0.522659 | 0.057952 | 0.013522 | 0.020605 | 0.045074 | 0.045074 | 0.045074 | 0 | 0 | 0 | 0 | 0.026622 | 0.168741 | 2,169 | 68 | 75 | 31.897059 | 0.83472 | 0.332872 | 0 | 0 | 0 | 0 | 0.03169 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.073171 | 0 | 0.95122 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
fcd345db2a751223a2e5984f49f5659329e6f948 | 502 | py | Python | terrascript/provider/cyrilgdn/vault.py | mjuenema/python-terrascript | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | [
"BSD-2-Clause"
] | 507 | 2017-07-26T02:58:38.000Z | 2022-01-21T12:35:13.000Z | terrascript/provider/cyrilgdn/vault.py | mjuenema/python-terrascript | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | [
"BSD-2-Clause"
] | 135 | 2017-07-20T12:01:59.000Z | 2021-10-04T22:25:40.000Z | terrascript/provider/cyrilgdn/vault.py | mjuenema/python-terrascript | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | [
"BSD-2-Clause"
] | 81 | 2018-02-20T17:55:28.000Z | 2022-01-31T07:08:40.000Z | # terrascript/provider/cyrilgdn/vault.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:30:00 UTC)
import terrascript
class vault(terrascript.Provider):
"""Terraform Vault provider"""
__description__ = "Terraform Vault provider"
__namespace__ = "cyrilgdn"
__name__ = "vault"
__source__ = "https://github.com/cyrilgdn/terraform-provider-vault"
__version__ = "2.23.1"
__published__ = "2021-09-06T07:03:44Z"
__tier__ = "community"
__all__ = ["vault"]
| 25.1 | 73 | 0.711155 | 57 | 502 | 5.701754 | 0.684211 | 0.116923 | 0.135385 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.071259 | 0.161355 | 502 | 19 | 74 | 26.421053 | 0.700713 | 0.270916 | 0 | 0 | 1 | 0 | 0.359331 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.1 | 0 | 0.9 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
fcd486d7a7f940a53d8f6597c77c19c3503e3712 | 1,265 | py | Python | xwing_data/migrations/0013_auto_20170321_1613.py | sheepeatingtaz/xwingoverlayer | 759007ea7cc8981fcbf87a395f8e9a61e8163f09 | [
"MIT"
] | 7 | 2017-03-28T21:11:16.000Z | 2021-01-26T11:13:37.000Z | xwing_data/migrations/0013_auto_20170321_1613.py | sheepeatingtaz/xwingoverlayer | 759007ea7cc8981fcbf87a395f8e9a61e8163f09 | [
"MIT"
] | 3 | 2017-06-01T23:12:40.000Z | 2018-02-26T19:29:30.000Z | xwing_data/migrations/0013_auto_20170321_1613.py | sheepeatingtaz/xwingoverlayer | 759007ea7cc8981fcbf87a395f8e9a61e8163f09 | [
"MIT"
] | 6 | 2017-06-05T18:26:24.000Z | 2019-06-24T11:08:23.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-21 16:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('xwing_data', '0012_auto_20170313_2203'),
]
operations = [
migrations.AlterField(
model_name='upgrade',
name='faction',
field=models.ManyToManyField(blank=True, to='xwing_data.Faction'),
),
migrations.AlterField(
model_name='upgrade',
name='grants',
field=models.ManyToManyField(blank=True, to='xwing_data.Grant'),
),
migrations.AlterField(
model_name='upgrade',
name='ships',
field=models.ManyToManyField(blank=True, to='xwing_data.Ship'),
),
migrations.AlterField(
model_name='upgrade',
name='size',
field=models.ManyToManyField(blank=True, to='xwing_data.BaseSize'),
),
migrations.AlterField(
model_name='upgrade',
name='slot',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='xwing_data.SlotType'),
),
]
| 30.119048 | 107 | 0.595257 | 128 | 1,265 | 5.726563 | 0.429688 | 0.07367 | 0.170532 | 0.197817 | 0.523874 | 0.523874 | 0.251023 | 0.251023 | 0 | 0 | 0 | 0.036264 | 0.280632 | 1,265 | 41 | 108 | 30.853659 | 0.769231 | 0.053755 | 0 | 0.441176 | 1 | 0 | 0.151591 | 0.019263 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.088235 | 0 | 0.176471 | 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 |
fcdd513c39573963aee674e38295dec750a1cac2 | 362 | py | Python | mercury_engine_data_structures/formats/bmscu.py | randovania/mercury-engine-data-structures | ddd16bcedd188779db75cf3d4dcc1f09053918ab | [
"MIT"
] | null | null | null | mercury_engine_data_structures/formats/bmscu.py | randovania/mercury-engine-data-structures | ddd16bcedd188779db75cf3d4dcc1f09053918ab | [
"MIT"
] | null | null | null | mercury_engine_data_structures/formats/bmscu.py | randovania/mercury-engine-data-structures | ddd16bcedd188779db75cf3d4dcc1f09053918ab | [
"MIT"
] | 2 | 2021-11-07T13:42:13.000Z | 2022-01-08T06:00:40.000Z | from construct import Construct
from mercury_engine_data_structures.formats import BaseResource, standard_format
from mercury_engine_data_structures.game_check import Game
BMSCU = standard_format.create('CCutSceneDef', 0x02030008)
class Bmscu(BaseResource):
@classmethod
def construct_class(cls, target_game: Game) -> Construct:
return BMSCU
| 27.846154 | 80 | 0.809392 | 43 | 362 | 6.55814 | 0.534884 | 0.078014 | 0.120567 | 0.148936 | 0.219858 | 0 | 0 | 0 | 0 | 0 | 0 | 0.028662 | 0.132597 | 362 | 12 | 81 | 30.166667 | 0.869427 | 0 | 0 | 0 | 0 | 0 | 0.033149 | 0 | 0 | 0 | 0.027624 | 0 | 0 | 1 | 0.125 | false | 0 | 0.375 | 0.125 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 2 |
fcf2fa10affd12d75370c21f39a40bf24b5511f7 | 6,494 | py | Python | bundle_cache/app_store/tk-flame-export/v1.9.1/hooks/settings.py | ColinKennedy/tk-config-default2-respawn | 855fb8033daa549b92615792442f19a7f9c4f55c | [
"Linux-OpenIB"
] | 4 | 2019-01-11T03:41:28.000Z | 2019-09-12T06:57:17.000Z | bundle_cache/app_store/tk-flame-export/v1.9.1/hooks/settings.py | ColinKennedy/tk-config-default2-respawn | 855fb8033daa549b92615792442f19a7f9c4f55c | [
"Linux-OpenIB"
] | null | null | null | bundle_cache/app_store/tk-flame-export/v1.9.1/hooks/settings.py | ColinKennedy/tk-config-default2-respawn | 855fb8033daa549b92615792442f19a7f9c4f55c | [
"Linux-OpenIB"
] | 2 | 2019-01-10T05:00:18.000Z | 2020-02-15T16:32:56.000Z | # Copyright (c) 2014 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.
import sgtk
from sgtk import TankError
HookBaseClass = sgtk.get_hook_baseclass()
class ExportSettings(HookBaseClass):
"""
This hook controls the settings that Flame will use when it exports plates and generates
quicktimes prior to uploading them to Shotgun.
"""
def get_video_preset(self, preset_name, name_pattern, publish_linked):
"""
Returns a chunk of video xml export profile given a preset name.
This chunk of XML will be joined into a larger structure which defines
the entire set of export options. The app will then pass this full preset
to Flame for file generation.
The preset name should correspond to one of the presets defined in the app
config - for each of these presets, this hook needs to implement logic to
handle that preset.
Certain fields should be populated with particular data from the system.
These 'dynamic fields' will get values via the input parameters of this method.
:param preset_name: The name of the export preset that the user has selected in the
export UI dialog.
:param name_pattern: Data to inject into the <name_pattern> tag in the xml structure.
:param publish_linked: Data to inject into the <publishLinked> tag in the xml structure.
:returns: the <video> xml section of a Flame export.
"""
if preset_name == "10 bit DPX":
# The codec ids have changed between flame 2016 and 2017
preset_version_str = self.parent.engine.preset_version
preset_version = int(preset_version_str)
codec_id = 923680 if preset_version < 7 else 6176
xml = """
<video>
<fileType>Dpx</fileType>
<codec>%d</codec>
<codecProfile />
<namePattern>{VIDEO_NAME_PATTERN}</namePattern>
<compressionQuality>50</compressionQuality>
<transferCharacteristic>2</transferCharacteristic>
<colorimetricSpecification>4</colorimetricSpecification>
<publishLinked>{PUBLISH_LINKED}</publishLinked>
<foregroundPublish>False</foregroundPublish>
<overwriteWithVersions>False</overwriteWithVersions>
<resize>
<resizeType>fit</resizeType>
<resizeFilter>lanczos</resizeFilter>
<width>0</width>
<height>0</height>
<bitsPerChannel>10</bitsPerChannel>
<numChannels>3</numChannels>
<floatingPoint>False</floatingPoint>
<bigEndian>True</bigEndian>
<pixelRatio>1</pixelRatio>
<scanFormat>P</scanFormat>
</resize>
</video>
""" % codec_id
elif preset_name == "16 bit OpenEXR":
xml = """
<video>
<fileType>OpenEXR</fileType>
<codec>596088</codec>
<codecProfile />
<namePattern>{VIDEO_NAME_PATTERN}</namePattern>
<compressionQuality>50</compressionQuality>
<transferCharacteristic>2</transferCharacteristic>
<colorimetricSpecification>4</colorimetricSpecification>
<publishLinked>{PUBLISH_LINKED}</publishLinked>
<foregroundPublish>False</foregroundPublish>
<overwriteWithVersions>False</overwriteWithVersions>
<resize>
<resizeType>fit</resizeType>
<resizeFilter>lanczos</resizeFilter>
<width>0</width>
<height>0</height>
<bitsPerChannel>16</bitsPerChannel>
<numChannels>3</numChannels>
<floatingPoint>True</floatingPoint>
<bigEndian>False</bigEndian>
<pixelRatio>1</pixelRatio>
<scanFormat>P</scanFormat>
</resize>
</video>
"""
elif preset_name == "16 bit OpenEXR - Multi-Channel":
xml = """
<video>
<fileType>OpenEXR</fileType>
<codec>596088</codec>
<codecProfile></codecProfile>
<namePattern>{VIDEO_NAME_PATTERN}</namePattern>
<compressionQuality>50</compressionQuality>
<transferCharacteristic>2</transferCharacteristic>
<colorimetricSpecification>4</colorimetricSpecification>
<multiTrack>True</multiTrack>
<overwriteWithVersions>False</overwriteWithVersions>
<resize>
<resizeType>fit</resizeType>
<resizeFilter>lanczos</resizeFilter>
<width>0</width>
<height>0</height>
<bitsPerChannel>16</bitsPerChannel>
<numChannels>3</numChannels>
<floatingPoint>True</floatingPoint>
<bigEndian>False</bigEndian>
<pixelRatio>1</pixelRatio>
<scanFormat>P</scanFormat>
</resize>
</video>
"""
else:
raise TankError("Unknown video export preset '%s'!" % preset_name)
xml = xml.replace("{VIDEO_NAME_PATTERN}", name_pattern)
xml = xml.replace("{PUBLISH_LINKED}", str(publish_linked))
return xml
| 46.719424 | 96 | 0.539575 | 544 | 6,494 | 6.373162 | 0.371324 | 0.023075 | 0.01846 | 0.02769 | 0.540525 | 0.503605 | 0.488607 | 0.488607 | 0.463225 | 0.41621 | 0 | 0.017799 | 0.385741 | 6,494 | 138 | 97 | 47.057971 | 0.851341 | 0.237758 | 0 | 0.741935 | 0 | 0 | 0.831373 | 0.384712 | 0 | 0 | 0 | 0 | 0 | 1 | 0.010753 | false | 0 | 0.021505 | 0 | 0.053763 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
fcfe4edc4fdf9f26b3174890d7b99981edbdb516 | 697 | py | Python | forge/blade/entity/entity.py | wwxFromTju/neural-mmo | 30cf1117c84cbe36bc4b378ed509874d307cf2c3 | [
"MIT"
] | 1,450 | 2019-03-04T15:47:38.000Z | 2022-03-30T03:33:35.000Z | forge/blade/entity/entity.py | wwxFromTju/neural-mmo | 30cf1117c84cbe36bc4b378ed509874d307cf2c3 | [
"MIT"
] | 34 | 2019-03-05T09:50:38.000Z | 2021-08-31T15:20:27.000Z | forge/blade/entity/entity.py | LaudateCorpus1/neural-mmo | a9a7c34a1fb24fbf252e2958bdb869c213e580a3 | [
"MIT"
] | 164 | 2019-03-04T16:09:19.000Z | 2022-02-26T15:43:40.000Z | import numpy as np
from forge.blade.action import action
from forge.blade.systems import skill, droptable
class Entity():
def __init__(self, pos):
self.pos = pos
self.alive = True
self.skills = skill.Skills()
self.entityIndex=0
self.health = -1
self.lastAttacker = None
def act(self, world):
pass
def decide(self, stimuli):
pass
def death(self):
pass
def registerHit(self, attacker, dmg):
self.lastAttacker = attacker
self.health -= dmg
def remove(self, ent):
r, c = self.pos
ent[r, c] = 0
def isAlive(self):
return self.health > 0
@property
def isPC(self):
return False
| 18.342105 | 48 | 0.609756 | 92 | 697 | 4.576087 | 0.478261 | 0.049881 | 0.066508 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008097 | 0.291248 | 697 | 37 | 49 | 18.837838 | 0.84413 | 0 | 0 | 0.107143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.107143 | 0.107143 | 0.071429 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
1e05686fcd9aabc80ad594afe26215f2519d925c | 1,121 | py | Python | maintenance/tests_old/test_mjcpy.py | sfpd/rlreloaded | 650c64ec22ad45996c8c577d85b1a4f20aa1c692 | [
"MIT"
] | null | null | null | maintenance/tests_old/test_mjcpy.py | sfpd/rlreloaded | 650c64ec22ad45996c8c577d85b1a4f20aa1c692 | [
"MIT"
] | null | null | null | maintenance/tests_old/test_mjcpy.py | sfpd/rlreloaded | 650c64ec22ad45996c8c577d85b1a4f20aa1c692 | [
"MIT"
] | null | null | null | import mjcpy
import numpy as np
from control3 import CTRL_ROOT
import os.path as osp
from control3.common_util import colorize
world = mjcpy.MJCWorld(osp.join(CTRL_ROOT,"cpp/3rdparty/mjc/mjcdata/3swimmer.bin"))
X,U = np.random.rand(9,10), np.random.rand(9,2)
x,u = np.random.rand(10), np.random.rand(2)
world.SetActuatedDims([3,4])
for i in xrange(10): assert np.allclose(world.Step(x,u),world.Step(x,u))
for i in xrange(10): assert np.allclose(world.StepMulti(X,U),world.StepMulti(X,U))
assert np.allclose(world.StepMulti(X,U), np.array([world.Step(x1,u1) for (x1,u1) in zip(X,U)]))
try:
import numdifftools as ndt
_, anjacx, anjacu = world.StepJacobian(x,u)
numjacx = ndt.Jacobian(lambda x1:world.Step(x1,u))(x)
numjacu = ndt.Jacobian(lambda u1:world.Step(x,u1))(u)
assert np.allclose(anjacx,numjacx)
assert np.allclose(anjacu,numjacu)
except ImportError:
print colorize("don't have numdifftools. skipping test","yellow")
# result = world.Step(x,u)
# world.Plot(x,u)
# from time import sleep
# for i in xrange(10):
# x = np.random.randn(10)
# world.Plot(x,u)
# sleep(.2)
| 30.297297 | 95 | 0.70562 | 194 | 1,121 | 4.056701 | 0.360825 | 0.030496 | 0.101652 | 0.045743 | 0.231258 | 0.143583 | 0.143583 | 0.088945 | 0.088945 | 0 | 0 | 0.031959 | 0.134701 | 1,121 | 36 | 96 | 31.138889 | 0.779381 | 0.130241 | 0 | 0 | 0 | 0 | 0.083938 | 0.038342 | 0 | 0 | 0 | 0 | 0.238095 | 0 | null | null | 0 | 0.333333 | null | null | 0.047619 | 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 |
1e0673e3da52dd4537aa21139b023aa2f66c6cb0 | 260 | py | Python | app.py | davido15/samplepythonazure | 7445c970f80d1cc8cba544486ba4da990159c839 | [
"MIT"
] | null | null | null | app.py | davido15/samplepythonazure | 7445c970f80d1cc8cba544486ba4da990159c839 | [
"MIT"
] | null | null | null | app.py | davido15/samplepythonazure | 7445c970f80d1cc8cba544486ba4da990159c839 | [
"MIT"
] | null | null | null | from flask import Flask,request
from predict import predict_on_text
import json
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, World!"
@app.route("/predict/<msg>")
def predict_toxicity(msg):
return str(predict_on_text(msg))
| 17.333333 | 35 | 0.707692 | 37 | 260 | 4.72973 | 0.486486 | 0.102857 | 0.148571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.157692 | 260 | 14 | 36 | 18.571429 | 0.799087 | 0 | 0 | 0 | 0 | 0 | 0.107692 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.3 | 0.2 | 0.7 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
1e26bfbf3e922c06d699612f2e4146aec83ed41a | 471 | py | Python | threephase/migrations/0002_auto_20211202_0756.py | KrisHugo/twophase-threephase-commit | f529e05d5180b329318521a918fe106960dae9ab | [
"MIT"
] | 2 | 2021-12-05T06:58:23.000Z | 2021-12-09T10:28:33.000Z | threephase/migrations/0002_auto_20211202_0756.py | comeonsunny/twophase-threephase-commit | 9c9d3bf708f13e6d0459d17a9d1793344ae81718 | [
"MIT"
] | 1 | 2021-12-05T01:13:27.000Z | 2021-12-05T01:13:27.000Z | threephase/migrations/0002_auto_20211202_0756.py | comeonsunny/twophase-threephase-commit | 9c9d3bf708f13e6d0459d17a9d1793344ae81718 | [
"MIT"
] | 2 | 2021-12-05T01:04:07.000Z | 2021-12-13T02:24:45.000Z | # Generated by Django 3.2.5 on 2021-12-02 07:56
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('threephase', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='TwoPhaseParticipant',
new_name='ThreePhaseParticipant',
),
migrations.RenameModel(
old_name='TwoPhaseValue',
new_name='ThreePhaseValue',
),
]
| 21.409091 | 47 | 0.596603 | 42 | 471 | 6.571429 | 0.738095 | 0.152174 | 0.173913 | 0.202899 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.057576 | 0.299363 | 471 | 21 | 48 | 22.428571 | 0.778788 | 0.095541 | 0 | 0.266667 | 1 | 0 | 0.212264 | 0.049528 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 0 | 0.266667 | 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 |
1e2ce9af1c0e2d535a917550a227bb8536ea14aa | 142 | py | Python | python/elapTime.py | Ayushd70/RetartedCodes | 301ced178a0ec352b2d127e19028845de950551d | [
"MIT"
] | null | null | null | python/elapTime.py | Ayushd70/RetartedCodes | 301ced178a0ec352b2d127e19028845de950551d | [
"MIT"
] | null | null | null | python/elapTime.py | Ayushd70/RetartedCodes | 301ced178a0ec352b2d127e19028845de950551d | [
"MIT"
] | null | null | null | # Python Program to Measure the Elapsed Time in Python
import time
start = time.time()
print(23*2.3)
end = time.time()
print(end - start)
| 12.909091 | 54 | 0.704225 | 24 | 142 | 4.166667 | 0.625 | 0.16 | 0.26 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034483 | 0.183099 | 142 | 10 | 55 | 14.2 | 0.827586 | 0.366197 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.4 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1e3630b63f43b543bb72e8a405e3c8bb5a8b198f | 12,247 | py | Python | sdk/python/pulumi_azure_nextgen/hanaonazure/v20171103preview/sap_monitor.py | test-wiz-sec/pulumi-azure-nextgen | 20a695af0d020b34b0f1c336e1b69702755174cc | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_nextgen/hanaonazure/v20171103preview/sap_monitor.py | test-wiz-sec/pulumi-azure-nextgen | 20a695af0d020b34b0f1c336e1b69702755174cc | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_nextgen/hanaonazure/v20171103preview/sap_monitor.py | test-wiz-sec/pulumi-azure-nextgen | 20a695af0d020b34b0f1c336e1b69702755174cc | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__all__ = ['SapMonitor']
class SapMonitor(pulumi.CustomResource):
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
enable_customer_analytics: Optional[pulumi.Input[bool]] = None,
hana_db_credentials_msi_id: Optional[pulumi.Input[str]] = None,
hana_db_name: Optional[pulumi.Input[str]] = None,
hana_db_password: Optional[pulumi.Input[str]] = None,
hana_db_password_key_vault_url: Optional[pulumi.Input[str]] = None,
hana_db_sql_port: Optional[pulumi.Input[int]] = None,
hana_db_username: Optional[pulumi.Input[str]] = None,
hana_hostname: Optional[pulumi.Input[str]] = None,
hana_subnet: Optional[pulumi.Input[str]] = None,
key_vault_id: Optional[pulumi.Input[str]] = None,
location: Optional[pulumi.Input[str]] = None,
log_analytics_workspace_arm_id: Optional[pulumi.Input[str]] = None,
log_analytics_workspace_id: Optional[pulumi.Input[str]] = None,
log_analytics_workspace_shared_key: Optional[pulumi.Input[str]] = None,
resource_group_name: Optional[pulumi.Input[str]] = None,
sap_monitor_name: Optional[pulumi.Input[str]] = None,
__props__=None,
__name__=None,
__opts__=None):
"""
SAP monitor info on Azure (ARM properties and SAP monitor properties)
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[bool] enable_customer_analytics: The value indicating whether to send analytics to Microsoft
:param pulumi.Input[str] hana_db_credentials_msi_id: MSI ID passed by customer which has access to customer's KeyVault and to be assigned to the Collector VM.
:param pulumi.Input[str] hana_db_name: Database name of the HANA instance.
:param pulumi.Input[str] hana_db_password: Database password of the HANA instance.
:param pulumi.Input[str] hana_db_password_key_vault_url: KeyVault URL link to the password for the HANA database.
:param pulumi.Input[int] hana_db_sql_port: Database port of the HANA instance.
:param pulumi.Input[str] hana_db_username: Database username of the HANA instance.
:param pulumi.Input[str] hana_hostname: Hostname of the HANA instance.
:param pulumi.Input[str] hana_subnet: Specifies the SAP monitor unique ID.
:param pulumi.Input[str] key_vault_id: Key Vault ID containing customer's HANA credentials.
:param pulumi.Input[str] location: Resource location
:param pulumi.Input[str] log_analytics_workspace_arm_id: The ARM ID of the Log Analytics Workspace that is used for monitoring
:param pulumi.Input[str] log_analytics_workspace_id: The workspace ID of the log analytics workspace to be used for monitoring
:param pulumi.Input[str] log_analytics_workspace_shared_key: The shared key of the log analytics workspace that is used for monitoring
:param pulumi.Input[str] resource_group_name: Name of the resource group.
:param pulumi.Input[str] sap_monitor_name: Name of the SAP monitor resource.
"""
if __name__ is not None:
warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
resource_name = __name__
if __opts__ is not None:
warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
opts = __opts__
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__ = dict()
__props__['enable_customer_analytics'] = enable_customer_analytics
__props__['hana_db_credentials_msi_id'] = hana_db_credentials_msi_id
__props__['hana_db_name'] = hana_db_name
__props__['hana_db_password'] = hana_db_password
__props__['hana_db_password_key_vault_url'] = hana_db_password_key_vault_url
__props__['hana_db_sql_port'] = hana_db_sql_port
__props__['hana_db_username'] = hana_db_username
__props__['hana_hostname'] = hana_hostname
__props__['hana_subnet'] = hana_subnet
__props__['key_vault_id'] = key_vault_id
__props__['location'] = location
__props__['log_analytics_workspace_arm_id'] = log_analytics_workspace_arm_id
__props__['log_analytics_workspace_id'] = log_analytics_workspace_id
__props__['log_analytics_workspace_shared_key'] = log_analytics_workspace_shared_key
if resource_group_name is None:
raise TypeError("Missing required property 'resource_group_name'")
__props__['resource_group_name'] = resource_group_name
if sap_monitor_name is None:
raise TypeError("Missing required property 'sap_monitor_name'")
__props__['sap_monitor_name'] = sap_monitor_name
__props__['managed_resource_group_name'] = None
__props__['name'] = None
__props__['provisioning_state'] = None
__props__['tags'] = None
__props__['type'] = None
alias_opts = pulumi.ResourceOptions(aliases=[pulumi.Alias(type_="azure-nextgen:hanaonazure/v20200207preview:SapMonitor")])
opts = pulumi.ResourceOptions.merge(opts, alias_opts)
super(SapMonitor, __self__).__init__(
'azure-nextgen:hanaonazure/v20171103preview:SapMonitor',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None) -> 'SapMonitor':
"""
Get an existing SapMonitor 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__ = dict()
return SapMonitor(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter(name="enableCustomerAnalytics")
def enable_customer_analytics(self) -> pulumi.Output[Optional[bool]]:
"""
The value indicating whether to send analytics to Microsoft
"""
return pulumi.get(self, "enable_customer_analytics")
@property
@pulumi.getter(name="hanaDbCredentialsMsiId")
def hana_db_credentials_msi_id(self) -> pulumi.Output[Optional[str]]:
"""
MSI ID passed by customer which has access to customer's KeyVault and to be assigned to the Collector VM.
"""
return pulumi.get(self, "hana_db_credentials_msi_id")
@property
@pulumi.getter(name="hanaDbName")
def hana_db_name(self) -> pulumi.Output[Optional[str]]:
"""
Database name of the HANA instance.
"""
return pulumi.get(self, "hana_db_name")
@property
@pulumi.getter(name="hanaDbPassword")
def hana_db_password(self) -> pulumi.Output[Optional[str]]:
"""
Database password of the HANA instance.
"""
return pulumi.get(self, "hana_db_password")
@property
@pulumi.getter(name="hanaDbPasswordKeyVaultUrl")
def hana_db_password_key_vault_url(self) -> pulumi.Output[Optional[str]]:
"""
KeyVault URL link to the password for the HANA database.
"""
return pulumi.get(self, "hana_db_password_key_vault_url")
@property
@pulumi.getter(name="hanaDbSqlPort")
def hana_db_sql_port(self) -> pulumi.Output[Optional[int]]:
"""
Database port of the HANA instance.
"""
return pulumi.get(self, "hana_db_sql_port")
@property
@pulumi.getter(name="hanaDbUsername")
def hana_db_username(self) -> pulumi.Output[Optional[str]]:
"""
Database username of the HANA instance.
"""
return pulumi.get(self, "hana_db_username")
@property
@pulumi.getter(name="hanaHostname")
def hana_hostname(self) -> pulumi.Output[Optional[str]]:
"""
Hostname of the HANA instance.
"""
return pulumi.get(self, "hana_hostname")
@property
@pulumi.getter(name="hanaSubnet")
def hana_subnet(self) -> pulumi.Output[Optional[str]]:
"""
Specifies the SAP monitor unique ID.
"""
return pulumi.get(self, "hana_subnet")
@property
@pulumi.getter(name="keyVaultId")
def key_vault_id(self) -> pulumi.Output[Optional[str]]:
"""
Key Vault ID containing customer's HANA credentials.
"""
return pulumi.get(self, "key_vault_id")
@property
@pulumi.getter
def location(self) -> pulumi.Output[Optional[str]]:
"""
Resource location
"""
return pulumi.get(self, "location")
@property
@pulumi.getter(name="logAnalyticsWorkspaceArmId")
def log_analytics_workspace_arm_id(self) -> pulumi.Output[Optional[str]]:
"""
The ARM ID of the Log Analytics Workspace that is used for monitoring
"""
return pulumi.get(self, "log_analytics_workspace_arm_id")
@property
@pulumi.getter(name="logAnalyticsWorkspaceId")
def log_analytics_workspace_id(self) -> pulumi.Output[Optional[str]]:
"""
The workspace ID of the log analytics workspace to be used for monitoring
"""
return pulumi.get(self, "log_analytics_workspace_id")
@property
@pulumi.getter(name="logAnalyticsWorkspaceSharedKey")
def log_analytics_workspace_shared_key(self) -> pulumi.Output[Optional[str]]:
"""
The shared key of the log analytics workspace that is used for monitoring
"""
return pulumi.get(self, "log_analytics_workspace_shared_key")
@property
@pulumi.getter(name="managedResourceGroupName")
def managed_resource_group_name(self) -> pulumi.Output[str]:
"""
The name of the resource group the SAP Monitor resources get deployed into.
"""
return pulumi.get(self, "managed_resource_group_name")
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
"""
Resource name
"""
return pulumi.get(self, "name")
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> pulumi.Output[str]:
"""
State of provisioning of the HanaInstance
"""
return pulumi.get(self, "provisioning_state")
@property
@pulumi.getter
def tags(self) -> pulumi.Output[Mapping[str, str]]:
"""
Resource tags
"""
return pulumi.get(self, "tags")
@property
@pulumi.getter
def type(self) -> pulumi.Output[str]:
"""
Resource type
"""
return pulumi.get(self, "type")
def translate_output_property(self, prop):
return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop
def translate_input_property(self, prop):
return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop
| 42.97193 | 166 | 0.658284 | 1,454 | 12,247 | 5.240715 | 0.129986 | 0.028346 | 0.055118 | 0.047375 | 0.522178 | 0.391076 | 0.282283 | 0.255643 | 0.192782 | 0.150787 | 0 | 0.001849 | 0.249204 | 12,247 | 284 | 167 | 43.123239 | 0.826862 | 0.254266 | 0 | 0.152439 | 1 | 0 | 0.170248 | 0.082172 | 0 | 0 | 0 | 0 | 0 | 1 | 0.140244 | false | 0.067073 | 0.030488 | 0.012195 | 0.310976 | 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 |
1e37843119223bd4dc33434f17e34c874d262faf | 461 | py | Python | view/view_model.py | MichSchli/Minnotate | 5978dc54c8b949c31cb627e0ca89f88263308176 | [
"MIT"
] | null | null | null | view/view_model.py | MichSchli/Minnotate | 5978dc54c8b949c31cb627e0ca89f88263308176 | [
"MIT"
] | null | null | null | view/view_model.py | MichSchli/Minnotate | 5978dc54c8b949c31cb627e0ca89f88263308176 | [
"MIT"
] | null | null | null | class ViewModel:
current_model = None
def __init__(self, view):
self.view = view
def switch(self, model):
self.clear_annotation()
self.current_model = model
self.view.show(model)
def get_current_id(self):
return self.current_model.identifier
def clear_annotation(self):
self.view.clear_annotation()
def show_annotation(self, annotation):
self.view.show_annotation(annotation) | 23.05 | 45 | 0.661605 | 55 | 461 | 5.290909 | 0.309091 | 0.137457 | 0.130584 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.249458 | 461 | 20 | 45 | 23.05 | 0.84104 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.357143 | false | 0 | 0 | 0.071429 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
1e40dbf8b17ec5cfb179ae94f978addbeb8a5d0b | 382 | py | Python | tests/unit/token/rules/test_has_scopes.py | manoadamro/jason | e6a152797cc47fc158b41f1f4b4d55f79d0494f7 | [
"MIT"
] | null | null | null | tests/unit/token/rules/test_has_scopes.py | manoadamro/jason | e6a152797cc47fc158b41f1f4b4d55f79d0494f7 | [
"MIT"
] | 136 | 2019-05-15T07:30:47.000Z | 2021-07-19T05:21:39.000Z | tests/unit/token/rules/test_has_scopes.py | manoadamro/jason | e6a152797cc47fc158b41f1f4b4d55f79d0494f7 | [
"MIT"
] | 1 | 2019-05-15T10:00:34.000Z | 2019-05-15T10:00:34.000Z | import pytest
from jason import token
def test_validate():
check = token.HasScopes("read:thing", "write:thing")
check.validate({"scp": ["read:thing", "write:thing"]})
def test_fails_to_validate():
check = token.HasScopes("read:thing", "write:thing")
with pytest.raises(token.BatchValidationError):
check.validate({"scp": ["read:other", "write:other"]})
| 25.466667 | 62 | 0.680628 | 47 | 382 | 5.446809 | 0.425532 | 0.105469 | 0.164063 | 0.222656 | 0.359375 | 0.359375 | 0.359375 | 0.359375 | 0 | 0 | 0 | 0 | 0.143979 | 382 | 14 | 63 | 27.285714 | 0.782875 | 0 | 0 | 0.222222 | 0 | 0 | 0.235602 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.222222 | 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 |
1e4ffac6bc40ec660a65464b1cd3d0fc1c4df851 | 2,423 | py | Python | commands/entertainment/ketchup.py | ii-Python/Prism | a404a61ddb16d045aa29d81908ce4ad80b24e24d | [
"MIT"
] | 6 | 2020-09-28T13:19:37.000Z | 2021-07-13T10:37:22.000Z | commands/entertainment/ketchup.py | BenjaminGotBanned/Prism | a404a61ddb16d045aa29d81908ce4ad80b24e24d | [
"MIT"
] | 2 | 2020-10-06T17:59:40.000Z | 2020-10-06T20:12:39.000Z | commands/entertainment/ketchup.py | BenjaminGotBanned/Prism | a404a61ddb16d045aa29d81908ce4ad80b24e24d | [
"MIT"
] | 3 | 2021-01-05T13:33:58.000Z | 2021-07-13T10:37:37.000Z | # Modules
import discord
from random import choice
from discord.ext import commands
# Main Command Class
class Ketchup(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.desc = "Some nice, slurpy, tasty ketchup"
self.usage = "ketchup"
self.images = [
"https://images-na.ssl-images-amazon.com/images/I/71i0PnRw6EL._SL1500_.jpg",
"https://cdn.shopify.com/s/files/1/2364/6329/products/2019_PK_Ketchup_Shopify_600x.jpg?v=1571608882",
"https://images-na.ssl-images-amazon.com/images/I/8199Xb1cVdL._SL1500_.jpg",
"https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcR3Tg_70GvbraVTinYoWxYACbvlA5ULiK5D7urt6hSNVlwo-plA",
"https://cdnimg.webstaurantstore.com/images/products/large/166705/271501.jpg",
"https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSb4nPCyZoz6qIIju4Mjh4R__hs9RCLuf2ztdpahgfpf2WFRgO-",
"https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRjyJ3-s_hkx1ddeMcH-G8nqe5b02a979VyFEXfNo7VkQwBTQ7B",
"https://cdn.shopify.com/s/files/1/1376/4649/products/no-added-sugar-organic-ketchup_1024x1024.jpg?v=1525969786",
"https://i2.wp.com/www.thepetitecook.com/wp-content/uploads/2015/08/ketchup-the-petite-cook.jpg?fit=700%2C467&ssl=1",
"https://images.freshop.com/00013000001243/e86a3a30c651ad96390af06a26cfd6d8_large.png",
"https://hips.hearstapps.com/ghk.h-cdn.co/assets/17/06/768x384/landscape-1486400207-index-ketchup.jpg?resize=480:*",
"https://thumbs-prod.si-cdn.com/utxQux55RAFtzULHh44boHRZY2g=/fit-in/1600x0/https://public-media.si-cdn.com/filer/3e/36/3e365ebe-49a1-48d6-a32a-09822b5da2b1/file-20180722-142438-k7576v.jpg",
"https://www.rd.com/wp-content/uploads/2017/08/01-Heres-The-Difference-Between-Fancy-Ketchup-and-Regular-Ketchup_643992628-Africa-Studio-1024x683.jpg"
]
@commands.command(aliases = ["katsup", "catsup"])
async def ketchup(self, ctx):
embed = discord.Embed(color = 0x126bf1)
embed.set_image(url = choice(self.images))
embed.set_author(name = " | Ketchup", icon_url = self.bot.user.avatar_url)
embed.set_footer(text = f" | Requested by {ctx.author}.", icon_url = ctx.author.avatar_url)
return await ctx.send(embed = embed)
# Link to bot
def setup(bot):
bot.add_cog(Ketchup(bot))
| 51.553191 | 201 | 0.694593 | 310 | 2,423 | 5.341935 | 0.535484 | 0.032609 | 0.032609 | 0.04529 | 0.148551 | 0.148551 | 0.148551 | 0.118357 | 0.095411 | 0 | 0 | 0.131462 | 0.161783 | 2,423 | 46 | 202 | 52.673913 | 0.6839 | 0.015683 | 0 | 0 | 0 | 0.28125 | 0.622428 | 0 | 0 | 0 | 0.00336 | 0 | 0 | 1 | 0.0625 | false | 0 | 0.09375 | 0 | 0.21875 | 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 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1e553a417682710d81a454e257fb9f809a302bed | 249 | py | Python | HLTrigger/Configuration/python/HLT_75e33/psets/hltPhase2L3MuonPSetPvClusterComparerForIT_cfi.py | PKUfudawei/cmssw | 8fbb5ce74398269c8a32956d7c7943766770c093 | [
"Apache-2.0"
] | 1 | 2021-11-30T16:24:46.000Z | 2021-11-30T16:24:46.000Z | HLTrigger/Configuration/python/HLT_75e33/psets/hltPhase2L3MuonPSetPvClusterComparerForIT_cfi.py | PKUfudawei/cmssw | 8fbb5ce74398269c8a32956d7c7943766770c093 | [
"Apache-2.0"
] | 4 | 2021-11-29T13:57:56.000Z | 2022-03-29T06:28:36.000Z | HLTrigger/Configuration/python/HLT_75e33/psets/hltPhase2L3MuonPSetPvClusterComparerForIT_cfi.py | PKUfudawei/cmssw | 8fbb5ce74398269c8a32956d7c7943766770c093 | [
"Apache-2.0"
] | 1 | 2021-11-30T16:16:05.000Z | 2021-11-30T16:16:05.000Z | import FWCore.ParameterSet.Config as cms
hltPhase2L3MuonPSetPvClusterComparerForIT = cms.PSet(
track_chi2_max = cms.double(20.0),
track_prob_min = cms.double(-1.0),
track_pt_max = cms.double(100.0),
track_pt_min = cms.double(1.0)
)
| 27.666667 | 53 | 0.730924 | 37 | 249 | 4.702703 | 0.513514 | 0.206897 | 0.137931 | 0.149425 | 0.16092 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066038 | 0.148594 | 249 | 8 | 54 | 31.125 | 0.754717 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0 | 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 |
1e705848e2db726200612aa93a7789b657fe3d42 | 1,319 | py | Python | tests/path_manager/test_cache_path_manager.py | sweetcolor/internet_market_scraper | f7eb8c9ade2c0a956ba5d5b7e6173010c85afed6 | [
"MIT"
] | null | null | null | tests/path_manager/test_cache_path_manager.py | sweetcolor/internet_market_scraper | f7eb8c9ade2c0a956ba5d5b7e6173010c85afed6 | [
"MIT"
] | null | null | null | tests/path_manager/test_cache_path_manager.py | sweetcolor/internet_market_scraper | f7eb8c9ade2c0a956ba5d5b7e6173010c85afed6 | [
"MIT"
] | null | null | null | import unittest
import os
from path_manager.cache_path_manager import CachePathManager
from path_manager.files.html_file import HtmlFile
from path_manager.page.product_page import ProductPage
from path_manager.page.root_page import RootPage
from path_manager.product_tab.tab_with_single_result import TabWithSingleResult
from config import CACHE_DIRECTORY
class CachePathManagerTestCase(unittest.TestCase):
def setUp(self):
root_page = RootPage('https://hard.rozetka.com.ua/processors/c80083/')
product_tab1 = TabWithSingleResult('characteristics')
html_file = HtmlFile()
page = ProductPage('https://hard.rozetka.com.ua/intel_core_i3_7100/p13244917',
root_page, product_tab1)
self.cache_path_manager = CachePathManager(page, html_file)
def test_get_dir_path(self):
self.assertEqual(self.cache_path_manager.get_dir_path(),
os.path.join(CACHE_DIRECTORY, 'processors-c80083', 'intel_core_i3_7100-p13244917'))
def test_get_file_path(self):
self.assertEqual(self.cache_path_manager.get_file_path(),
os.path.join(CACHE_DIRECTORY, 'processors-c80083', 'intel_core_i3_7100-p13244917',
'intel_core_i3_7100-p13244917-characteristics.html'))
| 45.482759 | 108 | 0.726308 | 161 | 1,319 | 5.63354 | 0.304348 | 0.109151 | 0.08269 | 0.066152 | 0.350606 | 0.251378 | 0.251378 | 0.251378 | 0.251378 | 0.149945 | 0 | 0.064607 | 0.190296 | 1,319 | 28 | 109 | 47.107143 | 0.784644 | 0 | 0 | 0 | 0 | 0 | 0.194086 | 0.079606 | 0 | 0 | 0 | 0 | 0.086957 | 1 | 0.130435 | 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 |
1e71a939cc47086f185ef697d65b51f4d07f33ff | 3,081 | py | Python | pysnmp/CXPhysicalInterfaceManager-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/CXPhysicalInterfaceManager-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/CXPhysicalInterfaceManager-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 CXPhysicalInterfaceManager-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXPhysicalInterfaceManager-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:17:44 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, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsIntersection")
cxPortManager, = mibBuilder.importSymbols("CXProduct-SMI", "cxPortManager")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
ObjectIdentity, IpAddress, MibIdentifier, Gauge32, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, Unsigned32, Counter64, Counter32, iso, TimeTicks, Bits, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "IpAddress", "MibIdentifier", "Gauge32", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "Unsigned32", "Counter64", "Counter32", "iso", "TimeTicks", "Bits", "NotificationType")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
cxPhyIfTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 16, 3), )
if mibBuilder.loadTexts: cxPhyIfTable.setStatus('mandatory')
cxPhyIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 16, 3, 1), ).setIndexNames((0, "CXPhysicalInterfaceManager-MIB", "cxPhyIfIndex"))
if mibBuilder.loadTexts: cxPhyIfEntry.setStatus('mandatory')
cxPhyIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 16, 3, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxPhyIfIndex.setStatus('mandatory')
cxPhyIfType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 16, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28))).clone(namedValues=NamedValues(("others", 1), ("v24", 2), ("v35", 3), ("x21", 4), ("v34", 5), ("u-isdn-bri", 6), ("st-isdn-bri", 8), ("dds-56k", 10), ("dds-t1e1", 11), ("fxs-voice", 12), ("fxo-voice", 13), ("em-voice", 14), ("ethernet", 15), ("token-ring", 16), ("v35-eu", 17), ("hsIO", 18), ("usIO", 19), ("lanIO", 20), ("elIO", 21), ("voxIO", 22), ("tlIO", 23), ("t1e1IO", 24), ("dvc", 25), ("multi-io", 26), ("fast-ethernet", 27), ("atm-cell-io", 28)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxPhyIfType.setStatus('mandatory')
mibBuilder.exportSymbols("CXPhysicalInterfaceManager-MIB", cxPhyIfIndex=cxPhyIfIndex, cxPhyIfTable=cxPhyIfTable, cxPhyIfEntry=cxPhyIfEntry, cxPhyIfType=cxPhyIfType)
| 128.375 | 726 | 0.726712 | 360 | 3,081 | 6.219444 | 0.427778 | 0.071907 | 0.00536 | 0.007146 | 0.315766 | 0.19071 | 0.19071 | 0.19071 | 0.19071 | 0.19071 | 0 | 0.087469 | 0.09088 | 3,081 | 23 | 727 | 133.956522 | 0.711889 | 0.114898 | 0 | 0 | 0 | 0 | 0.279985 | 0.038263 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4375 | 0 | 0.4375 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
1e7d05b0c91045724a73b4529521253d8c451822 | 56 | py | Python | he/config.py | JunguangJiang/Happy-Experiments | 0db03b25fca3876ba2ce5bb6b9a43c5ef6bed9f0 | [
"MIT"
] | 3 | 2020-05-02T14:27:23.000Z | 2020-05-03T13:13:04.000Z | he/config.py | JunguangJiang/Happy-Experiments | 0db03b25fca3876ba2ce5bb6b9a43c5ef6bed9f0 | [
"MIT"
] | null | null | null | he/config.py | JunguangJiang/Happy-Experiments | 0db03b25fca3876ba2ce5bb6b9a43c5ef6bed9f0 | [
"MIT"
] | null | null | null | WORKSPACE_DIR = 'he_workspace'
IGNORE_FILE = '.heignore' | 28 | 30 | 0.785714 | 7 | 56 | 5.857143 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.089286 | 56 | 2 | 31 | 28 | 0.803922 | 0 | 0 | 0 | 0 | 0 | 0.368421 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1e821bf55153f500c2f39f885b2b7e760a1ad70c | 550 | py | Python | instapp/migrations/0006_auto_20201122_1355.py | Jeff-Mwai/instagram-lite | 4fbe9ab70fd8262df8c906ec77f327f02064d95f | [
"MIT"
] | null | null | null | instapp/migrations/0006_auto_20201122_1355.py | Jeff-Mwai/instagram-lite | 4fbe9ab70fd8262df8c906ec77f327f02064d95f | [
"MIT"
] | null | null | null | instapp/migrations/0006_auto_20201122_1355.py | Jeff-Mwai/instagram-lite | 4fbe9ab70fd8262df8c906ec77f327f02064d95f | [
"MIT"
] | null | null | null | # Generated by Django 3.1.3 on 2020-11-22 13:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('instapp', '0005_auto_20201122_1350'),
]
operations = [
migrations.AlterField(
model_name='image',
name='image_caption',
field=models.CharField(max_length=250),
),
migrations.AlterField(
model_name='image',
name='image_name',
field=models.CharField(max_length=250),
),
]
| 22.916667 | 51 | 0.581818 | 57 | 550 | 5.45614 | 0.614035 | 0.115756 | 0.125402 | 0.186495 | 0.482315 | 0.482315 | 0.276527 | 0 | 0 | 0 | 0 | 0.096859 | 0.305455 | 550 | 23 | 52 | 23.913043 | 0.717277 | 0.081818 | 0 | 0.470588 | 1 | 0 | 0.125249 | 0.045726 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.235294 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1e8a0f9341f721564bf17e0a919201a5b07a4af3 | 4,574 | py | Python | autokeras/predefined_model.py | adamjm/autokeras | 124c05c595fedc4c45351ba9e91a14b13abf887e | [
"MIT"
] | 1 | 2019-01-29T21:38:49.000Z | 2019-01-29T21:38:49.000Z | autokeras/predefined_model.py | PaulGureghian1/AutoKeras | 60684cf9a2ff4fa92cf0424a13790896ce0a29fe | [
"MIT"
] | null | null | null | autokeras/predefined_model.py | PaulGureghian1/AutoKeras | 60684cf9a2ff4fa92cf0424a13790896ce0a29fe | [
"MIT"
] | null | null | null | import numpy as np
import torch
from abc import ABC, abstractmethod
from sklearn.model_selection import train_test_split
from autokeras.utils import rand_temp_folder_generator, validate_xy, resize_image_data, compute_image_resize_params
from autokeras.nn.metric import Accuracy
from autokeras.nn.loss_function import classification_loss
from autokeras.nn.generator import ResNetGenerator, DenseNetGenerator
from autokeras.search import train
from autokeras.constant import Constant
from autokeras.preprocessor import ImageDataTransformer, OneHotEncoder
from autokeras.supervised import SingleModelSupervised
class PredefinedModel(SingleModelSupervised):
"""The base class for the predefined model without architecture search
Attributes:
graph: The graph form of the model.
y_encoder: Label encoder, used in transform_y or inverse_transform_y for encode the label. For example,
if one hot encoder needed, y_encoder can be OneHotEncoder.
data_transformer: A instance of transformer to process the data, See example as ImageDataTransformer.
verbose: A boolean of whether the search process will be printed to stdout.
path: A string. The path to a directory, where the intermediate results are saved.
"""
def __init__(self, y_encoder=OneHotEncoder(), data_transformer=None, verbose=False, path=None):
super().__init__(verbose, path)
self.graph = None
self.generator = None
self.y_encoder = y_encoder
self.data_transformer = data_transformer
@abstractmethod
def _init_generator(self, n_output_node, input_shape):
"""Initialize the generator to generate the model architecture.
Args:
n_output_node: A integer value represent the number of output node in the final layer.
input_shape: A tuple to express the shape of every train entry.
"""
pass
@property
def loss(self):
return classification_loss
@property
def metric(self):
return Accuracy
def preprocess(self, x):
return resize_image_data(x, self.resize_shape)
def transform_y(self, y_train):
return self.y_encoder.transform(y_train)
def inverse_transform_y(self, output):
return self.y_encoder.inverse_transform(output)
def fit(self, x, y, trainer_args=None):
"""Trains the model on the dataset given.
Args:
x: A numpy.ndarray instance containing the training data or the training data combined with the
validation data.
y: A numpy.ndarray instance containing the label of the training data. or the label of the training data
combined with the validation label.
trainer_args: A dictionary containing the parameters of the ModelTrainer constructor.
"""
validate_xy(x, y)
self.resize_shape = compute_image_resize_params(x)
x = self.preprocess(x)
self.y_encoder.fit(y)
y = self.transform_y(y)
# Divide training data into training and testing data.
validation_set_size = int(len(y) * Constant.VALIDATION_SET_SIZE)
validation_set_size = min(validation_set_size, 500)
validation_set_size = max(validation_set_size, 1)
x_train, x_test, y_train, y_test = train_test_split(x, y,
test_size=validation_set_size,
random_state=42)
# initialize data_transformer
self.data_transformer = ImageDataTransformer(x_train)
# Wrap the data into DataLoaders
train_loader = self.data_transformer.transform_train(x_train, y_train)
test_loader = self.data_transformer.transform_test(x_test, y_test)
self.generator = self._init_generator(self.y_encoder.n_classes, x_train.shape[1:])
graph = self.generator.generate()
if trainer_args is None:
trainer_args = {'max_no_improvement_num': 30}
_, _1, self.graph = train(None, graph, train_loader, test_loader,
trainer_args, self.metric, self.loss,
self.verbose, self.path)
class PredefinedResnet(PredefinedModel):
def _init_generator(self, n_output_node, input_shape):
return ResNetGenerator(n_output_node, input_shape)
class PredefinedDensenet(PredefinedModel):
def _init_generator(self, n_output_node, input_shape):
return DenseNetGenerator(n_output_node, input_shape)
| 41.963303 | 116 | 0.691736 | 574 | 4,574 | 5.287456 | 0.280488 | 0.023723 | 0.039209 | 0.026359 | 0.155189 | 0.113674 | 0.080725 | 0.054366 | 0.054366 | 0.040857 | 0 | 0.002908 | 0.248142 | 4,574 | 108 | 117 | 42.351852 | 0.879616 | 0.290337 | 0 | 0.080645 | 0 | 0 | 0.007085 | 0.007085 | 0 | 0 | 0 | 0 | 0 | 1 | 0.16129 | false | 0.016129 | 0.193548 | 0.112903 | 0.516129 | 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 |
1e8a957f0a3efaf086ef4cdc67898a667be3900b | 4,379 | py | Python | src/pybullet_planning/interfaces/geometry/bounding_box.py | mcx/pybullet_planning | cc90e8620dd61acc7fc4246638d91f222b64e77a | [
"MIT"
] | 61 | 2019-10-07T19:20:15.000Z | 2022-03-09T21:28:18.000Z | src/pybullet_planning/interfaces/geometry/bounding_box.py | mcx/pybullet_planning | cc90e8620dd61acc7fc4246638d91f222b64e77a | [
"MIT"
] | 9 | 2020-03-14T21:24:05.000Z | 2021-06-01T13:27:45.000Z | src/pybullet_planning/interfaces/geometry/bounding_box.py | mcx/pybullet_planning | cc90e8620dd61acc7fc4246638d91f222b64e77a | [
"MIT"
] | 11 | 2020-08-20T12:54:55.000Z | 2022-01-27T06:05:51.000Z | import numpy as np
from collections import namedtuple
from itertools import product
import pybullet as p
from pybullet_planning.utils import CLIENT, BASE_LINK, UNKNOWN_FILE, OBJ_MESH_CACHE
from pybullet_planning.utils import implies
#####################################
# Bounding box
AABB = namedtuple('AABB', ['lower', 'upper'])
"""axis-aligned bounding box: https://en.wikipedia.org/wiki/Bounding_volume
Notice that the world-axis is used here. We don't have support for OOBB (using the object's local coordinate system)?
"""
def aabb_from_points(points):
return AABB(np.min(points, axis=0), np.max(points, axis=0))
def aabb_union(aabbs):
return aabb_from_points(np.vstack([aabb for aabb in aabbs]))
def aabb_overlap(aabb1, aabb2):
lower1, upper1 = aabb1
lower2, upper2 = aabb2
return np.less_equal(lower1, upper2).all() and \
np.less_equal(lower2, upper1).all()
#####################################
# Bounding box from body
def get_subtree_aabb(body, root_link=BASE_LINK):
from pybullet_planning.interfaces.robots.link import get_link_subtree
return aabb_union(get_aabb(body, link) for link in get_link_subtree(body, root_link))
def get_aabbs(body):
from pybullet_planning.interfaces.robots.link import get_all_links
return [get_aabb(body, link=link) for link in get_all_links(body)]
def get_aabb(body, link=None):
# Note that the query is conservative and may return additional objects that don't have actual AABB overlap.
# This happens because the acceleration structures have some heuristic that enlarges the AABBs a bit
# (extra margin and extruded along the velocity vector).
# Contact points with distance exceeding this threshold are not processed by the LCP solver.
# AABBs are extended by this number. Defaults to 0.02 in Bullet 2.x
#p.setPhysicsEngineParameter(contactBreakingThreshold=0.0, physicsClientId=CLIENT)
if link is None:
aabb = aabb_union(get_aabbs(body))
else:
aabb = p.getAABB(body, linkIndex=link, physicsClientId=CLIENT)
return aabb
get_lower_upper = get_aabb
def get_aabb_center(aabb):
lower, upper = aabb
return (np.array(lower) + np.array(upper)) / 2.
def get_aabb_extent(aabb):
"""return the bounding box range in the x, y, z in the body's pose frame
Parameters
----------
aabb : AABB
[description]
Returns
-------
np array of three float
[width, length, height]
"""
lower, upper = aabb
return np.array(upper) - np.array(lower)
def get_center_extent(body, **kwargs):
aabb = get_aabb(body, **kwargs)
return get_aabb_center(aabb), get_aabb_extent(aabb)
def aabb2d_from_aabb(aabb):
(lower, upper) = aabb
return lower[:2], upper[:2]
def aabb_contains_aabb(contained, container):
lower1, upper1 = contained
lower2, upper2 = container
return np.less_equal(lower2, lower1).all() and \
np.less_equal(upper1, upper2).all()
#return np.all(lower2 <= lower1) and np.all(upper1 <= upper2)
def aabb_contains_point(point, container):
lower, upper = container
return np.less_equal(lower, point).all() and \
np.less_equal(point, upper).all()
#return np.all(lower <= point) and np.all(point <= upper)
def get_bodies_in_region(aabb):
"""This query will return all the unique ids of objects that have axis aligned bounding box overlap with a given axis aligned bounding box.
Note that the query is conservative and may return additional objects that don't have actual AABB overlap.
This happens because the acceleration structures have some heuristic that enlarges the AABBs a bit
(extra margin and extruded along the velocity vector).
Parameters
----------
aabb : [type]
[description]
Returns
-------
a list of object unique ids.
"""
(lower, upper) = aabb
bodies = p.getOverlappingObjects(lower, upper, physicsClientId=CLIENT)
return [] if bodies is None else bodies
def get_aabb_volume(aabb):
return np.prod(get_aabb_extent(aabb))
def get_aabb_area(aabb):
return np.prod(get_aabb_extent(aabb2d_from_aabb(aabb)))
#####################################
# AABB approximation
def get_aabb_vertices(aabb):
d = len(aabb[0])
return [tuple(aabb[i[k]][k] for k in range(d))
for i in product(range(len(aabb)), repeat=d)]
| 33.174242 | 143 | 0.69171 | 625 | 4,379 | 4.7248 | 0.28 | 0.033187 | 0.02235 | 0.02235 | 0.302743 | 0.217406 | 0.19912 | 0.179479 | 0.146292 | 0.146292 | 0 | 0.010674 | 0.187029 | 4,379 | 131 | 144 | 33.427481 | 0.81882 | 0.31103 | 0 | 0.064516 | 0 | 0 | 0.005376 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.258065 | false | 0 | 0.129032 | 0.064516 | 0.645161 | 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 |
1e997c0ae7ba981669d24e0eebb3ca376d714072 | 343 | py | Python | Mundo_1/modulos_em_py/ex0022.py | gabizinha12/CursoEmVideoPython | 3f0931b3ef5f26d13f031f217cad7c8f345c0ff0 | [
"MIT"
] | 6 | 2021-05-18T10:55:12.000Z | 2021-11-08T08:56:36.000Z | Mundo_1/modulos_em_py/ex0022.py | gabizinha12/CursoEmVideoPython | 3f0931b3ef5f26d13f031f217cad7c8f345c0ff0 | [
"MIT"
] | null | null | null | Mundo_1/modulos_em_py/ex0022.py | gabizinha12/CursoEmVideoPython | 3f0931b3ef5f26d13f031f217cad7c8f345c0ff0 | [
"MIT"
] | null | null | null | nome = str(input("Digite seu nome: ")).strip()
print("Seu nome em maiusculas é {}".format(nome.upper()))
print("Seu nome em minusculas é {}".format(nome.lower()))
print("Seu nome tem ao todo {} letras".format(len(nome) - nome.count(' ')))
print("Seu primeiro nome é {} e ele tem {} letras.".format(nome[:nome.find(' ')], nome.find(' ')))
| 34.3 | 98 | 0.638484 | 52 | 343 | 4.211538 | 0.461538 | 0.127854 | 0.164384 | 0.127854 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134111 | 343 | 9 | 99 | 38.111111 | 0.737374 | 0 | 0 | 0 | 0 | 0 | 0.436578 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.8 | 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 | 0 | 0 | 0 | 1 | 0 | 2 |
1eab13bc0f475aad4a32851a5cd4f51c079deb0d | 192 | py | Python | Software 1/Practical/Week 06/Software 01 Practical 09.py | KristoffLiu/YorkCSSolution | cae76529b1e5956a59ac4bd51797a30a5a23fb8d | [
"Apache-2.0"
] | 3 | 2019-11-14T22:04:32.000Z | 2019-11-17T16:07:58.000Z | Software 1/Practical/Week 06/Software 01 Practical 09.py | KristoffLiu/YorkCSSolution | cae76529b1e5956a59ac4bd51797a30a5a23fb8d | [
"Apache-2.0"
] | null | null | null | Software 1/Practical/Week 06/Software 01 Practical 09.py | KristoffLiu/YorkCSSolution | cae76529b1e5956a59ac4bd51797a30a5a23fb8d | [
"Apache-2.0"
] | 1 | 2019-11-15T07:52:14.000Z | 2019-11-15T07:52:14.000Z | def exercise_1():
a_word = "hello world"
f = open("exo1.txt",'a')
f.write(a_word)
f.close()
def save_list2file(sentences, filename):
f = open(filename,"w")
f.close()
| 17.454545 | 40 | 0.59375 | 29 | 192 | 3.793103 | 0.62069 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02027 | 0.229167 | 192 | 10 | 41 | 19.2 | 0.722973 | 0 | 0 | 0.25 | 0 | 0 | 0.109375 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.25 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1ebae9bffcfcf5606a1102e655c04103d712d951 | 567 | py | Python | src/human_lambdas/workflow_handler/migrations/0030_auto_20201103_1718.py | Human-Lambdas/human-lambdas | 9a2f2317f0c8dbfbfa88f3ba4994de7e6b2c4d50 | [
"Apache-2.0"
] | 25 | 2021-06-08T08:00:08.000Z | 2022-03-17T22:49:10.000Z | src/human_lambdas/workflow_handler/migrations/0030_auto_20201103_1718.py | Human-Lambdas/human-lambdas | 9a2f2317f0c8dbfbfa88f3ba4994de7e6b2c4d50 | [
"Apache-2.0"
] | null | null | null | src/human_lambdas/workflow_handler/migrations/0030_auto_20201103_1718.py | Human-Lambdas/human-lambdas | 9a2f2317f0c8dbfbfa88f3ba4994de7e6b2c4d50 | [
"Apache-2.0"
] | 5 | 2021-06-15T09:57:46.000Z | 2022-02-03T16:18:33.000Z | # Generated by Django 2.2.13 on 2020-11-03 17:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("workflow_handler", "0029_auto_20201029_1449"),
]
operations = [
migrations.AddField(
model_name="task",
name="handling_time_seconds",
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name="task",
name="session_started_at",
field=models.DateTimeField(null=True),
),
]
| 23.625 | 56 | 0.594356 | 58 | 567 | 5.637931 | 0.741379 | 0.110092 | 0.140673 | 0.165138 | 0.214067 | 0.214067 | 0 | 0 | 0 | 0 | 0 | 0.082707 | 0.296296 | 567 | 23 | 57 | 24.652174 | 0.736842 | 0.081129 | 0 | 0.352941 | 1 | 0 | 0.165703 | 0.084778 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.235294 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1ebcb2ac8655a6742f52a54326d3b833576c0ac0 | 1,086 | py | Python | 14 - Data manipulation with Pandas/chapter 2 - Aggregating Data/11 - Fill in missing values and sum values with pivot tables.py | Baidaly/datacamp-samples | 09b3e253ec2c503df936298fedc3902413c987b0 | [
"MIT"
] | null | null | null | 14 - Data manipulation with Pandas/chapter 2 - Aggregating Data/11 - Fill in missing values and sum values with pivot tables.py | Baidaly/datacamp-samples | 09b3e253ec2c503df936298fedc3902413c987b0 | [
"MIT"
] | null | null | null | 14 - Data manipulation with Pandas/chapter 2 - Aggregating Data/11 - Fill in missing values and sum values with pivot tables.py | Baidaly/datacamp-samples | 09b3e253ec2c503df936298fedc3902413c987b0 | [
"MIT"
] | null | null | null | '''
The .pivot_table() method has several useful arguments, including fill_value and margins.
fill_value replaces missing values with a real value (known as imputation). What to replace missing values with is a topic big enough to have its own course (Dealing with Missing Data in Python), but the simplest thing to do is to substitute a dummy value.
margins is a shortcut for when you pivoted by two variables, but also wanted to pivot by each of those variables separately: it gives the row and column totals of the pivot table contents.
In this exercise, you'll practice using these arguments to up your pivot table skills, which will help you crunch numbers more efficiently!
'''
# Print mean weekly_sales by department and type; fill missing values with 0
print(sales.pivot_table(values="weekly_sales", index="type", columns="department", fill_value=0))
# Print the mean weekly_sales by department and type; fill missing values with 0s; sum all rows and cols
print(sales.pivot_table(values="weekly_sales", index="department", columns="type", fill_value=0, margins=True)) | 83.538462 | 260 | 0.785451 | 178 | 1,086 | 4.730337 | 0.52809 | 0.059382 | 0.08076 | 0.04038 | 0.230404 | 0.230404 | 0.230404 | 0.230404 | 0.130641 | 0.130641 | 0 | 0.004343 | 0.151934 | 1,086 | 13 | 261 | 83.538462 | 0.909881 | 0.79558 | 0 | 0 | 0 | 0 | 0.242991 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 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 |
1ebd1e5b31763c981c46244d6cb4695aec22f96d | 2,391 | py | Python | utils/wfuzzbasicauthbrute/wfuzz/plugins/iterations.py | ismailbozkurt/kubebot | 3558ddc593c861a9805731052c1ac5e71879fdf5 | [
"MIT"
] | 171 | 2017-07-11T08:27:49.000Z | 2022-02-20T17:42:51.000Z | utils/wfuzzbasicauthbrute/wfuzz/plugins/iterations.py | STEALTH-Z/kubebot | 3558ddc593c861a9805731052c1ac5e71879fdf5 | [
"MIT"
] | 2 | 2017-07-11T17:50:16.000Z | 2019-12-01T21:35:18.000Z | utils/wfuzzbasicauthbrute/wfuzz/plugins/iterations.py | STEALTH-Z/kubebot | 3558ddc593c861a9805731052c1ac5e71879fdf5 | [
"MIT"
] | 36 | 2017-07-11T08:33:31.000Z | 2022-03-11T04:56:02.000Z | from externals.moduleman.plugin import moduleman_plugin
import itertools
class piterator_void:
text="void"
def count(self):
return self.__count
def __init__(self, *i):
self._dic = i
self.__count = max(map(lambda x:x.count(), i))
self.it = self._dic[0]
def next(self):
return (self.it.next(),)
def restart(self):
for dic in self._dic:
dic.restart()
self.it = self._dic[0]
def __iter__(self):
self.restart()
return self
@moduleman_plugin("restart", "count", "next", "__iter__")
class zip:
name = "zip"
description = "Returns an iterator that aggregates elements from each of the iterables."
category = ["default"]
priority = 99
def __init__(self, *i):
self._dic = i
self.it = itertools.izip(*self._dic)
self.__count = max(map(lambda x:x.count(), i))
def count(self):
return self.__count
def restart(self):
for dic in self._dic:
dic.restart()
self.it = itertools.izip.__init__(self, *self._dic)
def next(self):
return self.it.next()
def __iter__(self):
self.restart()
return self
@moduleman_plugin("restart", "count", "next", "__iter__")
class product:
name = "product"
description = "Returns an iterator cartesian product of input iterables."
category = ["default"]
priority = 99
def __init__(self, *i):
self._dic = i
self.it = itertools.product(*self._dic)
self.__count = reduce(lambda x,y:x*y.count(), i[1:], i[0].count())
def restart(self):
for dic in self._dic:
dic.restart()
self.it = itertools.product(*self._dic)
def count(self):
return self.__count
def next(self):
return self.it.next()
def __iter__(self):
self.restart()
return self
@moduleman_plugin("restart", "count", "next", "__iter__")
class chain:
name = "chain"
description = "Returns an iterator returns elements from the first iterable until it is exhausted, then proceeds to the next iterable, until all of the iterables are exhausted."
category = ["default"]
priority = 99
def count(self):
return self.__count
def __init__(self, *i):
self.__count = sum(map(lambda x:x.count(), i))
self._dic = i
self.it = itertools.chain(*i)
def restart(self):
for dic in self._dic:
dic.restart()
self.it = itertools.chain(*self._dic)
def next(self):
return (self.it.next(),)
def __iter__(self):
self.restart()
return self
| 22.138889 | 181 | 0.663739 | 340 | 2,391 | 4.420588 | 0.188235 | 0.06986 | 0.074518 | 0.047904 | 0.689953 | 0.67332 | 0.642715 | 0.580838 | 0.560213 | 0.521623 | 0 | 0.005211 | 0.197407 | 2,391 | 107 | 182 | 22.345794 | 0.778009 | 0 | 0 | 0.768293 | 0 | 0.012195 | 0.16813 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.02439 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1ec13019aa0ecb723a140d5f752630115ac4899f | 1,451 | py | Python | com/kakao/cafe/menu/dessert/iceWaffle.py | roseonghwan/kakao-cafe | 39ed9227f48ab329eccc27ccf11535e843a35f4c | [
"MIT"
] | 2 | 2020-04-04T22:49:03.000Z | 2020-05-15T09:59:34.000Z | com/kakao/cafe/menu/dessert/iceWaffle.py | bamin0422/kakao-cafe | f5aca5f6eaf3637eca6af136157f53737c0bffc8 | [
"MIT"
] | null | null | null | com/kakao/cafe/menu/dessert/iceWaffle.py | bamin0422/kakao-cafe | f5aca5f6eaf3637eca6af136157f53737c0bffc8 | [
"MIT"
] | null | null | null | from com.kakao.cafe.menu.dessert.waffle import Waffle
class IceWaffle(Waffle):
def __init__(self):
super().__init__()
self.iceCream = 2
self.name = 'IceWaffle'
self.__price = 6000
self.__numWaffles = 2
def getName(self) -> str:
return self.name
def setName(self, name) -> None:
self.name = name
return
def getPrice(self) -> int:
return self.__price
def setPrice(self, price) -> None:
self.__price = price
return
def isIced(self) -> bool:
self._iced = True
return self._iced
def setIced(self, iced: bool) -> None:
pass
def isMelted(self) -> bool:
return self._melted
def melt(self) -> bool:
self._melted = True
return self._melted
def geticeCream(self) -> int:
return self.iceCream
def seticeCream(self, iceCream) -> None:
self.iceCream = iceCream
def getnumWaffles(self) -> int:
return self.__numWaffles
def setnumWaffles(self, numWaffles) -> None:
self.__numWaffles = numWaffles
def addWaffle(self, amount) -> None:
self.setnumWaffles(self.getnumWaffles() + amount)
self.setPrice(self.getPrice() + amount * 1000)
return
def addIceCream(self, amount) -> None:
self.seticeCream(self.geticeCream() + amount)
self.setPrice(self.getPrice() + amount * 500)
return
| 23.786885 | 57 | 0.598208 | 159 | 1,451 | 5.301887 | 0.289308 | 0.083037 | 0.046263 | 0.060498 | 0.085409 | 0.085409 | 0 | 0 | 0 | 0 | 0 | 0.012733 | 0.296347 | 1,451 | 60 | 58 | 24.183333 | 0.812929 | 0 | 0 | 0.136364 | 0 | 0 | 0.006203 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.340909 | false | 0.022727 | 0.022727 | 0.113636 | 0.636364 | 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 |
1eced6cec379caa443f824ef885b3af0eb53736d | 600 | py | Python | 2020/10/jolt.py | cheshyre/advent-of-code | 2ccc1529bbf8b0deed938d0783deb09dcc8f5e50 | [
"Unlicense"
] | 1 | 2021-12-03T07:20:23.000Z | 2021-12-03T07:20:23.000Z | 2020/10/jolt.py | cheshyre/advent-of-code | 2ccc1529bbf8b0deed938d0783deb09dcc8f5e50 | [
"Unlicense"
] | null | null | null | 2020/10/jolt.py | cheshyre/advent-of-code | 2ccc1529bbf8b0deed938d0783deb09dcc8f5e50 | [
"Unlicense"
] | null | null | null | def make_differences(arr):
diff_arr = [0] * (len(arr) - 1)
for i in range(1, len(arr)):
diff_arr[i - 1] = arr[i] - arr[i - 1]
return diff_arr
def paths_reconstruction(arr):
num_paths_arr = [0] * len(arr)
num_paths_arr[-1] = 1
for i in range(len(arr) - 2, -1, -1):
num_paths = 0
for j in range(1, 4):
if i + j >= len(arr):
break
if arr[i+j] - arr[i] > 3:
break
num_paths += num_paths_arr[i + j]
num_paths_arr[i] = num_paths
return num_paths_arr[0]
| 25 | 45 | 0.486667 | 94 | 600 | 2.914894 | 0.234043 | 0.233577 | 0.20073 | 0.072993 | 0.087591 | 0 | 0 | 0 | 0 | 0 | 0 | 0.043011 | 0.38 | 600 | 23 | 46 | 26.086957 | 0.693548 | 0 | 0 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0 | 0 | 0.222222 | 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 |
94929c97870c190664a53d54065efaad8f52ca01 | 377 | py | Python | Dictionary/DictExample8.py | suprit08/PythonAssignments | 6cab78660d8c77cf573cbea82e4dada19b0fc08c | [
"MIT"
] | null | null | null | Dictionary/DictExample8.py | suprit08/PythonAssignments | 6cab78660d8c77cf573cbea82e4dada19b0fc08c | [
"MIT"
] | null | null | null | Dictionary/DictExample8.py | suprit08/PythonAssignments | 6cab78660d8c77cf573cbea82e4dada19b0fc08c | [
"MIT"
] | null | null | null | #DictExample8.py
student = {"name":"sumit","college":"stanford","grade":"A"}
#this will prints whole key and values pairs using items()
for x in student.items():
print(x)
print("-----------------------------------------------------")
#you can also store key and value in two differnet variable like
for x,y in student.items():
print(x,"-",y)
| 19.842105 | 65 | 0.541114 | 48 | 377 | 4.25 | 0.6875 | 0.058824 | 0.137255 | 0.186275 | 0.196078 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003279 | 0.190981 | 377 | 18 | 66 | 20.944444 | 0.665574 | 0.35809 | 0 | 0 | 0 | 0 | 0.381818 | 0.240909 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 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 | 0 | 1 | 0 | 2 |
949377df94bdb2e53b1731045ff309db0fe847c3 | 245 | py | Python | Products/PloneGlossary/Extensions/install.py | collective/Products.PloneGlossary | ae040e0590040a23e20933e588324b9da222918e | [
"Unlicense"
] | null | null | null | Products/PloneGlossary/Extensions/install.py | collective/Products.PloneGlossary | ae040e0590040a23e20933e588324b9da222918e | [
"Unlicense"
] | 2 | 2016-03-02T10:45:42.000Z | 2021-04-29T09:56:41.000Z | Products/PloneGlossary/Extensions/install.py | collective/Products.PloneGlossary | ae040e0590040a23e20933e588324b9da222918e | [
"Unlicense"
] | 2 | 2017-05-21T20:11:42.000Z | 2019-08-22T13:13:09.000Z | # -*- coding: utf-8 -*-
def uninstall(portal, reinstall=False):
"""
launch uninstall profile
"""
setup_tool = portal.portal_setup
setup_tool.runAllImportStepsFromProfile(
'profile-Products.PloneGlossary:uninstall')
| 22.272727 | 51 | 0.681633 | 23 | 245 | 7.130435 | 0.652174 | 0.109756 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005076 | 0.195918 | 245 | 10 | 52 | 24.5 | 0.827411 | 0.191837 | 0 | 0 | 0 | 0 | 0.21978 | 0.21978 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
94a60eb2cabc052021f495c58d089725795022a9 | 373 | py | Python | zeenode/zeenode/config.py | flowitoo/selfbot | 8de0c84391bbc08546a7a8b6c657438405da675c | [
"MIT"
] | 1 | 2021-04-26T21:32:14.000Z | 2021-04-26T21:32:14.000Z | zeenode/zeenode/config.py | flowitoo/selfbot | 8de0c84391bbc08546a7a8b6c657438405da675c | [
"MIT"
] | null | null | null | zeenode/zeenode/config.py | flowitoo/selfbot | 8de0c84391bbc08546a7a8b6c657438405da675c | [
"MIT"
] | null | null | null | class config:
global auth; auth = "YOUR TOKEN" # Enter your discord token for Auto-Login.
global prefix; prefix = "$" # Enter your prefix for selfbot.
global nitro_sniper; nitro_sniper = "true" # 'true' to enable nitro sniper, 'false' to disable.
global giveaway_sniper; giveaway_sniper = "true" # 'true' to enable giveaway sniper, 'false' to disable.
| 62.166667 | 109 | 0.699732 | 50 | 373 | 5.14 | 0.42 | 0.128405 | 0.108949 | 0.124514 | 0.171206 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.201072 | 373 | 5 | 110 | 74.6 | 0.862416 | 0.47185 | 0 | 0 | 0 | 0 | 0.101604 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
94bebe73dfd4deb8b3338d590daaec4c386b76c0 | 147 | py | Python | paper_trail.py | Citizen-T/paper_trail | c797010a3ab7e70aaaa2dad223af4a547788040c | [
"Apache-2.0"
] | null | null | null | paper_trail.py | Citizen-T/paper_trail | c797010a3ab7e70aaaa2dad223af4a547788040c | [
"Apache-2.0"
] | null | null | null | paper_trail.py | Citizen-T/paper_trail | c797010a3ab7e70aaaa2dad223af4a547788040c | [
"Apache-2.0"
] | null | null | null | import os
for path in os.listdir():
parts = path.split()
date = parts[0]
if (len(date) != 10):
print('Date Warning: ' + path)
| 18.375 | 38 | 0.55102 | 21 | 147 | 3.857143 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.028571 | 0.285714 | 147 | 7 | 39 | 21 | 0.742857 | 0 | 0 | 0 | 0 | 0 | 0.095238 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0.166667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
94c73d2a57ffbc250828ad48519623c032b546d3 | 396 | py | Python | mayan/apps/appearance/settings.py | eshbeata/open-paperless | 6b9ed1f21908116ad2795b3785b2dbd66713d66e | [
"Apache-2.0"
] | 2,743 | 2017-12-18T07:12:30.000Z | 2022-03-27T17:21:25.000Z | mayan/apps/appearance/settings.py | eshbeata/open-paperless | 6b9ed1f21908116ad2795b3785b2dbd66713d66e | [
"Apache-2.0"
] | 15 | 2017-12-18T14:58:07.000Z | 2021-03-01T20:05:05.000Z | mayan/apps/appearance/settings.py | eshbeata/open-paperless | 6b9ed1f21908116ad2795b3785b2dbd66713d66e | [
"Apache-2.0"
] | 257 | 2017-12-18T03:12:58.000Z | 2022-03-25T08:59:10.000Z | from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from smart_settings import Namespace
from .literals import DEFAULT_MAXIMUM_TITLE_LENGTH
namespace = Namespace(name='appearance', label=_('Appearance'))
setting_max_title_length = namespace.add_setting(
global_name='APPEARANCE_MAXIMUM_TITLE_LENGTH',
default=DEFAULT_MAXIMUM_TITLE_LENGTH
)
| 28.285714 | 63 | 0.838384 | 49 | 396 | 6.306122 | 0.510204 | 0.142395 | 0.174757 | 0.161812 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.10101 | 396 | 13 | 64 | 30.461538 | 0.867978 | 0 | 0 | 0 | 0 | 0 | 0.128788 | 0.078283 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.444444 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
94ea4119fc938c36282c42d846743fa97ed1d93a | 555 | py | Python | pycheck.io/ELEMENTARY/Number Base.py | jz2010927/pycheck.io | 627898bed6fe712921f082c53a1858b8d80835a4 | [
"MIT"
] | null | null | null | pycheck.io/ELEMENTARY/Number Base.py | jz2010927/pycheck.io | 627898bed6fe712921f082c53a1858b8d80835a4 | [
"MIT"
] | null | null | null | pycheck.io/ELEMENTARY/Number Base.py | jz2010927/pycheck.io | 627898bed6fe712921f082c53a1858b8d80835a4 | [
"MIT"
] | null | null | null | def checkio(str_number, radix):
try:
return int(str_number,radix)
except:
return -1
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio("AF", 16) == 175, "Hex"
assert checkio("101", 2) == 5, "Bin"
assert checkio("101", 5) == 26, "5 base"
assert checkio("Z", 36) == 35, "Z base"
assert checkio("AB", 10) == -1, "B > A = 10"
print("Coding complete? Click 'Check' to review your tests and earn cool rewards!")
| 34.6875 | 88 | 0.585586 | 77 | 555 | 4.090909 | 0.714286 | 0.206349 | 0.088889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066502 | 0.268468 | 555 | 15 | 89 | 37 | 0.70936 | 0.142342 | 0 | 0 | 0 | 0 | 0.263043 | 0 | 0 | 0 | 0 | 0 | 0.416667 | 1 | 0.083333 | false | 0 | 0 | 0 | 0.25 | 0.083333 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
94eb4b6ea890f8fac4ff0f0b071e824e8b0e002b | 5,888 | py | Python | src/fhir_types/FHIR_SubstanceProtein.py | anthem-ai/fhir-types | 42348655fb3a9b3f131b911d6bc0782da8c14ce4 | [
"Apache-2.0"
] | 2 | 2022-02-03T00:51:30.000Z | 2022-02-03T18:42:43.000Z | src/fhir_types/FHIR_SubstanceProtein.py | anthem-ai/fhir-types | 42348655fb3a9b3f131b911d6bc0782da8c14ce4 | [
"Apache-2.0"
] | null | null | null | src/fhir_types/FHIR_SubstanceProtein.py | anthem-ai/fhir-types | 42348655fb3a9b3f131b911d6bc0782da8c14ce4 | [
"Apache-2.0"
] | null | null | null | from typing import Any, List, Literal, TypedDict
from .FHIR_code import FHIR_code
from .FHIR_CodeableConcept import FHIR_CodeableConcept
from .FHIR_Element import FHIR_Element
from .FHIR_id import FHIR_id
from .FHIR_integer import FHIR_integer
from .FHIR_Meta import FHIR_Meta
from .FHIR_Narrative import FHIR_Narrative
from .FHIR_string import FHIR_string
from .FHIR_SubstanceProtein_Subunit import FHIR_SubstanceProtein_Subunit
from .FHIR_uri import FHIR_uri
# A SubstanceProtein is defined as a single unit of a linear amino acid sequence, or a combination of subunits that are either covalently linked or have a defined invariant stoichiometric relationship. This includes all synthetic, recombinant and purified SubstanceProteins of defined sequence, whether the use is therapeutic or prophylactic. This set of elements will be used to describe albumins, coagulation factors, cytokines, growth factors, peptide/SubstanceProtein hormones, enzymes, toxins, toxoids, recombinant vaccines, and immunomodulators.
FHIR_SubstanceProtein = TypedDict(
"FHIR_SubstanceProtein",
{
# This is a SubstanceProtein resource
"resourceType": Literal["SubstanceProtein"],
# The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.
"id": FHIR_id,
# The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource.
"meta": FHIR_Meta,
# A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.
"implicitRules": FHIR_uri,
# Extensions for implicitRules
"_implicitRules": FHIR_Element,
# The base language in which the resource is written.
"language": FHIR_code,
# Extensions for language
"_language": FHIR_Element,
# A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.
"text": FHIR_Narrative,
# These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.
"contained": List[Any],
# May be used to represent additional information that is not part of the basic definition of the resource. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.
"extension": List[Any],
# May be used to represent additional information that is not part of the basic definition of the resource and that modifies the understanding of the element that contains it and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).
"modifierExtension": List[Any],
# The SubstanceProtein descriptive elements will only be used when a complete or partial amino acid sequence is available or derivable from a nucleic acid sequence.
"sequenceType": FHIR_CodeableConcept,
# Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable.
"numberOfSubunits": FHIR_integer,
# Extensions for numberOfSubunits
"_numberOfSubunits": FHIR_Element,
# The disulphide bond between two cysteine residues either on the same subunit or on two different subunits shall be described. The position of the disulfide bonds in the SubstanceProtein shall be listed in increasing order of subunit number and position within subunit followed by the abbreviation of the amino acids involved. The disulfide linkage positions shall actually contain the amino acid Cysteine at the respective positions.
"disulfideLinkage": List[FHIR_string],
# Extensions for disulfideLinkage
"_disulfideLinkage": List[FHIR_Element],
# This subclause refers to the description of each subunit constituting the SubstanceProtein. A subunit is a linear sequence of amino acids linked through peptide bonds. The Subunit information shall be provided when the finished SubstanceProtein is a complex of multiple sequences; subunits are not used to delineate domains within a single sequence. Subunits are listed in order of decreasing length; sequences of the same length will be ordered by decreasing molecular weight; subunits that have identical sequences will be repeated multiple times.
"subunit": List[FHIR_SubstanceProtein_Subunit],
},
total=False,
)
| 107.054545 | 839 | 0.782099 | 825 | 5,888 | 5.530909 | 0.323636 | 0.017532 | 0.014245 | 0.011177 | 0.155599 | 0.155599 | 0.155599 | 0.155599 | 0.138067 | 0.138067 | 0 | 0 | 0.184783 | 5,888 | 54 | 840 | 109.037037 | 0.950625 | 0.763077 | 0 | 0 | 0 | 0 | 0.162064 | 0.015262 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.323529 | 0 | 0.323529 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
94edc81eb1751709c553fa98f1f300b830cdb8e7 | 1,073 | py | Python | thundra/context/tracing_execution_context_provider.py | sturmianseq/thundra-agent-python | 4cee02d790eb7b8e4dea4e2e9dcd1f67533b1c56 | [
"Apache-2.0"
] | 22 | 2018-03-05T20:02:46.000Z | 2021-04-09T12:00:18.000Z | thundra/context/tracing_execution_context_provider.py | sturmianseq/thundra-agent-python | 4cee02d790eb7b8e4dea4e2e9dcd1f67533b1c56 | [
"Apache-2.0"
] | 13 | 2018-03-26T07:57:57.000Z | 2021-06-29T14:22:52.000Z | thundra/context/tracing_execution_context_provider.py | sturmianseq/thundra-agent-python | 4cee02d790eb7b8e4dea4e2e9dcd1f67533b1c56 | [
"Apache-2.0"
] | 3 | 2018-07-04T19:00:25.000Z | 2020-12-01T11:57:29.000Z | from thundra.context.context_provider import ContextProvider
from thundra.context.execution_context import ExecutionContext
from thundra.opentracing.tracer import ThundraTracer
class TracingExecutionContextProvider(ContextProvider):
def __init__(self):
self.tracer = ThundraTracer.get_instance()
def get(self):
execution_context = None
active_span = self.tracer.get_active_span()
if active_span and hasattr(active_span, 'execution_context'):
execution_context = active_span.execution_context
if not execution_context:
return ExecutionContext()
return execution_context
def set(self, execution_context):
active_span = self.tracer.get_active_span()
if active_span and hasattr(active_span, 'execution_context'):
active_span.execution_context = execution_context
def clear(self):
active_span = self.tracer.get_active_span()
if active_span and hasattr(active_span, 'execution_context'):
active_span.execution_context = None
| 37 | 69 | 0.726934 | 119 | 1,073 | 6.243697 | 0.235294 | 0.201884 | 0.153432 | 0.20996 | 0.475101 | 0.475101 | 0.397039 | 0.397039 | 0.397039 | 0.397039 | 0 | 0 | 0.207829 | 1,073 | 28 | 70 | 38.321429 | 0.874118 | 0 | 0 | 0.272727 | 0 | 0 | 0.047575 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.136364 | 0 | 0.454545 | 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 |
a209913b983aade32f4c6d35fc6863538e3a05d6 | 1,639 | py | Python | examples/widgets/directview/widget.py | chebee7i/ipython | 85b169fa3afc3d374973295c7f1409ededddbaca | [
"BSD-3-Clause-Clear"
] | 2 | 2020-11-30T14:04:30.000Z | 2021-11-08T11:29:05.000Z | examples/widgets/directview/widget.py | chebee7i/ipython | 85b169fa3afc3d374973295c7f1409ededddbaca | [
"BSD-3-Clause-Clear"
] | null | null | null | examples/widgets/directview/widget.py | chebee7i/ipython | 85b169fa3afc3d374973295c7f1409ededddbaca | [
"BSD-3-Clause-Clear"
] | 1 | 2020-05-03T10:25:12.000Z | 2020-05-03T10:25:12.000Z | """Python support code for JavaScript based widgets.
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2012 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import os
import uuid
from IPython.core.display import display, Javascript
from zmq.utils import jsonapi
#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------
class JavascriptWidget(object):
jslibs = []
def __init__(self):
self.widget_id = unicode(uuid.uuid4()).replace('-','')
self.widget_var = '__widget_%s' % self.widget_id
ns = get_ipython().user_ns
ns[self.widget_var] = self
def encode_json(self, o):
return jsonapi.dumps(o)
def decode_json(self, s):
return jsonapi.loads(s)
def interact(self):
"""This should call display(Javascript(jscode))."""
jscode = self.render()
display(Javascript(data=jscode,lib=self.jslibs))
def render(self):
"""Return the final JavaScript code that will be eval'd in the client."""
raise NotImplementedError('render is not implemented in this base class')
| 27.779661 | 81 | 0.47468 | 153 | 1,639 | 4.986928 | 0.562092 | 0.052425 | 0.031455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006589 | 0.166565 | 1,639 | 58 | 82 | 28.258621 | 0.551977 | 0.519219 | 0 | 0 | 0 | 0 | 0.073976 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.2 | 0.1 | 0.65 | 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 |
a210fabd11f3802c6242477ee578063607f497b0 | 155 | py | Python | rpi_code/ldrTest.py | utkalsahoo/eco_bin | b2199d2148ff8f4b55fdcb4f010adea55dbb607d | [
"MIT"
] | 8 | 2019-09-23T16:49:12.000Z | 2021-12-15T19:28:28.000Z | rpi_code/ldrTest.py | utkalsahoo/eco_bin | b2199d2148ff8f4b55fdcb4f010adea55dbb607d | [
"MIT"
] | null | null | null | rpi_code/ldrTest.py | utkalsahoo/eco_bin | b2199d2148ff8f4b55fdcb4f010adea55dbb607d | [
"MIT"
] | 5 | 2019-04-20T11:24:02.000Z | 2021-02-24T21:58:30.000Z | import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(4,GPIO.IN)
while 1:
try:
print GPIO.input(4),"\n"
except:
print "Exception..."
break;
| 11.923077 | 26 | 0.664516 | 26 | 155 | 3.961538 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023256 | 0.167742 | 155 | 12 | 27 | 12.916667 | 0.775194 | 0 | 0 | 0 | 0 | 0 | 0.090323 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.111111 | null | null | 0.222222 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
a221ea2a1777ccf135d5d294bafe7001229c0523 | 304 | py | Python | tests/integration_tests/faces_tests/vertices_tests/strategies.py | lycantropos/voronoi | 977e0b3e5eff2dd294e2e6ce1a8030c763e86233 | [
"MIT"
] | null | null | null | tests/integration_tests/faces_tests/vertices_tests/strategies.py | lycantropos/voronoi | 977e0b3e5eff2dd294e2e6ce1a8030c763e86233 | [
"MIT"
] | null | null | null | tests/integration_tests/faces_tests/vertices_tests/strategies.py | lycantropos/voronoi | 977e0b3e5eff2dd294e2e6ce1a8030c763e86233 | [
"MIT"
] | null | null | null | from hypothesis import strategies
from tests.integration_tests.utils import to_bound_with_ported_vertices_pair
from tests.strategies import doubles
coordinates = doubles
vertices_pairs = strategies.builds(to_bound_with_ported_vertices_pair,
coordinates, coordinates)
| 33.777778 | 76 | 0.779605 | 35 | 304 | 6.428571 | 0.485714 | 0.08 | 0.097778 | 0.151111 | 0.257778 | 0.257778 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1875 | 304 | 8 | 77 | 38 | 0.910931 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 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 |
a222e7518f7b58638337b03f93205e2449f2eb27 | 688 | py | Python | bootstrapping/__init__.py | tylerdave/python-bootstrapping-tools | e3d3e8f1c3c78e145f466a28cc40e77196d3d28d | [
"Unlicense"
] | 1 | 2015-03-10T18:16:51.000Z | 2015-03-10T18:16:51.000Z | bootstrapping/__init__.py | tylerdave/python-bootstrapping-tools | e3d3e8f1c3c78e145f466a28cc40e77196d3d28d | [
"Unlicense"
] | null | null | null | bootstrapping/__init__.py | tylerdave/python-bootstrapping-tools | e3d3e8f1c3c78e145f466a28cc40e77196d3d28d | [
"Unlicense"
] | null | null | null | import subprocess
class ShellError(RuntimeError):
pass
class CurlError(ShellError):
pass
def shell_command(command):
# TODO: capture stdout / stderr
p = subprocess.Popen(command.split())
status = p.wait()
if status !=0:
# TODO: provide better error output
raise ShellError('Shell command exited with an error.')
def curl_download(url, filename):
command = 'curl -o {filename} {url}'.format(filename=filename, url=url)
# TODO: capture stdout / stderr
p = subprocess.Popen(command.split())
status = p.wait()
if status !=0:
# TODO: get the actual error output
raise CurlError('curl exited with an error.')
| 22.933333 | 75 | 0.656977 | 85 | 688 | 5.294118 | 0.447059 | 0.053333 | 0.075556 | 0.102222 | 0.333333 | 0.333333 | 0.333333 | 0.333333 | 0.333333 | 0.333333 | 0 | 0.003795 | 0.234012 | 688 | 29 | 76 | 23.724138 | 0.850095 | 0.184593 | 0 | 0.5 | 0 | 0 | 0.15343 | 0 | 0 | 0 | 0 | 0.034483 | 0 | 1 | 0.125 | false | 0.125 | 0.0625 | 0 | 0.3125 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
a2268e4709776e7f272972020d48c8dd6c8c9ec4 | 12,187 | py | Python | src/dsrlib/compiler/codegen.py | fraca7/dsremap | fb8f4fb13e74b512ed0cac05387fbe9694faebcf | [
"MIT"
] | 8 | 2020-09-06T02:15:10.000Z | 2022-01-12T22:49:20.000Z | src/dsrlib/compiler/codegen.py | fraca7/dsremap | fb8f4fb13e74b512ed0cac05387fbe9694faebcf | [
"MIT"
] | 5 | 2021-03-29T20:37:46.000Z | 2021-09-19T13:20:24.000Z | src/dsrlib/compiler/codegen.py | fraca7/dsremap | fb8f4fb13e74b512ed0cac05387fbe9694faebcf | [
"MIT"
] | 2 | 2020-09-16T01:45:49.000Z | 2021-06-12T12:38:15.000Z | #!/usr/bin/env python3
import collections
from .symbols import SymbolScope
from .ast import ASTVisitor, ASTScopedVisitorMixin
from .mtypes import MethodType
from .opcodes import Opcodes
from . import asm
# Function activation block:
# arguments...
# retval
# retaddr
# locals
class StackSize(ASTScopedVisitorMixin, ASTVisitor):
def visitEmptyNode(self, node):
return 0
def visitConstantNode(self, node):
return 0
def visitIdentifierNode(self, node):
return 0
def visitPostfixUnaryNode(self, node):
return self.visit(node.target)
def visitPrefixUnaryNode(self, node):
return self.visit(node.target)
def visitUnaryNode(self, node):
return self.visit(node.expr)
def visitBinaryNode(self, node):
return self.visit(node.op1) + self.visit(node.op2)
def visitCallNode(self, node):
ftype = node.target.type()
# Arguments, retval, retaddr
size = ftype.argsize() + ftype.savesize() + node.type().size + 2
if isinstance(ftype, MethodType):
symbols = node.target.target.type().symbols
else:
symbols = self.currentTable()
func = symbols.get(node.target.name).value
size += CalleeStackSize().visit(func)
return size
def visitAccessNode(self, node):
return 0
def visitVariableNode(self, node):
return self.visit(node.expr)
def visitMemberNode(self, node):
return 0
def visitArgumentNode(self, node):
return 0
def visitStructNode(self, node):
return 0
def visitStateNode(self, node):
return node.symbols.size() + max(self.visit(node.init), self.visit(node.main))
def visitIfNode(self, node):
return self.visit(node.expr) + max(self.visit(node.yes), self.visit(node.no))
def visitWhileNode(self, node):
return self.visit(node.expr) + self.visit(node.body)
def visitAssignmentNode(self, node):
return self.visit(node.expr)
def visitContinueNode(self, node):
return 0
def visitBreakNode(self, node):
return 0
def visitYieldNode(self, node):
return 0
def visitGoNode(self, node):
return 0
def visitReturnNode(self, node):
return self.visit(node.expr)
def visitFunctionNode(self, node):
return 0
def visitMethodNode(self, node):
return 0
def visitStateMethodNode(self, node):
return node.symbols.size() + self.visit(node.body)
def visitCompoundStatementNode(self, node):
size = node.symbols.size()
if node.statements:
size += max([self.visit(statement) for statement in node.statements])
return size
class CalleeStackSize(StackSize):
def visitFunctionNode(self, node):
return StackSize().visit(node.body)
def visitMethodNode(self, node):
return StackSize().visit(node.body)
class RegoffAddr(collections.namedtuple('RegoffAddr', ['reg', 'offset', 'type'])):
def __str__(self):
return '[%s%s%s]%s' % (Opcodes.register_name(self.reg), '+' if self.offset >= 0 else '', self.offset, 'i' if self.type == Opcodes.ADDR_VALTYPE_INT else 'f')
class RegAddr(collections.namedtuple('RegAddr', ['reg'])):
def __str__(self):
return Opcodes.register_name(self.reg)
class ConstAddr:
def __init__(self, value):
self._value = value
def __str__(self):
return str(self._value)
def type(self):
return 'float' if isinstance(self._value, float) else 'int'
def value(self):
return self._value
class AddressGenerator:
def __init__(self):
self._offset = 0
def addArg(self, arg):
self._offset += arg.var.type().size
def resetArgs(self):
self._offset = 0
def generate(self, symbols, value):
return getattr(self, 'generate%s' % value.__class__.__name__)(symbols, value)
def generateConst(self, symbols, const): # pylint: disable=W0613
return ConstAddr(const.value)
def generateTempVar(self, symbols, var):
return self._generateVar(symbols, var)
def generateVariableNode(self, symbols, var):
return self._generateVar(symbols, var)
def generateRetval(self, symbols, var): # pylint: disable=W0613
# Caller context
return RegoffAddr(Opcodes.REGINDEX_SP, var.function.argsize(), Opcodes.type_value(var.function.rettype.name))
def generateMember(self, symbols, var):
reg, offset, _ = self._generateVar(symbols, var.root)
root = var.root.type()
for field in var.fields:
offset += root.symbols.offset(field)
root = root.memberType(field)
return RegoffAddr(reg, offset, Opcodes.type_value(root.name))
def generateMemberNode(self, symbols, var):
return self._generateVar(symbols, var)
def generateArgumentNode(self, symbols, var):
return self._generateVar(symbols, var)
def generateBuiltinVariable(self, symbols, var): # pylint: disable=W0613
return RegAddr(Opcodes.register_index(var.name))
def _generateVar(self, symbols, var):
offset = 0
while True:
type_ = symbols.type()
if symbols.has(var.name, recurse=False):
if type_ == SymbolScope.GLOBAL:
reg, offset = Opcodes.REGINDEX_ZR, symbols.offset(var.name)
break
if type_ in (SymbolScope.LOCAL, SymbolScope.INHERITED):
offset -= symbols.size()
offset += symbols.offset(var.name)
offset -= self._offset
reg = Opcodes.REGINDEX_SP
break
if type_ == SymbolScope.THIS:
reg, offset = Opcodes.REGINDEX_TH, symbols.offset(var.name)
break
if type_ == SymbolScope.ARGS:
offset -= 2 # ret addr
# retval size is included in the symbol table size
offset -= symbols.size()
offset += symbols.offset(var.name)
offset -= self._offset
reg = Opcodes.REGINDEX_SP
break
else:
offset -= symbols.size()
symbols = symbols.parent()
return RegoffAddr(reg, offset, Opcodes.type_value(var.type().name))
class CodeGenerator:
def __init__(self):
self._gen = AddressGenerator()
self._instructions = []
def generate(self, ops):
for op in ops:
getattr(self, 'generate%s' % op.__class__.__name__)(op)
return self._instructions
def _generateBinary(self, cls, dst, src):
self._instructions.append(cls(dst, src))
def generateLineSpec(self, line):
pass
def generateLabel(self, label):
self._instructions.append(label)
def generateStateEnterLabel(self, label):
self.generateLabel(label)
size = label.state.symbols.size()
if size:
self._generateBinary(asm.Add, RegAddr(Opcodes.REGINDEX_SP), ConstAddr(size))
def generateCallableLabel(self, label):
self.generateLabel(label)
def generateCompoundStartLabel(self, label):
self.generateLabel(label)
size = label.symbols.size()
if size:
self._generateBinary(asm.Add, RegAddr(Opcodes.REGINDEX_SP), ConstAddr(size))
def generateCompoundEndLabel(self, label):
self.generateLabel(label)
size = label.symbols.size()
if size:
self._generateBinary(asm.Sub, RegAddr(Opcodes.REGINDEX_SP), ConstAddr(size))
def generateArgument(self, arg):
var = self._gen.generate(arg.symbols, arg.var)
self._instructions.append(asm.Push(var))
self._gen.addArg(arg)
def generateFunctionCall(self, call):
size = call.function.rettype.size
if size:
self._generateBinary(asm.Add, RegAddr(Opcodes.REGINDEX_SP), ConstAddr(size))
self._instructions.append(asm.Call(call.label))
size += call.function.type().argsize()
if size:
self._generateBinary(asm.Sub, RegAddr(Opcodes.REGINDEX_SP), ConstAddr(size))
self._gen.resetArgs()
def generateMethodCall(self, call):
size = call.method.rettype.size
if size:
self._generateBinary(asm.Add, RegAddr(Opcodes.REGINDEX_SP), ConstAddr(size))
self._instructions.append(asm.Push(RegAddr(Opcodes.REGINDEX_TH)))
addr = self._gen.generate(call.symbols, call.var)
if addr.reg == Opcodes.REGINDEX_ZR:
self._generateBinary(asm.Load, RegAddr(Opcodes.REGINDEX_TH), ConstAddr(addr.offset))
elif addr.reg == Opcodes.REGINDEX_SP:
self._generateBinary(asm.Load, RegAddr(Opcodes.REGINDEX_TH), RegAddr(Opcodes.REGINDEX_SP))
self._generateBinary(asm.Sub, RegAddr(Opcodes.REGINDEX_TH), ConstAddr((4 - addr.offset + size)))
elif addr.reg == Opcodes.REGINDEX_TH:
self._generateBinary(asm.Add, RegAddr(Opcodes.REGINDEX_TH), ConstAddr(addr.offset))
else:
raise RuntimeError('wat')
self._instructions.append(asm.Call(call.label))
self._instructions.append(asm.Pop(RegAddr(Opcodes.REGINDEX_TH)))
size += call.method.type().argsize()
if size:
self._generateBinary(asm.Sub, RegAddr(Opcodes.REGINDEX_SP), ConstAddr(size))
self._gen.resetArgs()
def generateAssignment(self, op):
self._generateBinary(asm.Load, self._gen.generate(op.symbols, op.dst), self._gen.generate(op.symbols, op.src))
def generateReturn(self, op):
size = 0
symbols = op.symbols
while symbols.type() != SymbolScope.ARGS:
size += symbols.size()
symbols = symbols.parent()
if op.var is not None:
dst = RegoffAddr(Opcodes.REGINDEX_SP, -(2 + op.var.type().size + op.func.type().savesize() + size), Opcodes.type_value(op.var.type().name))
src = self._gen.generate(op.symbols, op.var)
self._generateBinary(asm.Load, dst, src)
if size:
self._generateBinary(asm.Sub, RegAddr(Opcodes.REGINDEX_SP), ConstAddr(size))
self._instructions.append(asm.Ret())
def generateYield(self, op): # pylint: disable=W0613
self._instructions.append(asm.Yield())
def generateJump(self, op):
self._instructions.append(asm.Jump(op.label))
def generateUnaryOp(self, op):
dst = self._gen.generate(op.symbols, op.dst)
if op.op in ('casti', 'castf'):
self._generateBinary(asm.Cast, dst, self._gen.generate(op.symbols, op.op1))
else:
self._generateBinary(asm.Load, dst, self._gen.generate(op.symbols, op.op1))
if op.op == '-':
self._instructions.append(asm.Neg(dst))
elif op.op == '!':
self._instructions.append(asm.Not(dst))
else:
raise RuntimeError(op.op)
def generateBinaryOp(self, op):
cmd = {
'+': asm.Add,
'-': asm.Sub,
'*': asm.Mul,
'/': asm.Div,
'<': asm.CLT,
'>': asm.CGT,
'<=': asm.CLTE,
'>=': asm.CGTE,
'==': asm.CE,
'!=': asm.CN,
'&&': asm.And,
'||': asm.Or,
}[op.op]
dst = self._gen.generate(op.symbols, op.dst)
op2 = self._gen.generate(op.symbols, op.op2)
if op.dst != op.op1:
op1 = self._gen.generate(op.symbols, op.op1)
self._generateBinary(asm.Load, dst, op1)
self._generateBinary(cmd, dst, op2)
def generateIfFalse(self, op):
cond = self._gen.generate(op.symbols, op.cond)
self._instructions.append(asm.JZ(cond, op.label))
def generateGo(self, op):
symbols = op.symbols
while symbols.type() != SymbolScope.GLOBAL:
symbols = symbols.parent()
self._generateBinary(asm.Load, RegAddr(Opcodes.REGINDEX_SP), ConstAddr(symbols.size()))
self._instructions.append(asm.Jump(op.label))
| 32.760753 | 164 | 0.615246 | 1,368 | 12,187 | 5.373538 | 0.157164 | 0.030472 | 0.049517 | 0.026527 | 0.466059 | 0.37029 | 0.326894 | 0.223235 | 0.168685 | 0.133315 | 0 | 0.005587 | 0.265693 | 12,187 | 371 | 165 | 32.849057 | 0.815845 | 0.022237 | 0 | 0.332117 | 0 | 0 | 0.00899 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.244526 | false | 0.00365 | 0.021898 | 0.142336 | 0.452555 | 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 |
bf485c0b653566482e930758d9b601f3760c68ff | 260 | py | Python | tests/unit/api/v2/conftest.py | krasnoludkolo/wykop-sdk | c6d8d8d2569249f3e2ededc53c4afe604045a19a | [
"BSD-3-Clause"
] | 38 | 2015-02-07T00:57:10.000Z | 2021-11-01T13:55:29.000Z | tests/unit/api/v2/conftest.py | msinfo32/wykop-sdk | c6d8d8d2569249f3e2ededc53c4afe604045a19a | [
"BSD-3-Clause"
] | 8 | 2016-05-14T17:55:14.000Z | 2020-11-25T17:27:40.000Z | tests/unit/api/v2/conftest.py | msinfo32/wykop-sdk | c6d8d8d2569249f3e2ededc53c4afe604045a19a | [
"BSD-3-Clause"
] | 16 | 2015-03-28T17:57:39.000Z | 2020-11-24T10:44:27.000Z | import pytest
from wykop.api.v2.clients import WykopAPIv2
@pytest.fixture
def wykop_api_v2():
return WykopAPIv2(
'sentinel.appkey',
'sentinel.secretkey',
output='sentinel.output',
response_format='sentinel.format',
)
| 18.571429 | 43 | 0.665385 | 28 | 260 | 6.071429 | 0.607143 | 0.094118 | 0.117647 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019901 | 0.226923 | 260 | 13 | 44 | 20 | 0.825871 | 0 | 0 | 0 | 0 | 0 | 0.242308 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | true | 0 | 0.2 | 0.1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
bf4c25a8c618372c640f68a0503359bcaf606a5e | 307 | py | Python | Python/LeetCode/1431. Kids With the Greatest Number of Candies.py | devMEremenko/Coding-Challenges | 803b1dfe00afb6a9e9651db02f9a223cb2f1bd64 | [
"MIT"
] | 10 | 2019-07-19T06:17:50.000Z | 2022-01-08T03:00:00.000Z | Python/LeetCode/1431. Kids With the Greatest Number of Candies.py | devMEremenko/LeetCode | 803b1dfe00afb6a9e9651db02f9a223cb2f1bd64 | [
"MIT"
] | null | null | null | Python/LeetCode/1431. Kids With the Greatest Number of Candies.py | devMEremenko/LeetCode | 803b1dfe00afb6a9e9651db02f9a223cb2f1bd64 | [
"MIT"
] | 1 | 2019-04-11T10:33:50.000Z | 2019-04-11T10:33:50.000Z | # https://leetcode.com/problems/kids-with-the-greatest-number-of-candies/submissions/
class Solution:
def kidsWithCandies(self, candies: [int], extraCandies: int) -> [bool]:
maxCandies = max(candies, default=0)
return [True if v + extraCandies >= maxCandies else False for v in candies] | 51.166667 | 85 | 0.710098 | 39 | 307 | 5.589744 | 0.820513 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003891 | 0.162866 | 307 | 6 | 86 | 51.166667 | 0.844358 | 0.270358 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
bf5317195d2e6e90d2f6e71272f2c52b3d4b8d6c | 1,334 | py | Python | src/snakeoil/compatibility.py | Arusekk/snakeoil | aad28a50118223766e5308452b369f2c72b971b2 | [
"BSD-3-Clause"
] | null | null | null | src/snakeoil/compatibility.py | Arusekk/snakeoil | aad28a50118223766e5308452b369f2c72b971b2 | [
"BSD-3-Clause"
] | null | null | null | src/snakeoil/compatibility.py | Arusekk/snakeoil | aad28a50118223766e5308452b369f2c72b971b2 | [
"BSD-3-Clause"
] | null | null | null | """
Compatibility functionality stubs
"""
__all__ = ("cmp", "sorted_cmp", "sort_cmp")
import sys
def sorted_key_from_cmp(cmp_func, key_func=None):
class _key_proxy:
__slots__ = ('_obj',)
if key_func: # done this way for speed reasons.
def __init__(self, obj, key_convert=key_func):
self._obj = key_convert(obj)
else:
def __init__(self, obj):
self._obj = obj
def __lt__(self, other, _cmp_func=cmp_func):
return _cmp_func(self._obj, other._obj) < 0
return _key_proxy
# yes this is heinous. this is what they recommended in the python
# docs for porting however...
def _raw_cmp(a, b):
return (a > b) - (a < b)
def cmp(obj1, obj2, raw_cmp=_raw_cmp):
if obj1 is None:
if obj2 is None:
return 0
return -1
elif obj2 is None:
return 1
return raw_cmp(obj1, obj2)
def sorted_cmp(sequence, func, key=None, reverse=False):
return sorted(sequence, reverse=reverse,
key=sorted_key_from_cmp(func, key_func=key))
def sort_cmp(list_inst, func, key=None, reverse=False):
list_inst.sort(reverse=reverse,
key=sorted_key_from_cmp(func, key_func=key))
IGNORED_EXCEPTIONS = (RuntimeError, MemoryError, SystemExit, KeyboardInterrupt)
| 24.254545 | 79 | 0.633433 | 185 | 1,334 | 4.221622 | 0.340541 | 0.06274 | 0.049936 | 0.06146 | 0.179257 | 0.120359 | 0.120359 | 0.120359 | 0.120359 | 0.120359 | 0 | 0.011247 | 0.266867 | 1,334 | 54 | 80 | 24.703704 | 0.787321 | 0.12069 | 0 | 0.064516 | 0 | 0 | 0.021496 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.258065 | false | 0 | 0.032258 | 0.096774 | 0.612903 | 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 |
bf5d160eb2dbcba8b5ea7946c86b46a885790cbd | 516 | py | Python | tests/metrics/test_abstract.py | craftslab/metalmetrics | 75653f29a3dcffefe317e70f1e068f709a9b7023 | [
"Apache-2.0"
] | null | null | null | tests/metrics/test_abstract.py | craftslab/metalmetrics | 75653f29a3dcffefe317e70f1e068f709a9b7023 | [
"Apache-2.0"
] | null | null | null | tests/metrics/test_abstract.py | craftslab/metalmetrics | 75653f29a3dcffefe317e70f1e068f709a9b7023 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from metalmetrics.config.config import Config
from metalmetrics.metrics.abstract import MetricsAbstract
from metalmetrics.proto.proto import Format
def test_metricsabstract():
class MetricsTest(MetricsAbstract):
def __init__(self, config):
super().__init__(config)
def _execution(self, _):
return {Format.CPU: "1 CPU"}
config = Config()
metrics = MetricsTest(config)
result = metrics.run(Format.CPU)
assert result is not None
| 24.571429 | 57 | 0.684109 | 57 | 516 | 6 | 0.508772 | 0.140351 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004951 | 0.217054 | 516 | 20 | 58 | 25.8 | 0.841584 | 0.040698 | 0 | 0 | 0 | 0 | 0.010142 | 0 | 0 | 0 | 0 | 0 | 0.076923 | 1 | 0.230769 | false | 0 | 0.230769 | 0.076923 | 0.615385 | 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 |
bf9eecc090923fda5826602246552ad8bd522c24 | 110 | py | Python | test/account/models.py | rishikumar/django_test_model | 72c9fe41795da85d5e113f81e7705fc76439cd4e | [
"BSD-3-Clause"
] | null | null | null | test/account/models.py | rishikumar/django_test_model | 72c9fe41795da85d5e113f81e7705fc76439cd4e | [
"BSD-3-Clause"
] | null | null | null | test/account/models.py | rishikumar/django_test_model | 72c9fe41795da85d5e113f81e7705fc76439cd4e | [
"BSD-3-Clause"
] | null | null | null | from django.db import models
class Account(models.Model):
class Meta:
db_table = 'test_account'
| 15.714286 | 33 | 0.690909 | 15 | 110 | 4.933333 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.227273 | 110 | 6 | 34 | 18.333333 | 0.870588 | 0 | 0 | 0 | 0 | 0 | 0.109091 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.75 | 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 |
bfa1c8a0788d4c7743e43b3d83f9ff75a73fbaa8 | 1,139 | py | Python | tests/ldap_tools/test_audit.py | ultramathman/ldap_tools | 3d80080c65b1ed8ef442e8a7115d666eb78eef7e | [
"MIT"
] | 1 | 2018-11-29T07:59:40.000Z | 2018-11-29T07:59:40.000Z | tests/ldap_tools/test_audit.py | ultramathman/ldap_tools | 3d80080c65b1ed8ef442e8a7115d666eb78eef7e | [
"MIT"
] | 4 | 2020-03-24T15:44:30.000Z | 2021-11-29T19:56:55.000Z | tests/ldap_tools/test_audit.py | ultramathman/ldap_tools | 3d80080c65b1ed8ef442e8a7115d666eb78eef7e | [
"MIT"
] | 3 | 2020-09-25T18:52:35.000Z | 2021-03-05T00:27:50.000Z | from click.testing import CliRunner
from pytest_mock import mocker # noqa: F401
import ldap_tools
from ldap_tools.audit import CLI as AuditCli
def describe_audit():
def describe_commandline_operations():
runner = CliRunner()
def it_lists_groups_by_user(mocker): # noqa: F811
mocker.patch('ldap_tools.audit.API.by_user', return_value=None)
mocker.patch(
'ldap_tools.client.Client.prepare_connection',
return_value=None)
runner.invoke(AuditCli.audit, ['by_user'])
ldap_tools.audit.API.by_user.assert_called_once_with()
def it_lists_users_by_group(mocker): # noqa: F811
mocker.patch('ldap_tools.audit.API.by_group', return_value=None)
mocker.patch(
'ldap_tools.client.Client.prepare_connection',
return_value=None)
runner.invoke(AuditCli.audit, ['by_group'])
ldap_tools.audit.API.by_group.assert_called_once_with()
def describe_api_calls():
pass # no testable methods implemented
def describe_utility_methods():
pass
| 32.542857 | 76 | 0.65935 | 140 | 1,139 | 5.064286 | 0.35 | 0.101551 | 0.098731 | 0.112835 | 0.566996 | 0.502116 | 0.423131 | 0.423131 | 0.423131 | 0.423131 | 0 | 0.010576 | 0.252853 | 1,139 | 34 | 77 | 33.5 | 0.822562 | 0.05619 | 0 | 0.32 | 0 | 0 | 0.147664 | 0.133645 | 0 | 0 | 0 | 0 | 0.08 | 1 | 0.24 | false | 0.08 | 0.16 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
bfa9d8d199b035f23a01c918fcf96d442c235763 | 928 | py | Python | Projects/Amazone_scrapper/Amazone_scrapper/items.py | imsamy-d/Web_Scraping | 23b6472bb11f3ecd4897526a0ca52cb23401f325 | [
"Unlicense"
] | null | null | null | Projects/Amazone_scrapper/Amazone_scrapper/items.py | imsamy-d/Web_Scraping | 23b6472bb11f3ecd4897526a0ca52cb23401f325 | [
"Unlicense"
] | null | null | null | Projects/Amazone_scrapper/Amazone_scrapper/items.py | imsamy-d/Web_Scraping | 23b6472bb11f3ecd4897526a0ca52cb23401f325 | [
"Unlicense"
] | null | null | null | # Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
from itemloaders.processors import MapCompose, TakeFirst
def get_price(price):
return price[1:]
def get_cur(price):
return price[0]
class AmazoneScrapperItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
name = scrapy.Field(
output_processor = TakeFirst()
)
price = scrapy.Field(
input_processor = MapCompose(get_price),
output_processor = TakeFirst()
)
curruncy = scrapy.Field(
input_processor = MapCompose(get_cur),
output_processor = TakeFirst()
)
rating = scrapy.Field(
output_processor = TakeFirst()
)
riviews = scrapy.Field(
output_processor = TakeFirst()
)
image = scrapy.Field(
output_processor = TakeFirst()
) | 25.777778 | 56 | 0.662716 | 103 | 928 | 5.854369 | 0.446602 | 0.127695 | 0.238806 | 0.172471 | 0.358209 | 0.126036 | 0 | 0 | 0 | 0 | 0 | 0.002841 | 0.241379 | 928 | 36 | 57 | 25.777778 | 0.853693 | 0.198276 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.074074 | false | 0 | 0.074074 | 0.074074 | 0.481481 | 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 |
bfc7988628f29de1c161fef3ffc52726e325f668 | 962 | py | Python | tests/test_products/test_products_views.py | Anton7177/product_optimizer | 1b1ceb32ac4881adda5f0902748b20159090fe0e | [
"MIT"
] | null | null | null | tests/test_products/test_products_views.py | Anton7177/product_optimizer | 1b1ceb32ac4881adda5f0902748b20159090fe0e | [
"MIT"
] | 1 | 2021-07-05T13:42:19.000Z | 2021-07-05T14:14:44.000Z | tests/test_products/test_products_views.py | Anton7177/product_optimizer | 1b1ceb32ac4881adda5f0902748b20159090fe0e | [
"MIT"
] | null | null | null | from flask.testing import FlaskClient
from project.products.crud import create_product
from project.products.models import Product
def test_products_endpoint(client: FlaskClient):
assert len(client.db.query(Product).all()) == 0
create_product(
client.db,
name='test',
link_photo='link',
price=100,
description='test desc',
category='test-category',
)
res = client.get('/api/products/')
assert res.status_code == 200
assert len(res.get_json()) == 1
def test_products_endpoint2(client: FlaskClient):
assert len(client.db.query(Product).all()) == 0
create_product(
client.db,
name='test',
link_photo='link',
price=100,
description='test desc',
category='test-category',
)
res = client.get('/api/products/')
assert res.status_code == 200
assert len(res.get_json()) == 1
#написать тест работы фильтров check filter | 27.485714 | 51 | 0.642412 | 118 | 962 | 5.127119 | 0.372881 | 0.059504 | 0.06281 | 0.08595 | 0.67438 | 0.67438 | 0.67438 | 0.67438 | 0.67438 | 0.67438 | 0 | 0.023035 | 0.232848 | 962 | 35 | 52 | 27.485714 | 0.796748 | 0.043659 | 0 | 0.758621 | 0 | 0 | 0.095652 | 0 | 0 | 0 | 0 | 0 | 0.206897 | 1 | 0.068966 | false | 0 | 0.103448 | 0 | 0.172414 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
bfd5c4531091a7fe976d10d4c9f95460ed1b61ad | 2,792 | py | Python | base/006-functions.py | balam909/python | e29041ff6771c0a6be77f5e8cb772cd69fd39f4c | [
"CC0-1.0"
] | null | null | null | base/006-functions.py | balam909/python | e29041ff6771c0a6be77f5e8cb772cd69fd39f4c | [
"CC0-1.0"
] | null | null | null | base/006-functions.py | balam909/python | e29041ff6771c0a6be77f5e8cb772cd69fd39f4c | [
"CC0-1.0"
] | null | null | null | print("To define a new function, you use 'def+<your_function_name>+(+<your_params_comma_separated>+)', example: 'def myFunction(param1, param2, ..., paramn)'")
# Creating a simple function and calling it
print("Creating simple function and calling it")
def sayHello(name):
print("Hello",name)
sayHello("balam909")
# Defining a simple function with default params
print("Creating a simple function with default params")
def giveMeTwoNumbersAndAText(number1, number2, myText="This is my default text"):
print("number1:",number1,"number2:",number2,"myText:",myText)
print("This function receive 3 parameters, if we have 'default values' defined, we can call this function without send the parameter(s) that has a default value asigned")
print("The function 'giveMeTwoNumbersAndAText' has 2 parameters with non default value and 1 parameter with a default value")
print("The function looks like this: 'giveMeTwoNumbersAndAText(number1, number2, myText=\"This is my default text\")'")
print("This is a call with the 3 parameters: giveMeTwoNumbersAndAText(1,2,\"Look at this awesome value\")")
giveMeTwoNumbersAndAText(1,2,"Look at this awesome value")
print("This is a call with 2 parameters: giveMeTwoNumbersAndAText(1,2)")
giveMeTwoNumbersAndAText(1,2)
print("If you do not have a default value for a param, you can not call the function without it")
print("For example: 'giveMeTwoNumbersAndAText(1)' will result in an error")
print("The default value is evaluated only once, when we define the function, so it not possible to change it arround the execution")
print("In python we can follow the argument order, or we can add the 'key,value' pair")
print("A valid example could be giveMeTwoNumbersAndAText(1, myText=\"Some Text\", number2=10)")
giveMeTwoNumbersAndAText(1, myText="Some Text", number2=10)
print("Once we use the 'key/value' definition, we have to use the 'key/value' for the next elements, an invalid call for this case looks like this: giveMeTwoNumbersAndAText(1, myText=\"Some Text\", 10)")
# Defining a function receiving pocitional arguments
print("Defining a function receiving pocitional arguments")
def sayAbunchOfWords(*args):
for arg in args:
print(arg)
print("A call with cero arg")
sayAbunchOfWords()
print("A call with one arg")
sayAbunchOfWords("one")
print("A call with two args")
sayAbunchOfWords("one","two")
print("A call with three arg")
sayAbunchOfWords("one","two","three")
# Defining a function receiving a dictionary
print("Defining a function receiving a dictionary")
def printMyDictionary(**myDictionary):
for key in myDictionary.keys():
print("The key:",key+"_k",",","The value:",myDictionary[key]+"_v")
print("This is the function call with a dictionary as an input")
printMyDictionary(param1="param1", param2="param2", param3="param3")
| 52.679245 | 203 | 0.765759 | 406 | 2,792 | 5.248768 | 0.295567 | 0.093853 | 0.02534 | 0.048803 | 0.32473 | 0.277335 | 0.153918 | 0.108869 | 0.06382 | 0.06382 | 0 | 0.017945 | 0.121777 | 2,792 | 52 | 204 | 53.692308 | 0.851142 | 0.065186 | 0 | 0 | 0 | 0.1 | 0.661036 | 0.10096 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0 | 0 | 0.1 | 0.675 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
bfd943f11ed2de81acd53c26c035bfe0b8593d1c | 600 | py | Python | backend/models.py | soumyabishi/hello-vue-django | 342d8440727d23018e07e3992cd0794359ac93dc | [
"Unlicense"
] | 1 | 2018-03-14T11:44:37.000Z | 2018-03-14T11:44:37.000Z | backend/models.py | soumyabishi/movie-quotes | 342d8440727d23018e07e3992cd0794359ac93dc | [
"Unlicense"
] | 1 | 2018-04-23T11:40:16.000Z | 2018-04-23T11:40:16.000Z | backend/models.py | soumyabishi/movie-quotes | 342d8440727d23018e07e3992cd0794359ac93dc | [
"Unlicense"
] | null | null | null | from __future__ import unicode_literals
from django.db import models
class Tag(models.Model):
name = models.CharField(max_length=128)
dialogues = models.ManyToManyField('Dialogues')
class Dialogues(models.Model):
dialogue = models.TextField()
movie_name = models.CharField(max_length=128)
star = models.CharField(max_length=128)
movie_year = models.IntegerField(default=1950)
poster = models.TextField()
class Emotion(models.Model):
dialogue = models.ForeignKey("Dialogues")
mood = models.CharField(max_length=128)
count = models.IntegerField(default=1)
| 27.272727 | 51 | 0.745 | 72 | 600 | 6.055556 | 0.444444 | 0.137615 | 0.165138 | 0.220183 | 0.266055 | 0.142202 | 0 | 0 | 0 | 0 | 0 | 0.033333 | 0.15 | 600 | 21 | 52 | 28.571429 | 0.821569 | 0 | 0 | 0 | 0 | 0 | 0.03 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.133333 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
44aae40bb6a228feca7b5d38f9be0c7111e53645 | 134 | py | Python | src/projects/tests/factories/cluster_settings.py | unikubehq/projects | 0df69eafa2a0d2664a22c7a5866d4512ac4d57fe | [
"Apache-2.0"
] | 1 | 2021-10-05T13:17:03.000Z | 2021-10-05T13:17:03.000Z | src/projects/tests/factories/cluster_settings.py | unikubehq/projects | 0df69eafa2a0d2664a22c7a5866d4512ac4d57fe | [
"Apache-2.0"
] | 48 | 2021-07-06T07:24:36.000Z | 2022-03-24T08:27:30.000Z | src/projects/tests/factories/cluster_settings.py | unikubehq/projects | 0df69eafa2a0d2664a22c7a5866d4512ac4d57fe | [
"Apache-2.0"
] | null | null | null | import factory
class ClusterSettingsFactory(factory.DjangoModelFactory):
class Meta:
model = "projects.ClusterSettings"
| 19.142857 | 57 | 0.761194 | 11 | 134 | 9.272727 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.171642 | 134 | 6 | 58 | 22.333333 | 0.918919 | 0 | 0 | 0 | 0 | 0 | 0.179104 | 0.179104 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.75 | 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 |
44c5596149534273225bcb9cf874bfe9b3cf1bf4 | 276 | py | Python | python/candy.py | Surya-06/My-Solutions | 58f7c7f1a0a3a28f25eff22d03a09cb2fbcf7806 | [
"MIT"
] | null | null | null | python/candy.py | Surya-06/My-Solutions | 58f7c7f1a0a3a28f25eff22d03a09cb2fbcf7806 | [
"MIT"
] | null | null | null | python/candy.py | Surya-06/My-Solutions | 58f7c7f1a0a3a28f25eff22d03a09cb2fbcf7806 | [
"MIT"
] | null | null | null | size = int(raw_input())
a=[int(x) for x in raw_input().split()]
f=[]
f[0]=1
for i in range(1,size):
if a[i]>a[i-1]:
f[i]=f[i-1]+1
else:
f[i]=1
for i in range(size,1,-1):
if a[i]>a[i-1]:
f[i]=f[i-1]+1
else:
f[i]=i
print sum(f)
| 15.333333 | 39 | 0.460145 | 65 | 276 | 1.923077 | 0.276923 | 0.096 | 0.072 | 0.112 | 0.496 | 0.304 | 0.304 | 0.304 | 0.304 | 0.304 | 0 | 0.061224 | 0.289855 | 276 | 17 | 40 | 16.235294 | 0.576531 | 0 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.066667 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
44ca0b5ba00ce231cdea5eb1645c326db975c7cd | 121 | py | Python | project_template/settings/grappelli.py | titovanton/bicycle-factory | a99eceb26ad504d52d16f552526d8c1320c5ebb2 | [
"Apache-1.1"
] | null | null | null | project_template/settings/grappelli.py | titovanton/bicycle-factory | a99eceb26ad504d52d16f552526d8c1320c5ebb2 | [
"Apache-1.1"
] | null | null | null | project_template/settings/grappelli.py | titovanton/bicycle-factory | a99eceb26ad504d52d16f552526d8c1320c5ebb2 | [
"Apache-1.1"
] | null | null | null | # -*- coding: utf-8 -*-
GRAPPELLI_INDEX_DASHBOARD = 'dashboard.CustomIndexDashboard'
GRAPPELLI_ADMIN_TITLE = u'Админка'
| 24.2 | 60 | 0.768595 | 13 | 121 | 6.846154 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009174 | 0.099174 | 121 | 4 | 61 | 30.25 | 0.807339 | 0.173554 | 0 | 0 | 0 | 0 | 0.377551 | 0.306122 | 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 |
44f246aa287b69c2afee8334edf7577e297193f6 | 642 | py | Python | Algorithms/DynamicProgramming/longest-common-substring-space-optimized-dp-solution.py | Sangeerththan/pythonDSA | d126b3a7a8acc1e202107e20a21ed96fb4ab144e | [
"MIT"
] | 1 | 2021-09-12T20:40:37.000Z | 2021-09-12T20:40:37.000Z | Algorithms/DynamicProgramming/longest-common-substring-space-optimized-dp-solution.py | Sangeerththan/pythonDataStructure | d126b3a7a8acc1e202107e20a21ed96fb4ab144e | [
"MIT"
] | null | null | null | Algorithms/DynamicProgramming/longest-common-substring-space-optimized-dp-solution.py | Sangeerththan/pythonDataStructure | d126b3a7a8acc1e202107e20a21ed96fb4ab144e | [
"MIT"
] | null | null | null | import numpy as np
def LCSubStr(X, Y):
m = len(X)
n = len(Y)
result = 0
len_mat = np.zeros((2, n))
currRow = 0
for i in range(m):
for j in range(n):
if i == 0 | j == 0:
len_mat[currRow][j] = 0
elif (X[i - 1] == Y[j - 1]):
len_mat[currRow][j] = len_mat[1 - currRow][j - 1] + 1
result = max(result, len_mat[currRow][j])
else:
len_mat[currRow][j] = 0
currRow = 1 - currRow
return result
# Driver Code
if __name__ == "__main__":
X = "Teststring"
Y = "Tests"
print(LCSubStr(X, Y))
| 18.882353 | 69 | 0.459502 | 93 | 642 | 3.021505 | 0.376344 | 0.128114 | 0.185053 | 0.199288 | 0.106762 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033592 | 0.397196 | 642 | 33 | 70 | 19.454545 | 0.692506 | 0.017134 | 0 | 0.090909 | 0 | 0 | 0.036566 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.045455 | false | 0 | 0.045455 | 0 | 0.136364 | 0.045455 | 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 |
44f6ca06fcaa1ada9acc3a29707d19413f4da87d | 351 | py | Python | src/models/user.py | zebraxxl/micro-pass | dc2242cc98742890d163b7359b2fbdf63d1dcdc4 | [
"MIT"
] | null | null | null | src/models/user.py | zebraxxl/micro-pass | dc2242cc98742890d163b7359b2fbdf63d1dcdc4 | [
"MIT"
] | null | null | null | src/models/user.py | zebraxxl/micro-pass | dc2242cc98742890d163b7359b2fbdf63d1dcdc4 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from peewee import *
from src.models import BaseModel, BigSerialField
__author__ = "zebraxxl"
class User(BaseModel):
id = BigSerialField(primary_key=True, index=True)
login = CharField(index=True, unique=True)
password = CharField()
private_data = TextField()
class Meta:
db_table = "mp_users"
| 20.647059 | 53 | 0.683761 | 41 | 351 | 5.658537 | 0.756098 | 0.077586 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003571 | 0.202279 | 351 | 16 | 54 | 21.9375 | 0.825 | 0.059829 | 0 | 0 | 0 | 0 | 0.04878 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.1 | 0.2 | 0 | 0.8 | 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 |
44fda3dba3598c95681fdf6d36b004d283a3013c | 1,511 | py | Python | tests/schema/types/test_number.py | dkraczkowski/opyapi | 93f9ca4a39ec3dc0622e3248b96f2efad8323827 | [
"MIT"
] | 5 | 2019-06-05T19:06:56.000Z | 2020-05-02T07:57:51.000Z | tests/schema/types/test_number.py | dkraczkowski/opyapi | 93f9ca4a39ec3dc0622e3248b96f2efad8323827 | [
"MIT"
] | 12 | 2019-06-05T19:34:09.000Z | 2019-09-08T18:50:48.000Z | tests/schema/types/test_number.py | dkraczkowski/opyapi | 93f9ca4a39ec3dc0622e3248b96f2efad8323827 | [
"MIT"
] | 1 | 2019-06-05T20:03:26.000Z | 2019-06-05T20:03:26.000Z | import pytest
from opyapi.schema.errors import ValidationError
from opyapi.schema.types import Number
def test_can_instantiate():
schema = Number()
assert schema.validate(10.12) is None
@pytest.mark.parametrize("value", (None, "", "10", False, True))
def test_validation_fail(value):
with pytest.raises(ValidationError):
Number().validate(value)
@pytest.mark.parametrize("value", (0, 1, -1, 2.13, 200000, 2j + 10))
def test_validation_pass(value):
assert Number().validate(value) is None
@pytest.mark.parametrize("multiplication,value", ((2, 8), (3, 6), (1, 21), (-2, -8)))
def test_pass_multiple_of(multiplication, value):
assert Number(multiple_of=multiplication).validate(value) is None
@pytest.mark.parametrize("multiplication,value", ((2, 7), (3, 4), (-2, 9)))
def test_fail_multiple_of(multiplication, value):
with pytest.raises(ValidationError):
Number(multiple_of=multiplication).validate(value)
@pytest.mark.parametrize(
"min,max,value",
((2, 8.1, 8.01), (3, None, 6), (None, 21.1, 21), (-2, 0, -1), (2, 4, 3)),
)
def test_pass_range(min, max, value):
assert Number(minimum=min, maximum=max).validate(value) is None
@pytest.mark.parametrize(
"min,max,value", ((2, 10, 1), (3, None, 2), (None, 21, 22), (-2, 0, 1))
)
def test_fail_range(min, max, value):
with pytest.raises(ValidationError):
Number(minimum=min, maximum=max).validate(value)
def test_nullable():
assert Number(nullable=True).validate(None) is None
| 29.057692 | 85 | 0.684315 | 215 | 1,511 | 4.72093 | 0.246512 | 0.055172 | 0.124138 | 0.063054 | 0.510345 | 0.450246 | 0.26601 | 0.118227 | 0.118227 | 0.118227 | 0 | 0.052632 | 0.144937 | 1,511 | 51 | 86 | 29.627451 | 0.732972 | 0 | 0 | 0.147059 | 0 | 0 | 0.051621 | 0 | 0 | 0 | 0 | 0 | 0.147059 | 1 | 0.235294 | false | 0.088235 | 0.088235 | 0 | 0.323529 | 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 |
7805ffb301635212f04ba11946965bbdf54add13 | 248 | py | Python | module01/ex/ex034.py | LauroHBrant/python-course | 2154181ca4b684b0d1fa635706bcb1647a753bc3 | [
"MIT"
] | 2 | 2021-01-07T23:59:36.000Z | 2021-01-18T00:23:52.000Z | module01/ex/ex034.py | LauroHBrant/python-course | 2154181ca4b684b0d1fa635706bcb1647a753bc3 | [
"MIT"
] | null | null | null | module01/ex/ex034.py | LauroHBrant/python-course | 2154181ca4b684b0d1fa635706bcb1647a753bc3 | [
"MIT"
] | null | null | null | s = float(input('What is the salary of the functionary? $'))
if s > 1250.00:
t = s + s * 0.10
print(f'His salary increased by 10% and is now {t:.2f}')
else:
f = s + s * 0.15
print(f'His salary increased by 15% and is now {f:.2f}')
| 27.555556 | 60 | 0.584677 | 49 | 248 | 2.959184 | 0.510204 | 0.027586 | 0.041379 | 0.206897 | 0.358621 | 0.358621 | 0 | 0 | 0 | 0 | 0 | 0.097826 | 0.258065 | 248 | 8 | 61 | 31 | 0.690217 | 0 | 0 | 0 | 0 | 0 | 0.532258 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.285714 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
783f000755a787ea9f1df1f591601ce7c04cbc1c | 266 | py | Python | app/migrations/0015_merge_20190918_0550.py | ckr3453/knut_festival | 31d41107a30ba7fab28e43292f5c65c0ae2916af | [
"MIT"
] | 4 | 2019-09-04T12:38:35.000Z | 2019-09-24T14:56:52.000Z | app/migrations/0015_merge_20190918_0550.py | ckr3453/knut_festival | 31d41107a30ba7fab28e43292f5c65c0ae2916af | [
"MIT"
] | 13 | 2020-03-30T16:29:18.000Z | 2022-02-10T10:52:50.000Z | app/migrations/0015_merge_20190918_0550.py | ckr3453/knut_festival | 31d41107a30ba7fab28e43292f5c65c0ae2916af | [
"MIT"
] | 4 | 2019-09-10T02:05:37.000Z | 2019-11-04T06:56:58.000Z | # Generated by Django 2.2.5 on 2019-09-17 20:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0012_merge_20190918_0158'),
('app', '0014_auto_20190918_0404'),
]
operations = [
]
| 17.733333 | 47 | 0.639098 | 33 | 266 | 4.969697 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.231527 | 0.236842 | 266 | 14 | 48 | 19 | 0.576355 | 0.169173 | 0 | 0 | 1 | 0 | 0.242009 | 0.214612 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 |
784cb63c654694d9f05ff9379629830ebd896360 | 343 | py | Python | simulation/simulation/Config.py | salinsiim/petssa-simulation | 8f0f128d462831f86664bb8d246f2c7b659a0b8d | [
"MIT"
] | null | null | null | simulation/simulation/Config.py | salinsiim/petssa-simulation | 8f0f128d462831f86664bb8d246f2c7b659a0b8d | [
"MIT"
] | null | null | null | simulation/simulation/Config.py | salinsiim/petssa-simulation | 8f0f128d462831f86664bb8d246f2c7b659a0b8d | [
"MIT"
] | null | null | null | import dataclasses as dc
@dc.dataclass(unsafe_hash=True)
class Config:
phases: list
protection_phases: list
green_states: list
max_speed: int
tl_logic_id: str
intersection_name: str
logging_file: str
crossings: list = None
max_green: int = None
max_green_diff: int = None
is_priority: bool = True
| 20.176471 | 31 | 0.696793 | 48 | 343 | 4.729167 | 0.666667 | 0.088106 | 0.105727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.241983 | 343 | 16 | 32 | 21.4375 | 0.873077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.071429 | 0 | 0.928571 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
7851b618b704173fa8ce7e207cf180f4eb1406fb | 198 | py | Python | hfpy_code/chapter8/page272.py | leobarros/use_cabeca_python | 4e0897a68fb7ef669ec05eab7cba9412baa0e85e | [
"Apache-2.0"
] | 1 | 2016-04-01T04:31:52.000Z | 2016-04-01T04:31:52.000Z | hfpython_code/hfpy_code/chapter8/page272.py | tdean1995/HFPythonSandbox | dc72257e4353c5bca7a2c401d18587c6d799f9a1 | [
"Apache-2.0"
] | null | null | null | hfpython_code/hfpy_code/chapter8/page272.py | tdean1995/HFPythonSandbox | dc72257e4353c5bca7a2c401d18587c6d799f9a1 | [
"Apache-2.0"
] | 1 | 2020-06-02T17:47:22.000Z | 2020-06-02T17:47:22.000Z | #! /usr/local/bin/python3
import json
import athletemodel
import yate
names = athletemodel.get_names_from_store()
print(yate.start_response('application/json'))
print(json.dumps(sorted(names)))
| 16.5 | 46 | 0.787879 | 27 | 198 | 5.62963 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005525 | 0.085859 | 198 | 11 | 47 | 18 | 0.834254 | 0.121212 | 0 | 0 | 0 | 0 | 0.093023 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0.333333 | 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 |
7863a06b2d60459c72c5131b49133c264120c7d9 | 456 | py | Python | desafio 11.py | noudas/treinopython1 | 88379a2f1a564de518e33ea29df14f7ce65583d8 | [
"0BSD"
] | null | null | null | desafio 11.py | noudas/treinopython1 | 88379a2f1a564de518e33ea29df14f7ce65583d8 | [
"0BSD"
] | null | null | null | desafio 11.py | noudas/treinopython1 | 88379a2f1a564de518e33ea29df14f7ce65583d8 | [
"0BSD"
] | null | null | null | def main():
a = int(input("Insira a idade do nadador: "))
if(a <= 5):
print("Categoria: Bebe")
elif(a > 5 and a <= 7):
print("Categoria: Infantil A")
elif(a >= 8 and a <= 10):
print("Categoria: Infantil B")
elif(a >= 11 and a <= 13):
print("Categoria: Juvenil A")
elif(a >= 14 and a <= 17):
print("Categoria: Juvenil B")
else:
print("Categoria: Senior")
main()
| 25.333333 | 50 | 0.495614 | 61 | 456 | 3.704918 | 0.459016 | 0.371681 | 0.19469 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.046358 | 0.337719 | 456 | 17 | 51 | 26.823529 | 0.701987 | 0 | 0 | 0 | 0 | 0 | 0.321185 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0 | 0 | 0 | 0.066667 | 0.4 | 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 |
789dfd491ad5437b4022d2f1209156791b62dc27 | 980 | py | Python | htdfsdk/__init__.py | youngqqcn/htdfsdk | c22f213a967c8233bb6ccfb01bf148112efd44db | [
"MIT"
] | 2 | 2021-01-21T01:46:29.000Z | 2021-03-12T05:59:19.000Z | htdfsdk/__init__.py | youngqqcn/htdfsdk | c22f213a967c8233bb6ccfb01bf148112efd44db | [
"MIT"
] | null | null | null | htdfsdk/__init__.py | youngqqcn/htdfsdk | c22f213a967c8233bb6ccfb01bf148112efd44db | [
"MIT"
] | null | null | null | import sys
if sys.version_info < (3, 6):
raise EnvironmentError(
"Python 3.6 or above is required. ")
import htdfsdk.web3 as web3
from htdfsdk.htdfsdk import (
HtdfTxBuilder,
HtdfRPC,
Address,
HtdfPrivateKey,
ValidatorAddress,
HtdfDelegateTxBuilder,
HtdfWithdrawDelegateRewardsTxBuilder,
HtdfSetUndelegateStatusTxBuilder,
HtdfUndelegateTxBuilder,
HtdfEditValidatorInfoTxBuilder
)
from htdfsdk.contract import (
HtdfContract
)
from eth_utils import (
to_checksum_address,
remove_0x_prefix
)
from htdfsdk.utils import *
__all__ = [
'utils',
"HtdfRPC",
"HtdfTxBuilder",
"Address",
"HtdfPrivateKey",
"web3",
"HtdfContract",
"to_checksum_address",
"remove_0x_prefix",
"ValidatorAddress",
"HtdfDelegateTxBuilder",
"HtdfWithdrawDelegateRewardsTxBuilder",
"HtdfSetUndelegateStatusTxBuilder",
"HtdfUndelegateTxBuilder",
"HtdfEditValidatorInfoTxBuilder",
]
| 18.846154 | 44 | 0.709184 | 75 | 980 | 9.08 | 0.506667 | 0.048458 | 0.214391 | 0.30837 | 0.555066 | 0.555066 | 0 | 0 | 0 | 0 | 0 | 0.011598 | 0.208163 | 980 | 51 | 45 | 19.215686 | 0.865979 | 0 | 0 | 0 | 0 | 0 | 0.293878 | 0.144898 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 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 |
78bd532dad6a00c923cf3301ebadbb559486325b | 5,260 | py | Python | pf_circle.py | gautelinga/phasefield | c9ec661955f1dc884449c5cfbdbd2e803d3fabdd | [
"MIT"
] | null | null | null | pf_circle.py | gautelinga/phasefield | c9ec661955f1dc884449c5cfbdbd2e803d3fabdd | [
"MIT"
] | null | null | null | pf_circle.py | gautelinga/phasefield | c9ec661955f1dc884449c5cfbdbd2e803d3fabdd | [
"MIT"
] | null | null | null | import numpy as np
import dolfin as df
import mshr
from mpi4py import MPI
import math
def make_circle_mesh(R, res=40.):
domain = mshr.Circle(df.Point(0., 0.), 1.)
mesh = mshr.generate_mesh(domain, res)
mesh.coordinates()[:] *= R
return mesh
def dfdphi(phi, c, lamda):
return (1.-phi**2)*(phi-c*lamda)
def mag(x):
return df.sqrt(df.dot(x, x))
def comp_corr(p, P, V):
grad_p = df.project(df.grad(p), V)
mag_grad_p = mag(grad_p)
kappa = df.div(grad_p/mag_grad_p)
return df.project(kappa*mag_grad_p, P)
class Around(df.SubDomain):
def inside(self, x, on_boundary):
return on_boundary
class PhaseFieldEquation(df.NonlinearProblem):
def __init__(self, a, L):
df.NonlinearProblem.__init__(self)
self.L = L
self.a = a
def F(self, b, x):
df.assemble(self.L, tensor=b)
def J(self, A, x):
df.assemble(self.L, tensor=A)
def main():
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
# Form compiler options
df.parameters["form_compiler"]["optimize"] = True
df.parameters["form_compiler"]["cpp_optimize"] = True
df.set_log_level(df.WARNING)
ffc_options = {"optimize": True,
"eliminate_zeros": True,
"precompute_basis_const": True,
"precompute_ip_const": True}
res = 150.
R = 200.
R_0 = 6.
c_inf = 1.0
Pe_PF = 1.
# Da = 100.
T = 5000.
# lamda = Pe_PF / (5./3. + math.sqrt(2)/Da)
lamda = 3.*Pe_PF/5.
mesh = make_circle_mesh(R, res)
mesh.init()
h5f_mesh = df.HDF5File(mesh.mpi_comm(), "circle_mesh.h5", "w")
h5f_mesh.write(mesh, "mesh")
h5f_mesh.close()
P = df.FunctionSpace(mesh, "CG", 1)
V = df.VectorFunctionSpace(mesh, "CG", 1)
domains = df.CellFunction("size_t", mesh)
boundaries = df.FacetFunction("size_t", mesh)
around = Around()
boundaries.set_all(0)
around.mark(boundaries, 1)
bcs_phi = df.DirichletBC(P, df.Constant(1.), boundaries, 1)
bcs_c = df.DirichletBC(P, df.Constant(c_inf), boundaries, 1)
dx = df.Measure('dx', domain=mesh, subdomain_data=domains)
ds = df.Measure('ds', domain=mesh, subdomain_data=boundaries)
num_cells_in = np.array(float(mesh.num_entities(2)))
num_cells = np.zeros(1)
comm.Allreduce(num_cells_in, num_cells, op=MPI.SUM)
dt = 0.9*np.sqrt(np.pi*R**2/num_cells[0])
nt = int(T/dt)
if rank == 0:
print "dt =", dt
print "nt =", nt
phi_init = df.Expression("tanh((sqrt(x[0]*x[0]+x[1]*x[1]) - "
"R_0 + a*sin(n*atan2(x[0], x[1])))/delta)",
R_0=R_0,
delta=1.,
a=.0, n=6., degree=1)
phi_init = df.interpolate(phi_init, P)
# Define nonlinear variational problem
dphi = df.TrialFunction(P) #
phi = df.Function(P) # current solution
phi_0 = df.Function(P) # solution from previous step
q = df.TestFunction(P)
kappa = df.Function(P) # curvature, based on previous
kappa.vector()[:] = 0.
phi.interpolate(phi_init)
phi_0.interpolate(phi_init)
c_test = df.TestFunction(P)
c_trial = df.TrialFunction(P)
c_0 = df.Function(P)
c_0.vector()[:] = c_inf * 0.5*(phi_init.vector()[:]+1.)
c = df.Function(P)
c.interpolate(c_0)
# df.plot(c, interactive=True)
F = (Pe_PF*q*(phi - phi_0)/dt*dx
+ df.dot(df.grad(phi), df.grad(q))*dx
- q*(dfdphi(phi, lamda, c_0))*dx)
J = df.derivative(F, phi, dphi)
F_c = c_test*(c_trial-c_0)/dt*dx + \
df.dot(df.grad(c_trial), df.grad(c_test))*dx
a, L = df.lhs(F_c), df.rhs(F_c)
# df.solve(a == L, c, bcs_c)
# df.plot(c, interactive=True)
c_prob = df.LinearVariationalProblem(a, L, c, bcs_c)
c_solver = df.LinearVariationalSolver(c_prob)
# problem = PhaseFieldEquation(F, J)
# solver = df.NewtonSolver()
# solver.parameters["linear_solver"] = "lu"
# solver.parameters["convergence_criterion"] = "incremental"
# solver.parameters["relative_tolerance"] = 1e-6
progress = df.Progress("Time-steppin'")
# df.set_log_level(df.PROGRESS)
field_names = ["phi", "c", "corr"]
xf = dict()
for field in field_names:
xf[field] = df.XDMFFile(mesh.mpi_comm(), field + ".xdmf")
xf[field].parameters["rewrite_function_mesh"] = False
xf[field].parameters["flush_output"] = True
phi_corr = df.Function(P)
t = 0.
for it in xrange(nt):
if rank == 0:
print "Step", it
t += dt
c_0.vector()[:] = c.vector()
phi_0.vector()[:] = phi.vector()
df.solve(F == 0, phi, bcs_phi, J=J,
form_compiler_parameters=ffc_options)
phi_corr.assign(comp_corr(phi, P, V))
phi.vector()[:] -= phi_corr.vector()[:]*dt
c_solver.solve()
c.vector()[:] += (phi.vector()[:] - phi_0.vector()[:])/dt
if it % 10 == 0:
xf["phi"].write(phi, t)
xf["c"].write(c, t)
xf["corr"].write(phi_corr, t)
progress.update(t/T)
# df.plot(phi, title="phi", interactive=True)
if __name__ == "__main__":
main()
| 26.432161 | 72 | 0.577757 | 778 | 5,260 | 3.739075 | 0.255784 | 0.012032 | 0.022688 | 0.010313 | 0.09419 | 0.026126 | 0.011 | 0 | 0 | 0 | 0 | 0.022359 | 0.260266 | 5,260 | 198 | 73 | 26.565657 | 0.725263 | 0.105133 | 0 | 0.015385 | 1 | 0.007692 | 0.066126 | 0.015785 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.038462 | null | null | 0.023077 | 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 |
78bfce1582fec9ddba6cc7b1f4f125fe43bf245c | 220 | py | Python | main.py | IronManCool001/Fibonacci-Generator-Flask | 318f653618f51562fd6e8bb810791821b389c8ac | [
"MIT"
] | null | null | null | main.py | IronManCool001/Fibonacci-Generator-Flask | 318f653618f51562fd6e8bb810791821b389c8ac | [
"MIT"
] | null | null | null | main.py | IronManCool001/Fibonacci-Generator-Flask | 318f653618f51562fd6e8bb810791821b389c8ac | [
"MIT"
] | null | null | null | from app.server import app
import os
production = os.environ.get("PRODUCTION", False)
if __name__ == "__main__":
if production:
app.run(debug=True)
else:
app.run(debug=True,port="2020") | 22 | 49 | 0.631818 | 29 | 220 | 4.517241 | 0.62069 | 0.091603 | 0.167939 | 0.229008 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023952 | 0.240909 | 220 | 10 | 50 | 22 | 0.760479 | 0 | 0 | 0 | 0 | 0 | 0.103774 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 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 | 0 | 0 | 0 | 2 |
151f5d1151cf68886d1d8b0c697254e2e68e3dab | 867 | py | Python | app/schemas/fastapi_/exception.py | maxzhenzhera/my_vocab_backend | 2e9f968374e0bc2fcc0ae40830ca40f3cf5754d1 | [
"MIT"
] | null | null | null | app/schemas/fastapi_/exception.py | maxzhenzhera/my_vocab_backend | 2e9f968374e0bc2fcc0ae40830ca40f3cf5754d1 | [
"MIT"
] | null | null | null | app/schemas/fastapi_/exception.py | maxzhenzhera/my_vocab_backend | 2e9f968374e0bc2fcc0ae40830ca40f3cf5754d1 | [
"MIT"
] | null | null | null | """
Supposed to be used in routes' `responses`.
Class name is verbose and contains `Schema` ending
for some purposes:
- make reference to the real `HTTPException`;
- `Schema` as serialazable pydantic model.
Example:
.. code-block:: python
>>> from starlette.status import HTTP_400_BAD_REQUEST
>>>
>>> # `responses` as an argument to:
>>> # router.get(..., responses={...})
>>>
>>> responses = {
>>> HTTP_400_BAD_REQUEST: {
>>> 'model': HTTPExceptionSchema
>>> },
>>> ...
>>> }
Docs about this schema has been written on module level.
Not a schema (class) level beacuse this way
docs will be copied to the swagger.
"""
from pydantic import BaseModel
__all__ = ['HTTPExceptionSchema']
class HTTPExceptionSchema(BaseModel):
detail: str
| 22.815789 | 61 | 0.600923 | 92 | 867 | 5.554348 | 0.695652 | 0.019569 | 0.039139 | 0.066536 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009585 | 0.27797 | 867 | 37 | 62 | 23.432432 | 0.806709 | 0.845444 | 0 | 0 | 0 | 0 | 0.150794 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
152657f6a89b93d965b9035ca4efd2b4a27f734e | 560 | py | Python | Janken.py | sevenc-nanashi/Janken | b71631b20918560f79ddd0240c41b2e5654eba4e | [
"MIT"
] | 9 | 2022-01-13T15:13:56.000Z | 2022-03-22T05:20:35.000Z | Janken.py | sevenc-nanashi/Janken | b71631b20918560f79ddd0240c41b2e5654eba4e | [
"MIT"
] | 3 | 2022-01-14T04:23:51.000Z | 2022-01-18T10:00:15.000Z | Janken.py | sevenc-nanashi/Janken | b71631b20918560f79ddd0240c41b2e5654eba4e | [
"MIT"
] | 4 | 2022-01-13T11:52:08.000Z | 2022-01-14T04:23:57.000Z | import random
print("最初はグー、じゃんけん・・・")
You = input("あなた:")
Python = random.choice(["グー", "チョキ", "パー"])
print("あいて:" + Python)
if You == Python:
print("あいこです")
elif You == "グー" and Python == "チョキ":
print("あなたの勝ちです")
elif You == "グー" and Python == "パー":
print("あなたの負けです")
elif You == "チョキ" and Python == "グー":
print("あなたの負けです")
elif You == "チョキ" and Python == "パー":
print("あなたの勝ちです")
elif You == "パー" and Python == "グー":
print("あなたの勝ちです")
elif You == "パー" and Python == "チョキ":
print("あなたの負けです")
else:
print("正しいポーズを選んでください")
| 23.333333 | 43 | 0.576786 | 74 | 560 | 4.405405 | 0.310811 | 0.128834 | 0.156442 | 0.184049 | 0.496933 | 0.386503 | 0.386503 | 0 | 0 | 0 | 0 | 0 | 0.201786 | 560 | 23 | 44 | 24.347826 | 0.722595 | 0 | 0 | 0.285714 | 0 | 0 | 0.221429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.047619 | 0 | 0.047619 | 0.47619 | 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 | 0 | 1 | 0 | 2 |
152825ec28809b5d143e5284745ab2a1184a59b4 | 426 | py | Python | tests/validators_tests.py | dgarlitt/release_notes_generator | af0f95ba85882bce020edabe26b70e649d1c17fe | [
"MIT"
] | 2 | 2016-02-23T00:07:07.000Z | 2021-12-09T04:00:06.000Z | tests/validators_tests.py | dgarlitt/release_notes_generator | af0f95ba85882bce020edabe26b70e649d1c17fe | [
"MIT"
] | null | null | null | tests/validators_tests.py | dgarlitt/release_notes_generator | af0f95ba85882bce020edabe26b70e649d1c17fe | [
"MIT"
] | null | null | null | import mock
from nose.tools import eq_, assert_raises
from lib.validators import RegexValidator
import argparse
class TestRegexValidator:
def setup(self):
pattern = "1.2.3.4"
self.sut = RegexValidator(pattern)
def test_call_happy_path(self):
eq_("1.2.3.4", self.sut.__call__("1.2.3.4"))
def test_call_raises_error(self):
assert_raises(ValueError, self.sut.__call__, "a.b.c.d")
| 23.666667 | 63 | 0.690141 | 64 | 426 | 4.3125 | 0.515625 | 0.021739 | 0.032609 | 0.043478 | 0.07971 | 0.07971 | 0 | 0 | 0 | 0 | 0 | 0.034783 | 0.190141 | 426 | 17 | 64 | 25.058824 | 0.765217 | 0 | 0 | 0 | 0 | 0 | 0.065728 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0.25 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
152ff4ce3800da488d9ab754d1c356937568f4ae | 861 | py | Python | bitten/build/tests/dummy.py | dokipen/bitten | d4d2829c63eec84bcfab05ec7035a23e85d90c00 | [
"BSD-3-Clause"
] | 1 | 2016-08-28T03:13:03.000Z | 2016-08-28T03:13:03.000Z | bitten/build/tests/dummy.py | dokipen/bitten | d4d2829c63eec84bcfab05ec7035a23e85d90c00 | [
"BSD-3-Clause"
] | null | null | null | bitten/build/tests/dummy.py | dokipen/bitten | d4d2829c63eec84bcfab05ec7035a23e85d90c00 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2007 Christopher Lenz <cmlenz@gmx.de>
# Copyright (C) 2007 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://bitten.edgewall.org/wiki/License.
from StringIO import StringIO
from bitten.build import api
class CommandLine(api.CommandLine):
def __init__(self, returncode=0, stdout='', stderr=''):
self.returncode = returncode
self.stdout = StringIO(stdout)
self.stderr = StringIO(stderr)
def __call__(self, executable, args, input=None, cwd=None):
return self
def execute(self):
return map(lambda x,y: (x,y),
self.stdout.readlines(),
self.stderr.readlines())
| 28.7 | 67 | 0.666667 | 110 | 861 | 5.145455 | 0.645455 | 0.035336 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020958 | 0.224158 | 861 | 29 | 68 | 29.689655 | 0.826347 | 0.383275 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.153846 | 0.153846 | 0.615385 | 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 |
153e63c6cf15909ad9b24c0c91c513c9c011dbbf | 3,477 | py | Python | scripts/update_metadata_util.py | Louquinze/auto-sklearn | b2ac331c500ebef7becf372802493a7b235f7cec | [
"BSD-3-Clause"
] | 6,390 | 2015-07-11T07:59:51.000Z | 2022-03-31T16:45:15.000Z | scripts/update_metadata_util.py | Louquinze/auto-sklearn | b2ac331c500ebef7becf372802493a7b235f7cec | [
"BSD-3-Clause"
] | 1,276 | 2015-07-29T02:11:29.000Z | 2022-03-31T17:31:34.000Z | scripts/update_metadata_util.py | Louquinze/auto-sklearn | b2ac331c500ebef7becf372802493a7b235f7cec | [
"BSD-3-Clause"
] | 1,313 | 2015-07-20T14:11:39.000Z | 2022-03-25T18:22:48.000Z | import numpy as np
import openml
classification_tasks = [
232, 236, 241, 245, 253, 254, 256, 258, 260, 262, 267, 271, 273, 275, 279, 288, 336,
340, 2119, 2120, 2121, 2122, 2123, 2125, 2356, 3044, 3047, 3048, 3049, 3053, 3054,
3055, 75089, 75092, 75093, 75098, 75100, 75108, 75109, 75112, 75114, 75115, 75116,
75118, 75120, 75121, 75125, 75126, 75129, 75131, 75133, 75134, 75136, 75139, 75141,
75142, 75143, 75146, 75147, 75148, 75149, 75153, 75154, 75156, 75157, 75159, 75161,
75163, 75166, 75169, 75171, 75173, 75174, 75176, 75178, 75179, 75180, 75184, 75185,
75187, 75192, 75195, 75196, 75199, 75210, 75212, 75213, 75215, 75217, 75219, 75221,
75223, 75225, 75232, 75233, 75234, 75235, 75236, 75237, 75239, 75250, 126021, 126024,
126028, 126030, 126031, 146574, 146575, 146576, 146577, 146578, 146583, 146586,
146592, 146593, 146594, 146596, 146597, 146600, 146601, 146602, 146603, 146679,
166859, 166866, 166872, 166875, 166882, 166897, 166905, 166906, 166913, 166915,
166931, 166932, 166944, 166950, 166951, 166953, 166956, 166957, 166958, 166959,
166970, 166996, 167085, 167086, 167087, 167088, 167089, 167090, 167094, 167096,
167097, 167099, 167100, 167101, 167103, 167105, 167106, 167202, 167203, 167204,
167205, 168785, 168791, 189779, 189786, 189828, 189829, 189836, 189840, 189841,
189843, 189844, 189845, 189846, 189857, 189858, 189859, 189863, 189864, 189869,
189870, 189875, 189878, 189880, 189881, 189882, 189883, 189884, 189887, 189890,
189893, 189894, 189899, 189900, 189902, 190154, 190155, 190156, 190157, 190158,
190159, 211720, 211721, 211722, 211723, 211724
]
regression_tasks = [
359997, 359998, 359999, 360000, 360001, 360002, 360003, 167146, 360004, 360005, 360006,
360007, 211696, 360009, 360010, 360011, 360012, 360013, 360014, 360015, 360016, 360017,
360018, 360019, 360020, 360021, 360022, 360023, 360024, 360025, 360026, 360027, 360028,
360029, 360030, 360031, 360032, 360033, 360034, 360035, 360036, 360037, 360038, 360039,
360040, 360041, 360042, 360043, 360044, 360045, 360046, 360047, 360048, 360049, 360050,
360051, 360052, 360053, 360054, 360055, 360056, 360057, 360058, 360059, 360060, 360061,
360062, 360063, 360064, 360066, 360067, 360068, 360069, 360070, 360071, 360072, 360073,
360074, 360075, 360076, 360077, 360078, 360079, 360080, 360081, 360082, 360083, 360084,
360085, 360086, 360087, 360088, 360089, 360090, 360091, 360092, 360093, 360094, 360095,
360096, 360097, 360098, 360100, 360101, 360102, 360103, 360104, 360105, 360106, 360107,
360108,
]
def load_task(task_id):
task = openml.tasks.get_task(task_id)
X, y = task.get_X_and_y()
train_indices, test_indices = task.get_train_test_split_indices()
X_train = X[train_indices]
y_train = y[train_indices]
X_test = X[test_indices]
y_test = y[test_indices]
dataset = openml.datasets.get_dataset(task.dataset_id)
_, _, cat, _ = dataset.get_data(target=task.target_name)
name = dataset.name.lower()
del _
del dataset
cat = {i: 'categorical' if c else 'numerical' for i, c in enumerate(cat)}
if isinstance(task, openml.tasks.OpenMLClassificationTask):
task_type = 'classification'
elif isinstance(task, openml.tasks.OpenMLRegressionTask):
task_type = 'regression'
else:
raise ValueError('Unknown task type')
return X_train, y_train, X_test, y_test, cat, task_type, name
| 54.328125 | 91 | 0.699166 | 452 | 3,477 | 5.294248 | 0.809735 | 0.010029 | 0.018805 | 0.020894 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.621574 | 0.181478 | 3,477 | 63 | 92 | 55.190476 | 0.219255 | 0 | 0 | 0 | 0 | 0 | 0.017544 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.017544 | false | 0 | 0.035088 | 0 | 0.070175 | 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 |
155cfe2a1aa40f3b17f22d33647d0aecad496ad5 | 4,849 | py | Python | ds_app_15/ds_app_15.py | briannebrown/oss-pcf-gcp-retail-demo | 3a01f369c06b91c25f3bd0ef301ba7ae03c1f990 | [
"Apache-2.0"
] | 18 | 2017-09-09T18:16:35.000Z | 2019-06-28T00:27:15.000Z | ds_app_15/ds_app_15.py | briannebrown/oss-pcf-gcp-retail-demo | 3a01f369c06b91c25f3bd0ef301ba7ae03c1f990 | [
"Apache-2.0"
] | null | null | null | ds_app_15/ds_app_15.py | briannebrown/oss-pcf-gcp-retail-demo | 3a01f369c06b91c25f3bd0ef301ba7ae03c1f990 | [
"Apache-2.0"
] | 12 | 2017-09-09T00:27:22.000Z | 2021-10-19T03:21:18.000Z | #!/usr/bin/env python
#
# Copyright (c) 2017-Present Pivotal Software, 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.
#
import os
import json
from flask import (Flask, request, jsonify)
from flask_cors import CORS, cross_origin
import uuid
from random import randint
import base64
import urllib
import re
import operator
from collections import defaultdict
import inflect
DEBUG = True
MATCHER_APP = 'image-match'
N_ITEMS_IN_OFFER = 4
N_IMAGE_MATCHES = 20 # Must be > N_ITEMS_IN_OFFER, due to filtering
DEFAULT_TOP_TERM = 'item'
# FIXME: Make this dynamic
LOCATION_URL = 'https://goo.gl/maps/mDzTzVkWah82'
# This CORS section enables the Web UI component to use the /lastMessage endpoint
app = Flask(__name__)
cors = CORS(app, resources={r'/lastMessage': {'origins': '*'}})
port = int(os.getenv("PORT", 18080))
def logMsg(args):
print "[Instance: %s] %s" % (str(os.getenv("CF_INSTANCE_INDEX", 0)), args)
hashtags = ['ootd', 'instafashion', 'vintage', 'fashionista', 'streetstyle',
'stylish', 'lookbook']
def genHashtag():
# TODO: incorporate post text into this
return hashtags[randint(0, len(hashtags)-1)]
"""
Consult the MATCHER_APP to get suggestions from inventory, and add these
to the JSON msg as a new element, 'offer_items'.
"""
imgMatchUrl = None
def addOfferItems(msg):
global imgMatchUrl
offerItems = [] # Array of items from inventory which match the user's need
if imgMatchUrl is None:
vcapApp = json.loads(os.getenv('VCAP_APPLICATION'))
thisHost = vcapApp['application_uris'][0]
matcherHost = re.sub(r'^[^\.]+', MATCHER_APP, thisHost)
imgMatcherUrl = 'http://' + matcherHost + '/query_image_url'
logMsg('Image Matcher URL: %s' % imgMatcherUrl)
makeOffer = ('make_offer' in msg and msg['make_offer'])
topTerm = DEFAULT_TOP_TERM # This would be the term used in the tweet ("... some hot new TERM ...")
if makeOffer and 'entities' in msg and 'media' in msg['entities']:
# FIXME: Just taking the first image in the tweet
imgUrl = msg['entities']['media'][0]['media_url']
resp = urllib.urlopen(imgMatcherUrl + '/' + str(N_IMAGE_MATCHES) + '/' + base64.b64encode(imgUrl))
match = json.loads(resp.read())
termCounts = defaultdict(int)
for item in match:
# Elements: { 'sku': sku, 'price': price, 'desc': desc, 'url': url }
# Ensure each one we append is relevant, per relevant_labels in JSON msg
# Targeting N_ITEMS_IN_OFFER items
termSet = set(msg['relevant_labels'])
descSet = set(item['desc'].lower().split())
overlapSet = termSet & descSet
if len(overlapSet) > 0:
for term in overlapSet:
termCounts[term] += 1
offerItems.append( { 'desc': item['desc'], 'url': item['url'] } )
if len(offerItems) == N_ITEMS_IN_OFFER:
break
topTerm = sorted(termCounts.items(), key=operator.itemgetter(1))[-1][0]
msg['top_term'] = topTerm
msg['offer_items'] = offerItems
inflectEngine = inflect.engine()
def plural(word):
return inflectEngine.plural(word)
# Save the most recent message here, for the "/lastMessage" endpoint to return
lastMessage = {}
# Determine whether to make an offer and, if so, add 'offer_text' item to JSON
"""
Example offer (for Twitter):
* pass in the PK to the offer
* custom tailored #hashtag
* text; e.g. "30% off at BohoChic with code #hashtag"
"""
@app.route('/', methods = ['POST', 'GET'])
def jsonHandler():
global lastMessage
obj = request.get_json(force=True)
makeOffer = ('make_offer' in obj and obj['make_offer'])
if makeOffer:
addOfferItems(obj) # Sets 'top_term', which is referenced below
offerId = str(uuid.uuid4()) # TODO: Store in persistence layer
obj['offer_id'] = offerId
userId = obj['user']['screen_name']
obj['offer_text'] = 'Hey, @' + str(userId) + '. We have some hot new ' + plural(obj['top_term']) \
+ ' here: ' + LOCATION_URL + ' Use code #' + genHashtag() + ' for 30% off in store today!'
obj['in_stock'] = True
logMsg('Event: %s' % json.dumps(obj))
lastMessage = obj
return json.dumps(obj)
@app.route('/lastMessage')
def getLastMessage():
return json.dumps(lastMessage)
@app.route('/status')
def test():
return "STATUS_OK", 200
if __name__ == '__main__':
app.run(host='0.0.0.0', port=port, threaded = not DEBUG, debug = DEBUG)
| 35.394161 | 102 | 0.687977 | 675 | 4,849 | 4.847407 | 0.428148 | 0.018337 | 0.00978 | 0.015892 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011593 | 0.181687 | 4,849 | 136 | 103 | 35.654412 | 0.813004 | 0.285007 | 0 | 0 | 0 | 0 | 0.181413 | 0 | 0 | 0 | 0 | 0.022059 | 0 | 0 | null | null | 0 | 0.141176 | null | null | 0.011765 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
15653b69331487e6c7d4888687c379b9af9581fd | 5,458 | py | Python | openGaussBase/testcase/SQL/FULL_TEXT_SEARCH/text_search/Opengauss_Function_Text_Search_Case0007.py | opengauss-mirror/Yat | aef107a8304b94e5d99b4f1f36eb46755eb8919e | [
"MulanPSL-1.0"
] | null | null | null | openGaussBase/testcase/SQL/FULL_TEXT_SEARCH/text_search/Opengauss_Function_Text_Search_Case0007.py | opengauss-mirror/Yat | aef107a8304b94e5d99b4f1f36eb46755eb8919e | [
"MulanPSL-1.0"
] | null | null | null | openGaussBase/testcase/SQL/FULL_TEXT_SEARCH/text_search/Opengauss_Function_Text_Search_Case0007.py | opengauss-mirror/Yat | aef107a8304b94e5d99b4f1f36eb46755eb8919e | [
"MulanPSL-1.0"
] | null | null | null | """
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
"""
'''
#-- @testpoint:ts_rank_cd函数测试
'''
import unittest
from yat.test import macro
from testcase.utils.Logger import Logger
from testcase.utils.Constant import Constant
from testcase.utils.CommonSH import CommonSH
logger = Logger()
commonsh = CommonSH('dbuser')
constant = Constant()
class Hostname(unittest.TestCase):
def setUp(self):
logger.info("------------------------Opengauss_Function_Text_Search_Case0007开始执行--------------------------")
# 排序文件查询使用覆盖密度
def test_directoary_1(self):
file_path = macro.DB_DictFile
SqlMdg = commonsh.execut_db_sql('''SELECT ts_rank_cd('hello world'::tsvector, 'world'::tsquery);''')
logger.info(SqlMdg)
self.assertTrue('ts_rank_cd >= 0', SqlMdg)
# 创建schema
SqlMdg = commonsh.execut_db_sql('''DROP SCHEMA IF EXISTS tsearch CASCADE;
CREATE SCHEMA tsearch;''')
logger.info(SqlMdg)
self.assertIn('CREATE SCHEMA', SqlMdg)
# 创建表
SqlMdg = commonsh.execut_db_sql('''DROP TABLE if exists tsearch.pgweb;
CREATE TABLE tsearch.pgweb(id int, body text, title text, last_mod_date date);''')
logger.info(SqlMdg)
self.assertIn('CREATE TABLE', SqlMdg)
# 插入数据
SqlMdg = commonsh.execut_db_sql('''INSERT INTO tsearch.pgweb VALUES(1, 'China, officially the People''s Republic of China (PRC), located in Asia, is the world''s most populous state.', 'China', '2010-1-1');
INSERT INTO tsearch.pgweb VALUES(2, 'America is a rock band, formed in England in 1970 by multi-instrumentalists Dewey Bunnell, Dan Peek, and Gerry Beckley.', 'America', '2010-1-1');
INSERT INTO tsearch.pgweb VALUES(3, 'England is a country that is part of the United Kingdom. It shares land borders with Scotland to the north and Wales to the west.', 'England', '2010-1-1');
INSERT INTO tsearch.pgweb VALUES(4, 'Australia, officially the Commonwealth of Australia, is a country comprising the mainland of the Australian continent, the island of Tasmania, and numerous smaller islands.', 'Australia', '2010-1-1');
INSERT INTO tsearch.pgweb VALUES(5, 'Russia, also officially known as the Russian Federation, is a sovereign state in northern Eurasia.', 'Russia', '2010-1-1');
INSERT INTO tsearch.pgweb VALUES(6, 'Japan is an island country in East Asia.', 'Japan', '2010-1-1');
INSERT INTO tsearch.pgweb VALUES(7, 'Germany, officially the Federal Republic of Germany, is a sovereign state and federal parliamentary republic in central-western Europe.', 'Germany', '2010-1-1');
INSERT INTO tsearch.pgweb VALUES(8, 'France, is a sovereign state comprising territory in western Europe and several overseas regions and territories.', 'France', '2010-1-1');
INSERT INTO tsearch.pgweb VALUES(9, 'Italy officially the Italian Republic, is a unitary parliamentary republic in Europe.', 'Italy', '2010-1-1');
INSERT INTO tsearch.pgweb VALUES(10, 'India, officially the Republic of India, is a country in South Asia.', 'India', '2010-1-1');
INSERT INTO tsearch.pgweb VALUES(11, 'Brazil, officially the Federative Republic of Brazil, is the largest country in both South America and Latin America.', 'Brazil', '2010-1-1');
INSERT INTO tsearch.pgweb VALUES(12, 'Canada is a country in the northern half of North America.', 'Canada', '2010-1-1');
INSERT INTO tsearch.pgweb VALUES(13, 'Mexico, officially the United Mexican States, is a federal republic in the southern part of North America.', 'Mexico', '2010-1-1');
''')
logger.info(SqlMdg)
self.assertIn('INSERT', SqlMdg)
# 从body列检索字串为'america'查询排名前十的覆盖密度
SqlMdg = commonsh.execut_db_sql('''SELECT id, title, ts_rank_cd(to_tsvector(body), query) AS rank FROM tsearch.pgweb, to_tsquery('america') query WHERE query @@ to_tsvector(body) ORDER BY rank DESC LIMIT 10;''')
logger.info(SqlMdg)
self.assertTrue('ts_rank_cd >= 0', SqlMdg)
# 清理环境
def tearDown(self):
logger.info('----------this is teardown-------')
# 删除表
SqlMdg = commonsh.execut_db_sql('''DROP TABLE tsearch.pgweb cascade;''')
logger.info(SqlMdg)
self.assertIn('DROP TABLE', SqlMdg)
# 删除schema
SqlMdg = commonsh.execut_db_sql('''DROP SCHEMA tsearch cascade;''')
logger.info(SqlMdg)
self.assertIn('DROP SCHEMA', SqlMdg)
logger.info('------------------------Opengauss_Function_Text_Search_Case0007执行结束--------------------------')
| 61.325843 | 274 | 0.630634 | 688 | 5,458 | 4.943314 | 0.357558 | 0.059982 | 0.064981 | 0.084093 | 0.293737 | 0.269921 | 0.209938 | 0.146428 | 0.026463 | 0.026463 | 0 | 0.029671 | 0.25284 | 5,458 | 88 | 275 | 62.022727 | 0.804316 | 0.108098 | 0 | 0.173077 | 0 | 0.269231 | 0.727934 | 0.053583 | 0 | 0 | 0 | 0 | 0.134615 | 1 | 0.057692 | false | 0 | 0.096154 | 0 | 0.173077 | 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 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1565c14ca818e5618d7e30453a3b61156dca04b9 | 11,570 | py | Python | tests/test_arithmetic_shift_left.py | ioancornea/niveristand-python | a7fd578aefa904e9eb0bab00762af0ebba21ada0 | [
"MIT"
] | 6 | 2018-07-04T10:59:43.000Z | 2022-03-24T13:34:33.000Z | tests/test_arithmetic_shift_left.py | ioancornea/niveristand-python | a7fd578aefa904e9eb0bab00762af0ebba21ada0 | [
"MIT"
] | 14 | 2018-11-05T20:05:33.000Z | 2022-03-10T12:54:58.000Z | tests/test_arithmetic_shift_left.py | ioancornea/niveristand-python | a7fd578aefa904e9eb0bab00762af0ebba21ada0 | [
"MIT"
] | 15 | 2018-07-04T07:58:49.000Z | 2022-02-22T16:35:26.000Z | import sys
from niveristand import nivs_rt_sequence
from niveristand import realtimesequencetools
from niveristand.clientapi import BooleanValue, ChannelReference, DoubleValue, I32Value, I64Value, RealTimeSequence
from niveristand.errors import TranslateError, VeristandError
from niveristand.library.primitives import localhost_wait
import pytest
from testutilities import rtseqrunner, validation
a = 1
b = 2
@nivs_rt_sequence
def _return_constant():
a = I32Value(5)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_simple_numbers():
a = DoubleValue(0)
a.value = 1 << 3
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_num_nivsdatatype():
a = DoubleValue(0)
a.value = 1 << DoubleValue(3)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_nivsdatatype_nivsdatatype():
a = DoubleValue(0)
a.value = DoubleValue(1) << DoubleValue(3)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_nivsdatatype_nivsdatatype1():
a = DoubleValue(0)
a.value = DoubleValue(1) << I32Value(3)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_nivsdatatype_nivsdatatype2():
a = BooleanValue(0)
a.value = BooleanValue(1) << BooleanValue(3)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_nivsdatatype_nivsdatatype3():
a = DoubleValue(0)
a.value = I32Value(1) << I32Value(3)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_multiple_types():
a = I32Value(0)
a.value = 1 << I32Value(3) << 5
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_multiple_types1():
a = I64Value(1)
a.value = 1 << I64Value(5) << 3 << I32Value(7)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_use_rtseq():
a = DoubleValue(0)
a.value = 1 << _return_constant()
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_use_rtseq1():
a = DoubleValue(0)
a.value = _return_constant() << 1
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_use_rtseq2():
a = DoubleValue(0)
a.value = I32Value(1) << _return_constant()
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_use_rtseq3():
a = DoubleValue(0)
a.value = _return_constant() << I32Value(1)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_use_rtseq4():
a = DoubleValue(0)
a.value = I32Value(1) << _return_constant()
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_use_rtseq5():
a = DoubleValue(0)
a.value = _return_constant() << I32Value(1)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_with_parentheses():
a = I32Value(0)
a.value = 1 << (2 << 1)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_with_parentheses1():
a = DoubleValue(0)
a.value = 1 << (DoubleValue(2) << I32Value(1))
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_with_parentheses2():
a = DoubleValue(0)
a.value = DoubleValue(1) << (I32Value(2) << 1.0) << DoubleValue(4)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_variables():
a = I32Value(5)
b = I32Value(0)
b.value = 1 << a
return b.value
@nivs_rt_sequence
def arithmetic_shift_left_variables1():
a = I64Value(5)
b = I64Value(0)
b.value = 1 << a.value
return b.value
@nivs_rt_sequence
def arithmetic_shift_left_variable_variable():
a = I32Value(1)
b = I64Value(3)
c = I32Value(0)
c.value = a.value << b.value
return c.value
@nivs_rt_sequence
def arithmetic_shift_left_variable_variable1():
a = I32Value(1)
b = I64Value(3)
c = DoubleValue(0)
c.value = a.value << b.value
return c.value
@nivs_rt_sequence
def arithmetic_shift_left_variable_rtseq():
a = I32Value(1)
b = DoubleValue(0)
b.value = a.value << _return_constant()
return b.value
@nivs_rt_sequence
def arithmetic_shift_left_variable_rtseq1():
a = I32Value(1)
b = DoubleValue(0)
b.value = _return_constant() << a.value
return b.value
@nivs_rt_sequence
def arithmetic_shift_left_to_channel_ref():
a = DoubleValue(0)
b = ChannelReference("Aliases/DesiredRPM")
b.value = 5.0
localhost_wait()
a.value = 1 << b.value
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_binary_unary():
a = I32Value(0)
a.value = 3 << -1
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_augassign_number():
a = I32Value(1)
a.value <<= 2
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_augassign_nivsdatatype():
a = I32Value(1)
a.value <<= I32Value(2)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_augassign_nivsdatatype1():
a = I64Value(1)
a.value <<= I64Value(2)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_augassign_nivsdatatype2():
a = I64Value(1)
a.value <<= I32Value(2)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_augassign_nivsdatatype3():
a = I32Value(1)
a.value <<= I64Value(2)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_augassign_nivsdatatype4():
a = I32Value(1)
a.value <<= DoubleValue(2)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_augassign_variable():
a = I32Value(1)
b = I32Value(2)
a.value <<= b.value
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_augassign_variable1():
a = I64Value(1)
b = I64Value(2)
a.value <<= b.value
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_augassign_variable2():
a = I32Value(1)
b = I64Value(2)
a.value <<= b.value
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_augassign_variable3():
a = I64Value(1)
b = I32Value(2)
a.value <<= b.value
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_augassign_variable4():
a = I32Value(1)
b = DoubleValue(2)
a.value <<= b.value
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_augassign_rtseq():
a = I32Value(1)
a.value <<= _return_constant()
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_augassign_parentheses():
a = I32Value(1)
a.value <<= (2 + I32Value(1)) + I64Value(1)
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_augassign_channel_ref():
a = DoubleValue(1)
b = ChannelReference("Aliases/DesiredRPM")
b.value = 5.0
localhost_wait()
a.value <<= b.value
return a.value
# <editor-fold desc=Invalid tests>
@nivs_rt_sequence
def arithmetic_shift_left_invalid_variables():
return a.value << b
@nivs_rt_sequence
def arithmetic_shift_left_invalid_variables1():
return a.value << b.value
@nivs_rt_sequence
def arithmetic_shift_left_to_None():
a = DoubleValue(0)
a.value = None << 1
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_invalid_rtseq_call():
a = DoubleValue(0)
a.value = _return_constant << 1
return a.value
@nivs_rt_sequence
def arithmetic_shift_left_complex_expr():
a = DoubleValue(0)
a.value = 1 << (2 if 2 < 3 else 4)
return a.value
# </editor-fold>
run_tests = [
(arithmetic_shift_left_simple_numbers, (), 8),
(arithmetic_shift_left_nivsdatatype_nivsdatatype1, (), 8),
(arithmetic_shift_left_nivsdatatype_nivsdatatype3, (), 8),
(arithmetic_shift_left_variables, (), 32),
(arithmetic_shift_left_variables1, (), 32),
(arithmetic_shift_left_multiple_types, (), 256),
(arithmetic_shift_left_multiple_types1, (), 32768),
(arithmetic_shift_left_with_parentheses, (), 16),
(arithmetic_shift_left_variable_variable, (), 8),
(arithmetic_shift_left_variable_variable1, (), 8),
(arithmetic_shift_left_augassign_number, (), 4),
(arithmetic_shift_left_augassign_nivsdatatype, (), 4),
(arithmetic_shift_left_augassign_nivsdatatype1, (), 4),
(arithmetic_shift_left_augassign_nivsdatatype2, (), 4),
(arithmetic_shift_left_augassign_nivsdatatype3, (), 4),
(arithmetic_shift_left_augassign_variable, (), 4),
(arithmetic_shift_left_augassign_variable1, (), 4),
(arithmetic_shift_left_augassign_variable2, (), 4),
(arithmetic_shift_left_augassign_variable3, (), 4),
(arithmetic_shift_left_augassign_parentheses, (), 16),
(arithmetic_shift_left_use_rtseq, (), 32),
(arithmetic_shift_left_use_rtseq1, (), 10),
(arithmetic_shift_left_use_rtseq2, (), 32),
(arithmetic_shift_left_use_rtseq3, (), 10),
(arithmetic_shift_left_use_rtseq4, (), 32),
(arithmetic_shift_left_use_rtseq5, (), 10),
(arithmetic_shift_left_variable_rtseq, (), 32),
(arithmetic_shift_left_variable_rtseq1, (), 10),
(arithmetic_shift_left_complex_expr, (), 4),
(arithmetic_shift_left_augassign_rtseq, (), 32),
]
fail_transform_tests = [
(arithmetic_shift_left_invalid_variables, (), TranslateError),
(arithmetic_shift_left_invalid_variables1, (), TranslateError),
(arithmetic_shift_left_num_nivsdatatype, (), VeristandError), # cannot do shift left on Double
(arithmetic_shift_left_nivsdatatype_nivsdatatype, (), VeristandError), # cannot do shift left on Double
(arithmetic_shift_left_nivsdatatype_nivsdatatype2, (), VeristandError), # cannot do shift left on Boolean
(arithmetic_shift_left_with_parentheses1, (), VeristandError), # cannot do shift left on Double
(arithmetic_shift_left_with_parentheses2, (), VeristandError), # cannot do shift left on Double
(arithmetic_shift_left_augassign_nivsdatatype4, (), VeristandError), # cannot do shift left on Double
(arithmetic_shift_left_augassign_variable4, (), VeristandError), # cannot do shift left on Double
(arithmetic_shift_left_to_channel_ref, (), VeristandError), # cannot do shift left on Double
(arithmetic_shift_left_augassign_channel_ref, (), VeristandError), # cannot do shift left on Double
(arithmetic_shift_left_to_None, (), TranslateError),
(arithmetic_shift_left_invalid_rtseq_call, (), VeristandError),
(arithmetic_shift_left_binary_unary, (), TranslateError),
]
py_only_errs = [
(arithmetic_shift_left_nivsdatatype_nivsdatatype1, (), 8), # cannot do shift left on float
]
def idfunc(val):
try:
return val.__name__
except AttributeError:
return str(val)
@pytest.mark.parametrize("func_name, params, expected_result", run_tests, ids=idfunc)
def test_transform(func_name, params, expected_result):
RealTimeSequence(func_name)
@pytest.mark.parametrize("func_name, params, expected_result", list(set(run_tests) - set(py_only_errs)), ids=idfunc)
def test_runpy(func_name, params, expected_result):
actual = func_name(*params)
assert actual == expected_result
@pytest.mark.parametrize("func_name, params, expected_result", run_tests, ids=idfunc)
def test_run_py_as_rts(func_name, params, expected_result):
actual = realtimesequencetools.run_py_as_rtseq(func_name)
assert actual == expected_result
@pytest.mark.parametrize("func_name, params, expected_result", run_tests, ids=idfunc)
def test_run_in_VM(func_name, params, expected_result):
actual = rtseqrunner.run_rtseq_in_VM(func_name)
assert actual == expected_result
@pytest.mark.parametrize("func_name, params, expected_result", fail_transform_tests, ids=idfunc)
def test_failures(func_name, params, expected_result):
with pytest.raises(expected_result):
RealTimeSequence(func_name)
with pytest.raises(expected_result):
func_name(*params)
def test_check_all_tested():
validation.test_validate(sys.modules[__name__])
| 26.176471 | 116 | 0.727831 | 1,528 | 11,570 | 5.153141 | 0.092277 | 0.113157 | 0.214757 | 0.097155 | 0.852934 | 0.603124 | 0.547371 | 0.526162 | 0.491999 | 0.491999 | 0 | 0.033455 | 0.168107 | 11,570 | 441 | 117 | 26.235828 | 0.784623 | 0.030856 | 0 | 0.518293 | 0 | 0 | 0.018393 | 0 | 0 | 0 | 0 | 0 | 0.009146 | 1 | 0.158537 | false | 0 | 0.02439 | 0.006098 | 0.32622 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 1 | 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 |
1565f840175f34307f597971bd13bdd7f6f9398d | 1,142 | py | Python | scripts/mcb.py | callmexss/pytoolet | 8542c8361c11e4c7d8625823f98d327e52fe56d2 | [
"MIT"
] | null | null | null | scripts/mcb.py | callmexss/pytoolet | 8542c8361c11e4c7d8625823f98d327e52fe56d2 | [
"MIT"
] | null | null | null | scripts/mcb.py | callmexss/pytoolet | 8542c8361c11e4c7d8625823f98d327e52fe56d2 | [
"MIT"
] | null | null | null | '''
File: mcb.py
File Created: Tuesday, 11th December 2018 3:07:00 pm
Author: xss (callmexss@126.com)
Description: A Python program to keep track of multiple
pieces of text. (mcb for multiclipboard)
-----
Last Modified: Tuesday, 11th December 2018 3:07:14 pm
Modified By: xss (callmexss@126.com)
-----
'''
import os
import shelve
import clipboard
class Guardian(object):
"""Provide cryptography support."""
pass
class Worker(object):
"""Do the routine."""
def __init__(self):
self.clipboard_dir = 'data'
self.clipboard_name = 'mcb'
if not os.path.isdir(self.clipboard_dir):
os.mkdir(self.clipboard_dir)
self.clipboard_path = os.path.join(self.clipboard_dir, self.clipboard_name)
def show_contents(self):
"""Show what in the clipboard."""
pass
def copy(self):
"""Copy a piece of data to the system clipboard."""
pass
def add(self):
"""Add an item to the multiclipboard."""
pass
def delete(self):
"""Delete a piece of item from the multiclipboard."""
pass
| 22.84 | 83 | 0.619089 | 149 | 1,142 | 4.66443 | 0.489933 | 0.130935 | 0.092086 | 0.066187 | 0.158273 | 0.07482 | 0 | 0 | 0 | 0 | 0 | 0.033453 | 0.267075 | 1,142 | 49 | 84 | 23.306122 | 0.796894 | 0.469352 | 0 | 0.25 | 0 | 0 | 0.012324 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.25 | 0.15 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
15673d61251eb2270ebe90516908a4ec21515811 | 1,916 | py | Python | app/routes.py | sebastianschramm/calendar_api | 88e2f59ed23b48d7b270bba50c0cdc6ea3b1f412 | [
"Apache-2.0"
] | null | null | null | app/routes.py | sebastianschramm/calendar_api | 88e2f59ed23b48d7b270bba50c0cdc6ea3b1f412 | [
"Apache-2.0"
] | null | null | null | app/routes.py | sebastianschramm/calendar_api | 88e2f59ed23b48d7b270bba50c0cdc6ea3b1f412 | [
"Apache-2.0"
] | null | null | null | from app.handlers.handler_health import handler_health_check
from app.handlers.handler_matches import get_matches
from app.handlers.handler_users import get_candidates, get_interviewers
from app.handlers.handler_timeslots import get_timeslots_interviewers, get_timeslots_candidates
from app.handlers.handler_timeslots import add_timeslots_interviewers, add_timeslots_candidates
def setup_routes(app):
service_base_url = '/api/v1'
user_candidate = "{}/candidates".format(service_base_url)
candidate_timeslots = "{}/{{user_id}}/timeslots".format(user_candidate)
user_interviewer = "{}/interviewers".format(service_base_url)
interviewer_timeslots = "{}/{{user_id}}/timeslots".format(user_interviewer)
matching_timeslots = "{}/matches".format(service_base_url)
# health check
app.router.add_route('GET', '/health', handler_health_check)
# users
app.router.add_route('GET', user_candidate, get_candidates)
#TODO: app.router.add_route('POST', user_candidate, default_handler)
#TODO: app.router.add_route('DELETE', user_candidate, default_handler)
app.router.add_route('GET', user_interviewer, get_interviewers)
#TODO: app.router.add_route('POST', user_interviewer, default_handler)
#TODO: app.router.add_route('DELETE', user_interviewer, default_handler)
# timeslots
app.router.add_route('GET', candidate_timeslots, get_timeslots_candidates)
app.router.add_route('POST', candidate_timeslots, add_timeslots_candidates)
#TODO: app.router.add_route('DELETE', candidate_timeslots, default_handler)
app.router.add_route('GET', interviewer_timeslots, get_timeslots_interviewers)
app.router.add_route('POST', interviewer_timeslots, add_timeslots_interviewers)
#TODO: app.router.add_route('DELETE', interviewer_timeslots, default_handler)
# matching timeslots
app.router.add_route('POST', matching_timeslots, get_matches)
| 44.55814 | 95 | 0.782881 | 239 | 1,916 | 5.933054 | 0.142259 | 0.088858 | 0.118477 | 0.167842 | 0.426657 | 0.341326 | 0.152327 | 0.06347 | 0.06347 | 0 | 0 | 0.000586 | 0.109081 | 1,916 | 42 | 96 | 45.619048 | 0.830111 | 0.246868 | 0 | 0 | 0 | 0 | 0.088687 | 0.03352 | 0 | 0 | 0 | 0.02381 | 0 | 1 | 0.05 | false | 0 | 0.25 | 0 | 0.3 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
158a5f414d850b75745ba84200927b2adc7021d2 | 319 | py | Python | setup.py | sunadandy/BaseNumberCalculator | ca77e04b4f144a4cda65ed1563b035a9a0d8fbda | [
"MIT"
] | null | null | null | setup.py | sunadandy/BaseNumberCalculator | ca77e04b4f144a4cda65ed1563b035a9a0d8fbda | [
"MIT"
] | null | null | null | setup.py | sunadandy/BaseNumberCalculator | ca77e04b4f144a4cda65ed1563b035a9a0d8fbda | [
"MIT"
] | null | null | null | from setuptools import setup
setup(
name="BaseNumberCalcurater",
version="0.0.1",
author="sunadandy",
entry_points={
"console_scripts": [
"dec2hex = calcuapp:dec2hex",
"dec2bin = calcuapp:dec2bin",
"hex2dec = calcuapp:hex2dec",
]
}
) | 22.785714 | 42 | 0.539185 | 26 | 319 | 6.538462 | 0.730769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.042654 | 0.338558 | 319 | 14 | 43 | 22.785714 | 0.763033 | 0 | 0 | 0 | 0 | 0 | 0.413681 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.076923 | 0 | 0.076923 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
15900bdb8bfc5894ebc891b81957202ba6ed7ab1 | 1,935 | py | Python | app/forms.py | maiorano84/ctaCompanion | df5c9fedc41303aea8c721912865518cdff2d595 | [
"MIT"
] | 2 | 2020-07-03T15:36:54.000Z | 2021-01-27T01:28:01.000Z | app/forms.py | maiorano84/ctaCompanion | df5c9fedc41303aea8c721912865518cdff2d595 | [
"MIT"
] | 4 | 2020-07-26T20:16:29.000Z | 2022-03-12T00:38:17.000Z | app/forms.py | maiorano84/ctaCompanion | df5c9fedc41303aea8c721912865518cdff2d595 | [
"MIT"
] | 2 | 2021-02-14T23:09:41.000Z | 2021-04-22T06:58:43.000Z | from flask import Flask
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField, IntegerField
from wtforms.validators import ValidationError, DataRequired, Email, EqualTo, NumberRange
from app.models import User
class CollectionForm(FlaskForm):
level = IntegerField('Level', validators=[DataRequired(), NumberRange(min=0, max=7)])
awaken = IntegerField('Awaken', validators=[DataRequired(), NumberRange(min=0, max=7)])
wpn = IntegerField('Weapon Level', validators=[DataRequired(), NumberRange(min=0, max=9)])
medals = IntegerField('Medals', validators=[DataRequired(), NumberRange(min=0, max=2500)])
submit = SubmitField('Save Changes')
class LoginForm(FlaskForm):
username = StringField('Username', validators=[DataRequired(message="Please enter a username")])
password = PasswordField('Password', validators=[DataRequired(message="Please enter a password")])
remember_me = BooleanField('Remember Me')
submit = SubmitField('Sign In')
class RegistrationForm(FlaskForm):
username = StringField('Username', validators=[DataRequired(message="Please enter a username")])
email = StringField('Email', validators=[DataRequired(message="Please enter a valid email"), Email()])
password = PasswordField('Password', validators=[DataRequired(message="Please enter a password")])
password2 = PasswordField('Confirm Password', validators=[DataRequired(message="Passwords doesn't match"), EqualTo('password')])
submit = SubmitField('Register')
def validate_username(self, username):
user = User.query.filter_by(username=username.data).first()
if user is not None:
raise ValidationError('Username is not available')
def validate_email(self, email):
user = User.query.filter_by(email=email.data).first()
if user is not None:
raise ValidationError('Email is not available') | 52.297297 | 132 | 0.73385 | 212 | 1,935 | 6.669811 | 0.330189 | 0.155587 | 0.123055 | 0.123762 | 0.473126 | 0.443423 | 0.386139 | 0.292786 | 0.292786 | 0.230552 | 0 | 0.007238 | 0.143152 | 1,935 | 37 | 133 | 52.297297 | 0.845597 | 0 | 0 | 0.2 | 0 | 0 | 0.163223 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0.133333 | 0.166667 | 0 | 0.8 | 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 |
15a22184116deb21e59b704e272d92ce3fad2854 | 290 | py | Python | scripts/ingest.py | adjspecies/sfdata | 9522176c1c80e9f0aeecf77da6576e8465238383 | [
"MIT"
] | 1 | 2019-01-24T01:57:21.000Z | 2019-01-24T01:57:21.000Z | scripts/ingest.py | adjspecies/sfdata | 9522176c1c80e9f0aeecf77da6576e8465238383 | [
"MIT"
] | null | null | null | scripts/ingest.py | adjspecies/sfdata | 9522176c1c80e9f0aeecf77da6576e8465238383 | [
"MIT"
] | 1 | 2018-12-22T02:20:39.000Z | 2018-12-22T02:20:39.000Z | import beautifulsoup4
import cookielib
import mechanize
br = mechanize.Browser()
jar = cookielib.LWPCookieJar()
br.set_cookiejar(jar)
br.set_handle_equiv( True )
br.set_handle_gzip( True )
br.set_handle_redirect( True )
br.set_handle_referer( True )
br.set_handle_robots( False )
| 17.058824 | 31 | 0.77931 | 41 | 290 | 5.243902 | 0.439024 | 0.139535 | 0.255814 | 0.27907 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003968 | 0.131034 | 290 | 16 | 32 | 18.125 | 0.849206 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.272727 | 0 | 0.272727 | 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 |
15b46faeca3aa8da9ecc048237a68f8f1792333b | 492 | py | Python | apps/api/urls.py | ltfred/site | f640a627599a4d0cc1e91867e314e1212727c81f | [
"MIT"
] | 1 | 2020-10-21T02:06:32.000Z | 2020-10-21T02:06:32.000Z | apps/api/urls.py | ltfred/site | f640a627599a4d0cc1e91867e314e1212727c81f | [
"MIT"
] | null | null | null | apps/api/urls.py | ltfred/site | f640a627599a4d0cc1e91867e314e1212727c81f | [
"MIT"
] | null | null | null | # -*- coding:utf-8 -*-
# @Date : 2019/2/1
from rest_framework.routers import DefaultRouter
from .views import ArticleListSet, CategoryListSet, TagListSet, TimelineListSet, ToolLinkListSet, UserListSet
router = DefaultRouter()
router.register(r"users", UserListSet)
router.register(r"articles", ArticleListSet)
router.register(r"tags", TagListSet)
router.register(r"categorys", CategoryListSet)
router.register(r"timelines", TimelineListSet)
router.register(r"toollinks", ToolLinkListSet)
| 32.8 | 109 | 0.796748 | 54 | 492 | 7.240741 | 0.537037 | 0.214834 | 0.230179 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015487 | 0.081301 | 492 | 14 | 110 | 35.142857 | 0.849558 | 0.077236 | 0 | 0 | 0 | 0 | 0.097561 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.222222 | 0 | 0.222222 | 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 |
15bc8906707e7950aa56e5f073bf0ab9d0907835 | 671 | py | Python | NewRelicApiParser/REST/KeyTransactions/__init__.py | Bharat23/newrelic-api-parser | c55d508387fde33af9bdc93f16aae3cb2a2e5f13 | [
"MIT"
] | null | null | null | NewRelicApiParser/REST/KeyTransactions/__init__.py | Bharat23/newrelic-api-parser | c55d508387fde33af9bdc93f16aae3cb2a2e5f13 | [
"MIT"
] | 1 | 2021-07-30T17:32:37.000Z | 2021-07-30T17:32:37.000Z | NewRelicApiParser/REST/KeyTransactions/__init__.py | Bharat23/newrelic-api-parser | c55d508387fde33af9bdc93f16aae3cb2a2e5f13 | [
"MIT"
] | null | null | null | from NewRelicApiParser.Base import BaseNewRelic
from NewRelicApiParser.CustomExceptions import ArgumentException
class KeyTransactions(BaseNewRelic):
def __init__(self, API_KEY):
super().__init__(API_KEY)
def get_list(self, options: dict = {}) -> dict:
"""
fetch the key transactions for new relic
"""
url = self.BASE_URI + '/key_transactions.json'
return super().get_data(url, options=options)
def show(self, app_id: int) -> dict:
"""
fetch single key transction data
"""
url = self.BASE_URI + '/key_transactions/{0}.json'.format(app_id)
return super().get_data(url) | 31.952381 | 73 | 0.646796 | 78 | 671 | 5.320513 | 0.487179 | 0.108434 | 0.053012 | 0.06747 | 0.240964 | 0.139759 | 0 | 0 | 0 | 0 | 0 | 0.001965 | 0.241431 | 671 | 21 | 74 | 31.952381 | 0.81336 | 0.108793 | 0 | 0 | 0 | 0 | 0.086957 | 0.086957 | 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 |
ec74b5db8e4e5ab25a2d5f65d4dd05c5a684157f | 293 | py | Python | Testing/TestCase/Assertions/assertQuerysetEqual/tests.py | looking-for-a-job/django-examples | dfafa450668cac5c0351f6c7238b8886511229bf | [
"Unlicense"
] | null | null | null | Testing/TestCase/Assertions/assertQuerysetEqual/tests.py | looking-for-a-job/django-examples | dfafa450668cac5c0351f6c7238b8886511229bf | [
"Unlicense"
] | null | null | null | Testing/TestCase/Assertions/assertQuerysetEqual/tests.py | looking-for-a-job/django-examples | dfafa450668cac5c0351f6c7238b8886511229bf | [
"Unlicense"
] | null | null | null | from django.test import TestCase
"""
https://docs.djangoproject.com/en/dev/topics/testing/tools/#django.test.TestCase.assertQuerysetEqual
assertQuerysetEqual(qs, values, transform=repr, ordered=True, msg=None)
"""
class Test(TestCase):
def test(self):
raise NotImplementedError
| 24.416667 | 100 | 0.761092 | 35 | 293 | 6.371429 | 0.8 | 0.089686 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.112628 | 293 | 11 | 101 | 26.636364 | 0.857692 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
ec7967455da96b505630700840be06ed5c0817fd | 223 | py | Python | setup.py | RasmusJuul/MLOps_personal | a843cccbf25802396f9ab9c32c99dae4cc8cc071 | [
"MIT"
] | null | null | null | setup.py | RasmusJuul/MLOps_personal | a843cccbf25802396f9ab9c32c99dae4cc8cc071 | [
"MIT"
] | null | null | null | setup.py | RasmusJuul/MLOps_personal | a843cccbf25802396f9ab9c32c99dae4cc8cc071 | [
"MIT"
] | null | null | null | from setuptools import find_packages, setup
setup(
name="src",
packages=find_packages(),
version="0.1.0",
description="Project for MLOps course jan 2022",
author="Rasmus Pedersen",
license="MIT",
)
| 20.272727 | 52 | 0.672646 | 28 | 223 | 5.285714 | 0.821429 | 0.162162 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039106 | 0.197309 | 223 | 10 | 53 | 22.3 | 0.78771 | 0 | 0 | 0 | 0 | 0 | 0.264574 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.111111 | 0 | 0.111111 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ec8c214519518e5e5e375236cd5655e89ac35eb7 | 110 | py | Python | src/classifier/Constants.py | qizhex/Large-scale-Cloze-Test-Dataset-Created-by-Teachers | 8bede0ad87fe7312e72069112c77f0ba64917ac8 | [
"MIT"
] | 29 | 2018-11-08T07:13:00.000Z | 2021-12-19T13:33:19.000Z | src/classifier/Constants.py | qizhex/Large-scale-Cloze-Test-Dataset-Designed-by-Teachers | 8bede0ad87fe7312e72069112c77f0ba64917ac8 | [
"MIT"
] | 3 | 2018-11-09T01:18:48.000Z | 2020-02-14T13:45:31.000Z | src/classifier/Constants.py | qizhex/Large-scale-Cloze-Test-Dataset-Created-by-Teachers | 8bede0ad87fe7312e72069112c77f0ba64917ac8 | [
"MIT"
] | 11 | 2018-10-19T07:58:18.000Z | 2021-12-11T09:21:39.000Z | PAD = 0
UNK = 1
EOS = 2
BOS = 3
PAD_WORD = '<blank>'
UNK_WORD = '<unk>'
EOS_WORD = '<eos>'
BOS_WORD = '<bos>' | 12.222222 | 20 | 0.563636 | 20 | 110 | 2.9 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.046512 | 0.218182 | 110 | 9 | 21 | 12.222222 | 0.627907 | 0 | 0 | 0 | 0 | 0 | 0.198198 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ec972c4bd2e273dab25db97d007d3abea637dcfc | 293 | py | Python | src/pagic/scanner.py | abilian/pagic | 4d77ce4ca5321b3471433dc0c3f8d756211dc12a | [
"Apache-2.0"
] | null | null | null | src/pagic/scanner.py | abilian/pagic | 4d77ce4ca5321b3471433dc0c3f8d756211dc12a | [
"Apache-2.0"
] | null | null | null | src/pagic/scanner.py | abilian/pagic | 4d77ce4ca5321b3471433dc0c3f8d756211dc12a | [
"Apache-2.0"
] | null | null | null | from werkzeug.utils import find_modules, import_string
def scan_modules(module_path, callback=None, recursive=True):
for name in find_modules(module_path, include_packages=True, recursive=recursive):
module = import_string(name)
if callback:
callback(module)
| 32.555556 | 86 | 0.737201 | 37 | 293 | 5.621622 | 0.567568 | 0.105769 | 0.163462 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.187713 | 293 | 8 | 87 | 36.625 | 0.87395 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
ecb1ea8591aa9114ebd8aa46e47b46b7ab38cbac | 1,020 | py | Python | lintcode/476.py | jianershi/algorithm | c3c38723b9c5f1cc745550d89e228f92fd4abfb2 | [
"MIT"
] | 1 | 2021-01-08T06:57:49.000Z | 2021-01-08T06:57:49.000Z | lintcode/476.py | jianershi/algorithm | c3c38723b9c5f1cc745550d89e228f92fd4abfb2 | [
"MIT"
] | null | null | null | lintcode/476.py | jianershi/algorithm | c3c38723b9c5f1cc745550d89e228f92fd4abfb2 | [
"MIT"
] | 1 | 2021-01-08T06:57:52.000Z | 2021-01-08T06:57:52.000Z | """
greedy solution won't work.
[6, 4, 4, 6]
"""
import sys
class Solution:
"""
@param A: An integer array
@return: An integer
"""
def stoneGame(self, A):
# write your code here
if not A:
return 0
sum_list = []
self.sub_stone_game(A, sum_list)
return sum(sum_list)
def sub_stone_game(self, nums, sum_list):
if len(nums) == 1:
return
two_sum_min_start_index, two_sum_min = None, sys.maxsize
for i in range(len(nums) - 1):
two_sum = nums[i] + nums[i + 1]
if two_sum < two_sum_min:
two_sum_min_start_index = i
two_sum_min = two_sum
sum_list.append(two_sum_min)
# print(nums[0:two_sum_min_start_index] + [two_sum_min] + nums[two_sum_min_start_index + 2:])
self.sub_stone_game(nums[0:two_sum_min_start_index] + [two_sum_min] + nums[two_sum_min_start_index + 2:], sum_list)
A= [6, 4, 4, 6]
s = Solution()
print(s.stoneGame(A))
| 26.842105 | 123 | 0.586275 | 160 | 1,020 | 3.41875 | 0.3 | 0.164534 | 0.197441 | 0.153565 | 0.338208 | 0.259598 | 0.259598 | 0.259598 | 0.20841 | 0.20841 | 0 | 0.022409 | 0.3 | 1,020 | 37 | 124 | 27.567568 | 0.743697 | 0.19902 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027027 | 0 | 1 | 0.090909 | false | 0 | 0.045455 | 0 | 0.318182 | 0.045455 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ecb2b1128cfcfde10de11184d84e7acc91db76fe | 243 | py | Python | src/_createmodule.py | MenkeTechnologies/zsh-more-completions | c0d4716b695ea9bf3d0e870bc2ced5354db3c031 | [
"MIT"
] | 25 | 2018-07-29T01:49:23.000Z | 2022-01-19T19:21:23.000Z | src/_createmodule.py | MenkeTechnologies/zsh-more-completions | c0d4716b695ea9bf3d0e870bc2ced5354db3c031 | [
"MIT"
] | null | null | null | src/_createmodule.py | MenkeTechnologies/zsh-more-completions | c0d4716b695ea9bf3d0e870bc2ced5354db3c031 | [
"MIT"
] | null | null | null | #compdef createmodule.py
local arguments
arguments=(
'(- * :)'{-h,--help}'[show this help message and exit]'
{-p,--prefix}'[specify path prefix]'
'--noprefix[do not generate a prefix]'
'*:filename:_files'
)
_arguments -s $arguments
| 18.692308 | 57 | 0.662551 | 30 | 243 | 5.3 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152263 | 243 | 12 | 58 | 20.25 | 0.771845 | 0.09465 | 0 | 0 | 1 | 0 | 0.520548 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ecb2b63ee3b506d95d4074b377a2be554d83f6ec | 389 | py | Python | core/recc/network/address_family.py | bogonets/answer | 57f892a9841980bcbc35fa1e27521b34cd94bc25 | [
"MIT"
] | 3 | 2021-06-20T02:24:10.000Z | 2022-01-26T23:55:33.000Z | core/recc/network/address_family.py | bogonets/answer | 57f892a9841980bcbc35fa1e27521b34cd94bc25 | [
"MIT"
] | null | null | null | core/recc/network/address_family.py | bogonets/answer | 57f892a9841980bcbc35fa1e27521b34cd94bc25 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from ipaddress import ip_address, IPv4Address
from socket import AF_INET, AF_INET6
def get_ip_address_family(address: str) -> int:
return AF_INET if type(ip_address(address)) is IPv4Address else AF_INET6
def is_ip_address(address: str) -> bool:
try:
ip_address(address)
except ValueError:
return False
else:
return True
| 21.611111 | 76 | 0.694087 | 55 | 389 | 4.690909 | 0.527273 | 0.174419 | 0.186047 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016556 | 0.22365 | 389 | 17 | 77 | 22.882353 | 0.837748 | 0.053985 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.181818 | 0.090909 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
ecc3bc468f0a1e5af124df4c324e4f2cb4934001 | 212 | py | Python | unitconverter/gui/__init__.py | SeanSyue/Ch11-ipynb | c7b511e4341d2f0a24addc767575737a883134e8 | [
"MIT"
] | null | null | null | unitconverter/gui/__init__.py | SeanSyue/Ch11-ipynb | c7b511e4341d2f0a24addc767575737a883134e8 | [
"MIT"
] | null | null | null | unitconverter/gui/__init__.py | SeanSyue/Ch11-ipynb | c7b511e4341d2f0a24addc767575737a883134e8 | [
"MIT"
] | null | null | null | import sys
from PyQt4.QtGui import QApplication
from .UnitConverter import UnitConverter
def run_gui():
app = QApplication(sys.argv)
ui_window = UnitConverter(None)
ui_window.show()
app.exec_()
| 19.272727 | 40 | 0.735849 | 27 | 212 | 5.62963 | 0.62963 | 0.105263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005747 | 0.179245 | 212 | 10 | 41 | 21.2 | 0.867816 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.375 | 0 | 0.5 | 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 |
ecc90975567c8471f17f43f5bbe3603f17e1d16b | 9,183 | py | Python | tests/test_parsers.py | NucleiAI/youtube-data-api | 9d2c02bffb34e9a6172bda2fd641750f25392d4c | [
"MIT"
] | 53 | 2018-12-05T01:01:36.000Z | 2022-02-05T19:12:56.000Z | tests/test_parsers.py | NucleiAI/youtube-data-api | 9d2c02bffb34e9a6172bda2fd641750f25392d4c | [
"MIT"
] | 36 | 2018-09-27T14:18:13.000Z | 2021-12-08T09:06:40.000Z | tests/test_parsers.py | NucleiAI/youtube-data-api | 9d2c02bffb34e9a6172bda2fd641750f25392d4c | [
"MIT"
] | 25 | 2019-05-15T05:10:23.000Z | 2021-09-15T14:08:53.000Z | import os
import sys
sys.path.append('../')
import unittest
import json
import datetime
from youtube_api import parsers as P
class TestParsers(unittest.TestCase):
@classmethod
def setUpClass(cls):
dirname = os.path.dirname(__file__)
with open(os.path.join(dirname,'data','video_metadata.json')) as f:
cls.video_metadata = json.load(f)
with open(os.path.join(dirname, 'data', 'channel_metadata.json')) as f:
cls.channel_metadata = json.load(f)
with open(os.path.join(dirname, 'data', 'subscription.json')) as f:
cls.subscription = json.load(f)
with open(os.path.join(dirname, 'data', 'playlist_meta.json')) as f:
cls.playlist = json.load(f)
with open(os.path.join(dirname, 'data', 'comment_meta.json')) as f:
cls.comment = json.load(f)
with open(os.path.join(dirname, 'data','caption.json')) as f:
cls.caption = json.load(f)
with open(os.path.join(dirname, 'data', 'recommendation.json')) as f:
cls.rec = json.load(f)
def test_raw_json(self):
'''Verified by Megan Brown on 11/30/2018'''
item = self.video_metadata.get('items')[0]
self.assertEqual(item, P.raw_json(item))
def test_video_metadata(self):
'''Verified by Megan Brown on 11/30/2018'''
item = self.video_metadata.get('items')[0]
metadata = P.parse_video_metadata(self.video_metadata.get('items')[0])
self.assertEqual(metadata['video_tags'], '')
self.assertEqual(metadata['video_id'], "kNbhUWLH_yY")
self.assertEqual(metadata['channel_title'], "CUNAAdvocacy")
self.assertEqual(metadata['channel_id'], "UCJvIPpWSsW-EGuQjNIZbBTQ")
self.assertEqual(metadata['video_publish_date'], datetime.datetime.timestamp(datetime.datetime(2018, 3, 14, 20, 53, 14)))
self.assertEqual(metadata['video_title'], "Thank you Senator Crapo for your support on Regulatory Relief")
self.assertEqual(metadata['video_description'], '')
self.assertEqual(metadata['video_category'], "29")
self.assertEqual(metadata['video_thumbnail'], "https://i.ytimg.com/vi/kNbhUWLH_yY/hqdefault.jpg")
self.assertEqual(metadata['video_view_count'], item["statistics"].get("viewCount"))
self.assertEqual(metadata['video_comment_count'], item["statistics"].get("commentCount"))
self.assertEqual(metadata['video_like_count'], item["statistics"].get("likeCount"))
self.assertEqual(metadata['video_dislike_count'], item["statistics"].get("dislikeCount"))
@unittest.expectedFailure
def test_video_url(self):
'''Verified by Megan Brown on 11/30/2018'''
metadata = P.parse_video_url(self.video_metadata_item)
self.assertEqual(metadata['publish_date'], datetime.datetime.timestamp(datetime.datetime(2018, 3, 14, 20, 53, 14)))
self.assertEqual(metadata['video_id'], "kNbhUWLH_yY")
self.assertEqual(metadata['channel_id'], "UCJvIPpWSsW-EGuQjNIZbBTQ")
def test_channel_metadata(self):
'''Verified by Megan Brown on 11/30/2018'''
item = self.channel_metadata.get('items')[0]
metadata = P.parse_channel_metadata(item)
self.assertEqual(metadata['channel_id'], "UC_x5XG1OV2P6uZZ5FSM9Ttw")
self.assertEqual(metadata['title'], "Google Developers")
#self.assertEqual(metadata['publish_date'], datetime.datetime(2007, 8, 23, 0, 34, 43))
self.assertIsNone(metadata['keywords'])
self.assertEqual(metadata['description'], "The Google Developers channel features talks from events, educational series, best practices, tips, and the latest updates across our products and platforms.")
self.assertEqual(metadata['view_count'], item["statistics"].get("viewCount"))
self.assertEqual(metadata['video_count'], item["statistics"].get("videoCount"))
self.assertEqual(metadata['subscription_count'], item["statistics"].get("subscriberCount"))
self.assertEqual(metadata['playlist_id_likes'], item['contentDetails']['relatedPlaylists'].get('likes'))
self.assertEqual(metadata['playlist_id_uploads'], item['contentDetails']['relatedPlaylists'].get('uploads'))
self.assertEqual(metadata['topic_ids'], None)
def test_subscription_descriptive(self):
'''#Verified by Megan Brown on 11/30/2018'''
item = self.subscription.get('items')[0]
metadata = P.parse_subscription_descriptive(item)
self.assertEqual(metadata['subscription_title'], "Google Search Stories")
self.assertEqual(metadata['subscription_channel_id'], "UCvceBgMIpKb4zK1ss-Sh90w")
self.assertEqual(metadata['subscription_kind'], "youtube#channel")
self.assertEqual(metadata['subscription_publish_date'], datetime.datetime.timestamp(datetime.datetime(2012, 10, 3, 19, 11, 46)))
def test_featured_channels(self):
'''#Verified by Megan Brown on 11/30/2018'''
item = self.channel_metadata.get('items')[0]
metadata = P.parse_featured_channels(item)
featured_urls = [
"UCP4bf6IHJJQehibu6ai__cg",
"UCVHFbqXqoYvEWM1Ddxl0QDg",
"UCnUYZLuoy1rq1aVMwx4aTzw",
"UClKO7be7O9cUGL94PHnAeOA",
"UCdIiCSqXuybzwGwJwrpHPqw",
"UCJS9pqu9BzkAMNTmzNMNhvg",
"UCorTyjVGM-PV5CCKbosONow",
"UCTspylBf8iNobZHgwUD4PXA",
"UCeo-MamuQVFRcfQmS2N7fhw",
"UCQqa5UIHtrnpiADC3eHFupw",
"UCXPBsjgKKG2HqsKBhWA4uQw"
]
self.assertEqual(metadata["UC_x5XG1OV2P6uZZ5FSM9Ttw"],featured_urls)
def test_playlist_meta(self):
'''#Verified by Megan Brown on 11/30/2018'''
item = self.playlist.get('items')[0]
metadata = P.parse_playlist_metadata(item)
self.assertEqual(metadata['playlist_name'], "PAIR UX Symposium 2018")
self.assertEqual(metadata['playlist_id'], "PLOU2XLYxmsILhFpQQzS8zo8mc86IRNqMa")
self.assertEqual(metadata['playlist_publish_date'], datetime.datetime.timestamp(datetime.datetime(2018, 6, 29, 21, 24, 9)))
self.assertEqual(metadata['channel_id'], "UC_x5XG1OV2P6uZZ5FSM9Ttw")
self.assertEqual(metadata['channel_name'], "Google Developers")
self.assertEqual(metadata['playlist_n_videos'], item['contentDetails'].get('itemCount'))
def test_comment_metadata(self):
'''#Verified by Megan Brown on 11/30/2018'''
item = self.comment.get('items')[0]
metadata = P.parse_comment_metadata(item)
self.assertEqual(metadata['commenter_channel_url'], "http://www.youtube.com/channel/UCqPPexmEM4QzCq0P-yi6vNA")
self.assertEqual(metadata['commenter_channel_display_name'], "up work")
self.assertEqual(metadata['comment_id'], "Ugi7hPbxcLYF3HgCoAEC.7-H0Z7-0SCn8iOqY-oxrko")
self.assertEqual(metadata['comment_like_count'], item["snippet"].get("likeCount"))
self.assertEqual(metadata['comment_publish_date'], datetime.datetime.timestamp(datetime.datetime(2018, 7, 7, 10, 31, 0)))
self.assertEqual(metadata['text'], "asddddf")
self.assertEqual(metadata['video_id'], item["snippet"].get("videoId"))
self.assertEqual(metadata['commenter_rating'], "none")
self.assertEqual(metadata['comment_parent_id'], "Ugi7hPbxcLYF3HgCoAEC")
def test_rec_video(self):
'''#Verified by Megan Brown on 11/30/2018'''
item = self.rec.get('items')[0]
metadata = P.parse_rec_video_metadata(item)
self.assertEqual(metadata['video_id'], "w-HYZv6HzAs")
self.assertEqual(metadata['channel_title'], "TEDx Talks")
self.assertEqual(metadata['channel_id'], "UCsT0YIqwnpJCM-mx7-gSA4Q")
self.assertEqual(metadata['video_publish_date'], datetime.datetime.timestamp(datetime.datetime(2012, 1, 13, 19, 42, 36)))
self.assertEqual(metadata['video_title'], "The skill of self confidence | Dr. Ivan Joseph | TEDxRyersonU")
self.assertEqual(metadata['video_description'], "Never miss a talk! SUBSCRIBE to the TEDx channel: http://bit.ly/1FAg8hB\n\nAs the Athletic Director and head coach of the Varsity Soccer team at Ryerson University, Dr. Joseph is often asked what skills he is searching for as a recruiter: is it speed? Strength? Agility? In Dr. Joseph's TEDx Talk, he explores self confidence and how it is not just the most important skill in athletics, but in our lives.\n \nIn the spirit of ideas worth spreading, TEDx is a program of local, self-organized events that bring people together to share a TED-like experience. At a TEDx event, TEDTalks video and live speakers combine to spark deep discussion and connection in a small group. These local, self-organized events are branded TEDx, where x = independently organized TED event. The TED Conference provides general guidance for the TEDx program, but individual TEDx events are self-organized.* (*Subject to certain rules and regulations)")
self.assertIsNone(metadata['video_category'])
self.assertEqual(metadata['video_thumbnail'], "https://i.ytimg.com/vi/w-HYZv6HzAs/hqdefault.jpg")
if __name__ == '__main__':
unittest.main()
| 55.319277 | 990 | 0.691822 | 1,094 | 9,183 | 5.679159 | 0.274223 | 0.130372 | 0.196202 | 0.085627 | 0.446644 | 0.342025 | 0.318043 | 0.286496 | 0.249799 | 0.244326 | 0 | 0.032254 | 0.176195 | 9,183 | 165 | 991 | 55.654545 | 0.789028 | 0.047043 | 0 | 0.082645 | 0 | 0.016529 | 0.377484 | 0.07467 | 0 | 0 | 0 | 0 | 0.454545 | 1 | 0.082645 | false | 0 | 0.057851 | 0 | 0.14876 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
eceeeee4db8e124032a93643cb132da6bae4e965 | 4,417 | py | Python | MogBot.py | AlexMog/IRCPokemonBot | 0a735f262ce06ecd4c3b702094cf4b78e3cd7c45 | [
"MIT"
] | 2 | 2015-06-10T12:16:53.000Z | 2016-03-09T22:43:43.000Z | MogBot.py | AlexMog/IRCPokemonBot | 0a735f262ce06ecd4c3b702094cf4b78e3cd7c45 | [
"MIT"
] | null | null | null | MogBot.py | AlexMog/IRCPokemonBot | 0a735f262ce06ecd4c3b702094cf4b78e3cd7c45 | [
"MIT"
] | null | null | null | #!/usr/bin/env python2
import sys
import irclib
import ircbot
import random
import importlib
import traceback
from User import *
class MogBot(ircbot.SingleServerIRCBot):
def __init__(self, server, port, nickname, target, commandstarter, password):
ircbot.SingleServerIRCBot.__init__(self, [(server, port, password)], nickname, "MogBot")
self.target = target
self.commandstarter = commandstarter
self.modules = []
self.userManager = UserManager()
def getUserManager(self):
return self.userManager
def on_welcome(self, connection, event):
if irclib.is_channel(self.target):
connection.join(self.target)
else:
print "Not a channel."
sys.exit(0)
def on_disconnect(self, connection, event):
sys.exit(0)
def on_join(self, connection, event):
auteur = irclib.nm_to_n(event.source())
canal = event.target()
if auteur == connection.get_nickname():
print "Bot joined the channel."
def find_module(self, modulename):
for i in range(len(self.modules)):
if self.modules[i][0] == modulename:
return self.modules[i][1]
return False
def reload_commands(self):
print "Reloading commands..."
for i in range(len(self.modules)):
self.modules[i][1] = importlib.reload(self.modules[i][1])
print "Commands reloaded."
def on_pubmsg(self, connection, event):
""" Reception d'un message du channel """
auteur = irclib.nm_to_n(event.source())
canal = event.target()
canalobj = self.channels[event.target()]
message = event.arguments()[0]
if auteur != connection.get_nickname() and self.userManager.findUser(auteur) == False:
self.userManager.addUser(User(auteur))
print "<< " + auteur + " " + canal + " : " + message
if connection.get_nickname().lower() in message.lower():
self.on_msg_to_bot(connection, canal, auteur, message, canalobj)
if message.startswith(self.commandstarter + " "):
try:
cmds = message.split(" ")
if len(cmds) > 1:
cmd = cmds[1]
module = self.find_module(cmd)
if module == False:
print "Module '" + cmd + "' didn't exist. Adding it."
module = importlib.import_module('commands.%s' % cmd)
self.modules.append((cmd, module))
function = getattr(module, cmd)
function(connection, canal, auteur, cmds, canalobj, self)
except Exception, e:
print e
print(traceback.format_exc())
def on_nicknameinuse(self, connection, event):
print "Nickname in use!"
self.connection.quit("Nickname in use!")
def on_privmsg(self, connection, event):
auteur = irclib.nm_to_n(event.source())
message = event.arguments()[0]
print "<<! " + auteur + " : " + message
def on_msg_to_bot(self, connection, canal, auteur, message, canalobj):
print "<<mtb " + auteur + " : " + message
def on_kick(self, connection, event):
if event.arguments()[0] == connection.get_nickname():
print "Bot kicked!"
connection.join(self.target)
def main():
if len(sys.argv) < 4:
print "Usage: " + sys.argv[0] + " <server[:port]> <botname> <target> [command starter(without !)] [password]"
print "Target need to be a nickname, or a channel (starts with #)"
print "The default command starter is !bot, it is used to interract with the bot"
sys.exit(1)
password = None
commandstarter = "!bot"
if len(sys.argv) > 4:
commandstarter = "!" + sys.argv[4]
if len(sys.argv) > 5:
password = sys.argv[5]
s = sys.argv[1].split(":", 1)
server = s[0]
if len(s) == 2:
try:
port = int(s[1])
except ValueError:
print "Error: Port need to be numeric!"
sys.exit(1)
else:
port = 6667
nickname = sys.argv[2]
target = sys.argv[3]
conn = MogBot(server, port, nickname, target, commandstarter, password)
print "Starting bot..."
conn.start()
if __name__ == "__main__":
main()
| 35.055556 | 117 | 0.573466 | 503 | 4,417 | 4.946322 | 0.272366 | 0.050643 | 0.053457 | 0.019293 | 0.206994 | 0.118971 | 0.081994 | 0.061897 | 0.061897 | 0.061897 | 0 | 0.010081 | 0.303826 | 4,417 | 125 | 118 | 35.336 | 0.799024 | 0.004754 | 0 | 0.179245 | 0 | 0 | 0.107487 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.056604 | 0.084906 | null | null | 0.160377 | 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 |
01aceadd7cad8cbc7cb0ceb6f205d5a501ca3359 | 2,295 | py | Python | Tools/csv2tkiz.py | jqmmes/NS3 | dcbcc7f080d7efebe865f9451c9be38869b1f158 | [
"Apache-2.0"
] | null | null | null | Tools/csv2tkiz.py | jqmmes/NS3 | dcbcc7f080d7efebe865f9451c9be38869b1f158 | [
"Apache-2.0"
] | null | null | null | Tools/csv2tkiz.py | jqmmes/NS3 | dcbcc7f080d7efebe865f9451c9be38869b1f158 | [
"Apache-2.0"
] | null | null | null | from sys import argv, stdout, stdin
from math import sqrt, pow
data = stdin.read().replace(",", ".").split("\n")
header = data[0].split(";")
if len(argv) < 2:
param = "time"
else:
param = str(argv[1])
show_sd = False
if len(argv) >= 3:
if argv[2] == "sd":
show_sd = True
colors = ["blue", "black", "purple", "green", "orange", "grey", "pink", "yellow"]
marks = ["square", "triangle", "*", "diamond", "square*", "grey", "pink", "yellow"]
c = 0
print "\\begin{figure}[ht]"
print "\minipage{0.5\textwidth}"
print " \\begin{tikzpicture}[scale=0.7]"
print " \\begin{axis}["
print " title={%s}," % header[0] # Download Time / Traffic
print " xlabel={Number of devices},"
print " ylabel={%s}," % ("MegaBytes [MB]" if param == "load" else "Time [ms]") # Time [ms] / MegaBytes [MB]
print " xmin=0, xmax=17,"
print " ymin=0, ymax=%d," % (1250 if param == "load" else 12500) # 12500 / 1250
print " xtick={1,2,4,6,8},"
print " ytick={0,%s}," % ("250,500,750,1000,1250" if param == "load" else "2500,5000,7500,10000,12500") # 2500,5000,7500,10000,12500 / 250,500,750,1000,1250
print " ymajorgrids=true,"
print " grid style=dashed,"
print " legend pos=north west"
print " ]"
for row in data[1:]:
row = row.split(";")
if len(row) < len(header):
continue
print len(row)
print " \\addplot[color=%s, mark=square]" % (colors[c%len(colors)])
print " plot[error bars/.cd, y dir=both, y explicit]"
print " coordinates {"
i = 0
for s in header[1:]:
if row[min((i*2 if show_sd else i)+1, len(row)-1)].strip() == "":
print " (%s, 0.0) +-(1, 0.0)" % s
else:
print " (%s, %0.2f) +-(1, %0.2f)" % (s, float(row[(i*2 if show_sd else i)+1]), (float(row[i*2+2]) if show_sd else 0.0))
i += 1
print " };"
print " \\addlegendentry{%s%%}" % row[0]
print ""
c += 1
print " \end{axis}"
print " \end{tikzpicture}"
print " \caption{%s}" % ("Average download time per file." if param != "load" else "Traffic handled by AP.")
print " \label{fig:simulation_%s}" % ("download_time" if param != "load" else "load")
print "\endminipage" | 38.898305 | 165 | 0.534641 | 323 | 2,295 | 3.77709 | 0.402477 | 0.02459 | 0.045082 | 0.061475 | 0.128689 | 0.02623 | 0.02623 | 0.02623 | 0 | 0 | 0 | 0.083529 | 0.259259 | 2,295 | 59 | 166 | 38.898305 | 0.634118 | 0.050109 | 0 | 0.037037 | 0 | 0 | 0.434743 | 0.068474 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.037037 | null | null | 0.537037 | 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 |
01b2cc44a96e1167c4a5376dd6045eee62ce1185 | 229 | py | Python | Scripts_Pyhton/Reindexacao.py | gmsantos1988/Work_Pandas | a5f53d4ac416b6b6e2f0acdc899cbf3bdc86f406 | [
"MIT"
] | null | null | null | Scripts_Pyhton/Reindexacao.py | gmsantos1988/Work_Pandas | a5f53d4ac416b6b6e2f0acdc899cbf3bdc86f406 | [
"MIT"
] | null | null | null | Scripts_Pyhton/Reindexacao.py | gmsantos1988/Work_Pandas | a5f53d4ac416b6b6e2f0acdc899cbf3bdc86f406 | [
"MIT"
] | null | null | null | #Trabalhando com sorted no Pandas
import pandas as pd
import numpy as np
unsorted_df = pd.DataFrame(np.random.randn(10,2),index=[1,4,6,2,3,5,9,8,0,7],columns = ['col2','col1'])
sorted_df=unsorted_df.sort_index()
print (sorted_df) | 38.166667 | 103 | 0.746725 | 45 | 229 | 3.688889 | 0.711111 | 0.120482 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.07177 | 0.087336 | 229 | 6 | 104 | 38.166667 | 0.722488 | 0.139738 | 0 | 0 | 0 | 0 | 0.040609 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0.2 | 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 |
01c7804669994a4d27cf2f066226995eaa1f41f8 | 4,253 | py | Python | puro/plugins/__init__.py | jvtm/puro | 653bf4ab8c8f65e8ef2050753d45d9b40af5d498 | [
"Apache-2.0"
] | 2 | 2018-03-01T00:31:34.000Z | 2018-03-01T08:04:42.000Z | puro/plugins/__init__.py | jvtm/puro | 653bf4ab8c8f65e8ef2050753d45d9b40af5d498 | [
"Apache-2.0"
] | 1 | 2018-05-17T06:13:43.000Z | 2018-05-17T06:13:43.000Z | puro/plugins/__init__.py | jvtm/puro | 653bf4ab8c8f65e8ef2050753d45d9b40af5d498 | [
"Apache-2.0"
] | null | null | null | """
Plugin registry, base classes and related helpers
"""
import importlib
import inspect
import logging
from collections.abc import MutableMapping
from typing import Optional, Type
from ..errors import StopProcessing
class Registry(MutableMapping):
"""Container for loading plugin classes based on configuration values.
Plugin classes can be referred by `name`, which makes the overall
configuration a bit more friendly.
"""
def __init__(self):
self._plugins = {}
def load_class(self, mod_path: str, *, name: Optional[str] = None, base_class: Optional[Type] = None) -> str:
""" Load a class into the registry
If name is not given, `plugin_name` class variable is checked from
the loaded class. If that is missing, full module path is used.
Might raise AttributeError, TypeError, ModuleNotFoundError, ...
:param mod_path: full module path including the class name
:param name: override plugin name
:param base_class: optional sub-class check
:return: loaded plugin name (to be used with other methods)
"""
mod_name, _, class_name = mod_path.rpartition(".")
module = importlib.import_module(mod_name)
plugin_class = getattr(module, class_name)
if name is None:
name = getattr(plugin_class, "plugin_name", mod_path)
self.add_class(name, plugin_class, base_class=base_class)
return name
def add_class(self, name: str, plugin_class: Type, *, base_class: Optional[Type] = None):
"""Add class manually to Registry
This is useful for cases when classes are being added during runtime, eg. from factory methods.
"""
if not inspect.isclass(plugin_class):
raise TypeError(f"{plugin_class} is not a class")
if base_class is not None and not issubclass(plugin_class, base_class):
raise TypeError(f"{name!r} {plugin_class} is not sub-class of {base_class}")
self._plugins[name] = plugin_class
def __setitem__(self, key, value):
self.add_class(key, value)
def __getitem__(self, key):
return self.get_class(key)
def __delitem__(self, key):
del self._plugins[key]
def __iter__(self):
return iter(self._plugins)
def __len__(self):
return len(self._plugins)
def get_class(self, plugin_name: str) -> Type:
"""Return already loaded class"""
return self._plugins[plugin_name]
def get_instance(self, plugin_name: str, *args, **kwargs):
"""Create instance of already loaded class"""
return self._plugins[plugin_name](*args, **kwargs)
class BasePlugin: # pylint: disable=too-few-public-methods
def __init__(self, name: str):
# perhaps logger should be the name, with a prefix...
self.log = logging.getLogger(self.__class__.__name__)
self.name = name
class Action(BasePlugin):
async def __call__(self, item):
raise NotImplementedError()
class Selector(Action):
def check(self, value):
"""Check if single item matches the configured schema, restrictions.
Usually `value` is dictionary, but other basic types possible too
Note: task/feed/service context are intentionally not available here.
For now any logic that needs to remember anything, access external data
stores, etc should be implemented as Action instead
For now, this SHOULD NOT raise any ValueErrors, KeyErrors etc.
So, depending on the used helpers, catch whatever it might throw at you.
"""
raise NotImplementedError()
async def __call__(self, item):
if not self.check(item.value):
raise StopProcessing()
class ServicePlugin(BasePlugin):
"""Base class for service plugins
Instantiated once, and reachable via service context
Useful for DB connections, global state objects, statistics etc
"""
async def initialize(self):
"""Initialize service plugin"""
# This is the place to do connection, pool, etc creation,
# especially if those are coroutines themselves
# TODO: might add loop=None keyword argument, if we ever want to use custom loop
pass
| 35.441667 | 113 | 0.674818 | 548 | 4,253 | 5.071168 | 0.372263 | 0.029147 | 0.015113 | 0.015113 | 0.064772 | 0.032386 | 0.032386 | 0.032386 | 0 | 0 | 0 | 0 | 0.243358 | 4,253 | 119 | 114 | 35.739496 | 0.86358 | 0.405596 | 0 | 0.075472 | 0 | 0 | 0.042469 | 0 | 0 | 0 | 0 | 0.008403 | 0 | 1 | 0.226415 | false | 0.018868 | 0.132075 | 0.056604 | 0.566038 | 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 |
01d2bcd4ecdb03aa758fe3094d39920a0bc6ffc3 | 1,689 | py | Python | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/mca/survey/cmd/registryhive/errors.py | bidhata/EquationGroupLeaks | 1ff4bc115cb2bd5bf2ed6bf769af44392926830c | [
"Unlicense"
] | 9 | 2019-11-22T04:58:40.000Z | 2022-02-26T16:47:28.000Z | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/mca/survey/cmd/registryhive/errors.py | bidhata/EquationGroupLeaks | 1ff4bc115cb2bd5bf2ed6bf769af44392926830c | [
"Unlicense"
] | null | null | null | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/mca/survey/cmd/registryhive/errors.py | bidhata/EquationGroupLeaks | 1ff4bc115cb2bd5bf2ed6bf769af44392926830c | [
"Unlicense"
] | 8 | 2017-09-27T10:31:18.000Z | 2022-01-08T10:30:46.000Z | # uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: errors.py
import mcl.status
ERR_SUCCESS = mcl.status.MCL_SUCCESS
ERR_INVALID_PARAM = mcl.status.framework.ERR_START
ERR_INVALID_HIVE = mcl.status.framework.ERR_START + 1
ERR_INVALID_ACTION = mcl.status.framework.ERR_START + 2
ERR_MARSHAL_FAILED = mcl.status.framework.ERR_START + 3
ERR_OPEN_FAILED = mcl.status.framework.ERR_START + 4
ERR_API_UNAVAILABLE = mcl.status.framework.ERR_START + 5
ERR_LOAD_FAILED = mcl.status.framework.ERR_START + 6
ERR_UNLOAD_FAILED = mcl.status.framework.ERR_START + 7
ERR_SAVE_FAILED = mcl.status.framework.ERR_START + 8
ERR_RESTORE_FAILED = mcl.status.framework.ERR_START + 9
ERR_UNLOAD_LIST_LOCKED = mcl.status.framework.ERR_START + 10
ERR_GET_FULL_PATH_FAILED = mcl.status.framework.ERR_START + 11
ERR_SEND_FAILED = mcl.status.framework.ERR_START + 12
errorStrings = {ERR_INVALID_PARAM: 'Invalid parameter(s)',
ERR_INVALID_HIVE: 'Invalid hive',
ERR_INVALID_ACTION: 'Invalid action',
ERR_MARSHAL_FAILED: 'Marshaling data failed',
ERR_OPEN_FAILED: 'Failed to open registry key',
ERR_API_UNAVAILABLE: 'Unable to access the registry API',
ERR_LOAD_FAILED: 'Failed to load hive',
ERR_UNLOAD_FAILED: 'Failed to unload hive',
ERR_SAVE_FAILED: 'Failed to save hive to file',
ERR_RESTORE_FAILED: 'Failed to restore key from file',
ERR_UNLOAD_LIST_LOCKED: 'Unable to add hive to list of hives to unload. Unload list is currently locked',
ERR_GET_FULL_PATH_FAILED: 'Failed to get full path to hive',
ERR_SEND_FAILED: 'Failed to send marshalled message'
} | 49.676471 | 109 | 0.781528 | 272 | 1,689 | 4.584559 | 0.283088 | 0.10826 | 0.18765 | 0.218925 | 0.336808 | 0.205293 | 0 | 0 | 0 | 0 | 0 | 0.036735 | 0.129663 | 1,689 | 34 | 110 | 49.676471 | 0.811565 | 0.100651 | 0 | 0 | 0 | 0 | 0.243725 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.034483 | 0 | 0.034483 | 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 |
01dd3bbf271f14ba0b2a2d9453777f7f4c7ff54c | 354 | py | Python | Python-codes-CeV/26-PhraseAnalysis.py | engcristian/Python | 726a53e9499fd5d0594572298e59e318f98e2d36 | [
"MIT"
] | 1 | 2021-02-22T03:53:23.000Z | 2021-02-22T03:53:23.000Z | Python-codes-CeV/26-PhraseAnalysis.py | engcristian/Python | 726a53e9499fd5d0594572298e59e318f98e2d36 | [
"MIT"
] | null | null | null | Python-codes-CeV/26-PhraseAnalysis.py | engcristian/Python | 726a53e9499fd5d0594572298e59e318f98e2d36 | [
"MIT"
] | null | null | null | '''
Analysing the letter 'A' in a phrase.
'''
phrase = str(input('Type any phrase: ')).strip().lower()
print('The letter A appears {} times in this phrase.'.format(phrase.count('a')))
print('The first letter A appeared on the {}º position.'.format(phrase.find('a')+1))
print('The last letter A appeared on the {}º position.'.format(phrase.rfind('a')+1)) | 50.571429 | 84 | 0.683616 | 58 | 354 | 4.172414 | 0.465517 | 0.115702 | 0.082645 | 0.140496 | 0.338843 | 0.338843 | 0.338843 | 0.338843 | 0.338843 | 0 | 0 | 0.00641 | 0.118644 | 354 | 7 | 85 | 50.571429 | 0.769231 | 0.10452 | 0 | 0 | 0 | 0 | 0.519355 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.75 | 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 | 0 | 0 | 0 | 1 | 0 | 2 |
01f0da756140dd41172ed7b10ee7f16196ee035e | 866 | py | Python | example_websockets.py | whittlem/eodhistoricaldata | f0d3991fdf523ee1af3e287b60b6b849bfba5c79 | [
"MIT"
] | 8 | 2021-11-02T02:16:37.000Z | 2022-02-27T04:41:10.000Z | example_websockets.py | webclinic017/eodhistoricaldata-1 | f0d3991fdf523ee1af3e287b60b6b849bfba5c79 | [
"MIT"
] | null | null | null | example_websockets.py | webclinic017/eodhistoricaldata-1 | f0d3991fdf523ee1af3e287b60b6b849bfba5c79 | [
"MIT"
] | 4 | 2021-11-13T10:02:59.000Z | 2022-03-31T05:19:48.000Z | """Websocket example"""
from time import sleep
from eodhistoricaldata import WebSocketClient
def main() -> None:
"""Main"""
websocket = WebSocketClient(
# Demo API key for testing purposes
api_key="OeAFFmMliFG5orCUuwAKQ8l4WWFQ67YX", endpoint="crypto", symbols=["BTC-USD"]
#api_key="OeAFFmMliFG5orCUuwAKQ8l4WWFQ67YX", endpoint="forex", symbols=["EURUSD"]
#api_key="OeAFFmMliFG5orCUuwAKQ8l4WWFQ67YX", endpoint="us", symbols=["AAPL"]
)
websocket.start()
message_count = 0
while True:
if websocket:
if (
message_count != websocket.message_count
):
print(websocket.message)
message_count = websocket.message_count
sleep(0.25) # output every 1/4 second, websocket is realtime
if __name__ == "__main__":
main()
| 29.862069 | 90 | 0.628176 | 82 | 866 | 6.439024 | 0.536585 | 0.113636 | 0.215909 | 0.261364 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032967 | 0.264434 | 866 | 28 | 91 | 30.928571 | 0.795918 | 0.299076 | 0 | 0 | 0 | 0 | 0.089376 | 0.053963 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0 | 0.111111 | 0 | 0.166667 | 0.055556 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.