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
10cf17556815f4f6e18976ca7404a21af1a97d41
954
py
Python
powerbi/import.py
salvaguardia/power-bi-python-api
e8ae210075486e03d1a7d518e71ed81be807a393
[ "MIT" ]
17
2021-05-26T01:08:38.000Z
2022-03-05T00:36:23.000Z
powerbi/import.py
salvaguardia/power-bi-python-api
e8ae210075486e03d1a7d518e71ed81be807a393
[ "MIT" ]
3
2021-11-15T22:45:51.000Z
2022-03-18T17:32:35.000Z
powerbi/import.py
salvaguardia/power-bi-python-api
e8ae210075486e03d1a7d518e71ed81be807a393
[ "MIT" ]
8
2021-04-05T03:27:21.000Z
2022-01-18T10:38:48.000Z
class ImportBuilder(): def __init__(self, file_type: str) -> None: self.allowed_file_types = [ 'xlsx', 'json', 'pbix', 'rdl', 'onedrive' ] if file_type not in self.allowed_file_types: raise ValueError( "File type not supported, please provide file types that are supported." ) _content_header = f""" Content-Disposition: form-data; filename="{0}" Content-Type: {0} """ def set_file_type(self) -> None: pass def set_file_path(self) -> None: pass def load_and_encode(self, file_path: str) -> None: pass def connection_details(self, connection_type: str = None, file_path: str = None, file_url: str = None) -> None: pass def _construct_headers(self) -> None: pass def _validate_file_extension(self) -> None: pass
22.714286
115
0.549266
107
954
4.635514
0.439252
0.096774
0.110887
0.090726
0
0
0
0
0
0
0
0.003221
0.349057
954
41
116
23.268293
0.795491
0
0
0.206897
0
0
0.192227
0
0
0
0
0
0
1
0.241379
false
0.206897
0.034483
0
0.310345
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
10d3044b0ca5ba98b4949543ae4baf1914cf1a41
12,730
py
Python
pysnmp-with-texts/HPN-ICF-NVGRE-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/HPN-ICF-NVGRE-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/HPN-ICF-NVGRE-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module HPN-ICF-NVGRE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-NVGRE-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:40:39 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint") hpnicfCommon, = mibBuilder.importSymbols("HPN-ICF-OID-MIB", "hpnicfCommon") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Gauge32, ModuleIdentity, MibIdentifier, Counter64, TimeTicks, NotificationType, Unsigned32, iso, Counter32, IpAddress, ObjectIdentity, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "ModuleIdentity", "MibIdentifier", "Counter64", "TimeTicks", "NotificationType", "Unsigned32", "iso", "Counter32", "IpAddress", "ObjectIdentity", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32") DisplayString, MacAddress, RowStatus, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "MacAddress", "RowStatus", "TextualConvention") hpnicfNvgre = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156)) hpnicfNvgre.setRevisions(('2014-03-11 09:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: hpnicfNvgre.setRevisionsDescriptions(('Initial version.',)) if mibBuilder.loadTexts: hpnicfNvgre.setLastUpdated('201403110900Z') if mibBuilder.loadTexts: hpnicfNvgre.setOrganization('') if mibBuilder.loadTexts: hpnicfNvgre.setContactInfo('') if mibBuilder.loadTexts: hpnicfNvgre.setDescription('The NVGRE MIB.') hpnicfNvgreObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1)) hpnicfNvgreScalarGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 1)) hpnicfNvgreNextNvgreID = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 1, 1), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfNvgreNextNvgreID.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreNextNvgreID.setDescription('Next available NVGRE ID(identifier), in the range of 4096 to 16777214. The invalid value 4294967295 indicates that no ID can be set.') hpnicfNvgreConfigured = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 1, 2), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfNvgreConfigured.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreConfigured.setDescription('Number of currently configured NVGREs.') hpnicfNvgreTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 2), ) if mibBuilder.loadTexts: hpnicfNvgreTable.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreTable.setDescription('A table for NVGRE parameters.') hpnicfNvgreEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 2, 1), ).setIndexNames((0, "HPN-ICF-NVGRE-MIB", "hpnicfNvgreID")) if mibBuilder.loadTexts: hpnicfNvgreEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreEntry.setDescription('Each entry represents the parameters of an NVGRE.') hpnicfNvgreID = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 2, 1, 1), Unsigned32()) if mibBuilder.loadTexts: hpnicfNvgreID.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreID.setDescription('The NVGRE ID, in the range of 4096 to 16777214.') hpnicfNvgreVsiIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 2, 1, 2), Unsigned32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfNvgreVsiIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreVsiIndex.setDescription('VSI index. A unique index for the conceptual row identifying a VSI(Virtual Switch Instance) in the hpnicfVsiTable.') hpnicfNvgreRemoteMacCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 2, 1, 3), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfNvgreRemoteMacCount.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreRemoteMacCount.setDescription('Remote MAC(Media Access Control) address count of this NVGRE.') hpnicfNvgreRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 2, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfNvgreRowStatus.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreRowStatus.setDescription('Operation status of this table entry. When a row in this table is in active state, no objects in that row can be modified by the agent.') hpnicfNvgreTunnelTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 3), ) if mibBuilder.loadTexts: hpnicfNvgreTunnelTable.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreTunnelTable.setDescription('A table for NVGRE tunnel parameters.') hpnicfNvgreTunnelEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 3, 1), ).setIndexNames((0, "HPN-ICF-NVGRE-MIB", "hpnicfNvgreID"), (0, "HPN-ICF-NVGRE-MIB", "hpnicfNvgreTunnelID")) if mibBuilder.loadTexts: hpnicfNvgreTunnelEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreTunnelEntry.setDescription('Each entry represents the parameters of an NVGRE tunnel.') hpnicfNvgreTunnelID = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 3, 1, 1), Unsigned32()) if mibBuilder.loadTexts: hpnicfNvgreTunnelID.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreTunnelID.setDescription('A unique index for tunnel.') hpnicfNvgreTunnelRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 3, 1, 2), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfNvgreTunnelRowStatus.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreTunnelRowStatus.setDescription('Operation status of this table entry.') hpnicfNvgreTunnelOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 3, 1, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfNvgreTunnelOctets.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreTunnelOctets.setDescription('The number of octets that have been forwarded over the tunnel.') hpnicfNvgreTunnelPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 3, 1, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfNvgreTunnelPackets.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreTunnelPackets.setDescription('The number of packets that have been forwarded over the tunnel.') hpnicfNvgreTunnelBoundTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 4), ) if mibBuilder.loadTexts: hpnicfNvgreTunnelBoundTable.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreTunnelBoundTable.setDescription('A table for the number of NVGREs to which the tunnel is bound.') hpnicfNvgreTunnelBoundEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 4, 1), ).setIndexNames((0, "HPN-ICF-NVGRE-MIB", "hpnicfNvgreTunnelID")) if mibBuilder.loadTexts: hpnicfNvgreTunnelBoundEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreTunnelBoundEntry.setDescription('An entry represents the number of NVGREs to which a tunnel is bound.') hpnicfNvgreTunnelBoundNvgreNum = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 4, 1, 1), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfNvgreTunnelBoundNvgreNum.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreTunnelBoundNvgreNum.setDescription('The number of NVGREs to which this tunnel is bound.') hpnicfNvgreMacTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 5), ) if mibBuilder.loadTexts: hpnicfNvgreMacTable.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreMacTable.setDescription('A table for NVGRE remote MAC addresses.') hpnicfNvgreMacEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 5, 1), ).setIndexNames((0, "HPN-ICF-NVGRE-MIB", "hpnicfNvgreVsiIndex"), (0, "HPN-ICF-NVGRE-MIB", "hpnicfNvgreMacAddr")) if mibBuilder.loadTexts: hpnicfNvgreMacEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreMacEntry.setDescription('An NVGRE remote MAC address.') hpnicfNvgreMacAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 5, 1, 1), MacAddress()) if mibBuilder.loadTexts: hpnicfNvgreMacAddr.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreMacAddr.setDescription('MAC address.') hpnicfNvgreMacTunnelID = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 5, 1, 2), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfNvgreMacTunnelID.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreMacTunnelID.setDescription('A unique index for tunnel.') hpnicfNvgreMacType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 5, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("selfLearned", 1), ("staticConfigured", 2), ("protocolLearned", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfNvgreMacType.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreMacType.setDescription('The type of an MAC address.') hpnicfNvgreStaticMacTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 6), ) if mibBuilder.loadTexts: hpnicfNvgreStaticMacTable.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreStaticMacTable.setDescription('A table for NVGRE static remote MAC addresses.') hpnicfNvgreStaticMacEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 6, 1), ).setIndexNames((0, "HPN-ICF-NVGRE-MIB", "hpnicfNvgreVsiIndex"), (0, "HPN-ICF-NVGRE-MIB", "hpnicfNvgreStaticMacAddr")) if mibBuilder.loadTexts: hpnicfNvgreStaticMacEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreStaticMacEntry.setDescription('An NVGRE static MAC address.') hpnicfNvgreStaticMacAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 6, 1, 1), MacAddress()) if mibBuilder.loadTexts: hpnicfNvgreStaticMacAddr.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreStaticMacAddr.setDescription('Static MAC address.') hpnicfNvgreStaticMacTunnelID = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 6, 1, 2), Unsigned32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfNvgreStaticMacTunnelID.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreStaticMacTunnelID.setDescription('A unique index for tunnel.') hpnicfNvgreStaticMacRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 156, 1, 6, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfNvgreStaticMacRowStatus.setStatus('current') if mibBuilder.loadTexts: hpnicfNvgreStaticMacRowStatus.setDescription('Operation status of this table entry. When a row in this table is in active state, no objects in that row can be modified by the agent.') mibBuilder.exportSymbols("HPN-ICF-NVGRE-MIB", hpnicfNvgreTunnelBoundNvgreNum=hpnicfNvgreTunnelBoundNvgreNum, hpnicfNvgreStaticMacTable=hpnicfNvgreStaticMacTable, hpnicfNvgreEntry=hpnicfNvgreEntry, hpnicfNvgreTunnelBoundTable=hpnicfNvgreTunnelBoundTable, PYSNMP_MODULE_ID=hpnicfNvgre, hpnicfNvgreTunnelID=hpnicfNvgreTunnelID, hpnicfNvgreTunnelPackets=hpnicfNvgreTunnelPackets, hpnicfNvgreRowStatus=hpnicfNvgreRowStatus, hpnicfNvgreTunnelEntry=hpnicfNvgreTunnelEntry, hpnicfNvgreMacType=hpnicfNvgreMacType, hpnicfNvgreID=hpnicfNvgreID, hpnicfNvgreScalarGroup=hpnicfNvgreScalarGroup, hpnicfNvgreMacTable=hpnicfNvgreMacTable, hpnicfNvgreRemoteMacCount=hpnicfNvgreRemoteMacCount, hpnicfNvgre=hpnicfNvgre, hpnicfNvgreConfigured=hpnicfNvgreConfigured, hpnicfNvgreMacEntry=hpnicfNvgreMacEntry, hpnicfNvgreStaticMacAddr=hpnicfNvgreStaticMacAddr, hpnicfNvgreStaticMacRowStatus=hpnicfNvgreStaticMacRowStatus, hpnicfNvgreTunnelTable=hpnicfNvgreTunnelTable, hpnicfNvgreTunnelOctets=hpnicfNvgreTunnelOctets, hpnicfNvgreTable=hpnicfNvgreTable, hpnicfNvgreMacAddr=hpnicfNvgreMacAddr, hpnicfNvgreMacTunnelID=hpnicfNvgreMacTunnelID, hpnicfNvgreStaticMacEntry=hpnicfNvgreStaticMacEntry, hpnicfNvgreTunnelBoundEntry=hpnicfNvgreTunnelBoundEntry, hpnicfNvgreVsiIndex=hpnicfNvgreVsiIndex, hpnicfNvgreStaticMacTunnelID=hpnicfNvgreStaticMacTunnelID, hpnicfNvgreObjects=hpnicfNvgreObjects, hpnicfNvgreNextNvgreID=hpnicfNvgreNextNvgreID, hpnicfNvgreTunnelRowStatus=hpnicfNvgreTunnelRowStatus)
117.87037
1,465
0.777298
1,496
12,730
6.612968
0.150401
0.071566
0.12524
0.01213
0.450217
0.313757
0.251895
0.233903
0.193672
0.171434
0
0.072233
0.093009
12,730
107
1,466
118.971963
0.784601
0.025766
0
0
0
0.040404
0.213508
0.005487
0
0
0
0
0
1
0
false
0
0.070707
0
0.070707
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
10d5a192bd753578821b8de811bfa7e8cccf1dfa
213
py
Python
Develop/C/blob/readfile.py
guoyudejin/SkrSkr
433aac617b549fcf387c8196c292e211eadffa71
[ "MIT" ]
null
null
null
Develop/C/blob/readfile.py
guoyudejin/SkrSkr
433aac617b549fcf387c8196c292e211eadffa71
[ "MIT" ]
null
null
null
Develop/C/blob/readfile.py
guoyudejin/SkrSkr
433aac617b549fcf387c8196c292e211eadffa71
[ "MIT" ]
null
null
null
image = [] with open('conv0.bb','rb') as f: pixels = f.read(320 * 160 * 4 * 2) print(type(pixels)) for pixel in pixels: image.append(pixel) print(len(image)) print(max(image)) print(min(image))
23.666667
38
0.610329
34
213
3.823529
0.676471
0.153846
0
0
0
0
0
0
0
0
0
0.053254
0.206573
213
9
39
23.666667
0.715976
0
0
0
0
0
0.046729
0
0
0
0
0
0
1
0
false
0
0
0
0
0.444444
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
10e4e997c0ea5773324d467ca62a87810fa04b55
362
py
Python
hellow.py
suhasksv/py-ground
8c04a845c6b5c4efcb335c8ad59416874e8226d1
[ "Apache-2.0" ]
3
2020-06-01T09:40:41.000Z
2020-08-26T12:09:27.000Z
hellow.py
suhasksv/py-ground
8c04a845c6b5c4efcb335c8ad59416874e8226d1
[ "Apache-2.0" ]
null
null
null
hellow.py
suhasksv/py-ground
8c04a845c6b5c4efcb335c8ad59416874e8226d1
[ "Apache-2.0" ]
4
2020-07-20T10:38:23.000Z
2020-10-16T08:41:05.000Z
print ("Hello world ....! Hi") count = 10 print("I am at break-point ",count); count=10*2 print("end ",count) print ("Hello world") pr = input("enter your name .!!") print ("Hello world",pr) for hooray_counter in range(1, 10): for hip_counter in range(1, 3): print ("Hip") print ("Hooray!!") while True: print("this is an infinite loop")
19.052632
37
0.621547
57
362
3.912281
0.578947
0.134529
0.201794
0.152466
0
0
0
0
0
0
0
0.034602
0.201657
362
18
38
20.111111
0.737024
0
0
0
0
0
0.331492
0
0
0
0
0
0
1
0
false
0
0
0
0
0.571429
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
0
1
0
2
10f4395e6a878bab145c7e017fb82670215b75dd
750
py
Python
cjkradlib/_decompose.py
patarapolw/cjkradlib
f467a1330047a68b1f9fce2d1748d1717da479c7
[ "MIT" ]
7
2019-04-18T07:02:31.000Z
2022-02-14T23:49:29.000Z
cjkradlib/_decompose.py
patarapolw/cjkradlib
f467a1330047a68b1f9fce2d1748d1717da479c7
[ "MIT" ]
2
2018-10-20T01:06:46.000Z
2019-06-03T12:12:02.000Z
cjkradlib/_decompose.py
patarapolw/cjkradlib
f467a1330047a68b1f9fce2d1748d1717da479c7
[ "MIT" ]
1
2021-01-15T04:43:39.000Z
2021-01-15T04:43:39.000Z
import re try: from importlib.resources import read_text except ImportError: from importlib_resources import read_text class Decompose: def __init__(self): self.entries = dict() self.super_entries = dict() for row in read_text('cjkradlib.data', 'cjk-decomp.txt').strip().split('\n'): entry, _, components = re.match('(.+):(.+)\((.*)\)', row).groups() comp_list = components.split(',') self.entries[entry] = comp_list for comp in comp_list: self.super_entries.setdefault(comp, []).append(entry) def get_sub(self, char): return self.entries.get(char, []) def get_super(self, char): return self.super_entries.get(char, [])
28.846154
85
0.605333
90
750
4.855556
0.455556
0.05492
0.10984
0.128146
0.16476
0.16476
0
0
0
0
0
0
0.250667
750
25
86
30
0.77758
0
0
0
0
0
0.064
0
0
0
0
0
0
1
0.157895
false
0
0.210526
0.105263
0.526316
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
10fa6bd35011013b46e4c0f3919394dcc4513eb4
5,438
py
Python
bac/simulate/gromacs/free_energy_controller.py
UCL-CCS/BAC2
57f50062f60a806d23be7fe6a44b4a1f4f28c109
[ "Apache-2.0" ]
3
2018-09-27T16:08:25.000Z
2021-03-19T04:27:04.000Z
bac/simulate/gromacs/free_energy_controller.py
UCL-CCS/BAC2
57f50062f60a806d23be7fe6a44b4a1f4f28c109
[ "Apache-2.0" ]
15
2018-11-27T09:19:31.000Z
2021-02-13T09:19:37.000Z
bac/simulate/gromacs/free_energy_controller.py
UCL-CCS/BAC2
57f50062f60a806d23be7fe6a44b4a1f4f28c109
[ "Apache-2.0" ]
1
2018-10-31T14:56:31.000Z
2018-10-31T14:56:31.000Z
from enum import Enum from supproperty import decimal, supproperty, boolean, integer, float_vector from bac.simulate.coding import Encodable from .group import Group class CouplingType(Enum): vdw_and_coulomb = 'vdw-q' vdw = 'vdw' coulomb = 'q' none = 'none' @classmethod def _missing_(cls, value): if value is None: return cls.no else: super()._missing_(value) class OutputEnergyType(Enum): no = 'no' potential = 'potential' total = 'total' @classmethod def _missing_(cls, value): if value is False: return cls.no else: super()._missing_(value) class FreeEnergyController(Encodable): def __init__(self, **kwargs): # self.expanded = kwargs.get('expanded') self.initial_lambda = kwargs.get('initial_lambda') self.delta_lambda = kwargs.get('delta_lambda') self.initial_lambda_state = kwargs.get('initial_lambda_state') self.fep_lambdas = kwargs.get('fep_lambdas') self.coulomb_lambdas = kwargs.get('coulomb_lambdas') self.van_der_waals_lambdas = kwargs.get('van_der_waals_lambdas') self.bonded_lambdas = kwargs.get('bonded_lambdas') self.restraint_lambdas = kwargs.get('restraint_lambdas') self.mass_lambdas = kwargs.get('mass_lambdas') self.temperature_lambdas = kwargs.get('temperature_lambdas') self.calculate_lambda_neighbors = kwargs.get('calculate_lambda_neighbors') self.soft_core_alpha = kwargs.get('soft_core_alpha') self.soft_core_radial_power = kwargs.get('soft_core_radial_power') self.soft_core_coulomb = kwargs.get('soft_core_coulomb') self.soft_core_power = kwargs.get('soft_core_power') self.soft_core_sigma = kwargs.get('soft_core_sigma') self.couple_molecule_groups = kwargs.get('couple_molecule_groups') self.couple_type_initial_lambda = kwargs.get('couple_type_initial_lambda') self.couple_type_final_lambda = kwargs.get('couple_type_final_lambda') self.couple_intramolecular = kwargs.get('couple_intramolecular') self.output_frequency = kwargs.get('output_frequency') self.output_derivatives = kwargs.get('output_derivatives') self.output_energy = kwargs.get('output_energy') self.separate_output = kwargs.get('separate_output') self.output_histogram_size = kwargs.get('output_histogram_size') self.output_bin_size = kwargs.get('output_bin_size') # Gromacs grompp says this is not a valid keyword or something... # @boolean(default=False) # def expanded(self): pass @decimal(default=-1) def initial_lambda(self): """ Initial value of lambda variable. Returns ------- """ pass @decimal(default=0) def delta_lambda(self): """ Difference between two consecutive lambda windows. Returns ------- """ pass @integer(default=-1) def initial_lambda_state(self): pass @property def supports_lambda_state(self): return True @float_vector(default=[]) def fep_lambdas(self): pass @float_vector(default=lambda self: self.fep_lambdas, validator=lambda self, x: self.fep_lambdas.size == x.size) def coulomb_lambdas(self): pass @float_vector(default=lambda self: self.fep_lambdas, validator=lambda self, x: self.fep_lambdas.size == x.size) def van_der_waals_lambdas(self): pass @float_vector(default=lambda self: self.fep_lambdas, validator=lambda self, x: self.fep_lambdas.size == x.size) def bonded_lambdas(self): pass @float_vector(default=lambda self: self.fep_lambdas, validator=lambda self, x: self.fep_lambdas.size == x.size) def restraint_lambdas(self): pass @float_vector(default=lambda self: self.fep_lambdas, validator=lambda self, x: self.fep_lambdas.size == x.size) def mass_lambdas(self): pass @float_vector(default=lambda self: self.fep_lambdas, validator=lambda self, x: self.fep_lambdas.size == x.size) def temperature_lambdas(self): pass @integer(default=1) def calculate_lambda_neighbors(self): pass @decimal(default=0) def soft_core_alpha(self): pass @integer(default=6, validator=lambda _, x: x in [6, 48]) def soft_core_radial_power(self): pass @boolean(default=False) def soft_core_coulomb(self): pass @integer(default=0, validator=lambda _, x: x in [1, 2]) def soft_core_power(self): pass @decimal(default=0.3) def soft_core_sigma(self): pass @supproperty(type=list, default=[Group.system]) def couple_molecule_groups(self): pass @supproperty(type=CouplingType, default=CouplingType.vdw_and_coulomb) def couple_type_initial_lambda(self): pass @supproperty(type=CouplingType, default=CouplingType.vdw_and_coulomb) def couple_type_final_lambda(self): pass @boolean(default=False) def couple_intramolecular(self): pass @integer(default=100) def output_frequency(self): pass @boolean(default=True) def output_derivatives(self): pass @supproperty(type=OutputEnergyType, default=OutputEnergyType.no) def output_energy(self): pass @boolean(default=True) def separate_output(self): pass @integer(default=0) def output_histogram_size(self): pass @decimal(default=0.1) def output_bin_size(self): pass
31.80117
115
0.691615
692
5,438
5.187861
0.16185
0.067688
0.050696
0.033426
0.423955
0.291365
0.258496
0.258496
0.216713
0.216713
0
0.0046
0.200441
5,438
170
116
31.988235
0.821067
0.049651
0
0.236364
0
0
0.095397
0.035995
0
0
0
0
0
1
0.272727
false
0.236364
0.036364
0.009091
0.427273
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
10fb5b5fa6ea92874cbfefdfff59adcb3f2eefef
2,193
py
Python
faker/tests.py
SysGrove/faker
61c1aa3eeece341c0984e95cd3128bcdf3797a78
[ "MIT" ]
1
2016-04-04T22:35:45.000Z
2016-04-04T22:35:45.000Z
faker/tests.py
SysGrove/faker
61c1aa3eeece341c0984e95cd3128bcdf3797a78
[ "MIT" ]
null
null
null
faker/tests.py
SysGrove/faker
61c1aa3eeece341c0984e95cd3128bcdf3797a78
[ "MIT" ]
null
null
null
import unittest from faker import Generator class BarProvider(object): def fooFormatter(self): return 'barfoo' class FooProvider(object): def fooFormatter(self): return 'foobar' def fooFormatterWithArguments(self, param='', append=''): return 'baz' + param + append class FactoryTestCase(unittest.TestCase): def setUp(self): self.generator = Generator() self.provider = FooProvider() self.generator.addProvider(self.provider) def testAddProviderGivesPriorityToNewlyAddedProvider(self): self.generator.addProvider(BarProvider()) self.assertEqual('barfoo', self.generator.format('fooFormatter')) def testGetFormatterReturnsCallable(self): formatter = self.generator.getFormatter('fooFormatter') self.assertTrue( hasattr(formatter, '__call__') or isinstance(formatter,(classmethod,staticmethod)) ) def testGetFormatterReturnsCorrectFormatter(self): self.assertEqual(self.provider.fooFormatter, self.generator.getFormatter('fooFormatter') ) def testGetFormatterThrowsExceptionOnIncorrectFormatter(self): with self.assertRaises(AttributeError): self.generator.getFormatter('barFormatter') def testFormatCallsFormatterOnProvider(self): self.assertEqual('foobar', self.generator.format('fooFormatter')) def testFormatTransfersArgumentsToFormatter(self): self.assertEqual('bazfoo!', self.generator.format('fooFormatterWithArguments', 'foo', append='!')) def testParseReturnsSameStringWhenItContainsNoCurlyBraces(self): self.assertEqual('fooBar#?', self.generator.parse('fooBar#?')) def testParseReturnsStringWithTokensReplacedByFormatters(self): self.assertEqual('This is foobar a text with foobar', self.generator.parse('This is {{fooFormatter}} a text with {{ fooFormatter }}')) def testMagicCallCallsFormat(self): self.assertEqual('foobar', self.generator.fooFormatter()) def testMagicCallCallsFormatWithArguments(self): self.assertEqual('bazfoo', self.generator.fooFormatterWithArguments('foo')) if __name__ == '__main__': unittest.main()
30.458333
109
0.722298
182
2,193
8.637363
0.324176
0.107506
0.084606
0.04771
0.195293
0.120865
0
0
0
0
0
0
0.167807
2,193
72
110
30.458333
0.86137
0
0
0.04878
0
0
0.117593
0.011395
0
0
0
0
0.243902
1
0.341463
false
0
0.04878
0.073171
0.536585
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
10fc6334121c06b48819548a7fce02442a158218
1,580
py
Python
M/12.py
jnoddell/LC
be17ab80e745169a6617788ba82ad2c5b250c0d5
[ "Apache-2.0" ]
2
2021-01-20T14:31:36.000Z
2021-01-20T14:32:31.000Z
M/12.py
jnoddell/LC
be17ab80e745169a6617788ba82ad2c5b250c0d5
[ "Apache-2.0" ]
null
null
null
M/12.py
jnoddell/LC
be17ab80e745169a6617788ba82ad2c5b250c0d5
[ "Apache-2.0" ]
null
null
null
class Solution(object): def intToRoman(self, num): """ :type num: int :rtype: str """ exchange = [['I', 1], ['V', 5], ['X', 10], ['L', 50], ['C', 100], ['D', 500], ['M', 1000]] exchange = exchange[::-1] roman = "" index = 0 while num > 0: curr_tuple = exchange[index] curr_symbol = curr_tuple[0] curr_value = curr_tuple[1] increment_index = True if num - curr_value == 0: return (roman + curr_symbol) elif num - curr_value > 0: num -= curr_value roman += curr_symbol increment_index = False elif increment_index and num - 900 >= 0: num -= 900 roman += "CM" elif index > 0 and increment_index and num - 400 >= 0: num -= 400 roman += "CD" elif index > 1 and increment_index and num - 90 >= 0: num -= 90 roman += "XC" elif index > 2 and increment_index and num - 40 >= 0: num -= 40 roman += "XL" elif index > 3 and increment_index and num - 9 >= 0: num -= 9 roman += "IX" elif index > 4 and increment_index and num - 4 >= 0: num -= 4 roman += "IV" if num == 0: return roman elif increment_index: index += 1
32.916667
98
0.406329
167
1,580
3.730539
0.329341
0.202247
0.163724
0.192616
0.184591
0
0
0
0
0
0
0.073983
0.486709
1,580
47
99
33.617021
0.694205
0.016456
0
0
0
0
0.012484
0
0
0
0
0
0
1
0.025641
false
0
0
0
0.102564
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
800bfb7e2c89cfff79f14e38b7922e318a351c65
215
py
Python
hgoddocker/main.py
Ganesha2282882/dimages
0a7783868678334bf4144882d4f3bdbaa48cefee
[ "Unlicense" ]
null
null
null
hgoddocker/main.py
Ganesha2282882/dimages
0a7783868678334bf4144882d4f3bdbaa48cefee
[ "Unlicense" ]
null
null
null
hgoddocker/main.py
Ganesha2282882/dimages
0a7783868678334bf4144882d4f3bdbaa48cefee
[ "Unlicense" ]
null
null
null
from random import choice gods = (["Brahma", "Vishnu", "Shiva", "Ganesha", "Rama", "Krishna", "Saraswati", "Lakshmi", "Durga Devi", "Indra", "Surya", "Agni", "Hanuman"]) random_god = choice(gods) print(random_god)
35.833333
143
0.660465
26
215
5.384615
0.807692
0.142857
0
0
0
0
0
0
0
0
0
0
0.116279
215
5
144
43
0.736842
0
0
0
0
0
0.383178
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
804b2bbb169fa8edcfb4dad1af5ac9ba5560d3d5
4,205
py
Python
socceraction/data/statsbomb/schema.py
BWyckaert/socceraction
5fd6bd7e29df8d230103d586f8f9449bdb0ca500
[ "MIT" ]
null
null
null
socceraction/data/statsbomb/schema.py
BWyckaert/socceraction
5fd6bd7e29df8d230103d586f8f9449bdb0ca500
[ "MIT" ]
44
2021-12-14T12:28:14.000Z
2022-03-30T12:31:43.000Z
socceraction/data/statsbomb/schema.py
BWyckaert/socceraction
5fd6bd7e29df8d230103d586f8f9449bdb0ca500
[ "MIT" ]
null
null
null
"""SPADL schema for StatsBomb data.""" from typing import Optional import pandera as pa from pandera.typing import DateTime, Object, Series from socceraction.data.schema import ( CompetitionSchema, EventSchema, GameSchema, PlayerSchema, TeamSchema, ) class StatsBombCompetitionSchema(CompetitionSchema): """Definition of a dataframe containing a list of competitions and seasons.""" country_name: Series[str] """The name of the country the competition relates to.""" competition_gender: Series[str] """The gender of the players competing in the competition.""" class StatsBombGameSchema(GameSchema): """Definition of a dataframe containing a list of games.""" competition_stage: Series[str] """The name of the phase of the competition this game is in.""" home_score: Series[int] """The final score of the home team.""" away_score: Series[int] """The final score of the away team.""" venue: Series[str] = pa.Field(nullable=True) """The name of the stadium where the game was played.""" referee: Series[str] = pa.Field(nullable=True) """The name of the referee.""" class StatsBombPlayerSchema(PlayerSchema): """Definition of a dataframe containing the list of players of a game.""" nickname: Series[str] = pa.Field(nullable=True) """The nickname of the player on the team.""" starting_position_id: Series[int] """The unique identifier for the starting position of the player on the team.""" starting_position_name: Series[str] """The name of the starting position of the player on the team.""" class StatsBombTeamSchema(TeamSchema): """Definition of a dataframe containing the list of teams of a game.""" class StatsBombEventSchema(EventSchema): """Definition of a dataframe containing event stream data of a game.""" index: Series[int] """Sequence notation for the ordering of events within each match.""" timestamp: Series[DateTime] """Time in the match the event takes place, recorded to the millisecond.""" minute: Series[int] """The minutes on the clock at the time of this event.""" second: Series[int] = pa.Field(ge=0, le=59) """The second part of the timestamp.""" possession: Series[int] """Indicates the current unique possession in the game.""" possession_team_id: Series[int] """The ID of the team that started this possession in control of the ball.""" possession_team_name: Series[str] """The name of the team that started this possession in control of the ball.""" play_pattern_id: Series[int] """The ID of the play pattern relevant to this event.""" play_pattern_name: Series[str] """The name of the play pattern relevant to this event.""" team_name: Series[str] """The name of the team this event relates to.""" duration: Series[float] = pa.Field(nullable=True) """If relevant, the length in seconds the event lasted.""" extra: Series[Object] """A JSON string containing type-specific information.""" related_events: Series[Object] """A comma separated list of the IDs of related events.""" player_name: Series[str] = pa.Field(nullable=True) """The name of the player this event relates to.""" position_id: Series[float] = pa.Field(nullable=True) """The ID of the position the player was in at the time of this event.""" position_name: Series[str] = pa.Field(nullable=True) """The name of the position the player was in at the time of this event.""" location: Series[Object] = pa.Field(nullable=True) """Array containing the x and y coordinates of the event.""" under_pressure: Series[bool] = pa.Field(nullable=True) """Whether the action was performed while being pressured by an opponent.""" counterpress: Series[bool] = pa.Field(nullable=True) """Pressing actions within 5 seconds of an open play turnover.""" visible_area_360: Optional[Series[Object]] = pa.Field(nullable=True) """An array of coordinates describing the polygon visible to the camera / in the 360 frame.""" freeze_frame_360: Optional[Series[Object]] = pa.Field(nullable=True) """An array of freeze frame objects."""
42.05
98
0.701784
589
4,205
4.964346
0.273345
0.04275
0.06156
0.077975
0.444254
0.432285
0.367305
0.322845
0.204514
0.158345
0
0.003818
0.19025
4,205
99
99
42.474747
0.854919
0.085375
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.086957
0
0.869565
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
80514c9e6bada18e2ec4fc3f8a200ef1b231eec2
899
py
Python
bin/lib/config_safe_loader.py
jfalcou/infra
97e05039a3f4f3d69b7c50233aed5e5d60a59605
[ "BSD-2-Clause" ]
135
2017-01-12T04:39:08.000Z
2020-05-08T17:08:52.000Z
bin/lib/config_safe_loader.py
jfalcou/infra
97e05039a3f4f3d69b7c50233aed5e5d60a59605
[ "BSD-2-Clause" ]
229
2017-01-23T12:45:44.000Z
2020-05-13T17:36:57.000Z
bin/lib/config_safe_loader.py
jfalcou/infra
97e05039a3f4f3d69b7c50233aed5e5d60a59605
[ "BSD-2-Clause" ]
106
2017-04-18T14:42:34.000Z
2020-05-07T14:24:34.000Z
import yaml # With thanks to: # https://stackoverflow.com/questions/34667108/ignore-dates-and-times-while-parsing-yaml class ConfigSafeLoader(yaml.SafeLoader): @classmethod def remove_implicit_resolver(cls, tag_to_remove): """ Remove implicit resolvers for a particular tag Takes care not to modify resolvers in super classes. """ if 'yaml_implicit_resolvers' not in cls.__dict__: cls.yaml_implicit_resolvers = cls.yaml_implicit_resolvers.copy() for first_letter, mappings in cls.yaml_implicit_resolvers.items(): cls.yaml_implicit_resolvers[first_letter] = [(tag, regexp) for tag, regexp in mappings if tag != tag_to_remove] ConfigSafeLoader.remove_implicit_resolver('tag:yaml.org,2002:timestamp')
35.96
88
0.634038
100
899
5.46
0.48
0.186813
0.192308
0.175824
0
0
0
0
0
0
0
0.018779
0.28921
899
24
89
37.458333
0.835681
0.226919
0
0
0
0
0.075529
0.075529
0
0
0
0
0
1
0.090909
false
0
0.090909
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
8053f20aa67d4de1aafc2c0daff7032315fdb7e0
2,522
py
Python
hkust-gmission/gmission/controllers/geo_controller.py
gmission/gmission
1fe25a2fa04e563d5276579faa36afad7bb4122e
[ "MIT" ]
251
2015-11-09T15:43:25.000Z
2021-12-17T08:38:23.000Z
hkust-gmission/gmission/controllers/geo_controller.py
gmission/gmission
1fe25a2fa04e563d5276579faa36afad7bb4122e
[ "MIT" ]
2
2019-09-03T17:41:03.000Z
2021-01-15T13:51:06.000Z
hkust-gmission/gmission/controllers/geo_controller.py
gmission/gmission
1fe25a2fa04e563d5276579faa36afad7bb4122e
[ "MIT" ]
20
2016-01-25T06:38:33.000Z
2022-03-18T13:56:40.000Z
import math __author__ = 'chenzhao' from gmission.models import * # 1km is about 0.01, 1m is 0.00001 def location_nearby_user_count(location_id, r=0.01): location = Location.query.get(location_id) P = UserLastPosition in_rect = (P.longitude >= location.coordinate.longitude - r) & (P.longitude <= location.coordinate.longitude + r) \ & (P.latitude >= location.coordinate.latitude - r) & (P.latitude <= location.coordinate.latitude + r) c = P.query.filter(in_rect).count() return c def get_nearest_n_users(longitude, latitude, n, r=0.00001): P = UserLastPosition in_rect = (P.longitude >= longitude - r) & (P.longitude <= longitude + r) \ & (P.latitude >= latitude - r) & (P.latitude <= latitude + r) c = P.query.filter(in_rect).count() print 'KNN', n, r, c if c < n and r < 0.1: return get_nearest_n_users(longitude, latitude, n, r * 2) ps = sorted(P.query.filter(in_rect).all(), key=lambda p: geo_distance(p.longitude, p.latitude, longitude, latitude)) return [p.user for p in ps[:n]] def get_nearby_users(longitude, latitude, r=0.05): P = UserLastPosition in_rect = (P.longitude >= longitude - r) & (P.longitude <= longitude + r) \ & (P.latitude >= latitude - r) & (P.latitude <= latitude + r) c = P.query.filter(in_rect).count() print ('user in %f bound: %d') % (r, c) # ps = sorted(P.query.filter(in_rect).all(), key=lambda p: geo_distance(p.longitude, p.latitude, longitude, latitude)) return [p.user for p in P.query.filter(in_rect).all()] def geo_angle(startPointLong, startPointLati, endPointLong, endPointLati): angle = math.atan2(endPointLati - startPointLati, endPointLong - startPointLong) return angle def geo_distance(long1, lati1, long2, lati2): return math.sqrt((long1 - long2) ** 2 + (lati1 - lati2) ** 2) pass def filter_location(data): if data.get('location_id', None): # print 'location_id provided, pop location' data.pop('location', None) return # if 'location' in data: # # print 'location provided' # uc_keys = ['name', 'longitude','latitude'] # existing_location = Location.query.filter_by(**dict(zip(uc_keys, map(data['location'].get, uc_keys)))).first() # # print 'existing location', existing_location # if existing_location: # data.pop('location', None) # data['location_id'] = existing_location.id if __name__ == '__main__': pass
33.626667
122
0.641554
337
2,522
4.652819
0.237389
0.034439
0.042092
0.053571
0.51148
0.477041
0.44898
0.360332
0.315689
0.294643
0
0.018677
0.214512
2,522
74
123
34.081081
0.772842
0.226011
0
0.307692
0
0
0.029928
0
0
0
0
0
0
0
null
null
0.051282
0.051282
null
null
0.051282
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
8056d189c9c600cd9fb0e8354574e010d6362630
1,002
py
Python
src/scenario_bash_script.py
haoli-buaa/faster-rcnn-scenarios
d1086f39ee7fe7c0e4720c20861abee9980bd018
[ "MIT" ]
14
2017-05-23T03:21:27.000Z
2021-01-18T10:31:54.000Z
src/scenario_bash_script.py
haoli-buaa/faster-rcnn-scenarios
d1086f39ee7fe7c0e4720c20861abee9980bd018
[ "MIT" ]
3
2017-11-23T03:36:15.000Z
2019-05-12T21:17:56.000Z
src/scenario_bash_script.py
djdam/faster-rcnn-scenarios
d1086f39ee7fe7c0e4720c20861abee9980bd018
[ "MIT" ]
12
2017-06-02T01:35:15.000Z
2020-08-17T06:22:54.000Z
SCRIPT=""" #!/bin/bash # Generate train/test script for scenario "{scenario}" using the faster-rcnn "alternating optimization" method set -x set -e rm -f $CAFFE_ROOT/data/cache/*.pkl rm -f {scenarios_dir}/{scenario}/output/*.pkl DIR=`pwd` function quit {{ cd $DIR exit 0 }} export PYTHONUNBUFFERED="True" TRAIN_IMDB={train_imdb} TEST_IMDB={test_imdb} cd {py_faster_rcnn} mkdir -p {scenarios_dir}/{scenario}/logs >/dev/null LOG="{scenarios_dir}/{scenario}/logs/log.txt.`date +'%Y-%m-%d_%H-%M-%S'`" exec &> >(tee -a "$LOG") echo Logging output to "$LOG" time {train_script} {scenario_file} || quit time ./tools/test_net.py --gpu {gpu_id} \\ --def {testproto} \\ --net {net_final_path} \\ --imdb {test_imdb} \\ --cfg {config_path} || quit chmod u+x {plot_script} {plot_script} $LOG {scenarios_dir}/{scenario}/output/results.png || true MEAN_AP=`grep "Mean AP = " ${{LOG}} | awk '{{print $3}}'` echo "{scenario} finished with mAP=$MEAN_AP" >> {scenarios_dir}/status.txt quit """
22.266667
110
0.673653
152
1,002
4.276316
0.559211
0.092308
0.123077
0.08
0
0
0
0
0
0
0
0.002302
0.132735
1,002
45
111
22.266667
0.745685
0
0
0
1
0.0625
0.986042
0.307079
0
0
0
0
0
1
0
false
0
0
0
0
0.03125
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
33806b6f08efa2b438a98c87fb959b5d57b838aa
681
py
Python
1-data-set-statistics/mongo_configuration.py
saeedeldah/multi-modal-multi-level-video-data-characterization-comparison-2018-2019
3a44572641349b9adb62aefd669b15436efad8d0
[ "MIT" ]
null
null
null
1-data-set-statistics/mongo_configuration.py
saeedeldah/multi-modal-multi-level-video-data-characterization-comparison-2018-2019
3a44572641349b9adb62aefd669b15436efad8d0
[ "MIT" ]
null
null
null
1-data-set-statistics/mongo_configuration.py
saeedeldah/multi-modal-multi-level-video-data-characterization-comparison-2018-2019
3a44572641349b9adb62aefd669b15436efad8d0
[ "MIT" ]
null
null
null
import json from pathlib import Path from typing import Dict class MongoConfiguration: __config: Dict[str, str] = {} __database: str __server: str __port: str def __init__(self): path = Path("mongo_configuration.json") json_string = path.open().read() self.__config = json.loads(json_string) self.__server = self.__config["server"] self.__port = self.__config["port"] self.__database = self.__config["database"] @property def database(self): return self.__database @property def server(self): return self.__server @property def port(self): return self.__port
21.967742
51
0.63583
77
681
5.168831
0.324675
0.100503
0.105528
0
0
0
0
0
0
0
0
0
0.264317
681
30
52
22.7
0.794411
0
0
0.125
0
0
0.061674
0.035242
0
0
0
0
0
1
0.166667
false
0
0.125
0.125
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
33859dccc64f89a8b27b32d844d34017c655fe03
2,246
py
Python
thrift_sasl/six.py
captify-sfuller/thrift_sasl
8ea957f91c15bf58cc893672a921d8be0e616ead
[ "Apache-2.0" ]
null
null
null
thrift_sasl/six.py
captify-sfuller/thrift_sasl
8ea957f91c15bf58cc893672a921d8be0e616ead
[ "Apache-2.0" ]
null
null
null
thrift_sasl/six.py
captify-sfuller/thrift_sasl
8ea957f91c15bf58cc893672a921d8be0e616ead
[ "Apache-2.0" ]
null
null
null
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. import sys PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 if PY2: from cStringIO import StringIO from thrift.transport.TTransport import ( TTransportException, TTransportBase, CReadableTransport) is_open_compat = lambda trans: trans.isOpen() read_all_compat = lambda trans, sz: trans.readAll(sz) if PY3: # TODO: consider contributing this to thriftpy instead class CReadableTransport(object): @property def cstringio_buf(self): pass def cstringio_refill(self, partialread, reqlen): pass # TODO: make this more explicit for maintainability sake from io import BytesIO as StringIO from thriftpy2.transport import TTransportException, TTransportBase # https://github.com/Thriftpy/thriftpy/blob/0e606f82a3c900e663b63d69f68fc304c5d58dee/thriftpy/transport/__init__.py#L10 # import from above because it's no longer in thriftpy2 def readall(read_fn, sz): buff = b'' have = 0 while have < sz: chunk = read_fn(sz - have) have += len(chunk) buff += chunk if len(chunk) == 0: raise TTransportException(TTransportException.END_OF_FILE, "End of file reading from transport") return buff def is_open_compat(trans): try: is_open = trans.is_open() except AttributeError: is_open = trans.isOpen() return is_open read_all_compat = lambda trans, sz: readall(trans.read, sz)
31.633803
121
0.719056
301
2,246
5.285714
0.48505
0.037712
0.032055
0.020113
0.032684
0.032684
0
0
0
0
0
0.024225
0.209706
2,246
70
122
32.085714
0.872113
0.457257
0
0.055556
0
0
0.028404
0
0
0
0
0.014286
0
1
0.111111
false
0.055556
0.138889
0
0.333333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
1
0
0
0
0
0
2
338fddb0ecb4f697cfa314b7ccedda05524933a4
1,051
py
Python
Scripts/simulation/visualization/connectivity_handles_visualizer.py
velocist/TS4CheatsInfo
b59ea7e5f4bd01d3b3bd7603843d525a9c179867
[ "Apache-2.0" ]
null
null
null
Scripts/simulation/visualization/connectivity_handles_visualizer.py
velocist/TS4CheatsInfo
b59ea7e5f4bd01d3b3bd7603843d525a9c179867
[ "Apache-2.0" ]
null
null
null
Scripts/simulation/visualization/connectivity_handles_visualizer.py
velocist/TS4CheatsInfo
b59ea7e5f4bd01d3b3bd7603843d525a9c179867
[ "Apache-2.0" ]
null
null
null
# uncompyle6 version 3.7.4 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] # Embedded file name: T:\InGame\Gameplay\Scripts\Server\visualization\connectivity_handles_visualizer.py # Compiled at: 2013-03-15 17:13:49 # Size of source mod 2**32: 1942 bytes from debugvis import Context import services, sims4.color class ConnectivityHandlesVisualizer: def __init__(self, sim, layer): self.layer = layer self.start() def start(self): services.current_zone().navmesh_change_callbacks.append(self.refresh) self.refresh() def stop(self): services.current_zone().navmesh_change_callbacks.remove(self.refresh) def refresh(self): pre_slot_color = sims4.color.from_rgba(0.8, 0.8, 0, 0.9) post_slot_color = sims4.color.from_rgba(0.9, 0.7, 0, 0.25) with Context((self.layer), altitude=0.1) as (context): for obj in services.object_manager().valid_objects(): pass
37.535714
107
0.686965
157
1,051
4.471338
0.605096
0.008547
0.054131
0.065527
0.207977
0.207977
0.207977
0
0
0
0
0.100118
0.192198
1,051
28
108
37.535714
0.726737
0.313987
0
0
0
0
0
0
0
0
0
0
0
1
0.235294
false
0.058824
0.117647
0
0.411765
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
339758c3e0ba2df77886bf14f368f2f7b6af240c
5,683
py
Python
tests/schedules/test_filters.py
concreted/prefect
dd732f5990ee2b0f3d816adb285168fd63b239e4
[ "Apache-2.0" ]
8,633
2019-03-23T17:51:03.000Z
2022-03-31T22:17:42.000Z
tests/schedules/test_filters.py
concreted/prefect
dd732f5990ee2b0f3d816adb285168fd63b239e4
[ "Apache-2.0" ]
3,903
2019-03-23T19:11:21.000Z
2022-03-31T23:21:23.000Z
tests/schedules/test_filters.py
ngriffiths13/prefect
7f5613abcb182494b7dc12159277c3bc5f3c9898
[ "Apache-2.0" ]
937
2019-03-23T18:49:44.000Z
2022-03-31T21:45:13.000Z
import pendulum import pytest import prefect.schedules.filters as filters def test_on_datetime_0(): filter_fn = filters.on_datetime(pendulum.datetime(2019, 1, 2, 3, 4, 5)) assert filter_fn(pendulum.datetime(2019, 1, 2, 3, 4, 5)) def test_on_datetime_1(): filter_fn = filters.on_datetime(pendulum.datetime(2019, 1, 2)) assert filter_fn(pendulum.datetime(2019, 1, 2)) def test_on_datetime_2(): filter_fn = filters.on_datetime(pendulum.datetime(2019, 1, 2, 3, 4)) assert not filter_fn(pendulum.datetime(2019, 1, 2, 3, 4, 5)) def test_on_datetime_3(): filter_fn = filters.on_datetime(pendulum.datetime(2019, 1, 2, 3, 4, 5)) assert not filter_fn(pendulum.datetime(2019, 1, 2, 3, 4)) @pytest.mark.parametrize( "test_datetimes", [ (pendulum.datetime(2019, 1, 1), pendulum.datetime(2019, 1, 2), True), (pendulum.datetime(2019, 1, 1), pendulum.datetime(2019, 1, 1), False), (pendulum.datetime(2019, 1, 2), pendulum.datetime(2019, 1, 2), False), (pendulum.datetime(2019, 1, 1, 6), pendulum.datetime(2019, 1, 1, 6), True), ( pendulum.datetime(2019, 1, 1, 5, 59), pendulum.datetime(2019, 1, 1, 6, 1), True, ), ], ) def test_between_datetimes(test_datetimes): dt = pendulum.datetime(2019, 1, 1, 6) filter_fn = filters.between_datetimes(test_datetimes[0], test_datetimes[1]) assert filter_fn(dt) is test_datetimes[2] def test_on_date(): filter_fn = filters.on_date(3, 4) assert filter_fn(pendulum.datetime(2019, 3, 4)) assert not filter_fn(pendulum.datetime(2019, 3, 5)) assert filter_fn(pendulum.datetime(2019, 3, 4, 5, 6)) assert filter_fn(pendulum.datetime(2034, 3, 4)) assert not filter_fn(pendulum.datetime(2034, 3, 5)) assert not filter_fn(pendulum.datetime(2034, 4, 4)) @pytest.mark.parametrize( "test_dates", [ ((1, 1, 12, 31), True), ((6, 1, 6, 1), True), ((5, 31, 6, 2), True), ((6, 2, 5, 31), False), ((6, 2, 7, 1), False), ((11, 1, 7, 1), True), ], ) def test_between_dates(test_dates): dt = pendulum.datetime(2019, 6, 1) filter_fn = filters.between_dates(*test_dates[0]) assert filter_fn(dt) is test_dates[1] @pytest.mark.parametrize( "test_times", [ (pendulum.datetime(2019, 1, 2, 4, 30), False), (pendulum.datetime(2019, 1, 2, 3, 30), True), (pendulum.datetime(2020, 1, 2, 3, 30), True), (pendulum.datetime(2019, 4, 5, 3, 30), True), (pendulum.datetime(2019, 4, 5, 3, 30, 1), False), ], ) def test_at_time(test_times): test_dt, result = test_times filter_fn = filters.at_time(pendulum.time(3, 30)) assert filter_fn(test_dt) is result @pytest.mark.parametrize( "test_times", [ (pendulum.time(5), pendulum.time(7), True), (pendulum.time(6), pendulum.time(6), True), (pendulum.time(7), pendulum.time(5), False), (pendulum.time(7), pendulum.time(6), True), ], ) def test_between_times(test_times): dt = pendulum.datetime(2019, 6, 1, 6) filter_fn = filters.between_times(test_times[0], test_times[1]) assert filter_fn(dt) is test_times[2] @pytest.mark.parametrize("dt", [pendulum.datetime(2019, 1, i) for i in range(1, 10)]) def test_is_weekday(dt): assert filters.is_weekday(dt) == (dt.weekday() < 5) @pytest.mark.parametrize("dt", [pendulum.datetime(2019, 1, i) for i in range(1, 10)]) def test_is_weekend(dt): assert filters.is_weekend(dt) == (dt.weekday() > 4) @pytest.mark.parametrize( "dates", [ (pendulum.datetime(2019, 1, 20), False), (pendulum.datetime(2019, 1, 31), True), (pendulum.datetime(2019, 2, 27), False), (pendulum.datetime(2019, 2, 28), True), (pendulum.datetime(2020, 2, 28), False), (pendulum.datetime(2020, 2, 29), True), ], ) def test_is_month_end(dates): assert filters.is_month_end(dates[0]) is dates[1] @pytest.mark.parametrize( "year", [ 1971, # Before start of UTC 1972, # Start of UTC 1992, # Near past 2020, # Relative present 2525, # Distant future ], ) @pytest.mark.parametrize("month", list(range(1, 12))) def test_is_month_start(year: int, month: int): filter_fn = filters.is_month_start assert filter_fn(dt=pendulum.datetime(year=year, month=month, day=1)) assert not filter_fn(dt=pendulum.datetime(year=year, month=month, day=2)) assert not filter_fn(dt=pendulum.datetime(year=year, month=month, day=15)) assert not filter_fn(dt=pendulum.datetime(year=year, month=month, day=28)) def test_is_day_of_week(): years = { 1971: {"month": 2, "day": 22}, # Before start of UTC 1972: {"month": 6, "day": 12}, # Start of UTC 1992: {"month": 6, "day": 8}, # Near past 2020: {"month": 9, "day": 14}, # Relative present 2525: {"month": 12, "day": 3}, # Distant future } months = range(1, 12) days_week = range(0, 6) def test_day_of_week(day_of_week: int): filter_fn = filters.is_day_of_week(day_of_week=day_of_week) for year in years: month = years[year]["month"] day = ( years[year]["day"] + day_of_week ) # day of the week also acts as an offset for each day, which starts at Sunday (0) next_day = day + 1 assert filter_fn(dt=pendulum.datetime(year=year, month=month, day=day)) assert not filter_fn( dt=pendulum.datetime(year=year, month=month, day=next_day) ) for day in days_week: test_day_of_week(day)
31.572222
96
0.619391
839
5,683
4.05006
0.11323
0.216598
0.200118
0.154503
0.60771
0.500589
0.371101
0.336963
0.295468
0.258682
0
0.096031
0.228576
5,683
179
97
31.748603
0.67906
0.040296
0
0.125874
0
0
0.020213
0
0
0
0
0
0.160839
1
0.104895
false
0
0.020979
0
0.125874
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
3399379e30203d5208083aef7d779796107af221
353
py
Python
sourcelyzer/dao/session.py
alex-dow/sourcelyzer
343c589e1310d7161caf3e3b3460f175d30c3f2f
[ "MIT" ]
1
2017-07-25T21:06:09.000Z
2017-07-25T21:06:09.000Z
sourcelyzer/dao/session.py
alex-dow/sourcelyzer
343c589e1310d7161caf3e3b3460f175d30c3f2f
[ "MIT" ]
null
null
null
sourcelyzer/dao/session.py
alex-dow/sourcelyzer
343c589e1310d7161caf3e3b3460f175d30c3f2f
[ "MIT" ]
null
null
null
from sourcelyzer.dao import Base from sqlalchemy import Column, Integer, String, Boolean, DateTime import datetime class Session(Base): __tablename__ = 'sourcelyzer_sessions' session_id = Column(Integer, primary_key=True, autoincrement=True) user_id = Column(Integer) created_on = Column(DateTime) expires_on = Column(DateTime)
23.533333
70
0.759207
42
353
6.142857
0.571429
0.151163
0.116279
0
0
0
0
0
0
0
0
0
0.164306
353
14
71
25.214286
0.874576
0
0
0
0
0
0.057143
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
33a5006185eadf6753ff645259b52b07966633f2
1,315
py
Python
setup.py
perslev/sleep-utils
9f9edf67f4cac6d8361243b4153bfe6351314844
[ "MIT" ]
1
2022-03-17T10:37:17.000Z
2022-03-17T10:37:17.000Z
setup.py
perslev/sleep-utils
9f9edf67f4cac6d8361243b4153bfe6351314844
[ "MIT" ]
null
null
null
setup.py
perslev/sleep-utils
9f9edf67f4cac6d8361243b4153bfe6351314844
[ "MIT" ]
null
null
null
from setuptools import setup, find_packages with open('README.md') as readme_file: readme = readme_file.read() with open("requirements.txt") as req_file: requirements = list(filter(None, req_file.read().split("\n"))) __version__ = None with open("psg_utils/version.py") as version_file: exec(version_file.read()) if __version__ is None: raise ValueError("Did not find __version__ in version.py file.") setup( name='psg-utils', version=__version__, description='A collection of Python utility classes and functions for loading and processing Polysomnography (PSG) sleep study data.', long_description=readme, long_description_content_type='text/markdown', author='Mathias Perslev', author_email='map@di.ku.dk', url='https://github.com/perslev/psg-utils', packages=find_packages(), package_dir={'psg_utils': 'psg_utils'}, include_package_data=True, install_requires=requirements, classifiers=['Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11'] )
36.527778
138
0.660837
158
1,315
5.272152
0.525316
0.136855
0.180072
0.187275
0
0
0
0
0
0
0
0.013553
0.214449
1,315
35
139
37.571429
0.792836
0
0
0
0
0
0.408365
0
0
0
0
0
0
1
0
false
0
0.032258
0
0.032258
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
33b42989e177566653444789d4dfcd98cc9d1f13
835
py
Python
test_day01/test_ex1.py
anxodio/aoc2021
b987e917676bdbc688d02526223b81f5c69aedf2
[ "MIT" ]
null
null
null
test_day01/test_ex1.py
anxodio/aoc2021
b987e917676bdbc688d02526223b81f5c69aedf2
[ "MIT" ]
null
null
null
test_day01/test_ex1.py
anxodio/aoc2021
b987e917676bdbc688d02526223b81f5c69aedf2
[ "MIT" ]
1
2021-12-01T15:49:10.000Z
2021-12-01T15:49:10.000Z
from pathlib import Path from typing import List import itertools def measurement_increases_counter(measurements: List[int]) -> int: return sum( measurement2 > measurement1 for measurement1, measurement2 in itertools.pairwise(measurements) ) def test_measurement_increases_counter(): assert ( measurement_increases_counter( [ 199, 200, 208, 210, 200, 207, 240, 269, 260, 263, ] ) == 7 ) if __name__ == "__main__": with open((Path(__file__).parent / "input.txt")) as f: measurements = [int(line) for line in f.readlines()] print(measurement_increases_counter(measurements))
22.567568
74
0.530539
74
835
5.702703
0.621622
0.189573
0.255924
0.184834
0
0
0
0
0
0
0
0.068898
0.391617
835
36
75
23.194444
0.761811
0
0
0.066667
0
0
0.020359
0
0
0
0
0
0.033333
1
0.066667
false
0
0.1
0.033333
0.2
0.033333
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
33b53d639611e77f01e7bc538a64b7acb3f39222
282
py
Python
text/_form/cascade/select/attribute/value/exact.py
jedhsu/text
8525b602d304ac571a629104c48703443244545c
[ "Apache-2.0" ]
null
null
null
text/_form/cascade/select/attribute/value/exact.py
jedhsu/text
8525b602d304ac571a629104c48703443244545c
[ "Apache-2.0" ]
null
null
null
text/_form/cascade/select/attribute/value/exact.py
jedhsu/text
8525b602d304ac571a629104c48703443244545c
[ "Apache-2.0" ]
null
null
null
""" *Attribute-Exact-Value-Select* Select based on attribute value. """ from abc import ABCMeta from ._select import AttributeValueSelect __all__ = ["AttributeExactValueSelect"] class AttributeExactValueSelect( AttributeValueSelect, ): __metaclass__ = ABCMeta
14.1
41
0.748227
24
282
8.416667
0.625
0
0
0
0
0
0
0
0
0
0
0
0.170213
282
19
42
14.842105
0.863248
0.22695
0
0
0
0
0.123762
0.123762
0
0
0
0
0
1
0
false
0
0.285714
0
0.571429
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
33c49d6325199bc8fde9a2e407202f99b7ae2e0c
732
py
Python
corehq/apps/hqadmin/views/utils.py
dimagilg/commcare-hq
ea1786238eae556bb7f1cbd8d2460171af1b619c
[ "BSD-3-Clause" ]
471
2015-01-10T02:55:01.000Z
2022-03-29T18:07:18.000Z
corehq/apps/hqadmin/views/utils.py
dimagilg/commcare-hq
ea1786238eae556bb7f1cbd8d2460171af1b619c
[ "BSD-3-Clause" ]
14,354
2015-01-01T07:38:23.000Z
2022-03-31T20:55:14.000Z
corehq/apps/hqadmin/views/utils.py
dimagilg/commcare-hq
ea1786238eae556bb7f1cbd8d2460171af1b619c
[ "BSD-3-Clause" ]
175
2015-01-06T07:16:47.000Z
2022-03-29T13:27:01.000Z
from django.http import HttpResponseRedirect from django.utils.translation import ugettext_lazy from corehq.apps.domain.decorators import require_superuser from corehq.apps.hqwebapp.views import BaseSectionPageView from corehq.util import reverse @require_superuser def default(request): from ..reports import UserListReport return HttpResponseRedirect(UserListReport.get_url()) def get_hqadmin_base_context(request): return { "domain": None, } class BaseAdminSectionView(BaseSectionPageView): section_name = ugettext_lazy("Admin") @property def section_url(self): return reverse('default_admin_report') @property def page_url(self): return reverse(self.urlname)
23.612903
59
0.763661
82
732
6.658537
0.512195
0.054945
0.051282
0.07326
0
0
0
0
0
0
0
0
0.163934
732
30
60
24.4
0.892157
0
0
0.095238
0
0
0.04235
0
0
0
0
0
0
1
0.190476
false
0
0.285714
0.142857
0.761905
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
33c66d5f63af69e8d9398206740a431eeb3370c0
1,600
py
Python
django_project/blog/models.py
nikki259/Blog-Made-Easy
cebc418101fc9e9638fb05d0d59895abf51ea695
[ "bzip2-1.0.6" ]
null
null
null
django_project/blog/models.py
nikki259/Blog-Made-Easy
cebc418101fc9e9638fb05d0d59895abf51ea695
[ "bzip2-1.0.6" ]
null
null
null
django_project/blog/models.py
nikki259/Blog-Made-Easy
cebc418101fc9e9638fb05d0d59895abf51ea695
[ "bzip2-1.0.6" ]
null
null
null
from django.db import models from django.utils import timezone from django.contrib.auth.models import User from django.urls import reverse class Post(models.Model): title = models.CharField(max_length = 100) content = models.TextField() # date_posted = models.DateTimeField(auto_now_add=True) date_posted = models.DateTimeField(default=timezone.now) author = models.ForeignKey(User, on_delete=models.CASCADE) keywords = models.TextField(default='keywords') text_summary = models.TextField(default='blog summary') #image = models.ImageField(default='images.jfif',blank=True) def __str__(self): return self.title def get_absolute_url(self): return reverse('post-detail', kwargs={'pk':self.pk}) class Blog(models.Model): title = models.CharField(max_length= 150) content = models.TextField() dateposted = models.DateTimeField(default=timezone.now) auth = models.ForeignKey(User,on_delete=models.CASCADE) def __str__(self): return self.title class Blogthis(models.Model): title = models.CharField(max_length= 150) content = models.TextField() date_posted = models.DateTimeField(default=timezone.now) keywords = models.TextField() auth = models.ForeignKey(User, on_delete=models.CASCADE) def __str__(self): return self.title class BlogImage(models.Model): img = models.ForeignKey(Blog,on_delete=models.CASCADE) image = models.ImageField(default='images.jfif',upload_to='blog_images/') class BlogImageAgain(models.Model): img = models.ForeignKey(Post,on_delete=models.CASCADE) image = models.ImageField(default='images.jfif',upload_to='blog_images_again/')
29.090909
80
0.77625
212
1,600
5.70283
0.29717
0.074442
0.057899
0.086849
0.678246
0.598015
0.545906
0.358974
0.358974
0.358974
0
0.006263
0.101875
1,600
54
81
29.62963
0.835073
0.07
0
0.416667
0
0
0.057239
0
0
0
0
0
0
1
0.111111
false
0
0.111111
0.111111
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
33e9773121ff7d31da8560b65deb9cf0b0b06f72
175
py
Python
day01/day01-1.py
RobinRH/advent-of-code-2018
461c8b569129b7dfb582c7e84566c198edec4c14
[ "MIT" ]
null
null
null
day01/day01-1.py
RobinRH/advent-of-code-2018
461c8b569129b7dfb582c7e84566c198edec4c14
[ "MIT" ]
null
null
null
day01/day01-1.py
RobinRH/advent-of-code-2018
461c8b569129b7dfb582c7e84566c198edec4c14
[ "MIT" ]
null
null
null
# 516 # # https://adventofcode.com/2018/day/1 import sys with open(sys.argv[1], 'r') as inputFile: numbers = sum([int(x) for x in inputFile.readlines()]) print numbers
15.909091
58
0.674286
28
175
4.214286
0.821429
0
0
0
0
0
0
0
0
0
0
0.061224
0.16
175
10
59
17.5
0.741497
0.222857
0
0
0
0
0.007576
0
0
0
0
0
0
0
null
null
0
0.25
null
null
0.25
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
33f558a28da98c4a1a6a55611702df0cbe600a31
937
py
Python
getTPRandFPRbyThreshold.py
andregustavom/quantifiers4python
433b564599cdedffa711d64392381aebdccaad41
[ "MIT" ]
null
null
null
getTPRandFPRbyThreshold.py
andregustavom/quantifiers4python
433b564599cdedffa711d64392381aebdccaad41
[ "MIT" ]
null
null
null
getTPRandFPRbyThreshold.py
andregustavom/quantifiers4python
433b564599cdedffa711d64392381aebdccaad41
[ "MIT" ]
null
null
null
import pandas as pd import numpy as np def getTPRandFPRbyThreshold (validation_scores): unique_scores = np.arange(0,1,0.01) arrayOfTPRandFPRByTr = pd.DataFrame(columns=['threshold','fpr', 'tpr']) total_positive = len(validation_scores[validation_scores['class']==1]) total_negative = len(validation_scores[validation_scores['class']==0]) for threshold in unique_scores: fp = len(validation_scores[(validation_scores['score'] > threshold) & (validation_scores['class']==0)]) tp = len(validation_scores[(validation_scores['score'] > threshold) & (validation_scores['class']==1)]) tpr = round(tp/total_positive,2) fpr = round(fp/total_negative,2) aux = pd.DataFrame([[round(threshold,2), fpr, tpr]]) aux.columns = ['threshold', 'fpr', 'tpr'] arrayOfTPRandFPRByTr = pd.concat([arrayOfTPRandFPRByTr, aux]) return arrayOfTPRandFPRByTr
49.315789
112
0.67556
106
937
5.811321
0.339623
0.285714
0.123377
0.188312
0.357143
0.357143
0.227273
0.227273
0.227273
0.227273
0
0.015686
0.183565
937
19
113
49.315789
0.789542
0
0
0
0
0
0.065217
0
0
0
0
0
0
1
0.0625
false
0
0.125
0
0.25
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
33fa45395cd3ed27129851ca9f2b2f896d0a94c0
210
py
Python
CodeForces/JzzhuAndChildren.py
PratikGarai/Coding-Challenges
af5f4458505b26538ec2d7dc0ca09aa236b2d01c
[ "MIT" ]
null
null
null
CodeForces/JzzhuAndChildren.py
PratikGarai/Coding-Challenges
af5f4458505b26538ec2d7dc0ca09aa236b2d01c
[ "MIT" ]
2
2020-10-01T16:13:37.000Z
2020-10-30T19:12:38.000Z
CodeForces/JzzhuAndChildren.py
PratikGarai/Coding-Challenges
af5f4458505b26538ec2d7dc0ca09aa236b2d01c
[ "MIT" ]
6
2020-10-03T09:04:26.000Z
2022-01-09T11:57:40.000Z
import math n,m = map(int, input().split()) s = list(map(int, input().split())) mx = 0 ind = 0 for i in range(n): if math.ceil(s[i]/m)>=mx: mx = math.ceil(s[i]/m) ind = i print(ind + 1)
14
35
0.519048
41
210
2.658537
0.512195
0.110092
0.201835
0.293578
0.201835
0
0
0
0
0
0
0.019355
0.261905
210
14
36
15
0.683871
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.1
0
0.1
0.1
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
d50962b3e4f36a7f341b1bb20b0e62368b04f2c6
381
py
Python
app1/forms.py
BethanyFolino/bugtracker
fd4868d52a7479b83a44e692fb268e325dc8cfde
[ "MIT" ]
null
null
null
app1/forms.py
BethanyFolino/bugtracker
fd4868d52a7479b83a44e692fb268e325dc8cfde
[ "MIT" ]
null
null
null
app1/forms.py
BethanyFolino/bugtracker
fd4868d52a7479b83a44e692fb268e325dc8cfde
[ "MIT" ]
null
null
null
from django import forms from django.contrib.auth.models import AbstractUser from app1.models import MyUser class AddUserForm(forms.Form): username = forms.CharField(max_length=150) password = forms.CharField(widget=forms.PasswordInput) class LoginForm(forms.Form): username = forms.CharField(max_length=150) password = forms.CharField(widget=forms.PasswordInput)
34.636364
58
0.792651
48
381
6.25
0.458333
0.186667
0.113333
0.146667
0.593333
0.593333
0.593333
0.593333
0.593333
0.593333
0
0.020833
0.11811
381
11
59
34.636364
0.872024
0
0
0.444444
0
0
0
0
0
0
0
0
0
1
0
false
0.222222
0.333333
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
0
0
0
2
d50b5a7cc1bf3cf4fd9bf527507697f3c5e85e76
873
py
Python
giscube_search/management/commands/giscube_search_drop_indexes.py
aroiginfraplan/giscube-admin
b7f3131b0186f847f3902df97f982cb288b16a49
[ "BSD-3-Clause" ]
5
2018-06-07T12:54:35.000Z
2022-01-14T10:38:38.000Z
giscube_search/management/commands/giscube_search_drop_indexes.py
aroiginfraplan/giscube-admin
b7f3131b0186f847f3902df97f982cb288b16a49
[ "BSD-3-Clause" ]
140
2018-06-18T10:27:28.000Z
2022-03-23T09:53:15.000Z
giscube_search/management/commands/giscube_search_drop_indexes.py
aroiginfraplan/giscube-admin
b7f3131b0186f847f3902df97f982cb288b16a49
[ "BSD-3-Clause" ]
1
2021-04-13T11:20:54.000Z
2021-04-13T11:20:54.000Z
import importlib from django.core.management.base import BaseCommand from giscube_search.model_utils import DocumentIndexEditor from giscube_search.utils import giscube_search_get_app_modules class Command(BaseCommand): def handle(self, *args, **options): """Drops all index tables""" done = [] for app_mod in giscube_search_get_app_modules(): try: m = "%s.giscube_search_indexes" % app_mod.__name__ search_index_module = importlib.import_module(m) except ImportError: pass continue for search_item in getattr(search_index_module, 'index_config', []): index = search_item.get_index() if not (index in done): done.append(index) DocumentIndexEditor(name=index).delete()
33.576923
80
0.620848
95
873
5.410526
0.505263
0.126459
0.066148
0.07393
0.101167
0
0
0
0
0
0
0
0.303551
873
25
81
34.92
0.845395
0.0252
0
0
0
0
0.043787
0.029586
0
0
0
0
0
1
0.052632
false
0.052632
0.315789
0
0.421053
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
0
0
0
2
1d1bca26af7835f62ba064e25f5edad2572cf98b
326
py
Python
example/demo.py
chintal/raspi-backdrop
0682b8ec0ccfdcca9cdbbb3349d13054105dbc73
[ "MIT" ]
null
null
null
example/demo.py
chintal/raspi-backdrop
0682b8ec0ccfdcca9cdbbb3349d13054105dbc73
[ "MIT" ]
null
null
null
example/demo.py
chintal/raspi-backdrop
0682b8ec0ccfdcca9cdbbb3349d13054105dbc73
[ "MIT" ]
null
null
null
import time import subprocess cmd = ['backdrop','-l', '2', '-x', '200', '-y' '500', '-w', '60', '-h', '78'] backdrop_process = subprocess.Popen(cmd, stdin=subprocess.PIPE) time.sleep(4) backdrop_process.stdin.write('400,100,400,300\n'.encode()) backdrop_process.stdin.flush() time.sleep(4) backdrop_process.terminate()
19.176471
77
0.680982
47
326
4.638298
0.617021
0.275229
0.091743
0.165138
0.229358
0
0
0
0
0
0
0.085034
0.09816
326
16
78
20.375
0.656463
0
0
0.222222
0
0
0.141538
0
0
0
0
0
0
1
0
false
0
0.222222
0
0.222222
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
1d2c1f6eb70c5513b1dfbfd236c39e28d5c8565a
537
py
Python
events/handler/views.py
totaki/learn-python-pnz-00
fbed6305f1d424f1a25f7ef9d86fa136540c0508
[ "MIT" ]
null
null
null
events/handler/views.py
totaki/learn-python-pnz-00
fbed6305f1d424f1a25f7ef9d86fa136540c0508
[ "MIT" ]
42
2019-12-14T15:43:11.000Z
2022-02-26T22:18:19.000Z
events/handler/views.py
totaki/learn-python-pnz-00
fbed6305f1d424f1a25f7ef9d86fa136540c0508
[ "MIT" ]
1
2019-12-09T16:13:22.000Z
2019-12-09T16:13:22.000Z
from rest_framework import viewsets from handler.serializers import EventsSerializer, PlaceSerializer from handler.models import Event, Place class EventViewSet(viewsets.ModelViewSet): """ API endpoint that allows users to be viewed or edited. """ queryset = Event.objects.all() serializer_class = EventsSerializer class PlaceViewSet(viewsets.ModelViewSet): """ API endpoint that allows groups to be viewed or edited. """ queryset = Place.objects.all() serializer_class = PlaceSerializer
21.48
65
0.73743
59
537
6.661017
0.525424
0.05598
0.117048
0.157761
0.340967
0.340967
0
0
0
0
0
0
0.191806
537
24
66
22.375
0.90553
0.204842
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
1d2da81ca95629fc3f3a2d02870c62a822aea9e0
417
py
Python
linter.py
Ruk33/SublimeLinter-contrib-vrjasslint
dad0a5b7859838de7182ce375323f566e60c646f
[ "MIT" ]
null
null
null
linter.py
Ruk33/SublimeLinter-contrib-vrjasslint
dad0a5b7859838de7182ce375323f566e60c646f
[ "MIT" ]
null
null
null
linter.py
Ruk33/SublimeLinter-contrib-vrjasslint
dad0a5b7859838de7182ce375323f566e60c646f
[ "MIT" ]
null
null
null
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Ruke # # License: MIT # """This module exports the Vrjasslint plugin class.""" from SublimeLinter.lint import Linter, util import os class Vrjasslint(Linter): """Provides an interface to vrjasslint.""" syntax = 'jass' regex = r'(?P<line>\d+):(?P<col>\d+) (?P<message>.+)' cmd = 'java -jar * -c'
20.85
73
0.659472
57
417
4.824561
0.807018
0.014545
0
0
0
0
0
0
0
0
0
0.0059
0.18705
417
20
74
20.85
0.80531
0.472422
0
0
0
0
0.295567
0.128079
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
1d60a99f0ecea7d433c6f908e315ab3a23e65510
125
py
Python
Ex43.py
TiagoM018/Python-Stuff
c868ce4872edb414d8b058aa278cc0b1ca864fcc
[ "Unlicense" ]
null
null
null
Ex43.py
TiagoM018/Python-Stuff
c868ce4872edb414d8b058aa278cc0b1ca864fcc
[ "Unlicense" ]
null
null
null
Ex43.py
TiagoM018/Python-Stuff
c868ce4872edb414d8b058aa278cc0b1ca864fcc
[ "Unlicense" ]
null
null
null
x = int (input('Digite um numero :')) for x in range (0,x): print (x) if x % 4 == 0: print ('[{}]'.format(x))
25
37
0.472
21
125
2.809524
0.666667
0
0
0
0
0
0
0
0
0
0
0.034091
0.296
125
5
38
25
0.636364
0
0
0
0
0
0.174603
0
0
0
0
0
0
1
0
false
0
0
0
0
0.4
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
1d6980aa56922d32e77dada03a2cc42243b4831e
88
py
Python
libsalesforce/__init__.py
cybojenix/py-libsalesforce
5468b6043196a403cd6bb9c493864ddacdb51c67
[ "MIT" ]
null
null
null
libsalesforce/__init__.py
cybojenix/py-libsalesforce
5468b6043196a403cd6bb9c493864ddacdb51c67
[ "MIT" ]
null
null
null
libsalesforce/__init__.py
cybojenix/py-libsalesforce
5468b6043196a403cd6bb9c493864ddacdb51c67
[ "MIT" ]
null
null
null
"""A Library for a cleaner interface with the Salesforce APIs""" __version__ = "0.1.0"
22
64
0.715909
14
88
4.214286
0.857143
0
0
0
0
0
0
0
0
0
0
0.040541
0.159091
88
3
65
29.333333
0.756757
0.659091
0
0
0
0
0.208333
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
1d6bd195a6f1f2ab35641c7349e64b700d5ef67d
699
py
Python
codewars/8 kyu/get-planet-name-by-id.py
sirken/coding-practice
9c5e23b2c24f525a89a5e1d15ce3aec3ad1a01ab
[ "MIT" ]
null
null
null
codewars/8 kyu/get-planet-name-by-id.py
sirken/coding-practice
9c5e23b2c24f525a89a5e1d15ce3aec3ad1a01ab
[ "MIT" ]
null
null
null
codewars/8 kyu/get-planet-name-by-id.py
sirken/coding-practice
9c5e23b2c24f525a89a5e1d15ce3aec3ad1a01ab
[ "MIT" ]
null
null
null
from Test import Test, Test as test ''' The function is not returning the correct values. Can you figure out why? get_planet_name(3) # should return 'Earth' ''' def get_planet_name(id): planets = { 1: "Mercury", 2: "Venus", 3: "Earth", 4: "Mars", 5: "Jupiter", 6: "Saturn", 7: "Uranus", 8: "Neptune" } return planets[id] Test.assert_equals(get_planet_name(2), 'Venus') Test.assert_equals(get_planet_name(5), 'Jupiter') Test.assert_equals(get_planet_name(3), 'Earth') Test.assert_equals(get_planet_name(4), 'Mars') Test.assert_equals(get_planet_name(8), 'Neptune') Test.assert_equals(get_planet_name(1), 'Mercury')
24.103448
73
0.643777
100
699
4.28
0.42
0.168224
0.242991
0.266355
0.406542
0.406542
0
0
0
0
0
0.027223
0.211731
699
29
74
24.103448
0.749546
0
0
0
0
0
0.142609
0
0
0
0
0
0.315789
1
0.052632
false
0
0.052632
0
0.157895
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
1d6e0f10d53eaa0bade71b9a63a6caf43ac6c36d
135
py
Python
file_read2.py
Glenn-Po/LearningPython
96b12999d13b55216a3da6cf6b9248a8e86cbe0b
[ "Apache-2.0" ]
null
null
null
file_read2.py
Glenn-Po/LearningPython
96b12999d13b55216a3da6cf6b9248a8e86cbe0b
[ "Apache-2.0" ]
null
null
null
file_read2.py
Glenn-Po/LearningPython
96b12999d13b55216a3da6cf6b9248a8e86cbe0b
[ "Apache-2.0" ]
null
null
null
#try out file I/O myfile=open("example.txt", "a+") secondfile=open("python.txt", "r") for _ in range(4): print(secondfile.read())
22.5
34
0.651852
22
135
3.954545
0.863636
0
0
0
0
0
0
0
0
0
0
0.008547
0.133333
135
5
35
27
0.735043
0.125926
0
0
0
0
0.205128
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
1d78dd533c294ebfd39658fcfa913858b11b07e8
1,017
py
Python
inz/activation.py
matbur/inz
f6be1a685761f99f8c808d8b23f58debf7e19da2
[ "MIT" ]
null
null
null
inz/activation.py
matbur/inz
f6be1a685761f99f8c808d8b23f58debf7e19da2
[ "MIT" ]
2
2020-03-24T16:35:39.000Z
2020-03-31T00:33:08.000Z
inz/activation.py
matbur/inz
f6be1a685761f99f8c808d8b23f58debf7e19da2
[ "MIT" ]
null
null
null
""" This module contains all activation functions. source: https://en.wikipedia.org/wiki/Activation_function """ import numpy as np def identity(x, der=False): if der: return 1 return x def binary_step(x, der=False): if der: if x == 0: raise ValueError('?') return 0 return x >= 0 def sigmoid(x, der=False): if der: return np.exp(x) / (1 + np.exp(x)) ** 2 return 1 / (1 + np.exp(-x)) def tanh(x, der=False): if der: return 1 - tanh(x) ** 2 return np.tanh(x) def arctan(x, der=False): if der: return 1 / (1 + x ** 2) return np.arctan(x) def soft_sign(x, der=False): if der: return 1 / (1 + abs(x)) ** 2 return x / (1 + abs(x)) def relu(x, der=False): if der: return x * (x > 0) / x return np.maximum(0, x) def softmax(x): rows_max = np.max(x, axis=1).reshape(-1, 1) e_x = np.exp(x - rows_max) div = np.sum(e_x, axis=1).reshape(-1, 1) return e_x / div
17.237288
57
0.539823
171
1,017
3.163743
0.280702
0.051756
0.116451
0.142329
0.314233
0.288355
0.158965
0.081331
0
0
0
0.035361
0.304818
1,017
58
58
17.534483
0.729844
0.103245
0
0.194444
0
0
0.001106
0
0
0
0
0
0
1
0.222222
false
0
0.027778
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
1d963715640b6802fd4f1a32d0694ad1084d034c
3,909
py
Python
rbtools/utils/tests/test_aliases.py
torcolvin/rbtools
3fbea5f57d0768488f56f398a174056e837f51b1
[ "MIT" ]
113
2015-01-01T15:26:22.000Z
2022-01-02T11:37:46.000Z
rbtools/utils/tests/test_aliases.py
torcolvin/rbtools
3fbea5f57d0768488f56f398a174056e837f51b1
[ "MIT" ]
29
2015-01-06T21:31:50.000Z
2022-01-12T05:37:26.000Z
rbtools/utils/tests/test_aliases.py
torcolvin/rbtools
3fbea5f57d0768488f56f398a174056e837f51b1
[ "MIT" ]
109
2015-01-03T20:55:05.000Z
2022-02-15T13:18:44.000Z
"""Unit tests for rbtools.utils.aliases.""" from __future__ import unicode_literals from rbtools.utils.aliases import replace_arguments from rbtools.utils.testbase import RBTestBase class AliasTests(RBTestBase): """Tests for rbtools.utils.aliases.""" def test_replace_arguments_basic(self): """Testing replace_arguments with variables and arguments""" self.assertEqual(replace_arguments('$1', ['HEAD'], posix=True), ['HEAD']) def test_replace_arguments_multiple(self): """Testing replace_arguments with multiple variables and arguments""" self.assertEqual(replace_arguments('$1..$2', ['a', 'b'], posix=True), ['a..b']) def test_replace_arguments_blank(self): """Testing replace_arguments with variables and a missing argument""" self.assertEqual(replace_arguments('rbt post $1', [], posix=True), ['rbt', 'post']) def test_replace_arguments_append(self): """Testing replace_arguments with no variables or arguments.""" self.assertEqual( replace_arguments('echo', ['a', 'b', 'c'], posix=True), ['echo', 'a', 'b', 'c']) def test_replace_arguments_unrecognized_variables(self): """Testing replace_arguments with an unrecognized variable name""" self.assertEqual(replace_arguments('$1 $test', ['f'], posix=True), ['f', '$test']) def test_replace_arguments_star(self): """Testing replace_arguments with the special $* variable""" self.assertEqual(replace_arguments('$*', ['a', 'b', 'c'], posix=True), ['a', 'b', 'c']) def test_replace_arguments_star_whitespace(self): """Testing replace_arguments with the special $* variable with whitespace-containing arguments """ self.assertEqual( replace_arguments('$*', ['a', 'b', 'c d e'], posix=True), ['a', 'b', 'c d e']) def test_replace_arguments_unescaped_non_posix(self): """Testing replace_arguments in non-POSIX mode does not evaluate escape sequences """ self.assertEqual(replace_arguments(r'"$1 \\"', ['a'], posix=False), [r'"a \\"']) def test_replace_arguments_invalid_quote(self): """Testing replace_arguments with invalid quotes in POSIX and non-POSIX mode raises an error """ self.assertRaises( ValueError, lambda: replace_arguments('"foo', [], posix=True)) self.assertRaises( ValueError, lambda: replace_arguments('"foo', [], posix=False)) def test_replace_arguments_invalid_quote_posix(self): """Testing replace_arguments with escaped ending quote in non-POSIX mode does not escape the quote """ self.assertEqual(replace_arguments('"\\"', [], posix=False), ['"\\"']) def test_replace_arguments_invalid_quote_non_posix(self): """Testing replace_arguments with escaped ending quote in POSIX mode raises an error """ self.assertRaises( ValueError, lambda: replace_arguments('"\\"', [], posix=True)) def test_replace_arguments_quoted_non_posix(self): """Testing replace_arguments in non-POSIX mode with a quoted sequence in the command """ self.assertEqual( replace_arguments("find . -iname '*.pyc' -delete", [], posix=False), ['find', '.', '-iname', "'*.pyc'", '-delete']) def test_replace_arguments_escaped_posix(self): """Testing replace_arguments in POSIX mode evaluates escape sequences """ self.assertEqual( replace_arguments(r'$1 \\ "\\" "\""', ['a'], posix=True), ['a', '\\', '\\', '"'])
39.09
79
0.595549
412
3,909
5.444175
0.208738
0.292465
0.081141
0.133304
0.637539
0.491752
0.448061
0.361569
0.204191
0.204191
0
0.002446
0.267843
3,909
99
80
39.484848
0.781272
0.26196
0
0.188679
0
0
0.074991
0
0
0
0
0
0.264151
1
0.245283
false
0
0.056604
0
0.320755
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
1d9b9bfd51b6999d8a05110eac25a8accd6f7c7a
1,751
py
Python
polyphemus/githubstat.py
Xarthisius/polyphemus
3ae6cb9ff312d90478d8a294681bd898b7f45b1c
[ "BSD-2-Clause" ]
null
null
null
polyphemus/githubstat.py
Xarthisius/polyphemus
3ae6cb9ff312d90478d8a294681bd898b7f45b1c
[ "BSD-2-Clause" ]
null
null
null
polyphemus/githubstat.py
Xarthisius/polyphemus
3ae6cb9ff312d90478d8a294681bd898b7f45b1c
[ "BSD-2-Clause" ]
null
null
null
"""The plugin to recieve posts from batlab and update the status of the pull request. This module is available as an polyphemus plugin by the name ``polyphemus.githubstat``. GitHub Status API ================= """ from __future__ import print_function import os import io import sys from warnings import warn if sys.version_info[0] >= 3: basestring = str try: import simplejson as json except ImportError: import json from github3 import GitHub import github3.events from .utils import RunControl, NotSpecified, writenewonly from .plugins import Plugin from .event import Event, runfor from .githubbase import set_pull_request_status class PolyphemusPlugin(Plugin): """This class provides functionality for updating pull request statuses on github. """ requires = ('polyphemus.githubbase',) _status_descs = { 'success': 'Great Success!', 'pending': 'Patience, discipline.', 'failure': 'It turns out failure *was* an option.', 'error': 'Error: does not compute.', } @runfor('batlab-status', 'swc-status') def execute(self, rc): """The githubstat plugin is only executed for 'batlab-status' and 'swc-status' events and requires that the event data be a dictionary with 'status' and 'number' as keys. It optionally may also include 'target_url' and 'description' keys. """ data = rc.event.data pr = (rc.github_owner, rc.github_repo, data['number']) set_pull_request_status(pr, data['status'], target_url=data.get('target_url', ""), description=data.get('description', self._status_descs[data['status']]), user=rc.github_user, credfile=rc.github_credentials)
30.719298
87
0.676185
220
1,751
5.277273
0.504545
0.037898
0.024117
0.034453
0
0
0
0
0
0
0
0.002918
0.217019
1,751
56
88
31.267857
0.84391
0.3004
0
0
0
0
0.175815
0.01801
0
0
0
0
0
1
0.030303
false
0
0.424242
0
0.545455
0.030303
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
1da532337e51ce79a01fad10db2a60abccaaf6a4
2,173
tac
Python
slave/buildbot.tac
bopopescu/chromium-build
f8e42c70146c1b668421ee6358dc550a955770a3
[ "BSD-3-Clause" ]
null
null
null
slave/buildbot.tac
bopopescu/chromium-build
f8e42c70146c1b668421ee6358dc550a955770a3
[ "BSD-3-Clause" ]
null
null
null
slave/buildbot.tac
bopopescu/chromium-build
f8e42c70146c1b668421ee6358dc550a955770a3
[ "BSD-3-Clause" ]
1
2020-07-22T09:16:32.000Z
2020-07-22T09:16:32.000Z
# -*- python -*- # ex: set syntax=python: # Copyright (c) 2010 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Chrome Buildbot slave configuration import argparse import os import socket import sys from buildslave.bot import BuildSlave from infra_libs import ts_mon from twisted.application import service from twisted.internet import reactor # Register the commands. from slave import chromium_commands # Load default settings. import config # config.Master.active_master and config.Master.active_slavename # are set in run_slave.py ActiveMaster = config.Master.active_master slavename = config.Master.active_slavename # Slave properties: password = config.Master.GetBotPassword() host = None port = None basedir = None keepalive = 300 usepty = 0 umask = None print 'Using slave name %s' % slavename if password is None: print >> sys.stderr, '*** No password configured in %s.' % repr(__file__) sys.exit(1) if host is None: host = os.environ.get('TESTING_MASTER_HOST', ActiveMaster.master_host) print 'Using master host %s' % host if port is None: port = ActiveMaster.slave_port print 'Using master port %s' % port if basedir is None: basedir = os.path.dirname(os.path.abspath(__file__)) def setup_timeseries_monitoring(): parser = argparse.ArgumentParser() ts_mon.add_argparse_options(parser) parser.set_defaults( ts_mon_target_type='task', ts_mon_task_service_name='buildslave', ts_mon_task_job_name='buildslave', ) args = parser.parse_args([]) ts_mon.process_argparse_options(args) def stop_timeseries_monitoring(): ts_mon.close() reactor.addSystemEventTrigger('during', 'startup', setup_timeseries_monitoring) reactor.addSystemEventTrigger('during', 'shutdown', stop_timeseries_monitoring) application = service.Application('buildslave') s = BuildSlave(host, port, slavename, password, basedir, keepalive, usepty, umask=umask, allow_shutdown='file') s.setServiceParent(application)
26.82716
80
0.726185
277
2,173
5.519856
0.429603
0.022891
0.04709
0.031393
0
0
0
0
0
0
0
0.005093
0.186838
2,173
80
81
27.1625
0.860215
0.176714
0
0
0
0
0.103712
0
0
0
0
0
0
0
null
null
0.081633
0.204082
null
null
0.081633
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
1daa50b1abe8329b19ed70b0fe1079214063b4db
83
py
Python
immature.py
TotallyNotTito/redesigned-octo-spoon
ff6e65536df8dc1a16cfc504571630423084ba05
[ "MIT" ]
1
2021-08-24T20:09:07.000Z
2021-08-24T20:09:07.000Z
immature.py
TotallyNotTito/redesigned-octo-spoon
ff6e65536df8dc1a16cfc504571630423084ba05
[ "MIT" ]
null
null
null
immature.py
TotallyNotTito/redesigned-octo-spoon
ff6e65536df8dc1a16cfc504571630423084ba05
[ "MIT" ]
null
null
null
a = "python" b = "is" c = "excellent" d = a[0] + c[0] + a[len(a)-1] + b print(d)
10.375
33
0.457831
18
83
2.111111
0.611111
0
0
0
0
0
0
0
0
0
0
0.048387
0.253012
83
7
34
11.857143
0.564516
0
0
0
0
0
0.204819
0
0
0
0
0
0
1
0
false
0
0
0
0
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d52e374c02176a7133a1462ff44381980734317e
60
py
Python
config_default.py
anne17/bevaka-tandvard
fb0502c9472d9397ab4c902873c01b70f164665e
[ "MIT" ]
null
null
null
config_default.py
anne17/bevaka-tandvard
fb0502c9472d9397ab4c902873c01b70f164665e
[ "MIT" ]
null
null
null
config_default.py
anne17/bevaka-tandvard
fb0502c9472d9397ab4c902873c01b70f164665e
[ "MIT" ]
null
null
null
sender = "Some Name <emailadress>" receiver = "emailadress"
20
34
0.733333
6
60
7.333333
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.133333
60
2
35
30
0.846154
0
0
0
0
0
0.566667
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
d5340f7a7e4a213058b63b94c7e5148cf0c3835d
105
py
Python
Informatik1/Midterms Prep/midterms hs17/positive_negative.py
Queentaker/uzh
35cccaf910b95d15db21be80c8567eb427202591
[ "MIT" ]
8
2021-11-21T10:02:08.000Z
2022-03-15T21:02:02.000Z
Informatik1/Midterms Prep/midterms hs17/positive_negative.py
Queentaker/uzh
35cccaf910b95d15db21be80c8567eb427202591
[ "MIT" ]
null
null
null
Informatik1/Midterms Prep/midterms hs17/positive_negative.py
Queentaker/uzh
35cccaf910b95d15db21be80c8567eb427202591
[ "MIT" ]
3
2021-11-19T18:52:56.000Z
2022-02-27T15:45:59.000Z
x = int(input("Please enter any number!")) if x >= 0: print( "Positive") else: print( "Negative")
21
42
0.6
15
105
4.2
0.866667
0
0
0
0
0
0
0
0
0
0
0.012048
0.209524
105
5
43
21
0.746988
0
0
0
0
0
0.377358
0
0
0
0
0
0
1
0
false
0
0
0
0
0.4
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
d5398fcb92462c36227d4584052e5ccf06a762f1
309
py
Python
python test/13.py
merry-hyelyn/LIKE_LION
26d6642a88d5c075447c60d43a70a7d0f082fb07
[ "MIT" ]
null
null
null
python test/13.py
merry-hyelyn/LIKE_LION
26d6642a88d5c075447c60d43a70a7d0f082fb07
[ "MIT" ]
null
null
null
python test/13.py
merry-hyelyn/LIKE_LION
26d6642a88d5c075447c60d43a70a7d0f082fb07
[ "MIT" ]
null
null
null
num = int(input("1부터 9 사이 숫자를 입력하세요 : ")) for i in range(1, num+1): if i % 2 != 0: for j in range(1, num+1): if j % 2 != 0: print(j, end=' ') else: for j in range(1, num+1): if j % 2 == 0: print(' ', j, end='') print('\n')
23.769231
41
0.375405
50
309
2.32
0.42
0.181034
0.206897
0.284483
0.637931
0.637931
0.517241
0.517241
0.517241
0.517241
0
0.081395
0.443366
309
12
42
25.75
0.593023
0
0
0.181818
0
0
0.084142
0
0
0
0
0
0
1
0
false
0
0
0
0
0.272727
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
d5428c208771d289da5d380cd98ba7db4dc4f9b7
1,093
py
Python
cha_bebe/presente/admin.py
intelektos/Cha_bebe
23df4af3901413c9c50e73bd305ade165c81001b
[ "MIT" ]
null
null
null
cha_bebe/presente/admin.py
intelektos/Cha_bebe
23df4af3901413c9c50e73bd305ade165c81001b
[ "MIT" ]
9
2020-06-08T03:31:08.000Z
2022-01-13T02:44:42.000Z
cha_bebe/presente/admin.py
intelektos/Cha_bebe
23df4af3901413c9c50e73bd305ade165c81001b
[ "MIT" ]
1
2020-06-01T17:43:20.000Z
2020-06-01T17:43:20.000Z
try: import Image except ImportError: from PIL import Image from django import forms from django.contrib import admin from django.contrib.admin.options import ModelAdmin from .models import Presente class FormPresente(forms.ModelForm): class Meta: model = Presente fields = '__all__' class AdminPresente(ModelAdmin): list_display = ('titulo',) list_filter = ('titulo',) search_fields = ('titulo',) form = FormPresente def save_model(self, request, obj, form, change): """Metodo declarado para criar miniatura da imagem depois de salvar""" super(AdminPresente, self).save_model(request, obj, form, change) if 'imagem' in form.changed_data: extensao = obj.imagem.name.split('.')[-1] obj.thumbnail = 'presentes/thumbnail/%s.%s'%( obj.id, extensao) miniatura = Image.open(obj.imagem.path) miniatura.thumbnail((100,100), Image.ANTIALIAS) miniatura.save(obj.thumbnail.path) obj.save() admin.site.register(Presente, AdminPresente)
27.325
78
0.655078
125
1,093
5.648
0.512
0.042493
0.048159
0.056657
0
0
0
0
0
0
0
0.008403
0.237877
1,093
39
79
28.025641
0.839136
0.058554
0
0
0
0
0.055828
0.024486
0
0
0
0.025641
0
1
0.035714
false
0
0.25
0
0.535714
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
0
0
0
1
0
0
2
d542e5af7d82a83d2c70bcf3211d00941b2ab678
1,202
py
Python
src/bl_ui_label.py
hyunjeong847/ROS-EYE
11b2f16d36c945372eefe488be3a969b2adf3c30
[ "MIT" ]
13
2020-07-30T02:49:26.000Z
2020-12-23T07:14:59.000Z
src/bl_ui_label.py
hyunjeong847/ROS-EYE
11b2f16d36c945372eefe488be3a969b2adf3c30
[ "MIT" ]
6
2020-09-03T15:00:57.000Z
2020-12-01T03:30:26.000Z
src/bl_ui_label.py
hyunjeong847/ROS-EYE
11b2f16d36c945372eefe488be3a969b2adf3c30
[ "MIT" ]
24
2020-06-16T03:43:39.000Z
2020-11-18T08:27:15.000Z
from bl_ui_widget import * import blf class BL_UI_Label(BL_UI_Widget): def __init__(self, x, y, width, height): super().__init__(x, y, width, height) self._text_color = (1.0, 1.0, 1.0, 1.0) self._text = "Label" self._text_size = 16 @property def text_color(self): return self._text_color @text_color.setter def text_color(self, value): self._text_color = value @property def text(self): return self._text @text.setter def text(self, value): self._text = value @property def text_size(self): return self._text_size @text_size.setter def text_size(self, value): self._text_size = value def is_in_rect(self, x, y): return False def draw(self): area_height = self.get_area_height() blf.size(0, self._text_size, 72) size = blf.dimensions(0, self._text) textpos_y = area_height - self.y_screen - self.height blf.position(0, self.x_screen, textpos_y, 0) r, g, b, a = self._text_color blf.color(0, r, g, b, a) blf.draw(0, self._text)
21.854545
61
0.574043
171
1,202
3.736842
0.245614
0.162754
0.081377
0.018779
0.028169
0.01252
0
0
0
0
0
0.022005
0.319468
1,202
54
62
22.259259
0.759169
0
0
0.081081
0
0
0.00416
0
0
0
0
0
0
1
0.243243
false
0
0.054054
0.108108
0.432432
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
d54825c6949223cef1caece235f59de559a95d52
3,593
py
Python
tensorflow/contrib/distributions/python/ops/gaussian.py
vmalarcon/tensorflow
eda89e930cfcbd992ecacafd40267d733e2153dc
[ "Apache-2.0" ]
21
2016-03-10T11:55:45.000Z
2021-02-03T02:49:11.000Z
tensorflow/contrib/distributions/python/ops/gaussian.py
vmalarcon/tensorflow
eda89e930cfcbd992ecacafd40267d733e2153dc
[ "Apache-2.0" ]
null
null
null
tensorflow/contrib/distributions/python/ops/gaussian.py
vmalarcon/tensorflow
eda89e930cfcbd992ecacafd40267d733e2153dc
[ "Apache-2.0" ]
39
2016-03-25T05:13:09.000Z
2020-06-16T01:30:53.000Z
# Copyright 2016 Google 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. # ============================================================================== """The Normal (Gaussian) distribution class. @@Gaussian """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import math from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops from tensorflow.python.ops import constant_op from tensorflow.python.ops import math_ops from tensorflow.python.ops import random_ops class Gaussian(object): """The Normal (Gaussian) distribution with mean mu and stddev sigma. The PDF of this distribution is: f(x) = sqrt(1/(2*pi*sigma^2)) exp(-(x-mu)^2/(2*sigma^2)) """ def __init__(self, mu, sigma): """Construct a new Gaussian distribution with mean mu and stddev sigma. Args: mu: Scalar tensor, the mean of the distribution. sigma: Scalar tensor, the precision of the distribution. Raises: TypeError: if mu and sigma are different dtypes. """ self._mu = ops.convert_to_tensor(mu) self._sigma = ops.convert_to_tensor(sigma) if mu.dtype != sigma.dtype: raise TypeError("Expected same dtype for mu, sigma but got: %s vs. %s" % (mu.dtype, sigma.dtype)) @property def dtype(self): return self._mu.dtype @property def shape(self): return constant_op.constant([]) # Scalar @property def mu(self): return self._mu @property def sigma(self): return self._sigma def log_pdf(self, x): """Log likelihood of observations in x under Gaussian with mu and sigma. Args: x: 1-D, a vector of observations. Returns: log_lik: 1-D, a vector of log likelihoods of `x` under the model. """ return (-0.5*math.log(2 * math.pi) - math_ops.log(self._sigma) -0.5*math_ops.square((x - self._mu) / self._sigma)) def cdf(self, x): """CDF of observations in x under Gaussian with mu and sigma. Args: x: 1-D, a vector of observations. Returns: cdf: 1-D, a vector of CDFs of `x` under the model. """ return (0.5 + 0.5*math_ops.erf( 1.0/(math.sqrt(2.0) * self._sigma)*(x - self._mu))) def log_cdf(self, x): """Log of the CDF of observations x under Gaussian with mu and sigma.""" return math_ops.log(self.cdf(x)) def pdf(self, x): """The PDF for observations x. Args: x: 1-D, a vector of observations. Returns: pdf: 1-D, a vector of pdf values of `x` under the model. """ return math_ops.exp(self.log_pdf(x)) def sample(self, n, seed=None): """Sample `n` observations from this Distribution. Args: n: Scalar int `Tensor`, the number of observations to sample. seed: Python integer, the random seed. Returns: samples: A vector of samples with shape `[n]`. """ return random_ops.random_normal( shape=array_ops.expand_dims(n, 0), mean=self._mu, stddev=self._sigma, dtype=self._mu.dtype, seed=seed)
28.975806
80
0.659894
536
3,593
4.324627
0.279851
0.020708
0.027179
0.023296
0.231665
0.204918
0.154012
0.141933
0.083261
0.068162
0
0.012065
0.215697
3,593
123
81
29.211382
0.810504
0.527971
0
0.095238
0
0
0.034211
0
0
0
0
0
0
1
0.238095
false
0
0.214286
0.095238
0.690476
0.02381
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
d54cd13c74b80480f3757283f7d697b3075f6bf0
1,033
py
Python
registers/SimulateRegister.py
nicoalonso/dory
3322afb929f0bc310f92b3294426eaefb1ff9353
[ "MIT" ]
null
null
null
registers/SimulateRegister.py
nicoalonso/dory
3322afb929f0bc310f92b3294426eaefb1ff9353
[ "MIT" ]
2
2021-04-30T21:02:08.000Z
2021-06-02T00:49:05.000Z
registers/SimulateRegister.py
nicoalonso/dory
3322afb929f0bc310f92b3294426eaefb1ff9353
[ "MIT" ]
null
null
null
#!/usr/bin/python3 from msgterm import MsgTerm from .RegisterBase import RegisterBase class SimulateRegister(RegisterBase): '''Simulate register Use this to simulate the register Use only for development purposes Extends: RegisterBase Args: config (Configurize): User configuration ''' def __init__(self, config): RegisterBase.__init__(self, config) def check(self): '''Check Check if the connection to the register is successfully Returns: bool: check result ''' MsgTerm.text('Simulate check register') MsgTerm.success('Simulate result: Ok') return True def list(self): '''Get list Show on the terminal the list of current records Use for debugging Returns: bool: list result ''' MsgTerm.text('Simulate list register') MsgTerm.success('Simulate result: Ok') return True
19.865385
63
0.588577
104
1,033
5.769231
0.480769
0.036667
0.046667
0.083333
0.16
0.16
0.16
0.16
0
0
0
0.001471
0.341723
1,033
51
64
20.254902
0.880882
0.375605
0
0.307692
0
0
0.170782
0
0
0
0
0
0
1
0.230769
false
0
0.153846
0
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
d56659cd9f317aee4b0e161df851838a754f985b
8,349
py
Python
tests/test_config.py
jparsai/cvejob
8f9462a1ecdf1d4de877ac5f44e772239ffcb379
[ "Apache-2.0" ]
8
2019-09-25T14:45:28.000Z
2021-11-08T10:30:03.000Z
tests/test_config.py
jparsai/cvejob
8f9462a1ecdf1d4de877ac5f44e772239ffcb379
[ "Apache-2.0" ]
113
2018-07-10T12:58:16.000Z
2020-12-09T22:33:15.000Z
tests/test_config.py
jparsai/cvejob
8f9462a1ecdf1d4de877ac5f44e772239ffcb379
[ "Apache-2.0" ]
12
2018-07-10T11:00:02.000Z
2021-01-27T12:19:56.000Z
"""Test for the config.py.""" # import pytest import os from cvejob.config import DefaultConfig, RuntimeConfig def test_default_config_constructor(): """Basic test for the class DefaultConfig.""" config = DefaultConfig() assert config is not None def test_default_config_attributes(): """Check the attributes existence for a class DefaultConfig.""" config = DefaultConfig() # basic configuration check attributes = ("ecosystem", "cve_age", "feed_dir", "feed_names", "date_range", "cve_id", "package_name", "cpe2pkg_path", "pkgfile_dir", "use_nvdtoolkit", "nvdtoolkit_export_dir") for attribute in attributes: assert hasattr(config, attribute) def test_default_config_attribute_values_nil(): """Check the attributes that needs to be set to nil (None).""" config = DefaultConfig() # the following attributes needs to be set to nil assert config.feed_names is None assert config.date_range is None assert config.cve_id is None assert config.package_name is None assert config.feed_names is None def test_default_config_attribute_values_not_nil(): """Check the attributes that needs not to be set to nil (None).""" config = DefaultConfig() # the following attributes need not be set to nil assert config.ecosystem is not None assert config.cve_age is not None assert config.feed_dir is not None assert config.cpe2pkg_path is not None assert config.pkgfile_dir is not None assert config.use_nvdtoolkit is not None assert config.nvdtoolkit_export_dir is not None def test_runtime_config(): """Basic test for the class RuntimeConfig.""" config = RuntimeConfig() assert config is not None def test_runtime_config_attributes(): """Check the attributes existence for a class RuntimeConfig.""" config = RuntimeConfig() assert config is not None assert hasattr(config, "_config") def unset_environment_variable(name): """Reset specified environment variable.""" return os.environ.pop(name, None) def test_runtime_config_attribute_ecosystem(): """Check the attributes handling for a class RuntimeConfig.""" old_value = unset_environment_variable('CVEJOB_ECOSYSTEM') config = RuntimeConfig() assert config._config.ecosystem == 'python' os.environ['CVEJOB_ECOSYSTEM'] = 'foobar' config = RuntimeConfig() assert config._config.ecosystem == 'foobar' if old_value is not None: os.environ['CVEJOB_ECOSYSTEM'] = old_value def test_runtime_config_attribute_cve_age(): """Check the attributes handling for a class RuntimeConfig.""" old_value = unset_environment_variable('CVEJOB_CVE_AGE') config = RuntimeConfig() assert config._config.cve_age == 0 os.environ['CVEJOB_CVE_AGE'] = '42' config = RuntimeConfig() assert config._config.cve_age == 42 os.environ['CVEJOB_CVE_AGE'] = '-42' config = RuntimeConfig() assert config._config.cve_age == -42 if old_value is not None: os.environ['CVEJOB_CVE_AGE'] = old_value def test_runtime_config_attribute_cvejob_feed_dir(): """Check the attributes handling for a class RuntimeConfig.""" old_value = unset_environment_variable('CVEJOB_FEED_DIR') config = RuntimeConfig() assert config._config.feed_dir == 'nvd-data/' os.environ['CVEJOB_FEED_DIR'] = 'directory1' config = RuntimeConfig() assert config._config.feed_dir == 'directory1' if old_value is not None: os.environ['CVEJOB_FEED_DIR'] = old_value def test_runtime_config_attribute_cvejob_feed_names(): """Check the attributes handling for a class RuntimeConfig.""" old_value = unset_environment_variable('CVEJOB_FEED_NAMES') config = RuntimeConfig() assert config._config.feed_names is None # TODO: the following test needs to be enabled after the fix in master branch # os.environ['CVEJOB_FEED_NAMES'] = 'name1' # config = RuntimeConfig() # assert config._config.feed_names == ['name1'] # os.environ['CVEJOB_FEED_NAMES'] = 'name1,name2' # config = RuntimeConfig() # assert config._config.feed_names == ['name1', 'name2'] if old_value is not None: os.environ['CVEJOB_FEED_NAMES'] = old_value def test_runtime_config_attribute_cvejob_date_range(): """Check the attributes handling for a class RuntimeConfig.""" old_value = unset_environment_variable('CVEJOB_DATE_RANGE') config = RuntimeConfig() assert config._config.date_range is None os.environ['CVEJOB_DATE_RANGE'] = '2017-01-01' config = RuntimeConfig() assert config._config.date_range == '2017-01-01' if old_value is not None: os.environ['CVEJOB_DATE_RANGE'] = old_value def test_runtime_config_attribute_cvejob_cve_id(): """Check the attributes handling for a class RuntimeConfig.""" old_value = unset_environment_variable('CVEJOB_CVE_ID') config = RuntimeConfig() assert config._config.cve_id is None os.environ['CVEJOB_CVE_ID'] = 'CVE1234' config = RuntimeConfig() assert config._config.cve_id == 'CVE1234' if old_value is not None: os.environ['CVEJOB_CVE_ID'] = old_value def test_runtime_config_attribute_cvejob_package_name(): """Check the attributes handling for a class RuntimeConfig.""" old_value = unset_environment_variable('CVEJOB_PACKAGE_NAME') config = RuntimeConfig() assert config._config.package_name is None os.environ['CVEJOB_PACKAGE_NAME'] = 'test_package' config = RuntimeConfig() assert config._config.package_name == 'test_package' if old_value is not None: os.environ['CVEJOB_PACKAGE_NAME'] = old_value def test_runtime_config_attribute_cvejob_cpe2pkg_path(): """Check the attributes handling for a class RuntimeConfig.""" old_value = unset_environment_variable('CVEJOB_CPE2PKG_PATH') config = RuntimeConfig() assert config._config.cpe2pkg_path == 'cpe2pkg.jar' os.environ['CVEJOB_CPE2PKG_PATH'] = 'cpe2pkg10.jar' config = RuntimeConfig() assert config._config.cpe2pkg_path == 'cpe2pkg10.jar' if old_value is not None: os.environ['CVEJOB_CPE2PKG_PATH'] = old_value def test_runtime_config_attribute_cvejob_pkgfile_dir(): """Check the attributes handling for a class RuntimeConfig.""" old_value = unset_environment_variable('CVEJOB_PKGFILE_DIR') config = RuntimeConfig() assert config._config.pkgfile_dir == 'data/' os.environ['CVEJOB_PKGFILE_DIR'] = 'cpe2pkg10.jar' config = RuntimeConfig() assert config._config.pkgfile_dir == 'cpe2pkg10.jar' if old_value is not None: os.environ['CVEJOB_PKGFILE_DIR'] = old_value def test_runtime_config_attribute_cvejob_use_nvd_toolkit(): """Check the attributes handling for a class RuntimeConfig.""" old_value = unset_environment_variable('CVEJOB_USE_NVD_TOOLKIT') config = RuntimeConfig() assert not config._config.use_nvdtoolkit os.environ['CVEJOB_USE_NVD_TOOLKIT'] = 'true' config = RuntimeConfig() assert config._config.use_nvdtoolkit os.environ['CVEJOB_USE_NVD_TOOLKIT'] = '1' config = RuntimeConfig() assert config._config.use_nvdtoolkit os.environ['CVEJOB_USE_NVD_TOOLKIT'] = 'yes' config = RuntimeConfig() assert config._config.use_nvdtoolkit os.environ['CVEJOB_USE_NVD_TOOLKIT'] = 'false' config = RuntimeConfig() assert not config._config.use_nvdtoolkit os.environ['CVEJOB_USE_NVD_TOOLKIT'] = '0' config = RuntimeConfig() assert not config._config.use_nvdtoolkit os.environ['CVEJOB_USE_NVD_TOOLKIT'] = 'no' config = RuntimeConfig() assert not config._config.use_nvdtoolkit if old_value is not None: os.environ['CVEJOB_USE_NVD_TOOLKIT'] = old_value def test_runtime_config_attribute_cvejob_nvd_toolkit_export_dir(): """Check the attributes handling for a class RuntimeConfig.""" old_value = unset_environment_variable('CVEJOB_NVD_TOOLKIT_EXPORT_DIR') config = RuntimeConfig() assert config._config.nvdtoolkit_export_dir == 'export/' os.environ['CVEJOB_NVD_TOOLKIT_EXPORT_DIR'] = 'export2/' config = RuntimeConfig() assert config._config.nvdtoolkit_export_dir == 'export2/' if old_value is not None: os.environ['CVEJOB_NVD_TOOLKIT_EXPORT_DIR'] = old_value
31.625
91
0.723081
1,064
8,349
5.37312
0.089286
0.08396
0.135561
0.146405
0.829281
0.762988
0.667308
0.523176
0.431345
0.338989
0
0.009658
0.181459
8,349
263
92
31.745247
0.826895
0.174392
0
0.370861
0
0
0.154413
0.041845
0
0
0
0.003802
0.291391
1
0.119205
false
0
0.013245
0
0.139073
0
0
0
0
null
0
0
0
1
1
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
d568284328f7d2637f2fa20910df46266ee7ca6e
1,285
py
Python
apollo/permissions.py
rpetti/apollo
1304d8623e6dfe8c9b269b7e90611b3688c0c61e
[ "MIT" ]
null
null
null
apollo/permissions.py
rpetti/apollo
1304d8623e6dfe8c9b269b7e90611b3688c0c61e
[ "MIT" ]
null
null
null
apollo/permissions.py
rpetti/apollo
1304d8623e6dfe8c9b269b7e90611b3688c0c61e
[ "MIT" ]
null
null
null
import discord class HavePermission: """Checks whether a user has the necessary permission to perform an action""" def __init__(self, discord_member, guild): self.discord_member = discord_member self.guild = guild def channel(self): if self.discord_member.guild_permissions.manage_guild: return True channel_create_role = self._get_role(self.guild.channel_role_id) if channel_create_role: return self.discord_member.top_role >= channel_create_role def delete(self): if self.discord_member.guild_permissions.manage_guild: return True event_delete_role = self._get_role(self.guild.delete_role_id) if event_delete_role: return self.discord_member.top_role >= event_delete_role def event(self): if self.discord_member.guild_permissions.manage_guild: return True event_create_role = self._get_role(self.guild.event_role_id) if event_create_role: return self.discord_member.top_role >= event_create_role else: # By default anyone can create events return True def _get_role(self, role_id): return discord.utils.get(self.discord_member.guild.roles, id=role_id)
34.72973
81
0.686381
168
1,285
4.910714
0.25
0.157576
0.185455
0.133333
0.482424
0.482424
0.453333
0.380606
0.230303
0.230303
0
0
0.247471
1,285
36
82
35.694444
0.853154
0.084047
0
0.259259
0
0
0
0
0
0
0
0
0
1
0.185185
false
0
0.037037
0.037037
0.555556
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
d56c33f7054eab2e27f71a5117d2dd28f071c8e6
304
py
Python
tags/models.py
kemalayhan/kinda-stackoverflow
99052b78b18cbc562388c4fea87b5ec15cb47067
[ "MIT" ]
7
2021-02-08T19:40:57.000Z
2021-10-01T08:09:21.000Z
tags/models.py
kemalayhan/kinda-stackoverflow
99052b78b18cbc562388c4fea87b5ec15cb47067
[ "MIT" ]
7
2021-04-08T19:57:02.000Z
2022-03-12T00:48:47.000Z
tags/models.py
kemalayhan/kinda-stackoverflow
99052b78b18cbc562388c4fea87b5ec15cb47067
[ "MIT" ]
1
2020-12-21T19:01:52.000Z
2020-12-21T19:01:52.000Z
from django.db import models # Create your models here. class Tag(models.Model): title = models.CharField(max_length=50) content = models.TextField(null=True, blank=True) tag_image = models.ImageField(upload_to="tag_image") def __str__(self): return self.title
25.333333
58
0.677632
40
304
4.95
0.725
0.080808
0
0
0
0
0
0
0
0
0
0.008475
0.223684
304
12
59
25.333333
0.830508
0.078947
0
0
0
0
0.032258
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0.142857
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
d587fbfbf91f88f7dedbd27dee4a5a50271fa6c7
247
py
Python
{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/commands/show.py
yankeexe/cookiecutter-python-cli
992bc1bf9af825b6ad144e5e4cbf969a58003347
[ "MIT" ]
4
2021-02-12T05:32:25.000Z
2022-01-19T10:30:46.000Z
{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/commands/show.py
yankeexe/cookiecutter-python-cli
992bc1bf9af825b6ad144e5e4cbf969a58003347
[ "MIT" ]
1
2022-01-19T13:56:45.000Z
2022-01-20T12:13:06.000Z
{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/commands/show.py
yankeexe/cookiecutter-python-cli
992bc1bf9af825b6ad144e5e4cbf969a58003347
[ "MIT" ]
1
2022-01-19T10:30:49.000Z
2022-01-19T10:30:49.000Z
""" Show command for the CLI. """ import click from {{cookiecutter.project_slug}} import console @click.command() def show(): """ Generic sub-command to show a message. """ console.print("Get started with your CLI in no time!")
16.466667
58
0.659919
34
247
4.764706
0.764706
0
0
0
0
0
0
0
0
0
0
0
0.206478
247
14
59
17.642857
0.826531
0
0
0
0
0
0.23125
0
0
0
0
0
0
0
null
null
0
0.4
null
null
0.2
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
d5910f2cdf5abf646883c1d89efe1d33cba6f0a9
770
py
Python
src/notify_task_list.py
ya2ha4/akari_gohan_notify_bot
173a162067c930b67dfecffdc4d9ccce40b5938b
[ "MIT" ]
null
null
null
src/notify_task_list.py
ya2ha4/akari_gohan_notify_bot
173a162067c930b67dfecffdc4d9ccce40b5938b
[ "MIT" ]
null
null
null
src/notify_task_list.py
ya2ha4/akari_gohan_notify_bot
173a162067c930b67dfecffdc4d9ccce40b5938b
[ "MIT" ]
null
null
null
from typing import List from logging import getLogger import notify logger = getLogger(__name__) class _RegisteredNotifyTaskList(): def __init__(self): self._task_list: List[notify.NotifyTask] = [] def append_task(self, task: notify.NotifyTask) -> None: self._task_list.append(task) def remove_task(self, task: notify.NotifyTask) -> None: self._task_list.remove(task) def find_task(self, message_id: int) -> notify.NotifyTask: for task in self._task_list: if message_id == task._register_send_message.id: return task logger.debug(f"not found:{len(self._task_list)=}") return None registered_notify_task_list: _RegisteredNotifyTaskList = _RegisteredNotifyTaskList()
24.0625
84
0.693506
92
770
5.456522
0.380435
0.111554
0.119522
0.071713
0.175299
0.175299
0.175299
0.175299
0.175299
0
0
0
0.212987
770
31
85
24.83871
0.828383
0
0
0
0
0
0.042857
0.037662
0
0
0
0
0
1
0.222222
false
0
0.166667
0
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
d5a5248f9e1a018738a5da22ea898ae03147c6f9
2,984
py
Python
wgltrace.py
prahal/apitrace
e9426dd61586757d23d7dddc85b3076f477e7f07
[ "MIT" ]
1
2020-06-19T12:34:44.000Z
2020-06-19T12:34:44.000Z
wgltrace.py
prahal/apitrace
e9426dd61586757d23d7dddc85b3076f477e7f07
[ "MIT" ]
null
null
null
wgltrace.py
prahal/apitrace
e9426dd61586757d23d7dddc85b3076f477e7f07
[ "MIT" ]
null
null
null
########################################################################## # # Copyright 2008-2009 VMware, Inc. # All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # ##########################################################################/ """WGL tracing code generator.""" from specs.stdapi import API from specs.glapi import glapi from specs.wglapi import wglapi from dispatch import function_pointer_type, function_pointer_value from gltrace import GlTracer from codegen import * class WglTracer(GlTracer): def wrap_ret(self, function, instance): GlTracer.wrap_ret(self, function, instance) if function.name == "wglGetProcAddress": print ' if (%s) {' % instance func_dict = dict([(f.name, f) for f in glapi.functions + wglapi.functions]) def handle_case(function_name): f = func_dict[function_name] ptype = function_pointer_type(f) pvalue = function_pointer_value(f) print ' %s = (%s)%s;' % (pvalue, ptype, instance) print ' %s = (%s)&%s;' % (instance, function.type, f.name); def handle_default(): print ' os::log("apitrace: warning: unknown function \\"%s\\"\\n", lpszProc);' string_switch('lpszProc', func_dict.keys(), handle_case, handle_default) print ' }' if __name__ == '__main__': print print '#define _GDI32_' print print '#include <string.h>' print '#include <windows.h>' print print '#include "trace_writer.hpp"' print '#include "os.hpp"' print print '// To validate our prototypes' print '#define GL_GLEXT_PROTOTYPES' print '#define WGL_GLXEXT_PROTOTYPES' print print '#include "glproc.hpp"' print '#include "glsize.hpp"' print api = API() api.add_api(glapi) api.add_api(wglapi) tracer = WglTracer() tracer.trace_api(api)
35.52381
97
0.639745
370
2,984
5.056757
0.443243
0.047034
0.027258
0.02031
0.028862
0
0
0
0
0
0
0.004316
0.223525
2,984
83
98
35.951807
0.803194
0.360255
0
0.136364
0
0
0.224047
0.012317
0
0
0
0
0
0
null
null
0
0.136364
null
null
0.477273
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
63397e0b664e70f0ff154eb4ed041aedec8b909d
136
py
Python
_draft/x_7_6-b.py
ofl/kuku2
7247fb1862d917d23258ebe7a93dca5939433225
[ "MIT" ]
null
null
null
_draft/x_7_6-b.py
ofl/kuku2
7247fb1862d917d23258ebe7a93dca5939433225
[ "MIT" ]
1
2021-11-13T08:03:04.000Z
2021-11-13T08:03:04.000Z
_draft/x_7_6-b.py
ofl/kuku2
7247fb1862d917d23258ebe7a93dca5939433225
[ "MIT" ]
null
null
null
# x_7_6 # # import re pattern = r'も+' print(re.search(pattern, 'すもももももももものうち')) onis = '赤鬼青鬼黄鬼' print(re.search(r'(.鬼)+', onis)[1])
10.461538
41
0.617647
22
136
3.727273
0.681818
0.170732
0.317073
0
0
0
0
0
0
0
0
0.025862
0.147059
136
12
42
11.333333
0.681034
0.036765
0
0
0
0
0.19685
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
6339bb40b43700b45b9a9035bff95ae544b1d616
1,536
py
Python
rvb/models/safehouse.py
dansgithubuser/circle
dcab4eed2df8f62248f2d6a59e04a4cf0284f06b
[ "MIT" ]
null
null
null
rvb/models/safehouse.py
dansgithubuser/circle
dcab4eed2df8f62248f2d6a59e04a4cf0284f06b
[ "MIT" ]
null
null
null
rvb/models/safehouse.py
dansgithubuser/circle
dcab4eed2df8f62248f2d6a59e04a4cf0284f06b
[ "MIT" ]
1
2018-08-30T01:11:45.000Z
2018-08-30T01:11:45.000Z
from rvb import db from rvb.models import * from datetime import datetime from sqlalchemy import func from flask import json from rvb.exceptions import ResourceMissing, IsDead, IllegalMove class Safehouse(db.Model): __tablename__ = 'safehouses' id = db.Column(db.Integer, primary_key=True) agents = db.relationship('Agent', back_populates='safehouse') packages = db.relationship('Package', back_populates='safehouse') x = db.Column(db.Integer,nullable=False, index=True) y = db.Column(db.Integer,nullable=False, index=True) dropoff = db.Column(db.Boolean, server_default='t', nullable=False) created_at = db.Column(db.TIMESTAMP, server_default=func.now()) updated_at = db.Column(db.TIMESTAMP, server_default=func.now(),onupdate=func.current_timestamp()) def __repr__(self): return '<Safehouse %r>' % self.id def find(instance_id): # Find instance by id return Safehouse.query.filter(Safehouse.id == instance_id).first() def create(position, dropoff): new_safehouse = Safehouse(dropoff=dropoff,x=position[0],y=position[1]) db.session.add(new_safehouse) db.session.commit() return new_safehouse def all(): return Safehouse.query.all() def has_packages(self): return len(self.packages) > 0 def serialize(self): return { 'id': self.id, 'x': self.x, 'y': self.y, 'dropoff': self.dropoff, 'packages': len(self.packages) }
32.680851
101
0.659505
193
1,536
5.129534
0.373057
0.048485
0.060606
0.051515
0.161616
0.161616
0.161616
0.161616
0.082828
0
0
0.002502
0.219401
1,536
46
102
33.391304
0.823186
0.01237
0
0
0
0
0.048845
0
0
0
0
0
0
1
0.162162
false
0
0.162162
0.135135
0.756757
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
634af0fb51b3f296990eae6ae8250fd8860da8d8
651
py
Python
app/controllers/__init__.py
spotframe/spotframe
63dbdc7841c9a106f3171cca6a96e2065d3fc8d5
[ "BSD-3-Clause" ]
null
null
null
app/controllers/__init__.py
spotframe/spotframe
63dbdc7841c9a106f3171cca6a96e2065d3fc8d5
[ "BSD-3-Clause" ]
8
2019-04-27T02:01:29.000Z
2022-02-26T10:34:28.000Z
app/controllers/__init__.py
spotframe/spotframe
63dbdc7841c9a106f3171cca6a96e2065d3fc8d5
[ "BSD-3-Clause" ]
null
null
null
from flask_restplus import Api from .entities import api as entities_api from .fetchers import api as fetchers_api from .backends import api as backends_api from .payloads import api as payloads_api from .actions import api as actions_api from .frames import api as frames_api from .queues import api as queues_api api = Api( title='Spotframe API', version='1.0', description='(spotframe) API', doc='/swagger' ) api.add_namespace(entities_api) api.add_namespace(fetchers_api) api.add_namespace(backends_api) api.add_namespace(payloads_api) api.add_namespace(actions_api) api.add_namespace(frames_api) api.add_namespace(queues_api)
25.038462
41
0.795699
102
651
4.862745
0.22549
0.145161
0.155242
0.217742
0
0
0
0
0
0
0
0.003521
0.127496
651
25
42
26.04
0.869718
0
0
0
0
0
0.059908
0
0
0
0
0
0
1
0
false
0
0.380952
0
0.380952
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
6354da67f0b8552804964159f47399f8cd06f67e
742
py
Python
setup.py
rhoerbe/simpleconsent
5c75bb3794d2722853aa8f5963a5c013e1149074
[ "MIT" ]
1
2019-08-19T17:56:57.000Z
2019-08-19T17:56:57.000Z
setup.py
rhoerbe/simpleconsent
5c75bb3794d2722853aa8f5963a5c013e1149074
[ "MIT" ]
null
null
null
setup.py
rhoerbe/simpleconsent
5c75bb3794d2722853aa8f5963a5c013e1149074
[ "MIT" ]
1
2019-08-19T17:57:14.000Z
2019-08-19T17:57:14.000Z
from setuptools import setup setup( name='simpleconsent', version='0.1.0', description='Consent service for SATOSA', author='r2h2', author_email='rh@identinetics.com', license='MIT', url='https://github.com/identinetics/simpleconsent', packages=['simpleconsent', ], install_requires=[ "django >=2.2.10, <3.0", # avoid 3.0 alpha release "django-basicauth", "jinja2", # why not django templates? Make it easy to load template from random filesystem path "requests", ], zip_safe=False, classifiers=[ "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", ], )
29.68
104
0.614555
83
742
5.457831
0.722892
0.125828
0.165563
0.172185
0
0
0
0
0
0
0
0.033808
0.242588
742
24
105
30.916667
0.772242
0.144205
0
0.086957
0
0
0.468354
0
0
0
0
0
0
1
0
true
0
0.043478
0
0.043478
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
6377bc2396cf43a6987d16fe32e3844652cf5c69
8,475
py
Python
antlir/tests/test_common.py
zeroxoneb/antlir
811d88965610d16a5c85d831d317f087797ca732
[ "MIT" ]
28
2020-08-11T16:22:46.000Z
2022-03-04T15:41:52.000Z
antlir/tests/test_common.py
zeroxoneb/antlir
811d88965610d16a5c85d831d317f087797ca732
[ "MIT" ]
137
2020-08-11T16:07:49.000Z
2022-02-27T10:59:05.000Z
antlir/tests/test_common.py
zeroxoneb/antlir
811d88965610d16a5c85d831d317f087797ca732
[ "MIT" ]
10
2020-09-10T00:01:28.000Z
2022-03-08T18:00:28.000Z
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import asyncio import logging import subprocess import time import unittest import unittest.mock from ..common import ( async_retry_fn, async_retryable, kernel_version, async_run, log as common_log, retry_fn, retryable, ) class TestCommon(unittest.IsolatedAsyncioTestCase): def test_retry_fn(self): class Retriable: def __init__(self, attempts_to_fail=0): self.attempts = 0 self.first_success_attempt = attempts_to_fail + 1 def run(self): self.attempts += 1 if self.attempts >= self.first_success_attempt: return self.attempts raise RuntimeError(self.attempts) self.assertEqual( 1, retry_fn(Retriable().run, delays=[], what="succeeds immediately") ) # Check log messages, and ensure that delays add up as expected start_time = time.time() with self.assertLogs(common_log) as log_ctx: self.assertEqual( 4, retry_fn( Retriable(3).run, delays=[0, 0.1, 0.2], what="succeeds on try 4", ), ) self.assertTrue( any( "\n[Retry 3 of 3] succeeds on try 4 -- waiting 0.2 seconds.\n" in o for o in log_ctx.output ) ) self.assertGreater(time.time() - start_time, 0.3) # Check log to debug with self.assertLogs(common_log, level=logging.DEBUG) as log_ctx: self.assertEqual( 4, retry_fn( Retriable(3).run, delays=[0, 0.1, 0.2], what="succeeds on try 4", log_exception=False, ), ) self.assertTrue( any( "\n[Retry 3 of 3] succeeds on try 4 -- waiting 0.2 seconds.\n" in o for o in log_ctx.output ) ) # Check running out of retries with self.assertLogs(common_log) as log_ctx, self.assertRaises( RuntimeError ) as ex_ctx: retry_fn(Retriable(100).run, delays=[0] * 7, what="never succeeds") self.assertTrue( any( "\n[Retry 7 of 7] never succeeds -- waiting 0 seconds.\n" in o for o in log_ctx.output ) ) self.assertEqual((8,), ex_ctx.exception.args) # Test is_exception_retriable def _is_retryable(e): if isinstance(e, RuntimeError): return False return True with self.assertRaises(RuntimeError) as ex_ctx: retry_fn( Retriable(10).run, _is_retryable, delays=[0] * 5, what="never retries", ) self.assertEqual((1,), ex_ctx.exception.args) def test_retryable(self): @retryable("got {a}, {b}, {c}", [0]) def to_be_retried(a: int, b: int, c: int = 5): raise RuntimeError("retrying...") with self.assertRaises(RuntimeError), self.assertLogs( common_log ) as logs: to_be_retried(1, b=2) self.assertIn("got 1, 2, 5", "".join(logs.output)) async def test_async_retry_fn(self): class Retriable: def __init__(self, attempts_to_fail=0): self.attempts = 0 self.first_success_attempt = attempts_to_fail + 1 async def run(self): self.attempts += 1 if self.attempts >= self.first_success_attempt: return self.attempts raise RuntimeError(self.attempts) self.assertEqual( 1, await async_retry_fn( Retriable().run, delays=[], what="succeeds immediately" ), ) # Check log messages, and ensure that delays add up as expected start_time = time.time() with self.assertLogs(common_log) as log_ctx: self.assertEqual( 4, await async_retry_fn( Retriable(3).run, delays=[0, 0.1, 0.2], what="succeeds on try 4", ), ) self.assertTrue( any( "\n[Retry 3 of 3] succeeds on try 4 -- waiting 0.2 seconds.\n" in o for o in log_ctx.output ) ) self.assertGreater(time.time() - start_time, 0.3) # Check log to debug with self.assertLogs(common_log, level=logging.DEBUG) as log_ctx: self.assertEqual( 4, await async_retry_fn( Retriable(3).run, delays=[0, 0.1, 0.2], what="succeeds on try 4", log_exception=False, ), ) self.assertTrue( any( "\n[Retry 3 of 3] succeeds on try 4 -- waiting 0.2 seconds.\n" in o for o in log_ctx.output ) ) # Check running out of retries with self.assertLogs(common_log) as log_ctx, self.assertRaises( RuntimeError ) as ex_ctx: await async_retry_fn( Retriable(100).run, delays=[0] * 7, what="never succeeds" ) self.assertTrue( any( "\n[Retry 7 of 7] never succeeds -- waiting 0 seconds.\n" in o for o in log_ctx.output ) ) self.assertEqual((8,), ex_ctx.exception.args) # Test is_exception_retriable def _is_retryable(e): if isinstance(e, RuntimeError): return False return True with self.assertRaises(RuntimeError) as ex_ctx: await async_retry_fn( Retriable(10).run, _is_retryable, delays=[0] * 5, what="never retries", ) self.assertEqual((1,), ex_ctx.exception.args) async def test_async_retryable(self): @async_retryable("got {a}, {b}, {c}", [0]) async def to_be_retried(a: int, b: int, c: int = 5): raise RuntimeError("retrying...") with self.assertRaises(RuntimeError), self.assertLogs( common_log ) as logs: await to_be_retried(1, b=2) self.assertIn("got 1, 2, 5", "".join(logs.output)) def test_retryable_skip(self): iters = 0 @retryable( "got {a}, {b}, {c}", [0, 0, 0], is_exception_retryable=lambda _: False, ) def to_be_retried(a: int, b: int, c: int = 5): nonlocal iters iters += 1 raise RuntimeError("retrying...") with self.assertRaises(RuntimeError): to_be_retried(1, b=2) self.assertEqual(1, iters) @unittest.mock.patch("antlir.common._mockable_platform_release") def test_kernel_version(self, platform_release): uname_to_tuples = { "5.2.9-129_fbk13_hardened_3948_ga3d2430737fa": (5, 2), "5.11.4-arch1-1": (5, 11), "4.16.9-old-busted": (4, 16), } for uname, parsed in uname_to_tuples.items(): platform_release.return_value = uname self.assertEqual(kernel_version(), parsed) async def test_async_run(self): cmd = ["echo", "-n", "hithere"] res = await async_run(cmd, check=True, stdout=asyncio.subprocess.PIPE) self.assertEqual(b"hithere", res.stdout) self.assertFalse(res.stderr) self.assertEqual(0, res.returncode) self.assertEqual(cmd, res.args) async def test_async_run_check_failure(self): with self.assertRaises(subprocess.CalledProcessError): await async_run(["sh", "exit", "1"], check=True) async def test_async_run_missing_pipe_stdin(self): with self.assertRaisesRegex(AssertionError, "You must set"): await async_run(["foo"], input=b"hello there")
32.102273
80
0.523776
973
8,475
4.409044
0.178828
0.052448
0.037296
0.04289
0.721911
0.700699
0.68951
0.672028
0.672028
0.672028
0
0.029975
0.378053
8,475
263
81
32.224335
0.783912
0.054985
0
0.605505
0
0
0.098174
0.01038
0
0
0
0
0.178899
1
0.050459
false
0
0.03211
0
0.123853
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
6389af020c0b0b2dc0a7977b1336f6603808ed0b
1,072
py
Python
api/resources_portal/test/serializers/test_user.py
AlexsLemonade/resources-portal
d91c6c8d6135461faccbc78ef2b0be3f9b358f21
[ "BSD-3-Clause" ]
null
null
null
api/resources_portal/test/serializers/test_user.py
AlexsLemonade/resources-portal
d91c6c8d6135461faccbc78ef2b0be3f9b358f21
[ "BSD-3-Clause" ]
536
2019-11-13T15:49:03.000Z
2022-03-28T20:17:24.000Z
api/resources_portal/test/serializers/test_user.py
AlexsLemonade/resources-portal
d91c6c8d6135461faccbc78ef2b0be3f9b358f21
[ "BSD-3-Clause" ]
1
2020-04-03T02:07:29.000Z
2020-04-03T02:07:29.000Z
from django.forms.models import model_to_dict from django.test import TestCase from resources_portal.test.factories import PersonalOrganizationFactory, UserFactory from resources_portal.views.user import UserSerializer class TestCreateUserSerializer(TestCase): def setUp(self): # personal_organization needs to be created first because # UserFactory can't build without having an id of an org to # reference. personal_organization = PersonalOrganizationFactory() self.user_data = model_to_dict( UserFactory.build(personal_organization=personal_organization) ) def test_serializer_with_empty_data(self): serializer = UserSerializer(data={}) self.assertFalse(serializer.is_valid()) def test_serializer_with_valid_data(self): serializer = UserSerializer(data=self.user_data) self.assertTrue(serializer.is_valid()) def test_serializer_hashes_password(self): serializer = UserSerializer(data=self.user_data) self.assertTrue(serializer.is_valid())
36.965517
84
0.746269
120
1,072
6.441667
0.416667
0.072445
0.046572
0.124191
0.316947
0.316947
0.194049
0.194049
0.194049
0.194049
0
0
0.185634
1,072
28
85
38.285714
0.885452
0.115672
0
0.210526
0
0
0
0
0
0
0
0
0.157895
1
0.210526
false
0.052632
0.210526
0
0.473684
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
63981edc3992e33d00709d84e7038a2bb4b82e19
10,511
py
Python
src/rekognition_online_action_detection/models/transformer/multihead_attention.py
amazon-research/long-short-term-transformer
a425be4b52ab68fddd85c91d26571e4cdfe8379a
[ "Apache-2.0" ]
52
2021-11-19T01:35:10.000Z
2022-03-24T11:48:10.000Z
src/rekognition_online_action_detection/models/transformer/multihead_attention.py
amazon-research/long-short-term-transformer
a425be4b52ab68fddd85c91d26571e4cdfe8379a
[ "Apache-2.0" ]
9
2021-11-24T18:50:13.000Z
2022-03-10T05:13:53.000Z
src/rekognition_online_action_detection/models/transformer/multihead_attention.py
amazon-research/long-short-term-transformer
a425be4b52ab68fddd85c91d26571e4cdfe8379a
[ "Apache-2.0" ]
8
2022-01-15T08:01:33.000Z
2022-03-20T22:08:29.000Z
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import torch import torch.nn as nn import torch.nn.functional as F class DotProductAttention(nn.Module): def __init__(self, dropout=0.0): super(DotProductAttention, self).__init__() self.dropout = dropout def forward(self, q, k, v, attn_mask=None): attn_output_weights = torch.bmm(q, k.transpose(1, 2)) if attn_mask is not None: attn_output_weights += attn_mask attn_output_weights = F.softmax(attn_output_weights, dim=-1) attn_output_weights = F.dropout(attn_output_weights, p=self.dropout, training=self.training) attn_output = torch.bmm(attn_output_weights, v) return attn_output class DotProductAttentionStream(DotProductAttention): def __init__(self, dropout=0.0): super(DotProductAttentionStream, self).__init__(dropout) ############################ # Cache for stream inference ############################ self.k_weights_cache = None self.k_pos_weights_cache = None def stream_inference(self, q, k, v, k_pos, v_pos, attn_mask=None): if self.k_weights_cache is not None: k_weights_new = torch.bmm(q, k[:, [-1]].transpose(1, 2)) k_weights = torch.cat((self.k_weights_cache[:, :, 1:], k_weights_new), dim=-1) self.k_weights_cache = k_weights k_pos_weights = self.k_pos_weights_cache else: k_weights = torch.bmm(q, k.transpose(1, 2)) self.k_weights_cache = k_weights k_pos_weights = torch.bmm(q, k_pos.transpose(1, 2)) self.k_pos_weights_cache = k_pos_weights attn_output_weights = k_weights + k_pos_weights if attn_mask is not None: attn_output_weights += attn_mask attn_output_weights = F.softmax(attn_output_weights, dim=-1) attn_output_weights = F.dropout(attn_output_weights, p=self.dropout, training=self.training) attn_output = torch.bmm(attn_output_weights, (v + v_pos)) return attn_output class MultiheadAttention(nn.Module): def __init__(self, embed_dim, num_heads, dropout=0.0, bias=True, kdim=None, vdim=None): super(MultiheadAttention, self).__init__() self.embed_dim = embed_dim self.num_heads = num_heads self.kdim = kdim if kdim is not None else embed_dim self.vdim = vdim if vdim is not None else embed_dim self._qkv_same_embed_dim = self.kdim == embed_dim and self.vdim == embed_dim if self._qkv_same_embed_dim: self.in_proj_weight = nn.Parameter(torch.empty(3 * embed_dim, embed_dim)) else: raise RuntimeError('Do not support q, k, v have different dimensions') if bias: self.in_proj_bias = nn.Parameter(torch.empty(3 * embed_dim)) else: self.register_parameter('in_proj_bias', None) self.out_proj = nn.Linear(embed_dim, embed_dim) if self._qkv_same_embed_dim: nn.init.xavier_uniform_(self.in_proj_weight) if self.in_proj_bias is not None: nn.init.constant_(self.in_proj_bias, 0.) nn.init.constant_(self.out_proj.bias, 0.) self.dotproductattention = DotProductAttention(dropout) def forward(self, q, k, v, attn_mask=None, key_padding_mask=None): tsz, bsz, embed_dim = q.shape[0], q.shape[1], q.shape[2] head_dim = embed_dim // self.num_heads assert head_dim * self.num_heads == embed_dim, \ 'embed_dim must be divisible by num_heads' scaling = float(head_dim) ** -0.5 _b = self.in_proj_bias _start = None _end = embed_dim _w = self.in_proj_weight[:_end, :] if _b is not None: _b = _b[:_end] q = F.linear(q, _w, _b) _b = self.in_proj_bias _start = embed_dim _end = embed_dim * 2 _w = self.in_proj_weight[_start:_end, :] if _b is not None: _b = _b[_start:_end] k = F.linear(k, _w, _b) _b = self.in_proj_bias _start = embed_dim * 2 _end = None _w = self.in_proj_weight[_start:, :] if _b is not None: _b = _b[_start:] v = F.linear(v, _w, _b) q = q * scaling q = q.contiguous().view(-1, bsz * self.num_heads, head_dim).transpose(0, 1) k = k.contiguous().view(-1, bsz * self.num_heads, head_dim).transpose(0, 1) v = v.contiguous().view(-1, bsz * self.num_heads, head_dim).transpose(0, 1) if attn_mask is not None: attn_mask = attn_mask.unsqueeze(0).repeat(bsz, 1, 1) attn_mask = attn_mask.unsqueeze(1).repeat(1, self.num_heads, 1, 1) attn_mask = attn_mask.reshape(-1, *attn_mask.shape[2:]) if key_padding_mask is not None: key_padding_mask = key_padding_mask.unsqueeze(1).repeat(1, tsz, 1) key_padding_mask = key_padding_mask.unsqueeze(1).repeat(1, self.num_heads, 1, 1) key_padding_mask = key_padding_mask.reshape(-1, *key_padding_mask.shape[2:]) if attn_mask is not None and key_padding_mask is not None: mask = attn_mask + key_padding_mask elif attn_mask is not None: mask = attn_mask elif key_padding_mask is not None: mask = key_padding_mask else: mask = None attn_output = self.dotproductattention(q, k, v, mask) attn_output = attn_output.transpose(0, 1).contiguous().view(tsz, bsz, self.embed_dim) return self.out_proj(attn_output), None class MultiheadAttentionStream(MultiheadAttention): def __init__(self, embed_dim, num_heads, dropout=0.0, bias=True, kdim=None, vdim=None): super(MultiheadAttentionStream, self).__init__(embed_dim, num_heads, dropout, bias, kdim, vdim) self.dotproductattention = DotProductAttentionStream(dropout) ############################ # Cache for stream inference ############################ self.q_cache = None self.k_cache = None self.v_cache = None self.k_pos_cache = None self.v_pos_cache = None def stream_inference(self, q, k, v, pos, attn_mask=None, key_padding_mask=None): tsz, bsz, embed_dim = q.shape[0], q.shape[1], q.shape[2] head_dim = embed_dim // self.num_heads assert head_dim * self.num_heads == embed_dim, \ 'embed_dim must be divisible by num_heads' scaling = float(head_dim) ** -0.5 if self.q_cache is not None: q = self.q_cache else: _b = self.in_proj_bias _start = None _end = embed_dim _w = self.in_proj_weight[:_end, :] if _b is not None: _b = _b[:_end] q = F.linear(q, _w, _b) self.q_cache = q assert (self.k_cache is None) == (self.k_pos_cache is None) if self.k_cache is not None: _b = self.in_proj_bias _start = embed_dim _end = embed_dim * 2 _w = self.in_proj_weight[_start:_end, :] if _b is not None: _b = _b[_start:_end] k_new = F.linear(k[[-1]], _w, None) k = torch.cat((self.k_cache[1:], k_new)) self.k_cache = k k_pos = self.k_pos_cache else: _b = self.in_proj_bias _start = embed_dim _end = embed_dim * 2 _w = self.in_proj_weight[_start:_end, :] if _b is not None: _b = _b[_start:_end] k = F.linear(k, _w, None) self.k_cache = k k_pos = F.linear(pos, _w, _b) self.k_pos_cache = k_pos assert (self.v_cache is None) == (self.v_pos_cache is None) if self.v_cache is not None: _b = self.in_proj_bias _start = embed_dim * 2 _end = None _w = self.in_proj_weight[_start:, :] if _b is not None: _b = _b[_start:] v_new = F.linear(v[[-1]], _w, None) v = torch.cat((self.v_cache[1:], v_new)) self.v_cache = v v_pos = self.v_pos_cache else: _b = self.in_proj_bias _start = embed_dim * 2 _end = None _w = self.in_proj_weight[_start:, :] if _b is not None: _b = _b[_start:] v = F.linear(v, _w, None) self.v_cache = v v_pos = F.linear(pos, _w, _b) self.v_pos_cache = v_pos q = q * scaling q = q.contiguous().view(-1, bsz * self.num_heads, head_dim).transpose(0, 1) k = k.contiguous().view(-1, bsz * self.num_heads, head_dim).transpose(0, 1) v = v.contiguous().view(-1, bsz * self.num_heads, head_dim).transpose(0, 1) k_pos = k_pos.contiguous().view(-1, bsz * self.num_heads, head_dim).transpose(0, 1) v_pos = v_pos.contiguous().view(-1, bsz * self.num_heads, head_dim).transpose(0, 1) if attn_mask is not None: attn_mask = attn_mask.unsqueeze(0).repeat(bsz, 1, 1) attn_mask = attn_mask.unsqueeze(1).repeat(1, self.num_heads, 1, 1) attn_mask = attn_mask.reshape(-1, *attn_mask.shape[2:]) if key_padding_mask is not None: key_padding_mask = key_padding_mask.unsqueeze(1).repeat(1, tsz, 1) key_padding_mask = key_padding_mask.unsqueeze(1).repeat(1, self.num_heads, 1, 1) key_padding_mask = key_padding_mask.reshape(-1, *key_padding_mask.shape[2:]) if attn_mask is not None and key_padding_mask is not None: mask = attn_mask + key_padding_mask elif attn_mask is not None: mask = attn_mask elif key_padding_mask is not None: mask = key_padding_mask else: mask = None attn_output = self.dotproductattention.stream_inference(q, k, v, k_pos, v_pos, mask) attn_output = attn_output.transpose(0, 1).contiguous().view(tsz, bsz, self.embed_dim) return self.out_proj(attn_output), None
38.221818
103
0.577205
1,467
10,511
3.809816
0.07771
0.054393
0.046699
0.032564
0.763106
0.725532
0.688316
0.64949
0.627483
0.602433
0
0.015376
0.313196
10,511
274
104
38.361314
0.758831
0.014842
0
0.64486
0
0
0.013675
0
0
0
0
0
0.018692
1
0.037383
false
0
0.014019
0
0.088785
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
639e338657eeed9b12b88ad6b5307849d158e1e1
766
py
Python
projects/views/demo.py
lizschley/number_six
a427202397822fca1f49d43d138c24fffdbe95da
[ "MIT" ]
1
2020-07-14T20:13:05.000Z
2020-07-14T20:13:05.000Z
projects/views/demo.py
lizschley/number_six
a427202397822fca1f49d43d138c24fffdbe95da
[ "MIT" ]
3
2021-04-06T20:40:08.000Z
2021-06-03T21:54:21.000Z
projects/views/demo.py
lizschley/number_six
a427202397822fca1f49d43d138c24fffdbe95da
[ "MIT" ]
null
null
null
''' demo view ''' from django.views.generic import TemplateView import constants.file_paths as file_paths import helpers.import_common_class.paragraph_helpers as import_para_helper class DemoParagraphView(TemplateView): ''' This is called from the project detail page. It gives information about the site. ''' template_name = 'projects/single_or_ordered_paragraphs.html' def get_context_data(self, **kwargs): context = self._add_to_context(super().get_context_data(**kwargs)) # print(f'from view: {context}') return context def _add_to_context(self, context): context['path_to_json'] = file_paths.DEMO_PARAGRAPH_JSON context = import_para_helper.paragraph_view_input(context, True) return context
38.3
94
0.74282
100
766
5.39
0.55
0.050093
0.059369
0
0
0
0
0
0
0
0
0
0.169713
766
19
95
40.315789
0.847484
0.164491
0
0.166667
0
0
0.086124
0.066986
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.833333
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
63b3257eb84d1bcb27ecad9ebbd9fc780c27ca86
242
py
Python
Widget testing/KivyMD Lable/1.py
WithSJ/Learn-KIvyMD
7cb49e6714aab34437bbb6cf6a5b4c8635ee9591
[ "MIT" ]
1
2020-06-02T17:39:01.000Z
2020-06-02T17:39:01.000Z
Widget testing/KivyMD Lable/1.py
WithSJ/Learn-KivyMD
7cb49e6714aab34437bbb6cf6a5b4c8635ee9591
[ "MIT" ]
null
null
null
Widget testing/KivyMD Lable/1.py
WithSJ/Learn-KivyMD
7cb49e6714aab34437bbb6cf6a5b4c8635ee9591
[ "MIT" ]
null
null
null
from kivymd.app import MDApp from kivymd.uix.label import MDLabel class MyApp(MDApp): def build(self): return MDLabel(text="Hello With SJ",pos_hint={"center_x": 0.5, "center_y": 0.5}) if __name__ == "__main__": MyApp().run()
26.888889
88
0.677686
38
242
4.026316
0.763158
0.130719
0
0
0
0
0
0
0
0
0
0.019901
0.169421
242
9
89
26.888889
0.741294
0
0
0
0
0
0.152263
0
0
0
0
0
0
1
0.142857
false
0
0.285714
0.142857
0.714286
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
1
0
0
0
2
63c1b6b6d888ef753f9c417dccaada685beae01d
1,363
py
Python
lilac/exceptions.py
mba811/lilac
ce7a4e19f7f73c07b2e6b4b33fb19b3812e8e131
[ "MIT" ]
1
2019-05-07T15:09:39.000Z
2019-05-07T15:09:39.000Z
lilac/exceptions.py
mba811/lilac
ce7a4e19f7f73c07b2e6b4b33fb19b3812e8e131
[ "MIT" ]
null
null
null
lilac/exceptions.py
mba811/lilac
ce7a4e19f7f73c07b2e6b4b33fb19b3812e8e131
[ "MIT" ]
null
null
null
# coding=utf8 """all possible exceptions""" class LilacException(Exception): """There was an ambiguous exception that occurred while handling lilac process""" pass class SourceDirectoryNotFound(LilacException): """Source directory was not found""" pass class ParseException(LilacException): """There was an exception occurred while parsing the source""" pass class RenderException(LilacException): """There was an exception occurred while rendering to html""" pass class SeparatorNotFound(ParseException): """There was no separator found in post's source""" pass class PostDateTimeNotFound(ParseException): """There was no datetime found in post's source""" pass class PostTitleNotFound(ParseException): """There was no title found in post's source""" pass class PostDateTimeInvalid(ParseException): """Invalid datetime format, should like '2012-04-05 10:10'""" pass class PostTagsTypeInvalid(ParseException): """Invalid tags datatype, should be a array""" pass class PostHeaderSyntaxError(ParseException): """TomlSyntaxError occurred in post's header""" pass class ConfigSyntaxError(LilacException): """TomlSyntaxError occurred in config.toml""" pass class JinjaTemplateNotFound(RenderException): """Jinja2 template was not found""" pass
21.296875
66
0.721937
147
1,363
6.693878
0.442177
0.10061
0.060976
0.073171
0.175813
0.175813
0.175813
0
0
0
0
0.01259
0.184153
1,363
63
67
21.634921
0.872302
0.438738
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
2
63c63e0d8623c768caff6d9ad932418714ea1564
61
py
Python
flask_vises/__init__.py
rexzhang/flask-vises
6173780d648527bee8716a1eb1d74b9bc7e56acf
[ "MIT" ]
4
2018-07-01T15:49:11.000Z
2019-04-12T07:47:55.000Z
flask_vises/__init__.py
rexzhang/flask-vises
6173780d648527bee8716a1eb1d74b9bc7e56acf
[ "MIT" ]
null
null
null
flask_vises/__init__.py
rexzhang/flask-vises
6173780d648527bee8716a1eb1d74b9bc7e56acf
[ "MIT" ]
null
null
null
#!/usr/bin/env python # coding=utf-8 __version__ = "2.1.4"
10.166667
21
0.639344
11
61
3.181818
1
0
0
0
0
0
0
0
0
0
0
0.076923
0.147541
61
5
22
12.2
0.596154
0.540984
0
0
0
0
0.192308
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
63c6d1ad1c891c694d89b954338db83260ccc08e
397
py
Python
src/app/temp.py
lileiigithub/PetdogRecognition
cefa700cbd24e3e8834670ffadfb591ce6eb1857
[ "MIT" ]
null
null
null
src/app/temp.py
lileiigithub/PetdogRecognition
cefa700cbd24e3e8834670ffadfb591ce6eb1857
[ "MIT" ]
null
null
null
src/app/temp.py
lileiigithub/PetdogRecognition
cefa700cbd24e3e8834670ffadfb591ce6eb1857
[ "MIT" ]
null
null
null
label_name = [] with open("label_name.txt",encoding='utf-8') as file: for line in file.readlines(): line = line.strip() name = (line.split('-')[-1]) if name.count('|') > 0: name = name.split('|')[-1] print(name) label_name.append((name)) for item in label_name: with open('label_name_1.txt','a') as file: file.write(item+'\n')
26.466667
53
0.544081
56
397
3.75
0.464286
0.214286
0.12381
0.161905
0.247619
0.247619
0
0
0
0
0
0.017123
0.264484
397
15
54
26.466667
0.702055
0
0
0
0
0
0.103275
0
0
0
0
0
0
1
0
false
0
0
0
0
0.083333
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
63c781ac2caf56183c3c6a173eea2a1c36a6ed2d
4,003
py
Python
gslib/parallelism_framework_util.py
craigcitro/gsutil
dfbad5ace8317cc3745745ed24abf5eb1074a261
[ "Apache-2.0" ]
null
null
null
gslib/parallelism_framework_util.py
craigcitro/gsutil
dfbad5ace8317cc3745745ed24abf5eb1074a261
[ "Apache-2.0" ]
null
null
null
gslib/parallelism_framework_util.py
craigcitro/gsutil
dfbad5ace8317cc3745745ed24abf5eb1074a261
[ "Apache-2.0" ]
2
2020-07-25T05:03:06.000Z
2020-11-04T04:55:57.000Z
# -*- coding: utf-8 -*- # Copyright 2013 Google 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. """Utility classes for the parallelism framework.""" from __future__ import absolute_import import multiprocessing import threading class BasicIncrementDict(object): """Dictionary meant for storing values for which increment is defined. This handles any values for which the "+" operation is defined (e.g., floats, lists, etc.). This class is neither thread- nor process-safe. """ def __init__(self): self.dict = {} def Get(self, key, default_value=None): return self.dict.get(key, default_value) def Put(self, key, value): self.dict[key] = value def Update(self, key, inc, default_value=0): """Update the stored value associated with the given key. Performs the equivalent of self.put(key, self.get(key, default_value) + inc). Args: key: lookup key for the value of the first operand of the "+" operation. inc: Second operand of the "+" operation. default_value: Default value if there is no existing value for the key. Returns: Incremented value. """ val = self.dict.get(key, default_value) + inc self.dict[key] = val return val class AtomicIncrementDict(BasicIncrementDict): """Dictionary meant for storing values for which increment is defined. This handles any values for which the "+" operation is defined (e.g., floats, lists, etc.) in a thread- and process-safe way that allows for atomic get, put, and update. """ def __init__(self, manager): # pylint: disable=super-init-not-called self.dict = ThreadAndProcessSafeDict(manager) self.lock = multiprocessing.Lock() def Update(self, key, inc, default_value=0): """Atomically update the stored value associated with the given key. Performs the atomic equivalent of self.put(key, self.get(key, default_value) + inc). Args: key: lookup key for the value of the first operand of the "+" operation. inc: Second operand of the "+" operation. default_value: Default value if there is no existing value for the key. Returns: Incremented value. """ with self.lock: return super(AtomicIncrementDict, self).Update(key, inc, default_value) class ThreadSafeDict(object): """Provides a thread-safe dictionary (protected by a lock).""" def __init__(self): """Initializes the thread-safe dict.""" self.lock = threading.Lock() self.dict = {} def __getitem__(self, key): with self.lock: return self.dict[key] def __setitem__(self, key, value): with self.lock: self.dict[key] = value # pylint: disable=invalid-name def get(self, key, default_value=None): with self.lock: return self.dict.get(key, default_value) def delete(self, key): with self.lock: del self.dict[key] class ThreadAndProcessSafeDict(ThreadSafeDict): """Wraps a multiprocessing.Manager's proxy objects for thread-safety. The proxy objects returned by a manager are process-safe but not necessarily thread-safe, so this class simply wraps their access with a lock for ease of use. Since the objects are process-safe, we can use the more efficient threading Lock. """ def __init__(self, manager): """Initializes the thread and process safe dict. Args: manager: Multiprocessing.manager object. """ super(ThreadAndProcessSafeDict, self).__init__() self.dict = manager.dict()
30.557252
79
0.704971
557
4,003
4.985637
0.308797
0.060497
0.037811
0.032409
0.385668
0.375225
0.352179
0.331293
0.283039
0.283039
0
0.00344
0.201099
4,003
130
80
30.792308
0.864916
0.599051
0
0.414634
0
0
0
0
0
0
0
0
0
1
0.292683
false
0
0.073171
0.02439
0.585366
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
63d1abec5ba8bedac2a516820c7ebd91b91589c7
231
py
Python
Core/Block_0/R0220_Factory.py
BernardoB95/Extrator_SPEDFiscal
10b4697833c561d24654251da5f22d044f03fc16
[ "MIT" ]
1
2021-04-25T13:53:20.000Z
2021-04-25T13:53:20.000Z
Core/Block_0/R0220_Factory.py
BernardoB95/Extrator_SPEDFiscal
10b4697833c561d24654251da5f22d044f03fc16
[ "MIT" ]
null
null
null
Core/Block_0/R0220_Factory.py
BernardoB95/Extrator_SPEDFiscal
10b4697833c561d24654251da5f22d044f03fc16
[ "MIT" ]
null
null
null
from Core.IFactory import IFactory from Regs.Block_0 import R0220 class R0220Factory(IFactory): def create_block_object(self, line): self.r0220 = _r0220 = R0220() _r0220.reg_list = line return _r0220
21
40
0.69697
30
231
5.133333
0.6
0.194805
0.194805
0
0
0
0
0
0
0
0
0.163842
0.233766
231
10
41
23.1
0.706215
0
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0.285714
0
0.714286
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
89443be788cb5c7ae3c166ae95581fb8a3727361
136
py
Python
requests/binary.py
pengchenyu111/SpiderLearning
d1fca1c7f46bfb22ad23f9396d0f2e2301ec4534
[ "Apache-2.0" ]
3
2020-11-21T13:13:46.000Z
2020-12-03T05:43:32.000Z
requests/binary.py
pengchenyu111/SpiderLearning
d1fca1c7f46bfb22ad23f9396d0f2e2301ec4534
[ "Apache-2.0" ]
null
null
null
requests/binary.py
pengchenyu111/SpiderLearning
d1fca1c7f46bfb22ad23f9396d0f2e2301ec4534
[ "Apache-2.0" ]
1
2020-12-03T05:43:53.000Z
2020-12-03T05:43:53.000Z
import requests r = requests.get('http://t.cn/EfgN7gz') print(r.text) with open('Python从菜鸟到高手.png', 'wb') as f: f.write(r.content)
19.428571
41
0.676471
23
136
4
0.826087
0
0
0
0
0
0
0
0
0
0
0.008403
0.125
136
6
42
22.666667
0.764706
0
0
0
0
0
0.272059
0
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
8959df370493e772913e4b292c2b2d645e9631d6
898
py
Python
h/emails/test.py
discodavey/h
7bff8478b3a5b936de82ac9fcd89b355f4afd3aa
[ "MIT" ]
2
2021-11-07T23:14:54.000Z
2021-11-17T10:11:55.000Z
h/emails/test.py
0b01/h
d13cbc3ec5cf92fbfb40ad360c7a5e0d937fbd14
[ "MIT" ]
16
2018-03-14T21:23:46.000Z
2019-04-29T18:55:28.000Z
h/emails/test.py
0b01/h
d13cbc3ec5cf92fbfb40ad360c7a5e0d937fbd14
[ "MIT" ]
1
2021-03-12T09:45:04.000Z
2021-03-12T09:45:04.000Z
# -*- coding: utf-8 -*- from __future__ import unicode_literals import datetime import platform from pyramid.renderers import render from h import __version__ def generate(request, recipient): """ Generate a test email. :param request: the current request :type request: pyramid.request.Request :param recipient: the recipient of the test email :type recipient: str :returns: a 4-element tuple containing: recipients, subject, text, html """ context = { 'time': datetime.datetime.utcnow().isoformat(), 'hostname': platform.node(), 'python_version': platform.python_version(), 'version': __version__, } text = render('h:templates/emails/test.txt.jinja2', context, request=request) html = render('h:templates/emails/test.html.jinja2', context, request=request) return [recipient], 'Test mail', text, html
24.944444
82
0.683742
104
898
5.759615
0.480769
0.070117
0.053422
0.073456
0.086811
0
0
0
0
0
0
0.005579
0.201559
898
35
83
25.657143
0.829847
0.2951
0
0
1
0
0.18593
0.115578
0
0
0
0
0
1
0.066667
false
0
0.333333
0
0.466667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
895b2d774d68df055eb07c4bcfb918809f112068
75
py
Python
review_code/min_mmdet_v2/mmdet/mmdet/models/roi_bones/__init__.py
li-phone/DetectionCompetition
a917f16790ec30358e3cfe1aa6e327a2070a1235
[ "Apache-2.0" ]
null
null
null
review_code/min_mmdet_v2/mmdet/mmdet/models/roi_bones/__init__.py
li-phone/DetectionCompetition
a917f16790ec30358e3cfe1aa6e327a2070a1235
[ "Apache-2.0" ]
null
null
null
review_code/min_mmdet_v2/mmdet/mmdet/models/roi_bones/__init__.py
li-phone/DetectionCompetition
a917f16790ec30358e3cfe1aa6e327a2070a1235
[ "Apache-2.0" ]
null
null
null
from .simple_roinet import SimpleROINet __all__ = [ 'SimpleROINet', ]
12.5
39
0.72
7
75
7
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.186667
75
5
40
15
0.803279
0
0
0
0
0
0.16
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
895ed8be602ada29e7ea748398db93459ef3021e
12,941
py
Python
serapis/language.py
enterstudio/serapis
6f8214fb226337ef2fd6820b07f9976c5e18b79b
[ "MIT" ]
7
2016-05-31T17:50:26.000Z
2016-06-27T04:17:51.000Z
serapis/language.py
enterstudio/serapis
6f8214fb226337ef2fd6820b07f9976c5e18b79b
[ "MIT" ]
null
null
null
serapis/language.py
enterstudio/serapis
6f8214fb226337ef2fd6820b07f9976c5e18b79b
[ "MIT" ]
1
2016-03-21T23:04:03.000Z
2016-03-21T23:04:03.000Z
#!/usr/bin/env python # coding=utf-8 """ Language detection module """ from __future__ import unicode_literals from __future__ import absolute_import __author__ = "Manuel Ebert" __copyright__ = "Copyright 2015, summer.ai" __date__ = "2015-12-01" __email__ = "manuel@summer.ai" from nltk.tokenize import word_tokenize # You can easily generate this stop word list with NLTK: # stopwords = {lang: frozenset(stopwords.words(lang)) for lang in ("english", 'german', 'italian', 'french', 'spanish')} STOPWORDS = {'german': frozenset([u'andere', u'anderm', u'andern', u'das', u'w\xfcrde', u'w\xe4hrend', u'sollte', u'selbst', u'anderr', u'anders', u'einer', u'wollte', u'als', u'alle', u'dessen', u'dazu', u'auf', u'dich', u'hab', u'sondern', u'demselben', u'aus', u'einige', u'derselbe', u'sonst', u'hatte', u'hat', u'bin', u'musste', u'waren', u'mein', u'deine', u'ihnen', u'deinem', u'deinen', u'deines', u'deiner', u'einmal', u'ich', u'dasselbe', u'du', u'bis', u'hin', u'wenn', u'viel', u'war', u'keiner', u'keines', u'die', u'warst', u'wird', u'w\xfcrden', u'haben', u'weil', u'nichts', u'ihn', u'keinen', u'dir', u'wir', u'kann', u'solcher', u'unse', u'nur', u'hinter', u'manche', u'solchen', u'es', u'er', u'will', u'ohne', u'f\xfcr', u'und', u'meinen', u'diesem', u'diesen', u'meinem', u'meiner', u'meines', u'dieser', u'dieses', u'indem', u'werde', u'dein', u'jede', u'denselben', u'wollen', u'dort', u'soll', u'jeden', u'jedem', u'diese', u'wo', u'seine', u'wirst', u'auch', u'jenen', u'keinem', u'jedes', u'jeder', u'habe', u'weiter', u'zur', u'uns', u'hatten', u'welcher', u'bist', u'werden', u'ob', u'ist', u'k\xf6nnte', u'ander', u'hier', u'einig', u'da\xdf', u'zum', u'solches', u'wie', u'aber', u'eines', u'ihr', u'nach', u'gewesen', u'desselben', u'damit', u'eine', u'ihm', u'einen', u'wieder', u'einem', u'jene', u'sind', u'jenem', u'welches', u'eurem', u'einiger', u'einiges', u'oder', u'weg', u'einigem', u'einigen', u'euer', u'dieselbe', u'was', u'von', u'jenes', u'jener', u'durch', u'mich', u'muss', u'unsen', u'ins', u'solchem', u'unsem', u'nun', u'bei', u'welchem', u'der', u'des', u'nicht', u'um', u'dann', u'dem', u'den', u'welchen', u'sein', u'ein', u'ihre', u'seinem', u'seinen', u'keine', u'alles', u'aller', u'noch', u'vom', u'unter', u'gegen', u'am', u'an', u'\xfcber', u'im', u'zwischen', u'vor', u'in', u'allen', u'allem', u'welche', u'seiner', u'seines', u'anderer', u'anderes', u'euch', u'manchem', u'derer', u'manchen', u'k\xf6nnen', u'also', u'manches', u'mancher', u'dieselben', u'sich', u'sie', u'zu', u'so', u'mir', u'anderen', u'mit', u'anderem', u'eurer', u'eures', u'zwar', u'dies', u'sehr', u'jetzt', u'etwas', u'derselben', u'eure', u'euren', u'da', u'solche', u'man', u'ihrem', u'kein', u'ihren', u'meine', u'doch', u'machen', u'denn', u'unser', u'unses', u'ihres', u'ihrer']), 'italian': frozenset([u'all', u'fanno', u'ebbi', u'stettero', u'stessi', u'sarei', u'faccia', u'nostra', u'facesse', u'avr\xe0', u'nostre', u'negl', u'farai', u'nostri', u'nostro', u'farei', u'hai', u'alle', u'le', u'alla', u'la', u'allo', u'lo', u'quelli', u'tu', u'quello', u'sia', u'li', u'starebbe', u'loro', u'faresti', u'ti', u'fareste', u'fossimo', u'stiate', u'cui', u'non', u'avesti', u'noi', u'di', u'dal', u'avr\xf2', u'nell', u'dell', u'avete', u'da', u'starai', u'fai', u'stando', u'facevo', u'stette', u'aveste', u'steste', u'avendo', u'pi\xf9', u'tra', u'sarete', u'l', u'ero', u'avremo', u'quella', u'facendo', u'stava', u'avrai', u'fece', u'starebbero', u'facessi', u'ed', u'feci', u'stemmo', u'stiamo', u'sarebbe', u'stesse', u'facevamo', u'facessimo', u'siano', u'sei', u'avrebbero', u'miei', u'nel', u'stiano', u'sua', u'dei', u'dagl', u'facciano', u'sul', u'suoi', u'per', u'stessero', u'avrete', u'lei', u'lui', u'facevi', u'starei', u'sugl', u'faceva', u'dalla', u'sareste', u'eravamo', u'nello', u'saresti', u'nella', u'faremo', u'eravate', u'anche', u'nelle', u'agli', u'avuti', u'foste', u'avuto', u'tuo', u'tua', u'negli', u'come', u'tue', u'avute', u'fummo', u'gli', u'c', u'avreste', u'quelle', u'stavate', u'\xe8', u'stavano', u'questo', u'questi', u'o', u'avresti', u'una', u'chi', u'coi', u'fui', u'staranno', u'col', u'dalle', u'con', u'star\xe0', u'ci', u'questa', u'stanno', u'avrebbe', u'furono', u'avevamo', u'perch\xe9', u'tuoi', u'stavamo', u'degl', u'avuta', u'staremo', u'tutto', u'degli', u'che', u'fossero', u'tutti', u'dove', u'sarai', u'avremmo', u'facciate', u'quante', u'facesti', u'starete', u'quanta', u'abbiate', u'quanto', u'quanti', u'contro', u'avessi', u'faranno', u'far\xe0', u'queste', u'ebbero', u'voi', u'siamo', u'agl', u'ho', u'farete', u'far\xf2', u'abbiamo', u'farebbe', u'ha', u'sarebbero', u'abbia', u'quale', u'avessimo', u'facessero', u'saranno', u'ma', u'sta', u'abbiano', u'dagli', u'avrei', u'sto', u'mi', u'ebbe', u'dello', u'facevate', u'un', u'del', u'era', u'avevano', u'stareste', u'delle', u'eri', u'della', u'facevano', u'faremmo', u'faceste', u'ad', u'stavi', u'ai', u'vi', u'stetti', u'in', u'al', u'avesse', u'sull', u'vostri', u'saremmo', u'il', u'io', u'vostro', u'vostra', u'avevate', u'vostre', u'staremmo', u'faccio', u'fosti', u'avemmo', u'mio', u'fossi', u'mia', u'sar\xe0', u'mie', u'ne', u'stia', u'dallo', u'star\xf2', u'sar\xf2', u'siete', u'avessero', u'staresti', u'avevo', u'avevi', u'fu', u'facciamo', u'dall', u'aveva', u'sue', u'erano', u'dai', u'essendo', u'stesti', u'sullo', u'sulla', u'sono', u'sulle', u'stai', u'a', u'sugli', u'e', u'avranno', u'i', u'hanno', u'farebbero', u'nei', u'saremo', u'su', u'sui', u'suo', u'si', u'facemmo', u'fecero', u'stavo', u'stessimo', u'uno', u'dov', u'fosse', u'se', u'siate']), 'spanish': frozenset([u'son', u'estar\xe1', u'estadas', u'tengamos', u'hubieras', u'sentidos', u'nuestra', u'teng\xe1is', u'\xe9l', u'tuvi\xe9semos', u'estos', u'tuvimos', u'tuviste', u'nuestro', u'otro', u'tuvieron', u'antes', u'le', u'han', u'la', u'estar\xedamos', u'lo', u'estar\xedas', u'tu', u'ten\xedamos', u'quienes', u'otra', u'hubi\xe9semos', u'hay', u'suyas', u'tendr\xe9', u'ti', u'estar', u'te', u'ten\xe9is', u'habr\xedas', u'tendr\xe1', u'porque', u'estuvimos', u'ser\xedais', u'estaba', u'esa', u'yo', u'\xe9ramos', u'ya', u'cuando', u'nada', u'de', u'est\xe1is', u'tuyos', u'hayan', u'tendr\xe9is', u'estuve', u'algunos', u'hayas', u'tanto', u'qu\xe9', u'seas', u'vosostros', u'm\xeda', u'tuvieras', u'nos', u'hubimos', u'est\xe9is', u'estoy', u'estaremos', u'hubieran', u'una', u'tuvieran', u'estar\xe9is', u'somos', u'fu\xe9semos', u'desde', u'sentida', u'habr\xe9', u'nosotras', u'estados', u'sentido', u'habr\xe1', u'el', u'fuera', u'en', u'habr\xeda', u'esos', u'tendr\xe1n', u'otras', u'habr\xe9is', u'ten\xedas', u'fuesen', u'fue', u'hubieseis', u'tenida', u'soy', u'fueseis', u'seamos', u'hube', u'sea', u'tendr\xedamos', u'estamos', u'todo', u'es', u'eres', u'estad', u'tuya', u't\xfa', u'tuvieseis', u'fueses', u'hab\xedas', u'm\xedas', u'tenido', u'muy', u'tuyo', u'algunas', u'poco', u'ese', u'haya', u'sus', u'estas', u'sobre', u'ser\xedamos', u'eso', u'hab\xedais', u'tened', u'estar\xe9', u'era', u'fuerais', u'habr\xedan', u'estuvieran', u'tienen', u'fuiste', u'tuvo', u'tus', u'fu\xe9ramos', u'estar\xedais', u'les', u'que', u'como', u'estuvieras', u'habido', u'tengan', u'tendr\xe1s', u'tenidas', u'ser\xedas', u'estar\xe1s', u'estuvierais', u'ten\xeda', u'hab\xeda', u'estuvo', u'eras', u'estuviera', u'estuvisteis', u'tuvierais', u'o', u'ser\xe1s', u'est\xe1bamos', u'tambi\xe9n', u'ser\xe1n', u'nosotros', u'algo', u'quien', u'fui', u'os', u'ser\xe9is', u'uno', u'hab\xedan', u'hubiera', u'habiendo', u'est\xe1', u'teniendo', u'fuisteis', u'por', u'est\xe9', u'durante', u'mucho', u'suya', u'donde', u'estuvieron', u'tendremos', u'erais', u'ante', u'tuvisteis', u'otros', u'estaban', u'suyo', u'tienes', u'fueron', u'tenemos', u'tuvieses', u'contra', u'esas', u'estado', u'pero', u'est\xe9s', u'estemos', u'est\xe9n', u'los', u'estabas', u'nuestros', u'se\xe1is', u'est\xe1s', u'ellos', u'tuvi\xe9ramos', u'estar\xe1n', u'fueran', u'suyos', u'habidos', u'hubiese', u'tendr\xedais', u'm\xe1s', u'vuestros', u'm\xedos', u'estabais', u'para', u'fuese', u'fuimos', u'estar\xedan', u'tendr\xedas', u'fueras', u'estuvieseis', u'tendr\xedan', u'vuestro', u'vuestra', u'ha', u'ten\xedais', u'he', u'me', u'has', u'hubo', u'seremos', u'hab\xe9is', u'hubi\xe9ramos', u'mi', u'tengo', u'est\xe1n', u'ten\xedan', u'sintiendo', u'un', u'del', u'hemos', u's\xed', u'tuviera', u'tengas', u'sean', u'habr\xedais', u'este', u'unos', u'esta', u'habr\xe1n', u'estando', u'eran', u'esto', u'al', u'hayamos', u'hab\xedamos', u'estuviese', u'hay\xe1is', u'hubieses', u'sois', u'tenidos', u'tuviese', u'habr\xe1s', u'tenga', u'ni', u'tuviesen', u'no', u'estuvieses', u'ellas', u'sentidas', u'tiene', u'habr\xedamos', u'estuviesen', u'cual', u'nuestras', u'mis', u'sin', u'todos', u'vosostras', u'hubisteis', u'tuyas', u'habremos', u'tuve', u'hubiste', u'ella', u'sentid', u'hubierais', u'hubieron', u'estada', u'siente', u'ser\xeda', u'estar\xeda', u'las', u'a', u'vuestras', u'estuvi\xe9ramos', u'e', u'entre', u'habida', u'm\xed', u'ser\xedan', u'muchos', u'm\xedo', u'su', u'hasta', u'estuvi\xe9semos', u'hubiesen', u'ser\xe1', u'y', u'habidas', u'tendr\xeda', u'con', u'estuviste', u'se', u'ser\xe9']), 'french': frozenset([u'e\xfbtes', u'\xeates', u'aient', u'auraient', u'aurions', u'auras', u'serait', u'le', u'serais', u'mais', u'la', u'eue', u'tu', u'ayante', u'eux', u'aux', u'te', u'eus', u'ta', u'aurais', u'aviez', u'de', u'ayantes', u'f\xfbtes', u'moi', u'sont', u'mon', u'ayant', u'serez', u'du', u'nos', u'aurez', u'eussiez', u'qu', u'd', u'furent', u'f\xfbt', u'\xe9t\xe9e', u'soient', u'leur', u't', u'\xe9t\xe9s', u'seriez', u'en', u'ses', u'avons', u'l', u'eu', u'et', u'sommes', u'tes', u'aurait', u'es', u'est', u'eurent', u'serions', u'sur', u'lui', u'soyons', u'ayants', u'\xe9tais', u'soyez', u'que', u'mes', u'qui', u'je', u'm\xeame', u'\xe0', u'c', u'ayons', u's', u'e\xfbmes', u'une', u'ou', u'\xe9tait', u'\xe9t\xe9', u'\xe9tants', u'\xe9t\xe9es', u'ce', u'son', u'auriez', u'des', u'\xe9tante', u'ont', u'avez', u'f\xfbmes', u'avait', u'avec', u'fussions', u'seraient', u'suis', u'eussions', u'toi', u'ton', u'eues', u'vous', u'aies', u'on', u'auront', u'aurons', u'avions', u'eut', u'me', u'fut', u'ma', u'fus', u'fussent', u'ait', u'j', u'dans', u'pour', u'n', u'seras', u'un', u'serai', u'sera', u'aie', u'ayez', u'avaient', u'aurai', u'votre', u'\xe9tiez', u'ai', u'eusse', u'\xe9taient', u'eussent', u'eusses', u'\xe9tantes', u'soit', u'as', u'au', u'il', u'sois', u'vos', u'\xe9tions', u'par', u'pas', u'fusses', u'fussiez', u'ne', u'\xe9tant', u'seront', u'serons', u'aura', u'avais', u'e\xfbt', u'notre', u'elle', u'nous', u'fusse', u'm', u'y', u'ces', u'sa', u'se']), 'english': frozenset([u'all', u'just', u'being', u'over', u'both', u'through', u'yourselves', u'its', u'before', u'herself', u'had', u'should', u'to', u'only', u'under', u'ours', u'has', u'do', u'them', u'his', u'very', u'they', u'not', u'during', u'now', u'him', u'nor', u'did', u'this', u'she', u'each', u'further', u'where', u'few', u'because', u'doing', u'some', u'are', u'our', u'ourselves', u'out', u'what', u'for', u'while', u'does', u'above', u'between', u't', u'be', u'we', u'who', u'were', u'here', u'hers', u'by', u'on', u'about', u'of', u'against', u's', u'or', u'own', u'into', u'yourself', u'down', u'your', u'from', u'her', u'their', u'there', u'been', u'whom', u'too', u'themselves', u'was', u'until', u'more', u'himself', u'that', u'but', u'don', u'with', u'than', u'those', u'he', u'me', u'myself', u'these', u'up', u'will', u'below', u'can', u'theirs', u'my', u'and', u'then', u'is', u'am', u'it', u'an', u'as', u'itself', u'at', u'have', u'in', u'any', u'if', u'again', u'no', u'when', u'same', u'how', u'other', u'which', u'you', u'after', u'most', u'such', u'why', u'a', u'off', u'i', u'yours', u'so', u'the', u'having', u'once'])} def detect_language(sentence): """Detects the language of a sentence, out of English, German, Italian, French, and Spanish. Uses stop word frequency: intersects the tokens of a sentence with a list of stop-words for each language and picks the language with the highest intersection. Returns a string identifying the language.""" tokens = [t.lower() for t in word_tokenize(sentence)] guesses = [] for lang in STOPWORDS: guesses.append((float(sum(w in STOPWORDS[lang] for w in tokens)) / len(tokens), lang)) return max(guesses)[1] def is_english(sentence): """Determines whether a sentence is English. Will return True if at least 10% of the words are English stop words. This method is a lot faster than detect_language since we only have to run this procedure for one language.""" tokens = [t.lower() for t in word_tokenize(sentence)] if not tokens: return False return float(sum(w in STOPWORDS['english'] for w in tokens)) / len(tokens) >= 0.1
308.119048
11,416
0.611931
2,554
12,941
3.088097
0.415427
0.008368
0.001521
0.006593
0.025865
0.01699
0.011665
0.011665
0.011665
0.011665
0
0.0084
0.10772
12,941
41
11,417
315.634146
0.674634
0.057646
0
0.105263
0
0
0.482634
0
0
0
0
0
0
1
0.105263
false
0
0.157895
0
0.421053
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
895f212cf5edba21e5ce077b06450b8e9b08630e
297
py
Python
utils/singleton.py
BlueYangDroid/test-python-appium-android
1a5fac08ddc8c8738092ae7ee341c29bdfd63da2
[ "MIT" ]
1
2018-08-30T06:59:00.000Z
2018-08-30T06:59:00.000Z
utils/singleton.py
BlueYangDroid/test-python-appium-android
1a5fac08ddc8c8738092ae7ee341c29bdfd63da2
[ "MIT" ]
null
null
null
utils/singleton.py
BlueYangDroid/test-python-appium-android
1a5fac08ddc8c8738092ae7ee341c29bdfd63da2
[ "MIT" ]
1
2020-01-08T14:10:43.000Z
2020-01-08T14:10:43.000Z
#!/usr/bin/env python # _*_ coding:utf-8 _*_ import functools def singleton(cls): instances = {} functools.wraps(cls) def getInstance(*args, **kw): if cls not in instances: instances[cls] = cls(*args, **kw) return instances[cls] return getInstance
17.470588
45
0.606061
35
297
5.028571
0.6
0.068182
0
0
0
0
0
0
0
0
0
0.004587
0.265993
297
16
46
18.5625
0.802752
0.138047
0
0
0
0
0
0
0
0
0
0
0
1
0.222222
false
0
0.111111
0
0.555556
0
0
0
0
null
0
0
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
89620b968dac4bcb2948e1819520aec4e252f954
2,754
py
Python
bagel_shop/bagel_tester.py
DudkinON/securing
5af3e1d214b979ca5be2d870ddf32acc00f77cc2
[ "MIT" ]
null
null
null
bagel_shop/bagel_tester.py
DudkinON/securing
5af3e1d214b979ca5be2d870ddf32acc00f77cc2
[ "MIT" ]
null
null
null
bagel_shop/bagel_tester.py
DudkinON/securing
5af3e1d214b979ca5be2d870ddf32acc00f77cc2
[ "MIT" ]
null
null
null
from urllib import urlencode from httplib2 import Http import json import sys import base64 address = 'http://127.0.0.1:8000' # TEST 1 TRY TO MAKE A NEW USER try: url = address + '/users' h = Http() # h.add_credentials('TinnyTim', 'Udacity') data = dict(username="TinnyTim", password="Udacity") data = json.dumps(data) resp, content = h.request(url, 'POST', body=data, headers={"Content-Type": "application/json"}) if resp['status'] != '201' and resp['status'] != '200': raise Exception( 'Received an unsuccessful status code of %s' % resp['status']) except Exception as err: print "Test 1 FAILED: Could not make a new user" print err.args sys.exit() else: print "Test 1 PASS: Succesfully made a new user" # TEST 2 ADD NEW BAGELS TO THE DATABASE try: h = Http() h.add_credentials('TinnyTim', 'Udacity') url = address + '/bagels' data = dict(username="TinnyTim", password="Udacity", name="plain", picture="http://bonacbagel.weebly.com/uploads/4/0/5/4/40548977/s318635836612132814_p1_i1_w240.jpeg", description="Old-Fashioned Plain Bagel", price="$1.99") resp, content = h.request(url, 'POST', body=json.dumps(data), headers={"Content-Type": "application/json"}) if resp['status'] != '200': raise Exception( 'Received an unsuccessful status code of %s' % resp['status']) except Exception as err: print "Test 2 FAILED: Could not add new bagels" print err.args sys.exit() else: print "Test 2 PASS: Succesfully made new bagels" # TEST 3 TRY TO READ BAGELS WITH INVALID CREDENTIALS try: h = Http() h.add_credentials('TinnyTim', 'Youdacity') url = address + '/bagels' data = dict(username="Tinny_Tim", password="youdacity") resp, content = h.request(url, 'GET', urlencode(data)) if resp['status'] == '200': raise Exception( "Security Flaw: able to log in with invalid credentials") except Exception as err: print "Test 3 FAILED" print err.args sys.exit() else: print "Test 3 PASS: App checks against invalid credentials" # TEST 4 TRY TO READ BAGELS WITH VALID CREDENTIALS try: h = Http() h.add_credentials("TinnyTim", "Udacity") url = address + '/bagels' # data = dict(username = "TinnyTim", password = "Udacity") resp, content = h.request(url, 'GET') # , urlencode(data)) if resp['status'] != '200': raise Exception("Unable to access /bagels with valid credentials") except Exception as err: print "Test 4 FAILED" print err.args sys.exit() else: print "Test 4 PASS: Logged in User can view /bagels" print "ALL TESTS PASSED!"
33.585366
116
0.633987
367
2,754
4.735695
0.318801
0.041427
0.013809
0.020713
0.625432
0.603567
0.562716
0.462025
0.394707
0.300345
0
0.037161
0.237836
2,754
81
117
34
0.790853
0.103123
0
0.521739
0
0.014493
0.355808
0
0
0
0
0
0
0
null
null
0.115942
0.072464
null
null
0.188406
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
89795ff76726caf59760afa7bd508deb6e8515fd
183
py
Python
risk_managed/views/home.py
jteppinette/risk-managed
e559575e6104baade42b31cbbfcbe5d4ce64bceb
[ "BSD-2-Clause" ]
2
2019-02-13T07:50:23.000Z
2022-02-08T08:32:26.000Z
risk_managed/views/home.py
jteppinette/risk-managed
e559575e6104baade42b31cbbfcbe5d4ce64bceb
[ "BSD-2-Clause" ]
9
2020-02-11T23:39:02.000Z
2021-06-10T17:43:24.000Z
risk_managed/views/home.py
jteppinette/risk-managed
e559575e6104baade42b31cbbfcbe5d4ce64bceb
[ "BSD-2-Clause" ]
null
null
null
from django.shortcuts import redirect, render def view(request): if request.user.is_authenticated: return redirect("dashboard") return render(request, "home.html")
20.333333
45
0.721311
22
183
5.954545
0.772727
0
0
0
0
0
0
0
0
0
0
0
0.180328
183
8
46
22.875
0.873333
0
0
0
0
0
0.098361
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.8
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
89a19e841ed6183a882c5dbc8821ee7d761b1270
545
py
Python
dualtext_server/dualtext_api/migrations/0008_auto_20201207_2109.py
mathislucka/dualtext
70cf7734cd66e60e482e2df09a3341224687526f
[ "MIT" ]
1
2021-08-16T20:21:11.000Z
2021-08-16T20:21:11.000Z
dualtext_server/dualtext_api/migrations/0008_auto_20201207_2109.py
mathislucka/dualtext
70cf7734cd66e60e482e2df09a3341224687526f
[ "MIT" ]
null
null
null
dualtext_server/dualtext_api/migrations/0008_auto_20201207_2109.py
mathislucka/dualtext
70cf7734cd66e60e482e2df09a3341224687526f
[ "MIT" ]
null
null
null
# Generated by Django 3.1.3 on 2020-12-07 21:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('dualtext_api', '0007_auto_20201207_2106'), ] operations = [ migrations.AddField( model_name='label', name='color', field=models.JSONField(null=True), ), migrations.AddField( model_name='label', name='key_code', field=models.CharField(max_length=1, null=True), ), ]
22.708333
60
0.572477
58
545
5.241379
0.689655
0.118421
0.151316
0.177632
0.236842
0.236842
0
0
0
0
0
0.085106
0.310092
545
23
61
23.695652
0.723404
0.082569
0
0.352941
1
0
0.116466
0.046185
0
0
0
0
0
1
0
false
0
0.058824
0
0.235294
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
89a689db077bb0a5342d4e8fb0c718dc70efd830
1,401
py
Python
tests/io/dsl/struct/test_struct.py
mpearmain/forml
3d69d27b1a64a237c739d2795512b6f9296d3874
[ "Apache-2.0" ]
null
null
null
tests/io/dsl/struct/test_struct.py
mpearmain/forml
3d69d27b1a64a237c739d2795512b6f9296d3874
[ "Apache-2.0" ]
null
null
null
tests/io/dsl/struct/test_struct.py
mpearmain/forml
3d69d27b1a64a237c739d2795512b6f9296d3874
[ "Apache-2.0" ]
null
null
null
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you 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. """ Struct tests. """ # pylint: disable=no-self-use import cloudpickle from forml.io.dsl.struct import frame class TestField: """Field unit tests.""" def test_renamed(self, student: frame.Table): """Test the field renaming.""" assert student.schema.dob.renamed('foo').name == 'foo' class TestSchema: """Schema unit tests.""" def test_serilizable(self, student: frame.Table): """Test schema serializability.""" assert cloudpickle.loads(cloudpickle.dumps(student.schema)) == student.schema assert cloudpickle.loads(cloudpickle.dumps(student)) == student
33.357143
85
0.729479
191
1,401
5.340314
0.549738
0.058824
0.02549
0.031373
0.137255
0.088235
0
0
0
0
0
0.003469
0.177016
1,401
41
86
34.170732
0.88118
0.632405
0
0
0
0
0.012739
0
0
0
0
0
0.333333
1
0.222222
false
0
0.222222
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
89ac6da90d7f12a9d46afe92e54e836c7baa6510
536
py
Python
tests/r/test_utilities2.py
hajime9652/observations
2c8b1ac31025938cb17762e540f2f592e302d5de
[ "Apache-2.0" ]
199
2017-07-24T01:34:27.000Z
2022-01-29T00:50:55.000Z
tests/r/test_utilities2.py
hajime9652/observations
2c8b1ac31025938cb17762e540f2f592e302d5de
[ "Apache-2.0" ]
46
2017-09-05T19:27:20.000Z
2019-01-07T09:47:26.000Z
tests/r/test_utilities2.py
hajime9652/observations
2c8b1ac31025938cb17762e540f2f592e302d5de
[ "Apache-2.0" ]
45
2017-07-26T00:10:44.000Z
2022-03-16T20:44:59.000Z
from __future__ import absolute_import from __future__ import division from __future__ import print_function import shutil import sys import tempfile from observations.r.utilities2 import utilities2 def test_utilities2(): """Test module utilities2.py by downloading utilities2.csv and testing shape of extracted data has 117 rows and 19 columns """ test_path = tempfile.mkdtemp() x_train, metadata = utilities2(test_path) try: assert x_train.shape == (117, 19) except: shutil.rmtree(test_path) raise()
22.333333
48
0.76306
72
536
5.402778
0.569444
0.077121
0.123393
0
0
0
0
0
0
0
0
0.036117
0.173507
536
23
49
23.304348
0.841986
0.222015
0
0
0
0
0
0
0
0
0
0
0.066667
1
0.066667
false
0
0.466667
0
0.533333
0.066667
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
89bafb59582cecd9484c64e34f6e36c8f44dba37
71
py
Python
mmcv/version.py
xiayongtao/mmcv
69048ff056d1c34ef78fe6f55c63f663a62bb0c7
[ "Apache-2.0" ]
1
2020-07-20T09:52:50.000Z
2020-07-20T09:52:50.000Z
mmcv/mmcv/version.py
justimyhxu/mmclassification
9ab7baff3b808a6defe6c3da6c5f151a6d04dd91
[ "Apache-2.0" ]
2
2020-01-13T10:13:25.000Z
2020-06-24T03:58:34.000Z
mmcv/version.py
xiayongtao/mmcv
69048ff056d1c34ef78fe6f55c63f663a62bb0c7
[ "Apache-2.0" ]
1
2020-08-04T05:47:52.000Z
2020-08-04T05:47:52.000Z
# Copyright (c) Open-MMLab. All rights reserved. __version__ = '0.6.1'
23.666667
48
0.704225
11
71
4.181818
1
0
0
0
0
0
0
0
0
0
0
0.04918
0.140845
71
2
49
35.5
0.704918
0.647887
0
0
0
0
0.217391
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
9832468276fb60cce1335e8978947db3cccc3648
1,200
py
Python
test_cleanup.py
KayleeTheMech/Simple-Retweet-Bot
67112cc2007c06a8bc2f0681e20eeae506261d46
[ "MIT" ]
2
2018-04-01T14:56:59.000Z
2019-12-25T04:25:47.000Z
test_cleanup.py
KayleeTheMech/Simple-Retweet-Bot
67112cc2007c06a8bc2f0681e20eeae506261d46
[ "MIT" ]
null
null
null
test_cleanup.py
KayleeTheMech/Simple-Retweet-Bot
67112cc2007c06a8bc2f0681e20eeae506261d46
[ "MIT" ]
1
2020-05-06T12:55:08.000Z
2020-05-06T12:55:08.000Z
# Retweet bot for Twitter, using Python and Tweepy. # License: MIT License. import tweepy import dateparser import pickle from RetweetObject import RetweetObject from RetweetStore import RetweetStore from RetweetGuard import RetweetGuard from time import sleep # Import in your Twitter application keys, tokens, and secrets. # Make sure your settings.py file lives in the same directory as this .py file. from settings import consumer_key from settings import consumer_secret from settings import access_token from settings import access_token_secret from settings import hashtag from settings import maximum_tweets_per_call from settings import testing # Authenticating auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) api = tweepy.API(auth) # Initializing retweetGuard = RetweetGuard(api.blocks_ids()) retweetStore = RetweetStore('tweetStore.obj') print("Using the Account: " + api.me().name) print("This account blocks " + str(len(retweetGuard._blocked_ids)) + " Accounts") sleep(4) # Clean up possible new blocks retweetGuard.clean_up_retweets(retweetStore, api) # Save updated store to disk retweetStore.saveStoreToDisk()
30
81
0.816667
161
1,200
5.962733
0.478261
0.0875
0.13125
0.054167
0.060417
0
0
0
0
0
0
0.000948
0.120833
1,200
39
82
30.769231
0.909005
0.245833
0
0
0
0
0.069196
0
0
0
0
0
0
1
0
false
0
0.583333
0
0.583333
0.083333
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
983e41cca8ec8e48127d8f8728e71f18801f71ed
1,577
py
Python
polysomeDetection/sim/sim0.py
luiskuhn/polysome-detection
2bd8ee5edb05457151f410d2f13d6511a1b75db0
[ "MIT" ]
null
null
null
polysomeDetection/sim/sim0.py
luiskuhn/polysome-detection
2bd8ee5edb05457151f410d2f13d6511a1b75db0
[ "MIT" ]
null
null
null
polysomeDetection/sim/sim0.py
luiskuhn/polysome-detection
2bd8ee5edb05457151f410d2f13d6511a1b75db0
[ "MIT" ]
null
null
null
from polysomeDetection.polysomeDetectionStructures import PolysomeDetectionMRF from polysomeDetection.sim.simFunctions import generatePositiveList, buildGraphRand, paintGraph import numpy as np posNum = 9 mapIt = 1 # neighborIt = 25 # for i in range(1, neighborIt +1): # sr_sum = 0.0 # for j in range(10): # pointList = generatePositiveList() # g = buildGraphRand(pointList, i*posNum, 0.0) # #paintGraph(pointList, g) # gm = PolysomeDetectionMRF(g) # mapVec = gm.getMAP(mapIt) # ground = [0, 0, 2, 2, 2, 5, 5, 5, 5] # ground.extend(range(9, 9 + i*posNum)) # n = len(ground) # ground = np.array(ground) # res = (mapVec == ground) # sr = float(res.sum())/n # sr_sum = sr_sum + sr # sr_mean = sr_sum/10 # print 'nn', i*posNum, sr_mean # f = open('stats_neighbors.txt', 'a') # f.write(str( float(posNum)/(i*posNum) ) + ' ' + str(sr_mean) + '\n') # f.close() # print 'done...' # ########## sdIt = 500 sdInit = 0.05 for i in range(1, sdIt +1): sr_sum = 0.0 for j in range(10): pointList = generatePositiveList() g = buildGraphRand(pointList, 50, i*sdInit) #paintGraph(pointList, g) gm = PolysomeDetectionMRF(g) mapVec = gm.getMAP(mapIt) ground = [0, 0, 2, 2, 2, 5, 5, 5, 5] ground.extend(range(9, 9 + 50)) n = len(ground) ground = np.array(ground) res = (mapVec == ground) sr = float(res.sum())/n sr_sum = sr_sum + sr sr_mean = sr_sum/10 print 'sd', i*sdInit, sr_mean f = open('stats_sd_1.txt', 'a') f.write(str( i*sdInit ) + ' ' + str(sr_mean) + '\n') f.close() print 'done...' ##########
19.7125
95
0.619531
233
1,577
4.120172
0.261803
0.041667
0.0125
0.022917
0.675
0.589583
0.589583
0.589583
0.5375
0.5375
0
0.04379
0.203551
1,577
80
96
19.7125
0.720541
0.422955
0
0
1
0
0.031214
0
0
0
0
0
0
0
null
null
0
0.111111
null
null
0.074074
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
9842cd352956b3e4f9102cd61c608087d415bb55
156
py
Python
HackerRank/Problem Solving/Beautiful Triplets/beautiful-triplets.py
weiyi-m/kattis
cc459508ad963988627267dd650e86cbac35fb04
[ "MIT" ]
2
2021-07-27T10:46:47.000Z
2021-07-27T10:47:57.000Z
HackerRank/Problem Solving/Beautiful Triplets/beautiful-triplets.py
weiyi-m/kattis
cc459508ad963988627267dd650e86cbac35fb04
[ "MIT" ]
null
null
null
HackerRank/Problem Solving/Beautiful Triplets/beautiful-triplets.py
weiyi-m/kattis
cc459508ad963988627267dd650e86cbac35fb04
[ "MIT" ]
null
null
null
def beautifulTriplets(d, arr): t = 0 for i in range(len(arr)): if arr[i] + d in arr and arr[i] + 2*d in arr: t += 1 return t
26
53
0.5
29
156
2.689655
0.551724
0.102564
0.153846
0
0
0
0
0
0
0
0
0.030612
0.371795
156
6
54
26
0.765306
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0
0
0.333333
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
9849c8208d215f96a9e2fb8a6ba5896688dfdfd4
1,203
py
Python
stories/migrations/0004_auto_20160119_1132.py
luterien/madcyoa
1af9140717fd00c5c671ccbcd09d75df51dee263
[ "Apache-2.0" ]
null
null
null
stories/migrations/0004_auto_20160119_1132.py
luterien/madcyoa
1af9140717fd00c5c671ccbcd09d75df51dee263
[ "Apache-2.0" ]
null
null
null
stories/migrations/0004_auto_20160119_1132.py
luterien/madcyoa
1af9140717fd00c5c671ccbcd09d75df51dee263
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-01-19 19:32 from __future__ import unicode_literals import autoslug.fields from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('stories', '0003_auto_20160119_1125'), ] operations = [ migrations.AlterField( model_name='chapter', name='slug', field=autoslug.fields.AutoSlugField(blank=True, editable=False, null=True, populate_from='name', unique=True), ), migrations.AlterField( model_name='choice', name='slug', field=autoslug.fields.AutoSlugField(blank=True, editable=False, null=True, populate_from='name', unique=True), ), migrations.AlterField( model_name='snippet', name='slug', field=autoslug.fields.AutoSlugField(blank=True, editable=False, null=True, populate_from='name', unique=True), ), migrations.AlterField( model_name='story', name='slug', field=autoslug.fields.AutoSlugField(blank=True, editable=False, null=True, populate_from='name', unique=True), ), ]
32.513514
122
0.619285
126
1,203
5.785714
0.380952
0.096022
0.137174
0.159122
0.646091
0.646091
0.646091
0.646091
0.646091
0.646091
0
0.034637
0.256027
1,203
36
123
33.416667
0.779888
0.054032
0
0.551724
1
0
0.076652
0.020264
0
0
0
0
0
1
0
false
0
0.103448
0
0.206897
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
9850fdc17b3b342ff2a399161f8a705c2c485ce9
699
py
Python
day06/c.py
Net-Mist/advent_of_code2021
124d773356bee2794294800de7673d5fac24db0a
[ "MIT" ]
1
2022-01-03T09:21:33.000Z
2022-01-03T09:21:33.000Z
day06/c.py
Net-Mist/advent_of_code2021
124d773356bee2794294800de7673d5fac24db0a
[ "MIT" ]
null
null
null
day06/c.py
Net-Mist/advent_of_code2021
124d773356bee2794294800de7673d5fac24db0a
[ "MIT" ]
null
null
null
from collections import Counter def day6(n_days: int) -> int: with open("input.txt") as f: fishes = map(int, f.readline().split(",")) n_fish_per_day = Counter() for f in fishes: n_fish_per_day[f] += 1 # simulate days for _ in range(n_days): new_n_fish_per_day = {} for i in range(1, 9): new_n_fish_per_day[i - 1] = n_fish_per_day[i] n_new_fish = n_fish_per_day[0] new_n_fish_per_day[6] += n_new_fish new_n_fish_per_day[8] = n_new_fish n_fish_per_day = new_n_fish_per_day # count return sum(n_fish_per_day[i] for i in range(0, 9)) print("part1:", day6(80)) print("part2:", day6(256))
24.103448
57
0.609442
124
699
3.056452
0.330645
0.145119
0.23219
0.319261
0.350923
0.100264
0.100264
0
0
0
0
0.037182
0.268956
699
28
58
24.964286
0.704501
0.027182
0
0
0
0
0.032496
0
0
0
0
0
0
1
0.055556
false
0
0.055556
0
0.166667
0.111111
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
985486dc07cce4afb2cb8d88b50be837a58e29b0
1,061
py
Python
modules/blockchain/book.py
zeddo123/OpenBook
051d2d86428f36c6ca0cc22eafeed23581347e17
[ "WTFPL" ]
12
2019-10-24T13:22:09.000Z
2020-10-04T20:27:53.000Z
modules/blockchain/book.py
zeddo123/OpenBook
051d2d86428f36c6ca0cc22eafeed23581347e17
[ "WTFPL" ]
null
null
null
modules/blockchain/book.py
zeddo123/OpenBook
051d2d86428f36c6ca0cc22eafeed23581347e17
[ "WTFPL" ]
null
null
null
class Book: """The Book object contains all the information about a book""" def __init__(self, title, author, date, genre): """Object constructor :param title: title of the Book :type title: str :param author: author of the book :type author: str :param data: the date at which the book has been published :param date: str :param genre: the subject/type of the book :type genre: str """ self.title = title self.author = author self.date = date self.genre = genre def to_json(self): """ to_json converts the object into a json object :var json_dict: contains information about the book :type json_dict: dict :returns: a dict (json) containing of the information of the book :rtype: dict """ json_dict = { 'title': self.title, 'author': self.author, 'date': self.date, 'genre': self.genre } return json_dict def __eq__(self, other): return (self.to_json() == other.to_json()) def __repr__(self): return str(self.to_json()) def __str__(self): return str(self.to_json())
21.22
67
0.671065
158
1,061
4.341772
0.259494
0.071429
0.052478
0.056851
0.067055
0.067055
0
0
0
0
0
0
0.219604
1,061
50
68
21.22
0.828502
0.489161
0
0.1
0
0
0.041408
0
0
0
0
0
0
1
0.25
false
0
0
0.15
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
0
0
1
0
0
0
2
985601fb8fd9ce4c6c0ec1fe28a668c6a7deb908
662
py
Python
post/forms.py
ashudva/Incog
53799a32d26c2301c562f85d9d81efc30fd8dc35
[ "MIT" ]
null
null
null
post/forms.py
ashudva/Incog
53799a32d26c2301c562f85d9d81efc30fd8dc35
[ "MIT" ]
12
2019-08-06T21:07:57.000Z
2021-06-09T18:35:50.000Z
post/forms.py
ashudva/Incog
53799a32d26c2301c562f85d9d81efc30fd8dc35
[ "MIT" ]
null
null
null
from .models import Comment, Post, Reply from django import forms from django.utils import timezone class PostForm(forms.Form): heading = forms.CharField(max_length=100) text = forms.CharField(max_length=2000) # def clean(self, request): # heading = self.cleaned_data['heading'] # confession = self.cleaned_data['confession'] # author = request.user.username # pub_date = timezone.now() # else: # return (heading, confession, author, pub_date) class CommentForm(forms.Form): text = forms.CharField(max_length=200) class ReplyForm(forms.Form): text = forms.CharField(max_length=200)
25.461538
60
0.679758
80
662
5.525
0.475
0.126697
0.153846
0.208145
0.237557
0.176471
0.176471
0.176471
0
0
0
0.024904
0.21148
662
25
61
26.48
0.821839
0.373112
0
0.2
0
0
0
0
0
0
0
0
0
1
0
false
0
0.3
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
9872fea407f1182cd2b5f6b51c42555cb6b61170
168
py
Python
mynetwork/__init__.py
lamter/mydealutil
26934e6e61b40327cb9cabc43e41cd01caf5bd2b
[ "MIT" ]
null
null
null
mynetwork/__init__.py
lamter/mydealutil
26934e6e61b40327cb9cabc43e41cd01caf5bd2b
[ "MIT" ]
null
null
null
mynetwork/__init__.py
lamter/mydealutil
26934e6e61b40327cb9cabc43e41cd01caf5bd2b
[ "MIT" ]
null
null
null
#coding=utf-8 ''' Created on 2015-10-23 @author: lamter ''' from .load import loadInt32 from .dump import dumpInt32 __all__ = [ 'loadInt32', 'dumpInt32' ]
9.882353
27
0.654762
21
168
5.047619
0.809524
0
0
0
0
0
0
0
0
0
0
0.12782
0.208333
168
16
28
10.5
0.669173
0.303571
0
0
0
0
0.165138
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
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
987acc1c2c7e5d7ae15680a1b0bbd480bbaa5edc
377
py
Python
python-fundamentals/default_value_params.py
douglasqsantos/complete-python-course
2657b6f09433e1a675cd35b5e263486518b16a1f
[ "Apache-2.0" ]
null
null
null
python-fundamentals/default_value_params.py
douglasqsantos/complete-python-course
2657b6f09433e1a675cd35b5e263486518b16a1f
[ "Apache-2.0" ]
null
null
null
python-fundamentals/default_value_params.py
douglasqsantos/complete-python-course
2657b6f09433e1a675cd35b5e263486518b16a1f
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/python3 # -*- coding: utf-8 -*- def main(): print(add(5,10)) print(add(5)) print(add(5,6)) print(add(x=5, y=2)) # print(add(x=5, 2)) # Error we need to use the both with name if you use the first one as named argument print(add(5,y=2)) print(1,2,3,4,5, sep=" - ") def add(x, y=3): total = x + y return total if __name__ == "__main__": main()
18.85
107
0.586207
74
377
2.878378
0.513514
0.225352
0.169014
0.093897
0
0
0
0
0
0
0
0.067114
0.209549
377
20
108
18.85
0.647651
0.376658
0
0
0
0
0.047414
0
0
0
0
0
0
1
0.166667
false
0
0
0
0.25
0.5
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
2
98821433be31fc73f8e6203e0c14adb9011e8cc9
332
py
Python
cs-2020-10-09-co-je-noveho-v-pythonu-3-9/new-module-zoneinfo.py
etjernst/blog
2dcba33cf08be528f18acd242d375aa52e64b30b
[ "BSD-3-Clause" ]
83
2016-04-10T02:26:19.000Z
2021-09-21T07:30:01.000Z
cs-2020-10-09-co-je-noveho-v-pythonu-3-9/new-module-zoneinfo.py
etjernst/blog
2dcba33cf08be528f18acd242d375aa52e64b30b
[ "BSD-3-Clause" ]
1
2016-09-02T09:40:55.000Z
2016-09-02T09:40:55.000Z
cs-2020-10-09-co-je-noveho-v-pythonu-3-9/new-module-zoneinfo.py
etjernst/blog
2dcba33cf08be528f18acd242d375aa52e64b30b
[ "BSD-3-Clause" ]
61
2016-06-08T15:43:43.000Z
2021-12-26T15:05:04.000Z
#!/usr/bin/env python3 # # Python 3.9: New module: zoneinfo # import datetime import zoneinfo dt = datetime.datetime(2020, 10, 10, tzinfo=zoneinfo.ZoneInfo('Europe/London')) print(dt) # 2020-10-10 00:00:00+01:00 dt = datetime.datetime(2020, 10, 10, tzinfo=zoneinfo.ZoneInfo('Europe/Prague')) print(dt) # 2020-10-10 00:00:00+02:00
25.538462
79
0.71988
56
332
4.267857
0.410714
0.100418
0.133891
0.1841
0.627615
0.627615
0.627615
0.627615
0.451883
0.451883
0
0.185811
0.108434
332
12
80
27.666667
0.621622
0.319277
0
0.333333
0
0
0.118182
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.333333
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
9889810a1abae450aa9700bb5b13e0e3d8d1c083
1,054
py
Python
Exercicios de Python/Curso em video/Mundo1/Ex30 Pedra, Papel ou Tessoura.py
AbraaoLeonardo/EstudandoPython
f4378eb08d4a8d1353372e181b1974d037d6ac9c
[ "MIT" ]
null
null
null
Exercicios de Python/Curso em video/Mundo1/Ex30 Pedra, Papel ou Tessoura.py
AbraaoLeonardo/EstudandoPython
f4378eb08d4a8d1353372e181b1974d037d6ac9c
[ "MIT" ]
null
null
null
Exercicios de Python/Curso em video/Mundo1/Ex30 Pedra, Papel ou Tessoura.py
AbraaoLeonardo/EstudandoPython
f4378eb08d4a8d1353372e181b1974d037d6ac9c
[ "MIT" ]
null
null
null
from random import randint from time import sleep escolha_do_computador = randint(0, 2) print('Pedra = 0, Papel = 1 e Tessoura = 2') escolha_do_player = int(input('Escolha a sua jogada: ')) Jogada = ['Pedra', 'Papel', 'Tessoura'] if escolha_do_player <= 2 and escolha_do_player >= 0: print('=' * 30) sleep(3) if escolha_do_player == escolha_do_computador: print('Empate, ambos escolheram {}'.format(Jogada[escolha_do_player])) elif escolha_do_player > escolha_do_computador: if escolha_do_player == 2 | escolha_do_computador == 0: print('Perdi, eu joguei {} e o computador jogou {}'.format(Jogada[escolha_do_player], Jogada[escolha_do_computador])) else: print('Ganhei, eu joguei {} e o computador jogou {}'.format(Jogada[escolha_do_player], Jogada[escolha_do_computador])) else: print('perdi') else: print('Jogada não encontrada')
47.909091
103
0.594877
124
1,054
4.814516
0.330645
0.226131
0.226131
0.085427
0.507538
0.40201
0.288107
0.288107
0.288107
0.288107
0
0.016238
0.298861
1,054
22
104
47.909091
0.79161
0
0
0.227273
0
0
0.204739
0
0
0
0
0
0
1
0
false
0
0.090909
0
0.090909
0.318182
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
988f411b2175859cb8c57f1c19acb89798e46cf7
272
py
Python
domain/types.py
Fenthick/sla_dashboard_webapp
fe7409b916f2c0504dd8fd097a2f6c5ba5f77b60
[ "Apache-2.0" ]
null
null
null
domain/types.py
Fenthick/sla_dashboard_webapp
fe7409b916f2c0504dd8fd097a2f6c5ba5f77b60
[ "Apache-2.0" ]
null
null
null
domain/types.py
Fenthick/sla_dashboard_webapp
fe7409b916f2c0504dd8fd097a2f6c5ba5f77b60
[ "Apache-2.0" ]
null
null
null
AgentID = str """ Assigned by Kentik """ TestID = str """ Assigned by Kentik """ Threshold = float """ latency and jitter in milliseconds, packet_loss in percent (0-100) """ MetricValue = float """ latency and jitter in milliseconds, packet_loss in percent (0-100) """
22.666667
74
0.694853
36
272
5.194444
0.527778
0.117647
0.139037
0.203209
0.620321
0.620321
0.620321
0.620321
0.620321
0.620321
0
0.035556
0.172794
272
11
75
24.727273
0.795556
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
7f3d2b8b4112a739904a65fea0ff2ad1a95da449
436
py
Python
apps/index/views.py
PyCN/BlogBackendProject
144ea98d54c624cf93a69816779e4f3483ab80a2
[ "Apache-2.0" ]
335
2018-02-06T11:40:44.000Z
2022-02-01T07:55:24.000Z
apps/index/views.py
PyCN/BlogBackendProject
144ea98d54c624cf93a69816779e4f3483ab80a2
[ "Apache-2.0" ]
18
2018-03-11T05:02:27.000Z
2022-03-11T23:18:34.000Z
apps/index/views.py
PyCN/BlogBackendProject
144ea98d54c624cf93a69816779e4f3483ab80a2
[ "Apache-2.0" ]
83
2018-03-02T03:24:06.000Z
2021-12-15T05:04:09.000Z
from django.shortcuts import render from django.views.generic.base import View from base.models import SiteInfo class IndexView(View): def get(self, request): site_infos = SiteInfo.objects.all().filter(is_live=True)[0] context = { 'site_infos': site_infos } request.session['__access_auth__'] = site_infos.access_password_encrypt return render(request, 'index.html', context)
27.25
79
0.688073
54
436
5.333333
0.648148
0.125
0
0
0
0
0
0
0
0
0
0.002915
0.213303
436
15
80
29.066667
0.836735
0
0
0
0
0
0.080275
0
0
0
0
0
0
1
0.090909
false
0.090909
0.272727
0
0.545455
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
7f3f0078a32cd8c8a54f8ba460ab6988d75e2c0a
1,083
py
Python
projects/eyetracking/pipeline/point.py
nirdslab/streaminghub
a0d9f5f8be0ee6f090bd2b48b9f596695497c2bf
[ "MIT" ]
null
null
null
projects/eyetracking/pipeline/point.py
nirdslab/streaminghub
a0d9f5f8be0ee6f090bd2b48b9f596695497c2bf
[ "MIT" ]
null
null
null
projects/eyetracking/pipeline/point.py
nirdslab/streaminghub
a0d9f5f8be0ee6f090bd2b48b9f596695497c2bf
[ "MIT" ]
1
2020-01-22T15:35:29.000Z
2020-01-22T15:35:29.000Z
#!/usr/bin/env python3 class Point: def __init__(self, x, y, t, err): """ This class represents a gaze point @param x: @param y: @param t: @param err: """ self.error = err self.timestamp = t self.coord = [] self.coord.append(x) self.coord.append(y) def at(self, k): """ index into the coords of this Point @param k: x if 0, y if 1 @return: coordinate """ return self.coord[k] def set(self, x, y): """ set coords @param x: @param y: """ self.coord[0] = x self.coord[1] = y def get_status(self): """ Get error status of point @return: """ return self.error def valid(self): """ a gaze point is valid if it's normalized coordinates are in the range [0,1] and both eyes are present @return: """ if self.error == "None" and \ self.coord[0] > 0 and self.coord[1] > 0 and \ self.coord[0] < 1 and self.coord[1] < 1: return True else: return False def get_timestamp(self): return self.timestamp
17.190476
105
0.554017
161
1,083
3.689441
0.335404
0.151515
0.080808
0.040404
0
0
0
0
0
0
0
0.02027
0.316713
1,083
62
106
17.467742
0.782432
0.333333
0
0
0
0
0.006601
0
0
0
0
0
0
1
0.26087
false
0
0
0.043478
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
1
0
0
0
0
1
0
0
2
7f43ce6b6e7b289e3b10e34448377d7224f38c92
100
py
Python
language/property/_property.py
jedhsu/language
3772a4a0ff287e1fc5ebefc716b8d91928d04c72
[ "MIT" ]
null
null
null
language/property/_property.py
jedhsu/language
3772a4a0ff287e1fc5ebefc716b8d91928d04c72
[ "MIT" ]
null
null
null
language/property/_property.py
jedhsu/language
3772a4a0ff287e1fc5ebefc716b8d91928d04c72
[ "MIT" ]
null
null
null
""" *AbstractProperty* """ __all__ = ["AbstractProperty"] class AbstractProperty: pass
8.333333
30
0.64
6
100
10
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.22
100
11
31
9.090909
0.769231
0.18
0
0
0
0
0.235294
0
0
0
0
0
0
1
0
false
0.333333
0
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
7f58c21eb6b59d103a969d7216c6e17a270b0436
1,773
py
Python
applaud/endpoints/app_prices.py
codinn/applaud
ed168ca67465b5c0acf4ab4f4e285a2ab348c96d
[ "MIT" ]
3
2022-01-22T15:34:13.000Z
2022-03-22T06:46:48.000Z
applaud/endpoints/app_prices.py
codinn/applaud
ed168ca67465b5c0acf4ab4f4e285a2ab348c96d
[ "MIT" ]
1
2022-03-13T17:13:01.000Z
2022-03-16T05:04:51.000Z
applaud/endpoints/app_prices.py
codinn/applaud
ed168ca67465b5c0acf4ab4f4e285a2ab348c96d
[ "MIT" ]
1
2022-03-16T02:17:30.000Z
2022-03-16T02:17:30.000Z
from __future__ import annotations from .base import Endpoint, IDEndpoint, SortOrder, endpoint from ..fields import * from typing import Union from ..schemas.models import * from ..schemas.responses import * from ..schemas.requests import * from ..schemas.enums import * class AppPriceEndpoint(IDEndpoint): path = '/v1/appPrices/{id}' def fields(self, *, app_price: Union[AppPriceField, list[AppPriceField]]=None) -> AppPriceEndpoint: '''Fields to return for included related types. :param app_price: the fields to include for returned resources of type appPrices :type app_price: Union[AppPriceField, list[AppPriceField]] = None :returns: self :rtype: applaud.endpoints.AppPriceEndpoint ''' if app_price: self._set_fields('appPrices',app_price if type(app_price) is list else [app_price]) return self class Include(StringEnum): APP = 'app' PRICE_TIER = 'priceTier' def include(self, relationship: Union[Include, list[Include]]) -> AppPriceEndpoint: '''Relationship data to include in the response. :returns: self :rtype: applaud.endpoints.AppPriceEndpoint ''' if relationship: self._set_includes(relationship if type(relationship) is list else [relationship]) return self def get(self) -> AppPriceResponse: '''Get the resource. :returns: Single AppPrice :rtype: AppPriceResponse :raises: :py:class:`applaud.schemas.responses.ErrorResponse`: if a error reponse returned. :py:class:`requests.RequestException`: if a connection or a HTTP error occurred. ''' json = super()._perform_get() return AppPriceResponse.parse_obj(json)
36.183673
107
0.673999
196
1,773
6
0.403061
0.054422
0.043367
0.044218
0.164966
0.164966
0.164966
0
0
0
0
0.000733
0.230118
1,773
48
108
36.9375
0.860806
0.342358
0
0.090909
0
0
0.037428
0
0
0
0
0
0
1
0.136364
false
0
0.363636
0
0.772727
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
7f74d654a591d5b07d4b9c19b9e78081b8e0a46e
101
py
Python
__init__.py
virtualcharacters/DisVoice
e53e4949a6023694720ba51708ec1646dcc4a667
[ "MIT" ]
191
2017-10-17T14:21:03.000Z
2022-03-31T01:50:48.000Z
__init__.py
virtualcharacters/DisVoice
e53e4949a6023694720ba51708ec1646dcc4a667
[ "MIT" ]
21
2017-08-14T16:06:01.000Z
2022-01-11T17:03:11.000Z
__init__.py
virtualcharacters/DisVoice
e53e4949a6023694720ba51708ec1646dcc4a667
[ "MIT" ]
56
2017-08-09T14:59:30.000Z
2022-03-14T03:56:36.000Z
# -*- coding: utf-8 -*- __all__=['glottal', 'phonation', 'articulation', 'prosody', 'replearning']
20.2
74
0.623762
9
101
6.555556
1
0
0
0
0
0
0
0
0
0
0
0.011236
0.118812
101
5
74
20.2
0.651685
0.207921
0
0
0
0
0.582278
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
7f78bfd72acc65a52af35553e75861dad53cbaac
1,518
py
Python
beam/vendor.py
gebn/beam
b2cd436e02e2665dea4091a37db21bcf7a1251f1
[ "MIT" ]
3
2018-01-31T16:09:08.000Z
2020-03-22T06:46:25.000Z
beam/vendor.py
gebn/beam
b2cd436e02e2665dea4091a37db21bcf7a1251f1
[ "MIT" ]
6
2016-12-12T00:37:56.000Z
2019-07-05T15:22:52.000Z
beam/vendor.py
gebn/beam
b2cd436e02e2665dea4091a37db21bcf7a1251f1
[ "MIT" ]
2
2017-07-02T10:54:17.000Z
2021-02-25T18:03:27.000Z
# -*- coding: utf-8 -*- from __future__ import unicode_literals import six @six.python_2_unicode_compatible class Vendor(object): """ Represents a VPS provider. """ def __init__(self, name, endpoint): """ Initialise a new vendor object. :param name: The name of the vendor, e.g. "RamNode". :param endpoint: The hostname of the SolusVM control panel, with protocol. """ self.name = name """ The vendor's name, e.g. "RamNode". """ self.endpoint = endpoint """ The hostname of the SolusVM control panel, with protocol. """ def __hash__(self): """ Retrieve a hash value for this object. :return: This object's hash. Identical objects will have an identical hash. """ return hash(self.name) def __eq__(self, other): """ Test whether this vendor is identical to another. :param other: The object to compare to this one. :return: True if the objects are identical, false otherwise. """ return isinstance(other, self.__class__) and other.name == self.name def __str__(self): """ Generate a human-readable string representation of this vendor. :return: This host as a friendly string. """ return '{0}({1}, {2})'.format(self.__class__.__name__, self.name, self.endpoint)
28.641509
77
0.561265
172
1,518
4.744186
0.453488
0.04902
0.022059
0.051471
0.134804
0.134804
0.134804
0.134804
0.134804
0.134804
0
0.005
0.341238
1,518
52
78
29.192308
0.811
0.407773
0
0
0
0
0.020968
0
0
0
0
0
0
1
0.266667
false
0
0.133333
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
7f959812ae4c704fd1ecc6236a798d3706edb189
2,008
py
Python
aorta/router/rule.py
ibrb/python-aorta
806d48bfb235f618f39d01cca32921fd46aaaef1
[ "RSA-MD" ]
null
null
null
aorta/router/rule.py
ibrb/python-aorta
806d48bfb235f618f39d01cca32921fd46aaaef1
[ "RSA-MD" ]
null
null
null
aorta/router/rule.py
ibrb/python-aorta
806d48bfb235f618f39d01cca32921fd46aaaef1
[ "RSA-MD" ]
null
null
null
import functools import operator from aorta.router.criterion import Criterion from aorta.router.criterion import NullCriterion from aorta.router.criterion import And class Rule(object): """Specifies a routing rule consisting of one or more :class:`Criterion` instances. """ def __init__(self, destinations, criterions=None, return_to_sender=False, exclude=None): """Initialize a new :class:`Rule`. Args: destinations: a list of :class:`Destination` instances specifying where to deliver the event. criterions: a list of :class:`Criterion` instances. return_to_sender: a boolean indicating if events matched by this rule should also be returned to the sender. exclude: a list of destination where events matched by this rule may never be routed to, for example because security considerations. """ self.destinations = tuple(destinations) self.criterions = functools.reduce(operator.and_, criterions or [NullCriterion()]) self.rts = return_to_sender self.exclude = set(exclude or []) def match(self, dto): """Matches the event contained in the Data Transfer Object (DTO) against all criterions. """ return self.criterions.match(dto) def get_destinations(self): """Return a tuple containing the destinations where the event should be routed to, and not. """ return set(self.destinations), set(self.exclude) def add_criterion(self, element, op, value): """Add a new :class:`Criterion` to the :class:`Rule`. Args: element: identifies the data-element to match on. op: specifies the comparison operator. value: the value to compare against. Returns: None """ self.criterions &= Criterion(element, op, value)
34.033898
92
0.624502
230
2,008
5.395652
0.373913
0.021757
0.036261
0.058018
0.109589
0
0
0
0
0
0
0
0.298805
2,008
58
93
34.62069
0.881392
0.483068
0
0
0
0
0
0
0
0
0
0
0
1
0.235294
false
0
0.294118
0
0.705882
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
7fb50aa2d7f2b1987e2d8d42043543e1eba09ec4
820
py
Python
tests/test_rg.py
sansbacon/nflfantasy
a46ed7702d8cadb1f851e93bdf2325b7cb3801a5
[ "MIT" ]
1
2019-08-08T13:20:52.000Z
2019-08-08T13:20:52.000Z
tests/test_rg.py
sansbacon/nflfantasy
a46ed7702d8cadb1f851e93bdf2325b7cb3801a5
[ "MIT" ]
3
2018-05-15T18:28:03.000Z
2018-10-05T20:12:39.000Z
tests/test_rg.py
sansbacon/nflfantasy
a46ed7702d8cadb1f851e93bdf2325b7cb3801a5
[ "MIT" ]
1
2019-04-26T03:42:01.000Z
2019-04-26T03:42:01.000Z
# tests/test_rg.py import logging import random import sys import unittest from nflfantasy.rotoguru import Scraper, Parser class RotoguruNFL_test(unittest.TestCase): ''' ''' @property def game(self): return random.choice(['dk', 'fd']) @property def season(self): return random.choice(range(2014, 2017)) @property def week(self): return random.choice(range(1, 18)) def setUp(self): self.s = Scraper(cache_name='test-rg-scraper') self.p = Parser() def test_dfs_week(self): content = self.s.dfs_week(self.season, self.week, self.game) results = self.p.dfs_week(content) self.assertIsNotNone(results) if __name__=='__main__': logging.basicConfig(stream=sys.stdout, level=logging.INFO) unittest.main()
20.5
68
0.65122
104
820
4.990385
0.461538
0.061657
0.092486
0.127168
0.104046
0
0
0
0
0
0
0.017296
0.22439
820
39
69
21.025641
0.798742
0.019512
0
0.12
0
0
0.034134
0
0
0
0
0
0.04
1
0.2
false
0
0.2
0.12
0.56
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
f69e2c815a9fde4701c40bad6bd3ce706d5db57a
221
py
Python
pyqt/pyqt5-master/src/web/factorial.py
Ding-zhenke/Dcount-s-notebook
16c29ac7d076c466e053f1b8db4a7f4e43f67a24
[ "MIT" ]
null
null
null
pyqt/pyqt5-master/src/web/factorial.py
Ding-zhenke/Dcount-s-notebook
16c29ac7d076c466e053f1b8db4a7f4e43f67a24
[ "MIT" ]
null
null
null
pyqt/pyqt5-master/src/web/factorial.py
Ding-zhenke/Dcount-s-notebook
16c29ac7d076c466e053f1b8db4a7f4e43f67a24
[ "MIT" ]
2
2019-06-18T05:53:26.000Z
2019-06-19T03:26:02.000Z
from PyQt5.QtCore import * class Factorial(QObject): @pyqtSlot(int, result=int) def factorial(self,n): if n == 0 or n == 1: return 1 else: return self.factorial(n - 1) * n
22.1
44
0.542986
30
221
4
0.633333
0.033333
0
0
0
0
0
0
0
0
0
0.034483
0.343891
221
9
45
24.555556
0.793103
0
0
0
0
0
0
0
0
0
0
0
0
1
0.125
false
0
0.125
0
0.625
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
f6cd30c4e86a7802cc42af79be7f1074b2316a33
1,044
py
Python
bluew/daemon.py
nullp0tr/Bluew
61219535413e09fde3ad2d4ef60a813eba058cca
[ "MIT" ]
17
2017-12-24T00:59:51.000Z
2019-07-27T16:49:40.000Z
bluew/daemon.py
nullp0tr/Bluew
61219535413e09fde3ad2d4ef60a813eba058cca
[ "MIT" ]
18
2018-01-01T08:58:36.000Z
2020-02-29T08:52:16.000Z
bluew/daemon.py
nullp0tr/Bluew
61219535413e09fde3ad2d4ef60a813eba058cca
[ "MIT" ]
3
2018-03-16T06:26:11.000Z
2019-04-16T08:47:49.000Z
""" bluew.daemon ~~~~~~~~~~~~~~~~~ This module provides a Daemon object that tries its best to keep connections alive, and has the ability to reproduce certain steps when a reconnection is needed. :copyright: (c) 2017 by Ahmed Alsharif. :license: MIT, see LICENSE for more details. """ def daemonize(func): """ A function wrapper that checks daemon flags. This wrapper as it is assumes that the calling class has a daemon attribute. """ def _wrapper(self, *args, d_init=False, **kwargs): if d_init: self.daemon.d_init.append((func, self, args, kwargs)) return func(self, *args, **kwargs) return _wrapper class Daemon(object): """The bluew daemon.""" def __init__(self): self.d_init = [] def run_init_funcs(self): """ This function iterates through the functions added to d_init, and runs them in the same order they were added in. """ for func, self_, args, kwargs in self.d_init: func(self_, *args, **kwargs)
25.463415
78
0.637931
144
1,044
4.513889
0.506944
0.046154
0.073846
0.110769
0.073846
0
0
0
0
0
0
0.005128
0.252874
1,044
40
79
26.1
0.828205
0.511494
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.583333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2