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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7bec654fc265aac08e29b93829d5f1686f3e37fb | 45 | py | Python | vnpy/gateway/hsoption/__init__.py | funrunskypalace/vnpy | 2d87aede685fa46278d8d3392432cc127b797926 | [
"MIT"
] | 19,529 | 2015-03-02T12:17:35.000Z | 2022-03-31T17:18:27.000Z | vnpy/gateway/hsoption/__init__.py | funrunskypalace/vnpy | 2d87aede685fa46278d8d3392432cc127b797926 | [
"MIT"
] | 2,186 | 2015-03-04T23:16:33.000Z | 2022-03-31T03:44:01.000Z | vnpy/gateway/hsoption/__init__.py | funrunskypalace/vnpy | 2d87aede685fa46278d8d3392432cc127b797926 | [
"MIT"
] | 8,276 | 2015-03-02T05:21:04.000Z | 2022-03-31T13:13:13.000Z | from .hsoption_gateway import HsoptionGateway | 45 | 45 | 0.911111 | 5 | 45 | 8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066667 | 45 | 1 | 45 | 45 | 0.952381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
7bec8ed04ec6ddaa1bb8b3262d604770e25814e0 | 155 | py | Python | clnews/scripts/clnews.py | antavelos/clnews | 1437b8535c80b041a869af2068d99445b320f19d | [
"MIT"
] | null | null | null | clnews/scripts/clnews.py | antavelos/clnews | 1437b8535c80b041a869af2068d99445b320f19d | [
"MIT"
] | null | null | null | clnews/scripts/clnews.py | antavelos/clnews | 1437b8535c80b041a869af2068d99445b320f19d | [
"MIT"
] | null | null | null | """
Implementation of the command-line clnews tool.
"""
from __future__ import absolute_import
# For backward compatibility
from clnews.shell import main
| 19.375 | 47 | 0.8 | 20 | 155 | 5.95 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135484 | 155 | 7 | 48 | 22.142857 | 0.88806 | 0.483871 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
d008fa463c2de04379fbdb49d5076b415209cdaa | 71 | py | Python | app/models/document.py | MosesMendoza/text-passives | 9df305fd83660a596e85a144658d103dcb6217c7 | [
"MIT"
] | null | null | null | app/models/document.py | MosesMendoza/text-passives | 9df305fd83660a596e85a144658d103dcb6217c7 | [
"MIT"
] | null | null | null | app/models/document.py | MosesMendoza/text-passives | 9df305fd83660a596e85a144658d103dcb6217c7 | [
"MIT"
] | null | null | null | from pydantic import BaseModel
class Document(BaseModel):
text: str
| 14.2 | 30 | 0.788732 | 9 | 71 | 6.222222 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15493 | 71 | 4 | 31 | 17.75 | 0.933333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
d05e9e6961f0ac48f85dae63800e64fadb451177 | 174 | py | Python | tests/cxx/fixtures/update_progress_message.py | sankhesh/tomviz | 7116f4eb75b30534a24462f4ddfb1694fe41c308 | [
"BSD-3-Clause"
] | 284 | 2015-01-05T08:53:20.000Z | 2022-03-31T07:35:16.000Z | tests/cxx/fixtures/update_progress_message.py | sankhesh/tomviz | 7116f4eb75b30534a24462f4ddfb1694fe41c308 | [
"BSD-3-Clause"
] | 1,579 | 2015-03-19T15:56:44.000Z | 2022-03-21T11:29:04.000Z | tests/cxx/fixtures/update_progress_message.py | sankhesh/tomviz | 7116f4eb75b30534a24462f4ddfb1694fe41c308 | [
"BSD-3-Clause"
] | 74 | 2015-01-29T16:24:32.000Z | 2022-03-07T21:52:29.000Z | import tomviz.operators
class TestOperator(tomviz.operators.Operator):
def transform_scalars(self, data):
self.progress.message = 'Is there anyone out there?'
| 21.75 | 60 | 0.741379 | 21 | 174 | 6.095238 | 0.809524 | 0.234375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 174 | 7 | 61 | 24.857143 | 0.882759 | 0 | 0 | 0 | 0 | 0 | 0.149425 | 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 | 1 | 0 | 0 | 5 |
d08383725610f0a136dfab40636543774157526f | 62 | py | Python | Term 2/16/6-function-add.py | theseana/ajisa | 1c92b00acd3fad7c92b8222b5f6a86fc6db4bcae | [
"MIT"
] | null | null | null | Term 2/16/6-function-add.py | theseana/ajisa | 1c92b00acd3fad7c92b8222b5f6a86fc6db4bcae | [
"MIT"
] | null | null | null | Term 2/16/6-function-add.py | theseana/ajisa | 1c92b00acd3fad7c92b8222b5f6a86fc6db4bcae | [
"MIT"
] | null | null | null | def add(n1, n2):
return n1 + n2
z = add(42, 7)
print(z)
| 8.857143 | 18 | 0.532258 | 13 | 62 | 2.538462 | 0.692308 | 0.242424 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.159091 | 0.290323 | 62 | 6 | 19 | 10.333333 | 0.590909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0.25 | 0.5 | 0.25 | 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 | 1 | 0 | 0 | 0 | 5 |
d0c74729e71f0dc127e4a984824fb72f4e04c78c | 41 | py | Python | python3/src/hello-world.py | nighcoder/hello-world | e1251a13db0a698e3cb128013682c730bce0a92d | [
"MIT"
] | 1 | 2021-07-02T16:31:44.000Z | 2021-07-02T16:31:44.000Z | python3/src/hello-world.py | nighcoder/hello-world | e1251a13db0a698e3cb128013682c730bce0a92d | [
"MIT"
] | null | null | null | python3/src/hello-world.py | nighcoder/hello-world | e1251a13db0a698e3cb128013682c730bce0a92d | [
"MIT"
] | null | null | null | #! /bin/env python3
print("hello world")
| 13.666667 | 20 | 0.682927 | 6 | 41 | 4.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027778 | 0.121951 | 41 | 2 | 21 | 20.5 | 0.75 | 0.439024 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
d0cda6d237388cfd3d23678afe23795f2015f9b6 | 513 | py | Python | models/brick.py | tb2johm/Brute-python | 166f0aa87266a5310ca32a1cb6e1de1d2d41a77f | [
"MIT"
] | null | null | null | models/brick.py | tb2johm/Brute-python | 166f0aa87266a5310ca32a1cb6e1de1d2d41a77f | [
"MIT"
] | null | null | null | models/brick.py | tb2johm/Brute-python | 166f0aa87266a5310ca32a1cb6e1de1d2d41a77f | [
"MIT"
] | null | null | null | import numpy as np
class Brick:
def __init__(self, index, pattern):
self.__index = index
self.__pattern = np.array(pattern)
print(f"Creating brick\n{self.__pattern * self.__index}")
@property
def index(self):
return self.__index
@property
def pattern(self):
return self.__pattern
@property
def width(self):
return self.__pattern.shape[1] #columns
@property
def height(self):
return self.__pattern.shape[0] #rows
| 21.375 | 65 | 0.621832 | 62 | 513 | 4.822581 | 0.403226 | 0.183946 | 0.187291 | 0.210702 | 0.173913 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005405 | 0.278752 | 513 | 23 | 66 | 22.304348 | 0.802703 | 0.021443 | 0 | 0.222222 | 0 | 0 | 0.094 | 0.044 | 0 | 0 | 0 | 0 | 0 | 1 | 0.277778 | false | 0 | 0.055556 | 0.222222 | 0.611111 | 0.055556 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 5 |
d0f49503f17fed4781533cedbacc18256d3882d6 | 74,916 | py | Python | nova/tests/network/test_quantum_prime_manager.py | bopopescu/nova-39 | 36c7a819582b838b7bbab11d55ca3d991a587405 | [
"Apache-2.0"
] | null | null | null | nova/tests/network/test_quantum_prime_manager.py | bopopescu/nova-39 | 36c7a819582b838b7bbab11d55ca3d991a587405 | [
"Apache-2.0"
] | null | null | null | nova/tests/network/test_quantum_prime_manager.py | bopopescu/nova-39 | 36c7a819582b838b7bbab11d55ca3d991a587405 | [
"Apache-2.0"
] | 1 | 2020-07-24T09:39:47.000Z | 2020-07-24T09:39:47.000Z | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import uuid
import contextlib
import mock
from nova import context
from nova import db
from nova import exception
from nova.network.quantum2 import manager
from nova.network.quantum2 import melange_connection
from nova.network.quantum2 import quantum_connection
from nova.openstack.common import uuidutils
from nova import test
def dummy(*args, **kwargs):
pass
def dummy_list(*args, **kwargs):
return []
def dummy_raise(*args, **kwargs):
raise test.TestingException('Boom!')
def _ip_addresses_helper(ips_per_vif):
return ['10.0.0.1%02d' % i for i in xrange(ips_per_vif)]
def _vif_helper(tenant_id, network_uuid, mac_offset=0, vif_id=None,
name=None):
network_name = name or 'net%s' % network_uuid
return {'id': vif_id or str(uuidutils.generate_uuid()),
'mac_address': '00:00:00:00:00:%02d' % mac_offset,
'ip_addresses': [
{'address': _ip_addresses_helper(1)[0],
'ip_block': {'tenant_id': tenant_id,
'network_id': network_uuid,
'network_name': network_name,
'gateway': '10.0.0.1',
'cidr': '10.0.0.0/8',
'dns1': '8.8.8.8',
'dns2': '8.8.4.4',
'ip_routes': [
{'destination': '1.1.1.1',
'gateway': '2.2.2.2',
'netmask': '255.0.0.0'}]}}]}
def _ips_from_vif_stub(ips_per_vif, tenants, networks, names):
def ips(vif):
ip_addresses = _ip_addresses_helper(ips_per_vif)
nets = [n['network_id'] for n in networks]
return ip_addresses, tenants, nets, names
return ips
def _fake_networks(network_count, tenant_id):
"""id is the id from melange
network_id is the id from quantum. Dumb"""
return [{'id': str(uuidutils.generate_uuid()),
'name': 'net%d' % i,
'network_name': 'qnet%s' % i,
'cidr': '10.0.0.0/8',
'network_id': str(uuidutils.generate_uuid()),
'tenant_id': tenant_id} for i in xrange(network_count)]
def _get_allocated_networks_stub(vifs, bare_uuids=True):
def allocated_nets(self, instance_id):
if bare_uuids:
return [{'id': vif} for vif in vifs]
return vifs
return allocated_nets
def _allocate_for_instance_networks_stub(networks):
vif_ids = [str(uuidutils.generate_uuid()) for i in xrange(len(networks))]
def allocate(self, tenant_id, instance_id, nets):
# explicitly ignoring including IPs, as we're going to
# stub out the helper method that iterates over VIFs looking
# for them.
return [_vif_helper(tenant_id, networks[i],
mac_offset=i, vif_id=vif_ids[i])
for i in xrange(len(networks))]
return vif_ids, allocate
def _create_network_stub(network_uuid):
def net_create(self, tenant_id, label, nova_id=None):
return network_uuid
return net_create
def _get_networks_for_tenant_stub(networks):
def nets_for_tenant(self, tenant_id):
return networks
return nets_for_tenant
def _create_ip_policy_stub():
def policy(self, tenant_id, network_id, label):
return dict(id=1)
return policy
def _get_port_by_attachment_stub(port):
def get_port(self, tenant_id, instance_id, interface_id):
return port
return get_port
def _quantum_client_stub(networks_dict):
class Client(object):
def __init__(self, *args, **kwargs):
self.tenant = None
self.format = None
def do_request(self, method, url):
return networks_dict
return Client
def _normalize_network_stub(label):
def normalize(net):
net['label'] = label
return net
return normalize
def _create_ip_block_stub(block):
def ip(*args, **kwargs):
return block
return ip
class QuantumPrimeManagerInterfaceTests(test.TestCase):
"""This test suite merely checks that the methods are callable."""
def setUp(self):
super(QuantumPrimeManagerInterfaceTests, self).setUp()
self.stubs.Set(manager.QuantumManager, '_clean_up_melange', dummy)
self.context = context.RequestContext(user_id=1, project_id=1)
self.net_manager = manager.QuantumManager()
def test_allocate_for_instance(self):
self.stubs.Set(quantum_connection.QuantumClientConnection,
'create_and_attach_port', dummy)
self.stubs.Set(melange_connection.MelangeConnection,
'allocate_for_instance_networks', dummy_list)
self.stubs.Set(melange_connection.MelangeConnection,
'get_networks_for_tenant', dummy_list)
self.net_manager.allocate_for_instance(self.context, instance_id=1,
rxtx_factor=1,
project_id='project1',
host='host')
def test_deallocate_for_instance(self):
self.stubs.Set(melange_connection.MelangeConnection,
'get_allocated_networks', dummy_list)
self.stubs.Set(melange_connection.MelangeConnection,
'allocate_for_instance_networks', dummy_list)
self.net_manager.deallocate_for_instance(self.context,
instance_id=1,
project_id='project1')
def test_get_all_networks(self):
self.stubs.Set(melange_connection.MelangeConnection,
'get_networks_for_tenant', dummy_list)
self.net_manager.get_all_networks(self.context)
def test_init_host(self):
self.net_manager.init_host()
class Quantum2ManagerTestsAllocateForInstanceGlobalIDs(test.TestCase):
def setUp(self):
super(Quantum2ManagerTestsAllocateForInstanceGlobalIDs, self).setUp()
self.flags(network_global_uuid_label_map=[
'00000000-0000-0000-0000-000000000000', 'public',
'11111111-1111-1111-1111-111111111111', 'private'])
self.tenant_id = 'project1'
self.context = context.RequestContext(user_id=1,
project_id=self.tenant_id)
self.q_client = ('nova.network.quantum2.quantum_connection.'
'QuantumClientConnection')
self.m_client = ('nova.network.quantum2.melange_connection.'
'MelangeConnection')
self.default_networks = _fake_networks(2, self.tenant_id)
def iterlabel():
for label in ['public', 'private']:
yield label
self.label_toggler = iterlabel()
def pub_priv(s, network):
network = {'id': network['network_id'],
'cidr': network['cidr']}
try:
network['label'] = self.label_toggler.next()
except StopIteration:
self.label_toggler = iterlabel()
network['label'] = self.label_toggler.next()
return network
self.stubs.Set(manager.QuantumManager, '_normalize_network', pub_priv)
self.stubs.Set(melange_connection.MelangeConnection,
'get_networks_for_tenant',
lambda *args, **kwargs: self.default_networks)
self.net_manager = manager.QuantumManager()
self.normalized_networks = [self.net_manager._normalize_network(n)
for n in self.default_networks]
def test_nw_map(self):
pub_uuid = [nw['id'] for nw in self.normalized_networks
if nw['label'] == 'public'][0]
priv_uuid = [nw['id'] for nw in self.normalized_networks
if nw['label'] == 'private'][0]
should_be = {'00000000-0000-0000-0000-000000000000': pub_uuid,
'11111111-1111-1111-1111-111111111111': priv_uuid,
pub_uuid: '00000000-0000-0000-0000-000000000000',
priv_uuid: '11111111-1111-1111-1111-111111111111'}
self.assertEqual(self.net_manager._nw_map, should_be)
def test_get_all_networks(self):
nets = self.net_manager.get_all_networks(self.context)
should_be = self.normalized_networks
for nw in should_be:
if nw['label'] == 'public':
nw['id'] = '00000000-0000-0000-0000-000000000000'
elif nw['label'] == 'private':
nw['id'] = '11111111-1111-1111-1111-111111111111'
self.assertEqual(nets, should_be)
def test_allocate_for_instance_with_global_requested_nets(self):
with contextlib.nested(
mock.patch.object(self.net_manager, '_vifs_to_model'),
mock.patch(self.q_client + '.create_and_attach_port'),
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
) as (vifs_to_model,
create_and_attach,
get_networks_for_tenant,
allocate_for_instance_networks):
# only take the first network for the test
networks = _fake_networks(2, self.tenant_id)
expected_networks = networks[:1]
requested_networks = [n['network_id']
for n in expected_networks]
requested_networks.append('0000000000-0000-0000-0000-000000000000')
vifs = [_vif_helper(self.tenant_id, n['network_id'])
for n in expected_networks]
get_networks_for_tenant.return_value = networks
allocate_for_instance_networks.return_value = vifs
instance_id = 1
kwargs = dict(instance_id=instance_id,
rxtx_factor=1,
project_id='project1',
requested_networks=[requested_networks],
host='host')
self.net_manager.allocate_for_instance(self.context, **kwargs)
args = (self.tenant_id,
instance_id,
[{'id': n['network_id'], 'tenant_id': n['tenant_id']}
for n in expected_networks])
allocate_for_instance_networks.assert_called_once_with(*args)
self.assertTrue(create_and_attach.called)
class Quantum2ManagerTestRackConnect(test.TestCase):
def setUp(self):
super(Quantum2ManagerTestRackConnect, self).setUp()
self.tenant_id = 'project1'
self.rc_role = 'lulzconnect'
self.q_tenant_id = 'quantum_tennant'
self.servicenet_label = 'private'
self.template_id = str(uuidutils.generate_uuid())
self.map = [str(uuidutils.generate_uuid()), self.servicenet_label]
self.flags(network_global_uuid_label_map=self.map,
quantum_default_tenant_id=self.q_tenant_id,
rackconnect_roles=[self.rc_role],
rackconnect_servicenet=self.servicenet_label,
rackconnect_servicenet_policy=self.template_id)
self.context = context.RequestContext(user_id=1,
project_id=self.tenant_id,
roles=[self.rc_role])
self.default_nets = [{'id': str(uuidutils.generate_uuid()),
'network_name': self.servicenet_label,
'cidr': '10.0.0.0/8',
'network_id': str(uuidutils.generate_uuid()),
'tenant_id': self.q_tenant_id}]
self.networks = _fake_networks(1, self.tenant_id)
self.vifs = [_vif_helper(self.tenant_id, n['network_id'],
name=n['network_name'])
for n in self.networks + self.default_nets]
self.port_ids = [str(uuidutils.generate_uuid())
for vif in self.vifs]
self.sp_port_id = self.port_ids[-1]
self.q_client = ('nova.network.quantum2.quantum_connection.'
'QuantumClientConnection')
self.m_client = ('nova.network.quantum2.melange_connection.'
'MelangeConnection')
self.a_client = ('nova.network.quantum2.aiclib_connection.'
'AICLibConnection')
def get_networks_for_tenant(self, tenant_id, *args, **kwargs):
if tenant_id == self.q_tenant_id:
return self.default_nets
return self.networks
def test_allocate_for_instance_global_policy(self):
with contextlib.nested(
mock.patch(self.q_client + '.create_and_attach_port'),
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
mock.patch(self.a_client + '.set_securityprofile'),
) as (create_and_attach,
get_networks_for_tenant,
allocate_for_instance_networks,
set_securityprofile):
get_networks_for_tenant.side_effect = self.get_networks_for_tenant
allocate_for_instance_networks.return_value = self.vifs
create_and_attach.side_effect = self.port_ids
net_manager = manager.QuantumManager()
net_manager.allocate_for_instance(self.context,
instance_id=1,
rxtx_factor=1,
project_id='project1',
host='host')
set_securityprofile.assert_called_once_with(self.sp_port_id,
self.template_id)
def test_allocate_for_instance_per_port_policy(self):
self.flags(rackconnect_clone_servicenet_policy=True)
new_sp_id = str(uuidutils.generate_uuid())
with contextlib.nested(
mock.patch(self.q_client + '.create_and_attach_port'),
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
mock.patch(self.a_client + '.set_securityprofile'),
mock.patch(self.a_client +
'.create_securityprofile_from_template'),
) as (create_and_attach,
get_networks_for_tenant,
allocate_for_instance_networks,
set_securityprofile,
create_sp_from_tmpl):
get_networks_for_tenant.side_effect = self.get_networks_for_tenant
allocate_for_instance_networks.return_value = self.vifs
create_and_attach.side_effect = self.port_ids
create_sp_from_tmpl.return_value = {'uuid': new_sp_id}
net_manager = manager.QuantumManager()
net_manager.allocate_for_instance(self.context,
instance_id=1,
rxtx_factor=1,
project_id='project1',
host='host')
create_sp_from_tmpl.assert_called_once_with(self.tenant_id,
self.template_id,
mock.ANY)
set_securityprofile.assert_called_once_with(self.sp_port_id,
new_sp_id)
def test_allocate_for_instance_per_tenant_policy_existing(self):
self.flags(rackconnect_clone_servicenet_policy=True,
rackconnect_clone_servicenet_policy_per_tenant=True)
new_sp_id = str(uuidutils.generate_uuid())
with contextlib.nested(
mock.patch(self.q_client + '.create_and_attach_port'),
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
mock.patch(self.a_client + '.set_securityprofile'),
mock.patch(self.a_client + '.get_securityprofile'),
) as (create_and_attach,
get_networks_for_tenant,
allocate_for_instance_networks,
set_securityprofile,
get_securityprofile,
):
get_networks_for_tenant.side_effect = self.get_networks_for_tenant
allocate_for_instance_networks.return_value = self.vifs
create_and_attach.side_effect = self.port_ids
get_securityprofile.return_value = {'uuid': new_sp_id}
net_manager = manager.QuantumManager()
net_manager.allocate_for_instance(self.context,
instance_id=1,
rxtx_factor=1,
project_id='project1',
host='host')
set_securityprofile.assert_called_once_with(self.sp_port_id,
new_sp_id)
def test_allocate_for_instance_per_tenant_policy_new(self):
self.flags(rackconnect_clone_servicenet_policy=True,
rackconnect_clone_servicenet_policy_per_tenant=True)
new_sp_id = str(uuidutils.generate_uuid())
with contextlib.nested(
mock.patch(self.q_client + '.create_and_attach_port'),
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
mock.patch(self.a_client + '.set_securityprofile'),
mock.patch(self.a_client +
'.create_securityprofile_from_template'),
mock.patch(self.a_client + '.get_securityprofile'),
) as (create_and_attach,
get_networks_for_tenant,
allocate_for_instance_networks,
set_securityprofile,
create_sp_from_tmpl,
get_securityprofile,
):
get_networks_for_tenant.side_effect = self.get_networks_for_tenant
allocate_for_instance_networks.return_value = self.vifs
create_and_attach.side_effect = self.port_ids
create_sp_from_tmpl.return_value = {'uuid': new_sp_id}
get_securityprofile.return_value = None
net_manager = manager.QuantumManager()
net_manager.allocate_for_instance(self.context,
instance_id=1,
rxtx_factor=1,
project_id='project1',
host='host')
create_sp_from_tmpl.assert_called_once_with(self.tenant_id,
self.template_id)
set_securityprofile.assert_called_once_with(self.sp_port_id,
new_sp_id)
class Quantum2ManagerTestsAllocateForInstance(test.TestCase):
def setUp(self):
super(Quantum2ManagerTestsAllocateForInstance, self).setUp()
self.tenant_id = 'project1'
self.context = context.RequestContext(user_id=1,
project_id=self.tenant_id)
self.net_manager = manager.QuantumManager()
self.q_client = ('nova.network.quantum2.quantum_connection.'
'QuantumClientConnection')
self.m_client = ('nova.network.quantum2.melange_connection.'
'MelangeConnection')
def test_allocate_for_instance_with_vifs(self):
with contextlib.nested(
mock.patch.object(self.net_manager, '_vifs_to_model'),
mock.patch(self.q_client + '.create_and_attach_port'),
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
) as (vifs_to_model,
create_and_attach,
get_networks_for_tenant,
allocate_for_instance_networks):
networks = _fake_networks(1, self.tenant_id)
vifs = [_vif_helper(self.tenant_id, n['network_id'])
for n in networks]
get_networks_for_tenant.return_value = networks
allocate_for_instance_networks.return_value = vifs
self.net_manager.allocate_for_instance(self.context,
instance_id=1,
rxtx_factor=1,
project_id='project1',
host='host')
self.assertTrue(create_and_attach.called)
def test_allocate_for_instance_with_requested_nets(self):
with contextlib.nested(
mock.patch.object(self.net_manager, '_vifs_to_model'),
mock.patch(self.q_client + '.create_and_attach_port'),
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
) as (vifs_to_model,
create_and_attach,
get_networks_for_tenant,
allocate_for_instance_networks):
# only take the first network for the test
networks = _fake_networks(2, self.tenant_id)
expected_networks = networks[:1]
requested_networks = [n['network_id']
for n in expected_networks]
vifs = [_vif_helper(self.tenant_id, n['network_id'])
for n in expected_networks]
get_networks_for_tenant.return_value = networks
allocate_for_instance_networks.return_value = vifs
instance_id = 1
kwargs = dict(instance_id=instance_id,
rxtx_factor=1,
project_id='project1',
requested_networks=[requested_networks],
host='host')
self.net_manager.allocate_for_instance(self.context, **kwargs)
args = (self.tenant_id,
instance_id,
[{'id': n['network_id'], 'tenant_id': n['tenant_id']}
for n in expected_networks])
allocate_for_instance_networks.assert_called_once_with(*args)
self.assertTrue(create_and_attach.called)
def test_allocate_for_instance_with_bad_requested_net_raises(self):
with contextlib.nested(
mock.patch.object(self.net_manager, '_vifs_to_model'),
mock.patch(self.q_client + '.create_and_attach_port'),
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
) as (vifs_to_model,
create_and_attach,
get_networks_for_tenant,
allocate_for_instance_networks):
# only take the first network for the test
networks = _fake_networks(2, self.tenant_id)
expected_networks = networks[:1]
requested_networks = [(n['network_id'], '')
for n in expected_networks]
# request a bad network
bad_rn = ('1 (607) 206-0502 u mad bro?', 'dietz')
requested_networks.append(bad_rn)
self.assertRaises(exception.NetworkNotFound,
self.net_manager.allocate_for_instance,
self.context, instance_id=1,
rxtx_factor=1,
project_id='project1',
requested_networks=requested_networks,
host='host')
def test_allocate_for_instance_no_vifs_raises(self):
with contextlib.nested(
mock.patch(self.q_client + '.create_and_attach_port'),
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
) as (create_and_attach,
get_networks_for_tenant,
allocate_for_instance_networks):
networks = _fake_networks(1, self.tenant_id)
get_networks_for_tenant.return_value = networks
allocate_for_instance_networks.return_value = []
self.net_manager.allocate_for_instance(self.context,
instance_id=1,
rxtx_factor=1,
project_id='project1',
host='host')
self.assertEqual(create_and_attach.called, False)
def test_allocate_for_instance_melange_allocation_fails(self):
with contextlib.nested(
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
) as (get_networks_for_tenant,
allocate_for_instance_networks):
get_networks_for_tenant.return_value = []
def side_effect(*args):
def clean_up_call(*args, **kwargs):
return
allocate_for_instance_networks.side_effect = clean_up_call
raise test.TestingException()
allocate_for_instance_networks.side_effect = side_effect
self.assertRaises(test.TestingException,
self.net_manager.allocate_for_instance,
self.context, instance_id=1,
rxtx_factor=1,
project_id='project1',
host='host')
def test_allocate_for_instance_too_many_net_tenant_ids_fails(self):
with contextlib.nested(
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
mock.patch.object(self.net_manager, '_get_ips_and_ids_from_vif'),
) as (get_networks_for_tenant,
allocate_for_instance_networks,
_get_ips_and_ids_from_vif):
networks = _fake_networks(1, self.tenant_id)
vifs = [_vif_helper(self.tenant_id, n['network_id'])
for n in networks]
names = [n['name'] for n in networks]
ips = _ips_from_vif_stub(ips_per_vif=2,
tenants=['project1', 'project2'],
networks=networks,
names=names)
_get_ips_and_ids_from_vif.side_effect = ips
get_networks_for_tenant.return_value = networks
allocate_for_instance_networks.return_value = vifs
self.assertRaises(exception.VirtualInterfaceCreateException,
self.net_manager.allocate_for_instance,
self.context,
instance_id=1,
rxtx_factor=1,
project_id='project1',
host='host')
def test_allocate_for_instance_too_many_net_ids_fails(self):
with contextlib.nested(
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
mock.patch.object(self.net_manager, '_get_ips_and_ids_from_vif'),
) as (get_networks_for_tenant,
allocate_for_instance_networks,
_get_ips_and_ids_from_vif):
networks = _fake_networks(1, self.tenant_id)
vifs = [_vif_helper(self.tenant_id, n['network_id'])
for n in networks]
names = [n['name'] for n in networks]
ips = _ips_from_vif_stub(ips_per_vif=2,
tenants=['project1'],
networks=networks * 2,
names=names * 2)
_get_ips_and_ids_from_vif.side_effect = ips
get_networks_for_tenant.return_value = networks
allocate_for_instance_networks.return_value = vifs
self.assertRaises(exception.VirtualInterfaceCreateException,
self.net_manager.allocate_for_instance,
self.context,
instance_id=1,
rxtx_factor=1,
project_id='project1',
host='host')
def test_allocate_for_instance_no_net_tenant_ids_fails(self):
with contextlib.nested(
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
mock.patch.object(self.net_manager, '_get_ips_and_ids_from_vif'),
) as (get_networks_for_tenant,
allocate_for_instance_networks,
_get_ips_and_ids_from_vif):
networks = _fake_networks(1, self.tenant_id)
vifs = [_vif_helper(self.tenant_id, n['network_id'])
for n in networks]
names = [n['name'] for n in networks]
ips = _ips_from_vif_stub(ips_per_vif=2,
tenants=[],
networks=networks,
names=names)
_get_ips_and_ids_from_vif.side_effect = ips
get_networks_for_tenant.return_value = networks
allocate_for_instance_networks.return_value = vifs
self.assertRaises(exception.VirtualInterfaceCreateException,
self.net_manager.allocate_for_instance,
self.context,
instance_id=1,
rxtx_factor=1,
project_id='project1',
host='host')
def test_allocate_for_instance_no_net_ids_fails(self):
with contextlib.nested(
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
mock.patch.object(self.net_manager, '_get_ips_and_ids_from_vif'),
) as (get_networks_for_tenant,
allocate_for_instance_networks,
_get_ips_and_ids_from_vif):
networks = _fake_networks(1, self.tenant_id)
vifs = [_vif_helper(self.tenant_id, n['network_id'])
for n in networks]
ips = _ips_from_vif_stub(ips_per_vif=2,
tenants=['project1'],
networks=[],
names=[])
_get_ips_and_ids_from_vif.side_effect = ips
get_networks_for_tenant.return_value = networks
allocate_for_instance_networks.return_value = vifs
self.assertRaises(exception.VirtualInterfaceCreateException,
self.net_manager.allocate_for_instance,
self.context,
instance_id=1,
rxtx_factor=1,
project_id='project1',
host='host')
def test_allocate_for_instance_with_port_security(self):
self.flags(quantum_use_port_security=True)
with contextlib.nested(
mock.patch.object(self.net_manager, '_vifs_to_model'),
mock.patch.object(self.net_manager, '_generate_address_pairs'),
mock.patch(self.q_client + '.create_and_attach_port'),
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
) as (vifs_to_model,
gen_pairs,
create_and_attach,
get_networks_for_tenant,
allocate_for_instance_networks):
networks = _fake_networks(1, self.tenant_id)
vifs = [_vif_helper(self.tenant_id, n['network_id'])
for n in networks]
get_networks_for_tenant.return_value = networks
allocate_for_instance_networks.return_value = vifs
self.net_manager.allocate_for_instance(self.context,
instance_id=1,
rxtx_factor=1,
project_id='project1',
host='host')
create_and_attach.assert_called()
gen_pairs.assert_called()
def test_allocate_for_instance_with_port_security_link_local(self):
self.flags(quantum_use_port_security=True)
with contextlib.nested(
mock.patch.object(self.net_manager, '_vifs_to_model'),
mock.patch.object(self.net_manager, '_generate_address_pairs'),
mock.patch(self.q_client + '.create_and_attach_port'),
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
mock.patch('netaddr.EUI'),
) as (vifs_to_model,
gen_pairs,
create_and_attach,
get_networks_for_tenant,
allocate_for_instance_networks,
eui):
networks = _fake_networks(1, self.tenant_id)
vifs = [_vif_helper(self.tenant_id, n['network_id'])
for n in networks]
get_networks_for_tenant.return_value = networks
allocate_for_instance_networks.return_value = vifs
self.net_manager.allocate_for_instance(self.context,
instance_id=1,
rxtx_factor=1,
project_id='project1',
host='host')
create_and_attach.assert_called()
gen_pairs.assert_called()
def test_allocate_for_instance_with_port_security_not_on_isolated(self):
self.flags(quantum_use_port_security=True)
self.flags(quantum_default_tenant_id=self.tenant_id)
tenant_id = 'BERKS_ISERLATED_NETWERK'
with contextlib.nested(
mock.patch.object(self.net_manager, '_vifs_to_model'),
mock.patch.object(self.net_manager, '_generate_address_pairs'),
mock.patch(self.q_client + '.create_and_attach_port'),
mock.patch(self.m_client + '.get_networks_for_tenant'),
mock.patch(self.m_client + '.allocate_for_instance_networks'),
mock.patch('netaddr.EUI'),
) as (vifs_to_model,
gen_pairs,
create_and_attach,
get_networks_for_tenant,
allocate_for_instance_networks,
eui):
networks = _fake_networks(1, self.tenant_id)
networks.extend(_fake_networks(1, tenant_id))
vifs = [_vif_helper(n['tenant_id'], n['network_id'])
for n in networks]
get_networks_for_tenant.return_value = networks
allocate_for_instance_networks.return_value = vifs
self.net_manager.allocate_for_instance(self.context,
instance_id=1,
rxtx_factor=1,
project_id=tenant_id,
host='host')
create_and_attach.assert_called()
self.assertTrue(create_and_attach.call_count == 2)
gen_pairs.assert_called()
self.assertTrue(gen_pairs.call_count == 1)
class Quantum2ManagerDeallocateForInstance(test.TestCase):
def setUp(self):
super(Quantum2ManagerDeallocateForInstance, self).setUp()
self.tenant_id = 'project1'
self.context = context.RequestContext(user_id=1,
project_id=self.tenant_id)
self.net_manager = manager.QuantumManager()
stub = self.stubs.Set
networks = _fake_networks(1, self.tenant_id)
names = [n['name'] for n in networks]
self.vifs, allocate_stub = _allocate_for_instance_networks_stub(
networks=networks)
stub(melange_connection.MelangeConnection,
'allocate_for_instance_networks',
allocate_stub)
stub(self.net_manager,
'_get_ips_and_ids_from_vif',
_ips_from_vif_stub(ips_per_vif=2,
tenants=['project1'],
networks=networks,
names=names))
self.stubs.Set(melange_connection.MelangeConnection,
'get_allocated_networks',
_get_allocated_networks_stub(self.vifs))
def test_deallocate_instance_no_vifs(self):
self.stubs.Set(melange_connection.MelangeConnection,
'get_allocated_networks',
_get_allocated_networks_stub([]))
with mock.patch('nova.network.quantum2.manager.QuantumManager'
'._deallocate_port') as patch:
self.net_manager.deallocate_for_instance(context=self.context,
instance_id=1,
project_id=self.tenant_id)
self.assertEqual(patch.called, False)
def test_deallocate_for_instance(self):
with mock.patch('nova.network.quantum2.manager.QuantumManager'
'._deallocate_port') as patch:
self.net_manager.deallocate_for_instance(context=self.context,
instance_id=1,
project_id=self.tenant_id)
self.assertEqual(patch.called, True)
def test_deallocate_instance_deallocate_port_fails(self):
"""
It's hard to assert this test is proving anything. We have to assume
the raise just happens
"""
with mock.patch('nova.network.quantum2.manager.QuantumManager'
'._deallocate_port',
mock.MagicMock(side_effect=Exception('Boom'))):
self.net_manager.deallocate_for_instance(self.context, 1,
self.tenant_id)
class Quantum2ManagerCreateNetworks(test.TestCase):
def test_create_networks(self):
net_manager = manager.QuantumManager()
network_uuid = uuidutils.generate_uuid()
stub = self.stubs.Set
ctxt = context.RequestContext(user_id=1,
project_id='project1')
stub(net_manager, '_normalize_network',
_normalize_network_stub('label'))
stub(melange_connection.MelangeConnection,
'create_unusable_range_in_policy', dummy)
stub(quantum_connection.QuantumClientConnection,
'create_network', _create_network_stub(network_uuid))
stub(melange_connection.MelangeConnection,
'create_ip_policy', _create_ip_policy_stub())
stub(melange_connection.MelangeConnection,
'create_unusable_octet_in_policy', dummy)
stub(melange_connection.MelangeConnection,
'create_ip_block', _create_ip_block_stub({}))
ret = net_manager.create_networks(ctxt, label='label',
cidr='10.0.0.0/24')
self.assertEqual(ret, [{'label': 'label'}])
class Quantum2ManagerDeleteNetwork(test.TestCase):
def setUp(self):
super(Quantum2ManagerDeleteNetwork, self).setUp()
self.tenant_id = 'project1'
self.context = context.RequestContext(user_id=1,
project_id=self.tenant_id)
self.net_manager = manager.QuantumManager()
self.networks = _fake_networks(network_count=2,
tenant_id=self.tenant_id)
stub = self.stubs.Set
stub(melange_connection.MelangeConnection, 'get_networks_for_tenant',
_get_networks_for_tenant_stub(self.networks))
stub(quantum_connection.QuantumClientConnection, 'delete_network',
dummy)
def test_delete_network_no_networks_raises(self):
self.assertRaises(exception.NetworkNotFound,
self.net_manager.delete_network,
context=self.context,
uuid='wharrgarbl')
def test_delete_network_too_many_networks_raises(self):
network_uuid = self.networks[0]['network_id']
# Make the ids the same, so we find two of the same net
self.networks[1]['network_id'] = network_uuid
self.assertRaises(exception.NetworkFoundMultipleTimes,
self.net_manager.delete_network,
context=self.context,
uuid=network_uuid)
def test_delete_network_active_ports_raises(self):
with mock.patch('nova.network.quantum2.melange_connection.'
'MelangeConnection.get_interfaces') as patch:
patch.return_value = [1]
network_uuid = self.networks[0]['network_id']
self.assertRaises(exception.NetworkBusy,
self.net_manager.delete_network,
context=self.context,
uuid=network_uuid)
def test_delete_network(self):
network_uuid = self.networks[0]['network_id']
with contextlib.nested(
mock.patch('nova.network.quantum2.melange_connection.'
'MelangeConnection.delete_ip_block'),
mock.patch('nova.network.quantum2.melange_connection.'
'MelangeConnection.get_interfaces')
) as (delete_ip_block, get_interfaces):
get_interfaces.return_value = []
self.net_manager.delete_network(context=self.context,
uuid=network_uuid)
delete_ip_block.assert_called()
class Quantum2ManagerGetAllNetworks(test.TestCase):
def setUp(self):
super(Quantum2ManagerGetAllNetworks, self).setUp()
self.tenant_id = 'project1'
self.net_manager = manager.QuantumManager()
stub = self.stubs.Set
self.context = context.RequestContext(user_id=1,
project_id='project1')
self.networks = _fake_networks(network_count=2,
tenant_id=self.tenant_id)
stub(melange_connection.MelangeConnection, 'get_networks_for_tenant',
_get_networks_for_tenant_stub(self.networks))
stub(self.net_manager, '_normalize_network',
_normalize_network_stub('label'))
def test_get_all_networks_no_tenant(self):
nets = self.net_manager.get_all_networks(self.context)
self.assertEqual(nets, self.networks)
class Quantum2ManagerGetInstanceNwInfo(test.TestCase):
def setUp(self):
super(Quantum2ManagerGetInstanceNwInfo, self).setUp()
self.q_client = ('nova.network.quantum2.quantum_connection.'
'QuantumClientConnection')
self.m_client = ('nova.network.quantum2.melange_connection.'
'MelangeConnection')
def test_get_instance_nw_info(self):
tenant_id = 'project1'
net_manager = manager.QuantumManager()
ctx = context.RequestContext(user_id=1, project_id=tenant_id)
with mock.patch(
self.m_client + '.get_allocated_networks'
) as get_allocated_networks:
networks = _fake_networks(2, tenant_id)
vifs = [_vif_helper(tenant_id, n['network_id'])
for n in networks]
get_allocated_networks.return_value = vifs
get_nw_info = net_manager.get_instance_nw_info
res = get_nw_info(ctx, instance_id=1, project_id=tenant_id)
self.assertEqual(len(res), len(vifs))
def test_get_instance_nw_info_correct_order(self):
tenant_id = 'project1'
net_manager = manager.QuantumManager()
ctx = context.RequestContext(user_id=1, project_id=tenant_id)
networks = _fake_networks(2, tenant_id)
vifs = [_vif_helper(tenant_id, networks[-1]['network_id'],
name='net1'),
_vif_helper(tenant_id, networks[0]['network_id'],
name='net0')]
network_order = ['net%d' % i for i in xrange(len(networks))]
self.flags(network_order=network_order)
with mock.patch(self.m_client + '.get_allocated_networks'
) as get_allocated_networks:
get_allocated_networks.return_value = vifs
get_nw_info = net_manager.get_instance_nw_info
res = get_nw_info(ctx, instance_id=1, project_id=tenant_id)
self.assertEqual(len(res), len(vifs))
self.assertEqual(res[0]['network']['label'],
networks[0]['name'])
self.assertEqual(res[1]['network']['label'],
networks[-1]['name'])
class Quantum2ManagerGetIpsAndIdsFromVifs(test.TestCase):
def test_get_ips_and_ids_from_vifs(self):
self.tenant_id = 'project1'
self.net_manager = manager.QuantumManager()
network_uuid = str(uuidutils.generate_uuid())
network_name = 'net%s' % network_uuid
self.context = context.RequestContext(user_id=1,
project_id='project1')
vif = _vif_helper(self.tenant_id, network_uuid)
res = self.net_manager._get_ips_and_ids_from_vif(vif)
addresses, tenants, network_uuids, network_names = res
self.assertEquals(addresses, ['10.0.0.100'])
self.assertEquals(tenants, set(['project1']))
self.assertEquals(network_uuids, set([network_uuid]))
self.assertEquals(network_names, set([network_name]))
class Quantum2ManagerCleanUpMelange(test.TestCase):
def setUp(self):
super(Quantum2ManagerCleanUpMelange, self).setUp()
self.tenant_id = 'project1'
self.net_manager = manager.QuantumManager()
self.context = context.RequestContext(user_id=1,
project_id=self.tenant_id)
self.networks = _fake_networks(network_count=1,
tenant_id=self.tenant_id)
self.vifs, allocate_stub = _allocate_for_instance_networks_stub(
self.networks)
self.allocate_stub = allocate_stub
def test_clean_up_melange(self):
self.stubs.Set(melange_connection.MelangeConnection,
'allocate_for_instance_networks',
self.allocate_stub)
self.net_manager._clean_up_melange(self.tenant_id, instance_id=1,
raise_exception=False)
def test_clean_up_melange_no_exception_doesnt_raise(self):
self.stubs.Set(melange_connection.MelangeConnection,
'allocate_for_instance_networks',
self.allocate_stub)
self.net_manager._clean_up_melange(self.tenant_id, instance_id=1,
raise_exception=True)
def test_clean_up_melange_exception_raise_exception_true_raises(self):
self.stubs.Set(melange_connection.MelangeConnection,
'allocate_for_instance_networks',
dummy_raise)
self.assertRaises(exception.VirtualInterfaceCleanupException,
self.net_manager._clean_up_melange,
self.tenant_id, instance_id=1, raise_exception=True)
def test_clean_up_melange_exception_raise_exception_false(self):
self.stubs.Set(melange_connection.MelangeConnection,
'allocate_for_instance_networks',
dummy_raise)
self.net_manager._clean_up_melange(self.tenant_id, instance_id=1,
raise_exception=False)
class Quantum2ManagerGenerateAddressPairs(test.TestCase):
def test_generate_address_pairs(self):
self.tenant_id = 'project1'
self.net_manager = manager.QuantumManager()
network_uuid = str(uuidutils.generate_uuid())
self.context = context.RequestContext(user_id=1,
project_id=self.tenant_id)
vif = _vif_helper(self.tenant_id, network_uuid)
ips = _ip_addresses_helper(1)
res = self.net_manager._generate_address_pairs(vif, ips)
self.assertEquals(res[0]['ip_address'], '10.0.0.100')
self.assertEquals(res[0]['mac_address'], '00:00:00:00:00:00')
class Quantum2ManagerDeallocatePort(test.TestCase):
def setUp(self):
super(Quantum2ManagerDeallocatePort, self).setUp()
self.tenant_id = 'project1'
self.net_manager = manager.QuantumManager()
self.network_uuid = str(uuidutils.generate_uuid())
self.context = context.RequestContext(user_id=1,
project_id=self.tenant_id)
self.stubs.Set(quantum_connection.QuantumClientConnection,
'get_port_by_attachment',
_get_port_by_attachment_stub('port'))
def test_deallocate_port_no_port(self):
self.stubs.Set(quantum_connection.QuantumClientConnection,
'get_port_by_attachment',
_get_port_by_attachment_stub(None))
with mock.patch(
'nova.network.quantum2.quantum_connection.'
'QuantumClientConnection.detach_and_delete_port'
) as patch:
self.net_manager._deallocate_port(self.tenant_id,
self.network_uuid,
interface_id=1)
self.assertEqual(patch.called, False)
def test_deallocate_port(self):
with mock.patch(
'nova.network.quantum2.quantum_connection.'
'QuantumClientConnection.detach_and_delete_port'
) as patch:
self.net_manager._deallocate_port(self.tenant_id,
self.network_uuid,
interface_id=1)
self.assertEqual(patch.called, True)
class Quantum2ManagerVifFromNetwork(test.TestCase):
def setUp(self):
super(Quantum2ManagerVifFromNetwork, self).setUp()
self.tenant_id = 'project1'
self.net_manager = manager.QuantumManager()
self.label = 'public'
self.network_uuid = str(uuidutils.generate_uuid())
self.context = context.RequestContext(user_id=1,
project_id=self.tenant_id)
def test_vif_from_network(self):
vifs = _vif_helper(self.tenant_id, self.network_uuid)
res = self.net_manager._vif_from_network(vifs, self.network_uuid,
self.label)
self.assertEquals(res['network']['subnets'][0]['ips'][0]['address'],
'10.0.0.100')
def test_vif_from_network_no_gateway(self):
vifs = _vif_helper(self.tenant_id, self.network_uuid)
vifs['ip_addresses'][0]['ip_block'].pop('gateway')
res = self.net_manager._vif_from_network(vifs, self.network_uuid,
self.label)
self.assertEqual(res['network']['subnets'][0].get('gateway'), None)
def test_vif_from_network_no_dns(self):
vifs = _vif_helper(self.tenant_id, self.network_uuid)
vifs['ip_addresses'][0]['ip_block'].pop('dns1')
vifs['ip_addresses'][0]['ip_block'].pop('dns2')
res = self.net_manager._vif_from_network(vifs, self.network_uuid,
self.label)
self.assertEqual(res['network']['subnets'][0].get('dns'), [])
class Quantum2ManagerVifsToModel(test.TestCase):
def setUp(self):
super(Quantum2ManagerVifsToModel, self).setUp()
self.tenant_id = 'project1'
self.net_manager = manager.QuantumManager()
stub = self.stubs.Set
self.context = context.RequestContext(user_id=1,
project_id=self.tenant_id)
self.networks = _fake_networks(network_count=1,
tenant_id=self.tenant_id)
self.names = [n['name'] for n in self.networks]
stub(self.net_manager, '_get_ips_and_ids_from_vif',
_ips_from_vif_stub(ips_per_vif=2,
tenants=['project1'],
networks=self.networks,
names=self.names))
self.vif = _vif_helper(self.tenant_id, self.networks[0]['id'])
def test_vifs_to_model_no_network_ids_fails(self):
self.stubs.Set(self.net_manager, '_get_ips_and_ids_from_vif',
_ips_from_vif_stub(ips_per_vif=2,
tenants=['project1'],
networks=[],
names=self.names))
self.assertRaises(exception.VirtualInterfaceIntegrityException,
self.net_manager._vifs_to_model, [self.vif])
def test_vifs_to_model_no_tenant_ids_fails(self):
self.stubs.Set(self.net_manager, '_get_ips_and_ids_from_vif',
_ips_from_vif_stub(ips_per_vif=2,
tenants=[],
networks=self.networks,
names=self.names))
self.assertRaises(exception.VirtualInterfaceIntegrityException,
self.net_manager._vifs_to_model, [self.vif])
def test_vifs_to_model_too_many_networks_fails(self):
networks = _fake_networks(network_count=4,
tenant_id=self.tenant_id)
names = [n['name'] for n in networks]
self.stubs.Set(self.net_manager, '_get_ips_and_ids_from_vif',
_ips_from_vif_stub(ips_per_vif=2,
tenants=['project1'],
networks=networks,
names=names))
self.assertRaises(exception.VirtualInterfaceIntegrityException,
self.net_manager._vifs_to_model, [self.vif])
def test_vifs_to_model_too_many_tenants_fails(self):
networks = _fake_networks(network_count=4,
tenant_id=self.tenant_id)
names = [n['name'] for n in networks]
self.stubs.Set(self.net_manager, '_get_ips_and_ids_from_vif',
_ips_from_vif_stub(ips_per_vif=2,
tenants=['project1'] * 4,
networks=networks,
names=names))
self.assertRaises(exception.VirtualInterfaceIntegrityException,
self.net_manager._vifs_to_model, [self.vif])
def test_vifs_to_model(self):
res = self.net_manager._vifs_to_model([self.vif])
self.assertEquals(res[0]['network']['subnets'][0]['ips'][0]['address'],
'10.0.0.100')
class Quantum2GetInstanceUUIDS(test.TestCase):
def setUp(self):
super(Quantum2GetInstanceUUIDS, self).setUp()
self.net_manager = manager.QuantumManager()
self.context = context.RequestContext(user_id=1,
project_id=1)
def test_get_instance_uuids_by_ip_filter(self):
filters = {'ip': 'ip_address'}
self.stubs.Set(melange_connection.MelangeConnection,
'get_instance_ids_by_ip_address',
lambda a, b, c: ["instance_id"])
instance = self.mox.CreateMockAnything()
instance.uuid = 'instance_uuid'
self.mox.StubOutWithMock(db, 'instance_get_by_uuid')
db.instance_get_by_uuid(self.context,
'instance_id').AndReturn(instance)
self.mox.ReplayAll()
uuids = self.net_manager.get_instance_uuids_by_ip_filter(self.context,
filters)
self.assertEquals(uuids, [{'instance_uuid': 'instance_uuid'}])
class Quantum2VirtualInterfaces(test.TestCase):
def setUp(self):
super(Quantum2VirtualInterfaces, self).setUp()
self.net_manager = manager.QuantumManager()
self.context = context.RequestContext(user_id=1,
project_id=1)
def _discover_nets_stub(self, ret):
def disc(*args, **kwargs):
return ret
return disc
def _get_vif(self, ret):
def vif(*args, **kwargs):
return ret
return vif
def _dummy(*args, **kwargs):
pass
def test_create_virtual_interface(self):
instance_id = 1
rxtx_factor = 1
project_id = "openstack"
network_id = uuid.uuid4()
self.stubs.Set(manager.QuantumManager, "_discover_networks",
self._discover_nets_stub([{"id": network_id}]))
self.stubs.Set(melange_connection.MelangeConnection,
"get_allocated_networks",
_get_allocated_networks_stub([]))
self.stubs.Set(melange_connection.MelangeConnection,
"allocate_interface_for_instance",
self._dummy)
self.stubs.Set(manager.QuantumManager, "_clean_vif_list", self._dummy)
with mock.patch("nova.network.quantum2.manager.QuantumManager."
"_establish_interface_and_port") as patch:
self.net_manager.allocate_interface_for_instance(self.context,
instance_id,
rxtx_factor,
project_id,
network_id)
self.assertEqual(patch.called, True)
def test_create_virtual_interface_too_many_connections_fails(self):
instance_id = 1
rxtx_factor = 1
project_id = "openstack"
network_id = uuid.uuid4()
vif = _vif_helper(project_id, network_id)
self.stubs.Set(manager.QuantumManager, "_discover_networks",
self._discover_nets_stub([{"id": network_id}]))
self.stubs.Set(melange_connection.MelangeConnection,
"get_allocated_networks",
_get_allocated_networks_stub([vif], bare_uuids=False))
self.stubs.Set(melange_connection.MelangeConnection,
"allocate_interface_for_instance",
self._dummy)
self.stubs.Set(manager.QuantumManager, "_establish_interface_and_port",
self._dummy)
instance_id = 1
rxtx_factor = 1
project_id = "openstack"
network_id = uuid.uuid4()
self.assertRaises(exception.AlreadyAttachedToNetwork,
self.net_manager.allocate_interface_for_instance,
self.context, instance_id, rxtx_factor, project_id,
network_id)
def test_delete_virtual_interface(self):
instance_id = 1
project_id = "openstack"
network_id = uuid.uuid4()
vif = _vif_helper(project_id, network_id)
self.stubs.Set(manager.QuantumManager, "_deallocate_port",
self._dummy)
self.stubs.Set(melange_connection.MelangeConnection,
"get_interface_for_device",
self._get_vif(vif))
instance_id = 1
project_id = "openstack"
network_id = uuid.uuid4()
with mock.patch("nova.network.quantum2.melange_connection."
"MelangeConnection."
"deallocate_interface_for_instance") as patch:
self.net_manager.deallocate_interface_for_instance(self.context,
instance_id,
vif["id"])
self.assertEquals(patch.called, True)
class Quantum2ManagerTestsAddRemoveFixedIP(test.TestCase):
def setUp(self):
super(Quantum2ManagerTestsAddRemoveFixedIP, self).setUp()
map = ['00000000-0000-0000-0000-000000000000', 'public',
'11111111-1111-1111-1111-111111111111', 'private']
self.flags(quantum_use_port_security=True,
network_global_uuid_label_map=map)
self.tenant_id = 'default'
self.context = context.RequestContext(is_admin=True, user_id=1,
project_id=self.tenant_id)
self.q_conn = ('nova.network.quantum2.quantum_connection.'
'QuantumClientConnection')
self.m_conn = ('nova.network.quantum2.melange_connection.'
'MelangeConnection')
self.default_networks = _fake_networks(2, self.tenant_id)
def iterlabel():
for label in ['public', 'private']:
yield label
self.label_toggler = iterlabel()
def pub_priv(s, network):
network = {'id': network['network_id'],
'cidr': network['cidr']}
try:
network['label'] = self.label_toggler.next()
except StopIteration:
self.label_toggler = iterlabel()
network['label'] = self.label_toggler.next()
return network
self.stubs.Set(manager.QuantumManager, '_normalize_network', pub_priv)
self.stubs.Set(melange_connection.MelangeConnection,
'get_networks_for_tenant',
lambda *args, **kwargs: self.default_networks)
self.net_manager = manager.QuantumManager()
def test_add_fixed_ip_to_instance_isolated(self):
with contextlib.nested(
mock.patch(self.m_conn + '.get_allocated_networks'),
mock.patch(self.m_conn + '.get_interface_for_device'),
mock.patch(self.m_conn + '.allocate_ip_for_instance'),
mock.patch(self.q_conn + '.update_allowed_address_pairs_on_port'),
mock.patch(self.q_conn + '.get_port_by_attachment'),
) as (get_allocated_networks,
get_interface_for_device,
allocate_ip_for_instance,
update_port,
get_port_by_attachment):
ip_block = {'network_id': '1'}
get_allocated_networks.return_value = [
{'id': 'fake_uuid',
'tenant_id': self.tenant_id,
'ip_addresses': [{'address': '10.0.0.3',
'ip_block': ip_block}]}]
get_interface_for_device.return_value = {
'interface': {'mac_address': 'xx.xx.xx.xx.xx.xx.xx',
'ip_addresses': [{'address': '10.0.0.5'},
{'address': '10.0.0.6'}]}}
get_port_by_attachment.return_value = 'some-uuid'
self.net_manager.add_fixed_ip_to_instance(self.context,
instance_id='1',
host='host',
network_id='1')
self.assertTrue(allocate_ip_for_instance.called)
self.assertTrue(update_port.called)
def test_add_fixed_ip_to_instance_rax(self):
with contextlib.nested(
mock.patch(self.m_conn + '.get_allocated_networks'),
mock.patch(self.m_conn + '.get_interface_for_device'),
mock.patch(self.m_conn + '.allocate_ip_for_instance'),
mock.patch(self.q_conn + '.update_allowed_address_pairs_on_port'),
mock.patch(self.q_conn + '.get_port_by_attachment'),
) as (get_allocated_networks,
get_interface_for_device,
allocate_ip_for_instance,
update_port,
get_port_by_attachment):
ip_block = {'network_id': self.default_networks[1]['network_id']}
get_allocated_networks.return_value = [
{'id': 'fake_uuid',
'tenant_id': self.tenant_id,
'ip_addresses': [{'address': '10.0.0.3',
'ip_block': ip_block}]}]
get_interface_for_device.return_value = {
'interface': {'mac_address': 'xx.xx.xx.xx.xx.xx.xx',
'ip_addresses': [{'address': '10.0.0.5'},
{'address': '10.0.0.6'}]}}
get_port_by_attachment.return_value = 'some-uuid'
net_id = '11111111-1111-1111-1111-111111111111'
self.net_manager.add_fixed_ip_to_instance(self.context,
instance_id='1',
host='host',
network_id=net_id)
self.assertTrue(allocate_ip_for_instance.called)
self.assertTrue(update_port.called)
def test_add_fixed_ip_to_instance_no_interface(self):
with contextlib.nested(
mock.patch(self.m_conn + '.get_allocated_networks'),
mock.patch(self.m_conn + '.get_interface_for_device'),
mock.patch(self.m_conn + '.allocate_ip_for_instance'),
mock.patch(self.q_conn + '.update_allowed_address_pairs_on_port'),
mock.patch(self.q_conn + '.get_port_by_attachment'),
) as (get_allocated_networks,
get_interface_for_device,
allocate_ip_for_instance,
update_port,
get_port_by_attachment):
get_allocated_networks.return_value = {}
get_interface_for_device.return_value = {}
self.net_manager.add_fixed_ip_to_instance(self.context,
instance_id='1',
host='host',
network_id='1')
self.assertFalse(allocate_ip_for_instance.called)
self.assertFalse(update_port.called)
def test_add_fixed_ip_bad_context(self):
with contextlib.nested(
mock.patch(self.m_conn + '.get_allocated_networks'),
mock.patch(self.m_conn + '.get_interface_for_device'),
mock.patch(self.m_conn + '.allocate_ip_for_instance'),
mock.patch(self.q_conn + '.update_allowed_address_pairs_on_port'),
mock.patch(self.q_conn + '.get_port_by_attachment'),
) as (get_allocated_networks,
get_interface_for_device,
allocate_ip_for_instance,
update_port,
get_port_by_attachment):
ctxt = context.RequestContext(user_id=1,
project_id=self.tenant_id)
self.net_manager.add_fixed_ip_to_instance(ctxt, instance_id='1',
host='host', network_id='1')
self.assertFalse(allocate_ip_for_instance.called)
self.assertFalse(update_port.called)
def test_remove_fixed_ip_from_instance(self):
with contextlib.nested(
mock.patch(self.m_conn + '.get_allocated_networks'),
mock.patch(self.m_conn + '.get_interface_for_device'),
mock.patch(self.m_conn + '.deallocate_ip_for_instance'),
mock.patch(self.q_conn + '.update_allowed_address_pairs_on_port'),
mock.patch(self.q_conn + '.get_port_by_attachment'),
) as (get_allocated_networks,
get_interface_for_device,
deallocate_ip_for_instance,
update_port,
get_port_by_attachment):
ip_block = {'network_id': 'some_uuid',
'tenant_id': self.tenant_id}
get_allocated_networks.return_value = [
{'id': 'fake_uuid',
'ip_addresses': [{'address': '10.0.0.3',
'ip_block': ip_block,
'version': 4},
{'address': '10.0.0.4',
'ip_block': ip_block,
'version': 4}]}]
get_interface_for_device.return_value = {
'interface': {'mac_address': 'xx.xx.xx.xx.xx.xx.xx',
'ip_addresses': [{'address': '10.0.0.5'},
{'address': '10.0.0.6'}]}}
get_port_by_attachment.return_value = 'some-uuid'
self.net_manager.remove_fixed_ip_from_instance(self.context,
instance_id='1',
host='host',
address='10.0.0.3')
self.assertTrue(deallocate_ip_for_instance.called)
self.assertTrue(update_port.called)
def test_remove_last_fixed_ip_from_instance(self):
with contextlib.nested(
mock.patch(self.m_conn + '.get_allocated_networks'),
mock.patch(self.m_conn + '.get_interface_for_device'),
mock.patch(self.m_conn + '.deallocate_ip_for_instance'),
mock.patch(self.q_conn + '.update_port'),
mock.patch(self.q_conn + '.get_port_by_attachment'),
) as (get_allocated_networks,
get_interface_for_device,
deallocate_ip_for_instance,
update_port,
get_port_by_attachment):
ip_block = {'network_id': 'some_uuid'}
get_allocated_networks.return_value = [
{'id': 'fake_uuid',
'ip_addresses': [{'address': '10.0.0.3',
'ip_block': ip_block,
'version': 4}]}]
get_interface_for_device.return_value = {
'interface': {'mac_address': 'xx.xx.xx.xx.xx.xx.xx',
'ip_addresses': [{'address': '10.0.0.5'},
{'address': '10.0.0.6'}]}}
get_port_by_attachment.return_value = 'some-uuid'
self.net_manager.remove_fixed_ip_from_instance(self.context,
instance_id='1',
host='host',
address='10.0.0.3')
self.assertFalse(deallocate_ip_for_instance.called)
self.assertFalse(update_port.called)
def test_remove_fixed_ip_from_instance_addr_not_found(self):
with contextlib.nested(
mock.patch(self.m_conn + '.get_allocated_networks'),
mock.patch(self.m_conn + '.get_interface_for_device'),
mock.patch(self.m_conn + '.deallocate_ip_for_instance'),
mock.patch(self.q_conn + '.update_allowed_address_pairs_on_port'),
mock.patch(self.q_conn + '.get_port_by_attachment'),
) as (get_allocated_networks,
get_interface_for_device,
deallocate_ip_for_instance,
update_port,
get_port_by_attachment):
get_allocated_networks.return_value = {}
get_interface_for_device.return_value = {}
self.net_manager.remove_fixed_ip_from_instance(self.context,
instance_id='1',
host='host',
address='10.0.0.3')
self.assertFalse(deallocate_ip_for_instance.called)
self.assertFalse(update_port.called)
def test_remove_fixed_ip_bad_context(self):
with contextlib.nested(
mock.patch(self.m_conn + '.get_allocated_networks'),
mock.patch(self.m_conn + '.get_interface_for_device'),
mock.patch(self.m_conn + '.deallocate_ip_for_instance'),
mock.patch(self.q_conn + '.update_allowed_address_pairs_on_port'),
mock.patch(self.q_conn + '.get_port_by_attachment'),
) as (get_allocated_networks,
get_interface_for_device,
deallocate_ip_for_instance,
update_port,
get_port_by_attachment):
ctxt = context.RequestContext(user_id=1,
project_id=self.tenant_id)
self.net_manager.remove_fixed_ip_from_instance(ctxt,
instance_id='1', host='host', address='10.0.0.3')
self.assertFalse(deallocate_ip_for_instance.called)
self.assertFalse(update_port.called)
| 45.321234 | 79 | 0.570693 | 7,791 | 74,916 | 5.115004 | 0.051213 | 0.037264 | 0.047201 | 0.03212 | 0.819176 | 0.791523 | 0.748764 | 0.717322 | 0.694964 | 0.687185 | 0 | 0.01798 | 0.342223 | 74,916 | 1,652 | 80 | 45.348668 | 0.790718 | 0.015791 | 0 | 0.693324 | 0 | 0 | 0.113405 | 0.069395 | 0 | 0 | 0 | 0 | 0.056493 | 1 | 0.085106 | false | 0.001467 | 0.00807 | 0.008804 | 0.132062 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
ef8549dac5b6accc989e6d9442a4de28c1774cd4 | 30 | py | Python | levels/__init__.py | Sigma-One/TextGame | 84ae7b3bc024efd5770c9e99ece17b5f2b303c69 | [
"MIT"
] | null | null | null | levels/__init__.py | Sigma-One/TextGame | 84ae7b3bc024efd5770c9e99ece17b5f2b303c69 | [
"MIT"
] | null | null | null | levels/__init__.py | Sigma-One/TextGame | 84ae7b3bc024efd5770c9e99ece17b5f2b303c69 | [
"MIT"
] | null | null | null | #Makes this folder importable
| 15 | 29 | 0.833333 | 4 | 30 | 6.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 30 | 1 | 30 | 30 | 0.961538 | 0.933333 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
4bd0cfb105b1a2cc1c6aaad201af47d37aed7c5c | 128 | py | Python | {{cookiecutter.project_name}}/tests/unitTests/{{cookiecutter.project_name}}Tests.py | michael-c-hoffman/python-best-practices-cookiecutter | 4dc35689477a7506fbb1bfd97a6850e5ac61bf05 | [
"MIT"
] | null | null | null | {{cookiecutter.project_name}}/tests/unitTests/{{cookiecutter.project_name}}Tests.py | michael-c-hoffman/python-best-practices-cookiecutter | 4dc35689477a7506fbb1bfd97a6850e5ac61bf05 | [
"MIT"
] | null | null | null | {{cookiecutter.project_name}}/tests/unitTests/{{cookiecutter.project_name}}Tests.py | michael-c-hoffman/python-best-practices-cookiecutter | 4dc35689477a7506fbb1bfd97a6850e5ac61bf05 | [
"MIT"
] | null | null | null | from {{cookiecutter.project_module}}.fib import fib
def fibTest(data_fib) -> None:
assert fib(data_fib[0]) == data_fib[1]
| 21.333333 | 51 | 0.710938 | 20 | 128 | 4.35 | 0.65 | 0.241379 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018182 | 0.140625 | 128 | 5 | 52 | 25.6 | 0.772727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 0 | null | null | 0 | 0.333333 | null | null | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
4be38520353d58f8544a37270501861b04a3d539 | 208 | py | Python | pysit/solvers/__init__.py | zfang-slim/pysit | 8fca42b9749841abc302d1f8195a1437fad7ae4d | [
"BSD-3-Clause"
] | 64 | 2015-09-08T06:23:27.000Z | 2022-03-09T23:35:24.000Z | pysit/solvers/__init__.py | zfang-slim/pysit | 8fca42b9749841abc302d1f8195a1437fad7ae4d | [
"BSD-3-Clause"
] | 23 | 2015-10-08T01:14:24.000Z | 2021-07-15T11:37:05.000Z | pysit/solvers/__init__.py | zfang-slim/pysit | 8fca42b9749841abc302d1f8195a1437fad7ae4d | [
"BSD-3-Clause"
] | 48 | 2015-06-25T14:48:22.000Z | 2021-12-06T19:50:25.000Z | from .wave_factory import *
from .helmholtz_factory import *
from .model_parameter import * #So we can set bounds like WaveSpeed.add_upper_bound(val)
#__all__ = filter(lambda s: not s.startswith('_'),dir())
| 34.666667 | 88 | 0.764423 | 31 | 208 | 4.806452 | 0.806452 | 0.174497 | 0.228188 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 208 | 5 | 89 | 41.6 | 0.818681 | 0.533654 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
4bf799049835ee98f798eb87be0afde53ec823c4 | 98 | py | Python | DeepRL_For_HPE/DatasetHandler/__init__.py | muratcancicek/Deep_RL_For_Head_Pose_Est | b3436a61a44d20d8bcfd1341792e0533e3ff9fc2 | [
"Apache-2.0"
] | null | null | null | DeepRL_For_HPE/DatasetHandler/__init__.py | muratcancicek/Deep_RL_For_Head_Pose_Est | b3436a61a44d20d8bcfd1341792e0533e3ff9fc2 | [
"Apache-2.0"
] | null | null | null | DeepRL_For_HPE/DatasetHandler/__init__.py | muratcancicek/Deep_RL_For_Head_Pose_Est | b3436a61a44d20d8bcfd1341792e0533e3ff9fc2 | [
"Apache-2.0"
] | null | null | null | """
from . import BiwiTarBrowser
from . import BiwiBrowser
from . import NighborFolderimporter
""" | 19.6 | 35 | 0.77551 | 9 | 98 | 8.444444 | 0.555556 | 0.394737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.132653 | 98 | 5 | 36 | 19.6 | 0.894118 | 0.918367 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
ef0cd1d46a9380f86af4612212d902041f4cd801 | 104 | py | Python | backend/app/settings/logging.py | MaxKochanov/stock-news | 42776196604e91cd673c94c9f7dea71343791bd1 | [
"MIT"
] | 6 | 2021-02-03T04:25:06.000Z | 2022-01-28T15:28:45.000Z | backend/app/settings/logging.py | MaxKochanov/stock-news | 42776196604e91cd673c94c9f7dea71343791bd1 | [
"MIT"
] | null | null | null | backend/app/settings/logging.py | MaxKochanov/stock-news | 42776196604e91cd673c94c9f7dea71343791bd1 | [
"MIT"
] | 5 | 2021-02-01T08:41:30.000Z | 2021-09-30T22:10:49.000Z | def init_logging():
pass
async def format_log_message(request, response, has_body=True):
pass
| 14.857143 | 63 | 0.730769 | 15 | 104 | 4.8 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.182692 | 104 | 6 | 64 | 17.333333 | 0.847059 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | true | 0.5 | 0 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
ef2a9753949539c1ab03aefefdfbea7d4d36e394 | 63 | py | Python | pyfido/__init__.py | frenck/pyfido | 1b8f5eebe59fa039db42933e1d28af5aff537993 | [
"Apache-2.0"
] | 4 | 2017-05-10T15:15:44.000Z | 2021-11-12T23:02:07.000Z | pyfido/__init__.py | frenck/pyfido | 1b8f5eebe59fa039db42933e1d28af5aff537993 | [
"Apache-2.0"
] | 3 | 2018-09-19T22:39:26.000Z | 2020-11-24T10:56:32.000Z | pyfido/__init__.py | frenck/pyfido | 1b8f5eebe59fa039db42933e1d28af5aff537993 | [
"Apache-2.0"
] | 6 | 2017-03-08T14:17:44.000Z | 2021-03-03T11:01:16.000Z | from pyfido.client import FidoClient, REQUESTS_TIMEOUT # NOQA
| 31.5 | 62 | 0.825397 | 8 | 63 | 6.375 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126984 | 63 | 1 | 63 | 63 | 0.927273 | 0.063492 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
ef47538c9709f8445ee167e4ace94773829d6fa0 | 116 | py | Python | general-practice/Exercises solved/w3resource/basic/Exercise80.py | lugabrielbueno/Projeto | f012c5bb9ce6f6d7c9e8196cc7986127dba3eba0 | [
"MIT"
] | null | null | null | general-practice/Exercises solved/w3resource/basic/Exercise80.py | lugabrielbueno/Projeto | f012c5bb9ce6f6d7c9e8196cc7986127dba3eba0 | [
"MIT"
] | null | null | null | general-practice/Exercises solved/w3resource/basic/Exercise80.py | lugabrielbueno/Projeto | f012c5bb9ce6f6d7c9e8196cc7986127dba3eba0 | [
"MIT"
] | null | null | null | # Write a Python program to get the current value of the recursion limit
import sys
print(sys.getrecursionlimit()) | 23.2 | 72 | 0.793103 | 18 | 116 | 5.111111 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.155172 | 116 | 5 | 73 | 23.2 | 0.938776 | 0.603448 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 5 |
ef5983d070c2bf372771aca5149cc949a29aa5bf | 139 | py | Python | Replacewithinthefragment.py | Arnabsaha6/Snakify | df0c1112ae8a56a275044f786bfd89f746e3ca85 | [
"MIT"
] | null | null | null | Replacewithinthefragment.py | Arnabsaha6/Snakify | df0c1112ae8a56a275044f786bfd89f746e3ca85 | [
"MIT"
] | null | null | null | Replacewithinthefragment.py | Arnabsaha6/Snakify | df0c1112ae8a56a275044f786bfd89f746e3ca85 | [
"MIT"
] | null | null | null | Code:
s = input()
a = s[:s.find('h') + 1]
b = s[s.find('h') + 1:s.rfind('h')]
c = s[s.rfind('h'):]
s = a + b.replace('h', 'H') + c
print(s) | 19.857143 | 35 | 0.453237 | 32 | 139 | 1.96875 | 0.375 | 0.095238 | 0.190476 | 0.222222 | 0.253968 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017544 | 0.179856 | 139 | 7 | 36 | 19.857143 | 0.535088 | 0 | 0 | 0 | 0 | 0 | 0.042857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.142857 | 0 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
ef5a7e156decb04321539d1f27c8ff94d439cdf2 | 143 | py | Python | en/037/python/main.py | franciscogomes2020/exercises | 8b33c4b9349a9331e4002a8225adc2a482c70024 | [
"MIT"
] | null | null | null | en/037/python/main.py | franciscogomes2020/exercises | 8b33c4b9349a9331e4002a8225adc2a482c70024 | [
"MIT"
] | null | null | null | en/037/python/main.py | franciscogomes2020/exercises | 8b33c4b9349a9331e4002a8225adc2a482c70024 | [
"MIT"
] | null | null | null | # Write a Python program that reads any integer and ask the user to choose the base conversion: 1 to binary, 2 to octal, and 3 to hexadecimal.
| 71.5 | 142 | 0.769231 | 27 | 143 | 4.074074 | 0.814815 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026087 | 0.195804 | 143 | 1 | 143 | 143 | 0.930435 | 0.979021 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
32413d042e7301bff11ee11afa18899c6ed05867 | 1,266 | py | Python | document/migrations/0005_auto_20210505_0912.py | sainioan/extractiontool | 9908b7ff1915b00a5721405a48b13d941442e1dd | [
"MIT"
] | 2 | 2021-05-18T17:25:06.000Z | 2021-05-28T04:24:16.000Z | document/migrations/0005_auto_20210505_0912.py | sainioan/extractiontool | 9908b7ff1915b00a5721405a48b13d941442e1dd | [
"MIT"
] | 38 | 2021-01-20T09:38:37.000Z | 2021-05-15T13:10:05.000Z | document/migrations/0005_auto_20210505_0912.py | sainioan/extractiontool | 9908b7ff1915b00a5721405a48b13d941442e1dd | [
"MIT"
] | 3 | 2021-01-20T13:18:31.000Z | 2021-02-25T13:34:49.000Z | # Generated by Django 3.1.5 on 2021-05-05 06:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('document', '0004_auto_20210504_0619'),
]
operations = [
migrations.AddField(
model_name='pdf',
name='issue',
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AddField(
model_name='pdf',
name='journal',
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AddField(
model_name='pdf',
name='pages',
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AddField(
model_name='pdf',
name='publisher',
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AddField(
model_name='pdf',
name='volume',
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AddField(
model_name='pdf',
name='year',
field=models.CharField(blank=True, max_length=100, null=True),
),
]
| 28.772727 | 74 | 0.552923 | 131 | 1,266 | 5.229008 | 0.328244 | 0.157664 | 0.20146 | 0.236496 | 0.727007 | 0.727007 | 0.677372 | 0.677372 | 0.677372 | 0.677372 | 0 | 0.05711 | 0.322275 | 1,266 | 43 | 75 | 29.44186 | 0.741259 | 0.035545 | 0 | 0.648649 | 1 | 0 | 0.069729 | 0.018868 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.027027 | 0 | 0.108108 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
325a3b8341579af2591259415d06e4973f8754aa | 217 | py | Python | bonobo/structs/tokens.py | winsmith/bonobo | 6fb9f52bec43a23feac2db968dd4315d75d69910 | [
"Apache-2.0"
] | 1 | 2017-11-13T22:29:27.000Z | 2017-11-13T22:29:27.000Z | bonobo/structs/tokens.py | winsmith/bonobo | 6fb9f52bec43a23feac2db968dd4315d75d69910 | [
"Apache-2.0"
] | null | null | null | bonobo/structs/tokens.py | winsmith/bonobo | 6fb9f52bec43a23feac2db968dd4315d75d69910 | [
"Apache-2.0"
] | null | null | null | class Token:
"""Factory for signal oriented queue messages or other token types."""
def __init__(self, name):
self.__name__ = name
def __repr__(self):
return '<{}>'.format(self.__name__)
| 24.111111 | 74 | 0.635945 | 26 | 217 | 4.692308 | 0.692308 | 0.196721 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.239631 | 217 | 8 | 75 | 27.125 | 0.739394 | 0.294931 | 0 | 0 | 0 | 0 | 0.027211 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0.2 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 5 |
327acfa198c827fc76c4dd76166fe92b49ca0632 | 103 | py | Python | src/services/db_connection_manager/__init__.py | Asa-Nisi-Masa/movie-recommender | 92752aa302e166885ab3e39b3e9d2ac9185a013e | [
"MIT"
] | null | null | null | src/services/db_connection_manager/__init__.py | Asa-Nisi-Masa/movie-recommender | 92752aa302e166885ab3e39b3e9d2ac9185a013e | [
"MIT"
] | null | null | null | src/services/db_connection_manager/__init__.py | Asa-Nisi-Masa/movie-recommender | 92752aa302e166885ab3e39b3e9d2ac9185a013e | [
"MIT"
] | null | null | null | from .db_connection_manager import DbConnectionManager
db_connection_manager = DbConnectionManager()
| 20.6 | 54 | 0.873786 | 10 | 103 | 8.6 | 0.6 | 0.27907 | 0.44186 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.087379 | 103 | 4 | 55 | 25.75 | 0.914894 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
086c525a43d9f00dab1f0ddde7871d3e3fb97750 | 86 | py | Python | project/sitemaps.py | andywar65/starter-fullstack | 683d6282eb02a9b967d15cd254976e67549672e9 | [
"BSD-2-Clause"
] | null | null | null | project/sitemaps.py | andywar65/starter-fullstack | 683d6282eb02a9b967d15cd254976e67549672e9 | [
"BSD-2-Clause"
] | null | null | null | project/sitemaps.py | andywar65/starter-fullstack | 683d6282eb02a9b967d15cd254976e67549672e9 | [
"BSD-2-Clause"
] | null | null | null | from django.contrib.sitemaps import Sitemap # noqa: F401
# add here sitemap classes
| 21.5 | 57 | 0.77907 | 12 | 86 | 5.583333 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041667 | 0.162791 | 86 | 3 | 58 | 28.666667 | 0.888889 | 0.406977 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
08a3f713edb0efd3058710929520f4dc3f521816 | 30,678 | py | Python | third_party/ite/cost/meta_i.py | gdikov/adversarial-variational-bayes | ebd692c70349f34bcb3a2086269bd814cafce96f | [
"MIT"
] | 11 | 2017-09-25T07:46:43.000Z | 2019-12-04T12:02:49.000Z | Foundations_of_Private_Computation/Split_Learning/concepts-definitions-code/ite-repo/ite/cost/meta_i.py | gonzalo-munillag/Private_AI_OpenMined | c23da9cc1c914d10646a0c0bc1a2497fe2cbaaca | [
"MIT"
] | null | null | null | Foundations_of_Private_Computation/Split_Learning/concepts-definitions-code/ite-repo/ite/cost/meta_i.py | gonzalo-munillag/Private_AI_OpenMined | c23da9cc1c914d10646a0c0bc1a2497fe2cbaaca | [
"MIT"
] | 4 | 2018-04-26T15:08:37.000Z | 2019-07-02T14:15:08.000Z | """ Meta mutual information estimators. """
from numpy.random import rand
from numpy import ones
from ite.cost.x_initialization import InitX, InitAlpha
from ite.cost.x_verification import VerCompSubspaceDims, VerOneDSubspaces,\
VerSubspaceNumberIsK
from ite.cost.x_factory import co_factory
from ite.shared import joint_and_product_of_the_marginals_split,\
copula_transformation
class MIShannon_DKL(InitX, VerCompSubspaceDims):
""" Shannon mutual information estimator based on KL divergence.
The estimation is based on the relation I(y^1,...,y^M) =
D(f_y,\prod_{m=1}^M f_{y^m}), where I is the Shannon mutual
information, D is the Kullback-Leibler divergence.
Partial initialization comes from 'InitX', verification is from
'VerCompSubspaceDims' (see 'ite.cost.x_initialization.py',
'ite.cost.x_verification.py').
"""
def __init__(self, mult=True, kl_co_name='BDKL_KnnK', kl_co_pars=None):
""" Initialize the estimator.
Parameters
----------
mult : bool, optional
'True': multiplicative constant relevant (needed) in the
estimation. 'False': estimation up to 'proportionality'.
(default is True)
kl_co_name : str, optional
You can change it to any Kullback-Leibler divergence
estimator (default is 'BDKL_KnnK').
kl_co_pars : dictionary, optional
Parameters for the KL divergence estimator (default
is None (=> {}); in this case the default parameter
values of the KL divergence estimator are used).
Examples
--------
>>> import ite
>>> co1 = ite.cost.MIShannon_DKL()
>>> co2 = ite.cost.MIShannon_DKL(kl_co_name='BDKL_KnnK')
>>> dict_ch = {'knn_method': 'cKDTree', 'k': 4, 'eps': 0.1}
>>> co3 = ite.cost.MIShannon_DKL(kl_co_name='BDKL_KnnK',\
kl_co_pars=dict_ch)
"""
# initialize with 'InitX':
super().__init__(mult=mult)
# initialize the KL divergence estimator:
kl_co_pars = kl_co_pars or {}
kl_co_pars['mult'] = mult # guarantee this property
self.kl_co = co_factory(kl_co_name, **kl_co_pars)
def estimation(self, y, ds):
""" Estimate Shannon mutual information.
Parameters
----------
y : (number of samples, dimension)-ndarray
One row of y corresponds to one sample.
ds : int vector
Dimensions of the individual subspaces in y; ds[i] = i^th
subspace dimension.
Returns
-------
i : float
Estimated Shannon mutual information.
Examples
--------
i = co.estimation(y,ds)
"""
# verification:
self.verification_compatible_subspace_dimensions(y, ds)
y1, y2 = joint_and_product_of_the_marginals_split(y, ds)
i = self.kl_co.estimation(y1, y2)
return i
class MIChi2_DChi2(InitX, VerCompSubspaceDims):
""" Chi-square mutual information estimator based on chi^2 distance.
The estimation is based on the relation I(y^1,...,y^M) =
D(f_y,\prod_{m=1}^M f_{y^m}), where I is the chi-square mutual
information, D is the chi^2 distance.
Partial initialization comes from 'InitX', verification is from
'VerCompSubspaceDims' (see 'ite.cost.x_initialization.py',
'ite.cost.x_verification.py').
"""
def __init__(self, mult=True, chi2_co_name='BDChi2_KnnK',
chi2_co_pars=None):
""" Initialize the estimator.
Parameters
----------
mult : bool, optional
'True': multiplicative constant relevant (needed) in the
estimation. 'False': estimation up to 'proportionality'.
(default is True)
chi2_co_name : str, optional
You can change it to any Pearson chi-square
divergence estimator (default is 'BDChi2_KnnK').
chi2_co_pars : dictionary, optional
Parameters for the Pearson chi-square divergence
estimator (default is None (=> {}); in this case the
default parameter values of the Pearson chi-square
divergence estimator are used).
Examples
--------
>>> import ite
>>> co1 = ite.cost.MIChi2_DChi2()
>>> co2 = ite.cost.MIChi2_DChi2(chi2_co_name='BDChi2_KnnK')
>>> dict_ch = {'knn_method': 'cKDTree', 'k': 4, 'eps': 0.1}
>>> co3 = ite.cost.MIChi2_DChi2(chi2_co_name='BDChi2_KnnK', \
chi2_co_pars=dict_ch)
"""
# initialize with 'InitX':
super().__init__(mult=mult)
# initialize the chi-square divergence estimator:
chi2_co_pars = chi2_co_pars or {}
chi2_co_pars['mult'] = mult # guarantee this property
self.chi2_co = co_factory(chi2_co_name, **chi2_co_pars)
def estimation(self, y, ds):
""" Estimate chi-square mutual information.
Parameters
----------
y : (number of samples, dimension)-ndarray
One row of y corresponds to one sample.
ds : int vector
Dimensions of the individual subspaces in y; ds[i] = i^th
subspace dimension.
Returns
-------
i : float
Estimated chi-square mutual information.
Examples
--------
i = co.estimation(y,ds)
"""
# verification:
self.verification_compatible_subspace_dimensions(y, ds)
y1, y2 = joint_and_product_of_the_marginals_split(y, ds)
i = self.chi2_co.estimation(y1, y2)
return i
class MIL2_DL2(InitX, VerCompSubspaceDims):
""" L2 mutual information estimator based on L2 divergence.
The estimation is based on the relation I(y^1,...,y^M) =
D(f_y,\prod_{m=1}^M f_{y^m}), where I is the L2 mutual
information, D is the L2 divergence.
Partial initialization comes from 'InitX', verification is from
'VerCompSubspaceDims' (see 'ite.cost.x_initialization.py',
'ite.cost.x_verification.py').
"""
def __init__(self, mult=True, l2_co_name='BDL2_KnnK', l2_co_pars=None):
""" Initialize the estimator.
Parameters
----------
mult : bool, optional
'True': multiplicative constant relevant (needed) in the
estimation. 'False': estimation up to 'proportionality'.
(default is True)
l2_co_name : str, optional
You can change it to any L2 divergence estimator
(default is 'BDL2_KnnK').
l2_co_pars : dictionary, optional
Parameters for the L2 divergence estimator (default
is None (=> {}); in this case the default parameter
values of the L2 divergence estimator are used).
Examples
--------
>>> import ite
>>> co1 = ite.cost.MIL2_DL2()
>>> co2 = ite.cost.MIL2_DL2(l2_co_name='BDL2_KnnK')
>>> dict_ch = {'knn_method': 'cKDTree', 'k': 2, 'eps': 0.1}
>>> co3 = ite.cost.MIL2_DL2(l2_co_name='BDL2_KnnK',\
l2_co_pars=dict_ch)
"""
# initialize with 'InitX':
super().__init__(mult=mult)
# initialize the L2 divergence estimator:
l2_co_pars = l2_co_pars or {}
l2_co_pars['mult'] = mult # guarantee this property
self.l2_co = co_factory(l2_co_name, **l2_co_pars)
def estimation(self, y, ds):
""" Estimate L2 mutual information.
Parameters
----------
y : (number of samples, dimension)-ndarray
One row of y corresponds to one sample.
ds : int vector
Dimensions of the individual subspaces in y; ds[i] = i^th
subspace dimension.
Returns
-------
i : float
Estimated L2 mutual information.
References
----------
Barnabas Poczos, Zoltan Szabo, Jeff Schneider: Nonparametric
divergence estimators for Independent Subspace Analysis. European
Signal Processing Conference (EUSIPCO), pages 1849-1853, 2011.
Examples
--------
i = co.estimation(y,ds)
"""
# verification:
self.verification_compatible_subspace_dimensions(y, ds)
y1, y2 = joint_and_product_of_the_marginals_split(y, ds)
i = self.l2_co.estimation(y1, y2)
return i
class MIRenyi_DR(InitAlpha, VerCompSubspaceDims):
""" Renyi mutual information estimator based on Renyi divergence.
The estimation is based on the relation I(y^1,...,y^M) =
D(f_y,\prod_{m=1}^M f_{y^m}), where I is the Renyi mutual
information, D is the Renyi divergence.
Partial initialization comes from 'InitAlpha', verification is from
'VerCompSubspaceDims' (see 'ite.cost.x_initialization.py',
'ite.cost.x_verification.py').
"""
def __init__(self, mult=True, alpha=0.99, renyi_co_name='BDRenyi_KnnK',
renyi_co_pars=None):
""" Initialize the estimator.
Parameters
----------
mult : bool, optional
'True': multiplicative constant relevant (needed) in the
estimation. 'False': estimation up to 'proportionality'.
(default is True)
alpha : float, optional
Parameter of the Renyi mutual information (default is
0.99).
renyi_co_name : str, optional
You can change it to any Renyi divergence
estimator (default is 'BDRenyi_KnnK').
renyi_co_pars : dictionary, optional
Parameters for the Renyi divergence estimator
(default is None (=> {}); in this case the default
parameter values of the Renyi divergence estimator
are used).
Examples
--------
>>> import ite
>>> co1 = ite.cost.MIRenyi_DR()
>>> co2 = ite.cost.MIRenyi_DR(renyi_co_name='BDRenyi_KnnK')
>>> co3 = ite.cost.MIRenyi_DR(renyi_co_name='BDRenyi_KnnK',\
alpha=0.4)
>>> dict_ch = {'knn_method': 'cKDTree', 'k': 2, 'eps': 0.1}
>>> co4 = ite.cost.MIRenyi_DR(mult=True,alpha=0.9,\
renyi_co_name='BDRenyi_KnnK',\
renyi_co_pars=dict_ch)
"""
# initialize with 'InitAlpha':
super().__init__(mult=mult, alpha=alpha)
# initialize the Renyi divergence estimator:
renyi_co_pars = renyi_co_pars or {}
renyi_co_pars['mult'] = mult # guarantee this property
renyi_co_pars['alpha'] = alpha # -||-
self.renyi_co = co_factory(renyi_co_name, **renyi_co_pars)
def estimation(self, y, ds):
""" Estimate Renyi mutual information.
Parameters
----------
y : (number of samples, dimension)-ndarray
One row of y corresponds to one sample.
ds : int vector
Dimensions of the individual subspaces in y; ds[i] = i^th
subspace dimension.
Returns
-------
i : float
Estimated Renyi mutual information.
References
----------
Barnabas Poczos, Zoltan Szabo, Jeff Schneider. Nonparametric
divergence estimators for Independent Subspace Analysis. European
Signal Processing Conference (EUSIPCO), pages 1849-1853, 2011.
Barnabas Poczos, Jeff Schneider. On the Estimation of
alpha-Divergences. International Conference on Artificial
Intelligence and Statistics (AISTATS), pages 609-617, 2011.
Examples
--------
i = co.estimation(y,ds)
"""
# verification:
self.verification_compatible_subspace_dimensions(y, ds)
y1, y2 = joint_and_product_of_the_marginals_split(y, ds)
i = self.renyi_co.estimation(y1, y2)
return i
class MITsallis_DT(InitAlpha, VerCompSubspaceDims):
""" Tsallis mutual information estimator based on Tsallis divergence.
The estimation is based on the relation I(y^1,...,y^M) =
D(f_y,\prod_{m=1}^M f_{y^m}), where I is the Tsallis mutual
information, D is the Tsallis divergence.
Partial initialization comes from 'InitAlpha', verification is from
'VerCompSubspaceDims' (see 'ite.cost.x_initialization.py',
'ite.cost.x_verification.py').
"""
def __init__(self, mult=True, alpha=0.99,
tsallis_co_name='BDTsallis_KnnK', tsallis_co_pars=None):
""" Initialize the estimator.
Parameters
----------
mult : bool, optional
'True': multiplicative constant relevant (needed) in the
estimation. 'False': estimation up to 'proportionality'.
(default is True)
alpha : float, optional
Parameter of the Renyi mutual information (default is
0.99).
tsallis_co_name : str, optional
You can change it to any Tsallis divergence
estimator (default is 'BDTsallis_KnnK').
tsallis_co_pars : dictionary, optional
Parameters for the Tsallis divergence estimator
(default is None (=> {}); in this case the
default parameter values of the Tsallis
divergence estimator are used).
Examples
--------
>>> import ite
>>> co1 = ite.cost.MITsallis_DT()
>>> co2 = ite.cost.MITsallis_DT(tsallis_co_name='BDTsallis_KnnK')
>>> co3 = ite.cost.MITsallis_DT(tsallis_co_name='BDTsallis_KnnK',\
alpha=0.4)
>>> dict_ch = {'knn_method': 'cKDTree', 'k': 2, 'eps': 0.1}
>>> co4 = ite.cost.MITsallis_DT(mult=True,alpha=0.9,\
tsallis_co_name='BDTsallis_KnnK',\
tsallis_co_pars=dict_ch)
"""
# initialize with 'InitAlpha':
super().__init__(mult=mult, alpha=alpha)
# initialize the Tsallis divergence estimator:
tsallis_co_pars = tsallis_co_pars or {}
tsallis_co_pars['mult'] = mult # guarantee this property
tsallis_co_pars['alpha'] = alpha # -||-
self.tsallis_co = co_factory(tsallis_co_name, **tsallis_co_pars)
def estimation(self, y, ds):
""" Estimate Tsallis mutual information.
Parameters
----------
y : (number of samples, dimension)-ndarray
One row of y corresponds to one sample.
ds : int vector
Dimensions of the individual subspaces in y; ds[i] = i^th
subspace dimension.
Returns
-------
i : float
Estimated Tsallis mutual information.
References
----------
Barnabas Poczos, Zoltan Szabo, Jeff Schneider. Nonparametric
divergence estimators for Independent Subspace Analysis. European
Signal Processing Conference (EUSIPCO), pages 1849-1853, 2011.
Barnabas Poczos, Jeff Schneider. On the Estimation of
alpha-Divergences. International Conference on Artificial
Intelligence and Statistics (AISTATS), pages 609-617, 2011.
Examples
--------
i = co.estimation(y,ds)
"""
# verification:
self.verification_compatible_subspace_dimensions(y, ds)
y1, y2 = joint_and_product_of_the_marginals_split(y, ds)
i = self.tsallis_co.estimation(y1, y2)
return i
class MIMMD_CopulaDMMD(InitX, VerCompSubspaceDims, VerOneDSubspaces):
""" Copula and MMD based kernel dependency estimator.
MMD stands for maximum mean discrepancy.
The estimation is based on the relation I(Y_1,...,Y_d) = MMD(P_Z,P_U),
where (i) Z =[F_1(Y_1);...;F_d(Y_d)] is the copula transformation of
Y; F_i is the cdf of Y_i, (ii) P_U is the uniform distribution on
[0,1]^d, (iii) dim(Y_1) = ... = dim(Y_d) = 1.
Partial initialization comes from 'InitX', verification is from
'VerCompSubspaceDims' and 'VerOneDSubspaces' (see
'ite.cost.x_initialization.py', 'ite.cost.x_verification.py').
"""
def __init__(self, mult=True, mmd_co_name='BDMMD_UStat',
mmd_co_pars=None):
""" Initialize the estimator.
Parameters
----------
mult : bool, optional
'True': multiplicative constant relevant (needed) in the
estimation. 'False': estimation up to 'proportionality'.
(default is True)
mmd_co_name : str, optional
You can change it to any MMD estimator (default is
'BDMMD_UStat').
mmd_co_pars : dictionary, optional
Parameters for the MMD estimator (default is None
(=> {}); in this case the default parameter values
of the MMD estimator are used).
Examples
--------
>>> import ite
>>> from ite.cost.x_kernel import Kernel
>>> co1 = ite.cost.MIMMD_CopulaDMMD()
>>> co2 = ite.cost.MIMMD_CopulaDMMD(mmd_co_name='BDMMD_UStat')
>>> dict_ch = {'kernel': Kernel({'name': 'RBF','sigma': 0.1})}
>>> co3 = ite.cost.MIMMD_CopulaDMMD(mmd_co_name='BDMMD_UStat',\
mmd_co_pars=dict_ch)
"""
# initialize with 'InitX':
super().__init__(mult=mult)
# initialize the MMD estimator:
mmd_co_pars = mmd_co_pars or {}
mmd_co_pars['mult'] = mult # guarantee this property
self.mmd_co = co_factory(mmd_co_name, **mmd_co_pars)
def estimation(self, y, ds=None):
""" Estimate copula and MMD based kernel dependency.
Parameters
----------
y : (number of samples, dimension)-ndarray
One row of y corresponds to one sample.
ds : int vector, vector of ones
If ds is not given (ds=None), the vector of ones [ds =
ones(y.shape[1],dtype='int')] is emulated inside the function.
Returns
-------
i : float
Estimated copula and MMD based kernel dependency.
References
----------
Barnabas Poczos, Zoubin Ghahramani, Jeff Schneider. Copula-based
Kernel Dependency Measures. International Conference on Machine
Learning (ICML), 2012.
Examples
--------
i = co.estimation(y,ds)
"""
if ds is None: # emulate 'ds = vector of ones'
ds = ones(y.shape[1], dtype='int')
# verification:
self.verification_compatible_subspace_dimensions(y, ds)
self.verification_one_dimensional_subspaces(ds)
z = copula_transformation(y)
u = rand(z.shape[0], z.shape[1])
i = self.mmd_co.estimation(z, u)
return i
class MIRenyi_HR(InitAlpha, VerCompSubspaceDims, VerOneDSubspaces):
""" Renyi mutual information estimator based on Renyi entropy.
The estimation is based on the relation I_{alpha}(X) = -H_{alpha}(Z),
where Z =[F_1(X_1);...;F_d(X_d)] is the copula transformation of X,
F_i is the cdf of X_i; I_{alpha} is the Renyi mutual information,
H_{alpha} is the Renyi entropy.
Partial initialization comes from 'InitAlpha', verification is from
'VerCompSubspaceDims' and 'VerOneDSubspaces' (see
'ite.cost.x_initialization.py', 'ite.cost.x_verification.py').
"""
def __init__(self, mult=True, alpha=0.99, renyi_co_name='BHRenyi_KnnK',
renyi_co_pars=None):
""" Initialize the estimator.
Parameters
----------
mult : bool, optional
'True': multiplicative constant relevant (needed) in the
estimation. 'False': estimation up to 'proportionality'.
(default is True)
alpha : float, \ne 1
Parameter of the Renyi mutual information.
renyi_co_name : str, optional
You can change it to any Renyi entropy estimator
(default is 'BHRenyi_KnnK').
renyi_co_pars : dictionary, optional
Parameters for the Renyi entropy estimator
(default is None (=> {}); in this case the default
parameter values of the Renyi entropy estimator
are used).
Examples
--------
>>> import ite
>>> co1 = ite.cost.MIRenyi_HR()
>>> co2 = ite.cost.MIRenyi_HR(renyi_co_name='BHRenyi_KnnK')
>>> dict_ch = {'k': 2, 'eps': 0.4}
>>> co3 = ite.cost.MIRenyi_HR(renyi_co_name='BHRenyi_KnnK',\
renyi_co_pars=dict_ch)
"""
# initialize with 'InitAlpha':
super().__init__(mult=mult, alpha=alpha)
# initialize the Renyi entropy estimator:
renyi_co_pars = renyi_co_pars or {}
renyi_co_pars['mult'] = mult # guarantee this property
renyi_co_pars['alpha'] = alpha # -||-
self.renyi_co = co_factory(renyi_co_name, **renyi_co_pars)
def estimation(self, y, ds=None):
""" Estimate Renyi mutual information.
Parameters
----------
y : (number of samples, dimension)-ndarray
One row of y corresponds to one sample.
ds : int vector, vector of ones
If ds is not given (ds=None), the vector of ones [ds =
ones(y.shape[1],dtype='int')] is emulated inside the function.
Returns
-------
i : float
Estimated Renyi mutual information.
References
----------
David Pal, Barnabas Poczos, Csaba Szepesvari. Estimation of Renyi
Entropy and Mutual Information Based on Generalized
Nearest-Neighbor Graphs. Advances in Neural Information Processing
Systems (NIPS), pages 1849-1857, 2010.
Barnabas Poczos, Sergey Krishner, Csaba Szepesvari. REGO:
Rank-based Estimation of Renyi Information using Euclidean Graph
Optimization. International Conference on Artificial Intelligence
and Statistics (AISTATS), pages 605-612, 2010.
Examples
--------
i = co.estimation(y,ds)
"""
if ds is None: # emulate 'ds = vector of ones'
ds = ones(y.shape[1], dtype='int')
# verification:
self.verification_compatible_subspace_dimensions(y, ds)
self.verification_one_dimensional_subspaces(ds)
z = copula_transformation(y)
i = -self.renyi_co.estimation(z)
return i
class MIShannon_HS(InitX, VerCompSubspaceDims):
""" Shannon mutual information estimator based on Shannon entropy.
The estimation is based on the relation I(y^1,...,y^M) = \sum_{m=1}^M
H(y^m) - H([y^1,...,y^M]), where I is the Shannon mutual information,
H is the Shannon entropy.
Partial initialization comes from 'InitX', verification is from
'VerCompSubspaceDims' (see 'ite.cost.x_initialization.py',
'ite.cost.x_verification.py').
"""
def __init__(self, mult=True, shannon_co_name='BHShannon_KnnK',
shannon_co_pars=None):
""" Initialize the estimator.
Parameters
----------
mult : bool, optional
'True': multiplicative constant relevant (needed) in the
estimation. 'False': estimation up to 'proportionality'.
(default is True)
shannon_co_name : str, optional
You can change it to any Shannon differential
entropy estimator (default is 'BHShannon_KnnK').
shannon_co_pars : dictionary, optional
Parameters for the Shannon differential entropy
estimator (default is None (=> {}); in this case
the default parameter values of the Shannon
differential entropy estimator are used).
Examples
--------
>>> import ite
>>> co1 = ite.cost.MIShannon_HS()
>>> co2 = ite.cost.MIShannon_HS(shannon_co_name='BHShannon_KnnK')
>>> dict_ch = {'knn_method': 'cKDTree', 'k': 4, 'eps': 0.1}
>>> co3 = ite.cost.MIShannon_HS(shannon_co_name='BHShannon_KnnK',\
shannon_co_pars=dict_ch)
"""
# initialize with 'InitX':
super().__init__(mult=mult)
# initialize the Shannon differential entropy estimator:
shannon_co_pars = shannon_co_pars or {}
shannon_co_pars['mult'] = True # guarantee this property
self.shannon_co = co_factory(shannon_co_name, **shannon_co_pars)
def estimation(self, y, ds):
""" Estimate Shannon mutual information.
Parameters
----------
y : (number of samples, dimension)-ndarray
One row of y corresponds to one sample.
ds : int vector
Dimensions of the individual subspaces in y; ds[i] = i^th
subspace dimension.
Returns
-------
i : float
Estimated Shannon mutual information.
References
----------
Thomas M. Cover, Joy A. Thomas. Elements of Information Theory,
John Wiley and Sons, New York, USA (1991).
Examples
--------
i = co.estimation(y,ds)
"""
# verification:
self.verification_compatible_subspace_dimensions(y, ds)
# I = - H([y^1,...,y^M]):
i = -self.shannon_co.estimation(y)
# I = I + \sum_{m=1}^M H(y^m):
idx_start = 0
for k in range(len(ds)):
dim_k = ds[k]
idx_stop = idx_start + dim_k
# print("{0}:{1}".format(idx_start,idx_stop))
i += self.shannon_co.estimation(y[:, idx_start:idx_stop])
idx_start = idx_stop
return i
class MIDistCov_HSIC(InitX, VerCompSubspaceDims, VerSubspaceNumberIsK):
""" Estimate distance covariance from HSIC.
The estimation is based on the relation I(y^1,y^2;rho_1,rho_2) =
2 HSIC(y^1,y^2;k), where HSIC stands for the Hilbert-Schmidt
independence criterion, y = [y^1; y^2] and k = k_1 x k_2, where k_i-s
generates rho_i-s, semimetrics of negative type used in distance
covariance.
Partial initialization comes from 'InitX', verification is from
'VerCompSubspaceDims' and 'VerSubspaceNumberIsK' (see
'ite.cost.x_initialization.py', 'ite.cost.x_verification.py').
"""
def __init__(self, mult=True, hsic_co_name='BIHSIC_IChol',
hsic_co_pars=None):
""" Initialize the estimator.
Parameters
----------
mult : bool, optional
'True': multiplicative constant relevant (needed) in the
estimation. 'False': estimation up to 'proportionality'.
(default is True)
hsic_co_name : str, optional
You can change it to any HSIC estimator
(default is 'BIHSIC_IChol').
hsic_co_pars : dictionary, optional
Parameters for the HSIC estimator (default is
None (=> {}); in this case the default parameter
values of the HSIC estimator are used.
Examples
--------
>>> import ite
>>> from ite.cost.x_kernel import Kernel
>>> co1 = ite.cost.MIDistCov_HSIC()
>>> co2 = ite.cost.MIDistCov_HSIC(hsic_co_name='BIHSIC_IChol')
>>> k = Kernel({'name': 'RBF','sigma': 0.3})
>>> dict_ch = {'kernel': k, 'eta': 1e-3}
>>> co3 = ite.cost.MIDistCov_HSIC(hsic_co_name='BIHSIC_IChol',\
hsic_co_pars=dict_ch)
"""
# initialize with 'InitX':
super().__init__(mult=mult)
# initialize the HSIC estimator:
hsic_co_pars = hsic_co_pars or {}
hsic_co_pars['mult'] = mult # guarantee this property
self.hsic_co = co_factory(hsic_co_name, **hsic_co_pars)
def estimation(self, y, ds):
""" Estimate distance covariance.
Parameters
----------
y : (number of samples, dimension)-ndarray
One row of y corresponds to one sample.
ds : int vector
Dimensions of the individual subspaces in y; ds[i] = i^th
subspace dimension. Length(ds) = 2.
Returns
-------
i : float
Estimated distance covariance.
References
----------
Examples
--------
i = co.estimation(y,ds)
"""
# verification:
self.verification_compatible_subspace_dimensions(y, ds)
self.verification_subspace_number_is_k(ds, 2)
i = 2 * self.hsic_co.estimation(y, ds)
return i
| 36.391459 | 79 | 0.5531 | 3,394 | 30,678 | 4.827637 | 0.088686 | 0.024168 | 0.01123 | 0.013427 | 0.822826 | 0.781691 | 0.760513 | 0.720659 | 0.674519 | 0.619774 | 0 | 0.014837 | 0.347513 | 30,678 | 842 | 80 | 36.434679 | 0.803717 | 0.642513 | 0 | 0.457364 | 0 | 0 | 0.023056 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.139535 | false | 0 | 0.046512 | 0 | 0.325581 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
08c0025272522ce8511d53d2d74d00f212b3ac07 | 85 | py | Python | cd_core/runners/lr_schedulers/__init__.py | shinianzhihou/change_detection.pytorch | e365eb1d97ebbce400ffc4230ac0fa063638fe05 | [
"Apache-2.0"
] | 1 | 2021-02-12T16:29:08.000Z | 2021-02-12T16:29:08.000Z | cd_core/runners/lr_schedulers/__init__.py | shinianzhihou/change_detection.pytorch | e365eb1d97ebbce400ffc4230ac0fa063638fe05 | [
"Apache-2.0"
] | null | null | null | cd_core/runners/lr_schedulers/__init__.py | shinianzhihou/change_detection.pytorch | e365eb1d97ebbce400ffc4230ac0fa063638fe05 | [
"Apache-2.0"
] | null | null | null | from .param_schedulers import *
from .multiplier_scheduler import MultiplierScheduler | 42.5 | 53 | 0.882353 | 9 | 85 | 8.111111 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.082353 | 85 | 2 | 53 | 42.5 | 0.935897 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
3ea136c23ab22ef008df00e7eba7305d7c3de54b | 137 | py | Python | oscina/__init__.py | gbrookshire/oscina | 30d4059ce320d42240bb076d70a86d663c5f6972 | [
"MIT"
] | null | null | null | oscina/__init__.py | gbrookshire/oscina | 30d4059ce320d42240bb076d70a86d663c5f6972 | [
"MIT"
] | null | null | null | oscina/__init__.py | gbrookshire/oscina | 30d4059ce320d42240bb076d70a86d663c5f6972 | [
"MIT"
] | null | null | null | from .version import __version__
from .ar_surr import ar_surr
from .robust_est import robust_est
from .shuff_time import lf2012, fsk2013
| 27.4 | 39 | 0.839416 | 22 | 137 | 4.818182 | 0.5 | 0.113208 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066667 | 0.124088 | 137 | 4 | 40 | 34.25 | 0.816667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
3eae8806b6242615421e62a732b806f620fb94cd | 131 | py | Python | iservice/admin.py | gzy403999903/itam | 9ced83fecf10a70686d0a2a5159effdea03eca6c | [
"Artistic-1.0-cl8"
] | 79 | 2018-05-28T09:13:31.000Z | 2022-03-22T08:55:21.000Z | iservice/admin.py | tracyzk/itam | 9ced83fecf10a70686d0a2a5159effdea03eca6c | [
"Artistic-1.0-cl8"
] | 1 | 2018-11-16T07:40:12.000Z | 2018-11-16T08:40:11.000Z | iservice/admin.py | tracyzk/itam | 9ced83fecf10a70686d0a2a5159effdea03eca6c | [
"Artistic-1.0-cl8"
] | 34 | 2018-05-28T09:13:34.000Z | 2021-10-18T06:52:55.000Z | from django.contrib import admin
# Register your models here.
from iservice import models
admin.site.register(models.ServiceInfo) | 21.833333 | 39 | 0.824427 | 18 | 131 | 6 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114504 | 131 | 6 | 39 | 21.833333 | 0.931034 | 0.198473 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
3edb221160c15dc110f83f2781330b45301cff99 | 767 | py | Python | tests/kyu_6_tests/test_pingpong_service_problem.py | the-zebulan/CodeWars | 1eafd1247d60955a5dfb63e4882e8ce86019f43a | [
"MIT"
] | 40 | 2016-03-09T12:26:20.000Z | 2022-03-23T08:44:51.000Z | tests/kyu_6_tests/test_pingpong_service_problem.py | akalynych/CodeWars | 1eafd1247d60955a5dfb63e4882e8ce86019f43a | [
"MIT"
] | null | null | null | tests/kyu_6_tests/test_pingpong_service_problem.py | akalynych/CodeWars | 1eafd1247d60955a5dfb63e4882e8ce86019f43a | [
"MIT"
] | 36 | 2016-11-07T19:59:58.000Z | 2022-03-31T11:18:27.000Z | import unittest
from katas.kyu_6.pingpong_service_problem import service
class ServiceTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(service('0:0'), 'first')
def test_equals_2(self):
self.assertEqual(service('0:5'), 'second')
def test_equals_3(self):
self.assertEqual(service('3:2'), 'second')
def test_equals_4(self):
self.assertEqual(service('5:5'), 'first')
def test_equals_5(self):
self.assertEqual(service('11:11'), 'first')
def test_equals_6(self):
self.assertEqual(service('14:15'), 'second')
def test_equals_7(self):
self.assertEqual(service('21:20'), 'first')
def test_equals_8(self):
self.assertEqual(service('21:22'), 'second')
| 25.566667 | 56 | 0.655802 | 102 | 767 | 4.754902 | 0.313725 | 0.115464 | 0.214433 | 0.428866 | 0.226804 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05153 | 0.190352 | 767 | 29 | 57 | 26.448276 | 0.729469 | 0 | 0 | 0 | 0 | 0 | 0.099087 | 0 | 0 | 0 | 0 | 0 | 0.421053 | 1 | 0.421053 | false | 0 | 0.105263 | 0 | 0.578947 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 5 |
3efcebf0a22a9b76458c27170088d336b766d466 | 193 | py | Python | src/main/resources/xlrconfig/__init__.py | xebialabs-community/xlr-config-propagation-plugin | 9a97deb753729b02d80c6086b3f2206ceb9a9cea | [
"MIT"
] | 1 | 2018-07-09T12:15:31.000Z | 2018-07-09T12:15:31.000Z | src/main/resources/xlrconfig/__init__.py | xebialabs-community/xlr-config-propagation-plugin | 9a97deb753729b02d80c6086b3f2206ceb9a9cea | [
"MIT"
] | null | null | null | src/main/resources/xlrconfig/__init__.py | xebialabs-community/xlr-config-propagation-plugin | 9a97deb753729b02d80c6086b3f2206ceb9a9cea | [
"MIT"
] | null | null | null |
def get_parent(path):
if '/' in path:
return path.rsplit('/', 1)[0]
return None
def get_name(path):
if '/' in path:
return path.rsplit('/', 1)[1]
return path
| 16.083333 | 37 | 0.53886 | 28 | 193 | 3.642857 | 0.428571 | 0.294118 | 0.156863 | 0.235294 | 0.568627 | 0.568627 | 0.568627 | 0.568627 | 0 | 0 | 0 | 0.029412 | 0.295337 | 193 | 11 | 38 | 17.545455 | 0.720588 | 0 | 0 | 0.25 | 0 | 0 | 0.020833 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.75 | 0 | 1 | 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 | 5 |
f5e78b157a5d4146722ed759afb6de394c2c2657 | 95 | py | Python | sysroot/usr/lib/llvm-11/build/utils/lit/tests/Inputs/shtest-shell/write-to-stderr.py | 219-design/sysroot_qt5.15.0_binaries_armv6zk_rpizero_bullseye_gcc10.3 | 60545a4471090a4c9ffcf207fb5a71831bfc3bb2 | [
"MIT"
] | null | null | null | sysroot/usr/lib/llvm-11/build/utils/lit/tests/Inputs/shtest-shell/write-to-stderr.py | 219-design/sysroot_qt5.15.0_binaries_armv6zk_rpizero_bullseye_gcc10.3 | 60545a4471090a4c9ffcf207fb5a71831bfc3bb2 | [
"MIT"
] | null | null | null | sysroot/usr/lib/llvm-11/build/utils/lit/tests/Inputs/shtest-shell/write-to-stderr.py | 219-design/sysroot_qt5.15.0_binaries_armv6zk_rpizero_bullseye_gcc10.3 | 60545a4471090a4c9ffcf207fb5a71831bfc3bb2 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import sys
sys.stderr.write("a line on stderr\n")
sys.stderr.flush()
| 11.875 | 38 | 0.705263 | 17 | 95 | 3.941176 | 0.764706 | 0.268657 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012048 | 0.126316 | 95 | 7 | 39 | 13.571429 | 0.795181 | 0.221053 | 0 | 0 | 0 | 0 | 0.246575 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
eb253a28c686690754ca5785a38204ba448185a8 | 72 | py | Python | backend/refill/formatters/__init__.py | bd808/refill | 950f3720d9cfa56a73d3f761d484951daa1c83bd | [
"BSD-2-Clause"
] | 36 | 2015-03-13T16:17:19.000Z | 2021-10-19T17:58:49.000Z | backend/refill/formatters/__init__.py | bd808/refill | 950f3720d9cfa56a73d3f761d484951daa1c83bd | [
"BSD-2-Clause"
] | 59 | 2015-02-26T13:28:05.000Z | 2021-08-31T16:37:02.000Z | backend/refill/formatters/__init__.py | bd808/refill | 950f3720d9cfa56a73d3f761d484951daa1c83bd | [
"BSD-2-Clause"
] | 32 | 2015-02-26T10:02:08.000Z | 2021-09-05T16:10:24.000Z | from .citetemplate import CiteTemplate
from .plainlink import Plainlink
| 24 | 38 | 0.861111 | 8 | 72 | 7.75 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 72 | 2 | 39 | 36 | 0.96875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
eb35ed35f123d61a760a3ddb5340026b05203884 | 229 | py | Python | utils/Inception.py | MrRiahi/Convolutional-Neural-Networks | e15b93376da83af89df672982f81475bf541c8cf | [
"MIT"
] | 5 | 2021-11-21T17:24:50.000Z | 2022-03-13T13:07:02.000Z | utils/Inception.py | MrRiahi/Convolutional-Neural-Networks | e15b93376da83af89df672982f81475bf541c8cf | [
"MIT"
] | null | null | null | utils/Inception.py | MrRiahi/Convolutional-Neural-Networks | e15b93376da83af89df672982f81475bf541c8cf | [
"MIT"
] | null | null | null |
class GoogLeNet:
def __init__(self, input_shape, classes):
self.input_shape = input_shape
self.classes = classes
@staticmethod
def _inception_block(filters, filter_size, pooling_size):
pass | 20.818182 | 61 | 0.681223 | 26 | 229 | 5.576923 | 0.615385 | 0.206897 | 0.193103 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.248908 | 229 | 11 | 62 | 20.818182 | 0.843023 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.142857 | 0 | 0 | 0.428571 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
eb434795d787aee6bc2d237e8ceeceee46444175 | 43 | py | Python | tests/pages/__init__.py | priformaggio/poc_calculator_python | 7b78465de685a6f427a0bcbdd4f867c21097d0c7 | [
"Apache-2.0"
] | 2 | 2018-01-23T09:00:47.000Z | 2021-02-24T22:36:26.000Z | tests/pages/__init__.py | priformaggio/poc_calculator_python | 7b78465de685a6f427a0bcbdd4f867c21097d0c7 | [
"Apache-2.0"
] | null | null | null | tests/pages/__init__.py | priformaggio/poc_calculator_python | 7b78465de685a6f427a0bcbdd4f867c21097d0c7 | [
"Apache-2.0"
] | 1 | 2018-01-23T09:01:11.000Z | 2018-01-23T09:01:11.000Z | from calculator_page import CalculatorPage
| 21.5 | 42 | 0.906977 | 5 | 43 | 7.6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.093023 | 43 | 1 | 43 | 43 | 0.974359 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
de2da9e0df3f0e237127d71c400f518f772195f1 | 60 | py | Python | c0banAPI/__init__.py | dc-aichara/c0banAPI | 8a0f52be6d4b54416d6327ee81ad7ab8d3d0532d | [
"MIT"
] | null | null | null | c0banAPI/__init__.py | dc-aichara/c0banAPI | 8a0f52be6d4b54416d6327ee81ad7ab8d3d0532d | [
"MIT"
] | null | null | null | c0banAPI/__init__.py | dc-aichara/c0banAPI | 8a0f52be6d4b54416d6327ee81ad7ab8d3d0532d | [
"MIT"
] | null | null | null | from .api import c0banAPI
from .tradingapi import c0banTrade | 30 | 34 | 0.85 | 8 | 60 | 6.375 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037736 | 0.116667 | 60 | 2 | 34 | 30 | 0.924528 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
deb3fe1e28ef0c568d810767a0f4ddc0b2990fc2 | 73 | py | Python | ewre.py | mykhailo-leontiev/for-python | 5452f19c9f3151e6d467e6f2412180697e2e3ecd | [
"MIT"
] | null | null | null | ewre.py | mykhailo-leontiev/for-python | 5452f19c9f3151e6d467e6f2412180697e2e3ecd | [
"MIT"
] | null | null | null | ewre.py | mykhailo-leontiev/for-python | 5452f19c9f3151e6d467e6f2412180697e2e3ecd | [
"MIT"
] | null | null | null | def lol ():
while True:
print ("Учитель лох")
print (lol ())
| 14.6 | 29 | 0.520548 | 9 | 73 | 4.222222 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.315068 | 73 | 4 | 30 | 18.25 | 0.76 | 0 | 0 | 0 | 0 | 0 | 0.150685 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | true | 0 | 0 | 0 | 0.25 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
dee67c1b154429aea30975ed97ec7e0a4878d016 | 153 | py | Python | app/auth/__init__.py | elmaghallawy/ManAudio-API | 4945530081f12a90e4e431f0a60bafaa33430f5d | [
"MIT"
] | null | null | null | app/auth/__init__.py | elmaghallawy/ManAudio-API | 4945530081f12a90e4e431f0a60bafaa33430f5d | [
"MIT"
] | null | null | null | app/auth/__init__.py | elmaghallawy/ManAudio-API | 4945530081f12a90e4e431f0a60bafaa33430f5d | [
"MIT"
] | null | null | null | from flask import Blueprint
auth = Blueprint('auth', __name__)
# we import auth views here to avoid circular dependancy issues
from . import views
| 15.3 | 63 | 0.75817 | 21 | 153 | 5.333333 | 0.666667 | 0.232143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.189542 | 153 | 9 | 64 | 17 | 0.903226 | 0.398693 | 0 | 0 | 0 | 0 | 0.045455 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0.666667 | 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 | 1 | 0 | 5 |
defa2467fe779b0b29f5bc2d45f8c5d745705f3e | 232 | py | Python | GUI/QThread_PyQT/gui/render_engine.py | mariusvrstr/PythonExamples | 14db4886ac2602fb93db09cc39b69449a0cde672 | [
"MIT"
] | null | null | null | GUI/QThread_PyQT/gui/render_engine.py | mariusvrstr/PythonExamples | 14db4886ac2602fb93db09cc39b69449a0cde672 | [
"MIT"
] | null | null | null | GUI/QThread_PyQT/gui/render_engine.py | mariusvrstr/PythonExamples | 14db4886ac2602fb93db09cc39b69449a0cde672 | [
"MIT"
] | null | null | null |
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (QLabel, QPushButton, QVBoxLayout, QWidget)
class RenderEngine():
def setup_gui(self):
## Too many logical relationships / need to seperate to work.
pass | 25.777778 | 71 | 0.715517 | 29 | 232 | 5.689655 | 0.862069 | 0.109091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010929 | 0.211207 | 232 | 9 | 72 | 25.777778 | 0.89071 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.2 | 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 | 1 | 1 | 0 | 1 | 0 | 0 | 5 |
72018e1d58ede7aef74b3c8b40b8ac027442ffcd | 4,929 | py | Python | RL_monitor.py | apeduto32/RL-SimpleProject | 956ed0dcd4e9de17632db4facb16c7d605f628da | [
"MIT"
] | null | null | null | RL_monitor.py | apeduto32/RL-SimpleProject | 956ed0dcd4e9de17632db4facb16c7d605f628da | [
"MIT"
] | 5 | 2021-05-24T19:44:14.000Z | 2021-07-17T15:59:28.000Z | RL_monitor.py | apeduto32/github-upload | 956ed0dcd4e9de17632db4facb16c7d605f628da | [
"MIT"
] | null | null | null | from collections import deque
import sys
import math
import numpy as np
def interact(env, agent, num_episodes=20000):
""" Monitor agent's performance.
Params
======
- env (obj): instance of the class MazeEnvironment
- agent (obj): instance of class MazeAgent
- num_episodes (int): number of episodes of agent-environment interaction
Returns
=======
- returns: deque containing return of each episode
"""
# Initialize a deque to save the average of rewards for each episode required
returns = deque(maxlen=num_episodes)
# for each episode
for i_episode in range(1, num_episodes+1):
# start it, getting the initial state of agent
state = env.reset()
# Update window of environment
env.render()
# get first action of agent
action = agent.start(state)
# initialize the sampled return
sample_return = 0.
while True:
# apply the actio choosen by agent
(reward, next_state, done) = env.step(action)
# update window
env.render()
# update the sampled return
sample_return += reward
# update the state (s <- s') to next time step
state = next_state
# Check if the signal of termination is True
if done:
# Execute the last update of q-values and policy inside of agent
agent.end(reward)
# save sample_return in returns
returns.append(sample_return)
break
# otherwise
else:
# get the next action and update the q-values and policy inside of agent
action = agent.step(reward, next_state)
# monitor progress
print("\rEpisode {}/{} || return: {}".format(i_episode, num_episodes, sample_return), end="")
sys.stdout.flush()
if i_episode == num_episodes: print('\n')
# close window
env.close_window()
return returns
def interact_without_showing(env, agent, num_episodes=20000, window_episodes=100):
""" Monitor agent's performance.
Params
======
- env (obj): instance of the class MazeEnvironment
- agent (obj): instance of class MazeAgent
- num_episodes (int): number of episodes of agent-environment interaction
Returns
=======
- returns: deque containing return of each episode
"""
# Initialize a deque to save the average of rewards for each episode required
returns = deque(maxlen=num_episodes)
# for each episode
for i_episode in range(1, num_episodes+1):
# start it, getting the initial state of agent
state = env.reset()
# get first action of agent
action = agent.start(state)
# initialize the sampled return
sample_return = 0.
while True:
# apply the actio choosen by agent
(reward, next_state, done) = env.step(action)
# update the sampled return
sample_return += reward
# update the state (s <- s') to next time step
state = next_state
# Check if the signal of termination is True
if done:
# Execute the last update of q-values and policy inside of agent
agent.end(reward)
# save sample_return in returns
returns.append(sample_return)
break
# otherwise
else:
# get the next action and update the q-values and policy inside of agent
action = agent.step(reward, next_state)
# monitor progress
print("\rEpisode {}/{} || return: {}".format(i_episode, num_episodes, sample_return), end="")
sys.stdout.flush()
if i_episode == num_episodes: print('\n')
# close window
env.close_window()
return returns
# Test function
def main():
# import MazeEnvironment and MazeAgent
from MazeEnvironment import MazeEnvironment
from MazeAgents import MazeQAgent
import matplotlib.pyplot as plt
# Define maze environment
height = 6
width = 6
env_info = {'height':height, 'width':width, 'start_loc':(0,0),'goal_loc':(5,5), 'obstacles':[(2,2),(3,3)]}
mazeEnv = MazeEnvironment(env_info)
# define maze agent
num_states = height*width
num_actions = 9
agent_info = {'num_states':num_states, 'num_actions':num_actions}
qAgent = MazeQAgent(agent_info)
# Execute episodes of interactions agent-environment
num_episodes = 3000
returns = interact(mazeEnv, qAgent, num_episodes)
# plot result
x = np.arange(1, num_episodes+1) # item number of episodes
y = returns # average of returns from the window_episodes-th episode
plt.plot(x,y)
plt.xlabel('Number of Episodes')
plt.ylabel('Avg Returns')
plt.show()
if __name__ == '__main__':
main() | 36.242647 | 110 | 0.614932 | 602 | 4,929 | 4.930233 | 0.23588 | 0.055593 | 0.01752 | 0.024259 | 0.719677 | 0.703504 | 0.703504 | 0.703504 | 0.703504 | 0.703504 | 0 | 0.010447 | 0.300872 | 4,929 | 136 | 111 | 36.242647 | 0.850842 | 0.391154 | 0 | 0.6 | 0 | 0 | 0.054742 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.042857 | false | 0 | 0.1 | 0 | 0.171429 | 0.057143 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
9d048c362c50dd2f5c439615cbd03b4145a7d78c | 2,229 | py | Python | xinshuo_images/test/image_processing/test_image_concatenate.py | xinshuoweng/cv_ml_tool | 1918b9e37ec5fb8148b8a089f226a4864d67b153 | [
"MIT"
] | 31 | 2020-03-05T12:27:21.000Z | 2022-03-07T04:00:18.000Z | xinshuo_images/test/image_processing/test_image_concatenate.py | xinshuoweng/cv_ml_tool | 1918b9e37ec5fb8148b8a089f226a4864d67b153 | [
"MIT"
] | null | null | null | xinshuo_images/test/image_processing/test_image_concatenate.py | xinshuoweng/cv_ml_tool | 1918b9e37ec5fb8148b8a089f226a4864d67b153 | [
"MIT"
] | 12 | 2020-07-06T05:06:58.000Z | 2021-11-18T14:43:20.000Z | # Author: Xinshuo Weng
# email: xinshuo.weng@gmail.com
from PIL import Image
import numpy as np
import init_paths
from image_processing import image_concatenate
from xinshuo_visualization import visualize_image
def test_image_concatenate():
image_path = '../lena.png'
image = np.array(Image.open(image_path).convert('RGB'))
print('test a single image')
target_size = [600, 600]
image_concatenated = image_concatenate(image, target_size=target_size)
visualize_image(image_concatenated, vis=True)
print('test multiple images')
image_list = [image, image, image, image, image, image, image]
image_all = np.stack(image_list, axis=0)
target_size = [1200, 1800]
image_concatenated = image_concatenate(image_all, target_size=target_size)
visualize_image(image_concatenated, vis=True)
print('test multiple images with grid size')
image_list = [image, image, image, image, image, image, image]
image_all = np.stack(image_list, axis=0)
target_size = [600, 3600]
image_concatenated = image_concatenate(image_all, target_size=target_size, grid_size=[1, 7])
visualize_image(image_concatenated, vis=True)
print('test multiple images with grid size')
image_list = [image, image, image, image, image, image, image]
image_all = np.stack(image_list, axis=0)
target_size = [1800, 300]
image_concatenated = image_concatenate(image_all, target_size=target_size, grid_size=[7, 1])
visualize_image(image_concatenated, vis=True)
print('test multiple images with edge factor')
image_list = [image, image, image, image, image, image, image]
image_all = np.stack(image_list, axis=0)
target_size = [1200, 1800]
image_concatenated = image_concatenate(image_all, target_size=target_size, edge_factor=0.5)
visualize_image(image_concatenated, vis=True)
print('test multiple grayscale images')
image_grayscale = np.array(Image.open(image_path).convert('L'))
image_list = [image_grayscale, image_grayscale]
image_all = np.expand_dims(np.stack(image_list, axis=0), axis=3) # NHW1
target_size = [1200, 1800]
image_concatenated = image_concatenate(image_all, target_size=target_size)
visualize_image(image_concatenated, vis=True)
print('\n\nDONE! SUCCESSFUL!!\n')
if __name__ == '__main__':
test_image_concatenate() | 38.431034 | 93 | 0.776133 | 323 | 2,229 | 5.080495 | 0.20743 | 0.207191 | 0.219378 | 0.243754 | 0.731261 | 0.708105 | 0.695308 | 0.656307 | 0.656307 | 0.622791 | 0 | 0.028802 | 0.112158 | 2,229 | 58 | 94 | 38.431034 | 0.800404 | 0.024675 | 0 | 0.456522 | 0 | 0 | 0.102718 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.021739 | false | 0 | 0.108696 | 0 | 0.130435 | 0.152174 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
9d140cef42642371f3db85de3fe8a1ba763d6e04 | 22,608 | py | Python | main.py | Daggy1234/oldapi | 6f237a8ebd6a9ae4a4efc87cce0819210ff58e54 | [
"Apache-2.0"
] | 1 | 2020-06-13T10:26:37.000Z | 2020-06-13T10:26:37.000Z | main.py | Daggy1234/dagbotapi | 6f237a8ebd6a9ae4a4efc87cce0819210ff58e54 | [
"Apache-2.0"
] | 3 | 2021-06-08T21:45:20.000Z | 2022-01-13T02:51:05.000Z | main.py | Daggy1234/oldapi | 6f237a8ebd6a9ae4a4efc87cce0819210ff58e54 | [
"Apache-2.0"
] | null | null | null | from fastapi import FastAPI,Header
import aiohttp
from fastapi.responses import StreamingResponse,JSONResponse,RedirectResponse
from io import BytesIO
from PIL import Image,ImageDraw,ImageFont,ImageEnhance,ImageOps,ImageFilter,ImageSequence
import wand.image as wi
import praw
from functools import partial
import asyncio
app = FastAPI()
async def checktoken(tok):
if str(tok) == 'sexytoken123#':
return(True)
async def getimg(url):
async with aiohttp.ClientSession() as session:
async with session.get(url) as r:
print(r)
if r.status == 200:
# imgf = await aiofiles.open(f'avatar{name}.png', mode='wb')
byt = await r.read()
return(byt)
# await imgf.close()
else:
return False
del r
def getsepia(image: BytesIO):
io =BytesIO(image)
io.seek(0)
with wi.Image() as dst_image:
with wi.Image(blob=io) as src_image:
for frame in src_image.sequence:
frame.sepia_tone(threshold=0.8)
dst_image.sequence.append(frame)
bts = dst_image.make_blob()
i = BytesIO(bts)
i.seek(0)
return(i)
def getwasted(image: BytesIO):
io = BytesIO(image)
io.seek(0)
with wi.Image() as dst_image:
with wi.Image(blob=io) as src_image:
for frame in src_image.sequence:
frame.transform_colorspace('gray')
dst_image.sequence.append(frame)
bts = dst_image.make_blob()
i = BytesIO(bts)
i.seek(0)
im = Image.open(i)
fil = Image.open('wasted.png')
w, h = im.size
filr = fil.resize((w, h), 5)
flist = []
for frame in ImageSequence.Iterator(im):
ci = im.convert('RGBA')
ci.paste(filr, mask=filr)
flist.append(ci)
retimg = BytesIO()
flist[0].save(retimg,format='gif', save_all=True, append_images=flist)
retimg.seek(0)
return(retimg)
def getgay(image:BytesIO):
io = BytesIO(image)
io.seek(0)
with Image.open(io) as im:
flist = []
w, h = im.size
fil = Image.open('gayfilter.png')
filr = fil.resize((w, h), 5)
for frame in ImageSequence.Iterator(im):
ci = frame.convert('RGBA')
ci.paste(filr, mask=filr)
ci.show()
flist.append(ci)
retimg = BytesIO()
flist[0].save(retimg, format='gif', save_all=True, append_images=flist)
retimg.seek(0)
return (retimg)
def getcharc(image: BytesIO):
io =BytesIO(image)
io.seek(0)
with wi.Image() as dst_image:
with wi.Image(blob=io) as src_image:
for frame in src_image.sequence:
frame.transform_colorspace("gray")
frame.sketch(0.5, 0.0, 98.0)
dst_image.sequence.append(frame)
bts = dst_image.make_blob()
i = BytesIO(bts)
i.seek(0)
return(i)
def getpaint(image: BytesIO):
io =BytesIO(image)
io.seek(0)
with wi.Image() as dst_image:
with wi.Image(blob=io) as src_image:
for frame in src_image.sequence:
frame.oil_paint(sigma=3)
dst_image.sequence.append(frame)
bts = dst_image.make_blob()
i = BytesIO(bts)
i.seek(0)
return(i)
def getpixel(image: BytesIO):
io =BytesIO(image)
io.seek(0)
with Image.open(io) as t:
flist = []
for frame in ImageSequence.Iterator(t):
imgSmall = frame.resize((32, 32), resample=Image.BILINEAR)
fim = imgSmall.resize(frame.size, Image.NEAREST)
flist.append(fim)
retimg = BytesIO()
flist[0].save(retimg, format='gif', save_all=True, append_images=flist[1:])
retimg.seek(0)
return(retimg)
def getinvert(image: BytesIO):
io =BytesIO(image)
io.seek(0)
with Image.open(io) as t:
flist = []
for frame in ImageSequence.Iterator(t):
blurred_image = ImageOps.invert(frame)
flist.append(blurred_image)
retimg = BytesIO()
flist[0].save(retimg, format='gif', save_all=True, append_images=flist[1:])
retimg.seek(0)
return(retimg)
def getblur(image: BytesIO):
io =BytesIO(image)
io.seek(0)
with Image.open(io) as t:
flist = []
for frame in ImageSequence.Iterator(t):
blurred_image = t.filter(ImageFilter.BLUR)
flist.append(blurred_image)
retimg = BytesIO()
flist[0].save(retimg, format='gif', save_all=True, append_images=flist[1:])
retimg.seek(0)
return(retimg)
def gethitler(image: BytesIO):
with Image.open(BytesIO(image)) as t:
im = Image.open('hitler.jpg')
wthf = t.resize((260, 300), 5)
width = 800
height = 600
fim = im.resize((width, height), 4)
area = (65, 40)
fim.paste(wthf, area)
retimg = BytesIO()
fim.save(retimg, 'png')
retimg.seek(0)
return (retimg)
def getsatan(image: BytesIO):
with Image.open(BytesIO(image)) as t:
im = Image.open('satan.jpg')
wthf = t.resize((400, 225), 5)
width = 800
height = 600
fim = im.resize((width, height), 4)
area = (250, 100)
fim.paste(wthf, area)
retimg = BytesIO()
fim.save(retimg, 'png')
retimg.seek(0)
return (retimg)
def getwanted(image: BytesIO):
with Image.open(BytesIO(image)) as av:
im = Image.open('wanted.png')
tp = av.resize((800, 800), 0)
im.paste(tp, (200, 450))
retimg = BytesIO()
im.save(retimg, 'png')
retimg.seek(0)
return (retimg)
def getsithorld(image: BytesIO):
with Image.open(BytesIO(image)) as ft:
im = Image.open('sithlord.jpg')
topa = ft.resize((250, 275), 5)
size = (225, 225)
mask = Image.new('L', size, 0)
draw_mask = ImageDraw.Draw(mask)
draw_mask.ellipse((50, 10) + size, fill=255)
topt = ImageOps.fit(topa, mask.size, centering=(0.5, 0.5))
im.paste(topt, (225, 180), mask=mask)
retimg = BytesIO()
im.save(retimg, 'png')
retimg.seek(0)
return (retimg)
def gettrash(image: BytesIO):
with Image.open(BytesIO(image)) as t:
im = Image.open('trash.jpg')
wthf = t.resize((200, 150), 5)
width = 800
height = 600
fim = im.resize((width, height), 4)
area = (500, 250)
fim.paste(wthf, area)
retimg = BytesIO()
fim.save(retimg, 'png')
retimg.seek(0)
return (retimg)
def getthoughtimg(image: BytesIO, text):
with Image.open(BytesIO(image)) as ft:
im = Image.open('speech.jpg')
file = str(text)
if len(file) > 200:
return (f'Your text is too long {len(file)} is greater than 200')
else:
if len(file) > 151:
fo = file[:50] + '\n' + file[50:]
ft = fo[:100] + '\n' + fo[100:]
ff = ft[:150] + '\n' + ft[150:]
size = 10
elif len(file) > 101:
fo = file[:50] + '\n' + file[50:]
ff = fo[:100] + '\n' + fo[100:]
size = 12
elif len(file) > 51 and len(file) < 100:
ff = file[:50] + '\n' + file[50:]
size = 14
elif len(file) > 20 and len(file) <= 50:
ff = file
size = 18
else:
ff = file
size = 25
wthf = ft.resize((200, 225), 5)
width = 800
height = 600
fim = im.resize((width, height), 4)
area = (125, 50)
fim.paste(wthf, area)
base = fim.convert('RGBA')
txt = Image.new('RGBA', base.size, (255, 255, 255, 0))
fnt = ImageFont.truetype('Helvetica-Bold-Font.ttf', size)
d = ImageDraw.Draw(txt)
d.text((400, 150), f"{ff}", font=fnt, fill=(0, 0, 0, 255))
out = Image.alpha_composite(base, txt)
retimg = BytesIO()
out.save(retimg, 'png')
retimg.seek(0)
return (retimg)
def badimg(image : BytesIO):
io = BytesIO(image)
io.seek(0)
with Image.open(BytesIO(image)) as im:
back = Image.open('bad.png')
t = im.resize((200, 200), 5)
back.paste(t, (20, 150))
bufferedio = BytesIO()
back.save(bufferedio, format="PNG")
bufferedio.seek(0)
return (bufferedio)
def getangel(image: BytesIO):
with Image.open(BytesIO(image)) as t:
im = Image.open('angel.jpg')
wthf = t.resize((300, 175), 5)
width = 800
height = 600
fim = im.resize((width, height), 4)
area = (250, 130)
fim.paste(wthf, area)
bufferedio = BytesIO()
fim.save(bufferedio, format="PNG")
bufferedio.seek(0)
return (bufferedio)
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.post('/api/wanted')
async def wanted(token: str = Header(None),url:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
else:
fn = partial(getwanted,byt)
loop = asyncio.get_event_loop()
img = await loop.run_in_executor(None,fn)
if isinstance(img,BytesIO):
return StreamingResponse(img, status_code=200,media_type="image/png")
else:
return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
else:
return JSONResponse(status_code=401,content={'error':'Invalid token'})
@app.post('/api/bad')
async def bad(token: str = Header(None),url:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return ('Error')
else:
img = badimg(byt)
return StreamingResponse(img, media_type="image/png")
else:
return ('Invalid token')
# @app.post('/api/deepfry')
# async def deepfry(token: str = Header(None),url:str = Header(None)):
#
# r = await checktoken(token)
# if r:
# byt = await getimg(url)
# if byt == False:
# return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
# else:
# fn = partial(get,byt)
# loop = asyncio.get_event_loop()
# img = await loop.run_in_executor(None,fn)
# if isinstance(img,BytesIO):
# return StreamingResponse(img, status_code=200,media_type="image/png")
#
# else:
# return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
# else:
# return JSONResponse(status_code=401,content={'error':'Invalid token'})
@app.post('/api/hitler')
async def hitler(token: str = Header(None),url:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
else:
fn = partial(gethitler,byt)
loop = asyncio.get_event_loop()
img = await loop.run_in_executor(None,fn)
if isinstance(img,BytesIO):
return StreamingResponse(img, status_code=200,media_type="image/png")
else:
return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
else:
return JSONResponse(status_code=401,content={'error':'Invalid token'})
@app.post('/api/thoughtimage')
async def thoughtimage(token: str = Header(None),url:str = Header(None),text:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
else:
fn = partial(getthoughtimg,byt,text)
loop = asyncio.get_event_loop()
img = await loop.run_in_executor(None,fn)
if isinstance(img,BytesIO):
return StreamingResponse(img, status_code=200,media_type="image/png")
else:
return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
else:
return JSONResponse(status_code=401,content={'error':'Invalid token'})
@app.post('/api/angel')
async def angel(token: str = Header(None),url:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
else:
fn = partial(getangel,byt)
loop = asyncio.get_event_loop()
img = await loop.run_in_executor(None,fn)
if isinstance(img,BytesIO):
return StreamingResponse(img, status_code=200,media_type="image/png")
else:
return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
else:
return JSONResponse(status_code=401,content={'error':'Invalid token'})
@app.get('/api')
async def redirecttodocs():
return RedirectResponse(url='/redoc')
@app.get('/server')
async def serverredirect():
return RedirectResponse(url='https://discord.gg/4R72Pks')
@app.get('/wrappers')
async def comiongsoon():
return JSONResponse(status_code=404,content={"In the works":"Wrappers soon"})
@app.post('/api/trash')
async def trash(token: str = Header(None),url:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
else:
fn = partial(gettrash,byt)
loop = asyncio.get_event_loop()
img = await loop.run_in_executor(None,fn)
if isinstance(img,BytesIO):
return StreamingResponse(img, status_code=200,media_type="image/png")
else:
return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
else:
return JSONResponse(status_code=401,content={'error':'Invalid token'})
@app.post('/api/satan')
async def satan(token: str = Header(None),url:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
else:
fn = partial(getsatan,byt)
loop = asyncio.get_event_loop()
img = await loop.run_in_executor(None,fn)
if isinstance(img,BytesIO):
return StreamingResponse(img, status_code=200,media_type="image/png")
else:
return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
else:
return JSONResponse(status_code=401,content={'error':'Invalid token'})
@app.post('/api/paint')
async def paint(token: str = Header(None),url:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
else:
fn = partial(getpaint,byt)
loop = asyncio.get_event_loop()
img = await loop.run_in_executor(None,fn)
if isinstance(img,BytesIO):
return StreamingResponse(img, status_code=200,media_type="image/gif")
else:
return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
else:
return JSONResponse(status_code=401,content={'error':'Invalid token'})
@app.post('/api/evil')
async def evil(token: str = Header(None),url:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
else:
fn = partial(getsithorld,byt)
loop = asyncio.get_event_loop()
img = await loop.run_in_executor(None,fn)
if isinstance(img,BytesIO):
return StreamingResponse(img, status_code=200,media_type="image/png")
else:
return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
else:
return JSONResponse(status_code=401,content={'error':'Invalid token'})
@app.post('/api/blur')
async def blur(token: str = Header(None),url:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
else:
fn = partial(getblur,byt)
loop = asyncio.get_event_loop()
img = await loop.run_in_executor(None,fn)
if isinstance(img,BytesIO):
return StreamingResponse(img, status_code=200,media_type="image/gif")
else:
return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
else:
return JSONResponse(status_code=401,content={'error':'Invalid token'})
@app.post('/api/invert')
async def invert(token: str = Header(None),url:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
else:
fn = partial(getinvert,byt)
loop = asyncio.get_event_loop()
img = await loop.run_in_executor(None,fn)
if isinstance(img,BytesIO):
return StreamingResponse(img, status_code=200,media_type="image/gif")
else:
return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
else:
return JSONResponse(status_code=401,content={'error':'Invalid token'})
#uvicorn main:app --reload
@app.post('/api/pixel')
async def pixel(token: str = Header(None),url:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
else:
fn = partial(getpixel,byt)
loop = asyncio.get_event_loop()
img = await loop.run_in_executor(None,fn)
if isinstance(img,BytesIO):
return StreamingResponse(img, status_code=200,media_type="image/gif")
else:
return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
else:
return JSONResponse(status_code=401,content={'error':'Invalid token'})
@app.post('/api/sepia')
async def sepia(token: str = Header(None),url:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
else:
fn = partial(getsepia,byt)
loop = asyncio.get_event_loop()
img = await loop.run_in_executor(None,fn)
if isinstance(img,BytesIO):
return StreamingResponse(img, status_code=200,media_type="image/gif")
else:
return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
else:
return JSONResponse(status_code=401,content={'error':'Invalid token'})
@app.post('/api/wasted')
async def wasted(token: str = Header(None),url:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
else:
fn = partial(getwasted,byt)
loop = asyncio.get_event_loop()
img = await loop.run_in_executor(None,fn)
if isinstance(img,BytesIO):
return StreamingResponse(img, status_code=200,media_type="image/gif")
else:
return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
else:
return JSONResponse(status_code=401,content={'error':'Invalid token'})
@app.post('/api/gay')
async def gay(token: str = Header(None),url:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
else:
fn = partial(getgay,byt)
loop = asyncio.get_event_loop()
img = await loop.run_in_executor(None,fn)
if isinstance(img,BytesIO):
return StreamingResponse(img, status_code=200,media_type="image/gif")
else:
return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
else:
return JSONResponse(status_code=401,content={'error':'Invalid token'})
@app.post('/api/charcoal')
async def charcoal(token: str = Header(None),url:str = Header(None)):
r = await checktoken(token)
if r:
byt = await getimg(url)
if byt == False:
return JSONResponse(status_code=400,content={'error':"We were unable to use the link your provided"})
else:
fn = partial(getcharc,byt)
loop = asyncio.get_event_loop()
img = await loop.run_in_executor(None,fn)
if isinstance(img,BytesIO):
return StreamingResponse(img, status_code=200,media_type="image/gif")
else:
return JSONResponse(status_code=500,content={"error":"The Image manipulation had a small"})
else:
return JSONResponse(status_code=401,content={'error':'Invalid token'})
| 35.659306 | 115 | 0.589039 | 2,862 | 22,608 | 4.585954 | 0.097135 | 0.049524 | 0.0896 | 0.104533 | 0.7936 | 0.789257 | 0.781029 | 0.771124 | 0.764648 | 0.753448 | 0 | 0.030258 | 0.283705 | 22,608 | 633 | 116 | 35.71564 | 0.780227 | 0.039676 | 0 | 0.680147 | 0 | 0 | 0.104943 | 0.00106 | 0 | 0 | 0 | 0 | 0 | 1 | 0.03125 | false | 0 | 0.016544 | 0.001838 | 0.191176 | 0.001838 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
9d1da9467ff4221ee3c70c87b5f577968995accc | 75 | py | Python | app/core/console/__init__.py | cPoolChia/ChiaAutoplotter-Worker | 7368396bda018a5adedef74173aba7b6f8f0eccc | [
"MIT"
] | 2 | 2021-06-02T08:19:27.000Z | 2021-06-02T09:53:11.000Z | app/core/console/__init__.py | cPoolChia/ChiaAutoplotter-Worker | 7368396bda018a5adedef74173aba7b6f8f0eccc | [
"MIT"
] | null | null | null | app/core/console/__init__.py | cPoolChia/ChiaAutoplotter-Worker | 7368396bda018a5adedef74173aba7b6f8f0eccc | [
"MIT"
] | null | null | null | from .base import BaseCommandExecutor
from .executor import CommandExecutor | 37.5 | 37 | 0.88 | 8 | 75 | 8.25 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.093333 | 75 | 2 | 38 | 37.5 | 0.970588 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
9d274ba249c2789bd114a901fdec65ad8cefd677 | 200 | py | Python | lib/exception/exceptions.py | dev1x-org/python-example | ad6b100d87d1ba8d5b77f160854dd3c387ded222 | [
"MIT"
] | null | null | null | lib/exception/exceptions.py | dev1x-org/python-example | ad6b100d87d1ba8d5b77f160854dd3c387ded222 | [
"MIT"
] | null | null | null | lib/exception/exceptions.py | dev1x-org/python-example | ad6b100d87d1ba8d5b77f160854dd3c387ded222 | [
"MIT"
] | null | null | null | #coding:utf-8
class ProjectNotFoundError(Exception):
pass
class TaskNotFoundError(Exception):
pass
class UserNotFoundError(Exception):
pass
class ApplicationError(Exception):
pass
| 14.285714 | 38 | 0.76 | 19 | 200 | 8 | 0.526316 | 0.342105 | 0.355263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005988 | 0.165 | 200 | 13 | 39 | 15.384615 | 0.904192 | 0.06 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
9d3602e230f917fb14876069df4506b9f38229ce | 166 | py | Python | articles/admin.py | CASDON-MYSTERY/studentapp | 0fd942e963a10a02a6c9f358dd362cfd646eecc3 | [
"MIT"
] | null | null | null | articles/admin.py | CASDON-MYSTERY/studentapp | 0fd942e963a10a02a6c9f358dd362cfd646eecc3 | [
"MIT"
] | null | null | null | articles/admin.py | CASDON-MYSTERY/studentapp | 0fd942e963a10a02a6c9f358dd362cfd646eecc3 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import Article, Sub_Section
# Register your models here.
admin.site.register(Article)
admin.site.register(Sub_Section) | 27.666667 | 41 | 0.819277 | 24 | 166 | 5.583333 | 0.541667 | 0.149254 | 0.253731 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.10241 | 166 | 6 | 42 | 27.666667 | 0.899329 | 0.156627 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
c214e9bf4eda800be60cc81062bde7415a4ecff0 | 111 | py | Python | pokeapi/api/database/schemas/__init__.py | QU3B1M/Go-and-Python-MicroMonsters | 82343456a619893fe395ba46e8dd06f1ad13b7be | [
"MIT"
] | null | null | null | pokeapi/api/database/schemas/__init__.py | QU3B1M/Go-and-Python-MicroMonsters | 82343456a619893fe395ba46e8dd06f1ad13b7be | [
"MIT"
] | null | null | null | pokeapi/api/database/schemas/__init__.py | QU3B1M/Go-and-Python-MicroMonsters | 82343456a619893fe395ba46e8dd06f1ad13b7be | [
"MIT"
] | null | null | null | from .pokemon import Pokemon
from .poketype import PokeType
from .pokemove import PokeMove, PokeMoveCategories
| 27.75 | 50 | 0.846847 | 13 | 111 | 7.230769 | 0.461538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117117 | 111 | 3 | 51 | 37 | 0.959184 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
dfbec9387ce176b23bdf8875bbc84b50f633d7f2 | 1,145 | py | Python | app/viewsets.py | Rainlv/next-server | 59e97ae2bc42d6da08b9e17d75810541f8caa3d9 | [
"MIT"
] | null | null | null | app/viewsets.py | Rainlv/next-server | 59e97ae2bc42d6da08b9e17d75810541f8caa3d9 | [
"MIT"
] | null | null | null | app/viewsets.py | Rainlv/next-server | 59e97ae2bc42d6da08b9e17d75810541f8caa3d9 | [
"MIT"
] | null | null | null | from rest_framework.viewsets import ModelViewSet
from app.response import SuccessResponse
class ModelViewSetWithCustomResponse(ModelViewSet):
def create(self, request, *args, **kwargs):
response = super(ModelViewSetWithCustomResponse, self).create(request, *args, **kwargs)
return SuccessResponse.wrap_response(response)
def retrieve(self, request, *args, **kwargs):
response = super(ModelViewSetWithCustomResponse, self).retrieve(request, *args, **kwargs)
return SuccessResponse.wrap_response(response)
def update(self, request, *args, **kwargs):
response = super(ModelViewSetWithCustomResponse, self).update(request, *args, **kwargs)
return SuccessResponse.wrap_response(response)
def destroy(self, request, *args, **kwargs):
response = super(ModelViewSetWithCustomResponse, self).destroy(request, *args, **kwargs)
return SuccessResponse.wrap_response(response)
def list(self, request, *args, **kwargs):
response = super(ModelViewSetWithCustomResponse, self).list(request, *args, **kwargs)
return SuccessResponse.wrap_response(response) | 45.8 | 97 | 0.732751 | 109 | 1,145 | 7.642202 | 0.220183 | 0.132053 | 0.204082 | 0.12605 | 0.770708 | 0.770708 | 0.770708 | 0.770708 | 0.292917 | 0 | 0 | 0 | 0.158079 | 1,145 | 25 | 98 | 45.8 | 0.864108 | 0 | 0 | 0.277778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.277778 | false | 0 | 0.111111 | 0 | 0.722222 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 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 | 5 |
dfca49bf33349ea6f966a549e7abc1a4d145a572 | 115 | py | Python | cookbook/deployment/cluster/productionize_cluster.py | mayitbeegh/flytesnacks | 35fe9db45f08fce3d94923b4245b1a9980a915ef | [
"Apache-2.0"
] | null | null | null | cookbook/deployment/cluster/productionize_cluster.py | mayitbeegh/flytesnacks | 35fe9db45f08fce3d94923b4245b1a9980a915ef | [
"Apache-2.0"
] | null | null | null | cookbook/deployment/cluster/productionize_cluster.py | mayitbeegh/flytesnacks | 35fe9db45f08fce3d94923b4245b1a9980a915ef | [
"Apache-2.0"
] | null | null | null | """
Productionize Your Flyte Cluster
--------------------------------------------
.. NOTE::
Coming soon 🛠
""" | 14.375 | 44 | 0.373913 | 8 | 115 | 5.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147826 | 115 | 8 | 45 | 14.375 | 0.438776 | 0.930435 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
dfdff9cf18b81b2f728008d17d2c465ec4c769de | 6,448 | py | Python | pywca/competition.py | MysteryBlokHed/PyWCA | 457afffe3355d84a26fc1090f035def843b532a8 | [
"MIT"
] | null | null | null | pywca/competition.py | MysteryBlokHed/PyWCA | 457afffe3355d84a26fc1090f035def843b532a8 | [
"MIT"
] | null | null | null | pywca/competition.py | MysteryBlokHed/PyWCA | 457afffe3355d84a26fc1090f035def843b532a8 | [
"MIT"
] | null | null | null | # Created by Adam Thompson-Sharpe on 12/03/2020.
class CompetitionMin(object):
"""
A minimal Competition object.
`name: str` - The name of the competition.
`url: str` - The url of the competition on the WCA website.
`geo_location: str` - The city/country of the competition (eg. Columbus, Ohio, United States)
`venue: str` - The venue the competition is/was at.
`date: str` - The date of the competition, formatted as Month Day, Year, or Month Day - Day, Year (eg. Mar 14, 2020, Mar 13 - 15, 2020)
`venue_site: str` - The website of the competition venue (NOT the address map link)
"""
def __init__(self, name: str, url: str, geo_location: str, venue: str, date: str, venue_site: str=None):
# Check types
if type(name) is not str:
raise TypeError(f"Expected str for name, got {type(name).__name__}.")
if type(url) is not str:
raise TypeError(f"Expected str for url, got {type(name).__name__}.")
if type(geo_location) is not str:
raise TypeError(f"Expected str for geo_location, got {type(geo_location).__name__}.")
if type(venue) is not str:
raise TypeError(f"Expected str for venue, got {type(venue).__name__}.")
if type(date) is not str:
raise TypeError(f"Expected str for date, got {type(date).__name__}.")
if type(venue_site) not in (str, type(None)):
raise TypeError(f"Expected str for venue_site, got {type(venue_site).__name__}.")
# Set variables
self._name = name
self._url = url
self._geo_location = geo_location
self._venue = venue
self._date = date
self._venue_site = venue_site
def __getitem__(self, key: str):
if key == "name":
return self._name
elif key == "url":
return self._url
elif key == "geo_location":
return self._geo_location
elif key == "venue":
return self._venue
elif key == "date":
return self._date
elif key == "venue_site":
return self._venue_site
else:
raise KeyError(key)
class Competition(object):
"""
A detailed Competition object.
`name: str` - The name of the competition.
`url: str` - The url of the competition on the WCA website.
`geo_location: str` - The city/country of the competition (eg. Columbus, Ohio, United States)
`venue: str` - The venue the competition is/was at.
`date: str` - The date of the competition, formatted as Month Day, Year, or Month Day - Day, Year (eg. Mar 14, 2020, Mar 13 - 15, 2020)
`address: str` - The address of the venue for the competition.
`address_map_link: str` - The Google Maps link to the address.
`organizers: str` - The organizers of the competition (eg. `"John Doe, Jack Doe and Jack"`, `"Lorem Ipsum"`)
`delegates: str` - The WCA delegates at the competition (eg. `"John Doe, Jack Doe and Jack"`, `"Lorem Ipsum"`)
`events: list` - The events at the competition (eg. `["3x3x3 Cube", "3x3x3 Blindfolded"]`)
`main_event: str` - The main event at the competition (if one is listed) (eg. `"3x3x3 Cube"`)
`venue_site: str` - The website of the competition venue (NOT the address map link)
"""
def __init__(self, name: str, url: str, geo_location: str, venue: str, date: str, address: str, address_map_link: str, organizers: str, delegates: str, events: list, main_event: str=None, venue_site: str=None):
# Check types
if type(name) is not str:
raise TypeError(f"Expected str for name, got {type(name).__name__}.")
if type(url) is not str:
raise TypeError(f"Expected str for url, got {type(url).__name__}.")
if type(geo_location) is not str:
raise TypeError(f"Expected str for geo_location, got {type(geo_location).__name__}.")
if type(venue) is not str:
raise TypeError(f"Expected str for venue, got {type(venue).__name__}.")
if type(date) is not str:
raise TypeError(f"Expected str for date, got {type(date).__name__}.")
if type(address) is not str:
raise TypeError(f"Expected str for address, got {type(address).__name__}.")
if type(address_map_link) is not str:
raise TypeError(f"Expected str for address_map_link, got {type(address_map_link).__name__}.")
if type(organizers) is not str:
raise TypeError(f"Expected str for organizers, got {type(organizers).__name__}.")
if type(delegates) is not str:
raise TypeError(f"Expected str for delegates, got {type(delegates).__name__}.")
if type(events) is not list:
raise TypeError(f"Expected list for events, got {type(events).__name__}.")
if type(main_event) not in (str, type(None)):
raise TypeError(f"Expected str for main_event, got {type(main_event).__name__}.")
if type(venue_site) not in (str, type(None)):
raise TypeError(f"Expected str for venue_site, got {type(venue_site).__name__}.")
# Set variables
self._name = name
self._url = url
self._geo_location = geo_location
self._venue = venue
self._date = date
self._address = address
self._address_map_link = address_map_link
self._organizers = organizers
self._delegates = delegates
self._events = events
self._main_event = main_event
self._venue_site = venue_site
def __getitem__(self, key: str):
if key == "name":
return self._name
elif key == "url":
return self._url
elif key == "geo_location":
return self._geo_location
elif key == "venue":
return self._venue
elif key == "date":
return self._date
elif key == "address":
return self._address
elif key == "address_map_link":
return self._address_map_link
elif key == "organizers":
return self._organizers
elif key == "delegates":
return self._delegates
elif key == "events":
return self._events
elif key == "main_event":
return self._main_event
elif key == "venue_site":
return self._venue_site
else:
raise KeyError(key)
| 42.143791 | 214 | 0.614764 | 866 | 6,448 | 4.361432 | 0.1097 | 0.052423 | 0.071485 | 0.109611 | 0.715383 | 0.715383 | 0.714324 | 0.714324 | 0.714324 | 0.694731 | 0 | 0.009711 | 0.281328 | 6,448 | 152 | 215 | 42.421053 | 0.805352 | 0.255428 | 0 | 0.64 | 0 | 0 | 0.243289 | 0.097784 | 0 | 0 | 0 | 0 | 0 | 1 | 0.04 | false | 0 | 0 | 0 | 0.24 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
5f076e07351d50294ca24c919b5e118977ec5a04 | 329 | py | Python | tests/test_A000121.py | TimothyDJones/oeis | d9d608bc32ee31c73c139e1b68e4eb6315205e8d | [
"MIT"
] | 21 | 2020-03-21T17:50:13.000Z | 2022-01-18T01:52:47.000Z | tests/test_A000121.py | TimothyDJones/oeis | d9d608bc32ee31c73c139e1b68e4eb6315205e8d | [
"MIT"
] | 296 | 2019-11-18T14:04:36.000Z | 2022-03-27T21:59:24.000Z | tests/test_A000121.py | TimothyDJones/oeis | d9d608bc32ee31c73c139e1b68e4eb6315205e8d | [
"MIT"
] | 29 | 2019-11-18T11:56:22.000Z | 2022-03-26T22:31:57.000Z | from oeis import A000121
def test_A000121():
assert A000121[0:20] == [
1,
2,
2,
3,
3,
3,
4,
3,
4,
5,
4,
5,
4,
4,
6,
5,
6,
6,
5,
6,
]
| 12.185185 | 30 | 0.218845 | 31 | 329 | 2.290323 | 0.483871 | 0.056338 | 0.084507 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.401961 | 0.68997 | 329 | 26 | 31 | 12.653846 | 0.294118 | 0 | 0 | 0.791667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041667 | 1 | 0.041667 | true | 0 | 0.041667 | 0 | 0.083333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
5f31b12bd0a16df0ed26e698fa0d50188bdab54e | 560 | py | Python | ai_transformersx/data/dataprocessor.py | aicanhelp/ai-transformers | fa30031fa7360ee6d4fd3d016a3c81a23cfe8af1 | [
"MIT"
] | 1 | 2020-08-03T12:59:20.000Z | 2020-08-03T12:59:20.000Z | ai_transformersx/data/dataprocessor.py | aicanhelp/ai-transformers | fa30031fa7360ee6d4fd3d016a3c81a23cfe8af1 | [
"MIT"
] | null | null | null | ai_transformersx/data/dataprocessor.py | aicanhelp/ai-transformers | fa30031fa7360ee6d4fd3d016a3c81a23cfe8af1 | [
"MIT"
] | null | null | null | class DataProcessor:
"""Base class for data converters for sequence classification data sets."""
def get_train_examples(self):
"""Gets a collection of `InputExample`s for the train set."""
raise NotImplementedError()
def get_dev_examples(self):
"""Gets a collection of `InputExample`s for the dev set."""
raise NotImplementedError()
def get_labels(self):
"""Gets the list of labels for this data set."""
raise NotImplementedError()
def data_dir(self):
raise NotImplementedError()
| 31.111111 | 79 | 0.664286 | 67 | 560 | 5.462687 | 0.432836 | 0.262295 | 0.221311 | 0.245902 | 0.442623 | 0.262295 | 0.262295 | 0.262295 | 0.262295 | 0.262295 | 0 | 0 | 0.241071 | 560 | 17 | 80 | 32.941176 | 0.861176 | 0.396429 | 0 | 0.444444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.444444 | false | 0 | 0 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 5 |
a05a327da68b7c377f50dd77a5ad794aafd98fca | 129 | py | Python | src/abaqus/Material/TestData/PlanarTestDataArray.py | Haiiliin/PyAbaqus | f20db6ebea19b73059fe875a53be370253381078 | [
"MIT"
] | 7 | 2022-01-21T09:15:45.000Z | 2022-02-15T09:31:58.000Z | src/abaqus/Material/TestData/PlanarTestDataArray.py | Haiiliin/PyAbaqus | f20db6ebea19b73059fe875a53be370253381078 | [
"MIT"
] | null | null | null | src/abaqus/Material/TestData/PlanarTestDataArray.py | Haiiliin/PyAbaqus | f20db6ebea19b73059fe875a53be370253381078 | [
"MIT"
] | null | null | null | from .PlanarTestData import PlanarTestData
class PlanarTestDataArray(list[PlanarTestData]):
def findAt(self):
pass
| 18.428571 | 48 | 0.751938 | 12 | 129 | 8.083333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178295 | 129 | 6 | 49 | 21.5 | 0.915094 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.25 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 5 |
a07130c3994f8827e0a1eb5cc952a9584790591e | 313 | py | Python | rtamt/exception/stl/exception.py | xiaoyaooo/rtamt | edb7bf664720c52e9d70920102c450b1f593af95 | [
"BSD-3-Clause"
] | 24 | 2019-12-04T00:20:16.000Z | 2022-03-24T17:48:14.000Z | rtamt/exception/stl/exception.py | xiaoyaooo/rtamt | edb7bf664720c52e9d70920102c450b1f593af95 | [
"BSD-3-Clause"
] | 142 | 2020-01-16T15:36:21.000Z | 2022-03-28T20:40:45.000Z | rtamt/exception/stl/exception.py | xiaoyaooo/rtamt | edb7bf664720c52e9d70920102c450b1f593af95 | [
"BSD-3-Clause"
] | 17 | 2020-07-07T20:32:08.000Z | 2022-03-07T07:20:22.000Z | from rtamt.exception.exception import RTAMTException
class STLException(RTAMTException):
pass
class STLParseException(STLException):
pass
class STLOfflineException(STLException):
pass
class STLSpecificationException(STLException):
pass
class STLNotImplementedException(STLException):
pass | 19.5625 | 52 | 0.808307 | 26 | 313 | 9.730769 | 0.461538 | 0.142292 | 0.249012 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.13738 | 313 | 16 | 53 | 19.5625 | 0.937037 | 0 | 0 | 0.454545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.454545 | 0.090909 | 0 | 0.545455 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 5 |
a0a89049db539d9150142036542188b6389b4e8d | 245 | py | Python | data/typing/pandas.tests.extension.json.array.py | vfdev-5/python-record-api | 006faf0bba9cd4cb55fbacc13d2bbda365f5bf0b | [
"MIT"
] | 67 | 2020-08-17T11:53:26.000Z | 2021-11-08T20:16:06.000Z | data/typing/pandas.tests.extension.json.array.py | vfdev-5/python-record-api | 006faf0bba9cd4cb55fbacc13d2bbda365f5bf0b | [
"MIT"
] | 36 | 2020-08-17T11:09:51.000Z | 2021-12-15T18:09:47.000Z | data/typing/pandas.tests.extension.json.array.py | pydata-apis/python-api-record | 684cffbbb6dc6e81f9de4e02619c8b0ebc557b2b | [
"MIT"
] | 7 | 2020-08-19T05:06:47.000Z | 2020-11-04T05:10:38.000Z | from typing import *
class JSONDtype:
def __eq__(self, _0: numpy.dtype, /):
"""
usage.pandas: 1
"""
...
def __ne__(self, _0: numpy.dtype, /):
"""
usage.pandas: 1
"""
...
| 15.3125 | 41 | 0.42449 | 23 | 245 | 4.086957 | 0.652174 | 0.106383 | 0.212766 | 0.319149 | 0.574468 | 0.574468 | 0.574468 | 0 | 0 | 0 | 0 | 0.027778 | 0.412245 | 245 | 15 | 42 | 16.333333 | 0.625 | 0.126531 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | true | 0 | 0.166667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
a0b5b3a7f21fdcd90b01a9d58f720ce9ac619e08 | 126 | py | Python | web/sso/admin.py | mhamzaerol/kisaweb | 6852bbfb018f14df6caeaf75c4087553df6a1357 | [
"MIT"
] | null | null | null | web/sso/admin.py | mhamzaerol/kisaweb | 6852bbfb018f14df6caeaf75c4087553df6a1357 | [
"MIT"
] | null | null | null | web/sso/admin.py | mhamzaerol/kisaweb | 6852bbfb018f14df6caeaf75c4087553df6a1357 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import Agreement
# Register your models here.
admin.site.register(Agreement)
| 15.75 | 32 | 0.801587 | 17 | 126 | 5.941176 | 0.647059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134921 | 126 | 7 | 33 | 18 | 0.926606 | 0.206349 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
262baaa265a7bf6cbc394dbc060aa2e1caa9aac4 | 220 | py | Python | publib/tools/__init__.py | erwanp/publib | 84a4d8f51c4380410788678879d779f17614a6d9 | [
"MIT"
] | 29 | 2016-02-17T04:05:45.000Z | 2022-03-09T10:25:39.000Z | publib/tools/__init__.py | rainwear/publib | 84a4d8f51c4380410788678879d779f17614a6d9 | [
"MIT"
] | 7 | 2018-07-07T12:01:31.000Z | 2021-01-10T17:23:25.000Z | publib/tools/__init__.py | rainwear/publib | 84a4d8f51c4380410788678879d779f17614a6d9 | [
"MIT"
] | 1 | 2020-06-29T02:30:34.000Z | 2020-06-29T02:30:34.000Z | # -*- coding: utf-8 -*-
"""
publib
"""
from .tools import reset_defaults, regenerate_fonts, list_font_names, list_font_files
from .fix import fix_bold_TimesNewRoman
from .colors import colors, keep_color, get_next_color | 27.5 | 85 | 0.781818 | 32 | 220 | 5.03125 | 0.71875 | 0.099379 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005128 | 0.113636 | 220 | 8 | 86 | 27.5 | 0.820513 | 0.131818 | 0 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
2632f0d101d3304fc9be531fcc9fb9b236e12f16 | 262 | py | Python | Chapter03/arithmetic.py | add54/ADMIN_SYS_PYTHON | 5a6d9705537c8663c8f7b0f45d29ccc87b6096e7 | [
"MIT"
] | 116 | 2018-12-21T01:05:47.000Z | 2022-03-23T21:41:41.000Z | Chapter03/arithmetic.py | add54/ADMIN_SYS_PYTHON | 5a6d9705537c8663c8f7b0f45d29ccc87b6096e7 | [
"MIT"
] | 2 | 2021-03-31T19:36:19.000Z | 2021-06-10T22:29:26.000Z | Chapter03/arithmetic.py | add54/ADMIN_SYS_PYTHON | 5a6d9705537c8663c8f7b0f45d29ccc87b6096e7 | [
"MIT"
] | 147 | 2018-12-19T14:10:32.000Z | 2022-03-20T11:03:20.000Z | # In this script, we are going to create a 4 functions: add_numbers, sub_numbers, mul_numbers, div_numbers.
def add_numbers(x, y):
return x + y
def sub_numbers(x, y):
return x - y
def mul_numbers(x, y):
return x * y
def div_numbers(x, y):
return (x / y)
| 18.714286 | 107 | 0.69084 | 51 | 262 | 3.392157 | 0.392157 | 0.092486 | 0.208092 | 0.346821 | 0.445087 | 0.445087 | 0.346821 | 0 | 0 | 0 | 0 | 0.004762 | 0.198473 | 262 | 13 | 108 | 20.153846 | 0.819048 | 0.400763 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 5 |
26354c9892a4f3a925ab8d78e606d309dbf51956 | 378 | py | Python | __init__.py | DDMAL/Calvo-classifier | 06e9a74b2221e130ec7eae1dfe462f9de1a5ffa3 | [
"MIT"
] | null | null | null | __init__.py | DDMAL/Calvo-classifier | 06e9a74b2221e130ec7eae1dfe462f9de1a5ffa3 | [
"MIT"
] | 25 | 2017-07-17T19:49:57.000Z | 2021-05-21T14:29:34.000Z | __init__.py | DDMAL/Calvo-classifier | 06e9a74b2221e130ec7eae1dfe462f9de1a5ffa3 | [
"MIT"
] | null | null | null | import rodan
__version__ = "1.2.3"
import logging
logger = logging.getLogger('rodan')
from rodan.jobs import module_loader
module_loader('rodan.jobs.Calvo_classifier.calvo_classifier')
module_loader('rodan.jobs.Calvo_classifier.calvo_trainer')
module_loader('rodan.jobs.Calvo_classifier.fast_calvo_classifier')
module_loader('rodan.jobs.Calvo_classifier.fast_calvo_trainer')
| 29.076923 | 66 | 0.838624 | 52 | 378 | 5.730769 | 0.326923 | 0.302013 | 0.228188 | 0.281879 | 0.644295 | 0.644295 | 0.644295 | 0.506711 | 0 | 0 | 0 | 0.008403 | 0.055556 | 378 | 12 | 67 | 31.5 | 0.826331 | 0 | 0 | 0 | 0 | 0 | 0.502646 | 0.47619 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
2635db32a0747cad0cb2d49e6657c70c6855b32d | 119 | py | Python | 0401-0500/0441-Arranging Coins/0441-Arranging Coins.py | jiadaizhao/LeetCode | 4ddea0a532fe7c5d053ffbd6870174ec99fc2d60 | [
"MIT"
] | 49 | 2018-05-05T02:53:10.000Z | 2022-03-30T12:08:09.000Z | 0401-0500/0441-Arranging Coins/0441-Arranging Coins.py | jolly-fellow/LeetCode | ab20b3ec137ed05fad1edda1c30db04ab355486f | [
"MIT"
] | 11 | 2017-12-15T22:31:44.000Z | 2020-10-02T12:42:49.000Z | 0401-0500/0441-Arranging Coins/0441-Arranging Coins.py | jolly-fellow/LeetCode | ab20b3ec137ed05fad1edda1c30db04ab355486f | [
"MIT"
] | 28 | 2017-12-05T10:56:51.000Z | 2022-01-26T18:18:27.000Z | import math
class Solution:
def arrangeCoins(self, n: int) -> int:
return int(math.sqrt(1 + 8*n) - 1) // 2
| 23.8 | 47 | 0.596639 | 19 | 119 | 3.736842 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044944 | 0.252101 | 119 | 4 | 48 | 29.75 | 0.752809 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.25 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 5 |
265a73af2a5d49340b90c891f1a715aa2ca5fbd3 | 496 | py | Python | djsci/fields.py | claydodo/django-scientific | d48db1fb606ca3b24a219054dc01bdcdbea9ad9d | [
"Unlicense"
] | null | null | null | djsci/fields.py | claydodo/django-scientific | d48db1fb606ca3b24a219054dc01bdcdbea9ad9d | [
"Unlicense"
] | null | null | null | djsci/fields.py | claydodo/django-scientific | d48db1fb606ca3b24a219054dc01bdcdbea9ad9d | [
"Unlicense"
] | null | null | null | # -*- coding:utf-8 -*-
from picklefield.fields import PickledObjectField
class DataField(PickledObjectField):
"""A Generic Data Field"""
# TODO: add type attr to this field
pass
class NumpyArrayField(PickledObjectField):
# TODO: customize value_to_string(), etc
pass
class PandasSeriesField(PickledObjectField):
# TODO: customize value_to_string(), etc
pass
class PandasDataFrameField(PickledObjectField):
# TODO: customize value_to_string(), etc
pass | 20.666667 | 49 | 0.725806 | 53 | 496 | 6.679245 | 0.528302 | 0.076271 | 0.262712 | 0.305085 | 0.460452 | 0.460452 | 0.460452 | 0.460452 | 0.316384 | 0 | 0 | 0.002469 | 0.183468 | 496 | 24 | 50 | 20.666667 | 0.871605 | 0.389113 | 0 | 0.444444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041667 | 0 | 1 | 0 | true | 0.444444 | 0.111111 | 0 | 0.555556 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
2669d55e3cfa5718ee15094ea7a62bbbe3063b4e | 331 | py | Python | ikfast_pybind/__init__.py | wenbowen123/catgrasp | 4b2f4016fc40e8aad1f157267c460ce333dec7ad | [
"Apache-2.0",
"MIT"
] | 44 | 2022-03-05T00:47:18.000Z | 2022-03-31T11:12:02.000Z | ikfast_pybind/__init__.py | wenbowen123/catgrasp | 4b2f4016fc40e8aad1f157267c460ce333dec7ad | [
"Apache-2.0",
"MIT"
] | null | null | null | ikfast_pybind/__init__.py | wenbowen123/catgrasp | 4b2f4016fc40e8aad1f157267c460ce333dec7ad | [
"Apache-2.0",
"MIT"
] | 9 | 2022-03-22T08:02:10.000Z | 2022-03-28T10:49:06.000Z | import os,sys
code_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(code_dir)
from ikfast_kuka_iiwa14 import get_fk as get_fk_iiwa14
from ikfast_kuka_iiwa14 import get_ik as get_ik_iiwa14
from ikfast_kuka_iiwa14 import get_dof as get_dof_iiwa14
from ikfast_kuka_iiwa14 import get_free_dof as get_free_dof_iiwa14
| 33.1 | 66 | 0.861027 | 63 | 331 | 4.079365 | 0.31746 | 0.155642 | 0.217899 | 0.311284 | 0.521401 | 0.521401 | 0.40856 | 0 | 0 | 0 | 0 | 0.053512 | 0.096677 | 331 | 9 | 67 | 36.777778 | 0.80602 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.714286 | 0 | 0.714286 | 0 | 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 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
266a18d0d3b98d67cfaa2584560c3b4e0d35f5b9 | 51 | py | Python | src/phony/bluetooth/profiles/handsfree/__init__.py | QuentinosR/phony | 11f0e8abb8a5d67eaf23cd600768d4f6e0add6fd | [
"MIT"
] | 71 | 2016-05-08T00:52:47.000Z | 2022-03-28T16:33:22.000Z | src/phony/bluetooth/profiles/handsfree/__init__.py | QuentinosR/phony | 11f0e8abb8a5d67eaf23cd600768d4f6e0add6fd | [
"MIT"
] | 13 | 2017-04-17T01:04:27.000Z | 2021-08-30T01:41:02.000Z | src/phony/bluetooth/profiles/handsfree/__init__.py | QuentinosR/phony | 11f0e8abb8a5d67eaf23cd600768d4f6e0add6fd | [
"MIT"
] | 18 | 2017-05-26T21:26:34.000Z | 2022-03-26T15:39:19.000Z | from nohands import NoHands
from ofono import Ofono | 25.5 | 27 | 0.862745 | 8 | 51 | 5.5 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137255 | 51 | 2 | 28 | 25.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
13fe543634f027ce69f3a7d6a43e971b764dde7b | 420 | py | Python | _backup/stage03_quantification_models_execute.py | dmccloskey/SBaaS_thermodynamics | 0eeed0191f952ea0226ab8bbc234a30638fb2f9f | [
"MIT"
] | null | null | null | _backup/stage03_quantification_models_execute.py | dmccloskey/SBaaS_thermodynamics | 0eeed0191f952ea0226ab8bbc234a30638fb2f9f | [
"MIT"
] | null | null | null | _backup/stage03_quantification_models_execute.py | dmccloskey/SBaaS_thermodynamics | 0eeed0191f952ea0226ab8bbc234a30638fb2f9f | [
"MIT"
] | null | null | null | #SBaaS
from .stage03_quantification_models_io import stage03_quantification_models_io
#SBaaS models (delete if not needed)
from .stage03_quantification_models_postgresql_models import *
# Resources (delete if not needed)
from io_utilities.base_importData import base_importData
from io_utilities.base_exportData import base_exportData
class stage03_quantification_models_execute(stage03_quantification_models_io):
| 38.181818 | 78 | 0.87619 | 54 | 420 | 6.407407 | 0.351852 | 0.303468 | 0.390173 | 0.251445 | 0.121387 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02611 | 0.088095 | 420 | 11 | 79 | 38.181818 | 0.877285 | 0.17381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.8 | null | null | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
cd298160a71d1cdbfaa600654811c55a7e6508b8 | 66 | py | Python | ndstructs/datasink/__init__.py | k-dominik/ndstructs | 53dd6fd389832804d5f28eb4f9f34e2a62e30afe | [
"MIT"
] | null | null | null | ndstructs/datasink/__init__.py | k-dominik/ndstructs | 53dd6fd389832804d5f28eb4f9f34e2a62e30afe | [
"MIT"
] | 7 | 2019-07-05T08:01:19.000Z | 2020-12-08T09:46:44.000Z | ndstructs/datasink/__init__.py | k-dominik/ndstructs | 53dd6fd389832804d5f28eb4f9f34e2a62e30afe | [
"MIT"
] | 2 | 2019-07-24T08:10:31.000Z | 2019-12-12T09:25:31.000Z | from .DataSink import DataSink
from .N5DataSink import N5DataSink
| 22 | 34 | 0.848485 | 8 | 66 | 7 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034483 | 0.121212 | 66 | 2 | 35 | 33 | 0.931034 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
cd5143788454464ccfd1e7b002326815a6636e44 | 102 | py | Python | kubi_ecs_logger/models/__init__.py | kumina/kubi_ecs_logger | 64d9519e0759a24253a4edc53e0c024675033d1c | [
"BSD-3-Clause"
] | 6 | 2019-12-15T12:47:06.000Z | 2022-01-11T08:54:58.000Z | kubi_ecs_logger/models/__init__.py | kumina/kubi_ecs_logger | 64d9519e0759a24253a4edc53e0c024675033d1c | [
"BSD-3-Clause"
] | null | null | null | kubi_ecs_logger/models/__init__.py | kumina/kubi_ecs_logger | 64d9519e0759a24253a4edc53e0c024675033d1c | [
"BSD-3-Clause"
] | null | null | null | from .root_schema import RootSchema
from .base import Base, BaseSchema
from .severity import Severity
| 25.5 | 35 | 0.833333 | 14 | 102 | 6 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.127451 | 102 | 3 | 36 | 34 | 0.94382 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
cd71059b2f4fcc3c2c44c770b2d07caeb9050b21 | 255 | py | Python | fastapi_users/settings.py | chatalyan/fastapi-users | 2d6db3deea0fd7d4805ff2c5f6783fca8fc0fa34 | [
"MIT"
] | null | null | null | fastapi_users/settings.py | chatalyan/fastapi-users | 2d6db3deea0fd7d4805ff2c5f6783fca8fc0fa34 | [
"MIT"
] | 2 | 2022-02-18T04:38:15.000Z | 2022-03-07T04:36:52.000Z | fastapi_users/settings.py | chatalyan/fastapi-users | 2d6db3deea0fd7d4805ff2c5f6783fca8fc0fa34 | [
"MIT"
] | null | null | null | PREFIX_TOKEN = "users"
AUTH_TOKEN_AUDIENCE = f"{PREFIX_TOKEN}:auth"
RESET_PASSWORD_TOKEN_AUDIENCE = f"{PREFIX_TOKEN}:reset"
VERIFY_USER_TOKEN_AUDIENCE = f"{PREFIX_TOKEN}:verify"
STATE_TOKEN_AUDIENCE = f"{PREFIX_TOKEN}:oauth-state"
TOKEN_LIFETIME = 3600
| 28.333333 | 55 | 0.807843 | 37 | 255 | 5.135135 | 0.378378 | 0.289474 | 0.294737 | 0.421053 | 0.526316 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017021 | 0.078431 | 255 | 8 | 56 | 31.875 | 0.791489 | 0 | 0 | 0 | 0 | 0 | 0.356863 | 0.184314 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
cd90d12b1139bb7c8053fcbee09dc65066e39250 | 78 | py | Python | largescale/src/stimulus/stimulus/__init__.py | cosmozhang-lab/motion-illusion-model | 32a5ccab920095818b220642bae491429ff71f27 | [
"MIT"
] | null | null | null | largescale/src/stimulus/stimulus/__init__.py | cosmozhang-lab/motion-illusion-model | 32a5ccab920095818b220642bae491429ff71f27 | [
"MIT"
] | null | null | null | largescale/src/stimulus/stimulus/__init__.py | cosmozhang-lab/motion-illusion-model | 32a5ccab920095818b220642bae491429ff71f27 | [
"MIT"
] | null | null | null | # Package: largescale.src.stimulus.stimulus
from stimulus import StimulusBase | 26 | 43 | 0.846154 | 9 | 78 | 7.333333 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.089744 | 78 | 3 | 44 | 26 | 0.929577 | 0.525641 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
269d05074ea6396ca1e23cf61df6ba91a5364e7c | 167 | py | Python | cli/exceptions.py | dwarventech/csv2sqlite | 7a2c7cd2e1ba93021ea8afa7863de0eb1eb510ab | [
"MIT"
] | 1 | 2016-05-16T04:20:07.000Z | 2016-05-16T04:20:07.000Z | cli/exceptions.py | dwarventech/csv2sqlite | 7a2c7cd2e1ba93021ea8afa7863de0eb1eb510ab | [
"MIT"
] | null | null | null | cli/exceptions.py | dwarventech/csv2sqlite | 7a2c7cd2e1ba93021ea8afa7863de0eb1eb510ab | [
"MIT"
] | null | null | null | class CsvColumnNotFound(Exception):
def __init__(self, line_number, column_index):
self.line_number = line_number
self.column_index = column_index
| 33.4 | 50 | 0.736527 | 20 | 167 | 5.65 | 0.5 | 0.265487 | 0.247788 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.191617 | 167 | 4 | 51 | 41.75 | 0.837037 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
26cf924ee2d6c6db4c50b31fd31ea16087f20133 | 585 | py | Python | tests/test_json.py | fossabot/crazy-imports | 3821233e4a907756bdbaac7e23a0e65ae44bd33f | [
"MIT"
] | 5 | 2021-01-16T18:37:14.000Z | 2021-02-11T07:26:09.000Z | tests/test_json.py | fossabot/crazy-imports | 3821233e4a907756bdbaac7e23a0e65ae44bd33f | [
"MIT"
] | 31 | 2020-12-25T09:04:50.000Z | 2021-11-27T12:09:38.000Z | tests/test_json.py | fossabot/crazy-imports | 3821233e4a907756bdbaac7e23a0e65ae44bd33f | [
"MIT"
] | 3 | 2020-12-25T13:18:53.000Z | 2021-10-10T12:14:18.000Z | import crazyimports
import tests.test_data.config_json as config
def test_json_file_type():
assert config.__file__.split(".")[-1] == "json"
def test_json_integer_type():
assert isinstance(config.number, int)
def test_json_integer_value():
assert config.number == 42
def test_json_string_type():
assert isinstance(config.string, str)
def test_json_string_value():
assert config.string == "apple"
def test_json_number_in_object():
assert config.object["number"] == 43
def test_json_string_in_object():
assert config.object["string"] == "orange"
| 18.870968 | 51 | 0.731624 | 81 | 585 | 4.925926 | 0.333333 | 0.122807 | 0.192982 | 0.12782 | 0.130326 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01006 | 0.150427 | 585 | 30 | 52 | 19.5 | 0.792757 | 0 | 0 | 0 | 0 | 0 | 0.047863 | 0 | 0 | 0 | 0 | 0 | 0.4375 | 1 | 0.4375 | true | 0 | 0.125 | 0 | 0.5625 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 5 |
26d87ca7c1c6fde53c571ac1fafdad0ac9804a81 | 44 | py | Python | env/lib/python3.8/site-packages/plotly/graph_objs/layout/template/data/_scattercarpet.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 11,750 | 2015-10-12T07:03:39.000Z | 2022-03-31T20:43:15.000Z | env/lib/python3.8/site-packages/plotly/graph_objs/layout/template/data/_scattercarpet.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 2,951 | 2015-10-12T00:41:25.000Z | 2022-03-31T22:19:26.000Z | env/lib/python3.8/site-packages/plotly/graph_objs/layout/template/data/_scattercarpet.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 2,623 | 2015-10-15T14:40:27.000Z | 2022-03-28T16:05:50.000Z | from plotly.graph_objs import Scattercarpet
| 22 | 43 | 0.886364 | 6 | 44 | 6.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 44 | 1 | 44 | 44 | 0.95 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
26d94e25d20d513fb6386c51978a1a3ae5eebfb3 | 560 | py | Python | __init__.py | jabbershort/KinovaGen3 | b5aedf6f3433c9010fae4f63e194aa5c228555f3 | [
"MIT"
] | 1 | 2021-10-14T20:03:20.000Z | 2021-10-14T20:03:20.000Z | __init__.py | jabbershort/KinovaGen3 | b5aedf6f3433c9010fae4f63e194aa5c228555f3 | [
"MIT"
] | null | null | null | __init__.py | jabbershort/KinovaGen3 | b5aedf6f3433c9010fae4f63e194aa5c228555f3 | [
"MIT"
] | 1 | 2021-10-15T07:17:07.000Z | 2021-10-15T07:17:07.000Z | from .forward_kinematics import forward_kinematics
from .inverse_kinematics import inverse_kinematics
from .inverse_kinematics import multicriteria_ik
from .inverse_kinematics import inverse_kinematics_dls
from .inverse_kinematics import multicriteria_ik_damped
from .jacobian import jacobian
from .gravity import gravity
from .mass_matrix import mass_matrix
from .coriolis import coriolis
from .manipulability import manipulability
from .com_positions import com_positions
from .mid_positions import mid_positions
from .joint_positions import joint_positions
| 40 | 55 | 0.883929 | 72 | 560 | 6.597222 | 0.263889 | 0.214737 | 0.176842 | 0.227368 | 0.383158 | 0.362105 | 0 | 0 | 0 | 0 | 0 | 0 | 0.092857 | 560 | 13 | 56 | 43.076923 | 0.935039 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
26ffe07b6cba2263486290af8990d6c84bf9b27a | 25 | py | Python | aos_sw_api/dot1x/__init__.py | KennethSoelberg/AOS-Switch | a5a2c54917bbb69fab044bf0b313bcf795642d30 | [
"MIT"
] | null | null | null | aos_sw_api/dot1x/__init__.py | KennethSoelberg/AOS-Switch | a5a2c54917bbb69fab044bf0b313bcf795642d30 | [
"MIT"
] | 1 | 2020-12-24T15:36:56.000Z | 2021-01-28T23:19:57.000Z | aos_sw_api/dot1x/__init__.py | KennethSoelberg/AOS-Switch | a5a2c54917bbb69fab044bf0b313bcf795642d30 | [
"MIT"
] | 1 | 2021-02-16T23:26:28.000Z | 2021-02-16T23:26:28.000Z | from ._dot1x import Dot1x | 25 | 25 | 0.84 | 4 | 25 | 5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 0.12 | 25 | 1 | 25 | 25 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
f8020631b16411295d68b38217fa4df75812fee6 | 39 | py | Python | Haifuckqueue/src/test/__init__.py | Hydrazer/Haifuckqueue | 8f64a3cbd70189ac5e39a753591192d92f99fc3b | [
"MIT"
] | 2 | 2021-12-07T23:29:15.000Z | 2021-12-07T23:57:08.000Z | Haifuckqueue/src/test/__init__.py | Hydrazer/Haifuckqueue | 8f64a3cbd70189ac5e39a753591192d92f99fc3b | [
"MIT"
] | 1 | 2021-11-20T21:06:01.000Z | 2021-11-20T21:06:01.000Z | src/test/__init__.py | 4gboframram/Haifuckqueue | 1f32126d469b80a91be3a7c437c6c9ba17fe3a86 | [
"MIT"
] | null | null | null | # LET ME FUCKING UPLOAD "EMPTY FILES"
| 19.5 | 38 | 0.717949 | 6 | 39 | 4.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.205128 | 39 | 1 | 39 | 39 | 0.903226 | 0.897436 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
f83532d5eb984bbf6e6ee32989664b6956a892cd | 204 | py | Python | apps/api/__init__.py | onyxhealth/safhir-vmi | 60ba90e9e8ba00347e0dc32e3061da5285df4ade | [
"Apache-2.0"
] | null | null | null | apps/api/__init__.py | onyxhealth/safhir-vmi | 60ba90e9e8ba00347e0dc32e3061da5285df4ade | [
"Apache-2.0"
] | 9 | 2021-03-19T11:43:09.000Z | 2022-03-12T00:38:43.000Z | apps/api/__init__.py | onyxhealth/safhir-vmi | 60ba90e9e8ba00347e0dc32e3061da5285df4ade | [
"Apache-2.0"
] | null | null | null | from django.conf import settings
assert getattr(settings, 'ATOMIC_REQUESTS', False), "Use of this API package requires ATOMIC_REQUESTS to be enabled to ensure no cases of partial success occure" # noqa
| 51 | 169 | 0.79902 | 31 | 204 | 5.193548 | 0.83871 | 0.173913 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147059 | 204 | 3 | 170 | 68 | 0.925287 | 0.019608 | 0 | 0 | 0 | 0 | 0.616162 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
f835520eb590cfd5d266fdad6d553a7637f62cce | 284 | py | Python | bin/check_port.py | wangxiao1254/GraphSC | 294b9195477d701b9c75f15387e5ac1aaee8cc51 | [
"MIT"
] | 25 | 2015-05-22T17:45:22.000Z | 2021-11-19T07:55:09.000Z | bin/check_port.py | wangxiao1254/GraphSC | 294b9195477d701b9c75f15387e5ac1aaee8cc51 | [
"MIT"
] | 1 | 2021-08-05T02:49:48.000Z | 2021-08-05T02:49:48.000Z | bin/check_port.py | wangxiao1254/GraphSC | 294b9195477d701b9c75f15387e5ac1aaee8cc51 | [
"MIT"
] | 11 | 2015-06-10T18:16:26.000Z | 2021-09-17T05:48:12.000Z | #!/usr/bin/python
import subprocess
import os.path
import time
for i in range(0, 16):
subprocess.call("fuser " + str(35000 + i) + "/tcp", shell=True)
subprocess.call("fuser " + str(50000 + i) + "/tcp", shell=True)
subprocess.call("fuser " + str(55000 + i) + "/tcp", shell=True)
| 31.555556 | 65 | 0.647887 | 43 | 284 | 4.27907 | 0.534884 | 0.228261 | 0.309783 | 0.358696 | 0.380435 | 0.380435 | 0.380435 | 0.380435 | 0 | 0 | 0 | 0.075314 | 0.158451 | 284 | 8 | 66 | 35.5 | 0.694561 | 0.056338 | 0 | 0 | 0 | 0 | 0.11236 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
f874a4fa56ef58956676e2f46f3321933d6b8298 | 174 | py | Python | tests/permission_test/python_permission_test.py | DockerComposeFiles/ARM | b0faddb525ad134ff8c589c370d8e61ab030c216 | [
"MIT"
] | null | null | null | tests/permission_test/python_permission_test.py | DockerComposeFiles/ARM | b0faddb525ad134ff8c589c370d8e61ab030c216 | [
"MIT"
] | null | null | null | tests/permission_test/python_permission_test.py | DockerComposeFiles/ARM | b0faddb525ad134ff8c589c370d8e61ab030c216 | [
"MIT"
] | null | null | null | import datetime
import time
# Zeitangabe mit Zugriff auf Systemzeit
print(time.sleep)
# Zeitangabe ohne Zugriff auf die genaue Systemzeit.
print(datetime.time.microsecond)
| 19.333333 | 52 | 0.816092 | 23 | 174 | 6.173913 | 0.608696 | 0.140845 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126437 | 174 | 8 | 53 | 21.75 | 0.934211 | 0.505747 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 5 |
3e658c9a032278a5ce15345b9258b3d1d71d964b | 53 | py | Python | tadataka/vo/__init__.py | IshitaTakeshi/Tadataka | 852c7afb904503005e51884408e1492ef0be836f | [
"Apache-2.0"
] | 54 | 2019-11-15T16:30:34.000Z | 2022-01-13T15:18:54.000Z | tadataka/vo/__init__.py | IshitaTakeshi/Tadataka | 852c7afb904503005e51884408e1492ef0be836f | [
"Apache-2.0"
] | 11 | 2019-02-28T08:28:24.000Z | 2020-04-07T04:47:12.000Z | tadataka/vo/__init__.py | IshitaTakeshi/Tadataka | 852c7afb904503005e51884408e1492ef0be836f | [
"Apache-2.0"
] | 1 | 2020-02-26T13:59:40.000Z | 2020-02-26T13:59:40.000Z | from tadataka.vo.feature_based import FeatureBasedVO
| 26.5 | 52 | 0.886792 | 7 | 53 | 6.571429 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.075472 | 53 | 1 | 53 | 53 | 0.938776 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
3e764e5e2099bc65817b31d22e3fb74aeb27f934 | 80 | py | Python | __init__.py | auraGB/PopcornTimeAPI | 7fbf940d039ef4203cec8cf586154f2e9e4b47b7 | [
"Apache-2.0"
] | null | null | null | __init__.py | auraGB/PopcornTimeAPI | 7fbf940d039ef4203cec8cf586154f2e9e4b47b7 | [
"Apache-2.0"
] | null | null | null | __init__.py | auraGB/PopcornTimeAPI | 7fbf940d039ef4203cec8cf586154f2e9e4b47b7 | [
"Apache-2.0"
] | null | null | null | from .version import __version__
from .media.shows import *
# __all__ = [
# ] | 11.428571 | 32 | 0.6875 | 9 | 80 | 5.222222 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 80 | 7 | 33 | 11.428571 | 0.734375 | 0.1625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
3e8eb11a20ae4f8820995cac9f2de2951342e1c0 | 103 | py | Python | cpgames/modules/core/whacamole/modules/__init__.py | Wasabii88/Games | 33262ca1958207a24e57e3532feded7e275b1dd1 | [
"MIT"
] | 1 | 2022-02-27T10:33:41.000Z | 2022-02-27T10:33:41.000Z | cpgames/modules/core/whacamole/modules/__init__.py | beiwei365/Games | f6499f378802d3212a08aeca761191b58714b7f0 | [
"MIT"
] | null | null | null | cpgames/modules/core/whacamole/modules/__init__.py | beiwei365/Games | f6499f378802d3212a08aeca761191b58714b7f0 | [
"MIT"
] | null | null | null | '''initialize'''
from .sprites import Mole, Hammer
from .interfaces import endInterface, startInterface | 34.333333 | 52 | 0.805825 | 11 | 103 | 7.545455 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097087 | 103 | 3 | 52 | 34.333333 | 0.892473 | 0.097087 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
e42097eb7128df9fba862c295f3727b7eae0f7bf | 140 | py | Python | src/questions/__init__.py | byran/ScreenPlayExample | 1108a8567aacc8ddc8e460a42f54409ad7dc0f23 | [
"MIT"
] | null | null | null | src/questions/__init__.py | byran/ScreenPlayExample | 1108a8567aacc8ddc8e460a42f54409ad7dc0f23 | [
"MIT"
] | null | null | null | src/questions/__init__.py | byran/ScreenPlayExample | 1108a8567aacc8ddc8e460a42f54409ad7dc0f23 | [
"MIT"
] | null | null | null | from .the_search_result_titles import the_search_result_titles
__all__ = [
'the_search_result_titles' # the_search_result_titles.py
]
| 23.333333 | 62 | 0.821429 | 20 | 140 | 4.95 | 0.4 | 0.363636 | 0.606061 | 0.848485 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121429 | 140 | 5 | 63 | 28 | 0.804878 | 0.192857 | 0 | 0 | 0 | 0 | 0.216216 | 0.216216 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
e427d1811fed7f470d4408b1f26dab9df83f1e1b | 162 | py | Python | qork/console.py | flipcoder/qork | 86f10f0db2edc82786516fd30bbd9f046b1a27aa | [
"MIT"
] | 3 | 2020-03-19T06:31:32.000Z | 2021-08-24T19:19:50.000Z | qork/console.py | flipcoder/qork | 86f10f0db2edc82786516fd30bbd9f046b1a27aa | [
"MIT"
] | null | null | null | qork/console.py | flipcoder/qork | 86f10f0db2edc82786516fd30bbd9f046b1a27aa | [
"MIT"
] | null | null | null | #!/usr/bin/env python
from qork.canvas import Canvas
class Console(Canvas):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
| 18 | 41 | 0.660494 | 21 | 162 | 4.714286 | 0.761905 | 0.20202 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.179012 | 162 | 8 | 42 | 20.25 | 0.744361 | 0.123457 | 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 | 1 | 0 | 0 | 5 |
e42d7c449da1424dc3af390ede252d1f2018a31a | 3,630 | py | Python | blahb/setops/intersection/intersection_direct.py | mvsaha/blahb | e4ea703fa0fc255f627057c07df4c51138299d8b | [
"MIT"
] | null | null | null | blahb/setops/intersection/intersection_direct.py | mvsaha/blahb | e4ea703fa0fc255f627057c07df4c51138299d8b | [
"MIT"
] | null | null | null | blahb/setops/intersection/intersection_direct.py | mvsaha/blahb | e4ea703fa0fc255f627057c07df4c51138299d8b | [
"MIT"
] | null | null | null | import numpy as np
import numba
from ...utils import lex_less_Nd, eq_Nd
@numba.njit
def _intersection_direct_1d(a, b):
na, ndim = a.shape
ib, nb = 0, b.shape[0]
assert b.shape[1] == ndim
take_a = np.empty(na, dtype=numba.boolean)
for ia in range(na):
while b[ib, 0] < a[ia, 0]:
ib += 1
if ib == nb:
take_a[ia:] = False
return take_a
if a[ia, 0] == b[ib, 0]:
take_a[ia] = True
else:
take_a[ia] = False
return take_a
@numba.njit
def _intersection_direct_2d(a, b):
na, ndim = a.shape
ib, nb = 0, b.shape[0]
assert b.shape[1] == ndim
take_a = np.empty(na, dtype=numba.boolean)
for ia in range(na):
while (b[ib, 0] < a[ia, 0] or
(b[ib, 0] == a[ia, 0] and (b[ib, 1] < a[ia, 1]))):
ib += 1
if ib == nb:
take_a[ia:] = False
return take_a
if (a[ia, 0] == b[ib, 0] and a[ia, 1] == b[ib, 1]):
take_a[ia] = True
else:
take_a[ia] = False
return take_a
@numba.njit
def _intersection_direct_3d(a, b):
na, ndim = a.shape
ib, nb = 0, b.shape[0]
assert b.shape[1] == ndim
take_a = np.empty(na, dtype=numba.boolean)
for ia in range(na):
while (b[ib, 0] < a[ia, 0] or
(b[ib, 0] == a[ia, 0] and (b[ib, 1] < a[ia, 1] or
(b[ib, 1] == a[ia, 1] and b[ib, 2] < a[ia, 2])))):
ib += 1
if ib == nb:
take_a[ia:] = False
return take_a
if (a[ia, 0] == b[ib, 0] and a[ia, 1] == b[ib, 1] and
a[ia, 2] == b[ib, 2]):
take_a[ia] = True
else:
take_a[ia] = False
return take_a
@numba.njit
def _intersection_direct_4d(a, b):
na, ndim = a.shape
ib, nb = 0, b.shape[0]
assert b.shape[1] == ndim
take_a = np.empty(na, dtype=numba.boolean)
for ia in range(na):
while (b[ib, 0] < a[ia, 0] or
(b[ib, 0] == a[ia, 0] and (b[ib, 1] < a[ia, 1] or
(b[ib, 1] == a[ia, 1] and (b[ib, 2] < a[ia, 2] or
(b[ib, 2] == a[ia, 2] and b[ib, 3] < a[ia, 3])))))):
ib += 1
if ib == nb:
take_a[ia:] = False
return take_a
if (a[ia, 0] == b[ib, 0] and a[ia, 1] == b[ib, 1] and
a[ia, 2] == b[ib, 2] and a[ia, 3] == b[ib, 3]):
take_a[ia] = True
else:
take_a[ia] = False
return take_a
@numba.njit
def _intersection_direct_Nd(a, b):
"""Find the set intersection between two IndexSets in linear time."""
na, ndim = a.shape
ib, nb = 0, b.shape[0]
assert b.shape[1] == ndim
take_a = np.empty(na, dtype=numba.boolean)
for ia in range(na):
while lex_less_Nd(b[ib], a[ia]):
ib += 1
if ib == nb: # If we run out of b coordinates, then we are done
take_a[ia:] = False
return take_a
if eq_Nd(b[ib], a[ia]):
take_a[ia] = True
else:
take_a[ia] = False
return take_a
@numba.njit
def intersection_direct_(a_loc, b_loc):
ndim = a_loc.shape[1]
assert ndim == b_loc.shape[1]
if ndim == 1:
return _intersection_direct_1d(a_loc, b_loc)
elif ndim == 2:
return _intersection_direct_2d(a_loc, b_loc)
elif ndim == 3:
return _intersection_direct_3d(a_loc, b_loc)
elif ndim == 4:
return _intersection_direct_4d(a_loc, b_loc)
else:
return _intersection_direct_Nd(a_loc, b_loc)
| 28.139535 | 76 | 0.488154 | 605 | 3,630 | 2.793388 | 0.109091 | 0.076331 | 0.06213 | 0.071006 | 0.768639 | 0.736095 | 0.702959 | 0.702959 | 0.688166 | 0.688166 | 0 | 0.037197 | 0.363085 | 3,630 | 128 | 77 | 28.359375 | 0.693772 | 0.031129 | 0 | 0.718182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.054545 | 1 | 0.054545 | false | 0 | 0.027273 | 0 | 0.218182 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 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 | 5 |
e449ce92d0c288d1227a8d0e900d485bae34638b | 163 | py | Python | django_fortumo/settings/test.py | v0y/django-fortumo | d21101690a6b11adaa44faf5a686cb6e8f1c74fc | [
"MIT"
] | null | null | null | django_fortumo/settings/test.py | v0y/django-fortumo | d21101690a6b11adaa44faf5a686cb6e8f1c74fc | [
"MIT"
] | null | null | null | django_fortumo/settings/test.py | v0y/django-fortumo | d21101690a6b11adaa44faf5a686cb6e8f1c74fc | [
"MIT"
] | null | null | null | from django_fortumo.settings.base import *
FORTUMO_SECRET = 'bad54c617b3a51230ac7cc3da398855e'
SECRET_KEY = '0_6iq7a%wez2ibbrt07#g&hj1v#pnt9)!^0t)sk3vy72)p%87@'
| 27.166667 | 65 | 0.803681 | 21 | 163 | 6.047619 | 0.904762 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.218543 | 0.07362 | 163 | 5 | 66 | 32.6 | 0.622517 | 0 | 0 | 0 | 0 | 0 | 0.503067 | 0.503067 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
e48ccba32b3285d120053677eed78e689ec73054 | 168 | py | Python | scripts/__main__.py | 7onn/politicians-contacts | 571bec23c2f795905c3f1dd6888850dac95cfccc | [
"MIT"
] | 2 | 2022-02-05T18:42:07.000Z | 2022-03-08T19:21:49.000Z | scripts/__main__.py | 7onn/politicians-contacts | 571bec23c2f795905c3f1dd6888850dac95cfccc | [
"MIT"
] | null | null | null | scripts/__main__.py | 7onn/politicians-contacts | 571bec23c2f795905c3f1dd6888850dac95cfccc | [
"MIT"
] | null | null | null | from congress_crawler import CongressCrawler
from senate_crawler import SenateCrawler
if __name__ == "__main__":
SenateCrawler().run()
CongressCrawler().run()
| 24 | 44 | 0.77381 | 17 | 168 | 7.058824 | 0.647059 | 0.216667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136905 | 168 | 6 | 45 | 28 | 0.827586 | 0 | 0 | 0 | 0 | 0 | 0.047619 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
e4ae1928d24f092f3d585dec67ca322dbf2d39a1 | 116 | py | Python | test/__init__.py | jeanqasaur/jeeves | 1b5783a98f88fa2fc9e4cae7e005d2c9242cfea4 | [
"MIT"
] | 253 | 2015-01-02T01:54:27.000Z | 2022-03-10T01:44:02.000Z | test/__init__.py | jeanqasaur/jeeves | 1b5783a98f88fa2fc9e4cae7e005d2c9242cfea4 | [
"MIT"
] | 4 | 2015-06-09T03:36:28.000Z | 2017-08-11T15:54:24.000Z | test/__init__.py | jeanqasaur/jeeves | 1b5783a98f88fa2fc9e4cae7e005d2c9242cfea4 | [
"MIT"
] | 29 | 2015-02-14T02:24:08.000Z | 2021-12-16T02:46:16.000Z | import macropy.activate
import testCaching
import testJeevesWrite
import testLogPolicies
import testSourceTransform
| 19.333333 | 26 | 0.905172 | 11 | 116 | 9.545455 | 0.636364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.086207 | 116 | 5 | 27 | 23.2 | 0.990566 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
e4d162b158859df8d7329dca96c1775709ce4821 | 192 | py | Python | src/notebook_adventure/model/classes/Magic_attack.py | kjamaal/notebook_adventure | 703d6663212efcfd2ffe8c54e788e7dfd7feb221 | [
"MIT"
] | null | null | null | src/notebook_adventure/model/classes/Magic_attack.py | kjamaal/notebook_adventure | 703d6663212efcfd2ffe8c54e788e7dfd7feb221 | [
"MIT"
] | 1 | 2021-06-01T23:59:47.000Z | 2021-06-01T23:59:47.000Z | src/notebook_adventure/model/classes/Magic_attack.py | kjamaal/notebook_adventure_client | 703d6663212efcfd2ffe8c54e788e7dfd7feb221 | [
"MIT"
] | null | null | null | from ..base.Attack import Attack
class Magic_attack(Attack):
def __init__(self, name, aType, damage):
self.target_member = 'md'
Attack.__init__(self, name, aType, damage)
| 27.428571 | 47 | 0.682292 | 25 | 192 | 4.84 | 0.6 | 0.132231 | 0.198347 | 0.280992 | 0.380165 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.203125 | 192 | 7 | 48 | 27.428571 | 0.79085 | 0 | 0 | 0 | 0 | 0 | 0.010695 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 5 |
901128417a22e80056c7be63656b700f0973208f | 96 | py | Python | Geometry/__init__.py | ComputationalChemistry-NMSU/terse | d97c4efe941b7459d6de591511592c0dec21ebbb | [
"MIT"
] | 1 | 2018-02-25T00:36:52.000Z | 2018-02-25T00:36:52.000Z | Geometry/__init__.py | ComputationalChemistry-NMSU/terse | d97c4efe941b7459d6de591511592c0dec21ebbb | [
"MIT"
] | null | null | null | Geometry/__init__.py | ComputationalChemistry-NMSU/terse | d97c4efe941b7459d6de591511592c0dec21ebbb | [
"MIT"
] | null | null | null | from ListGeoms import ListGeoms
from Geom import Geom
from IRC import IRC
from Scan import Scan
| 19.2 | 31 | 0.833333 | 16 | 96 | 5 | 0.375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 96 | 4 | 32 | 24 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
9039fb054c30b2523a50869837059e6609260816 | 200 | py | Python | saleor/attribute/signals.py | fairhopeweb/saleor | 9ac6c22652d46ba65a5b894da5f1ba5bec48c019 | [
"CC-BY-4.0"
] | 15,337 | 2015-01-12T02:11:52.000Z | 2021-10-05T19:19:29.000Z | saleor/attribute/signals.py | fairhopeweb/saleor | 9ac6c22652d46ba65a5b894da5f1ba5bec48c019 | [
"CC-BY-4.0"
] | 7,486 | 2015-02-11T10:52:13.000Z | 2021-10-06T09:37:15.000Z | saleor/attribute/signals.py | aminziadna/saleor | 2e78fb5bcf8b83a6278af02551a104cfa555a1fb | [
"CC-BY-4.0"
] | 5,864 | 2015-01-16T14:52:54.000Z | 2021-10-05T23:01:15.000Z | from ..core.tasks import delete_from_storage_task
def delete_attribute_value_file(sender, instance, **kwargs):
if file_url := instance.file_url:
delete_from_storage_task.delay(file_url)
| 28.571429 | 60 | 0.78 | 29 | 200 | 4.965517 | 0.586207 | 0.145833 | 0.236111 | 0.291667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135 | 200 | 6 | 61 | 33.333333 | 0.83237 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
5f9984f4d5503b2a33efbc98bc7b6b7c93124c04 | 84 | py | Python | hex_maze/__init__.py | lebalz/hex_maze | df03a5176d367754e623fcfb82d3cd2a3e4b18c9 | [
"MIT"
] | null | null | null | hex_maze/__init__.py | lebalz/hex_maze | df03a5176d367754e623fcfb82d3cd2a3e4b18c9 | [
"MIT"
] | null | null | null | hex_maze/__init__.py | lebalz/hex_maze | df03a5176d367754e623fcfb82d3cd2a3e4b18c9 | [
"MIT"
] | 1 | 2021-09-26T14:30:50.000Z | 2021-09-26T14:30:50.000Z | from __future__ import annotations
from .board import Board
from .tile import Tile
| 16.8 | 34 | 0.821429 | 12 | 84 | 5.416667 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.154762 | 84 | 4 | 35 | 21 | 0.915493 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
5fa8f090ba4f48e91a945f796d03c5bb1bdd08a9 | 98 | py | Python | common/ml_prediction_client_test.py | stevensshi/smart-realestate | f00671a5ec9590b9f5b74595c3599317a722370e | [
"MIT"
] | 4 | 2017-01-19T10:14:59.000Z | 2019-06-25T23:14:29.000Z | common/ml_prediction_client_test.py | stevensshi/smart-realestate | f00671a5ec9590b9f5b74595c3599317a722370e | [
"MIT"
] | null | null | null | common/ml_prediction_client_test.py | stevensshi/smart-realestate | f00671a5ec9590b9f5b74595c3599317a722370e | [
"MIT"
] | 1 | 2019-06-25T23:14:31.000Z | 2019-06-25T23:14:31.000Z | import ml_prediction_client as client
print client.predict('94015', 'Single Family', 4, 2, 2000)
| 24.5 | 58 | 0.765306 | 15 | 98 | 4.866667 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.127907 | 0.122449 | 98 | 3 | 59 | 32.666667 | 0.72093 | 0 | 0 | 0 | 0 | 0 | 0.183673 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.5 | null | null | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 5 |
39560c5d7ad92eaecd4c6b350f76f2083092a74f | 109 | py | Python | uiautomator2/_url.py | snakx/uiautomator2 | 470af5f627838ed2c9195110b4659f7d34ce9343 | [
"MIT"
] | 1 | 2021-10-31T05:31:51.000Z | 2021-10-31T05:31:51.000Z | uiautomator2/_url.py | snakx/uiautomator2 | 470af5f627838ed2c9195110b4659f7d34ce9343 | [
"MIT"
] | null | null | null | uiautomator2/_url.py | snakx/uiautomator2 | 470af5f627838ed2c9195110b4659f7d34ce9343 | [
"MIT"
] | null | null | null | def dump_route(proto, host, port=4726):
url = proto + '://' + host + ':' + str(port) + '/'
return url | 36.333333 | 54 | 0.53211 | 14 | 109 | 4.071429 | 0.714286 | 0.315789 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.048193 | 0.238532 | 109 | 3 | 55 | 36.333333 | 0.638554 | 0 | 0 | 0 | 0 | 0 | 0.045455 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 5 |
398f2a8e905bb3d27768f2bc692f5c7c2e883bdd | 215 | py | Python | pymarlin/plugins/__init__.py | nifarn/PyMarlin | ea1f5f927aa85112ecebc206d53b5c3ee65704fa | [
"MIT"
] | 20 | 2021-06-09T18:46:45.000Z | 2022-02-09T01:08:13.000Z | pymarlin/plugins/__init__.py | nifarn/PyMarlin | ea1f5f927aa85112ecebc206d53b5c3ee65704fa | [
"MIT"
] | 50 | 2021-06-09T17:50:35.000Z | 2022-02-07T23:02:30.000Z | pymarlin/plugins/__init__.py | nifarn/PyMarlin | ea1f5f927aa85112ecebc206d53b5c3ee65704fa | [
"MIT"
] | 5 | 2021-06-21T22:24:30.000Z | 2021-12-21T17:08:21.000Z | '''pymarlin.plugins'''
from .plugin_module_interface import PluginModuleInterface
from .hf_seq_classification import HfSeqClassificationPlugin
from .hf_ner import HfNERPlugin
from .hf_seq2seq import HfSeq2SeqPlugin
| 35.833333 | 60 | 0.869767 | 24 | 215 | 7.541667 | 0.666667 | 0.099448 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010101 | 0.07907 | 215 | 5 | 61 | 43 | 0.90404 | 0.074419 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
39d3f798dc6dd14bea34bf9e58ca426b8d22bdef | 60 | py | Python | lib/__init__.py | learning/SublimeTogetherServer | a089b24da1f49ac5748dcf9e78c247aac6691990 | [
"MIT"
] | 1 | 2017-07-05T07:16:13.000Z | 2017-07-05T07:16:13.000Z | lib/__init__.py | learning/SublimeTogetherServer | a089b24da1f49ac5748dcf9e78c247aac6691990 | [
"MIT"
] | null | null | null | lib/__init__.py | learning/SublimeTogetherServer | a089b24da1f49ac5748dcf9e78c247aac6691990 | [
"MIT"
] | null | null | null | from lib.commands import in_cmd, out_cmd
import lib.handlers | 30 | 40 | 0.85 | 11 | 60 | 4.454545 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 60 | 2 | 41 | 30 | 0.907407 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
39defe9e39c23bcfa6bd498114aab3d3d24ab39f | 168 | py | Python | blog_comments/urls.py | msherman64/portal | e5399ef2ed3051d7c9a46c660f028c666ae22ca6 | [
"Apache-2.0"
] | null | null | null | blog_comments/urls.py | msherman64/portal | e5399ef2ed3051d7c9a46c660f028c666ae22ca6 | [
"Apache-2.0"
] | null | null | null | blog_comments/urls.py | msherman64/portal | e5399ef2ed3051d7c9a46c660f028c666ae22ca6 | [
"Apache-2.0"
] | null | null | null | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^post/(?P<pk>\d+)/comment/$', views.add_comment_to_post, name='add_comment_to_post'),
]
| 24 | 95 | 0.708333 | 27 | 168 | 4.185185 | 0.62963 | 0.176991 | 0.212389 | 0.283186 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.119048 | 168 | 6 | 96 | 28 | 0.763514 | 0 | 0 | 0 | 0 | 0 | 0.27381 | 0.160714 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
f2d67424cec17400e6b8bf3f4582cd33234eebd5 | 129 | py | Python | hc/front/admin.py | andela/hc-bigas-opus | b749367ee16e8afa95d5b9cbfe854d12157c64d1 | [
"BSD-3-Clause"
] | 2 | 2018-04-20T10:07:25.000Z | 2018-04-20T13:48:21.000Z | hc/front/admin.py | andela/hc-bigas-opus | b749367ee16e8afa95d5b9cbfe854d12157c64d1 | [
"BSD-3-Clause"
] | 20 | 2018-03-21T12:43:28.000Z | 2018-04-16T18:15:29.000Z | hc/front/admin.py | andela/hc-bigas-opus | b749367ee16e8afa95d5b9cbfe854d12157c64d1 | [
"BSD-3-Clause"
] | 1 | 2021-06-01T19:47:15.000Z | 2021-06-01T19:47:15.000Z | from django.contrib import admin
from .models import FaqQuestions
# Register your models here.
admin.site.register(FaqQuestions) | 25.8 | 33 | 0.829457 | 17 | 129 | 6.294118 | 0.647059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.108527 | 129 | 5 | 33 | 25.8 | 0.930435 | 0.20155 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
f2de076258c2789fa7e388c9a99c4cdb309873ae | 79 | py | Python | Emmanuel ANENE/Phase 1/Python Basic 1/Day2/dateTime.py | nkem1010/python-challenge-solutions | 203cedc691094a83b110fc75764aac51dbbc1a03 | [
"MIT"
] | null | null | null | Emmanuel ANENE/Phase 1/Python Basic 1/Day2/dateTime.py | nkem1010/python-challenge-solutions | 203cedc691094a83b110fc75764aac51dbbc1a03 | [
"MIT"
] | null | null | null | Emmanuel ANENE/Phase 1/Python Basic 1/Day2/dateTime.py | nkem1010/python-challenge-solutions | 203cedc691094a83b110fc75764aac51dbbc1a03 | [
"MIT"
] | null | null | null | import datetime
print("Current date and time is:", datetime.datetime.today())
| 19.75 | 61 | 0.759494 | 11 | 79 | 5.454545 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113924 | 79 | 3 | 62 | 26.333333 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0.316456 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 5 |
84387e24b1476f57b8382d634b7858b8d766595b | 122 | py | Python | GUI/test.py | IDzyre/TankController | 60ccdd6d4023be7a0e0155b508e8b067603bf8b2 | [
"MIT"
] | 4 | 2019-11-07T17:51:20.000Z | 2020-08-27T05:00:43.000Z | GUI/test.py | IDzyre/TankController | 60ccdd6d4023be7a0e0155b508e8b067603bf8b2 | [
"MIT"
] | 46 | 2020-11-01T05:39:29.000Z | 2021-03-23T04:50:06.000Z | GUI/test.py | IDzyre/TankController | 60ccdd6d4023be7a0e0155b508e8b067603bf8b2 | [
"MIT"
] | 12 | 2019-11-07T17:51:14.000Z | 2020-09-21T16:06:15.000Z | #!python3
import libTC
print('Version:', libTC.version())
print('LCD: ', libTC.lcd(0))
print(' ', libTC.lcd(1))
| 20.333333 | 34 | 0.598361 | 16 | 122 | 4.5625 | 0.5 | 0.219178 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029703 | 0.172131 | 122 | 5 | 35 | 24.4 | 0.693069 | 0.065574 | 0 | 0 | 0 | 0 | 0.212389 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0.75 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
ffda4cd1ad08e4d86afb4a7b9240f6e6f3a2466c | 19 | py | Python | step00_helloworld/hello_world.py | hammadtariq/learn-python | f15da464f017d68ae5635dc31083f913bdb4eb0b | [
"MIT"
] | 12 | 2016-05-07T21:08:46.000Z | 2020-06-02T20:20:28.000Z | step00_helloworld/hello_world.py | almirah/learn-python | f15da464f017d68ae5635dc31083f913bdb4eb0b | [
"MIT"
] | null | null | null | step00_helloworld/hello_world.py | almirah/learn-python | f15da464f017d68ae5635dc31083f913bdb4eb0b | [
"MIT"
] | 9 | 2016-06-03T10:40:11.000Z | 2021-01-26T13:44:52.000Z | print("hello zia")
| 9.5 | 18 | 0.684211 | 3 | 19 | 4.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.105263 | 19 | 1 | 19 | 19 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0.473684 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
ffdf025aa06e0b842c8f4ceb33c737f3719d7d41 | 50 | py | Python | beyond/orbits/__init__.py | priyatharsan/beyond | 1061b870407d316d43e4d1351a7ec026629685ae | [
"MIT"
] | null | null | null | beyond/orbits/__init__.py | priyatharsan/beyond | 1061b870407d316d43e4d1351a7ec026629685ae | [
"MIT"
] | null | null | null | beyond/orbits/__init__.py | priyatharsan/beyond | 1061b870407d316d43e4d1351a7ec026629685ae | [
"MIT"
] | null | null | null | from .orbit import Orbit
from .ephem import Ephem
| 16.666667 | 24 | 0.8 | 8 | 50 | 5 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16 | 50 | 2 | 25 | 25 | 0.952381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
08152330e78c85fcd33b74d01b603a06de9e73c1 | 182 | py | Python | teitoku/gateway/base_gateway.py | yukinotenshi/teitoku | adb54fb7f709e0bac0da6d6f6f8aa00702c2f9c5 | [
"MIT"
] | null | null | null | teitoku/gateway/base_gateway.py | yukinotenshi/teitoku | adb54fb7f709e0bac0da6d6f6f8aa00702c2f9c5 | [
"MIT"
] | null | null | null | teitoku/gateway/base_gateway.py | yukinotenshi/teitoku | adb54fb7f709e0bac0da6d6f6f8aa00702c2f9c5 | [
"MIT"
] | 1 | 2020-01-25T10:53:44.000Z | 2020-01-25T10:53:44.000Z | class Gateway:
def __init__(self, dispatcher, message_parser):
self.dispatcher = dispatcher
self.message_parser = message_parser
def run(self):
pass
| 22.75 | 51 | 0.664835 | 20 | 182 | 5.7 | 0.5 | 0.342105 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.263736 | 182 | 7 | 52 | 26 | 0.850746 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0.166667 | 0 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
082171af307e2cf2e1acfaf5f2127e7785e962f2 | 64 | py | Python | multilingual_t5/baseline_bn/__init__.py | sumanthd17/mt5 | c99b4e3ad1c69908c852c730a1323ccb52d48f58 | [
"Apache-2.0"
] | null | null | null | multilingual_t5/baseline_bn/__init__.py | sumanthd17/mt5 | c99b4e3ad1c69908c852c730a1323ccb52d48f58 | [
"Apache-2.0"
] | null | null | null | multilingual_t5/baseline_bn/__init__.py | sumanthd17/mt5 | c99b4e3ad1c69908c852c730a1323ccb52d48f58 | [
"Apache-2.0"
] | null | null | null | """baseline_bn dataset."""
from .baseline_bn import BaselineBn
| 16 | 35 | 0.765625 | 8 | 64 | 5.875 | 0.75 | 0.425532 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.109375 | 64 | 3 | 36 | 21.333333 | 0.824561 | 0.3125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
f26796c33037195501b273e30084dd96578f00e8 | 76 | py | Python | vaayu/cfg/__init__.py | sayerhs/vaayu | 668a35fc1cd77fe7c2e945abcde6f9763124c0b8 | [
"Apache-2.0"
] | null | null | null | vaayu/cfg/__init__.py | sayerhs/vaayu | 668a35fc1cd77fe7c2e945abcde6f9763124c0b8 | [
"Apache-2.0"
] | null | null | null | vaayu/cfg/__init__.py | sayerhs/vaayu | 668a35fc1cd77fe7c2e945abcde6f9763124c0b8 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""\
Vaayu Configuration
===================
"""
| 8.444444 | 23 | 0.368421 | 5 | 76 | 5.6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015873 | 0.171053 | 76 | 8 | 24 | 9.5 | 0.428571 | 0.815789 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
f28a2232e13cb05545ecbeb17aeea5e2050ab11a | 183 | py | Python | assets/examples/python trick 2.2 example.py | hyeonchan523/hyeonchan523.github.io | 2267bd77ecf41be02236e78b9120a864329bbbef | [
"MIT"
] | null | null | null | assets/examples/python trick 2.2 example.py | hyeonchan523/hyeonchan523.github.io | 2267bd77ecf41be02236e78b9120a864329bbbef | [
"MIT"
] | null | null | null | assets/examples/python trick 2.2 example.py | hyeonchan523/hyeonchan523.github.io | 2267bd77ecf41be02236e78b9120a864329bbbef | [
"MIT"
] | null | null | null | names = ['Alice', 'Bob', 'Dilbert']
names = [
'Alice',
'Bob',
'Dilbert',
'Jane'
]
names = [
'Alice',
'Bob',
'Dilbert',
'Jane'
] | 12.2 | 35 | 0.371585 | 14 | 183 | 4.857143 | 0.357143 | 0.441176 | 0.573529 | 0.882353 | 0.705882 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.415301 | 183 | 15 | 36 | 12.2 | 0.635514 | 0 | 0 | 0.769231 | 0 | 0 | 0.288043 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
f2aeb9c74955eac18c63a06d2d11d41fcd483f39 | 141 | py | Python | 3rdparty/wsgi_intercept/mechanoid_intercept/__init__.py | arda2525/fixofx | 1792d94697af682ca1d4a75cfefe98465d95a288 | [
"Apache-2.0"
] | 50 | 2015-01-01T00:14:04.000Z | 2020-11-26T04:44:30.000Z | 3rdparty/wsgi_intercept/mechanoid_intercept/__init__.py | arda2525/fixofx | 1792d94697af682ca1d4a75cfefe98465d95a288 | [
"Apache-2.0"
] | 3 | 2016-01-31T17:14:41.000Z | 2017-03-01T13:36:17.000Z | 3rdparty/wsgi_intercept/mechanoid_intercept/__init__.py | arda2525/fixofx | 1792d94697af682ca1d4a75cfefe98465d95a288 | [
"Apache-2.0"
] | 15 | 2015-10-29T09:04:21.000Z | 2022-01-19T17:33:25.000Z | """intercept connections made using a mechanoid Browser.
(see wsgi_intercept/__init__.py for examples)
"""
from wsgi_browser import Browser | 23.5 | 56 | 0.801418 | 19 | 141 | 5.631579 | 0.789474 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.120567 | 141 | 6 | 57 | 23.5 | 0.862903 | 0.70922 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.