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
86dfd2db6a4ab89adc603c7004f87398bcf67bea
4,683
py
Python
jmeter_api/configs/random_variable/test_random_variable.py
dashawn888/jmeter_api
1ab5b02f3a7c8ad1b84fc50db4fe1fc2fa7c91bd
[ "Apache-2.0" ]
11
2020-03-22T13:30:21.000Z
2021-12-25T06:23:44.000Z
jmeter_api/configs/random_variable/test_random_variable.py
dashawn888/jmeter_api
1ab5b02f3a7c8ad1b84fc50db4fe1fc2fa7c91bd
[ "Apache-2.0" ]
37
2019-12-18T13:12:50.000Z
2022-02-10T10:52:37.000Z
jmeter_api/configs/random_variable/test_random_variable.py
dashawn888/jmeter_api
1ab5b02f3a7c8ad1b84fc50db4fe1fc2fa7c91bd
[ "Apache-2.0" ]
5
2019-12-06T10:55:56.000Z
2020-06-01T19:32:32.000Z
import xmltodict import pytest from jmeter_api.configs.random_variable.elements import RandomVariable from jmeter_api.basics.utils import tag_wrapper class TestRandomVariable: class TestVariableName: def test_type_check(self): with pytest.raises(TypeError): RandomVariable(variable_name=123) def test_positive(self): RandomVariable(variable_name="var") class TestFormat: def test_type_check(self): with pytest.raises(TypeError): RandomVariable(variable_name="var", output_format=123) def test_positive(self): RandomVariable(variable_name="var", output_format="user") class TestMin: def test_type_check(self): with pytest.raises(TypeError): RandomVariable(variable_name="var", minimum_value="1") def test_positive(self): RandomVariable(variable_name="var", minimum_value=1) class TestMax: def test_type_check(self): with pytest.raises(TypeError): RandomVariable(variable_name="var", maximum_value="1") def test_type_check2(self): with pytest.raises(ValueError): RandomVariable(variable_name="var", minimum_value=2, maximum_value=1) def test_positive(self): RandomVariable(variable_name="var", maximum_value=1) class TestSeed: def test_type_check(self): with pytest.raises(TypeError): RandomVariable(variable_name="var", random_seed="1") def test_positive(self): RandomVariable(variable_name="var", random_seed=10) class TestPerThread: def test_type_check(self): with pytest.raises(TypeError): RandomVariable(variable_name="var", per_thread="True") def test_type_check1(self): with pytest.raises(TypeError): RandomVariable(variable_name="var", per_thread=1) def test_positive(self): RandomVariable(variable_name="var", per_thread=True) class TestCsvDataSetConfigRender: def test_variable_name(self): element = RandomVariable(variable_name="var") rendered_doc = tag_wrapper(element.to_xml(), 'result') parsed_doc = xmltodict.parse(rendered_doc) for tag in parsed_doc['result']['RandomVariableConfig']['stringProp']: if tag['@name'] == 'CounterConfig.variable_name': assert tag['#text'] == 'var' def test_format(self): element = RandomVariable(variable_name="var", output_format="user") rendered_doc = tag_wrapper(element.to_xml(), 'result') parsed_doc = xmltodict.parse(rendered_doc) for tag in parsed_doc['result']['RandomVariableConfig']['stringProp']: if tag['@name'] == 'outputFormat': assert tag['#text'] == "user" def test_min(self): element = RandomVariable(variable_name="var", minimum_value=1) rendered_doc = tag_wrapper(element.to_xml(), 'result') parsed_doc = xmltodict.parse(rendered_doc) for tag in parsed_doc['result']['RandomVariableConfig']['stringProp']: if tag['@name'] == 'minimumValue': assert tag['#text'] == '1' def test_max(self): element = RandomVariable(variable_name="var", maximum_value=3) rendered_doc = tag_wrapper(element.to_xml(), 'result') parsed_doc = xmltodict.parse(rendered_doc) for tag in parsed_doc['result']['RandomVariableConfig']['stringProp']: if tag['@name'] == 'maximumValue': assert tag['#text'] == '3' def test_seed(self): element = RandomVariable(variable_name="var", random_seed=2) rendered_doc = tag_wrapper(element.to_xml(), 'result') parsed_doc = xmltodict.parse(rendered_doc) for tag in parsed_doc['result']['RandomVariableConfig']['stringProp']: if tag['@name'] == 'randomSeed': assert tag['#text'] == '2' def test_per_thread(self): element = RandomVariable(variable_name="var", per_thread=True) rendered_doc = tag_wrapper(element.to_xml(), 'result') parsed_doc = xmltodict.parse(rendered_doc) assert parsed_doc['result']['RandomVariableConfig']['boolProp']['#text'] == 'true' def test_hashtree_contain(self): element = RandomVariable(variable_name="var") rendered_doc = tag_wrapper(element.to_xml(), 'result') assert '<hashTree />' in rendered_doc
40.025641
90
0.620329
496
4,683
5.622984
0.157258
0.09896
0.195769
0.20796
0.760846
0.755826
0.681248
0.606669
0.606669
0.534959
0
0.006967
0.26436
4,683
116
91
40.37069
0.802612
0
0
0.423913
0
0
0.103566
0.005766
0
0
0
0
0.076087
1
0.228261
false
0
0.043478
0
0.358696
0
0
0
0
null
0
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
86e646c34b7601845faf63d30a352f7d48970df1
66,202
py
Python
neutron/tests/unit/openvswitch/test_agent_scheduler.py
ksshanam/neutron-vrrp
f9fb7f9b41adc0de401cc118a4d97026d3abb6e0
[ "Apache-2.0" ]
null
null
null
neutron/tests/unit/openvswitch/test_agent_scheduler.py
ksshanam/neutron-vrrp
f9fb7f9b41adc0de401cc118a4d97026d3abb6e0
[ "Apache-2.0" ]
null
null
null
neutron/tests/unit/openvswitch/test_agent_scheduler.py
ksshanam/neutron-vrrp
f9fb7f9b41adc0de401cc118a4d97026d3abb6e0
[ "Apache-2.0" ]
null
null
null
# Copyright (c) 2013 OpenStack Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import contextlib import copy import datetime import mock from oslo.config import cfg from webob import exc from neutron.api import extensions from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api from neutron.api.rpc.handlers import dhcp_rpc from neutron.api.rpc.handlers import l3_rpc from neutron.api.v2 import attributes from neutron.common import constants from neutron import context from neutron.db import agents_db from neutron.db import l3_agentschedulers_db from neutron.extensions import agent from neutron.extensions import dhcpagentscheduler from neutron.extensions import l3agentscheduler from neutron import manager from neutron.openstack.common import timeutils from neutron.openstack.common import uuidutils from neutron.plugins.common import constants as service_constants from neutron.tests import fake_notifier from neutron.tests.unit import test_agent_ext_plugin from neutron.tests.unit import test_db_plugin as test_plugin from neutron.tests.unit import test_extensions from neutron.tests.unit import test_l3_plugin from neutron.tests.unit import testlib_api from neutron import wsgi L3_HOSTA = 'hosta' DHCP_HOSTA = 'hosta' L3_HOSTB = 'hostb' DHCP_HOSTC = 'hostc' class AgentSchedulerTestMixIn(object): def _request_list(self, path, admin_context=True, expected_code=exc.HTTPOk.code): req = self._path_req(path, admin_context=admin_context) res = req.get_response(self.ext_api) self.assertEqual(res.status_int, expected_code) return self.deserialize(self.fmt, res) def _path_req(self, path, method='GET', data=None, query_string=None, admin_context=True): content_type = 'application/%s' % self.fmt body = None if data is not None: # empty dict is valid body = wsgi.Serializer().serialize(data, content_type) if admin_context: return testlib_api.create_request( path, body, content_type, method, query_string=query_string) else: return testlib_api.create_request( path, body, content_type, method, query_string=query_string, context=context.Context('', 'tenant_id')) def _path_create_request(self, path, data, admin_context=True): return self._path_req(path, method='POST', data=data, admin_context=admin_context) def _path_show_request(self, path, admin_context=True): return self._path_req(path, admin_context=admin_context) def _path_delete_request(self, path, admin_context=True): return self._path_req(path, method='DELETE', admin_context=admin_context) def _path_update_request(self, path, data, admin_context=True): return self._path_req(path, method='PUT', data=data, admin_context=admin_context) def _list_routers_hosted_by_l3_agent(self, agent_id, expected_code=exc.HTTPOk.code, admin_context=True): path = "/agents/%s/%s.%s" % (agent_id, l3agentscheduler.L3_ROUTERS, self.fmt) return self._request_list(path, expected_code=expected_code, admin_context=admin_context) def _list_networks_hosted_by_dhcp_agent(self, agent_id, expected_code=exc.HTTPOk.code, admin_context=True): path = "/agents/%s/%s.%s" % (agent_id, dhcpagentscheduler.DHCP_NETS, self.fmt) return self._request_list(path, expected_code=expected_code, admin_context=admin_context) def _list_l3_agents_hosting_router(self, router_id, expected_code=exc.HTTPOk.code, admin_context=True): path = "/routers/%s/%s.%s" % (router_id, l3agentscheduler.L3_AGENTS, self.fmt) return self._request_list(path, expected_code=expected_code, admin_context=admin_context) def _list_dhcp_agents_hosting_network(self, network_id, expected_code=exc.HTTPOk.code, admin_context=True): path = "/networks/%s/%s.%s" % (network_id, dhcpagentscheduler.DHCP_AGENTS, self.fmt) return self._request_list(path, expected_code=expected_code, admin_context=admin_context) def _add_router_to_l3_agent(self, id, router_id, expected_code=exc.HTTPCreated.code, admin_context=True): path = "/agents/%s/%s.%s" % (id, l3agentscheduler.L3_ROUTERS, self.fmt) req = self._path_create_request(path, {'router_id': router_id}, admin_context=admin_context) res = req.get_response(self.ext_api) self.assertEqual(res.status_int, expected_code) def _add_network_to_dhcp_agent(self, id, network_id, expected_code=exc.HTTPCreated.code, admin_context=True): path = "/agents/%s/%s.%s" % (id, dhcpagentscheduler.DHCP_NETS, self.fmt) req = self._path_create_request(path, {'network_id': network_id}, admin_context=admin_context) res = req.get_response(self.ext_api) self.assertEqual(res.status_int, expected_code) def _remove_network_from_dhcp_agent(self, id, network_id, expected_code=exc.HTTPNoContent.code, admin_context=True): path = "/agents/%s/%s/%s.%s" % (id, dhcpagentscheduler.DHCP_NETS, network_id, self.fmt) req = self._path_delete_request(path, admin_context=admin_context) res = req.get_response(self.ext_api) self.assertEqual(res.status_int, expected_code) def _remove_router_from_l3_agent(self, id, router_id, expected_code=exc.HTTPNoContent.code, admin_context=True): path = "/agents/%s/%s/%s.%s" % (id, l3agentscheduler.L3_ROUTERS, router_id, self.fmt) req = self._path_delete_request(path, admin_context=admin_context) res = req.get_response(self.ext_api) self.assertEqual(res.status_int, expected_code) def _assert_notify(self, notifications, expected_event_type): event_types = [event['event_type'] for event in notifications] self.assertIn(expected_event_type, event_types) def _register_one_agent_state(self, agent_state): callback = agents_db.AgentExtRpcCallback() callback.report_state(self.adminContext, agent_state={'agent_state': agent_state}, time=timeutils.strtime()) def _disable_agent(self, agent_id, admin_state_up=False): new_agent = {} new_agent['agent'] = {} new_agent['agent']['admin_state_up'] = admin_state_up self._update('agents', agent_id, new_agent) def _get_agent_id(self, agent_type, host): agents = self._list_agents() for agent_data in agents['agents']: if (agent_data['agent_type'] == agent_type and agent_data['host'] == host): return agent_data['id'] class OvsAgentSchedulerTestCaseBase(test_l3_plugin.L3NatTestCaseMixin, test_agent_ext_plugin.AgentDBTestMixIn, AgentSchedulerTestMixIn, test_plugin.NeutronDbPluginV2TestCase): fmt = 'json' plugin_str = ('neutron.plugins.openvswitch.' 'ovs_neutron_plugin.OVSNeutronPluginV2') l3_plugin = None def setUp(self): # Save the global RESOURCE_ATTRIBUTE_MAP before loading plugin self.saved_attr_map = {} for resource, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.iteritems(): self.saved_attr_map[resource] = attrs.copy() if self.l3_plugin: service_plugins = {'l3_plugin_name': self.l3_plugin} else: service_plugins = None super(OvsAgentSchedulerTestCaseBase, self).setUp( self.plugin_str, service_plugins=service_plugins) ext_mgr = extensions.PluginAwareExtensionManager.get_instance() self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr) self.adminContext = context.get_admin_context() # Add the resources to the global attribute map # This is done here as the setup process won't # initialize the main API router which extends # the global attribute map attributes.RESOURCE_ATTRIBUTE_MAP.update( agent.RESOURCE_ATTRIBUTE_MAP) self.addCleanup(self.restore_attribute_map) self.l3agentscheduler_dbMinxin = ( manager.NeutronManager.get_service_plugins().get( service_constants.L3_ROUTER_NAT)) self.l3_notify_p = mock.patch( 'neutron.extensions.l3agentscheduler.notify') self.patched_l3_notify = self.l3_notify_p.start() self.l3_periodic_p = mock.patch('neutron.db.L3AgentSchedulerDbMixin.' 'start_periodic_agent_status_check') self.patched_l3_periodic = self.l3_notify_p.start() self.dhcp_notify_p = mock.patch( 'neutron.extensions.dhcpagentscheduler.notify') self.patched_dhcp_notify = self.dhcp_notify_p.start() def restore_attribute_map(self): # Restore the original RESOURCE_ATTRIBUTE_MAP attributes.RESOURCE_ATTRIBUTE_MAP = self.saved_attr_map class OvsAgentSchedulerTestCase(OvsAgentSchedulerTestCaseBase): def test_report_states(self): self._register_agent_states() agents = self._list_agents() self.assertEqual(4, len(agents['agents'])) def test_network_scheduling_on_network_creation(self): self._register_agent_states() with self.network() as net: dhcp_agents = self._list_dhcp_agents_hosting_network( net['network']['id']) self.assertEqual(0, len(dhcp_agents['agents'])) def test_network_auto_schedule_with_disabled(self): cfg.CONF.set_override('allow_overlapping_ips', True) with contextlib.nested(self.subnet(), self.subnet()): dhcp_rpc_cb = dhcp_rpc.DhcpRpcCallback() self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTA) hostc_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTC) self._disable_agent(hosta_id) dhcp_rpc_cb.get_active_networks(self.adminContext, host=DHCP_HOSTA) # second agent will host all the networks since first is disabled. dhcp_rpc_cb.get_active_networks(self.adminContext, host=DHCP_HOSTC) networks = self._list_networks_hosted_by_dhcp_agent(hostc_id) num_hostc_nets = len(networks['networks']) networks = self._list_networks_hosted_by_dhcp_agent(hosta_id) num_hosta_nets = len(networks['networks']) self.assertEqual(0, num_hosta_nets) self.assertEqual(2, num_hostc_nets) def test_network_auto_schedule_with_no_dhcp(self): cfg.CONF.set_override('allow_overlapping_ips', True) with contextlib.nested(self.subnet(enable_dhcp=False), self.subnet(enable_dhcp=False)): dhcp_rpc_cb = dhcp_rpc.DhcpRpcCallback() self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTA) hostc_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTC) self._disable_agent(hosta_id) dhcp_rpc_cb.get_active_networks(self.adminContext, host=DHCP_HOSTA) dhcp_rpc_cb.get_active_networks(self.adminContext, host=DHCP_HOSTC) networks = self._list_networks_hosted_by_dhcp_agent(hostc_id) num_hostc_nets = len(networks['networks']) networks = self._list_networks_hosted_by_dhcp_agent(hosta_id) num_hosta_nets = len(networks['networks']) self.assertEqual(0, num_hosta_nets) self.assertEqual(0, num_hostc_nets) def test_network_auto_schedule_with_multiple_agents(self): cfg.CONF.set_override('dhcp_agents_per_network', 2) cfg.CONF.set_override('allow_overlapping_ips', True) with contextlib.nested(self.subnet(), self.subnet()): dhcp_rpc_cb = dhcp_rpc.DhcpRpcCallback() self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTA) hostc_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTC) dhcp_rpc_cb.get_active_networks(self.adminContext, host=DHCP_HOSTA) dhcp_rpc_cb.get_active_networks(self.adminContext, host=DHCP_HOSTC) networks = self._list_networks_hosted_by_dhcp_agent(hostc_id) num_hostc_nets = len(networks['networks']) networks = self._list_networks_hosted_by_dhcp_agent(hosta_id) num_hosta_nets = len(networks['networks']) self.assertEqual(2, num_hosta_nets) self.assertEqual(2, num_hostc_nets) def test_network_auto_schedule_restart_dhcp_agent(self): cfg.CONF.set_override('dhcp_agents_per_network', 2) with self.subnet() as sub1: dhcp_rpc_cb = dhcp_rpc.DhcpRpcCallback() self._register_agent_states() dhcp_rpc_cb.get_active_networks(self.adminContext, host=DHCP_HOSTA) dhcp_rpc_cb.get_active_networks(self.adminContext, host=DHCP_HOSTA) dhcp_agents = self._list_dhcp_agents_hosting_network( sub1['subnet']['network_id']) self.assertEqual(1, len(dhcp_agents['agents'])) def test_network_auto_schedule_with_hosted(self): # one agent hosts all the networks, other hosts none cfg.CONF.set_override('allow_overlapping_ips', True) with contextlib.nested(self.subnet(), self.subnet()) as (sub1, sub2): dhcp_rpc_cb = dhcp_rpc.DhcpRpcCallback() self._register_agent_states() dhcp_rpc_cb.get_active_networks(self.adminContext, host=DHCP_HOSTA) # second agent will not host the network since first has got it. dhcp_rpc_cb.get_active_networks(self.adminContext, host=DHCP_HOSTC) dhcp_agents = self._list_dhcp_agents_hosting_network( sub1['subnet']['network_id']) hosta_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTA) hostc_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTC) hosta_nets = self._list_networks_hosted_by_dhcp_agent(hosta_id) num_hosta_nets = len(hosta_nets['networks']) hostc_nets = self._list_networks_hosted_by_dhcp_agent(hostc_id) num_hostc_nets = len(hostc_nets['networks']) self.assertEqual(2, num_hosta_nets) self.assertEqual(0, num_hostc_nets) self.assertEqual(1, len(dhcp_agents['agents'])) self.assertEqual(DHCP_HOSTA, dhcp_agents['agents'][0]['host']) def test_network_auto_schedule_with_hosted_2(self): # one agent hosts one network dhcp_rpc_cb = dhcp_rpc.DhcpRpcCallback() dhcp_hosta = { 'binary': 'neutron-dhcp-agent', 'host': DHCP_HOSTA, 'topic': 'DHCP_AGENT', 'configurations': {'dhcp_driver': 'dhcp_driver', 'use_namespaces': True, }, 'agent_type': constants.AGENT_TYPE_DHCP} dhcp_hostc = copy.deepcopy(dhcp_hosta) dhcp_hostc['host'] = DHCP_HOSTC cfg.CONF.set_override('allow_overlapping_ips', True) with self.subnet() as sub1: self._register_one_agent_state(dhcp_hosta) dhcp_rpc_cb.get_active_networks(self.adminContext, host=DHCP_HOSTA) hosta_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTA) self._disable_agent(hosta_id, admin_state_up=False) with self.subnet() as sub2: self._register_one_agent_state(dhcp_hostc) dhcp_rpc_cb.get_active_networks(self.adminContext, host=DHCP_HOSTC) dhcp_agents_1 = self._list_dhcp_agents_hosting_network( sub1['subnet']['network_id']) dhcp_agents_2 = self._list_dhcp_agents_hosting_network( sub2['subnet']['network_id']) hosta_nets = self._list_networks_hosted_by_dhcp_agent(hosta_id) num_hosta_nets = len(hosta_nets['networks']) hostc_id = self._get_agent_id( constants.AGENT_TYPE_DHCP, DHCP_HOSTC) hostc_nets = self._list_networks_hosted_by_dhcp_agent(hostc_id) num_hostc_nets = len(hostc_nets['networks']) self.assertEqual(1, num_hosta_nets) self.assertEqual(1, num_hostc_nets) self.assertEqual(1, len(dhcp_agents_1['agents'])) self.assertEqual(1, len(dhcp_agents_2['agents'])) self.assertEqual(DHCP_HOSTA, dhcp_agents_1['agents'][0]['host']) self.assertEqual(DHCP_HOSTC, dhcp_agents_2['agents'][0]['host']) def test_network_scheduling_on_port_creation(self): with self.subnet() as subnet: dhcp_agents = self._list_dhcp_agents_hosting_network( subnet['subnet']['network_id']) result0 = len(dhcp_agents['agents']) self._register_agent_states() with self.port(subnet=subnet, device_owner="compute:test:" + DHCP_HOSTA) as port: dhcp_agents = self._list_dhcp_agents_hosting_network( port['port']['network_id']) result1 = len(dhcp_agents['agents']) self.assertEqual(0, result0) self.assertEqual(1, result1) def test_network_ha_scheduling_on_port_creation(self): cfg.CONF.set_override('dhcp_agents_per_network', 2) with self.subnet() as subnet: dhcp_agents = self._list_dhcp_agents_hosting_network( subnet['subnet']['network_id']) result0 = len(dhcp_agents['agents']) self._register_agent_states() with self.port(subnet=subnet, device_owner="compute:test:" + DHCP_HOSTA) as port: dhcp_agents = self._list_dhcp_agents_hosting_network( port['port']['network_id']) result1 = len(dhcp_agents['agents']) self.assertEqual(0, result0) self.assertEqual(2, result1) def test_network_ha_scheduling_on_port_creation_with_new_agent(self): cfg.CONF.set_override('dhcp_agents_per_network', 3) with self.subnet() as subnet: dhcp_agents = self._list_dhcp_agents_hosting_network( subnet['subnet']['network_id']) result0 = len(dhcp_agents['agents']) self._register_agent_states() with self.port(subnet=subnet, device_owner="compute:test:" + DHCP_HOSTA) as port: dhcp_agents = self._list_dhcp_agents_hosting_network( port['port']['network_id']) result1 = len(dhcp_agents['agents']) self._register_one_dhcp_agent() with self.port(subnet=subnet, device_owner="compute:test:" + DHCP_HOSTA) as port: dhcp_agents = self._list_dhcp_agents_hosting_network( port['port']['network_id']) result2 = len(dhcp_agents['agents']) self.assertEqual(0, result0) self.assertEqual(2, result1) self.assertEqual(3, result2) def test_network_scheduler_with_disabled_agent(self): dhcp_hosta = { 'binary': 'neutron-dhcp-agent', 'host': DHCP_HOSTA, 'topic': 'DHCP_AGENT', 'configurations': {'dhcp_driver': 'dhcp_driver', 'use_namespaces': True, }, 'agent_type': constants.AGENT_TYPE_DHCP} self._register_one_agent_state(dhcp_hosta) with self.port() as port1: dhcp_agents = self._list_dhcp_agents_hosting_network( port1['port']['network_id']) self.assertEqual(1, len(dhcp_agents['agents'])) agents = self._list_agents() self._disable_agent(agents['agents'][0]['id']) with self.port() as port2: dhcp_agents = self._list_dhcp_agents_hosting_network( port2['port']['network_id']) self.assertEqual(0, len(dhcp_agents['agents'])) def test_network_scheduler_with_down_agent(self): dhcp_hosta = { 'binary': 'neutron-dhcp-agent', 'host': DHCP_HOSTA, 'topic': 'DHCP_AGENT', 'configurations': {'dhcp_driver': 'dhcp_driver', 'use_namespaces': True, }, 'agent_type': constants.AGENT_TYPE_DHCP} self._register_one_agent_state(dhcp_hosta) is_agent_down_str = 'neutron.db.agents_db.AgentDbMixin.is_agent_down' with mock.patch(is_agent_down_str) as mock_is_agent_down: mock_is_agent_down.return_value = False with self.port() as port: dhcp_agents = self._list_dhcp_agents_hosting_network( port['port']['network_id']) self.assertEqual(1, len(dhcp_agents['agents'])) with mock.patch(is_agent_down_str) as mock_is_agent_down: mock_is_agent_down.return_value = True with self.port() as port: dhcp_agents = self._list_dhcp_agents_hosting_network( port['port']['network_id']) self.assertEqual(0, len(dhcp_agents['agents'])) def test_network_scheduler_with_hosted_network(self): plugin = manager.NeutronManager.get_plugin() dhcp_hosta = { 'binary': 'neutron-dhcp-agent', 'host': DHCP_HOSTA, 'topic': 'DHCP_AGENT', 'configurations': {'dhcp_driver': 'dhcp_driver', 'use_namespaces': True, }, 'agent_type': constants.AGENT_TYPE_DHCP} self._register_one_agent_state(dhcp_hosta) with self.port() as port1: dhcp_agents = self._list_dhcp_agents_hosting_network( port1['port']['network_id']) self.assertEqual(1, len(dhcp_agents['agents'])) with mock.patch.object(plugin, 'get_dhcp_agents_hosting_networks', autospec=True) as mock_hosting_agents: mock_hosting_agents.return_value = plugin.get_agents_db( self.adminContext) with self.network('test', do_delete=False) as net1: pass with self.subnet(network=net1, cidr='10.0.1.0/24', do_delete=False) as subnet1: pass with self.port(subnet=subnet1, do_delete=False) as port2: pass dhcp_agents = self._list_dhcp_agents_hosting_network( port2['port']['network_id']) self.assertEqual(0, len(dhcp_agents['agents'])) def test_network_policy(self): with self.network() as net1: self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTA) self._list_networks_hosted_by_dhcp_agent( hosta_id, expected_code=exc.HTTPForbidden.code, admin_context=False) self._add_network_to_dhcp_agent( hosta_id, net1['network']['id'], expected_code=exc.HTTPForbidden.code, admin_context=False) self._add_network_to_dhcp_agent(hosta_id, net1['network']['id']) self._remove_network_from_dhcp_agent( hosta_id, net1['network']['id'], expected_code=exc.HTTPForbidden.code, admin_context=False) self._list_dhcp_agents_hosting_network( net1['network']['id'], expected_code=exc.HTTPForbidden.code, admin_context=False) def test_network_add_to_dhcp_agent(self): with self.network() as net1: self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTA) num_before_add = len( self._list_networks_hosted_by_dhcp_agent( hosta_id)['networks']) self._add_network_to_dhcp_agent(hosta_id, net1['network']['id']) num_after_add = len( self._list_networks_hosted_by_dhcp_agent( hosta_id)['networks']) self.assertEqual(0, num_before_add) self.assertEqual(1, num_after_add) def test_network_remove_from_dhcp_agent(self): dhcp_hosta = { 'binary': 'neutron-dhcp-agent', 'host': DHCP_HOSTA, 'topic': 'DHCP_AGENT', 'configurations': {'dhcp_driver': 'dhcp_driver', 'use_namespaces': True, }, 'agent_type': constants.AGENT_TYPE_DHCP} self._register_one_agent_state(dhcp_hosta) hosta_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTA) with self.port() as port1: num_before_remove = len( self._list_networks_hosted_by_dhcp_agent( hosta_id)['networks']) self._remove_network_from_dhcp_agent(hosta_id, port1['port']['network_id']) num_after_remove = len( self._list_networks_hosted_by_dhcp_agent( hosta_id)['networks']) self.assertEqual(1, num_before_remove) self.assertEqual(0, num_after_remove) def test_list_active_networks_on_not_registered_yet_dhcp_agent(self): plugin = manager.NeutronManager.get_plugin() nets = plugin.list_active_networks_on_active_dhcp_agent( self.adminContext, host=DHCP_HOSTA) self.assertEqual([], nets) def test_reserved_port_after_network_remove_from_dhcp_agent(self): dhcp_hosta = { 'binary': 'neutron-dhcp-agent', 'host': DHCP_HOSTA, 'topic': 'DHCP_AGENT', 'configurations': {'dhcp_driver': 'dhcp_driver', 'use_namespaces': True, }, 'agent_type': constants.AGENT_TYPE_DHCP} self._register_one_agent_state(dhcp_hosta) hosta_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTA) with self.port(device_owner=constants.DEVICE_OWNER_DHCP, host=DHCP_HOSTA) as port1: self._remove_network_from_dhcp_agent(hosta_id, port1['port']['network_id']) port_res = self._list_ports( 'json', 200, network_id=port1['port']['network_id']) port_list = self.deserialize('json', port_res) self.assertEqual(port_list['ports'][0]['device_id'], constants.DEVICE_ID_RESERVED_DHCP_PORT) def _take_down_agent_and_run_reschedule(self, host): # take down the agent on host A and ensure B is alive self.adminContext.session.begin(subtransactions=True) query = self.adminContext.session.query(agents_db.Agent) agt = query.filter_by(host=host).first() agt.heartbeat_timestamp = ( agt.heartbeat_timestamp - datetime.timedelta(hours=1)) self.adminContext.session.commit() plugin = manager.NeutronManager.get_service_plugins().get( service_constants.L3_ROUTER_NAT) plugin.reschedule_routers_from_down_agents() def _set_agent_admin_state_up(self, host, state): self.adminContext.session.begin(subtransactions=True) query = self.adminContext.session.query(agents_db.Agent) agt_db = query.filter_by(host=host).first() agt_db.admin_state_up = state self.adminContext.session.commit() def test_router_is_not_rescheduled_from_alive_agent(self): with self.router(): l3_rpc_cb = l3_rpc.L3RpcCallback() self._register_agent_states() # schedule the router to host A l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA) with mock.patch('neutron.db.l3_agentschedulers_db.' 'L3AgentSchedulerDbMixin.reschedule_router') as rr: # take down some unrelated agent and run reschedule check self._take_down_agent_and_run_reschedule(DHCP_HOSTC) self.assertFalse(rr.called) def test_router_reschedule_from_dead_agent(self): with self.router(): l3_rpc_cb = l3_rpc.L3RpcCallback() self._register_agent_states() # schedule the router to host A ret_a = l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA) self._take_down_agent_and_run_reschedule(L3_HOSTA) # B should now pick up the router ret_b = l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTB) self.assertEqual(ret_b, ret_a) def test_router_no_reschedule_from_dead_admin_down_agent(self): with self.router() as r: l3_rpc_cb = l3_rpc.L3RpcCallback() self._register_agent_states() # schedule the router to host A l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA) self._set_agent_admin_state_up(L3_HOSTA, False) self._take_down_agent_and_run_reschedule(L3_HOSTA) # A should still have it even though it was inactive due to the # admin_state being down rab = l3_agentschedulers_db.RouterL3AgentBinding binding = (self.adminContext.session.query(rab). filter(rab.router_id == r['router']['id']).first()) self.assertEqual(binding.l3_agent.host, L3_HOSTA) # B should not pick up the router ret_b = l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTB) self.assertFalse(ret_b) def test_router_auto_schedule_with_invalid_router(self): with self.router() as router: l3_rpc_cb = l3_rpc.L3RpcCallback() self._register_agent_states() # deleted router ret_a = l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA, router_ids=[router['router']['id']]) self.assertFalse(ret_a) # non-existent router ret_a = l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA, router_ids=[uuidutils.generate_uuid()]) self.assertFalse(ret_a) def test_router_auto_schedule_with_hosted(self): with self.router() as router: l3_rpc_cb = l3_rpc.L3RpcCallback() self._register_agent_states() ret_a = l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA) ret_b = l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTB) l3_agents = self._list_l3_agents_hosting_router( router['router']['id']) self.assertEqual(1, len(ret_a)) self.assertIn(router['router']['id'], [r['id'] for r in ret_a]) self.assertFalse(len(ret_b)) self.assertEqual(1, len(l3_agents['agents'])) self.assertEqual(L3_HOSTA, l3_agents['agents'][0]['host']) def test_router_auto_schedule_restart_l3_agent(self): with self.router(): l3_rpc_cb = l3_rpc.L3RpcCallback() self._register_agent_states() l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA) l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA) def test_router_auto_schedule_with_hosted_2(self): # one agent hosts one router l3_rpc_cb = l3_rpc.L3RpcCallback() l3_hosta = { 'binary': 'neutron-l3-agent', 'host': L3_HOSTA, 'topic': 'L3_AGENT', 'configurations': {'use_namespaces': True, 'router_id': None, 'handle_internal_only_routers': True, 'gateway_external_network_id': None, 'interface_driver': 'interface_driver', }, 'agent_type': constants.AGENT_TYPE_L3} l3_hostb = copy.deepcopy(l3_hosta) l3_hostb['host'] = L3_HOSTB with self.router() as router1: self._register_one_agent_state(l3_hosta) l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA) hosta_id = self._get_agent_id(constants.AGENT_TYPE_L3, L3_HOSTA) self._disable_agent(hosta_id, admin_state_up=False) with self.router() as router2: self._register_one_agent_state(l3_hostb) l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTB) l3_agents_1 = self._list_l3_agents_hosting_router( router1['router']['id']) l3_agents_2 = self._list_l3_agents_hosting_router( router2['router']['id']) hosta_routers = self._list_routers_hosted_by_l3_agent(hosta_id) num_hosta_routers = len(hosta_routers['routers']) hostb_id = self._get_agent_id( constants.AGENT_TYPE_L3, L3_HOSTB) hostb_routers = self._list_routers_hosted_by_l3_agent(hostb_id) num_hostc_routers = len(hostb_routers['routers']) self.assertEqual(1, num_hosta_routers) self.assertEqual(1, num_hostc_routers) self.assertEqual(1, len(l3_agents_1['agents'])) self.assertEqual(1, len(l3_agents_2['agents'])) self.assertEqual(L3_HOSTA, l3_agents_1['agents'][0]['host']) self.assertEqual(L3_HOSTB, l3_agents_2['agents'][0]['host']) def test_router_auto_schedule_with_disabled(self): with contextlib.nested(self.router(), self.router()): l3_rpc_cb = l3_rpc.L3RpcCallback() self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_L3, L3_HOSTA) hostb_id = self._get_agent_id(constants.AGENT_TYPE_L3, L3_HOSTB) self._disable_agent(hosta_id) # first agent will not host router since it is disabled l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA) # second agent will host all the routers since first is disabled. l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTB) hostb_routers = self._list_routers_hosted_by_l3_agent(hostb_id) num_hostb_routers = len(hostb_routers['routers']) hosta_routers = self._list_routers_hosted_by_l3_agent(hosta_id) num_hosta_routers = len(hosta_routers['routers']) self.assertEqual(2, num_hostb_routers) self.assertEqual(0, num_hosta_routers) def test_router_auto_schedule_with_candidates(self): l3_hosta = { 'binary': 'neutron-l3-agent', 'host': L3_HOSTA, 'topic': 'L3_AGENT', 'configurations': {'use_namespaces': False, 'router_id': None, 'handle_internal_only_routers': True, 'gateway_external_network_id': None, 'interface_driver': 'interface_driver', }, 'agent_type': constants.AGENT_TYPE_L3} with contextlib.nested(self.router(), self.router()) as (router1, router2): l3_rpc_cb = l3_rpc.L3RpcCallback() l3_hosta['configurations']['router_id'] = router1['router']['id'] self._register_one_agent_state(l3_hosta) hosta_id = self._get_agent_id(constants.AGENT_TYPE_L3, L3_HOSTA) l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA) hosta_routers = self._list_routers_hosted_by_l3_agent(hosta_id) num_hosta_routers = len(hosta_routers['routers']) l3_agents_1 = self._list_l3_agents_hosting_router( router1['router']['id']) l3_agents_2 = self._list_l3_agents_hosting_router( router2['router']['id']) # L3 agent will host only the compatible router. self.assertEqual(1, num_hosta_routers) self.assertEqual(1, len(l3_agents_1['agents'])) self.assertEqual(0, len(l3_agents_2['agents'])) def test_rpc_sync_routers(self): l3_rpc_cb = l3_rpc.L3RpcCallback() self._register_agent_states() # No routers ret_a = l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA) self.assertEqual(0, len(ret_a)) with contextlib.nested(self.router(), self.router(), self.router()) as routers: router_ids = [r['router']['id'] for r in routers] # Get all routers ret_a = l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA) self.assertEqual(3, len(ret_a)) self.assertEqual(set(router_ids), set([r['id'] for r in ret_a])) # Get all routers (router_ids=None) ret_a = l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA, router_ids=None) self.assertEqual(3, len(ret_a)) self.assertEqual(set(router_ids), set([r['id'] for r in ret_a])) # Get router2 only ret_a = l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA, router_ids=[router_ids[1]]) self.assertEqual(1, len(ret_a)) self.assertIn(router_ids[1], [r['id'] for r in ret_a]) # Get router1 and router3 ret_a = l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA, router_ids=[router_ids[0], router_ids[2]]) self.assertEqual(2, len(ret_a)) self.assertIn(router_ids[0], [r['id'] for r in ret_a]) self.assertIn(router_ids[2], [r['id'] for r in ret_a]) def test_router_auto_schedule_for_specified_routers(self): def _sync_router_with_ids(router_ids, exp_synced, exp_hosted, host_id): ret_a = l3_rpc_cb.sync_routers(self.adminContext, host=L3_HOSTA, router_ids=router_ids) self.assertEqual(exp_synced, len(ret_a)) for r in router_ids: self.assertIn(r, [r['id'] for r in ret_a]) host_routers = self._list_routers_hosted_by_l3_agent(host_id) num_host_routers = len(host_routers['routers']) self.assertEqual(exp_hosted, num_host_routers) l3_rpc_cb = l3_rpc.L3RpcCallback() self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_L3, L3_HOSTA) with contextlib.nested(self.router(), self.router(), self.router(), self.router()) as routers: router_ids = [r['router']['id'] for r in routers] # Sync router1 (router1 is scheduled) _sync_router_with_ids([router_ids[0]], 1, 1, hosta_id) # Sync router1 only (no router is scheduled) _sync_router_with_ids([router_ids[0]], 1, 1, hosta_id) # Schedule router2 _sync_router_with_ids([router_ids[1]], 1, 2, hosta_id) # Sync router2 and router4 (router4 is scheduled) _sync_router_with_ids([router_ids[1], router_ids[3]], 2, 3, hosta_id) # Sync all routers (router3 is scheduled) _sync_router_with_ids(router_ids, 4, 4, hosta_id) def test_router_schedule_with_candidates(self): l3_hosta = { 'binary': 'neutron-l3-agent', 'host': L3_HOSTA, 'topic': 'L3_AGENT', 'configurations': {'use_namespaces': False, 'router_id': None, 'handle_internal_only_routers': True, 'gateway_external_network_id': None, 'interface_driver': 'interface_driver', }, 'agent_type': constants.AGENT_TYPE_L3} with contextlib.nested(self.router(), self.router(), self.subnet(), self.subnet(cidr='10.0.3.0/24')) as (router1, router2, subnet1, subnet2): l3_hosta['configurations']['router_id'] = router1['router']['id'] self._register_one_agent_state(l3_hosta) hosta_id = self._get_agent_id(constants.AGENT_TYPE_L3, L3_HOSTA) self._router_interface_action('add', router1['router']['id'], subnet1['subnet']['id'], None) self._router_interface_action('add', router2['router']['id'], subnet2['subnet']['id'], None) hosta_routers = self._list_routers_hosted_by_l3_agent(hosta_id) num_hosta_routers = len(hosta_routers['routers']) l3_agents_1 = self._list_l3_agents_hosting_router( router1['router']['id']) l3_agents_2 = self._list_l3_agents_hosting_router( router2['router']['id']) # safe cleanup self._router_interface_action('remove', router1['router']['id'], subnet1['subnet']['id'], None) self._router_interface_action('remove', router2['router']['id'], subnet2['subnet']['id'], None) # L3 agent will host only the compatible router. self.assertEqual(1, num_hosta_routers) self.assertEqual(1, len(l3_agents_1['agents'])) self.assertEqual(0, len(l3_agents_2['agents'])) def test_router_without_l3_agents(self): with self.subnet() as s: self._set_net_external(s['subnet']['network_id']) data = {'router': {'tenant_id': uuidutils.generate_uuid()}} data['router']['name'] = 'router1' data['router']['external_gateway_info'] = { 'network_id': s['subnet']['network_id']} router_req = self.new_create_request('routers', data, self.fmt) res = router_req.get_response(self.ext_api) router = self.deserialize(self.fmt, res) l3agents = ( self.l3agentscheduler_dbMinxin.get_l3_agents_hosting_routers( self.adminContext, [router['router']['id']])) self._delete('routers', router['router']['id']) self.assertEqual(0, len(l3agents)) def test_router_sync_data(self): with contextlib.nested( self.subnet(), self.subnet(cidr='10.0.2.0/24'), self.subnet(cidr='10.0.3.0/24') ) as (s1, s2, s3): self._register_agent_states() self._set_net_external(s1['subnet']['network_id']) data = {'router': {'tenant_id': uuidutils.generate_uuid()}} data['router']['name'] = 'router1' data['router']['external_gateway_info'] = { 'network_id': s1['subnet']['network_id']} router_req = self.new_create_request('routers', data, self.fmt) res = router_req.get_response(self.ext_api) router = self.deserialize(self.fmt, res) self._router_interface_action('add', router['router']['id'], s2['subnet']['id'], None) self._router_interface_action('add', router['router']['id'], s3['subnet']['id'], None) l3agents = self._list_l3_agents_hosting_router( router['router']['id']) self.assertEqual(1, len(l3agents['agents'])) agents = self._list_agents() another_l3_agent_id = None another_l3_agent_host = None default = l3agents['agents'][0]['id'] for com in agents['agents']: if (com['id'] != default and com['agent_type'] == constants.AGENT_TYPE_L3): another_l3_agent_id = com['id'] another_l3_agent_host = com['host'] break self.assertIsNotNone(another_l3_agent_id) self._add_router_to_l3_agent(another_l3_agent_id, router['router']['id'], expected_code=exc.HTTPConflict.code) self._remove_router_from_l3_agent(default, router['router']['id']) self._add_router_to_l3_agent(another_l3_agent_id, router['router']['id']) l3agents = self._list_l3_agents_hosting_router( router['router']['id']) self.assertEqual(another_l3_agent_host, l3agents['agents'][0]['host']) self._remove_router_from_l3_agent(another_l3_agent_id, router['router']['id']) self._router_interface_action('remove', router['router']['id'], s2['subnet']['id'], None) l3agents = self._list_l3_agents_hosting_router( router['router']['id']) self.assertEqual(1, len(l3agents['agents'])) self._router_interface_action('remove', router['router']['id'], s3['subnet']['id'], None) self._delete('routers', router['router']['id']) def test_router_add_to_l3_agent(self): with self.router() as router1: self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_L3, L3_HOSTA) num_before_add = len( self._list_routers_hosted_by_l3_agent( hosta_id)['routers']) self._add_router_to_l3_agent(hosta_id, router1['router']['id']) hostb_id = self._get_agent_id(constants.AGENT_TYPE_L3, L3_HOSTB) self._add_router_to_l3_agent(hostb_id, router1['router']['id'], expected_code=exc.HTTPConflict.code) num_after_add = len( self._list_routers_hosted_by_l3_agent( hosta_id)['routers']) self.assertEqual(0, num_before_add) self.assertEqual(1, num_after_add) def test_router_add_to_l3_agent_two_times(self): with self.router() as router1: self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_L3, L3_HOSTA) self._add_router_to_l3_agent(hosta_id, router1['router']['id']) # scheduling twice on the same agent is fine self._add_router_to_l3_agent(hosta_id, router1['router']['id']) def test_router_add_to_two_l3_agents(self): with self.router() as router1: self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_L3, L3_HOSTA) hostb_id = self._get_agent_id(constants.AGENT_TYPE_L3, L3_HOSTB) self._add_router_to_l3_agent(hosta_id, router1['router']['id']) self._add_router_to_l3_agent(hostb_id, router1['router']['id'], expected_code=exc.HTTPConflict.code) def test_router_policy(self): with self.router() as router1: self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_L3, L3_HOSTA) self._list_routers_hosted_by_l3_agent( hosta_id, expected_code=exc.HTTPForbidden.code, admin_context=False) self._add_router_to_l3_agent( hosta_id, router1['router']['id'], expected_code=exc.HTTPForbidden.code, admin_context=False) self._add_router_to_l3_agent( hosta_id, router1['router']['id']) self._remove_router_from_l3_agent( hosta_id, router1['router']['id'], expected_code=exc.HTTPForbidden.code, admin_context=False) self._list_l3_agents_hosting_router( router1['router']['id'], expected_code=exc.HTTPForbidden.code, admin_context=False) class OvsDhcpAgentNotifierTestCase(test_l3_plugin.L3NatTestCaseMixin, test_agent_ext_plugin.AgentDBTestMixIn, AgentSchedulerTestMixIn, test_plugin.NeutronDbPluginV2TestCase): plugin_str = ('neutron.plugins.openvswitch.' 'ovs_neutron_plugin.OVSNeutronPluginV2') def setUp(self): # Save the global RESOURCE_ATTRIBUTE_MAP before loading plugin self.saved_attr_map = {} for resource, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.iteritems(): self.saved_attr_map[resource] = attrs.copy() super(OvsDhcpAgentNotifierTestCase, self).setUp(self.plugin_str) # the notifier is used to get access to make_msg() method only self.dhcp_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI() self.dhcp_notifier_cast = mock.patch( 'neutron.api.rpc.agentnotifiers.dhcp_rpc_agent_api.' 'DhcpAgentNotifyAPI.cast').start() ext_mgr = extensions.PluginAwareExtensionManager.get_instance() self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr) self.adminContext = context.get_admin_context() # Add the resources to the global attribute map # This is done here as the setup process won't # initialize the main API router which extends # the global attribute map attributes.RESOURCE_ATTRIBUTE_MAP.update( agent.RESOURCE_ATTRIBUTE_MAP) self.addCleanup(self.restore_attribute_map) fake_notifier.reset() def restore_attribute_map(self): # Restore the original RESOURCE_ATTRIBUTE_MAP attributes.RESOURCE_ATTRIBUTE_MAP = self.saved_attr_map def test_network_add_to_dhcp_agent_notification(self): with self.network() as net1: network_id = net1['network']['id'] self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTA) self._add_network_to_dhcp_agent(hosta_id, network_id) self.dhcp_notifier_cast.assert_called_with( mock.ANY, self.dhcp_notifier.make_msg( 'network_create_end', payload={'network': {'id': network_id}}), topic='dhcp_agent.' + DHCP_HOSTA) notifications = fake_notifier.NOTIFICATIONS expected_event_type = 'dhcp_agent.network.add' self._assert_notify(notifications, expected_event_type) def test_network_remove_from_dhcp_agent_notification(self): with self.network(do_delete=False) as net1: network_id = net1['network']['id'] self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTA) self._add_network_to_dhcp_agent(hosta_id, network_id) self._remove_network_from_dhcp_agent(hosta_id, network_id) self.dhcp_notifier_cast.assert_called_with( mock.ANY, self.dhcp_notifier.make_msg( 'network_delete_end', payload={'network_id': network_id}), topic='dhcp_agent.' + DHCP_HOSTA) notifications = fake_notifier.NOTIFICATIONS expected_event_type = 'dhcp_agent.network.remove' self._assert_notify(notifications, expected_event_type) def test_agent_updated_dhcp_agent_notification(self): self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_DHCP, DHCP_HOSTA) self._disable_agent(hosta_id, admin_state_up=False) self.dhcp_notifier_cast.assert_called_with( mock.ANY, self.dhcp_notifier.make_msg( 'agent_updated', payload={'admin_state_up': False}), topic='dhcp_agent.' + DHCP_HOSTA) def _network_port_create( self, hosts, gateway=attributes.ATTR_NOT_SPECIFIED, owner=None): for host in hosts: self._register_one_agent_state( {'binary': 'neutron-dhcp-agent', 'host': host, 'topic': 'dhcp_agent', 'configurations': {'dhcp_driver': 'dhcp_driver', 'use_namespaces': True, }, 'agent_type': constants.AGENT_TYPE_DHCP}) with self.network(do_delete=False) as net1: with self.subnet(network=net1, gateway_ip=gateway, do_delete=False) as subnet1: if owner: with self.port(subnet=subnet1, do_delete=False, device_owner=owner) as port: return [net1, subnet1, port] else: with self.port(subnet=subnet1, do_delete=False) as port: return [net1, subnet1, port] def _notification_mocks(self, hosts, net, subnet, port): host_calls = {} for host in hosts: expected_calls = [ mock.call( mock.ANY, self.dhcp_notifier.make_msg( 'network_create_end', payload={'network': {'id': net['network']['id']}}), topic='dhcp_agent.' + host), mock.call( mock.ANY, self.dhcp_notifier.make_msg( 'port_create_end', payload={'port': port['port']}), topic='dhcp_agent.' + host)] host_calls[host] = expected_calls return host_calls def test_network_port_create_notification(self): hosts = [DHCP_HOSTA] net, subnet, port = self._network_port_create(hosts) expected_calls = self._notification_mocks(hosts, net, subnet, port) self.assertEqual( expected_calls[DHCP_HOSTA], self.dhcp_notifier_cast.call_args_list) def test_network_ha_port_create_notification(self): cfg.CONF.set_override('dhcp_agents_per_network', 2) hosts = [DHCP_HOSTA, DHCP_HOSTC] net, subnet, port = self._network_port_create(hosts) expected_calls = self._notification_mocks(hosts, net, subnet, port) for expected in expected_calls[DHCP_HOSTA]: self.assertIn(expected, self.dhcp_notifier_cast.call_args_list) for expected in expected_calls[DHCP_HOSTC]: self.assertIn(expected, self.dhcp_notifier_cast.call_args_list) def _is_schedule_network_called(self, device_id): plugin = manager.NeutronManager.get_plugin() notifier = plugin.agent_notifiers[constants.AGENT_TYPE_DHCP] with contextlib.nested( self.subnet(), mock.patch.object(plugin, 'get_dhcp_agents_hosting_networks', return_value=[]), mock.patch.object(notifier, '_schedule_network', return_value=[]) ) as (subnet, _, mock_sched): with self.port(subnet=subnet, device_id=device_id): return mock_sched.called def test_reserved_dhcp_port_creation(self): device_id = constants.DEVICE_ID_RESERVED_DHCP_PORT self.assertFalse(self._is_schedule_network_called(device_id)) def test_unreserved_dhcp_port_creation(self): device_id = 'not_reserved' self.assertTrue(self._is_schedule_network_called(device_id)) class OvsL3AgentNotifierTestCase(test_l3_plugin.L3NatTestCaseMixin, test_agent_ext_plugin.AgentDBTestMixIn, AgentSchedulerTestMixIn, test_plugin.NeutronDbPluginV2TestCase): plugin_str = ('neutron.plugins.openvswitch.' 'ovs_neutron_plugin.OVSNeutronPluginV2') l3_plugin = None def setUp(self): self.dhcp_notifier_cls_p = mock.patch( 'neutron.api.rpc.agentnotifiers.dhcp_rpc_agent_api.' 'DhcpAgentNotifyAPI') self.dhcp_notifier = mock.Mock(name='dhcp_notifier') self.dhcp_notifier_cls = self.dhcp_notifier_cls_p.start() self.dhcp_notifier_cls.return_value = self.dhcp_notifier # Save the global RESOURCE_ATTRIBUTE_MAP self.saved_attr_map = {} for resource, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.iteritems(): self.saved_attr_map[resource] = attrs.copy() if self.l3_plugin: service_plugins = {'l3_plugin_name': self.l3_plugin} else: service_plugins = None super(OvsL3AgentNotifierTestCase, self).setUp( self.plugin_str, service_plugins=service_plugins) ext_mgr = extensions.PluginAwareExtensionManager.get_instance() self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr) self.adminContext = context.get_admin_context() # Add the resources to the global attribute map # This is done here as the setup process won't # initialize the main API router which extends # the global attribute map attributes.RESOURCE_ATTRIBUTE_MAP.update( agent.RESOURCE_ATTRIBUTE_MAP) self.addCleanup(self.restore_attribute_map) fake_notifier.reset() def restore_attribute_map(self): # Restore the original RESOURCE_ATTRIBUTE_MAP attributes.RESOURCE_ATTRIBUTE_MAP = self.saved_attr_map def test_router_add_to_l3_agent_notification(self): plugin = manager.NeutronManager.get_plugin() l3_notifier = plugin.agent_notifiers[constants.AGENT_TYPE_L3] with mock.patch.object(l3_notifier, 'cast') as mock_l3: with self.router() as router1: self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_L3, L3_HOSTA) self._add_router_to_l3_agent(hosta_id, router1['router']['id']) routers = [router1['router']['id']] mock_l3.assert_called_with( mock.ANY, l3_notifier.make_msg( 'router_added_to_agent', payload=routers), topic='l3_agent.hosta') notifications = fake_notifier.NOTIFICATIONS expected_event_type = 'l3_agent.router.add' self._assert_notify(notifications, expected_event_type) def test_router_remove_from_l3_agent_notification(self): plugin = manager.NeutronManager.get_plugin() l3_notifier = plugin.agent_notifiers[constants.AGENT_TYPE_L3] with mock.patch.object(l3_notifier, 'cast') as mock_l3: with self.router() as router1: self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_L3, L3_HOSTA) self._add_router_to_l3_agent(hosta_id, router1['router']['id']) self._remove_router_from_l3_agent(hosta_id, router1['router']['id']) mock_l3.assert_called_with( mock.ANY, l3_notifier.make_msg( 'router_removed_from_agent', payload={'router_id': router1['router']['id']}), topic='l3_agent.hosta') notifications = fake_notifier.NOTIFICATIONS expected_event_type = 'l3_agent.router.remove' self._assert_notify(notifications, expected_event_type) def test_agent_updated_l3_agent_notification(self): plugin = manager.NeutronManager.get_plugin() l3_notifier = plugin.agent_notifiers[constants.AGENT_TYPE_L3] with mock.patch.object(l3_notifier, 'cast') as mock_l3: self._register_agent_states() hosta_id = self._get_agent_id(constants.AGENT_TYPE_L3, L3_HOSTA) self._disable_agent(hosta_id, admin_state_up=False) mock_l3.assert_called_with( mock.ANY, l3_notifier.make_msg( 'agent_updated', payload={'admin_state_up': False}), topic='l3_agent.hosta') class OvsAgentSchedulerTestCaseXML(OvsAgentSchedulerTestCase): fmt = 'xml'
48.428676
79
0.578094
7,239
66,202
4.905512
0.058986
0.032948
0.02433
0.01301
0.811748
0.773535
0.738025
0.696798
0.67106
0.64304
0
0.013331
0.333751
66,202
1,366
80
48.464129
0.791779
0.039092
0
0.65654
0
0
0.072938
0.018868
0
0
0
0
0.088608
1
0.064979
false
0.002532
0.024473
0.003376
0.113924
0
0
0
0
null
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
81008e2e21e18ef4ea6e909454dc22c639385add
129
py
Python
run.py
atb-leap/boilerplate-cloud-functions
e8975c90e950beada573c89217d4f7aae4a92ba4
[ "Apache-2.0" ]
null
null
null
run.py
atb-leap/boilerplate-cloud-functions
e8975c90e950beada573c89217d4f7aae4a92ba4
[ "Apache-2.0" ]
6
2019-09-16T19:06:57.000Z
2019-09-18T20:04:57.000Z
run.py
atb-leap/boilerplate-cloud-functions
e8975c90e950beada573c89217d4f7aae4a92ba4
[ "Apache-2.0" ]
null
null
null
import os from myapp import app if __name__ == '__main__': app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 8080)))
18.428571
67
0.658915
23
129
3.347826
0.695652
0.077922
0.077922
0
0
0
0
0
0
0
0
0.072727
0.147287
129
6
68
21.5
0.627273
0
0
0
0
0
0.148438
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
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
0
0
0
4
8115a81a660c25bea1f28bfcd9389f511e8280a8
58
py
Python
cryptococcus/tests/test_placeholder.py
leouieda/cryptococcus
bc06184614406518b44c70e33a19e2e361bae8a7
[ "BSD-3-Clause-Clear" ]
null
null
null
cryptococcus/tests/test_placeholder.py
leouieda/cryptococcus
bc06184614406518b44c70e33a19e2e361bae8a7
[ "BSD-3-Clause-Clear" ]
null
null
null
cryptococcus/tests/test_placeholder.py
leouieda/cryptococcus
bc06184614406518b44c70e33a19e2e361bae8a7
[ "BSD-3-Clause-Clear" ]
null
null
null
def test_something(): "Do some tests" assert True
14.5
21
0.655172
8
58
4.625
1
0
0
0
0
0
0
0
0
0
0
0
0.258621
58
3
22
19.333333
0.860465
0.224138
0
0
0
0
0.224138
0
0
0
0
0
0.333333
1
0.333333
true
0
0
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
0
0
0
0
4
8132c5c10034388742082ad9886553d6b8b7f278
188
py
Python
python/export/exporter.py
amlozano/airmonitoring
32b26ee83982612e9d77aa37fce05a18185580a3
[ "Apache-2.0" ]
null
null
null
python/export/exporter.py
amlozano/airmonitoring
32b26ee83982612e9d77aa37fce05a18185580a3
[ "Apache-2.0" ]
9
2021-01-14T15:47:47.000Z
2021-01-22T12:48:11.000Z
python/export/exporter.py
amlozano/airmonitoring
32b26ee83982612e9d77aa37fce05a18185580a3
[ "Apache-2.0" ]
null
null
null
from abc import ABC from data.measurement import Measurement class Exporter(ABC): def export_value(self, measurement: Measurement): pass def flush(self): pass
14.461538
53
0.68617
23
188
5.565217
0.565217
0
0
0
0
0
0
0
0
0
0
0
0.25
188
12
54
15.666667
0.907801
0
0
0.285714
0
0
0
0
0
0
0
0
0
1
0.285714
false
0.285714
0.285714
0
0.714286
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
4
813852ea3e7c5c2f1c372bbc36edb4253e176db7
17,722
py
Python
tests/test_anchor.py
jiangrongatrobo/mmdetection
76ccf891f98f5df526146560773f1fedf5607bdd
[ "Apache-2.0" ]
426
2020-10-16T08:09:27.000Z
2022-03-30T03:36:04.000Z
tests/test_anchor.py
Oz-art/mmdetection
d3cf38d91c454b1a6881e8c36c1e4a66dc5521b8
[ "Apache-2.0" ]
170
2020-09-08T12:29:06.000Z
2022-03-31T18:28:09.000Z
tests/test_anchor.py
Oz-art/mmdetection
d3cf38d91c454b1a6881e8c36c1e4a66dc5521b8
[ "Apache-2.0" ]
49
2021-05-12T05:27:28.000Z
2022-03-14T04:02:40.000Z
""" CommandLine: pytest tests/test_anchor.py xdoctest tests/test_anchor.py zero """ import torch def test_standard_anchor_generator(): from mmdet.core.anchor import build_anchor_generator anchor_generator_cfg = dict( type='AnchorGenerator', scales=[8], ratios=[0.5, 1.0, 2.0], strides=[4, 8]) anchor_generator = build_anchor_generator(anchor_generator_cfg) assert anchor_generator is not None def test_strides(): from mmdet.core import AnchorGenerator # Square strides self = AnchorGenerator([10], [1.], [1.], [10]) anchors = self.grid_anchors([(2, 2)], device='cpu') expected_anchors = torch.tensor([[-5., -5., 5., 5.], [5., -5., 15., 5.], [-5., 5., 5., 15.], [5., 5., 15., 15.]]) assert torch.equal(anchors[0], expected_anchors) # Different strides in x and y direction self = AnchorGenerator([(10, 20)], [1.], [1.], [10]) anchors = self.grid_anchors([(2, 2)], device='cpu') expected_anchors = torch.tensor([[-5., -5., 5., 5.], [5., -5., 15., 5.], [-5., 15., 5., 25.], [5., 15., 15., 25.]]) assert torch.equal(anchors[0], expected_anchors) def test_ssd_anchor_generator(): from mmdet.core.anchor import build_anchor_generator if torch.cuda.is_available(): device = 'cuda' else: device = 'cpu' anchor_generator_cfg = dict( type='SSDAnchorGenerator', scale_major=False, input_size=300, basesize_ratio_range=(0.15, 0.9), strides=[8, 16, 32, 64, 100, 300], ratios=[[2], [2, 3], [2, 3], [2, 3], [2], [2]]) featmap_sizes = [(38, 38), (19, 19), (10, 10), (5, 5), (3, 3), (1, 1)] anchor_generator = build_anchor_generator(anchor_generator_cfg) # check base anchors expected_base_anchors = [ torch.Tensor([[-6.5000, -6.5000, 14.5000, 14.5000], [-11.3704, -11.3704, 19.3704, 19.3704], [-10.8492, -3.4246, 18.8492, 11.4246], [-3.4246, -10.8492, 11.4246, 18.8492]]), torch.Tensor([[-14.5000, -14.5000, 30.5000, 30.5000], [-25.3729, -25.3729, 41.3729, 41.3729], [-23.8198, -7.9099, 39.8198, 23.9099], [-7.9099, -23.8198, 23.9099, 39.8198], [-30.9711, -4.9904, 46.9711, 20.9904], [-4.9904, -30.9711, 20.9904, 46.9711]]), torch.Tensor([[-33.5000, -33.5000, 65.5000, 65.5000], [-45.5366, -45.5366, 77.5366, 77.5366], [-54.0036, -19.0018, 86.0036, 51.0018], [-19.0018, -54.0036, 51.0018, 86.0036], [-69.7365, -12.5788, 101.7365, 44.5788], [-12.5788, -69.7365, 44.5788, 101.7365]]), torch.Tensor([[-44.5000, -44.5000, 108.5000, 108.5000], [-56.9817, -56.9817, 120.9817, 120.9817], [-76.1873, -22.0937, 140.1873, 86.0937], [-22.0937, -76.1873, 86.0937, 140.1873], [-100.5019, -12.1673, 164.5019, 76.1673], [-12.1673, -100.5019, 76.1673, 164.5019]]), torch.Tensor([[-53.5000, -53.5000, 153.5000, 153.5000], [-66.2185, -66.2185, 166.2185, 166.2185], [-96.3711, -23.1855, 196.3711, 123.1855], [-23.1855, -96.3711, 123.1855, 196.3711]]), torch.Tensor([[19.5000, 19.5000, 280.5000, 280.5000], [6.6342, 6.6342, 293.3658, 293.3658], [-34.5549, 57.7226, 334.5549, 242.2774], [57.7226, -34.5549, 242.2774, 334.5549]]), ] base_anchors = anchor_generator.base_anchors for i, base_anchor in enumerate(base_anchors): assert base_anchor.allclose(expected_base_anchors[i]) # check valid flags expected_valid_pixels = [5776, 2166, 600, 150, 36, 4] multi_level_valid_flags = anchor_generator.valid_flags( featmap_sizes, (300, 300), device) for i, single_level_valid_flag in enumerate(multi_level_valid_flags): assert single_level_valid_flag.sum() == expected_valid_pixels[i] # check number of base anchors for each level assert anchor_generator.num_base_anchors == [4, 6, 6, 6, 4, 4] # check anchor generation anchors = anchor_generator.grid_anchors(featmap_sizes, device) assert len(anchors) == 6 def test_anchor_generator_with_tuples(): from mmdet.core.anchor import build_anchor_generator if torch.cuda.is_available(): device = 'cuda' else: device = 'cpu' anchor_generator_cfg = dict( type='SSDAnchorGenerator', scale_major=False, input_size=300, basesize_ratio_range=(0.15, 0.9), strides=[8, 16, 32, 64, 100, 300], ratios=[[2], [2, 3], [2, 3], [2, 3], [2], [2]]) featmap_sizes = [(38, 38), (19, 19), (10, 10), (5, 5), (3, 3), (1, 1)] anchor_generator = build_anchor_generator(anchor_generator_cfg) anchors = anchor_generator.grid_anchors(featmap_sizes, device) anchor_generator_cfg_tuples = dict( type='SSDAnchorGenerator', scale_major=False, input_size=300, basesize_ratio_range=(0.15, 0.9), strides=[(8, 8), (16, 16), (32, 32), (64, 64), (100, 100), (300, 300)], ratios=[[2], [2, 3], [2, 3], [2, 3], [2], [2]]) anchor_generator_tuples = build_anchor_generator( anchor_generator_cfg_tuples) anchors_tuples = anchor_generator_tuples.grid_anchors( featmap_sizes, device) for anchor, anchor_tuples in zip(anchors, anchors_tuples): assert torch.equal(anchor, anchor_tuples) def test_yolo_anchor_generator(): from mmdet.core.anchor import build_anchor_generator if torch.cuda.is_available(): device = 'cuda' else: device = 'cpu' anchor_generator_cfg = dict( type='YOLOAnchorGenerator', strides=[32, 16, 8], base_sizes=[ [(116, 90), (156, 198), (373, 326)], [(30, 61), (62, 45), (59, 119)], [(10, 13), (16, 30), (33, 23)], ]) featmap_sizes = [(14, 18), (28, 36), (56, 72)] anchor_generator = build_anchor_generator(anchor_generator_cfg) # check base anchors expected_base_anchors = [ torch.Tensor([[-42.0000, -29.0000, 74.0000, 61.0000], [-62.0000, -83.0000, 94.0000, 115.0000], [-170.5000, -147.0000, 202.5000, 179.0000]]), torch.Tensor([[-7.0000, -22.5000, 23.0000, 38.5000], [-23.0000, -14.5000, 39.0000, 30.5000], [-21.5000, -51.5000, 37.5000, 67.5000]]), torch.Tensor([[-1.0000, -2.5000, 9.0000, 10.5000], [-4.0000, -11.0000, 12.0000, 19.0000], [-12.5000, -7.5000, 20.5000, 15.5000]]) ] base_anchors = anchor_generator.base_anchors for i, base_anchor in enumerate(base_anchors): assert base_anchor.allclose(expected_base_anchors[i]) # check number of base anchors for each level assert anchor_generator.num_base_anchors == [3, 3, 3] # check anchor generation anchors = anchor_generator.grid_anchors(featmap_sizes, device) assert len(anchors) == 3 def test_retina_anchor(): from mmdet.models import build_head if torch.cuda.is_available(): device = 'cuda' else: device = 'cpu' # head configs modified from # configs/nas_fpn/retinanet_r50_fpn_crop640_50e.py bbox_head = dict( type='RetinaSepBNHead', num_classes=4, num_ins=5, in_channels=4, stacked_convs=1, feat_channels=4, anchor_generator=dict( type='AnchorGenerator', octave_base_scale=4, scales_per_octave=3, ratios=[0.5, 1.0, 2.0], strides=[8, 16, 32, 64, 128]), bbox_coder=dict( type='DeltaXYWHBBoxCoder', target_means=[.0, .0, .0, .0], target_stds=[1.0, 1.0, 1.0, 1.0])) retina_head = build_head(bbox_head) assert retina_head.anchor_generator is not None # use the featmap sizes in NASFPN setting to test retina head featmap_sizes = [(80, 80), (40, 40), (20, 20), (10, 10), (5, 5)] # check base anchors expected_base_anchors = [ torch.Tensor([[-22.6274, -11.3137, 22.6274, 11.3137], [-28.5088, -14.2544, 28.5088, 14.2544], [-35.9188, -17.9594, 35.9188, 17.9594], [-16.0000, -16.0000, 16.0000, 16.0000], [-20.1587, -20.1587, 20.1587, 20.1587], [-25.3984, -25.3984, 25.3984, 25.3984], [-11.3137, -22.6274, 11.3137, 22.6274], [-14.2544, -28.5088, 14.2544, 28.5088], [-17.9594, -35.9188, 17.9594, 35.9188]]), torch.Tensor([[-45.2548, -22.6274, 45.2548, 22.6274], [-57.0175, -28.5088, 57.0175, 28.5088], [-71.8376, -35.9188, 71.8376, 35.9188], [-32.0000, -32.0000, 32.0000, 32.0000], [-40.3175, -40.3175, 40.3175, 40.3175], [-50.7968, -50.7968, 50.7968, 50.7968], [-22.6274, -45.2548, 22.6274, 45.2548], [-28.5088, -57.0175, 28.5088, 57.0175], [-35.9188, -71.8376, 35.9188, 71.8376]]), torch.Tensor([[-90.5097, -45.2548, 90.5097, 45.2548], [-114.0350, -57.0175, 114.0350, 57.0175], [-143.6751, -71.8376, 143.6751, 71.8376], [-64.0000, -64.0000, 64.0000, 64.0000], [-80.6349, -80.6349, 80.6349, 80.6349], [-101.5937, -101.5937, 101.5937, 101.5937], [-45.2548, -90.5097, 45.2548, 90.5097], [-57.0175, -114.0350, 57.0175, 114.0350], [-71.8376, -143.6751, 71.8376, 143.6751]]), torch.Tensor([[-181.0193, -90.5097, 181.0193, 90.5097], [-228.0701, -114.0350, 228.0701, 114.0350], [-287.3503, -143.6751, 287.3503, 143.6751], [-128.0000, -128.0000, 128.0000, 128.0000], [-161.2699, -161.2699, 161.2699, 161.2699], [-203.1873, -203.1873, 203.1873, 203.1873], [-90.5097, -181.0193, 90.5097, 181.0193], [-114.0350, -228.0701, 114.0350, 228.0701], [-143.6751, -287.3503, 143.6751, 287.3503]]), torch.Tensor([[-362.0387, -181.0193, 362.0387, 181.0193], [-456.1401, -228.0701, 456.1401, 228.0701], [-574.7006, -287.3503, 574.7006, 287.3503], [-256.0000, -256.0000, 256.0000, 256.0000], [-322.5398, -322.5398, 322.5398, 322.5398], [-406.3747, -406.3747, 406.3747, 406.3747], [-181.0193, -362.0387, 181.0193, 362.0387], [-228.0701, -456.1401, 228.0701, 456.1401], [-287.3503, -574.7006, 287.3503, 574.7006]]) ] base_anchors = retina_head.anchor_generator.base_anchors for i, base_anchor in enumerate(base_anchors): assert base_anchor.allclose(expected_base_anchors[i]) # check valid flags expected_valid_pixels = [57600, 14400, 3600, 900, 225] multi_level_valid_flags = retina_head.anchor_generator.valid_flags( featmap_sizes, (640, 640), device) for i, single_level_valid_flag in enumerate(multi_level_valid_flags): assert single_level_valid_flag.sum() == expected_valid_pixels[i] # check number of base anchors for each level assert retina_head.anchor_generator.num_base_anchors == [9, 9, 9, 9, 9] # check anchor generation anchors = retina_head.anchor_generator.grid_anchors(featmap_sizes, device) assert len(anchors) == 5 def test_guided_anchor(): from mmdet.models import build_head if torch.cuda.is_available(): device = 'cuda' else: device = 'cpu' # head configs modified from # configs/guided_anchoring/ga_retinanet_r50_fpn_1x_coco.py bbox_head = dict( type='GARetinaHead', num_classes=8, in_channels=4, stacked_convs=1, feat_channels=4, approx_anchor_generator=dict( type='AnchorGenerator', octave_base_scale=4, scales_per_octave=3, ratios=[0.5, 1.0, 2.0], strides=[8, 16, 32, 64, 128]), square_anchor_generator=dict( type='AnchorGenerator', ratios=[1.0], scales=[4], strides=[8, 16, 32, 64, 128])) ga_retina_head = build_head(bbox_head) assert ga_retina_head.approx_anchor_generator is not None # use the featmap sizes in NASFPN setting to test ga_retina_head featmap_sizes = [(100, 152), (50, 76), (25, 38), (13, 19), (7, 10)] # check base anchors expected_approxs = [ torch.Tensor([[-22.6274, -11.3137, 22.6274, 11.3137], [-28.5088, -14.2544, 28.5088, 14.2544], [-35.9188, -17.9594, 35.9188, 17.9594], [-16.0000, -16.0000, 16.0000, 16.0000], [-20.1587, -20.1587, 20.1587, 20.1587], [-25.3984, -25.3984, 25.3984, 25.3984], [-11.3137, -22.6274, 11.3137, 22.6274], [-14.2544, -28.5088, 14.2544, 28.5088], [-17.9594, -35.9188, 17.9594, 35.9188]]), torch.Tensor([[-45.2548, -22.6274, 45.2548, 22.6274], [-57.0175, -28.5088, 57.0175, 28.5088], [-71.8376, -35.9188, 71.8376, 35.9188], [-32.0000, -32.0000, 32.0000, 32.0000], [-40.3175, -40.3175, 40.3175, 40.3175], [-50.7968, -50.7968, 50.7968, 50.7968], [-22.6274, -45.2548, 22.6274, 45.2548], [-28.5088, -57.0175, 28.5088, 57.0175], [-35.9188, -71.8376, 35.9188, 71.8376]]), torch.Tensor([[-90.5097, -45.2548, 90.5097, 45.2548], [-114.0350, -57.0175, 114.0350, 57.0175], [-143.6751, -71.8376, 143.6751, 71.8376], [-64.0000, -64.0000, 64.0000, 64.0000], [-80.6349, -80.6349, 80.6349, 80.6349], [-101.5937, -101.5937, 101.5937, 101.5937], [-45.2548, -90.5097, 45.2548, 90.5097], [-57.0175, -114.0350, 57.0175, 114.0350], [-71.8376, -143.6751, 71.8376, 143.6751]]), torch.Tensor([[-181.0193, -90.5097, 181.0193, 90.5097], [-228.0701, -114.0350, 228.0701, 114.0350], [-287.3503, -143.6751, 287.3503, 143.6751], [-128.0000, -128.0000, 128.0000, 128.0000], [-161.2699, -161.2699, 161.2699, 161.2699], [-203.1873, -203.1873, 203.1873, 203.1873], [-90.5097, -181.0193, 90.5097, 181.0193], [-114.0350, -228.0701, 114.0350, 228.0701], [-143.6751, -287.3503, 143.6751, 287.3503]]), torch.Tensor([[-362.0387, -181.0193, 362.0387, 181.0193], [-456.1401, -228.0701, 456.1401, 228.0701], [-574.7006, -287.3503, 574.7006, 287.3503], [-256.0000, -256.0000, 256.0000, 256.0000], [-322.5398, -322.5398, 322.5398, 322.5398], [-406.3747, -406.3747, 406.3747, 406.3747], [-181.0193, -362.0387, 181.0193, 362.0387], [-228.0701, -456.1401, 228.0701, 456.1401], [-287.3503, -574.7006, 287.3503, 574.7006]]) ] approxs = ga_retina_head.approx_anchor_generator.base_anchors for i, base_anchor in enumerate(approxs): assert base_anchor.allclose(expected_approxs[i]) # check valid flags expected_valid_pixels = [136800, 34200, 8550, 2223, 630] multi_level_valid_flags = ga_retina_head.approx_anchor_generator \ .valid_flags(featmap_sizes, (800, 1216), device) for i, single_level_valid_flag in enumerate(multi_level_valid_flags): assert single_level_valid_flag.sum() == expected_valid_pixels[i] # check number of base anchors for each level assert ga_retina_head.approx_anchor_generator.num_base_anchors == [ 9, 9, 9, 9, 9 ] # check approx generation squares = ga_retina_head.square_anchor_generator.grid_anchors( featmap_sizes, device) assert len(squares) == 5 expected_squares = [ torch.Tensor([[-16., -16., 16., 16.]]), torch.Tensor([[-32., -32., 32., 32]]), torch.Tensor([[-64., -64., 64., 64.]]), torch.Tensor([[-128., -128., 128., 128.]]), torch.Tensor([[-256., -256., 256., 256.]]) ] squares = ga_retina_head.square_anchor_generator.base_anchors for i, base_anchor in enumerate(squares): assert base_anchor.allclose(expected_squares[i]) # square_anchor_generator does not check valid flags # check number of base anchors for each level assert (ga_retina_head.square_anchor_generator.num_base_anchors == [ 1, 1, 1, 1, 1 ]) # check square generation anchors = ga_retina_head.square_anchor_generator.grid_anchors( featmap_sizes, device) assert len(anchors) == 5
43.119221
79
0.537185
2,331
17,722
3.947662
0.130845
0.089654
0.019561
0.003043
0.735601
0.706586
0.679526
0.653988
0.635731
0.62769
0
0.309263
0.303747
17,722
410
80
43.22439
0.436502
0.053154
0
0.598784
0
0
0.013078
0
0
0
0
0
0.072948
1
0.021277
false
0
0.024316
0
0.045593
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
813d8a61be8d6618af7c16897eb55b8e08d7b785
170
py
Python
yatube/posts/views.py
memphis94/yatube_project
78048e4a5fc3e6faa13c6f14386ae5de1d3814ff
[ "MIT" ]
null
null
null
yatube/posts/views.py
memphis94/yatube_project
78048e4a5fc3e6faa13c6f14386ae5de1d3814ff
[ "MIT" ]
null
null
null
yatube/posts/views.py
memphis94/yatube_project
78048e4a5fc3e6faa13c6f14386ae5de1d3814ff
[ "MIT" ]
null
null
null
from django.shortcuts import render # Create your views here. def group_posts(request, slug): template = 'posts/group_list.html' return render(request, template)
28.333333
38
0.758824
23
170
5.521739
0.782609
0
0
0
0
0
0
0
0
0
0
0
0.152941
170
6
39
28.333333
0.881944
0.135294
0
0
0
0
0.143836
0.143836
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
813f155a31e7fb070d7cd17da5b836f822d68b1a
21,206
py
Python
main.py
simongroom/project_euler_python
25751fba228cff31fe0898442fdfa2126bb98657
[ "MIT" ]
null
null
null
main.py
simongroom/project_euler_python
25751fba228cff31fe0898442fdfa2126bb98657
[ "MIT" ]
null
null
null
main.py
simongroom/project_euler_python
25751fba228cff31fe0898442fdfa2126bb98657
[ "MIT" ]
null
null
null
# coding=utf-8 import math from datetime import datetime, timedelta from time import time from helpers import Helpers def even_fib_numbers(): ef1 = 0 ef2 = 2 result = ef1 + ef2 r = 4000000 while ef2 <= r: ef3 = 4 * ef2 + ef1 if ef3 > r: break result += ef3 ef1 = ef2 ef2 = ef3 print(str(result)) def largest_prime_factor(): n = 600851475143 # n = 6 result = -1 while n % 2 == 0: result = 2 n /= 2 print("result is: " + str(result)) print("n is: " + str(n)) for i in range(3, int(math.sqrt(n)), 2): while n % i == 0: result = i n = n / i print("result is: " + str(result)) print("n is: " + str(n)) if n > 2: result = n print("result is: " + str(result)) def largest_palindrome_product(): start = 100 end = 999 result = 0 for x in range(end, start, -1): for y in range(end, start, -1): prod = x * y if str(prod) == str(prod)[::-1]: if prod > result: result = prod print("result: " + str(result)) def smallest_multiple(): n = 20 result = 1 for x in range(1, n, 1): previous = result while result % x != 0: result = result + previous print("result: " + str(result)) def sum_square_difference(): n = 100 sum_squares = 0 square_sums = 0 for i in range(n + 1): sum_squares = sum_squares + (i * i) for i in range(n + 1): square_sums += i square_sums = square_sums * square_sums result = square_sums - sum_squares print(str(result)) def ten_thousand_first_prime(): num_primes = 1 counter = 2 while num_primes < 10001: counter += 1 if Helpers.is_prime(counter): num_primes += 1 print(str(counter)) def largest_product_in_series(): num = 7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450 greatest_product = 0 num_string = str(num) n_len = len(num_string) split_num = 13 # split_num = 4 for i in range(n_len - split_num + 1): portion = num_string[i:split_num + i] portion_list = [int(s) for s in portion] prod = 1 for p in portion_list: prod = prod * p if prod > greatest_product: greatest_product = prod print(str(greatest_product)) def special_pythagorean_triplet(): result = 0 target = 1000 for counter in range(1, target): if result != 0: break for counter_1 in range(counter + 1, target - 1): counter_2 = ((counter ** 2) + (counter_1 ** 2)) ** 0.5 if counter + counter_1 + counter_2 == target: print("counter value is: " + str(counter)) print("counter_1 value is: " + str(counter_1)) print("counter_2 value is: " + str(counter_2)) print("************HIT**************") result = counter * counter_1 * counter_2 break Helpers.pr(int(result)) def summation_of_primes(): """ The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. :return: """ result = 0 n = 2000000 # n = 10 for i in range(n): if Helpers.is_prime(i): result += i Helpers.pr(result) def largest_product_in_a_grid(): """ In the 20×20 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65 52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91 22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80 24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50 32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70 67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21 24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72 21 36 23 09 75 00 76 44 20 45 35 14 00 61 33 97 34 31 33 95 78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92 16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57 86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58 19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40 04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66 88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69 04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36 20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16 20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54 01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48 The product of these numbers is 26 * 63 * 78 * 14 = 1788696. What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid? :return: """ def get_point_value(multi_dim_arr, y_el, x_el): if 0 <= y_el < len(multi_dim_arr) and 0 <= x_el < len(multi_dim_arr[y_el]): return multi_dim_arr[y_el][x_el] return 0 result = 0 arr = [ [8, 2, 22, 97, 38, 15, 00, 40, 00, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8], [49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 00], [81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65], [52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91], [22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80], [24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50], [32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70], [67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21], [24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72], [21, 36, 23, 9, 75, 00, 76, 44, 20, 45, 35, 14, 00, 61, 33, 97, 34, 31, 33, 95], [78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 3, 80, 4, 62, 16, 14, 9, 53, 56, 92], [16, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 00, 17, 54, 24, 36, 29, 85, 57], [86, 56, 00, 48, 35, 71, 89, 7, 5, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58], [19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40], [4, 52, 8, 83, 97, 35, 99, 16, 7, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66], [88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69], [4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36], [20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16], [20, 73, 35, 29, 78, 31, 90, 0, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54], [1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48] ] d = 4 for y in range(len(arr)): for x in range(len(arr)): point1, point2, point3, point4 = 1, 1, 1, 1 for i in range(d): print("point1: " + str(point1)) print("point2: " + str(point2)) print("point3: " + str(point3)) print("point4: " + str(point4)) point1 *= get_point_value(arr, y, x + i) point2 *= get_point_value(arr, y + i, x) point3 *= get_point_value(arr, y + i, x + i) point4 *= get_point_value(arr, y + i, x - i) print("point1: " + str(point1)) print("point2: " + str(point2)) print("point3: " + str(point3)) print("point4: " + str(point4)) result = max(point1, point2, point3, point4, result) Helpers.pr(result) Helpers.pr(result) def highest_divisible_triangular_number(): """ The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... Let us list the factors of the first seven triangle numbers: 1: 1 3: 1,3 6: 1,2,3,6 10: 1,2,5,10 15: 1,3,5,15 21: 1,3,7,21 28: 1,2,4,7,14,28 We can see that 28 is the first triangle number to have over five divisors. What is the value of the first triangle number to have over five hundred divisors? :return: """ target = 500 result = 0 n = 1 while Helpers.number_of_divisors(result) < target: result += n n += 1 Helpers.pr(result) def large_sum(): """ Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. :return: """ nums = [ 37107287533902102798797998220837590246510135740250, 46376937677490009712648124896970078050417018260538, 74324986199524741059474233309513058123726617309629, 91942213363574161572522430563301811072406154908250, 23067588207539346171171980310421047513778063246676, 89261670696623633820136378418383684178734361726757, 28112879812849979408065481931592621691275889832738, 44274228917432520321923589422876796487670272189318, 47451445736001306439091167216856844588711603153276, 70386486105843025439939619828917593665686757934951, 62176457141856560629502157223196586755079324193331, 64906352462741904929101432445813822663347944758178, 92575867718337217661963751590579239728245598838407, 58203565325359399008402633568948830189458628227828, 80181199384826282014278194139940567587151170094390, 35398664372827112653829987240784473053190104293586, 86515506006295864861532075273371959191420517255829, 71693888707715466499115593487603532921714970056938, 54370070576826684624621495650076471787294438377604, 53282654108756828443191190634694037855217779295145, 36123272525000296071075082563815656710885258350721, 45876576172410976447339110607218265236877223636045, 17423706905851860660448207621209813287860733969412, 81142660418086830619328460811191061556940512689692, 51934325451728388641918047049293215058642563049483, 62467221648435076201727918039944693004732956340691, 15732444386908125794514089057706229429197107928209, 55037687525678773091862540744969844508330393682126, 18336384825330154686196124348767681297534375946515, 80386287592878490201521685554828717201219257766954, 78182833757993103614740356856449095527097864797581, 16726320100436897842553539920931837441497806860984, 48403098129077791799088218795327364475675590848030, 87086987551392711854517078544161852424320693150332, 59959406895756536782107074926966537676326235447210, 69793950679652694742597709739166693763042633987085, 41052684708299085211399427365734116182760315001271, 65378607361501080857009149939512557028198746004375, 35829035317434717326932123578154982629742552737307, 94953759765105305946966067683156574377167401875275, 88902802571733229619176668713819931811048770190271, 25267680276078003013678680992525463401061632866526, 36270218540497705585629946580636237993140746255962, 24074486908231174977792365466257246923322810917141, 91430288197103288597806669760892938638285025333403, 34413065578016127815921815005561868836468420090470, 23053081172816430487623791969842487255036638784583, 11487696932154902810424020138335124462181441773470, 63783299490636259666498587618221225225512486764533, 67720186971698544312419572409913959008952310058822, 95548255300263520781532296796249481641953868218774, 76085327132285723110424803456124867697064507995236, 37774242535411291684276865538926205024910326572967, 23701913275725675285653248258265463092207058596522, 29798860272258331913126375147341994889534765745501, 18495701454879288984856827726077713721403798879715, 38298203783031473527721580348144513491373226651381, 34829543829199918180278916522431027392251122869539, 40957953066405232632538044100059654939159879593635, 29746152185502371307642255121183693803580388584903, 41698116222072977186158236678424689157993532961922, 62467957194401269043877107275048102390895523597457, 23189706772547915061505504953922979530901129967519, 86188088225875314529584099251203829009407770775672, 11306739708304724483816533873502340845647058077308, 82959174767140363198008187129011875491310547126581, 97623331044818386269515456334926366572897563400500, 42846280183517070527831839425882145521227251250327, 55121603546981200581762165212827652751691296897789, 32238195734329339946437501907836945765883352399886, 75506164965184775180738168837861091527357929701337, 62177842752192623401942399639168044983993173312731, 32924185707147349566916674687634660915035914677504, 99518671430235219628894890102423325116913619626622, 73267460800591547471830798392868535206946944540724, 76841822524674417161514036427982273348055556214818, 97142617910342598647204516893989422179826088076852, 87783646182799346313767754307809363333018982642090, 10848802521674670883215120185883543223812876952786, 71329612474782464538636993009049310363619763878039, 62184073572399794223406235393808339651327408011116, 66627891981488087797941876876144230030984490851411, 60661826293682836764744779239180335110989069790714, 85786944089552990653640447425576083659976645795096, 66024396409905389607120198219976047599490197230297, 64913982680032973156037120041377903785566085089252, 16730939319872750275468906903707539413042652315011, 94809377245048795150954100921645863754710598436791, 78639167021187492431995700641917969777599028300699, 15368713711936614952811305876380278410754449733078, 40789923115535562561142322423255033685442488917353, 44889911501440648020369068063960672322193204149535, 41503128880339536053299340368006977710650566631954, 81234880673210146739058568557934581403627822703280, 82616570773948327592232845941706525094512325230608, 22918802058777319719839450180888072429661980811197, 77158542502016545090413245809786882778948721859617, 72107838435069186155435662884062257473692284509516, 20849603980134001723930671666823555245252804609722, 53503534226472524250874054075591789781264330331690 ] num_sum = 0 for i in nums: num_sum += i result = str(num_sum)[:10] Helpers.pr(result) def longest_collatz_sequence(): """ The following iterative sequence is defined for the set of positive integers: n → n/2 (n is even) n → 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1 It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at 1. Which starting number, under one million, produces the longest chain? NOTE: Once the chain starts the terms are allowed to go above one million. :return: """ start = time() result = 0 top = 1000000 longest = 0 for i in range(1, top): chain = 0 n = i while n != 1: if n % 2 == 0: n = n / 2 else: n = n * 3 + 1 chain += 1 if chain > longest: longest = chain result = i end = time() print("longest is: " + str(longest)) Helpers.pr(result) print("processing time: " + str(end - start)) def lattice_paths(): """ Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner. How many such routes are there through a 20×20 grid? :return: """ # 1 * 1 grid has 2 options # 2 * 2 grid has 6 options # 2 options for first grid, plus 2 * 2 options for second grid = 6 result = 1 grid_size = 20 for i in range(1, grid_size + 1): result = result * (grid_size + i) / i Helpers.pr(result) def power_digit_sum(): """ 2**15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2**1000? :return: """ s = datetime.utcnow() result = 0 n = 2**1000 for i in str(n): result += int(i) e = datetime.utcnow() print("time: " + str(e - s)) return Helpers.pr(result) def number_letter_counts(): """ If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out numbers is in compliance with British usage. :return: """ def below_one_hundred(n): if n < 20: return uniques[n] return tenths[n / 10] + uniques[n % 10] result = 0 uniques = [ 0, len("one"), len("two"), len("three"), len("four"), len("five"), len("six"), len("seven"), len("eight"), len("nine"), len("ten"), len("eleven"), len("twelve"), len("thirteen"), len("fourteen"), len("fifteen"), len("sixteen"), len("seventeen"), len("eighteen"), len("nineteen"), ] tenths = [ 0, 0, len("twenty"), len("thirty"), len("forty"), len("fifty"), len("sixty"), len("seventy"), len("eighty"), len("ninety"), ] top = 1000 hundred = len("hundred") thousand = len("thousand") for i in range(top + 1): if i < 100: result += below_one_hundred(i) continue h = int(math.floor(i / 100) % 10) t = int(math.floor(i / 1000)) s = i % 100 if i > 999: result += below_one_hundred(t) + thousand if h != 0: result += uniques[h] + hundred if s != 0: result += below_one_hundred(s) + len("and") Helpers.pr(result) def maximum_path_sum_1(): """ By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. 3 7 4 2 4 6 8 5 9 3 That is, 3 + 7 + 4 + 9 = 23. Find the maximum total from top to bottom of the triangle below: 75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 40 80 70 33 41 48 72 33 47 32 37 16 94 29 53 71 44 65 25 43 91 52 97 51 14 70 11 33 28 77 73 17 78 39 68 17 57 91 71 52 38 17 14 91 43 58 50 27 29 48 63 66 04 68 89 53 67 30 73 16 69 87 40 31 04 62 98 27 23 09 70 98 73 93 38 53 60 04 23 NOTE: As there are only 16384 routes, it is possible to solve this problem by trying every route. However, Problem 67, is the same challenge with a triangle containing one-hundred rows; it cannot be solved by brute force, and requires a clever method! ;o) :return: """ triangle = [ [75], [95, 64], [17, 47, 82], [18, 35, 87, 10], [20, 4, 82, 47, 65], [19, 1, 23, 75, 3, 34], [88, 2, 77, 73, 7, 63, 67], [99, 65, 4, 28, 6, 16, 70, 92], [41, 41, 26, 56, 83, 40, 80, 70, 33], [41, 48, 72, 33, 47, 32, 37, 16, 94, 29], [53, 71, 44, 65, 25, 43, 91, 52, 97, 51, 14], [70, 11, 33, 28, 77, 73, 17, 78, 39, 68, 17, 57], [91, 71, 52, 38, 17, 14, 91, 43, 58, 50, 27, 29, 48], [63, 66, 4, 68, 89, 53, 67, 30, 73, 16, 69, 87, 40, 31], [4, 62, 98, 27, 23, 9, 70, 98, 73, 93, 38, 53, 60, 4, 23] ] # triangle2 = [ # [3], # [7, 4], # [2, 4, 6], # [8, 5, 9, 3] # ] for i in range(len(triangle) - 2, -1, -1): for j in range(i + 1): triangle[i][j] += max(triangle[i+1][j], triangle[i+1][j+1]) result = triangle[0][0] Helpers.pr(result) def counting_sundays(): """ You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine. And on leap years, twenty-nine. A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400. How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)? :return: """ weekdays = { 0: "MONDAY", 1: "TUESDAY", 2: "WEDNESDAY", 3: "THURSDAY", 4: "FRIDAY", 5: "SATURDAY", 6: "SUNDAY" } result = 0 start = datetime(year=1901, month=1, day=1) end = datetime(year=2000, month=12, day=31) while start <= end: if start.day == 1 and weekdays.get(start.date().weekday()) == weekdays[6]: result += 1 start = start + timedelta(days=1) print("weekday is: " + str(start.date().weekday())) print("day is: " + str(start.date().day)) print("day of week is: " + weekdays.get(start.date().weekday())) Helpers.pr(result) if __name__ == '__main__': # even_fib_numbers() # largest_prime_factor() # largest_palindrome_product() # smallest_multiple() # sum_square_difference() # ten_thousand_first_prime() # largest_product_in_series() # special_pythagorean_triplet() # summation_of_primes() # largest_product_in_a_grid() # highest_divisible_triangular_number() # large_sum() # longest_collatz_sequence() # lattice_paths() # power_digit_sum() # number_letter_counts() # maximum_path_sum_1() counting_sundays()
31.323486
1,007
0.712817
2,965
21,206
5.047218
0.192243
0.00842
0.004811
0.00735
0.178416
0.148814
0.143602
0.132309
0.11841
0.113598
0
0.495362
0.186551
21,206
676
1,008
31.369822
0.371304
0.269169
0
0.110855
0
0
0.03346
0.001899
0
1
0
0
0
1
0.046189
false
0
0.009238
0
0.066975
0.066975
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
4
d48d70d08aa9b6b4c2d31146570aa8459d4757cc
99
py
Python
models3cw/models3cwapp/apps.py
cs-fullstack-2019-spring/django-models3-cw-gkg901
13f5c8b463cd66811c91ff11b7128f130a7b31be
[ "Apache-2.0" ]
null
null
null
models3cw/models3cwapp/apps.py
cs-fullstack-2019-spring/django-models3-cw-gkg901
13f5c8b463cd66811c91ff11b7128f130a7b31be
[ "Apache-2.0" ]
null
null
null
models3cw/models3cwapp/apps.py
cs-fullstack-2019-spring/django-models3-cw-gkg901
13f5c8b463cd66811c91ff11b7128f130a7b31be
[ "Apache-2.0" ]
null
null
null
from django.apps import AppConfig class Models3CwappConfig(AppConfig): name = 'models3cwapp'
16.5
36
0.777778
10
99
7.7
0.9
0
0
0
0
0
0
0
0
0
0
0.02381
0.151515
99
5
37
19.8
0.892857
0
0
0
0
0
0.121212
0
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
1
0
1
0
0
4
d495f6759b17bcdc594ecc38ce968b3d01cf4c41
341
py
Python
ex109.py
raphael-abrantes/exercises-python
71f1e7cba2f56173c256d43e4fe33a43722b4484
[ "MIT" ]
null
null
null
ex109.py
raphael-abrantes/exercises-python
71f1e7cba2f56173c256d43e4fe33a43722b4484
[ "MIT" ]
null
null
null
ex109.py
raphael-abrantes/exercises-python
71f1e7cba2f56173c256d43e4fe33a43722b4484
[ "MIT" ]
null
null
null
from utilsPy.utilspackage import moeda p = float(input('Digite o preço: R$')) print(f'A metade de {p} é: {moeda.metade(p, True)}') print(f'O dobro de {p} é: {moeda.dobro(p, True)}') print(f'Com um aumento de 10% o valor fica: {moeda.aumentar(p, 10, True)}') print(f'Com uma redução de 5% o valor fica: {moeda.diminuir(p, 5, True)}')
42.625
76
0.659824
64
341
3.515625
0.484375
0.106667
0.133333
0.08
0
0
0
0
0
0
0
0.020906
0.158358
341
7
77
48.714286
0.763066
0
0
0
0
0.333333
0.685629
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
0.666667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
d49aa98d4f1f69928563790507f5cf8b6a18b36d
16,098
py
Python
tests/matcher/test_pattern.py
KarrLab/nucleopatterns
1bf9c34bf791d097f8ce76c8b71054b3031cdab2
[ "MIT" ]
null
null
null
tests/matcher/test_pattern.py
KarrLab/nucleopatterns
1bf9c34bf791d097f8ce76c8b71054b3031cdab2
[ "MIT" ]
null
null
null
tests/matcher/test_pattern.py
KarrLab/nucleopatterns
1bf9c34bf791d097f8ce76c8b71054b3031cdab2
[ "MIT" ]
null
null
null
from wc_rules.schema.entity import Entity from wc_rules.schema.attributes import BooleanAttribute, IntegerAttribute, StringAttribute, computation from wc_rules.modeling.pattern import Pattern, GraphContainer, Observable from wc_rules.matcher.core import build_rete_net_class from wc_rules.matcher.token import * from wc_rules.graph.examples import X,Y import unittest class BigAttributeClass(Entity): x = BooleanAttribute() y = BooleanAttribute() n1 = IntegerAttribute() n2 = IntegerAttribute() s1 = StringAttribute() s2 = StringAttribute() @computation def some_function(s1,s2,k=True): return ('A' in s1 or 'A' in s2) and k ReteNet = build_rete_net_class() def get_lengths(*nodes): return [len(node.state.cache) for node in nodes] class TestRetePatternInitialization(unittest.TestCase): # test the pattern, its incoming channel def test_pattern_alias(self): # an alias pattern is a pattern that is a pure graph # no expressions or attribute checks rn = ReteNet().initialize_start() px = Pattern(parent=GraphContainer([X('x')])) rn.initialize_pattern(px) rn_px = rn.get_node(core=px) channel = rn.get_channel(target=px) rn_parent = rn.get_node(core=channel.source) self.assertEqual(rn_px.core,px) self.assertEqual(rn_px.state.cache.target,rn_parent.state.cache) self.assertEqual(rn_px.state.cache.mapping,{'x':'a'}) self.assertEqual(channel.data.transformer.datamap,{'a':'x'}) actions = {'AddEntry':'AddEntry','RemoveEntry':'RemoveEntry'} self.assertEqual(channel.data.transformer.actionmap,actions) def test_pattern_double_alias(self): rn = ReteNet().initialize_start() start = rn.get_node(type='start') px = Pattern(parent=GraphContainer([X('x')])) pxx = Pattern(parent=px) rn.initialize_pattern(pxx) rn_px, rn_pxx = [rn.get_node(core=x) for x in [px,pxx]] self.assertTrue(rn_px is not None) self.assertTrue(rn_pxx is not None) self.assertTrue(rn_pxx.state.cache.target is rn_px.state.cache.target) def test_pattern_edge_attribute(self): # no helpers rn = ReteNet().initialize_start() start = rn.get_node(type='start') py = Pattern( parent=GraphContainer([Y('y')]), constraints=['len(y.x)==0'] ) rn.initialize_pattern(py) rn_py = rn.get_node(core=py) rn_parent = rn.get_node(type='canonical_label') self.assertTrue(rn_py is not None) self.assertTrue(rn_py.data.executables is not None) self.assertEqual(rn_py.data.executables.execs[0].code,'len(y.x) == 0') self.assertTrue(rn_py.data.caches is not None) self.assertEqual(rn_py.data.caches['parent'].target,rn_parent.state.cache) ch = rn.get_channel(source=Y,target=py,type='transform') self.assertTrue(ch is not None) self.assertEqual(ch.data.transformer.datamap,{'ref':'y'}) self.assertEqual(ch.data.transformer.actionmap,{'SetAttr':'VerifyEntry'}) self.assertTrue(ch.data.filter_data({'attr':'x'})) self.assertTrue(ch.data.filter_data({'attr':'boo'}) == False) def test_pattern_literal_attrs(self): p = Pattern( parent = GraphContainer([BigAttributeClass('elem')]), constraints = [ 'any(elem.x,elem.y)==True', 'elem.n1 + elem.n2 < 4', 'elem.some_function(k=True)==True' ] ) rn = ReteNet().initialize_start() start = rn.get_node(type='start') rn.initialize_pattern(p) rn_p = rn.get_node(core=p) # make sure there are 6 transform channels on rn_p # that originate from a class node # they correspond to attribute checks # the channels differ only in their filter_data method channels = [ch for ch in rn.get_channels(target=p) if isinstance(ch.source,type)] self.assertEqual(len(channels),6) attrs = [attr for ch in channels for attr in ch.data.filter_data.keywords.values()] self.assertEqual(attrs,sorted('x y n1 n2 s1 s2'.split())) def test_pattern_assigned_variables(self): p = Pattern( parent = GraphContainer([BigAttributeClass('elem')]), constraints = ['n = elem.n1 + elem.n2'] ) p1 = Pattern(parent=p,constraints=['n > 2']) rn = ReteNet().initialize_start() start = rn.get_node(type='start') rn.initialize_pattern(p1) p_node = rn.get_node(core=p) p1_node = rn.get_node(core=p1) self.assertEqual(p_node.state.cache.fields,['elem','n']) self.assertEqual(p1_node.state.cache.fields,['elem','n']) def test_pattern_helpers(self): ReteNet = build_rete_net_class() net = ReteNet().initialize_start() p = Pattern(GraphContainer([BigAttributeClass('elem',x=True,y=True)])) q = Pattern(GraphContainer([BigAttributeClass('elem',n1=0,n2=0)])) r = Pattern( parent = GraphContainer([BigAttributeClass('elem')]), helpers = {'p':p,'q':q}, constraints = ['p.contains(elem=elem) == True', 'q.contains(elem=elem)==True'] ) net.initialize_pattern(r) p_rn, q_rn, r_rn = [net.get_node(core=x) for x in [p,q,r]] self.assertEqual(r_rn.data.caches['p'],p_rn.state.cache) self.assertEqual(r_rn.data.caches['q'],q_rn.state.cache) pr, qr = [net.get_channel(source=x,target=y) for x,y in [(p,r),(q,r)]] self.assertEqual(pr.data.transformer.datamap,{'elem':'elem'}) self.assertEqual(qr.data.transformer.datamap,{'elem':'elem'}) def test_observable(self): ReteNet = build_rete_net_class() net = ReteNet().initialize_start().initialize_end() p = Pattern(GraphContainer([BigAttributeClass('elem',x=True,y=True)])) q = Observable(name='obsTrue',helpers={'p':p},expression='p.count()') net.initialize_observable('obsTrue',q) q_rn = net.get_node(core='obsTrue') self.assertTrue(q_rn is not None) self.assertTrue(net.get_node(core=p) is not None) ch = net.get_channel(source=p,target='obsTrue') self.assertTrue(ch is not None) self.assertEqual(ch.type,'variable_update') self.assertEqual(q_rn.state.cache.value,0) ch = net.get_channel(source='obsTrue',target='end') self.assertTrue(ch is not None) class TestRetePatternBehavior(unittest.TestCase): # test insert/remove/filter def test_pattern_alias(self): rn = ReteNet().initialize_start() start = rn.get_node(type='start') px = Pattern(parent=GraphContainer([X('x')])) rn.initialize_pattern(px) rn_px = rn.get_node(core=px) self.assertEqual(len(rn_px.state.cache.target),0) x1 = X('x1') token = make_node_token(X,x1,'AddNode') start.state.incoming.append(token) rn.sync(start) self.assertEqual(len(rn_px.state.cache.target),1) self.assertEqual(rn_px.state.cache.filter(),[{'x':x1}]) self.assertEqual(rn_px.state.cache.filter({'x':x1}),[{'x':x1}]) token = make_node_token(X,x1,'RemoveNode') start.state.incoming.append(token) rn.sync(start) self.assertEqual(len(rn_px.state.cache.target),0) def test_pattern_double_alias(self): rn = ReteNet().initialize_start() start = rn.get_node(type='start') px = Pattern(parent=GraphContainer([X('x')])) pxx = Pattern(parent=px) rn.initialize_pattern(pxx) rn_px, rn_pxx = [rn.get_node(core=x) for x in [px,pxx]] self.assertEqual(rn_pxx.state.cache.filter(),[]) x1 = X('x1') token = make_node_token(X,x1,'AddNode') start.state.incoming.append(token) rn.sync(start) self.assertEqual(rn_pxx.state.cache.filter(),[{'x':x1}]) token = make_node_token(X,x1,'RemoveNode') start.state.incoming.append(token) rn.sync(start) self.assertEqual(rn_pxx.state.cache.filter(),[]) def test_pattern_edge_attribute(self): rn = ReteNet().initialize_start() start = rn.get_node(type='start') py = Pattern( parent=GraphContainer([Y('y')]), constraints=['len(y.x)==0'] ) rn.initialize_pattern(py) rn_py = rn.get_node(core=py) self.assertEqual(rn_py.state.cache.filter(),[]) x1,y1 = X('x1'), Y('y1') token = make_node_token(Y,y1,'AddNode') start.state.incoming.append(token) rn.sync(start) self.assertEqual(rn_py.state.cache.filter(),[{'y':y1}]) y1.x = x1 token = make_attr_token(Y,y1,'x','SetAttr') start.state.incoming.append(token) rn.sync(start) self.assertEqual(rn_py.state.cache.filter(),[]) y1.x = None token = make_attr_token(Y,y1,'x','SetAttr') start.state.incoming.append(token) rn.sync(start) self.assertEqual(rn_py.state.cache.filter(),[{'y':y1}]) token = make_node_token(Y,y1,'RemoveNode') start.state.incoming.append(token) rn.sync(start) self.assertEqual(rn_py.state.cache.filter(),[]) def test_pattern_literal_attrs(self): p = Pattern( parent = GraphContainer([BigAttributeClass('elem')]), constraints = [ 'any(elem.x,elem.y)==True', 'elem.n1 + elem.n2 < 4', 'elem.some_function(k=True)==True' ] ) rn = ReteNet().initialize_start() start = rn.get_node(type='start') rn.initialize_pattern(p) rn_p = rn.get_node(core=p) self.assertEqual(len(rn_p.state.cache),0) elem1 = BigAttributeClass('elem1',x=True,y=False,n1=1,n2=2,s1='ABC',s2='DEF') token = make_node_token(BigAttributeClass,elem1,'AddNode') start.state.incoming.append(token) rn.sync(start) self.assertEqual(len(rn_p.state.cache),1) elem1.x = False token = make_attr_token(BigAttributeClass,elem1,'x','SetAttr') start.state.incoming.append(token) rn.sync(start) self.assertEqual(len(rn_p.state.cache),0) elem1.y = True token = make_attr_token(BigAttributeClass,elem1,'y','SetAttr') start.state.incoming.append(token) rn.sync(start) self.assertEqual(len(rn_p.state.cache),1) elem1.n1 = 2 token = make_attr_token(BigAttributeClass,elem1,'n1','SetAttr') start.state.incoming.append(token) rn.sync(start) self.assertEqual(len(rn_p.state.cache),0) elem1.n2 = 1 token = make_attr_token(BigAttributeClass,elem1,'n2','SetAttr') start.state.incoming.append(token) rn.sync(start) self.assertEqual(len(rn_p.state.cache),1) elem1.s1 = 'DEF' token = make_attr_token(BigAttributeClass,elem1,'s1','SetAttr') start.state.incoming.append(token) rn.sync(start) self.assertEqual(len(rn_p.state.cache),0) elem1.s2 = 'ABC' token = make_attr_token(BigAttributeClass,elem1,'s2','SetAttr') start.state.incoming.append(token) rn.sync(start) self.assertEqual(len(rn_p.state.cache),1) def test_pattern_assigned_variables(self): p = Pattern( parent = GraphContainer([BigAttributeClass('elem')]), constraints = ['n = elem.n1 + elem.n2'] ) p1 = Pattern(parent=p,constraints=['n > 2']) rn = ReteNet().initialize_start() start = rn.get_node(type='start') rn.initialize_pattern(p1) p_node = rn.get_node(core=p) p1_node = rn.get_node(core=p1) elem1 = BigAttributeClass('elem1',x=True,y=False,n1=1,n2=2,s1='ABC',s2='DEF') token = make_node_token(BigAttributeClass,elem1,'AddNode') start.state.incoming.append(token) rn.sync(start) self.assertEqual(p_node.state.cache.filter(),[{'elem':elem1,'n':3}]) self.assertEqual(p1_node.state.cache.filter(),[{'elem':elem1,'n':3}]) elem1.n1 = 0 token = make_attr_token(BigAttributeClass,elem1,'n1','SetAttr') start.state.incoming.append(token) rn.sync(start) self.assertEqual(p_node.state.cache.filter(),[{'elem':elem1,'n':2}]) self.assertEqual(p1_node.state.cache.filter(),[]) def test_pattern_helpers(self): ReteNet = build_rete_net_class() net = ReteNet().initialize_start() p = Pattern(GraphContainer([BigAttributeClass('elem',x=True,y=True)])) q = Pattern(GraphContainer([BigAttributeClass('elem',n1=0,n2=0)])) r = Pattern( parent = GraphContainer([BigAttributeClass('elem')]), helpers = {'p':p,'q':q}, constraints = ['p.contains(elem=elem) == True', 'q.contains(elem=elem)==True'] ) net.initialize_pattern(r) start = net.get_node(type='start') p_rn, q_rn, r_rn = [net.get_node(core=x) for x in [p,q,r]] self.assertEqual(get_lengths(p_rn,q_rn,r_rn),[0,0,0]) # first add elem1 which should map with q but not p elem1 = BigAttributeClass('elem1',x=False,y=False,n1=0,n2=0,s1='',s2='') token = make_node_token(BigAttributeClass,elem1,'AddNode') start.state.incoming.append(token) net.sync(start) self.assertEqual(get_lengths(p_rn,q_rn,r_rn),[0,1,0]) self.assertEqual(q_rn.state.cache.filter()[0],{'elem':elem1}) # then add elem2 which should map with p but not q elem2 = BigAttributeClass('elem2',x=True,y=True,n1=1,n2=1,s1='',s2='') token = make_node_token(BigAttributeClass,elem2,'AddNode') start.state.incoming.append(token) net.sync(start) self.assertEqual(get_lengths(p_rn,q_rn,r_rn),[1,1,0]) self.assertEqual(p_rn.state.cache.filter()[0],{'elem':elem2}) # change attributes of elem1 so it maps to both p and q, ergo r elem1.x = True token = make_attr_token(BigAttributeClass,elem1,'x','SetAttr') start.state.incoming.append(token) net.sync(start) self.assertEqual(get_lengths(p_rn,q_rn,r_rn),[1,1,0]) elem1.y = True token = make_attr_token(BigAttributeClass,elem1,'y','SetAttr') start.state.incoming.append(token) net.sync(start) self.assertEqual(get_lengths(p_rn,q_rn,r_rn),[2,1,1]) self.assertEqual(r_rn.state.cache.filter(),[{'elem':elem1}]) # change attributes of elem2 so it maps to both p and q, ergo r elem2.n1 = 0 token = make_attr_token(BigAttributeClass,elem2,'n1','SetAttr') start.state.incoming.append(token) net.sync(start) self.assertEqual(get_lengths(p_rn,q_rn,r_rn),[2,1,1]) elem2.n2 = 0 token = make_attr_token(BigAttributeClass,elem2,'n2','SetAttr') start.state.incoming.append(token) net.sync(start) self.assertEqual(get_lengths(p_rn,q_rn,r_rn),[2,2,2]) self.assertEqual(r_rn.state.cache.filter(),[{'elem':elem1},{'elem':elem2}]) # change attribute of elem1 so it maps to p but not q elem1.n1 = 1 token = make_attr_token(BigAttributeClass,elem1,'n1','SetAttr') start.state.incoming.append(token) net.sync(start) self.assertEqual(get_lengths(p_rn,q_rn,r_rn),[2,1,1]) self.assertEqual(r_rn.state.cache.filter(),[{'elem':elem2}]) self.assertEqual(p_rn.state.cache.filter(),[{'elem':elem2},{'elem':elem1}]) self.assertEqual(q_rn.state.cache.filter(),[{'elem':elem2}]) # change attribute of elem2 so it maps to q but not p elem2.x = False token = make_attr_token(BigAttributeClass,elem2,'x','SetAttr') start.state.incoming.append(token) net.sync(start) self.assertEqual(get_lengths(p_rn,q_rn,r_rn),[1,1,0]) self.assertEqual(p_rn.state.cache.filter(),[{'elem':elem1}]) self.assertEqual(q_rn.state.cache.filter(),[{'elem':elem2}]) # we went from p:[elem2], q:[elem1], r:[] # to p:[elem1,elem2], q:[elem1,elem2], r:[elem1,elem2] # to p:[elem1], q:[elem2], r:[] def test_observable(self): ReteNet = build_rete_net_class() net = ReteNet().initialize_start().initialize_end() start = net.get_node(type='start') p = Pattern(GraphContainer([BigAttributeClass('elem',x=True,y=True)])) q = Observable(name='obsTrue',helpers={'p':p},expression='p.count()') net.initialize_observable('obsTrue',q) q_rn = net.get_node(core='obsTrue') self.assertEqual(q_rn.state.cache.value,0) elem1 = BigAttributeClass('elem1',x=True,y=True,n1=0,n2=0,s1='',s2='') token = make_node_token(BigAttributeClass,elem1,'AddNode') start.state.incoming.append(token) net.sync(start) self.assertEqual(q_rn.state.cache.value,1) elem2 = BigAttributeClass('elem2',x=True,y=False,n1=1,n2=0,s1='',s2='') token = make_node_token(BigAttributeClass,elem2,'AddNode') start.state.incoming.append(token) net.sync(start) self.assertEqual(q_rn.state.cache.value,1) elem2.y = True token = make_attr_token(BigAttributeClass,elem2,'y','SetAttr') start.state.incoming.append(token) net.sync(start) self.assertEqual(q_rn.state.cache.value,2) elem1.x = False token = make_attr_token(BigAttributeClass,elem1,'x','SetAttr') start.state.incoming.append(token) net.sync(start) self.assertEqual(q_rn.state.cache.value,1) elem2.x = False token = make_attr_token(BigAttributeClass,elem2,'x','SetAttr') start.state.incoming.append(token) net.sync(start) self.assertEqual(q_rn.state.cache.value,0) end = net.get_node(type='end') self.assertEqual(list(end.state.cache),['obsTrue']) # first add elem1 which matches q # then elem2 which does not match q # then modify elem2 so it does match q # then modify elem1 so it does not match q # then modify elem2 so it does not match q
33.191753
103
0.710523
2,456
16,098
4.527687
0.078176
0.093076
0.048561
0.064748
0.808453
0.764748
0.718795
0.669694
0.647752
0.622302
0
0.018881
0.121568
16,098
484
104
33.260331
0.767485
0.06007
0
0.683196
0
0
0.071958
0.013769
0
0
0
0
0.225895
1
0.044077
false
0
0.019284
0.00551
0.093664
0
0
0
0
null
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
d49f031ff58fc1bbf3768194de8cb925dde5da02
243
py
Python
jogoMath.py
denilsonbomjesus/jogopython-fp
07ac51220cc9c14cc5847840b9da95e47a2adac6
[ "MIT" ]
null
null
null
jogoMath.py
denilsonbomjesus/jogopython-fp
07ac51220cc9c14cc5847840b9da95e47a2adac6
[ "MIT" ]
null
null
null
jogoMath.py
denilsonbomjesus/jogopython-fp
07ac51220cc9c14cc5847840b9da95e47a2adac6
[ "MIT" ]
null
null
null
# e é uma tupla (A,B) representando os coeficientes da RETA A*x + B def solve1(A, B, x): return A*x + B # e é uma tupla (A,B,C) representando os coeficientes da PARABOLA A*x**2 + B*x + C def solve2(A, B, C, x): return A*x**2 + B*x + C
34.714286
82
0.617284
54
243
2.777778
0.351852
0.053333
0.066667
0.133333
0.24
0.24
0
0
0
0
0
0.021505
0.234568
243
7
83
34.714286
0.784946
0.600823
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0.5
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
d4b15653d81b509faf595f0ae07e203406fc423c
125
py
Python
CodeWars/7 Kyu/Check three and two.py
anubhab-code/Competitive-Programming
de28cb7d44044b9e7d8bdb475da61e37c018ac35
[ "MIT" ]
null
null
null
CodeWars/7 Kyu/Check three and two.py
anubhab-code/Competitive-Programming
de28cb7d44044b9e7d8bdb475da61e37c018ac35
[ "MIT" ]
null
null
null
CodeWars/7 Kyu/Check three and two.py
anubhab-code/Competitive-Programming
de28cb7d44044b9e7d8bdb475da61e37c018ac35
[ "MIT" ]
null
null
null
def check_three_and_two(array): ans = [array.count(i) for i in 'abc'] return True if 2 in ans and 3 in ans else False
41.666667
51
0.688
26
125
3.192308
0.730769
0.120482
0
0
0
0
0
0
0
0
0
0.020619
0.224
125
3
51
41.666667
0.835052
0
0
0
0
0
0.02381
0
0
0
0
0
0
1
0.333333
false
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
0
0
0
0
1
0
0
4
d4ee77187073749ca0dd6d20160453fc7e57d9f9
3,887
py
Python
notebooks/auto_ABReaction_vf.py
ccontrer/20-05SNBifurcationCarryover
ea525496956e0171dda6621437e3f90ab430c425
[ "MIT" ]
null
null
null
notebooks/auto_ABReaction_vf.py
ccontrer/20-05SNBifurcationCarryover
ea525496956e0171dda6621437e3f90ab430c425
[ "MIT" ]
null
null
null
notebooks/auto_ABReaction_vf.py
ccontrer/20-05SNBifurcationCarryover
ea525496956e0171dda6621437e3f90ab430c425
[ "MIT" ]
null
null
null
# This file was automatically generated by SWIG (http://www.swig.org). # Version 4.0.1 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info if _swig_python_version_info < (2, 7, 0): raise RuntimeError("Python 2.7 or later required") # Import the low-level C/C++ module if __package__ or "." in __name__: from . import _auto_ABReaction_vf else: import _auto_ABReaction_vf try: import builtins as __builtin__ except ImportError: import __builtin__ def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except __builtin__.Exception: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) def _swig_setattr_nondynamic_instance_variable(set): def set_instance_attr(self, name, value): if name == "thisown": self.this.own(value) elif name == "this": set(self, name, value) elif hasattr(self, name) and isinstance(getattr(type(self), name), property): set(self, name, value) else: raise AttributeError("You cannot add instance attributes to %s" % self) return set_instance_attr def _swig_setattr_nondynamic_class_variable(set): def set_class_attr(cls, name, value): if hasattr(cls, name) and not isinstance(getattr(cls, name), property): set(cls, name, value) else: raise AttributeError("You cannot add class attributes to %s" % cls) return set_class_attr def _swig_add_metaclass(metaclass): """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass""" def wrapper(cls): return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy()) return wrapper class _SwigNonDynamicMeta(type): """Meta class to enforce nondynamic attributes (no new attributes) for a class""" __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__) def Initialize(): return _auto_ABReaction_vf.Initialize() def SetData(ips, ilp, isw, isp, sjac, sflow, nsm, nmx, ndim, ntst, ncol, iad, epsl, epsu, epss, itmx, itnw, ds, dsmin, dsmax, npr, iid, nicp, icp, nuzr, iuz, vuz): return _auto_ABReaction_vf.SetData(ips, ilp, isw, isp, sjac, sflow, nsm, nmx, ndim, ntst, ncol, iad, epsl, epsu, epss, itmx, itnw, ds, dsmin, dsmax, npr, iid, nicp, icp, nuzr, iuz, vuz) def SetInitPoint(u, npar, ipar, par, icp, nups, ups, udotps, rldot, adaptcycle): return _auto_ABReaction_vf.SetInitPoint(u, npar, ipar, par, icp, nups, ups, udotps, rldot, adaptcycle) def Compute(): return _auto_ABReaction_vf.Compute() def ClearAll(): return _auto_ABReaction_vf.ClearAll() def getSolutionNum(): return _auto_ABReaction_vf.getSolutionNum() def getSolutionVar(A): return _auto_ABReaction_vf.getSolutionVar(A) def getSolutionPar(A): return _auto_ABReaction_vf.getSolutionPar(A) def getFloquetMultipliers(A): return _auto_ABReaction_vf.getFloquetMultipliers(A) def getJacobians(A): return _auto_ABReaction_vf.getJacobians(A) def getNumIters(A): return _auto_ABReaction_vf.getNumIters(A) def getSpecPtNum(): return _auto_ABReaction_vf.getSpecPtNum() def getSpecPtDims(i, A): return _auto_ABReaction_vf.getSpecPtDims(i, A) def getSpecPtFlags(i, A): return _auto_ABReaction_vf.getSpecPtFlags(i, A) def getSpecPt_ups(i, A): return _auto_ABReaction_vf.getSpecPt_ups(i, A) def getSpecPt_udotps(i, A): return _auto_ABReaction_vf.getSpecPt_udotps(i, A) def getSpecPt_rldot(i, A): return _auto_ABReaction_vf.getSpecPt_rldot(i, A) def getSpecPt_flow1(i, A): return _auto_ABReaction_vf.getSpecPt_flow1(i, A) def getSpecPt_flow2(i, A): return _auto_ABReaction_vf.getSpecPt_flow2(i, A)
31.601626
189
0.718292
536
3,887
4.88806
0.302239
0.112214
0.128244
0.159542
0.306107
0.23626
0.217939
0.154962
0.121374
0.121374
0
0.003768
0.180602
3,887
122
190
31.860656
0.818838
0.105737
0
0.088608
1
0
0.039907
0
0
0
0
0
0
1
0.329114
false
0
0.075949
0.253165
0.734177
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
be103681ce7b240ad63d028ea252af6954bfa82b
151
py
Python
sublime/Packages/BracketHighlighter/bh_modules/erlangcase.py
herove/dotfiles
5f08d4d6f518758b3ad0516d9e704edf251e8ff3
[ "MIT" ]
1
2018-06-23T08:07:39.000Z
2018-06-23T08:07:39.000Z
sublime/Packages/BracketHighlighter/bh_modules/erlangcase.py
herove/dotfiles
5f08d4d6f518758b3ad0516d9e704edf251e8ff3
[ "MIT" ]
null
null
null
sublime/Packages/BracketHighlighter/bh_modules/erlangcase.py
herove/dotfiles
5f08d4d6f518758b3ad0516d9e704edf251e8ff3
[ "MIT" ]
null
null
null
def validate(name, bracket, bracket_side, bfr): """ Check if bracket is lowercase """ return bfr[bracket.begin:bracket.end].islower()
21.571429
51
0.662252
19
151
5.210526
0.736842
0
0
0
0
0
0
0
0
0
0
0
0.205298
151
6
52
25.166667
0.825
0.192053
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
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
1
0
0
0
0
1
0
0
4
be2bb795484093f2819ef51a4d12db39eeb4cf24
59,290
py
Python
chainer_/chainercv2/models/model_store.py
XYAskWhy/imgclsmob
87fe1b7e35b562f6d154b31d84a495f1323de0ca
[ "MIT" ]
null
null
null
chainer_/chainercv2/models/model_store.py
XYAskWhy/imgclsmob
87fe1b7e35b562f6d154b31d84a495f1323de0ca
[ "MIT" ]
null
null
null
chainer_/chainercv2/models/model_store.py
XYAskWhy/imgclsmob
87fe1b7e35b562f6d154b31d84a495f1323de0ca
[ "MIT" ]
null
null
null
""" Model store which provides pretrained models. """ __all__ = ['get_model_file'] import os import zipfile import logging import hashlib _model_sha1 = {name: (error, checksum, repo_release_tag) for name, error, checksum, repo_release_tag in [ ('alexnet', '1610', 'd666015b6e4e82eccc5d6c47cd35282a8aede469', 'v0.0.481'), ('alexnetb', '1705', 'a22a3ab8a8fba9ab0cb729d3f4f32f4d4eaed56c', 'v0.0.485'), ('zfnet', '1675', '0205a9ab48a3d46407dd6263b1e5e003668ba3e0', 'v0.0.395'), ('zfnetb', '1456', '5808c73ebdc868de4da958a3b9b29f9646ecbfbb', 'v0.0.400'), ('vgg11', '1017', '7934dcf08eb44f0ebdb0a654733aba0c68e079cd', 'v0.0.381'), ('vgg13', '0952', 'f6af5a265c59e6ba07062bd917ef149077019338', 'v0.0.388'), ('vgg16', '0833', '5e08a9eccf74f0e89001f2bbccfc3aa2cd4b370f', 'v0.0.401'), ('vgg19', '0766', 'abf329094b917c8c73d3a584f3fd3a76eec4f8c3', 'v0.0.420'), ('bn_vgg11', '0937', '8fcdb341a39dd2b45c17d2db5304c61dc1b9227c', 'v0.0.339'), ('bn_vgg13', '0887', '1709fd1a05ff302100434574b8c10f9788c06f48', 'v0.0.353'), ('bn_vgg16', '0759', '8d6a2a82be26b8126cd8e5ead52c6ba0f2c3bdca', 'v0.0.359'), ('bn_vgg19', '0688', '5b6f413cb019374591a6f6597e4ced2ae81fb924', 'v0.0.360'), ('bn_vgg11b', '0978', '54b2345ee8b3251a1d9eba3f4b3c7e8b33d0b0ab', 'v0.0.407'), ('bn_vgg13b', '0916', 'e0110b44936aefc987f007654dca2ac150994d8e', 'v0.0.488'), ('bn_vgg16b', '0775', '037038446bcc72f2f42d042003e2e2a8cf4dc923', 'v0.0.489'), ('bn_vgg19b', '0733', '44d38dbe3b7134da21af424e743a284aadcb37bc', 'v0.0.490'), ('bninception', '0752', '44a9e12ccd43a521ea09b021214f2951725d0826', 'v0.0.405'), ('resnet10', '1255', 'bc5960a1638783d2f671823893705007f8f749b0', 'v0.0.483'), ('resnet12', '1204', '651ffc1c04d51d6268e816bef89508f44b3a8ea4', 'v0.0.485'), ('resnet14', '1093', 'adafc1c18a43d882da3af341d4a0ff36db49b924', 'v0.0.491'), ('resnetbc14b', '1036', '8c665d1b9c0ade0a6707c9586fbb00a85aaf1f7a', 'v0.0.481'), ('resnet16', '0978', 'd2b6300f4c0ac1e3272ea4a58ece9e4d34b0a58d', 'v0.0.493'), ('resnet18_wd4', '1745', '79de61deb25b02203ba3f6da4aaf74a4287fc01d', 'v0.0.262'), ('resnet18_wd2', '1285', 'ae41e11d7dec4121f88552b806918bc160fcca05', 'v0.0.263'), ('resnet18_w3d4', '1067', '4defa49f9173d881ac7c3f9595db1d176d4be122', 'v0.0.266'), ('resnet18', '0868', '6e670b225570fe0d2862cd3bc65ac72480f3cf87', 'v0.0.478'), ('resnet26', '0824', '0ae9add49746f378bed04313828cc08879f5ea13', 'v0.0.489'), ('resnetbc26b', '0755', '74cf9fe93063636e46bcae0ab00ce02e34be9ae5', 'v0.0.313'), ('resnet34', '0746', '1856e049c0f6c18c1812b51e56f7d26efde52733', 'v0.0.291'), ('resnetbc38b', '0675', '9210464e98e553bceeb4812d1d72dbeae02eb72a', 'v0.0.328'), ('resnet50', '0607', 'f4a162287a4ac0ae502d5de8701fb77bfc958fed', 'v0.0.329'), ('resnet50b', '0615', '32bc835e3844b1da62a31198047304b5dc6f799d', 'v0.0.308'), ('resnet101', '0517', '88c52266a9452ffa111e1c11adb6bb2f1d071fe8', 'v0.0.499'), ('resnet101b', '0514', '077eb1e282d5ece78d68bb329874b80b8f052e23', 'v0.0.357'), ('resnet152', '0447', '99b827c464d10138928fa680a14b86648fd378b6', 'v0.0.518'), ('resnet152b', '0430', 'c047395271a19c7a7095c032787d9b9919b24d99', 'v0.0.517'), ('preresnet10', '1402', '94e8fc28c7129095273a9e17f6f8d7cc7f88aefc', 'v0.0.249'), ('preresnet12', '1318', 'fea1c8c51c1084ff1573abbaea7df6e3aee6a7ee', 'v0.0.257'), ('preresnet14', '1224', 'f9973f4f030c379c691ae52d9fe9795595e8e7c6', 'v0.0.260'), ('preresnetbc14b', '1153', '1d37e5334d2854dab5b85235fa24c08b6942bbca', 'v0.0.315'), ('preresnet16', '1080', 'ac7a346a9f200da344a334848aaf98c984446a29', 'v0.0.261'), ('preresnet18_wd4', '1778', '1cf8aa487aa79f903ccd4779d19e3cf01326a937', 'v0.0.272'), ('preresnet18_wd2', '1312', 'fa4ce56a87f1763cc037bdf6333d906fbbc86963', 'v0.0.273'), ('preresnet18_w3d4', '1069', '25ddcd56602fa811320836d280afa2bd015d7c7f', 'v0.0.274'), ('preresnet18', '0954', '21e4811aa9c868bc4afb21ca773493322ba09e82', 'v0.0.140'), ('preresnet26', '0838', '8cbc763838f642e8ca770769b57f979745e30be3', 'v0.0.316'), ('preresnetbc26b', '0786', '4c1e6a248620c09d884ab7a00a7a9a38b9f36f13', 'v0.0.325'), ('preresnet34', '0755', 'b664c649a04a07364543a6125cf1e0286c64af6c', 'v0.0.300'), ('preresnetbc38b', '0636', '3105fbe866a6aff33a262efa904f5a2ab01881ff', 'v0.0.348'), ('preresnet50', '0624', 'a2bba5b6b4136029626fa717f661495f1e0f0de5', 'v0.0.330'), ('preresnet50b', '0634', '605b0eec9ab02677872ebe86acb200c1e7036300', 'v0.0.307'), ('preresnet101', '0534', 'b4e33e606ef4b4f323f7bcdc688ad2d265e1c6e5', 'v0.0.504'), ('preresnet101b', '0538', 'b502bf25880a9579cd22ab89341a6effcf5d48af', 'v0.0.351'), ('preresnet152', '0447', 'f62a6bc823c9439d372176c51fc648f4b24452ae', 'v0.0.510'), ('preresnet152b', '0438', '50121ca1db2920af1d6e7d7aaa1d9dbf574cd423', 'v0.0.523'), ('preresnet200b', '0446', 'f44d47e8eaf165cec579e2f76183b49f2dc828bf', 'v0.0.529'), ('preresnet269b', '0504', 'c93634683e040dbcf2bce9431fad3726a44532a8', 'v0.0.545'), ('resnext14_16x4d', '1226', '80d9a3310326debcf4f9669842fd03c56d88d504', 'v0.0.370'), ('resnext14_32x2d', '1249', '892f96a44bdd01e12eca47d478f3b8c0b3784555', 'v0.0.371'), ('resnext14_32x4d', '1115', 'fa0e7f7fd7d4a60a2876bb3c303dd1ee9fea264c', 'v0.0.327'), ('resnext26_32x2d', '0849', '58d86996a5e83efe1f49513b7ef5e7803f4830b6', 'v0.0.373'), ('resnext26_32x4d', '0719', '62ca50907121ceee5aada95eda7398dca69928cb', 'v0.0.332'), ('resnext50_32x4d', '0546', 'd1e20cc5a1c88a131033e2b1c4f4e06d28084c73', 'v0.0.498'), ('resnext101_32x4d', '0416', 'ec66f27ffcc27337c5b7d74f68cd3b0b466fb22c', 'v0.0.530'), ('resnext101_64x4d', '0438', '06bfc635568c5f87a998c512fc36c698dfcb8946', 'v0.0.544'), ('seresnet10', '1170', '2b3424cb76b192830ac243df3f5d60f2a0167e9c', 'v0.0.486'), ('seresnet12', '1176', '0095f8bd6c886fb6d84fd3a0ab2548e30e23668b', 'v0.0.544'), ('seresnet14', '1100', 'fb477b24f6e53027d67da964a41a1e412dc95604', 'v0.0.545'), ('seresnet16', '0971', 'c15d615add91439be1f4fb686aa6efaba250ab3c', 'v0.0.545'), ('seresnet18', '0923', 'b0931abe71a56c02e9c1012d34b99e469602eacc', 'v0.0.355'), ('seresnet26', '0806', '00032d5b07f7f580d6b39f433dec3133940d9418', 'v0.0.363'), ('seresnetbc26b', '0684', '884c0e6bfaa08ac9250e90716e61e0e491f27648', 'v0.0.366'), ('seresnetbc38b', '0579', '7f103cd01544f11e9cd18e9cfefb56b00d215901', 'v0.0.374'), ('seresnet50', '0559', '6c5585d5e6e3fccd3ff742f081175fa0f4c2bf9f', 'v0.0.441'), ('seresnet50b', '0530', '1ac3bf504713faa817e7cf1c5e8e37fb4368a883', 'v0.0.387'), ('seresnet101', '0441', 'c70e51906cdd617dc6fa29956ad307b2d8e47698', 'v0.0.533'), ('seresnet101b', '0463', '97cc55c354860719b9c206d6808e2ebd7a019bf9', 'v0.0.460'), ('seresnet152', '0430', '0f5f30354879e404e363917de2cf8ddfb5f7a41b', 'v0.0.538'), ('sepreresnet10', '1220', '1bdbe9ae1acc4aeb018a2257a387c53216e78cf9', 'v0.0.544'), ('sepreresnet12', '1180', 'f41eb3683101fb9a2e775b41c2a45b4d4c48b673', 'v0.0.543'), ('sepreresnet16', '0955', '904e014fafe13bf9552796492d77c97d5c5321f0', 'v0.0.543'), ('sepreresnet18', '0883', '356877c7e7be4aa4e04b86bbd7537c2c6b68a4ec', 'v0.0.543'), ('sepreresnet26', '0805', 'e7e6cc562a715c904dfdea61e116b01ca9dbfd8a', 'v0.0.543'), ('sepreresnetbc26b', '0638', 'e8393574e457106c4963f7979d91b67dc7554239', 'v0.0.399'), ('sepreresnetbc38b', '0566', '4b9ce0969cc05e5a710fed7073132ad025789091', 'v0.0.409'), ('sepreresnet50b', '0531', 'fde03b262da6696c27d1de9188b0d4f35854b92b', 'v0.0.461'), ('seresnext50_32x4d', '0435', '52a11b61d67ede6016b5169d10294bce351e3862', 'v0.0.505'), ('seresnext101_32x4d', '0445', 'fd8f34d6995be18893c99d5568fd016d1a491e25', 'v0.0.529'), ('seresnext101_64x4d', '0468', 'ae28d0b429fd96c3a102c499ed37b4cac0d0206d', 'v0.0.418'), ('senet16', '0807', 'f45aa3fffb8ea5148c53d031e50a3f93ab00ede0', 'v0.0.341'), ('senet28', '0591', '7e7bf250ab1bb4842f6dd32ceb93967a7c02239b', 'v0.0.356'), ('senet154', '0442', '9f7f0ae340671343ae7e341b1183cacc2f20124c', 'v0.0.522'), ('resnestabc14', '0633', 'a76f3b83d2ecab7ee278000f6d205ddae648e0bf', 'v0.0.493'), ('resnesta18', '0694', '4ecaf0b7ce07224b4eb1972562ec8aa39e481796', 'v0.0.489'), ('resnestabc26', '0469', '14cb6ca540ef6cb8feb35199b015e41d69fb5df6', 'v0.0.495'), ('resnesta50', '0438', '84192ed0ab36270dfc4bed570cc5e1171b4bf4b3', 'v0.0.531'), ('resnesta101', '0400', 'bd2efb4282ecce70dfb7985a2fbda9a0ee11a955', 'v0.0.465'), ('resnesta152', '0452', '70e32d11f9c62120fb1be6d2a616f90fdf4647d4', 'v0.0.540'), ('resnesta200', '0339', 'b521427b8e168879455118c21ed4d99f2d37a682', 'v0.0.465'), ('resnesta269', '0336', '933dbe64fb27a174752b77980bad3c545582c5e8', 'v0.0.465'), ('airnet50_1x64d_r2', '0528', '650960afc0ace5180fa6a2542a183f8b54ee9bfe', 'v0.0.522'), ('airnet50_1x64d_r16', '0547', '6d3d6db4c9ae6f449c3fa9d7d2787dad7e03bed1', 'v0.0.519'), ('airnext50_32x4d_r2', '0503', '2bb8e4fc574d18a8b0896c1505de7bf4551d682d', 'v0.0.521'), ('bam_resnet50', '0535', 'e2069bb5c18d2dca451688615bc0197a3387e441', 'v0.0.499'), ('cbam_resnet50', '0488', '8a05bbda852fa152cd057b4e716bdebee024eb6d', 'v0.0.537'), ('scnet50', '0535', 'f0ef9a4c4d2b3202c5f73fa3f0a129f3a5baba63', 'v0.0.493'), ('scnet101', '0464', '7b1574415a93dc6d3ad66dfd494d99cceec925a6', 'v0.0.507'), ('scneta50', '0466', 'e90cf3c5fb3dacdb2945a8cfa7fdb096fc5bafd2', 'v0.0.472'), ('regnetx002', '1038', '04ae28288f3d6ae14a0397122ab47d1d9f6bb131', 'v0.0.475'), ('regnetx004', '0855', 'ecd227780275b53cd351fe902bfa43314decc6f1', 'v0.0.479'), ('regnetx006', '0760', 'fadb78d4fd6db17e87525a4565140e60d2cfdf9d', 'v0.0.482'), ('regnetx008', '0723', '5fff64913b28a54b188443e5ca7c2f3e4ccb12be', 'v0.0.482'), ('regnetx016', '0613', '5092bfd9e5c842c3ed5bfa664af4fc93bdcbbb19', 'v0.0.486'), ('regnetx032', '0569', 'c3625268f53c5c78f6a0cd78444890abc0a3286c', 'v0.0.492'), ('regnetx040', '0471', '362a2ce3dd02702db90e37deb8cc858e26fa9674', 'v0.0.495'), ('regnetx064', '0455', '3bdbfa0d09d0d06d66d43fbd81d8191a6bc949f8', 'v0.0.535'), ('regnetx080', '0467', '3618e40bed12247e0f27027f09adecceafc514eb', 'v0.0.515'), ('regnetx120', '0519', '686990070b7bd855b5792424056acea21f16c5f1', 'v0.0.542'), ('regnetx160', '0458', '99da1e86058c2dd4c78da404eab02227955023f2', 'v0.0.532'), ('regnetx320', '0394', '22a74cbae34c199dd199df216f2b87fc1ab4884e', 'v0.0.548'), ('regnety002', '0955', '5ba3e62c853d6216aadd189c49cfa2dc0d9fd871', 'v0.0.476'), ('regnety004', '0752', 'e30b7c274003dad0f2fa5c8e16e2e34992acc3ea', 'v0.0.481'), ('regnety006', '0700', '0917e50c0cdded628c6c7a4318bf42d55e4f9960', 'v0.0.483'), ('regnety008', '0645', 'aa4c6104c38d80ead55cbab28445d5a149ddbc52', 'v0.0.483'), ('regnety016', '0571', '962bc21c498ac8022a863853a6d3b030ffa1b997', 'v0.0.486'), ('regnety032', '0411', '7097f659b5ac93d7a53d8e94bf87f05c6f16007c', 'v0.0.473'), ('regnety040', '0466', 'c84f52dfeeb8001e6456fc033090bd27768f5834', 'v0.0.494'), ('regnety064', '0446', '22d3ab05b95da9402dd8aaf08970c7fb13120b76', 'v0.0.513'), ('regnety080', '0437', 'f324b0464dc045e411606b6da836d13d5e456ce8', 'v0.0.516'), ('regnety120', '0430', 'fa03425ab8fc82a9bbbb59a4eb5173bb9f8ea7aa', 'v0.0.526'), ('regnety160', '0429', '0a034eb9e3171320f3bd41199b466c96534f14aa', 'v0.0.527'), ('regnety320', '0372', '7bc537394ea4baabb5b839b5bf63d1de24ef5007', 'v0.0.550'), ('pyramidnet101_a360', '0520', 'e37960c468df05477caaf2fec90d9a81ff675cf3', 'v0.0.507'), ('diracnet18v2', '1113', 'b85b43d13697dfbddbea6e46dea4766359fff7e5', 'v0.0.111'), ('diracnet34v2', '0948', '0245163a5c947bd6e07a743f17e6ca92c79c84da', 'v0.0.111'), ('densenet121', '0683', '4caa2458d39ef6dc467ef3d1a2921ce214b9ddda', 'v0.0.314'), ('densenet161', '0590', 'a514f930224961341c65890cb1039b02076426b8', 'v0.0.432'), ('densenet169', '0609', '99c9bddf1ae3472efad2b4775fd91b540078e1d3', 'v0.0.406'), ('densenet201', '0590', 'f50cfbb1d3cf084d107cff5d165dd5c7fc72b6b9', 'v0.0.426'), ('condensenet74_c4_g4', '0861', 'ef6077ec5348504346b3bcbaacbc308f825a9f87', 'v0.0.36'), ('condensenet74_c8_g8', '1043', '277fbfb898e0c8c7de8475184bcf5e651da10acc', 'v0.0.36'), ('peleenet', '0984', '32d512c0d0f89b8cbc413f34d6d6609712f6668c', 'v0.0.496'), ('wrn50_2', '0607', 'c597636592320ac714874bb4dbe90e4c89c3b6c9', 'v0.0.520'), ('drnc26', '0710', '16a6251b3f82de588f43e203a6845de006a10882', 'v0.0.508'), ('drnc42', '0614', '6b2099e0224e0f451a67b5d8266bd9a6535793e2', 'v0.0.556'), ('drnc58', '0517', 'a333394a13eebff2732db2277db6a0f37eba76c6', 'v0.0.559'), ('drnd22', '0747', 'e4c5cf7351f691f0afe4c7b4325fd4e3a4b47681', 'v0.0.498'), ('drnd38', '0624', '1a1a7b99703d3d8bade3ebb0f22f0ffbad33ad60', 'v0.0.552'), ('drnd54', '0500', 'b679707c999e1a6f24a63e3d96f667a941cef141', 'v0.0.554'), ('drnd105', '0584', 'c0d7657b2d3c4cf7d97ff407cd50dda5d1bd1880', 'v0.0.116'), ('dpn68', '0656', 'bf9b72e9749da4c6ee5a544639f78ac7fa85f7ce', 'v0.0.310'), ('dpn98', '0426', '2ab67669d6b82719cd23128ccdf1ef71511bea94', 'v0.0.540'), ('dpn131', '0479', 'eb5a4bc267cee898cb59c4a42639a36aa47e3220', 'v0.0.534'), ('darknet_tiny', '1746', 'b04fa46318a78e977aa5a117786968d98d325871', 'v0.0.69'), ('darknet_ref', '1671', 'b2d5721f3a5f6f05cc785d57ff7a63fe82f6325e', 'v0.0.64'), ('darknet53', '0552', '3e6f40761d22e830fe6040def741590bfb77a653', 'v0.0.501'), ('irevnet301', '0887', 'ed6e6df033e659893b9021a6381f101feff002b8', 'v0.0.251'), ('bagnet9', '2544', '346ee14310c654f3484b5ef380950557fc5a2078', 'v0.0.553'), ('bagnet17', '1523', 'ccc69ea4558cd023e9e0a8e13269ef63700b63e0', 'v0.0.558'), ('bagnet33', '1492', 'a7be162cc1572d5d32f30643ddcd2ead5834cb17', 'v0.0.255'), ('dla34', '0706', '576dd492cc7047152c1251c0b56595da6e09e0bb', 'v0.0.486'), ('dla46c', '1292', '98e3efd5e9cd50d3b403bc36b71614aad4bf69ff', 'v0.0.282'), ('dla46xc', '1228', 'c2dc61bc0ac57dc4f5b4041d3261ac3d7df521b2', 'v0.0.293'), ('dla60', '0554', '740881ca03874579a87915a60474e2844dd9aa5b', 'v0.0.494'), ('dla60x', '0554', '4d7575621aaca43cbb21184ad6a4757e45383e3c', 'v0.0.493'), ('dla60xc', '1076', '4c418399df58871201cc0487db4e72411ff53c44', 'v0.0.289'), ('dla102', '0518', 'ebbfedd74580223c69e97c7231c48e430b1f9bc6', 'v0.0.505'), ('dla102x', '0474', '39bad3b5b8c1fc55069f58c8a52328349097c8e7', 'v0.0.528'), ('dla102x2', '0425', '4ffec22510a29d1a22d0eb9666be1649b120c789', 'v0.0.542'), ('dla169', '0461', 'f47952e20e67ac6b526ae9946f673d3a5c57e4da', 'v0.0.539'), ('fishnet150', '0465', '724e74fc0471c81dd75a97c1928f46d06d10815b', 'v0.0.502'), ('espnetv2_wd2', '2094', '1fd688ad3646740f90389ac8045d89a521b0554a', 'v0.0.560'), ('espnetv2_w1', '1431', 'eab8d605b475bd3659d6834ba5140d327f57c7de', 'v0.0.238'), ('espnetv2_w5d4', '1268', 'dc69f420f422154ab7242bcd95488541491d4982', 'v0.0.238'), ('espnetv2_w3d2', '1140', '1bfaa23b08b27972064758ae869476b2a4931bd4', 'v0.0.520'), ('espnetv2_w2', '0990', 'bfb3ab7c84239ff53003865e456c2a0178c48f12', 'v0.0.238'), ('dicenet_wd5', '3064', '118c88d2f2d74a7fdf22eb4b40616d3e32379170', 'v0.0.497'), ('dicenet_wd2', '2366', '4f9b934ae1e273d113024baebb629863e32e027e', 'v0.0.497'), ('dicenet_w3d4', '1642', 'c97e91578cae2babd5ae738ec6dfae44e87186ae', 'v0.0.497'), ('dicenet_w1', '1413', 'e926dbb2c070eb0b0c92fcb05d361d427c6a32ad', 'v0.0.513'), ('dicenet_w5d4', '1255', 'f4914cf7100caf8d768c15518caba45185a03f64', 'v0.0.515'), ('dicenet_w3d2', '1144', 'a6b89c5e819e032f30a729170871a7f2c13b11d6', 'v0.0.522'), ('dicenet_w7d8', '1080', 'f2a3e6aeb1041a7d97afb3b21e1bd659cf1527c9', 'v0.0.527'), ('dicenet_w2', '1063', '224f41530a18a994311af3e8e3e0d92e3451ef4d', 'v0.0.497'), ('hrnet_w18_small_v1', '0873', '96476e4b15451b62abf443101a5152e34be552e2', 'v0.0.492'), ('hrnet_w18_small_v2', '0603', '87be573162d6f21af4c816a7b389a93ef9f7af85', 'v0.0.499'), ('hrnetv2_w18', '0504', '27b854bf5ec915e735ef9deb7b28049db3f32e14', 'v0.0.508'), ('hrnetv2_w30', '0506', '04453d82f1903ef7bae24928089eee31e96b7501', 'v0.0.525'), ('hrnetv2_w32', '0493', '9f43468d683eb07dc663025a923a100872e702e0', 'v0.0.528'), ('hrnetv2_w40', '0479', '738507ee2be69b25ed561c268c9dd2e494995a1f', 'v0.0.534'), ('hrnetv2_w44', '0490', '6e10e2b59d14d390c539c07a399c52513ca3f348', 'v0.0.541'), ('hrnetv2_w48', '0486', 'e8df81b5f3c59b8a09b4ca898c9f557ea93abfb6', 'v0.0.541'), ('hrnetv2_w64', '0479', '702c5688006ccc606cfc7deabab67a988aa7bf7e', 'v0.0.543'), ('vovnet27s', '0978', '6983e4ee743e345a1ff587522d4daa2a344d7c12', 'v0.0.551'), ('vovnet39', '0553', '6a8b67836ffb3e08fbad0b56b4ba0e5437dd9056', 'v0.0.493'), ('vovnet57', '0512', 'beb31bd5037c55a1652cf84ab4bff37775bdd515', 'v0.0.505'), ('selecsls42b', '0601', 'd89a50426a90267fcb5f23fb29f323de8eb53a20', 'v0.0.493'), ('selecsls60', '0514', '637c2506b3681efe06a39b6dccff6e274f0bb6e8', 'v0.0.496'), ('selecsls60b', '0538', 'f9f8d657c6abc03ef15c08b17149d799ba8b02ce', 'v0.0.495'), ('hardnet39ds', '0870', 'fcf92ed6c41c073e506f0e7e15ca20ce13795920', 'v0.0.485'), ('hardnet68ds', '0743', 'a6b77ed008c9a937f6a915f1b8440d4310ee982e', 'v0.0.487'), ('hardnet68', '0704', '71176051a7c9e95b6bdceb693664ecdaf9241b95', 'v0.0.557'), ('hardnet85', '0569', '5f3cb7bebb19060b3c02bbe899d98daae8c680a0', 'v0.0.495'), ('squeezenet_v1_0', '1738', '4c55a6a5c7ae14b88a7989eea5a7dc60960120ef', 'v0.0.128'), ('squeezenet_v1_1', '1740', 'b236c2047fe1d9b283ccfaabb763143a214ecc33', 'v0.0.88'), ('squeezeresnet_v1_0', '1766', '6dc69dc26e83beaa98fa77ee64d208294f7850f9', 'v0.0.178'), ('squeezeresnet_v1_1', '1787', 'f40e60512a8b66f314f4d7ffab9b18dd31715b3a', 'v0.0.70'), ('sqnxt23_w1', '1903', 'ef3d725b418277e98ed5e590e615cc13df2f001e', 'v0.0.171'), ('sqnxt23v5_w1', '1786', '8b24c6e36f00be6d1b970f3c10e2b956fe281357', 'v0.0.172'), ('sqnxt23_w3d2', '1344', 'a5c3b21eb05532cba4b35f530fea2bdaac3d6bf5', 'v0.0.210'), ('sqnxt23v5_w3d2', '1292', 'c997e27957a32f89538f23d86207a044d2dc0c93', 'v0.0.212'), ('sqnxt23_w2', '1082', 'cf7aebefd6abb1fb3fea72dc10e0ad3dd145be8b', 'v0.0.240'), ('sqnxt23v5_w2', '1043', 'e9e849cdfeba0f8b3cdfd34bc214cc6526016dc4', 'v0.0.216'), ('shufflenet_g1_wd4', '3681', '15d3e7871b85cee9283663bbbc78dfe5e1a1a1db', 'v0.0.134'), ('shufflenet_g3_wd4', '3616', '064f7f7f1dd327f43e16adf5e4864a31e16d9ad9', 'v0.0.135'), ('shufflenet_g1_wd2', '2235', '5d83cc2822fbd0669af75d93c7940aa09e78d317', 'v0.0.174'), ('shufflenet_g3_wd2', '2061', '557e4397da6cebf2dd7b70e8039100f07414437a', 'v0.0.167'), ('shufflenet_g1_w3d4', '1677', 'b5515ea9c945c92fc4272ba7daf0002314cc61de', 'v0.0.218'), ('shufflenet_g3_w3d4', '1613', '55129cb578d0d53bb962e703da0746930d092c2a', 'v0.0.219'), ('shufflenet_g1_w1', '1348', '37cc6c5f70ad982ff3fc9c92a0ae6405bb46e2c7', 'v0.0.223'), ('shufflenet_g2_w1', '1333', 'e473c62fe289cc2563cb17cfa4c8562f25fd6e49', 'v0.0.241'), ('shufflenet_g3_w1', '1326', '95df048749f08aa69e9aed33a8bd7182b4caf2df', 'v0.0.244'), ('shufflenet_g4_w1', '1308', '8ed92f35a9d69874e3c9d040785f6c71c54d976c', 'v0.0.245'), ('shufflenet_g8_w1', '1321', '2fea8945a2115c718cdb09a22a95f4e2808e098b', 'v0.0.250'), ('shufflenetv2_wd2', '2073', 'c5e5a23c300c800d55e2f45e1dcb2e12907c0eae', 'v0.0.90'), ('shufflenetv2_w1', '1298', '3830a2da0701f2b31385aceeb828101008446812', 'v0.0.133'), ('shufflenetv2_w3d2', '1014', '5f75edb160035ea6e8f2896e4c233fa2a1494af1', 'v0.0.288'), ('shufflenetv2_w2', '0899', 'a44b1d5d86f6041e8d34fb3b13563d144dc6b4c0', 'v0.0.301'), ('shufflenetv2b_wd2', '1787', '08a12021fa41000f5f6206446d34daa2eebb8d00', 'v0.0.157'), ('shufflenetv2b_w1', '1100', '21562fb22a353559c6c732e54e807766bb576dee', 'v0.0.161'), ('shufflenetv2b_w3d2', '0878', '7a5c7ed4aa440788875680b2a12531716ee02f98', 'v0.0.203'), ('shufflenetv2b_w2', '0810', '636e281ce91bf852fd20adb07f0037be8dd3d6b6', 'v0.0.242'), ('menet108_8x1_g3', '2042', '9e3ff283ac81b4f4e6d4a5b11d8d54b63f4aa2f0', 'v0.0.89'), ('menet128_8x1_g4', '1919', 'f6fd56fae09d0c528c902d1381f7cf401590d130', 'v0.0.103'), ('menet160_8x1_g8', '2042', '250fd7654d54c79477ef7cbf402e15d69ea3ea6a', 'v0.0.154'), ('menet228_12x1_g3', '1301', '39c25ca345751cac91395a602565796393fea60d', 'v0.0.131'), ('menet256_12x1_g4', '1218', '57160b09127535a3733f22af10d50fb16d5d2643', 'v0.0.152'), ('menet348_12x1_g3', '0936', 'ee7e056d0f38a68a6d6c85fe8162bee944a73121', 'v0.0.173'), ('menet352_12x1_g8', '1172', 'c256ae25591e33ce6b9e12177305eacb3dd9620c', 'v0.0.198'), ('menet456_24x1_g3', '0779', '5af355f6457347168d5b95323b6d7480360398d8', 'v0.0.237'), ('mobilenet_wd4', '2216', '09c50ab8d72049a4aa9cae4bd1502859522b9a70', 'v0.0.62'), ('mobilenet_wd2', '1337', '48d12ee398fa6dc23596f669fb202f08108a6ccc', 'v0.0.156'), ('mobilenet_w3d4', '1053', 'd7ec3192f88b7017d477fdb704ad6ad77a4c5cc1', 'v0.0.130'), ('mobilenet_w1', '0866', 'b888f817a2978cdeb00a09fd5e71c3f2a52ddd8c', 'v0.0.155'), ('mobilenetb_wd4', '2164', '65e4eeb5d97217ca029056b68410dddce46367b4', 'v0.0.481'), ('mobilenetb_wd2', '1269', 'a649a585b080f5605e66807d49f5092a2d306b99', 'v0.0.480'), ('mobilenetb_w3d4', '1019', 'a54016b221391951f530fde1d66333026142ee97', 'v0.0.481'), ('mobilenetb_w1', '0788', 'e95ffdb9154278b60b27d58900d4985d6498c89b', 'v0.0.489'), ('fdmobilenet_wd4', '3063', '55407f3a3e3370fa2951f651f14faac3bf9a9f28', 'v0.0.177'), ('fdmobilenet_wd2', '1976', '6299d44272390440be808e58059219b0d57907e4', 'v0.0.83'), ('fdmobilenet_w3d4', '1599', 'cdfc2e043017be0166cf06cb9f49e0f516aa5d15', 'v0.0.159'), ('fdmobilenet_w1', '1316', '0ed6f00cbb5095eff002882e31c006edb1c5235e', 'v0.0.162'), ('mobilenetv2_wd4', '2411', '9fc398d348226c410659464d12b0fe6b7d4506e7', 'v0.0.137'), ('mobilenetv2_wd2', '1444', 'ca0906e176f15855aa8c8d771c841c3f9cd3d454', 'v0.0.170'), ('mobilenetv2_w3d4', '1047', 'a25fd26c426b5af8c5761b9d634b508622f019cf', 'v0.0.230'), ('mobilenetv2_w1', '0866', 'efc3331e08dfc578526bbf5e161c15e50b146c63', 'v0.0.213'), ('mobilenetv2b_wd4', '2342', 'bf23c31450e60bba8f19745e23d6d4b579387cc8', 'v0.0.483'), ('mobilenetv2b_wd2', '1376', 'f68cc37dc7ac2517fc9d8a0b25d8e454012549bb', 'v0.0.486'), ('mobilenetv2b_w3d4', '1067', 'ba0caa95046fd230f974022313171c241bc841af', 'v0.0.483'), ('mobilenetv2b_w1', '0890', 'dbc98d15c71586688436c4359a5a536c75e1559b', 'v0.0.483'), ('mobilenetv3_large_w1', '0733', '20f2980c2bb0140f587a959f50ef66b9b570698d', 'v0.0.491'), ('igcv3_wd4', '2828', '25942192926a7dcdd0c57238336a8a0ef840e079', 'v0.0.142'), ('igcv3_wd2', '1704', '86246558ade35232344a4c448288ae3927143f9c', 'v0.0.132'), ('igcv3_w3d4', '1099', 'b0dbc54a5c40c7bd55ebd3cab05e39263064f4ec', 'v0.0.207'), ('igcv3_w1', '0898', '5fd85acd8a4ed75845e2ef770c25460c5f7eff95', 'v0.0.243'), ('mnasnet_b1', '0725', '2733981b74b01d4e4984a7e5060e84e5a8cfeab4', 'v0.0.493'), ('mnasnet_a1', '0705', '9ac62ab0edbb8f28d13670b0d34893353ae2bd7a', 'v0.0.486'), ('darts', '0758', '8085336b75ace69817910c822149acb67083cf95', 'v0.0.485'), ('proxylessnas_cpu', '0752', '22bd211b1fbf219f1cb28ed7a407e3949a2037ea', 'v0.0.324'), ('proxylessnas_gpu', '0723', 'b81256a146f7e0c08a5d5004332bb409576799f3', 'v0.0.333'), ('proxylessnas_mobile', '0785', '561f3416638764215dcd975b2f7e27fc34974929', 'v0.0.326'), ('proxylessnas_mobile14', '0651', '7467ce2d73d14facfc593c395fe73a6f2d7dc456', 'v0.0.331'), ('fbnet_cb', '0764', '9a8153a55f4338aa22671f090cbb20e65b19c7df', 'v0.0.486'), ('xception', '0518', 'a311fd377a845eacdec8146503a61e672d82a78c', 'v0.0.544'), ('inceptionv3', '0535', '1662fcdcc33232e91193a9e9076f9fa66266c4e8', 'v0.0.552'), ('inceptionv4', '0487', '75970908c643ff9a4cd681ab82d21fb56e3604cd', 'v0.0.543'), ('inceptionresnetv1', '0481', 'a3ddee2c2e5347b7103889cd2590204048d70d4f', 'v0.0.552'), ('inceptionresnetv2', '0472', '178ff37acc2c10d9c770bd0ae14d4aec77aff683', 'v0.0.547'), ('polynet', '0450', '6dc7028b0edc48c452f83dd38448b1242c554a5e', 'v0.0.96'), ('nasnet_4a1056', '0790', '92b4789ba1ad62d39ff7aac4ddbb21af45e84d02', 'v0.0.495'), ('nasnet_6a4032', '0422', 'd49d46631abda0ec7ac4a0076e6f8d05bf99b7d1', 'v0.0.101'), ('pnasnet5large', '0426', '3c2755dce80a29dea19b398dce514a640da2aaa3', 'v0.0.114'), ('spnasnet', '0779', '4fa174dbff90b886eee9b5f9e3f2b164ccda3707', 'v0.0.490'), ('efficientnet_b0', '0725', '8d6f17447e9fa2da26963b72cf8fd359aebba504', 'v0.0.364'), ('efficientnet_b1', '0633', '4ac377d926a55be53052c42f21678c26862a81eb', 'v0.0.376'), ('efficientnet_b0b', '0669', '366e9c540a59d954fdfd13b46f47b91231aa8700', 'v0.0.403'), ('efficientnet_b1b', '0567', '2826a68613cbecc782819f24ddd5b031bfed1586', 'v0.0.403'), ('efficientnet_b2b', '0514', '93c91747fda8ea4f20d6eacb678ba13bacb455bc', 'v0.0.403'), ('efficientnet_b3b', '0436', '82eb9d9104377ec90cfecc8e8f04a9876d3c16f9', 'v0.0.403'), ('efficientnet_b4b', '0392', '81138451fda7683c964ea52a9f2a7ea48622ef33', 'v0.0.403'), ('efficientnet_b5b', '0339', 'fb684f5dc219d9463acb5aa42b48bd920f887cd1', 'v0.0.403'), ('efficientnet_b6b', '0324', 'acaad4db1bb064f088d53b620ee682ecc328c80d', 'v0.0.403'), ('efficientnet_b7b', '0323', '031b7bd5e4c361f734eb40bba1e10a11df0a8374', 'v0.0.403'), ('efficientnet_b0c', '0644', 'e95e873de2fa5ef2fedaff2264fdd3f276a24818', 'v0.0.433'), ('efficientnet_b1c', '0557', '07796241b5ef171966c1be23d911c5604936f385', 'v0.0.433'), ('efficientnet_b2c', '0496', '5a0d33334fedd1b327cec38e78b2c6d6f410051d', 'v0.0.433'), ('efficientnet_b3c', '0440', 'ec082c3117c91028c25e47c2df1eacff1af4673d', 'v0.0.433'), ('efficientnet_b4c', '0368', 'c025d233c76831db75f7032e7b6e2450f9a4813d', 'v0.0.433'), ('efficientnet_b5c', '0311', 'e01810a9209563e4d00aaab725eccc6220662cf8', 'v0.0.433'), ('efficientnet_b6c', '0298', '72ac53f6de551166cb900b38a31582be7b467f3f', 'v0.0.433'), ('efficientnet_b7c', '0291', 'c0711f2102c5211cf4985e87bd9eec1cac2eeb62', 'v0.0.433'), ('efficientnet_b8c', '0276', 'd1c7aa153428ed631730a4510333eec7329667ed', 'v0.0.433'), ('efficientnet_edge_small_b', '0629', '4aac359125638568f1461072a97ed96cb5a8a34c', 'v0.0.434'), ('efficientnet_edge_medium_b', '0552', 'fdf98bd58abbd135f59b8630e2beaffccdbc4832', 'v0.0.434'), ('efficientnet_edge_large_b', '0489', '45f0595804415252d4496153eefd45f2ebc38fd5', 'v0.0.434'), ('mixnet_s', '0705', '4822e76db658a73a098a50b01034d3c9b9f5afdd', 'v0.0.493'), ('mixnet_m', '0634', '2638a38807457af19e82f7761d9be532b5737e36', 'v0.0.493'), ('mixnet_l', '0559', 'ff6929efd523b16c1fdd265624046c74e61fcbff', 'v0.0.500'), ('resneta10', '1161', 'c28d6ca63f9d1f6b5b68c721245ea74772b4afb7', 'v0.0.484'), ('resnetabc14b', '0957', '84e05fea22df04a711a8d60ee69bdfd676b10648', 'v0.0.477'), ('resneta18', '0805', 'f4088383363f90f2da8ef4e422d2d44dada566cf', 'v0.0.486'), ('resneta50b', '0537', '204eb60edce7da09c28bb469a7d91422b1d08c71', 'v0.0.492'), ('resneta101b', '0445', '5b214e8c82cfbbcd05e10927a2429353a343e82b', 'v0.0.532'), ('resneta152b', '0423', '515d6b62a931f56cb6973ab45b08f8a8daaf59ca', 'v0.0.524'), ('resnetd50b', '0550', '7ba88f0436b3fa598520424bb463ac985ffb0caf', 'v0.0.296'), ('resnetd101b', '0460', 'b90f971e4514345fb885de95165ddcc4e6610234', 'v0.0.296'), ('resnetd152b', '0470', '41442334cde93c9744d2a86288d11614c848503a', 'v0.0.296'), ('nin_cifar10', '0743', '045abfde63c6b73fbb1b6c6b062c9da5e2485750', 'v0.0.175'), ('nin_cifar100', '2839', '891047637c63f274d4138a430fcaf5f92f054ad4', 'v0.0.183'), ('nin_svhn', '0376', '2fbe48d0dd165c97acb93cf0edcf4b847651e3a0', 'v0.0.270'), ('resnet20_cifar10', '0597', '15145d2e00c85b5c295b6999068ce4b494febfb0', 'v0.0.163'), ('resnet20_cifar100', '2964', '6a85f07e9bda4721ee68f9b7350250b866247324', 'v0.0.180'), ('resnet20_svhn', '0343', 'b6c1dc9982e1ee04f089ca02d5a3dbe549b18c02', 'v0.0.265'), ('resnet56_cifar10', '0452', 'eb7923aa7d53e4e9951483b05c9629010fbd75a4', 'v0.0.163'), ('resnet56_cifar100', '2488', '2d641cdef73a9cdc440d7ebfb665167907a6b3bd', 'v0.0.181'), ('resnet56_svhn', '0275', 'cf18a0720e4e73e5d36832e24a36b78351f9c266', 'v0.0.265'), ('resnet110_cifar10', '0369', '27d76fce060ce5737314f491211734bd10c60308', 'v0.0.163'), ('resnet110_cifar100', '2280', 'd2ec4ff1c85095343031a0b11a671c4799ae1187', 'v0.0.190'), ('resnet110_svhn', '0245', 'f274056a4f3b187618ab826aa6e3ade028a3a4da', 'v0.0.265'), ('resnet164bn_cifar10', '0368', 'd86593667f30bfef0c0ad237f2da32601b048312', 'v0.0.179'), ('resnet164bn_cifar100', '2044', '190ab6b485404e43c41a85542e57adb051744aa0', 'v0.0.182'), ('resnet164bn_svhn', '0242', 'b4c1c66ccc47f0802058fcd469844811f214bbca', 'v0.0.267'), ('resnet272bn_cifar10', '0333', 'b7c6902a5e742b2c46c9454be5962f9a5e5a0fa5', 'v0.0.368'), ('resnet272bn_cifar100', '2007', 'fe6b27f8b18785d568719dfbaea79ae05eb0aefe', 'v0.0.368'), ('resnet272bn_svhn', '0243', '693d5c393d2823146a1bdde0f8b11bb21ccd8c12', 'v0.0.368'), ('resnet542bn_cifar10', '0343', 'b6598e7a0e5bd800b4425424b43274a96677e77b', 'v0.0.369'), ('resnet542bn_cifar100', '1932', '4f95b380a755ae548187bfa0da038565c50e1e26', 'v0.0.369'), ('resnet542bn_svhn', '0234', '7421964d2246a7b5ba7f9baf294cc3bd06329ad8', 'v0.0.369'), ('resnet1001_cifar10', '0328', '0e27556cdc97b7d0612d4518546a9b0479e030c3', 'v0.0.201'), ('resnet1001_cifar100', '1979', '6416c8d2f86debf42f1a3798e4b53fa8d94b0347', 'v0.0.254'), ('resnet1001_svhn', '0241', 'c8b23d4c50359cac2fbd837ed754cc4ea7b3b060', 'v0.0.408'), ('resnet1202_cifar10', '0353', 'd82bb4359d16e68989547f8b1153c8f23264e46c', 'v0.0.214'), ('resnet1202_cifar100', '2156', '711136021e134b4180cc49c7bb1dda2bd0d4ab49', 'v0.0.410'), ('preresnet20_cifar10', '0651', '5cf94722c7969e136e2174959fee4d7b95528f54', 'v0.0.164'), ('preresnet20_cifar100', '3022', 'e3fd9391a621da1afd77f1c09ae0c9bdda4e17aa', 'v0.0.187'), ('preresnet20_svhn', '0322', '8e56898f75a9ba2c016b1e14e880305e55a96ea7', 'v0.0.269'), ('preresnet56_cifar10', '0449', '73ea193a6f184d034a4b5b911fe6d23473eb0220', 'v0.0.164'), ('preresnet56_cifar100', '2505', 'f879fb4e9c9bc328b97ca8999575ea29343bbd79', 'v0.0.188'), ('preresnet56_svhn', '0280', 'f512407305efa862c899a56cfc86003ee9ca0e9f', 'v0.0.269'), ('preresnet110_cifar10', '0386', '544ed0f0e0b3c0da72395924e2ea381dbf381e52', 'v0.0.164'), ('preresnet110_cifar100', '2267', '4e010af04fefb74f6535a1de150f695460ec0550', 'v0.0.191'), ('preresnet110_svhn', '0279', '8dcd3ae54540a62f6a9b87332f0aa2abfc587600', 'v0.0.269'), ('preresnet164bn_cifar10', '0364', 'c0ff243801f078c6e6be72e1d3b67d88d61c4454', 'v0.0.196'), ('preresnet164bn_cifar100', '2018', '5228dfbdebf0f4699dae38a4a9b8310b08189d48', 'v0.0.192'), ('preresnet164bn_svhn', '0258', '69de71f53eee796710e11dae53f10ed276588df0', 'v0.0.269'), ('preresnet272bn_cifar10', '0325', '8f8f375dfca98fb0572b2de63ca3441888c52a88', 'v0.0.389'), ('preresnet272bn_cifar100', '1963', '52a0ebabfa75366e249e612b9556c87618acf41e', 'v0.0.389'), ('preresnet272bn_svhn', '0234', 'b2cc8842932feb8f04547d5341f00ef2a3846d8a', 'v0.0.389'), ('preresnet542bn_cifar10', '0314', '86a2b5f51c4e8064ba3093472a65e52e4d65f6be', 'v0.0.391'), ('preresnet542bn_cifar100', '1871', 'd7343a662a78d29fe14f98e7dba6d79096f43904', 'v0.0.391'), ('preresnet542bn_svhn', '0236', '67f372d8a906e75f2aa3a32396e757851fd6e1fd', 'v0.0.391'), ('preresnet1001_cifar10', '0265', '1f3028bdf7143b8f99340b1b1a0a8e029d7020a0', 'v0.0.209'), ('preresnet1001_cifar100', '1841', 'fcbddbdb462da0d77c50026878ea2cfb6a95f5d4', 'v0.0.283'), ('preresnet1202_cifar10', '0339', 'cc2bd85a97842f7a444deb78262886a264a42c25', 'v0.0.246'), ('resnext29_32x4d_cifar10', '0315', '442eca6c30448563f931174d37796c2f08c778b7', 'v0.0.169'), ('resnext29_32x4d_cifar100', '1950', 'de139852f2876a04c74c271d50f0a50ba75ece3e', 'v0.0.200'), ('resnext29_32x4d_svhn', '0280', '0a402faba812ae0b1238a6da95adc734a5a24f16', 'v0.0.275'), ('resnext29_16x64d_cifar10', '0241', 'e80d3cb5f8d32be2025fe8fb7a7369b2d004217e', 'v0.0.176'), ('resnext29_16x64d_cifar100', '1693', '762f79b3506528f817882c3a47252c2f42e9376b', 'v0.0.322'), ('resnext29_16x64d_svhn', '0268', '04ffa5396ae4a61e60a30f86cd5180611ce94772', 'v0.0.358'), ('resnext272_1x64d_cifar10', '0255', '1ca6630049e54d9d17887c0af26ab6f848d30067', 'v0.0.372'), ('resnext272_1x64d_cifar100', '1911', '9a9b397c1091c6bd5b0f4b13fb6567a99d7aa7ac', 'v0.0.372'), ('resnext272_1x64d_svhn', '0235', 'b12f9d9ce073c72c2e5509a27a5dd065a7b5d05f', 'v0.0.372'), ('resnext272_2x32d_cifar10', '0274', '94e492a4391e589e6722a91ddc8b18df4dc89ed0', 'v0.0.375'), ('resnext272_2x32d_cifar100', '1834', 'bbc0c87cad70745f2aa86241521449ab7f9fd3bf', 'v0.0.375'), ('resnext272_2x32d_svhn', '0244', 'd9432f639120985968afc9b1bdde666ceaad53c9', 'v0.0.375'), ('seresnet20_cifar10', '0601', '143eba2ad59cc9f7e539d97445eb4fe13aad1a6e', 'v0.0.362'), ('seresnet20_cifar100', '2854', '1240e42f79500ddca2e471f543ff1aa28f20af16', 'v0.0.362'), ('seresnet20_svhn', '0323', '6c611f0a860d7a0c161602bfc268ccb8563376ee', 'v0.0.362'), ('seresnet56_cifar10', '0413', '66486cdbab43e244883ca8f26aa93da2297f9468', 'v0.0.362'), ('seresnet56_cifar100', '2294', 'ab7e54434bdee090f0694d3ba96122c441b7753b', 'v0.0.362'), ('seresnet56_svhn', '0264', '0a017d76364bb219b35aa2a792291acb1554e251', 'v0.0.362'), ('seresnet110_cifar10', '0363', '9a85ff9521387e1155437e691d5ccb411b28e441', 'v0.0.362'), ('seresnet110_cifar100', '2086', '298d298ea6747ff9f9277be08838f723c239e4e3', 'v0.0.362'), ('seresnet110_svhn', '0235', '525399af7c6f717aabc6c1c024c863191a1a28d9', 'v0.0.362'), ('seresnet164bn_cifar10', '0339', '4c59e76fc3264532142b37db049d3ff422b6d5f4', 'v0.0.362'), ('seresnet164bn_cifar100', '1995', 'cdac82fd3133bfd4d8cd261016a68fe95928ea4b', 'v0.0.362'), ('seresnet164bn_svhn', '0245', '31e8d2beeeb74a444ff756cafc7f1b557009cddc', 'v0.0.362'), ('seresnet272bn_cifar10', '0339', '8081d1be9a5eb985c828b6f60e41b3d689c84659', 'v0.0.390'), ('seresnet272bn_cifar100', '1907', 'a83ac8d69535cfb394be7e790ff9683d65e2b3f9', 'v0.0.390'), ('seresnet272bn_svhn', '0238', '2b28cd779296d2afbb789cee7b73a80b4b07e4a9', 'v0.0.390'), ('seresnet542bn_cifar10', '0347', 'e67d0c059a4f5c2e97790eb50d03013430f5a2fd', 'v0.0.385'), ('seresnet542bn_cifar100', '1887', 'dac530d68dff49ec37756212d3f9b52c256448fb', 'v0.0.385'), ('seresnet542bn_svhn', '0226', '9571b88bd6ac07407a453651feb29b376609933c', 'v0.0.385'), ('sepreresnet20_cifar10', '0618', 'cbc1c4df6061046a7cf99e5739a5c5df811da420', 'v0.0.379'), ('sepreresnet20_cifar100', '2831', 'e54804186c83656f8d9705ff021fd83772a0c6eb', 'v0.0.379'), ('sepreresnet20_svhn', '0324', '04dafec1e0490ecc7001a0ca9547b60ba6314956', 'v0.0.379'), ('sepreresnet56_cifar10', '0451', '0b34942c73cd2d196aa01763fb5167cb78f2b56d', 'v0.0.379'), ('sepreresnet56_cifar100', '2305', '1138b50001119765d50eeaf10a3fca15ccf6040a', 'v0.0.379'), ('sepreresnet56_svhn', '0271', '150740af292a0c5c8a6d499dfa13b2a2c5672e60', 'v0.0.379'), ('sepreresnet110_cifar10', '0454', '4c062f46d2ec615cbfc0e07af12febcddcd16364', 'v0.0.379'), ('sepreresnet110_cifar100', '2261', 'b525d8b1568e1cad021026930f5b5283bdba8b49', 'v0.0.379'), ('sepreresnet110_svhn', '0259', 'eec4c9f3c94cad32557f0a969a8ec1d127877ab6', 'v0.0.379'), ('sepreresnet164bn_cifar10', '0373', 'e82ad7ffc78c00ad128ab4116dbd3f3eae028c19', 'v0.0.379'), ('sepreresnet164bn_cifar100', '2005', 'baf00211c3da54ddf50000629b8419da8af599d8', 'v0.0.379'), ('sepreresnet164bn_svhn', '0256', '36362d66943c89b7b7153eeaf0cfc2113369b6d5', 'v0.0.379'), ('sepreresnet272bn_cifar10', '0339', '02e141138736d647bcbdb4f0fc0d81a7bc8bef85', 'v0.0.379'), ('sepreresnet272bn_cifar100', '1913', 'd37b7af28056f42bbd11df19479cbdb0b0ac7f63', 'v0.0.379'), ('sepreresnet272bn_svhn', '0249', '44b18f81ea4ba5ec6a7ea725fc9c0798a670c161', 'v0.0.379'), ('sepreresnet542bn_cifar10', '0308', '1e726874123afc10d24cf58779347b13fdfa3b00', 'v0.0.382'), ('sepreresnet542bn_cifar100', '1945', 'aadac5fbe15f5227ff02cdf9abf3c2f27b602db4', 'v0.0.382'), ('sepreresnet542bn_svhn', '0247', 'ff5682df9a051821a4fda0a1f1fe81dbf96da479', 'v0.0.382'), ('pyramidnet110_a48_cifar10', '0372', '965fce37e26ef4e3724df869fe90283669fe9daf', 'v0.0.184'), ('pyramidnet110_a48_cifar100', '2095', 'b74f12c8d11de3ddd9fa51fe93c1903675a43a3c', 'v0.0.186'), ('pyramidnet110_a48_svhn', '0247', 'e750bd672b24bb60eca0527fd11f9866a9fc8329', 'v0.0.281'), ('pyramidnet110_a84_cifar10', '0298', '7b38a0f65de0bec2f4ceb83398fef61009a2c129', 'v0.0.185'), ('pyramidnet110_a84_cifar100', '1887', '842b3809619ec81c6e27defcad9df5c3dbc0ae55', 'v0.0.199'), ('pyramidnet110_a84_svhn', '0243', '56b06d8fd9ec043ccf5acc0b8a129bee2ef9a901', 'v0.0.392'), ('pyramidnet110_a270_cifar10', '0251', 'b3456ddd5919ef861ec607f8287bd071de0ba077', 'v0.0.194'), ('pyramidnet110_a270_cifar100', '1710', '56ae71355de25daafe34c51b91fe5b4bdab1f6ac', 'v0.0.319'), ('pyramidnet110_a270_svhn', '0238', 'fdf9f2da74bae9d4280f329554a12c9770fde52f', 'v0.0.393'), ('pyramidnet164_a270_bn_cifar10', '0242', '783e21b5856a46ee0087535776703eb7ca0c24ae', 'v0.0.264'), ('pyramidnet164_a270_bn_cifar100', '1670', '7614c56c52d9a6ca42d0446ab7b5c9a5e4eae63f', 'v0.0.312'), ('pyramidnet164_a270_bn_svhn', '0233', '6dcd188245b4c4edc8a1c751cd54211d26e2c603', 'v0.0.396'), ('pyramidnet200_a240_bn_cifar10', '0244', '89ae1856e23a67aac329df11775346e6bf8e00b7', 'v0.0.268'), ('pyramidnet200_a240_bn_cifar100', '1609', '0729db3729da20627c7e91bd1e9beff251f2b82c', 'v0.0.317'), ('pyramidnet200_a240_bn_svhn', '0232', 'b5876d02190e3e6a7dc7c0cd6e931e96151c34e9', 'v0.0.397'), ('pyramidnet236_a220_bn_cifar10', '0247', '6b9a29664f54d8ea82afc863670a79099e6f570a', 'v0.0.285'), ('pyramidnet236_a220_bn_cifar100', '1634', 'fd14728bc8ca8ccb205880d24d38740dad232d00', 'v0.0.312'), ('pyramidnet236_a220_bn_svhn', '0235', 'bb39a3c6f8ee25c32a40304ebf266a9521b513c4', 'v0.0.398'), ('pyramidnet272_a200_bn_cifar10', '0239', '533f8d89abe57656e1baef549dabedbc4dcefbe8', 'v0.0.284'), ('pyramidnet272_a200_bn_cifar100', '1619', '4ba0ea07d5f519878d33f7b3741f742ae12fef50', 'v0.0.312'), ('pyramidnet272_a200_bn_svhn', '0240', '2ace26878c803cc3a415d8f897bf9d3ec7f4d19c', 'v0.0.404'), ('densenet40_k12_cifar10', '0561', 'a37df881a11487fdde772254a82c20c3e45b461b', 'v0.0.193'), ('densenet40_k12_cifar100', '2490', 'd06839db7eec0331354ca31b421c6fbcd4665fd3', 'v0.0.195'), ('densenet40_k12_svhn', '0305', '8d563cdf9dcd1d4822669f6119f6e77b4e03c162', 'v0.0.278'), ('densenet40_k12_bc_cifar10', '0643', '234918e7144b95454e1417035c73391663a68401', 'v0.0.231'), ('densenet40_k12_bc_cifar100', '2841', '968e5667c29dd682a90c3f8a488e00a9efe0d29f', 'v0.0.232'), ('densenet40_k12_bc_svhn', '0320', '52bd79007dd8a8b60b9aef94a555161c9faf4b37', 'v0.0.279'), ('densenet40_k24_bc_cifar10', '0452', '3ec459af58cf2106bfcbdad090369a1f3d41ef3c', 'v0.0.220'), ('densenet40_k24_bc_cifar100', '2267', 'f744296d04d703c202b0b78cdb32e7fc40116584', 'v0.0.221'), ('densenet40_k24_bc_svhn', '0290', '268af51aaea47003c9ce128ddb76507dabb0726e', 'v0.0.280'), ('densenet40_k36_bc_cifar10', '0404', '6be4225a6d0e5fb68bdc9cda471207c0b5420395', 'v0.0.224'), ('densenet40_k36_bc_cifar100', '2050', '49b6695fe06d98cfac5d4fdbdb716edb268712c2', 'v0.0.225'), ('densenet40_k36_bc_svhn', '0260', '47ef4d80ef3f541b795a1aee645ff9e8bada6101', 'v0.0.311'), ('densenet100_k12_cifar10', '0366', '85031735e1c80d3a6254fe8649c5e9bae2d54315', 'v0.0.205'), ('densenet100_k12_cifar100', '1964', 'f04f59203ad863f466c25fa9bbfc18686d72a46a', 'v0.0.206'), ('densenet100_k12_svhn', '0260', 'c57bbabec45492bcc4a2587443b06bf400c6ea25', 'v0.0.311'), ('densenet100_k24_cifar10', '0313', '939ef3090b6219e5afabc97f03cc34365c729ada', 'v0.0.252'), ('densenet100_k24_cifar100', '1808', '47274dd8a35bfeb77e9a077275111e4a94d561e4', 'v0.0.318'), ('densenet100_k12_bc_cifar10', '0416', '160a064165eddf492970a99b5a8ca9689bf94fea', 'v0.0.189'), ('densenet100_k12_bc_cifar100', '2119', 'a37ebc2a083fbe8e7642988945d1092fb421f182', 'v0.0.208'), ('densenet190_k40_bc_cifar10', '0252', '57f2fa706376545c260f4848a1112cd03069a323', 'v0.0.286'), ('densenet250_k24_bc_cifar10', '0267', '03b268872cdedadc7196783664b4d6e72b00ecd2', 'v0.0.290'), ('densenet250_k24_bc_cifar100', '1739', '9100f02ada0459792e3305feddda602e3278833a', 'v0.0.303'), ('xdensenet40_2_k24_bc_cifar10', '0531', 'd3c448ab2c110f873579093ff9a69e735d80b4e7', 'v0.0.226'), ('xdensenet40_2_k24_bc_cifar100', '2396', '84357bb40bcd1da5cf6237ea5755a309bcf36d49', 'v0.0.227'), ('xdensenet40_2_k24_bc_svhn', '0287', '065f384765a1eaaba26d1d9224878658cbb9cb84', 'v0.0.306'), ('xdensenet40_2_k36_bc_cifar10', '0437', 'fb6d7431c005eb9965da0e1b2872c048d6b31b30', 'v0.0.233'), ('xdensenet40_2_k36_bc_cifar100', '2165', '9ac51e902167ba05f1c21ed1a9690c1fd4cad3eb', 'v0.0.234'), ('xdensenet40_2_k36_bc_svhn', '0274', 'bf7f7de9f9b9661385a47b5e241fdc0c54287a8c', 'v0.0.306'), ('wrn16_10_cifar10', '0293', '4ac60015e3b287580d11e605793b3426e8184137', 'v0.0.166'), ('wrn16_10_cifar100', '1895', 'd6e852788e29532c8a12bb39617a2e81aba2483f', 'v0.0.204'), ('wrn16_10_svhn', '0278', 'b87185c815b64a1290ecbb7a217447906c77da75', 'v0.0.271'), ('wrn28_10_cifar10', '0239', 'f8a24941ca542f78eda2d192f461b1bac0600d27', 'v0.0.166'), ('wrn28_10_cifar100', '1788', '603872998b7d9f0303769cb34c4cfd16d4e09258', 'v0.0.320'), ('wrn28_10_svhn', '0271', '59f255be865678bc0d3c7dcc9785022f30265d69', 'v0.0.276'), ('wrn40_8_cifar10', '0237', '3f56f24a07be7155fb143cc4360755d564e3761a', 'v0.0.166'), ('wrn40_8_cifar100', '1803', '794aca6066fb993f2a5511df45fca58d6bc546e7', 'v0.0.321'), ('wrn40_8_svhn', '0254', '8af6aad0c2034ed8a574f74391869a0d20def51b', 'v0.0.277'), ('wrn20_10_1bit_cifar10', '0326', '3288c59a265fc3531502b9c53e33322ff74dd33f', 'v0.0.302'), ('wrn20_10_1bit_cifar100', '1904', '1c6f1917c49134da366abfbd27c1d7ad61182882', 'v0.0.302'), ('wrn20_10_1bit_svhn', '0273', '4d7bfe0dfa88d593f691b39ca9d20eb3e78636ea', 'v0.0.302'), ('wrn20_10_32bit_cifar10', '0314', '90b3fc15d99009b35b1939baefa2e2290003968a', 'v0.0.302'), ('wrn20_10_32bit_cifar100', '1812', '346f276fe7e6b61cc93482fdb3d471064d1e1de3', 'v0.0.302'), ('wrn20_10_32bit_svhn', '0259', 'af3fddd1f68f373038eea1828e7ae15d21a03ef9', 'v0.0.302'), ('ror3_56_cifar10', '0543', '7ca1b24c4a573d53484ca92b19bad5c08e38fa8b', 'v0.0.228'), ('ror3_56_cifar100', '2549', 'a7903e5f5f80bf53c07e12ce34659e0d9af4b106', 'v0.0.229'), ('ror3_56_svhn', '0269', '113859bb3c23fde05fce740647a26dca69678a34', 'v0.0.287'), ('ror3_110_cifar10', '0435', 'bf021f253fc1cf29b30a1eb579c7c4693f963933', 'v0.0.235'), ('ror3_110_cifar100', '2364', '13de922a8f8758a15eaf1d283dc42e7dcf0f3fda', 'v0.0.236'), ('ror3_110_svhn', '0257', '4b8b6963fd73753104945853a65210de84c9fb4c', 'v0.0.287'), ('ror3_164_cifar10', '0393', '7ac7b44610acdb065f40b62e94d5ec5dbb49ee11', 'v0.0.294'), ('ror3_164_cifar100', '2234', 'd5a5321048d06f554a8c7688b743c32da830372b', 'v0.0.294'), ('ror3_164_svhn', '0273', '1d0a2f127a194ea923857c1d8ec732ae5fa87300', 'v0.0.294'), ('rir_cifar10', '0328', '9780c77d0ab1c63478531557ab1aff77c208ad0d', 'v0.0.292'), ('rir_cifar100', '1923', '4bfd2f239ecca391c116cbc02d2ef7e5e2a54028', 'v0.0.292'), ('rir_svhn', '0268', '5240bc967aa1fc1e9df2b31919178203dcaa582a', 'v0.0.292'), ('shakeshakeresnet20_2x16d_cifar10', '0515', 'e2f524b5196951f48495973a087135ca974ec327', 'v0.0.215'), ('shakeshakeresnet20_2x16d_cifar100', '2922', '84772a31f6f6bb3228276515a8d4371c25925c85', 'v0.0.247'), ('shakeshakeresnet20_2x16d_svhn', '0317', '261fd59fcb7cf375331ce0c402ad2030b283c17c', 'v0.0.295'), ('shakeshakeresnet26_2x32d_cifar10', '0317', '5422fce187dff99fa8f4678274a8dd1519e23e27', 'v0.0.217'), ('shakeshakeresnet26_2x32d_cifar100', '1880', '750a574e738cf53079b6965410e07fb3abef82fd', 'v0.0.222'), ('shakeshakeresnet26_2x32d_svhn', '0262', '844e1f6d067b830087b9456617159a77137138f7', 'v0.0.295'), ('diaresnet20_cifar10', '0622', '1c5f4c8adeb52090b5d1ee7330f02b96d4aac843', 'v0.0.340'), ('diaresnet20_cifar100', '2771', '350c5ed4fa58bf339b8b44f19044d75ee14917cf', 'v0.0.342'), ('diaresnet20_svhn', '0323', 'f37bac8b8843319d2934a79e62c0e7365addef2f', 'v0.0.342'), ('diaresnet56_cifar10', '0505', '4073bb0c53d239a40c6cf7ee634f32096b1d54dd', 'v0.0.340'), ('diaresnet56_cifar100', '2435', '22e777d2b708b1fc8eb79e593130fa660b51dd95', 'v0.0.342'), ('diaresnet56_svhn', '0268', '7ea0022b7eff7afd1bb53e81d579e23952f9ee7f', 'v0.0.342'), ('diaresnet110_cifar10', '0410', '5d0517456f3d535722d4f3fade53146ffd8e9f5f', 'v0.0.340'), ('diaresnet110_cifar100', '2211', '4c6aa3fe0a58d54ce04061df8440b798b73c9c4b', 'v0.0.342'), ('diaresnet110_svhn', '0247', '515ce8f3ddc01b00747b839e8b52387f231f482f', 'v0.0.342'), ('diaresnet164bn_cifar10', '0350', '27cfe80d62974bfc1d3aa52e1fd1d173d5067393', 'v0.0.340'), ('diaresnet164bn_cifar100', '1953', '18aa50ab105095688597937fcafdbae1d5518597', 'v0.0.342'), ('diaresnet164bn_svhn', '0244', '4773b5183a25ef906e176079f3cae8641a167e13', 'v0.0.342'), ('diapreresnet20_cifar10', '0642', 'bfcfd5c633e563036061d10d420ea6878f102ddb', 'v0.0.343'), ('diapreresnet20_cifar100', '2837', '936a4acca4a570be185c6338e0a76c8d8cee78a9', 'v0.0.343'), ('diapreresnet20_svhn', '0303', 'd682b80f3a2f5d126eac829dc3a55d800a6e3998', 'v0.0.343'), ('diapreresnet56_cifar10', '0483', 'd5229916f76180aa66a08d89645c1cdd1bbf4bf1', 'v0.0.343'), ('diapreresnet56_cifar100', '2505', '9867b907f721c3688bc9577e2d30e71aac14e163', 'v0.0.343'), ('diapreresnet56_svhn', '0280', '7a984a6375979ecce61576cc371ed5170a4b2cd2', 'v0.0.343'), ('diapreresnet110_cifar10', '0425', '9fab76b9a11b246b0e06386879b29196af002de5', 'v0.0.343'), ('diapreresnet110_cifar100', '2269', '0af00d413f9c7022ebec87256760b40ccb30e944', 'v0.0.343'), ('diapreresnet110_svhn', '0242', '2bab754f7a7d426eb5a1f40c3156e2c82aa145c2', 'v0.0.343'), ('diapreresnet164bn_cifar10', '0356', '7a0b124307fe307489743d8648e99239e14b764a', 'v0.0.343'), ('diapreresnet164bn_cifar100', '1999', 'a3835edf5ae8daa0383e8d13fedf3a8dc8352338', 'v0.0.343'), ('diapreresnet164bn_svhn', '0256', '30de9b3b60e03ab5c44bf7d9b571f63a9065890d', 'v0.0.343'), ('resnet10_cub', '2760', 'e8bdefb0f503d253197370a2d9d5ae772b2cb913', 'v0.0.335'), ('resnet12_cub', '2667', '22b2b21696461aa952a257014f4f0ec901375ac5', 'v0.0.336'), ('resnet14_cub', '2434', '57f6a73d2eb22d7dfc43a8ff52f25982e1b7d78b', 'v0.0.337'), ('resnet16_cub', '2321', '5e48b19f8fb8eae1afcdf04e77ae3ad9ad9c6b73', 'v0.0.338'), ('resnet18_cub', '2333', 'c32998b4b12e31b9d291770bbf3eb38490542e38', 'v0.0.344'), ('resnet26_cub', '2261', '56c8fcc12333fec68ac09c6696bb462e175be047', 'v0.0.345'), ('seresnet10_cub', '2742', 'b8e56acfe873705609c82932c321467169436531', 'v0.0.361'), ('seresnet12_cub', '2599', '9c0ee8cf33733bf5ba66eeda7394c84ed11d3d7e', 'v0.0.361'), ('seresnet14_cub', '2368', 'b58cddb7b2cc8f5c40a83912690eeff8d4d6d418', 'v0.0.361'), ('seresnet16_cub', '2318', '1d8b187c417832ac3f19806ff13f1897c7692f4f', 'v0.0.361'), ('seresnet18_cub', '2321', '7b1d02a7965a3f54606d768e0e5149148f2fb0b1', 'v0.0.361'), ('seresnet26_cub', '2254', '5cbf65d229088b3f16e396a05bde054470c14563', 'v0.0.361'), ('mobilenet_w1_cub', '2356', '02c2accf0f92fcc460cdbb6b41a581321e1fa216', 'v0.0.346'), ('proxylessnas_mobile_cub', '2190', 'a9c66b1b9623f81105b9daf8c5e45f4501e80bbe', 'v0.0.347'), ('ntsnet_cub', '1286', '4d7595248f0fb042ef06c657d73bd0a2f3fc4f0d', 'v0.0.334'), ('pspnet_resnetd101b_voc', '7626', 'f90c0db9892ec6892623a774ba21000f7cc3995f', 'v0.0.297'), ('pspnet_resnetd50b_ade20k', '2746', '7b7ce5680fdfab567222ced11a2430cf1a452116', 'v0.0.297'), ('pspnet_resnetd101b_ade20k', '3286', 'c5e619c41740751865f662b539abbad5dd9be42b', 'v0.0.297'), ('pspnet_resnetd101b_cityscapes', '5757', '2e2315d45b83479c507a4e7a47dac6a68a8e3e1c', 'v0.0.297'), ('pspnet_resnetd101b_coco', '5467', '690335581310128a1d11fcdb0eb03ce07fb5f88d', 'v0.0.297'), ('deeplabv3_resnetd101b_voc', '7566', '6a4f805fe1433898d1dc665bb10a5620816999bd', 'v0.0.298'), ('deeplabv3_resnetd152b_voc', '7806', '1c3089b5034043e4a82567ae28b085d694e5319c', 'v0.0.298'), ('deeplabv3_resnetd50b_ade20k', '3196', '00903dce3d63fd847c36617d51907cff12834d06', 'v0.0.298'), ('deeplabv3_resnetd101b_ade20k', '3517', '46828740498741a7291fd479901dfba3d3de3b11', 'v0.0.298'), ('deeplabv3_resnetd101b_coco', '5906', '2811b3cd3512c237faef59f746d984823892d9e5', 'v0.0.298'), ('deeplabv3_resnetd152b_coco', '6107', '80ddcd964c41906f4bc104cf5b087303a06aa79f', 'v0.0.298'), ('fcn8sd_resnetd101b_voc', '8040', '3568dc41c137cbe797c1baa7b5a76669faf1ceb0', 'v0.0.299'), ('fcn8sd_resnetd50b_ade20k', '3339', '1d03bc38ea64551806ddfd4185b5eb49fb9e160f', 'v0.0.299'), ('fcn8sd_resnetd101b_ade20k', '3588', 'ff385e1913bc8c05c6abe9cb19896f477b9b75a7', 'v0.0.299'), ('fcn8sd_resnetd101b_coco', '6011', '4a469997cdc3e52c1dee1a2d58578f9df54c419b', 'v0.0.299'), ('icnet_resnetd50b_cityscapes', '6078', '04f581dc985f3d2874e8530bb70e529302e9d3dd', 'v0.0.457'), ('fastscnn_cityscapes', '6595', '6dca42601bbba8134afa11674ba606231e30f035', 'v0.0.474'), ('sinet_cityscapes', '6084', 'c0a4e992f64c042ac815b87fe8d37919a693d0ad', 'v0.0.437'), ('bisenet_resnet18_celebamaskhq', '0000', 'c3bd2251b86e4fce29a3d1fb7600c6259d4d6523', 'v0.0.462'), ('danet_resnetd50b_cityscapes', '6799', 'dcef11be5a3e3984877c9d2b8644a630938eb25a', 'v0.0.468'), ('danet_resnetd101b_cityscapes', '6810', 'a6593e21091fb7d96989866381fe484de50a5d70', 'v0.0.468'), ('alphapose_fastseresnet101b_coco', '7415', 'c1aee8e0e4aaa1352d728ad5f147d77b9ebeff8d', 'v0.0.454'), ('simplepose_resnet18_coco', '6631', 'e267629f3da46f502914d84c10afb52a5ea12e3b', 'v0.0.455'), ('simplepose_resnet50b_coco', '7102', '78b005c871baaf5a77d7c8de41eac8ec01b7d942', 'v0.0.455'), ('simplepose_resnet101b_coco', '7244', '59f85623525928ba8601eefc81c781f0a48dd72e', 'v0.0.455'), ('simplepose_resnet152b_coco', '7253', '6228ce42852da4e01b85917f234bf74cc0962e8f', 'v0.0.455'), ('simplepose_resneta50b_coco', '7170', 'e45c65255002eb22c2aa39ff4ee4d7d1c902467c', 'v0.0.455'), ('simplepose_resneta101b_coco', '7297', '800500538da729d33bd7e141b3b7c80738b33c47', 'v0.0.455'), ('simplepose_resneta152b_coco', '7344', 'ac76d0a9dd51dcbe770ce3044567bc53f21d8fc4', 'v0.0.455'), ('simplepose_mobile_resnet18_coco', '6625', 'a5201083587dbc1f9e0b666285872f0ffcb23f88', 'v0.0.456'), ('simplepose_mobile_resnet50b_coco', '7110', '6d17c89b71fa02db4903ac4ba08922c1c267dcf5', 'v0.0.456'), ('simplepose_mobile_mobilenet_w1_coco', '6410', '14efcbbaf1be6e08448a89feb3161e572466de20', 'v0.0.456'), ('simplepose_mobile_mobilenetv2b_w1_coco', '6374', '73b90839e07f59decdbc11cbffff196ed148e1d9', 'v0.0.456'), ('simplepose_mobile_mobilenetv3_small_w1_coco', '5434', 'cc5169a3ac2cb3311d02bc4752abc0f799bc4492', 'v0.0.456'), ('simplepose_mobile_mobilenetv3_large_w1_coco', '6367', 'b93dbd09bdb07fd33732aaf9e782148cbb394cd3', 'v0.0.456'), ('lwopenpose2d_mobilenet_cmupan_coco', '3999', '0a2829dcb84ea39a401dbfb6b4635d68cc1e23ca', 'v0.0.458'), ('lwopenpose3d_mobilenet_cmupan_coco', '3999', 'ef1e8e130485a5df9864db59f93ddeb892c11a46', 'v0.0.458'), ('ibppose_coco', '6487', '70158be1fc226d4b3608d02273898e887edf744a', 'v0.0.459'), ('jasperdr10x5_en', 'nana', '9e212ca84c4ecd876462c289754ab71fa845c445', 'v0.0.555'), ('jasperdr10x5_en_nr', 'nana', 'cf4b9f5320ed72868104d0bfb44a6012be348a0b', 'v0.0.555'), ('quartznet5x5_en_ls', 'nana', '3651852c5a78ae2c9f2f58aa6936bc75db83a30a', 'v0.0.555'), ('quartznet15x5_en', 'nana', 'd41a53cf8fc87d229d7c464a034ab33347d05e8f', 'v0.0.555'), ('quartznet15x5_en_nr', 'nana', 'c73f88532c594801f76b7db921f1c7c3fcf08fc0', 'v0.0.555'), ('quartznet15x5_de', 'nana', '02b5f71ff83de19d97f6770566b0d57cc2ea1bb9', 'v0.0.555'), ('quartznet15x5_fr', 'nana', '62c42726412bd3b97a668632f78225351bf040ed', 'v0.0.555'), ('quartznet15x5_it', 'nana', '6712dfefb2f1cb997f467ffb7feb0ceb94f2a046', 'v0.0.555'), ('quartznet15x5_es', 'nana', '96f14570ed8f75d1b2ebb1e13e20dd28a128c99b', 'v0.0.555'), ('quartznet15x5_ca', 'nana', 'a8ba8cb3da5bda15a6a0d2fb30ced54459a0f0ff', 'v0.0.555'), ('quartznet15x5_pl', 'nana', 'a1ea93770043bd852a21a4e8c29c366268ce27d5', 'v0.0.555'), ('quartznet15x5_ru', 'nana', 'cb5585439804c94ef9d8d39a5bc483932fe4acd0', 'v0.0.555'), ('quartznet15x5_ru34', 'nana', 'b4dd1c93ecb01dd79276f3e13bec8d36c6249d02', 'v0.0.555'), ]} imgclsmob_repo_url = 'https://github.com/osmr/imgclsmob' def get_model_name_suffix_data(model_name): if model_name not in _model_sha1: raise ValueError("Pretrained model for {name} is not available.".format(name=model_name)) error, sha1_hash, repo_release_tag = _model_sha1[model_name] return error, sha1_hash, repo_release_tag def get_model_file(model_name, local_model_store_dir_path=os.path.join("~", ".chainer", "models")): """ Return location for the pretrained on local file system. This function will download from online model zoo when model cannot be found or has mismatch. The root directory will be created if it doesn't exist. Parameters: ---------- model_name : str Name of the model. local_model_store_dir_path : str, default $CHAINER_HOME/models Location for keeping the model parameters. Returns: ------- file_path Path to the requested pretrained model file. """ error, sha1_hash, repo_release_tag = get_model_name_suffix_data(model_name) short_sha1 = sha1_hash[:8] file_name = "{name}-{error}-{short_sha1}.npz".format( name=model_name, error=error, short_sha1=short_sha1) local_model_store_dir_path = os.path.expanduser(local_model_store_dir_path) file_path = os.path.join(local_model_store_dir_path, file_name) if os.path.exists(file_path): if _check_sha1(file_path, sha1_hash): return file_path else: logging.warning("Mismatch in the content of model file detected. Downloading again.") else: logging.info("Model file not found. Downloading to {}.".format(file_path)) if not os.path.exists(local_model_store_dir_path): os.makedirs(local_model_store_dir_path) zip_file_path = file_path + ".zip" _download( url="{repo_url}/releases/download/{repo_release_tag}/{file_name}.zip".format( repo_url=imgclsmob_repo_url, repo_release_tag=repo_release_tag, file_name=file_name), path=zip_file_path, overwrite=True) with zipfile.ZipFile(zip_file_path) as zf: zf.extractall(local_model_store_dir_path) os.remove(zip_file_path) if _check_sha1(file_path, sha1_hash): return file_path else: raise ValueError("Downloaded file has different hash. Please try again.") def _download(url, path=None, overwrite=False, sha1_hash=None, retries=5, verify_ssl=True): """Download an given URL Parameters: ---------- url : str URL to download path : str, optional Destination path to store downloaded file. By default stores to the current directory with same name as in url. overwrite : bool, optional Whether to overwrite destination file if already exists. sha1_hash : str, optional Expected sha1 hash in hexadecimal digits. Will ignore existing file when hash is specified but doesn't match. retries : integer, default 5 The number of times to attempt the download in case of failure or non 200 return codes verify_ssl : bool, default True Verify SSL certificates. Returns: ------- str The file path of the downloaded file. """ import warnings try: import requests except ImportError: class requests_failed_to_import(object): pass requests = requests_failed_to_import if path is None: fname = url.split("/")[-1] # Empty filenames are invalid assert fname, "Can't construct file-name from this URL. Please set the `path` option manually." else: path = os.path.expanduser(path) if os.path.isdir(path): fname = os.path.join(path, url.split("/")[-1]) else: fname = path assert retries >= 0, "Number of retries should be at least 0" if not verify_ssl: warnings.warn( "Unverified HTTPS request is being made (verify_ssl=False). " "Adding certificate verification is strongly advised.") if overwrite or not os.path.exists(fname) or (sha1_hash and not _check_sha1(fname, sha1_hash)): dirname = os.path.dirname(os.path.abspath(os.path.expanduser(fname))) if not os.path.exists(dirname): os.makedirs(dirname) while retries + 1 > 0: # Disable pyling too broad Exception # pylint: disable=W0703 try: print("Downloading {} from {}...".format(fname, url)) r = requests.get(url, stream=True, verify=verify_ssl) if r.status_code != 200: raise RuntimeError("Failed downloading url {}".format(url)) with open(fname, "wb") as f: for chunk in r.iter_content(chunk_size=1024): if chunk: # filter out keep-alive new chunks f.write(chunk) if sha1_hash and not _check_sha1(fname, sha1_hash): raise UserWarning("File {} is downloaded but the content hash does not match." " The repo may be outdated or download may be incomplete. " "If the 'repo_url' is overridden, consider switching to " "the default repo.".format(fname)) break except Exception as e: retries -= 1 if retries <= 0: raise e else: print("download failed, retrying, {} attempt{} left" .format(retries, "s" if retries > 1 else "")) return fname def _check_sha1(filename, sha1_hash): """Check whether the sha1 hash of the file content matches the expected hash. Parameters: ---------- filename : str Path to the file. sha1_hash : str Expected sha1 hash in hexadecimal digits. Returns: ------- bool Whether the file content matches the expected hash. """ sha1 = hashlib.sha1() with open(filename, "rb") as f: while True: data = f.read(1048576) if not data: break sha1.update(data) return sha1.hexdigest() == sha1_hash
76.90013
116
0.721218
4,994
59,290
8.401882
0.406688
0.041755
0.002145
0.004528
0.035296
0.0199
0.00877
0.004242
0.004242
0.002526
0
0.415615
0.111469
59,290
770
117
77
0.380858
0.026868
0
0.02029
0
0
0.708244
0.474506
0
0
0
0
0.002899
1
0.005797
false
0.001449
0.013043
0
0.027536
0.002899
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0784cb48d7e0bf8c1aec2a15510ca693b8038c8c
485
py
Python
leaderboard/forms.py
snukky/OCELoT
6d4cc42bf09f059a15505d84b4c8b2c9d359fb8c
[ "BSD-3-Clause" ]
null
null
null
leaderboard/forms.py
snukky/OCELoT
6d4cc42bf09f059a15505d84b4c8b2c9d359fb8c
[ "BSD-3-Clause" ]
null
null
null
leaderboard/forms.py
snukky/OCELoT
6d4cc42bf09f059a15505d84b4c8b2c9d359fb8c
[ "BSD-3-Clause" ]
null
null
null
""" Project OCELoT: Open, Competitive Evaluation Leaderboard of Translations """ from django import forms from leaderboard.models import Language, TestSet class LeaderboardForm(forms.Form): """Generates form for filtering submissions on leaderboard.""" source_language = forms.ModelChoiceField(queryset=Language.objects.all()) target_language = forms.ModelChoiceField(queryset=Language.objects.all()) testset = forms.ModelChoiceField(queryset=TestSet.objects.all())
34.642857
77
0.785567
52
485
7.288462
0.557692
0.166227
0.229551
0.195251
0.290237
0.290237
0.290237
0
0
0
0
0
0.115464
485
13
78
37.307692
0.88345
0.265979
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
0
0
0
null
0
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
4
0784cb78694319eb839c1aabcb132d50d7c18826
189
py
Python
apps/homepage/resources.py
mehrbodjavadi79/AIC21-Backend
9f4342781f0722804a2eb704b43b52984c81b40a
[ "MIT" ]
3
2021-03-12T18:32:39.000Z
2021-11-08T10:21:04.000Z
apps/homepage/resources.py
mehrbodjavadi79/AIC21-Backend
9f4342781f0722804a2eb704b43b52984c81b40a
[ "MIT" ]
null
null
null
apps/homepage/resources.py
mehrbodjavadi79/AIC21-Backend
9f4342781f0722804a2eb704b43b52984c81b40a
[ "MIT" ]
2
2021-01-29T14:52:53.000Z
2022-03-05T10:24:24.000Z
from import_export import resources from .models import Subscribe class SubscribeResource(resources.ModelResource): class Meta: model = Subscribe fields = ('email',)
18.9
49
0.714286
19
189
7.052632
0.684211
0
0
0
0
0
0
0
0
0
0
0
0.216931
189
9
50
21
0.905405
0
0
0
0
0
0.026455
0
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
1
0
1
0
0
4
0789a8962457bcfe36570f212d19aa6c0e5d900a
95
py
Python
api/data/src/apps/infoscreen/apps.py
xeor/hohu
ab5edb47eb50fe2434432d76d5599f5a2f168f57
[ "MIT" ]
null
null
null
api/data/src/apps/infoscreen/apps.py
xeor/hohu
ab5edb47eb50fe2434432d76d5599f5a2f168f57
[ "MIT" ]
null
null
null
api/data/src/apps/infoscreen/apps.py
xeor/hohu
ab5edb47eb50fe2434432d76d5599f5a2f168f57
[ "MIT" ]
null
null
null
from django.apps import AppConfig class InfoscreenConfig(AppConfig): name = 'infoscreen'
15.833333
34
0.768421
10
95
7.3
0.9
0
0
0
0
0
0
0
0
0
0
0
0.157895
95
5
35
19
0.9125
0
0
0
0
0
0.105263
0
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
1
0
1
0
0
4
07a1813473367361e6b2a7da1f34eddf9ffbd0d8
169
py
Python
tests/web_platform/css_flexbox_1/test_flexbox_flex_1_N_0_unitless.py
jonboland/colosseum
cbf974be54fd7f6fddbe7285704cfaf7a866c5c5
[ "BSD-3-Clause" ]
71
2015-04-13T09:44:14.000Z
2019-03-24T01:03:02.000Z
tests/web_platform/css_flexbox_1/test_flexbox_flex_1_N_0_unitless.py
jonboland/colosseum
cbf974be54fd7f6fddbe7285704cfaf7a866c5c5
[ "BSD-3-Clause" ]
35
2019-05-06T15:26:09.000Z
2022-03-28T06:30:33.000Z
tests/web_platform/css_flexbox_1/test_flexbox_flex_1_N_0_unitless.py
jonboland/colosseum
cbf974be54fd7f6fddbe7285704cfaf7a866c5c5
[ "BSD-3-Clause" ]
139
2015-05-30T18:37:43.000Z
2019-03-27T17:14:05.000Z
from tests.utils import W3CTestCase class TestFlexbox_Flex1N0Unitless(W3CTestCase): vars().update(W3CTestCase.find_tests(__file__, 'flexbox_flex-1-N-0-unitless'))
28.166667
82
0.804734
21
169
6.142857
0.857143
0
0
0
0
0
0
0
0
0
0
0.045161
0.08284
169
5
83
33.8
0.787097
0
0
0
0
0
0.159763
0.159763
0
0
0
0
0
1
0
true
0
0.333333
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
0
0
0
4
07bdef1171a5a0146e0180c8d9e3ecbf2e04e5d5
35
py
Python
tap_newrelic/tests/__init__.py
siilats/tap-newrelic
92ceb66fd4b09b37a4d02812e5bc9716a6d8a27d
[ "Apache-2.0" ]
null
null
null
tap_newrelic/tests/__init__.py
siilats/tap-newrelic
92ceb66fd4b09b37a4d02812e5bc9716a6d8a27d
[ "Apache-2.0" ]
null
null
null
tap_newrelic/tests/__init__.py
siilats/tap-newrelic
92ceb66fd4b09b37a4d02812e5bc9716a6d8a27d
[ "Apache-2.0" ]
1
2021-08-02T19:42:04.000Z
2021-08-02T19:42:04.000Z
"""Test suite for tap-newrelic."""
17.5
34
0.657143
5
35
4.6
1
0
0
0
0
0
0
0
0
0
0
0
0.114286
35
1
35
35
0.741935
0.8
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
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
07f17290ff905557b12b1eed32f99380d784ae92
164
py
Python
scripts/item/consume_2434661.py
Snewmy/swordie
ae01ed4ec0eb20a18730e8cd209eea0b84a8dd17
[ "MIT" ]
null
null
null
scripts/item/consume_2434661.py
Snewmy/swordie
ae01ed4ec0eb20a18730e8cd209eea0b84a8dd17
[ "MIT" ]
null
null
null
scripts/item/consume_2434661.py
Snewmy/swordie
ae01ed4ec0eb20a18730e8cd209eea0b84a8dd17
[ "MIT" ]
null
null
null
# Zombie Damage Skin success = sm.addDamageSkin(2434661) if success: sm.chat("The Zombie Damage Skin has been added to your account's damage skin collection.")
32.8
94
0.762195
25
164
5
0.72
0.24
0.256
0
0
0
0
0
0
0
0
0.050725
0.158537
164
4
95
41
0.855072
0.109756
0
0
0
0
0.548611
0
0
0
0
0
0
1
0
false
0
0
0
0
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
0
0
0
0
0
4
07f6c5832b83ed93c1e3c3e5b683e3e2eeb82065
107
py
Python
programming/python/ex030.py
Vinicius-Moraes20/personal-projects
c041909ab1c66eeca11768f8f7944eb351c8b8e7
[ "MIT" ]
null
null
null
programming/python/ex030.py
Vinicius-Moraes20/personal-projects
c041909ab1c66eeca11768f8f7944eb351c8b8e7
[ "MIT" ]
null
null
null
programming/python/ex030.py
Vinicius-Moraes20/personal-projects
c041909ab1c66eeca11768f8f7944eb351c8b8e7
[ "MIT" ]
null
null
null
numero = int(input("Digite um numero: ")) % 2 print("Numero par") if numero == 0 else print("Numero impar")
53.5
61
0.672897
17
107
4.235294
0.705882
0.305556
0
0
0
0
0
0
0
0
0
0.021978
0.149533
107
2
61
53.5
0.769231
0
0
0
0
0
0.37037
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
0
0
0
1
0
4
6af3277504cf732ef58367eaeac65f265a0d9116
310
py
Python
en/093/python/main.py
franciscogomes2020/exercises
8b33c4b9349a9331e4002a8225adc2a482c70024
[ "MIT" ]
null
null
null
en/093/python/main.py
franciscogomes2020/exercises
8b33c4b9349a9331e4002a8225adc2a482c70024
[ "MIT" ]
null
null
null
en/093/python/main.py
franciscogomes2020/exercises
8b33c4b9349a9331e4002a8225adc2a482c70024
[ "MIT" ]
null
null
null
# Create a program that manages a football player's performance. The program will read the player's name and how many games he has played. Then it will read the number of goals scored in each match. In the end, all this will be stored in a dictionary, including the total goals scored during the championship.
155
309
0.793548
56
310
4.392857
0.696429
0.056911
0.089431
0
0
0
0
0
0
0
0
0
0.177419
310
1
310
310
0.964706
0.990323
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
ed01f4d8341b5497473b6f535ac4a2c04158cd9e
279
py
Python
tools/wptrunner/wptrunner/executors/executorsafari.py
ziransun/wpt
ab8f451eb39eb198584d547f5d965ef54df2a86a
[ "BSD-3-Clause" ]
9
2019-04-01T10:57:10.000Z
2021-12-02T11:12:06.000Z
tools/wptrunner/wptrunner/executors/executorsafari.py
ziransun/wpt
ab8f451eb39eb198584d547f5d965ef54df2a86a
[ "BSD-3-Clause" ]
33
2019-03-21T10:18:37.000Z
2022-03-23T13:21:40.000Z
tools/wptrunner/wptrunner/executors/executorsafari.py
ziransun/wpt
ab8f451eb39eb198584d547f5d965ef54df2a86a
[ "BSD-3-Clause" ]
11
2019-04-12T01:20:16.000Z
2021-11-23T17:25:02.000Z
from ..webdriver_server import SafariDriverServer from .base import WdspecExecutor, WebDriverProtocol class SafariDriverProtocol(WebDriverProtocol): server_cls = SafariDriverServer class SafariDriverWdspecExecutor(WdspecExecutor): protocol_cls = SafariDriverProtocol
25.363636
51
0.845878
22
279
10.590909
0.590909
0
0
0
0
0
0
0
0
0
0
0
0.111111
279
10
52
27.9
0.939516
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
ed28956a366a9a8ec75382a2b1bfd3d32741e8ca
2,023
py
Python
OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GLES2/OES/sample_variables.py
JE-Chen/je_old_repo
a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5
[ "MIT" ]
null
null
null
OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GLES2/OES/sample_variables.py
JE-Chen/je_old_repo
a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5
[ "MIT" ]
null
null
null
OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GLES2/OES/sample_variables.py
JE-Chen/je_old_repo
a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5
[ "MIT" ]
null
null
null
'''OpenGL extension OES.sample_variables This module customises the behaviour of the OpenGL.raw.GLES2.OES.sample_variables to provide a more Python-friendly API Overview (from the spec) This extension allows fragment shaders more control over multisample rendering. The mask of samples covered by a fragment can be read by the shader and individual samples can be masked out. Additionally fragment shaders can be run on individual samples and the sample's ID and position read to allow better interaction with multisample resources such as textures. In multisample rendering, an implementation is allowed to assign the same sets of fragment shader input values to each sample, which then allows the optimization where the shader is only evaluated once and then distributed to the samples that have been determined to be covered by the primitive currently being rasterized. This extension does not change how values are interpolated, but it makes some details of the current sample available. This means that where these features are used (gl_SampleID and gl_SamplePosition), implementations must run the fragment shader for each sample. In order to obtain per-sample interpolation on fragment inputs, either OES_sample_shading or OES_shader_multisample_interpolation must be used in conjunction with the features from this extension. The official definition of this extension is available here: http://www.opengl.org/registry/specs/OES/sample_variables.txt ''' from OpenGL import platform, constant, arrays from OpenGL import extensions, wrapper import ctypes from OpenGL.raw.GLES2 import _types, _glgets from OpenGL.raw.GLES2.OES.sample_variables import * from OpenGL.raw.GLES2.OES.sample_variables import _EXTENSION_NAME def glInitSampleVariablesOES(): '''Return boolean indicating whether this extension is available''' from OpenGL import extensions return extensions.hasGLExtension( _EXTENSION_NAME ) ### END AUTOGENERATED SECTION
43.978261
72
0.797331
288
2,023
5.538194
0.5
0.033856
0.056426
0.031975
0.072727
0.072727
0.052665
0.052665
0
0
0
0.002375
0.167573
2,023
46
73
43.978261
0.944774
0.849234
0
0
0
0
0
0
0
0
0
0
0
1
0.111111
true
0
0.777778
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
ed296dd4c8225c0f6b33f59ac26874fbfe7ffc7b
11,423
py
Python
opensfm/test/test_robust.py
hidden-ar/OpenSfM
3ea1216d4dedc94b93ea9f7aa51cd8efd7377922
[ "BSD-2-Clause" ]
null
null
null
opensfm/test/test_robust.py
hidden-ar/OpenSfM
3ea1216d4dedc94b93ea9f7aa51cd8efd7377922
[ "BSD-2-Clause" ]
null
null
null
opensfm/test/test_robust.py
hidden-ar/OpenSfM
3ea1216d4dedc94b93ea9f7aa51cd8efd7377922
[ "BSD-2-Clause" ]
null
null
null
import copy from typing import Tuple import numpy as np from opensfm import pyrobust, pygeometry def line_data() -> Tuple[int, int, np.ndarray, int]: a, b = 2, 3 samples = 100 x = np.linspace(0, 100, samples) return a, b, x, samples def similarity_data() -> Tuple[np.ndarray, np.ndarray, int, np.ndarray, int]: rotation = np.array([0.1, 0.2, 0.3]) translation = np.array([4, 5, 6]) scale = 2 samples = 100 x = np.random.rand(samples, 3) return rotation, translation, scale, x, samples def add_outliers(ratio_outliers: float, x: np.ndarray, min: float, max: float) -> None: for index in np.random.permutation(len(x))[: int(ratio_outliers * len(x))]: shape = x[index].shape noise = np.random.uniform(min, max, size=shape) if len(shape) == 0: sign = 1 if np.random.randint(2) > 0 else -1 else: sign = [1 if r > 0 else -1 for r in np.random.randint(2, size=shape)] x[int(index)] += sign * noise def test_uniform_line_ransac() -> None: a, b, x, samples = line_data() scale = 2.0 y = a * x + b + np.random.rand(x.shape[0]) * scale data = np.array([x, y]).transpose() params = pyrobust.RobustEstimatorParams() result = pyrobust.ransac_line(data, scale, params, pyrobust.RansacType.RANSAC) assert result.score == samples assert len(result.inliers_indices) == samples def test_outliers_line_ransac() -> None: a, b, x, samples = line_data() scale = 2.0 y = a * x + b + np.random.rand(x.shape[0]) * scale ratio_outliers = 0.4 outliers_max = 5.0 add_outliers(ratio_outliers, x, scale, outliers_max) data = np.array([x, y]).transpose() params = pyrobust.RobustEstimatorParams() result = pyrobust.ransac_line(data, scale, params, pyrobust.RansacType.RANSAC) inliers_count = (1 - ratio_outliers) * samples assert np.allclose(result.score, inliers_count, atol=1) assert np.allclose(len(result.inliers_indices), inliers_count, atol=1) def test_normal_line_msac() -> None: a, b, x, samples = line_data() sigma = 2.0 y = a * x + b + np.random.normal(scale=sigma, size=x.shape[0]) multiplier = 1.96 data = np.array([x, y]).transpose() params = pyrobust.RobustEstimatorParams() result = pyrobust.ransac_line( data, multiplier * sigma, params, pyrobust.RansacType.MSAC ) confidence = 0.95 # 1.96*MAD -> 95% rejecting inliers assert np.isclose( len(result.inliers_indices), samples, rtol=(1 - confidence), atol=8 ) def test_outliers_line_msac() -> None: a, b, x, samples = line_data() sigma = 2.0 y = a * x + b + np.random.normal(scale=sigma, size=x.shape[0]) multiplier = 1.96 ratio_outliers = 0.4 outliers_max = 5.0 add_outliers(ratio_outliers, x, multiplier * sigma, multiplier * outliers_max) data = np.array([x, y]).transpose() params = pyrobust.RobustEstimatorParams() result = pyrobust.ransac_line( data, multiplier * sigma, params, pyrobust.RansacType.MSAC ) inliers_count = (1 - ratio_outliers) * samples confidence = 0.95 # 1.96*MAD -> 95% rejecting inliers assert np.isclose( len(result.inliers_indices), inliers_count, rtol=(1 - confidence), atol=5 ) def test_normal_line_LMedS() -> None: a, b, x, samples = line_data() sigma = 2.0 y = a * x + b + np.random.normal(scale=sigma, size=x.shape[0]) multiplier = 1.96 data = np.array([x, y]).transpose() params = pyrobust.RobustEstimatorParams() result = pyrobust.ransac_line(data, multiplier, params, pyrobust.RansacType.LMedS) confidence = 0.95 # 1.96*MAD -> 95% rejecting inliers assert np.isclose( len(result.inliers_indices), samples, rtol=(1 - confidence), atol=11 ) def test_outliers_line_LMedS() -> None: a, b, x, samples = line_data() sigma = 2.0 y = a * x + b + np.random.normal(scale=sigma, size=x.shape[0]) multiplier = 1.96 ratio_outliers = 0.4 outliers_max = 5.0 add_outliers(ratio_outliers, x, multiplier * sigma, multiplier * outliers_max) data = np.array([x, y]).transpose() params = pyrobust.RobustEstimatorParams() # can't be used with LMedS as an over-estimated sigma will make it stop early params.use_iteration_reduction = False result = pyrobust.ransac_line(data, multiplier, params, pyrobust.RansacType.LMedS) inliers_count = (1 - ratio_outliers) * samples confidence = 0.95 # 1.96*MAD -> 95% rejecting inliers assert np.isclose( len(result.inliers_indices), inliers_count, rtol=(1 - confidence), atol=8 ) def test_outliers_similarity_ransac() -> None: rotation, translation, scale, x, samples = similarity_data() similarity = pygeometry.Similarity(rotation, translation, scale) y = np.array([similarity.transform(p) for p in x]) sigma = 0.001 y += np.random.normal(scale=sigma, size=y.shape) outliers_max = 1.0 ratio_outliers = 0.3 add_outliers(ratio_outliers, x, scale, outliers_max) params = pyrobust.RobustEstimatorParams() result = pyrobust.ransac_similarity(x, y, 0.1, params, pyrobust.RansacType.RANSAC) inliers_count = (1 - ratio_outliers) * samples confidence = 0.95 # 1.96*MAD -> 95% rejecting inliers assert np.isclose( len(result.inliers_indices), inliers_count, rtol=(1 - confidence), atol=8 ) def test_uniform_essential_ransac(pairs_and_their_E) -> None: for f1, f2, _, _ in pairs_and_their_E: points = np.concatenate((f1, f2), axis=1) scale = 1e-2 points += np.random.rand(*points.shape) * scale f1, f2 = points[:, 0:3], points[:, 3:6] f1 /= np.linalg.norm(f1, axis=1)[:, None] f2 /= np.linalg.norm(f2, axis=1)[:, None] scale_eps_ratio = 5e-1 params = pyrobust.RobustEstimatorParams() params.use_iteration_reduction = False result = pyrobust.ransac_essential( f1, f2, scale * (1.0 + scale_eps_ratio), params, pyrobust.RansacType.RANSAC ) assert len(result.inliers_indices) == len(f1) == len(f2) def test_outliers_essential_ransac(pairs_and_their_E) -> None: for f1, f2, _, _ in pairs_and_their_E: points = np.concatenate((f1, f2), axis=1) scale = 1e-3 points += np.random.rand(*points.shape) * scale ratio_outliers = 0.3 add_outliers(ratio_outliers, points, 0.1, 0.4) f1, f2 = points[:, 0:3], points[:, 3:6] f1 /= np.linalg.norm(f1, axis=1)[:, None] f2 /= np.linalg.norm(f2, axis=1)[:, None] scale_eps_ratio = 0.5 params = pyrobust.RobustEstimatorParams() params.probability = 1 - 1e-3 result = pyrobust.ransac_essential( f1, f2, scale * (1.0 + scale_eps_ratio), params, pyrobust.RansacType.RANSAC ) tolerance = 0.12 # some outliers might have been moved along the epipolar inliers_count = (1 - ratio_outliers) * len(points) assert np.isclose(len(result.inliers_indices), inliers_count, rtol=tolerance) def test_outliers_relative_pose_ransac(pairs_and_their_E) -> None: for f1, f2, _, pose in pairs_and_their_E: points = np.concatenate((f1, f2), axis=1) scale = 1e-3 points += np.random.rand(*points.shape) * scale ratio_outliers = 0.3 add_outliers(ratio_outliers, points, 0.1, 1.0) f1, f2 = points[:, 0:3], points[:, 3:6] f1 /= np.linalg.norm(f1, axis=1)[:, None] f2 /= np.linalg.norm(f2, axis=1)[:, None] scale_eps_ratio = 1e-1 params = pyrobust.RobustEstimatorParams() params.iterations = 1000 result = pyrobust.ransac_relative_pose( f1, f2, scale * (1.0 + scale_eps_ratio), params, pyrobust.RansacType.RANSAC ) expected = pose.get_world_to_cam()[:3] expected[:, 3] /= np.linalg.norm(expected[:, 3]) tolerance = 0.15 inliers_count = (1 - ratio_outliers) * len(points) assert np.isclose(len(result.inliers_indices), inliers_count, rtol=tolerance) assert np.linalg.norm(expected - result.lo_model, ord="fro") < 16e-2 def test_outliers_relative_rotation_ransac(pairs_and_their_E) -> None: for f1, _, _, _ in pairs_and_their_E: vec_x = np.random.rand(3) vec_x /= np.linalg.norm(vec_x) vec_y = np.array([-vec_x[1], vec_x[0], 0.0]) vec_y /= np.linalg.norm(vec_y) vec_z = np.cross(vec_x, vec_y) rotation = np.array([vec_x, vec_y, vec_z]) f1 /= np.linalg.norm(f1, axis=1)[:, None] f2 = [rotation.dot(x) for x in f1] points = np.concatenate((f1, f2), axis=1) scale = 1e-3 points += np.random.rand(*points.shape) * scale ratio_outliers = 0.3 add_outliers(ratio_outliers, points, 0.1, 1.0) f1, f2 = points[:, 0:3], points[:, 3:6] f1 /= np.linalg.norm(f1, axis=1)[:, None] f2 /= np.linalg.norm(f2, axis=1)[:, None] params = pyrobust.RobustEstimatorParams() params.iterations = 1000 result = pyrobust.ransac_relative_rotation( f1, f2, np.sqrt(3 * scale * scale), params, pyrobust.RansacType.RANSAC ) tolerance = 0.04 inliers_count = (1 - ratio_outliers) * len(points) assert np.isclose(len(result.inliers_indices), inliers_count, rtol=tolerance) assert np.linalg.norm(rotation - result.lo_model, ord="fro") < 8e-2 def test_outliers_absolute_pose_ransac(shots_and_their_points) -> None: for pose, bearings, points in shots_and_their_points: scale = 1e-3 bearings = copy.deepcopy(bearings) bearings += np.random.rand(*bearings.shape) * scale ratio_outliers = 0.3 add_outliers(ratio_outliers, bearings, 0.1, 1.0) bearings /= np.linalg.norm(bearings, axis=1)[:, None] params = pyrobust.RobustEstimatorParams() params.iterations = 1000 result = pyrobust.ransac_absolute_pose( bearings, points, scale, params, pyrobust.RansacType.RANSAC ) expected = pose.get_world_to_cam()[:3] tolerance = 0.05 inliers_count = (1 - ratio_outliers) * len(points) assert np.isclose(len(result.inliers_indices), inliers_count, rtol=tolerance) assert np.linalg.norm(expected - result.lo_model, ord="fro") < 8e-2 def test_outliers_absolute_pose_known_rotation_ransac(shots_and_their_points) -> None: for pose, bearings, points in shots_and_their_points: scale = 1e-3 bearings = copy.deepcopy(bearings) bearings += np.random.rand(*bearings.shape) * scale ratio_outliers = 0.3 add_outliers(ratio_outliers, bearings, 0.1, 1.0) bearings /= np.linalg.norm(bearings, axis=1)[:, None] R = pose.get_rotation_matrix() p_rotated = np.array([R.dot(p) for p in points]) params = pyrobust.RobustEstimatorParams() params.iterations = 1000 result = pyrobust.ransac_absolute_pose_known_rotation( bearings, p_rotated, scale, params, pyrobust.RansacType.RANSAC ) tolerance = 0.05 inliers_count = (1 - ratio_outliers) * len(points) assert np.isclose(len(result.inliers_indices), inliers_count, rtol=tolerance) assert np.linalg.norm(pose.translation - result.lo_model) < 8e-2
32.177465
87
0.638274
1,571
11,423
4.488224
0.103756
0.053468
0.030634
0.042405
0.781591
0.754219
0.736066
0.719898
0.694653
0.686427
0
0.038541
0.234527
11,423
354
88
32.268362
0.767841
0.026263
0
0.606557
0
0
0.00081
0
0
0
0
0
0.077869
1
0.065574
false
0
0.016393
0
0.090164
0
0
0
0
null
0
0
0
0
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
4
ed2bfc4d302bfd4bd288ed4f43ff9caf6ed4aa45
57
py
Python
pyimp/girl/interfaces/pixeloperators.py
ismaelharunid/girl
78c703e2788808b0fb2033577e827dcbdb59b797
[ "MIT" ]
1
2020-06-14T13:42:17.000Z
2020-06-14T13:42:17.000Z
pyimp/girl/interfaces/pixeloperators.py
ismaelharunid/girl
78c703e2788808b0fb2033577e827dcbdb59b797
[ "MIT" ]
null
null
null
pyimp/girl/interfaces/pixeloperators.py
ismaelharunid/girl
78c703e2788808b0fb2033577e827dcbdb59b797
[ "MIT" ]
null
null
null
# operator methods for working with pixels and bitmaps
14.25
54
0.789474
8
57
5.625
1
0
0
0
0
0
0
0
0
0
0
0
0.192982
57
3
55
19
0.978261
0.912281
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
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
ed2ef13d1491c00a29c5ca34ac0eab718b661862
147
py
Python
purdue/models/Item.py
ScriptedButton/purdue.py
5960ad4bcbbcefc2236e30209b41811dd5e02ded
[ "MIT" ]
null
null
null
purdue/models/Item.py
ScriptedButton/purdue.py
5960ad4bcbbcefc2236e30209b41811dd5e02ded
[ "MIT" ]
null
null
null
purdue/models/Item.py
ScriptedButton/purdue.py
5960ad4bcbbcefc2236e30209b41811dd5e02ded
[ "MIT" ]
null
null
null
from dataclasses import dataclass @dataclass class Item: id: int name: str is_vegetarian: bool #allergens: list[Allergen]
16.333333
34
0.666667
17
147
5.705882
0.941176
0
0
0
0
0
0
0
0
0
0
0
0.272109
147
9
35
16.333333
0.906542
0.170068
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.166667
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
1
0
0
0
1
0
0
4
ed43aaea3e69aedd4f7909c72cd382f09323b4d5
548
py
Python
6KYU/what_century.py
yaznasivasai/python_codewars
25493591dde4649dc9c1ec3bece8191a3bed6818
[ "MIT" ]
4
2021-07-17T22:48:03.000Z
2022-03-25T14:10:58.000Z
6KYU/what_century.py
yaznasivasai/python_codewars
25493591dde4649dc9c1ec3bece8191a3bed6818
[ "MIT" ]
null
null
null
6KYU/what_century.py
yaznasivasai/python_codewars
25493591dde4649dc9c1ec3bece8191a3bed6818
[ "MIT" ]
3
2021-06-14T14:18:16.000Z
2022-03-16T06:02:02.000Z
from math import ceil def what_century(year: str) -> str: """ This function returns the century of the input year. """ century = str(ceil(int(year) / 100)) if century[-1] == '1': if century == '11': return century + 'th' return century + 'st' if century[-1] == '2': if century == '12': return century + 'th' return century + 'nd' if century[-1] == '3': if century == '13': return century + 'th' return century + 'rd' return century + 'th'
28.842105
64
0.512774
67
548
4.179104
0.432836
0.325
0.214286
0.225
0.3
0
0
0
0
0
0
0.041436
0.339416
548
19
65
28.842105
0.732044
0.094891
0
0.25
0
0
0.047035
0
0
0
0
0
0
1
0.0625
false
0
0.0625
0
0.5625
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
0
0
1
0
0
4
ed6bae8f6a905c89aafc4eecf25902c291b4ca41
10,048
py
Python
tests/test_aprspy.py
nsnw/aprspy
c289ecc44cfc0d2475937cfce4a8b8eac10ba680
[ "MIT" ]
11
2019-11-05T08:55:52.000Z
2021-05-14T13:16:49.000Z
tests/test_aprspy.py
nsnw/aprspy
c289ecc44cfc0d2475937cfce4a8b8eac10ba680
[ "MIT" ]
12
2019-10-26T04:11:53.000Z
2020-11-14T09:23:07.000Z
tests/test_aprspy.py
nsnw/aprspy
c289ecc44cfc0d2475937cfce4a8b8eac10ba680
[ "MIT" ]
1
2019-10-25T03:35:02.000Z
2019-10-25T03:35:02.000Z
import pytest from aprspy import APRS, GenericPacket from aprspy.utils import APRSUtils from aprspy.exceptions import ParseError from aprspy.components import Station, Path def test_init_packet(): packet = GenericPacket() assert repr(packet) == "<GenericPacket>" packet = GenericPacket(source="XX1XX", destination="APRS", path="TCPIP*,qAR,T2TEST", data_type_id=">", info="This is a test status message") assert repr(packet) == "<GenericPacket: XX1XX>" assert packet.source == "XX1XX" assert packet.destination == "APRS" assert packet.data_type_id == ">" assert packet.info == "This is a test status message" def test_packet_properties(): packet = GenericPacket() station = Station(callsign="XX1XX-11") dest = Station(callsign="APRS") path = Path(path="TCPIP*,qAR,T2TEST") packet.source = station assert packet.source == station packet.destination = dest assert packet.destination == dest packet.path = path assert packet.path == path def test_invalid_packet_properties(): packet = GenericPacket() # Source is too long try: packet.source = "XXX1XXX-11" assert False except ValueError: assert True except Exception: assert False # Source type is invalid try: packet.source = 11 assert False except TypeError: assert True except Exception: assert False # Destination is too long try: packet.destination = "XXX1XXX-11" assert False except ValueError: assert True except Exception: assert False # Destination type is invalid try: packet.destination = 11 assert False except TypeError: assert True except Exception: assert False # Path type is invalid try: packet.path = False assert False except TypeError: assert True except Exception: assert False def test_timestamp(): timestamp = APRSUtils.decode_timestamp("091234z") #def test_packet(): # raw = 'XX1XX>APRS,TCPIP*,qAC,FOURTH:=5030.50N/10020.30W$221/000/A=005Test packet' # # packet = APRS.parse(raw) # # assert packet.raw == raw def test_invalid_packet(): # Missing > after source try: APRS.parse('XX1XXAPRS,TCPIP*,qAC,FOURTH:=5030.50N/10020.30W$221/000/A=005000Test packet') assert False except ParseError: assert True except Exception: assert False # Source is too long try: APRS.parse('XXX1XXX-11>APRS,TCPIP*,qAC,FOURTH:=5030.50N/10020.30W$221/000/A=005000Test packet') assert False except ParseError: assert True except Exception: assert False # Destination is too long try: APRS.parse('XX1XX>APRSAPRSAPRS,TCPIP*,qAC,FOURTH:=5030.50N/10020.30W$221/000/A=005000Test packet') assert False except ParseError: assert True except Exception: assert False # Destination is invalid try: APRS.parse('XX1XX>aprs,TCPIP*,qAC,FOURTH:=5030.50N/10020.30W$221/000/A=005000Test packet') assert False except ParseError: assert True except Exception: assert False # Destination is invalid try: APRS.parse('XX1XX>APRS-XX,TCPIP*,qAC,FOURTH:=5030.50N/10020.30W$221/000/A=005000Test packet') assert False except ParseError: assert True except Exception: assert False # Packet is too short try: APRS.parse('XX1XX>APRS,TCPIP*,qAC,FOURTH:=') assert False except ParseError: assert True except Exception: assert False def test_decode_phg(): (power, height, gain, directivity) = APRSUtils.decode_phg("5132") assert power == 25 assert height == 20 assert gain == 3 assert directivity == 90 (power, height, gain, directivity) = APRSUtils.decode_phg("5130") assert power == 25 assert height == 20 assert gain == 3 assert directivity is None def test_decode_invalid_phg(): # PHG values must be numerical try: APRSUtils.decode_phg("PHG513T") assert False except ValueError: assert True except Exception: assert False def test_encode_phg(): phg = APRSUtils.encode_phg(power=25, height=20, gain=3, directivity=90) assert phg == "5132" phg = APRSUtils.encode_phg(power=25, height=20, gain=3, directivity=None) assert phg == "5130" def test_decode_dfs(): (strength, height, gain, directivity) = APRSUtils.decode_dfs("2360") assert strength == 2 assert height == 80 assert gain == 6 assert directivity == None (strength, height, gain, directivity) = APRSUtils.decode_dfs("2361") assert strength == 2 assert height == 80 assert gain == 6 assert directivity == 45 def test_decode_invalid_dfs(): # DFS values must be numerical try: APRSUtils.decode_dfs("DFS236Z") assert False except ValueError: assert True except Exception: assert False def test_encode_invalid_phg(): # Invalid power try: phg = APRSUtils.encode_phg(power=10, height=80, gain=6, directivity=None) assert False except ValueError: assert True except Exception: assert False try: phg = APRSUtils.encode_phg(power="10", height=80, gain=6, directivity=None) assert False except TypeError: assert True except Exception: assert False # Invalid height try: phg = APRSUtils.encode_phg(power=25, height=90, gain=6, directivity=None) assert False except ValueError: assert True except Exception: assert False try: phg = APRSUtils.encode_phg(power=25, height="90", gain=6, directivity=None) assert False except TypeError: assert True except Exception: assert False # Invalid gain try: phg = APRSUtils.encode_phg(power=25, height=80, gain=10, directivity=None) assert False except ValueError: assert True except Exception: assert False try: phg = APRSUtils.encode_phg(power=25, height=80, gain="10", directivity=None) assert False except TypeError: assert True except Exception: assert False # Invalid directivity try: phg = APRSUtils.encode_phg(power=25, height=80, gain=6, directivity=47) assert False except ValueError: assert True except Exception: assert False try: phg = APRSUtils.encode_phg(power=25, height=80, gain=6, directivity="None") assert False except TypeError: assert True except Exception: assert False def test_encode_dfs(): dfs = APRSUtils.encode_dfs(strength=2, height=80, gain=6, directivity=None) assert dfs == "2360" dfs = APRSUtils.encode_dfs(strength=2, height=80, gain=6, directivity=45) assert dfs == "2361" def test_encode_invalid_dfs(): # Invalid strength try: dfs = APRSUtils.encode_dfs(strength=10, height=80, gain=6, directivity=None) assert False except ValueError: assert True except Exception: assert False try: dfs = APRSUtils.encode_dfs(strength="2", height=80, gain=6, directivity=None) assert False except TypeError: assert True except Exception: assert False # Invalid height try: dfs = APRSUtils.encode_dfs(strength=2, height=90, gain=6, directivity=None) assert False except ValueError: assert True except Exception: assert False try: dfs = APRSUtils.encode_dfs(strength=2, height="80", gain=6, directivity=None) assert False except TypeError: assert True except Exception: assert False # Invalid gain try: dfs = APRSUtils.encode_dfs(strength=2, height=80, gain=10, directivity=None) assert False except ValueError: assert True except Exception: assert False try: dfs = APRSUtils.encode_dfs(strength=2, height=80, gain="6", directivity=None) assert False except TypeError: assert True except Exception: assert False # Invalid directivity try: dfs = APRSUtils.encode_dfs(strength=2, height=80, gain=6, directivity=47) assert False except ValueError: assert True except Exception: assert False try: dfs = APRSUtils.encode_dfs(strength=2, height=80, gain=6, directivity="None") assert False except TypeError: assert True except Exception: assert False def test_decode_nrq(): # Test with example from APRS 1.01 n, r, q = APRSUtils.decode_nrq("729") assert n == 87.5 assert r == 4 assert q == 1 # Test with 0 n, r, q = APRSUtils.decode_nrq("029") assert n == None assert r == None assert q == None # Test with manual n, r, q = APRSUtils.decode_nrq("929") assert n == "manual" # Test different qualities # These don't fit neatly into 2 ** x n, r, q = APRSUtils.decode_nrq("722") assert q == 120 n, r, q = APRSUtils.decode_nrq("721") assert q == 240 n, r, q = APRSUtils.decode_nrq("720") assert q == None def test_decode_invalid_nrq(): try: APRSUtils.decode_nrq("S29") assert False except ValueError: assert True except Exception: assert False
24.627451
107
0.6041
1,156
10,048
5.186851
0.112457
0.110073
0.085057
0.125083
0.762842
0.738826
0.707472
0.650934
0.640093
0.635924
0
0.054577
0.310709
10,048
407
108
24.687961
0.811146
0.07086
0
0.667797
0
0.016949
0.079137
0.04384
0
0
0
0
0.437288
1
0.050847
false
0
0.016949
0
0.067797
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
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
ed6dc673f4f90a2ec65db06037e5dff1bb0468e4
33
py
Python
tests/server/__init__.py
abitmore/hivemind
a68d8dd49d5d79caccf988a1ff6cba4703adae49
[ "MIT" ]
45
2021-05-23T21:06:49.000Z
2022-03-22T23:04:25.000Z
tests/server/__init__.py
abitmore/hivemind
a68d8dd49d5d79caccf988a1ff6cba4703adae49
[ "MIT" ]
1
2021-08-03T10:57:23.000Z
2021-08-03T10:58:05.000Z
tests/server/__init__.py
abitmore/hivemind
a68d8dd49d5d79caccf988a1ff6cba4703adae49
[ "MIT" ]
30
2021-05-28T16:23:53.000Z
2021-09-09T00:28:34.000Z
"""Hive server and API tests."""
16.5
32
0.636364
5
33
4.2
1
0
0
0
0
0
0
0
0
0
0
0
0.151515
33
1
33
33
0.75
0.787879
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
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
9c087b378aa41c41cba3aa61c93c17b33a0d74f5
1,761
py
Python
finbyzwhatsapp/commands.py
mohsinalimat/finbyzwhatsapp
8a1f38479c08c31324c240d61e94ef6bd626ef3a
[ "MIT" ]
null
null
null
finbyzwhatsapp/commands.py
mohsinalimat/finbyzwhatsapp
8a1f38479c08c31324c240d61e94ef6bd626ef3a
[ "MIT" ]
null
null
null
finbyzwhatsapp/commands.py
mohsinalimat/finbyzwhatsapp
8a1f38479c08c31324c240d61e94ef6bd626ef3a
[ "MIT" ]
null
null
null
import click, os, sys, shlex import subprocess from subprocess import STDOUT, check_call, CalledProcessError @click.command('install-whatsapp') def install_whatsapp(): pass # cur_dir = os.getcwd() + "/../apps/finbyzerp/finbyzerp/webwhatsapi" # os.chdir(cur_dir) # Firefox # os.system('sudo su') # os.system("sudo apt install firefox") # os.system("export GECKO_DRIVER_VERSION='v0.29.0'") # os.system("wget https://github.com/mozilla/geckodriver/releases/download/$GECKO_DRIVER_VERSION/geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz") # os.system("tar -xvzf geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz") # os.system("rm geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz") # os.system("sudo cp geckodriver /usr/local/bin/") # os.system("chmod +x /usr/local/bin/geckodriver") # Chrome # os.system('sudo curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add') # os.system('sudo echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list') # os.system('sudo apt-get -y update') # os.system('wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb') # os.system('sudo apt install ./google-chrome-stable_current_amd64.deb') # os.system('sudo wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip') # os.system('sudo unzip chromedriver_linux64.zip') # os.system('sudo mv chromedriver /usr/local/bin/chromedriver') # os.system('sudo chown root:root /usr/local/bin/chromedriver') # os.system("sudo rm chromedriver_linux64.zip") # os.system('sudo chmod +x /usr/local/bin/chromedriver') commands = [install_whatsapp]
48.916667
151
0.712663
248
1,761
4.96371
0.375
0.123477
0.126726
0.036556
0.385865
0.33225
0.249391
0.192526
0.192526
0
0
0.016329
0.130608
1,761
35
152
50.314286
0.78772
0.800681
0
0
0
0
0.04893
0
0
0
0
0
0
1
0.142857
false
0.142857
0.428571
0
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
4
9c3d28479abce8157c8dfe41796ecd964c3ec9e5
149
py
Python
utils/hosttourl.py
Mingmingge/csdn-to-github.io
84b6f86f536f696f695c56931e8f3b43c43d7476
[ "Apache-2.0" ]
3
2018-07-04T01:20:44.000Z
2019-04-11T06:40:35.000Z
utils/hosttourl.py
Mingmingge/csdn-to-github.io
84b6f86f536f696f695c56931e8f3b43c43d7476
[ "Apache-2.0" ]
null
null
null
utils/hosttourl.py
Mingmingge/csdn-to-github.io
84b6f86f536f696f695c56931e8f3b43c43d7476
[ "Apache-2.0" ]
null
null
null
#! /usr/bin/python # -*- coding: utf-8 -*- import os def hostTourl( host, i): url = os.path.join(host, 'article/list/' + str(i)) return url
18.625
54
0.590604
23
149
3.826087
0.826087
0
0
0
0
0
0
0
0
0
0
0.008403
0.201342
149
8
55
18.625
0.731092
0.261745
0
0
0
0
0.119266
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
92caceb57e7fe6b867e0a8bb7582f0959b417a1c
461
py
Python
service3/src/__init__.py
joshuahigginson1/DevOps_Assessment_2
9ee7f3793ae8e7c1aa55dbb60bca7dbe0c718d1c
[ "MIT" ]
1
2021-03-30T09:55:04.000Z
2021-03-30T09:55:04.000Z
service3/src/__init__.py
joshuahigginson1/DevOps_Assessment_2
9ee7f3793ae8e7c1aa55dbb60bca7dbe0c718d1c
[ "MIT" ]
null
null
null
service3/src/__init__.py
joshuahigginson1/DevOps_Assessment_2
9ee7f3793ae8e7c1aa55dbb60bca7dbe0c718d1c
[ "MIT" ]
1
2020-08-17T09:06:39.000Z
2020-08-17T09:06:39.000Z
"""Task:""" # Imports -------------------------------------------------------------- # Classes -------------------------------------------------------------- # Functions ------------------------------------------------------------ # Methods -------------------------------------------------------------- # Define Variables ----------------------------------------------------- # Execute Code ---------------------------------------------------------
24.263158
72
0.130152
9
461
6.666667
1
0
0
0
0
0
0
0
0
0
0
0
0.069414
461
18
73
25.611111
0.13986
0.937093
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
0
0
0
1
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
92f13e4235719a3bcdb745a81f18b88e8fb60026
21
py
Python
psslib/__init__.py
isanych/pss
9c9f3b8e5fedcc8e3fdbf39ace6b4f25ac4a00ff
[ "Unlicense" ]
202
2015-01-05T13:58:05.000Z
2022-03-07T18:28:42.000Z
psslib/__init__.py
sthagen/pss
b248b0f94dfe6d7a472d27ba98c9c3d7a8c092b6
[ "Unlicense" ]
29
2015-01-23T03:26:54.000Z
2021-02-23T13:13:25.000Z
psslib/__init__.py
sthagen/pss
b248b0f94dfe6d7a472d27ba98c9c3d7a8c092b6
[ "Unlicense" ]
40
2015-02-08T20:08:59.000Z
2022-02-05T06:11:50.000Z
__version__ = '1.43'
10.5
20
0.666667
3
21
3.333333
1
0
0
0
0
0
0
0
0
0
0
0.166667
0.142857
21
1
21
21
0.388889
0
0
0
0
0
0.190476
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
0
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
4
131505753e0911784f45799958cb510163d8c078
828
py
Python
src/shape_constraint_detectors/StringMinLengthDetectorSHACLMinLength.py
IDLabResearch/lovstats
dd33183574eed692ee89059ff3c6494160dfb8a9
[ "MIT" ]
1
2018-12-11T13:57:38.000Z
2018-12-11T13:57:38.000Z
src/shape_constraint_detectors/StringMinLengthDetectorSHACLMinLength.py
IDLabResearch/lovstats
dd33183574eed692ee89059ff3c6494160dfb8a9
[ "MIT" ]
null
null
null
src/shape_constraint_detectors/StringMinLengthDetectorSHACLMinLength.py
IDLabResearch/lovstats
dd33183574eed692ee89059ff3c6494160dfb8a9
[ "MIT" ]
null
null
null
from StringMinLengthDetector import StringMinLengthDetector class StringMinLengthDetectorSHACLMinLength(StringMinLengthDetector): """ This class implements the detection of the minimum string length constraint sh:minLength. For further information have a look at the parent class. """ def __init__(self): super(StringMinLengthDetectorSHACLMinLength, self).__init__() self.number = 0 def count(self, s, p, o, s_blank, o_l, o_blank, statement): if p == 'http://www.w3.org/ns/shacl#minLength': self.number += 1 def getName(self): return "stringMinLengthLODStatsDetectorSHACLMinLength" def getVersion(self): return "stringMinLengthLODStatsDetectorSHACLMinLength-v1" def compute(self): self.setNumberStringMinLength(self.number)
30.666667
93
0.716184
83
828
7.012048
0.626506
0.051546
0.189003
0
0
0
0
0
0
0
0
0.006061
0.202899
828
26
94
31.846154
0.875758
0.176329
0
0
0
0
0.195751
0.141123
0
0
0
0
0
1
0.357143
false
0
0.071429
0.142857
0.642857
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
1315945d91fa5d4e9e23be30dc0ed6ed7c1fa1a2
8,748
py
Python
src/OTLMOW/OTLModel/Datatypes/KlBetonsterkteklasse.py
davidvlaminck/OTLClassPython
71330afeb37c3ea6d9981f521ff8f4a3f8b946fc
[ "MIT" ]
2
2022-02-01T08:58:11.000Z
2022-02-08T13:35:17.000Z
src/OTLMOW/OTLModel/Datatypes/KlBetonsterkteklasse.py
davidvlaminck/OTLMOW
71330afeb37c3ea6d9981f521ff8f4a3f8b946fc
[ "MIT" ]
null
null
null
src/OTLMOW/OTLModel/Datatypes/KlBetonsterkteklasse.py
davidvlaminck/OTLMOW
71330afeb37c3ea6d9981f521ff8f4a3f8b946fc
[ "MIT" ]
null
null
null
# coding=utf-8 from OTLMOW.OTLModel.Datatypes.KeuzelijstField import KeuzelijstField from OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde import KeuzelijstWaarde # Generated with OTLEnumerationCreator. To modify: extend, do not edit class KlBetonsterkteklasse(KeuzelijstField): """De klasse waarin de sterkte van beton wordt uitgedrukt.""" naam = 'KlBetonsterkteklasse' label = 'Betonsterkteklasse' objectUri = 'https://wegenenverkeer.data.vlaanderen.be/ns/implementatieelement#KlBetonsterkteklasse' definition = 'De klasse waarin de sterkte van beton wordt uitgedrukt.' codelist = 'https://wegenenverkeer.data.vlaanderen.be/id/conceptscheme/KlBetonsterkteklasse' options = { 'c-12-15': KeuzelijstWaarde(invulwaarde='c-12-15', label='C12/15', definitie='C van Concrete (Beton). 12 is de karakteristieke druksterkte bij beproeving op cilinders. 15 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-12-15'), 'c-16-20': KeuzelijstWaarde(invulwaarde='c-16-20', label='C16/20', definitie='C van Concrete (Beton). 16 is de karakteristieke druksterkte bij beproeving op cilinders. 20 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-16-20'), 'c-20-25': KeuzelijstWaarde(invulwaarde='c-20-25', label='C20/25', definitie='C van Concrete (Beton). 20 is de karakteristieke druksterkte bij beproeving op cilinders. 25 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-20-25'), 'c-25-30': KeuzelijstWaarde(invulwaarde='c-25-30', label='C25/30', definitie='C van Concrete (Beton). 25 is de karakteristieke druksterkte bij beproeving op cilinders. 30 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-25-30'), 'c-28-35': KeuzelijstWaarde(invulwaarde='c-28-35', label='C28/35', definitie='C van Concrete (Beton). 28 is de karakteristieke druksterkte bij beproeving op cilinders. 35 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-28-35'), 'c-30-37': KeuzelijstWaarde(invulwaarde='c-30-37', label='C30/37', definitie='C van Concrete (Beton). 30 is de karakteristieke druksterkte bij beproeving op cilinders. 37 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-30-37'), 'c-35-45': KeuzelijstWaarde(invulwaarde='c-35-45', label='C35/45', definitie='C van Concrete (Beton). 35 is de karakteristieke druksterkte bij beproeving op cilinders. 45 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-35-45'), 'c-40-50': KeuzelijstWaarde(invulwaarde='c-40-50', label='C40/50', definitie='C van Concrete (Beton). 40 is de karakteristieke druksterkte bij beproeving op cilinders. 50 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-40-50'), 'c-45-55': KeuzelijstWaarde(invulwaarde='c-45-55', label='C45/55', definitie='C van Concrete (Beton). 45 is de karakteristieke druksterkte bij beproeving op cilinders. 55 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-45-55'), 'c-50-60': KeuzelijstWaarde(invulwaarde='c-50-60', label='C50/60', definitie='C van Concrete (Beton). 50 is de karakteristieke druksterkte bij beproeving op cilinders. 60 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-50-60'), 'c-53-65': KeuzelijstWaarde(invulwaarde='c-53-65', label='C53/65', definitie='C van Concrete (Beton). 53 is de karakteristieke druksterkte bij beproeving op cilinders. 65 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-53-65'), 'c-55-67': KeuzelijstWaarde(invulwaarde='c-55-67', label='C55/67', definitie='C van Concrete (Beton). 55 is de karakteristieke druksterkte bij beproeving op cilinders. 67 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-55-67'), 'c-60-75': KeuzelijstWaarde(invulwaarde='c-60-75', label='C60/75', definitie='C van Concrete (Beton). 60 is de karakteristieke druksterkte bij beproeving op cilinders. 75 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-60-75'), 'c-70-85': KeuzelijstWaarde(invulwaarde='c-70-85', label='C70/85', definitie='C van Concrete (Beton). 70 is de karakteristieke druksterkte bij beproeving op cilinders. 85 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-70-85'), 'c-8-10': KeuzelijstWaarde(invulwaarde='c-8-10', label='C8/10', definitie='C van Concrete (Beton). 8 is de karakteristieke druksterkte bij beproeving op cilinders. 10 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-8-10'), 'c-80-85': KeuzelijstWaarde(invulwaarde='c-80-85', label='C80/85', definitie='C van Concrete (Beton). 80 is de karakteristieke druksterkte bij beproeving op cilinders. 85 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-80-85'), 'c-90-105': KeuzelijstWaarde(invulwaarde='c-90-105', label='C90/105', definitie='C van Concrete (Beton). 90 is de karakteristieke druksterkte bij beproeving op cilinders. 105 is de karakteristieke druksterkte bij beproeving op kubussen. Beiden uitgedrukt in MPa.', objectUri='https://wegenenverkeer.data.vlaanderen.be/id/concept/KlBetonsterkteklasse/c-90-105') }
102.917647
231
0.613397
921
8,748
5.826276
0.110749
0.025345
0.120388
0.190086
0.76202
0.68934
0.663809
0.663809
0.506895
0.48975
0
0.055241
0.294353
8,748
84
232
104.142857
0.814029
0.015775
0
0
1
0.435897
0.585329
0
0
0
0
0
0
1
0
false
0
0.025641
0
0.115385
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
131ff5abb9fb6319e730d74742914d28dd29745f
36,588
py
Python
test/hummingbot/strategy/cross_exchange_market_making/test_cross_exchange_market_making.py
d3alek/hummingbot
14d6c3b8c4d34c44079c45ef6cd05e9c192f241c
[ "Apache-2.0" ]
null
null
null
test/hummingbot/strategy/cross_exchange_market_making/test_cross_exchange_market_making.py
d3alek/hummingbot
14d6c3b8c4d34c44079c45ef6cd05e9c192f241c
[ "Apache-2.0" ]
null
null
null
test/hummingbot/strategy/cross_exchange_market_making/test_cross_exchange_market_making.py
d3alek/hummingbot
14d6c3b8c4d34c44079c45ef6cd05e9c192f241c
[ "Apache-2.0" ]
null
null
null
import logging import unittest from decimal import Decimal from math import ceil, floor from typing import List import pandas as pd from nose.plugins.attrib import attr from hummingbot.connector.exchange.paper_trade.paper_trade_exchange import QuantizationParams from hummingbot.core.clock import Clock, ClockMode from hummingbot.core.data_type.limit_order import LimitOrder from hummingbot.core.data_type.order_book import OrderBook from hummingbot.core.data_type.order_book_row import OrderBookRow from hummingbot.core.data_type.trade_fee import AddedToCostTradeFee from hummingbot.core.event.event_logger import EventLogger from hummingbot.core.event.events import ( BuyOrderCompletedEvent, BuyOrderCreatedEvent, MarketEvent, OrderBookTradeEvent, OrderFilledEvent, OrderType, SellOrderCreatedEvent, SellOrderCompletedEvent, TradeType, ) from hummingbot.strategy.cross_exchange_market_making import CrossExchangeMarketMakingStrategy from hummingbot.strategy.cross_exchange_market_making.cross_exchange_market_pair import CrossExchangeMarketPair from hummingbot.strategy.market_trading_pair_tuple import MarketTradingPairTuple from test.mock.mock_paper_exchange import MockPaperExchange logging.basicConfig(level=logging.ERROR) @attr("stable") class HedgedMarketMakingUnitTest(unittest.TestCase): start: pd.Timestamp = pd.Timestamp("2019-01-01", tz="UTC") end: pd.Timestamp = pd.Timestamp("2019-01-01 01:00:00", tz="UTC") start_timestamp: float = start.timestamp() end_timestamp: float = end.timestamp() maker_trading_pairs: List[str] = ["COINALPHA-WETH", "COINALPHA", "WETH"] taker_trading_pairs: List[str] = ["COINALPHA-ETH", "COINALPHA", "ETH"] def setUp(self): self.clock: Clock = Clock(ClockMode.BACKTEST, 1.0, self.start_timestamp, self.end_timestamp) self.min_profitbality = Decimal("0.005") self.maker_market: MockPaperExchange = MockPaperExchange() self.taker_market: MockPaperExchange = MockPaperExchange() self.maker_market.set_balanced_order_book(self.maker_trading_pairs[0], 1.0, 0.5, 1.5, 0.01, 10) self.taker_market.set_balanced_order_book(self.taker_trading_pairs[0], 1.0, 0.5, 1.5, 0.001, 4) self.maker_market.set_balance("COINALPHA", 5) self.maker_market.set_balance("WETH", 5) self.maker_market.set_balance("QETH", 5) self.taker_market.set_balance("COINALPHA", 5) self.taker_market.set_balance("ETH", 5) self.maker_market.set_quantization_param(QuantizationParams(self.maker_trading_pairs[0], 5, 5, 5, 5)) self.taker_market.set_quantization_param(QuantizationParams(self.taker_trading_pairs[0], 5, 5, 5, 5)) self.market_pair: CrossExchangeMarketPair = CrossExchangeMarketPair( MarketTradingPairTuple(self.maker_market, *self.maker_trading_pairs), MarketTradingPairTuple(self.taker_market, *self.taker_trading_pairs), ) logging_options: int = ( CrossExchangeMarketMakingStrategy.OPTION_LOG_ALL & (~CrossExchangeMarketMakingStrategy.OPTION_LOG_NULL_ORDER_SIZE) ) self.strategy: CrossExchangeMarketMakingStrategy = CrossExchangeMarketMakingStrategy() self.strategy.init_params( [self.market_pair], order_size_portfolio_ratio_limit=Decimal("0.3"), min_profitability=Decimal(self.min_profitbality), logging_options=logging_options, slippage_buffer=Decimal("0"), ) self.strategy_with_top_depth_tolerance: CrossExchangeMarketMakingStrategy = CrossExchangeMarketMakingStrategy() self.strategy_with_top_depth_tolerance.init_params( [self.market_pair], order_size_portfolio_ratio_limit=Decimal("0.3"), min_profitability=Decimal(self.min_profitbality), logging_options=logging_options, top_depth_tolerance=1, slippage_buffer=Decimal("0"), ) self.logging_options = logging_options self.clock.add_iterator(self.maker_market) self.clock.add_iterator(self.taker_market) self.clock.add_iterator(self.strategy) self.maker_order_fill_logger: EventLogger = EventLogger() self.taker_order_fill_logger: EventLogger = EventLogger() self.cancel_order_logger: EventLogger = EventLogger() self.maker_order_created_logger: EventLogger = EventLogger() self.taker_order_created_logger: EventLogger = EventLogger() self.maker_market.add_listener(MarketEvent.OrderFilled, self.maker_order_fill_logger) self.taker_market.add_listener(MarketEvent.OrderFilled, self.taker_order_fill_logger) self.maker_market.add_listener(MarketEvent.OrderCancelled, self.cancel_order_logger) self.maker_market.add_listener(MarketEvent.BuyOrderCreated, self.maker_order_created_logger) self.maker_market.add_listener(MarketEvent.SellOrderCreated, self.maker_order_created_logger) self.taker_market.add_listener(MarketEvent.BuyOrderCreated, self.taker_order_created_logger) self.taker_market.add_listener(MarketEvent.SellOrderCreated, self.taker_order_created_logger) def simulate_maker_market_trade(self, is_buy: bool, quantity: Decimal, price: Decimal): maker_trading_pair: str = self.maker_trading_pairs[0] order_book: OrderBook = self.maker_market.get_order_book(maker_trading_pair) trade_event: OrderBookTradeEvent = OrderBookTradeEvent( maker_trading_pair, self.clock.current_timestamp, TradeType.BUY if is_buy else TradeType.SELL, price, quantity ) order_book.apply_trade(trade_event) @staticmethod def simulate_order_book_widening(order_book: OrderBook, top_bid: float, top_ask: float): bid_diffs: List[OrderBookRow] = [] ask_diffs: List[OrderBookRow] = [] update_id: int = order_book.last_diff_uid + 1 for row in order_book.bid_entries(): if row.price > top_bid: bid_diffs.append(OrderBookRow(row.price, 0, update_id)) else: break for row in order_book.ask_entries(): if row.price < top_ask: ask_diffs.append(OrderBookRow(row.price, 0, update_id)) else: break order_book.apply_diffs(bid_diffs, ask_diffs, update_id) @staticmethod def simulate_limit_order_fill(market: MockPaperExchange, limit_order: LimitOrder): quote_currency_traded: Decimal = limit_order.price * limit_order.quantity base_currency_traded: Decimal = limit_order.quantity quote_currency: str = limit_order.quote_currency base_currency: str = limit_order.base_currency if limit_order.is_buy: market.set_balance(quote_currency, market.get_balance(quote_currency) - quote_currency_traded) market.set_balance(base_currency, market.get_balance(base_currency) + base_currency_traded) market.trigger_event( MarketEvent.BuyOrderCreated, BuyOrderCreatedEvent( market.current_timestamp, OrderType.LIMIT, limit_order.trading_pair, limit_order.quantity, limit_order.price, limit_order.client_order_id, limit_order.creation_timestamp * 1e-6 ) ) market.trigger_event( MarketEvent.OrderFilled, OrderFilledEvent( market.current_timestamp, limit_order.client_order_id, limit_order.trading_pair, TradeType.BUY, OrderType.LIMIT, limit_order.price, limit_order.quantity, AddedToCostTradeFee(Decimal(0)), ), ) market.trigger_event( MarketEvent.BuyOrderCompleted, BuyOrderCompletedEvent( market.current_timestamp, limit_order.client_order_id, base_currency, quote_currency, quote_currency, base_currency_traded, quote_currency_traded, Decimal(0), OrderType.LIMIT, ), ) else: market.set_balance(quote_currency, market.get_balance(quote_currency) + quote_currency_traded) market.set_balance(base_currency, market.get_balance(base_currency) - base_currency_traded) market.trigger_event( MarketEvent.BuyOrderCreated, SellOrderCreatedEvent( market.current_timestamp, OrderType.LIMIT, limit_order.trading_pair, limit_order.quantity, limit_order.price, limit_order.client_order_id, limit_order.creation_timestamp * 1e-6, ) ) market.trigger_event( MarketEvent.OrderFilled, OrderFilledEvent( market.current_timestamp, limit_order.client_order_id, limit_order.trading_pair, TradeType.SELL, OrderType.LIMIT, limit_order.price, limit_order.quantity, AddedToCostTradeFee(Decimal(0)), ), ) market.trigger_event( MarketEvent.SellOrderCompleted, SellOrderCompletedEvent( market.current_timestamp, limit_order.client_order_id, base_currency, quote_currency, quote_currency, base_currency_traded, quote_currency_traded, Decimal(0), OrderType.LIMIT, ), ) @staticmethod def emit_order_created_event(market: MockPaperExchange, order: LimitOrder): event_cls = BuyOrderCreatedEvent if order.is_buy else SellOrderCreatedEvent event_tag = MarketEvent.BuyOrderCreated if order.is_buy else MarketEvent.SellOrderCreated market.trigger_event( event_tag, message=event_cls( order.creation_timestamp, OrderType.LIMIT, order.trading_pair, order.quantity, order.price, order.client_order_id, order.creation_timestamp * 1e-6 ) ) def test_both_sides_profitable(self): self.clock.backtest_til(self.start_timestamp + 5) self.assertEqual(1, len(self.strategy.active_bids)) self.assertEqual(1, len(self.strategy.active_asks)) bid_order: LimitOrder = self.strategy.active_bids[0][1] ask_order: LimitOrder = self.strategy.active_asks[0][1] self.assertEqual(Decimal("0.99451"), bid_order.price) self.assertEqual(Decimal("1.0055"), ask_order.price) self.assertEqual(Decimal("3.0"), bid_order.quantity) self.assertEqual(Decimal("3.0"), ask_order.quantity) self.simulate_maker_market_trade(False, Decimal("10.0"), bid_order.price * Decimal("0.99")) self.clock.backtest_til(self.start_timestamp + 10) self.assertEqual(1, len(self.maker_order_fill_logger.event_log)) self.assertEqual(1, len(self.taker_order_fill_logger.event_log)) maker_fill: OrderFilledEvent = self.maker_order_fill_logger.event_log[0] taker_fill: OrderFilledEvent = self.taker_order_fill_logger.event_log[0] self.assertEqual(TradeType.BUY, maker_fill.trade_type) self.assertEqual(TradeType.SELL, taker_fill.trade_type) self.assertAlmostEqual(Decimal("0.99451"), maker_fill.price) self.assertAlmostEqual(Decimal("0.9995"), taker_fill.price) self.assertAlmostEqual(Decimal("3.0"), maker_fill.amount) self.assertAlmostEqual(Decimal("3.0"), taker_fill.amount) def test_top_depth_tolerance(self): # TODO self.clock.remove_iterator(self.strategy) self.clock.add_iterator(self.strategy_with_top_depth_tolerance) self.clock.backtest_til(self.start_timestamp + 5) bid_order: LimitOrder = self.strategy_with_top_depth_tolerance.active_bids[0][1] ask_order: LimitOrder = self.strategy_with_top_depth_tolerance.active_asks[0][1] self.taker_market.trigger_event( MarketEvent.BuyOrderCreated, BuyOrderCreatedEvent( self.start_timestamp + 5, OrderType.LIMIT, bid_order.trading_pair, bid_order.quantity, bid_order.price, bid_order.client_order_id, bid_order.creation_timestamp * 1e-6, ) ) self.taker_market.trigger_event( MarketEvent.SellOrderCreated, SellOrderCreatedEvent( self.start_timestamp + 5, OrderType.LIMIT, ask_order.trading_pair, ask_order.quantity, ask_order.price, ask_order.client_order_id, ask_order.creation_timestamp * 1e-6, ) ) self.assertEqual(Decimal("0.99451"), bid_order.price) self.assertEqual(Decimal("1.0055"), ask_order.price) self.assertEqual(Decimal("3.0"), bid_order.quantity) self.assertEqual(Decimal("3.0"), ask_order.quantity) self.simulate_order_book_widening(self.taker_market.order_books[self.taker_trading_pairs[0]], 0.99, 1.01) self.clock.backtest_til(self.start_timestamp + 100) self.assertEqual(2, len(self.cancel_order_logger.event_log)) self.assertEqual(1, len(self.strategy_with_top_depth_tolerance.active_bids)) self.assertEqual(1, len(self.strategy_with_top_depth_tolerance.active_asks)) bid_order = self.strategy_with_top_depth_tolerance.active_bids[0][1] ask_order = self.strategy_with_top_depth_tolerance.active_asks[0][1] self.assertEqual(Decimal("0.98457"), bid_order.price) self.assertEqual(Decimal("1.0155"), ask_order.price) def test_market_became_wider(self): self.clock.backtest_til(self.start_timestamp + 5) bid_order: LimitOrder = self.strategy.active_bids[0][1] ask_order: LimitOrder = self.strategy.active_asks[0][1] self.assertEqual(Decimal("0.99451"), bid_order.price) self.assertEqual(Decimal("1.0055"), ask_order.price) self.assertEqual(Decimal("3.0"), bid_order.quantity) self.assertEqual(Decimal("3.0"), ask_order.quantity) self.taker_market.trigger_event( MarketEvent.BuyOrderCreated, BuyOrderCreatedEvent( self.start_timestamp + 5, OrderType.LIMIT, bid_order.trading_pair, bid_order.quantity, bid_order.price, bid_order.client_order_id, bid_order.creation_timestamp * 1e-6, ) ) self.taker_market.trigger_event( MarketEvent.SellOrderCreated, SellOrderCreatedEvent( self.start_timestamp + 5, OrderType.LIMIT, ask_order.trading_pair, ask_order.quantity, ask_order.price, ask_order.client_order_id, bid_order.creation_timestamp * 1e-6, ) ) self.simulate_order_book_widening(self.taker_market.order_books[self.taker_trading_pairs[0]], 0.99, 1.01) self.clock.backtest_til(self.start_timestamp + 100) self.assertEqual(2, len(self.cancel_order_logger.event_log)) self.assertEqual(1, len(self.strategy.active_bids)) self.assertEqual(1, len(self.strategy.active_asks)) bid_order = self.strategy.active_bids[0][1] ask_order = self.strategy.active_asks[0][1] self.assertEqual(Decimal("0.98457"), bid_order.price) self.assertEqual(Decimal("1.0155"), ask_order.price) def test_market_became_narrower(self): self.clock.backtest_til(self.start_timestamp + 5) bid_order: LimitOrder = self.strategy.active_bids[0][1] ask_order: LimitOrder = self.strategy.active_asks[0][1] self.assertEqual(Decimal("0.99451"), bid_order.price) self.assertEqual(Decimal("1.0055"), ask_order.price) self.assertEqual(Decimal("3.0"), bid_order.quantity) self.assertEqual(Decimal("3.0"), ask_order.quantity) self.maker_market.order_books[self.maker_trading_pairs[0]].apply_diffs( [OrderBookRow(0.996, 30, 2)], [OrderBookRow(1.004, 30, 2)], 2) self.clock.backtest_til(self.start_timestamp + 10) self.assertEqual(0, len(self.cancel_order_logger.event_log)) self.assertEqual(1, len(self.strategy.active_bids)) self.assertEqual(1, len(self.strategy.active_asks)) bid_order = self.strategy.active_bids[0][1] ask_order = self.strategy.active_asks[0][1] self.assertEqual(Decimal("0.99451"), bid_order.price) self.assertEqual(Decimal("1.0055"), ask_order.price) def test_order_fills_after_cancellation(self): # TODO self.clock.backtest_til(self.start_timestamp + 5) bid_order: LimitOrder = self.strategy.active_bids[0][1] ask_order: LimitOrder = self.strategy.active_asks[0][1] self.assertEqual(Decimal("0.99451"), bid_order.price) self.assertEqual(Decimal("1.0055"), ask_order.price) self.assertEqual(Decimal("3.0"), bid_order.quantity) self.assertEqual(Decimal("3.0"), ask_order.quantity) self.taker_market.trigger_event( MarketEvent.BuyOrderCreated, BuyOrderCreatedEvent( self.start_timestamp + 5, OrderType.LIMIT, bid_order.trading_pair, bid_order.quantity, bid_order.price, bid_order.client_order_id, bid_order.creation_timestamp * 1e-6, ) ) self.taker_market.trigger_event( MarketEvent.SellOrderCreated, SellOrderCreatedEvent( self.start_timestamp + 5, OrderType.LIMIT, ask_order.trading_pair, ask_order.quantity, ask_order.price, ask_order.client_order_id, ask_order.creation_timestamp * 1e-6, ) ) self.simulate_order_book_widening(self.taker_market.order_books[self.taker_trading_pairs[0]], 0.99, 1.01) self.clock.backtest_til(self.start_timestamp + 10) self.assertEqual(2, len(self.cancel_order_logger.event_log)) self.assertEqual(1, len(self.strategy.active_bids)) self.assertEqual(1, len(self.strategy.active_asks)) bid_order = self.strategy.active_bids[0][1] ask_order = self.strategy.active_asks[0][1] self.assertEqual(Decimal("0.98457"), bid_order.price) self.assertEqual(Decimal("1.0155"), ask_order.price) self.clock.backtest_til(self.start_timestamp + 20) self.simulate_limit_order_fill(self.maker_market, bid_order) self.simulate_limit_order_fill(self.maker_market, ask_order) self.clock.backtest_til(self.start_timestamp + 25) fill_events: List[OrderFilledEvent] = self.taker_order_fill_logger.event_log bid_hedges: List[OrderFilledEvent] = [evt for evt in fill_events if evt.trade_type is TradeType.SELL] ask_hedges: List[OrderFilledEvent] = [evt for evt in fill_events if evt.trade_type is TradeType.BUY] self.assertEqual(1, len(bid_hedges)) self.assertEqual(1, len(ask_hedges)) self.assertGreater( self.maker_market.get_balance(self.maker_trading_pairs[2]) + self.taker_market.get_balance(self.taker_trading_pairs[2]), Decimal("10"), ) self.assertEqual(2, len(self.taker_order_fill_logger.event_log)) taker_fill1: OrderFilledEvent = self.taker_order_fill_logger.event_log[0] self.assertEqual(TradeType.SELL, taker_fill1.trade_type) self.assertAlmostEqual(Decimal("0.9895"), taker_fill1.price) self.assertAlmostEqual(Decimal("3.0"), taker_fill1.amount) taker_fill2: OrderFilledEvent = self.taker_order_fill_logger.event_log[1] self.assertEqual(TradeType.BUY, taker_fill2.trade_type) self.assertAlmostEqual(Decimal("1.0105"), taker_fill2.price) self.assertAlmostEqual(Decimal("3.0"), taker_fill2.amount) def test_with_conversion(self): self.clock.remove_iterator(self.strategy) self.market_pair: CrossExchangeMarketPair = CrossExchangeMarketPair( MarketTradingPairTuple(self.maker_market, *["COINALPHA-QETH", "COINALPHA", "QETH"]), MarketTradingPairTuple(self.taker_market, *self.taker_trading_pairs), ) self.maker_market.set_balanced_order_book("COINALPHA-QETH", 1.05, 0.55, 1.55, 0.01, 10) self.strategy: CrossExchangeMarketMakingStrategy = CrossExchangeMarketMakingStrategy() self.strategy.init_params( [self.market_pair], Decimal("0.01"), order_size_portfolio_ratio_limit=Decimal("0.3"), logging_options=self.logging_options, taker_to_maker_base_conversion_rate=Decimal("0.95") ) self.clock.add_iterator(self.strategy) self.clock.backtest_til(self.start_timestamp + 5) self.assertEqual(1, len(self.strategy.active_bids)) self.assertEqual(1, len(self.strategy.active_asks)) bid_order: LimitOrder = self.strategy.active_bids[0][1] ask_order: LimitOrder = self.strategy.active_asks[0][1] self.assertAlmostEqual(Decimal("1.0417"), round(bid_order.price, 4)) self.assertAlmostEqual(Decimal("1.0636"), round(ask_order.price, 4)) self.assertAlmostEqual(Decimal("2.9286"), round(bid_order.quantity, 4)) self.assertAlmostEqual(Decimal("2.9286"), round(ask_order.quantity, 4)) def test_maker_price(self): buy_taker_price: Decimal = round(self.strategy.get_effective_hedging_price(self.market_pair, False, 3), 4) sell_taker_price: Decimal = round(self.strategy.get_effective_hedging_price(self.market_pair, True, 3), 4) price_quantum = Decimal("0.0001") self.assertEqual(Decimal("1.0004"), buy_taker_price) self.assertEqual(Decimal("0.9995"), sell_taker_price) self.clock.backtest_til(self.start_timestamp + 5) bid_order: LimitOrder = self.strategy.active_bids[0][1] ask_order: LimitOrder = self.strategy.active_asks[0][1] bid_maker_price = sell_taker_price * (1 - self.min_profitbality) bid_maker_price = (floor(bid_maker_price / price_quantum)) * price_quantum ask_maker_price = buy_taker_price * (1 + self.min_profitbality) ask_maker_price = (ceil(ask_maker_price / price_quantum) * price_quantum) self.assertEqual(bid_maker_price, round(bid_order.price, 4)) self.assertEqual(ask_maker_price, round(ask_order.price, 4)) self.assertEqual(Decimal("3.0"), bid_order.quantity) self.assertEqual(Decimal("3.0"), ask_order.quantity) def test_with_adjust_orders_enabled(self): self.clock.remove_iterator(self.strategy) self.clock.remove_iterator(self.maker_market) self.maker_market: MockPaperExchange = MockPaperExchange() self.maker_market.set_balanced_order_book(self.maker_trading_pairs[0], 1.0, 0.5, 1.5, 0.1, 10) self.market_pair: CrossExchangeMarketPair = CrossExchangeMarketPair( MarketTradingPairTuple(self.maker_market, *self.maker_trading_pairs), MarketTradingPairTuple(self.taker_market, *self.taker_trading_pairs), ) self.strategy: CrossExchangeMarketMakingStrategy = CrossExchangeMarketMakingStrategy() self.strategy.init_params( [self.market_pair], order_size_portfolio_ratio_limit=Decimal("0.3"), min_profitability=Decimal("0.005"), logging_options=self.logging_options, ) self.maker_market.set_balance("COINALPHA", 5) self.maker_market.set_balance("WETH", 5) self.maker_market.set_balance("QETH", 5) self.maker_market.set_quantization_param(QuantizationParams(self.maker_trading_pairs[0], 4, 4, 4, 4)) self.clock.add_iterator(self.strategy) self.clock.add_iterator(self.maker_market) self.clock.backtest_til(self.start_timestamp + 5) self.assertEqual(1, len(self.strategy.active_bids)) self.assertEqual(1, len(self.strategy.active_asks)) bid_order: LimitOrder = self.strategy.active_bids[0][1] ask_order: LimitOrder = self.strategy.active_asks[0][1] # place above top bid (at 0.95) self.assertAlmostEqual(Decimal("0.9500"), bid_order.price) # place below top ask (at 1.05) self.assertAlmostEqual(Decimal("1.049"), ask_order.price) self.assertAlmostEqual(Decimal("3"), round(bid_order.quantity, 4)) self.assertAlmostEqual(Decimal("3"), round(ask_order.quantity, 4)) def test_with_adjust_orders_disabled(self): self.clock.remove_iterator(self.strategy) self.clock.remove_iterator(self.maker_market) self.maker_market: MockPaperExchange = MockPaperExchange() self.maker_market.set_balanced_order_book(self.maker_trading_pairs[0], 1.0, 0.5, 1.5, 0.1, 10) self.taker_market.set_balanced_order_book(self.taker_trading_pairs[0], 1.0, 0.5, 1.5, 0.001, 20) self.market_pair: CrossExchangeMarketPair = CrossExchangeMarketPair( MarketTradingPairTuple(self.maker_market, *self.maker_trading_pairs), MarketTradingPairTuple(self.taker_market, *self.taker_trading_pairs), ) self.strategy: CrossExchangeMarketMakingStrategy = CrossExchangeMarketMakingStrategy() self.strategy.init_params( [self.market_pair], order_size_portfolio_ratio_limit=Decimal("0.3"), min_profitability=Decimal("0.005"), logging_options=self.logging_options, adjust_order_enabled=False ) self.maker_market.set_balance("COINALPHA", 5) self.maker_market.set_balance("WETH", 5) self.maker_market.set_balance("QETH", 5) self.maker_market.set_quantization_param(QuantizationParams(self.maker_trading_pairs[0], 4, 4, 4, 4)) self.clock.add_iterator(self.strategy) self.clock.add_iterator(self.maker_market) self.clock.backtest_til(self.start_timestamp + 5) self.assertEqual(1, len(self.strategy.active_bids)) self.assertEqual(1, len(self.strategy.active_asks)) bid_order: LimitOrder = self.strategy.active_bids[0][1] ask_order: LimitOrder = self.strategy.active_asks[0][1] self.assertEqual(Decimal("0.9945"), bid_order.price) self.assertEqual(Decimal("1.006"), ask_order.price) self.assertAlmostEqual(Decimal("3"), round(bid_order.quantity, 4)) self.assertAlmostEqual(Decimal("3"), round(ask_order.quantity, 4)) def test_price_and_size_limit_calculation(self): self.taker_market.set_balanced_order_book(self.taker_trading_pairs[0], 1.0, 0.5, 1.5, 0.001, 20) bid_size = self.strategy.get_market_making_size(self.market_pair, True) bid_price = self.strategy.get_market_making_price(self.market_pair, True, bid_size) ask_size = self.strategy.get_market_making_size(self.market_pair, False) ask_price = self.strategy.get_market_making_price(self.market_pair, False, ask_size) self.assertEqual((Decimal("0.99451"), Decimal("3")), (bid_price, bid_size)) self.assertEqual((Decimal("1.0055"), Decimal("3")), (ask_price, ask_size)) def test_price_and_size_limit_calculation_with_slippage_buffer(self): self.taker_market.set_balance("ETH", 3) self.taker_market.set_balanced_order_book( self.taker_trading_pairs[0], mid_price=Decimal("1.0"), min_price=Decimal("0.5"), max_price=Decimal("1.5"), price_step_size=Decimal("0.1"), volume_step_size=Decimal("100"), ) self.strategy: CrossExchangeMarketMakingStrategy = CrossExchangeMarketMakingStrategy() self.strategy.init_params( [self.market_pair], order_size_taker_volume_factor=Decimal("1"), order_size_taker_balance_factor=Decimal("1"), order_size_portfolio_ratio_limit=Decimal("1"), min_profitability=Decimal("0.25"), logging_options=self.logging_options, slippage_buffer=Decimal("0"), order_amount=Decimal("4"), ) strategy_with_slippage_buffer: CrossExchangeMarketMakingStrategy = CrossExchangeMarketMakingStrategy() strategy_with_slippage_buffer.init_params( [self.market_pair], order_size_taker_volume_factor=Decimal("1"), order_size_taker_balance_factor=Decimal("1"), order_size_portfolio_ratio_limit=Decimal("1"), min_profitability=Decimal("0.25"), logging_options=self.logging_options, slippage_buffer=Decimal("0.25"), order_amount=Decimal("4"), ) bid_size = self.strategy.get_market_making_size(self.market_pair, True) bid_price = self.strategy.get_market_making_price(self.market_pair, True, bid_size) ask_size = self.strategy.get_market_making_size(self.market_pair, False) ask_price = self.strategy.get_market_making_price(self.market_pair, False, ask_size) slippage_bid_size = strategy_with_slippage_buffer.get_market_making_size(self.market_pair, True) slippage_bid_price = strategy_with_slippage_buffer.get_market_making_price( self.market_pair, True, slippage_bid_size ) slippage_ask_size = strategy_with_slippage_buffer.get_market_making_size(self.market_pair, False) slippage_ask_price = strategy_with_slippage_buffer.get_market_making_price( self.market_pair, False, slippage_ask_size ) self.assertEqual(Decimal("4"), bid_size) # the user size self.assertEqual(Decimal("0.75999"), bid_price) # price = bid_VWAP(4) / profitability = 0.95 / 1.25 self.assertEqual(Decimal("2.8571"), ask_size) # size = balance / (ask_VWAP(3) * slippage) = 3 / (1.05 * 1) self.assertEqual(Decimal("1.3125"), ask_price) # price = ask_VWAP(2.8571) * profitability = 1.05 * 1.25 self.assertEqual(Decimal("4"), slippage_bid_size) # the user size self.assertEqual(Decimal("0.75999"), slippage_bid_price) # price = bid_VWAP(4) / profitability = 0.9 / 1.25 self.assertEqual(Decimal("2.2857"), slippage_ask_size) # size = balance / (ask_VWAP(3) * slippage) = 3 / (1.05 * 1.25) self.assertEqual(Decimal("1.3125"), slippage_ask_price) # price = ask_VWAP(2.2857) * profitability = 1.05 * 1.25 def test_check_if_sufficient_balance_adjusts_including_slippage(self): self.taker_market.set_balance("COINALPHA", 4) self.taker_market.set_balance("ETH", 3) self.taker_market.set_balanced_order_book( self.taker_trading_pairs[0], mid_price=Decimal("1.0"), min_price=Decimal("0.5"), max_price=Decimal("1.5"), price_step_size=Decimal("0.1"), volume_step_size=Decimal("1"), ) strategy_with_slippage_buffer: CrossExchangeMarketMakingStrategy = CrossExchangeMarketMakingStrategy() strategy_with_slippage_buffer.init_params( [self.market_pair], order_size_taker_volume_factor=Decimal("1"), order_size_taker_balance_factor=Decimal("1"), order_size_portfolio_ratio_limit=Decimal("1"), min_profitability=Decimal("0.25"), logging_options=self.logging_options, slippage_buffer=Decimal("0.25"), order_amount=Decimal("4"), ) self.clock.remove_iterator(self.strategy) self.clock.add_iterator(strategy_with_slippage_buffer) self.clock.backtest_til(self.start_timestamp + 1) active_bids = strategy_with_slippage_buffer.active_bids active_asks = strategy_with_slippage_buffer.active_asks self.assertEqual(1, len(active_bids)) self.assertEqual(1, len(active_asks)) active_bid = active_bids[0][1] active_ask = active_asks[0][1] self.emit_order_created_event(self.maker_market, active_bid) self.emit_order_created_event(self.maker_market, active_ask) self.clock.backtest_til(self.start_timestamp + 2) active_bids = strategy_with_slippage_buffer.active_bids active_asks = strategy_with_slippage_buffer.active_asks self.assertEqual(1, len(active_bids)) self.assertEqual(1, len(active_asks)) active_bid = active_bids[0][1] active_ask = active_asks[0][1] bids_quantum = self.taker_market.get_order_size_quantum( self.taker_trading_pairs[0], active_bid.quantity ) asks_quantum = self.taker_market.get_order_size_quantum( self.taker_trading_pairs[0], active_ask.quantity ) self.taker_market.set_balance("COINALPHA", Decimal("4") - bids_quantum) self.taker_market.set_balance("ETH", Decimal("3") - asks_quantum * 1) self.clock.backtest_til(self.start_timestamp + 3) active_bids = strategy_with_slippage_buffer.active_bids active_asks = strategy_with_slippage_buffer.active_asks self.assertEqual(0, len(active_bids)) # cancelled self.assertEqual(0, len(active_asks)) # cancelled self.clock.backtest_til(self.start_timestamp + 4) new_active_bids = strategy_with_slippage_buffer.active_bids new_active_asks = strategy_with_slippage_buffer.active_asks self.assertEqual(1, len(new_active_bids)) self.assertEqual(1, len(new_active_asks)) new_active_bid = new_active_bids[0][1] new_active_ask = new_active_asks[0][1] self.assertEqual(Decimal(str(active_bid.quantity - bids_quantum)), new_active_bid.quantity) self.assertEqual(Decimal(str(active_ask.quantity - asks_quantum)), new_active_ask.quantity) def test_empty_maker_orderbook(self): self.clock.remove_iterator(self.strategy) self.clock.remove_iterator(self.maker_market) self.maker_market: MockPaperExchange = MockPaperExchange() # Orderbook is empty self.maker_market.new_empty_order_book(self.maker_trading_pairs[0]) self.market_pair: CrossExchangeMarketPair = CrossExchangeMarketPair( MarketTradingPairTuple(self.maker_market, *self.maker_trading_pairs), MarketTradingPairTuple(self.taker_market, *self.taker_trading_pairs), ) self.strategy: CrossExchangeMarketMakingStrategy = CrossExchangeMarketMakingStrategy() self.strategy.init_params( [self.market_pair], order_amount=1, min_profitability=Decimal("0.005"), logging_options=self.logging_options, adjust_order_enabled=False ) self.maker_market.set_balance("COINALPHA", 5) self.maker_market.set_balance("WETH", 5) self.maker_market.set_balance("QETH", 5) self.maker_market.set_quantization_param(QuantizationParams(self.maker_trading_pairs[0], 4, 4, 4, 4)) self.clock.add_iterator(self.strategy) self.clock.add_iterator(self.maker_market) self.clock.backtest_til(self.start_timestamp + 5) self.assertEqual(1, len(self.strategy.active_bids)) self.assertEqual(1, len(self.strategy.active_asks)) bid_order: LimitOrder = self.strategy.active_bids[0][1] ask_order: LimitOrder = self.strategy.active_asks[0][1] # Places orders based on taker orderbook self.assertEqual(Decimal("0.9945"), bid_order.price) self.assertEqual(Decimal("1.006"), ask_order.price) self.assertAlmostEqual(Decimal("1"), round(bid_order.quantity, 4)) self.assertAlmostEqual(Decimal("1"), round(ask_order.quantity, 4))
48.849132
132
0.672816
4,310
36,588
5.409977
0.062645
0.057254
0.030879
0.022816
0.81284
0.77184
0.712656
0.668439
0.638204
0.620234
0
0.028663
0.229529
36,588
748
133
48.914439
0.798475
0.013802
0
0.579341
0
0
0.018993
0
0
0
0
0.001337
0.164671
1
0.026946
false
0
0.028443
0
0.065868
0
0
0
0
null
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
13448b8c2c1210837607a3fff553421d1b976daa
233
py
Python
urls.py
Cantemo/FileSysArchivePlugin
8b0c5d3135d3451d44b3aa7376bdfb5ff4c82c2e
[ "BSD-3-Clause" ]
1
2016-02-16T15:17:05.000Z
2016-02-16T15:17:05.000Z
urls.py
Cantemo/FileSysArchivePlugin
8b0c5d3135d3451d44b3aa7376bdfb5ff4c82c2e
[ "BSD-3-Clause" ]
null
null
null
urls.py
Cantemo/FileSysArchivePlugin
8b0c5d3135d3451d44b3aa7376bdfb5ff4c82c2e
[ "BSD-3-Clause" ]
null
null
null
from django.conf.urls import url from .views import FileSysArchiveSettings urlpatterns = [ url(r'^filesysarchive_example/settings/$', FileSysArchiveSettings.as_view(), name='filesysarchive_example_settings'), ]
23.3
48
0.742489
23
233
7.347826
0.695652
0.248521
0.343195
0
0
0
0
0
0
0
0
0
0.158798
233
9
49
25.888889
0.862245
0
0
0
0
0
0.280172
0.280172
0
0
0
0
0
1
0
false
0
0.285714
0
0.285714
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
0
0
0
0
0
4
1356cd5561370a2ef8db8e8361431a2c7e11050a
162
py
Python
tests/syntax/assign_name_before_global_1.py
friendly-traceback/friendly-traceback
4f6785f14c271a4d6412ef19c140f9d380cdbcbf
[ "MIT" ]
45
2021-07-06T03:30:20.000Z
2022-03-16T17:30:58.000Z
tests/syntax/assign_name_before_global_1.py
friendly-traceback/friendly-traceback
4f6785f14c271a4d6412ef19c140f9d380cdbcbf
[ "MIT" ]
110
2021-06-28T11:48:46.000Z
2022-03-25T20:41:25.000Z
tests/syntax/assign_name_before_global_1.py
friendly-traceback/friendly-traceback
4f6785f14c271a4d6412ef19c140f9d380cdbcbf
[ "MIT" ]
4
2021-07-05T20:56:39.000Z
2021-11-11T20:24:34.000Z
"""Should raise SyntaxError: name 'cc' is assigned to prior to global declaration """ aa, bb, cc, dd = 1, 2, 3, 4 def fn(): cc = 1 global aa, bb, cc, dd
20.25
81
0.604938
29
162
3.37931
0.689655
0.081633
0.122449
0.163265
0
0
0
0
0
0
0
0.041322
0.253086
162
7
82
23.142857
0.768595
0.481481
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0
0
0.25
0
1
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
1
0
0
0
0
0
0
0
4
135d713384d33ebd8f0f6d4e790ffae5c8f03439
92
py
Python
tests/db.py
jiyulongxu/sql-tricks
6eee96849ce09d46dd15ec0f48b6022bd5738fff
[ "Apache-2.0" ]
1
2022-02-21T03:09:26.000Z
2022-02-21T03:09:26.000Z
tests/db.py
jiyulongxu/sql-tricks
6eee96849ce09d46dd15ec0f48b6022bd5738fff
[ "Apache-2.0" ]
null
null
null
tests/db.py
jiyulongxu/sql-tricks
6eee96849ce09d46dd15ec0f48b6022bd5738fff
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- import sqlite3 import logging conn = sqlite3.connect('db.sqlite')
13.142857
35
0.673913
12
92
5.166667
0.833333
0
0
0
0
0
0
0
0
0
0
0.038462
0.152174
92
6
36
15.333333
0.75641
0.228261
0
0
0
0
0.132353
0
0
0
0
0
0
1
0
false
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
0
0
1
0
1
0
0
4
1366e7910e71bb63fc7fe5de9c54fc0483b27926
226
py
Python
testing/test_awswrangler/test_metadata.py
JPFrancoia/aws-data-wrangler
5b08087d79b42683b03be91ba5ebc12ad4bd2d3d
[ "Apache-2.0" ]
null
null
null
testing/test_awswrangler/test_metadata.py
JPFrancoia/aws-data-wrangler
5b08087d79b42683b03be91ba5ebc12ad4bd2d3d
[ "Apache-2.0" ]
null
null
null
testing/test_awswrangler/test_metadata.py
JPFrancoia/aws-data-wrangler
5b08087d79b42683b03be91ba5ebc12ad4bd2d3d
[ "Apache-2.0" ]
null
null
null
import awswrangler as wr def test_metadata(): assert wr.__version__ == "1.0.3" assert wr.__title__ == "awswrangler" assert wr.__description__ == "Pandas on AWS." assert wr.__license__ == "Apache License 2.0"
25.111111
49
0.685841
30
226
4.6
0.666667
0.231884
0
0
0
0
0
0
0
0
0
0.027473
0.19469
226
8
50
28.25
0.730769
0
0
0
0
0
0.212389
0
0
0
0
0
0.666667
1
0.166667
true
0
0.166667
0
0.333333
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
1
0
0
0
0
0
0
4
1394568c727f7835ee137f0fb07111fc90b433fb
158
py
Python
controller/routes.py
NataliaCarvalho03/iClinicAPI
0e68b3c93b56197dc947995350c713174778a6a0
[ "CC0-1.0" ]
null
null
null
controller/routes.py
NataliaCarvalho03/iClinicAPI
0e68b3c93b56197dc947995350c713174778a6a0
[ "CC0-1.0" ]
null
null
null
controller/routes.py
NataliaCarvalho03/iClinicAPI
0e68b3c93b56197dc947995350c713174778a6a0
[ "CC0-1.0" ]
null
null
null
from view.resources import Prescription, Sign_Up def get_routes(): return [ (Prescription, '/prescriptions'), (Sign_Up, '/signup'), ]
22.571429
48
0.626582
16
158
6
0.8125
0.125
0
0
0
0
0
0
0
0
0
0
0.240506
158
7
49
22.571429
0.8
0
0
0
0
0
0.132075
0
0
0
0
0
0
1
0.166667
true
0
0.166667
0.166667
0.5
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
0
1
0
0
0
4
13981881c4be6fde9613b288abe674f91d9b5ce7
13,793
py
Python
cpgames/modules/core/angrybirds/modules/sprites.py
Wasabii88/Games
33262ca1958207a24e57e3532feded7e275b1dd1
[ "MIT" ]
1
2022-02-27T10:33:41.000Z
2022-02-27T10:33:41.000Z
cpgames/modules/core/angrybirds/modules/sprites.py
beiwei365/Games
f6499f378802d3212a08aeca761191b58714b7f0
[ "MIT" ]
null
null
null
cpgames/modules/core/angrybirds/modules/sprites.py
beiwei365/Games
f6499f378802d3212a08aeca761191b58714b7f0
[ "MIT" ]
null
null
null
''' Function: 定义游戏精灵类 Author: Charles 微信公众号: Charles的皮卡丘 ''' import math import pygame import random from .misc import VelocityVector, VectorAddition '''猪''' class Pig(pygame.sprite.Sprite): def __init__(self, screen, images, loc_info, velocity=None, **kwargs): pygame.sprite.Sprite.__init__(self) assert len(loc_info) == 3 assert len(images) == 3 # 设置必要的属性常量 self.screen = screen self.loc_info = list(loc_info) self.velocity = VelocityVector() if velocity is None else velocity self.type = 'pig' self.is_dead = False self.elasticity = 0.8 self.switch_freq = 20 self.animate_count = 0 self.inverse_friction = 0.99 self.gravity = VelocityVector(0.2, math.pi) # 屏幕大小 self.screen_size = screen.get_rect().size self.screen_size = (self.screen_size[0], self.screen_size[1] - 50) # 导入图像 self.pig_images = images # 设置当前图像 self.image = random.choice(self.pig_images[:2]) '''画到屏幕上''' def draw(self): self.animate_count += 1 if (self.animate_count % self.switch_freq == 0) and (not self.is_dead): self.animate_count = 0 self.image = random.choice(self.pig_images[:2]) position = self.loc_info[0] - self.loc_info[2], self.loc_info[1] - self.loc_info[2] self.screen.blit(self.image, position) '''移动猪''' def move(self): # 根据重力改变猪的速度向量 self.velocity = VectorAddition(self.velocity, self.gravity) self.loc_info[0] += self.velocity.magnitude * math.sin(self.velocity.angle) self.loc_info[1] -= self.velocity.magnitude * math.cos(self.velocity.angle) self.velocity.magnitude *= self.inverse_friction # 宽度超出屏幕 if self.loc_info[0] > self.screen_size[0] - self.loc_info[2]: self.loc_info[0] = 2 * (self.screen_size[0] - self.loc_info[2]) - self.loc_info[0] self.velocity.angle *= -1 self.velocity.magnitude *= self.elasticity elif self.loc_info[0] < self.loc_info[2]: self.loc_info[0] = 2 * self.loc_info[2] - self.loc_info[0] self.velocity.angle *= -1 self.velocity.magnitude *= self.elasticity # 高度超出屏幕 if self.loc_info[1] > self.screen_size[1] - self.loc_info[2]: self.loc_info[1] = 2 * (self.screen_size[1] - self.loc_info[2]) - self.loc_info[1] self.velocity.angle = math.pi - self.velocity.angle self.velocity.magnitude *= self.elasticity elif self.loc_info[1] < self.loc_info[2]: self.loc_info[1] = 2 * self.loc_info[2] - self.loc_info[1] self.velocity.angle = math.pi - self.velocity.angle self.velocity.magnitude *= self.elasticity '''猪死掉了''' def setdead(self): self.is_dead = True self.image = self.pig_images[-1] '''小鸟''' class Bird(pygame.sprite.Sprite): def __init__(self, screen, images, loc_info, velocity=None, color=(255, 255, 255), **kwargs): pygame.sprite.Sprite.__init__(self) assert len(loc_info) == 3 assert len(images) == 1 # 设置必要的属性常量 self.color = color self.screen = screen self.images = images self.loc_info = list(loc_info) self.velocity = VelocityVector() if velocity is None else velocity self.type = 'bird' self.fly_path = [] self.is_dead = False self.elasticity = 0.8 self.is_loaded = False self.is_selected = False self.inverse_friction = 0.99 self.gravity = VelocityVector(0.2, math.pi) # 屏幕大小 self.screen_size = screen.get_rect().size self.screen_size = (self.screen_size[0], self.screen_size[1] - 50) # 导入图像 self.image = images[0] '''画到屏幕上''' def draw(self): if not self.is_loaded: for point in self.fly_path: pygame.draw.ellipse(self.screen, self.color, (point[0], point[1], 3, 3), 1) position = self.loc_info[0] - self.loc_info[2], self.loc_info[1] - self.loc_info[2] self.screen.blit(self.image, position) '''判断有没有被鼠标选中''' def selected(self): pos = pygame.mouse.get_pos() dx, dy = pos[0] - self.loc_info[0], pos[1] - self.loc_info[1] dist = math.hypot(dy, dx) if dist < self.loc_info[2]: return True return False '''加载到弹弓上''' def load(self, slingshot): self.loc_info[0], self.loc_info[1] = slingshot.x, slingshot.y self.is_loaded = True '''重新设置位置''' def reposition(self, slingshot): pos = pygame.mouse.get_pos() if self.selected: self.loc_info[0], self.loc_info[1] = pos[0], pos[1] dx, dy = slingshot.x - self.loc_info[0], slingshot.y - self.loc_info[1] self.velocity.magnitude = min(int(math.hypot(dx, dy) / 2), 80) self.velocity.angle = math.pi / 2 + math.atan2(dy, dx) '''显示发射小鸟的路径''' def projectpath(self): if self.is_loaded: path = [] bird = Bird(self.screen, self.images, self.loc_info, velocity=self.velocity) for i in range(30): bird.move() if i % 5 == 0: path.append((bird.loc_info[0], bird.loc_info[1])) for point in path: pygame.draw.ellipse(self.screen, self.color, (point[0], point[1], 2, 2)) '''移动小鸟''' def move(self): # 根据重力改变小鸟的速度向量 self.velocity = VectorAddition(self.velocity, self.gravity) self.loc_info[0] += self.velocity.magnitude * math.sin(self.velocity.angle) self.loc_info[1] -= self.velocity.magnitude * math.cos(self.velocity.angle) self.velocity.magnitude *= self.inverse_friction # 宽度超出屏幕 if self.loc_info[0] > self.screen_size[0] - self.loc_info[2]: self.loc_info[0] = 2 * (self.screen_size[0] - self.loc_info[2]) - self.loc_info[0] self.velocity.angle *= -1 self.velocity.magnitude *= self.elasticity elif self.loc_info[0] < self.loc_info[2]: self.loc_info[0] = 2 * self.loc_info[2] - self.loc_info[0] self.velocity.angle *= -1 self.velocity.magnitude *= self.elasticity # 高度超出屏幕 if self.loc_info[1] > self.screen_size[1] - self.loc_info[2]: self.loc_info[1] = 2 * (self.screen_size[1] - self.loc_info[2]) - self.loc_info[1] self.velocity.angle = math.pi - self.velocity.angle self.velocity.magnitude *= self.elasticity elif self.loc_info[1] < self.loc_info[2]: self.loc_info[1] = 2 * self.loc_info[2] - self.loc_info[1] self.velocity.angle = math.pi - self.velocity.angle self.velocity.magnitude *= self.elasticity '''地图里的木块''' class Block(pygame.sprite.Sprite): def __init__(self, screen, images, loc_info, velocity=None, **kwargs): pygame.sprite.Sprite.__init__(self) assert len(loc_info) == 3 assert len(images) == 2 # 设置必要的属性常量 self.type = 'block' self.screen = screen self.loc_info = list(loc_info) self.velocity = VelocityVector() if velocity is None else velocity self.elasticity = 0.7 self.is_destroyed = False self.inverse_friction = 0.99 self.gravity = VelocityVector(0.2, math.pi) # 导入图像 self.block_images = [] for image in images: self.block_images.append(pygame.transform.scale(image, (100, 100))) # 屏幕大小 self.screen_size = screen.get_rect().size self.screen_size = (self.screen_size[0], self.screen_size[1] - 50) # 设置当前图像 self.image = self.block_images[0] self.rect = self.image.get_rect() self.rotate_angle = math.radians(0) '''画到屏幕上''' def draw(self): pygame.transform.rotate(self.image, self.rotate_angle) self.screen.blit(self.image, (self.loc_info[0] - self.rect.width // 2, self.loc_info[1])) '''设置为损坏状态''' def setdestroy(self): self.is_destroyed = True self.image = self.block_images[1] '''移动木块''' def move(self): # 根据重力改变木块的速度向量 self.velocity = VectorAddition(self.velocity, self.gravity) self.loc_info[0] += self.velocity.magnitude * math.sin(self.velocity.angle) self.loc_info[1] -= self.velocity.magnitude * math.cos(self.velocity.angle) self.velocity.magnitude *= self.inverse_friction # 宽度超出屏幕 if self.loc_info[0] > self.screen_size[0] - self.rect.width: self.loc_info[0] = 2 * (self.screen_size[0] - self.rect.width) - self.loc_info[0] self.velocity.angle *= -1 self.rotate_angle = -self.velocity.angle self.velocity.magnitude *= self.elasticity elif self.loc_info[0] < self.rect.width: self.loc_info[0] = 2 * self.rect.width - self.loc_info[0] self.velocity.angle *= -1 self.rotate_angle = -self.velocity.angle self.velocity.magnitude *= self.elasticity # 高度超出屏幕 if self.loc_info[1] > self.screen_size[1] - self.rect.height: self.loc_info[1] = 2 * (self.screen_size[1] - self.rect.height) - self.loc_info[1] self.velocity.angle = math.pi - self.velocity.angle self.rotate_angle = math.pi - self.velocity.angle self.velocity.magnitude *= self.elasticity elif self.loc_info[1] < self.rect.height: self.loc_info[1] = 2 * self.rect.height - self.loc_info[1] self.velocity.angle = math.pi - self.velocity.angle self.rotate_angle = math.pi - self.velocity.angle self.velocity.magnitude *= self.elasticity '''弹弓''' class Slingshot(pygame.sprite.Sprite): def __init__(self, screen, x, y, width, height, color=(66, 73, 73), line_color=(100, 30, 22), **kwargs): pygame.sprite.Sprite.__init__(self) self.x = x self.y = y self.color = color self.width = width self.height = height self.screen = screen self.line_color = line_color self.type = 'slingshot' '''画到屏幕上''' def draw(self, bird=None): pygame.draw.rect(self.screen, self.color, (self.x, self.y + self.height * 1 / 3, self.width, self.height * 2 / 3)) if bird is not None and bird.is_loaded: pygame.draw.line(self.screen, self.line_color, (self.x, self.y + self.height / 6), (bird.loc_info[0], bird.loc_info[1] + bird.loc_info[2] / 2), 10) pygame.draw.line(self.screen, self.line_color, (self.x + self.width, self.y + self.height / 6), (bird.loc_info[0] + bird.loc_info[2], bird.loc_info[1] + bird.loc_info[2] / 2), 10) pygame.draw.rect(self.screen, self.color, (self.x - self.width / 4, self.y, self.width / 2, self.height / 3), 5) pygame.draw.rect(self.screen, self.color, (self.x + self.width * 3 / 4, self.y, self.width / 2, self.height / 3), 5) '''墙''' class Slab(pygame.sprite.Sprite): def __init__(self, screen, images, x, y, width, height, color=(255, 255, 255)): pygame.sprite.Sprite.__init__(self) self.x = x self.y = y self.color = color self.width = width self.height = height self.screen = screen self.images = images if self.width > self.height: self.image = self.images[0] else: self.image = self.images[1] self.image = pygame.transform.scale(self.image, (self.width, self.height)) self.type = 'wall' '''画到屏幕上''' def draw(self): self.screen.blit(self.image, (self.x, self.y)) '''按钮类''' class Button(pygame.sprite.Sprite): def __init__(self, screen, x, y, width, height, action=None, color_not_active=(189, 195, 199), color_active=(189, 195, 199)): pygame.sprite.Sprite.__init__(self) self.x = x self.y = y self.width = width self.height = height self.action = action self.screen = screen self.color_active = color_active self.color_not_active = color_not_active '''添加文字''' def addtext(self, text, size=20, font='Times New Roman', color=(0, 0, 0)): self.font = pygame.font.Font(font, size) self.text = self.font.render(text, True, color) self.text_pos = self.text.get_rect() self.text_pos.center = (self.x + self.width / 2, self.y + self.height / 2) '''是否被鼠标选中''' def selected(self): pos = pygame.mouse.get_pos() if (self.x < pos[0] < self.x + self.width) and (self.y < pos[1] < self.y + self.height): return True return False '''画到屏幕上''' def draw(self): if self.selected(): pygame.draw.rect(self.screen, self.color_active, (self.x, self.y, self.width, self.height)) else: pygame.draw.rect(self.screen, self.color_not_active, (self.x, self.y, self.width, self.height)) if hasattr(self, 'text'): self.screen.blit(self.text, self.text_pos) '''文字标签类''' class Label(pygame.sprite.Sprite): def __init__(self, screen, x, y, width, height): pygame.sprite.Sprite.__init__(self) self.x = x self.y = y self.width = width self.height = height self.screen = screen '''添加文字''' def addtext(self, text, size=20, font='Times New Roman', color=(0, 0, 0)): self.font = pygame.font.Font(font, size) self.text = self.font.render(text, True, color) self.text_pos = self.text.get_rect() self.text_pos.center = (self.x + self.width / 2, self.y + self.height / 2) '''画到屏幕上''' def draw(self): if hasattr(self, 'text'): self.screen.blit(self.text, self.text_pos)
42.180428
191
0.597912
1,901
13,793
4.206207
0.088375
0.086668
0.111431
0.042021
0.778389
0.741121
0.728614
0.707729
0.676088
0.657079
0
0.027999
0.262017
13,793
327
192
42.180428
0.75754
0.016095
0
0.617761
0
0
0.004749
0
0
0
0
0
0.023166
1
0.100386
false
0
0.015444
0
0.158301
0
0
0
0
null
0
0
0
0
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
4
13a44b55f7a795cb0f30147ae1e085c55f302008
87
py
Python
rdnt/__main__.py
jda/rdnt
e78b496bc9a2c161bb798ad26add2ae31f76c229
[ "MIT" ]
null
null
null
rdnt/__main__.py
jda/rdnt
e78b496bc9a2c161bb798ad26add2ae31f76c229
[ "MIT" ]
null
null
null
rdnt/__main__.py
jda/rdnt
e78b496bc9a2c161bb798ad26add2ae31f76c229
[ "MIT" ]
null
null
null
#!/usr/bin/env python from cli import cli if __name__ == "__main__": cli(obj={})
12.428571
26
0.632184
13
87
3.615385
0.846154
0
0
0
0
0
0
0
0
0
0
0
0.195402
87
6
27
14.5
0.671429
0.229885
0
0
0
0
0.121212
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
13bbac0e964fb444eda78da1939174bf6da9fdb8
523
py
Python
mplapp/spacer.py
fatTimmy/mplapp
b3ffb0e3c9013af5194594d5c93cfc75aeb74c9f
[ "MIT" ]
null
null
null
mplapp/spacer.py
fatTimmy/mplapp
b3ffb0e3c9013af5194594d5c93cfc75aeb74c9f
[ "MIT" ]
11
2016-03-01T03:28:21.000Z
2016-03-13T18:44:51.000Z
mplapp/spacer.py
weegreenblobbie/mplkitcode
392cc68fe0f86b3f9e4dc78441106ac0c09b48af
[ "MIT" ]
null
null
null
from mplapp.base import Base class Spacer(Base): """ Just something that takes up space, to aid widget alignment. """ def __init__(self, width, height): self._width = float(width) self._height = float(height) def axes(self): raise RuntimeError("Spacer does not have an axes") def canvas(self): raise RuntimeError("Spacer does not have a canvas") def size(self): return (self._width, self._height) def _render(self, fig, x, y): pass
18.678571
64
0.615679
68
523
4.602941
0.558824
0.086262
0.095847
0.172524
0.242812
0.242812
0.242812
0
0
0
0
0
0.282983
523
28
65
18.678571
0.834667
0.114723
0
0
0
0
0.127232
0
0
0
0
0
0
1
0.384615
false
0.076923
0.076923
0.076923
0.615385
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
4
13c46b3c06ebcb497213f103c98b0f0dde932c04
5,460
py
Python
src/olympia/api/tests/test_middleware.py
anik31/addons-server
cecb61da98d6e830fb45a2b1d61b41e72812137e
[ "BSD-3-Clause" ]
2
2021-07-19T03:26:43.000Z
2021-07-24T03:12:52.000Z
src/olympia/api/tests/test_middleware.py
anik31/addons-server
cecb61da98d6e830fb45a2b1d61b41e72812137e
[ "BSD-3-Clause" ]
760
2021-05-17T07:59:30.000Z
2022-03-31T11:14:15.000Z
src/olympia/api/tests/test_middleware.py
championshuttler/addons-server
5d4c1bfbed2fc509ecc1f3f5065955996e057eeb
[ "BSD-3-Clause" ]
1
2021-07-19T03:26:52.000Z
2021-07-19T03:26:52.000Z
from django.http import HttpResponse from django.test.client import RequestFactory from olympia.amo.tests import reverse_ns, TestCase from olympia.api.middleware import APICacheControlMiddleware, APIRequestMiddleware class TestAPIRequestMiddleware(TestCase): def setUp(self): self.request_factory = RequestFactory() def test_api_identified(self): request = self.request_factory.get('/api/v3/lol/') APIRequestMiddleware().process_request(request) assert request.is_api def test_vary_applied(self): request = self.request_factory.get('/api/v5/foo') request.is_api = True response = HttpResponse() APIRequestMiddleware().process_response(request, response) assert response['Vary'] == 'X-Country-Code, Accept-Language' response['Vary'] = 'Foo, Bar' APIRequestMiddleware().process_response(request, response) assert response['Vary'] == 'Foo, Bar, X-Country-Code, Accept-Language' def test_vary_not_applied_outside_api(self): request = self.request_factory.get('/somewhere') request.is_api = False response = HttpResponse() APIRequestMiddleware().process_response(request, response) assert not response.has_header('Vary') response['Vary'] = 'Foo, Bar' APIRequestMiddleware().process_response(request, response) assert response['Vary'] == 'Foo, Bar' def test_disabled_for_the_rest(self): """Test that we don't tag the request as API on "regular" pages.""" request = self.request_factory.get('/overtherainbow') APIRequestMiddleware().process_request(request) assert not request.is_api request = self.request_factory.get('/overtherainbow') APIRequestMiddleware().process_request(request) assert not request.is_api class TestAPICacheControlMiddleware(TestCase): def setUp(self): self.request_factory = RequestFactory() def test_not_api_should_not_cache(self): request = self.request_factory.get('/bar') request.is_api = False response = HttpResponse() response = APICacheControlMiddleware(lambda x: response)(request) assert 'Cache-Control' not in response def test_authenticated_should_not_cache(self): request = self.request_factory.get('/api/v5/foo') request.is_api = True request.META = {'HTTP_AUTHORIZATION': 'foo'} response = HttpResponse() response = APICacheControlMiddleware(lambda x: response)(request) assert 'Cache-Control' not in response def test_non_read_only_http_method_should_not_cache(self): request = self.request_factory.get('/api/v5/foo') request.is_api = True for method in ('POST', 'DELETE', 'PUT', 'PATCH'): request.method = method response = HttpResponse() response = APICacheControlMiddleware(lambda x: response)(request) assert 'Cache-Control' not in response def test_disable_caching_arg_should_not_cache(self): request = self.request_factory.get('/api/v5/foo') request.is_api = True request.GET = {'disable_caching': '1'} response = HttpResponse() response = APICacheControlMiddleware(lambda x: response)(request) assert 'Cache-Control' not in response def test_cookies_in_response_should_not_cache(self): request = self.request_factory.get('/api/v5/foo') request.is_api = True response = HttpResponse() response.set_cookie('foo', 'bar') response = APICacheControlMiddleware(lambda x: response)(request) assert 'Cache-Control' not in response def test_cache_control_already_set_should_not_override(self): request = self.request_factory.get('/api/v5/foo') request.is_api = True response = HttpResponse() response['Cache-Control'] = 'max-age=3600' response = APICacheControlMiddleware(lambda x: response)(request) assert response['Cache-Control'] == 'max-age=3600' def test_non_success_status_code_should_not_cache(self): request = self.request_factory.get('/api/v5/foo') request.is_api = True response = HttpResponse() for status_code in (400, 401, 403, 404, 429, 500, 502, 503, 504): response.status_code = status_code response = APICacheControlMiddleware(lambda x: response)(request) assert 'Cache-Control' not in response def test_everything_ok_should_cache_for_3_minutes(self): request = self.request_factory.get('/api/v5/foo') request.is_api = True response = HttpResponse() for status_code in (200, 201, 202, 204, 301, 302, 303, 304): response.status_code = status_code response = APICacheControlMiddleware(lambda x: response)(request) assert response['Cache-Control'] == 'max-age=180' def test_functional_should_cache(self): response = self.client.get(reverse_ns('amo-site-status')) assert response.status_code == 200 assert 'Cache-Control' in response assert response['Cache-Control'] == 'max-age=180' def test_functional_should_not_cache(self): response = self.client.get( reverse_ns('amo-site-status'), HTTP_AUTHORIZATION='blah' ) assert response.status_code == 200 assert 'Cache-Control' not in response
41.363636
82
0.675824
623
5,460
5.728732
0.192616
0.080134
0.075651
0.091062
0.774166
0.746428
0.717008
0.707201
0.641636
0.628748
0
0.019267
0.220513
5,460
131
83
41.679389
0.819314
0.011172
0
0.611111
0
0
0.104024
0
0
0
0
0
0.185185
1
0.148148
false
0
0.037037
0
0.203704
0
0
0
0
null
0
0
0
0
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
4
13d298fbdddc5c30868f6fd49902a061ec42c7f9
214
py
Python
demo/examples/accounting/apps.py
willist/django-material
73e50eb0105a67dde1c3f6846f868f10bda1f4ea
[ "BSD-3-Clause" ]
2,703
2015-02-05T00:55:14.000Z
2022-03-16T19:58:23.000Z
demo/examples/accounting/apps.py
willist/django-material
73e50eb0105a67dde1c3f6846f868f10bda1f4ea
[ "BSD-3-Clause" ]
495
2015-04-03T14:20:23.000Z
2022-03-01T13:05:51.000Z
demo/examples/accounting/apps.py
willist/django-material
73e50eb0105a67dde1c3f6846f868f10bda1f4ea
[ "BSD-3-Clause" ]
552
2015-04-04T12:09:36.000Z
2022-03-04T13:59:19.000Z
from django.apps import AppConfig from material.frontend.apps import ModuleMixin class Accounting(ModuleMixin, AppConfig): name = "demo.examples.accounting" icon = '<i class="material-icons">payment</i>'
26.75
50
0.757009
26
214
6.230769
0.653846
0.123457
0
0
0
0
0
0
0
0
0
0
0.130841
214
7
51
30.571429
0.870968
0
0
0
0
0
0.285047
0.271028
0
0
0
0
0
1
0
false
0
0.4
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
0
0
1
0
1
0
0
4
13e223e4493f73acd3f941f7a96674e9dda39a70
420
py
Python
algorithms/1716. Calculate Money in Leetcode Bank.py
vuzway9132/leetcode
e51a9ce7a6bb3e35c0fcb8c8f4f6cd5763708dbf
[ "MIT" ]
1
2020-12-02T13:54:30.000Z
2020-12-02T13:54:30.000Z
algorithms/1716. Calculate Money in Leetcode Bank.py
vuzway9132/leetcode
e51a9ce7a6bb3e35c0fcb8c8f4f6cd5763708dbf
[ "MIT" ]
null
null
null
algorithms/1716. Calculate Money in Leetcode Bank.py
vuzway9132/leetcode
e51a9ce7a6bb3e35c0fcb8c8f4f6cd5763708dbf
[ "MIT" ]
null
null
null
""" 1. Clarification 2. Possible solutions - simulation - math 3. Coding 4. Tests """ # T=O(n), S=O(n) class Solution: def totalMoney(self, n: int) -> int: return sum(i%7 + 1 + i//7 for i in range(n)) # # T=O(1), S=O(1) # class Solution: # def totalMoney(self, n: int) -> int: # extra, weeks = n % 7, n // 7 # return 28*weeks + 7*weeks*(weeks-1)//2 + weeks*extra + extra*(extra+1)//2
21
83
0.554762
71
420
3.28169
0.43662
0.017167
0.137339
0.223176
0.317597
0.317597
0.317597
0.317597
0
0
0
0.057143
0.25
420
19
84
22.105263
0.68254
0.683333
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.333333
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
13ea3cccf771dee03d9e64415a3aa21f5d206cc4
91
py
Python
src/documentClassification/routes/StatisticsRoutes.py
shaibachar/DocumentClassification
f592d1173d826e2b4e62deeba77cf58ec6f8095b
[ "MIT" ]
null
null
null
src/documentClassification/routes/StatisticsRoutes.py
shaibachar/DocumentClassification
f592d1173d826e2b4e62deeba77cf58ec6f8095b
[ "MIT" ]
null
null
null
src/documentClassification/routes/StatisticsRoutes.py
shaibachar/DocumentClassification
f592d1173d826e2b4e62deeba77cf58ec6f8095b
[ "MIT" ]
null
null
null
import os class StatisticsRoutes(object): def __init__(self,Db): self.Db = Db
15.166667
31
0.659341
12
91
4.666667
0.75
0.214286
0
0
0
0
0
0
0
0
0
0
0.241758
91
5
32
18.2
0.811594
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
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
1
0
0
0
0
0
0
0
4
b92700d838e767f922aaf0b795dd9aabfc3c695f
700
py
Python
Camera.py
evan-mcginnis/weeds
dabda454622d021be3aa92306d6d796e4388d080
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
Camera.py
evan-mcginnis/weeds
dabda454622d021be3aa92306d6d796e4388d080
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
Camera.py
evan-mcginnis/weeds
dabda454622d021be3aa92306d6d796e4388d080
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
# # C A M E R A # import numpy as np from abc import ABC, abstractmethod class Camera(ABC): def __init__(self, options : str): self.options = options super().__init__() @abstractmethod def connect(self): raise NotImplementedError() return True @abstractmethod def disconnect(self): raise NotImplementedError() return True @abstractmethod def diagnostics(self): self._connected = False return 0 @abstractmethod def capture(self) -> np.ndarray: self._connected = False return @abstractmethod def getResolution(self): self._connected = False return (0,0)
18.421053
38
0.612857
73
700
5.726027
0.452055
0.203349
0.129187
0.172249
0.401914
0.401914
0.263158
0
0
0
0
0.006198
0.308571
700
37
39
18.918919
0.857438
0.015714
0
0.461538
0
0
0
0
0
0
0
0
0
1
0.230769
false
0
0.076923
0
0.538462
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
b94e19a56a7c2b0f23e50e8c9f286c39991893cf
270
py
Python
scraper.py
chrisaddy/citizensunited
fbffe3c43814f6d177a05bcf735ba76aea1463dd
[ "MIT" ]
null
null
null
scraper.py
chrisaddy/citizensunited
fbffe3c43814f6d177a05bcf735ba76aea1463dd
[ "MIT" ]
null
null
null
scraper.py
chrisaddy/citizensunited
fbffe3c43814f6d177a05bcf735ba76aea1463dd
[ "MIT" ]
null
null
null
import numpy as np import pandas as pd def phetch_philly(url: str) -> pd.DataFrame: """Get all year-to-date-transactions for a given year (currently a full url) in data frame form.""" return pd.read_csv(url, sep = '\t', encoding = 'latin1', low_memory=False)
30
103
0.7
45
270
4.133333
0.822222
0
0
0
0
0
0
0
0
0
0
0.004505
0.177778
270
8
104
33.75
0.833333
0.344444
0
0
0
0
0.047059
0
0
0
0
0
0
1
0.25
false
0
0.5
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
4
b95bcc05f276d0812bfb017a57b2a63277eb6c18
1,007
py
Python
evalytics/exceptions.py
eduardogr/evalytics
fd2fc32851a0905313249120f232e96d805190b6
[ "Apache-2.0" ]
3
2020-03-30T09:21:38.000Z
2020-06-26T15:30:56.000Z
evalytics/exceptions.py
eduardogr/evalytics
fd2fc32851a0905313249120f232e96d805190b6
[ "Apache-2.0" ]
58
2020-03-26T20:49:18.000Z
2022-03-10T14:05:07.000Z
evalytics/exceptions.py
eduardogr/evalytics
fd2fc32851a0905313249120f232e96d805190b6
[ "Apache-2.0" ]
1
2020-03-26T15:42:32.000Z
2020-03-26T15:42:32.000Z
class CustomException(Exception): def __init__(self, *args): if args: self.message = args[0] else: self.message = None def get_str(self, class_name): if self.message: return '{0}, {1} '.format(self.message, class_name) else: return '{0} has been raised'.format(class_name) class CommunicationChannelException(CustomException): def __str__(self): return super().get_str('CommunicationChannelException') class MissingDataException(CustomException): def __str__(self): return super().get_str('MissingDataException') class NoFormsException(CustomException): def __str__(self): return super().get_str('NoFormsException') class NoPeersException(CustomException): def __str__(self): return super().get_str('NoPeersException') class NotExistentEmployeeException(CustomException): def __str__(self): return super().get_str('NotExistentEmployeeException')
25.175
63
0.67428
98
1,007
6.591837
0.27551
0.055728
0.162539
0.193498
0.325077
0.325077
0.325077
0.325077
0
0
0
0.005089
0.219464
1,007
39
64
25.820513
0.816794
0
0
0.269231
0
0
0.136048
0.056604
0
0
0
0
0
1
0.269231
false
0
0
0.192308
0.769231
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
b961fd9016123ef27ad87e08dca318bd96656a0a
110
py
Python
apis/__init__.py
lpcheng1208/order_sanic
fad99ed4a6cb503f85ef884ba0adbca59b6070e0
[ "MIT" ]
4
2019-09-18T06:38:37.000Z
2022-02-22T08:26:02.000Z
apis/__init__.py
lpcheng1208/order_sanic
fad99ed4a6cb503f85ef884ba0adbca59b6070e0
[ "MIT" ]
1
2021-06-02T00:23:53.000Z
2021-06-02T00:23:53.000Z
apis/__init__.py
lpcheng1208/order_sanic
fad99ed4a6cb503f85ef884ba0adbca59b6070e0
[ "MIT" ]
1
2019-11-05T14:56:29.000Z
2019-11-05T14:56:29.000Z
from sanic import Blueprint from .order import order api = Blueprint.group(order, url_prefix='/api')
8.461538
47
0.718182
15
110
5.2
0.6
0
0
0
0
0
0
0
0
0
0
0
0.190909
110
12
48
9.166667
0.876404
0
0
0
0
0
0.038095
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
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
1
0
4
b974c731b2830e6e3f4c07b75900fcf8323b99aa
505
py
Python
tests/basics/try4.py
geowor01/micropython
7fb13eeef4a85f21cae36f1d502bcc53880e1815
[ "MIT" ]
7
2019-10-18T13:41:39.000Z
2022-03-15T17:27:57.000Z
tests/basics/try4.py
geowor01/micropython
7fb13eeef4a85f21cae36f1d502bcc53880e1815
[ "MIT" ]
null
null
null
tests/basics/try4.py
geowor01/micropython
7fb13eeef4a85f21cae36f1d502bcc53880e1815
[ "MIT" ]
2
2020-06-23T09:10:15.000Z
2020-12-22T06:42:14.000Z
# triple nested exceptions passed = 1 def f(): try: foo() passed = 0 except: print("except 1") try: bar() passed = 0 except: print("except 2") try: baz() passed = 0 except: print("except 3") bak() passed = 0 try: f() passed = 0 except: print("f except") if (passed): print("PASS") else: print("FAIL")
14.852941
33
0.386139
49
505
3.979592
0.428571
0.179487
0.266667
0.369231
0.369231
0
0
0
0
0
0
0.035857
0.50297
505
33
34
15.30303
0.741036
0.047525
0
0.464286
0
0
0.083507
0
0
0
0
0
0
1
0.035714
false
0.285714
0
0
0.035714
0.214286
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
b97be9d9515168db373e98c1036b7b5803900dc5
2,625
py
Python
E-commerce store.py
K-P1/kp-learning-python
67e63a53b93f269ba25d45f6811727382edf3fff
[ "bzip2-1.0.6" ]
null
null
null
E-commerce store.py
K-P1/kp-learning-python
67e63a53b93f269ba25d45f6811727382edf3fff
[ "bzip2-1.0.6" ]
null
null
null
E-commerce store.py
K-P1/kp-learning-python
67e63a53b93f269ba25d45f6811727382edf3fff
[ "bzip2-1.0.6" ]
null
null
null
""" Take Home Project 1. Write a program for an e-commerce store. The program must accept at least 10 products on the first run. The storekeeper should be given the option to Add a product, remove a product, empty the product catalog and close the program. 2. Create a membership system that allows users to register and login after registration. 3. Write a budget for the United states of America for any 20 states of your choice in tabular form with the following columns, index, State, Allocation, Population, allocation per head\ """ #================ Number 1================== """ 1. Write a program for an e-commerce store. The program must accept at least 10 products on the first run. The storekeeper should be given the option to Add a product, remove a product, empty the product catalog and close the program. Code for Number 1 print("Welcome to Lizzy Autos") catalog = [] isMoreProduct = "yes" for i in range(4): name_of_product = input("Enter Product:\t") catalog.append(name_of_product) while isMoreProduct == "yes": isMoreProduct = input("Do you have more products to add?\t") isMoreProduct = isMoreProduct.lower() if isMoreProduct == "yes": name_of_product = input("Enter Product:\t") catalog.append(name_of_product) else: break print("\n\nList of Products\n") while True: for x in catalog: print(x) print("") print("1. Add a Product") print("2. Remove a Product") print("3. Clear The Catalog") print("4. Quit") print("") option = int(input("Choose an Option\t")) print("") if option == 1: name_of_product = input("Enter Product:\t") catalog.append(name_of_product) elif option == 2: product_to_remove = int(input("Enter Product index:\t")) catalog.pop(product_to_remove - 1) elif option == 3: catalog.clear() elif option == 4: break else: print("Invalid Input") """ #================ Number 2================== """ 2. Create a membership system that allows users to register and login after registration. """ #================Number 3================ """ 3. Write a budget for the United states of America for any 20 states of your choice in tabular form with the following columns: State, Allocation, Population, allocation per head\ """ print("Welcome to the United States Data Center\n") print("State\tAllocation($)\tPopulation(M)\tAllocation/Head($)\n") print(f"California\t\t2\t\t3\t{round(2/3,3)}")
30.523256
72
0.633143
363
2,625
4.534435
0.31405
0.029162
0.047388
0.032807
0.594775
0.594775
0.543742
0.543742
0.543742
0.543742
0
0.016451
0.23581
2,625
85
73
30.882353
0.804088
0.250667
0
0
0
0
0.75419
0.519553
0
0
0
0
0
1
0
true
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
1
0
0
0
0
1
0
4
b97ce72630a0c268344ef9117f421429d73bd4e9
202
py
Python
kaamkaj/admin.py
Jai-kishan/Django-User-Profile
4aac1cf600bb4c84c48338a22b0dbbfdc443d55a
[ "MIT" ]
1
2021-12-21T03:39:12.000Z
2021-12-21T03:39:12.000Z
kaamkaj/admin.py
Jai-kishan/Django-User-Profile
4aac1cf600bb4c84c48338a22b0dbbfdc443d55a
[ "MIT" ]
null
null
null
kaamkaj/admin.py
Jai-kishan/Django-User-Profile
4aac1cf600bb4c84c48338a22b0dbbfdc443d55a
[ "MIT" ]
null
null
null
from django.contrib import admin from kaamkaj.models import * # Register your models here. class KaamKajAdmin(admin.ModelAdmin): readonly_fields=('created',) admin.site.register(KaamKaj,KaamKajAdmin)
25.25
41
0.806931
25
202
6.48
0.68
0
0
0
0
0
0
0
0
0
0
0
0.094059
202
8
41
25.25
0.885246
0.128713
0
0
0
0
0.04
0
0
0
0
0
0
1
0
false
0
0.4
0
0.8
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
b98ba656be1a191cb96fee55ad7258fbc6fe4d6d
42
py
Python
Task/User-input-Text/Python/user-input-text-1.py
LaudateCorpus1/RosettaCodeData
9ad63ea473a958506c041077f1d810c0c7c8c18d
[ "Info-ZIP" ]
5
2021-01-29T20:08:05.000Z
2022-03-22T06:16:05.000Z
Task/User-input-Text/Python/user-input-text-1.py
seanwallawalla-forks/RosettaCodeData
9ad63ea473a958506c041077f1d810c0c7c8c18d
[ "Info-ZIP" ]
null
null
null
Task/User-input-Text/Python/user-input-text-1.py
seanwallawalla-forks/RosettaCodeData
9ad63ea473a958506c041077f1d810c0c7c8c18d
[ "Info-ZIP" ]
1
2021-04-13T04:19:31.000Z
2021-04-13T04:19:31.000Z
string = raw_input("Input a string: ")
21
41
0.642857
6
42
4.333333
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.214286
42
1
42
42
0.787879
0
0
0
0
0
0.380952
0
0
0
0
0
0
0
null
null
0
0
null
null
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
1
0
0
0
0
0
0
0
0
4
b9a110dc665cfb848b7f90a7044da337ff9d40e9
11,723
bzl
Python
3rdparty/workspace.bzl
AleksanderGondek/animated-carnival
d371b05133126027901ebc2f8ae08acb23e4f675
[ "MIT" ]
null
null
null
3rdparty/workspace.bzl
AleksanderGondek/animated-carnival
d371b05133126027901ebc2f8ae08acb23e4f675
[ "MIT" ]
null
null
null
3rdparty/workspace.bzl
AleksanderGondek/animated-carnival
d371b05133126027901ebc2f8ae08acb23e4f675
[ "MIT" ]
null
null
null
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml. def _jar_artifact_impl(ctx): jar_name = "%s.jar" % ctx.name ctx.download( output=ctx.path("jar/%s" % jar_name), url=ctx.attr.urls, sha256=ctx.attr.sha256, executable=False ) src_name="%s-sources.jar" % ctx.name srcjar_attr="" has_sources = len(ctx.attr.src_urls) != 0 if has_sources: ctx.download( output=ctx.path("jar/%s" % src_name), url=ctx.attr.src_urls, sha256=ctx.attr.src_sha256, executable=False ) srcjar_attr ='\n srcjar = ":%s",' % src_name build_file_contents = """ package(default_visibility = ['//visibility:public']) java_import( name = 'jar', tags = ['maven_coordinates={artifact}'], jars = ['{jar_name}'],{srcjar_attr} ) filegroup( name = 'file', srcs = [ '{jar_name}', '{src_name}' ], visibility = ['//visibility:public'] )\n""".format(artifact = ctx.attr.artifact, jar_name = jar_name, src_name = src_name, srcjar_attr = srcjar_attr) ctx.file(ctx.path("jar/BUILD"), build_file_contents, False) return None jar_artifact = repository_rule( attrs = { "artifact": attr.string(mandatory = True), "sha256": attr.string(mandatory = True), "urls": attr.string_list(mandatory = True), "src_sha256": attr.string(mandatory = False, default=""), "src_urls": attr.string_list(mandatory = False, default=[]), }, implementation = _jar_artifact_impl ) def jar_artifact_callback(hash): src_urls = [] src_sha256 = "" source=hash.get("source", None) if source != None: src_urls = [source["url"]] src_sha256 = source["sha256"] jar_artifact( artifact = hash["artifact"], name = hash["name"], urls = [hash["url"]], sha256 = hash["sha256"], src_urls = src_urls, src_sha256 = src_sha256 ) native.bind(name = hash["bind"], actual = hash["actual"]) def list_dependencies(): return [ {"artifact": "com.google.protobuf:protobuf-java:3.5.1", "lang": "java", "sha1": "8c3492f7662fa1cbf8ca76a0f5eb1146f7725acd", "sha256": "b5e2d91812d183c9f053ffeebcbcda034d4de6679521940a19064714966c2cd4", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/google/protobuf/protobuf-java/3.5.1/protobuf-java-3.5.1.jar", "source": {"sha1": "7235a28a13938050e8cd5d9ed5133bebf7a4dca7", "sha256": "3be3115498d543851443bfa725c0c5b28140e363b3b7dec97f4028cd17040fa4", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/google/protobuf/protobuf-java/3.5.1/protobuf-java-3.5.1-sources.jar"} , "name": "com_google_protobuf_protobuf_java", "actual": "@com_google_protobuf_protobuf_java//jar", "bind": "jar/com/google/protobuf/protobuf_java"}, {"artifact": "com.lihaoyi:fastparse-utils_2.12:1.0.0", "lang": "java", "sha1": "02900ec8460abec27913f4154b338e61fd482607", "sha256": "fb6cd6484e21459e11fcd45f22f07ad75e3cb29eca0650b39aa388d13c8e7d0a", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/lihaoyi/fastparse-utils_2.12/1.0.0/fastparse-utils_2.12-1.0.0.jar", "source": {"sha1": "891f76cff455350adc2f122421b67855f93c8dc3", "sha256": "19e055e9d870f2a2cec5a8e0b892f9afb6e4350ecce315ca519458c4f52f9253", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/lihaoyi/fastparse-utils_2.12/1.0.0/fastparse-utils_2.12-1.0.0-sources.jar"} , "name": "com_lihaoyi_fastparse_utils_2_12", "actual": "@com_lihaoyi_fastparse_utils_2_12//jar", "bind": "jar/com/lihaoyi/fastparse_utils_2_12"}, {"artifact": "com.lihaoyi:fastparse_2.12:1.0.0", "lang": "java", "sha1": "2473a344aa1200fd50b7ff78281188c172f9cfcb", "sha256": "1227a00a26a4ad76ddcfa6eae2416687df7f3c039553d586324b32ba0a528fcc", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/lihaoyi/fastparse_2.12/1.0.0/fastparse_2.12-1.0.0.jar", "source": {"sha1": "b1fdfd4c95bdb3f49ec78837be78d657a5ac86c0", "sha256": "290c1e9a4bad4d3724daec48324083fd0d97f51981a3fabbf75e2de1303da5ca", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/lihaoyi/fastparse_2.12/1.0.0/fastparse_2.12-1.0.0-sources.jar"} , "name": "com_lihaoyi_fastparse_2_12", "actual": "@com_lihaoyi_fastparse_2_12//jar", "bind": "jar/com/lihaoyi/fastparse_2_12"}, {"artifact": "com.lihaoyi:sourcecode_2.12:0.1.4", "lang": "java", "sha1": "ef9a771975cb0860f2b42778c5cf1f5d76818979", "sha256": "9a3134484e596205d0acdcccd260e0854346f266cb4d24e1b8a31be54fbaf6d9", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/lihaoyi/sourcecode_2.12/0.1.4/sourcecode_2.12-0.1.4.jar", "source": {"sha1": "ffb135dacaf0d989c260a486c8b86867bcab2e22", "sha256": "c5c53ba31a9f891988f9e21595e8728956be22d9ab9442e140840d0a73be8261", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/lihaoyi/sourcecode_2.12/0.1.4/sourcecode_2.12-0.1.4-sources.jar"} , "name": "com_lihaoyi_sourcecode_2_12", "actual": "@com_lihaoyi_sourcecode_2_12//jar", "bind": "jar/com/lihaoyi/sourcecode_2_12"}, {"artifact": "com.thesamet.scalapb:lenses_2.12:0.8.0-RC1", "lang": "java", "sha1": "63f6dfbea05fa9793e20368d5b563db9b9444f16", "sha256": "6e061e15fa9f37662d89d1d0a3f4da64c73e3129108b672c792b36bf490ae8e2", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/thesamet/scalapb/lenses_2.12/0.8.0-RC1/lenses_2.12-0.8.0-RC1.jar", "source": {"sha1": "05b9aeff30f2b2fbc3682eefd05743577769ee4d", "sha256": "cf2899b36193b3fa7b99fd0476aca8453f0c4bd284d37da8a564cfbc69f24244", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/thesamet/scalapb/lenses_2.12/0.8.0-RC1/lenses_2.12-0.8.0-RC1-sources.jar"} , "name": "com_thesamet_scalapb_lenses_2_12", "actual": "@com_thesamet_scalapb_lenses_2_12//jar", "bind": "jar/com/thesamet/scalapb/lenses_2_12"}, {"artifact": "com.thesamet.scalapb:scalapb-runtime_2.12:0.8.0-RC1", "lang": "java", "sha1": "f9879e234145d4e9e9874509a538f3d64ad205ac", "sha256": "d922c788c8997e2524a39b1f43bac3c859516fc0ae580eab82c0db7e40aef944", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/thesamet/scalapb/scalapb-runtime_2.12/0.8.0-RC1/scalapb-runtime_2.12-0.8.0-RC1.jar", "source": {"sha1": "ea3d3cb5b134aef3a22ce41dd99ce4271ac5e6b0", "sha256": "fbc11c3ceffbd1d146c039e40c34fe8aa9b467f15f91668ebfe796c4cd0b91e4", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/com/thesamet/scalapb/scalapb-runtime_2.12/0.8.0-RC1/scalapb-runtime_2.12-0.8.0-RC1-sources.jar"} , "name": "com_thesamet_scalapb_scalapb_runtime_2_12", "actual": "@com_thesamet_scalapb_scalapb_runtime_2_12//jar", "bind": "jar/com/thesamet/scalapb/scalapb_runtime_2_12"}, # duplicates in org.scala-lang:scala-library promoted to 2.12.8 # - com.lihaoyi:fastparse-utils_2.12:1.0.0 wanted version 2.12.3 # - com.lihaoyi:fastparse_2.12:1.0.0 wanted version 2.12.3 # - com.lihaoyi:sourcecode_2.12:0.1.4 wanted version 2.12.2 # - com.thesamet.scalapb:lenses_2.12:0.8.0-RC1 wanted version 2.12.6 # - com.thesamet.scalapb:scalapb-runtime_2.12:0.8.0-RC1 wanted version 2.12.6 # - org.scalameta:common_2.12:4.1.6 wanted version 2.12.8 # - org.scalameta:io_2.12:4.1.6 wanted version 2.12.8 # - org.scalameta:semanticdb-javac_2.12:4.1.6 wanted version 2.12.8 # - org.scalameta:semanticdb_2.12:4.1.6 wanted version 2.12.8 {"artifact": "org.scala-lang:scala-library:2.12.8", "lang": "java", "sha1": "36b234834d8f842cdde963c8591efae6cf413e3f", "sha256": "321fb55685635c931eba4bc0d7668349da3f2c09aee2de93a70566066ff25c28", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scala-lang/scala-library/2.12.8/scala-library-2.12.8.jar", "source": {"sha1": "45ccb865e040cbef5d5620571527831441392f24", "sha256": "11482bcb49b2e47baee89c3b1ae10c6a40b89e2fbb0da2a423e062f444e13492", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scala-lang/scala-library/2.12.8/scala-library-2.12.8-sources.jar"} , "name": "org_scala_lang_scala_library", "actual": "@org_scala_lang_scala_library//jar", "bind": "jar/org/scala_lang/scala_library"}, {"artifact": "org.scalameta:common_2.12:4.1.6", "lang": "java", "sha1": "34c19fe6e9141bb8014453af7706c58844f58468", "sha256": "4bcf81a9734c14e881dd62d3934127b3dbfd8fdb5603cad249a4ec73492af0de", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/common_2.12/4.1.6/common_2.12-4.1.6.jar", "source": {"sha1": "84454c925612885d0ffba8fcbdba4cd7d19e0721", "sha256": "d7f71a0ebd2ec659c19c82974e09da5afd5598aa4bc4c59a624959845ca97c72", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/common_2.12/4.1.6/common_2.12-4.1.6-sources.jar"} , "name": "org_scalameta_common_2_12", "actual": "@org_scalameta_common_2_12//jar", "bind": "jar/org/scalameta/common_2_12"}, {"artifact": "org.scalameta:io_2.12:4.1.6", "lang": "java", "sha1": "b7aa0c103a59aa97fa1d273e56089621526d0d22", "sha256": "296e593460f5f700c01589dc717b35d44d6474d8f30c005bf6e7b13bbc5b9734", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/io_2.12/4.1.6/io_2.12-4.1.6.jar", "source": {"sha1": "f4da2f7b1f9ce2c86281c0fe8473e099e4073c5a", "sha256": "9d3ec1d68f6aed526b3956264f5223db95326608df71511c5b60db31e4e02ab6", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/io_2.12/4.1.6/io_2.12-4.1.6-sources.jar"} , "name": "org_scalameta_io_2_12", "actual": "@org_scalameta_io_2_12//jar", "bind": "jar/org/scalameta/io_2_12"}, {"artifact": "org.scalameta:semanticdb-javac_2.12:4.1.6", "lang": "scala", "sha1": "d16dd9ca4aebaabe6f3887a15a0bc12e26f06e51", "sha256": "74456b658ee596ce56d817ebf1e9cbd0181a04e73596c5ff9c94b9c32d929ef6", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/semanticdb-javac_2.12/4.1.6/semanticdb-javac_2.12-4.1.6.jar", "source": {"sha1": "5383f4da130713de35bed96506fed0800bd8b4be", "sha256": "f2a593828ed76ee00a207a5e748c8b6f71dd464ccce5d64eddacd9b49d03f671", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/semanticdb-javac_2.12/4.1.6/semanticdb-javac_2.12-4.1.6-sources.jar"} , "name": "org_scalameta_semanticdb_javac_2_12", "actual": "@org_scalameta_semanticdb_javac_2_12//jar:file", "bind": "jar/org/scalameta/semanticdb_javac_2_12"}, {"artifact": "org.scalameta:semanticdb_2.12:4.1.6", "lang": "java", "sha1": "38cdb3c7664b86ef54b414b53c4d80cf02a3b508", "sha256": "201fa1f10778e5b9c69ab9d524ca795be4f08e179506ae2ad7a8dcc6efeeb5cb", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/semanticdb_2.12/4.1.6/semanticdb_2.12-4.1.6.jar", "source": {"sha1": "39aaf6f189e7fa185001eff68d0b24d10e54e80c", "sha256": "6d9932d7830516f903ed2ff9cc6bf5af0e99b22b502014469a2b420e92fa596a", "repository": "http://central.maven.org/maven2/", "url": "http://central.maven.org/maven2/org/scalameta/semanticdb_2.12/4.1.6/semanticdb_2.12-4.1.6-sources.jar"} , "name": "org_scalameta_semanticdb_2_12", "actual": "@org_scalameta_semanticdb_2_12//jar", "bind": "jar/org/scalameta/semanticdb_2_12"}, ] def maven_dependencies(callback = jar_artifact_callback): for hash in list_dependencies(): callback(hash)
120.85567
898
0.736586
1,488
11,723
5.646505
0.101478
0.034278
0.08379
0.0995
0.545703
0.495001
0.462271
0.436087
0.377529
0.360628
0
0.193344
0.082317
11,723
96
899
122.114583
0.587656
0.058688
0
0.050633
1
0.278481
0.72893
0.356346
0
0
0
0
0
1
0.050633
false
0
0.012658
0.012658
0.088608
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
b9a61445ea7c4e6cbf5d413e874a3241c6409e51
10,915
py
Python
tests.py
dabbers/PlxSrt
3c8d1d24e78208a6b9d6a19ffb96dd3b2595c3f3
[ "MIT" ]
1
2017-03-24T22:59:36.000Z
2017-03-24T22:59:36.000Z
tests.py
dabbers/PlxSrt
3c8d1d24e78208a6b9d6a19ffb96dd3b2595c3f3
[ "MIT" ]
2
2017-03-31T18:01:33.000Z
2019-01-22T04:36:15.000Z
tests.py
dabbers/PlxSrt
3c8d1d24e78208a6b9d6a19ffb96dd3b2595c3f3
[ "MIT" ]
1
2017-09-12T23:29:04.000Z
2017-09-12T23:29:04.000Z
import detector import os class testosshim: def __init__(self, folder): self.folder = folder def movieFolder(self): return r"C:\Media\\Movies\\" def tvFolder(self): return r"C:\Media\TV\\" def link(self, source, target, targetdir): return {"action":"link", "source": source, "target":target, "targetdir":targetdir} def listdir(self, path): parts = os.path.normpath(path).split(os.path.sep) cd = self.folder for part in parts: if (cd.has_key(part)): cd = cd[part] else: return [] return cd.keys() def isdir(self, path): parts = os.path.normpath(path).split(os.path.sep) cd = self.folder for part in parts[:-1]: if (cd.has_key(part)): cd = cd[part] else: return False if (not cd.has_key(parts[-1])): return False return cd[parts[-1]] != True def extract(self, source, target): return {"action":"extract", "source": source, "target":target} def getApiKey(self): return "" fstruct = { "C:" : { "downloads" : { "test.movie.2017.UHD.1337.mkv":True, "test.show.s01e01.mkv":True, "test.show.format2.s1e1.mkv":True, "Test.Show.3.S01E02": { "test.show.3.s01e02.part1.rar":True, "test.show.3.s01e02.part2.rar":True, "test.show.3.s01e02.part3.rar":True, }, "The.Test.Show.With.Yo.Momma.2017.03.22.Yo.Momma":{ "The.Test.Show.With.Yo.Momma.2017.03.22.Yo.Momma.r01": True, "The.Test.Show.With.Yo.Momma.2017.03.22.Yo.Momma.r02": True, "The.Test.Show.With.Yo.Momma.2017.03.22.Yo.Momma.r03": True, "The.Test.Show.With.Yo.Momma.2017.03.22.Yo.Momma.rar": True }, "Test.Movie.23.2017.UHD.1337": { "Subs": { "Test.Movie.23.2017.UHD.1337.part1.rar":True, }, "Test.Movie.23.2017.UHD.1337.part1.rar":True, "Test.Movie.23.2017.UHD.1337.part2.rar":True, "Test.Movie.23.2017.UHD.1337.part3.rar":True, "Test.Movie.23.2017.UHD.1337.sample.mkv":True, "Test.Movie.23.2017.UHD.1337.sfv":True }, "Don't look down": { "Don't look down 1080p.mkv": True }, "S01_-_Complete": { "Show.Name.1x01.The_Stakeout.DVDRip_Xvid-Fov": { "Show.Name.1x01.The_Stakeout.DVDRip_Xvid-Fov.r00": True, "Show.Name.1x01.The_Stakeout.DVDRip_Xvid-Fov.r01": True, "Show.Name.1x01.The_Stakeout.DVDRip_Xvid-Fov.rar": True, }, "Show.Name.1x02.The_Stakeout.DVDRip_Xvid-Fov": { "Show.Name.1x02.The_Stakeout2.DVDRip_Xvid-Fov.r00": True, "Show.Name.1x02.The_Stakeout2.DVDRip_Xvid-Fov.r01": True, "Show.Name.1x02.The_Stakeout2.DVDRip_Xvid-Fov.rar": True, }, }, "Season_11-COMPLETE": { "Show.Name.11x01.The_Stakeout.DVDRip_Xvid-Fov": { "sn11ep1-yd.r00": True, "sn11ep1-yd.r01": True, "sn11ep1-yd.rar": True, }, "Show.Name.11x02.The_Stakeout.DVDRip_Xvid-Fov": { "sn11ep2-yd.r00": True, "sn11ep2-yd.r01": True, "sn11ep2-yd.rar": True, }, }, "The Show - Complete": { "The Show - Season 1" : { "Show, The - S1E01 - Pilot.avi": True, "Show, The - S1E02 - Second.avi":True, }, "The Show - Season 2" : { "Show, The - S2E01 - Pilot.avi": True, "Show, The - S2E02 - Second.avi":True, } } }, "Media": { "Movies": { }, "TV": { } } } } shim = testosshim(fstruct) tests_input_expected = [ { "input": { "name": "Test.Show.3.S01E02", "path": "C:\\downloads\\" }, "expected": [ { 'Output': { 'action': 'extract', 'source': 'C:\\downloads\\Test.Show.3.S01E02\\test.show.3.s01e02.part1.rar', 'target': 'C:\\Media\\TV\\Test Show 3\\Season 1' }, 'Result': True } ] }, { "input": { "name": "test.show.s01e01.mkv", "path": "C:\\downloads\\" }, "expected": [ { 'Output': { 'action': 'link', 'source': 'C:\\downloads\\test.show.s01e01.mkv', 'target': 'C:\\Media\\TV\\test show\\Season 1\\test.show.s01e01.mkv', 'targetdir': 'C:\\Media\\TV\\test show\\Season 1' }, 'Result': True } ] }, { "input": { "name": "The.Test.Show.With.Yo.Momma.2017.03.22.Yo.Momma", "path": "C:\\downloads\\" }, "expected": [ { 'Output': { 'action': 'extract', 'source': 'C:\\downloads\\The.Test.Show.With.Yo.Momma.2017.03.22.Yo.Momma\\The.Test.Show.With.Yo.Momma.2017.03.22.Yo.Momma.rar', 'target': 'C:\\Media\\TV\\The Test Show With Yo Momma\\2017' }, 'Result': True } ] }, { "input": { "name": "Don't look down", "path": "C:\\downloads\\" }, "expected": [ { 'Output': { 'action': 'link', 'source': "C:\\downloads\\Don't look down\\Don't look down 1080p.mkv", 'target': "C:\\Media\\Movies\\Don'T Look Down\\Don't look down 1080p.mkv", 'targetdir': "C:\\Media\\Movies\\Don'T Look Down" }, 'Result': True } ] }, { "input": { "name": "Test.Movie.23.2017.UHD.1337", "path": "C:\\downloads\\" }, "expected": [ { 'Output': { 'action': 'extract', 'source': 'C:\\downloads\\Test.Movie.23.2017.UHD.1337\\Subs\\Test.Movie.23.2017.UHD.1337.part1.rar', 'target': 'C:\\Media\\Movies\\Test Movie 23 2017' }, 'Result': True }, { 'Output': { 'action': 'extract', 'source': 'C:\\downloads\\Test.Movie.23.2017.UHD.1337\\Test.Movie.23.2017.UHD.1337.part1.rar', 'target': 'C:\\Media\\Movies\\Test Movie 23 2017' }, 'Result': True } ] }, { "input": { "name": "S01_-_Complete", "path": "C:\\downloads\\" }, "expected": [ { 'Output': { 'action': 'extract', 'source': 'C:\\downloads\\S01_-_Complete\\Show.Name.1x01.The_Stakeout.DVDRip_Xvid-Fov\\Show.Name.1x01.The_Stakeout.DVDRip_Xvid-Fov.rar', 'target': 'C:\\Media\\TV\\Show Name\\Season 1' }, 'Result': True }, { 'Output': { 'action': 'extract', 'source': 'C:\\downloads\\S01_-_Complete\\Show.Name.1x02.The_Stakeout.DVDRip_Xvid-Fov\\Show.Name.1x02.The_Stakeout2.DVDRip_Xvid-Fov.rar', 'target': 'C:\\Media\\TV\\Show Name\\Season 1' }, 'Result': True } ] }, { "input": { "name": "Season_11-COMPLETE", "path": "C:\\downloads\\" }, "expected": [ { 'Output': { 'action': 'extract', 'source': 'C:\\downloads\\Season_11-COMPLETE\\Show.Name.11x01.The_Stakeout.DVDRip_Xvid-Fov\\sn11ep1-yd.rar', 'target': 'C:\\Media\\TV\\Show Name\\Season 11' }, 'Result': True }, { 'Output': { 'action': 'extract', 'source': 'C:\\downloads\\Season_11-COMPLETE\\Show.Name.11x02.The_Stakeout.DVDRip_Xvid-Fov\\sn11ep2-yd.rar', 'target': 'C:\\Media\\TV\\Show Name\\Season 11' }, 'Result': True } ] }, { "input": { "name": "The Show - Complete", "path": "C:\\downloads\\" }, "expected": [ { 'Output': { 'action': 'link', 'source': 'C:\\downloads\\The Show - Complete\\The Show - Season 2\\Show, The - S2E01 - Pilot.avi', 'target': 'C:\\Media\\TV\\Show, The -\\Season 2\\Show, The - S2E01 - Pilot.avi', 'targetdir': 'C:\\Media\\TV\\Show, The -\\Season 2' }, 'Result': True }, { 'Output': { 'action': 'link', 'source': 'C:\\downloads\\The Show - Complete\\The Show - Season 2\\Show, The - S2E02 - Second.avi', 'target': 'C:\\Media\\TV\\Show, The -\\Season 2\\Show, The - S2E02 - Second.avi', 'targetdir': 'C:\\Media\\TV\\Show, The -\\Season 2' }, 'Result': True }, { 'Output': { 'action': 'link', 'source': 'C:\\downloads\\The Show - Complete\\The Show - Season 1\\Show, The - S1E02 - Second.avi', 'target': 'C:\\Media\\TV\\Show, The -\\Season 1\\Show, The - S1E02 - Second.avi', 'targetdir': 'C:\\Media\\TV\\Show, The -\\Season 1' }, 'Result': True }, { 'Output': { 'action': 'link', 'source': 'C:\\downloads\\The Show - Complete\\The Show - Season 1\\Show, The - S1E01 - Pilot.avi', 'target': 'C:\\Media\\TV\\Show, The -\\Season 1\\Show, The - S1E01 - Pilot.avi', 'targetdir': 'C:\\Media\\TV\\Show, The -\\Season 1' }, 'Result': True } ] } ] for test in tests_input_expected: result = detector.detect(test["input"]["name"], test["input"]["path"], shim) if (result == test["expected"]): print("Test " + test["input"]["name"] + " passed") else: print("**** Test " + test["input"]["name"] + " failed") print(result)
36.627517
157
0.433074
1,100
10,915
4.247273
0.105455
0.041096
0.02911
0.044949
0.810788
0.762628
0.731592
0.692209
0.678938
0.626284
0
0.070636
0.396885
10,915
297
158
36.750842
0.63907
0
0
0.271739
0
0.07971
0.438388
0.192487
0
0
0
0
0
1
0.028986
false
0.003623
0.007246
0.018116
0.076087
0.01087
0
0
0
null
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
b9ec5ed9043325213134e909b8eb76751a68b2d4
60
py
Python
tests/__init__.py
unodan/tkmvc
94cb7f48e2df866162505966ff0e943ef712f339
[ "MIT" ]
null
null
null
tests/__init__.py
unodan/tkmvc
94cb7f48e2df866162505966ff0e943ef712f339
[ "MIT" ]
1
2021-11-15T17:49:24.000Z
2021-11-15T17:49:24.000Z
tests/__init__.py
unodan/tkmvc
94cb7f48e2df866162505966ff0e943ef712f339
[ "MIT" ]
1
2021-01-11T09:04:41.000Z
2021-01-11T09:04:41.000Z
# -*- coding: utf-8 -*- """Unit test package for tkmvc."""
15
34
0.55
8
60
4.125
1
0
0
0
0
0
0
0
0
0
0
0.020408
0.183333
60
3
35
20
0.653061
0.85
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
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
b9ff8d88129e2253354aad170a7ab10ae622bb97
422
py
Python
app/genetic/mutation_operators/gene_creation.py
SDomarecki/WSEOptimizer
e5595344085329aebcd35ac08a5f52fd9c1b1cf0
[ "MIT" ]
1
2021-08-18T03:18:44.000Z
2021-08-18T03:18:44.000Z
app/genetic/mutation_operators/gene_creation.py
SDomarecki/WSEOptimizer
e5595344085329aebcd35ac08a5f52fd9c1b1cf0
[ "MIT" ]
2
2021-02-25T08:25:57.000Z
2021-02-26T11:39:11.000Z
app/genetic/mutation_operators/gene_creation.py
SDomarecki/WSEOptimizer
e5595344085329aebcd35ac08a5f52fd9c1b1cf0
[ "MIT" ]
1
2021-03-05T12:35:58.000Z
2021-03-05T12:35:58.000Z
from app.genetic.mutation_operators.operator import Operator from app.genetic.genes.gene import Gene from app.genetic.genes.gene_factory import GeneFactory class GeneCreation(Operator): def __init__(self, mutation_rate: float, factory: GeneFactory): super().__init__(mutation_rate) self.factory = factory def mutate_one_gene(self, gene) -> Gene: return self.factory.create_random_gene()
32.461538
67
0.758294
54
422
5.62963
0.444444
0.069079
0.138158
0.125
0.151316
0
0
0
0
0
0
0
0.156398
422
12
68
35.166667
0.853933
0
0
0
0
0
0
0
0
0
0
0
0
1
0.222222
false
0
0.333333
0.111111
0.777778
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
1
1
0
0
4
6a1696ee568e86e7dafe241ae322da86ab46323c
1,164
py
Python
src/rest_framework_api_key/crypto.py
shabie/djangorestframework-api-key
0b5e3f2205b0a3cb5de5c7e46088051282e49dd0
[ "MIT" ]
462
2018-09-25T20:15:38.000Z
2022-03-25T19:25:02.000Z
src/rest_framework_api_key/crypto.py
shabie/djangorestframework-api-key
0b5e3f2205b0a3cb5de5c7e46088051282e49dd0
[ "MIT" ]
154
2018-09-22T14:55:27.000Z
2022-03-22T21:07:54.000Z
src/rest_framework_api_key/crypto.py
shabie/djangorestframework-api-key
0b5e3f2205b0a3cb5de5c7e46088051282e49dd0
[ "MIT" ]
89
2018-10-12T17:46:37.000Z
2022-03-07T23:31:33.000Z
import typing from django.contrib.auth.hashers import check_password, make_password from django.utils.crypto import get_random_string def concatenate(left: str, right: str) -> str: return "{}.{}".format(left, right) def split(concatenated: str) -> typing.Tuple[str, str]: left, _, right = concatenated.partition(".") return left, right class KeyGenerator: def __init__(self, prefix_length: int = 8, secret_key_length: int = 32): self.prefix_length = prefix_length self.secret_key_length = secret_key_length def get_prefix(self) -> str: return get_random_string(self.prefix_length) def get_secret_key(self) -> str: return get_random_string(self.secret_key_length) def hash(self, value: str) -> str: return make_password(value) def generate(self) -> typing.Tuple[str, str, str]: prefix = self.get_prefix() secret_key = self.get_secret_key() key = concatenate(prefix, secret_key) hashed_key = self.hash(key) return key, prefix, hashed_key def verify(self, key: str, hashed_key: str) -> bool: return check_password(key, hashed_key)
29.846154
76
0.684708
156
1,164
4.858974
0.275641
0.094987
0.079156
0.044855
0.084433
0.084433
0.084433
0
0
0
0
0.003257
0.208763
1,164
38
77
30.631579
0.819761
0
0
0
0
0
0.005155
0
0
0
0
0
0
1
0.307692
false
0.115385
0.115385
0.192308
0.730769
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
4
6a179ca24ef533b1fcb3f23c853bb1c77797d6d2
225
py
Python
test/run/t507.py
timmartin/skulpt
2e3a3fbbaccc12baa29094a717ceec491a8a6750
[ "MIT" ]
2,671
2015-01-03T08:23:25.000Z
2022-03-31T06:15:48.000Z
test/run/t507.py
timmartin/skulpt
2e3a3fbbaccc12baa29094a717ceec491a8a6750
[ "MIT" ]
972
2015-01-05T08:11:00.000Z
2022-03-29T13:47:15.000Z
test/run/t507.py
timmartin/skulpt
2e3a3fbbaccc12baa29094a717ceec491a8a6750
[ "MIT" ]
845
2015-01-03T19:53:36.000Z
2022-03-29T18:34:22.000Z
import random l = [None, float('-inf'), -1, False, 0.1, True, 2.7, 123456789123456789123456789L, float('inf'), {1: 2, 3: 4}, [1, 2, 3], 'hello', (1, 2, 3)] for x in range(10): random.shuffle(l) l.sort() print l
25
141
0.568889
39
225
3.282051
0.615385
0.046875
0.070313
0
0
0
0
0
0
0
0
0.24581
0.204444
225
8
142
28.125
0.469274
0
0
0
0
0
0.053333
0
0
0
0
0
0
0
null
null
0
0.166667
null
null
0.166667
0
0
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
1
0
0
0
0
0
0
0
0
4
6a1a8b41fa289addf609fc5b8ce8b3664684c97f
518
py
Python
integration_tests/environment_data.py
CanopySimulations/canopy-python
9ec37e674e65d6fbef0402ac0c612c163d55631e
[ "MIT" ]
null
null
null
integration_tests/environment_data.py
CanopySimulations/canopy-python
9ec37e674e65d6fbef0402ac0c612c163d55631e
[ "MIT" ]
1
2022-01-31T10:18:08.000Z
2022-01-31T10:18:08.000Z
integration_tests/environment_data.py
CanopySimulations/canopy-python
9ec37e674e65d6fbef0402ac0c612c163d55631e
[ "MIT" ]
null
null
null
import canopy class EnvironmentData(object): def __init__( self, authentication: canopy.AuthenticationData): self._authentication = authentication @property def authentication(self) -> canopy.AuthenticationData: return self._authentication def create_session(self) -> canopy.Session: return canopy.Session(self._authentication) # return canopy.Session(self._authentication, proxy=canopy.ProxyConfiguration('http://localhost:8888', '1', '1'))
30.470588
121
0.694981
47
518
7.468085
0.425532
0.25641
0.108262
0.131054
0.210826
0
0
0
0
0
0
0.014599
0.206564
518
16
122
32.375
0.839416
0.214286
0
0
0
0
0
0
0
0
0
0
0
1
0.272727
false
0
0.090909
0.181818
0.636364
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
6a33ecce772b0e517120c6701d2f841944d9fe75
92
py
Python
perros/apps.py
FacundoAlvarado9/cuchanoble-backend
d04c91cdbbc61ec50db441847fec6f6b14bb5087
[ "MIT" ]
1
2017-11-21T00:25:03.000Z
2017-11-21T00:25:03.000Z
perros/apps.py
FacundoAlvarado9/cuchanoble
d04c91cdbbc61ec50db441847fec6f6b14bb5087
[ "MIT" ]
7
2020-02-11T23:24:22.000Z
2022-01-13T00:49:07.000Z
perros/apps.py
FacundoAlvarado9/cuchanoble-backend
d04c91cdbbc61ec50db441847fec6f6b14bb5087
[ "MIT" ]
null
null
null
from django.apps import AppConfig class PerrosConfig(AppConfig): name = 'perros'
15.333333
34
0.706522
10
92
6.5
0.9
0
0
0
0
0
0
0
0
0
0
0
0.217391
92
5
35
18.4
0.902778
0
0
0
0
0
0.068966
0
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
1
0
1
0
0
4
dbe5931c92ad78211b9144686dac798306859e11
401
py
Python
sparkdq/repository/MetricsRepositoryLoader.py
PasaLab/SparkDQ
16d50210747ef7de03cf36d689ce26ff7445f63a
[ "Apache-2.0" ]
1
2021-02-08T07:49:54.000Z
2021-02-08T07:49:54.000Z
sparkdq/repository/MetricsRepositoryLoader.py
PasaLab/SparkDQ
16d50210747ef7de03cf36d689ce26ff7445f63a
[ "Apache-2.0" ]
null
null
null
sparkdq/repository/MetricsRepositoryLoader.py
PasaLab/SparkDQ
16d50210747ef7de03cf36d689ce26ff7445f63a
[ "Apache-2.0" ]
null
null
null
from abc import abstractmethod class MetricsRepositoryLoader: @abstractmethod def with_tag_values(self, tag_values): pass @abstractmethod def for_analyzers(self, analyzers): pass @abstractmethod def after(self, date_time): pass @abstractmethod def before(self, date_time): pass @abstractmethod def get(self): pass
16.04
42
0.645885
41
401
6.170732
0.463415
0.335968
0.332016
0.126482
0.26087
0.26087
0
0
0
0
0
0
0.291771
401
24
43
16.708333
0.890845
0
0
0.588235
0
0
0
0
0
0
0
0
0
1
0.294118
false
0.294118
0.058824
0
0.411765
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
1
0
1
0
0
0
0
0
4
e001bb2fcc26e6c0e466a9d51e45bed3a34fe017
147
py
Python
run_time/src/gae_server/third_party/old-fonttools-master/Lib/fontTools/pens/__init__.py
moyogo/tachyfont
05c8b3e7357e7a13af37ef81b719a0ff749105a5
[ "Apache-2.0" ]
21
2015-01-16T05:10:02.000Z
2021-06-11T20:48:15.000Z
run_time/src/gae_server/third_party/old-fonttools-master/Lib/fontTools/pens/__init__.py
moyogo/tachyfont
05c8b3e7357e7a13af37ef81b719a0ff749105a5
[ "Apache-2.0" ]
9
2019-06-15T21:31:27.000Z
2021-05-08T18:55:51.000Z
run_time/src/gae_server/third_party/old-fonttools-master/Lib/fontTools/pens/__init__.py
moyogo/tachyfont
05c8b3e7357e7a13af37ef81b719a0ff749105a5
[ "Apache-2.0" ]
2
2015-05-03T04:51:08.000Z
2018-08-24T08:28:53.000Z
"""Empty __init__.py file to signal Python this directory is a package. (It can't be completely empty since WinZip seems to skip empty files.) """
36.75
71
0.755102
25
147
4.28
0.88
0
0
0
0
0
0
0
0
0
0
0
0.163265
147
3
72
49
0.869919
0.945578
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
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
e01bba3e69070ffda76f330f1bdd3bd5f9ad4c4a
270
py
Python
server/app/budget/models/signals/__init__.py
catvitalio/personal-budget
b4470115ebbfd185a8a781a2024787cbfe822639
[ "MIT" ]
null
null
null
server/app/budget/models/signals/__init__.py
catvitalio/personal-budget
b4470115ebbfd185a8a781a2024787cbfe822639
[ "MIT" ]
null
null
null
server/app/budget/models/signals/__init__.py
catvitalio/personal-budget
b4470115ebbfd185a8a781a2024787cbfe822639
[ "MIT" ]
null
null
null
from .include_expense import include_expense from .include_income import include_income from .include_transfer import include_transfer from .exclude_expense import exclude_expense from .exclude_income import exclude_income from .exclude_transfer import exclude_transfer
38.571429
46
0.888889
36
270
6.333333
0.194444
0.144737
0
0
0
0
0
0
0
0
0
0
0.088889
270
6
47
45
0.926829
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
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
4
e0249f734c1f00925111097cd4f339d205463164
208
py
Python
illuminate_core/support/utils.py
tonyhhyip/py-illuminate
173162c8b6e5a49472515142d5446fae543ff7b4
[ "MIT" ]
null
null
null
illuminate_core/support/utils.py
tonyhhyip/py-illuminate
173162c8b6e5a49472515142d5446fae543ff7b4
[ "MIT" ]
null
null
null
illuminate_core/support/utils.py
tonyhhyip/py-illuminate
173162c8b6e5a49472515142d5446fae543ff7b4
[ "MIT" ]
null
null
null
import inspect from typing import Any, Callable def call_user_func(func: Callable, *args) -> Any: signature = inspect.signature(func) args = args[0:len(signature.parameters)] return func(*args)
23.111111
49
0.721154
28
208
5.285714
0.571429
0.108108
0
0
0
0
0
0
0
0
0
0.00578
0.168269
208
8
50
26
0.849711
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.333333
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
0
0
1
0
1
0
0
4
e034cfa1ca34848053ad67da792b4468d569a242
23
py
Python
libsolace/data/__init__.py
ExalDraen/python-libsolace
76abd2ac8b9f2c579fa9c23ae0c988ce001fabaf
[ "MIT" ]
null
null
null
libsolace/data/__init__.py
ExalDraen/python-libsolace
76abd2ac8b9f2c579fa9c23ae0c988ce001fabaf
[ "MIT" ]
null
null
null
libsolace/data/__init__.py
ExalDraen/python-libsolace
76abd2ac8b9f2c579fa9c23ae0c988ce001fabaf
[ "MIT" ]
2
2019-09-06T23:47:35.000Z
2020-09-14T10:06:07.000Z
''' libsolace data '''
5.75
14
0.565217
2
23
6.5
1
0
0
0
0
0
0
0
0
0
0
0
0.173913
23
3
15
7.666667
0.684211
0.608696
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
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
e03f101055a154b254cc4a19a11df6e739ad4c4f
130
py
Python
spidey_simulation/spidey_py/spidey_python/omniverse/__init__.py
JasonJZLiu/Spidey-Quadruped
74c1817f997b354bae4fffd2728f2cc94947062c
[ "MIT" ]
5
2021-06-14T03:12:18.000Z
2021-12-23T12:58:56.000Z
spidey_simulation/spidey_py/spidey_python/omniverse/__init__.py
JasonJZLiu/Spidey-Quadruped
74c1817f997b354bae4fffd2728f2cc94947062c
[ "MIT" ]
null
null
null
spidey_simulation/spidey_py/spidey_python/omniverse/__init__.py
JasonJZLiu/Spidey-Quadruped
74c1817f997b354bae4fffd2728f2cc94947062c
[ "MIT" ]
null
null
null
""" This module provides all the interfaces related to omniverse simulator. """ from .kit import * from .helpers import * # EOF
14.444444
71
0.723077
17
130
5.529412
0.882353
0
0
0
0
0
0
0
0
0
0
0
0.184615
130
8
72
16.25
0.886792
0.584615
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
0
0
0
4
e04749c8d5a517c074d5d4475d5705e2863696ab
405
py
Python
terrascript/dns/r.py
vfoucault/python-terrascript
fe82b3d7e79ffa72b7871538f999828be0a115d0
[ "BSD-2-Clause" ]
null
null
null
terrascript/dns/r.py
vfoucault/python-terrascript
fe82b3d7e79ffa72b7871538f999828be0a115d0
[ "BSD-2-Clause" ]
null
null
null
terrascript/dns/r.py
vfoucault/python-terrascript
fe82b3d7e79ffa72b7871538f999828be0a115d0
[ "BSD-2-Clause" ]
null
null
null
from terrascript import _resource class dns_a_record_set(_resource): pass a_record_set = dns_a_record_set class dns_ns_record_set(_resource): pass ns_record_set = dns_ns_record_set class dns_aaaa_record_set(_resource): pass aaaa_record_set = dns_aaaa_record_set class dns_cname_record(_resource): pass cname_record = dns_cname_record class dns_ptr_record(_resource): pass ptr_record = dns_ptr_record
23.823529
42
0.854321
68
405
4.5
0.205882
0.264706
0.098039
0.205882
0
0
0
0
0
0
0
0
0.096296
405
16
43
25.3125
0.836066
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.454545
0.090909
0
0.545455
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
4
e065a7fd1aab2f3e6edb2c07d5a2c45e30938acc
175
py
Python
World 1.0 - Fundamentos/30 - Par ou Impar.py
melissa-mfs/Exercicios-de-Python
91c3b7bca601df4c211803805e20e4f0bea73642
[ "MIT" ]
null
null
null
World 1.0 - Fundamentos/30 - Par ou Impar.py
melissa-mfs/Exercicios-de-Python
91c3b7bca601df4c211803805e20e4f0bea73642
[ "MIT" ]
null
null
null
World 1.0 - Fundamentos/30 - Par ou Impar.py
melissa-mfs/Exercicios-de-Python
91c3b7bca601df4c211803805e20e4f0bea73642
[ "MIT" ]
null
null
null
#Entrada de dados numero = int(input('Digite um número :')) #Processamento e Saida de dados if numero % 2 == 0: print('O número é PAR') else: print('O número é IMPAR')
25
41
0.662857
29
175
4
0.724138
0.12069
0.206897
0.224138
0
0
0
0
0
0
0
0.014388
0.205714
175
7
42
25
0.820144
0.262857
0
0
0
0
0.375
0
0
0
0
0
0
1
0
false
0
0
0
0
0.4
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
0
0
4
0eb93535876120d1899265a34ec044446c0fe45b
70
py
Python
kattis/Faktor.py
jaredliw/python-question-bank
9c8c246623d8d171f875700b57772df0afcbdcdf
[ "MIT" ]
1
2021-04-08T07:49:15.000Z
2021-04-08T07:49:15.000Z
kattis/Faktor.py
jaredliw/leetcode-solutions
9c8c246623d8d171f875700b57772df0afcbdcdf
[ "MIT" ]
null
null
null
kattis/Faktor.py
jaredliw/leetcode-solutions
9c8c246623d8d171f875700b57772df0afcbdcdf
[ "MIT" ]
1
2022-01-23T02:12:24.000Z
2022-01-23T02:12:24.000Z
# CPU: 0.05 s a, i = map(int, input().split()) print(a * (i - 1) + 1)
17.5
32
0.485714
15
70
2.266667
0.8
0.117647
0
0
0
0
0
0
0
0
0
0.092593
0.228571
70
3
33
23.333333
0.537037
0.157143
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
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
0
0
0
1
0
4
0ec9cfae066b357978f0fa4c381fc13997260fb4
132
py
Python
Chapter 04/Chap04_Example4.22.py
Anancha/Programming-Techniques-using-Python
e80c329d2a27383909d358741a5cab03cb22fd8b
[ "MIT" ]
null
null
null
Chapter 04/Chap04_Example4.22.py
Anancha/Programming-Techniques-using-Python
e80c329d2a27383909d358741a5cab03cb22fd8b
[ "MIT" ]
null
null
null
Chapter 04/Chap04_Example4.22.py
Anancha/Programming-Techniques-using-Python
e80c329d2a27383909d358741a5cab03cb22fd8b
[ "MIT" ]
null
null
null
g1 = 1 def display(): global g1 g1 = 2 print(g1) print("inside",id(g1)) display() print(g1) print("outside",id(g1))
13.2
26
0.575758
21
132
3.619048
0.47619
0.184211
0.315789
0
0
0
0
0
0
0
0
0.089109
0.234848
132
9
27
14.666667
0.663366
0
0
0.222222
0
0
0.098485
0
0
0
0
0
0
1
0.111111
false
0
0
0
0.111111
0.444444
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
0
0
0
1
0
4
0eda5aebe6c0990d04b3937024959699b96b85e7
57
py
Python
lithops/storage/backends/gcsfs/__init__.py
kpavel/lithops
395eef8b283512bd714d3633dcd94258e1df620c
[ "Apache-2.0" ]
158
2020-09-16T13:22:03.000Z
2022-03-28T20:01:31.000Z
lithops/storage/backends/gcsfs/__init__.py
kpavel/lithops
395eef8b283512bd714d3633dcd94258e1df620c
[ "Apache-2.0" ]
204
2020-09-17T12:59:29.000Z
2022-03-28T19:03:22.000Z
lithops/storage/backends/gcsfs/__init__.py
kpavel/lithops
395eef8b283512bd714d3633dcd94258e1df620c
[ "Apache-2.0" ]
48
2020-09-19T15:29:53.000Z
2022-03-23T17:08:24.000Z
from .gcsfs import GcsfsStorageBackend as StorageBackend
28.5
56
0.877193
6
57
8.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.105263
57
1
57
57
0.980392
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
0
0
0
4
0ef7a2cdbd22ac64a5b09a516cede82c193a7396
221
py
Python
tests/test_input_stokes_slip_bc_penalty.py
clazaro/sfepy
78757a6989d6aaf85a3fb27957b9179c5e2aa2c7
[ "BSD-3-Clause" ]
1
2021-06-07T13:20:04.000Z
2021-06-07T13:20:04.000Z
tests/test_input_stokes_slip_bc_penalty.py
clazaro/sfepy
78757a6989d6aaf85a3fb27957b9179c5e2aa2c7
[ "BSD-3-Clause" ]
null
null
null
tests/test_input_stokes_slip_bc_penalty.py
clazaro/sfepy
78757a6989d6aaf85a3fb27957b9179c5e2aa2c7
[ "BSD-3-Clause" ]
null
null
null
from __future__ import absolute_import input_name = '../examples/navier_stokes/stokes_slip_bc_penalty.py' output_name = 'test_stokes_slip_bc_penalty.vtk' from tests_basic import TestInput class Test(TestInput): pass
27.625
66
0.828054
32
221
5.21875
0.65625
0.11976
0.143713
0.227545
0
0
0
0
0
0
0
0
0.099548
221
7
67
31.571429
0.839196
0
0
0
0
0
0.371041
0.371041
0
0
0
0
0
1
0
false
0.166667
0.333333
0
0.5
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
0
0
0
4
0ef9bbd8fb512badcba7f6cae7ae274b4566cb13
146
py
Python
download117M.py
asierarranz/GPT_Bench
b9d46cba218b09cb5f00f2a56a386853ee2c672e
[ "MIT" ]
1
2020-01-24T16:32:38.000Z
2020-01-24T16:32:38.000Z
download117M.py
asierarranz/GPT_Bench
b9d46cba218b09cb5f00f2a56a386853ee2c672e
[ "MIT" ]
null
null
null
download117M.py
asierarranz/GPT_Bench
b9d46cba218b09cb5f00f2a56a386853ee2c672e
[ "MIT" ]
null
null
null
import warnings warnings.simplefilter(action='ignore', category=FutureWarning) import gpt_2_simple as gpt2 gpt2.download_gpt2(model_name="117M")
24.333333
62
0.835616
20
146
5.9
0.8
0
0
0
0
0
0
0
0
0
0
0.051471
0.068493
146
5
63
29.2
0.816176
0
0
0
0
0
0.068493
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
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
0
0
0
4
0efb114a10c5557ea67b8e6752ee8f6e583e6196
474
py
Python
apps/counter/app.py
rapidsms/rapidsms-legacy
43c2ecd41fd1541a2538326edee3d9e816d84529
[ "BSD-3-Clause" ]
null
null
null
apps/counter/app.py
rapidsms/rapidsms-legacy
43c2ecd41fd1541a2538326edee3d9e816d84529
[ "BSD-3-Clause" ]
null
null
null
apps/counter/app.py
rapidsms/rapidsms-legacy
43c2ecd41fd1541a2538326edee3d9e816d84529
[ "BSD-3-Clause" ]
1
2019-11-02T19:35:54.000Z
2019-11-02T19:35:54.000Z
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 import rapidsms class App(rapidsms.app.App): def start(self): self.counters = {} def parse(self, msg): if not msg.connection.identity in self.counters: self.counters[msg.connection.identity] = 0 def handle(self, msg): self.counters[msg.connection.identity] += 1 msg.respond("You've spoken to me %d times!" % (self.counters[msg.connection.identity]))
26.333333
95
0.622363
67
474
4.402985
0.552239
0.20339
0.284746
0.254237
0.335593
0
0
0
0
0
0
0.013966
0.244726
474
17
96
27.882353
0.810056
0.099156
0
0
0
0
0.068235
0
0
0
0
0
0
1
0.3
false
0
0.1
0
0.5
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
0
0
0
4
0efeea228827e4d2ba6953620d7b717e3ddc84ef
144
py
Python
tests/asp/weakConstraints/optimization.example2.nonground.gringo.test.py
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
19
2015-12-03T08:53:45.000Z
2022-03-31T02:09:43.000Z
tests/asp/weakConstraints/optimization.example2.nonground.gringo.test.py
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
80
2017-11-25T07:57:32.000Z
2018-06-10T19:03:30.000Z
tests/asp/weakConstraints/optimization.example2.nonground.gringo.test.py
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
6
2015-01-15T07:51:48.000Z
2020-06-18T14:47:48.000Z
input = """ 8 2 2 3 0 0 8 2 4 5 0 0 8 2 6 7 0 0 6 0 4 0 2 3 4 5 1 1 1 1 0 4 c 3 b 7 f 2 a 6 e 5 d 0 B+ 0 B- 1 0 1 """ output = """ COST 2@1 """
6
23
0.465278
55
144
1.218182
0.327273
0.089552
0.089552
0.119403
0
0
0
0
0
0
0
0.52381
0.416667
144
23
24
6.26087
0.27381
0
0
0.086957
0
0
0.784722
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
161ae04161624371abcd780faf5959c4c0fa27be
234
py
Python
kvdroid/path.py
VICTORVICKIE/Kvdroid
9441ef189b6cdbf761e4f3bfd22cbdf8eb93e7fb
[ "MIT" ]
null
null
null
kvdroid/path.py
VICTORVICKIE/Kvdroid
9441ef189b6cdbf761e4f3bfd22cbdf8eb93e7fb
[ "MIT" ]
null
null
null
kvdroid/path.py
VICTORVICKIE/Kvdroid
9441ef189b6cdbf761e4f3bfd22cbdf8eb93e7fb
[ "MIT" ]
null
null
null
import os from kvdroid import Environment def path(): return os.path.dirname(os.path.abspath("__main__")) app_folder = path() def sdcard(): return Environment.getExternalStorageDirectory().toString() sdcard = sdcard()
13.764706
63
0.726496
27
234
6.111111
0.592593
0.072727
0
0
0
0
0
0
0
0
0
0
0.153846
234
16
64
14.625
0.833333
0
0
0
0
0
0.034188
0
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
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
4
165beb318f4d6a24a79ecfbc39939b7ad55ccf1d
4,029
py
Python
Wigle/python-client/swagger_client/__init__.py
BillReyor/SSIDprobeCollector
437989fd1e9d8d200ca28f88a692ecc17530db73
[ "MIT" ]
1
2022-01-30T16:34:05.000Z
2022-01-30T16:34:05.000Z
Wigle/python-client/swagger_client/__init__.py
BillReyor/SSIDprobeCollector
437989fd1e9d8d200ca28f88a692ecc17530db73
[ "MIT" ]
null
null
null
Wigle/python-client/swagger_client/__init__.py
BillReyor/SSIDprobeCollector
437989fd1e9d8d200ca28f88a692ecc17530db73
[ "MIT" ]
null
null
null
# coding: utf-8 # flake8: noqa """ WiGLE API Search, upload, and integrate statistics from WiGLE. Use API Name+Token from https://wigle.net/account # noqa: E501 OpenAPI spec version: 3.1 Contact: WiGLE-admin@wigle.net Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import # import apis into sdk package from swagger_client.api.bluetooth_search_and_information_tools_api import BluetoothSearchAndInformationToolsApi from swagger_client.api.cell_search_and_information_tools_api import CellSearchAndInformationToolsApi from swagger_client.api.network_observation_file_upload_and_status__api import NetworkObservationFileUploadAndStatus_Api from swagger_client.api.network_search_and_information_tools_api import NetworkSearchAndInformationToolsApi from swagger_client.api.statistics_and_information_api import StatisticsAndInformationApi from swagger_client.api.stats_group_management_api import StatsGroupManagementApi from swagger_client.api.user_profile_operations_api import UserProfileOperationsApi from swagger_client.api.v3_alpha_api import V3ALPHAApi # import ApiClient from swagger_client.api_client import ApiClient from swagger_client.configuration import Configuration # import models into sdk package from swagger_client.models.auth_token import AuthToken from swagger_client.models.auth_tokens_response import AuthTokensResponse from swagger_client.models.bluetooth_location import BluetoothLocation from swagger_client.models.bt_detail import BtDetail from swagger_client.models.bt_location_cluster import BtLocationCluster from swagger_client.models.cell_detail import CellDetail from swagger_client.models.cell_location_cluster import CellLocationCluster from swagger_client.models.cell_site_channel import CellSiteChannel from swagger_client.models.channel_detail_response import ChannelDetailResponse from swagger_client.models.countries_response import CountriesResponse from swagger_client.models.country_stat import CountryStat from swagger_client.models.encryption_stat import EncryptionStat from swagger_client.models.generic_location import GenericLocation from swagger_client.models.geocoding_response import GeocodingResponse from swagger_client.models.group import Group from swagger_client.models.group_member import GroupMember from swagger_client.models.group_member_response import GroupMemberResponse from swagger_client.models.group_response import GroupResponse from swagger_client.models.group_stat import GroupStat from swagger_client.models.group_stat_response import GroupStatResponse from swagger_client.models.net_comment_response import NetCommentResponse from swagger_client.models.net_search_response import NetSearchResponse from swagger_client.models.network_geocoding_response import NetworkGeocodingResponse from swagger_client.models.person import Person from swagger_client.models.postal_stat import PostalStat from swagger_client.models.region_response import RegionResponse from swagger_client.models.region_stat import RegionStat from swagger_client.models.street_address import StreetAddress from swagger_client.models.trans_log import TransLog from swagger_client.models.transid_response import TransidResponse from swagger_client.models.translog_response import TranslogResponse from swagger_client.models.upload_response import UploadResponse from swagger_client.models.upload_results_response import UploadResultsResponse from swagger_client.models.user_standings import UserStandings from swagger_client.models.user_stats_response import UserStatsResponse from swagger_client.models.wi_fi_detail import WiFiDetail from swagger_client.models.wi_fi_location import WiFiLocation from swagger_client.models.wi_fi_location_cluster import WiFiLocationCluster from swagger_client.models.wi_fi_network import WiFiNetwork from swagger_client.models.wi_fi_network_detail_response import WiFiNetworkDetailResponse from swagger_client.models.wi_fi_network_with_location import WiFiNetworkWithLocation
55.191781
120
0.894018
513
4,029
6.723197
0.269006
0.162656
0.251377
0.273413
0.307046
0.14352
0.04987
0
0
0
0
0.002404
0.070985
4,029
72
121
55.958333
0.919049
0.088111
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
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
0
0
0
4
165d7e72ffc04a88f94f61cfd71fb01d25054fd7
209
py
Python
checkov/common/graph/db_connectors/db_connector.py
jamesholland-uk/checkov
d73fd4bd7096d48ab3434a92a177bcc55605460a
[ "Apache-2.0" ]
4,013
2019-12-09T13:16:54.000Z
2022-03-31T14:31:01.000Z
checkov/common/graph/db_connectors/db_connector.py
jamesholland-uk/checkov
d73fd4bd7096d48ab3434a92a177bcc55605460a
[ "Apache-2.0" ]
1,258
2019-12-17T09:55:51.000Z
2022-03-31T19:17:17.000Z
checkov/common/graph/db_connectors/db_connector.py
jamesholland-uk/checkov
d73fd4bd7096d48ab3434a92a177bcc55605460a
[ "Apache-2.0" ]
638
2019-12-19T08:57:38.000Z
2022-03-30T21:38:37.000Z
class DBConnector: def save_graph(self, local_graph): pass def get_reader_endpoint(self): pass def get_writer_endpoint(self): pass def disconnect(self): pass
16.076923
38
0.617225
25
209
4.92
0.52
0.170732
0.162602
0.308943
0
0
0
0
0
0
0
0
0.315789
209
12
39
17.416667
0.86014
0
0
0.444444
0
0
0
0
0
0
0
0
0
1
0.444444
false
0.444444
0
0
0.555556
0
1
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
4
16668574dc81e4b7fb597e3451742037cbf58504
12,778
py
Python
stores/apps/payments/migrations/0003_auto__add_paypaltransaction.py
diassor/CollectorCity-Market-Place
892ad220b8cf1c0fc7433f625213fe61729522b2
[ "Apache-2.0" ]
135
2015-03-19T13:28:18.000Z
2022-03-27T06:41:42.000Z
stores/apps/payments/migrations/0003_auto__add_paypaltransaction.py
dfcoding/CollectorCity-Market-Place
e59acec3d600c049323397b17cae14fdcaaaec07
[ "Apache-2.0" ]
null
null
null
stores/apps/payments/migrations/0003_auto__add_paypaltransaction.py
dfcoding/CollectorCity-Market-Place
e59acec3d600c049323397b17cae14fdcaaaec07
[ "Apache-2.0" ]
83
2015-01-30T01:00:15.000Z
2022-03-08T17:25:10.000Z
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'PayPalTransaction' db.create_table('payments_paypaltransaction', ( ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('sell', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['sell.Sell'])), ('transaction_id', self.gf('django.db.models.fields.CharField')(max_length=30)), )) db.send_create_signal('payments', ['PayPalTransaction']) def backwards(self, orm): # Deleting model 'PayPalTransaction' db.delete_table('payments_paypaltransaction') models = { 'auth.group': { 'Meta': {'object_name': 'Group'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) }, 'auth.permission': { 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) }, 'auth.user': { 'Meta': {'object_name': 'User'}, 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'}) }, 'contenttypes.contenttype': { 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) }, 'market.marketplace': { 'Meta': {'object_name': 'MarketPlace'}, 'base_domain': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '92'}), 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '92', 'db_index': 'True'}), 'template_prefix': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '92', 'db_index': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '92'}) }, 'payments.braintreeshopsettings': { 'Meta': {'object_name': 'BraintreeShopSettings'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'merchant_id': ('django.db.models.fields.CharField', [], {'max_length': '40'}), 'private_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}), 'public_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}), 'shop': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['shops.Shop']"}) }, 'payments.braintreetransaction': { 'Meta': {'object_name': 'BrainTreeTransaction'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'sell': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sell.Sell']"}), 'transaction_id': ('django.db.models.fields.CharField', [], {'max_length': '20'}) }, 'payments.googlecheckoutorder': { 'Meta': {'object_name': 'GoogleCheckoutOrder'}, 'buyer_id': ('django.db.models.fields.CharField', [], {'max_length': '20'}), 'financial_state': ('django.db.models.fields.CharField', [], {'max_length': '20'}), 'fulfillment_state': ('django.db.models.fields.CharField', [], {'max_length': '20'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'order_number': ('django.db.models.fields.CharField', [], {'max_length': '20'}), 'ready_to_ship': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'sell': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sell.Sell']"}) }, 'payments.googlecheckoutshopsettings': { 'Meta': {'object_name': 'GoogleCheckoutShopSettings'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'merchant_id': ('django.db.models.fields.CharField', [], {'max_length': '20'}), 'merchant_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}), 'shop': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['shops.Shop']"}) }, 'payments.manualpaymentshopsettings': { 'Meta': {'object_name': 'ManualPaymentShopSettings'}, 'description': ('django.db.models.fields.TextField', [], {'default': "''"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'instructions': ('django.db.models.fields.TextField', [], {}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}), 'shop': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['shops.Shop']"}) }, 'payments.paypalshopsettings': { 'Meta': {'object_name': 'PayPalShopSettings'}, 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}), 'first_name': ('django.db.models.fields.EmailField', [], {'max_length': '75'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'last_name': ('django.db.models.fields.EmailField', [], {'max_length': '75'}), 'payer_id': ('django.db.models.fields.CharField', [], {'max_length': '92'}), 'perms': ('picklefield.fields.PickledObjectField', [], {'default': '[]'}), 'shop': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['shops.Shop']"}) }, 'payments.paypaltoken': { 'Meta': {'object_name': 'PayPalToken'}, 'cart': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sell.Cart']"}), 'confirmed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'token': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) }, 'payments.paypaltransaction': { 'Meta': {'object_name': 'PayPalTransaction'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'sell': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sell.Sell']"}), 'transaction_id': ('django.db.models.fields.CharField', [], {'max_length': '30'}) }, 'sell.cart': { 'Meta': {'object_name': 'Cart'}, 'bidder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'shippingdata': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['sell.ShippingData']", 'unique': 'True', 'null': 'True', 'blank': 'True'}), 'shop': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['shops.Shop']"}) }, 'sell.sell': { 'Meta': {'object_name': 'Sell'}, 'bidder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), 'cancel': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'closed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'date_time': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'payment_method': ('django.db.models.fields.CharField', [], {'default': "'Manual Payment'", 'max_length': '255'}), 'shippingdata': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['sell.ShippingData']", 'unique': 'True', 'null': 'True', 'blank': 'True'}), 'shop': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['shops.Shop']", 'null': 'True'}), 'total': ('django.db.models.fields.DecimalField', [], {'default': "'0'", 'max_digits': '11', 'decimal_places': '2'}), 'total_taxes': ('django.db.models.fields.DecimalField', [], {'default': "'0'", 'max_digits': '11', 'decimal_places': '2'}), 'total_without_taxes': ('django.db.models.fields.DecimalField', [], {'default': "'0'", 'max_digits': '11', 'decimal_places': '2'}) }, 'sell.shippingdata': { 'Meta': {'object_name': 'ShippingData'}, 'city': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True', 'blank': 'True'}), 'country': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'state': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True', 'blank': 'True'}), 'street_address': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True', 'blank': 'True'}), 'zip': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}) }, 'shops.shop': { 'Meta': {'object_name': 'Shop'}, 'admin': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), 'bids': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'date_time': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'location': ('django.db.models.fields.CharField', [], {'default': "'39.29038,-76.61219'", 'max_length': '255'}), 'marketplace': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['market.MarketPlace']"}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '60'}), 'views': ('django.db.models.fields.IntegerField', [], {'default': '0'}) } } complete_apps = ['payments']
71.385475
169
0.555486
1,267
12,778
5.490923
0.137332
0.116142
0.201236
0.28748
0.741124
0.732787
0.71482
0.695846
0.61722
0.438839
0
0.012011
0.198544
12,778
178
170
71.786517
0.667318
0.006496
0
0.180723
0
0
0.578678
0.328973
0
0
0
0
0
1
0.012048
false
0.006024
0.024096
0
0.054217
0
0
0
0
null
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
1674a4637801fa20211da240be468fa21d7eb084
996
py
Python
setup.py
Codesee-io/currint
103ed6776fa5125a0e498c1f868bfb52adf5a98f
[ "Apache-2.0" ]
15
2015-07-19T10:54:34.000Z
2019-10-23T16:48:09.000Z
setup.py
Codesee-io/currint
103ed6776fa5125a0e498c1f868bfb52adf5a98f
[ "Apache-2.0" ]
6
2015-08-31T04:04:17.000Z
2018-02-20T18:57:28.000Z
setup.py
Codesee-io/currint
103ed6776fa5125a0e498c1f868bfb52adf5a98f
[ "Apache-2.0" ]
7
2017-10-12T22:38:23.000Z
2021-09-15T16:33:37.000Z
from setuptools import ( find_packages, setup, ) from currint import __version__ setup( name='currint', version=__version__, description='Integer-based, fixed precision currency calculation', packages=find_packages(), author='Andrew Godwin', author_email='andrew@aeracode.org', install_requires=[ 'six', ], test_suite='currint.tests', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Topic :: Software Development', ], )
28.457143
70
0.614458
93
996
6.44086
0.580645
0.222037
0.292154
0.173623
0
0
0
0
0
0
0
0.014865
0.257028
996
34
71
29.294118
0.794595
0
0
0.064516
0
0
0.543173
0
0
0
0
0
0
1
0
true
0
0.064516
0
0.064516
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
1
0
0
0
0
0
0
4
168133898eace07483f99f2c35e043f213c14baa
288
py
Python
basicsr/__init__.py
hiterjoshua/BasicSR
299b9459b5281d2d200bfd1d400515fe928a63c0
[ "Apache-2.0", "MIT" ]
null
null
null
basicsr/__init__.py
hiterjoshua/BasicSR
299b9459b5281d2d200bfd1d400515fe928a63c0
[ "Apache-2.0", "MIT" ]
null
null
null
basicsr/__init__.py
hiterjoshua/BasicSR
299b9459b5281d2d200bfd1d400515fe928a63c0
[ "Apache-2.0", "MIT" ]
null
null
null
# https://github.com/xinntao/BasicSR # flake8: noqa from .archs import * from .data import * from .losses import * from .metrics import * from .models import * # from .ops import * from .test import * from .train import * from .utils import * from .version import __gitsha__, __version__
22.153846
44
0.732639
39
288
5.205128
0.512821
0.44335
0
0
0
0
0
0
0
0
0
0.004149
0.163194
288
12
45
24
0.838174
0.229167
0
0
0
0
0
0
0
0
0
0
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
0
0
0
0
1
0
1
0
1
0
0
4
1698833c144c21fc7a54539d48ce4a920e680264
143
py
Python
tests/asp/AllAnswerSets/nontight/example.gus1.asp.gringo.test.py
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
19
2015-12-03T08:53:45.000Z
2022-03-31T02:09:43.000Z
tests/asp/AllAnswerSets/nontight/example.gus1.asp.gringo.test.py
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
80
2017-11-25T07:57:32.000Z
2018-06-10T19:03:30.000Z
tests/asp/AllAnswerSets/nontight/example.gus1.asp.gringo.test.py
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
6
2015-01-15T07:51:48.000Z
2020-06-18T14:47:48.000Z
input = """ 1 2 2 1 3 4 1 3 2 1 2 4 1 4 0 0 1 5 1 0 2 1 6 1 0 5 1 5 1 0 6 0 3 d 2 c 6 b 5 a 0 B+ 0 B- 1 0 1 """ output = """ {d} {c, a, b} """
5.72
12
0.433566
53
143
1.169811
0.245283
0.129032
0.096774
0.129032
0
0
0
0
0
0
0
0.488095
0.412587
143
24
13
5.958333
0.25
0
0
0.083333
0
0
0.783217
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
16a563870ad493fed817178a7a9c39c97d86d8db
20
py
Python
src/eoapi/raster/eoapi/raster/__init__.py
drnextgis/eoAPI
690d6f9efcb4108ae0f21334fd4ed4db79e80366
[ "MIT" ]
14
2021-08-31T19:03:46.000Z
2022-03-18T20:05:01.000Z
src/eoapi/raster/eoapi/raster/__init__.py
drnextgis/eoAPI
690d6f9efcb4108ae0f21334fd4ed4db79e80366
[ "MIT" ]
27
2021-08-30T17:34:20.000Z
2022-03-10T18:15:53.000Z
src/eoapi/raster/eoapi/raster/__init__.py
drnextgis/eoAPI
690d6f9efcb4108ae0f21334fd4ed4db79e80366
[ "MIT" ]
2
2021-09-08T15:53:40.000Z
2022-03-01T20:25:51.000Z
"""eoapi.raster."""
10
19
0.55
2
20
5.5
1
0
0
0
0
0
0
0
0
0
0
0
0.05
20
1
20
20
0.578947
0.65
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
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
16a9ecdbd9eef9ed95681122c000e2d1e264c261
154
py
Python
__main__.py
jhubaum/draft
f6cf6ea5c9571c8d6bff55216cf3f5604b8a1600
[ "MIT" ]
null
null
null
__main__.py
jhubaum/draft
f6cf6ea5c9571c8d6bff55216cf3f5604b8a1600
[ "MIT" ]
null
null
null
__main__.py
jhubaum/draft
f6cf6ea5c9571c8d6bff55216cf3f5604b8a1600
[ "MIT" ]
null
null
null
import os from . import app from .views import setup if __name__ == '__main__': setup() app.secret_key = os.urandom(12) app.run(debug=True)
15.4
35
0.668831
23
154
4.086957
0.695652
0
0
0
0
0
0
0
0
0
0
0.016529
0.214286
154
9
36
17.111111
0.760331
0
0
0
0
0
0.051948
0
0
0
0
0
0
1
0
true
0
0.428571
0
0.428571
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
16c5aa14f0c3017ca69f9d36fd4fcf7c36f7fc29
2,407
py
Python
meiduo_mall/meiduo_mall/apps/oauth/serializers.py
ld-xy/Django_html_vue.js
330bceccc1004d98d34b9f7171fe8e64bab6d409
[ "Apache-2.0" ]
1
2021-07-28T10:34:13.000Z
2021-07-28T10:34:13.000Z
meiduo_mall/meiduo_mall/apps/oauth/serializers.py
ld-xy/Django_vue_-
330bceccc1004d98d34b9f7171fe8e64bab6d409
[ "Apache-2.0" ]
null
null
null
meiduo_mall/meiduo_mall/apps/oauth/serializers.py
ld-xy/Django_vue_-
330bceccc1004d98d34b9f7171fe8e64bab6d409
[ "Apache-2.0" ]
null
null
null
from django_redis import get_redis_connection from rest_framework import serializers from .utils import check_save_user_token from users.models import User from .models import OAuthQQUser class QQAuthUserSerializer(serializers.Serializer): """openid 绑定用户的序列化器""" # mobile password sms_code access_token access_token = serializers.CharField(label='操作凭证') mobile = serializers.RegexField(label='手机号', regex=r'^1[3-9]\d{9}$') password = serializers.CharField(label='密码', max_length=20, min_length=8) sms_code = serializers.CharField(label='短信验证码') def validate(self, attrs): # 1.把加密的openid 取出来 加密 access_token = attrs.pop('access_token') openid = check_save_user_token(access_token) if openid is None: raise serializers.ValidationError('openid无效') # 1.1 把原本的openid 重新添加到attrs 字典(以备后期create方法中绑定使用) attrs['openid'] = openid # 2. 校验验证码 # 校验验证码 redis_conn = get_redis_connection('verify_codes') mobile = attrs['mobile'] real_sms_code = redis_conn.get('sms_%s' % mobile) # 向redis存储数据时都是以字条串进行存储的,取出来后都是bytes类型 [bytes] if real_sms_code is None or attrs['sms_code'] != real_sms_code.decode(): raise serializers.ValidationError('验证码错误') # 3.拿手机号查询 user表 如果能查到说明手机号已注册,如果已注册再绑定密码是否和用户匹配 try: user = User.objects.get(mobile=mobile) except User.DoesNotExist: raise serializers.ValidationError('用户不存在') else: if user.check_password(attrs['password']) is False: raise serializers.ValidationError('密码错误') else: # 如果用户已存在,并且密码也正确 把当前的user对象存储到反序列化大字典中以备后期绑定使用 attrs['user'] = user return attrs def create(self, validated_data): # 1.获取validated_data中的user,如果能取到user说明用户已存在 user = validated_data.get('user') if user is None: # 2.如果validated_data 里面没有取出user,创建一个新用户 user = User( username=validated_data.get('mobile'), mobile=validated_data.get('mobile') ) user.set_password(validated_data.get('password')) user.save() # 3. 把openid和user绑定 OAuthQQUser.objects.create( openid=validated_data.get('openid'), user=user ) # 4.把user返回 return user
2,407
2,407
0.635646
257
2,407
5.789883
0.412451
0.028226
0.053763
0.024194
0
0
0
0
0
0
0
0.009106
0.270046
2,407
1
2,407
2,407
0.837792
0.160781
0
0.044444
0
0
0.070359
0
0
0
0
0
0
1
0.044444
false
0.066667
0.111111
0
0.311111
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
16cbfc3b3257dbf81ae62f8f3af1bd4c1cf41dc3
184
py
Python
skylearn/__init__.py
sherwyn11/Skylearn.py
ab3069950a2f58222ccb9eefc1740f8896a0ea40
[ "MIT" ]
1
2020-05-17T21:24:34.000Z
2020-05-17T21:24:34.000Z
skylearn/__init__.py
sherwyn11/Skylearn.py
ab3069950a2f58222ccb9eefc1740f8896a0ea40
[ "MIT" ]
null
null
null
skylearn/__init__.py
sherwyn11/Skylearn.py
ab3069950a2f58222ccb9eefc1740f8896a0ea40
[ "MIT" ]
1
2020-04-26T11:11:08.000Z
2020-04-26T11:11:08.000Z
from flask import Flask, session import os app = Flask(__name__) app.config["SECRET_KEY"] = os.getenv('SECRET_KEY') app.secret_key = "HelloWorld" from skylearn import routes
20.444444
51
0.733696
26
184
4.923077
0.538462
0.210938
0
0
0
0
0
0
0
0
0
0
0.163043
184
8
52
23
0.831169
0
0
0
0
0
0.170455
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
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
0
0
0
4
16de842792da47e48dd3b9feb042576a5531b4ab
209
py
Python
exercises/exe01 - 10/exe009.py
thomas-rohde/Classes-Python
f862995510b7aabf68bc14aecf815f597034d8a1
[ "MIT" ]
null
null
null
exercises/exe01 - 10/exe009.py
thomas-rohde/Classes-Python
f862995510b7aabf68bc14aecf815f597034d8a1
[ "MIT" ]
null
null
null
exercises/exe01 - 10/exe009.py
thomas-rohde/Classes-Python
f862995510b7aabf68bc14aecf815f597034d8a1
[ "MIT" ]
null
null
null
l = float(input('Qual a largura da parede (em m)? ')) h = float(input('Qual a altura da parede (em m)? ')) m = float(l*h) print('A quantida de litros necessária para pintar essa parede é {:.2f}'.format(m/2))
41.8
85
0.660287
39
209
3.538462
0.615385
0.144928
0.202899
0.217391
0
0
0
0
0
0
0
0.011494
0.167464
209
5
85
41.8
0.781609
0
0
0
0
0
0.619048
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
0
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
bc8f06653efd6effe231538c02f5aa5fa040ea14
454
py
Python
deephyper/core/exceptions/loading.py
jtchilders/deephyper
06f9653599757a69fa5720820f4de3a1f154b081
[ "BSD-3-Clause" ]
null
null
null
deephyper/core/exceptions/loading.py
jtchilders/deephyper
06f9653599757a69fa5720820f4de3a1f154b081
[ "BSD-3-Clause" ]
null
null
null
deephyper/core/exceptions/loading.py
jtchilders/deephyper
06f9653599757a69fa5720820f4de3a1f154b081
[ "BSD-3-Clause" ]
null
null
null
"""Exceptions related with imports of modules/attributes/scripts. """ from deephyper.core.exceptions import DeephyperError class GenericLoaderError(DeephyperError): """Raised when the generic_loader function is failing. """ def __init__(self, str_value): self.str_value = str_value def __str__(self): return f"The target '{self.str_value}' cannot be imported because it's neither a python script nor a python module."
30.266667
124
0.73348
59
454
5.423729
0.728814
0.1
0.1125
0
0
0
0
0
0
0
0
0
0.180617
454
14
125
32.428571
0.860215
0.262115
0
0
0
0.166667
0.328173
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0.166667
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
1
1
0
0
4
bcb1152785898fd78050592e47535f089bfa0f92
229
py
Python
venv/Lib/site-packages/bootstrap3/templates/bootstrap3/messages.html.py
roshanba/mangal
f7b428811dc07214009cc33f0beb665ead402038
[ "bzip2-1.0.6", "MIT" ]
null
null
null
venv/Lib/site-packages/bootstrap3/templates/bootstrap3/messages.html.py
roshanba/mangal
f7b428811dc07214009cc33f0beb665ead402038
[ "bzip2-1.0.6", "MIT" ]
null
null
null
venv/Lib/site-packages/bootstrap3/templates/bootstrap3/messages.html.py
roshanba/mangal
f7b428811dc07214009cc33f0beb665ead402038
[ "bzip2-1.0.6", "MIT" ]
null
null
null
BBBB BBBBBBBBBB BBB BBBBBBB BB BBBBBBBB XXXX XXXXXXXFFFFFFFFFFFFFFFFFFFFFFFFF XXXXXXXXXXXXXXXXXXX XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX BBBBBB
28.625
99
0.820961
16
229
11.75
0.9375
0
0
0
0
0
0
0
0
0
0
0
0.179039
229
7
100
32.714286
1
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
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
1
0
0
0
0
0
0
0
0
4
bcc02da69d5fa05d6da6766290287fc2da6aaf0f
16,207
py
Python
tests/test_pocket.py
reactive-firewall/PiAP-python-tools
0313956cef86a4e44c606280e07afb2b94864581
[ "MIT-0" ]
2
2017-05-01T10:25:33.000Z
2018-06-22T21:54:52.000Z
tests/test_pocket.py
reactive-firewall/PiAP-python-tools
0313956cef86a4e44c606280e07afb2b94864581
[ "MIT-0" ]
89
2017-05-05T22:11:03.000Z
2020-04-05T03:06:36.000Z
tests/test_pocket.py
reactive-firewall/PiAP-python-tools
0313956cef86a4e44c606280e07afb2b94864581
[ "MIT-0" ]
null
null
null
#! /usr/bin/env python # -*- coding: utf-8 -*- # Pocket PiAP # ...................................................................... # Copyright (c) 2017-2020, Kendrick Walls # ...................................................................... # Licensed under MIT (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.github.com/reactive-firewall/PiAP-python-tools/LICENSE.rst # ...................................................................... # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. # ...................................................................... import subprocess try: import sys if sys.__name__ is None: # pragma: no branch raise ImportError("[CWE-758] OMG! we could not import sys! ABORT. ABORT.") except Exception as err: # pragma: no branch raise ImportError(err) try: try: import context except Exception as ImportErr: # pragma: no branch ImportErr = None del ImportErr from . import context if context.__name__ is None: raise ImportError("[CWE-758] Failed to import context") else: from context import unittest as unittest except Exception: raise ImportError("[CWE-758] Failed to import test context") def getPythonCommand(): """function for backend python command""" thepython = "exit 1 ; #" try: thepython = checkPythonCommand(["which", "coverage"]) if (str("/coverage") in str(thepython)) and (sys.version_info >= (3, 3)): thepython = str("coverage run -p") elif (str("/coverage") in str(thepython)) and (sys.version_info <= (3, 2)): try: import coverage if coverage.__name__ is not None: thepython = str("{} -m coverage run -p").format(str(sys.executable)) else: thepython = str(sys.executable) except Exception: thepython = str(sys.executable) else: thepython = str(sys.executable) except Exception: thepython = "exit 1 ; #" try: thepython = str(sys.executable) except Exception: thepython = "exit 1 ; #" return str(thepython) def checkPythonCommand(args=[None], stderr=None): """function for backend subprocess check_output command""" theOutput = None try: if args is None or args is [None]: theOutput = subprocess.check_output(["exit 1 ; #"]) else: if str("coverage ") in args[0]: if sys.__name__ is None: raise ImportError("Failed to import system. WTF?!!") if str("{} -m coverage ").format(str(sys.executable)) in str(args[0]): args[0] = str(sys.executable) args.insert(1, str("-m")) args.insert(2, str("coverage")) args.insert(3, str("run")) args.insert(4, str("-p")) args.insert(4, str("--source=piaplib,piaplib/lint,piaplib/keyring,piaplib/pku,piaplib/book")) else: args[0] = str("coverage") args.insert(1, str("run")) args.insert(2, str("-p")) args.insert(2, str("--source=piaplib,piaplib/lint,piaplib/keyring,piaplib/pku,piaplib/book")) theOutput = subprocess.check_output(args, stderr=stderr) except Exception as err: theOutput = None try: if err.output is not None: theOutput = err.output except Exception as cascadeErr: theOutput = None cascadeErr = None del cascadeErr try: if isinstance(theOutput, bytes): theOutput = theOutput.decode("""utf-8""") except UnicodeDecodeError: theOutput = bytes(theOutput) return theOutput def checkPythonFuzzing(args=[None], stderr=None): """function for backend subprocess check_output command""" theOutput = None try: if args is None or args is [None]: theOutput = subprocess.check_output(["exit 1 ; #"]) else: if str("coverage ") in args[0]: import sys if sys.__name__ is None: raise ImportError("Failed to import system. WTF?!!") if str("{} -m coverage ").format(str(sys.executable)) in str(args[0]): args[0] = str(sys.executable) args.insert(1, str("-m")) args.insert(2, str("coverage")) args.insert(3, str("run")) args.insert(4, str("-p")) args.insert(4, str("--source=piaplib,piaplib/lint,piaplib/keyring,piaplib/pku,piaplib/book")) else: args[0] = str("coverage") args.insert(1, str("run")) args.insert(2, str("-p")) args.insert(2, str("--source=piaplib,piaplib/lint,piaplib/keyring,piaplib/pku,piaplib/book")) theOutput = subprocess.check_output(args, stderr=stderr) if isinstance(theOutput, bytes): theOutput = theOutput.decode("""utf-8""") except Exception as err: theOutput = None raise RuntimeError(err) return theOutput def check_exec_command_has_output(test_case, someArgs): """Test case for command output != None. returns True if has output and False otherwise.""" theResult = False try: import sys if sys.__name__ is None: raise ImportError("Failed to import system. WTF?!!") import piaplib.pku.utils as utils if utils.__name__ is None: raise ImportError("Failed to import system. WTF?!!") thepython = getPythonCommand() if (thepython is not None): try: theArgs = [thepython] + someArgs test_case.assertIsNotNone(checkPythonCommand(theArgs, stderr=subprocess.STDOUT)) theResult = True except Exception as othererr: print(str("")) print(str(type(othererr))) print(str(othererr)) print(str((othererr.args))) print(str("")) othererr = None del othererr theResult = False except Exception as err: print(str("")) print(str(type(err))) print(str(err)) print(str((err.args))) print(str("")) othererr = None del othererr theResult = False return theResult class PocketUsageTestSuite(unittest.TestCase): """Basic functional test cases.""" def setup(self): """Test case importing code.""" theResult = False try: from .context import piaplib if piaplib.__name__ is None: theResult = False from piaplib import pocket if pocket.__name__ is None: theResult = False theResult = True except Exception as impErr: print(str(type(impErr))) print(str(impErr)) theResult = False assert theResult def test_absolute_truth_and_meaning(self): """Insanitty Test.""" assert True def test_b_python_command(self): """Test case for backend library.""" theResult = False try: import sys if sys.__name__ is None: raise ImportError("Failed to import system. WTF?!!") thepython = getPythonCommand() if (str("/python3") in str(thepython)) or (sys.version_info <= (3, 2)): theResult = True elif (str("coverage") in str(thepython)) or (sys.version_info <= (3, 2)): theResult = True elif (str("python") in str(thepython)) or (sys.version_info >= (3, 2)): theResult = True except Exception: theResult = False try: theOutputtext = checkPythonCommand(["which", "python"]) if (str("/python") in str(theOutputtext)): theResult = True except Exception: theResult = False assert theResult def test_case_pocket_insane_none(self): """Tests the imposible state for pocket given bad tools""" theResult = True try: from .context import piaplib if piaplib.__name__ is None: theResult = False from piaplib import pocket if pocket.__name__ is None: theResult = False from piaplib import pocket as pocket if pocket.__name__ is None: raise ImportError("Failed to import pocket") self.assertIsNone(pocket.useTool("NoSuchTool")) self.assertIsNone(pocket.useTool(None)) except Exception as err: print(str("")) print(str(type(err))) print(str(err)) print(str((err.args))) print(str("")) err = None del err theResult = False assert theResult def test_c_python_command_pocket(self): """Test case for piaplib.pocket --help.""" theResult = False try: import sys if sys.__name__ is None: raise ImportError("Failed to import system. WTF?!!") thepython = getPythonCommand() if (thepython is not None): try: theOutputtext = checkPythonCommand([ str(thepython), str("-m"), str("piaplib.pocket"), str("--help") ], stderr=subprocess.STDOUT) if (str("usage:") in str(theOutputtext)): theResult = True else: theResult = False print(str("")) print(str("python cmd is {}").format(str(thepython))) print(str("")) print(str("Expected output was...")) print(str("")) print(str("'usage:'")) print(str("")) print(str("actual output was...")) print(str("")) print(str("{}").format(str(theOutputtext))) print(str("")) except Exception as othererr: print(str("")) print(str(type(othererr))) print(str(othererr)) print(str((othererr.args))) print(str("")) othererr = None del othererr theResult = False except Exception as err: print(str("")) print(str(type(err))) print(str(err)) print(str((err.args))) print(str("")) othererr = None del othererr theResult = False assert theResult def test_h_python_command_pocket_version(self): """Test case for piaplib.pocket --version.""" theResult = False try: import sys if sys.__name__ is None: raise ImportError("Failed to import system. WTF?!!") from .context import piaplib as piaplib if piaplib.__version__ is not None: theResult = False thepython = getPythonCommand() if (thepython is not None): try: theOutputtext = checkPythonCommand([ str(thepython), str("-m"), str("piaplib.pocket"), str("--version") ], stderr=subprocess.STDOUT) if (str(piaplib.__version__) in str(theOutputtext)): theResult = True else: theResult = False except Exception as othererr: print(str("")) print(str(type(othererr))) print(str(othererr)) print(str((othererr.args))) print(str("")) othererr = None del othererr theResult = False except Exception as err: print(str("")) print(str(type(err))) print(str(err)) print(str((err.args))) print(str("")) othererr = None del othererr theResult = False assert theResult def test_c_python_command_pocket_units(self): """Test case for piaplib.pocket *""" theResult = False try: import sys if sys.__name__ is None: raise ImportError("Failed to import system. WTF?!!") thepython = getPythonCommand() if (thepython is not None): try: for unit in ["lint", "pku", "book", "keyring"]: theOutputtext = checkPythonCommand([ str(thepython), str("-m"), str("piaplib.pocket"), str("{}").format(str(unit)) ], stderr=subprocess.STDOUT) if (str("usage:") in str(theOutputtext)): theResult = True elif (theOutputtext is None) or (str(theOutputtext) in str("")): theResult = True else: theResult = False print(str("")) print(str("python cmd is {}").format(str(thepython))) print(str("")) print(str("Expected output was...")) print(str("")) print(str("'usage:'")) print(str("")) print(str("actual output was...")) print(str("")) print(str("{}").format(repr(theOutputtext))) print(str("")) except Exception as othererr: print(str("")) print(str(type(othererr))) print(str(othererr)) print(str((othererr.args))) print(str("")) othererr = None del othererr theResult = False except Exception as err: print(str("")) print(str(type(err))) print(str(err)) print(str((err.args))) print(str("")) othererr = None del othererr theResult = False assert theResult def test_d_python_command_bad_pocket(self): """Test case for piaplib.pocket check null.""" theResult = True try: from piaplib import pku as pku if pku.__name__ is None: raise ImportError("Failed to import pku") from pku import utils as utils if utils.__name__ is None: raise ImportError("Failed to import utils") import sys if sys.__name__ is None: raise ImportError("Failed to import system. WTF?!!") thepython = getPythonCommand() if (thepython is not None): theOutputtext = checkPythonFuzzing([ str(thepython), str("-m"), str("piaplib.pocket") ], stderr=subprocess.STDOUT) self.assertIsNotNone(theOutputtext) if (str("usage:") in str(theOutputtext)): theResult = True elif (theOutputtext is None) or (str(theOutputtext) in str("")): theResult = True except Exception as err: print(str("")) print(str(type(err))) print(str(err)) print(str((err.args))) print(str("")) othererr = None del othererr theResult = False assert theResult def test_d_python_command_bad_interface(self): """Test case for piaplib.pocket.lint check users.""" theResult = True try: from piaplib import pku as pku if pku.__name__ is None: raise ImportError("Failed to import pku") from pku import utils as utils if utils.__name__ is None: raise ImportError("Failed to import utils") from pku import interfaces as interfaces if interfaces.__name__ is None: raise ImportError("Failed to import interfaces") import sys if sys.__name__ is None: raise ImportError("Failed to import system. WTF?!!") thepython = getPythonCommand() if (thepython is not None): theOutputtext = None with self.assertRaises(Exception): theOutputtext = checkPythonFuzzing([ str(thepython), str("-m"), str("piaplib.pocket"), str("pku"), str("interfaces"), str("""-i {}""").format(str("eth0")) ], stderr=subprocess.STDOUT) self.assertIsNone(theOutputtext) theOutputtext = checkPythonCommand([ str(thepython), str("-m"), str("piaplib.pocket"), str("pku"), str("interfaces"), str("""-i {} -r""").format(interfaces.INTERFACE_CHOICES[1]) ], stderr=subprocess.STDOUT) self.assertIsNone(theOutputtext) except Exception as err: print(str("")) print(str(type(err))) print(str(err)) print(str((err.args))) print(str("")) othererr = None del othererr theResult = False assert theResult def test_o_exec_command_run(self): """Test case for piaplib.pocket.lint do_execve calls.""" theResult = False try: import sys if sys.__name__ is None: raise ImportError("Failed to import system. WTF?!!") thepython = getPythonCommand() if (thepython is not None): try: self.assertIsNotNone(checkPythonCommand([ str(thepython), str("-m"), str("piaplib.pocket"), str("lint"), str("execve"), str("""--cmd={}""").format(str(sys.executable)), str("""--args={}""").format(str("piaplib.pocket")) ], stderr=subprocess.STDOUT)) theResult = True except Exception as othererr: print(str("")) print(str(type(othererr))) print(str(othererr)) print(str((othererr.args))) print(str("")) othererr = None del othererr theResult = False except Exception as err: print(str("")) print(str(type(err))) print(str(err)) print(str((err.args))) print(str("")) othererr = None del othererr theResult = False assert theResult def test_o_exec_command_io(self): """Test case for piaplib.pocket.lint do_execve calls.""" theResult = False try: theResult = check_exec_command_has_output(self, [ str("-m"), str("piaplib.pocket"), str("lint"), str("execve"), str("""--out""").format(str(sys.executable)), str("""--cmd={}""").format(str(sys.executable)), str("""--args={}""").format(str("piaplib.pocket")), str("""--args={}""").format(str("--help")) ]) except Exception as err: print(str("")) print(str(type(err))) print(str(err)) print(str((err.args))) print(str("")) othererr = None del othererr theResult = False assert theResult if __name__ == '__main__': unittest.main()
28.838078
98
0.635404
1,986
16,207
5.095166
0.111279
0.074316
0.029351
0.037948
0.769246
0.744836
0.705801
0.689396
0.67398
0.654907
0
0.004809
0.20448
16,207
561
99
28.889483
0.780036
0.105016
0
0.815789
0
0
0.113333
0.019444
0
0
0
0
0.038462
1
0.030364
false
0
0.103239
0
0.143725
0.190283
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
bcc6e41e9eb6107ffc9f5cdbeca4d7f27007acb6
740
py
Python
dwtools3/django/duration/__init__.py
bazzisoft/dwtools3
ed7b457290ca940b6e53ab56df26ece42afc9928
[ "MIT" ]
1
2019-09-03T10:42:16.000Z
2019-09-03T10:42:16.000Z
dwtools3/django/duration/__init__.py
bazzisoft/dwtools3
ed7b457290ca940b6e53ab56df26ece42afc9928
[ "MIT" ]
null
null
null
dwtools3/django/duration/__init__.py
bazzisoft/dwtools3
ed7b457290ca940b6e53ab56df26ece42afc9928
[ "MIT" ]
null
null
null
""" DurationField form field to store datetime.timedelta objects. Works with Django ``models.DurationField``. Borrowed from https://github.com/johnpaulett/django-durationfield. Dependencies ------------ None. Installation ------------ None. Usage ----- In your models:: from django.db import models class Time(models.Model): ... duration = models.DurationField() ... In your forms:: from dwtools3.django.duration.forms import DurationField class MyForm(forms.ModelForm): duration = DurationField() Enter time values as:: 3 days 2:20:10 3d 2:20:10.123456 """ from .forms import DurationField from .widgets import DurationInput from .utils import format_duration_hhmm
15.416667
66
0.67973
85
740
5.894118
0.576471
0.075848
0.095808
0
0
0
0
0
0
0
0
0.031933
0.195946
740
47
67
15.744681
0.810084
0.841892
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
bcfa2ca19bea4a53a7dbe800f443166ff227ec59
445
py
Python
weatherbitpypi/errors.py
nepozs/py-weatherbit
32e7e0e79edbc9a2587a5e2f118a781a8eb044e7
[ "MIT" ]
null
null
null
weatherbitpypi/errors.py
nepozs/py-weatherbit
32e7e0e79edbc9a2587a5e2f118a781a8eb044e7
[ "MIT" ]
null
null
null
weatherbitpypi/errors.py
nepozs/py-weatherbit
32e7e0e79edbc9a2587a5e2f118a781a8eb044e7
[ "MIT" ]
null
null
null
"""Define package errors.""" class WeatherbitError(Exception): """Define a base error.""" pass class InvalidApiKey(WeatherbitError): """Define an error related to invalid or missing API Key.""" pass class RequestError(WeatherbitError): """Define an error related to invalid requests.""" pass class ResultError(WeatherbitError): """Define an error related to the result returned from a request.""" pass
17.8
72
0.692135
51
445
6.039216
0.529412
0.087662
0.224026
0.272727
0.405844
0.405844
0.285714
0
0
0
0
0
0.202247
445
24
73
18.541667
0.867606
0.462921
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
0
0
0
null
0
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
1
0
0
0
0
0
4
4c0999428354be0cfefb5c33cf696585521924fc
1,929
py
Python
openpnm/network/__init__.py
lixuekai2001/OpenPNM
9026f0fed427d37f4caf1a79e4a7684490d52cf6
[ "MIT" ]
2
2019-08-24T09:17:40.000Z
2020-07-05T07:21:21.000Z
openpnm/network/__init__.py
xu-kai-xu/OpenPNM
61d5fc4729a0a29291cf6c53c07c4246e7a13714
[ "MIT" ]
2
2020-06-26T19:58:23.000Z
2021-12-14T07:16:41.000Z
openpnm/network/__init__.py
xu-kai-xu/OpenPNM
61d5fc4729a0a29291cf6c53c07c4246e7a13714
[ "MIT" ]
null
null
null
r""" Object model for storing topological information of the network =============================================================== This module contains the ``GenericNetwork`` class, whose main purpose is to manage the topological representation of the Network. It also houses a collection of Network generators. Available Network Generators ---------------------------- OpenPNM includes a variety of Network generators. The basically include two families of topology: periodic lattices and tessellations of random points. The GenericNetwork Class ------------------------ All of the above Network classes derive from the GenericNetwork class. It is a subclass of ``Base`` so contains methods for retrieving sets of pores based on labels and so forth, but also contains the following additional methods that are used soley for topological queries. Pore networks require two essential pieces of information: - the spatial location of pores - the connectivity of which throats connect which pores The ``GenericNetwork`` class and it's subclasses are responsible for storing, managing, and utilizing this information. Network topology is stored using `adjacency matrices <https://en.wikipedia.org/wiki/Adjacency_matrix>`_. Moreover, this is stored using a `sparse matrix format <https://en.wikipedia.org/wiki/Sparse_matrix>`_ known as COO. All netowrk objects store the COO matrix as ``'throat.conns'``. The spatial location of each pore is stored in Cartesian coordinates [x, y, z], under ``'pore.coords'``. All networks must be 3D, so even a 2D network must have a z-component (but set to 0). """ from ._generic import GenericNetwork from ._cubic import Cubic from ._cubic_dual import CubicDual from ._bravais import Bravais from ._cubic_template import CubicTemplate from ._delaunay_voronoi_dual import DelaunayVoronoiDual from ._voronoi import Voronoi from ._delaunay import Delaunay from ._gabriel import Gabriel
37.823529
79
0.755314
264
1,929
5.454545
0.507576
0.047222
0.061111
0.027778
0.031944
0
0
0
0
0
0
0.001801
0.13634
1,929
50
80
38.58
0.862545
0.828409
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.9
0
0.9
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4