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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
81559efb7896381d40fa7301fce245760cfd0566
| 45
|
py
|
Python
|
discorgtts/__init__.py
|
dgnsrekt/discord-gtts-messenger
|
3adb7fb7692cfa1d39bf3d3c0d2a610b6d881f5d
|
[
"MIT"
] | null | null | null |
discorgtts/__init__.py
|
dgnsrekt/discord-gtts-messenger
|
3adb7fb7692cfa1d39bf3d3c0d2a610b6d881f5d
|
[
"MIT"
] | null | null | null |
discorgtts/__init__.py
|
dgnsrekt/discord-gtts-messenger
|
3adb7fb7692cfa1d39bf3d3c0d2a610b6d881f5d
|
[
"MIT"
] | null | null | null |
# from .core import *
# from cli import main
| 15
| 22
| 0.688889
| 7
| 45
| 4.428571
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.222222
| 45
| 2
| 23
| 22.5
| 0.885714
| 0.888889
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
816ee2e06eb483dc8a04aa210839b000cd089466
| 23,974
|
py
|
Python
|
tests/case_management/test_artifact_interface.py
|
Joeyt1008/tcex
|
01114a6579b9a4e51ad2420844e1297799100eb6
|
[
"Apache-2.0"
] | null | null | null |
tests/case_management/test_artifact_interface.py
|
Joeyt1008/tcex
|
01114a6579b9a4e51ad2420844e1297799100eb6
|
[
"Apache-2.0"
] | null | null | null |
tests/case_management/test_artifact_interface.py
|
Joeyt1008/tcex
|
01114a6579b9a4e51ad2420844e1297799100eb6
|
[
"Apache-2.0"
] | null | null | null |
"""Test the TcEx Case Management Module."""
# standard library
import os
import time
from random import randint
# third-party
from dateutil.parser import parse
# first-party
from tcex.case_management.tql import TQL
from .cm_helpers import CMHelper, TestCaseManagement
class TestArtifact(TestCaseManagement):
"""Test TcEx CM Artifact Interface."""
def setup_method(self):
"""Configure setup before all tests."""
self.cm_helper = CMHelper('artifact')
self.cm = self.cm_helper.cm
self.tcex = self.cm_helper.tcex
def teardown_method(self):
"""Configure teardown before all tests."""
if os.getenv('TEARDOWN_METHOD') is None:
self.cm_helper.cleanup()
def test_artifact_api_options(self):
"""Test filter keywords."""
super().obj_api_options()
def test_artifact_code_gen(self):
"""Generate code and docstring from Options methods.
This is not truly a test case, but best place to store it for now.
"""
doc_string, filter_map, filter_class = super().obj_code_gen()
assert doc_string
assert filter_map
print(filter_map)
assert filter_class
def test_artifact_filter_keywords(self):
"""Test filter keywords."""
super().obj_filter_keywords()
def test_artifact_object_properties(self):
"""Test properties."""
super().obj_properties()
def test_artifact_object_properties_extra(self):
"""Test properties."""
super().obj_properties_extra()
def test_artifact_create_by_case_id(self):
"""Test Artifact Creation"""
# create case
case = self.cm_helper.create_case()
# artifact data
artifact_data = {
'case_id': case.id,
'intel_type': 'indicator-ASN',
'summary': f'asn{randint(100, 999)}',
'type': 'ASN',
}
# create artifact
artifact = self.cm.artifact(**artifact_data)
artifact.submit()
# get artifact from API to use in asserts
artifact = self.cm.artifact(id=artifact.id)
artifact.get()
# run assertions on returned data
assert artifact.required_properties # coverage: required_properties
assert artifact.intel_type == artifact_data.get('intel_type')
assert artifact.summary == artifact_data.get('summary')
assert artifact.type == artifact_data.get('type')
assert artifact.field_name is None
def test_artifact_create_by_case_xid(self, request):
"""Test Artifact Creation"""
# create case
case_xid = f'{request.node.name}-{time.time()}'
self.cm_helper.create_case(xid=case_xid)
# artifact data
artifact_data = {
'case_xid': case_xid,
'intel_type': 'indicator-ASN',
'summary': f'asn{randint(100, 999)}',
'type': 'ASN',
}
# create artifact
artifact = self.cm.artifact(**artifact_data)
artifact.submit()
# get single artifact by id
artifact = self.cm.artifact(id=artifact.id)
artifact.get()
# run assertions on returned data
assert artifact.intel_type == artifact_data.get('intel_type')
assert artifact.summary == artifact_data.get('summary')
assert artifact.type == artifact_data.get('type')
def test_artifact_delete_by_id(self):
"""Test Artifact Deletion"""
# create case
case = self.cm_helper.create_case()
# artifact data
artifact_data = {
'case_id': case.id,
'intel_type': 'indicator-ASN',
'summary': f'asn{randint(100, 999)}',
'type': 'ASN',
}
# create artifact
artifact = self.cm.artifact(**artifact_data)
artifact.submit()
# get single artifact by id
artifact = self.cm.artifact(id=artifact.id)
artifact.get()
# delete the artifact
artifact.delete()
# test that artifact is deleted
try:
artifact.get()
assert False
except RuntimeError:
pass
def test_artifact_get_many(self):
"""Test Artifact Get Many"""
# create case
case = self.cm_helper.create_case()
# artifact data
artifact_data = {
'case_id': case.id,
'intel_type': 'indicator-ASN',
'summary': f'asn{randint(100, 999)}',
'type': 'ASN',
}
# create artifact
artifact = self.cm.artifact(**artifact_data)
artifact.submit()
# iterate over all artifact looking for needle
for a in self.cm.artifacts():
if a.summary == artifact_data.get('summary'):
assert artifact.intel_type == artifact_data.get('intel_type')
assert artifact.type == artifact_data.get('type')
break
else:
assert False
def test_artifact_get_single_by_id(self):
"""Test Artifact Get by Id"""
# create case
case = self.cm_helper.create_case()
# artifact data
artifact_data = {
'case_id': case.id,
'intel_type': 'indicator-ASN',
'summary': f'asn{randint(100, 999)}',
'type': 'ASN',
}
# create artifact
artifact = self.cm.artifact(**artifact_data)
artifact.submit()
# get single artifact by id
artifact = self.cm.artifact(id=artifact.id)
artifact.get(params={'result_limit': 10})
# run assertions on returned data
assert str(artifact) # coverage: __str__ method
assert artifact.intel_type == artifact_data.get('intel_type')
assert artifact.summary == artifact_data.get('summary')
assert artifact.type == artifact_data.get('type')
def test_artifact_task_get_single_by_id_properties(self, request):
"""Test Artifact get single attached to task by id"""
case = self.cm_helper.create_case()
# task data
task_data = {
'case_id': case.id,
'description': f'a description from {request.node.name}',
'name': f'name-{request.node.name}',
'workflow_phase': 0,
'workflow_step': 1,
'xid': f'{request.node.name}-{time.time()}',
}
# create task
task = self.cm.task(**task_data)
task.submit()
file_data = (
'RmFpbGVkIHRvIGZpbmQgbGliIGRpcmVjdG9yeSAoWydsaWJfbGF0ZXN0JywgJ2xpYl8yLjcuMTUnXSkuCg=='
)
# task data
artifact_data = {
'task_id': task.id,
'task_xid': task.xid,
'source': 'artifact source',
'file_data': f'{file_data}',
'summary': 'pytest test file artifact',
'type': 'Certificate File',
'note_text': 'artifact note text',
}
# create task
artifact = self.cm.artifact()
# add properties
artifact.task_id = artifact_data.get('task_id')
artifact.task_xid = artifact_data.get('task_xid')
artifact.file_data = artifact_data.get('file_data')
artifact.source = artifact_data.get('source')
artifact.summary = artifact_data.get('summary')
artifact.type = artifact_data.get('type')
# add note
note_data = {'text': artifact_data.get('note_text')}
artifact.add_note(**note_data)
artifact.submit()
# get task from API to use in asserts
artifact = self.cm.artifact(id=artifact.id)
artifact.get(all_available_fields=True)
# run assertions on returned data
assert artifact.case_id == case.id
assert artifact.case_xid == case.xid
assert artifact.file_data == file_data
assert artifact.source == artifact_data.get('source')
assert artifact.summary == artifact_data.get('summary')
assert artifact.task.name == task.name
assert artifact.task_id == task.id
assert artifact.task_xid == task.xid
assert artifact.intel_type is None
assert artifact.type == artifact_data.get('type')
for note in artifact.notes:
if note.text == artifact_data.get('note_text'):
break
assert False, 'Note not found'
# assert read-only data
assert artifact.analytics_priority_level is None
assert artifact.analytics_score is None
assert artifact.analytics_type is None
assert artifact.artifact_type.name == artifact_data.get('type')
try:
parse(artifact.date_added)
except ValueError:
assert False, 'Invalid date added'
assert artifact.parent_case.id == case.id
# test as_entity
assert artifact.as_entity.get('value') == artifact_data.get('summary')
def test_artifact_case_get_single_by_id_properties(self):
"""Test Artifact get single attached to case by id"""
# create case
case = self.cm_helper.create_case()
file_data = (
'RmFpbGVkIHRvIGZpbmQgbGliIGRpcmVjdG9yeSAoWydsaWJfbGF0ZXN0JywgJ2xpYl8yLjcuMTUnXSkuCg=='
)
# task data
artifact_data = {
'case_id': case.id,
'case_xid': case.xid,
'source': 'artifact source',
'file_data': f'{file_data}',
'summary': 'pytest test file artifact',
'type': 'Certificate File',
'note_text': 'artifact note text',
}
# create task
artifact = self.cm.artifact()
# add properties
artifact.case_id = artifact_data.get('case_id')
artifact.case_xid = artifact_data.get('case_xid')
artifact.file_data = artifact_data.get('file_data')
artifact.source = artifact_data.get('source')
artifact.summary = artifact_data.get('summary')
artifact.type = artifact_data.get('type')
# add note
notes = {'data': [{'text': artifact_data.get('note_text')}]}
artifact.notes = notes
artifact.submit()
# get task from API to use in asserts
artifact = self.cm.artifact(id=artifact.id)
artifact.get(all_available_fields=True)
# run assertions on returned data
assert artifact.case_id == artifact_data.get('case_id')
assert artifact.case_xid == artifact_data.get('case_xid')
assert artifact.file_data == file_data
assert artifact.source == artifact_data.get('source')
assert artifact.summary == artifact_data.get('summary')
assert artifact.task is None
assert artifact.task_id is None
assert artifact.task_xid is None
assert artifact.intel_type is None
assert artifact.type == artifact_data.get('type')
for note in artifact.notes:
if note.text == artifact_data.get('note_text'):
break
assert False, 'Note not found'
# assert read-only data
assert artifact.analytics_priority_level is None
assert artifact.analytics_score is None
assert artifact.analytics_type is None
assert artifact.artifact_type.name == artifact_data.get('type')
try:
parse(artifact.date_added)
except ValueError:
assert False, 'Invalid date added'
assert artifact.parent_case.id == case.id
# test as_entity
assert artifact.as_entity.get('value') == artifact_data.get('summary')
def test_artifact_get_by_tql_filter_case_id(self):
"""Test Artifact Get by TQL"""
# create case
case = self.cm_helper.create_case()
# artifact data
artifact_data = {
'case_id': case.id,
'intel_type': 'indicator-ASN',
'summary': f'asn{randint(100, 999)}',
'type': 'ASN',
}
# create artifact
artifact = self.cm.artifact(**artifact_data)
artifact.submit()
# retrieve artifacts using TQL
artifacts = self.cm.artifacts()
artifacts.filter.case_id(TQL.Operator.EQ, case.id)
for artifact in artifacts:
assert artifact.summary == artifact_data.get('summary')
assert artifact.type == artifact_data.get('type')
break
else:
assert False, 'No artifact returned for TQL'
def test_artifact_get_by_note_id_filter(self, request):
"""Test Artifact Get by TQL"""
# create case
case = self.cm_helper.create_case()
# artifact data
artifact_data = {
'case_id': case.id,
'intel_type': 'indicator-ASN',
'summary': f'asn{randint(100, 999)}',
'type': 'ASN',
}
# create artifact
artifact = self.cm.artifact(**artifact_data)
artifact.submit()
note_data = {
'text': f'note for artifact in {request.node.name}',
'artifact_id': artifact.id,
}
# add a note to a artifact
note = self.cm.note(**note_data)
note.submit()
artifacts = self.cm.artifacts()
artifacts.filter.note_id(TQL.Operator.EQ, note.id)
assert len(artifacts) == 1
for artifact in artifacts:
assert artifact.id == note_data.get('artifact_id')
assert artifact.summary == artifact_data.get('summary')
def test_artifact_get_by_has_case_filter_id(self):
"""Test Artifact Get by TQL"""
# create case
case = self.cm_helper.create_case()
# artifact data
artifact_data_1 = {
'case_id': case.id,
'intel_type': 'indicator-ASN',
'summary': f'asn{randint(100, 999)}',
'type': 'ASN',
}
artifact_data_2 = {
'case_id': case.id,
'intel_type': 'indicator-ASN',
'summary': f'asn{randint(100, 999)}',
'type': 'ASN',
}
# create artifact
artifact_1 = self.cm.artifact(**artifact_data_1)
artifact_2 = self.cm.artifact(**artifact_data_2)
artifact_1.submit()
artifact_2.submit()
artifacts = self.cm.artifacts()
artifacts.filter.has_case.id(TQL.Operator.EQ, case.id)
assert len(artifacts) == 2
ids = [artifact_1.id, artifact_2.id]
summaries = [artifact_1.summary, artifact_2.summary]
for artifact in artifacts:
assert artifact.id in ids
assert artifact.summary in summaries
ids.remove(artifact.id)
summaries.remove(artifact.summary)
def test_artifact_get_by_has_note_filter_id(self, request):
"""Test Artifact Get by TQL"""
# create case
case = self.cm_helper.create_case()
# artifact data
artifact_data = {
'case_id': case.id,
'intel_type': 'indicator-ASN',
'summary': f'asn{randint(100, 999)}',
'type': 'ASN',
}
# create artifact
artifact = self.cm.artifact(**artifact_data)
artifact.submit()
note_data = {
'text': f'note for artifact in {request.node.name}',
'artifact_id': artifact.id,
}
# add a note to a artifact
note = self.cm.note(**note_data)
note.submit()
artifacts = self.cm.artifacts()
artifacts.filter.has_note.id(TQL.Operator.EQ, note.id)
assert len(artifacts) == 1
for artifact in artifacts:
assert artifact.id == note_data.get('artifact_id')
assert artifact.summary == artifact_data.get('summary')
def test_artifact_get_by_has_task_filter_id(self, request):
"""Test Artifact Get by TQL"""
# create case
case = self.cm_helper.create_case()
# artifact data
artifact_data = {
'intel_type': 'indicator-ASN',
'summary': f'asn{randint(100, 999)}',
'type': 'ASN',
}
# task data
task_data = {
'case_id': case.id,
'description': f'a description from {request.node.name}',
'name': f'name-{request.node.name}',
}
task = self.cm.task(**task_data)
task.add_artifact(**artifact_data)
task.submit()
task.get(all_available_fields=True)
artifact_id = None
for artifact in task.artifacts:
artifact_id = artifact.id
artifacts = self.cm.artifacts()
artifacts.filter.has_task.id(TQL.Operator.EQ, task.id)
assert len(artifacts) == 1
for artifact in artifacts:
assert artifact.id == artifact_id
assert artifact.summary == artifact_data.get('summary')
# TODO: checking with MJ on what this should be
def test_artifact_get_by_tql_filter_comment_id(self):
"""Test Artifact Get by TQL"""
def test_artifact_get_by_tql_filter_id(self):
"""Test Artifact Get by TQL"""
# create case
case = self.cm_helper.create_case()
# artifact data
artifact_data = {
'case_id': case.id,
'intel_type': 'indicator-ASN',
'summary': f'asn{randint(100, 999)}',
'type': 'ASN',
}
# create artifact
artifact = self.cm.artifact(**artifact_data)
artifact.submit()
# retrieve artifacts using TQL
artifacts = self.cm.artifacts()
artifacts.filter.id(TQL.Operator.EQ, artifact.id)
for artifact in artifacts:
assert artifact.summary == artifact_data.get('summary')
assert artifact.type == artifact_data.get('type')
break
else:
assert False, 'No artifact returned for TQL'
# TODO: this needs some consideration
def test_artifact_get_by_tql_filter_hascase(self):
"""Test Artifact Get by TQL"""
def test_artifact_get_by_tql_filter_source(self):
"""Test Artifact Get by TQL"""
# create case
case = self.cm_helper.create_case()
# artifact data
artifact_data = {
'case_id': case.id,
'intel_type': 'indicator-ASN',
'source': 'pytest',
'summary': f'asn{randint(100, 999)}',
'type': 'ASN',
}
# create artifact
artifact = self.cm.artifact(**artifact_data)
artifact.submit()
# retrieve artifacts using TQL
artifacts = self.cm.artifacts()
artifacts.filter.case_id(TQL.Operator.EQ, case.id)
artifacts.filter.source(TQL.Operator.EQ, artifact_data.get('source'))
for artifact in artifacts:
assert artifact.summary == artifact_data.get('summary')
assert artifact.type == artifact_data.get('type')
break
else:
assert False, 'No artifact returned for TQL'
def test_artifact_get_by_tql_filter_summary(self):
"""Test Artifact Get by TQL"""
# create case
case = self.cm_helper.create_case()
# artifact data
artifact_data = {
'case_id': case.id,
'intel_type': 'indicator-ASN',
'summary': f'asn{randint(100, 999)}',
'type': 'ASN',
}
# create artifact
artifact = self.cm.artifact(**artifact_data)
artifact.submit()
# retrieve artifacts using TQL
artifacts = self.cm.artifacts()
artifacts.filter.case_id(TQL.Operator.EQ, case.id)
artifacts.filter.summary(TQL.Operator.EQ, artifact_data.get('summary'))
for artifact in artifacts:
assert artifact.summary == artifact_data.get('summary')
assert artifact.type == artifact_data.get('type')
break
else:
assert False, 'No artifact returned for TQL'
# TODO: MJ working on this for AD-4631
def test_artifact_get_by_tql_filter_task_id(self, request):
"""Test Artifact Get by TQL"""
# create case
case = self.cm_helper.create_case()
# task data
task_data = {
'case_id': case.id,
'name': f'name-{request.node.name}',
}
# create task
task = self.cm.task(**task_data)
task.submit()
# artifact data
artifact_data = {
# 'case_id': case.id,
'intel_type': 'indicator-ASN',
'summary': f'asn{randint(100, 999)}',
'task_id': task.id,
'type': 'ASN',
}
# create artifact
artifact = self.cm.artifact(**artifact_data)
artifact.submit()
# retrieve artifacts using TQL
artifacts = self.cm.artifacts()
artifacts.filter.case_id(TQL.Operator.EQ, case.id)
artifacts.filter.task_id(TQL.Operator.EQ, task.id)
for artifact in artifacts:
assert artifact.summary == artifact_data.get('summary')
assert artifact.type == artifact_data.get('type')
break
else:
assert False, 'No artifact returned for TQL'
def test_artifact_get_by_tql_filter_type_name(self):
"""Test Artifact Get by TQL"""
# create case
case = self.cm_helper.create_case()
# artifact data
artifact_data = {
'case_id': case.id,
'intel_type': 'indicator-ASN',
'summary': f'asn{randint(100, 999)}',
'type': 'ASN',
}
# create artifact
artifact = self.cm.artifact(**artifact_data)
artifact.submit()
# retrieve artifacts using TQL
artifacts = self.cm.artifacts()
artifacts.filter.case_id(TQL.Operator.EQ, case.id)
artifacts.filter.type_name(TQL.Operator.EQ, artifact_data.get('type'))
assert str(artifacts) # coverage: __str__ method
for artifact in artifacts:
assert artifact.summary == artifact_data.get('summary')
assert artifact.type == artifact_data.get('type')
break
else:
assert False, 'No artifact returned for TQL'
def test_artifact_update_properties(self):
"""Test updating artifacts properties"""
case = self.cm_helper.create_case()
file_data = (
'FmFpbGVkIHRvIGZpbmQgbGliIGRpcmVjdG9yeSAoWydsaWJfbGF0ZXN0JywgJ2xpYl8yLjcuMTUnXSkuCg=='
)
# artifact data initially
artifact_data = {
'case_id': case.id,
'file_data': f'{file_data}',
'summary': f'asn{randint(100, 999)}',
'type': 'Certificate File',
}
# create artifact
artifact = self.cm.artifact(**artifact_data)
artifact.submit()
# artifact data updated
file_data = (
'GmFpbGVkIHRvIGZpbmQgbGliIGRpcmVjdG9yeSAoWydsaWJfbGF0ZXN0JywgJ2xpYl8yLjcuMTUnXSkuCg=='
)
# artifact data
artifact_data = {
'source': 'artifact source',
'file_data': f'{file_data}',
'summary': f'asn{randint(100, 999)}',
}
artifact.source = artifact_data.get('source')
artifact.summary = artifact_data.get('summary')
artifact.file_data = artifact_data.get('file_data')
artifact.submit()
artifact.get(all_available_fields=True)
assert artifact.source == artifact_data.get('source')
assert artifact.summary == artifact_data.get('summary')
assert artifact.file_data == artifact_data.get('file_data')
def test_artifact_get_by_tql_filter_fail_tql(self):
"""Test Artifact Get by TQL"""
# retrieve artifacts using TQL
artifacts = self.cm.artifacts()
artifacts.filter.tql('Invalid TQL')
try:
for artifact in artifacts: # pylint: disable=unused-variable
pass
assert False, 'TQL should have failed'
except Exception:
pass
| 33.067586
| 98
| 0.589222
| 2,709
| 23,974
| 5.033592
| 0.074935
| 0.104723
| 0.070402
| 0.033661
| 0.820109
| 0.798695
| 0.752347
| 0.704019
| 0.680991
| 0.672411
| 0
| 0.00909
| 0.302536
| 23,974
| 724
| 99
| 33.11326
| 0.806411
| 0.117711
| 0
| 0.691023
| 0
| 0
| 0.143069
| 0.022696
| 0
| 0
| 0
| 0.001381
| 0.187891
| 1
| 0.058455
| false
| 0.006263
| 0.012526
| 0
| 0.073069
| 0.002088
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
81bae867e6d1a586512a73590c8ae9ccdeaebda7
| 138
|
py
|
Python
|
src/python/__init__.py
|
gleckler1/pcmdi_metrics
|
5b1c587ba64bb950debffed48b37430817be29e1
|
[
"X11",
"MIT"
] | null | null | null |
src/python/__init__.py
|
gleckler1/pcmdi_metrics
|
5b1c587ba64bb950debffed48b37430817be29e1
|
[
"X11",
"MIT"
] | null | null | null |
src/python/__init__.py
|
gleckler1/pcmdi_metrics
|
5b1c587ba64bb950debffed48b37430817be29e1
|
[
"X11",
"MIT"
] | null | null | null |
# put here the impor calls to expose whatever we want to the user
import io
import pcmdi
from version import __version__ , __git_sha1__
| 23
| 66
| 0.797101
| 23
| 138
| 4.391304
| 0.782609
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.008929
| 0.188406
| 138
| 5
| 67
| 27.6
| 0.892857
| 0.456522
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
81c5dda191199582a38ebfdb0fb9be2057130ed7
| 51
|
py
|
Python
|
AutoAcademicCV/__init__.py
|
german-arroyo-moreno/AutoAcademia
|
3f51eb8b4c6706ed5ccc71bb57bf2d478e7cae17
|
[
"MIT"
] | null | null | null |
AutoAcademicCV/__init__.py
|
german-arroyo-moreno/AutoAcademia
|
3f51eb8b4c6706ed5ccc71bb57bf2d478e7cae17
|
[
"MIT"
] | null | null | null |
AutoAcademicCV/__init__.py
|
german-arroyo-moreno/AutoAcademia
|
3f51eb8b4c6706ed5ccc71bb57bf2d478e7cae17
|
[
"MIT"
] | null | null | null |
from .parser import Parser
from .textfile import *
| 17
| 26
| 0.784314
| 7
| 51
| 5.714286
| 0.571429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.156863
| 51
| 2
| 27
| 25.5
| 0.930233
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
81dddd72f8632bd40970ed0c78bfd02319c4416b
| 65
|
py
|
Python
|
SLpackage/private/pacbio/pythonpkgs/pbcore/lib/python2.7/site-packages/pbcore/chemistry/__init__.py
|
fanglab/6mASCOPE
|
3f1fdcb7693ff152f17623ce549526ec272698b1
|
[
"BSD-3-Clause"
] | 5
|
2022-02-20T07:10:02.000Z
|
2022-03-18T17:47:53.000Z
|
SLpackage/private/pacbio/pythonpkgs/pbcore/lib/python2.7/site-packages/pbcore/chemistry/__init__.py
|
fanglab/6mASCOPE
|
3f1fdcb7693ff152f17623ce549526ec272698b1
|
[
"BSD-3-Clause"
] | null | null | null |
SLpackage/private/pacbio/pythonpkgs/pbcore/lib/python2.7/site-packages/pbcore/chemistry/__init__.py
|
fanglab/6mASCOPE
|
3f1fdcb7693ff152f17623ce549526ec272698b1
|
[
"BSD-3-Clause"
] | null | null | null |
from __future__ import absolute_import
from .chemistry import *
| 16.25
| 38
| 0.830769
| 8
| 65
| 6.125
| 0.625
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.138462
| 65
| 3
| 39
| 21.666667
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
c4b0535cb8d0daf92f4e258657765b4c4424857f
| 58
|
py
|
Python
|
pyEOM/datasets/GSOD.py
|
jonas-eberle/pyEOM
|
0e03af1076573d37a506bdbcb3f532b0c56a1a4c
|
[
"MIT"
] | 15
|
2015-07-25T01:29:23.000Z
|
2020-06-12T00:51:39.000Z
|
pyEOM/datasets/GHCND.py
|
jonas-eberle/pyEOM
|
0e03af1076573d37a506bdbcb3f532b0c56a1a4c
|
[
"MIT"
] | 6
|
2015-07-30T20:49:25.000Z
|
2017-01-24T08:32:30.000Z
|
pyEOM/outputs/__init__.py
|
jonas-eberle/pyEOM
|
0e03af1076573d37a506bdbcb3f532b0c56a1a4c
|
[
"MIT"
] | 7
|
2015-03-05T20:32:30.000Z
|
2021-12-18T16:35:37.000Z
|
__author__ = 'Jonas Eberle <jonas.eberle@eberle-mail.de>'
| 29
| 57
| 0.758621
| 8
| 58
| 5
| 0.625
| 0.55
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.086207
| 58
| 1
| 58
| 58
| 0.754717
| 0
| 0
| 0
| 0
| 0
| 0.724138
| 0.5
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
c4b628f823a7c26c5db53673bd56c93df7d04d62
| 470
|
py
|
Python
|
python3/lib/python3.6/site-packages/tensorflow/_api/v1/compat/v1/train/queue_runner/__init__.py
|
TruongThuyLiem/keras2tensorflow
|
726f2370160701081cb43fbd8b56154c10d7ad63
|
[
"MIT"
] | 3
|
2020-10-12T15:47:01.000Z
|
2022-01-14T19:51:26.000Z
|
python3/lib/python3.6/site-packages/tensorflow/_api/v1/compat/v1/train/queue_runner/__init__.py
|
TruongThuyLiem/keras2tensorflow
|
726f2370160701081cb43fbd8b56154c10d7ad63
|
[
"MIT"
] | null | null | null |
python3/lib/python3.6/site-packages/tensorflow/_api/v1/compat/v1/train/queue_runner/__init__.py
|
TruongThuyLiem/keras2tensorflow
|
726f2370160701081cb43fbd8b56154c10d7ad63
|
[
"MIT"
] | 2
|
2020-08-03T13:02:06.000Z
|
2020-11-04T03:15:44.000Z
|
# This file is MACHINE GENERATED! Do not edit.
# Generated by: tensorflow/python/tools/api/generator/create_python_api.py script.
"""Public API for tf.train.queue_runner namespace.
"""
from __future__ import print_function as _print_function
from tensorflow.python.training.queue_runner import QueueRunner
from tensorflow.python.training.queue_runner import add_queue_runner
from tensorflow.python.training.queue_runner import start_queue_runners
del _print_function
| 36.153846
| 82
| 0.844681
| 67
| 470
| 5.641791
| 0.537313
| 0.145503
| 0.15873
| 0.222222
| 0.357143
| 0.357143
| 0.357143
| 0
| 0
| 0
| 0
| 0
| 0.091489
| 470
| 12
| 83
| 39.166667
| 0.885246
| 0.370213
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.8
| 0
| 0.8
| 0.4
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
c4dacffae0f24a56c98f8f329908bce41ae11465
| 72
|
py
|
Python
|
src/main/python/py_client.py
|
gaurav-singh/grasp-jython
|
1dda5b64927ce1cee0b16ca145a0501e3a5130da
|
[
"Apache-2.0"
] | null | null | null |
src/main/python/py_client.py
|
gaurav-singh/grasp-jython
|
1dda5b64927ce1cee0b16ca145a0501e3a5130da
|
[
"Apache-2.0"
] | null | null | null |
src/main/python/py_client.py
|
gaurav-singh/grasp-jython
|
1dda5b64927ce1cee0b16ca145a0501e3a5130da
|
[
"Apache-2.0"
] | null | null | null |
# Usage of jython library within java code
print('Jython: Hello there!')
| 36
| 42
| 0.763889
| 11
| 72
| 5
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.138889
| 72
| 2
| 43
| 36
| 0.887097
| 0.555556
| 0
| 0
| 0
| 0
| 0.645161
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 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
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
c4e9020278761d638991057c08d0c4c4cb1a9527
| 57
|
py
|
Python
|
EduKTM/AKT/__init__.py
|
fannazya/EduKTM
|
1ff0b32d6744d487bbbb05be03c56f92bd30b3ef
|
[
"Apache-2.0"
] | 53
|
2021-05-01T04:15:54.000Z
|
2022-03-22T07:40:13.000Z
|
EduKTM/AKT/__init__.py
|
fannazya/EduKTM
|
1ff0b32d6744d487bbbb05be03c56f92bd30b3ef
|
[
"Apache-2.0"
] | 21
|
2021-04-20T14:31:22.000Z
|
2022-03-29T06:06:33.000Z
|
EduKTM/AKT/__init__.py
|
fannazya/EduKTM
|
1ff0b32d6744d487bbbb05be03c56f92bd30b3ef
|
[
"Apache-2.0"
] | 28
|
2021-04-20T12:38:31.000Z
|
2022-03-29T07:53:36.000Z
|
# coding: utf-8
# 2021/7/15 @ sone
from .AKT import AKT
| 11.4
| 20
| 0.649123
| 11
| 57
| 3.363636
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.177778
| 0.210526
| 57
| 4
| 21
| 14.25
| 0.644444
| 0.526316
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
c4f0d84cafe5d9dfaadc5e982032c7b8896dc0d5
| 3,434
|
py
|
Python
|
eth/db/accesslog.py
|
ggs134/py-evm
|
5ad87356181b03c14a2452131f50fe8762127c84
|
[
"MIT"
] | 1,641
|
2017-11-24T04:24:22.000Z
|
2022-03-31T14:59:30.000Z
|
eth/db/accesslog.py
|
ggs134/py-evm
|
5ad87356181b03c14a2452131f50fe8762127c84
|
[
"MIT"
] | 1,347
|
2017-11-23T10:37:36.000Z
|
2022-03-20T16:31:44.000Z
|
eth/db/accesslog.py
|
ggs134/py-evm
|
5ad87356181b03c14a2452131f50fe8762127c84
|
[
"MIT"
] | 567
|
2017-11-22T18:03:27.000Z
|
2022-03-28T17:49:08.000Z
|
from contextlib import contextmanager
import logging
from typing import (
Iterator,
FrozenSet,
Set,
)
from eth.abc import (
AtomicWriteBatchAPI,
AtomicDatabaseAPI,
DatabaseAPI,
)
from eth.db.backends.base import (
BaseDB,
)
from eth.db.atomic import (
BaseAtomicDB,
)
class KeyAccessLoggerDB(BaseDB):
"""
Wraps around a database, and tracks all the keys that were read since initialization.
"""
logger = logging.getLogger("eth.db.KeyAccessLoggerDB")
def __init__(self, wrapped_db: DatabaseAPI, log_missing_keys: bool = True) -> None:
"""
:param log_missing_keys: True if a key is added to :attr:`keys_read` even if the
key/value does not exist in the database.
"""
self.wrapped_db = wrapped_db
self._keys_read: Set[bytes] = set()
self._log_missing_keys = log_missing_keys
@property
def keys_read(self) -> FrozenSet[bytes]:
# Make a defensive copy so callers can't modify the list externally
return frozenset(self._keys_read)
def __getitem__(self, key: bytes) -> bytes:
try:
result = self.wrapped_db.__getitem__(key)
except KeyError:
if self._log_missing_keys:
self._keys_read.add(key)
raise
else:
self._keys_read.add(key)
return result
def __setitem__(self, key: bytes, value: bytes) -> None:
self.wrapped_db[key] = value
def __delitem__(self, key: bytes) -> None:
del self.wrapped_db[key]
def _exists(self, key: bytes) -> bool:
does_exist = key in self.wrapped_db
if does_exist or self._log_missing_keys:
self._keys_read.add(key)
return does_exist
class KeyAccessLoggerAtomicDB(BaseAtomicDB):
"""
Wraps around an atomic database, and tracks all the keys that were read since initialization.
"""
logger = logging.getLogger("eth.db.KeyAccessLoggerAtomicDB")
def __init__(self, wrapped_db: AtomicDatabaseAPI, log_missing_keys: bool = True) -> None:
"""
:param log_missing_keys: True if a key is added to :attr:`keys_read` even if the
key/value does not exist in the database.
"""
self.wrapped_db = wrapped_db
self._keys_read: Set[bytes] = set()
self._log_missing_keys = log_missing_keys
@property
def keys_read(self) -> FrozenSet[bytes]:
# Make a defensive copy so callers can't modify the list externally
return frozenset(self._keys_read)
def __getitem__(self, key: bytes) -> bytes:
try:
result = self.wrapped_db.__getitem__(key)
except KeyError:
if self._log_missing_keys:
self._keys_read.add(key)
raise
else:
self._keys_read.add(key)
return result
def __setitem__(self, key: bytes, value: bytes) -> None:
self.wrapped_db[key] = value
def __delitem__(self, key: bytes) -> None:
del self.wrapped_db[key]
def _exists(self, key: bytes) -> bool:
does_exist = key in self.wrapped_db
if does_exist or self._log_missing_keys:
self._keys_read.add(key)
return does_exist
@contextmanager
def atomic_batch(self) -> Iterator[AtomicWriteBatchAPI]:
with self.wrapped_db.atomic_batch() as readable_batch:
yield readable_batch
| 30.122807
| 97
| 0.638323
| 430
| 3,434
| 4.816279
| 0.216279
| 0.065186
| 0.081603
| 0.052149
| 0.759054
| 0.739739
| 0.739739
| 0.739739
| 0.739739
| 0.739739
| 0
| 0
| 0.275772
| 3,434
| 113
| 98
| 30.389381
| 0.83273
| 0.164822
| 0
| 0.641026
| 0
| 0
| 0.019466
| 0.019466
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.076923
| 0.025641
| 0.371795
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
4804d07fbc7354d9408712146e592600d8e0fa49
| 165
|
py
|
Python
|
src/nitpick/style/__init__.py
|
camresp/nitpick
|
c922dcde1c1e650234343e03bb872cac6500e7b1
|
[
"MIT"
] | 251
|
2019-08-06T08:50:01.000Z
|
2022-03-26T13:49:19.000Z
|
src/nitpick/style/__init__.py
|
camresp/nitpick
|
c922dcde1c1e650234343e03bb872cac6500e7b1
|
[
"MIT"
] | 429
|
2019-06-07T09:12:52.000Z
|
2022-03-31T23:29:26.000Z
|
src/nitpick/style/__init__.py
|
camresp/nitpick
|
c922dcde1c1e650234343e03bb872cac6500e7b1
|
[
"MIT"
] | 18
|
2019-08-12T14:16:28.000Z
|
2022-03-15T13:54:26.000Z
|
"""Styles parsing and merging."""
from nitpick.style.cache import parse_cache_option
from nitpick.style.core import Style
__all__ = ("Style", "parse_cache_option")
| 27.5
| 50
| 0.781818
| 23
| 165
| 5.26087
| 0.565217
| 0.181818
| 0.264463
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.10303
| 165
| 5
| 51
| 33
| 0.817568
| 0.163636
| 0
| 0
| 0
| 0
| 0.174242
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
480b46232f24662a12879a626b98ab357af79f30
| 18,199
|
py
|
Python
|
upvote/gae/modules/bit9_api/change_set_test.py
|
cclauss/upvote
|
9d526fec72690cde1575dbd32dacf68cbbab81d1
|
[
"Apache-2.0"
] | null | null | null |
upvote/gae/modules/bit9_api/change_set_test.py
|
cclauss/upvote
|
9d526fec72690cde1575dbd32dacf68cbbab81d1
|
[
"Apache-2.0"
] | null | null | null |
upvote/gae/modules/bit9_api/change_set_test.py
|
cclauss/upvote
|
9d526fec72690cde1575dbd32dacf68cbbab81d1
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2017 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.
"""Tests for RuleChangeSet commitment."""
import datetime
import mock
from google.appengine.ext import deferred
from absl.testing import absltest
from upvote.gae.datastore import test_utils
from upvote.gae.datastore.models import bit9
from upvote.gae.modules.bit9_api import change_set
from upvote.gae.modules.bit9_api import constants as bit9_constants
from upvote.gae.modules.bit9_api import utils
from upvote.gae.modules.bit9_api.api import api
from upvote.gae.shared.common import basetest
from upvote.shared import constants
class WithRetriesTest(basetest.UpvoteTestCase):
def _CreateDecoratedFunc(self, side_effect=None, **decorator_kwargs):
func = mock.MagicMock(side_effect=side_effect)
func.__name__ = 'placeholder' # Needed to keep functools.wraps() happy.
decorator = change_set._WithRetries(**decorator_kwargs)
return decorator(func)
def testImmediateSuccess(self):
decorated = self._CreateDecoratedFunc(side_effect=[123], max_retries=3)
result = decorated()
self.assertEqual(123, result)
self.assertEqual(1, decorated.__wrapped__.call_count)
def testUnexpectedException(self):
decorated = self._CreateDecoratedFunc(
side_effect=[change_set.WaitingForSyncError, NotImplementedError],
max_retries=3)
with self.assertRaises(NotImplementedError):
decorated()
self.assertEqual(2, decorated.__wrapped__.call_count)
def testExhaustRetries(self):
decorated = self._CreateDecoratedFunc(
side_effect=[change_set.WaitingForSyncError] * 4, max_retries=3)
with self.assertRaises(change_set.WaitingForSyncError):
decorated()
self.assertEqual(4, decorated.__wrapped__.call_count)
class CommitBlockableChangeSetTest(basetest.UpvoteTestCase):
def setUp(self):
super(CommitBlockableChangeSetTest, self).setUp()
self.Patch(utils, 'CONTEXT')
self.binary = test_utils.CreateBit9Binary(file_catalog_id='1234')
self.local_rule = test_utils.CreateBit9Rule(self.binary.key, host_id='5678')
self.global_rule = test_utils.CreateBit9Rule(self.binary.key)
def _PatchApiRequests(self, *results):
requests = []
for batch in results:
if isinstance(batch, list):
requests.append([obj.to_raw_dict() for obj in batch])
else:
requests.append(batch.to_raw_dict())
utils.CONTEXT.ExecuteRequest.side_effect = requests
def testWhitelist_LocalRule_Fulfilled(self):
change = test_utils.CreateRuleChangeSet(
self.binary.key,
rule_keys=[self.local_rule.key],
change_type=constants.RULE_POLICY.WHITELIST)
fi = api.FileInstance(
id=9012,
file_catalog_id=int(self.binary.file_catalog_id),
computer_id=int(self.local_rule.host_id),
local_state=bit9_constants.APPROVAL_STATE.UNAPPROVED)
self._PatchApiRequests([fi], fi)
change_set.CommitBlockableChangeSet(self.binary.key)
utils.CONTEXT.ExecuteRequest.assert_has_calls([
mock.call(
'GET', api_route='fileInstance',
query_args=[r'q=computerId:5678', 'q=fileCatalogId:1234']),
mock.call(
'POST', api_route='fileInstance',
data={'id': 9012,
'localState': 2,
'fileCatalogId': 1234,
'computerId': 5678},
query_args=None)])
self.assertTrue(self.local_rule.key.get().is_fulfilled)
self.assertTrue(self.local_rule.key.get().is_committed)
self.assertIsNone(change.key.get())
def testWhitelist_LocalRule_NotFulfilled(self):
change = test_utils.CreateRuleChangeSet(
self.binary.key,
rule_keys=[self.local_rule.key],
change_type=constants.RULE_POLICY.WHITELIST)
computer = api.Computer(id=5678, sync_percent=100)
computer.last_poll_date = datetime.datetime.utcnow()
self._PatchApiRequests([], computer)
change_set.CommitBlockableChangeSet(self.binary.key)
utils.CONTEXT.ExecuteRequest.assert_has_calls([
mock.call(
'GET', api_route='fileInstance',
query_args=[r'q=computerId:5678', 'q=fileCatalogId:1234'])])
self.assertIsNotNone(self.local_rule.key.get().is_fulfilled)
self.assertFalse(self.local_rule.key.get().is_fulfilled)
self.assertTrue(self.local_rule.key.get().is_committed)
self.assertIsNone(change.key.get())
def testWhitelist_LocalRule_Certificate(self):
cert = test_utils.CreateBit9Certificate()
local_rule = test_utils.CreateBit9Rule(cert.key, host_id='5678')
change = test_utils.CreateRuleChangeSet(
cert.key,
rule_keys=[local_rule.key],
change_type=constants.RULE_POLICY.WHITELIST)
change_set.CommitBlockableChangeSet(cert.key)
self.assertIsNotNone(self.local_rule.key.get().is_fulfilled)
self.assertFalse(local_rule.key.get().is_fulfilled)
self.assertTrue(local_rule.key.get().is_committed)
self.assertIsNone(change.key.get())
def testWhitelist_GlobalRule(self):
change = test_utils.CreateRuleChangeSet(
self.binary.key,
rule_keys=[self.global_rule.key],
change_type=constants.RULE_POLICY.WHITELIST)
self._PatchApiRequests(api.Computer(id=5678))
change_set.CommitBlockableChangeSet(self.binary.key)
utils.CONTEXT.ExecuteRequest.assert_has_calls([
mock.call(
'POST', api_route='fileRule',
data={'fileCatalogId': 1234, 'fileState': 2}, query_args=None)])
self.assertTrue(self.global_rule.key.get().is_committed)
self.assertIsNone(change.key.get())
def testWhitelist_GlobalRule_Certificate(self):
cert = test_utils.CreateBit9Certificate(id='1a2b')
global_rule = test_utils.CreateBit9Rule(cert.key, host_id='')
change = test_utils.CreateRuleChangeSet(
cert.key,
rule_keys=[global_rule.key],
change_type=constants.RULE_POLICY.WHITELIST)
api_cert = api.Certificate(id=9012, thumbprint='1a2b', certificate_state=1)
self._PatchApiRequests([api_cert], api_cert)
change_set.CommitBlockableChangeSet(cert.key)
utils.CONTEXT.ExecuteRequest.assert_has_calls([
mock.call(
'GET', api_route='certificate',
query_args=['q=thumbprint:1a2b']),
mock.call(
'POST', api_route='certificate',
data={'id': 9012, 'thumbprint': '1a2b', 'certificateState': 2},
query_args=None)])
self.assertTrue(global_rule.key.get().is_committed)
self.assertIsNone(change.key.get())
def testWhitelist_MixedRules(self):
other_local_rule = test_utils.CreateBit9Rule(
self.binary.key, host_id='9012')
change = test_utils.CreateRuleChangeSet(
self.binary.key,
rule_keys=[
self.local_rule.key, other_local_rule.key, self.global_rule.key],
change_type=constants.RULE_POLICY.WHITELIST)
fi1 = api.FileInstance(
id=9012,
file_catalog_id=int(self.binary.file_catalog_id),
computer_id=int(self.local_rule.host_id),
local_state=bit9_constants.APPROVAL_STATE.UNAPPROVED)
fi2 = api.FileInstance(
id=9012,
file_catalog_id=int(self.binary.file_catalog_id),
computer_id=9012,
local_state=bit9_constants.APPROVAL_STATE.UNAPPROVED)
rule = api.FileRule(
file_catalog_id=1234, file_state=bit9_constants.APPROVAL_STATE.APPROVED)
self._PatchApiRequests([fi1], fi1, [fi2], fi2, rule)
change_set.CommitBlockableChangeSet(self.binary.key)
utils.CONTEXT.ExecuteRequest.assert_has_calls([
mock.call(
'GET', api_route='fileInstance',
query_args=[r'q=computerId:5678', 'q=fileCatalogId:1234']),
mock.call(
'POST', api_route='fileInstance',
data={'id': 9012,
'localState': 2,
'fileCatalogId': 1234,
'computerId': 5678},
query_args=None),
mock.call(
'GET', api_route='fileInstance',
query_args=[r'q=computerId:9012', 'q=fileCatalogId:1234']),
mock.call(
'POST', api_route='fileInstance',
data={'id': 9012,
'localState': 2,
'fileCatalogId': 1234,
'computerId': 9012},
query_args=None),
mock.call(
'POST', api_route='fileRule',
data={'fileCatalogId': 1234, 'fileState': 2}, query_args=None),
])
self.assertTrue(self.local_rule.key.get().is_fulfilled)
self.assertTrue(self.local_rule.key.get().is_committed)
self.assertTrue(other_local_rule.key.get().is_fulfilled)
self.assertTrue(other_local_rule.key.get().is_committed)
self.assertTrue(self.global_rule.key.get().is_committed)
self.assertIsNone(change.key.get())
def testBlacklist_GlobalRule(self):
change = test_utils.CreateRuleChangeSet(
self.binary.key,
rule_keys=[self.global_rule.key],
change_type=constants.RULE_POLICY.BLACKLIST)
rule = api.FileRule(
file_catalog_id=1234,
file_state=bit9_constants.APPROVAL_STATE.UNAPPROVED)
self._PatchApiRequests(rule)
change_set.CommitBlockableChangeSet(self.binary.key)
utils.CONTEXT.ExecuteRequest.assert_has_calls([
mock.call(
'POST', api_route='fileRule',
data={'fileCatalogId': 1234, 'fileState': 3}, query_args=None)])
self.assertTrue(self.global_rule.key.get().is_committed)
self.assertIsNone(change.key.get())
def testBlacklist_GlobalRule_Multiple(self):
other_global_rule = test_utils.CreateBit9Rule(self.binary.key)
test_utils.CreateRuleChangeSet(
self.binary.key,
rule_keys=[self.global_rule.key, other_global_rule.key],
change_type=constants.RULE_POLICY.BLACKLIST)
with self.assertRaises(deferred.PermanentTaskFailure):
change_set.CommitBlockableChangeSet(self.binary.key)
def testBlacklist_MixedRules(self):
test_utils.CreateRuleChangeSet(
self.binary.key,
rule_keys=[self.local_rule.key, self.global_rule.key],
change_type=constants.RULE_POLICY.BLACKLIST)
with self.assertRaises(deferred.PermanentTaskFailure):
change_set.CommitBlockableChangeSet(self.binary.key)
def testRemove_MixedRules(self):
other_local_rule = test_utils.CreateBit9Rule(
self.binary.key, host_id='9012')
change = test_utils.CreateRuleChangeSet(
self.binary.key,
rule_keys=[
self.local_rule.key, other_local_rule.key, self.global_rule.key],
change_type=constants.RULE_POLICY.REMOVE)
fi1 = api.FileInstance(
id=9012,
file_catalog_id=int(self.binary.file_catalog_id),
computer_id=int(self.local_rule.host_id),
local_state=bit9_constants.APPROVAL_STATE.APPROVED)
fi2 = api.FileInstance(
id=9012,
file_catalog_id=int(self.binary.file_catalog_id),
computer_id=int(other_local_rule.host_id),
local_state=bit9_constants.APPROVAL_STATE.APPROVED)
rule = api.FileRule(
file_catalog_id=1234, file_state=bit9_constants.APPROVAL_STATE.APPROVED)
self._PatchApiRequests([fi1], fi1, [fi2], fi2, rule)
change_set.CommitBlockableChangeSet(self.binary.key)
utils.CONTEXT.ExecuteRequest.assert_has_calls([
mock.call(
'GET', api_route='fileInstance',
query_args=[r'q=computerId:5678', 'q=fileCatalogId:1234']),
mock.call(
'POST', api_route='fileInstance',
data={'id': 9012,
'localState': 1,
'fileCatalogId': 1234,
'computerId': 5678},
query_args=None),
mock.call(
'GET', api_route='fileInstance',
query_args=[r'q=computerId:9012', 'q=fileCatalogId:1234']),
mock.call(
'POST', api_route='fileInstance',
data={'id': 9012,
'localState': 1,
'fileCatalogId': 1234,
'computerId': 9012},
query_args=None),
mock.call(
'POST', api_route='fileRule',
data={'fileCatalogId': 1234, 'fileState': 1}, query_args=None),
])
self.assertTrue(self.local_rule.key.get().is_fulfilled)
self.assertTrue(self.local_rule.key.get().is_committed)
self.assertTrue(other_local_rule.key.get().is_fulfilled)
self.assertTrue(other_local_rule.key.get().is_committed)
self.assertTrue(self.global_rule.key.get().is_committed)
self.assertIsNone(change.key.get())
def testTailDefer(self):
test_utils.CreateRuleChangeSet(
self.binary.key,
rule_keys=[self.local_rule.key],
change_type=constants.RULE_POLICY.WHITELIST)
test_utils.CreateRuleChangeSet(
self.binary.key,
rule_keys=[self.global_rule.key],
change_type=constants.RULE_POLICY.WHITELIST)
with mock.patch.object(change_set, '_Whitelist'):
change_set.CommitBlockableChangeSet(self.binary.key)
# Tail defer should have been added.
self.assertTaskCount(constants.TASK_QUEUE.BIT9_COMMIT_CHANGE, 1)
# Only the local rule should have been committed first.
self.assertTrue(self.local_rule.key.get().is_committed)
self.assertFalse(self.global_rule.key.get().is_committed)
self.assertEntityCount(bit9.RuleChangeSet, 1)
# Run the deferred commit attempt.
self.RunDeferredTasks(constants.TASK_QUEUE.BIT9_COMMIT_CHANGE)
# Tail defer should not have been added as there are no more changes.
self.assertTaskCount(constants.TASK_QUEUE.BIT9_COMMIT_CHANGE, 0)
# Both rules should now have been committed.
self.assertTrue(self.local_rule.key.get().is_committed)
self.assertTrue(self.global_rule.key.get().is_committed)
self.assertEntityCount(bit9.RuleChangeSet, 0)
def testNoChange(self):
with mock.patch.object(change_set, 'CommitChangeSet') as mock_commit:
change_set.CommitBlockableChangeSet(self.binary.key)
self.assertFalse(mock_commit.called)
def testFailure_ExceedRetryLimit(self):
test_utils.CreateRuleChangeSet(
self.binary.key,
rule_keys=[self.local_rule.key],
change_type=constants.RULE_POLICY.WHITELIST)
computer = api.Computer(id=5678, sync_percent=90)
computer.last_poll_date = datetime.datetime.utcnow()
self._PatchApiRequests(
[], computer, [], computer, [], computer, [], computer)
with self.assertRaises(deferred.PermanentTaskFailure):
change_set.CommitBlockableChangeSet(self.binary.key)
def testFailure_RetryAndSucceed(self):
test_utils.CreateRuleChangeSet(
self.binary.key,
rule_keys=[self.local_rule.key],
change_type=constants.RULE_POLICY.WHITELIST)
fi = api.FileInstance(
id=9012,
file_catalog_id=int(self.binary.file_catalog_id),
computer_id=int(self.local_rule.host_id),
local_state=bit9_constants.APPROVAL_STATE.UNAPPROVED)
computer = api.Computer(id=5678, sync_percent=90)
computer.last_poll_date = datetime.datetime.utcnow()
self._PatchApiRequests([], computer, [], computer, [], computer, [fi], fi)
change_set.CommitBlockableChangeSet(self.binary.key)
expected_call = mock.call(
'POST', api_route='fileInstance',
data={'id': 9012,
'localState': 2,
'fileCatalogId': 1234,
'computerId': 5678},
query_args=None)
self.assertTrue(expected_call in utils.CONTEXT.ExecuteRequest.mock_calls)
class DeferCommitTest(basetest.UpvoteTestCase):
def setUp(self):
super(DeferCommitTest, self).setUp()
self.binary = test_utils.CreateBit9Binary(file_catalog_id='1234')
self.local_rule = test_utils.CreateBit9Rule(self.binary.key, host_id='5678')
self.change = test_utils.CreateRuleChangeSet(
self.binary.key,
rule_keys=[self.local_rule.key],
change_type=constants.RULE_POLICY.WHITELIST)
def testDeferCommitBlockableChangeSet_TailDefer_MoreChanges(self):
test_utils.CreateRuleChangeSet(
self.binary.key,
rule_keys=[self.local_rule.key],
change_type=constants.RULE_POLICY.BLACKLIST)
with mock.patch.object(change_set, 'CommitChangeSet') as mock_commit:
change_set.DeferCommitBlockableChangeSet(self.binary.key)
self.assertTaskCount(constants.TASK_QUEUE.BIT9_COMMIT_CHANGE, 1)
self.RunDeferredTasks(constants.TASK_QUEUE.BIT9_COMMIT_CHANGE)
# Tail defer task for remaining change.
self.assertTaskCount(constants.TASK_QUEUE.BIT9_COMMIT_CHANGE, 1)
mock_commit.assert_called_once_with(self.change.key)
def testDeferCommitBlockableChangeSet_TailDefer_NoMoreChanges(self):
with mock.patch.object(change_set, 'CommitChangeSet') as mock_commit:
change_set.DeferCommitBlockableChangeSet(self.binary.key)
self.assertTaskCount(constants.TASK_QUEUE.BIT9_COMMIT_CHANGE, 1)
self.RunDeferredTasks(constants.TASK_QUEUE.BIT9_COMMIT_CHANGE)
self.assertTaskCount(constants.TASK_QUEUE.BIT9_COMMIT_CHANGE, 0)
mock_commit.assert_called_once_with(self.change.key)
def testDeferCommitBlockableChangeSet_NoTailDefer(self):
with mock.patch.object(change_set, 'CommitChangeSet') as mock_commit:
change_set.DeferCommitBlockableChangeSet(
self.binary.key, tail_defer=False)
self.assertTaskCount(constants.TASK_QUEUE.BIT9_COMMIT_CHANGE, 1)
self.RunDeferredTasks(constants.TASK_QUEUE.BIT9_COMMIT_CHANGE)
self.assertTaskCount(constants.TASK_QUEUE.BIT9_COMMIT_CHANGE, 0)
mock_commit.assert_called_once_with(self.change.key)
if __name__ == '__main__':
absltest.main()
| 37.60124
| 80
| 0.702456
| 2,134
| 18,199
| 5.763824
| 0.127929
| 0.026748
| 0.036992
| 0.02439
| 0.799024
| 0.784228
| 0.747642
| 0.735854
| 0.702195
| 0.667561
| 0
| 0.022949
| 0.188307
| 18,199
| 483
| 81
| 37.679089
| 0.809708
| 0.050387
| 0
| 0.694595
| 0
| 0
| 0.055861
| 0
| 0
| 0
| 0
| 0
| 0.172973
| 1
| 0.064865
| false
| 0
| 0.032432
| 0
| 0.108108
| 0.008108
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
4839084044145689ce4fde40bb5ba3d8a163ebf3
| 65
|
py
|
Python
|
politenessr/__init__.py
|
wujunjie1998/Politenessr
|
da1426fe93b67db73a61b3a87bd5b0d214a688a6
|
[
"MIT"
] | null | null | null |
politenessr/__init__.py
|
wujunjie1998/Politenessr
|
da1426fe93b67db73a61b3a87bd5b0d214a688a6
|
[
"MIT"
] | null | null | null |
politenessr/__init__.py
|
wujunjie1998/Politenessr
|
da1426fe93b67db73a61b3a87bd5b0d214a688a6
|
[
"MIT"
] | 1
|
2021-12-19T12:54:47.000Z
|
2021-12-19T12:54:47.000Z
|
from .politenessr import Politenessr
from .predict import predict
| 32.5
| 36
| 0.861538
| 8
| 65
| 7
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.107692
| 65
| 2
| 37
| 32.5
| 0.965517
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
4863ad2771dc4b2023a69bc2b03996f5ce2aa96f
| 196
|
py
|
Python
|
Validation/HGCalValidation/python/HGCalValidator_cff.py
|
NTrevisani/cmssw
|
a212a27526f34eb9507cf8b875c93896e6544781
|
[
"Apache-2.0"
] | 3
|
2018-08-24T19:10:26.000Z
|
2019-02-19T11:45:32.000Z
|
Validation/HGCalValidation/python/HGCalValidator_cff.py
|
NTrevisani/cmssw
|
a212a27526f34eb9507cf8b875c93896e6544781
|
[
"Apache-2.0"
] | 8
|
2020-03-20T23:18:36.000Z
|
2020-05-27T11:00:06.000Z
|
Validation/HGCalValidation/python/HGCalValidator_cff.py
|
NTrevisani/cmssw
|
a212a27526f34eb9507cf8b875c93896e6544781
|
[
"Apache-2.0"
] | 5
|
2018-08-21T16:37:52.000Z
|
2020-01-09T13:33:17.000Z
|
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQM_cfg import *
DQMStore.collateHistograms = cms.untracked.bool(True)
from Validation.HGCalValidation.HGCalValidator_cfi import *
| 28
| 59
| 0.841837
| 24
| 196
| 6.791667
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.086735
| 196
| 6
| 60
| 32.666667
| 0.910615
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.75
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
486f4f8e8b730335980f96ad770d4d98174e543b
| 118
|
py
|
Python
|
variables/job_config.py
|
ayustae/k8s-airflow
|
9fe666bc354269a69f5a9b834678120612391c4d
|
[
"BSD-3-Clause"
] | null | null | null |
variables/job_config.py
|
ayustae/k8s-airflow
|
9fe666bc354269a69f5a9b834678120612391c4d
|
[
"BSD-3-Clause"
] | null | null | null |
variables/job_config.py
|
ayustae/k8s-airflow
|
9fe666bc354269a69f5a9b834678120612391c4d
|
[
"BSD-3-Clause"
] | null | null | null |
{
"name": "train-nn",
"s3_path": "s3://tht-spark/executables/SDG_Data_Technologies_Model.py",
"executors": 2,
}
| 19.666667
| 73
| 0.661017
| 16
| 118
| 4.625
| 0.9375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.028846
| 0.118644
| 118
| 5
| 74
| 23.6
| 0.682692
| 0
| 0
| 0
| 0
| 0
| 0.720339
| 0.483051
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
6faa7496e689e3e9b9a8d22d05cf80ea6dede3f0
| 170
|
py
|
Python
|
hcap/settings/prod/secrets.py
|
fabiommendes/capacidade_hospitalar
|
4f675b574573eb3f51e6be8a927ea230bf2712c7
|
[
"MIT"
] | null | null | null |
hcap/settings/prod/secrets.py
|
fabiommendes/capacidade_hospitalar
|
4f675b574573eb3f51e6be8a927ea230bf2712c7
|
[
"MIT"
] | 31
|
2020-04-11T13:38:17.000Z
|
2021-09-22T18:51:11.000Z
|
hcap/settings/prod/secrets.py
|
fabiommendes/capacidade_hospitalar
|
4f675b574573eb3f51e6be8a927ea230bf2712c7
|
[
"MIT"
] | 1
|
2020-04-12T17:51:20.000Z
|
2020-04-12T17:51:20.000Z
|
"""
django:
https://docs.djangoproject.com/en/3.0/ref/settings/#secret-key
"""
from hcap.settings.env import env
SECRET_KEY = env("SECRET_KEY", default="changeme")
| 18.888889
| 66
| 0.711765
| 25
| 170
| 4.76
| 0.72
| 0.226891
| 0.201681
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.013158
| 0.105882
| 170
| 8
| 67
| 21.25
| 0.769737
| 0.435294
| 0
| 0
| 0
| 0
| 0.204545
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
6fb66d93f98ef078cc39ac74d47ed385c511e384
| 130
|
py
|
Python
|
zoo/policies/keep_lane_policy.py
|
HONGcalmJIN/SMARTS
|
0e2249a3bc985ee9279512d6154ce32732065835
|
[
"MIT"
] | null | null | null |
zoo/policies/keep_lane_policy.py
|
HONGcalmJIN/SMARTS
|
0e2249a3bc985ee9279512d6154ce32732065835
|
[
"MIT"
] | null | null | null |
zoo/policies/keep_lane_policy.py
|
HONGcalmJIN/SMARTS
|
0e2249a3bc985ee9279512d6154ce32732065835
|
[
"MIT"
] | 1
|
2022-03-31T02:14:09.000Z
|
2022-03-31T02:14:09.000Z
|
from smarts.core.agent import AgentPolicy
class KeepLanePolicy(AgentPolicy):
def act(self, obs):
return "keep_lane"
| 18.571429
| 41
| 0.723077
| 16
| 130
| 5.8125
| 0.9375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.192308
| 130
| 6
| 42
| 21.666667
| 0.885714
| 0
| 0
| 0
| 0
| 0
| 0.069231
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0.25
| 1
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
6fd0248aef83f23c15c72e14597a8220a4e2c632
| 158
|
py
|
Python
|
tests/_bootstrap_.py
|
hesapadim/python-websocket-server
|
5ca9235d5d9a609910f6ae48341f4a4879cfca28
|
[
"MIT"
] | null | null | null |
tests/_bootstrap_.py
|
hesapadim/python-websocket-server
|
5ca9235d5d9a609910f6ae48341f4a4879cfca28
|
[
"MIT"
] | null | null | null |
tests/_bootstrap_.py
|
hesapadim/python-websocket-server
|
5ca9235d5d9a609910f6ae48341f4a4879cfca28
|
[
"MIT"
] | null | null | null |
#Bootstrap
import sys, os
if os.getcwd().endswith('tests'):
sys.path.insert(0, '..')
elif os.getcwd().endswith('websocket-server'):
sys.path.insert(0, '.')
| 22.571429
| 46
| 0.670886
| 23
| 158
| 4.608696
| 0.608696
| 0.150943
| 0.301887
| 0.264151
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.013889
| 0.088608
| 158
| 6
| 47
| 26.333333
| 0.722222
| 0.056962
| 0
| 0
| 0
| 0
| 0.162162
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.2
| 0
| 0.2
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
6fd3bcf80dd8c61f5acf537546cbcd6db8a84e58
| 2,826
|
py
|
Python
|
test/test_flask_urls.py
|
jboegeholz/flask_urls
|
382fcf7763a3aa35c6e395e308546589318679d8
|
[
"MIT"
] | 1
|
2021-06-21T15:18:51.000Z
|
2021-06-21T15:18:51.000Z
|
test/test_flask_urls.py
|
jboegeholz/flask_urls
|
382fcf7763a3aa35c6e395e308546589318679d8
|
[
"MIT"
] | null | null | null |
test/test_flask_urls.py
|
jboegeholz/flask_urls
|
382fcf7763a3aa35c6e395e308546589318679d8
|
[
"MIT"
] | 1
|
2021-09-25T15:29:45.000Z
|
2021-09-25T15:29:45.000Z
|
import unittest
from test.testapp.application import create_app
class FlaskUrlsTest(unittest.TestCase):
def setUp(self):
# creates testapp under test
self.test_app = create_app().test_client()
self.test_app.testing = True
def tearDown(self):
pass
def test_root(self):
from flask_url_mapping import FlaskUrls
from test.testapp import views
urls = [
("/", views.index, ["GET"]),
]
flask_urls = FlaskUrls(self.test_app.application)
flask_urls.register_urls(urls)
result = self.test_app.get('/')
self.assertEqual(result.status_code, 200)
def test_users(self):
from flask_url_mapping import FlaskUrls
from test.testapp import views
urls = [
("/users", views.get_users, ["GET"]),
]
flask_urls = FlaskUrls(self.test_app.application)
flask_urls.register_urls(urls)
result = self.test_app.get('/users')
self.assertEqual(result.status_code, 200)
def test_home_index(self):
from flask_url_mapping import FlaskUrls
urls = [
("/home", "home.urls")
]
flask_urls = FlaskUrls(self.test_app.application)
flask_urls.register_urls(urls)
result = self.test_app.get('/home/home_index')
self.assertEqual(result.status_code, 200)
def test_home_users(self):
from flask_url_mapping import FlaskUrls
urls = [
("/home", "home.urls")
]
flask_urls = FlaskUrls(self.test_app.application)
flask_urls.register_urls(urls)
result = self.test_app.get('/home/home_users')
self.assertEqual(result.status_code, 200)
def test_without_http_method(self):
from flask_url_mapping import FlaskUrls
from test.testapp import views
urls = [
("/", views.index),
]
flask_urls = FlaskUrls(self.test_app.application)
flask_urls.register_urls(urls)
result = self.test_app.get('/')
self.assertEqual(result.status_code, 200)
def test_wrong_mapping_format_no_endpoint(self):
from flask_url_mapping import FlaskUrls
urls = [
"/"
]
with self.assertRaises(Exception) as context:
flask_urls = FlaskUrls(self.test_app.application)
flask_urls.register_urls(urls)
self.assertTrue('Wrong mapping format!' in str(context.exception))
def test_templates(self):
from flask_url_mapping import FlaskUrls
urls = [
("/home", "home.urls")
]
flask_urls = FlaskUrls(self.test_app.application)
flask_urls.register_urls(urls)
result = self.test_app.get('/home/home_html')
self.assertEqual(result.status_code, 200)
| 32.113636
| 74
| 0.625619
| 330
| 2,826
| 5.121212
| 0.166667
| 0.071006
| 0.097633
| 0.066272
| 0.769231
| 0.769231
| 0.749112
| 0.749112
| 0.718343
| 0.634911
| 0
| 0.00878
| 0.274593
| 2,826
| 87
| 75
| 32.482759
| 0.81561
| 0.0092
| 0
| 0.567568
| 0
| 0
| 0.047551
| 0
| 0
| 0
| 0
| 0
| 0.108108
| 1
| 0.121622
| false
| 0.013514
| 0.162162
| 0
| 0.297297
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
6ff5597f25a09bb020e26591d3bd75a286576583
| 21
|
py
|
Python
|
sales.py
|
monkeyhjy/HjyOwn
|
c2d387d701066a5f45e108fd314179c5c54272f7
|
[
"MIT"
] | null | null | null |
sales.py
|
monkeyhjy/HjyOwn
|
c2d387d701066a5f45e108fd314179c5c54272f7
|
[
"MIT"
] | null | null | null |
sales.py
|
monkeyhjy/HjyOwn
|
c2d387d701066a5f45e108fd314179c5c54272f7
|
[
"MIT"
] | null | null | null |
# This is the sales.
| 10.5
| 20
| 0.666667
| 4
| 21
| 3.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.238095
| 21
| 1
| 21
| 21
| 0.875
| 0.857143
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
6ffcbe91319155b55b6256e004768f1719661ea7
| 455
|
py
|
Python
|
deep_utils/vision/face_detection/ultralight/torch/config.py
|
dornasabet/deep_utils
|
be61b36ea5b3219831e9f2a364fbd4a63858abed
|
[
"MIT"
] | null | null | null |
deep_utils/vision/face_detection/ultralight/torch/config.py
|
dornasabet/deep_utils
|
be61b36ea5b3219831e9f2a364fbd4a63858abed
|
[
"MIT"
] | null | null | null |
deep_utils/vision/face_detection/ultralight/torch/config.py
|
dornasabet/deep_utils
|
be61b36ea5b3219831e9f2a364fbd4a63858abed
|
[
"MIT"
] | null | null | null |
class Config:
device = 'cpu'
RBF_url = "https://github.com/Practical-AI/deep_utils/releases/download/0.2.0/version-RFB-320.pth"
RBF_cache = 'weights/vision/face_detection/ultra-light/torch/RBF/version-RFB-320.pth'
RBF = None
slim_url = "https://github.com/Practical-AI/deep_utils/releases/download/0.2.0/version-slim-320.pth"
slim_cache = 'weights/vision/face_detection/ultra-light/torch/slim/version-slim-320.pth'
slim = None
| 50.555556
| 104
| 0.734066
| 72
| 455
| 4.527778
| 0.430556
| 0.07362
| 0.08589
| 0.104294
| 0.871166
| 0.668712
| 0.668712
| 0.668712
| 0.386503
| 0.386503
| 0
| 0.044554
| 0.112088
| 455
| 8
| 105
| 56.875
| 0.762376
| 0
| 0
| 0
| 0
| 0.5
| 0.703297
| 0.316484
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
d203649caca07bc3537b50dd55e80808e61413b3
| 413
|
py
|
Python
|
pytfe/__init__.py
|
guamum/tfp
|
98a8f27bdd81a94944a4a829b72052245461d6d0
|
[
"MIT"
] | null | null | null |
pytfe/__init__.py
|
guamum/tfp
|
98a8f27bdd81a94944a4a829b72052245461d6d0
|
[
"MIT"
] | null | null | null |
pytfe/__init__.py
|
guamum/tfp
|
98a8f27bdd81a94944a4a829b72052245461d6d0
|
[
"MIT"
] | null | null | null |
__version__ = '0.0.1'
from .app import * # noqa
from .app import Connection # noqa
from .app import Function # noqa
from .app import Item # noqa
from .app import Locals # noqa
from .app import Output # noqa
from .app import Plan # noqa
from .app import Provider # noqa
from .app import Provisioner # noqa
from .app import Raw # noqa
from .app import Resource # noqa
from .app import Variable # noqa
| 25.8125
| 36
| 0.711864
| 63
| 413
| 4.603175
| 0.285714
| 0.289655
| 0.537931
| 0.644828
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009259
| 0.215496
| 413
| 15
| 37
| 27.533333
| 0.885802
| 0.142857
| 0
| 0
| 0
| 0
| 0.014663
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.923077
| 0
| 0.923077
| 0
| 0
| 0
| 0
| null | 1
| 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
| 1
| 0
| 1
| 0
|
0
| 5
|
d21c5a01598edb587e0d3383f5166c0ac12c7623
| 98
|
py
|
Python
|
dace/libraries/standard/environments/__init__.py
|
targetsm/dace
|
297b12804a334df8cc6fad5250d5fb0cce20dc6e
|
[
"BSD-3-Clause"
] | null | null | null |
dace/libraries/standard/environments/__init__.py
|
targetsm/dace
|
297b12804a334df8cc6fad5250d5fb0cce20dc6e
|
[
"BSD-3-Clause"
] | null | null | null |
dace/libraries/standard/environments/__init__.py
|
targetsm/dace
|
297b12804a334df8cc6fad5250d5fb0cce20dc6e
|
[
"BSD-3-Clause"
] | null | null | null |
# Copyright 2019-2020 ETH Zurich and the DaCe authors. All rights reserved.
from .cuda import CUDA
| 49
| 75
| 0.795918
| 16
| 98
| 4.875
| 0.9375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.096386
| 0.153061
| 98
| 2
| 76
| 49
| 0.843373
| 0.744898
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
d22b7aa659f225122aedff5c79cc2bba7b28d97f
| 32
|
py
|
Python
|
rational/numpy/__init__.py
|
ThomasRot/rational_activations
|
1fa26d1ee5f3c916eda00c899afa96eccb960143
|
[
"MIT"
] | null | null | null |
rational/numpy/__init__.py
|
ThomasRot/rational_activations
|
1fa26d1ee5f3c916eda00c899afa96eccb960143
|
[
"MIT"
] | null | null | null |
rational/numpy/__init__.py
|
ThomasRot/rational_activations
|
1fa26d1ee5f3c916eda00c899afa96eccb960143
|
[
"MIT"
] | null | null | null |
from .rationals import Rational
| 16
| 31
| 0.84375
| 4
| 32
| 6.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125
| 32
| 1
| 32
| 32
| 0.964286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
9627d1800e0f3a32a60106ba203a836d7c75c991
| 108
|
py
|
Python
|
06/1 - IHOPython.py
|
Surferlul/csc-python-solutions
|
bea99e5e1e344d17fb2cb29d8bcbc6b108e24cee
|
[
"MIT"
] | null | null | null |
06/1 - IHOPython.py
|
Surferlul/csc-python-solutions
|
bea99e5e1e344d17fb2cb29d8bcbc6b108e24cee
|
[
"MIT"
] | null | null | null |
06/1 - IHOPython.py
|
Surferlul/csc-python-solutions
|
bea99e5e1e344d17fb2cb29d8bcbc6b108e24cee
|
[
"MIT"
] | null | null | null |
pancakes = int(input())
if pancakes > 3:
print("Yum!")
else: #if pancakes < 3:
print("Still hungry!")
| 18
| 25
| 0.611111
| 15
| 108
| 4.4
| 0.666667
| 0.30303
| 0.333333
| 0.484848
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.022989
| 0.194444
| 108
| 5
| 26
| 21.6
| 0.735632
| 0.148148
| 0
| 0
| 0
| 0
| 0.186813
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.4
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
963a3bab98d32075392d1e5e1f331cacdf27e379
| 44
|
py
|
Python
|
testSources/incorrect/errValueError2.py
|
Gavaharlal/fpTask1
|
1f070ad9ad0c56f56488cc27ac263854c7c010d8
|
[
"BSD-3-Clause"
] | null | null | null |
testSources/incorrect/errValueError2.py
|
Gavaharlal/fpTask1
|
1f070ad9ad0c56f56488cc27ac263854c7c010d8
|
[
"BSD-3-Clause"
] | null | null | null |
testSources/incorrect/errValueError2.py
|
Gavaharlal/fpTask1
|
1f070ad9ad0c56f56488cc27ac263854c7c010d8
|
[
"BSD-3-Clause"
] | null | null | null |
def x(a, b, c):
p = 5
b = int(x)
print(b)
| 8.8
| 15
| 0.454545
| 12
| 44
| 1.666667
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.032258
| 0.295455
| 44
| 5
| 16
| 8.8
| 0.612903
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0
| 0.25
| 0.25
| 1
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
964e4851c9e145ed12e5af10016c36f6bb7e9d8f
| 2,846
|
py
|
Python
|
testbench/sw_lenet_test.py
|
hanlinxuy/HASCO
|
f7c3ac51817b2550f1dcfe7c9a79f81fd15f232c
|
[
"Apache-2.0"
] | 20
|
2021-05-29T01:36:33.000Z
|
2022-02-07T14:17:09.000Z
|
testbench/sw_lenet_test.py
|
hanlinxuy/HASCO
|
f7c3ac51817b2550f1dcfe7c9a79f81fd15f232c
|
[
"Apache-2.0"
] | 6
|
2021-05-28T09:25:58.000Z
|
2021-11-01T01:14:55.000Z
|
testbench/sw_lenet_test.py
|
hanlinxuy/HASCO
|
f7c3ac51817b2550f1dcfe7c9a79f81fd15f232c
|
[
"Apache-2.0"
] | 6
|
2021-06-10T12:00:20.000Z
|
2022-02-08T06:50:54.000Z
|
import sys
sys.path.append("./src/")
from hw_generator.generator_conv import CONVGenerator
from hw_generator.generator_gemm import GEMMGenerator
from benchmark.benchmark import Workload, Benchmark
from codesign.hw_evaluation import evaluation_function_model, gen_software, reset
from benchmark.computations import conv2d_compute, mm_compute
if __name__ == '__main__':
dtype = "int8"
print("Testing accelerators with CONV intrinsic ...")
generator = CONVGenerator()
parameterization = {'x':4, 'y':4, 'sp_capacity':2048, 'local_capacity':1024,
'sp_banks':4, 'dma_buswidth':256, 'dma_maxbytes':128,
'dataflow': "FIXED", 'dtype':"int8"}
benchmark = Benchmark("LeNet")
conv1 = Workload("conv_1", "CONV", conv2d_compute, (1, 1, 32, 32, 6, 5, 5, 1, dtype, generator.type, False))
conv2 = Workload("conv_2", "CONV", conv2d_compute, (1, 6, 14, 14, 16, 5, 5, 1, dtype, generator.type, False))
conv3 = Workload("conv_3", "CONV", conv2d_compute, (1, 16, 5, 5, 120, 5, 5, 1, dtype, generator.type, False))
mm1 = Workload("fc_1", "GEMM", mm_compute, (1, 84, 120, dtype, generator.type))
mm2 = Workload("fc_2", "GEMM", mm_compute, (1, 10, 84, dtype, generator.type))
benchmark.add(conv1)
benchmark.add(conv2)
benchmark.add(conv3)
benchmark.add(mm1)
benchmark.add(mm2)
evaluation_function_model(parameterization, benchmark, generator)
arg_str = [str(i) for i in parameterization.values()]
tag = '_'.join(arg_str)
software = gen_software(tag, is_print=True)
print("Passed.")
print("Testing accelerators with GEMM intrinsic ...")
reset()
generator = GEMMGenerator()
parameterization = {'x':16, 'sp_capacity':512, 'local_capacity':1024,
'sp_banks':4, 'dma_buswidth':256, 'dma_maxbytes':128,
'dataflow': "OS", 'dtype':"int8"}
benchmark = Benchmark("LeNet")
conv1 = Workload("conv_1", "CONV", conv2d_compute, (1, 1, 32, 32, 6, 5, 5, 1, dtype, generator.type, False))
conv2 = Workload("conv_2", "CONV", conv2d_compute, (1, 6, 14, 14, 16, 5, 5, 1, dtype, generator.type, False))
conv3 = Workload("conv_3", "CONV", conv2d_compute, (1, 16, 5, 5, 120, 5, 5, 1, dtype, generator.type, False))
mm1 = Workload("fc_1", "GEMM", mm_compute, (1, 84, 120, dtype, generator.type))
mm2 = Workload("fc_2", "GEMM", mm_compute, (1, 10, 84, dtype, generator.type))
benchmark.add(conv1)
benchmark.add(conv2)
benchmark.add(conv3)
benchmark.add(mm1)
benchmark.add(mm2)
evaluation_function_model(parameterization, benchmark, generator)
arg_str = [str(i) for i in parameterization.values()]
tag = '_'.join(arg_str)
software = gen_software(tag, is_print=True)
print("Passed.")
| 42.477612
| 115
| 0.645467
| 371
| 2,846
| 4.784367
| 0.231806
| 0.04507
| 0.101408
| 0.060845
| 0.713239
| 0.713239
| 0.713239
| 0.713239
| 0.713239
| 0.713239
| 0
| 0.070137
| 0.203443
| 2,846
| 66
| 116
| 43.121212
| 0.712836
| 0
| 0
| 0.653846
| 0
| 0
| 0.134318
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.038462
| 0.115385
| 0
| 0.115385
| 0.115385
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
966b08eeab5bc285ad3be3010c316adad6db04a6
| 377
|
py
|
Python
|
Aula10/MetodosExercicio.py
|
PabloSchumacher/TrabalhosPython
|
828edd35eb40442629211bc9f1477f75fb025d74
|
[
"bzip2-1.0.6",
"MIT"
] | null | null | null |
Aula10/MetodosExercicio.py
|
PabloSchumacher/TrabalhosPython
|
828edd35eb40442629211bc9f1477f75fb025d74
|
[
"bzip2-1.0.6",
"MIT"
] | null | null | null |
Aula10/MetodosExercicio.py
|
PabloSchumacher/TrabalhosPython
|
828edd35eb40442629211bc9f1477f75fb025d74
|
[
"bzip2-1.0.6",
"MIT"
] | null | null | null |
def soma(n1,n2):
r = n1+n2
return r
def sub(n1,n2):
r = n1-n2
return r
def mult(n1,n2):
r = n1*n2
return r
def divfra(n1,n2):
r = n1/n2
return r
def divint(n1,n2):
r = n1//n2
return r
def restodiv(n1,n2):
r = n1%n2
return r
def raiz1(n1,n2):
r = n1**(0.5)
return r
def raiz2(n1,n2):
r = n2**(1/2)
return r
| 11.78125
| 20
| 0.511936
| 74
| 377
| 2.608108
| 0.22973
| 0.290155
| 0.207254
| 0.253886
| 0.590674
| 0.590674
| 0.590674
| 0.590674
| 0
| 0
| 0
| 0.144
| 0.33687
| 377
| 31
| 21
| 12.16129
| 0.628
| 0
| 0
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 1
| 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
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
96bf5e468351cc4e78f378f1fd71ef0256e2ff2b
| 112
|
py
|
Python
|
parsers/hml_parser.py
|
akrherz/pyWWA
|
011526f459db00d117e59f570535ac42ca267d83
|
[
"MIT"
] | 9
|
2015-03-27T22:43:07.000Z
|
2020-04-10T04:19:47.000Z
|
parsers/hml_parser.py
|
akrherz/pyWWA
|
011526f459db00d117e59f570535ac42ca267d83
|
[
"MIT"
] | 76
|
2015-03-05T18:20:07.000Z
|
2022-03-24T02:04:25.000Z
|
parsers/hml_parser.py
|
akrherz/pyWWA
|
011526f459db00d117e59f570535ac42ca267d83
|
[
"MIT"
] | 3
|
2020-11-05T17:38:03.000Z
|
2022-03-04T17:39:40.000Z
|
""" HML parser! """
# Local
from pywwa.workflows.hml_parser import main
if __name__ == "__main__":
main()
| 14
| 43
| 0.660714
| 14
| 112
| 4.642857
| 0.714286
| 0.276923
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1875
| 112
| 7
| 44
| 16
| 0.714286
| 0.169643
| 0
| 0
| 0
| 0
| 0.093023
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
736d668d35986683ecc2ecbe8af7fc1eefb298ff
| 26
|
py
|
Python
|
analoglogin/__init__.py
|
EddieIvan01/lessons-robber
|
273258e0a90e20cc899a3f490ace4117e3f92f8a
|
[
"MIT"
] | 14
|
2019-05-13T10:57:18.000Z
|
2022-03-01T10:03:42.000Z
|
analoglogin/__init__.py
|
EddieIvan01/Lessons_Robber
|
273258e0a90e20cc899a3f490ace4117e3f92f8a
|
[
"MIT"
] | 2
|
2019-12-26T05:12:09.000Z
|
2019-12-27T15:36:54.000Z
|
analoglogin/__init__.py
|
EddieIvan01/lessons-robber
|
273258e0a90e20cc899a3f490ace4117e3f92f8a
|
[
"MIT"
] | 4
|
2019-08-20T11:15:31.000Z
|
2021-08-16T14:21:39.000Z
|
from .login import Loginer
| 26
| 26
| 0.846154
| 4
| 26
| 5.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115385
| 26
| 1
| 26
| 26
| 0.956522
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
7390450a65f6c5e72601b648cdeaa9b196e7efff
| 60
|
py
|
Python
|
pyagify/__init__.py
|
allenng321/py-agify
|
c509b5ce72fc4ac95ed5f972b9655779d230f862
|
[
"BSD-3-Clause"
] | 1
|
2020-10-11T15:28:13.000Z
|
2020-10-11T15:28:13.000Z
|
pyagify/__init__.py
|
allenng321/py-agify
|
c509b5ce72fc4ac95ed5f972b9655779d230f862
|
[
"BSD-3-Clause"
] | 2
|
2020-10-17T14:46:17.000Z
|
2021-01-08T00:18:55.000Z
|
pyagify/__init__.py
|
allenng321/py-agify
|
c509b5ce72fc4ac95ed5f972b9655779d230f862
|
[
"BSD-3-Clause"
] | null | null | null |
from pyagify.agify import *
from pyagify.exceptions import *
| 30
| 32
| 0.816667
| 8
| 60
| 6.125
| 0.625
| 0.44898
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116667
| 60
| 2
| 32
| 30
| 0.924528
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
7395b868877fb6676856168d8aba0c9b141ef756
| 97
|
py
|
Python
|
funboost/publishers/__init__.py
|
DJMIN/funboost
|
7570ca2909bb0b44a1080f5f98aa96c86d3da9d4
|
[
"Apache-2.0"
] | 333
|
2019-08-08T10:25:27.000Z
|
2022-03-30T07:32:04.000Z
|
funboost/publishers/__init__.py
|
mooti-barry/funboost
|
2cd9530e2c4e5a52fc921070d243d402adbc3a0e
|
[
"Apache-2.0"
] | 38
|
2020-04-24T01:47:51.000Z
|
2021-12-20T07:22:15.000Z
|
funboost/publishers/__init__.py
|
mooti-barry/funboost
|
2cd9530e2c4e5a52fc921070d243d402adbc3a0e
|
[
"Apache-2.0"
] | 84
|
2019-08-09T11:51:14.000Z
|
2022-03-02T06:29:09.000Z
|
# -*- coding: utf-8 -*-
# @Author : ydf
# @Time : 2019/8/8 0008 11:50
"""
实现各种中间件类型的发布者。
"""
| 13.857143
| 32
| 0.515464
| 13
| 97
| 3.846154
| 0.846154
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.2
| 0.226804
| 97
| 7
| 33
| 13.857143
| 0.466667
| 0.85567
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
739b68d1222aeaef2015d877d14e029a60d2889c
| 127
|
py
|
Python
|
lib/pypeflow/utils/__init__.py
|
TomLXXVI/pipe-network-sim
|
c2307aba3138bc87ebb24f48e5299149db893ea9
|
[
"MIT"
] | null | null | null |
lib/pypeflow/utils/__init__.py
|
TomLXXVI/pipe-network-sim
|
c2307aba3138bc87ebb24f48e5299149db893ea9
|
[
"MIT"
] | null | null | null |
lib/pypeflow/utils/__init__.py
|
TomLXXVI/pipe-network-sim
|
c2307aba3138bc87ebb24f48e5299149db893ea9
|
[
"MIT"
] | 1
|
2022-01-19T20:27:43.000Z
|
2022-01-19T20:27:43.000Z
|
"""
# Utilities that aid in the design and analysis of piping networks
"""
from lib.pypeflow.utils.pump_curve import PumpCurve
| 25.4
| 66
| 0.779528
| 19
| 127
| 5.157895
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.141732
| 127
| 4
| 67
| 31.75
| 0.899083
| 0.519685
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
73b223bb5ba42f06f68968b364d43731ddf2a9d5
| 146
|
py
|
Python
|
py_tdlib/constructors/update_chat_reply_markup.py
|
Mr-TelegramBot/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 24
|
2018-10-05T13:04:30.000Z
|
2020-05-12T08:45:34.000Z
|
py_tdlib/constructors/update_chat_reply_markup.py
|
MrMahdi313/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 3
|
2019-06-26T07:20:20.000Z
|
2021-05-24T13:06:56.000Z
|
py_tdlib/constructors/update_chat_reply_markup.py
|
MrMahdi313/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 5
|
2018-10-05T14:29:28.000Z
|
2020-08-11T15:04:10.000Z
|
from ..factory import Type
class updateChatReplyMarkup(Type):
chat_id = None # type: "int53"
reply_markup_message_id = None # type: "int53"
| 20.857143
| 48
| 0.732877
| 19
| 146
| 5.421053
| 0.684211
| 0.116505
| 0.194175
| 0.291262
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.032787
| 0.164384
| 146
| 6
| 49
| 24.333333
| 0.811475
| 0.184932
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
73c844b7e77fc06bc5447a3f56bb574a930f80b4
| 132
|
py
|
Python
|
web/datasets/tests/conftest.py
|
andressadotpy/maria-quiteria
|
eb0dae395d2eb12b354aedb50810419d3b512875
|
[
"MIT"
] | 151
|
2019-11-10T02:18:25.000Z
|
2022-01-18T14:28:25.000Z
|
web/datasets/tests/conftest.py
|
andressadotpy/maria-quiteria
|
eb0dae395d2eb12b354aedb50810419d3b512875
|
[
"MIT"
] | 202
|
2019-11-09T16:27:19.000Z
|
2022-03-22T12:41:27.000Z
|
web/datasets/tests/conftest.py
|
andressadotpy/maria-quiteria
|
eb0dae395d2eb12b354aedb50810419d3b512875
|
[
"MIT"
] | 69
|
2020-02-05T01:33:35.000Z
|
2022-03-30T10:39:27.000Z
|
import pytest
@pytest.fixture
def mock_backup_file(mocker):
return mocker.patch("web.datasets.tasks.backup_file.apply_async")
| 18.857143
| 69
| 0.795455
| 19
| 132
| 5.315789
| 0.789474
| 0.19802
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098485
| 132
| 6
| 70
| 22
| 0.84874
| 0
| 0
| 0
| 0
| 0
| 0.318182
| 0.318182
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0.25
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
73d9d5017b8749e04a0f0034c6da40111c0b0911
| 26
|
py
|
Python
|
Chapter 04/ch4_3_23.py
|
bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE
|
f6a4194684515495d00aa38347a725dd08f39a0c
|
[
"MIT"
] | null | null | null |
Chapter 04/ch4_3_23.py
|
bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE
|
f6a4194684515495d00aa38347a725dd08f39a0c
|
[
"MIT"
] | null | null | null |
Chapter 04/ch4_3_23.py
|
bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE
|
f6a4194684515495d00aa38347a725dd08f39a0c
|
[
"MIT"
] | null | null | null |
print(bool ('None')) #True
| 26
| 26
| 0.653846
| 4
| 26
| 4.25
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.076923
| 26
| 1
| 26
| 26
| 0.708333
| 0.153846
| 0
| 0
| 0
| 0
| 0.181818
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
fb98cc60331dc84a61d3a8c08c9329e9cb24d584
| 99
|
py
|
Python
|
home/models.py
|
mbrandeburg/anc1d04
|
a9895481731938b03d02e4a668f678f4318bdaa2
|
[
"MIT"
] | null | null | null |
home/models.py
|
mbrandeburg/anc1d04
|
a9895481731938b03d02e4a668f678f4318bdaa2
|
[
"MIT"
] | null | null | null |
home/models.py
|
mbrandeburg/anc1d04
|
a9895481731938b03d02e4a668f678f4318bdaa2
|
[
"MIT"
] | null | null | null |
from django.db import models
# Create your models here.
# NOTE: These are your db tables, right?
| 19.8
| 40
| 0.737374
| 16
| 99
| 4.5625
| 0.8125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.191919
| 99
| 4
| 41
| 24.75
| 0.9125
| 0.646465
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
fba534e0b9599f5f792386dacf352e349959669e
| 134
|
py
|
Python
|
app/sample_type/__init__.py
|
kid-kodi/BioBank
|
27c7cb7286dcae737fa53c245456d60857fe949f
|
[
"MIT"
] | null | null | null |
app/sample_type/__init__.py
|
kid-kodi/BioBank
|
27c7cb7286dcae737fa53c245456d60857fe949f
|
[
"MIT"
] | null | null | null |
app/sample_type/__init__.py
|
kid-kodi/BioBank
|
27c7cb7286dcae737fa53c245456d60857fe949f
|
[
"MIT"
] | null | null | null |
from flask import Blueprint
bp = Blueprint('sample_type', __name__, template_folder='templates')
from app.sample_type import routes
| 22.333333
| 68
| 0.80597
| 18
| 134
| 5.611111
| 0.722222
| 0.19802
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.11194
| 134
| 5
| 69
| 26.8
| 0.84874
| 0
| 0
| 0
| 0
| 0
| 0.149254
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0.666667
| 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
| 1
| 0
| 1
| 1
|
0
| 5
|
fbb272ec840f9eaa40ba8cacf5050bd2bb0b5988
| 292
|
py
|
Python
|
pip_audit/util.py
|
ccoulombe/pip-audit
|
32c54c8afb68042e12cfc198a9a6d041851a76f0
|
[
"Apache-2.0"
] | null | null | null |
pip_audit/util.py
|
ccoulombe/pip-audit
|
32c54c8afb68042e12cfc198a9a6d041851a76f0
|
[
"Apache-2.0"
] | null | null | null |
pip_audit/util.py
|
ccoulombe/pip-audit
|
32c54c8afb68042e12cfc198a9a6d041851a76f0
|
[
"Apache-2.0"
] | null | null | null |
"""
Utilities functions for `pip-audit`.
"""
from typing import NoReturn # pragma: no cover
def assert_never(x: NoReturn) -> NoReturn: # pragma: no cover
"""
A hint to the typechecker that a branch can never occur.
"""
assert False, f"unhandled type: {type(x).__name__}"
| 22.461538
| 62
| 0.664384
| 40
| 292
| 4.725
| 0.75
| 0.148148
| 0.169312
| 0.222222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.212329
| 292
| 12
| 63
| 24.333333
| 0.821739
| 0.438356
| 0
| 0
| 0
| 0
| 0.242857
| 0
| 0
| 0
| 0
| 0
| 0.666667
| 1
| 0.333333
| false
| 0
| 0.333333
| 0
| 0.666667
| 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
| 1
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
fbb7a7378f9a60a0bbb880ec0cf3298c311360ff
| 164
|
py
|
Python
|
exercicios/desafio 27.py
|
ibianco91/curso_em_video
|
13829b5d2e2290fcffe47ef0ab902b5e4a24a0ed
|
[
"MIT"
] | null | null | null |
exercicios/desafio 27.py
|
ibianco91/curso_em_video
|
13829b5d2e2290fcffe47ef0ab902b5e4a24a0ed
|
[
"MIT"
] | null | null | null |
exercicios/desafio 27.py
|
ibianco91/curso_em_video
|
13829b5d2e2290fcffe47ef0ab902b5e4a24a0ed
|
[
"MIT"
] | null | null | null |
n = str(input('digite seu nome completo')).strip()
n1 = n.split()
print('seu primeiro nome é {}'.format(n1[0]))
print('seu ultimo nome é {}' .format(n1[len(n1)-1]))
| 41
| 52
| 0.646341
| 29
| 164
| 3.655172
| 0.62069
| 0.150943
| 0.207547
| 0.245283
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.041379
| 0.115854
| 164
| 4
| 52
| 41
| 0.689655
| 0
| 0
| 0
| 0
| 0
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
fbba2910f706482434d660190cd012b39ad23c6b
| 160
|
py
|
Python
|
moto/rds2/__init__.py
|
JimNero009/moto
|
d53dd233900507518382628723d24de63f2fecf8
|
[
"Apache-2.0"
] | null | null | null |
moto/rds2/__init__.py
|
JimNero009/moto
|
d53dd233900507518382628723d24de63f2fecf8
|
[
"Apache-2.0"
] | 1
|
2022-02-19T02:10:45.000Z
|
2022-02-19T02:15:52.000Z
|
moto/rds2/__init__.py
|
JimNero009/moto
|
d53dd233900507518382628723d24de63f2fecf8
|
[
"Apache-2.0"
] | null | null | null |
from .models import rds2_backends
from ..core.models import base_decorator
rds2_backend = rds2_backends["us-west-1"]
mock_rds2 = base_decorator(rds2_backends)
| 26.666667
| 41
| 0.81875
| 24
| 160
| 5.166667
| 0.541667
| 0.290323
| 0.274194
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.041379
| 0.09375
| 160
| 5
| 42
| 32
| 0.813793
| 0
| 0
| 0
| 0
| 0
| 0.05625
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
fbbe5551de1f17dfc701c82a7be19d55fe38dd15
| 73
|
py
|
Python
|
python/format_number.py
|
TechieHelper/Codewars
|
98ea8deb14ae1422162895f481e4175ab5868955
|
[
"MIT"
] | null | null | null |
python/format_number.py
|
TechieHelper/Codewars
|
98ea8deb14ae1422162895f481e4175ab5868955
|
[
"MIT"
] | null | null | null |
python/format_number.py
|
TechieHelper/Codewars
|
98ea8deb14ae1422162895f481e4175ab5868955
|
[
"MIT"
] | null | null | null |
def format_number(num: int):
return [i for i in range(len(str(num)))]
| 36.5
| 44
| 0.671233
| 14
| 73
| 3.428571
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.164384
| 73
| 2
| 44
| 36.5
| 0.786885
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
fbbf6209a3b0770eeeda092cfd2037b0fec16ec5
| 158,720
|
py
|
Python
|
migration.py
|
subhayuroy/BirdMigration_Tracking
|
a2573f6062ef811eb71a06d7cca4e9e5b87d6aaa
|
[
"BSL-1.0"
] | null | null | null |
migration.py
|
subhayuroy/BirdMigration_Tracking
|
a2573f6062ef811eb71a06d7cca4e9e5b87d6aaa
|
[
"BSL-1.0"
] | null | null | null |
migration.py
|
subhayuroy/BirdMigration_Tracking
|
a2573f6062ef811eb71a06d7cca4e9e5b87d6aaa
|
[
"BSL-1.0"
] | null | null | null |
# -*- coding: utf-8 -*-
"""#Understanding migration patterns of purple martins.
These birds typically spend the summer breeding season in the **eastern United States**, and then migrate to **South America** for the winter. But since this bird is under threat of endangerment, we'd like to take a closer look at the ***locations that these birds are more likely to visit***

There are several protected areas in South America, which operate under special regulations to ensure that species that migrate (or live) there have the best opportunity to thrive.
We'd like to know if purple martins tend to visit these areas. To answer this question, you'll use some recently collected data that tracks the year-round location of eleven different birds.
"""
import pandas as pd
import geopandas as gpd
from shapely.geometry import LineString
"""**Loading data**"""
birds_df = pd.read_csv("/content/purple_martin.csv", parse_dates=['timestamp'])
print("There are {} different birds in the dataset.".format(birds_df["tag-local-identifier"].nunique()))
"""**Creating the GeoDataFrame**"""
birds = gpd.GeoDataFrame(birds_df, geometry=gpd.points_from_xy(birds_df["location-long"], birds_df["location-lat"]))
birds.crs = {'init' :'epsg:4326'}
"""##Plot the data
**Load a GeoDataFrame with country boundaries in North/South America**
"""
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
americas = world.loc[world['continent'].isin(['North America', 'South America'])]
americas.head()
ax = americas.plot(figsize=(15,15), color='white', linestyle=':', edgecolor='gray')
birds.plot(ax=ax, markersize=10)
ax.set_xlim([-110, -30])
ax.set_ylim([-30, 60])
"""###Where does each bird start and end its journey? (Part 1)
**GeoDataFrame showing path for each bird**
"""
path_df = birds.groupby("tag-local-identifier")['geometry'].apply(list).apply(lambda x: LineString(x)).reset_index()
path_gdf = gpd.GeoDataFrame(path_df, geometry=path_df.geometry)
path_gdf.crs = {'init' :'epsg:4326'}
"""**GeoDataFrame showing starting point for each bird**"""
start_df = birds.groupby("tag-local-identifier")['geometry'].apply(list).apply(lambda x: x[0]).reset_index()
start_gdf = gpd.GeoDataFrame(start_df, geometry=start_df.geometry)
start_gdf.crs = {'init' :'epsg:4326'}
"""**GeoDataFrame containing the final location of each bird**"""
end_df = birds.groupby("tag-local-identifier")['geometry'].apply(list).apply(lambda x: x[-1]).reset_index()
end_gdf = gpd.GeoDataFrame(end_df, geometry=end_df.geometry)
end_gdf.crs = {'init': 'epsg:4326'}
"""###Where does each bird start and end its journey? (Part 2)"""
ax=americas.plot(figsize=(12,12), color='whitesmoke', linestyle=':', edgecolor='black')
start_gdf.plot(ax=ax, color='red', markersize=30)
path_gdf.plot(ax=ax, cmap='tab20b', linestyle='-', linewidth=1, zorder=1)
end_gdf.plot(ax=ax, color='black', markersize=30)
"""###Where are the protected areas in South America? (Part 1)
It looks like all of the birds end up somewhere in South America. But are they going to protected areas?
"""
protected_filepath = "/content/SAPA_Aug2019-shapefile"
protected_areas = gpd.read_file(protected_filepath)
"""###Where are the protected areas in South America? (Part 2)
Creating a plot that uses the protected_areas GeoDataFrame to show the locations of the protected areas in South America. (_We'll notice that some protected areas are on land, while others are in marine waters._)
"""
south_america = americas.loc[americas['continent']=='South America']
ax = south_america.plot(figsize=(12,12),color='whitesmoke', linestyle=':', edgecolor='black')
protected_areas.plot(ax=ax, markersize=2)
south_america = americas.loc[americas['continent']=='South America']
ax = south_america.plot(figsize=(12,12), color='white', edgecolor='gray')
protected_areas.plot(ax=ax, alpha=0.4)
"""###What percentage of South America is protected?
We're interested in determining ***what percentage of South America is protected***, so that we know ***how much of South America is suitable for the birds***.
As a first step, we calculate the total area of all protected lands in South America (not including marine area). To do this, we use the "REP_AREA" and "REP_M_AREA" columns, which contain the total area and total marine area, respectively, in square kilometers.
"""
P_Area = sum(protected_areas['REP_AREA']-protected_areas['REP_M_AREA'])
print("South America has {} square kilometers of protected areas.".format(P_Area))
south_america.head()
"""Calculate the **total area of South America** by following these steps:
1. Calculate the area of each country using the area attribute of each polygon (with EPSG 3035 as the CRS), and add up the results.
2. The calculated area will be in units of square meters.
Convert your answer to have units of square kilometeters.
"""
totalArea = sum(south_america.geometry.to_crs(epsg=3035).area) / 10**6
percentage_protected = P_Area/totalArea
print('Approximately {}% of South America is protected.'.format(round(percentage_protected*100, 2)))
"""###Where are the birds in South America?
So, are the birds in protected areas?
Creating a plot that shows for all birds, all of the locations where they were discovered in South America. Also plot the locations of all protected areas in South America.
"""
ax = south_america.plot(figsize=(15,15), color='whitesmoke', linestyle=':', edgecolor='black')
protected_areas[protected_areas['MARINE']!=2].plot(ax=ax,alpha=0.4, zorder=1)
birds[birds.geometry.y < 0].plot(ax=ax, color='red', alpha=0.6, markersize=10, zorder=2)
"""Excluded protected areas are that are purely marine areas (with no land component)"""
| 1,184.477612
| 153,059
| 0.965978
| 4,767
| 158,720
| 32.148311
| 0.665198
| 0.002114
| 0.001879
| 0.003471
| 0.073239
| 0.058897
| 0.047262
| 0.031067
| 0.029435
| 0.023099
| 0
| 0.133269
| 0.004322
| 158,720
| 133
| 153,060
| 1,193.383459
| 0.836466
| 0.969034
| 0
| 0.045455
| 0
| 0
| 0.212153
| 0.020021
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.068182
| 0
| 0.068182
| 0.068182
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
fbd95db4c37bfcc5daa227e866011cf383eee285
| 2,428
|
py
|
Python
|
tests/aks/test_aks_actions.py
|
ShotaAshida/chaostoolkit-azure
|
49be5e48a2dba9130719f3831ba3b94fc9bd3aff
|
[
"Apache-2.0"
] | null | null | null |
tests/aks/test_aks_actions.py
|
ShotaAshida/chaostoolkit-azure
|
49be5e48a2dba9130719f3831ba3b94fc9bd3aff
|
[
"Apache-2.0"
] | null | null | null |
tests/aks/test_aks_actions.py
|
ShotaAshida/chaostoolkit-azure
|
49be5e48a2dba9130719f3831ba3b94fc9bd3aff
|
[
"Apache-2.0"
] | null | null | null |
from unittest.mock import patch
import pytest
from chaoslib.exceptions import FailedActivity
from chaosazure.aks.actions import restart_node, stop_node, delete_node, format_query
resource = {
'name': 'chaos-aks',
'resourceGroup': 'rg',
'properties': {
'nodeResourceGroup': 'nrg'
}}
@patch('chaosazure.aks.actions.fetch_resources', autospec=True)
@patch('chaosazure.aks.actions.delete_machines', autospec=True)
def test_delete_node(delete, fetch):
resource_list = [resource]
fetch.return_value = resource_list
delete_node(None, None, None, None)
@patch('chaosazure.aks.actions.fetch_resources', autospec=True)
def test_restart_node_with_no_nodes(fetch):
with pytest.raises(FailedActivity) as x:
resource_list = []
fetch.return_value = resource_list
delete_node(None, None, None, None)
assert "No AKS clusters found" in str(x.value)
@patch('chaosazure.aks.actions.fetch_resources', autospec=True)
@patch('chaosazure.aks.actions.stop_machines', autospec=True)
def test_stop_node(stop, fetch):
resource_list = [resource]
fetch.return_value = resource_list
stop_node(None, None, None, None)
@patch('chaosazure.aks.actions.fetch_resources', autospec=True)
def test_restart_node_with_no_nodes(fetch):
with pytest.raises(FailedActivity) as x:
resource_list = []
fetch.return_value = resource_list
stop_node(None, None, None, None)
assert "No AKS clusters found" in str(x.value)
@patch('chaosazure.aks.actions.fetch_resources', autospec=True)
@patch('chaosazure.aks.actions.restart_machines', autospec=True)
def test_restart_node(restart, fetch):
resource_list = [resource]
fetch.return_value = resource_list
restart_node(None, None, None, None)
@patch('chaosazure.aks.actions.fetch_resources', autospec=True)
def test_restart_node_with_no_nodes(fetch):
with pytest.raises(FailedActivity) as x:
resource_list = []
fetch.return_value = resource_list
restart_node(None, None, None, None)
assert "No AKS clusters found" in str(x.value)
def test_format_query():
query = format_query(1, resource['properties']['nodeResourceGroup'])
assert query == "where resourceGroup =~ 'nrg' | sample 1"
def test_no_sample_format_query():
query = format_query(None, resource['properties']['nodeResourceGroup'])
assert query == "where resourceGroup =~ 'nrg'"
| 29.609756
| 85
| 0.728171
| 310
| 2,428
| 5.490323
| 0.164516
| 0.084606
| 0.084606
| 0.132197
| 0.822562
| 0.754407
| 0.73678
| 0.73678
| 0.658049
| 0.613984
| 0
| 0.000978
| 0.157331
| 2,428
| 81
| 86
| 29.975309
| 0.83089
| 0
| 0
| 0.6
| 0
| 0
| 0.240214
| 0.140503
| 0
| 0
| 0
| 0
| 0.090909
| 1
| 0.145455
| false
| 0
| 0.072727
| 0
| 0.218182
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
8382b404b1b95b2ee9b700d5440e00a3cef6b4f1
| 23
|
py
|
Python
|
demo.py
|
17875054196782844693/ONE-PIECE
|
ac835b5d302527669f5c7bba019c8041c546f359
|
[
"MIT"
] | null | null | null |
demo.py
|
17875054196782844693/ONE-PIECE
|
ac835b5d302527669f5c7bba019c8041c546f359
|
[
"MIT"
] | null | null | null |
demo.py
|
17875054196782844693/ONE-PIECE
|
ac835b5d302527669f5c7bba019c8041c546f359
|
[
"MIT"
] | null | null | null |
num1 = 10
num2 = 200
| 5.75
| 10
| 0.565217
| 4
| 23
| 3.25
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.466667
| 0.347826
| 23
| 3
| 11
| 7.666667
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
83c55b539adab261c7a44bc8a0d1d753f00084c3
| 212
|
py
|
Python
|
tron/Hub/Reply/Decoders/__init__.py
|
sdss/tron
|
886c5c5fb6341ad85e4a9f5d6f5ecb6bbc0d8322
|
[
"BSD-3-Clause"
] | null | null | null |
tron/Hub/Reply/Decoders/__init__.py
|
sdss/tron
|
886c5c5fb6341ad85e4a9f5d6f5ecb6bbc0d8322
|
[
"BSD-3-Clause"
] | null | null | null |
tron/Hub/Reply/Decoders/__init__.py
|
sdss/tron
|
886c5c5fb6341ad85e4a9f5d6f5ecb6bbc0d8322
|
[
"BSD-3-Clause"
] | null | null | null |
from .ASCIIReplyDecoder import ASCIIReplyDecoder
from .PyReplyDecoder import PyReplyDecoder
from .RawReplyDecoder import RawReplyDecoder
from .ReplyDecoder import ReplyDecoder
#from BinaryReplyDecoder import *
| 26.5
| 48
| 0.867925
| 19
| 212
| 9.684211
| 0.368421
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.103774
| 212
| 7
| 49
| 30.285714
| 0.968421
| 0.150943
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
f7e08cd706f91d30def8e2060aebd6d82b5c317d
| 34
|
py
|
Python
|
elsa/spawner/__init__.py
|
dirac-institute/elsa
|
ecef24e71b8016a6590868544c821240743bd658
|
[
"BSD-3-Clause"
] | 6
|
2020-11-11T08:00:10.000Z
|
2021-05-28T15:17:02.000Z
|
elsa/spawner/__init__.py
|
dirac-institute/elsa
|
ecef24e71b8016a6590868544c821240743bd658
|
[
"BSD-3-Clause"
] | null | null | null |
elsa/spawner/__init__.py
|
dirac-institute/elsa
|
ecef24e71b8016a6590868544c821240743bd658
|
[
"BSD-3-Clause"
] | null | null | null |
from .spawner import PodmanSpawner
| 34
| 34
| 0.882353
| 4
| 34
| 7.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.088235
| 34
| 1
| 34
| 34
| 0.967742
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
790ef75570fe808b46eeb7ba90634c7c1a761158
| 196
|
py
|
Python
|
DjangoSales/apps/users/forms.py
|
X-ELE/DjangoSales
|
f054cc4b7984856f475431a72ccbc17ea66bd1b7
|
[
"MIT"
] | null | null | null |
DjangoSales/apps/users/forms.py
|
X-ELE/DjangoSales
|
f054cc4b7984856f475431a72ccbc17ea66bd1b7
|
[
"MIT"
] | null | null | null |
DjangoSales/apps/users/forms.py
|
X-ELE/DjangoSales
|
f054cc4b7984856f475431a72ccbc17ea66bd1b7
|
[
"MIT"
] | null | null | null |
from django import forms
class LoginForm(forms.Form):
username = forms.CharField(widget=forms.TextInput())
password = forms.CharField(widget=forms.PasswordInput(render_value=False))
| 39.2
| 79
| 0.760204
| 23
| 196
| 6.434783
| 0.695652
| 0.189189
| 0.27027
| 0.337838
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.132653
| 196
| 5
| 79
| 39.2
| 0.870588
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.25
| 0.25
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
f70a75b50f6ab4c03d21568a0b919684fa9dd706
| 187
|
py
|
Python
|
repos/tf_ctpn_cpu/lib/utils/setup.py
|
ysglh/DeepVideoAnalytics
|
ce807cc1595c813250bb4bc7dfc6fb76cd644335
|
[
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | 3
|
2019-03-05T00:46:56.000Z
|
2021-11-26T10:20:40.000Z
|
repos/tf_ctpn_cpu/lib/utils/setup.py
|
jiangxu87/DeepVideoAnalytics
|
e401b3273782409b2604657514bec293d6aa75b0
|
[
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null |
repos/tf_ctpn_cpu/lib/utils/setup.py
|
jiangxu87/DeepVideoAnalytics
|
e401b3273782409b2604657514bec293d6aa75b0
|
[
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | 4
|
2021-09-22T07:47:27.000Z
|
2022-01-23T14:16:08.000Z
|
from Cython.Build import cythonize
import numpy as np
from distutils.core import setup
setup(ext_modules=cythonize(["bbox.pyx","cython_nms.pyx"],include_path=[np.get_include()]
))
| 20.777778
| 89
| 0.764706
| 28
| 187
| 4.964286
| 0.678571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.112299
| 187
| 8
| 90
| 23.375
| 0.837349
| 0
| 0
| 0
| 0
| 0
| 0.11828
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.6
| 0
| 0.6
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
f746dc7dad357acb09f04caba4451d2162cf3379
| 425
|
py
|
Python
|
buidl/buidl/__init__.py
|
rugrah/ru
|
ebe5451709ebcc94e58f4de368fd66cc91c92d21
|
[
"Unlicense"
] | null | null | null |
buidl/buidl/__init__.py
|
rugrah/ru
|
ebe5451709ebcc94e58f4de368fd66cc91c92d21
|
[
"Unlicense"
] | null | null | null |
buidl/buidl/__init__.py
|
rugrah/ru
|
ebe5451709ebcc94e58f4de368fd66cc91c92d21
|
[
"Unlicense"
] | null | null | null |
# TODO: specify what specifically to import
from .block import *
from .bloomfilter import *
from .ecc import *
from .hd import *
from .helper import *
from .merkleblock import *
from .mnemonic import *
from .network import *
from .op import *
from .pbkdf2 import *
from .psbt import *
from .script import *
from .tx import *
from .witness import *
from .hd import HDPrivateKey as keys
from .hd import AddressHelper as addrs
| 22.368421
| 43
| 0.745882
| 60
| 425
| 5.283333
| 0.433333
| 0.473186
| 0.113565
| 0.113565
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.002865
| 0.178824
| 425
| 18
| 44
| 23.611111
| 0.905444
| 0.096471
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.055556
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
f7678932af0d1e73a0fe6d5fa511dd0c74b6a48b
| 18,528
|
py
|
Python
|
model/Modules/cleaning59.py
|
vinclab/loan-customer-scoring
|
896bccd6ac25eb4c5bcb45e5429272a1e9257430
|
[
"Apache-2.0"
] | null | null | null |
model/Modules/cleaning59.py
|
vinclab/loan-customer-scoring
|
896bccd6ac25eb4c5bcb45e5429272a1e9257430
|
[
"Apache-2.0"
] | null | null | null |
model/Modules/cleaning59.py
|
vinclab/loan-customer-scoring
|
896bccd6ac25eb4c5bcb45e5429272a1e9257430
|
[
"Apache-2.0"
] | null | null | null |
#BANQUE DE FONCTIONS DE NETTOYAGE DE DATAFRAME - Vincent Salas
# import des librairies dont nous aurons besoin
import pandas as pd
import numpy as np
#-------------------------------------------------------------------------------------------------------------------------
#NaN DATAFRAME
#-------------------------------------------------------------------------------------------------------------------------
# Définition d"une fonction identifiant les lignes sans données d'un dataframe
def na_rows_list(dataframe,value):
"""Fonction faisant la somme des éléments de ligne et retournant une liste d'indices de lignes sans données"""
"""La valeur de vérification conditionnelle dépend d'un projet, A CHANGER!!!!!!!!"""
na_row_list = []
for i in dataframe.index:
if dataframe.loc[i].value_counts().sum() == value: # Attention valeur de condition à changer
na_row_list.append(i)
return na_row_list
# Définition d"une fonction supprimant les lignes sans données d'un dataframe
def na_raw_drop_df(dataframe,liste):
"""Supprime les lignes NaN"""
"""Utilisation de la fonction na_raws au préalable pour trouver une liste de lignes à supprimer"""
"""Renvoie un dataframe"""
for i in liste: # Utilise na_raws()
dataframe.drop(i,inplace=True)
return dataframe
#-------------------------------------------------------------------------------------------------------------------------
#LIGNES DATAFRAME
#-------------------------------------------------------------------------------------------------------------------------
# Taux de remplissage moyen par ligne
#def row_data_rate_mean(dataframe):
# """Calcul du taux moyen de remplissage par ligne"""
# rows_rate = []
# for i in dataframe.index:
# rate = dataframe.loc[i].value_counts().sum()/dataframe.shape[1]
# rows_rate.append(rate)
#
# return sum(rows_rate)/len(rows_rate)
# Définition d"une fonction identifiant les lignes d'un dataframe avec un taux de remplissage minimal
def min_row_data_rate_list(dataframe,value):
"""Fonction faisant la somme des éléments de ligne et retournant une liste d'indices de lignes avec un taux de
remplissage minimal"""
"""La valeur de vérification conditionnelle dépend d'un projet, A CHANGER!!!!!!!!"""
rows_list = []
for i in dataframe.index:
if dataframe.loc[i].value_counts().sum()/dataframe.shape[1] > value:
rows_list.append(i)
return rows_list
# Définition d"une fonction supprimant les lignes d'un dataframe avec un taux de remplissage insuffisant
def min_row_data_rate_df(dataframe,value):
"""Fonction faisant la somme des éléments de ligne et retournant un dataframe avec un taux de
remplissage minimal"""
"""La valeur de vérification conditionnelle dépend d'un projet, A CHANGER!!!!!!!!"""
rows_list = []
for i in dataframe.index:
if dataframe.loc[i].value_counts().sum()/dataframe.shape[1] < value:
dataframe.drop(i,inplace=True)
return dataframe
# Définition d"une fonction identifiant les lignes avec peu de données d'un dataframe
#def few_data_rows_list(dataframe,value):
# """Fonction faisant la somme des éléments de ligne et retournant une liste d'indices de lignes avec peu de
# données, remplissant une condition de remplissage < x données"""
# """La valeur de vérification conditionnelle dépend d'un projet, A CHANGER!!!!!!!!"""
# rows_list = []
# for i in dataframe.index:
# if dataframe.loc[i].value_counts().sum() < value:
# rows_list.append(i)
# return rows_list
# Définition d"une fonction identifiant les lignes avec un minimum de données d'un dataframe
#def enough_data_rows_list(dataframe,value):
# """Fonction faisant la somme des éléments de ligne et retournant une liste d'indices de lignes avec assez de
# données, remplissant une condition de remplissage > x données"""
# """La valeur de vérification conditionnelle dépend d'un projet, A CHANGER!!!!!!!!"""
# rows_list = []
# for i in dataframe.index:
# if dataframe.loc[i].value_counts().sum() > value:
# rows_list.append(i)
# return rows_list
#------------------------------------------------------------------------------------------------------------------------
#COLONNES DATAFRAME
#-------------------------------------------------------------------------------------------------------------------------
# Vérification du taux de remplissage par colonne
def column_data_rate(dataframe):
"""Fonction vérifiant le taux de remplissage par colonne"""
serie_na = dataframe.notna().sum()/len(dataframe)
return serie_na
# Taux de remplissage moyen par colonne:
def column_data_rate_mean(dataframe):
"""Calcul du taux moyen de remplissage par colonne"""
serie_na = dataframe.notna().sum()/len(dataframe)
return serie_na[:].mean()
# Liste des colonnes d'un dataframe à supprimer si non dans une liste comparative
def columns_not_in_list(dataframe, liste_garder):
"""Compare le nom des colonnes d'un dataframe avec une liste. Renvoie une liste de colonnes à supprimer si non dans la
liste voulue"""
colonnes_supprimer = []
for colonne in dataframe.columns:
if colonne not in liste_garder:
colonnes_supprimer.append(colonne)
return colonnes_supprimer
# Suppression de colonnes d'un dataframe à partir d'une liste
def columns_delete_df(dataframe, list_delete):
"""Supprime les colonnes d'un dataframe non incluses dans une liste et retourne le dataframe"""
dataframe.drop(list_delete,axis=1,inplace= True)
return dataframe
# Définition d"une fonction supprimant les colonnes d'un dataframe avec un taux de remplissage insuffisant
def min_column_data_rate_df(dataframe,value):
"""Fonction retournant un dataframe avec un taux de remplissage minimal par colonne"""
"""La valeur de vérification conditionnelle dépend d'un projet, A CHANGER!!!!!!!!"""
column_list = []
for c in dataframe.columns:
if dataframe[c].value_counts().sum()/dataframe.shape[0] < value:
del dataframe[c]
return dataframe
#-------------------------------------------------------------------------------------------------------------------------
# Valeurs aberrantes
#-------------------------------------------------------------------------------------------------------------------------
# Calcul du nombre de valeurs aberrantes d'un dataframe
#def low_outlier_count(dataframe, columns, value):
# """Calcul du nombre de valeurs aberrantes d'un dataframe en-dessous d'une valeur, #impression du
# résultat"""
# import numpy as np
# dic_count_before = {}
# dic_count_after = {}
# dic_count_variables_aberrantes = {}
#
# print('Nombre de valeurs aberrantes :\n')
# for variable in columns:
# dic_count_before[variable] = dataframe[variable].value_counts().sum()
# dataframe[variable] = [t if t>value else np.NaN for t in dataframe[variable]]
# dic_count_after[variable] = dataframe[variable].value_counts().sum()
# dic_count_variables_aberrantes[variable] = dic_count_before[variable] - #dic_count_after[variable]
#
# return dic_count_variables_aberrantes
# Calcul du nombre de valeurs aberrantes d'un dataframe
#def high_outlier_count(dataframe, columns, value):
# """Calcul du nombre de valeurs aberrantes d'un dataframe au-dessus d'une valeur, #impression du
# résultat"""
# import numpy as np
# dic_count_before = {}
# dic_count_after = {}
# dic_count_variables_aberrantes = {}
#
# print('Nombre de valeurs aberrantes :\n')
# for variable in columns:
# dic_count_before[variable] = dataframe[variable].value_counts().sum()
# dataframe[variable] = [t if t<value else np.NaN for t in dataframe[variable]]
# dic_count_after[variable] = dataframe[variable].value_counts().sum()
# dic_count_variables_aberrantes[variable] = dic_count_before[variable] - #dic_count_after[variable]
#
# return dic_count_variables_aberrantes
#def below_zero_filter(x):
# if x < 0:
# x = np.NaN
# else:
# None
#Fonction pour le filtre de séries ou colonnes d'un dataframe
#def below_value_filter(x,value):
# """Filtre les valeurs en dessous d'une valeur définie. A associer avec .apply(lambda x: ) pour modifier les colonnes
# d'un dataframe"""
# import numpy as np
# if x != np.NaN and x < value:
# return np.NaN
# else:
# return x
#Fonction pour le filtre de séries ou colonnes d'un dataframe
#def above_value_filter(x,value):
# """Filtre les valeurs au dessus d'une valeur définie. A associer avec .apply(lambda x: ) pour modifier les colonnes
# d'un dataframe"""
# import numpy as np
# if x != np.NaN and x > value:
# return np.NaN
# else:
# return x
# Calcul du nombre de valeurs aberrantes d'un dataframe, filtre de celle-ci et impression du résultat
#Input: une SEULE valeur au choix pour chaque colonne
def high_outlier_filter_df(dataframe, columns, value):
"""Calcul du nombre de valeurs aberrantes d'un dataframe au-dessus d'une valeur, filtre de celles-ci et impression
du résultat"""
import numpy as np
dataframe_filter = dataframe.copy()
dic_count_before = {}
dic_count_after = {}
dic_count_variables_aberrantes = {}
dic_percent_variables_aberrantes = {}
print('Nombre de valeurs aberrantes :\n')
for variable in columns:
dic_count_before[variable] = dataframe_filter[variable].value_counts().sum()
dataframe_filter[variable] = dataframe_filter[variable].map(lambda x: x if x<value else np.NaN)
dic_count_after[variable] = dataframe_filter[variable].value_counts().sum()
dic_count_variables_aberrantes[variable] = dic_count_before[variable] - dic_count_after[variable]
dic_percent_variables_aberrantes[variable] = (dic_count_before[variable] -
dic_count_after[variable])/len(dataframe)
print(dic_count_variables_aberrantes)
print('\n')
print('ratio de valeurs aberrantes :\n')
print(dic_percent_variables_aberrantes)
return dataframe_filter
# Calcul du nombre de valeurs aberrantes d'un dataframe, filtre de celle-ci et impression du résultat
#Input: une SEULE valeur au choix pour chaque colonne
def low_outlier_filter_df(dataframe, columns,value):
"""Calcul du nombre de valeurs aberrantes d'un dataframe au-dessus d'une valeur, filtre de celles-ci et impression du
résultat"""
import numpy as np
dic_count_before = {}
dic_count_after = {}
dic_count_variables_aberrantes = {}
dic_percent_variables_aberrantes = {}
print('Nombre de valeurs aberrantes :\n')
for variable in columns:
dic_count_before[variable] = dataframe[variable].value_counts().sum()
dataframe[variable] = dataframe[variable].map(lambda x: x if x>value else np.NaN)
dic_count_after[variable] = dataframe[variable].value_counts().sum()
dic_count_variables_aberrantes[variable] = dic_count_before[variable] - dic_count_after[variable]
dic_percent_variables_aberrantes[variable] = (dic_count_before[variable] -
dic_count_after[variable])/len(dataframe)
print(dic_count_variables_aberrantes)
print('\n')
print('ratio de valeurs aberrantes :\n')
print(dic_percent_variables_aberrantes)
return dataframe
def sign_invert_filter_df(dataframe, columns):
"""Inversion de signe de valeurs numériques si inférieur à zéro"""
import numpy as np
dic_count_before = {}
dic_count_after = {}
dic_count_variables_aberrantes = {}
dic_percent_variables_aberrantes = {}
print('Nombre de valeurs aberrantes :\n')
for variable in columns:
dic_count_before[variable] = dataframe[variable].value_counts().sum()
dataframe[variable] = dataframe[variable].map(lambda x: -x if x<0 else x)
dic_count_after[variable] = dataframe[variable].value_counts().sum()
dic_count_variables_aberrantes[variable] = dic_count_before[variable] - dic_count_after[variable]
dic_percent_variables_aberrantes[variable] = (dic_count_before[variable] -
dic_count_after[variable])/len(dataframe)
print(dic_count_variables_aberrantes)
print('\n')
print('ratio de valeurs aberrantes :\n')
print(dic_percent_variables_aberrantes)
return dataframe
# Calcul du nombre de valeurs aberrantes d'un dataframe, filtre de celle-ci et impression du résultat
# Input: dictionnaire (une valeur par colonne)
def dic_high_outlier_filter_df(dataframe, columns, dictionary):
"""Calcul du nombre de valeurs aberrantes d'un dataframe au-dessus d'une valeur lue dans un dictionnaire, filtre de
celles-ci et impression du résultat"""
import numpy as np
dic_count_before = {}
dic_count_after = {}
dic_count_variables_aberrantes = {}
dic_percent_variables_aberrantes = {}
print('Nombre de valeurs aberrantes :\n')
for variable in columns:
dic_count_before[variable] = dataframe[variable].value_counts().sum()
dataframe[variable] = dataframe[variable].map(lambda x: x if x<dictionary[variable] else np.NaN)
dic_count_after[variable] = dataframe[variable].value_counts().sum()
dic_count_variables_aberrantes[variable] = dic_count_before[variable] - dic_count_after[variable]
dic_percent_variables_aberrantes[variable] = (dic_count_before[variable] -
dic_count_after[variable])/len(dataframe)
print(dic_count_variables_aberrantes)
print('\n')
print('ratio de valeurs aberrantes :\n')
print(dic_percent_variables_aberrantes)
return dataframe
#-------------------------------------------------------------------------------------------------------------------------
# Recherche et filtre de chaînes de caractères dans dataframe
#-------------------------------------------------------------------------------------------------------------------------
# Renvoie un dataframe filtré
def word_column_filter_df(dataframe, column_to_filter, column_freeze, word_list):
# La fonction .where() donne une position qu'il faut transformer en index
# Il faut entrer le nom d'une colonne repère (exemple: code produit) pour retrouver l'index, ou construire un colonne de re-indexée.
"""Filtre les colonnes d'un dataframe, en fonction d'une liste de mots, puis retourne le dataframe"""
import re
position_to_drop_lst = np.where(dataframe[column_to_filter].str.contains('|'.join(map(re.escape, word_list)),
np.NaN))[0]
indices_to_drop_lst = []
for position in position_to_drop_lst:
indice = (dataframe[dataframe[column_freeze] == dataframe.iloc[position].loc[column_freeze]]).index[0]
indices_to_drop_lst.append(indice)
print("Nombre de lignes supprimées:")
nbr= len(indices_to_drop_lst)
print(nbr)
print("\n")
dataframe.drop(indices_to_drop_lst, axis=0,inplace=True)
return dataframe
# Renvoie une liste des indices
def word_column_filter_lst(dataframe, column_to_filter, column_freeze, word_list):
# La fonction .where() donne une position qu'il faut transformer en index
# Il faut entrer le nom d'une colonne repère (exemple: code produit) pour retrouver l'index, ou construire un colonne de re-indexée.
"""Filtre les colonnes d'un dataframe, en fonction d'une liste de mots, puis retourne le dataframe"""
import re
position_to_drop_lst = np.where(dataframe[column_to_filter].str.contains('|'.join(map(re.escape, word_list)),
np.NaN))[0]
indices_to_drop_lst = []
for position in position_to_drop_lst:
indice = (dataframe[dataframe[column_freeze] == dataframe.iloc[position].loc[column_freeze]]).index[0]
indices_to_drop_lst.append(indice)
print("Nombre de lignes supprimées:")
nbr= len(indices_to_drop_lst)
print(nbr)
print("\n")
return indices_to_drop_lst
#-------------------------------------------------------------------------------------------------------------------------
# Tirage aléatoire de produits/bâtiments etc
#-------------------------------------------------------------------------------------------------------------------------
def random_item(df, item_column):
"""Tirage aléatoire de lignes de dataframe et renvoie un nouveau dataframe"""
new_df = pd.DataFrame([], columns=df.columns)
building_lst = df[item_column].unique()
indices_keep = []
for building in building_lst:
# Filtre du dataframe sur les lignes ayant ce nom de bâtiment
building_df = df[df[item_column] == building]
# Sélection unique
#building_count.append(building)
# Tirage aléatoite d'un indice de ligne sur ce dataframe filtré
year_building_ind = list(np.random.choice(list(building_df.index), 1))[0]
indices_keep.append(year_building_ind)
# Création d'un dataframe de ligne à ajouter
#raw_to_add = pd.DataFrame(df.iloc[year_building_ind]).T
# Concaténation avec le nouveau dataframe
#new_df = pd.concat([new_df, raw_to_add],axis=0)
# Suppression des indices de lignes
new_df = df.iloc[indices_keep, range(len(df.columns))]
return new_df
#-------------------------------------------------------------------------------------------------------------------------
# Comparaison de listes
#-------------------------------------------------------------------------------------------------------------------------
def common_elements(list1, list2):
"""Check of common values of two lists"""
print(f"Liste 1: {len(list1)}")
print(f"Liste 2: {len(list2)}")
print("\n")
print(f"Common elements: ")
return list(set(list1) & set(list2))
def separate_elements(list1, list2):
"""Check of different values of two lists"""
print(f"Liste 1: {len(list1)}")
print(f"Liste 2: {len(list2)}")
print("\n")
print(f"Separate elements: ")
return list(set(list1) ^ set(list2))
| 45.300733
| 132
| 0.628886
| 2,269
| 18,528
| 4.965624
| 0.116351
| 0.044022
| 0.029822
| 0.043135
| 0.798704
| 0.762048
| 0.745363
| 0.72273
| 0.701518
| 0.685719
| 0
| 0.002074
| 0.193383
| 18,528
| 409
| 133
| 45.300734
| 0.751823
| 0.505829
| 0
| 0.631579
| 0
| 0
| 0.052856
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.105263
| false
| 0
| 0.046784
| 0
| 0.25731
| 0.19883
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
f79074cf30dcf53fee5f432cb963f21e06328b86
| 1,027
|
py
|
Python
|
stx/components/__init__.py
|
bakasoft/stx
|
ef6ad209c2acaed83df37f8ebbec52ffc0ff1909
|
[
"MIT"
] | 1
|
2020-04-07T04:42:11.000Z
|
2020-04-07T04:42:11.000Z
|
stx/components/__init__.py
|
stx-lang/python-stx
|
ef6ad209c2acaed83df37f8ebbec52ffc0ff1909
|
[
"MIT"
] | 6
|
2020-03-21T20:16:07.000Z
|
2020-04-10T02:53:38.000Z
|
stx/components/__init__.py
|
stx-lang/python-stx
|
ef6ad209c2acaed83df37f8ebbec52ffc0ff1909
|
[
"MIT"
] | null | null | null |
from ._captured_text import CapturedText # noqa: F401
from ._code_block import CodeBlock # noqa: F401
from ._component import Component, DisplayMode # noqa: F401
from ._composite import Composite # noqa: F401
from ._content_box import ContentBox # noqa: F401
from ._custom_text import CustomText # noqa: F401
from ._figure import Figure # noqa: F401
from ._function_call import FunctionCall # noqa: F401
from ._image import Image # noqa: F401
from ._layout import Layout # noqa: F401
from ._link_text import LinkText # noqa: F401
from ._list_block import ListBlock # noqa: F401
from ._literal import Literal # noqa: F401
from ._paragraph import Paragraph # noqa: F401
from ._plain_text import PlainText # noqa: F401
from ._section import Section # noqa: F401
from ._separator import Separator # noqa: F401
from ._styled_text import StyledText # noqa: F401
from ._table import Table # noqa: F401
from ._table_row import TableRow # noqa: F401
from ._toc import TableOfContents, ElementReference # noqa: F401
| 46.681818
| 65
| 0.771178
| 138
| 1,027
| 5.514493
| 0.304348
| 0.220762
| 0.315375
| 0.044678
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.073512
| 0.165531
| 1,027
| 21
| 66
| 48.904762
| 0.814469
| 0.223953
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
e39f4099369761c80ec8fee7ad5710fe80fd2ba7
| 258
|
py
|
Python
|
pyleecan/Methods/Geometry/Segment/__init__.py
|
IrakozeFD/pyleecan
|
5a93bd98755d880176c1ce8ac90f36ca1b907055
|
[
"Apache-2.0"
] | 95
|
2019-01-23T04:19:45.000Z
|
2022-03-17T18:22:10.000Z
|
pyleecan/Methods/Geometry/Segment/__init__.py
|
IrakozeFD/pyleecan
|
5a93bd98755d880176c1ce8ac90f36ca1b907055
|
[
"Apache-2.0"
] | 366
|
2019-02-20T07:15:08.000Z
|
2022-03-31T13:37:23.000Z
|
pyleecan/Methods/Geometry/Segment/__init__.py
|
IrakozeFD/pyleecan
|
5a93bd98755d880176c1ce8ac90f36ca1b907055
|
[
"Apache-2.0"
] | 74
|
2019-01-24T01:47:31.000Z
|
2022-02-25T05:44:42.000Z
|
class PointSegmentError(Exception):
""" """
pass
class AngleRotationSegmentError(Exception):
""" """
pass
class PointTranslateSegmentError(Exception):
""" """
pass
class NbPointSegmentDError(Exception):
""" """
pass
| 11.217391
| 44
| 0.620155
| 16
| 258
| 10
| 0.4375
| 0.325
| 0.3375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.24031
| 258
| 22
| 45
| 11.727273
| 0.816327
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 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
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
e3ac6412a3ef8cf33d15315deddaf05911f9ce3c
| 669
|
py
|
Python
|
tests/conftest.py
|
ColeVoelpel/virtool
|
859c8d2516f07343bde47f3bae0247dedd76e6c4
|
[
"MIT"
] | 1
|
2019-08-23T00:19:00.000Z
|
2019-08-23T00:19:00.000Z
|
tests/conftest.py
|
ColeVoelpel/virtool
|
859c8d2516f07343bde47f3bae0247dedd76e6c4
|
[
"MIT"
] | null | null | null |
tests/conftest.py
|
ColeVoelpel/virtool
|
859c8d2516f07343bde47f3bae0247dedd76e6c4
|
[
"MIT"
] | null | null | null |
from tests.fixtures.client import *
from tests.fixtures.core import *
from tests.fixtures.db import *
from tests.fixtures.dispatcher import *
from tests.fixtures.documents import *
from tests.fixtures.groups import *
from tests.fixtures.history import *
from tests.fixtures.indexes import *
from tests.fixtures.jobs import *
from tests.fixtures.references import *
from tests.fixtures.response import *
from tests.fixtures.setup import *
from tests.fixtures.users import *
from tests.fixtures.otus import *
def pytest_addoption(parser):
parser.addoption(
"--db-connection-string",
action="store",
default="mongodb://localhost:27017"
)
| 29.086957
| 43
| 0.756353
| 85
| 669
| 5.941176
| 0.352941
| 0.249505
| 0.471287
| 0.592079
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.008741
| 0.144993
| 669
| 22
| 44
| 30.409091
| 0.874126
| 0
| 0
| 0
| 0
| 0
| 0.077728
| 0.070254
| 0
| 0
| 0
| 0
| 0
| 1
| 0.05
| false
| 0
| 0.7
| 0
| 0.75
| 0
| 0
| 0
| 0
| null | 1
| 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
| 1
| 0
| 1
| 0
|
0
| 5
|
e3b10c7a12e165bbbc34966dca65effd5f5b7fb6
| 332
|
py
|
Python
|
tests/conftest.py
|
hexatester/dapodik
|
d89c0fb899c89e866527f6b7b57f741abd6444ea
|
[
"MIT"
] | 4
|
2021-02-01T15:19:35.000Z
|
2022-01-26T02:47:21.000Z
|
tests/conftest.py
|
hexatester/dapodik
|
d89c0fb899c89e866527f6b7b57f741abd6444ea
|
[
"MIT"
] | 3
|
2020-01-08T17:07:15.000Z
|
2020-01-08T18:05:12.000Z
|
tests/conftest.py
|
hexatester/dapodik
|
d89c0fb899c89e866527f6b7b57f741abd6444ea
|
[
"MIT"
] | 2
|
2021-08-04T13:48:08.000Z
|
2021-12-25T02:36:49.000Z
|
import cattr
from datetime import date, datetime
from uuid import UUID
from dapodik.utils.parser import str_to_date, str_to_datetime
cattr.register_structure_hook(date, lambda d, t: str_to_date(d))
cattr.register_structure_hook(datetime, lambda d, t: str_to_datetime(d))
cattr.register_structure_hook(UUID, lambda d, t: UUID(d))
| 30.181818
| 72
| 0.813253
| 56
| 332
| 4.571429
| 0.303571
| 0.078125
| 0.257813
| 0.304688
| 0.3125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.10241
| 332
| 10
| 73
| 33.2
| 0.85906
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.571429
| 0
| 0.571429
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
5408872e5a48e4e79bc6b9b4d73720a91eb1dcb7
| 64
|
py
|
Python
|
board/admin.py
|
mvasilkov/django-balkans
|
c491bf7f13291870c0d271d3c0d57e728d0da02c
|
[
"MIT"
] | 1
|
2021-07-28T18:59:18.000Z
|
2021-07-28T18:59:18.000Z
|
board/admin.py
|
mvasilkov/django-balkans
|
c491bf7f13291870c0d271d3c0d57e728d0da02c
|
[
"MIT"
] | null | null | null |
board/admin.py
|
mvasilkov/django-balkans
|
c491bf7f13291870c0d271d3c0d57e728d0da02c
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
# nobody here but us chickens
| 16
| 32
| 0.796875
| 10
| 64
| 5.1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.171875
| 64
| 3
| 33
| 21.333333
| 0.962264
| 0.421875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
54167044b0b9528f39d384a8859884c4a7e290a6
| 152
|
py
|
Python
|
scripts/build_automake.py
|
1byte2bytes/SydChain
|
ac1fffd9f87c2afa6e2f6a0540d69dad0815ef4f
|
[
"MIT"
] | null | null | null |
scripts/build_automake.py
|
1byte2bytes/SydChain
|
ac1fffd9f87c2afa6e2f6a0540d69dad0815ef4f
|
[
"MIT"
] | null | null | null |
scripts/build_automake.py
|
1byte2bytes/SydChain
|
ac1fffd9f87c2afa6e2f6a0540d69dad0815ef4f
|
[
"MIT"
] | null | null | null |
# Copyright (c) Sydney Erickson 2017
import buildlib
import buildsettings
import build_autoconf
buildlib.build_configure("automake-1.15.1.tar.gz", "")
| 21.714286
| 54
| 0.796053
| 21
| 152
| 5.666667
| 0.761905
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.058394
| 0.098684
| 152
| 7
| 54
| 21.714286
| 0.810219
| 0.223684
| 0
| 0
| 0
| 0
| 0.188034
| 0.188034
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.75
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
542affb1f2c029d53643c486244accbc33654c3e
| 117
|
py
|
Python
|
django_app/hello/admin.py
|
nogawanogawa/django_sample
|
0d3a3c9b4957dd1dd1edeb4c59cfd3c8a4d9c968
|
[
"MIT"
] | null | null | null |
django_app/hello/admin.py
|
nogawanogawa/django_sample
|
0d3a3c9b4957dd1dd1edeb4c59cfd3c8a4d9c968
|
[
"MIT"
] | 4
|
2018-10-15T02:58:35.000Z
|
2021-06-10T20:49:35.000Z
|
webresume/api/admin.py
|
cmput401-fall2018/web-app-ci-cd-with-travis-ci-fmachaal
|
a5d30ea4ed94b64199eb3de2555e5675c783600b
|
[
"MIT"
] | 1
|
2018-10-16T22:46:53.000Z
|
2018-10-16T22:46:53.000Z
|
from django.contrib import admin
from .models import Person
# Register your models here.
admin.site.register(Person)
| 23.4
| 32
| 0.811966
| 17
| 117
| 5.588235
| 0.647059
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.119658
| 117
| 5
| 33
| 23.4
| 0.92233
| 0.222222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
582861c37ae4f2e701f7fba2dd272c53c3434e15
| 160
|
py
|
Python
|
sherlock/imports/__init__.py
|
Mattlk13/sherlock
|
8b6d12d18b2d2529f972b028c5b9b9cfb1ac0afa
|
[
"MIT"
] | null | null | null |
sherlock/imports/__init__.py
|
Mattlk13/sherlock
|
8b6d12d18b2d2529f972b028c5b9b9cfb1ac0afa
|
[
"MIT"
] | null | null | null |
sherlock/imports/__init__.py
|
Mattlk13/sherlock
|
8b6d12d18b2d2529f972b028c5b9b9cfb1ac0afa
|
[
"MIT"
] | null | null | null |
from ifs import ifs
from veron import veron
from marshall import marshall
from _base_importer import _base_importer
from ned import ned
from ned_d import ned_d
| 22.857143
| 41
| 0.85
| 28
| 160
| 4.642857
| 0.321429
| 0.184615
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15
| 160
| 6
| 42
| 26.666667
| 0.955882
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
58583c475111897941100cbf84654731d6df8b50
| 36
|
py
|
Python
|
tests/__init__.py
|
ykemiche/merlin
|
f0980d7ee5dbe04ac083ba1f2bb34a9c2d3aa343
|
[
"MIT"
] | null | null | null |
tests/__init__.py
|
ykemiche/merlin
|
f0980d7ee5dbe04ac083ba1f2bb34a9c2d3aa343
|
[
"MIT"
] | null | null | null |
tests/__init__.py
|
ykemiche/merlin
|
f0980d7ee5dbe04ac083ba1f2bb34a9c2d3aa343
|
[
"MIT"
] | null | null | null |
"""Unit test package for merlin."""
| 18
| 35
| 0.666667
| 5
| 36
| 4.8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.138889
| 36
| 1
| 36
| 36
| 0.774194
| 0.805556
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
58a45234f930c3110a6e492e5cf2fd79e3464a36
| 181
|
py
|
Python
|
scene_parsing/__init__.py
|
kanghuangnj/scene_parsing_demo
|
bfce3abae268402e8b1555f48ade4d0c8f6f5268
|
[
"BSD-3-Clause"
] | null | null | null |
scene_parsing/__init__.py
|
kanghuangnj/scene_parsing_demo
|
bfce3abae268402e8b1555f48ade4d0c8f6f5268
|
[
"BSD-3-Clause"
] | null | null | null |
scene_parsing/__init__.py
|
kanghuangnj/scene_parsing_demo
|
bfce3abae268402e8b1555f48ade4d0c8f6f5268
|
[
"BSD-3-Clause"
] | null | null | null |
from .dataset import TestDataset
from .models import ModelBuilder, SegmentationModule
from .utils import plot_colortable, colorEncode, find_recursive, setup_logger
from . import lib
| 45.25
| 77
| 0.850829
| 22
| 181
| 6.863636
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.104972
| 181
| 4
| 78
| 45.25
| 0.932099
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
58a4dcc620625dcad0378448b9692d6c3fe87657
| 142
|
py
|
Python
|
common/errors.py
|
dahakawang/real_estate_robot
|
d8693e7f6f816602c8f5d37475509b1cbd6da58a
|
[
"MIT"
] | null | null | null |
common/errors.py
|
dahakawang/real_estate_robot
|
d8693e7f6f816602c8f5d37475509b1cbd6da58a
|
[
"MIT"
] | null | null | null |
common/errors.py
|
dahakawang/real_estate_robot
|
d8693e7f6f816602c8f5d37475509b1cbd6da58a
|
[
"MIT"
] | null | null | null |
class HttpFetchError(BaseException):
pass
class MaxExceptionError(BaseException):
pass
class KnownError(BaseException):
pass
| 11.833333
| 39
| 0.753521
| 12
| 142
| 8.916667
| 0.5
| 0.476636
| 0.411215
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.183099
| 142
| 11
| 40
| 12.909091
| 0.922414
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 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
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
542eed6db8f794a8b5047a10d0a2720d407c55c4
| 157
|
py
|
Python
|
causalimpact/tests/conftest.py
|
cdutr/causalimpact-1
|
73b4b8f077626ae2999a88f5acf1731cce121407
|
[
"Apache-2.0"
] | 152
|
2016-11-02T20:39:43.000Z
|
2022-03-30T16:26:30.000Z
|
causalimpact/tests/conftest.py
|
cdutr/causalimpact-1
|
73b4b8f077626ae2999a88f5acf1731cce121407
|
[
"Apache-2.0"
] | 21
|
2016-12-07T16:44:42.000Z
|
2022-01-05T12:06:54.000Z
|
causalimpact/tests/conftest.py
|
cdutr/causalimpact-1
|
73b4b8f077626ae2999a88f5acf1731cce121407
|
[
"Apache-2.0"
] | 44
|
2016-10-06T18:59:45.000Z
|
2022-03-18T08:45:56.000Z
|
import os
import pytest
here = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture
def FIXTURES_FOLDER():
return os.path.join(here, 'fixtures')
| 17.444444
| 49
| 0.745223
| 23
| 157
| 4.869565
| 0.608696
| 0.160714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.121019
| 157
| 8
| 50
| 19.625
| 0.811594
| 0
| 0
| 0
| 0
| 0
| 0.050955
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.333333
| 0.166667
| 0.666667
| 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
| 1
| 1
| 1
| 0
|
0
| 5
|
54366dfa04711075fd1ec037cfc82215cc1d5809
| 92
|
py
|
Python
|
ArticleRecommender/article_recommender/__init__.py
|
celestinhermez/recommendation_engine_ibm
|
bc30ea2509527af37bcb7fd4684c52f95e82f3bb
|
[
"MIT"
] | null | null | null |
ArticleRecommender/article_recommender/__init__.py
|
celestinhermez/recommendation_engine_ibm
|
bc30ea2509527af37bcb7fd4684c52f95e82f3bb
|
[
"MIT"
] | null | null | null |
ArticleRecommender/article_recommender/__init__.py
|
celestinhermez/recommendation_engine_ibm
|
bc30ea2509527af37bcb7fd4684c52f95e82f3bb
|
[
"MIT"
] | null | null | null |
from .recommender import ArticleRecommender
from . import recommender_helper_functions as rf
| 46
| 48
| 0.880435
| 11
| 92
| 7.181818
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.097826
| 92
| 2
| 48
| 46
| 0.951807
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
544d8787466f637ed09a651d7cb768a56aa64fe4
| 154
|
py
|
Python
|
myproject/YT_Project-1/spotify/credentials.py
|
captainTOKIO/Premchand_Aug2022_fullstack_august_python1
|
5fbbdd106a764c2f862cf933fdcd69d6bf4ebdf0
|
[
"MIT"
] | null | null | null |
myproject/YT_Project-1/spotify/credentials.py
|
captainTOKIO/Premchand_Aug2022_fullstack_august_python1
|
5fbbdd106a764c2f862cf933fdcd69d6bf4ebdf0
|
[
"MIT"
] | null | null | null |
myproject/YT_Project-1/spotify/credentials.py
|
captainTOKIO/Premchand_Aug2022_fullstack_august_python1
|
5fbbdd106a764c2f862cf933fdcd69d6bf4ebdf0
|
[
"MIT"
] | null | null | null |
CLIENT_ID = "3266e30c851a4b7581a6a3fa2f832476"
CLIENT_SECRET = "31c15011281441babdab2adbc4152cbf"
REDIRECT_URI = "http://127.0.0.1:8000/spotify/redirect"
| 38.5
| 55
| 0.824675
| 16
| 154
| 7.75
| 0.8125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.351724
| 0.058442
| 154
| 3
| 56
| 51.333333
| 0.503448
| 0
| 0
| 0
| 0
| 0
| 0.662338
| 0.415584
| 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
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
5459d2fe1f29ca4b2b750a66f55094f19c69b259
| 146
|
py
|
Python
|
api_keys.py
|
alienor1/python_api_challenge
|
fac4aba29cf1baef065e5a8b401051623a299431
|
[
"ADSL"
] | null | null | null |
api_keys.py
|
alienor1/python_api_challenge
|
fac4aba29cf1baef065e5a8b401051623a299431
|
[
"ADSL"
] | null | null | null |
api_keys.py
|
alienor1/python_api_challenge
|
fac4aba29cf1baef065e5a8b401051623a299431
|
[
"ADSL"
] | null | null | null |
# OpenWeatherMap API Key
weather_api_key = "4b6f407bc3690ac1562800a586bbda13"
# Google API Key
g_key = "AIzaSyBH17Xn87x8SM7waCAzHnS4gKMWRX96iDQ"
| 24.333333
| 52
| 0.842466
| 13
| 146
| 9.230769
| 0.615385
| 0.15
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.229008
| 0.10274
| 146
| 5
| 53
| 29.2
| 0.687023
| 0.253425
| 0
| 0
| 0
| 0
| 0.669811
| 0.669811
| 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
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
5489ca700accef45d7f092eacfaf2b6ff1bf595b
| 18,320
|
py
|
Python
|
Tests/test_GACrossover.py
|
yangwu91/biopython
|
ce1fcd9e49f14661207ec07b75b34d9adb9d9acc
|
[
"BSD-3-Clause"
] | 2
|
2019-11-21T02:34:52.000Z
|
2021-02-14T07:47:43.000Z
|
Tests/test_GACrossover.py
|
EngineerKhan/biopython
|
4e359e2aa9255aa8b420ad512d3c4cbe15c07a35
|
[
"BSD-3-Clause"
] | null | null | null |
Tests/test_GACrossover.py
|
EngineerKhan/biopython
|
4e359e2aa9255aa8b420ad512d3c4cbe15c07a35
|
[
"BSD-3-Clause"
] | 1
|
2021-04-16T09:48:23.000Z
|
2021-04-16T09:48:23.000Z
|
#!/usr/bin/env python
"""Tests different Genetic Algorithm crossover classes.
"""
# standard library
import unittest
# biopython
from Bio.Seq import MutableSeq
from Bio.Alphabet import SingleLetterAlphabet
# local stuff
import warnings
from Bio import BiopythonDeprecationWarning
with warnings.catch_warnings():
warnings.simplefilter('ignore', BiopythonDeprecationWarning)
from Bio.GA.Organism import Organism
from Bio.GA.Crossover.General import SafeFitnessCrossover
from Bio.GA.Crossover.GeneralPoint import GeneralPointCrossover
from Bio.GA.Crossover.GeneralPoint import InterleaveCrossover
from Bio.GA.Crossover.TwoPoint import TwoPointCrossover
from Bio.GA.Crossover.Point import SinglePointCrossover
from Bio.GA.Crossover.Uniform import UniformCrossover
class TestAlphabet(SingleLetterAlphabet):
"""Simple test alphabet.
"""
letters = ["1", "2", "3"]
def contains(self, oalpha):
return True
def test_fitness(genome):
"""Simple class for calculating fitnesses.
"""
seq_genome = genome.toseq()
return int(str(seq_genome))
class SinglePointTest(unittest.TestCase):
"""Test simple point crossovers.
"""
def setUp(self):
self.alphabet = TestAlphabet()
genome_1 = MutableSeq("11111", self.alphabet)
self.org_1 = Organism(genome_1, test_fitness)
genome_2 = MutableSeq("22222", self.alphabet)
self.org_2 = Organism(genome_2, test_fitness)
self.crossover = SinglePointCrossover(1.0)
def test_basic_crossover(self):
"""Test basic point crossover functionality.
"""
start_genome_1 = self.org_1.genome[:]
start_genome_2 = self.org_2.genome[:]
new_org_1, new_org_2 = self.crossover.do_crossover(self.org_1,
self.org_2)
self.assertNotEqual(str(new_org_1.genome), str(start_genome_1),
"Did not perform a crossover when expected.")
self.assertNotEqual(str(new_org_2.genome), str(start_genome_2),
"Did not perform a crossover when expected.")
self.assertNotEqual(str(new_org_1), str(self.org_1),
"Returned an exact copy of the original organism.")
self.assertNotEqual(str(new_org_2), str(self.org_2),
"Returned an exact copy of the original organism.")
class UniformTest(unittest.TestCase):
"""Test simple point crossovers.
"""
def setUp(self):
self.alphabet = TestAlphabet()
genome_1 = MutableSeq("11111111", self.alphabet)
self.org_1 = Organism(genome_1, test_fitness)
genome_2 = MutableSeq("22222222", self.alphabet)
self.org_2 = Organism(genome_2, test_fitness)
genome_3 = MutableSeq("333", self.alphabet)
self.org_3 = Organism(genome_3, test_fitness)
self.crossover = UniformCrossover(1.0, 0.8)
def test_basic_crossover(self):
"""Test basic uniform crossover functionality.
"""
start_genome_1 = self.org_1.genome[:]
start_genome_2 = self.org_2.genome[:]
new_org_1, new_org_2 = self.crossover.do_crossover(self.org_1,
self.org_2)
self.assertNotEqual(str(new_org_1.genome), str(start_genome_1),
"Did not perform a crossover when expected.")
self.assertNotEqual(str(new_org_2.genome), str(start_genome_2),
"Did not perform a crossover when expected.")
self.assertNotEqual(str(new_org_1), str(self.org_1),
"Returned an exact copy of the original organism.")
self.assertNotEqual(str(new_org_2), str(self.org_2),
"Returned an exact copy of the original organism.")
def test_ds_prop_uniform_crossover(self):
"""Test properties of differing genome length, uniform crossovers.
"""
new_org_1, new_org_2 = self.crossover.do_crossover(self.org_1,
self.org_3)
self.assertTrue(len(new_org_1.genome) > len(new_org_2.genome),
"Strings are of wrong sizes after uniform crossover.")
self.assertEqual(str(new_org_2.genome).count("1"),
str(new_org_1.genome).count("3"),
"There should be equal distributions of the smaller string")
self.assertEqual(str(self.org_1.genome[len(new_org_2.genome):]),
str(new_org_1.genome[len(new_org_2.genome):]),
"Uniform should not touch non-overlapping elements of genome")
def test_ss_prop_uniform_crossover(self):
"""Test properties of equal genome length, uniform crossovers.
"""
new_org_1, new_org_2 = self.crossover.do_crossover(self.org_1,
self.org_2)
self.assertEqual(len(new_org_1.genome), len(new_org_2.genome),
"Strings are of different sizes after uniform crossover.")
self.assertEqual(str(new_org_1.genome).count("1"),
str(new_org_2.genome).count("2"),
"There should be equal, inverse distributions")
self.assertEqual(str(new_org_1.genome).count("2"),
str(new_org_2.genome).count("1"),
"There should be equal, inverse distributions")
class InterleaveTest(unittest.TestCase):
"""Test 'simple' 4-point crossovers.
"""
def setUp(self):
self.alphabet = TestAlphabet()
genome_1 = MutableSeq("11111", self.alphabet)
self.org_1 = Organism(genome_1, test_fitness)
genome_2 = MutableSeq("22222", self.alphabet)
self.org_2 = Organism(genome_2, test_fitness)
genome_3 = MutableSeq("333333333", self.alphabet)
self.org_3 = Organism(genome_3, test_fitness)
self._crossover = InterleaveCrossover(1.0)
def test_basic_crossover(self):
"""Test basic interleave crossover functionality.
"""
start_genome_1 = self.org_1.genome[:]
start_genome_2 = self.org_2.genome[:]
new_org_1, new_org_2 = self._crossover.do_crossover(self.org_1,
self.org_2)
self.assertNotEqual(str(new_org_1.genome), str(start_genome_1),
"Did not perform a crossover when expected.")
self.assertNotEqual(str(new_org_2.genome), str(start_genome_2),
"Did not perform a crossover when expected.")
self.assertNotEqual(str(new_org_1), str(self.org_1),
"Returned an exact copy of the original organism.")
self.assertNotEqual(str(new_org_2), str(self.org_2),
"Returned an exact copy of the original organism.")
def test_prop_sym_crossover(self):
"""Test properties of interleave point crossover."""
new_org_1, new_org_2 = self._crossover.do_crossover(self.org_1,
self.org_2)
self.assertEqual(len(new_org_1.genome), len(new_org_2.genome),
"Strings are of different sizes after interleave point crossover.")
self.assertEqual(str(new_org_1.genome).count("1"),
str(new_org_2.genome).count("2"),
"There should be equal, inverse distributions")
self.assertEqual(str(new_org_1.genome).count("2"),
str(new_org_2.genome).count("1"),
"There should be equal, inverse distributions")
self.assertEqual(str(new_org_1.genome), "12121",
"Did not interleave.")
self.assertEqual(str(new_org_2.genome), "21212",
"Did not interleave.")
def test_prop_asym_crossover(self):
"""Test basic interleave crossover with asymmetric genomes."""
start_genome_1 = self.org_1.genome[:]
start_genome_3 = self.org_3.genome[:]
new_org_1, new_org_3 = self._crossover.do_crossover(self.org_1,
self.org_3)
self.assertNotEqual(str(new_org_1.genome), str(start_genome_1),
"Did not perform a crossover when expected.")
self.assertNotEqual(str(new_org_3.genome), str(start_genome_3),
"Did not perform a crossover when expected.")
self.assertNotEqual(str(new_org_1), str(self.org_1),
"Returned an exact copy of the original organism.")
self.assertNotEqual(str(new_org_3), str(self.org_3),
"Returned an exact copy of the original organism.")
self.assertEqual(str(new_org_1.genome), "13131",
"Did not interleave with growth.")
self.assertEqual(str(new_org_3.genome), "31313333",
"Did not interleave with growth.")
class FourPointTest(unittest.TestCase):
"""Test 'simple' 4-point crossovers.
"""
def setUp(self):
self.alphabet = TestAlphabet()
genome_1 = MutableSeq("11111", self.alphabet)
self.org_1 = Organism(genome_1, test_fitness)
genome_2 = MutableSeq("22222", self.alphabet)
self.org_2 = Organism(genome_2, test_fitness)
self.sym_crossover = GeneralPointCrossover(3, 1.0)
self.asym_crossover = GeneralPointCrossover(4, 1.0)
def test_basic_crossover(self):
"""Test basic 4-point crossover functionality.
"""
start_genome_1 = self.org_1.genome[:]
start_genome_2 = self.org_2.genome[:]
new_org_1, new_org_2 = self.sym_crossover.do_crossover(self.org_1,
self.org_2)
self.assertNotEqual(str(new_org_1.genome), str(start_genome_1),
"Did not perform a crossover when expected.")
self.assertNotEqual(str(new_org_2.genome), str(start_genome_2),
"Did not perform a crossover when expected.")
self.assertNotEqual(str(new_org_1), str(self.org_1),
"Returned an exact copy of the original organism.")
self.assertNotEqual(str(new_org_2), str(self.org_2),
"Returned an exact copy of the original organism.")
def test_prop_sym_crossover(self):
"""Test properties of symmetric 4-point crossover.
"""
new_org_1, new_org_2 = self.sym_crossover.do_crossover(self.org_1,
self.org_2)
self.assertEqual(len(new_org_1.genome), len(new_org_2.genome),
"Strings are of different sizes after symmetric crossover.")
self.assertEqual(str(new_org_1.genome).count("1"),
str(new_org_2.genome).count("2"),
"There should be equal, inverse distributions")
self.assertEqual(str(new_org_1.genome).count("2"),
str(new_org_2.genome).count("1"),
"There should be equal, inverse distributions")
def test_basic_asym_crossover(self):
"""Test basic asymmetric 2-point crossover functionality.
"""
start_genome_1 = self.org_1.genome[:]
start_genome_2 = self.org_2.genome[:]
new_org_1, new_org_2 = self.asym_crossover.do_crossover(self.org_1,
self.org_2)
self.assertNotEqual(str(new_org_1.genome), str(start_genome_1),
"Did not perform a crossover when expected.")
self.assertNotEqual(str(new_org_2.genome), str(start_genome_2),
"Did not perform a crossover when expected.")
self.assertNotEqual(str(new_org_1), str(self.org_1),
"Returned an exact copy of the original organism.")
self.assertNotEqual(str(new_org_2), str(self.org_2),
"Returned an exact copy of the original organism.")
class TwoPointTest(unittest.TestCase):
"""Test simple 2-point crossovers.
"""
def setUp(self):
self.alphabet = TestAlphabet()
genome_1 = MutableSeq("11111111", self.alphabet)
self.org_1 = Organism(genome_1, test_fitness)
genome_2 = MutableSeq("22222222", self.alphabet)
self.org_2 = Organism(genome_2, test_fitness)
self.asym_crossover = TwoPointCrossover(1.0)
def test_basic_asym_crossover(self):
"""Test basic asymmetric 2-point crossover functionality.
"""
start_genome_1 = self.org_1.genome[:]
start_genome_2 = self.org_2.genome[:]
new_org_1, new_org_2 = self.asym_crossover.do_crossover(self.org_1,
self.org_2)
self.assertNotEqual(str(new_org_1.genome), str(start_genome_1),
"Did not perform a crossover when expected.")
self.assertNotEqual(str(new_org_2.genome), str(start_genome_2),
"Did not perform a crossover when expected.")
self.assertNotEqual(str(new_org_1), str(self.org_1),
"Returned an exact copy of the original organism.")
self.assertNotEqual(str(new_org_2), str(self.org_2),
"Returned an exact copy of the original organism.")
class TestCrossover(object):
"""Provide basic crossover functionality for testing SafeFitness."""
def __init__(self):
"""Initialize."""
# whether or not to produce new organisms with lower fitness
# higher fitness, or the same organism
self.type = "lower"
def do_crossover(self, org_1, org_2):
seq_org1 = org_1.genome.toseq()
seq_org2 = org_2.genome.toseq()
org1_genome = str(seq_org1)
org2_genome = str(seq_org2)
new_org_1 = org_1.copy()
new_org_2 = org_2.copy()
if self.type == "same":
return new_org_1, new_org_2
elif self.type == "lower":
new_org1_genome = str(int(org1_genome) - 1)
new_org2_genome = str(int(org2_genome) - 1)
new_org_1.genome = MutableSeq(new_org1_genome,
org_1.genome.alphabet)
new_org_2.genome = MutableSeq(new_org2_genome,
org_2.genome.alphabet)
elif self.type == "higher":
new_org1_genome = str(int(org1_genome) + 1)
new_org2_genome = str(int(org2_genome) + 1)
else:
raise ValueError("Got type %s" % self.type)
new_org_1.genome = MutableSeq(new_org1_genome,
org_1.genome.alphabet)
new_org_2.genome = MutableSeq(new_org2_genome,
org_2.genome.alphabet)
return new_org_1, new_org_2
class SafeFitnessTest(unittest.TestCase):
"""Tests for crossovers which do not reduce fitness.
"""
def setUp(self):
self.alphabet = TestAlphabet()
genome_1 = MutableSeq("2", self.alphabet)
self.org_1 = Organism(genome_1, test_fitness)
genome_2 = MutableSeq("2", self.alphabet)
self.org_2 = Organism(genome_2, test_fitness)
self.test_crossover = TestCrossover()
def test_keep_higher(self):
"""Make sure we always keep higher fitness when specified.
"""
crossover = SafeFitnessCrossover(self.test_crossover)
self.test_crossover.type = "same"
new_org_1, new_org_2 = crossover.do_crossover(self.org_1, self.org_2)
self.assertEqual(str(new_org_1), str(self.org_1),
"Did not retain organism for same fitness.")
self.assertEqual(str(new_org_2), str(self.org_2),
"Did not retain organism for same fitness.")
self.test_crossover.type = "lower"
new_org_1, new_org_2 = crossover.do_crossover(self.org_1, self.org_2)
self.assertEqual(str(new_org_1), str(self.org_1),
"Did not retain organism when crossover had lower fitness.")
self.assertEqual(str(new_org_2), str(self.org_2),
"Did not retain organism when crossover had lower fitness.")
self.test_crossover.type = "higher"
new_org_1, new_org_2 = crossover.do_crossover(self.org_1, self.org_2)
self.assertTrue(new_org_1.fitness > self.org_1.fitness and
new_org_2.fitness > self.org_2.fitness,
"Did not get new organism when it had higher fitness.")
def test_keep_lower(self):
"""Make sure we do normal crossover functionality when specified.
"""
crossover = SafeFitnessCrossover(self.test_crossover, 1.0)
self.test_crossover.type = "same"
new_org_1, new_org_2 = crossover.do_crossover(self.org_1, self.org_2)
self.assertEqual(str(new_org_1), str(self.org_1),
"Did not retain organism for same fitness.")
self.assertEqual(str(new_org_2), str(self.org_2),
"Did not retain organism for same fitness.")
self.test_crossover.type = "lower"
new_org_1, new_org_2 = crossover.do_crossover(self.org_1, self.org_2)
self.assertNotEqual(str(new_org_1), str(self.org_1),
"Retained lower fitness organism in crossover.")
self.assertNotEqual(str(new_org_2), str(self.org_2),
"Retained lower fitness organism in crossover.")
self.test_crossover.type = "higher"
new_org_1, new_org_2 = crossover.do_crossover(self.org_1, self.org_2)
self.assertTrue(new_org_1.fitness > self.org_1.fitness and
new_org_2.fitness > self.org_2.fitness,
"Did not get new organism under higher fitness conditions.")
if __name__ == "__main__":
runner = unittest.TextTestRunner(verbosity=2)
unittest.main(testRunner=runner)
| 41.922197
| 87
| 0.603057
| 2,241
| 18,320
| 4.689871
| 0.084337
| 0.06451
| 0.037298
| 0.068506
| 0.79705
| 0.785918
| 0.770029
| 0.729971
| 0.727498
| 0.693625
| 0
| 0.033708
| 0.300437
| 18,320
| 436
| 88
| 42.018349
| 0.786361
| 0.075109
| 0
| 0.69338
| 0
| 0
| 0.156687
| 0
| 0
| 0
| 0
| 0
| 0.188153
| 1
| 0.080139
| false
| 0
| 0.041812
| 0.003484
| 0.167247
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
49c416d1ab56897bb60188d84ec82e7e5a359c54
| 89
|
py
|
Python
|
plottr/plot/__init__.py
|
koubitlabuiuc/plottr
|
c4c31a13fb7f2cf86abda1df26f67380fdcaa72b
|
[
"MIT"
] | 19
|
2020-10-20T15:45:02.000Z
|
2022-03-15T06:39:44.000Z
|
plottr/plot/__init__.py
|
koubitlabuiuc/plottr
|
c4c31a13fb7f2cf86abda1df26f67380fdcaa72b
|
[
"MIT"
] | 103
|
2020-04-17T15:18:50.000Z
|
2022-03-28T14:18:15.000Z
|
plottr/plot/__init__.py
|
koubitlabuiuc/plottr
|
c4c31a13fb7f2cf86abda1df26f67380fdcaa72b
|
[
"MIT"
] | 22
|
2020-04-17T12:52:49.000Z
|
2022-02-15T21:21:44.000Z
|
from .base import PlotNode, PlotWidgetContainer, makeFlowchartWithPlot, \
PlotWidget
| 29.666667
| 73
| 0.808989
| 7
| 89
| 10.285714
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.134831
| 89
| 2
| 74
| 44.5
| 0.935065
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
49e280dfbfe26239dde73929c10b0da60f18c1eb
| 12,281
|
py
|
Python
|
sdk/python/pulumi_grafana/user.py
|
jorgeperezc/pulumi-grafana
|
bbfd904e1bf5554ce47690e71ef172904d8787b5
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_grafana/user.py
|
jorgeperezc/pulumi-grafana
|
bbfd904e1bf5554ce47690e71ef172904d8787b5
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_grafana/user.py
|
jorgeperezc/pulumi-grafana
|
bbfd904e1bf5554ce47690e71ef172904d8787b5
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
__all__ = ['UserArgs', 'User']
@pulumi.input_type
class UserArgs:
def __init__(__self__, *,
email: pulumi.Input[str],
password: pulumi.Input[str],
is_admin: Optional[pulumi.Input[bool]] = None,
login: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None):
"""
The set of arguments for constructing a User resource.
:param pulumi.Input[str] email: The email address of the Grafana user.
:param pulumi.Input[str] password: The password for the Grafana user.
:param pulumi.Input[bool] is_admin: Whether to make user an admin.
:param pulumi.Input[str] login: The username for the Grafana user.
:param pulumi.Input[str] name: The display name for the Grafana user.
"""
pulumi.set(__self__, "email", email)
pulumi.set(__self__, "password", password)
if is_admin is not None:
pulumi.set(__self__, "is_admin", is_admin)
if login is not None:
pulumi.set(__self__, "login", login)
if name is not None:
pulumi.set(__self__, "name", name)
@property
@pulumi.getter
def email(self) -> pulumi.Input[str]:
"""
The email address of the Grafana user.
"""
return pulumi.get(self, "email")
@email.setter
def email(self, value: pulumi.Input[str]):
pulumi.set(self, "email", value)
@property
@pulumi.getter
def password(self) -> pulumi.Input[str]:
"""
The password for the Grafana user.
"""
return pulumi.get(self, "password")
@password.setter
def password(self, value: pulumi.Input[str]):
pulumi.set(self, "password", value)
@property
@pulumi.getter(name="isAdmin")
def is_admin(self) -> Optional[pulumi.Input[bool]]:
"""
Whether to make user an admin.
"""
return pulumi.get(self, "is_admin")
@is_admin.setter
def is_admin(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "is_admin", value)
@property
@pulumi.getter
def login(self) -> Optional[pulumi.Input[str]]:
"""
The username for the Grafana user.
"""
return pulumi.get(self, "login")
@login.setter
def login(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "login", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
The display name for the Grafana user.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@pulumi.input_type
class _UserState:
def __init__(__self__, *,
email: Optional[pulumi.Input[str]] = None,
is_admin: Optional[pulumi.Input[bool]] = None,
login: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
password: Optional[pulumi.Input[str]] = None):
"""
Input properties used for looking up and filtering User resources.
:param pulumi.Input[str] email: The email address of the Grafana user.
:param pulumi.Input[bool] is_admin: Whether to make user an admin.
:param pulumi.Input[str] login: The username for the Grafana user.
:param pulumi.Input[str] name: The display name for the Grafana user.
:param pulumi.Input[str] password: The password for the Grafana user.
"""
if email is not None:
pulumi.set(__self__, "email", email)
if is_admin is not None:
pulumi.set(__self__, "is_admin", is_admin)
if login is not None:
pulumi.set(__self__, "login", login)
if name is not None:
pulumi.set(__self__, "name", name)
if password is not None:
pulumi.set(__self__, "password", password)
@property
@pulumi.getter
def email(self) -> Optional[pulumi.Input[str]]:
"""
The email address of the Grafana user.
"""
return pulumi.get(self, "email")
@email.setter
def email(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "email", value)
@property
@pulumi.getter(name="isAdmin")
def is_admin(self) -> Optional[pulumi.Input[bool]]:
"""
Whether to make user an admin.
"""
return pulumi.get(self, "is_admin")
@is_admin.setter
def is_admin(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "is_admin", value)
@property
@pulumi.getter
def login(self) -> Optional[pulumi.Input[str]]:
"""
The username for the Grafana user.
"""
return pulumi.get(self, "login")
@login.setter
def login(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "login", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
The display name for the Grafana user.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def password(self) -> Optional[pulumi.Input[str]]:
"""
The password for the Grafana user.
"""
return pulumi.get(self, "password")
@password.setter
def password(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "password", value)
class User(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
email: Optional[pulumi.Input[str]] = None,
is_admin: Optional[pulumi.Input[bool]] = None,
login: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
password: Optional[pulumi.Input[str]] = None,
__props__=None):
"""
Create a User resource with the given unique name, props, and options.
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] email: The email address of the Grafana user.
:param pulumi.Input[bool] is_admin: Whether to make user an admin.
:param pulumi.Input[str] login: The username for the Grafana user.
:param pulumi.Input[str] name: The display name for the Grafana user.
:param pulumi.Input[str] password: The password for the Grafana user.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: UserArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
Create a User resource with the given unique name, props, and options.
:param str resource_name: The name of the resource.
:param UserArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
def __init__(__self__, resource_name: str, *args, **kwargs):
resource_args, opts = _utilities.get_resource_args_opts(UserArgs, pulumi.ResourceOptions, *args, **kwargs)
if resource_args is not None:
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
else:
__self__._internal_init(resource_name, *args, **kwargs)
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
email: Optional[pulumi.Input[str]] = None,
is_admin: Optional[pulumi.Input[bool]] = None,
login: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
password: Optional[pulumi.Input[str]] = None,
__props__=None):
if opts is None:
opts = pulumi.ResourceOptions()
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.version is None:
opts.version = _utilities.get_version()
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = UserArgs.__new__(UserArgs)
if email is None and not opts.urn:
raise TypeError("Missing required property 'email'")
__props__.__dict__["email"] = email
__props__.__dict__["is_admin"] = is_admin
__props__.__dict__["login"] = login
__props__.__dict__["name"] = name
if password is None and not opts.urn:
raise TypeError("Missing required property 'password'")
__props__.__dict__["password"] = password
super(User, __self__).__init__(
'grafana:index/user:User',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
email: Optional[pulumi.Input[str]] = None,
is_admin: Optional[pulumi.Input[bool]] = None,
login: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
password: Optional[pulumi.Input[str]] = None) -> 'User':
"""
Get an existing User resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] email: The email address of the Grafana user.
:param pulumi.Input[bool] is_admin: Whether to make user an admin.
:param pulumi.Input[str] login: The username for the Grafana user.
:param pulumi.Input[str] name: The display name for the Grafana user.
:param pulumi.Input[str] password: The password for the Grafana user.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _UserState.__new__(_UserState)
__props__.__dict__["email"] = email
__props__.__dict__["is_admin"] = is_admin
__props__.__dict__["login"] = login
__props__.__dict__["name"] = name
__props__.__dict__["password"] = password
return User(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter
def email(self) -> pulumi.Output[str]:
"""
The email address of the Grafana user.
"""
return pulumi.get(self, "email")
@property
@pulumi.getter(name="isAdmin")
def is_admin(self) -> pulumi.Output[Optional[bool]]:
"""
Whether to make user an admin.
"""
return pulumi.get(self, "is_admin")
@property
@pulumi.getter
def login(self) -> pulumi.Output[Optional[str]]:
"""
The username for the Grafana user.
"""
return pulumi.get(self, "login")
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
"""
The display name for the Grafana user.
"""
return pulumi.get(self, "name")
@property
@pulumi.getter
def password(self) -> pulumi.Output[str]:
"""
The password for the Grafana user.
"""
return pulumi.get(self, "password")
| 36.550595
| 134
| 0.603208
| 1,451
| 12,281
| 4.901447
| 0.093728
| 0.106721
| 0.106299
| 0.092801
| 0.77784
| 0.741142
| 0.719348
| 0.685602
| 0.671682
| 0.659308
| 0
| 0.000114
| 0.28654
| 12,281
| 335
| 135
| 36.659701
| 0.811573
| 0.244443
| 0
| 0.691176
| 1
| 0
| 0.064779
| 0.00268
| 0
| 0
| 0
| 0
| 0
| 1
| 0.156863
| false
| 0.122549
| 0.02451
| 0
| 0.27451
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 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
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
b7101206359072877fc7f9d18d76ceaf5235e784
| 170
|
py
|
Python
|
tests/resources/test_resources.py
|
andreshndz/cuenca-python
|
ca9f0f078584f1458e71baeb4cd15fcc55b40397
|
[
"MIT"
] | 6
|
2020-11-02T21:03:11.000Z
|
2022-01-13T23:12:01.000Z
|
tests/resources/test_resources.py
|
andreshndz/cuenca-python
|
ca9f0f078584f1458e71baeb4cd15fcc55b40397
|
[
"MIT"
] | 220
|
2020-05-13T19:20:57.000Z
|
2022-03-30T22:03:03.000Z
|
tests/resources/test_resources.py
|
andreshndz/cuenca-python
|
ca9f0f078584f1458e71baeb4cd15fcc55b40397
|
[
"MIT"
] | 14
|
2020-07-15T15:32:03.000Z
|
2021-09-17T19:11:14.000Z
|
import pytest
from cuenca.resources.resources import retrieve_uri
def test_retrieve_wrong_uri():
with pytest.raises(ValueError):
retrieve_uri('wrong_uri')
| 18.888889
| 51
| 0.770588
| 22
| 170
| 5.681818
| 0.590909
| 0.176
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.152941
| 170
| 8
| 52
| 21.25
| 0.868056
| 0
| 0
| 0
| 0
| 0
| 0.052941
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| true
| 0
| 0.4
| 0
| 0.6
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
b726293cb342ee5cfe01c9e759bc43264a310fdd
| 146
|
py
|
Python
|
python/kids/number.py
|
walterfan/snippets
|
62f87720c411093fcff888f25b338afd1d99a6f9
|
[
"Apache-2.0"
] | 1
|
2021-06-18T09:31:59.000Z
|
2021-06-18T09:31:59.000Z
|
python/kids/number.py
|
walterfan/snippets
|
62f87720c411093fcff888f25b338afd1d99a6f9
|
[
"Apache-2.0"
] | 10
|
2020-12-12T08:12:06.000Z
|
2022-03-02T06:54:10.000Z
|
python/kids/number.py
|
walterfan/snippets
|
62f87720c411093fcff888f25b338afd1d99a6f9
|
[
"Apache-2.0"
] | null | null | null |
print "please input a number"
str=raw_input()
number=int(str)
if number%2 == 0:
print "even number"
if number%2 == 1:
print "odd number"
| 16.222222
| 29
| 0.657534
| 25
| 146
| 3.8
| 0.56
| 0.168421
| 0.189474
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.034483
| 0.205479
| 146
| 8
| 30
| 18.25
| 0.784483
| 0
| 0
| 0
| 0
| 0
| 0.287671
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.428571
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
3f7ee63e1e56baa2caf9f6ef86749e1d0b4226d6
| 1,155
|
py
|
Python
|
src/com/inductiveautomation/ignition/common/opc/__init__.py
|
thecesrom/8.1
|
0a0fa304137d9eca3e9fd8517b2c9569243121e4
|
[
"MIT"
] | 1
|
2022-03-16T05:59:14.000Z
|
2022-03-16T05:59:14.000Z
|
src/com/inductiveautomation/ignition/common/opc/__init__.py
|
thecesrom/8.1
|
0a0fa304137d9eca3e9fd8517b2c9569243121e4
|
[
"MIT"
] | 4
|
2022-03-15T21:33:46.000Z
|
2022-03-22T21:25:18.000Z
|
src/com/inductiveautomation/ignition/common/opc/__init__.py
|
thecesrom/7.9
|
6dc59a1e920382345837d620907578b35fe7e96b
|
[
"MIT"
] | 2
|
2022-03-16T18:26:29.000Z
|
2022-03-28T20:12:56.000Z
|
__all__ = ["BasicOPCBrowseElement", "OPCBrowseElement", "ServerBrowseElement"]
from java.lang import Object
class OPCBrowseElement(object):
def getDataType(self):
raise NotImplementedError
def getDescription(self):
raise NotImplementedError
def getDisplayName(self):
raise NotImplementedError
def getElementType(self):
raise NotImplementedError
def getServerNodeId(self):
raise NotImplementedError
class BasicOPCBrowseElement(Object, OPCBrowseElement):
def __init__(self, *args):
pass
def getDataType(self):
pass
def getDescription(self):
pass
def getDisplayName(self):
pass
def getElementType(self):
pass
def getServerNodeId(self):
pass
class ServerBrowseElement(Object, OPCBrowseElement):
_serverName = None
def __init__(self, serverName):
self._serverName = serverName
def getDataType(self):
pass
def getDescription(self):
pass
def getDisplayName(self):
pass
def getElementType(self):
pass
def getServerNodeId(self):
pass
| 18.333333
| 78
| 0.662338
| 99
| 1,155
| 7.585859
| 0.242424
| 0.106525
| 0.117177
| 0.165113
| 0.327563
| 0.327563
| 0.327563
| 0.327563
| 0.327563
| 0.327563
| 0
| 0
| 0.268398
| 1,155
| 62
| 79
| 18.629032
| 0.888757
| 0
| 0
| 0.775
| 0
| 0
| 0.048485
| 0.018182
| 0
| 0
| 0
| 0
| 0
| 1
| 0.425
| false
| 0.275
| 0.025
| 0
| 0.55
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
3f94943793a5689b162c2c246064f56af30f5a33
| 139
|
py
|
Python
|
Assignment30 - Mini Project 3/hash.py
|
BenyaminZojaji/image_processing
|
0cfe3a6b826b25fcdd0de5041916aed423bfdb37
|
[
"MIT"
] | 21
|
2021-11-05T20:24:58.000Z
|
2022-02-05T07:49:28.000Z
|
Assignment30 - Mini Project 3/hash.py
|
BenyaminZojaji/image_processing
|
0cfe3a6b826b25fcdd0de5041916aed423bfdb37
|
[
"MIT"
] | null | null | null |
Assignment30 - Mini Project 3/hash.py
|
BenyaminZojaji/image_processing
|
0cfe3a6b826b25fcdd0de5041916aed423bfdb37
|
[
"MIT"
] | 2
|
2021-12-28T02:12:22.000Z
|
2022-02-09T12:39:54.000Z
|
import hashlib
def encode(password):
password = password.encode()
hash = hashlib.sha256(password).hexdigest()
return hash
| 23.166667
| 48
| 0.690647
| 15
| 139
| 6.4
| 0.6
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.027273
| 0.208633
| 139
| 6
| 49
| 23.166667
| 0.845455
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0.6
| 0.2
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
3f9dca33638c93a53b42dd7223df42ec761e57c6
| 492
|
py
|
Python
|
hello/views.py
|
Daniil-7/Tatem-MKS
|
4500bcfff25ba66c299264063796bdfe7f498cd8
|
[
"MIT"
] | null | null | null |
hello/views.py
|
Daniil-7/Tatem-MKS
|
4500bcfff25ba66c299264063796bdfe7f498cd8
|
[
"MIT"
] | null | null | null |
hello/views.py
|
Daniil-7/Tatem-MKS
|
4500bcfff25ba66c299264063796bdfe7f498cd8
|
[
"MIT"
] | null | null | null |
from django.shortcuts import render
from hello.apidata import NewsNasaApi, ImageDayApi
def index(request):
return render(request, "index.html")
def home(request):
return render(request, "home.html")
def news(request):
context = {"ListNews": NewsNasaApi()}
return render(request, "news.html", context)
def imageday(request):
context = ImageDayApi()
return render(request, "imageday.html", context)
def track(request):
return render(request, "track.html")
| 19.68
| 52
| 0.711382
| 58
| 492
| 6.034483
| 0.344828
| 0.171429
| 0.271429
| 0.222857
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.164634
| 492
| 24
| 53
| 20.5
| 0.851582
| 0
| 0
| 0
| 0
| 0
| 0.119919
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.357143
| false
| 0
| 0.142857
| 0.214286
| 0.857143
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
3fcf11419fac8474cc24ee598b3ae2d4cadafaed
| 92
|
py
|
Python
|
palindrome/solution.py
|
Coding-Interview-Club/problem-solutions
|
4368ea85f0abbb9b465902acc8faed2e3d5ce21c
|
[
"MIT"
] | 5
|
2019-10-23T03:55:28.000Z
|
2021-08-18T08:53:38.000Z
|
palindrome/solution.py
|
Coding-Interview-Club/problem-solutions
|
4368ea85f0abbb9b465902acc8faed2e3d5ce21c
|
[
"MIT"
] | 2
|
2020-11-04T07:52:32.000Z
|
2022-03-28T21:19:19.000Z
|
palindrome/solution.py
|
Coding-Interview-Club/problem-solutions
|
4368ea85f0abbb9b465902acc8faed2e3d5ce21c
|
[
"MIT"
] | 5
|
2019-10-23T02:48:17.000Z
|
2021-01-31T15:33:43.000Z
|
def is_palindrome(s):
return all(s[i] == s[len(s) - 1 - i] for i in range(len(s) // 2))
| 30.666667
| 69
| 0.554348
| 20
| 92
| 2.5
| 0.65
| 0.16
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.027778
| 0.217391
| 92
| 2
| 70
| 46
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
3fdf33b0a5f1bd43528ad4a4bfbf589a5f57132e
| 65
|
py
|
Python
|
idfy_sdk/infrastructure/models/__init__.py
|
idfy-io/idfy-sdk-python
|
0f7ced0cf0df080b1c73e2451bf02a23710b5bf1
|
[
"Apache-2.0"
] | null | null | null |
idfy_sdk/infrastructure/models/__init__.py
|
idfy-io/idfy-sdk-python
|
0f7ced0cf0df080b1c73e2451bf02a23710b5bf1
|
[
"Apache-2.0"
] | null | null | null |
idfy_sdk/infrastructure/models/__init__.py
|
idfy-io/idfy-sdk-python
|
0f7ced0cf0df080b1c73e2451bf02a23710b5bf1
|
[
"Apache-2.0"
] | null | null | null |
from idfy_sdk.infrastructure.models.oauth_token import OAuthToken
| 65
| 65
| 0.907692
| 9
| 65
| 6.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.046154
| 65
| 1
| 65
| 65
| 0.919355
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
b756711eb23a7a77613a6c1cd127bbf973ef03b2
| 63
|
py
|
Python
|
Flyweight/Python 3/IPlayer.py
|
kuuhaku86/design-patterns
|
9044ecbeb366fec97e27f1ec51e66d0fafdace07
|
[
"MIT"
] | 11
|
2022-03-24T15:08:06.000Z
|
2022-03-30T19:24:30.000Z
|
Flyweight/Python 3/IPlayer.py
|
kuuhaku86/design-patterns
|
9044ecbeb366fec97e27f1ec51e66d0fafdace07
|
[
"MIT"
] | null | null | null |
Flyweight/Python 3/IPlayer.py
|
kuuhaku86/design-patterns
|
9044ecbeb366fec97e27f1ec51e66d0fafdace07
|
[
"MIT"
] | null | null | null |
class IPlayer:
def doMission():
raise NotImplementedError
| 21
| 29
| 0.761905
| 6
| 63
| 8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.174603
| 63
| 3
| 29
| 21
| 0.923077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| true
| 0
| 0
| 0
| 0.666667
| 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
| 1
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
b7ac1eb4bc33fea1cf3261bb97330d1820d2e1a0
| 93
|
py
|
Python
|
examples/datetime.time.utcoffset/ex1.py
|
mcorne/python-by-example
|
15339c0909c84b51075587a6a66391100971c033
|
[
"MIT"
] | null | null | null |
examples/datetime.time.utcoffset/ex1.py
|
mcorne/python-by-example
|
15339c0909c84b51075587a6a66391100971c033
|
[
"MIT"
] | null | null | null |
examples/datetime.time.utcoffset/ex1.py
|
mcorne/python-by-example
|
15339c0909c84b51075587a6a66391100971c033
|
[
"MIT"
] | null | null | null |
from datetime import time, timezone
print(time(12, 34, 56, tzinfo=timezone.utc).utcoffset())
| 31
| 56
| 0.763441
| 14
| 93
| 5.071429
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.071429
| 0.096774
| 93
| 2
| 57
| 46.5
| 0.77381
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0.5
| 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
| 1
| 0
| 1
| 0
| 0
| 1
|
0
| 5
|
b7af7e6d96212473fe5b24c5767f17e430282d72
| 189
|
py
|
Python
|
tictactoe/database/entity/EmbeddedEntity.py
|
Jabuf/ml-tictactoe
|
431fb3dc9dafc4a60a43ab73bcafcda52e34751b
|
[
"MIT"
] | null | null | null |
tictactoe/database/entity/EmbeddedEntity.py
|
Jabuf/ml-tictactoe
|
431fb3dc9dafc4a60a43ab73bcafcda52e34751b
|
[
"MIT"
] | null | null | null |
tictactoe/database/entity/EmbeddedEntity.py
|
Jabuf/ml-tictactoe
|
431fb3dc9dafc4a60a43ab73bcafcda52e34751b
|
[
"MIT"
] | null | null | null |
from datetime import datetime
from mongoengine import *
class EmbeddedEntity(EmbeddedDocument):
meta = {'abstract': True}
date = DateTimeField(default=datetime.today())
pass
| 18.9
| 50
| 0.73545
| 19
| 189
| 7.315789
| 0.789474
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.174603
| 189
| 9
| 51
| 21
| 0.891026
| 0
| 0
| 0
| 0
| 0
| 0.042328
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.166667
| 0.333333
| 0
| 0.833333
| 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
| 1
| 1
| 0
| 1
| 0
|
0
| 5
|
b7bc7a015cf6d16bfe6d0897300ac5131e7875a5
| 63
|
py
|
Python
|
aminiaio/handlers/errors/__init__.py
|
aioc/aminio
|
a1487b7ff51dfc2085ad4a220ae96cc675664a32
|
[
"MIT"
] | null | null | null |
aminiaio/handlers/errors/__init__.py
|
aioc/aminio
|
a1487b7ff51dfc2085ad4a220ae96cc675664a32
|
[
"MIT"
] | null | null | null |
aminiaio/handlers/errors/__init__.py
|
aioc/aminio
|
a1487b7ff51dfc2085ad4a220ae96cc675664a32
|
[
"MIT"
] | null | null | null |
# Error handlers.
from . import error404, error401, error405
| 12.6
| 42
| 0.746032
| 7
| 63
| 6.714286
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.173077
| 0.174603
| 63
| 4
| 43
| 15.75
| 0.730769
| 0.238095
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
b7e9d7904f12ad23fedf194d08d692b545114bac
| 250
|
py
|
Python
|
shape2seq/__init__.py
|
trsherborne/shape2seq
|
7d99ca62b5de4530544c912ec4584953f5b600bd
|
[
"Apache-2.0"
] | 1
|
2018-05-15T19:27:56.000Z
|
2018-05-15T19:27:56.000Z
|
shape2seq/__init__.py
|
trsherborne/shape2seq
|
7d99ca62b5de4530544c912ec4584953f5b600bd
|
[
"Apache-2.0"
] | null | null | null |
shape2seq/__init__.py
|
trsherborne/shape2seq
|
7d99ca62b5de4530544c912ec4584953f5b600bd
|
[
"Apache-2.0"
] | null | null | null |
from .batch_parser import FullSequenceBatchParser, SimpleBatchParser
from .config import Config
from .glove_loader import GloveLoader
from .image_network import ShapeWorldEncoder
from .model import CaptioningModel
from .parser_base import ParserBase
| 35.714286
| 68
| 0.872
| 29
| 250
| 7.37931
| 0.586207
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1
| 250
| 6
| 69
| 41.666667
| 0.951111
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
b7f2f70ebb81cb421714ef5f397ae2882bffaa28
| 218
|
py
|
Python
|
utils/exceptions.py
|
mesdaghi/conkit-web
|
7c0c32740cbf13b149187cad0f2bd2e59c2496c4
|
[
"BSD-3-Clause"
] | null | null | null |
utils/exceptions.py
|
mesdaghi/conkit-web
|
7c0c32740cbf13b149187cad0f2bd2e59c2496c4
|
[
"BSD-3-Clause"
] | null | null | null |
utils/exceptions.py
|
mesdaghi/conkit-web
|
7c0c32740cbf13b149187cad0f2bd2e59c2496c4
|
[
"BSD-3-Clause"
] | null | null | null |
class SessionTimeOut(Exception):
pass
class InvalidFormat(Exception):
pass
class UserExists(Exception):
pass
class EmailAlreadyUsed(Exception):
pass
class SQLInjectionAlert(Exception):
pass
| 11.473684
| 35
| 0.733945
| 20
| 218
| 8
| 0.4
| 0.40625
| 0.45
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.197248
| 218
| 18
| 36
| 12.111111
| 0.914286
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 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
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
4d1205a3b318f1a758568adb6d857322dc6a7504
| 126
|
py
|
Python
|
pyDE/__init__.py
|
jeff324/pyDE
|
c2931e57f6177d2b4fca62b9c119a847f22f022a
|
[
"MIT"
] | 3
|
2021-05-19T22:18:11.000Z
|
2022-02-14T08:41:31.000Z
|
pyDE/__init__.py
|
jeff324/pyDE
|
c2931e57f6177d2b4fca62b9c119a847f22f022a
|
[
"MIT"
] | null | null | null |
pyDE/__init__.py
|
jeff324/pyDE
|
c2931e57f6177d2b4fca62b9c119a847f22f022a
|
[
"MIT"
] | 1
|
2019-10-15T16:59:42.000Z
|
2019-10-15T16:59:42.000Z
|
name = "pyDE"
__version__ = "0.1"
from .de import *
from .model import *
from .distributions import *
from .utils import idx
| 15.75
| 28
| 0.706349
| 18
| 126
| 4.722222
| 0.666667
| 0.352941
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.019417
| 0.18254
| 126
| 7
| 29
| 18
| 0.805825
| 0
| 0
| 0
| 0
| 0
| 0.055556
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
4d34acc61e7abe5536c84fec4fe9fd9b26311cc7
| 59
|
py
|
Python
|
awesome/__init__.py
|
Antoch03/python_cov
|
d17c7d471c53fad714b01dc2bf82c68897cbdcd5
|
[
"CNRI-Python"
] | null | null | null |
awesome/__init__.py
|
Antoch03/python_cov
|
d17c7d471c53fad714b01dc2bf82c68897cbdcd5
|
[
"CNRI-Python"
] | null | null | null |
awesome/__init__.py
|
Antoch03/python_cov
|
d17c7d471c53fad714b01dc2bf82c68897cbdcd5
|
[
"CNRI-Python"
] | null | null | null |
def smile():
return ":)"
def frown():
return ":("
| 9.833333
| 15
| 0.474576
| 6
| 59
| 4.666667
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.288136
| 59
| 5
| 16
| 11.8
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0.067797
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0
| 0
| 0.5
| 1
| 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
| 1
| 1
| 0
| 0
| 1
| 0
| 0
|
0
| 5
|
4d5e40952aa8f7a3e45205d3cdbc0229b9e6be60
| 199
|
py
|
Python
|
hubspot/crm/imports/api/__init__.py
|
cclauss/hubspot-api-python
|
7c60c0f572b98c73e1f1816bf5981396a42735f6
|
[
"Apache-2.0"
] | null | null | null |
hubspot/crm/imports/api/__init__.py
|
cclauss/hubspot-api-python
|
7c60c0f572b98c73e1f1816bf5981396a42735f6
|
[
"Apache-2.0"
] | null | null | null |
hubspot/crm/imports/api/__init__.py
|
cclauss/hubspot-api-python
|
7c60c0f572b98c73e1f1816bf5981396a42735f6
|
[
"Apache-2.0"
] | null | null | null |
from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from hubspot.crm.imports.api.core_api import CoreApi
from hubspot.crm.imports.api.default_api import DefaultApi
| 24.875
| 58
| 0.829146
| 30
| 199
| 5.266667
| 0.566667
| 0.139241
| 0.177215
| 0.265823
| 0.303797
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005682
| 0.115578
| 199
| 7
| 59
| 28.428571
| 0.892045
| 0.20603
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
4d7ba57969ee31ec8ca2949b3a5d7360a77bedf2
| 334
|
py
|
Python
|
tests/helpers/imports.py
|
Benjamin-Etheredge/pytorch-lightning
|
fe572c5911abfa2cc0b806b1c2cfe977d483c7c1
|
[
"Apache-2.0"
] | 3
|
2020-04-11T01:39:41.000Z
|
2022-03-09T16:21:01.000Z
|
tests/helpers/imports.py
|
Benjamin-Etheredge/pytorch-lightning
|
fe572c5911abfa2cc0b806b1c2cfe977d483c7c1
|
[
"Apache-2.0"
] | 2
|
2021-03-22T00:20:28.000Z
|
2021-06-25T11:35:33.000Z
|
tests/helpers/imports.py
|
Benjamin-Etheredge/pytorch-lightning
|
fe572c5911abfa2cc0b806b1c2cfe977d483c7c1
|
[
"Apache-2.0"
] | 2
|
2021-06-10T21:46:37.000Z
|
2021-08-24T18:49:17.000Z
|
import operator
from pytorch_lightning.utilities.imports import _compare_version
if _compare_version("torchtext", operator.ge, "0.9.0"):
from torchtext.legacy.data import Batch, Dataset, Example, Field, Iterator, LabelField
else:
from torchtext.data import Batch, Dataset, Example, Field, Iterator, LabelField # noqa: F401
| 37.111111
| 97
| 0.781437
| 43
| 334
| 5.953488
| 0.581395
| 0.109375
| 0.117188
| 0.171875
| 0.40625
| 0.40625
| 0.40625
| 0.40625
| 0
| 0
| 0
| 0.020619
| 0.128743
| 334
| 8
| 98
| 41.75
| 0.859107
| 0.02994
| 0
| 0
| 0
| 0
| 0.043478
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
4dcd0550b83567fa3987f2fc5c520e190f5512cc
| 52
|
py
|
Python
|
ml_gym/__init__.py
|
olliethomas/ml-fairness-gym
|
adaa878596d3ce7dc0ee821f53f99cdf0cd2ef5f
|
[
"Apache-2.0"
] | null | null | null |
ml_gym/__init__.py
|
olliethomas/ml-fairness-gym
|
adaa878596d3ce7dc0ee821f53f99cdf0cd2ef5f
|
[
"Apache-2.0"
] | null | null | null |
ml_gym/__init__.py
|
olliethomas/ml-fairness-gym
|
adaa878596d3ce7dc0ee821f53f99cdf0cd2ef5f
|
[
"Apache-2.0"
] | null | null | null |
from . import agents, environments, metrics, spaces
| 26
| 51
| 0.788462
| 6
| 52
| 6.833333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.134615
| 52
| 1
| 52
| 52
| 0.911111
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
127e1f6485df1916f67ee70d2c3149bf1a113747
| 41
|
py
|
Python
|
noise/errors.py
|
wakfi/Noise-Cipher
|
b0ed00bcb396bcae15547cc43fe069732a4bb60f
|
[
"MIT"
] | 1
|
2021-02-09T04:39:05.000Z
|
2021-02-09T04:39:05.000Z
|
noise/errors.py
|
wakfi/Noise-Cipher
|
b0ed00bcb396bcae15547cc43fe069732a4bb60f
|
[
"MIT"
] | null | null | null |
noise/errors.py
|
wakfi/Noise-Cipher
|
b0ed00bcb396bcae15547cc43fe069732a4bb60f
|
[
"MIT"
] | 1
|
2021-02-09T03:58:46.000Z
|
2021-02-09T03:58:46.000Z
|
class NotSupported(AttributeError):
pass
| 20.5
| 35
| 0.853659
| 4
| 41
| 8.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.073171
| 41
| 2
| 36
| 20.5
| 0.921053
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
12b649af3a11510d55aad415450b959fd36b5477
| 130
|
py
|
Python
|
src/checklist/models/__init__.py
|
fga-gpp-mds/2017.2-Grupo12
|
a90f94d0d497f625ab82ef44a907561f3bfa835f
|
[
"MIT"
] | 6
|
2017-10-02T12:07:40.000Z
|
2017-12-14T11:40:07.000Z
|
src/checklist/models/__init__.py
|
fga-gpp-mds/2017.2-Grupo12
|
a90f94d0d497f625ab82ef44a907561f3bfa835f
|
[
"MIT"
] | 92
|
2017-09-30T19:14:21.000Z
|
2017-12-14T04:41:16.000Z
|
src/checklist/models/__init__.py
|
fga-gpp-mds/2017.2-Grupo12
|
a90f94d0d497f625ab82ef44a907561f3bfa835f
|
[
"MIT"
] | 3
|
2017-09-06T00:49:38.000Z
|
2018-07-13T00:32:37.000Z
|
from .checklist import Checklist
from .question import Question
from .answer import Answer
from .observations import Observations
| 26
| 38
| 0.846154
| 16
| 130
| 6.875
| 0.375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.123077
| 130
| 4
| 39
| 32.5
| 0.964912
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
425e9c55f2819c40e83a32a928d92373c8745085
| 56
|
py
|
Python
|
algorithm/replay_buffer/atari_buffer/__init__.py
|
Stilwell-Git/Randomized-Return-Decomposition
|
bc804736cbac0ab7ef2eb241d5b17f4a5e2e80a2
|
[
"MIT"
] | 1
|
2022-03-21T21:38:15.000Z
|
2022-03-21T21:38:15.000Z
|
algorithm/replay_buffer/atari_buffer/__init__.py
|
Stilwell-Git/Randomized-Return-Decomposition
|
bc804736cbac0ab7ef2eb241d5b17f4a5e2e80a2
|
[
"MIT"
] | null | null | null |
algorithm/replay_buffer/atari_buffer/__init__.py
|
Stilwell-Git/Randomized-Return-Decomposition
|
bc804736cbac0ab7ef2eb241d5b17f4a5e2e80a2
|
[
"MIT"
] | null | null | null |
from .frame_stack_buffer import ReplayBuffer_FrameStack
| 28
| 55
| 0.910714
| 7
| 56
| 6.857143
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.071429
| 56
| 1
| 56
| 56
| 0.923077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
4262cd9256ea46b0fb153358627e725ea806de1b
| 85
|
py
|
Python
|
sysml/Frame.py
|
Existentio/phoenix_story
|
e4e0771de8c5af66941b37dacbeaaa314b592665
|
[
"MIT"
] | 1
|
2020-12-05T21:21:32.000Z
|
2020-12-05T21:21:32.000Z
|
sysml/Frame.py
|
Existentio/phoenix_story
|
e4e0771de8c5af66941b37dacbeaaa314b592665
|
[
"MIT"
] | null | null | null |
sysml/Frame.py
|
Existentio/phoenix_story
|
e4e0771de8c5af66941b37dacbeaaa314b592665
|
[
"MIT"
] | null | null | null |
from sysml.Header import Header
class Frame:
def __init__(self):
pass
| 10.625
| 31
| 0.658824
| 11
| 85
| 4.727273
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.282353
| 85
| 7
| 32
| 12.142857
| 0.852459
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0.25
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 5
|
4270478b02b9ffab758df7cf4330d60bb374b4c3
| 19,031
|
py
|
Python
|
cs3/ocm/provider/v1beta1/resources_pb2.py
|
cs3org/python-cs3apis
|
33f84befa7c6009ce87fb7594128d26ff6e49bbd
|
[
"Apache-2.0"
] | 1
|
2020-12-17T14:39:57.000Z
|
2020-12-17T14:39:57.000Z
|
cs3/ocm/provider/v1beta1/resources_pb2.py
|
cs3org/python-cs3apis
|
33f84befa7c6009ce87fb7594128d26ff6e49bbd
|
[
"Apache-2.0"
] | 1
|
2020-05-06T10:23:07.000Z
|
2020-05-12T09:07:08.000Z
|
cs3/ocm/provider/v1beta1/resources_pb2.py
|
cs3org/python-cs3apis
|
33f84befa7c6009ce87fb7594128d26ff6e49bbd
|
[
"Apache-2.0"
] | 1
|
2020-05-05T09:24:54.000Z
|
2020-05-05T09:24:54.000Z
|
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: cs3/ocm/provider/v1beta1/resources.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='cs3/ocm/provider/v1beta1/resources.proto',
package='cs3.ocm.provider.v1beta1',
syntax='proto3',
serialized_options=b'\n\034com.cs3.ocm.provider.v1beta1B\016ResourcesProtoP\001Z\017providerv1beta1\242\002\003COP\252\002\030Cs3.Ocm.Provider.V1Beta1\312\002\030Cs3\\Ocm\\Provider\\V1Beta1',
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n(cs3/ocm/provider/v1beta1/resources.proto\x12\x18\x63s3.ocm.provider.v1beta1\"0\n\x0bServiceType\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\"\xfa\x01\n\x0fServiceEndpoint\x12\x33\n\x04type\x18\x01 \x01(\x0b\x32%.cs3.ocm.provider.v1beta1.ServiceType\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0c\n\x04path\x18\x03 \x01(\t\x12\x14\n\x0cis_monitored\x18\x04 \x01(\x08\x12M\n\nproperties\x18\x05 \x03(\x0b\x32\x39.cs3.ocm.provider.v1beta1.ServiceEndpoint.PropertiesEntry\x1a\x31\n\x0fPropertiesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xb2\x01\n\x07Service\x12\x0c\n\x04host\x18\x01 \x01(\t\x12;\n\x08\x65ndpoint\x18\x02 \x01(\x0b\x32).cs3.ocm.provider.v1beta1.ServiceEndpoint\x12\x13\n\x0b\x61pi_version\x18\x03 \x01(\t\x12G\n\x14\x61\x64\x64itional_endpoints\x18\x04 \x03(\x0b\x32).cs3.ocm.provider.v1beta1.ServiceEndpoint\"\xbf\x02\n\x0cProviderInfo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\tfull_name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x14\n\x0corganization\x18\x04 \x01(\t\x12\x0e\n\x06\x64omain\x18\x05 \x01(\t\x12\x10\n\x08homepage\x18\x06 \x01(\t\x12\r\n\x05\x65mail\x18\x07 \x01(\t\x12\x33\n\x08services\x18\x08 \x03(\x0b\x32!.cs3.ocm.provider.v1beta1.Service\x12J\n\nproperties\x18\t \x03(\x0b\x32\x36.cs3.ocm.provider.v1beta1.ProviderInfo.PropertiesEntry\x1a\x31\n\x0fPropertiesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42}\n\x1c\x63om.cs3.ocm.provider.v1beta1B\x0eResourcesProtoP\x01Z\x0fproviderv1beta1\xa2\x02\x03\x43OP\xaa\x02\x18\x43s3.Ocm.Provider.V1Beta1\xca\x02\x18\x43s3\\Ocm\\Provider\\V1Beta1b\x06proto3'
)
_SERVICETYPE = _descriptor.Descriptor(
name='ServiceType',
full_name='cs3.ocm.provider.v1beta1.ServiceType',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='cs3.ocm.provider.v1beta1.ServiceType.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='description', full_name='cs3.ocm.provider.v1beta1.ServiceType.description', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=70,
serialized_end=118,
)
_SERVICEENDPOINT_PROPERTIESENTRY = _descriptor.Descriptor(
name='PropertiesEntry',
full_name='cs3.ocm.provider.v1beta1.ServiceEndpoint.PropertiesEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='cs3.ocm.provider.v1beta1.ServiceEndpoint.PropertiesEntry.key', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='value', full_name='cs3.ocm.provider.v1beta1.ServiceEndpoint.PropertiesEntry.value', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=b'8\001',
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=322,
serialized_end=371,
)
_SERVICEENDPOINT = _descriptor.Descriptor(
name='ServiceEndpoint',
full_name='cs3.ocm.provider.v1beta1.ServiceEndpoint',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='type', full_name='cs3.ocm.provider.v1beta1.ServiceEndpoint.type', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='name', full_name='cs3.ocm.provider.v1beta1.ServiceEndpoint.name', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='path', full_name='cs3.ocm.provider.v1beta1.ServiceEndpoint.path', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='is_monitored', full_name='cs3.ocm.provider.v1beta1.ServiceEndpoint.is_monitored', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='properties', full_name='cs3.ocm.provider.v1beta1.ServiceEndpoint.properties', index=4,
number=5, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[_SERVICEENDPOINT_PROPERTIESENTRY, ],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=121,
serialized_end=371,
)
_SERVICE = _descriptor.Descriptor(
name='Service',
full_name='cs3.ocm.provider.v1beta1.Service',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='host', full_name='cs3.ocm.provider.v1beta1.Service.host', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='endpoint', full_name='cs3.ocm.provider.v1beta1.Service.endpoint', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='api_version', full_name='cs3.ocm.provider.v1beta1.Service.api_version', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='additional_endpoints', full_name='cs3.ocm.provider.v1beta1.Service.additional_endpoints', index=3,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=374,
serialized_end=552,
)
_PROVIDERINFO_PROPERTIESENTRY = _descriptor.Descriptor(
name='PropertiesEntry',
full_name='cs3.ocm.provider.v1beta1.ProviderInfo.PropertiesEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='cs3.ocm.provider.v1beta1.ProviderInfo.PropertiesEntry.key', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='value', full_name='cs3.ocm.provider.v1beta1.ProviderInfo.PropertiesEntry.value', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=b'8\001',
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=322,
serialized_end=371,
)
_PROVIDERINFO = _descriptor.Descriptor(
name='ProviderInfo',
full_name='cs3.ocm.provider.v1beta1.ProviderInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='cs3.ocm.provider.v1beta1.ProviderInfo.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='full_name', full_name='cs3.ocm.provider.v1beta1.ProviderInfo.full_name', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='description', full_name='cs3.ocm.provider.v1beta1.ProviderInfo.description', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='organization', full_name='cs3.ocm.provider.v1beta1.ProviderInfo.organization', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='domain', full_name='cs3.ocm.provider.v1beta1.ProviderInfo.domain', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='homepage', full_name='cs3.ocm.provider.v1beta1.ProviderInfo.homepage', index=5,
number=6, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='email', full_name='cs3.ocm.provider.v1beta1.ProviderInfo.email', index=6,
number=7, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='services', full_name='cs3.ocm.provider.v1beta1.ProviderInfo.services', index=7,
number=8, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='properties', full_name='cs3.ocm.provider.v1beta1.ProviderInfo.properties', index=8,
number=9, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[_PROVIDERINFO_PROPERTIESENTRY, ],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=555,
serialized_end=874,
)
_SERVICEENDPOINT_PROPERTIESENTRY.containing_type = _SERVICEENDPOINT
_SERVICEENDPOINT.fields_by_name['type'].message_type = _SERVICETYPE
_SERVICEENDPOINT.fields_by_name['properties'].message_type = _SERVICEENDPOINT_PROPERTIESENTRY
_SERVICE.fields_by_name['endpoint'].message_type = _SERVICEENDPOINT
_SERVICE.fields_by_name['additional_endpoints'].message_type = _SERVICEENDPOINT
_PROVIDERINFO_PROPERTIESENTRY.containing_type = _PROVIDERINFO
_PROVIDERINFO.fields_by_name['services'].message_type = _SERVICE
_PROVIDERINFO.fields_by_name['properties'].message_type = _PROVIDERINFO_PROPERTIESENTRY
DESCRIPTOR.message_types_by_name['ServiceType'] = _SERVICETYPE
DESCRIPTOR.message_types_by_name['ServiceEndpoint'] = _SERVICEENDPOINT
DESCRIPTOR.message_types_by_name['Service'] = _SERVICE
DESCRIPTOR.message_types_by_name['ProviderInfo'] = _PROVIDERINFO
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
ServiceType = _reflection.GeneratedProtocolMessageType('ServiceType', (_message.Message,), {
'DESCRIPTOR' : _SERVICETYPE,
'__module__' : 'cs3.ocm.provider.v1beta1.resources_pb2'
# @@protoc_insertion_point(class_scope:cs3.ocm.provider.v1beta1.ServiceType)
})
_sym_db.RegisterMessage(ServiceType)
ServiceEndpoint = _reflection.GeneratedProtocolMessageType('ServiceEndpoint', (_message.Message,), {
'PropertiesEntry' : _reflection.GeneratedProtocolMessageType('PropertiesEntry', (_message.Message,), {
'DESCRIPTOR' : _SERVICEENDPOINT_PROPERTIESENTRY,
'__module__' : 'cs3.ocm.provider.v1beta1.resources_pb2'
# @@protoc_insertion_point(class_scope:cs3.ocm.provider.v1beta1.ServiceEndpoint.PropertiesEntry)
})
,
'DESCRIPTOR' : _SERVICEENDPOINT,
'__module__' : 'cs3.ocm.provider.v1beta1.resources_pb2'
# @@protoc_insertion_point(class_scope:cs3.ocm.provider.v1beta1.ServiceEndpoint)
})
_sym_db.RegisterMessage(ServiceEndpoint)
_sym_db.RegisterMessage(ServiceEndpoint.PropertiesEntry)
Service = _reflection.GeneratedProtocolMessageType('Service', (_message.Message,), {
'DESCRIPTOR' : _SERVICE,
'__module__' : 'cs3.ocm.provider.v1beta1.resources_pb2'
# @@protoc_insertion_point(class_scope:cs3.ocm.provider.v1beta1.Service)
})
_sym_db.RegisterMessage(Service)
ProviderInfo = _reflection.GeneratedProtocolMessageType('ProviderInfo', (_message.Message,), {
'PropertiesEntry' : _reflection.GeneratedProtocolMessageType('PropertiesEntry', (_message.Message,), {
'DESCRIPTOR' : _PROVIDERINFO_PROPERTIESENTRY,
'__module__' : 'cs3.ocm.provider.v1beta1.resources_pb2'
# @@protoc_insertion_point(class_scope:cs3.ocm.provider.v1beta1.ProviderInfo.PropertiesEntry)
})
,
'DESCRIPTOR' : _PROVIDERINFO,
'__module__' : 'cs3.ocm.provider.v1beta1.resources_pb2'
# @@protoc_insertion_point(class_scope:cs3.ocm.provider.v1beta1.ProviderInfo)
})
_sym_db.RegisterMessage(ProviderInfo)
_sym_db.RegisterMessage(ProviderInfo.PropertiesEntry)
DESCRIPTOR._options = None
_SERVICEENDPOINT_PROPERTIESENTRY._options = None
_PROVIDERINFO_PROPERTIESENTRY._options = None
# @@protoc_insertion_point(module_scope)
| 46.874384
| 1,700
| 0.758552
| 2,422
| 19,031
| 5.675062
| 0.085054
| 0.045398
| 0.073336
| 0.079447
| 0.789814
| 0.750964
| 0.728701
| 0.663296
| 0.650491
| 0.626992
| 0
| 0.047111
| 0.113289
| 19,031
| 405
| 1,701
| 46.990123
| 0.767407
| 0.037886
| 0
| 0.694823
| 1
| 0.00545
| 0.233629
| 0.192795
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.010899
| 0
| 0.010899
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
427f2938b499a3d00fafe83511c4d52527a87b76
| 9,035
|
py
|
Python
|
test/run_test.py
|
gousaiyang/tbtrim
|
454935e69cabdde3d2d9663eb619abfaa67394b2
|
[
"MIT"
] | 1
|
2019-01-22T15:21:29.000Z
|
2019-01-22T15:21:29.000Z
|
test/run_test.py
|
gousaiyang/tbtrim
|
454935e69cabdde3d2d9663eb619abfaa67394b2
|
[
"MIT"
] | null | null | null |
test/run_test.py
|
gousaiyang/tbtrim
|
454935e69cabdde3d2d9663eb619abfaa67394b2
|
[
"MIT"
] | null | null | null |
import os
import shutil
import subprocess
import sys
import tempfile
import textwrap
import threading
import unittest
from io import open
os.chdir(os.path.dirname(os.path.realpath(__file__)))
supports_threading_excepthook = 'excepthook' in threading.__all__
def read_text_file(filename, encoding='utf-8'):
with open(filename, 'r', encoding=encoding) as file:
return file.read()
def write_text_file(filename, content, encoding='utf-8'):
with open(filename, 'w', encoding=encoding) as file:
file.write(content)
class TestTbtrim(unittest.TestCase):
code_set_trim_rule = "tbtrim.set_trim_rule(lambda filename: os.path.basename(filename) == 'inner.py'{extra})"
code_clear_trim_rule = "tbtrim.clear_trim_rule()"
code_normal_main = textwrap.dedent("""\
if __name__ == '__main__':
main({extra})
""")
code_threading_main = textwrap.dedent("""\
if __name__ == '__main__':
import threading
t = threading.Thread(target=main{extra})
t.start()
t.join()
""")
@classmethod
def setUpClass(cls):
cls.tmpd = tempfile.mkdtemp(prefix='tbtrim-test-')
cls.template = read_text_file('template.py')
shutil.copy('inner.py', cls.tmpd)
shutil.copy(os.path.join('..', 'tbtrim.py'), cls.tmpd)
@classmethod
def tearDownClass(cls):
shutil.rmtree(cls.tmpd, ignore_errors=True)
def setUp(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra='')
self.main_calls = self.code_normal_main.format(extra='')
self.expect_trimmed = True
def run_and_check_stderr(self, skip_check=False):
filepath = os.path.join(self.tmpd, 'test.py')
write_text_file(filepath, self.template.format(tbtrim_calls=self.tbtrim_calls, main_calls=self.main_calls))
p = subprocess.Popen([sys.executable, filepath], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
self.stderr = p.communicate()[1].decode()
if skip_check:
return
if self.expect_trimmed:
self.assertIn('inner.foo(exc)', self.stderr)
self.assertNotIn('bar', self.stderr)
else:
self.assertIn('inner.foo(exc)', self.stderr)
self.assertIn('bar(exc)', self.stderr)
self.assertIn('baz(exc)', self.stderr)
def test_predicate(self):
self.run_and_check_stderr()
def test_target_one(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', target=LookupError')
self.main_calls = self.code_normal_main.format(extra='exc=LookupError')
self.run_and_check_stderr()
def test_target_multi(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', target=(LookupError, ValueError)')
self.main_calls = self.code_normal_main.format(extra='exc=LookupError')
self.run_and_check_stderr()
def test_exclude_one(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', exclude=LookupError')
self.main_calls = self.code_normal_main.format(extra='exc=LookupError')
self.expect_trimmed = False
self.run_and_check_stderr()
def test_exclude_multi(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', exclude=(LookupError, ValueError)')
self.main_calls = self.code_normal_main.format(extra='exc=LookupError')
self.expect_trimmed = False
self.run_and_check_stderr()
def test_target_and_exclude_1(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', target=(LookupError, ValueError), exclude=(LookupError, NameError)')
self.main_calls = self.code_normal_main.format(extra='exc=LookupError')
self.expect_trimmed = False
self.run_and_check_stderr()
def test_target_and_exclude_2(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', target=(LookupError, ValueError), exclude=(ValueError, NameError)')
self.main_calls = self.code_normal_main.format(extra='exc=LookupError')
self.run_and_check_stderr()
def test_not_strict(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', target=(LookupError, ValueError)')
self.main_calls = self.code_normal_main.format(extra='exc=KeyError')
self.run_and_check_stderr()
def test_strict(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', target=(LookupError, ValueError), strict=True')
self.main_calls = self.code_normal_main.format(extra='exc=KeyError')
self.expect_trimmed = False
self.run_and_check_stderr()
def test_not_strict_exclude(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', target=(KeyError, ValueError), exclude=LookupError')
self.main_calls = self.code_normal_main.format(extra='exc=KeyError')
self.expect_trimmed = False
self.run_and_check_stderr()
def test_strict_exclude(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', target=(KeyError, ValueError), exclude=LookupError, strict=True')
self.main_calls = self.code_normal_main.format(extra='exc=KeyError')
self.run_and_check_stderr()
def test_legacy_exception_posarg(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', (LookupError,), LookupError, True')
self.main_calls = self.code_normal_main.format(extra='exc=LookupError')
self.expect_trimmed = False
self.run_and_check_stderr()
def test_legacy_exception_posarg_conflict_with_exclude(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', (LookupError,), LookupError, True, ValueError')
self.main_calls = self.code_normal_main.format(extra='exc=LookupError')
self.run_and_check_stderr(skip_check=True)
self.assertIn('''raise TypeError("cannot pass 'exclude' and 'exception' arguments at the same time")''', self.stderr)
def test_legacy_exception_kwarg(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', exception=LookupError, strict=True')
self.main_calls = self.code_normal_main.format(extra='exc=LookupError')
self.expect_trimmed = False
self.run_and_check_stderr()
def test_legacy_exception_kwarg_conflict_with_exclude(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', exception=LookupError, exclude=ValueError')
self.main_calls = self.code_normal_main.format(extra='exc=LookupError')
self.run_and_check_stderr(skip_check=True)
self.assertIn('''raise TypeError("cannot pass 'exclude' and 'exception' arguments at the same time")''', self.stderr)
def test_clear(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra='') + '\n' + self.code_clear_trim_rule
self.expect_trimmed = False
self.run_and_check_stderr()
@unittest.skipUnless(supports_threading_excepthook, 'threading.excepthook not supported')
def test_threading(self):
self.main_calls = self.code_threading_main.format(extra='')
self.run_and_check_stderr()
@unittest.skipUnless(supports_threading_excepthook, 'threading.excepthook not supported')
def test_threading_with_parmeters_1(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', target=(KeyError, ValueError), exclude=(LookupError, NameError)')
self.main_calls = self.code_threading_main.format(extra=', kwargs={"exc": KeyError}')
self.expect_trimmed = False
self.run_and_check_stderr()
@unittest.skipUnless(supports_threading_excepthook, 'threading.excepthook not supported')
def test_threading_with_parmeters_2(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', target=(KeyError, ValueError), exclude=(LookupError, NameError), strict=True')
self.main_calls = self.code_threading_main.format(extra=', kwargs={"exc": KeyError}')
self.run_and_check_stderr()
@unittest.skipUnless(supports_threading_excepthook, 'threading.excepthook not supported')
def test_threading_with_parmeters_3(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra=', target=(LookupError, ValueError), exclude=(ValueError, NameError)')
self.main_calls = self.code_threading_main.format(extra=', kwargs={"exc": LookupError}')
self.run_and_check_stderr()
@unittest.skipUnless(supports_threading_excepthook, 'threading.excepthook not supported')
def test_threading_clear(self):
self.tbtrim_calls = self.code_set_trim_rule.format(extra='') + '\n' + self.code_clear_trim_rule
self.main_calls = self.code_threading_main.format(extra='')
self.expect_trimmed = False
self.run_and_check_stderr()
if __name__ == '__main__':
unittest.main()
| 47.057292
| 147
| 0.694743
| 1,138
| 9,035
| 5.20123
| 0.115993
| 0.063862
| 0.087853
| 0.063186
| 0.79608
| 0.790505
| 0.764487
| 0.760939
| 0.739314
| 0.722757
| 0
| 0.001092
| 0.189264
| 9,035
| 191
| 148
| 47.303665
| 0.806962
| 0
| 0
| 0.464968
| 0
| 0.006369
| 0.215061
| 0.02725
| 0
| 0
| 0
| 0
| 0.044586
| 1
| 0.171975
| false
| 0.012739
| 0.063694
| 0
| 0.280255
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 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
| 5
|
42915d8636bc040ef71848f29869895cecba5093
| 120
|
py
|
Python
|
pytoil/config/__init__.py
|
FollowTheProcess/pytoil
|
b13acb14f015ae5399d7697bdc3e0e475dff03ec
|
[
"Apache-2.0"
] | 6
|
2021-05-08T20:31:03.000Z
|
2022-03-08T01:25:43.000Z
|
pytoil/config/__init__.py
|
FollowTheProcess/pytoil
|
b13acb14f015ae5399d7697bdc3e0e475dff03ec
|
[
"Apache-2.0"
] | 116
|
2021-07-08T11:21:22.000Z
|
2022-03-30T14:04:51.000Z
|
pytoil/config/__init__.py
|
FollowTheProcess/pytoil
|
b13acb14f015ae5399d7697bdc3e0e475dff03ec
|
[
"Apache-2.0"
] | null | null | null |
from pytoil.config import defaults
from pytoil.config.config import Config
__all__ = [
"Config",
"defaults",
]
| 15
| 39
| 0.708333
| 14
| 120
| 5.785714
| 0.428571
| 0.246914
| 0.395062
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.191667
| 120
| 7
| 40
| 17.142857
| 0.835052
| 0
| 0
| 0
| 0
| 0
| 0.116667
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
35f7cd95cb82ecf3c8f96e2ae5239b99d2ebc5cb
| 45
|
py
|
Python
|
demo/demoproject/virtual/models.py
|
cjdreiss/django-downloadview
|
292ac1de978654d2cab9da07c3f7297e22a53b62
|
[
"BSD-3-Clause"
] | 164
|
2015-01-14T20:52:08.000Z
|
2020-09-01T09:57:16.000Z
|
demo/demoproject/virtual/models.py
|
cjdreiss/django-downloadview
|
292ac1de978654d2cab9da07c3f7297e22a53b62
|
[
"BSD-3-Clause"
] | 58
|
2015-01-23T13:48:15.000Z
|
2020-09-18T08:49:29.000Z
|
demo/demoproject/virtual/models.py
|
cjdreiss/django-downloadview
|
292ac1de978654d2cab9da07c3f7297e22a53b62
|
[
"BSD-3-Clause"
] | 41
|
2015-03-06T02:05:03.000Z
|
2020-09-17T13:44:45.000Z
|
"""Required to make a Django application."""
| 22.5
| 44
| 0.711111
| 6
| 45
| 5.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.133333
| 45
| 1
| 45
| 45
| 0.820513
| 0.844444
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
35fe385378c7169fed3cac79c90891573253877b
| 45
|
py
|
Python
|
python/testData/resolve/pyToJava/Field.py
|
jnthn/intellij-community
|
8fa7c8a3ace62400c838e0d5926a7be106aa8557
|
[
"Apache-2.0"
] | 2
|
2019-04-28T07:48:50.000Z
|
2020-12-11T14:18:08.000Z
|
python/testData/resolve/pyToJava/Field.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 173
|
2018-07-05T13:59:39.000Z
|
2018-08-09T01:12:03.000Z
|
python/testData/resolve/pyToJava/Field.py
|
Cyril-lamirand/intellij-community
|
60ab6c61b82fc761dd68363eca7d9d69663cfa39
|
[
"Apache-2.0"
] | 2
|
2020-03-15T08:57:37.000Z
|
2020-04-07T04:48:14.000Z
|
from java.lang import System
System.ou<ref>t
| 15
| 28
| 0.8
| 9
| 45
| 4
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 45
| 3
| 29
| 15
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
c406f67d0f6e4c765977ca48f7d6b88ee1b0371a
| 170
|
py
|
Python
|
pyinstaller/pyi_rth_fontconfig.py
|
possibilities/CQ-editor
|
dc950180b365ae39840f6787c8f5a061492734ed
|
[
"Apache-2.0"
] | 351
|
2018-06-08T14:36:35.000Z
|
2022-03-29T22:03:04.000Z
|
pyinstaller/pyi_rth_fontconfig.py
|
possibilities/CQ-editor
|
dc950180b365ae39840f6787c8f5a061492734ed
|
[
"Apache-2.0"
] | 315
|
2018-06-08T14:35:08.000Z
|
2022-03-31T15:45:27.000Z
|
pyinstaller/pyi_rth_fontconfig.py
|
possibilities/CQ-editor
|
dc950180b365ae39840f6787c8f5a061492734ed
|
[
"Apache-2.0"
] | 71
|
2018-06-19T02:00:24.000Z
|
2022-03-25T08:55:02.000Z
|
import os
import sys
if sys.platform.startswith('linux'):
os.environ['FONTCONFIG_FILE'] = '/etc/fonts/fonts.conf'
os.environ['FONTCONFIG_PATH'] = '/etc/fonts/'
| 24.285714
| 59
| 0.694118
| 23
| 170
| 5.043478
| 0.608696
| 0.155172
| 0.327586
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.129412
| 170
| 6
| 60
| 28.333333
| 0.783784
| 0
| 0
| 0
| 0
| 0
| 0.394118
| 0.123529
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
c407acb687fc47e60dad57a980c64d5030639023
| 212
|
py
|
Python
|
python/searchCrawler/config.py
|
TeamTitanz/Word2vecLegalDocumentRetrieval
|
d7b8c88cc42f3fdce8926abee0c662632f9597f9
|
[
"Apache-2.0"
] | null | null | null |
python/searchCrawler/config.py
|
TeamTitanz/Word2vecLegalDocumentRetrieval
|
d7b8c88cc42f3fdce8926abee0c662632f9597f9
|
[
"Apache-2.0"
] | null | null | null |
python/searchCrawler/config.py
|
TeamTitanz/Word2vecLegalDocumentRetrieval
|
d7b8c88cc42f3fdce8926abee0c662632f9597f9
|
[
"Apache-2.0"
] | null | null | null |
import os.path
import sys
HOME = os.getcwd()
PHANTOM_DRIVER_PATH = HOME + '\\driver\\phantomjs.exe'
GECKO_DRIVER_PATH = HOME + '\\driver\\geckodriver.exe'
CHROME_DRIVER_PATH = HOME + '\\driver\\chromedriver.exe'
| 30.285714
| 56
| 0.745283
| 29
| 212
| 5.241379
| 0.482759
| 0.197368
| 0.276316
| 0.394737
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.103774
| 212
| 7
| 56
| 30.285714
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0.347418
| 0.347418
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
c4564114b17e2b9cfd87777d5d6dae3a9531b812
| 74
|
py
|
Python
|
misc/python/mango/coreTest/__init__.py
|
pymango/pymango
|
b55f831f0194b214e746b2dfb4d9c6671a1abc38
|
[
"BSD-2-Clause"
] | 3
|
2020-05-11T03:23:17.000Z
|
2021-03-16T09:01:48.000Z
|
misc/python/mango/coreTest/__init__.py
|
pymango/pymango
|
b55f831f0194b214e746b2dfb4d9c6671a1abc38
|
[
"BSD-2-Clause"
] | null | null | null |
misc/python/mango/coreTest/__init__.py
|
pymango/pymango
|
b55f831f0194b214e746b2dfb4d9c6671a1abc38
|
[
"BSD-2-Clause"
] | 2
|
2017-03-04T11:03:40.000Z
|
2020-08-01T10:01:36.000Z
|
from ._DdsTest import *
from ._MapElementValuesTest import *
| 24.666667
| 36
| 0.662162
| 6
| 74
| 7.833333
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.283784
| 74
| 2
| 37
| 37
| 0.886792
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
67015b77212c0d6f128967aa3cd3ca9d79ee0c2a
| 264
|
py
|
Python
|
peerscout/server/datasets/__init__.py
|
elifesciences/peerscout
|
2e899f268b4712ffb7a09b171de3f3841337d65d
|
[
"MIT"
] | 3
|
2018-09-10T16:33:14.000Z
|
2021-04-06T06:09:23.000Z
|
peerscout/server/datasets/__init__.py
|
elifesciences/peerscout
|
2e899f268b4712ffb7a09b171de3f3841337d65d
|
[
"MIT"
] | 247
|
2018-03-01T12:06:07.000Z
|
2019-10-25T05:25:16.000Z
|
peerscout/server/datasets/__init__.py
|
elifesciences/peerscout
|
2e899f268b4712ffb7a09b171de3f3841337d65d
|
[
"MIT"
] | 3
|
2018-03-01T12:25:44.000Z
|
2019-09-04T00:43:34.000Z
|
from .CachedDatasetLoader import CachedDatasetLoader # noqa: F401
from .CsvDatasetLoader import CsvDatasetLoader # noqa: F401
from .PickleDatasetLoader import PickleDatasetLoader # noqa: F401
from .RoutingDatasetLoader import RoutingDatasetLoader # noqa: F401
| 52.8
| 68
| 0.833333
| 24
| 264
| 9.166667
| 0.333333
| 0.145455
| 0.163636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.051724
| 0.121212
| 264
| 4
| 69
| 66
| 0.896552
| 0.162879
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.