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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c68018bb11f46c707d52efde1089991066ffb03d
| 163
|
py
|
Python
|
blackmamba/lib/future/moves/_thread.py
|
oz90210/blackmamba
|
65c82c8e99028d6fbb57098ce82d0a394df215a0
|
[
"MIT"
] | 2,151
|
2020-04-18T07:31:17.000Z
|
2022-03-31T08:39:18.000Z
|
blackmamba/lib/future/moves/_thread.py
|
oz90210/blackmamba
|
65c82c8e99028d6fbb57098ce82d0a394df215a0
|
[
"MIT"
] | 4,640
|
2015-07-08T16:19:08.000Z
|
2019-12-02T15:01:27.000Z
|
blackmamba/lib/future/moves/_thread.py
|
oz90210/blackmamba
|
65c82c8e99028d6fbb57098ce82d0a394df215a0
|
[
"MIT"
] | 698
|
2015-06-02T19:18:35.000Z
|
2022-03-29T16:57:15.000Z
|
from __future__ import absolute_import
from future.utils import PY3
if PY3:
from _thread import *
else:
__future_module__ = True
from thread import *
| 18.111111
| 38
| 0.748466
| 22
| 163
| 5.045455
| 0.5
| 0.18018
| 0.288288
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.015625
| 0.214724
| 163
| 8
| 39
| 20.375
| 0.851563
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.571429
| 0
| 0.571429
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
c6b4eaa217044230ea97ca7846e0be84b8585beb
| 130
|
py
|
Python
|
api/api/migrations/helpers/__init__.py
|
marzmehr/family-law-act-app
|
f036a23657e117eb04a8a0014e0153654ee97696
|
[
"Apache-2.0"
] | 4
|
2020-04-06T23:42:41.000Z
|
2022-03-20T18:32:59.000Z
|
api/api/migrations/helpers/__init__.py
|
marzmehr/family-law-act-app
|
f036a23657e117eb04a8a0014e0153654ee97696
|
[
"Apache-2.0"
] | 86
|
2020-03-11T01:33:07.000Z
|
2022-03-31T21:45:04.000Z
|
api/api/migrations/helpers/__init__.py
|
marzmehr/family-law-act-app
|
f036a23657e117eb04a8a0014e0153654ee97696
|
[
"Apache-2.0"
] | 10
|
2020-01-22T17:28:35.000Z
|
2021-07-29T20:42:22.000Z
|
from .helper_0021 import Migration_1_0_to_1_1
from .helper_0022 import Migration_1_1_to_1_2_1
from .clean_nones import clean_nones
| 43.333333
| 47
| 0.892308
| 27
| 130
| 3.740741
| 0.444444
| 0.19802
| 0.316832
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 0.084615
| 130
| 3
| 48
| 43.333333
| 0.705882
| 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
| 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
|
c6c75f052892c4c8ca0ee3265414864b66ace046
| 476
|
py
|
Python
|
tests/test_object_cache.py
|
u-masao/object-cache
|
d491b84b00d3f988e7cb2ac4c45357043ecf38b9
|
[
"MIT"
] | 1
|
2020-10-19T02:18:32.000Z
|
2020-10-19T02:18:32.000Z
|
tests/test_object_cache.py
|
u-masao/object-cache
|
d491b84b00d3f988e7cb2ac4c45357043ecf38b9
|
[
"MIT"
] | null | null | null |
tests/test_object_cache.py
|
u-masao/object-cache
|
d491b84b00d3f988e7cb2ac4c45357043ecf38b9
|
[
"MIT"
] | null | null | null |
from object_cache import object_cache
import object_cache as oc
@object_cache
def add(a, b):
return a + b
def test_cache_hit():
assert add(1, 2) == 3
assert add(2, 3) == 5
assert add(1, 2) == 3
def test_enable_print():
oc.enable_print = True
assert add(1, 2) == 3
assert add(2, 3) == 5
assert add(1, 2) == 3
def test_disable():
oc.disable_cache = True
assert add(1, 2) == 3
assert add(2, 3) == 5
assert add(1, 2) == 3
| 15.866667
| 37
| 0.590336
| 84
| 476
| 3.214286
| 0.261905
| 0.3
| 0.222222
| 0.244444
| 0.648148
| 0.481481
| 0.481481
| 0.481481
| 0.481481
| 0.481481
| 0
| 0.078261
| 0.27521
| 476
| 29
| 38
| 16.413793
| 0.704348
| 0
| 0
| 0.473684
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.473684
| 1
| 0.210526
| false
| 0
| 0.105263
| 0.052632
| 0.368421
| 0.105263
| 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
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
c6d43d5d0c405a48e719525de5ecd44155d46642
| 156
|
py
|
Python
|
config.py
|
surugh/occe_api_v3
|
364f0d736db7085d452c4269cf26cabaca5555a9
|
[
"MIT"
] | null | null | null |
config.py
|
surugh/occe_api_v3
|
364f0d736db7085d452c4269cf26cabaca5555a9
|
[
"MIT"
] | null | null | null |
config.py
|
surugh/occe_api_v3
|
364f0d736db7085d452c4269cf26cabaca5555a9
|
[
"MIT"
] | null | null | null |
TRADE = {
'access': 'trade_pub_key',
'secret': 'trade_pri_key'
}
CASHIER = {
'access': 'trade_pub_key',
'secret': 'trade_pub_key'
}
| 17.333333
| 31
| 0.564103
| 18
| 156
| 4.444444
| 0.388889
| 0.3
| 0.4125
| 0.425
| 0.7
| 0.7
| 0
| 0
| 0
| 0
| 0
| 0
| 0.25641
| 156
| 8
| 32
| 19.5
| 0.689655
| 0
| 0
| 0.25
| 0
| 0
| 0.513514
| 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
| 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
|
c6d5ef8f07d71098663073a8588a97c208497b7f
| 39,620
|
py
|
Python
|
ironic_oneview_cli/tests/functional/test_functional_ironic_oneview_cli.py
|
HewlettPackard/ironic-oneview-cli
|
54d27ec6ac3bc62d28736e41cef45227659c0079
|
[
"Apache-2.0"
] | 6
|
2017-12-07T18:46:30.000Z
|
2018-03-19T03:44:28.000Z
|
ironic_oneview_cli/tests/functional/test_functional_ironic_oneview_cli.py
|
HewlettPackard/ironic-oneview-cli
|
54d27ec6ac3bc62d28736e41cef45227659c0079
|
[
"Apache-2.0"
] | 11
|
2017-12-12T20:36:02.000Z
|
2018-03-02T18:18:38.000Z
|
ironic_oneview_cli/tests/functional/test_functional_ironic_oneview_cli.py
|
HewlettPackard/ironic-oneview-cli
|
54d27ec6ac3bc62d28736e41cef45227659c0079
|
[
"Apache-2.0"
] | null | null | null |
# Copyright (2015-2017) Hewlett Packard Enterprise Development LP
# Copyright (2015-2017) Universidade Federal de Campina Grande
# 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 argparse
import mock
import unittest
from ironic_oneview_cli.create_flavor_shell import (
commands as create_flavor_cmd)
from ironic_oneview_cli.create_node_shell import (
commands as create_node_cmd)
from ironic_oneview_cli.create_port_shell import (
commands as port_create_cmd)
from ironic_oneview_cli.delete_node_shell import (
commands as delete_node_cmd)
from ironic_oneview_cli.tests import stubs
POOL_OF_STUB_IRONIC_NODES = [
stubs.StubIronicNode(
id=1,
uuid='111111111-2222-8888-9999-000000000000',
chassis_uuid='aaaaaaaa-1111-bbbb-2222-cccccccccccc',
maintenance=False,
provision_state='enroll',
ports=[
{'id': 987,
'uuid': '11111111-2222-3333-4444-555555555555',
'node_uuid': '66666666-7777-8888-9999-000000000000',
'address': 'AA:BB:CC:DD:EE:FF',
'extra': {}}
],
driver='fake_oneview',
driver_info={'user': 'foo',
'password': 'bar'},
properties={'num_cpu': 4},
name='fake-node-1',
extra={}
),
stubs.StubIronicNode(
id=2,
uuid='22222222-3333-8888-9999-000000000000',
chassis_uuid='aaaaaaaa-1111-bbbb-2222-cccccccccccc',
maintenance=False,
provision_state='enroll',
ports=[
{'id': 987,
'uuid': '11111111-2222-3333-4444-555555555555',
'node_uuid': '66666666-7777-8888-9999-000000000000',
'address': 'AA:BB:CC:DD:EE:FF',
'extra': {}}
],
driver='fake_oneview',
driver_info={'server_hardware_uri': "/rest/server-hardware/22222",
'user': 'foo',
'password': 'bar'},
properties={'num_cpu': 4},
name='fake-node-2',
extra={}
),
stubs.StubIronicNode(
id=3,
uuid='33333333-4444-8888-9999-000000000000',
chassis_uuid='aaaaaaaa-1111-bbbb-2222-cccccccccccc',
maintenance=False,
provision_state='enroll',
ports=[
{'id': 987,
'uuid': '11111111-2222-3333-4444-555555555555',
'node_uuid': '66666666-7777-8888-9999-000000000000',
'address': 'AA:BB:CC:DD:EE:FF',
'extra': {}}
],
driver='fake_oneview',
driver_info={'server_hardware_uri': "/rest/server-hardware/22222",
'user': 'foo',
'password': 'bar'},
properties={'memory_mb': 32768,
'cpu_arch': 'x86_64',
'local_gb': 120,
'cpus': 8,
'capabilities':
"server_hardware_type_uri:"
"/rest/server-hardware-types/1111112222233333,"
"enclosure_group_uri:"
"/rest/enclosure-groups/1111112222233333,"
"server_profile_template_uri:"
"/rest/server-profile-templates/1111112222233333"
},
instance_uuid='1111-2222-3333-4444-5555',
name='fake-node-3',
extra={}
),
stubs.StubIronicNode(
id=4,
uuid='4444444-3333-8888-9999-000000000000',
chassis_uuid='aaaaaaaa-1111-bbbb-2222-cccccccccccc',
maintenance=False,
provision_state='enroll',
ports=[{}],
driver='fake',
driver_info={'server_hardware_uri': "/rest/server-hardware/22222",
'user': 'foo',
'password': 'bar'},
properties={'num_cpu': 4},
name='fake-node-4',
extra={}
),
stubs.StubIronicNode(
id=5,
uuid='33333333-4444-8888-9999-11111111111',
chassis_uuid='aaaaaaaa-1111-bbbb-2222-cccccccccccc',
maintenance=False,
provision_state='enroll',
ports=[
{'id': 345,
'uuid': '11111111-2222-3333-4444-555555555555',
'node_uuid': '66666666-7777-8888-9999-000000000000',
'address': 'AA:BB:CC:DD:EE:FF',
'extra': {}}
],
driver='fake_oneview',
driver_info={'server_hardware_uri': "/rest/server-hardware/22222",
'user': 'foo',
'password': 'bar'},
properties={'memory_mb': 32768,
'cpu_arch': 'x86_64',
'local_gb': 120,
'cpus': 8,
'capabilities':
"server_hardware_type_uri:"
"/rest/server-hardware-types/1111112222233333,"
"enclosure_group_uri:"
"/rest/enclosure-groups/1111112222233333,"
"server_profile_template_uri:"
"/rest/server-profile-templates/1111112222233333"
},
instance_uuid='1111-2222-3333-4444-5555',
name='fake-node-5',
extra={}
),
stubs.StubIronicNode(
id=6,
uuid='33333333-4444-8888-9999-22222222222',
chassis_uuid='aaaaaaaa-1111-bbbb-2222-cccccccccccc',
maintenance=False,
maintenance_reason='',
provision_state='enroll',
ports=[
{'id': 345,
'uuid': '11111111-2222-3333-4444-555555555555',
'node_uuid': '66666666-7777-8888-9999-000000000000',
'address': 'AA:BB:CC:DD:EE:FF',
'extra': {}}
],
driver='fake_oneview',
driver_info={'server_hardware_uri': "/rest/server-hardware/22222",
'user': 'foo',
'password': 'bar'},
properties={'memory_mb': 32768,
'cpu_arch': 'x86_64',
'local_gb': 120,
'cpus': 8,
'capabilities':
"server_hardware_type_uri:"
"/rest/server-hardware-types/1111112222233333,"
"enclosure_group_uri:"
"/rest/enclosure-groups/1111112222233333,"
"server_profile_template_uri:"
"/rest/server-profile-templates/1111112222233333"
},
instance_uuid='1111-2222-3333-4444-5555',
name='fake-node-6',
extra={}
),
stubs.StubIronicNode(
id=7,
uuid='33333333-4444-8888-9999-22222222222',
chassis_uuid='aaaaaaaa-1111-bbbb-2222-cccccccccccc',
maintenance=False,
maintenance_reason='',
provision_state='enroll',
ports=[
{'id': 345,
'uuid': '11111111-2222-3333-4444-555555555555',
'node_uuid': '66666666-7777-8888-9999-000000000000',
'address': 'AA:BB:CC:DD:EE:FF',
'extra': {}}
],
driver='fake_oneview',
driver_info={'server_hardware_uri': "/rest/server-hardware/11111",
'user': 'foo',
'password': 'bar'},
properties={'memory_mb': 32768,
'cpu_arch': 'x86_64',
'local_gb': 120,
'cpus': 8,
'capabilities':
"server_hardware_type_uri:"
"/rest/server-hardware-types/1111112222233333,"
"enclosure_group_uri:"
"/rest/enclosure-groups/1111112222233333,"
"server_profile_template_uri:"
"/rest/server-profile-templates/1111112222233333"
},
name='fake-node-7',
extra={}
),
stubs.StubIronicNode(
id=8,
uuid='44444444-5555-6666-7777-88888888888',
chassis_uuid='aaaaaaaa-1111-bbbb-2222-cccccccccccc',
maintenance=False,
maintenance_reason='',
provision_state='enroll',
ports=[],
driver='fake_oneview',
driver_info={'server_hardware_uri': "/rest/server-hardware/22222",
"use_oneview_ml2_driver": True,
'user': 'foo',
'password': 'bar'},
properties={'memory_mb': 32768,
'cpu_arch': 'x86_64',
'local_gb': 120,
'cpus': 8,
'capabilities':
"server_hardware_type_uri:"
"/rest/server-hardware-types/1111112222233333,"
"enclosure_group_uri:"
"/rest/enclosure-groups/1111112222233333,"
"server_profile_template_uri:"
"/rest/server-profile-templates/1111112222233333"
},
name='fake-node-8',
extra={}
)
]
STUB_ENCLOSURE_GROUP = stubs.StubEnclosureGroup(
name='ENCLGROUP',
uuid='22222222-TTTT-BBBB-9999-AAAAAAAAAAA',
uri='/rest/server-hardware/22222222-TTTT-BBBB-9999-AAAAAAAAAAA',
)
STUB_SERVER_HARDWARE_TYPE = stubs.StubServerHardwareType(
name='TYPETYPETYPE',
uuid='22222222-7777-8888-9999-AAAAAAAAAAA',
uri='/rest/server-hardware/22222222-7777-8888-9999-AAAAAAAAAAA',
)
POOL_OF_SERVER_HARDWARE = [
{
'name': 'AAAAA',
'uuid': '11111111-7777-8888-9999-000000000000',
'uri': '/rest/server-hardware/11111',
'powerState': 'Off',
'serverProfileUri': '',
'serverHardwareTypeUri':
'/rest/server-hardware-types/111112222233333',
'serverGroupUri': '/rest/enclosure-groups/1111112222233333',
'status': 'OK',
'state': 'Unknown',
'stateReason': '',
'locationUri': '/rest/enclosures/1111112222233333',
'processorCount': 12,
'processorCoreCount': 12,
'memoryMb': 16384,
'portMap': {},
'mpHostInfo': {}
},
{
'name': 'BBBBB',
'uuid': '22222222-7777-8888-9999-000000000000',
'uri': '/rest/server-hardware/22222',
'powerState': 'Off',
'serverProfileUri': '/rest/server-profile/1111-2222',
'serverHardwareTypeUri':
'/rest/server-hardware-types/111111222233333',
'serverGroupUri': '/rest/enclosure-groups/1111112222233333',
'status': 'OK',
'state': 'Unknown',
'stateReason': '',
'locationUri': '/rest/enclosures/1111112222233333',
'processorCount': 12,
'processorCoreCount': 12,
'memoryMb': 16384,
'portMap': {
'deviceSlots': [{
'physicalPorts': [{
'type': 'Ethernet',
'virtualPorts': [{
'portFunction': 'a',
'mac': 'aa:bb:cc:dd:ee:ff'
}]
}]
}]
},
'mpHostInfo': {}
},
{
'name': 'CCCCC',
'uuid': '33333333-7777-8888-9999-000000000000',
'uri': '/rest/server-hardware/33333',
'powerState': 'Off',
'serverProfileUri': '',
'serverHardwareTypeUri':
'/rest/server-hardware-types/111111222223333',
'serverGroupUri': '/rest/enclosure-groups/1111112222233333',
'status': 'OK',
'state': 'Unknown',
'stateReason': '',
'locationUri': '/rest/enclosures/1111112222233333',
'processorCount': 12,
'processorCoreCount': 12,
'memoryMb': 16384,
'portMap': {},
'mpHostInfo': {}
},
{
'name': 'DDDDD',
'uuid': '44444444-7777-8888-9999-000000000000',
'uri': '/rest/server-hardware/44444',
'powerState': 'Off',
'serverProfileUri': '',
'serverHardwareTypeUri':
'/rest/server-hardware-types/111111222223333',
'serverGroupUri': '/rest/enclosure-groups/1111112222233333',
'status': 'OK',
'state': 'Unknown',
'stateReason': '',
'locationUri': '/rest/enclosures/1111112222233333',
'processorCount': 12,
'processorCoreCount': 12,
'memoryMb': 16384,
'portMap': {},
'mpHostInfo': {}
},
{
'name': 'RackServer',
'uuid': '55555555-7777-8888-9999-111111',
'uri': '/rest/server-hardware/55555',
'powerState': 'Off',
'serverProfileUri': '',
'serverHardwareTypeUri':
'/rest/server-hardware-types/111111222223333',
'serverGroupUri': None,
'status': 'OK',
'state': 'Unknown',
'stateReason': '',
'locationUri': None,
'processorCount': 12,
'processorCoreCount': 12,
'memoryMb': 16384,
'portMap': None,
'mpHostInfo': {}
}
]
POOL_OF_SERVER_PROFILE_TEMPLATE = [
{
'uri': '/rest/server-profile-templates/1111112222233333',
'name': 'TEMPLATETEMPLATETEMPLATE',
'serverHardwareTypeUri':
'/rest/server-hardware-types/111111222223333',
'enclosureGroupUri': '/rest/enclosure-groups/1111112222233333',
'connections': [],
'boot': {}
}
]
POOL_OF_STUB_NOVA_FLAVORS = [
stubs.StubNovaFlavor(
id=123,
uuid='66666666-7777-8888-9999-000000000000',
name='fake-flavor',
memory_mb=1024,
ram_mb=1024,
vcpus=1,
cpus=1,
cpu_arch='x64',
disk=100,
root_gb=100,
ephemeral_gb=0,
flavorid='abc',
swap=0,
rxtx_factor=1,
vcpu_weight=1,
disabled=False,
is_public=True,
extra_specs={},
projects=[]
)
]
STUB_PARAMETERS = stubs.StubParameters(
os_ironic_node_driver='fake_oneview',
os_driver='fake_oneview',
os_power_interface='fake_oneview',
os_management_interface='fake_oneview',
os_inspect_interface='fake_oneview',
os_deploy_interface='fake_oneview',
os_ironic_deploy_kernel_uuid='11111-22222-33333-44444-55555',
os_ironic_deploy_ramdisk_uuid='55555-44444-33333-22222-11111'
)
@mock.patch('ironic_oneview_cli.common.get_ironic_client')
@mock.patch('ironic_oneview_cli.common.oneview_client.OneViewClient')
class FunctionalTestIronicOneviewCli(unittest.TestCase):
def setUp(self):
self.args = argparse.Namespace(
ov_auth_url='https://my-oneview',
ov_username='ov-user',
ov_password='secret',
ov_insecure='False',
ov_cacert='ca_file',
os_auth_url='http://something',
os_username='my_name',
os_password='secret',
os_project_id='my_tenant_id',
os_project_name='my_tenant',
os_user_domain_id='default',
os_user_domain_name='Default',
os_project_domain_id='default',
os_project_domain_name='Default',
os_tenant_name='my_tenant',
insecure=True,
os_cacert='',
os_cert='',
os_inspection_enabled=False,
os_ironic_node_driver=STUB_PARAMETERS.os_ironic_node_driver,
os_driver=STUB_PARAMETERS.os_driver,
os_power_interface=STUB_PARAMETERS.os_power_interface,
os_management_interface=STUB_PARAMETERS.os_management_interface,
os_inspect_interface=STUB_PARAMETERS.os_inspect_interface,
os_deploy_interface=STUB_PARAMETERS.os_deploy_interface,
os_ironic_deploy_kernel_uuid=(
STUB_PARAMETERS.os_ironic_deploy_kernel_uuid
),
os_ironic_deploy_ramdisk_uuid=(
STUB_PARAMETERS.os_ironic_deploy_ramdisk_uuid
),
all=False,
server_profile_template_name=None,
use_oneview_ml2_driver=False,
classic=False,
number=None,
nodes=None,
mac=None,
name=None,
node=None,
server_hardware_uuid=None,
server_profile_template=None
)
@mock.patch('ironic_oneview_cli.common.builtin_input')
def test_node_creation_no_args(
self, mock_input, mock_oneview_client, mock_ironic_client
):
oneview_client = mock_oneview_client.return_value
oneview_client.server_hardware.get_all.return_value = (
POOL_OF_SERVER_HARDWARE
)
oneview_client.server_profile_templates.get_all.return_value = (
POOL_OF_SERVER_PROFILE_TEMPLATE
)
oneview_client.server_hardware.get.return_value = (
POOL_OF_SERVER_HARDWARE[1]
)
spt_index = 0
sh_index = 0
mock_input.side_effect = [
str(spt_index + 1),
str(sh_index + 1)
]
create_node_cmd.do_node_create(self.args)
selected_sh = POOL_OF_SERVER_HARDWARE[sh_index]
selected_spt = POOL_OF_SERVER_PROFILE_TEMPLATE[spt_index]
attrs = self._create_attrs_for_node(selected_sh, selected_spt)
ironic_client = mock_ironic_client.return_value
ironic_client.node.create.assert_called_with(
**attrs
)
@mock.patch('ironic_oneview_cli.common.builtin_input')
def test_node_creation_with_oneview_ml2_driver_interactive(
self, mock_input, mock_oneview_client, mock_ironic_client
):
self.args.use_oneview_ml2_driver = True
oneview_client = mock_oneview_client.return_value
oneview_client.server_hardware.get_all.return_value = (
POOL_OF_SERVER_HARDWARE
)
oneview_client.server_profile_templates.get_all.return_value = (
POOL_OF_SERVER_PROFILE_TEMPLATE
)
oneview_client.server_hardware.get.return_value = (
POOL_OF_SERVER_HARDWARE[1]
)
spt_index = 0
sh_index = 0
mock_input.side_effect = [
str(spt_index + 1),
str(sh_index + 1)
]
create_node_cmd.do_node_create(self.args)
selected_sh = POOL_OF_SERVER_HARDWARE[sh_index]
selected_spt = POOL_OF_SERVER_PROFILE_TEMPLATE[spt_index]
attrs = self._create_attrs_for_node(selected_sh, selected_spt)
attrs['network_interface'] = 'neutron'
ironic_client = mock_ironic_client.return_value
ironic_client.node.create.assert_called_with(
**attrs
)
@mock.patch('ironic_oneview_cli.facade.Facade.'
'get_server_hardware_mac_from_ilo')
def test_node_creation_with_oneview_ml2_driver_noninteractive(
self, mock_mac_from_ilo, mock_oneview_client, mock_ironic_client
):
self.args.use_oneview_ml2_driver = True
mock_mac_from_ilo.return_valur = 'aa:bb:cc:dd:ee:ff'
oneview_client = mock_oneview_client.return_value
oneview_client.server_hardware.get_all.return_value = (
POOL_OF_SERVER_HARDWARE
)
oneview_client.server_profile_templates.get_all.return_value = (
POOL_OF_SERVER_PROFILE_TEMPLATE
)
spt_index = 0
sh_index = 3
oneview_client.server_hardware.get.return_value = (
POOL_OF_SERVER_HARDWARE[sh_index]
)
self.args.server_profile_template = (
POOL_OF_SERVER_PROFILE_TEMPLATE[spt_index]['name']
)
selected_sh = POOL_OF_SERVER_HARDWARE[sh_index]
selected_spt = POOL_OF_SERVER_PROFILE_TEMPLATE[spt_index]
self.args.server_hardware_uuid = '44444'
self.args.mac = "00:29:15:80:4E:4A"
create_node_cmd.do_node_create(self.args)
attrs = self._create_attrs_for_node(selected_sh, selected_spt)
attrs['network_interface'] = 'neutron'
ironic_client = mock_ironic_client.return_value
ironic_client.node.create.assert_called_with(
**attrs
)
@mock.patch('ironic_oneview_cli.common.builtin_input')
def test_node_creation_with_classic_flag(
self, mock_input, mock_oneview_client, mock_ironic_client
):
self.args.classic = True
oneview_client = mock_oneview_client.return_value
oneview_client.server_hardware.get_all.return_value = (
POOL_OF_SERVER_HARDWARE
)
oneview_client.server_profile_templates.get_all.return_value = (
POOL_OF_SERVER_PROFILE_TEMPLATE
)
oneview_client.server_hardware.get.return_value = (
POOL_OF_SERVER_HARDWARE[1]
)
spt_index = 0
sh_index = 0
mock_input.side_effect = [
str(spt_index + 1),
str(sh_index + 1)
]
create_node_cmd.do_node_create(self.args)
selected_sh = POOL_OF_SERVER_HARDWARE[sh_index]
selected_spt = POOL_OF_SERVER_PROFILE_TEMPLATE[spt_index]
attrs = self._create_attrs_for_node(selected_sh, selected_spt)
attrs['driver'] = STUB_PARAMETERS.os_ironic_node_driver
ironic_client = mock_ironic_client.return_value
ironic_client.node.create.assert_called_with(
**attrs
)
@mock.patch('ironic_oneview_cli.common.builtin_input')
def test_node_creation_rack_servers(
self, mock_input, mock_oneview_client, mock_ironic_client
):
oneview_client = mock_oneview_client.return_value
oneview_client.server_hardware.get_all.return_value = (
POOL_OF_SERVER_HARDWARE
)
oneview_client.server_profile_templates.get_all.return_value = (
POOL_OF_SERVER_PROFILE_TEMPLATE
)
oneview_client.server_hardware.get.return_value = (
POOL_OF_SERVER_HARDWARE[1]
)
spt_index = 0
sh_index = 4
mock_input.side_effect = [
str(spt_index + 1),
str(sh_index + 1)
]
create_node_cmd.do_node_create(self.args)
selected_sh = POOL_OF_SERVER_HARDWARE[sh_index]
selected_spt = POOL_OF_SERVER_PROFILE_TEMPLATE[spt_index]
attrs = self._create_attrs_for_node(selected_sh, selected_spt)
attrs['properties']['capabilities'] = (
'server_hardware_type_uri:%s,'
'server_profile_template_uri:%s' % (
selected_sh.get("serverHardwareTypeUri"),
selected_spt.get('uri')
)
)
ironic_client = mock_ironic_client.return_value
ironic_client.node.create.assert_called_with(
**attrs
)
@mock.patch('ironic_oneview_cli.common.builtin_input')
def test_node_creation_inspection_enabled(
self, mock_input, mock_oneview_client, mock_ironic_client
):
self.args.os_inspection_enabled = True
oneview_client = mock_oneview_client.return_value
oneview_client.server_hardware.get_all.return_value = (
POOL_OF_SERVER_HARDWARE
)
oneview_client.server_profile_templates.get_all.return_value = (
POOL_OF_SERVER_PROFILE_TEMPLATE
)
oneview_client.server_hardware.get.return_value = (
POOL_OF_SERVER_HARDWARE[1]
)
spt_index = 0
sh_index = 0
mock_input.side_effect = [
str(spt_index + 1),
str(sh_index + 1)
]
create_node_cmd.do_node_create(self.args)
selected_sh = POOL_OF_SERVER_HARDWARE[sh_index]
selected_spt = POOL_OF_SERVER_PROFILE_TEMPLATE[spt_index]
attrs = self._create_attrs_for_node(selected_sh, selected_spt)
attrs['properties'] = {
'capabilities': 'server_hardware_type_uri:%s,'
'server_profile_template_uri:%s,'
'enclosure_group_uri:%s' % (
selected_sh.get("serverHardwareTypeUri"),
selected_spt.get("uri"),
selected_sh.get("serverGroupUri")
)
}
ironic_client = mock_ironic_client.return_value
ironic_client.node.create.assert_called_with(
**attrs
)
@mock.patch('ironic_oneview_cli.common.builtin_input')
def test_node_creation_number_argument(
self, mock_input, mock_oneview_client, mock_ironic_client
):
self.args.number = 2
oneview_client = mock_oneview_client.return_value
oneview_client.server_hardware.get_all.return_value = (
POOL_OF_SERVER_HARDWARE
)
oneview_client.server_profile_templates.get_all.return_value = (
POOL_OF_SERVER_PROFILE_TEMPLATE
)
oneview_client.server_hardware.get.return_value = (
POOL_OF_SERVER_HARDWARE[1]
)
spt_index = 0
mock_input.side_effect = [
str(spt_index + 1),
]
create_node_cmd.do_node_create(self.args)
ironic_client = mock_ironic_client.return_value
self.assertEqual(
self.args.number, ironic_client.node.create.call_count
)
@mock.patch('ironic_oneview_cli.common.builtin_input')
def test_node_creation_spt_argument(
self, mock_input, mock_oneview_client, mock_ironic_client
):
oneview_client = mock_oneview_client.return_value
oneview_client.server_hardware.get_all.return_value = (
POOL_OF_SERVER_HARDWARE
)
oneview_client.server_profile_templates.get_all.return_value = (
POOL_OF_SERVER_PROFILE_TEMPLATE
)
oneview_client.server_hardware.get.return_value = (
POOL_OF_SERVER_HARDWARE[1]
)
self.args.server_profile_template_name = (
'TEMPLATETEMPLATETEMPLATE'
)
sh_index = 0
spt_index = 0
mock_input.side_effect = [
str(sh_index + 1), '1'
]
create_node_cmd.do_node_create(self.args)
selected_sh = POOL_OF_SERVER_HARDWARE[sh_index]
selected_spt = POOL_OF_SERVER_PROFILE_TEMPLATE[spt_index]
attrs = self._create_attrs_for_node(selected_sh, selected_spt)
ironic_client = mock_ironic_client.return_value
ironic_client.node.create.assert_called_with(
**attrs
)
@mock.patch('ironic_oneview_cli.common.builtin_input')
def test_node_creation_spt_and_number_arguments(
self, mock_input, mock_oneview_client, mock_ironic_client
):
oneview_client = mock_oneview_client.return_value
oneview_client.server_hardware.get_all.return_value = (
POOL_OF_SERVER_HARDWARE
)
oneview_client.server_profile_templates.get_all.return_value = (
POOL_OF_SERVER_PROFILE_TEMPLATE
)
oneview_client.server_hardware.get.return_value = (
POOL_OF_SERVER_HARDWARE[1]
)
self.args.server_profile_template_name = (
'TEMPLATETEMPLATETEMPLATE'
)
self.args.number = 3
create_node_cmd.do_node_create(self.args)
sh_index = 0
spt_index = 0
selected_sh = POOL_OF_SERVER_HARDWARE[sh_index]
selected_spt = POOL_OF_SERVER_PROFILE_TEMPLATE[spt_index]
attrs = self._create_attrs_for_node(selected_sh, selected_spt)
ironic_client = mock_ironic_client.return_value
ironic_client.node.create.assert_any_call(
**attrs
)
self.assertEqual(
self.args.number, ironic_client.node.create.call_count
)
@mock.patch('ironic_oneview_cli.common.builtin_input')
@mock.patch('ironic_oneview_cli.common.get_nova_client')
def test_flavor_creation_interactive(
self, mock_nova_client, mock_input,
mock_oneview_client, mock_ironic_client
):
ironic_client = mock_ironic_client.return_value
ironic_client.node.list.return_value = (
POOL_OF_STUB_IRONIC_NODES
)
# Nodes 0 and 1 doesn't have the required attributes, will not be shown
node_selected = POOL_OF_STUB_IRONIC_NODES[2]
flavor_name = 'my-flavor'
mock_input.side_effect = ['1', flavor_name, 'n']
create_flavor_cmd.do_flavor_create(self.args)
attrs = {
'name': flavor_name,
'ram': node_selected.properties.get('memory_mb'),
'vcpus': node_selected.properties.get('cpus'),
'disk': node_selected.properties.get('local_gb')
}
nova_client = mock_nova_client.return_value
nova_client.flavors.create.assert_called_with(
**attrs
)
@mock.patch('ironic_oneview_cli.common.get_nova_client')
def test_flavor_creation_noninteractive(
self, mock_nova_client, mock_oneview_client, mock_ironic_client
):
ironic_client = mock_ironic_client.return_value
ironic_client.node.list.return_value = (
POOL_OF_STUB_IRONIC_NODES
)
# Nodes 0 and 1 doesn't have the required attributes, will not be shown
node_selected = POOL_OF_STUB_IRONIC_NODES[2]
self.args.name = 'my-flavor'
self.args.node = node_selected.uuid
create_flavor_cmd.do_flavor_create(self.args)
attrs = {
'name': self.args.name,
'ram': node_selected.properties.get('memory_mb'),
'vcpus': node_selected.properties.get('cpus'),
'disk': node_selected.properties.get('local_gb')
}
nova_client = mock_nova_client.return_value
nova_client.flavors.create.assert_called_with(
**attrs
)
@mock.patch('ironic_oneview_cli.common.builtin_input')
def test_delete_node(self, mock_input,
mock_oneview_client, mock_ironic_client):
ironic_client = mock_ironic_client.return_value
ironic_client.node.list.return_value = POOL_OF_STUB_IRONIC_NODES
self.args.all = True
mock_input.side_effect = ['y']
delete_node_cmd.do_node_delete(self.args)
self.assertEqual(8, ironic_client.node.delete.call_count)
def test_port_creation_no_args(
self, mock_oneview_client, mock_ironic_client
):
server_hardware = POOL_OF_SERVER_HARDWARE[1]
ironic_node = POOL_OF_STUB_IRONIC_NODES[3]
oneview_client = mock_oneview_client.return_value
oneview_client.server_hardware.get.return_value = server_hardware
ironic_client = mock_ironic_client.return_value
ironic_client.node.get.return_value = ironic_node
self.args.node = ironic_node.uuid
port_create_cmd.do_port_create(self.args)
attrs = self._create_attrs_for_port(server_hardware, ironic_node)
ironic_client.port.create.assert_called_with(
**attrs
)
def test_port_creation_with_mac(
self, mock_oneview_client, mock_ironic_client
):
server_hardware = POOL_OF_SERVER_HARDWARE[1]
ironic_node = POOL_OF_STUB_IRONIC_NODES[3]
oneview_client = mock_oneview_client.return_value
oneview_client.server_hardware.get.return_value = server_hardware
ironic_client = mock_ironic_client.return_value
ironic_client.node.get.return_value = ironic_node
self.args.node = ironic_node.uuid
self.args.mac = "aa:bb:cc:dd:ee:ff"
port_create_cmd.do_port_create(self.args)
attrs = self._create_attrs_for_port(server_hardware, ironic_node,
self.args.mac)
ironic_client.port.create.assert_called_with(
**attrs
)
def test_port_abort_creation_with_mac(
self, mock_oneview_client, mock_ironic_client
):
server_hardware = POOL_OF_SERVER_HARDWARE[1]
ironic_node = POOL_OF_STUB_IRONIC_NODES[3]
oneview_client = mock_oneview_client.return_value
oneview_client.server_hardware.get.return_value = server_hardware
ironic_client = mock_ironic_client.return_value
ironic_client.node.get.return_value = ironic_node
self.args.node = ironic_node.uuid
self.args.mac = "01:23:45:67:89:ab"
port_create_cmd.do_port_create(self.args)
ironic_client.port.create.assert_not_called()
def test_port_creation_with_oneview_ml2_driver(
self, mock_oneview_client, mock_ironic_client
):
server_hardware = POOL_OF_SERVER_HARDWARE[1]
ironic_node = POOL_OF_STUB_IRONIC_NODES[7]
oneview_client = mock_oneview_client.return_value
oneview_client.server_hardware.get.return_value = server_hardware
ironic_client = mock_ironic_client.return_value
ironic_client.node.get.return_value = ironic_node
self.args.node = ironic_node.uuid
port_create_cmd.do_port_create(self.args)
attrs = self._create_attrs_for_port(server_hardware, ironic_node)
ironic_client.port.create.assert_called_with(
**attrs
)
@mock.patch('ironic_oneview_cli.facade.Facade.'
'get_server_hardware_mac_from_ilo')
def test_port_creation_rack_server(
self, mock_mac_from_ilo, mock_oneview_client, mock_ironic_client
):
server_hardware = POOL_OF_SERVER_HARDWARE[4]
ironic_node = POOL_OF_STUB_IRONIC_NODES[6]
mac = "aa:bb:cc:dd:ee:ff"
oneview_client = mock_oneview_client.return_value
oneview_client.server_hardware.get.return_value = server_hardware
ironic_client = mock_ironic_client.return_value
ironic_client.node.get.return_value = ironic_node
mock_mac_from_ilo.return_value = mac
self.args.node = ironic_node.uuid
port_create_cmd.do_port_create(self.args)
attrs = self._create_attrs_for_port(server_hardware, ironic_node, mac)
ironic_client.port.create.assert_called_with(
**attrs
)
@mock.patch('ironic_oneview_cli.common.print_prompt')
def test_template_list(
self, mock_prompt, mock_oneview_client, mock_ironic_client
):
oneview_client = mock_oneview_client.return_value
oneview_client.server_profile_templates.get_all.return_value = (
POOL_OF_SERVER_PROFILE_TEMPLATE
)
oneview_client.server_hardware.get_all.return_value = (
POOL_OF_SERVER_HARDWARE
)
create_node_cmd.do_server_profile_template_list(self.args)
mock_prompt.called_with(
POOL_OF_SERVER_PROFILE_TEMPLATE,
[
'uuid',
'name',
'enclosure_group_name',
'server_hardware_type_name'
],
field_labels=[
'UUID',
'Name',
'Enclosure Group Name',
'Server Hardware Type Name'
]
)
@mock.patch('ironic_oneview_cli.common.print_prompt')
def test_hardware_list(
self, mock_prompt, mock_oneview_client, mock_ironic_client
):
oneview_client = mock_oneview_client.return_value
oneview_client.server_profile_templates.get_all.return_value = (
POOL_OF_SERVER_PROFILE_TEMPLATE
)
oneview_client.server_hardware.get_all.return_value = (
POOL_OF_SERVER_HARDWARE
)
self.args.server_profile_template = (
POOL_OF_SERVER_PROFILE_TEMPLATE[0].get('name')
)
create_node_cmd.do_server_hardware_list(self.args)
mock_prompt.called_with(
POOL_OF_SERVER_HARDWARE,
[
'uuid',
'name',
'cpus',
'memory_mb',
'local_gb',
'enclosure_group_name',
'server_hardware_type_name'
],
field_labels=[
'UUID',
'Name',
'CPUs',
'Memory MB',
'Local GB',
'Server Group Name',
'Server Hardware Type Name'
]
)
def _create_attrs_for_port(self, server_hardware, ironic_node, mac=None):
if not mac:
device_slot = server_hardware.get("portMap").get("deviceSlots")[0]
physical_port = device_slot.get("physicalPorts")[0]
mac = physical_port.get("virtualPorts")[0].get("mac")
local_link_connection = {}
if ironic_node.driver_info.get('use_oneview_ml2_driver'):
server_hardware_uri = ironic_node.driver_info.get(
"server_hardware_uri")
server_hardware_id = server_hardware_uri.split("/")[-1]
switch_info = (
'{"server_hardware_id": "%(server_hardware_id)s", '
'"bootable": "%(bootable)s"}') % {
'server_hardware_id': server_hardware_id,
'bootable': True}
local_link_connection = {
"switch_id": "01:23:45:67:89:ab",
"port_id": "",
"switch_info": switch_info
}
attrs = {
'address': mac,
'node_uuid': ironic_node.uuid,
'portgroup_uuid': None,
"local_link_connection": local_link_connection,
'pxe_enabled': True
}
return attrs
def _create_attrs_for_node(self, server_hardware, server_profile_template):
cpus = (server_hardware.get("processorCount") *
server_hardware.get("processorCoreCount"))
attrs = {
'name': server_hardware.get('name'),
'driver_info': {
'use_oneview_ml2_driver': self.args.use_oneview_ml2_driver,
'deploy_kernel': STUB_PARAMETERS.os_ironic_deploy_kernel_uuid,
'deploy_ramdisk':
STUB_PARAMETERS.os_ironic_deploy_ramdisk_uuid,
'server_hardware_uri':
server_hardware.get("uri"),
},
'properties': {
'cpus': cpus,
'memory_mb': server_hardware.get("memoryMb"),
'local_gb': server_hardware.get("local_gb"),
'cpu_arch': server_hardware.get("cpu_arch"),
'capabilities':
'server_hardware_type_uri:%s,'
'server_profile_template_uri:%s,'
'enclosure_group_uri:%s' % (
server_hardware.get("serverHardwareTypeUri"),
server_profile_template.get("uri"),
server_hardware.get("serverGroupUri")
)
}
}
if self.args.classic:
attrs['driver'] = STUB_PARAMETERS.os_ironic_node_driver
else:
attrs['driver'] = STUB_PARAMETERS.os_driver
attrs['power_interface'] = STUB_PARAMETERS.os_power_interface
attrs['management_interface'] = (
STUB_PARAMETERS.os_management_interface
)
attrs['inspect_interface'] = STUB_PARAMETERS.os_inspect_interface
attrs['deploy_interface'] = STUB_PARAMETERS.os_deploy_interface
return attrs
| 35.629496
| 79
| 0.601464
| 4,199
| 39,620
| 5.296261
| 0.089307
| 0.091281
| 0.031296
| 0.035613
| 0.812312
| 0.771617
| 0.752327
| 0.709879
| 0.686856
| 0.684248
| 0
| 0.069065
| 0.299066
| 39,620
| 1,111
| 80
| 35.661566
| 0.731735
| 0.021075
| 0
| 0.598169
| 0
| 0
| 0.210127
| 0.125854
| 0
| 0
| 0
| 0
| 0.018311
| 1
| 0.02238
| false
| 0.010173
| 0.008138
| 0
| 0.033571
| 0.002035
| 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
|
c6e61d8240e2feb1bf558a698281b0a97aab75d1
| 221
|
py
|
Python
|
core/testes.py
|
dayvison1/django_testes
|
4008aaf3ebc43cb3c3ecdeff3340cbdbfeb6414a
|
[
"MIT"
] | 1
|
2020-09-19T18:58:52.000Z
|
2020-09-19T18:58:52.000Z
|
core/testes.py
|
dayvison1/django_testes
|
4008aaf3ebc43cb3c3ecdeff3340cbdbfeb6414a
|
[
"MIT"
] | null | null | null |
core/testes.py
|
dayvison1/django_testes
|
4008aaf3ebc43cb3c3ecdeff3340cbdbfeb6414a
|
[
"MIT"
] | null | null | null |
xx='type=\"button\" class=\"btn btn-danger btn-sm btn-block\" data-toggle=\"modal\" data-target=\"#exampleModal\" onclick=\"setaDadosModal(\'{%idBotao i semana1 j%}\')\" >{%idBotao i semana1 j%}'
x='\"button\"'
print(xx)
| 55.25
| 195
| 0.660633
| 31
| 221
| 4.709677
| 0.677419
| 0.109589
| 0.205479
| 0.219178
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009804
| 0.076923
| 221
| 3
| 196
| 73.666667
| 0.705882
| 0
| 0
| 0
| 0
| 0.333333
| 0.78733
| 0.343891
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.333333
| 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
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
059c9e44eb75b5105a38bdb101c0db001857eb9a
| 2,177
|
py
|
Python
|
bob/pipelines/distributed/sge_queues.py
|
bioidiap/bob.pipelines
|
cbefdaf3b384ee11cb26a279281f007adc2d8f19
|
[
"BSD-3-Clause"
] | 1
|
2020-10-13T19:58:44.000Z
|
2020-10-13T19:58:44.000Z
|
bob/pipelines/distributed/sge_queues.py
|
bioidiap/bob.pipelines
|
cbefdaf3b384ee11cb26a279281f007adc2d8f19
|
[
"BSD-3-Clause"
] | null | null | null |
bob/pipelines/distributed/sge_queues.py
|
bioidiap/bob.pipelines
|
cbefdaf3b384ee11cb26a279281f007adc2d8f19
|
[
"BSD-3-Clause"
] | null | null | null |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Tiago de Freitas Pereira <tiago.pereira@idiap.ch>
"""SGE QUEUES"""
QUEUE_DEFAULT = {
"default": {
"queue": "q_1day",
"memory": "8GB",
"io_big": False,
"resource_spec": "",
"max_jobs": 128,
"resources": {"default": 1},
},
"q_1week": {
"queue": "q_1week",
"memory": "4GB",
"io_big": True,
"resource_spec": "",
"max_jobs": 24,
"resources": {"q_1week": 1},
},
"q_long_gpu": {
"queue": "q_long_gpu",
"memory": "30GB",
"io_big": False,
"resource_spec": "",
"resources": {"q_long_gpu": 1},
},
"q_gpu": {
"queue": "q_gpu",
"memory": "30GB",
"io_big": False,
"resource_spec": "",
"resources": {"q_gpu": 1},
},
"q_short_gpu": {
"queue": "q_short_gpu",
"memory": "30GB",
"io_big": False,
"resource_spec": "",
"max_jobs": 45,
"resources": {"q_short_gpu": 1},
},
}
QUEUE_GPU = {
"default": {
"queue": "q_short_gpu",
"memory": "30GB",
"io_big": False,
"resource_spec": "",
"max_jobs": 45,
"resources": "",
},
"q_1day": {
"queue": "q_1day",
"memory": "4GB",
"io_big": False,
"resource_spec": "",
"max_jobs": 48,
"resources": {"q_1day": 1},
},
"q_1week": {
"queue": "q_1week",
"memory": "4GB",
"io_big": True,
"resource_spec": "",
"resources": {"q_1week": 1},
},
"q_short_gpu": {
"queue": "q_short_gpu",
"memory": "30GB",
"io_big": False,
"resource_spec": "",
"max_jobs": 45,
"resources": {"q_short_gpu": 1},
},
"q_gpu": {
"queue": "q_gpu",
"memory": "30GB",
"io_big": False,
"resource_spec": "",
"resources": {"q_gpu": 1},
},
"q_long_gpu": {
"queue": "q_long_gpu",
"memory": "30GB",
"io_big": False,
"resource_spec": "",
"resources": {"q_long_gpu": 1},
},
}
| 23.159574
| 51
| 0.438677
| 224
| 2,177
| 3.941964
| 0.191964
| 0.074745
| 0.101925
| 0.183465
| 0.766704
| 0.732729
| 0.732729
| 0.667044
| 0.667044
| 0.667044
| 0
| 0.036853
| 0.35186
| 2,177
| 93
| 52
| 23.408602
| 0.588944
| 0.050988
| 0
| 0.735632
| 0
| 0
| 0.374636
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
059e0aad87aa07ff37ae14ef680c535a420d5685
| 88
|
py
|
Python
|
imessage_reader/__init__.py
|
xern/imessage_reader
|
d4e57e60b5460376e9c0cfcc3bfef5418b53fdf1
|
[
"MIT"
] | 16
|
2019-07-12T19:50:04.000Z
|
2022-03-23T02:50:11.000Z
|
imessage_reader/__init__.py
|
xern/imessage_reader
|
d4e57e60b5460376e9c0cfcc3bfef5418b53fdf1
|
[
"MIT"
] | 10
|
2020-10-23T09:33:35.000Z
|
2021-11-09T09:30:52.000Z
|
imessage_reader/__init__.py
|
xern/imessage_reader
|
d4e57e60b5460376e9c0cfcc3bfef5418b53fdf1
|
[
"MIT"
] | 6
|
2020-10-23T11:49:39.000Z
|
2021-08-06T14:47:23.000Z
|
# Import all Python files in the imessage_reader folder
# from imessage_reader import *
| 29.333333
| 55
| 0.806818
| 13
| 88
| 5.307692
| 0.769231
| 0.405797
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.159091
| 88
| 2
| 56
| 44
| 0.932432
| 0.943182
| 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
|
05b30966dac8d354a75963c341fe672d6d6b3a7a
| 569
|
py
|
Python
|
polyaxon/k8s_events_handlers/apps.py
|
elyase/polyaxon
|
1c19f059a010a6889e2b7ea340715b2bcfa382a0
|
[
"MIT"
] | null | null | null |
polyaxon/k8s_events_handlers/apps.py
|
elyase/polyaxon
|
1c19f059a010a6889e2b7ea340715b2bcfa382a0
|
[
"MIT"
] | null | null | null |
polyaxon/k8s_events_handlers/apps.py
|
elyase/polyaxon
|
1c19f059a010a6889e2b7ea340715b2bcfa382a0
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class K8SEventsHandlersConfig(AppConfig):
name = 'k8s_events_handlers'
verbose_name = 'K8SEventsHandlers'
def ready(self):
import signals.build_jobs # noqa
import signals.experiments # noqa
import signals.experiment_groups # noqa
import signals.jobs # noqa
import signals.projects # noqa
import signals.project_notebook_jobs # noqa
import signals.project_tensorboard_jobs # noqa
import signals.nodes # noqa
import signals.pipelines # noqa
| 31.611111
| 55
| 0.688928
| 60
| 569
| 6.383333
| 0.483333
| 0.305483
| 0.355091
| 0.219321
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007092
| 0.256591
| 569
| 17
| 56
| 33.470588
| 0.898345
| 0.077329
| 0
| 0
| 0
| 0
| 0.069903
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.071429
| false
| 0
| 0.714286
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
af087e54db4ef73a98f1ea28f37e10d525fe3b4b
| 41
|
py
|
Python
|
src/models/lgb_owl.py
|
ompanda/kaggle_ieee_creditcard_fraud_detection
|
8af98bf4c6774a52f86631487022b8ffb49f776c
|
[
"MIT"
] | null | null | null |
src/models/lgb_owl.py
|
ompanda/kaggle_ieee_creditcard_fraud_detection
|
8af98bf4c6774a52f86631487022b8ffb49f776c
|
[
"MIT"
] | null | null | null |
src/models/lgb_owl.py
|
ompanda/kaggle_ieee_creditcard_fraud_detection
|
8af98bf4c6774a52f86631487022b8ffb49f776c
|
[
"MIT"
] | null | null | null |
#https://www.kaggle.com/jazivxt/safe-box
| 20.5
| 40
| 0.756098
| 7
| 41
| 4.428571
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.02439
| 41
| 1
| 41
| 41
| 0.775
| 0.95122
| 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
|
af0dd0f0253927711e77387b61738803227093ea
| 56
|
py
|
Python
|
lib/utils/__init__.py
|
datasciencecampus/optimus
|
3696f63497b82c00c55806629445661d12c60b6d
|
[
"MIT"
] | 11
|
2018-09-17T18:30:42.000Z
|
2021-12-31T13:40:19.000Z
|
lib/utils/__init__.py
|
datasciencecampus/optimus
|
3696f63497b82c00c55806629445661d12c60b6d
|
[
"MIT"
] | 6
|
2019-10-10T10:25:59.000Z
|
2021-08-23T07:27:07.000Z
|
lib/utils/__init__.py
|
datasciencecampus/optimus
|
3696f63497b82c00c55806629445661d12c60b6d
|
[
"MIT"
] | 4
|
2019-10-14T16:21:38.000Z
|
2021-06-25T04:57:54.000Z
|
from .gatekeeper import Gatekeeper
from .knn import KNN
| 18.666667
| 34
| 0.821429
| 8
| 56
| 5.75
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 56
| 2
| 35
| 28
| 0.958333
| 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
|
af1189457c0f36b789c45e878cd61f2bbb340826
| 46
|
py
|
Python
|
phpipam_exporter/__init__.py
|
BlackSmith/phpipam_exporter
|
f58bd59f3f6b517833aed29f03c806b2cd0e7e0e
|
[
"MIT"
] | null | null | null |
phpipam_exporter/__init__.py
|
BlackSmith/phpipam_exporter
|
f58bd59f3f6b517833aed29f03c806b2cd0e7e0e
|
[
"MIT"
] | null | null | null |
phpipam_exporter/__init__.py
|
BlackSmith/phpipam_exporter
|
f58bd59f3f6b517833aed29f03c806b2cd0e7e0e
|
[
"MIT"
] | null | null | null |
"""Top-level package for phpipam-exporter."""
| 23
| 45
| 0.717391
| 6
| 46
| 5.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.086957
| 46
| 1
| 46
| 46
| 0.785714
| 0.847826
| 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
|
af6e87d78ad2e71698eff4ac83e0aeac1c1e3785
| 197
|
py
|
Python
|
arclet/edoves/builtin/event/message.py
|
ArcletProject/Edoves
|
b28423057ab765796d5299b5d8f98a0e8ce494dd
|
[
"MIT"
] | 2
|
2022-01-25T16:05:30.000Z
|
2022-02-12T18:33:39.000Z
|
arclet/edoves/builtin/event/message.py
|
ArcletProject/Edoves
|
b28423057ab765796d5299b5d8f98a0e8ce494dd
|
[
"MIT"
] | 4
|
2022-03-04T08:24:53.000Z
|
2022-03-23T15:22:26.000Z
|
arclet/edoves/builtin/event/message.py
|
ArcletProject/Edoves
|
b28423057ab765796d5299b5d8f98a0e8ce494dd
|
[
"MIT"
] | null | null | null |
from ...main.event import EdovesBasicEvent
from ..medium import Message
class MessageReceived(EdovesBasicEvent):
medium: Message
class MessageRevoked(EdovesBasicEvent):
medium: Message
| 17.909091
| 42
| 0.786802
| 19
| 197
| 8.157895
| 0.526316
| 0.154839
| 0.374194
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142132
| 197
| 10
| 43
| 19.7
| 0.91716
| 0
| 0
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 1
| 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
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
afbea30074e2d56b694e776e887adce9e9230ce0
| 151
|
py
|
Python
|
PVGeo/_helpers/__init__.py
|
tkoyama010/PVGeo
|
d2852b07be5411ca4b3a96f886ae864bbf6d09d8
|
[
"BSD-3-Clause"
] | 145
|
2018-07-20T21:46:27.000Z
|
2022-02-21T02:23:06.000Z
|
PVGeo/_helpers/__init__.py
|
tkoyama010/PVGeo
|
d2852b07be5411ca4b3a96f886ae864bbf6d09d8
|
[
"BSD-3-Clause"
] | 50
|
2018-06-14T22:38:27.000Z
|
2021-11-29T03:38:08.000Z
|
PVGeo/_helpers/__init__.py
|
tkoyama010/PVGeo
|
d2852b07be5411ca4b3a96f886ae864bbf6d09d8
|
[
"BSD-3-Clause"
] | 34
|
2018-07-27T07:48:20.000Z
|
2022-03-23T06:39:57.000Z
|
from .arrays import *
from .errors import *
from .timeseries import *
from .readers import *
from .xml import *
__displayname__ = 'Internal Helpers'
| 16.777778
| 36
| 0.741722
| 18
| 151
| 6
| 0.555556
| 0.37037
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.172185
| 151
| 8
| 37
| 18.875
| 0.864
| 0
| 0
| 0
| 0
| 0
| 0.10596
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.833333
| 0
| 0.833333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
bb7826fca3be7b416c2222e70b5c1cdb95878ff3
| 318
|
py
|
Python
|
models/armedforces/formations/units/unitary.py
|
MaksNech/pylab2018_ht_4-5
|
81ba35b8181095af506ee2fc5c51257db5cf15ce
|
[
"MIT"
] | null | null | null |
models/armedforces/formations/units/unitary.py
|
MaksNech/pylab2018_ht_4-5
|
81ba35b8181095af506ee2fc5c51257db5cf15ce
|
[
"MIT"
] | 1
|
2021-06-01T23:19:17.000Z
|
2021-06-01T23:19:17.000Z
|
models/armedforces/formations/units/unitary.py
|
MaksNech/python3_battle_simulator
|
81ba35b8181095af506ee2fc5c51257db5cf15ce
|
[
"MIT"
] | null | null | null |
from abc import ABC, abstractmethod
class Unitary(ABC):
@abstractmethod
def to_attack(self):
pass
@abstractmethod
def to_damage(self):
pass
@abstractmethod
def get_damage(self, dmg_val: float):
pass
@abstractmethod
def incrs_experience(self):
pass
| 15.142857
| 41
| 0.632075
| 35
| 318
| 5.6
| 0.514286
| 0.346939
| 0.321429
| 0.255102
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.298742
| 318
| 20
| 42
| 15.9
| 0.878924
| 0
| 0
| 0.571429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0.285714
| 0.071429
| 0
| 0.428571
| 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
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
bbab8998ab73d0b9a869664ae5280b45261cf189
| 247
|
py
|
Python
|
Day14/Solution.py
|
alexandersperling/30-Days-Of-Code
|
9a33b601452b4c9fa9cbc39ec7c4811b7a564aeb
|
[
"MIT"
] | null | null | null |
Day14/Solution.py
|
alexandersperling/30-Days-Of-Code
|
9a33b601452b4c9fa9cbc39ec7c4811b7a564aeb
|
[
"MIT"
] | null | null | null |
Day14/Solution.py
|
alexandersperling/30-Days-Of-Code
|
9a33b601452b4c9fa9cbc39ec7c4811b7a564aeb
|
[
"MIT"
] | null | null | null |
self.maximumDifference = 0
def computeDifference(self):
for a in self.__elements:
for b in self.__elements:
if abs(a-b) > self.maximumDifference:
self.maximumDifference = abs(a-b)
| 30.875
| 53
| 0.566802
| 27
| 247
| 5.037037
| 0.444444
| 0.463235
| 0.205882
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.00625
| 0.352227
| 247
| 7
| 54
| 35.285714
| 0.84375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
bbba611ae3569c17a6051f0b0b6cbc4345ce5a58
| 110
|
py
|
Python
|
cookie_consent/managers.py
|
briefmnews/django-cookie-consent
|
12787b5641671289b03bba981af7dfdc674dbaac
|
[
"BSD-2-Clause"
] | 1
|
2020-08-02T00:38:50.000Z
|
2020-08-02T00:38:50.000Z
|
cookie_consent/managers.py
|
briefmnews/django-cookie-consent
|
12787b5641671289b03bba981af7dfdc674dbaac
|
[
"BSD-2-Clause"
] | null | null | null |
cookie_consent/managers.py
|
briefmnews/django-cookie-consent
|
12787b5641671289b03bba981af7dfdc674dbaac
|
[
"BSD-2-Clause"
] | 4
|
2019-05-02T15:12:51.000Z
|
2021-01-20T13:12:44.000Z
|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
#from django.db.models.query import QuerySet
| 22
| 44
| 0.754545
| 15
| 110
| 5.2
| 0.866667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010417
| 0.127273
| 110
| 4
| 45
| 27.5
| 0.802083
| 0.581818
| 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
|
a553e65ddab9aa867d7ea4911a274f8d4ab65fa6
| 164
|
py
|
Python
|
cmd/expandybird/test/templates/helpers/common.py
|
sparkprime/helm
|
4d7c681ba0aa43b45d122faa998c243422019be4
|
[
"Apache-2.0"
] | null | null | null |
cmd/expandybird/test/templates/helpers/common.py
|
sparkprime/helm
|
4d7c681ba0aa43b45d122faa998c243422019be4
|
[
"Apache-2.0"
] | null | null | null |
cmd/expandybird/test/templates/helpers/common.py
|
sparkprime/helm
|
4d7c681ba0aa43b45d122faa998c243422019be4
|
[
"Apache-2.0"
] | null | null | null |
"""Dummy helper methods invoked in other constructors."""
def GenerateMachineName(prefix, suffix):
"""Generates name of a VM."""
return prefix + "-" + suffix
| 23.428571
| 57
| 0.695122
| 19
| 164
| 6
| 0.894737
| 0.210526
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.164634
| 164
| 6
| 58
| 27.333333
| 0.832117
| 0.457317
| 0
| 0
| 1
| 0
| 0.012821
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
a55c934de6432cbb2da63b23b821c52655a77864
| 169
|
py
|
Python
|
00.FullSpeedPython/03.ModulesAndFunctions/05.sum_N_Numbers.py
|
hadibakalim/python_related_courses
|
79773e8186a0a109d8afe981440e36f4eeacbcb9
|
[
"MIT"
] | 1
|
2019-11-08T10:54:38.000Z
|
2019-11-08T10:54:38.000Z
|
00.FullSpeedPython/03.ModulesAndFunctions/05.sum_N_Numbers.py
|
hadibakalim/python_related_courses
|
79773e8186a0a109d8afe981440e36f4eeacbcb9
|
[
"MIT"
] | null | null | null |
00.FullSpeedPython/03.ModulesAndFunctions/05.sum_N_Numbers.py
|
hadibakalim/python_related_courses
|
79773e8186a0a109d8afe981440e36f4eeacbcb9
|
[
"MIT"
] | null | null | null |
# The sum of all numbers from 1 upto
# that input natural number n
def sum_N_Numbers (n):
if n == 1:
return 1
# Write code here
return n + sum_N_Numbers(n-1)
| 21.125
| 37
| 0.668639
| 33
| 169
| 3.30303
| 0.575758
| 0.073395
| 0.201835
| 0.220183
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.031746
| 0.254438
| 169
| 8
| 38
| 21.125
| 0.833333
| 0.467456
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0
| 0.75
| 0
| 0
| 0
| 0
| null | 0
| 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
| 1
| 0
|
0
| 5
|
a57b7f312a400dc8be4805fdf5060168065dfbeb
| 934
|
py
|
Python
|
1011/1011.py
|
daengdaengLee/baekjoon_coding
|
cb32c6c42f961bd6c1361aebfa68be1352e9055e
|
[
"MIT"
] | null | null | null |
1011/1011.py
|
daengdaengLee/baekjoon_coding
|
cb32c6c42f961bd6c1361aebfa68be1352e9055e
|
[
"MIT"
] | null | null | null |
1011/1011.py
|
daengdaengLee/baekjoon_coding
|
cb32c6c42f961bd6c1361aebfa68be1352e9055e
|
[
"MIT"
] | null | null | null |
def init_n(d):
n = 1
while True:
if n * n > d:
return n - 1
n += 1
def main(x, y):
d = y - x
if d <= 2:
return d
n = init_n(d)
remain_d = d - (n * n)
if remain_d == 0:
return n + (n - 1)
if remain_d % n == 0:
return n + (n - 1) + (remain_d // n)
return n + (n - 1) + (remain_d // n) + 1
print(main(0, 3)) # 3
print(main(1, 5)) # 3
print(main(45, 50)) # 4
print(main(0, 15)) # 7
print(main(20, 23)) # 3
print(main(0, 2147483647)) # 92681
print(main(1, 2147483647)) # 92681
print(main(2, 2147483647)) # 92681
print(main(41706, 2147483647)) # 92681
print(main(41707, 2147483647)) # 92680
print(main(2147483643, 2147483647)) # 3
print(main(2147483644, 2147483647)) # 3
print(main(2147483645, 2147483647)) # 2
print(main(2147483646, 2147483647)) # 1
print(main(0, 1)) # 1
print(main(0, 2)) # 2
print(main(0, 3)) # 3
print(main(0, 4)) # 3
| 20.755556
| 44
| 0.549251
| 156
| 934
| 3.24359
| 0.217949
| 0.320158
| 0.13834
| 0.189723
| 0.171937
| 0.150198
| 0.150198
| 0
| 0
| 0
| 0
| 0.315169
| 0.273019
| 934
| 44
| 45
| 21.227273
| 0.430044
| 0.058887
| 0
| 0.057143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.057143
| false
| 0
| 0
| 0
| 0.2
| 0.514286
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
3c01274c792dc03f22cc30e24a9aa7f4f4a33668
| 140
|
py
|
Python
|
interpreter/ASG/__init__.py
|
SDX2000/ushell
|
d058d76e283b0574f10877fa62e7e5bc14d0941e
|
[
"MIT"
] | null | null | null |
interpreter/ASG/__init__.py
|
SDX2000/ushell
|
d058d76e283b0574f10877fa62e7e5bc14d0941e
|
[
"MIT"
] | null | null | null |
interpreter/ASG/__init__.py
|
SDX2000/ushell
|
d058d76e283b0574f10877fa62e7e5bc14d0941e
|
[
"MIT"
] | null | null | null |
from .program import Program
from .flag import Flag
from .command import Command
from .varlookup import VarLookup
from .string import String
| 28
| 32
| 0.828571
| 20
| 140
| 5.8
| 0.35
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.135714
| 140
| 5
| 33
| 28
| 0.958678
| 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
|
3c2a5f249c706a4cd0589f6e8b1d5b7e87bdc5b4
| 17,805
|
py
|
Python
|
app/models.py
|
MashSoftware/flux-api
|
8763f752d44868b53a351f44f243ae760b28be31
|
[
"MIT"
] | 1
|
2021-06-19T18:06:34.000Z
|
2021-06-19T18:06:34.000Z
|
app/models.py
|
MashSoftware/flux-api
|
8763f752d44868b53a351f44f243ae760b28be31
|
[
"MIT"
] | null | null | null |
app/models.py
|
MashSoftware/flux-api
|
8763f752d44868b53a351f44f243ae760b28be31
|
[
"MIT"
] | null | null | null |
import json
import uuid
from datetime import datetime
from sqlalchemy.dialects.postgresql import UUID
from app import db
# person_team = db.Table(
# "person_team",
# db.Column(
# "person_id",
# UUID,
# db.ForeignKey("person.id", ondelete="CASCADE"),
# primary_key=True,
# ),
# db.Column(
# "team_id", UUID, db.ForeignKey("team.id", ondelete="CASCADE"), primary_key=True
# ),
# db.Index("ix_person_team_person_id_team_id", "team_id", "person_id", unique=True),
# )
# person_project = db.Table(
# "person_project",
# db.Column(
# "person_id",
# UUID,
# db.ForeignKey("person.id", ondelete="CASCADE"),
# primary_key=True,
# ),
# db.Column(
# "project_id",
# UUID,
# db.ForeignKey("project.id", ondelete="CASCADE"),
# primary_key=True,
# ),
# db.Index(
# "ix_person_project_person_id_project_id", "project_id", "person_id", unique=True
# ),
# )
class Organisation(db.Model):
# Fields
id = db.Column(UUID, primary_key=True)
name = db.Column(db.String(), nullable=False, index=True) # Should this be unique too, or just domain?
domain = db.Column(db.String(), nullable=False, index=True, unique=True)
created_at = db.Column(db.DateTime(timezone=True), nullable=False, index=True)
updated_at = db.Column(db.DateTime(timezone=True), nullable=True)
# Relationships
grades = db.relationship("Grade", backref="organisation")
locations = db.relationship("Location", backref="organisation")
people = db.relationship("Person", backref="organisation")
practices = db.relationship("Practice", backref="organisation")
programmes = db.relationship("Programme", backref="organisation")
projects = db.relationship("Project", backref="organisation")
roles = db.relationship("Role", backref="organisation")
# Methods
def __init__(self, name, domain):
self.id = str(uuid.uuid4())
self.name = name.strip()
self.domain = domain.strip().lower()
self.created_at = datetime.utcnow()
def __repr__(self):
return json.dumps(self.as_dict(), separators=(",", ":"))
def as_dict(self):
return {
"id": self.id,
"name": self.name,
"domain": self.domain,
"grades": len(self.grades),
"locations": len(self.locations),
"people": len(self.people),
"practices": len(self.practices),
"programmes": len(self.programmes),
"projects": len(self.projects),
"roles": len(self.roles),
"created_at": self.created_at.isoformat(),
"updated_at": self.updated_at.isoformat() if self.updated_at else None,
}
def list_item(self):
return {
"id": self.id,
"name": self.name,
"domain": self.domain,
}
class Location(db.Model):
# Fields
id = db.Column(UUID, primary_key=True)
name = db.Column(db.String(), nullable=False, index=True)
address = db.Column(db.String(), nullable=False)
organisation_id = db.Column(UUID, db.ForeignKey("organisation.id", ondelete="CASCADE"), nullable=False)
created_at = db.Column(db.DateTime(timezone=True), nullable=False, index=True)
updated_at = db.Column(db.DateTime(timezone=True), nullable=True)
# Relationships
people = db.relationship("Person", backref="location", lazy=True)
# Methods
def __init__(self, name, address, organisation_id):
self.id = str(uuid.uuid4())
self.name = name.strip().title()
self.address = address.strip()
self.organisation_id = str(uuid.UUID(organisation_id, version=4))
self.created_at = datetime.utcnow()
def __repr__(self):
return json.dumps(self.as_dict(), separators=(",", ":"))
def as_dict(self):
return {
"id": self.id,
"name": self.name,
"address": self.address,
"organisation": {
"id": self.organisation.id,
"name": self.organisation.name,
},
"people": len(self.people),
"created_at": self.created_at.isoformat(),
"updated_at": self.updated_at.isoformat() if self.updated_at else None,
}
def list_item(self):
return {"id": self.id, "name": self.name}
class Grade(db.Model):
# Fields
id = db.Column(UUID, primary_key=True)
name = db.Column(db.String(), nullable=False, index=True)
organisation_id = db.Column(UUID, db.ForeignKey("organisation.id", ondelete="CASCADE"), nullable=False)
created_at = db.Column(db.DateTime(timezone=True), nullable=False, index=True)
updated_at = db.Column(db.DateTime(timezone=True), nullable=True)
# Relationships
roles = db.relationship("Role", backref="grade", lazy=True)
# Methods
def __init__(self, name, organisation_id):
self.id = str(uuid.uuid4())
self.name = name.strip()
self.organisation_id = str(uuid.UUID(organisation_id, version=4))
self.created_at = datetime.utcnow()
def __repr__(self):
return json.dumps(self.as_dict(), separators=(",", ":"))
def as_dict(self):
return {
"id": self.id,
"name": self.name,
"organisation": {
"id": self.organisation.id,
"name": self.organisation.name,
},
"roles": len(self.roles),
"created_at": self.created_at.isoformat(),
"updated_at": self.updated_at.isoformat() if self.updated_at else None,
}
def list_item(self):
return {"id": self.id, "name": self.name}
class Practice(db.Model):
# Fields
id = db.Column(UUID, primary_key=True)
name = db.Column(db.String(), nullable=False, index=True)
head_id = db.Column(UUID, db.ForeignKey("person.id", ondelete="SET NULL"), nullable=True, index=True)
cost_centre = db.Column(db.String(), nullable=True)
organisation_id = db.Column(UUID, db.ForeignKey("organisation.id", ondelete="CASCADE"), nullable=False)
created_at = db.Column(db.DateTime(timezone=True), nullable=False, index=True)
updated_at = db.Column(db.DateTime(timezone=True), nullable=True)
# Relationships
head = db.relationship("Person", uselist=False)
roles = db.relationship("Role", backref="practice", lazy=True)
# Methods
def __init__(self, name, head_id, cost_centre, organisation_id):
self.id = str(uuid.uuid4())
self.name = name.strip().title()
self.head_id = str(uuid.UUID(head_id, version=4)) if head_id else None
self.cost_centre = cost_centre.strip() if cost_centre else None
self.organisation_id = str(uuid.UUID(organisation_id, version=4))
self.created_at = datetime.utcnow()
def __repr__(self):
return json.dumps(self.as_dict(), separators=(",", ":"))
def as_dict(self):
return {
"id": self.id,
"name": self.name,
"head": {
"id": self.head.id,
"name": self.head.name,
}
if self.head
else None,
"cost_centre": self.cost_centre,
"organisation": {
"id": self.organisation.id,
"name": self.organisation.name,
},
"roles": len(self.roles),
"created_at": self.created_at.isoformat(),
"updated_at": self.updated_at.isoformat() if self.updated_at else None,
}
def list_item(self):
return {
"id": self.id,
"name": self.name,
"head": {
"id": self.head.id,
"name": self.head.name,
}
if self.head
else None,
}
class Role(db.Model):
# Fields
id = db.Column(UUID, primary_key=True)
title = db.Column(db.String(), nullable=False, index=True)
grade_id = db.Column(UUID, db.ForeignKey("grade.id", ondelete="CASCADE"), nullable=False)
practice_id = db.Column(UUID, db.ForeignKey("practice.id", ondelete="CASCADE"), nullable=True)
organisation_id = db.Column(UUID, db.ForeignKey("organisation.id", ondelete="CASCADE"), nullable=False)
created_at = db.Column(db.DateTime(timezone=True), nullable=False, index=True)
updated_at = db.Column(db.DateTime(timezone=True), nullable=True)
# Relationships
people = db.relationship("Person", backref="role", lazy=True)
# Methods
def __init__(self, title, grade_id, practice_id, organisation_id):
self.id = str(uuid.uuid4())
self.title = title.strip()
self.grade_id = str(uuid.UUID(grade_id, version=4))
self.practice_id = str(uuid.UUID(practice_id, version=4)) if practice_id else None
self.organisation_id = str(uuid.UUID(organisation_id, version=4))
self.created_at = datetime.utcnow()
def __repr__(self):
return json.dumps(self.as_dict(), separators=(",", ":"))
def as_dict(self):
return {
"id": self.id,
"title": self.title,
"grade": {"id": self.grade.id, "name": self.grade.name},
"practice": self.practice.list_item() if self.practice else None,
"organisation": {
"id": self.organisation.id,
"name": self.organisation.name,
},
"people": len(self.people),
"created_at": self.created_at.isoformat(),
"updated_at": self.updated_at.isoformat() if self.updated_at else None,
}
def list_item(self):
return {
"id": self.id,
"title": self.title,
"grade": self.grade.list_item(),
"practice": {"id": self.practice.id, "name": self.practice.name} if self.practice else None,
}
class Person(db.Model):
# Fields
id = db.Column(UUID, primary_key=True)
name = db.Column(db.String, nullable=False)
role_id = db.Column(UUID, db.ForeignKey("role.id", ondelete="CASCADE"), nullable=False, index=True)
organisation_id = db.Column(
UUID,
db.ForeignKey("organisation.id", ondelete="CASCADE"),
nullable=False,
index=True,
)
email_address = db.Column(db.String(254), nullable=False, unique=True)
full_time_equivalent = db.Column(db.Float, nullable=True)
location_id = db.Column(
UUID,
db.ForeignKey("location.id", ondelete="SET NULL"),
nullable=True,
index=True,
)
employment = db.Column(db.String, nullable=True)
created_at = db.Column(db.DateTime(timezone=True), nullable=False, index=True)
updated_at = db.Column(db.DateTime(timezone=True), nullable=True)
# Relationships
# teams = db.relationship(
# "Team",
# secondary=person_team,
# lazy=True,
# backref=db.backref("people", lazy=True),
# )
# projects = db.relationship(
# "Project",
# secondary=person_project,
# lazy=True,
# backref=db.backref("people", lazy=True),
# )
# Methods
def __init__(
self,
name,
role_id,
organisation_id,
email_address,
full_time_equivalent,
location_id,
employment,
):
self.id = str(uuid.uuid4())
self.name = name.strip().title()
self.organisation_id = str(uuid.UUID(organisation_id, version=4))
self.role_id = str(uuid.UUID(role_id, version=4))
self.email_address = email_address.strip().lower()
self.full_time_equivalent = full_time_equivalent
self.location_id = str(uuid.UUID(location_id, version=4))
self.employment = employment.strip()
self.created_at = datetime.utcnow()
def __repr__(self):
return json.dumps(self.as_dict(), separators=(",", ":"))
def as_dict(self):
return {
"id": self.id,
"name": self.name,
"organisation": {
"id": self.organisation.id,
"name": self.organisation.name,
},
"role": self.role.list_item(),
"email_address": self.email_address,
"full_time_equivalent": self.full_time_equivalent,
"location": self.location.list_item(),
"employment": self.employment,
"created_at": self.created_at.isoformat(),
"updated_at": self.updated_at.isoformat() if self.updated_at else None,
}
def list_item(self):
return {
"id": self.id,
"name": self.name,
"role": self.role.list_item(),
"location": self.location.list_item(),
}
class Programme(db.Model):
# Fields
id = db.Column(UUID, primary_key=True)
name = db.Column(db.String(), nullable=False, index=True)
manager_id = db.Column(UUID, db.ForeignKey("person.id", ondelete="SET NULL"), nullable=True, index=True)
organisation_id = db.Column(UUID, db.ForeignKey("organisation.id", ondelete="CASCADE"), nullable=False)
created_at = db.Column(db.DateTime(timezone=True), nullable=False, index=True)
updated_at = db.Column(db.DateTime(timezone=True), nullable=True)
# Relationships
manager = db.relationship("Person", uselist=False)
projects = db.relationship("Project", backref="programme", lazy=True)
# Methods
def __init__(self, name, manager_id, organisation_id):
self.id = str(uuid.uuid4())
self.name = name.strip()
self.manager_id = str(uuid.UUID(manager_id, version=4)) if manager_id else None
self.organisation_id = str(uuid.UUID(organisation_id, version=4))
self.created_at = datetime.utcnow()
def __repr__(self):
return json.dumps(self.as_dict(), separators=(",", ":"))
def as_dict(self):
return {
"id": self.id,
"name": self.name,
"manager": {
"id": self.manager.id,
"name": self.manager.name,
}
if self.manager
else None,
"organisation": {
"id": self.organisation.id,
"name": self.organisation.name,
},
"projects": len(self.projects),
"created_at": self.created_at.isoformat(),
"updated_at": self.updated_at.isoformat() if self.updated_at else None,
}
def list_item(self):
return {
"id": self.id,
"name": self.name,
"manager": {
"id": self.manager.id,
"name": self.manager.name,
}
if self.manager
else None,
}
class Project(db.Model):
# Fields
id = db.Column(UUID, primary_key=True)
name = db.Column(db.String(), nullable=False, index=True)
manager_id = db.Column(UUID, db.ForeignKey("person.id", ondelete="SET NULL"), nullable=True, index=True)
programme_id = db.Column(UUID, db.ForeignKey("programme.id"), nullable=True)
status = db.Column(db.String(), nullable=False, index=True)
organisation_id = db.Column(UUID, db.ForeignKey("organisation.id"), nullable=False)
created_at = db.Column(db.DateTime(timezone=True), nullable=False, index=True)
updated_at = db.Column(db.DateTime(timezone=True), nullable=True)
# Relationships
manager = db.relationship("Person", uselist=False)
# teams = db.relationship("Team", backref="project", lazy=True)
# many to many with person
# Methods
def __init__(self, name, manager_id, programme_id, status, organisation_id):
self.id = str(uuid.uuid4())
self.name = name.strip()
self.manager_id = str(uuid.UUID(manager_id, version=4)) if manager_id else None
self.programme_id = str(uuid.UUID(programme_id, version=4)) if programme_id else None
self.status = status.strip()
self.organisation_id = str(uuid.UUID(organisation_id, version=4))
self.created_at = datetime.utcnow()
def __repr__(self):
return json.dumps(self.as_dict(), separators=(",", ":"))
def as_dict(self):
return {
"id": self.id,
"name": self.name,
"manager": {
"id": self.manager.id,
"name": self.manager.name,
}
if self.manager
else None,
"programme": {
"id": self.programme.id,
"name": self.programme.name,
}
if self.programme
else None,
"status": self.status,
"organisation": {
"id": self.organisation.id,
"name": self.organisation.name,
},
"created_at": self.created_at.isoformat(),
"updated_at": self.updated_at.isoformat() if self.updated_at else None,
}
def list_item(self):
return {
"id": self.id,
"name": self.name,
"manager": {
"id": self.manager.id,
"name": self.manager.name,
}
if self.manager
else None,
"programme": {
"id": self.programme.id,
"name": self.programme.name,
}
if self.programme
else None,
"status": self.status,
}
# class Team(db.Model):
# # Fields
# id = db.Column(UUID, primary_key=True)
# name = db.Column(db.String(), nullable=False, index=True)
# created_at = db.Column(db.DateTime(timezone=True), nullable=False, index=True)
# updated_at = db.Column(db.DateTime(timezone=True), nullable=True)
# # Relationships
# # many to many with person
| 35.118343
| 108
| 0.586352
| 2,064
| 17,805
| 4.91812
| 0.051357
| 0.048862
| 0.033494
| 0.0331
| 0.803665
| 0.748399
| 0.722293
| 0.702
| 0.683282
| 0.670082
| 0
| 0.002005
| 0.271834
| 17,805
| 506
| 109
| 35.187747
| 0.780949
| 0.100253
| 0
| 0.666667
| 0
| 0
| 0.076421
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.087432
| false
| 0
| 0.013661
| 0.065574
| 0.377049
| 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
|
3c52d4f48894d4ea7df0c573b16b5fcb44ac81f1
| 3,319
|
py
|
Python
|
tests/tof/conversions_test.py
|
scipp/scippneutron
|
2d0f903880592837e922e5f2ac073d58fe6bf971
|
[
"BSD-3-Clause"
] | 2
|
2021-03-25T07:42:00.000Z
|
2022-02-23T16:12:47.000Z
|
tests/tof/conversions_test.py
|
scipp/scippneutron
|
2d0f903880592837e922e5f2ac073d58fe6bf971
|
[
"BSD-3-Clause"
] | 149
|
2021-02-15T11:34:09.000Z
|
2022-03-28T09:47:39.000Z
|
tests/tof/conversions_test.py
|
scipp/scippneutron
|
2d0f903880592837e922e5f2ac073d58fe6bf971
|
[
"BSD-3-Clause"
] | null | null | null |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2021 Scipp contributors (https://github.com/scipp)
# @author Simon Heybrock
import pytest
from scippneutron.tof import conversions
def test_incident_beam():
assert set(conversions.incident_beam().keys()) == set(['incident_beam'])
def test_scattered_beam():
assert set(conversions.scattered_beam().keys()) == set(['scattered_beam'])
def test_two_theta():
assert set(conversions.two_theta().keys()) == set(
['scattered_beam', 'incident_beam', 'two_theta'])
def test_L1():
assert set(conversions.L1().keys()) == set(['L1', 'incident_beam'])
def test_L2():
assert set(conversions.L2().keys()) == set(['L2', 'scattered_beam'])
def test_Ltotal():
assert set(conversions.Ltotal(scatter=False).keys()) == set(['Ltotal'])
assert set(conversions.Ltotal(scatter=True).keys()) == set(
['scattered_beam', 'incident_beam', 'L1', 'L2', 'Ltotal'])
def test_beamline():
assert set(conversions.beamline(scatter=False).keys()) == set(['Ltotal'])
assert set(conversions.beamline(scatter=True).keys()) == set(
['scattered_beam', 'incident_beam', 'L1', 'L2', 'Ltotal', 'two_theta'])
def test_kinematic():
assert set(conversions.kinematic('tof').keys()) == set(['energy', 'wavelength'])
# Other initial coords not supported for now
with pytest.raises(KeyError):
conversions.kinematic('energy')
with pytest.raises(KeyError):
conversions.kinematic('wavelength')
def test_elastic():
assert set(conversions.elastic('energy').keys()) == set(['dspacing', 'wavelength'])
assert set(conversions.elastic('tof').keys()) == set(
['dspacing', 'energy', 'Q', 'wavelength'])
assert set(conversions.elastic('Q').keys()) == set(['wavelength'])
assert set(conversions.elastic('wavelength').keys()) == set(
['dspacing', 'energy', 'Q'])
def test_elastic_dspacing():
assert set(conversions.elastic_dspacing('energy').keys()) == set(['dspacing'])
assert set(conversions.elastic_dspacing('tof').keys()) == set(['dspacing'])
assert set(conversions.elastic_dspacing('wavelength').keys()) == set(['dspacing'])
def test_elastic_energy():
assert set(conversions.elastic_energy('tof').keys()) == set(['energy'])
assert set(conversions.elastic_energy('wavelength').keys()) == set(['energy'])
def test_elastic_Q():
assert set(conversions.elastic_Q('tof').keys()) == set(['Q', 'wavelength'])
assert set(conversions.elastic_Q('wavelength').keys()) == set(['Q'])
def test_elastic_wavelength():
assert set(conversions.elastic_wavelength('energy').keys()) == set(['wavelength'])
assert set(conversions.elastic_wavelength('tof').keys()) == set(['wavelength'])
assert set(conversions.elastic_wavelength('Q').keys()) == set(['wavelength'])
def test_direct_inelastic():
assert set(conversions.direct_inelastic('tof').keys()) == set(['energy_transfer'])
# Other initial coords not supported for now
with pytest.raises(KeyError):
conversions.kinematic('wavelength')
def test_indirect_inelastic():
assert set(conversions.indirect_inelastic('tof').keys()) == set(['energy_transfer'])
# Other initial coords not supported for now
with pytest.raises(KeyError):
conversions.kinematic('wavelength')
| 35.688172
| 88
| 0.677614
| 385
| 3,319
| 5.703896
| 0.155844
| 0.106557
| 0.236794
| 0.172131
| 0.612477
| 0.531876
| 0.423497
| 0.387978
| 0.227687
| 0.196721
| 0
| 0.005228
| 0.135583
| 3,319
| 92
| 89
| 36.076087
| 0.760195
| 0.076529
| 0
| 0.125
| 0
| 0
| 0.163833
| 0
| 0
| 0
| 0
| 0
| 0.464286
| 1
| 0.267857
| true
| 0
| 0.035714
| 0
| 0.303571
| 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
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
3c9c26f7bfb697000bb95ddda8d5bf5868bc0856
| 6,383
|
py
|
Python
|
azext_iot/central/services/export.py
|
lucadruda/azure-iot-cli-extension
|
9d2f677d19580f8fbac860e079550167e743a237
|
[
"MIT"
] | 1
|
2021-06-09T22:38:32.000Z
|
2021-06-09T22:38:32.000Z
|
azext_iot/central/services/export.py
|
lucadruda/azure-iot-cli-extension
|
9d2f677d19580f8fbac860e079550167e743a237
|
[
"MIT"
] | null | null | null |
azext_iot/central/services/export.py
|
lucadruda/azure-iot-cli-extension
|
9d2f677d19580f8fbac860e079550167e743a237
|
[
"MIT"
] | null | null | null |
# coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# This is largely derived from https://docs.microsoft.com/en-us/rest/api/iotcentral/1.1-previewdataplane/exports
from typing import List, Union
from knack.log import get_logger
from knack.util import CLIError
from azext_iot.central.models.enum import ApiVersion
from azext_iot.constants import CENTRAL_ENDPOINT
from azext_iot.central.models.v1_1_preview import ExportV1_1_preview
from azext_iot.central.services import _utility
logger = get_logger(__name__)
BASE_PATH = "api/dataExport/exports"
def add_export(
cmd,
app_id: str,
export_id: str,
payload: str,
token: str,
api_version=ApiVersion.v1_1_preview.value,
central_dns_suffix=CENTRAL_ENDPOINT,
) -> Union[dict, ExportV1_1_preview]:
"""
Add and data export to IoT Central app
Args:
cmd: command passed into az
app_id: name of app (used for forming request URL)
export_id: unique identifier for export
payload: export definition in JSON
token: (OPTIONAL) authorization token to fetch device details from IoTC.
MUST INCLUDE type (e.g. 'SharedAccessToken ...', 'Bearer ...')
central_dns_suffix: {centralDnsSuffixInPath} as found in docs
Returns:
Export
"""
url = "https://{}.{}/{}/{}".format(app_id, central_dns_suffix, BASE_PATH, export_id)
return _utility.make_api_call(
cmd,
app_id,
method="PUT",
url=url,
payload=payload,
token=token,
api_version=api_version,
central_dnx_suffix=central_dns_suffix,
)
def update_export(
cmd,
app_id: str,
export_id: str,
payload: str,
token: str,
api_version=ApiVersion.v1_1_preview.value,
central_dns_suffix=CENTRAL_ENDPOINT,
) -> Union[dict, ExportV1_1_preview]:
"""
Update and data export in IoT Central app
Args:
cmd: command passed into az
app_id: name of app (used for forming request URL)
export_id: unique identifier for export
payload: export definition in JSON
token: (OPTIONAL) authorization token to fetch device details from IoTC.
MUST INCLUDE type (e.g. 'SharedAccessToken ...', 'Bearer ...')
central_dns_suffix: {centralDnsSuffixInPath} as found in docs
Returns:
Export
"""
url = "https://{}.{}/{}/{}".format(app_id, central_dns_suffix, BASE_PATH, export_id)
return _utility.make_api_call(
cmd,
app_id,
method="PATCH",
url=url,
payload=payload,
token=token,
api_version=api_version,
central_dnx_suffix=central_dns_suffix,
)
def list_exports(
cmd,
app_id: str,
token: str,
max_pages=0,
api_version=ApiVersion.v1_1_preview.value,
central_dns_suffix=CENTRAL_ENDPOINT,
) -> List[Union[dict, ExportV1_1_preview]]:
"""
Get the list of exports for a central app.
Args:
cmd: command passed into az
app_id: name of app (used for forming request URL)
max_pages: max return result pages
token: (OPTIONAL) authorization token to fetch device details from IoTC.
MUST INCLUDE type (e.g. 'SharedAccessToken ...', 'Bearer ...')
central_dns_suffix: {centralDnsSuffixInPath} as found in docs
Returns:
List of Export
"""
exports = []
url = "https://{}.{}/{}".format(app_id, central_dns_suffix, BASE_PATH)
pages_processed = 0
while (max_pages == 0 or pages_processed < max_pages) and url:
result = _utility.make_api_call(
cmd,
app_id,
method="GET",
url=url,
payload=None,
token=token,
api_version=api_version,
central_dnx_suffix=central_dns_suffix,
)
if "value" not in result:
raise CLIError("Value is not present in body: {}".format(result))
exports.extend(result.get("value", []))
url = result.get("nextLink", None)
pages_processed = pages_processed + 1
return exports
def get_export(
cmd,
app_id: str,
export_id: str,
token: str,
api_version=ApiVersion.v1_1_preview.value,
central_dns_suffix=CENTRAL_ENDPOINT,
) -> Union[dict, ExportV1_1_preview]:
"""
Get information about a specified export.
Args:
cmd: command passed into az
app_id: name of app (used for forming request URL)
export_id: unique identifier for export
token: (OPTIONAL) authorization token to fetch device details from IoTC.
MUST INCLUDE type (e.g. 'SharedAccessToken ...', 'Bearer ...')
central_dns_suffix: {centralDnsSuffixInPath} as found in docs
Returns:
Export
"""
url = "https://{}.{}/{}/{}".format(app_id, central_dns_suffix, BASE_PATH, export_id)
return _utility.make_api_call(
cmd,
app_id,
method="GET",
url=url,
payload=None,
token=token,
api_version=api_version,
central_dnx_suffix=central_dns_suffix,
)
def delete_export(
cmd,
app_id: str,
export_id: str,
token: str,
api_version=ApiVersion.v1.value,
central_dns_suffix=CENTRAL_ENDPOINT,
) -> dict:
"""
Delete data export export from Central app.
Args:
cmd: command passed into az
app_id: name of app (used for forming request URL)
export_id: unique identifier for export
token: (OPTIONAL) authorization token to fetch device details from IoTC.
MUST INCLUDE type (e.g. 'SharedAccessToken ...', 'Bearer ...')
central_dns_suffix: {centralDnsSuffixInPath} as found in docs
Returns:
Response dict
"""
url = "https://{}.{}/{}/{}".format(app_id, central_dns_suffix, BASE_PATH, export_id)
return _utility.make_api_call(
cmd,
app_id,
method="DELETE",
url=url,
payload=None,
token=token,
api_version=api_version,
central_dnx_suffix=central_dns_suffix,
)
| 28.882353
| 112
| 0.624315
| 777
| 6,383
| 4.912484
| 0.182754
| 0.026199
| 0.083835
| 0.014409
| 0.746136
| 0.733036
| 0.715483
| 0.715483
| 0.715483
| 0.715483
| 0
| 0.005887
| 0.254896
| 6,383
| 220
| 113
| 29.013636
| 0.796678
| 0.411092
| 0
| 0.678261
| 0
| 0
| 0.052722
| 0.006304
| 0
| 0
| 0
| 0
| 0
| 1
| 0.043478
| false
| 0
| 0.06087
| 0
| 0.147826
| 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
|
b1d7af602c9b831830f88831f161d10ce6fe97cd
| 237
|
py
|
Python
|
LR/lr/tests/functional/test_pubkey.py
|
LearningRegistry/LearningRegistry
|
d9f0a8117a4adb8fcf6bf101d3d58d799463a2e2
|
[
"Apache-2.0"
] | 26
|
2015-04-14T03:11:58.000Z
|
2022-01-06T14:31:07.000Z
|
LR/lr/tests/functional/test_pubkey.py
|
LearningRegistry/LearningRegistry
|
d9f0a8117a4adb8fcf6bf101d3d58d799463a2e2
|
[
"Apache-2.0"
] | 11
|
2015-04-03T21:54:03.000Z
|
2017-05-02T17:20:03.000Z
|
LR/lr/tests/functional/test_pubkey.py
|
LearningRegistry/LearningRegistry
|
d9f0a8117a4adb8fcf6bf101d3d58d799463a2e2
|
[
"Apache-2.0"
] | 16
|
2015-02-11T09:30:18.000Z
|
2020-11-20T02:06:24.000Z
|
from lr.tests import *
class TestPubkeyController(TestController):
def test_index(self):
response = self.app.get('/pubkey')
# Test response...
def test_create(self):
response = self.app.post('/pubkey')
| 21.545455
| 43
| 0.64135
| 27
| 237
| 5.555556
| 0.62963
| 0.093333
| 0.213333
| 0.253333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.227848
| 237
| 10
| 44
| 23.7
| 0.819672
| 0.067511
| 0
| 0
| 0
| 0
| 0.063927
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 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
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
593c4cade3c46ae621383006e1c33b6e7d7de5b9
| 129
|
py
|
Python
|
demo_app.py
|
BonjourGit/nlc2cmd-submission-hubris
|
7928f75ad212295c732dbd4e42ce4eba378d2509
|
[
"MIT"
] | 7
|
2020-12-01T16:13:59.000Z
|
2022-01-01T18:02:22.000Z
|
demo_app.py
|
BonjourGit/nlc2cmd-submission-hubris
|
7928f75ad212295c732dbd4e42ce4eba378d2509
|
[
"MIT"
] | 1
|
2020-12-22T02:15:13.000Z
|
2021-01-05T14:14:30.000Z
|
demo_app.py
|
BonjourGit/nlc2cmd-submission-hubris
|
7928f75ad212295c732dbd4e42ce4eba378d2509
|
[
"MIT"
] | 2
|
2021-01-05T03:16:06.000Z
|
2021-01-14T05:06:31.000Z
|
# Copyright 2020 Nokia
# Licensed under the MIT License.
# SPDX-License-Identifier: MIT
print("STARTING")
from webapp import app
| 21.5
| 33
| 0.775194
| 18
| 129
| 5.555556
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.036036
| 0.139535
| 129
| 6
| 34
| 21.5
| 0.864865
| 0.627907
| 0
| 0
| 0
| 0
| 0.177778
| 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
|
59412084234fbcd13fc4f9991ee8fdd780935067
| 154
|
py
|
Python
|
lib_api_client/exception.py
|
caser789/libapiclient
|
8babab8d7719e0f930f7be57daf22748efed3caf
|
[
"MIT"
] | null | null | null |
lib_api_client/exception.py
|
caser789/libapiclient
|
8babab8d7719e0f930f7be57daf22748efed3caf
|
[
"MIT"
] | null | null | null |
lib_api_client/exception.py
|
caser789/libapiclient
|
8babab8d7719e0f930f7be57daf22748efed3caf
|
[
"MIT"
] | null | null | null |
class MaskSensitiveDataException(Exception):
pass
class RequestException(Exception):
pass
class ResponseParsingException(Exception):
pass
| 14
| 44
| 0.779221
| 12
| 154
| 10
| 0.5
| 0.325
| 0.3
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.162338
| 154
| 10
| 45
| 15.4
| 0.930233
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
3cddbc586efd4e7dd20673bd86f2a32114a451f7
| 675
|
py
|
Python
|
maintain_frontend/view_official_search/routes.py
|
LandRegistry/maintain-frontend
|
d92446a9972ebbcd9a43a7a7444a528aa2f30bf7
|
[
"MIT"
] | 1
|
2019-10-03T13:58:29.000Z
|
2019-10-03T13:58:29.000Z
|
maintain_frontend/view_official_search/routes.py
|
LandRegistry/maintain-frontend
|
d92446a9972ebbcd9a43a7a7444a528aa2f30bf7
|
[
"MIT"
] | null | null | null |
maintain_frontend/view_official_search/routes.py
|
LandRegistry/maintain-frontend
|
d92446a9972ebbcd9a43a7a7444a528aa2f30bf7
|
[
"MIT"
] | 1
|
2021-04-11T05:24:57.000Z
|
2021-04-11T05:24:57.000Z
|
from flask import Blueprint
import maintain_frontend.view_official_search.view_official_search
import maintain_frontend.view_official_search.enter_search_ref
import maintain_frontend.view_official_search.search_results
# Blueprint Definition
view_official_search_bp = Blueprint('view_official_search', __name__,
template_folder='templates')
maintain_frontend.view_official_search.view_official_search.register_routes(view_official_search_bp)
maintain_frontend.view_official_search.enter_search_ref.register_routes(view_official_search_bp)
maintain_frontend.view_official_search.search_results.register_routes(view_official_search_bp)
| 42.1875
| 100
| 0.860741
| 85
| 675
| 6.247059
| 0.235294
| 0.293785
| 0.440678
| 0.316384
| 0.779661
| 0.779661
| 0.681733
| 0.568738
| 0.256121
| 0.256121
| 0
| 0
| 0.091852
| 675
| 15
| 101
| 45
| 0.866232
| 0.02963
| 0
| 0
| 0
| 0
| 0.04441
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.444444
| 0
| 0.444444
| 0.222222
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
a72fc13be56cef062159407be841a1c3c2a8f402
| 138
|
py
|
Python
|
code/exercises/ex_7_2/__init__.py
|
ElliotMunro200/reinforcement_learning_an_introduction
|
c4fccb46a4bb00955549be3505144ec49f0132e5
|
[
"MIT"
] | 234
|
2018-09-01T00:26:29.000Z
|
2022-03-21T03:55:50.000Z
|
code/exercises/ex_7_2/__init__.py
|
15779235038/reinforcement_learning_an_introduction
|
a0ac9e5da6eaeae14d297a560c499d1a6e579c2a
|
[
"MIT"
] | 7
|
2018-11-29T21:04:36.000Z
|
2021-12-13T17:11:50.000Z
|
code/exercises/ex_7_2/__init__.py
|
15779235038/reinforcement_learning_an_introduction
|
a0ac9e5da6eaeae14d297a560c499d1a6e579c2a
|
[
"MIT"
] | 63
|
2018-07-31T04:53:21.000Z
|
2022-03-24T04:03:43.000Z
|
#!/usr/bin/env python
"""
--------------------------------
project: code
created: 02/07/2018 14:00
---------------------------------
"""
| 15.333333
| 33
| 0.326087
| 12
| 138
| 3.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.095238
| 0.086957
| 138
| 8
| 34
| 17.25
| 0.261905
| 0.92029
| 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
|
595aa6ae8b063fe2b36e6483317b3025445e96cf
| 871
|
py
|
Python
|
packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_layout.py
|
tweakimp/plotly.py
|
45a9270130fc0fec51b6205f0223c3f8d9302cff
|
[
"MIT"
] | 1
|
2020-08-08T21:56:11.000Z
|
2020-08-08T21:56:11.000Z
|
packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_layout.py
|
pythonthings/plotly.py
|
b770468d392bf89cbfc630e2c02bd54ec5db97a7
|
[
"MIT"
] | null | null | null |
packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_layout.py
|
pythonthings/plotly.py
|
b770468d392bf89cbfc630e2c02bd54ec5db97a7
|
[
"MIT"
] | null | null | null |
from unittest import TestCase
import plotly.graph_objects as go
class TestUpdateLayout(TestCase):
def test_update_layout_kwargs(self):
# Create initial figure
fig = go.Figure()
fig.layout.title.font.size = 10
# Grab copy of original figure
orig_fig = go.Figure(fig)
fig.update_layout(title_font_family="Courier New")
orig_fig.layout.update(title_font_family="Courier New")
self.assertEqual(fig, orig_fig)
def test_update_layout_dict(self):
# Create initial figure
fig = go.Figure()
fig.layout.title.font.size = 10
# Grab copy of original figure
orig_fig = go.Figure(fig)
fig.update_layout(dict(title=dict(font=dict(family="Courier New"))))
orig_fig.layout.update(title_font_family="Courier New")
self.assertEqual(fig, orig_fig)
| 30.034483
| 76
| 0.668197
| 116
| 871
| 4.836207
| 0.301724
| 0.096257
| 0.078431
| 0.099822
| 0.729055
| 0.713012
| 0.713012
| 0.713012
| 0.713012
| 0.713012
| 0
| 0.006024
| 0.237658
| 871
| 28
| 77
| 31.107143
| 0.838855
| 0.115959
| 0
| 0.588235
| 0
| 0
| 0.057516
| 0
| 0
| 0
| 0
| 0
| 0.117647
| 1
| 0.117647
| false
| 0
| 0.117647
| 0
| 0.294118
| 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
|
ab95418902e4776f0624dbb919e8c44daea130a5
| 109
|
py
|
Python
|
methods/__init__.py
|
hrayrhar/f-CMI
|
2f923169650cf41d25c000f0a3b37c9ba6e264f6
|
[
"MIT"
] | null | null | null |
methods/__init__.py
|
hrayrhar/f-CMI
|
2f923169650cf41d25c000f0a3b37c9ba6e264f6
|
[
"MIT"
] | null | null | null |
methods/__init__.py
|
hrayrhar/f-CMI
|
2f923169650cf41d25c000f0a3b37c9ba6e264f6
|
[
"MIT"
] | 1
|
2022-01-08T20:47:28.000Z
|
2022-01-08T20:47:28.000Z
|
from methods.base import BaseClassifier
from methods.classifiers import StandardClassifier, LangevinDynamics
| 36.333333
| 68
| 0.889908
| 11
| 109
| 8.818182
| 0.727273
| 0.226804
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.082569
| 109
| 2
| 69
| 54.5
| 0.97
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
aba5833f38840aa430dbfe7da3b194bfb39d4d39
| 407
|
py
|
Python
|
core-python/Core_Python/com/ConditionOp.py
|
theumang100/tutorials-1
|
497f54c2adb022c316530319a168fca1c007d4b1
|
[
"MIT"
] | 9
|
2020-04-23T05:24:19.000Z
|
2022-02-17T16:37:51.000Z
|
core-python/Core_Python/com/ConditionOp.py
|
theumang100/tutorials-1
|
497f54c2adb022c316530319a168fca1c007d4b1
|
[
"MIT"
] | 5
|
2020-10-01T05:08:37.000Z
|
2020-10-12T03:18:10.000Z
|
core-python/Core_Python/com/ConditionOp.py
|
theumang100/tutorials-1
|
497f54c2adb022c316530319a168fca1c007d4b1
|
[
"MIT"
] | 9
|
2020-04-28T14:06:41.000Z
|
2021-10-19T18:32:28.000Z
|
from builtins import print
'''a, b, c = True, True, True
print("precedence -> not , and ,or (t & !t = f,now f | t = t so o/p is t): ", a and not b or c)'''
a, b, c = True, True, False
print("precedence -> not , and ,or (t & !t = f,now f | f = f so o/p is f): ", a and not b or c)
a, b, c = True, False, False
print("precedence -> not , and ,or (t & !f = t,now t | f = t so o/p is t): ", a and not b or c)
| 40.7
| 98
| 0.542998
| 91
| 407
| 2.428571
| 0.21978
| 0.036199
| 0.040724
| 0.095023
| 0.778281
| 0.710407
| 0.710407
| 0.556561
| 0.556561
| 0.556561
| 0
| 0
| 0.265356
| 407
| 10
| 99
| 40.7
| 0.73913
| 0
| 0
| 0
| 0
| 0.4
| 0.485714
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.2
| 0
| 0.2
| 0.6
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
f9f18b77228f9f5a0a27fa0af0b06c735698142c
| 128
|
py
|
Python
|
Divergent430/TransferLearning/test_files/test_basset_model.py
|
jeffmylife/models
|
30f398518ea1709245a9de445fcff8071528e400
|
[
"MIT"
] | null | null | null |
Divergent430/TransferLearning/test_files/test_basset_model.py
|
jeffmylife/models
|
30f398518ea1709245a9de445fcff8071528e400
|
[
"MIT"
] | null | null | null |
Divergent430/TransferLearning/test_files/test_basset_model.py
|
jeffmylife/models
|
30f398518ea1709245a9de445fcff8071528e400
|
[
"MIT"
] | null | null | null |
version https://git-lfs.github.com/spec/v1
oid sha256:82f0028babea09ee16e2c630b6d4873e204d5b6b728de33335a112d3103c179f
size 874
| 32
| 75
| 0.882813
| 13
| 128
| 8.692308
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.401639
| 0.046875
| 128
| 3
| 76
| 42.666667
| 0.52459
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 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
| 0
| null | 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
e60a80d46b3b853355945d9aaa2c9a170a8524b8
| 254
|
py
|
Python
|
preprocessing/Processor.py
|
mrForest13/sentiment-analysis
|
f747800b78dbf5d9c598d52cbe9f92a44b90cc42
|
[
"Apache-2.0"
] | null | null | null |
preprocessing/Processor.py
|
mrForest13/sentiment-analysis
|
f747800b78dbf5d9c598d52cbe9f92a44b90cc42
|
[
"Apache-2.0"
] | null | null | null |
preprocessing/Processor.py
|
mrForest13/sentiment-analysis
|
f747800b78dbf5d9c598d52cbe9f92a44b90cc42
|
[
"Apache-2.0"
] | null | null | null |
import abc
class Processor(object):
def __init__(self):
self.next_processor = None
def next(self, next_processor):
self.next_processor = next_processor
@abc.abstractmethod
def process(self, data):
return data
| 16.933333
| 44
| 0.661417
| 30
| 254
| 5.333333
| 0.466667
| 0.325
| 0.31875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.259843
| 254
| 14
| 45
| 18.142857
| 0.851064
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.111111
| 0.111111
| 0.666667
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
e60dd9d78b0ad12ce72a729e4e0eb8369d574246
| 766
|
py
|
Python
|
config.py
|
Pingal-co/natural_language_cloud
|
175bac92d525a69ae5935f1e0434734b6e426839
|
[
"MIT"
] | null | null | null |
config.py
|
Pingal-co/natural_language_cloud
|
175bac92d525a69ae5935f1e0434734b6e426839
|
[
"MIT"
] | null | null | null |
config.py
|
Pingal-co/natural_language_cloud
|
175bac92d525a69ae5935f1e0434734b6e426839
|
[
"MIT"
] | null | null | null |
"""
registry = {
'NLP_SERVICE_ADDRESS': "ipc:///tmp/nlp-service.sock",
'ANN_SERVICE_ADDRESS': "ipc:///tmp/ann-service.sock",
'RECOMMEND_SERVICE_ADDRESS': "ipc:///tmp/recommend-service.sock",
'DIALOG_SERVICE_ADDRESS': "ipc:///tmp/dialog-service.sock",
'INTENT_SERVICE_ADDRESS': "ipc:///tmp/intent-service.sock",
'MATH_SERVICE_ADDRESS': "ipc:///tmp/math-service.sock"
}
"""
registry = {
'ANN_SERVICE_ADDRESS': "tcp://198.211.104.216:9010",
'RECOMMEND_SERVICE_ADDRESS': "tcp://159.203.181.52:9020",
'DIALOG_SERVICE_ADDRESS': "tcp://198.211.104.216:9030",
'INTENT_SERVICE_ADDRESS': "tcp://198.211.104.216:9040",
'MATH_SERVICE_ADDRESS': "tcp://198.211.104.216:9050",
'NLP_SERVICE_ADDRESS': "tcp://198.211.104.216:9090"
}
| 34.818182
| 69
| 0.673629
| 104
| 766
| 4.730769
| 0.259615
| 0.341463
| 0.207317
| 0.243902
| 0.294715
| 0.294715
| 0.294715
| 0
| 0
| 0
| 0
| 0.139296
| 0.109661
| 766
| 21
| 70
| 36.47619
| 0.582111
| 0.503916
| 0
| 0
| 0
| 0
| 0.762162
| 0.605405
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 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
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
e62e5300e11587db09eeb072486b71ebca4b9a24
| 4,178
|
py
|
Python
|
sky/views.py
|
eethan1/IMnight2018_Backend
|
39780f737e57763fdfb171c4687a375d3c5a4bb0
|
[
"Apache-2.0"
] | null | null | null |
sky/views.py
|
eethan1/IMnight2018_Backend
|
39780f737e57763fdfb171c4687a375d3c5a4bb0
|
[
"Apache-2.0"
] | null | null | null |
sky/views.py
|
eethan1/IMnight2018_Backend
|
39780f737e57763fdfb171c4687a375d3c5a4bb0
|
[
"Apache-2.0"
] | 4
|
2018-01-27T06:01:41.000Z
|
2018-02-21T12:18:35.000Z
|
from django.shortcuts import render
from rest_framework.generics import GenericAPIView, RetrieveUpdateAPIView, ListAPIView, CreateAPIView
from rest_framework.views import APIView
from rest_framework.permissions import IsAuthenticated, AllowAny
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework.response import Response
from sky.models import Article, News, Course
from sky.serializers import NewsSerializer, ArticleSerializer, CourseSerializer, ArticleListSerializer, CourseListSerializer
QUERY_MAX = 10
class CourseListView(ListAPIView):
"""
取得課程
default_para = {'index':'0', 'num':'5', 'label':None}
"""
permission_classes = (AllowAny,)
authentication_classes = (SessionAuthentication, BasicAuthentication)
serializer_class = CourseListSerializer
default_para = {'index': '0', 'num': '5', 'label': None}
para_key = ('index', 'num', 'label')
def get_queryset(self):
q = {}
for key in self.para_key:
q[key] = self.request.query_params.get(key, self.default_para[key])
queryset = Course.objects.all()
if int(q['num']) > QUERY_MAX:
q['num'] = QUERY_MAX
if q['label'] is not None:
queryset = queryset.filter(label=q['label'])
queryset = queryset.order_by(
'-created')[int(q['index']):int(q['index']) + int(q['num'])]
return queryset
class CourseView(ListAPIView):
permission_classes = (AllowAny,)
authentication_classes = (SessionAuthentication, BasicAuthentication)
serializer_class = CourseSerializer
def get_queryset(self):
if 'label' not in self.kwargs:
# wrong url setting
return []
label = self.kwargs['label']
queryset = Course.objects.none()
if label is not None:
queryset = Course.objects.filter(label=label)
return queryset
class ArticleListView(ListAPIView):
"""
取得文章
default_para = {'index':'0', 'num':'5', 'label':None}
"""
permission_classes = (AllowAny,)
authentication_classes = (SessionAuthentication, BasicAuthentication)
serializer_class = ArticleListSerializer
default_para = {'index': '0', 'num': '5', 'label': None}
para_key = ('index', 'num', 'label')
def get_queryset(self):
q = {}
for key in self.para_key:
q[key] = self.request.query_params.get(key, self.default_para[key])
queryset = Article.objects.all()
if int(q['num']) > QUERY_MAX:
q['num'] = QUERY_MAX
if q['label'] is not None:
queryset = queryset.filter(label=q['label'])
queryset = queryset.order_by(
'-created')[int(q['index']):int(q['index']) + int(q['num'])]
return queryset
class ArticleView(ListAPIView):
permission_classes = (AllowAny,)
authentication_classes = (SessionAuthentication, BasicAuthentication)
serializer_class = ArticleSerializer
def get_queryset(self):
if 'label' not in self.kwargs:
# wrong url setting
return []
label = self.kwargs['label']
queryset = Article.objects.none()
if label is not None:
queryset = Article.objects.filter(label=label)
return queryset
class NewsListView(ListAPIView):
"""
取得News
default_para = {'index':'0', 'num':'5', 'label':None}
"""
permission_classes = (AllowAny,)
authentication_classes = (SessionAuthentication, BasicAuthentication)
serializer_class = NewsSerializer
default_para = {'index': '0', 'num': '5', 'label': None}
para_key = ('index', 'num', 'label')
def get_queryset(self):
q = {}
for key in self.para_key:
q[key] = self.request.query_params.get(key, self.default_para[key])
queryset = News.objects.all()
if int(q['num']) > QUERY_MAX:
q['num'] = QUERY_MAX
if q['label'] is not None:
queryset = queryset.filter(label=q['label'])
queryset = queryset.order_by(
'-created')[int(q['index']):int(q['index']) + int(q['num'])]
return queryset
| 33.15873
| 124
| 0.635711
| 455
| 4,178
| 5.720879
| 0.175824
| 0.01844
| 0.036881
| 0.039186
| 0.718786
| 0.718786
| 0.718786
| 0.686516
| 0.659624
| 0.659624
| 0
| 0.004383
| 0.235519
| 4,178
| 125
| 125
| 33.424
| 0.810582
| 0.05146
| 0
| 0.701149
| 0
| 0
| 0.055072
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.057471
| false
| 0
| 0.091954
| 0
| 0.528736
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
e639899b4f278f990c88c77399f80335d6a2271b
| 44
|
py
|
Python
|
services/todoAPI/test/__init__.py
|
Ovakefali13/buerro
|
1476f6e708f95a09a2d73f67ae8aa2cb3bb836af
|
[
"MIT"
] | 2
|
2020-03-26T19:20:31.000Z
|
2020-03-30T13:09:07.000Z
|
services/todoAPI/test/__init__.py
|
Ovakefali13/buerro
|
1476f6e708f95a09a2d73f67ae8aa2cb3bb836af
|
[
"MIT"
] | 51
|
2020-03-05T09:04:21.000Z
|
2021-12-13T20:34:22.000Z
|
services/todoAPI/test/__init__.py
|
Ovakefali13/buerro
|
1476f6e708f95a09a2d73f67ae8aa2cb3bb836af
|
[
"MIT"
] | null | null | null |
from .test_service import TodoistMockRemote
| 22
| 43
| 0.886364
| 5
| 44
| 7.6
| 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
|
e63cc4096a3ac962d2527bfbaff59d292016f1d3
| 1,878
|
py
|
Python
|
nsist/tests/test_commands.py
|
daleathan/pynsist
|
fa69cd31b15d59544bd9f1d280a637916028b749
|
[
"MIT"
] | 671
|
2015-01-11T05:16:03.000Z
|
2022-03-28T18:27:18.000Z
|
nsist/tests/test_commands.py
|
daleathan/pynsist
|
fa69cd31b15d59544bd9f1d280a637916028b749
|
[
"MIT"
] | 203
|
2015-01-05T18:33:53.000Z
|
2022-03-21T11:49:05.000Z
|
nsist/tests/test_commands.py
|
daleathan/pynsist
|
fa69cd31b15d59544bd9f1d280a637916028b749
|
[
"MIT"
] | 118
|
2015-01-14T20:36:19.000Z
|
2022-01-18T22:50:25.000Z
|
import io
from testpath import assert_isfile, assert_not_path_exists
from zipfile import ZipFile
from nsist import commands
def test_prepare_bin_dir(tmp_path):
cmds = {
'acommand': {
'entry_point': 'somemod:somefunc',
'extra_preamble': io.StringIO(u'import extra')
}
}
commands.prepare_bin_directory(tmp_path, cmds)
exe_file = str(tmp_path / 'acommand.exe')
assert_isfile(exe_file)
with open(commands.find_exe(console=True), 'rb') as lf:
b_launcher = lf.read()
assert b_launcher[:2] == b'MZ' # Sanity check
with open(exe_file, 'rb') as ef:
b_exe = ef.read()
assert b_exe[:len(b_launcher)] == b_launcher
assert b_exe[len(b_launcher):].startswith(b"#!<launcher_dir>\\..\\Python\\python.exe\r\n")
with ZipFile(exe_file) as zf:
assert zf.testzip() is None
script_contents = zf.read('__main__.py').decode('utf-8')
assert 'import extra' in script_contents
assert 'somefunc()' in script_contents
def test_prepare_bin_dir_noconsole(tmp_path):
cmds = {
'acommand': {
'entry_point': 'somemod:somefunc',
'console': False
}
}
commands.prepare_bin_directory(tmp_path, cmds)
exe_file = str(tmp_path / 'acommand.exe')
assert_isfile(exe_file)
with open(commands.find_exe(console=False), 'rb') as lf:
b_launcher = lf.read()
assert b_launcher[:2] == b'MZ' # Sanity check
with open(exe_file, 'rb') as ef:
b_exe = ef.read()
assert b_exe[:len(b_launcher)] == b_launcher
assert b_exe[len(b_launcher):].startswith(b"#!<launcher_dir>\\..\\Python\\pythonw.exe\r\n")
with ZipFile(exe_file) as zf:
assert zf.testzip() is None
script_contents = zf.read('__main__.py').decode('utf-8')
assert 'somefunc()' in script_contents
| 30.786885
| 99
| 0.635783
| 259
| 1,878
| 4.351351
| 0.262548
| 0.09583
| 0.039042
| 0.04614
| 0.814552
| 0.731145
| 0.731145
| 0.731145
| 0.653061
| 0.653061
| 0
| 0.00277
| 0.231097
| 1,878
| 60
| 100
| 31.3
| 0.777701
| 0.013312
| 0
| 0.638298
| 0
| 0
| 0.157838
| 0.048108
| 0
| 0
| 0
| 0
| 0.297872
| 1
| 0.042553
| false
| 0
| 0.12766
| 0
| 0.170213
| 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
|
e63e17e141b3211d062de76134ccea2ca2cb079c
| 88
|
py
|
Python
|
Python/Set 01/challenge01.py
|
felipeAraujo/cryptopals-solutions
|
8ec848b95a2135f38d908623a5b1abdccbdc1242
|
[
"MIT"
] | null | null | null |
Python/Set 01/challenge01.py
|
felipeAraujo/cryptopals-solutions
|
8ec848b95a2135f38d908623a5b1abdccbdc1242
|
[
"MIT"
] | null | null | null |
Python/Set 01/challenge01.py
|
felipeAraujo/cryptopals-solutions
|
8ec848b95a2135f38d908623a5b1abdccbdc1242
|
[
"MIT"
] | null | null | null |
def cg01_hex_to_base64(value):
return value.decode("hex").encode("base64").strip()
| 22
| 55
| 0.715909
| 13
| 88
| 4.615385
| 0.769231
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.075949
| 0.102273
| 88
| 3
| 56
| 29.333333
| 0.683544
| 0
| 0
| 0
| 0
| 0
| 0.103448
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
e64806ec2985e9ccf7b4d040280e6172c5497ddd
| 140
|
py
|
Python
|
neurokit2/misc/__init__.py
|
purpl3F0x/NeuroKit
|
bd41f2bf7692bc8ed4c85608daa535293a33a1d6
|
[
"MIT"
] | null | null | null |
neurokit2/misc/__init__.py
|
purpl3F0x/NeuroKit
|
bd41f2bf7692bc8ed4c85608daa535293a33a1d6
|
[
"MIT"
] | null | null | null |
neurokit2/misc/__init__.py
|
purpl3F0x/NeuroKit
|
bd41f2bf7692bc8ed4c85608daa535293a33a1d6
|
[
"MIT"
] | null | null | null |
"""Submodule for NeuroKit."""
from .listify import listify
from .findclosest import findclosest
from .sanitize_input import sanitize_input
| 23.333333
| 42
| 0.814286
| 17
| 140
| 6.588235
| 0.529412
| 0.232143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.114286
| 140
| 5
| 43
| 28
| 0.903226
| 0.164286
| 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
|
0504f55e85ca72cffa1af4c6c108c82959dd8356
| 1,480
|
py
|
Python
|
mri_works/NodeEditor/python/__init__.py
|
montigno/mri_works
|
8ec6ff1500aa34d3540e44e4b0148023cf821f61
|
[
"CECILL-B"
] | 2
|
2020-08-20T21:00:53.000Z
|
2021-08-16T15:28:51.000Z
|
mri_works/NodeEditor/python/__init__.py
|
montigno/mri_works
|
8ec6ff1500aa34d3540e44e4b0148023cf821f61
|
[
"CECILL-B"
] | 3
|
2020-09-24T06:50:43.000Z
|
2020-12-15T11:02:04.000Z
|
mri_works/NodeEditor/python/__init__.py
|
montigno/mri_works
|
8ec6ff1500aa34d3540e44e4b0148023cf821f61
|
[
"CECILL-B"
] | 1
|
2020-08-20T21:00:59.000Z
|
2020-08-20T21:00:59.000Z
|
##########################################################################
# mriWorks - Copyright (C) IRMAGE/INSERM, 2020
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# https://cecill.info/licences/Licence_CeCILL_V2-en.html
# for details.
##########################################################################
from NodeEditor.python.PipeLine_Analyze import analyze
from NodeEditor.python.PipeLine_Execution import execution
from NodeEditor.python.editParam import editParam
from NodeEditor.python.editParamForLoop import editParamLoopFor
from NodeEditor.python.titleScript import changeTitle
from NodeEditor.python.addOptions import chOptions
from NodeEditor.python.defTunnels import defineTunnels
from NodeEditor.python.def_inputs_outputs import define_inputs_outputs
from NodeEditor.python.changeLabelConn import changeLabel
from NodeEditor.python.errorHandler import errorHandler
from NodeEditor.python.loadModules import getlistModules
from NodeEditor.python.loadSubModules import getlistSubModules
from NodeEditor.python.sourceBlock import seeCode
from NodeEditor.python.configStandalone import ConfigModuls, windowConfig
from NodeEditor.python.constantCombobox import editCombobox
from NodeEditor.python.Capsul.export_Capsul import exportCapsul
from NodeEditor.python.syntax import PythonHighlighter
from NodeEditor.python.multiExecution import multiple_execution
from Config import Config
| 54.814815
| 74
| 0.781757
| 162
| 1,480
| 7.080247
| 0.462963
| 0.219704
| 0.313862
| 0.048823
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.003658
| 0.076351
| 1,480
| 27
| 75
| 54.814815
| 0.835406
| 0.157432
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
051044be4ebe944039e7dd5da81f5274f8445698
| 167
|
py
|
Python
|
tm2py/components/network/transit/transit_skim.py
|
camsys/tm2py
|
e92681e7fa289df91f3d1421a1b17ee48ae74d53
|
[
"Apache-2.0"
] | null | null | null |
tm2py/components/network/transit/transit_skim.py
|
camsys/tm2py
|
e92681e7fa289df91f3d1421a1b17ee48ae74d53
|
[
"Apache-2.0"
] | null | null | null |
tm2py/components/network/transit/transit_skim.py
|
camsys/tm2py
|
e92681e7fa289df91f3d1421a1b17ee48ae74d53
|
[
"Apache-2.0"
] | null | null | null |
"""Transit skims module"""
from ...component import Component
# from ....controller import RunController
class TransitSkim(Component):
"""Run transit skims"""
| 16.7
| 42
| 0.712575
| 17
| 167
| 7
| 0.647059
| 0.201681
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.149701
| 167
| 9
| 43
| 18.555556
| 0.838028
| 0.479042
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 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
|
5544fe02b66ae6e03bbf24f6353d08282fcba7db
| 9,620
|
py
|
Python
|
chatterbot/input/input_adapter.py
|
Reinaesaya/OUIRL-ChatBot
|
27e4bba4b0ece62ac45ef9901a4a02f8370b3fd5
|
[
"BSD-3-Clause"
] | null | null | null |
chatterbot/input/input_adapter.py
|
Reinaesaya/OUIRL-ChatBot
|
27e4bba4b0ece62ac45ef9901a4a02f8370b3fd5
|
[
"BSD-3-Clause"
] | null | null | null |
chatterbot/input/input_adapter.py
|
Reinaesaya/OUIRL-ChatBot
|
27e4bba4b0ece62ac45ef9901a4a02f8370b3fd5
|
[
"BSD-3-Clause"
] | null | null | null |
from __future__ import unicode_literals
from chatterbot.adapters import Adapter
from chatterbot.conversation import Statement
from chatterbot.constants import *
import random
import time
class InputAdapter(Adapter):
"""
This is an abstract class that represents the
interface that all input adapters should implement.
"""
def __init__(self, **kwargs):
super(InputAdapter, self).__init__(**kwargs)
self.abstractadaptertype = "NORMAL"
self.genconvoimage = [
"generate conversation from image",
"make conversation from image",
"genconvoimage",
]
self.takepicture = [
"take picture",
"take a picture",
"takepicture",
]
self.lookforconvo = [
"look for conversation",
"lookforconvo",
]
self.lookatscreenforconvo = [
"look at screen for conversation",
"new topic",
"new topic of conversation",
"new conversation",
"what is on the screen",
"lookatscreenforconvo",
]
self.cycle = 0
def process_input(self, *args, **kwargs):
"""
Returns a statement object based on the input source.
"""
raise self.AdapterMethodNotImplementedError()
def process_input_statement(self, *args, **kwargs):
"""
Return an existing statement object (if one exists).
"""
input_statement = self.process_input(*args, **kwargs)
self.logger.info('Received input statement: {}'.format(input_statement.text))
existing_statement = self.chatbot.storage.find(input_statement.text)
if existing_statement:
self.logger.info('"{}" is a known statement'.format(input_statement.text))
input_statement = existing_statement
exists = True
else:
self.logger.info('"{}" is not a known statement'.format(input_statement.text))
exists = False
return input_statement, exists
def check_if_known(self, s):
input_statement = Statement(s)
self.logger.info('Received input statement: {}'.format(input_statement.text))
existing_statement = self.chatbot.storage.find(input_statement.text)
if existing_statement:
self.logger.info('"{}" is a known statement'.format(input_statement.text))
input_statement = existing_statement
exists = True
else:
self.logger.info('"{}" is not a known statement'.format(input_statement.text))
exists = False
return input_statement, exists
def process_input_statement_cmdline(self, *args, **kwargs):
"""
Return an existing statement object (if one exists).
"""
input_statement = self.process_input(*args, **kwargs)
self.logger.info('Received input statement: {}'.format(input_statement.text))
override = ''
if input_statement.text.startswith("--override "): # --override ImageCaptioningAdapter
override = input_statement.text.split()[1]
input_statement = Statement(' '.join(input_statement.text.split()[2:]))
elif input_statement.text.startswith("--genconvo "): # --genconvo sports
keyword, exists = self.chatbot.check_convo_keyword(input_statement.text.split()[1])
print(keyword)
if exists:
tatora_response = self.chatbot.generate_conversation(keyword)
override = "NewConversationStarter"
input_statement = Statement(keyword.lower())
elif input_statement.text.startswith("--genconvoimage"): # --genconvoimage random
override = "ImageCaptioningAdapter"
elif input_statement.text.startswith("--move "):
if self.chatbot.commu_move:
self.chatbot.commu.move(input_statement.text.split()[1], input_statement.text.split()[2], input_statement.text.split()[3])
input_statement = Statement("*actioncommand*")
elif input_statement.text.startswith("--look "):
if self.chatbot.commu_move:
self.chatbot.commu.look(input_statement.text.split()[1], input_statement.text.split()[2], input_statement.text.split()[3])
input_statement = Statement("*actioncommand*")
elif input_statement.text.startswith("--takepicture"):
if self.chatbot.commu is not None:
self.chatbot.commu.takepicture()
input_statement = Statement("*actioncommand*")
elif input_statement.text.startswith("--lookforconvo"):
if self.chatbot.commu_move:
x = random.sample(xrange(100,400),1)[0]*random.sample([-1,1],1)[0]
y = random.sample(xrange(200,400),1)[0]
z = random.sample(xrange(250,750),1)[0]
self.chatbot.commu.look(x, y, z)
picturecommandsendtime = time.time()
self.chatbot.commu.takepicture()
while self.chatbot.getcaptiontimestamp() < picturecommandsendtime:
time.sleep(0.5)
self.chatbot.resetCommU_initPos()
input_statement = Statement("genconvoimage")
override = "ImageCaptioningAdapter"
elif input_statement.text.startswith("--lookatscreenforconvo"):
if self.chatbot.commu_move:
self.chatbot.commu.move(self.chatbot.commu.AXIS['LATERAL_BODY'], 100, 100)
self.chatbot.commu.move(self.chatbot.commu.AXIS['TURN_HEAD'], 100, 50)
self.chatbot.commu.move(self.chatbot.commu.AXIS['PITCH_HEAD'], 0, 25)
picturecommandsendtime = time.time()
self.chatbot.commu.takepicture()
while self.chatbot.getcaptiontimestamp() < picturecommandsendtime:
time.sleep(0.5)
self.chatbot.resetCommU_initPos()
input_statement = Statement("genconvoimage")
override = "ImageCaptioningAdapter"
else:
pass
existing_statement = self.chatbot.storage.find(input_statement.text)
if existing_statement:
self.logger.info('"{}" is a known statement'.format(input_statement.text))
input_statement = existing_statement
exists = True
else:
self.logger.info('"{}" is not a known statement'.format(input_statement.text))
exists = False
return input_statement, exists, override
def process_input_statement_tatora(self, *args, **kwargs):
"""
Return an existing statement object (if one exists).
"""
self.cycle += 1
input_statement = self.process_input(*args, **kwargs)
self.logger.info('Received input statement: {}'.format(input_statement.text))
override = ''
cleaned = self.cleansentence(input_statement.text)
if self.statementmatch(cleaned, self.lookatscreenforconvo) or \
(self.convoforce and self.cycle >= CONVOSTART_FORCE):
if self.chatbot.commu_move:
self.chatbot.commu.move(self.chatbot.commu.AXIS['LATERAL_BODY'], 100, 100)
self.chatbot.commu.move(self.chatbot.commu.AXIS['TURN_HEAD'], 100, 50)
self.chatbot.commu.move(self.chatbot.commu.AXIS['PITCH_HEAD'], 0, 150)
picturecommandsendtime = time.time()
self.chatbot.commu.takepicture()
while self.chatbot.getcaptiontimestamp() < picturecommandsendtime:
time.sleep(0.5)
self.chatbot.resetCommU_initPos()
input_statement = Statement("genconvoimage")
override = "ImageCaptioningAdapter"
if (self.convoforce and self.cycle >= CONVOSTART_FORCE):
print("Forcing new conversation")
self.cycle = 0
elif self.statementmatch(cleaned, self.genconvoimage):
input_statement = Statement("genconvoimage")
override = "ImageCaptioningAdapter"
elif self.statementmatch(cleaned, self.takepicture):
if self.chatbot.commu is not None:
self.chatbot.commu.takepicture()
input_statement = Statement("*actioncommand*")
elif self.statementmatch(cleaned, self.lookforconvo):
if self.chatbot.commu_move:
x = random.sample(xrange(100,400),1)[0]*random.sample([-1,1],1)[0]
y = random.sample(xrange(200,400),1)[0]
z = random.sample(xrange(250,750),1)[0]
self.chatbot.commu.look(x, y, z)
picturecommandsendtime = time.time()
self.chatbot.commu.takepicture()
while self.chatbot.getcaptiontimestamp() < picturecommandsendtime:
time.sleep(0.5)
self.chatbot.resetCommU_initPos()
input_statement = Statement("genconvoimage")
override = "ImageCaptioningAdapter"
else:
pass
existing_statement = self.chatbot.storage.find(input_statement.text)
if existing_statement:
self.logger.info('"{}" is a known statement'.format(input_statement.text))
input_statement = existing_statement
exists = True
else:
self.logger.info('"{}" is not a known statement'.format(input_statement.text))
exists = False
return input_statement, exists, override
def process_input_statement_tatoraControl(self, *args, **kwargs):
"""
Return an existing statement object (if one exists).
"""
self.cycle += 1
input_statement = self.process_input(*args, **kwargs)
self.logger.info('Received input statement: {}'.format(input_statement.text))
override = ''
cleaned = self.cleansentence(input_statement.text)
if self.statementmatch(cleaned, self.genconvoimage) or \
self.statementmatch(cleaned, self.lookforconvo) or \
self.statementmatch(cleaned, self.lookatscreenforconvo) or \
(self.convoforce and self.cycle >= CONVOSTART_FORCE):
input_statement = Statement("genconvoimage")
override = "ImageCaptioningAdapter"
if (self.convoforce and self.cycle >= CONVOSTART_FORCE):
print("Forcing new conversation")
self.cycle = 0
else:
pass
existing_statement = self.chatbot.storage.find(input_statement.text)
if existing_statement:
self.logger.info('"{}" is a known statement'.format(input_statement.text))
input_statement = existing_statement
exists = True
else:
self.logger.info('"{}" is not a known statement'.format(input_statement.text))
exists = False
return input_statement, exists, override
def statementmatch(self, cleaned_statement, match_list):
match = False
for p in match_list:
if p in cleaned_statement:
match = True
break
return match
def cleansentence(self, sentence):
cleaned = ''.join([x for x in sentence.lower() if x.isalpha() or x==' '])
return cleaned
| 31.644737
| 126
| 0.719751
| 1,141
| 9,620
| 5.945662
| 0.131464
| 0.154776
| 0.103479
| 0.064121
| 0.786704
| 0.746315
| 0.746315
| 0.716539
| 0.710938
| 0.700619
| 0
| 0.013174
| 0.155717
| 9,620
| 303
| 127
| 31.749175
| 0.822088
| 0.045634
| 0
| 0.646226
| 0
| 0
| 0.132448
| 0.021727
| 0
| 0
| 0
| 0
| 0
| 1
| 0.042453
| false
| 0.014151
| 0.028302
| 0
| 0.108491
| 0.014151
| 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
|
5579f7f3146216d9c62a7f840cef15bf25df2f96
| 130
|
py
|
Python
|
test_apps/python_plugin/tests/shared/__init__.py
|
Origen-SDK/o2
|
5b0f9a6d113ddebc73c7ee224931e8b2d0301794
|
[
"MIT"
] | null | null | null |
test_apps/python_plugin/tests/shared/__init__.py
|
Origen-SDK/o2
|
5b0f9a6d113ddebc73c7ee224931e8b2d0301794
|
[
"MIT"
] | 127
|
2019-11-23T17:09:35.000Z
|
2021-09-02T11:06:20.000Z
|
rust/origen/cli/src/commands/new/templates/py_app/tests/shared/__init__.py
|
Origen-SDK/o2
|
5b0f9a6d113ddebc73c7ee224931e8b2d0301794
|
[
"MIT"
] | null | null | null |
# This is a good place to add helper functions that you want to make
# available to all of your tests
import pytest
import origen
| 26
| 68
| 0.784615
| 24
| 130
| 4.25
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.2
| 130
| 5
| 69
| 26
| 0.980769
| 0.746154
| 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
|
e949b6f0c8427b6081853952bdbab60ca74eae83
| 165
|
bzl
|
Python
|
docs/docs.bzl
|
dmayle/rules_sqlc
|
c465542827a086994e9427e2c792bbc4355c3e70
|
[
"Apache-2.0"
] | 2
|
2020-12-09T16:01:14.000Z
|
2021-02-15T09:24:27.000Z
|
docs/docs.bzl
|
dmayle/rules_sqlc
|
c465542827a086994e9427e2c792bbc4355c3e70
|
[
"Apache-2.0"
] | 2
|
2020-12-08T16:46:25.000Z
|
2020-12-09T16:17:55.000Z
|
docs/docs.bzl
|
dmayle/rules_sqlc
|
c465542827a086994e9427e2c792bbc4355c3e70
|
[
"Apache-2.0"
] | 3
|
2021-07-28T20:39:10.000Z
|
2022-01-26T19:33:28.000Z
|
load("//sqlc:def.bzl", _sqlc_package = "sqlc_package")
load("//sqlc:def.bzl", _SQLCRelease = "SQLCRelease")
sqlc_package = _sqlc_package
SQLCRelease = _SQLCRelease
| 27.5
| 54
| 0.751515
| 20
| 165
| 5.8
| 0.3
| 0.37931
| 0.189655
| 0.241379
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.090909
| 165
| 5
| 55
| 33
| 0.773333
| 0
| 0
| 0
| 0
| 0
| 0.309091
| 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
| 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
|
e95c7a816894c862d7a396e1f207056d9c9ce23a
| 87
|
py
|
Python
|
likes/admin.py
|
mccuyper/SocialMedia-DRF
|
5908a2da59904368d5e2dbcfe19b3d7c8563c792
|
[
"MIT"
] | null | null | null |
likes/admin.py
|
mccuyper/SocialMedia-DRF
|
5908a2da59904368d5e2dbcfe19b3d7c8563c792
|
[
"MIT"
] | null | null | null |
likes/admin.py
|
mccuyper/SocialMedia-DRF
|
5908a2da59904368d5e2dbcfe19b3d7c8563c792
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Likes
admin.site.register(Likes)
| 17.4
| 32
| 0.816092
| 13
| 87
| 5.461538
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.114943
| 87
| 5
| 33
| 17.4
| 0.922078
| 0
| 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
|
e965fb663ec4aa588052b79193b3d8d33502f887
| 91
|
py
|
Python
|
src/app/models/__init__.py
|
Karim-Valeev/django-finances
|
1923f64a2e7f49d59d37d1dada878bd41fa190ed
|
[
"MIT"
] | null | null | null |
src/app/models/__init__.py
|
Karim-Valeev/django-finances
|
1923f64a2e7f49d59d37d1dada878bd41fa190ed
|
[
"MIT"
] | null | null | null |
src/app/models/__init__.py
|
Karim-Valeev/django-finances
|
1923f64a2e7f49d59d37d1dada878bd41fa190ed
|
[
"MIT"
] | null | null | null |
from .user_model import WalletUser, UserManager
from .note import NoteType, Note, NotePaid
| 30.333333
| 47
| 0.824176
| 12
| 91
| 6.166667
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.120879
| 91
| 2
| 48
| 45.5
| 0.925
| 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
|
e983bfa73b57579195ab5076c784fb0406f75810
| 168
|
py
|
Python
|
app/home/__init__.py
|
LambArchie/Competition-Manager
|
7da4c8625f0bd0c1b002b4f2aef72529e1ede4c6
|
[
"MIT"
] | null | null | null |
app/home/__init__.py
|
LambArchie/Competition-Manager
|
7da4c8625f0bd0c1b002b4f2aef72529e1ede4c6
|
[
"MIT"
] | 1
|
2021-06-14T14:48:06.000Z
|
2021-06-14T15:42:40.000Z
|
app/home/__init__.py
|
LambArchie/Competition-Manager
|
7da4c8625f0bd0c1b002b4f2aef72529e1ede4c6
|
[
"MIT"
] | null | null | null |
"""
Initialises Home
"""
from flask import Blueprint
bp = Blueprint('home', __name__, template_folder='templates', static_folder='files')
from app.home import routes
| 18.666667
| 84
| 0.755952
| 21
| 168
| 5.761905
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.119048
| 168
| 8
| 85
| 21
| 0.817568
| 0.095238
| 0
| 0
| 0
| 0
| 0.125
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0.666667
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
|
0
| 5
|
e9914d1c5b3da2d47a46b5a8ba40d744b5d476c1
| 13,782
|
py
|
Python
|
animation.py
|
EverythingForked/DedSec
|
e80cf24fcd805c5ed9d70b6f245bbc1c37317eb2
|
[
"MIT"
] | null | null | null |
animation.py
|
EverythingForked/DedSec
|
e80cf24fcd805c5ed9d70b6f245bbc1c37317eb2
|
[
"MIT"
] | null | null | null |
animation.py
|
EverythingForked/DedSec
|
e80cf24fcd805c5ed9d70b6f245bbc1c37317eb2
|
[
"MIT"
] | null | null | null |
#!/usr/local/bin/python
# coding: latin-1
# Someone is watchin' at the script... Don't worry, it's alright if u dont touch anything :)
# - Retr0
"""
▒██ ██▒ █████▒▒█████ ██▀███ █ █░ ▒█████ ██▀███ ██ ▄█▀ ██████
▒▒ █ █ ▒░▓██ ▒▒██▒ ██▒▓██ ▒ ██▒▓█░ █ ░█░▒██▒ ██▒▓██ ▒ ██▒ ██▄█▒ ▒██ ▒
░░ █ ░▒████ ░▒██░ ██▒▓██ ░▄█ ▒▒█░ █ ░█ ▒██░ ██▒▓██ ░▄█ ▒▓███▄░ ░ ▓██▄
░ █ █ ▒ ░▓█▒ ░▒██ ██░▒██▀▀█▄ ░█░ █ ░█ ▒██ ██░▒██▀▀█▄ ▓██ █▄ ▒ ██▒
▒██▒ ▒██▒░▒█░ ░ ████▓▒░░██▓ ▒██▒░░██▒██▓ ░ ████▓▒░░██▓ ▒██▒▒██▒ █▄▒██████▒▒
▒▒ ░ ░▓ ░ ▒ ░ ░ ▒░▒░▒░ ░ ▒▓ ░▒▓░░ ▓░▒ ▒ ░ ▒░▒░▒░ ░ ▒▓ ░▒▓░▒ ▒▒ ▓▒▒ ▒▓▒ ▒ ░
░░ ░▒ ░ ░ ░ ▒ ▒░ ░▒ ░ ▒░ ▒ ░ ░ ░ ▒ ▒░ ░▒ ░ ▒░░ ░▒ ▒░░ ░▒ ░ ░
░ ░ ░ ░ ░ ░ ░ ▒ ░░ ░ ░ ░ ░ ░ ░ ▒ ░░ ░ ░ ░░ ░ ░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
"""
import colorama
import random
import os
import time
import sys
sys.stdout.write("\x1b]2;DEDSEC | STARTING\x07")
from datetime import datetime
now = datetime.now()
lBlue = '\033[1;36m'
Blue = '\033[34m'
Cyan = '\033[94m'
Bold = '\033[01m'
Reset = '\033[0m'
def anim():
found = False
while not found:
try:
os.system("clear")
for x in range(1):
print Cyan+"""
\033[01m _________________________________________________\033[0m
\033[34mDedSec is Loading... \033[01m##########\033[94m
_________________________________________________\033[0m\033[94m
---_____
__ ----_
\\
\\
_____)
/ \\
\\ /)\\
\\__/ /
_ /\\
\\_____/ \\_/\\
----| / |
| |___________|
| | ((_(_)| )_)
| \\_((_(_)|/(_)
\\ (
\\_____________)
""".decode('utf-8')
time.sleep(0.5)
os.system("clear")
print Cyan+"""
\033[01m _________________________________________________\033[0m
\033[34mDedSec is Loading.. \033[01m++########\033[94m
_________________________________________________\033[0m\033[94m
-----_____
__ ----_
- \\
\\
_____)
/ \\
\\ /)\\
\\__/ /
_ /\\
__ \\_____/ \\_/\\
----| / |
| |___________|
| | ((_(_)| )_)
| \\_((_(_)|/(_)
\\ (
\\_____________)
""".decode('utf-8')
time.sleep(0.5)
os.system("clear")
print Cyan+"""
\033[01m _________________________________________________\033[0m
\033[34mDedSec is Loading. \033[01m++++######\033[94m
_________________________________________________\033[0m\033[94m
_____-----_____
__ ----_
_------ \\
---- \\
| _____)
- / \\
___-- \\ /)\\
--____ \\__/ /
\\ -- _ /\\
--__--__ \\_____/ \\_/\\
----| / |
| |___________|
| | ((_(_)| )_)
| \\_((_(_)|/(_)
\\ (
\\_____________)
""".decode('utf-8')
time.sleep(0.5)
os.system("clear")
print Cyan+"""
\033[01m _________________________________________________\033[0m
\033[34mDedSec is Loading.. \033[01m++++++####\033[94m
_________________________________________________\033[0m\033[94m
_________-----_____
__ ----_
___------ \\
---- \\
--__ | _____)
__- / \\
-- ___-- \\ /)\\
---____ \\__/ /
--__ \\ -- _ /\\
--__--__ \\_____/ \\_/\\
----| / |
| |___________|
| | ((_(_)| )_)
| \\_((_(_)|/(_)
\\ (
\\_____________)
""".decode('utf-8')
time.sleep(0.5)
os.system("clear")
print Cyan+"""
\033[01m _________________________________________________\033[0m
\033[34mDedSec is Loading... \033[01m++++++++##\033[94m
_________________________________________________\033[0m\033[94m
_________-----_____
--- __ ----_
___------ \\
---- \\
-----__ | _____)
__- / \\
----- ___-- \\ /)\\
---____ \\__/ /
-----__ \\ -- _ /\\
--__--__ \\_____/ \\_/\\
----| / |
| |___________|
| | ((_(_)| )_)
| \\_((_(_)|/(_)
\\ (
\\_____________)
""".decode('utf-8')
time.sleep(0.5)
os.system("clear")
print Cyan+"""
\033[01m _________________________________________________\033[0m
\033[34mDedSec is Loading.. \033[01m++++++++++\033[94m
_________________________________________________\033[0m\033[94m
_________-----_____
------ __ ----_
___------ \\
___ ---- \\
-----__ | _____)
__- / \\
___----- ___-- \\ /)\\
___ ---____ \\__/ /
-----__ \\ -- _ /\\
--__--__ \\_____/ \\_/\\
----| / |
| |___________|
| | ((_(_)| )_)
| \\_((_(_)|/(_)
\\ (
\\_____________)
""".decode('utf-8')
time.sleep(0.5)
os.system("clear")
print Cyan+"""
\033[01m _________________________________________________\033[0m
\033[34mDedSec is Loading. \033[01m++++++++##\033[94m
_________________________________________________\033[0m\033[94m
_________-----_____
___------ __ ----_
___------ \\
______ ---- \\
-----__ | _____)
__- / \\
______----- ___-- \\ /)\\
______ ---____ \\__/ /
-----__ \\ -- _ /\\
--__--__ \\_____/ \\_/\\
----| / |
| |___________|
| | ((_(_)| )_)
| \\_((_(_)|/(_)
\\ (
\\_____________)
""".decode('utf-8')
time.sleep(0.5)
os.system("clear")
print Cyan+"""
\033[01m _________________________________________________\033[0m
\033[34mDedSec is Loading.. \033[01m++++++####\033[94m
_________________________________________________\033[0m\033[94m
_________-----_____
_____------ __ ----_
___------ \\
________ ---- \\
-----__ | _____)
__- / \\
_______----- ___-- \\ /)\\
-_______ ---____ \\__/ /
-----__ \\ -- _ /\\
--__--__ \\_____/ \\_/\\
----| / |
| |___________|
| | ((_(_)| )_)
| \\_((_(_)|/(_)
\\ (
\\_____________)
""".decode('utf-8')
time.sleep(0.5)
os.system("clear")
print Cyan+"""
\033[01m _________________________________________________\033[0m
\033[34mDedSec is Loading... \033[01m++++######\033[94m
_________________________________________________\033[0m\033[94m
_________-----_____
_____------ __ ----_
-- ___------ \\
--________ ---- \\
-----__ | _____)
__- / \\
_______----- ___-- \\ /)\\
---_______ ---____ \\__/ /
-----__ \\ -- _ /\\
--__--__ \\_____/ \\_/\\
----| / |
| |___________|
| | ((_(_)| )_)
| \\_((_(_)|/(_)
\\ (
\\_____________)
""".decode('utf-8')
time.sleep(0.5)
os.system("clear")
print Cyan+"""
\033[01m _________________________________________________\033[0m
\033[34mDedSec is Loading.. \033[01m++########\033[94m
_________________________________________________\033[0m\033[94m
_________-----_____
_____------ __ ----_
---- ___------ \\
----________ ---- \\
-----__ | _____)
__- / \\
_______----- ___-- \\ /)\\
-----_______ ---____ \\__/ /
-----__ \\ -- _ /\\
--__--__ \\_____/ \_/\\
----| / |
| |___________|
| | ((_(_)| )_)
| \\_((_(_)|/(_)
\\ (
\\_____________)
""".decode('utf-8')
time.sleep(0.5)
os.system("clear")
print Cyan+"""
\033[01m _________________________________________________\033[0m
\033[34mDedSec is Loading. \033[01m##########\033[94m
_________________________________________________\033[0m\033[94m
_________-----_____
_____------ __ ----_
_---- ___------ \\
----________ ---- \\
-----__ | _____)
__- / \\
_______----- ___-- \\ /)\\
------_______ ---____ \\__/ /
-----__ \\ -- _ /\\
--__--__ \\_____/ \\_/\\
----| / |
| |___________|
| | ((_(_)| )_)
| \\_((_(_)|/(_)
\\ (
\\_____________)
""".decode('utf-8')
time.sleep(0.5)
os.system("clear")
print Cyan+"""
\033[01m _________________________________________________\033[0m
\033[34mDedSec is Loading.. \033[01m DONE\033[94m
_________________________________________________\033[0m\033[94m
_________-----_____
_____------ __ ----_
___---- ___------ \\
----________ ---- \\
-----__ | _____)
__- / \\
_______----- ___-- \\ /)\\
------_______ ---____ \\__/ /
-----__ \\ -- _ /\\
--__--__ \_____/ \\_/\\
----| / |
| |___________|
| | ((_(_)| )_)
| \\_((_(_)|/(_)
\\ (
\\_____________)
""".decode('utf-8')
time.sleep(0.5)
os.system("clear")
exit()
except:
os.system("clear")
print Cyan+"\033[34m(\033[94m!\033[34m) \033[90mDedSec is Starting..."
print Cyan+"""
______
.-" "-.
/ \\
| |
|, .-. .-. ,| \033[90mv1.0.6\033[94m
| )(__/ \__)( |
|/ /\ \\|
(_ ^^ _)
\\__|IIIIII|__/
| \IIIIII/ |
\\ /
`--------`
""".decode('utf-8')
time.sleep(0.2)
os.system("clear")
break
found = True
anim()
# Really intrigued by the script huh? You looked at the whole thing...
# Do u even have a life? Kiddin' LOL
# - Retr0
| 38.822535
| 95
| 0.293063
| 631
| 13,782
| 3.432647
| 0.236133
| 0.031394
| 0.037396
| 0.040628
| 0.590951
| 0.590951
| 0.570175
| 0.560942
| 0.560942
| 0.559557
| 0
| 0.076221
| 0.523074
| 13,782
| 355
| 96
| 38.822535
| 0.191845
| 0.018067
| 0
| 0.748428
| 0
| 0
| 0.822447
| 0.143319
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.018868
| null | null | 0.044025
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
e99969b259dafb2f331b9ce3f61512ef7e7f4ba4
| 100
|
py
|
Python
|
indexers/__init__.py
|
nika2312/qa_explaination
|
ce65b77154be582a41c94843937685402d5355ec
|
[
"MIT"
] | 10
|
2020-05-17T07:07:03.000Z
|
2022-03-04T19:51:52.000Z
|
indexers/__init__.py
|
nika2312/qa_explaination
|
ce65b77154be582a41c94843937685402d5355ec
|
[
"MIT"
] | 1
|
2020-09-28T07:46:31.000Z
|
2020-09-28T07:46:31.000Z
|
indexers/__init__.py
|
nika2312/qa_explaination
|
ce65b77154be582a41c94843937685402d5355ec
|
[
"MIT"
] | 1
|
2021-07-16T15:49:06.000Z
|
2021-07-16T15:49:06.000Z
|
from qa_explanation.indexers.pretrained_transformer_indexer import PretrainedTransformerIndexerLocal
| 100
| 100
| 0.95
| 9
| 100
| 10.222222
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.03
| 100
| 1
| 100
| 100
| 0.948454
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
e99f2db4ef44d63080b02f2fe51c67d603f6d41f
| 634
|
py
|
Python
|
pyslet/imsqtiv1p2p1.py
|
cidermole/pyslet
|
b30e9a439f6c0f0e2d01f1ac80986944bed7427b
|
[
"BSD-3-Clause"
] | 62
|
2015-02-05T19:51:16.000Z
|
2022-03-17T22:36:39.000Z
|
pyslet/imsqtiv1p2p1.py
|
cidermole/pyslet
|
b30e9a439f6c0f0e2d01f1ac80986944bed7427b
|
[
"BSD-3-Clause"
] | 64
|
2015-01-04T15:43:28.000Z
|
2022-02-22T08:54:20.000Z
|
pyslet/imsqtiv1p2p1.py
|
cidermole/pyslet
|
b30e9a439f6c0f0e2d01f1ac80986944bed7427b
|
[
"BSD-3-Clause"
] | 39
|
2015-10-24T08:31:38.000Z
|
2021-11-01T19:50:13.000Z
|
#! /usr/bin/env python
"""This module implements the QTI 1.2.1 specification defined by IMS GLC"""
import warnings
from .qtiv1.assessment import * # noqa
from .qtiv1.common import * # noqa
from .qtiv1.core import * # noqa
from .qtiv1.item import * # noqa
from .qtiv1.objectbank import * # noqa
from .qtiv1.outcomes import * # noqa
from .qtiv1.sao import * # noqa
from .qtiv1.section import * # noqa
from .qtiv1.xml import * # noqa
warnings.warn(
"pyslet.imsqtiv1p2p1 is deprecated, use pyslet.qtiv1 package instead",
DeprecationWarning, stacklevel=3)
| 31.7
| 75
| 0.648265
| 78
| 634
| 5.269231
| 0.525641
| 0.19708
| 0.272506
| 0.36983
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.036093
| 0.257098
| 634
| 19
| 76
| 33.368421
| 0.836518
| 0.214511
| 0
| 0
| 0
| 0
| 0.138716
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.769231
| 0
| 0.769231
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
e9d1270a17d1fcf9a97db0df960d01f0fa9c97e8
| 206
|
py
|
Python
|
payir/exceptions.py
|
farahmand-m/django-payir
|
c6f1042cf9fa3b1887086cedfacc5f76755540be
|
[
"MIT"
] | null | null | null |
payir/exceptions.py
|
farahmand-m/django-payir
|
c6f1042cf9fa3b1887086cedfacc5f76755540be
|
[
"MIT"
] | null | null | null |
payir/exceptions.py
|
farahmand-m/django-payir
|
c6f1042cf9fa3b1887086cedfacc5f76755540be
|
[
"MIT"
] | null | null | null |
class GatewayError(RuntimeError):
def __init__(self, error_code, error_message):
super().__init__(error_message)
self.error_code = error_code
self.error_message = error_message
| 29.428571
| 50
| 0.713592
| 24
| 206
| 5.5
| 0.416667
| 0.363636
| 0.19697
| 0.272727
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.203884
| 206
| 6
| 51
| 34.333333
| 0.804878
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0
| 0
| 0.4
| 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
|
e9dab44bffe5593aeaa5d8493cf0d606e56e0605
| 165
|
py
|
Python
|
uptimer/cli.py
|
janw/uptimer
|
967b5ed907d620f79ee29ab8be52ba89f1686513
|
[
"Apache-2.0"
] | 1
|
2021-08-23T18:40:03.000Z
|
2021-08-23T18:40:03.000Z
|
uptimer/cli.py
|
janw/uptimer
|
967b5ed907d620f79ee29ab8be52ba89f1686513
|
[
"Apache-2.0"
] | 1
|
2021-01-17T13:31:41.000Z
|
2021-01-17T13:31:41.000Z
|
uptimer/cli.py
|
janw/uptimer
|
967b5ed907d620f79ee29ab8be52ba89f1686513
|
[
"Apache-2.0"
] | null | null | null |
def cli(): # pragma: no cover
from uptimer.core.logging import setup_logging
setup_logging()
from uptimer.main import main # noqa: E402
main()
| 16.5
| 50
| 0.666667
| 22
| 165
| 4.909091
| 0.636364
| 0.203704
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.024194
| 0.248485
| 165
| 9
| 51
| 18.333333
| 0.846774
| 0.163636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| true
| 0
| 0.4
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
7589f083552a6392406cbbb1d23ac29838006b07
| 64
|
py
|
Python
|
python/blinkytools/utils.py
|
popura/blinky
|
d9a81c0c0b8789ce9f0d234d1c768dd24f88d257
|
[
"MIT"
] | 7
|
2019-04-08T03:37:00.000Z
|
2021-09-07T10:02:01.000Z
|
python/blinkytools/utils.py
|
popura/blinky
|
d9a81c0c0b8789ce9f0d234d1c768dd24f88d257
|
[
"MIT"
] | null | null | null |
python/blinkytools/utils.py
|
popura/blinky
|
d9a81c0c0b8789ce9f0d234d1c768dd24f88d257
|
[
"MIT"
] | 5
|
2019-10-01T06:24:22.000Z
|
2022-02-12T03:40:32.000Z
|
def pixel_to_str(pixel):
return f"({pixel[0]}, {pixel[1]})"
| 21.333333
| 38
| 0.609375
| 11
| 64
| 3.363636
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.036364
| 0.140625
| 64
| 2
| 39
| 32
| 0.636364
| 0
| 0
| 0
| 0
| 0
| 0.375
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
75a88c31682582bb4538dbb77bb262510225ce94
| 4,530
|
py
|
Python
|
nets/keras_models.py
|
kamwoh/ghn
|
5c19a034e54cd866d8b470efc520ed6e51448545
|
[
"MIT"
] | 6
|
2018-03-14T16:03:32.000Z
|
2021-12-08T02:32:25.000Z
|
nets/keras_models.py
|
fj2250109/ghn
|
5c19a034e54cd866d8b470efc520ed6e51448545
|
[
"MIT"
] | null | null | null |
nets/keras_models.py
|
fj2250109/ghn
|
5c19a034e54cd866d8b470efc520ed6e51448545
|
[
"MIT"
] | 3
|
2017-12-27T18:47:01.000Z
|
2018-01-05T15:50:07.000Z
|
import tensorflow as tf
from keras import optimizers
from keras.layers import Conv2D, MaxPooling2D, Dropout, Dense, Flatten, Activation, BatchNormalization
from keras.models import Sequential
from keras_layers import ConvGHD, FCGHD, CustomRelu
def categorical_crossentropy(y_true, y_pred):
return tf.nn.softmax_cross_entropy_with_logits_v2(labels=y_true,
logits=y_pred)
def ghd_mnist_model(learning_rate, double_threshold, per_pixel, alpha, relu=False):
with tf.variable_scope('ghn'):
model = Sequential()
model.add(ConvGHD(filters=16,
kernel_size=[5, 5],
double_threshold=double_threshold,
per_pixel=per_pixel,
alpha=alpha,
input_shape=(28, 28, 1),
name='conv1'))
if relu:
model.add(CustomRelu())
model.add(MaxPooling2D(pool_size=[2, 2],
strides=[2, 2]))
model.add(ConvGHD(filters=64,
kernel_size=[5, 5],
double_threshold=double_threshold,
per_pixel=per_pixel,
alpha=alpha,
name='conv2'))
if relu:
model.add(CustomRelu())
model.add(MaxPooling2D(pool_size=[2, 2],
strides=[2, 2]))
model.add(Flatten())
model.add(FCGHD(units=1024,
double_threshold=double_threshold,
per_pixel=per_pixel,
alpha=alpha,
name='fc3'))
if relu:
model.add(CustomRelu())
model.add(Dropout(0.5))
model.add(FCGHD(units=10,
double_threshold=double_threshold,
per_pixel=per_pixel,
alpha=alpha,
name='fc4'))
model.compile(optimizer=optimizers.Adam(learning_rate),
loss=categorical_crossentropy,
metrics=['accuracy'])
return model
def naive_mnist_model(learning_rate):
with tf.variable_scope('naive'):
model = Sequential()
model.add(Conv2D(filters=16,
kernel_size=[5, 5],
input_shape=(28, 28, 1),
name='conv1'))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=[2, 2],
strides=[2, 2]))
model.add(Conv2D(filters=64,
kernel_size=[5, 5],
name='conv2'))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=[2, 2],
strides=[2, 2]))
model.add(Flatten())
model.add(Dense(units=1024,
name='fc3'))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(units=10,
name='fc4'))
model.compile(optimizer=optimizers.Adam(learning_rate),
loss=categorical_crossentropy,
metrics=['accuracy'])
return model
def bn_mnist_model(learning_rate):
with tf.variable_scope('bn'):
model = Sequential()
model.add(Conv2D(filters=16,
kernel_size=[5, 5],
input_shape=(28, 28, 1),
name='conv1'))
model.add(BatchNormalization())
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=[2, 2],
strides=[2, 2]))
model.add(Conv2D(filters=64,
kernel_size=[5, 5],
name='conv2'))
model.add(BatchNormalization())
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=[2, 2],
strides=[2, 2]))
model.add(Flatten())
model.add(Dense(units=1024,
name='fc3'))
model.add(BatchNormalization())
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(units=10,
name='fc4'))
model.add(BatchNormalization())
model.compile(optimizer=optimizers.Adam(learning_rate),
loss=categorical_crossentropy,
metrics=['accuracy'])
return model
| 38.389831
| 102
| 0.494702
| 439
| 4,530
| 4.963554
| 0.186788
| 0.135842
| 0.049564
| 0.033043
| 0.771914
| 0.771914
| 0.763653
| 0.730151
| 0.69252
| 0.684259
| 0
| 0.040921
| 0.395806
| 4,530
| 117
| 103
| 38.717949
| 0.755206
| 0
| 0
| 0.833333
| 0
| 0
| 0.0234
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.037037
| false
| 0
| 0.046296
| 0.009259
| 0.12037
| 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
|
75b99bc85058de67441e98229deba43421cc5a94
| 42
|
py
|
Python
|
run_generator.py
|
mokalos/sia-o
|
e1567ccad876b6cbc8be53be2661016ead44acc5
|
[
"BSD-Source-Code"
] | null | null | null |
run_generator.py
|
mokalos/sia-o
|
e1567ccad876b6cbc8be53be2661016ead44acc5
|
[
"BSD-Source-Code"
] | null | null | null |
run_generator.py
|
mokalos/sia-o
|
e1567ccad876b6cbc8be53be2661016ead44acc5
|
[
"BSD-Source-Code"
] | null | null | null |
import os as alpha
alpha.system("lscpu")
| 10.5
| 21
| 0.738095
| 7
| 42
| 4.428571
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 42
| 3
| 22
| 14
| 0.861111
| 0
| 0
| 0
| 0
| 0
| 0.121951
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
75c209d5f76ec2d77011cd2610c0da21b313f04d
| 304
|
py
|
Python
|
matlib/vectors/__init__.py
|
bmoretz/Quantitative-Development
|
1085d6ab756ae1889c50a68ed6945f7efded78c1
|
[
"MIT"
] | null | null | null |
matlib/vectors/__init__.py
|
bmoretz/Quantitative-Development
|
1085d6ab756ae1889c50a68ed6945f7efded78c1
|
[
"MIT"
] | null | null | null |
matlib/vectors/__init__.py
|
bmoretz/Quantitative-Development
|
1085d6ab756ae1889c50a68ed6945f7efded78c1
|
[
"MIT"
] | null | null | null |
from matlib.vectors.types import Vector, make_vector, make_vectors
from matlib.vectors.operators import add, subtract, multiply, length, distance
from matlib.vectors.shapes import Points, Polygon, Arrow, Segment, perimeter, regular_polygon
from matlib.vectors.transforms import scale, shift, flip, rotate
| 76
| 93
| 0.832237
| 41
| 304
| 6.097561
| 0.609756
| 0.16
| 0.272
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.095395
| 304
| 4
| 94
| 76
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 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
|
75c8d3a7817aec80c91474f8ae5b46c5a5393b87
| 47
|
py
|
Python
|
web/kwmo/kwmo/lib/exceptions.py
|
tmbx/kas
|
0d4e74d0a8ec0e0f85ba574eb01d389530bdeecc
|
[
"BSD-3-Clause"
] | null | null | null |
web/kwmo/kwmo/lib/exceptions.py
|
tmbx/kas
|
0d4e74d0a8ec0e0f85ba574eb01d389530bdeecc
|
[
"BSD-3-Clause"
] | null | null | null |
web/kwmo/kwmo/lib/exceptions.py
|
tmbx/kas
|
0d4e74d0a8ec0e0f85ba574eb01d389530bdeecc
|
[
"BSD-3-Clause"
] | null | null | null |
class KAjaxViewException(Exception):
pass
| 11.75
| 36
| 0.765957
| 4
| 47
| 9
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.170213
| 47
| 3
| 37
| 15.666667
| 0.923077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
75ed9d9fc01eb48622ef113269e889c710f08724
| 88
|
py
|
Python
|
test.py
|
ryandens/PythonAgent
|
8a45c9ed629b0a13a14b6708926016a217056ae2
|
[
"MIT"
] | null | null | null |
test.py
|
ryandens/PythonAgent
|
8a45c9ed629b0a13a14b6708926016a217056ae2
|
[
"MIT"
] | null | null | null |
test.py
|
ryandens/PythonAgent
|
8a45c9ed629b0a13a14b6708926016a217056ae2
|
[
"MIT"
] | null | null | null |
from python_agent.agent_string import AgentString
print("test")
print(AgentString.COUNT)
| 29.333333
| 49
| 0.852273
| 12
| 88
| 6.083333
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.056818
| 88
| 3
| 50
| 29.333333
| 0.879518
| 0
| 0
| 0
| 0
| 0
| 0.044944
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0.666667
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
|
0
| 5
|
75fe4b1aee421c309db88bf1f43528eed549f90f
| 146
|
py
|
Python
|
app/app/db/base.py
|
openshift-scale/snappy-data-server
|
286bfbdc40e362110d9ca8e716a3d2cccd3f9344
|
[
"Apache-2.0"
] | 1
|
2021-06-09T03:40:03.000Z
|
2021-06-09T03:40:03.000Z
|
app/app/db/base.py
|
openshift-scale/snappy-data-server
|
286bfbdc40e362110d9ca8e716a3d2cccd3f9344
|
[
"Apache-2.0"
] | 6
|
2020-07-28T21:18:44.000Z
|
2021-06-04T17:30:16.000Z
|
app/app/db/base.py
|
openshift-scale/snappy-data-server
|
286bfbdc40e362110d9ca8e716a3d2cccd3f9344
|
[
"Apache-2.0"
] | 3
|
2020-07-08T20:56:11.000Z
|
2021-04-12T05:58:12.000Z
|
# Import all schemas, so that Base has them before
# being imported by Alembic
from app.db.base_class import Base
from .schemas import UserTable
| 24.333333
| 50
| 0.794521
| 24
| 146
| 4.791667
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.164384
| 146
| 5
| 51
| 29.2
| 0.942623
| 0.506849
| 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
|
f97995a90cad299bacb7e95519bb1857df32daac
| 246
|
py
|
Python
|
utils/load_data.py
|
FGAUnB-REQ-GM/2021.2-PousadaAnimal
|
b7371aebccad0da23073de0db642a6ce824f919e
|
[
"MIT"
] | null | null | null |
utils/load_data.py
|
FGAUnB-REQ-GM/2021.2-PousadaAnimal
|
b7371aebccad0da23073de0db642a6ce824f919e
|
[
"MIT"
] | 95
|
2022-02-04T19:40:09.000Z
|
2022-03-31T20:24:11.000Z
|
utils/load_data.py
|
FGAUnB-REQ-GM/2021.2-PousadaAnimal
|
b7371aebccad0da23073de0db642a6ce824f919e
|
[
"MIT"
] | 4
|
2022-01-26T23:51:48.000Z
|
2022-01-27T18:28:16.000Z
|
from os import system
# Database
system('python3 manage.py makemigrations users pets hosting message payment host services')
system('python3 manage.py migrate')
# Super User
print('Create super user')
system('python3 manage.py createsuperuser')
| 27.333333
| 91
| 0.796748
| 33
| 246
| 5.939394
| 0.666667
| 0.19898
| 0.290816
| 0.321429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.013825
| 0.117886
| 246
| 9
| 92
| 27.333333
| 0.889401
| 0.077236
| 0
| 0
| 0
| 0
| 0.693333
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.2
| 0
| 0.2
| 0.2
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
f9c0a4e374de41888fe31026db572cd5345ed5eb
| 280
|
py
|
Python
|
week_08/tests/test_7.py
|
vlasenckov/MIPT_py_3_term
|
ffe30371221017d61a22e18300f059d9f7086740
|
[
"MIT"
] | 5
|
2020-10-05T15:21:11.000Z
|
2020-12-17T19:19:32.000Z
|
week_08/tests/test_7.py
|
vlasenckov/MIPT_py_3_term
|
ffe30371221017d61a22e18300f059d9f7086740
|
[
"MIT"
] | 8
|
2020-09-24T10:36:15.000Z
|
2020-11-30T10:54:56.000Z
|
week_08/tests/test_7.py
|
vlasenckov/MIPT_py_3_term
|
ffe30371221017d61a22e18300f059d9f7086740
|
[
"MIT"
] | 2
|
2020-10-11T13:08:35.000Z
|
2020-12-04T19:54:21.000Z
|
from scripts.ex_7 import get_combinations_with_r
def test_combination_with_r():
assert get_combinations_with_r("cat", 2) == ["aa", "ac", "at", "cc", "ct", "tt"]
assert get_combinations_with_r("ca", 2) == ["aa", "ac", "cc"]
assert get_combinations_with_r("", 1) == []
| 40
| 84
| 0.653571
| 43
| 280
| 3.883721
| 0.534884
| 0.149701
| 0.45509
| 0.479042
| 0.467066
| 0
| 0
| 0
| 0
| 0
| 0
| 0.016736
| 0.146429
| 280
| 7
| 85
| 40
| 0.682008
| 0
| 0
| 0
| 0
| 0
| 0.081851
| 0
| 0
| 0
| 0
| 0
| 0.6
| 1
| 0.2
| true
| 0
| 0.2
| 0
| 0.4
| 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
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
ddce59149a1714689c2b296f74d8507c9eb187d3
| 23
|
py
|
Python
|
gostop/core/utils.py
|
ymkim92/gostop
|
1c6490b381e855db5e30dbb412b0fe449c8eb531
|
[
"MIT"
] | 6
|
2018-10-10T12:05:14.000Z
|
2021-08-20T00:22:11.000Z
|
gostop/core/utils.py
|
ymkim92/gostop
|
1c6490b381e855db5e30dbb412b0fe449c8eb531
|
[
"MIT"
] | null | null | null |
gostop/core/utils.py
|
ymkim92/gostop
|
1c6490b381e855db5e30dbb412b0fe449c8eb531
|
[
"MIT"
] | 3
|
2019-01-31T11:59:47.000Z
|
2019-10-27T00:20:56.000Z
|
def _(s):
return s
| 7.666667
| 12
| 0.521739
| 4
| 23
| 2.75
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.347826
| 23
| 2
| 13
| 11.5
| 0.733333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 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
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 5
|
fb021117596bfdb9c82ccffd834f65eb3fd02d49
| 193
|
py
|
Python
|
Old Laptop Desktop/Code_Files/Driving_Code/Flipperes/definintions.py
|
CCGSRobotics/testing_code
|
a963926984bb1abb9a457ea2cf6212d8362f4642
|
[
"Apache-2.0"
] | null | null | null |
Old Laptop Desktop/Code_Files/Driving_Code/Flipperes/definintions.py
|
CCGSRobotics/testing_code
|
a963926984bb1abb9a457ea2cf6212d8362f4642
|
[
"Apache-2.0"
] | 1
|
2017-06-14T11:08:38.000Z
|
2017-06-14T11:08:38.000Z
|
Old Laptop Desktop/Code_Files/Driving_Code/Flipperes/definintions.py
|
CCGSRobotics/Archive-Code
|
a963926984bb1abb9a457ea2cf6212d8362f4642
|
[
"Apache-2.0"
] | null | null | null |
from connect import *
print("definitions setup")
def SwitchON():
sock.sendall(bytes("ON\n", "utf-8"))
def SwitchOFF():
sock.sendall(bytes("OFF\n", "utf-8"))
print("definitions made")
| 17.545455
| 41
| 0.663212
| 27
| 193
| 4.740741
| 0.666667
| 0.25
| 0.25
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011976
| 0.134715
| 193
| 10
| 42
| 19.3
| 0.754491
| 0
| 0
| 0
| 0
| 0
| 0.26943
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| true
| 0
| 0.142857
| 0
| 0.428571
| 0.285714
| 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
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
3499b71e22ac9bce5083481e97dc5c24db113c02
| 8,378
|
py
|
Python
|
api/tests/test_asset_incident_report_api.py
|
raheemazeezabiodun/art-backend
|
0bc47f3cf6f403101082f201c7fd1ca8108d5731
|
[
"MIT"
] | null | null | null |
api/tests/test_asset_incident_report_api.py
|
raheemazeezabiodun/art-backend
|
0bc47f3cf6f403101082f201c7fd1ca8108d5731
|
[
"MIT"
] | null | null | null |
api/tests/test_asset_incident_report_api.py
|
raheemazeezabiodun/art-backend
|
0bc47f3cf6f403101082f201c7fd1ca8108d5731
|
[
"MIT"
] | null | null | null |
# Standard Library
from unittest.mock import patch
# Third-Party Imports
from rest_framework.test import APIClient
# App Imports
from api.tests import APIBaseTestCase
from core.models import AssetIncidentReport
client = APIClient()
class AssetIncidentReportAPITest(APIBaseTestCase):
""" Tests for the AssetIncidentReport API """
def test_non_authenticated_user_view_incident_report(self):
response = client.get(self.incident_report_url)
self.assertEqual(
response.data, {"detail": "Authentication credentials were not provided."}
)
@patch("api.authentication.auth.verify_id_token")
def test_authenticated_user_post_incident_report(self, mock_verify_id_token):
mock_verify_id_token.return_value = {"email": self.user.email}
data = {
"asset": self.asset.id,
"incident_type": "Loss",
"incident_location": "CDB",
"incident_description": "Lorem Ipsum",
"injuries_sustained": "N/a",
"loss_of_property": "Mobile Phone",
"witnesses": "John Doe +2347548458457",
"police_abstract_obtained": "Yes",
}
response = client.post(
f"{self.incident_report_url}",
data,
HTTP_AUTHORIZATION="Token {}".format(self.token_user),
)
self.assertIn(
f"{self.asset.serial_number} - {self.asset.asset_code}",
response.data.values(),
)
self.assertIn("submitted_by", response.data.keys())
self.assertEqual(response.data["submitted_by"], self.user.email)
self.assertEqual(response.status_code, 201)
@patch("api.authentication.auth.verify_id_token")
def test_authenticated_user_post_invalid_incident_type(self, mock_verify_id_token):
mock_verify_id_token.return_value = {"email": self.user.email}
data = {
"asset": self.asset.id,
"incident_type": "Invalid",
"incident_location": "CDB",
"incident_description": "Lorem Ipsum",
"injuries_sustained": "N/a",
"loss_of_property": "Mobile Phone",
"witnesses": "John Doe +2347548458457",
"police_abstract_obtained": "Yes",
}
response = client.post(
f"{self.incident_report_url}",
data,
HTTP_AUTHORIZATION="Token {}".format(self.token_user),
)
self.assertEqual(
response.data, {"incident_type": ['"Invalid" is not a valid choice.']}
)
self.assertEqual(response.status_code, 400)
@patch("api.authentication.auth.verify_id_token")
def test_authenticated_user_post_empty_incident_fields(self, mock_verify_id_token):
mock_verify_id_token.return_value = {"email": self.user.email}
data = {
"asset": self.asset.id,
"incident_type": "Loss",
"incident_location": "",
"incident_description": "Lorem",
"police_abstract_obtained": "Yes",
}
response = client.post(
f"{self.incident_report_url}",
data,
HTTP_AUTHORIZATION="Token {}".format(self.token_user),
)
self.assertEqual(
response.data, {"incident_location": ["This field may not be blank."]}
)
self.assertEqual(response.status_code, 400)
@patch("api.authentication.auth.verify_id_token")
def test_authenticated_user_get_incident_report(self, mock_verify_id_token):
mock_verify_id_token.return_value = {"email": self.user.email}
response = client.get(
f"{self.incident_report_url}",
HTTP_AUTHORIZATION="Token {}".format(self.token_user),
)
self.assertIn(self.incident_report.id, response.data["results"][0].values())
self.assertEqual(
len(response.data["results"]), AssetIncidentReport.objects.count()
)
self.assertEqual(response.status_code, 200)
@patch("api.authentication.auth.verify_id_token")
def test_authenticated_user_get_single_incident_report(self, mock_verify_id_token):
mock_verify_id_token.return_value = {"email": self.user.email}
response = client.get(
f"{self.incident_report_url}/{self.incident_report.id}/",
HTTP_AUTHORIZATION="Token {}".format(self.token_user),
)
self.assertIn(self.incident_report.id, response.data.values())
self.assertEqual(response.status_code, 200)
@patch("api.authentication.auth.verify_id_token")
def test_cant_allow_put_incident_report(self, mock_verify_id_token):
mock_verify_id_token.return_value = {"email": self.user.email}
response = client.put(
f"{self.incident_report_url}/{self.incident_report.id}/",
HTTP_AUTHORIZATION="Token {}".format(self.token_user),
)
self.assertEqual(response.data, {"detail": 'Method "PUT" not allowed.'})
self.assertEqual(response.status_code, 405)
@patch("api.authentication.auth.verify_id_token")
def test_cant_allow_patch_incident_report(self, mock_verify_id_token):
mock_verify_id_token.return_value = {"email": self.user.email}
response = client.patch(
f"{self.incident_report_url}",
HTTP_AUTHORIZATION="Token {}".format(self.token_user),
)
self.assertEqual(response.data, {"detail": 'Method "PATCH" not allowed.'})
self.assertEqual(response.status_code, 405)
@patch("api.authentication.auth.verify_id_token")
def test_cant_allow_delete_incident_report(self, mock_verify_id_token):
mock_verify_id_token.return_value = {"email": self.user.email}
response = client.delete(
f"{self.incident_report_url}",
HTTP_AUTHORIZATION="Token {}".format(self.token_user),
)
self.assertEqual(response.data, {"detail": 'Method "DELETE" not allowed.'})
self.assertEqual(response.status_code, 405)
@patch('api.authentication.auth.verify_id_token')
def test_can_allow_patch_of_incident_report_status(self, mock_verify_id_token):
mock_verify_id_token.return_value = {'email': self.admin_user.email}
data = {
"incident_report_state": "internal assessment",
"asset_state_from_report": "Damaged",
}
response = client.patch(
f"{self.incident_report_status_url}",
data,
HTTP_AUTHORIZATION="Token {}".format(self.token_user),
)
data['id'] = self.report_status.id
data['asset_incident_report'] = self.report_status.asset_incident_report.id
self.assertEqual(response.data, data)
self.assertEqual(response.status_code, 200)
@patch('api.authentication.auth.verify_id_token')
def test_require_both_fields_to_patch_incident_report_status(
self, mock_verify_id_token
):
mock_verify_id_token.return_value = {'email': self.admin_user.email}
data = {
"asset_incident_report": self.report_status.asset_incident_report.id,
"incident_report_state": "internal assessment",
}
response = client.patch(
f"{self.incident_report_status_url}",
data,
HTTP_AUTHORIZATION="Token {}".format(self.token_user),
)
self.assertEqual(
response.data,
{
"Error": "Ensure that incident_report_state and asset_state_from_report fields are filled"
},
)
self.assertEqual(response.status_code, 400)
@patch('api.authentication.auth.verify_id_token')
def test_restrict_patch_of_incident_report_status_for_external_assessment(
self, mock_verify_id_token
):
mock_verify_id_token.return_value = {'email': self.admin_user.email}
data = {
"incident_report_state": "external assessment",
"asset_state_from_report": "requires external assessment",
}
response = client.patch(
f"{self.incident_report_status_url}",
data,
HTTP_AUTHORIZATION="Token {}".format(self.token_user),
)
self.assertEqual(
response.data,
{"Error": "Asset state option is not valid for given report state"},
)
self.assertEqual(response.status_code, 400)
| 41.270936
| 106
| 0.644426
| 932
| 8,378
| 5.476395
| 0.146996
| 0.09326
| 0.084052
| 0.073276
| 0.795259
| 0.752939
| 0.745886
| 0.744906
| 0.744906
| 0.743339
| 0
| 0.009443
| 0.241585
| 8,378
| 202
| 107
| 41.475248
| 0.793831
| 0.010504
| 0
| 0.59116
| 0
| 0
| 0.254317
| 0.133559
| 0
| 0
| 0
| 0
| 0.143646
| 1
| 0.066298
| false
| 0
| 0.022099
| 0
| 0.093923
| 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
|
34bf0756dd831ffac5a4bd14464745c4e5e1623e
| 158
|
py
|
Python
|
words/admin.py
|
Kunal614/Find_Your_word
|
2689fbb68e4af6190a436e24a64bcf9350a13be0
|
[
"MIT"
] | null | null | null |
words/admin.py
|
Kunal614/Find_Your_word
|
2689fbb68e4af6190a436e24a64bcf9350a13be0
|
[
"MIT"
] | null | null | null |
words/admin.py
|
Kunal614/Find_Your_word
|
2689fbb68e4af6190a436e24a64bcf9350a13be0
|
[
"MIT"
] | 1
|
2020-10-02T05:12:24.000Z
|
2020-10-02T05:12:24.000Z
|
from django.contrib import admin
from .models import Word , Sentence
# Register your models here.
admin.site.register(Word)
admin.site.register(Sentence)
| 15.8
| 35
| 0.78481
| 22
| 158
| 5.636364
| 0.545455
| 0.145161
| 0.274194
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.132911
| 158
| 9
| 36
| 17.555556
| 0.905109
| 0.164557
| 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
|
5510e8b83d0f21f0cb05583df25b10ad1f739fb3
| 54
|
py
|
Python
|
pdip/dependency/container/__init__.py
|
ahmetcagriakca/pdip
|
c4c16d5666a740154cabdc6762cd44d98b7bdde8
|
[
"MIT"
] | 2
|
2021-12-09T21:07:46.000Z
|
2021-12-11T22:18:01.000Z
|
pdip/dependency/container/__init__.py
|
fmuyilmaz/pdip
|
f7e30b0c04d9e85ef46b0b7094fafd3ce18bccab
|
[
"MIT"
] | null | null | null |
pdip/dependency/container/__init__.py
|
fmuyilmaz/pdip
|
f7e30b0c04d9e85ef46b0b7094fafd3ce18bccab
|
[
"MIT"
] | 3
|
2021-11-15T00:47:00.000Z
|
2021-12-17T11:35:45.000Z
|
from .dependency_container import DependencyContainer
| 27
| 53
| 0.907407
| 5
| 54
| 9.6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.074074
| 54
| 1
| 54
| 54
| 0.96
| 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
|
9b380e07b38500ac6e06ae775497a339a02fc815
| 61
|
py
|
Python
|
app/main.py
|
profnelsonseixas/dictionarysentiments
|
aadab487d0003a07232fc1703c65e1f9adf654dc
|
[
"MIT"
] | null | null | null |
app/main.py
|
profnelsonseixas/dictionarysentiments
|
aadab487d0003a07232fc1703c65e1f9adf654dc
|
[
"MIT"
] | null | null | null |
app/main.py
|
profnelsonseixas/dictionarysentiments
|
aadab487d0003a07232fc1703c65e1f9adf654dc
|
[
"MIT"
] | null | null | null |
def main():
pass
if __name__ == '__main__.py':
main()
| 10.166667
| 29
| 0.57377
| 8
| 61
| 3.375
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.245902
| 61
| 5
| 30
| 12.2
| 0.586957
| 0
| 0
| 0
| 0
| 0
| 0.180328
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0.25
| 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
|
9b477bcb61599f5fb3b628b68c470073d30df291
| 82
|
py
|
Python
|
py_tdlib/constructors/update_file.py
|
Mr-TelegramBot/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 24
|
2018-10-05T13:04:30.000Z
|
2020-05-12T08:45:34.000Z
|
py_tdlib/constructors/update_file.py
|
MrMahdi313/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 3
|
2019-06-26T07:20:20.000Z
|
2021-05-24T13:06:56.000Z
|
py_tdlib/constructors/update_file.py
|
MrMahdi313/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 5
|
2018-10-05T14:29:28.000Z
|
2020-08-11T15:04:10.000Z
|
from ..factory import Type
class updateFile(Type):
file = None # type: "file"
| 13.666667
| 28
| 0.682927
| 11
| 82
| 5.090909
| 0.727273
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.195122
| 82
| 5
| 29
| 16.4
| 0.848485
| 0.146341
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 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
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
9b5588a3dce01dac3e7949473251e36f80b39480
| 735
|
py
|
Python
|
scidb/plugins/backup/base/backend.py
|
oxdc/sci.db
|
0a751a0e05e7ad4c83c350e32e32ea9ce5831cbb
|
[
"MIT"
] | null | null | null |
scidb/plugins/backup/base/backend.py
|
oxdc/sci.db
|
0a751a0e05e7ad4c83c350e32e32ea9ce5831cbb
|
[
"MIT"
] | null | null | null |
scidb/plugins/backup/base/backend.py
|
oxdc/sci.db
|
0a751a0e05e7ad4c83c350e32e32ea9ce5831cbb
|
[
"MIT"
] | null | null | null |
from typing import Tuple, Union
class BackupBackend:
def __init__(self, **kwargs):
self.__is_connected__ = False
def ping(self) -> Union[bool, Tuple[bool, float]]:
raise NotImplementedError
def connect(self):
raise NotImplementedError
@property
def is_connected(self) -> bool:
return self.__is_connected__
def create_backup(self, **kwargs):
raise NotImplementedError
def sync_backup(self, **kwargs):
raise NotImplementedError
def list_backups(self, **kwargs):
raise NotImplementedError
def fetch_backup(self, **kwargs):
raise NotImplementedError
def recover_from_backup(self, **kwargs):
raise NotImplementedError
| 22.96875
| 54
| 0.673469
| 76
| 735
| 6.236842
| 0.381579
| 0.35443
| 0.28481
| 0.35865
| 0.434599
| 0.272152
| 0
| 0
| 0
| 0
| 0
| 0
| 0.243537
| 735
| 31
| 55
| 23.709677
| 0.852518
| 0
| 0
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.428571
| false
| 0
| 0.047619
| 0.047619
| 0.571429
| 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
|
9b606d4b41d70b870a4e6326e37eaefa45ddfbf7
| 313
|
py
|
Python
|
pystratis/api/contract_swagger/responsemodels/__init__.py
|
TjadenFroyda/pyStratis
|
9cc7620d7506637f8a2b84003d931eceb36ac5f2
|
[
"MIT"
] | 8
|
2021-06-30T20:44:22.000Z
|
2021-12-07T14:42:22.000Z
|
pystratis/api/contract_swagger/responsemodels/__init__.py
|
TjadenFroyda/pyStratis
|
9cc7620d7506637f8a2b84003d931eceb36ac5f2
|
[
"MIT"
] | 2
|
2021-07-01T11:50:18.000Z
|
2022-01-25T18:39:49.000Z
|
pystratis/api/contract_swagger/responsemodels/__init__.py
|
TjadenFroyda/pyStratis
|
9cc7620d7506637f8a2b84003d931eceb36ac5f2
|
[
"MIT"
] | 4
|
2021-07-01T04:36:42.000Z
|
2021-09-17T10:54:19.000Z
|
from .openapischemamodel import OpenAPISchemaModel
from .openapiendpointsmodel import OpenAPIEndpointsModel
from .openapiinfomodel import OpenAPIInfoModel
from .swaggerendpointmodel import SwaggerEndpointModel
__all__ = ['OpenAPISchemaModel', 'OpenAPIEndpointsModel', 'OpenAPIInfoModel', 'SwaggerEndpointModel']
| 44.714286
| 101
| 0.86901
| 21
| 313
| 12.761905
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.073482
| 313
| 6
| 102
| 52.166667
| 0.924138
| 0
| 0
| 0
| 0
| 0
| 0.239617
| 0.067093
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.8
| 0
| 0.8
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
9b61c510951ea9cd863216f8d700ebcd0e3a0ef5
| 147
|
py
|
Python
|
climat/settings.py
|
Desk30/climat
|
dca7c3a89aa1b689bcf282a61421c3c78ab9bed0
|
[
"MIT"
] | null | null | null |
climat/settings.py
|
Desk30/climat
|
dca7c3a89aa1b689bcf282a61421c3c78ab9bed0
|
[
"MIT"
] | 7
|
2021-01-13T07:05:27.000Z
|
2021-01-16T18:04:03.000Z
|
climat/settings.py
|
Desk30/climat
|
dca7c3a89aa1b689bcf282a61421c3c78ab9bed0
|
[
"MIT"
] | null | null | null |
from pathlib import Path
class Settings:
pdata = Path("data")
def get_data_dir(json_file: str):
return Settings.pdata / json_file.stem
| 14.7
| 42
| 0.721088
| 22
| 147
| 4.636364
| 0.727273
| 0.254902
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.190476
| 147
| 9
| 43
| 16.333333
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0.027211
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.2
| 0.2
| 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
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
9b93405ac510c70f9fde6c77c4c6e2612f8ef344
| 32
|
py
|
Python
|
regras/asdf.py
|
hubertokf/lupsContextServer
|
4f3cd2ef0ddc9a62f408de168caf42be770aed69
|
[
"MIT"
] | 2
|
2017-05-23T12:05:28.000Z
|
2018-05-08T20:38:23.000Z
|
regras/asdf.py
|
hubertokf/lupsContextServer
|
4f3cd2ef0ddc9a62f408de168caf42be770aed69
|
[
"MIT"
] | null | null | null |
regras/asdf.py
|
hubertokf/lupsContextServer
|
4f3cd2ef0ddc9a62f408de168caf42be770aed69
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
print "oi"
| 16
| 21
| 0.6875
| 6
| 32
| 3.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.09375
| 32
| 2
| 22
| 16
| 0.758621
| 0.625
| 0
| 0
| 0
| 0
| 0.166667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
32e5d865d339e60c9bd082fa7fde79ab54f4ed12
| 94
|
py
|
Python
|
cs1006-IntroPython/HW5-MachineLearning/models/__init__.py
|
ecahern16/AcademicCode
|
cf95a65545e7054604c23d4830f709323eeb81f5
|
[
"Apache-2.0"
] | null | null | null |
cs1006-IntroPython/HW5-MachineLearning/models/__init__.py
|
ecahern16/AcademicCode
|
cf95a65545e7054604c23d4830f709323eeb81f5
|
[
"Apache-2.0"
] | null | null | null |
cs1006-IntroPython/HW5-MachineLearning/models/__init__.py
|
ecahern16/AcademicCode
|
cf95a65545e7054604c23d4830f709323eeb81f5
|
[
"Apache-2.0"
] | null | null | null |
from .knn import NNClassifier
from .sklearn import SKLearnKnnClassifier, SKLearnSVMClassifier
| 31.333333
| 63
| 0.87234
| 9
| 94
| 9.111111
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.095745
| 94
| 2
| 64
| 47
| 0.964706
| 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
|
fd34378d86344caf38e7acadc35a608af9e65411
| 284
|
py
|
Python
|
SimPEG/regularization/__init__.py
|
kimjaed/simpeg
|
b8d716f86a4ea07ba3085fabb24c2bc974788040
|
[
"MIT"
] | 1
|
2020-03-17T11:24:15.000Z
|
2020-03-17T11:24:15.000Z
|
SimPEG/regularization/__init__.py
|
kimjaed/simpeg
|
b8d716f86a4ea07ba3085fabb24c2bc974788040
|
[
"MIT"
] | 1
|
2020-10-29T11:42:21.000Z
|
2020-10-29T11:42:21.000Z
|
SimPEG/regularization/__init__.py
|
kimjaed/simpeg
|
b8d716f86a4ea07ba3085fabb24c2bc974788040
|
[
"MIT"
] | 1
|
2020-07-09T18:15:10.000Z
|
2020-07-09T18:15:10.000Z
|
from .base import BaseRegularization, BaseComboRegularization
from .regularization_mesh import RegularizationMesh
from .tikhonov import (
SimpleSmall, SimpleSmoothDeriv, Simple,
Small, SmoothDeriv, SmoothDeriv2, Tikhonov
)
from .sparse import SparseSmall, SparseDeriv, Sparse
| 35.5
| 61
| 0.823944
| 26
| 284
| 8.961538
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.004016
| 0.123239
| 284
| 7
| 62
| 40.571429
| 0.931727
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.571429
| 0
| 0.571429
| 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
|
fd3f8e99bc37f15ccba29891721ff01f64365aef
| 2,971
|
py
|
Python
|
lstm_demo.py
|
csruiliu/tensorflow_ptb
|
ff85b270a266e4b4f6634c4fa7973569d1e7747d
|
[
"MIT"
] | null | null | null |
lstm_demo.py
|
csruiliu/tensorflow_ptb
|
ff85b270a266e4b4f6634c4fa7973569d1e7747d
|
[
"MIT"
] | null | null | null |
lstm_demo.py
|
csruiliu/tensorflow_ptb
|
ff85b270a266e4b4f6634c4fa7973569d1e7747d
|
[
"MIT"
] | null | null | null |
from models.bi_lstm import BiLSTM
from models.lstm import LSTMNet
import tools.udtb_reader as udtb_reader
import tensorflow as tf
def main():
(train_sentences_x,
val_sentences_x,
train_tags_y,
val_tags_y,
MAX_LENGTH,
word2index,
tag2index) = udtb_reader.load_udtb_dataset()
####################################################
# Build model for BiLSTM
####################################################
config = tf.ConfigProto()
config.allow_soft_placement = True
config.gpu_options.allow_growth = True
with tf.Session(config=config) as sess:
sess.run(tf.global_variables_initializer())
model = BiLSTM(MAX_LENGTH, learn_rate=0.001, optimizer='Adam')
logit, _ = model.build(word2index, tag2index)
logit.fit(train_sentences_x,
udtb_reader.to_categorical(train_tags_y, len(tag2index)),
batch_size=64,
epochs=1,
validation_split=0.2)
scores = logit.evaluate(val_sentences_x, udtb_reader.to_categorical(val_tags_y, len(tag2index)))
print(f"{logit.metrics_names[1]}: {scores[1]}")
logit.save('lstm.h5')
logit.load_weights('lstm.h5')
logit.fit(train_sentences_x,
udtb_reader.to_categorical(train_tags_y, len(tag2index)),
batch_size=64,
epochs=1,
validation_split=0.2)
scores = logit.evaluate(val_sentences_x, udtb_reader.to_categorical(val_tags_y, len(tag2index)))
print(f"{logit.metrics_names[1]}: {scores[1]}")
####################################################
# Build model for LSTM
####################################################
config = tf.ConfigProto()
config.allow_soft_placement = True
config.gpu_options.allow_growth = True
with tf.Session(config=config) as sess:
sess.run(tf.global_variables_initializer())
model = LSTMNet(MAX_LENGTH, learn_rate=0.001, optimizer='Adagrad')
logit, _ = model.build(word2index, tag2index)
logit.fit(train_sentences_x,
udtb_reader.to_categorical(train_tags_y, len(tag2index)),
batch_size=64,
epochs=10,
validation_split=0.2)
scores = logit.evaluate(val_sentences_x, udtb_reader.to_categorical(val_tags_y, len(tag2index)))
print('{}: {}'.format(logit.metrics_names[1], scores[1]))
logit.save('bilstm.h5')
logit.load_weights('bilstm.h5')
logit.fit(train_sentences_x,
udtb_reader.to_categorical(train_tags_y, len(tag2index)),
batch_size=64,
epochs=1,
validation_split=0.2)
scores = logit.evaluate(val_sentences_x, udtb_reader.to_categorical(val_tags_y, len(tag2index)))
print(f"{logit.metrics_names[1]}: {scores[1]}")
if __name__ == "__main__":
main()
| 34.149425
| 104
| 0.585325
| 343
| 2,971
| 4.769679
| 0.230321
| 0.067237
| 0.06846
| 0.0978
| 0.784841
| 0.784841
| 0.784841
| 0.746944
| 0.72066
| 0.72066
| 0
| 0.024532
| 0.245372
| 2,971
| 87
| 105
| 34.149425
| 0.705174
| 0.014473
| 0
| 0.633333
| 0
| 0
| 0.06181
| 0.027594
| 0
| 0
| 0
| 0
| 0
| 1
| 0.016667
| false
| 0
| 0.066667
| 0
| 0.083333
| 0.066667
| 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
|
b5dd7484ad48a3b2397eaea7dfacbe383784852c
| 110
|
py
|
Python
|
backend/modules/payments/admin.py
|
crowdbotics-apps/nftlink-33254
|
14c1e9d8c797966896145d608c583f168679369c
|
[
"FTL",
"AML",
"RSA-MD"
] | null | null | null |
backend/modules/payments/admin.py
|
crowdbotics-apps/nftlink-33254
|
14c1e9d8c797966896145d608c583f168679369c
|
[
"FTL",
"AML",
"RSA-MD"
] | null | null | null |
backend/modules/payments/admin.py
|
crowdbotics-apps/nftlink-33254
|
14c1e9d8c797966896145d608c583f168679369c
|
[
"FTL",
"AML",
"RSA-MD"
] | null | null | null |
from django.contrib import admin
from .models import StripeUserProfile
admin.site.register(StripeUserProfile)
| 27.5
| 38
| 0.863636
| 13
| 110
| 7.307692
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.081818
| 110
| 4
| 38
| 27.5
| 0.940594
| 0
| 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
|
bd4494b60ca01674a8d51c5545fd51db457d174c
| 1,360
|
py
|
Python
|
Scripts/old_scripts/bird_npdata.py
|
calvinyong/adversarial_examples_capproj
|
972e89e105dec6dc5f61e62f378d06656698b71d
|
[
"MIT"
] | 1
|
2020-11-15T03:51:10.000Z
|
2020-11-15T03:51:10.000Z
|
Scripts/old_scripts/bird_npdata.py
|
calvinyong/adversarial_examples_capproj
|
972e89e105dec6dc5f61e62f378d06656698b71d
|
[
"MIT"
] | null | null | null |
Scripts/old_scripts/bird_npdata.py
|
calvinyong/adversarial_examples_capproj
|
972e89e105dec6dc5f61e62f378d06656698b71d
|
[
"MIT"
] | null | null | null |
import numpy as np
import cv2
from glob import glob
from tqdm import tqdm
bird_imgs_train = glob('../Data/bird_or_bicycle/0.0.3/train/bird/*')
bicycle_imgs_train = glob('../Data/bird_or_bicycle/0.0.3/train/bicycle/*')
bird_imgs_test = glob('../Data/bird_or_bicycle/0.0.3/test/bird/*')
bicycle_imgs_test = glob('../Data/bird_or_bicycle/0.0.3/test/bicycle/*')
array = np.empty(shape=(0, 299, 299, 3), dtype=int)
for f in tqdm(bird_imgs_train, desc='bird train'):
img = cv2.imread(f)
img = np.expand_dims(img, axis=0)
array = np.append(array, img, axis=0)
for f in tqdm(bicycle_imgs_train, desc='bicycle train'):
img = cv2.imread(f)
img = np.expand_dims(img, axis=0)
array = np.append(array, img, axis=0)
array = array[:, :, :, ::-1].copy()
np.save('bird_bicycle_train.npy', array)
print("Train saved ndarray of shape:", array.shape)
array = np.empty(shape=(0, 299, 299, 3), dtype=int)
for f in tqdm(bird_imgs_test, desc='bird test'):
img = cv2.imread(f)
img = np.expand_dims(img, axis=0)
array = np.append(array, img, axis=0)
for f in tqdm(bicycle_imgs_test, desc='bicycle test'):
img = cv2.imread(f)
img = np.expand_dims(img, axis=0)
array = np.append(array, img, axis=0)
array = array[:, :, :, ::-1].copy()
np.save('bird_bicycle_test.npy', array)
print("Test saved ndarray of shape:", array.shape)
| 28.93617
| 74
| 0.673529
| 236
| 1,360
| 3.745763
| 0.173729
| 0.063348
| 0.072398
| 0.088235
| 0.769231
| 0.769231
| 0.70362
| 0.70362
| 0.70362
| 0.70362
| 0
| 0.037133
| 0.148529
| 1,360
| 46
| 75
| 29.565217
| 0.726252
| 0
| 0
| 0.5
| 0
| 0
| 0.232353
| 0.158088
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.125
| 0
| 0.125
| 0.0625
| 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
|
1f9c6740a98bbfb1fd83ff58a52e355575ca2c5d
| 145
|
py
|
Python
|
vcfsyncer/__init__.py
|
jeremymcrae/vcfsyncer
|
3233df0b4ea760d066a7ade7d315441bf4c01fac
|
[
"MIT"
] | 1
|
2019-01-25T19:07:05.000Z
|
2019-01-25T19:07:05.000Z
|
vcfsyncer/__init__.py
|
jeremymcrae/vcfsyncer
|
3233df0b4ea760d066a7ade7d315441bf4c01fac
|
[
"MIT"
] | null | null | null |
vcfsyncer/__init__.py
|
jeremymcrae/vcfsyncer
|
3233df0b4ea760d066a7ade7d315441bf4c01fac
|
[
"MIT"
] | null | null | null |
from pkg_resources import get_distribution
name = 'vcfsyncer'
__version__ = get_distribution(name).version
from vcfsyncer.vcf import VCFSyncer
| 20.714286
| 44
| 0.834483
| 18
| 145
| 6.333333
| 0.555556
| 0.263158
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.110345
| 145
| 6
| 45
| 24.166667
| 0.883721
| 0
| 0
| 0
| 0
| 0
| 0.062069
| 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
|
1fda39018e0e141b87a3a7fd0236e168a0039f7c
| 118
|
py
|
Python
|
dashboard/admin.py
|
kingbaberre/Study-buddy
|
808f96ef7cd08cd535154de6bcaadede0c36157a
|
[
"MIT",
"Unlicense"
] | null | null | null |
dashboard/admin.py
|
kingbaberre/Study-buddy
|
808f96ef7cd08cd535154de6bcaadede0c36157a
|
[
"MIT",
"Unlicense"
] | 10
|
2020-02-12T01:26:33.000Z
|
2022-02-10T12:29:37.000Z
|
dashboard/admin.py
|
kingbaberre/Study-buddy
|
808f96ef7cd08cd535154de6bcaadede0c36157a
|
[
"MIT",
"Unlicense"
] | null | null | null |
from django.contrib import admin
from .forms import Profile
# Register your models here.
admin.site.register(Profile)
| 23.6
| 32
| 0.813559
| 17
| 118
| 5.647059
| 0.705882
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.118644
| 118
| 5
| 33
| 23.6
| 0.923077
| 0.220339
| 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
|
9528dec2a2b8c9cddc25ff2fe0c6ca228acfe35a
| 7,090
|
py
|
Python
|
network.py
|
RPetitpierre/goods_supply_interactive_visualization
|
0ae61b5f5fa07b3e4c4846569f1c30fc4efe9bc1
|
[
"MIT"
] | 2
|
2018-11-24T10:59:32.000Z
|
2019-04-05T20:37:30.000Z
|
network.py
|
RPetitpierre/goods_supply_interactive_visualization
|
0ae61b5f5fa07b3e4c4846569f1c30fc4efe9bc1
|
[
"MIT"
] | null | null | null |
network.py
|
RPetitpierre/goods_supply_interactive_visualization
|
0ae61b5f5fa07b3e4c4846569f1c30fc4efe9bc1
|
[
"MIT"
] | null | null | null |
import folium
import settings as sgs
import numpy as np
def get_beautiful_base_image_map(df_flux, thin=False):
""" Create the beautiful folium map containing routes, with blur effect """
# Initialize folium map parameters
folium_map = folium.Map(location = sgs._location_map,
zoom_start = sgs._zoom_map,
tiles = "CartoDB dark_matter")
# From outer to inner, establish a beautiful shading of colors and opacities in order
# to create a lightning effect
colors = ['#FFCB00','#FFD325','#FDFAF1']
weight = 1
# The thin mode allow to draw a very light network, which is useful if you want to add
# other information of the map in order to avoid to overload the representation
if thin :
opacities = [.12, .16, .55]
weight = 1/20
else :
opacities = [.18, .23, .8]
weight = 1/5
# The process is doubled because of a bug from folium which sometimes doesn't draw the line
for j in range(2):
# Iterate on all routes to draw
for ind_, row in df_flux.iterrows():
# Iterate over the successive layers of colors/weights/opacities which result in the lightning effect
for i in range(len(colors)):
# Add a line on the folium map
folium.PolyLine(locations = [[row[4], row[5]],
[row[1], row[2]]],
color = colors[i],
opacity = float(opacities[i]),
weight = np.log2(row['flux'])*(len(colors)-i)*weight).add_to(folium_map)
return folium_map
def get_beautiful_tricolor_base_image_map(df_flux):
""" Create the beautiful folium map containing routes, with blur effect. In this variant,
the naval trade routes will be displayed in blue. Land+naval routes will be displayed
in green """
# This tricolor representation only make sense if the naval mode is enabled
if sgs._enable_Naval :
# Initialize folium map parameters
folium_map = folium.Map(location = sgs._location_map,
zoom_start = sgs._zoom_map,
tiles = "CartoDB dark_matter")
# From outer to inner, establish a beautiful shading of colors and opacities in order
# to create a lightning effect
colors = [['#FFCB00','#FFD325','#FDFAF1'], # gold for land routes
['#0092FF', '#25C5FF','#CAE9FF'], # blue for naval routes
['#00CE18','#25CE39','#B4E1B9']] # green for land+naval routes
opacities = [.18, .23, .8]
# The process is doubled because of a bug from folium which sometimes doesn't draw the line
for j in range(2):
# Iterate on all routes to draw
for ind_, row in df_flux.iterrows():
# Select land flux, naval flux or heterogenous flux
if sum(row[6:6+sgs._Ntypes_production]) > 0 :
if sum(row[16:16+sgs._Ntypes_production]) > 0: I = 2
else : I = 0
else : I = 1
# Iterate over the successive layers of colors/weights/opacities which result in the lightning effect
for i in range(len(colors[I])):
# Add a line on the folium map
folium.PolyLine(locations = [[row[4], row[5]],
[row[1], row[2]]],
color = colors[I][i],
opacity = float(opacities[i]),
weight = np.log2(row['flux'])*(len(colors[I])-i)/5).add_to(folium_map)
# If the naval mode is not enabled, we just call the classical function
else :
folium_map = get_beautiful_base_image_map(flux)
return folium_map
def get_beautiful_base_image_map_by_route_category(df_flux, mode):
""" Create the beautiful folium map containing routes, with blur effect. In this variant,
depending on the mode ('naval' or 'land'), only land or naval routes will be displayed """
# Initialize folium map parameters
folium_map = folium.Map(location = sgs._location_map,
zoom_start = sgs._zoom_map,
tiles = "CartoDB dark_matter")
# This tricolor representation only make sense if the naval mode is enabled
if sgs._enable_Naval :
# Initialize variable
colors = []
# From outer to inner, establish a beautiful shading of colors and opacities in order
# to create a lightning effect
if mode == 'naval' :
colors = ['#0092FF', '#25C5FF','#CAE9FF'] # blue for naval routes
elif mode == 'land' :
colors = ['#FFCB00','#FFD325','#FDFAF1'] # gold for land routes
else :
print("ERROR : mode should be either 'land' or 'naval'.")
folium_map = get_beautiful_base_image_map(flux)
opacities = [.18, .23, .8]
# The process is doubled because of a bug from folium which sometimes doesn't draw the line
for j in range(2):
# Iterate on all routes to draw
for ind_, row in df_flux.iterrows():
# Initialize variable
is_of_route_category = False
# Test if the route is a land route
if (sum(row[6:6+sgs._Ntypes_production]) > 0) & (mode == 'land') :
is_of_route_category = True
# Test if the route is a naval route
elif (sum(row[16:16+sgs._Ntypes_production]) > 0) & (mode == 'naval') :
is_of_route_category = True
# Route is only plotted if it is of the wished category
if is_of_route_category:
# Iterate over the successive layers of colors/weights/opacities which result in the lightning effect
for i in range(len(colors)):
# Add a line on the folium map
folium.PolyLine(locations = [[row[4], row[5]],
[row[1], row[2]]],
color = colors[i],
opacity = float(opacities[i]),
weight = np.log2(row['flux'])*(len(colors)-i)/5).add_to(folium_map)
# If the naval mode is not enabled, we just call the classical function
else :
print('ERROR : Naval mode should be enabled to use this function.')
folium_map = get_beautiful_base_image_map(flux)
return folium_map
| 44.3125
| 125
| 0.533145
| 843
| 7,090
| 4.372479
| 0.19573
| 0.0586
| 0.019533
| 0.028486
| 0.800054
| 0.759088
| 0.727075
| 0.707542
| 0.665491
| 0.649213
| 0
| 0.025529
| 0.386742
| 7,090
| 159
| 126
| 44.591195
| 0.822217
| 0.339774
| 0
| 0.5875
| 0
| 0
| 0.069348
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.0375
| false
| 0
| 0.0375
| 0
| 0.1125
| 0.025
| 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
|
1f0fced5a21c37a33b5743018f3631bb4a58032b
| 658
|
py
|
Python
|
test/test_account.py
|
Factern/factern-client-python
|
2453dbf0d683417142fe98514ef6de2742f14f92
|
[
"MIT"
] | null | null | null |
test/test_account.py
|
Factern/factern-client-python
|
2453dbf0d683417142fe98514ef6de2742f14f92
|
[
"MIT"
] | null | null | null |
test/test_account.py
|
Factern/factern-client-python
|
2453dbf0d683417142fe98514ef6de2742f14f92
|
[
"MIT"
] | 2
|
2018-07-20T15:02:06.000Z
|
2018-08-01T20:38:38.000Z
|
# coding: utf-8
"""
Factern API
"""
from __future__ import absolute_import
import unittest
import factern_client
from factern_client.com.factern.model.account import Account # noqa: E501
from factern_client.rest import ApiException
class TestAccount(unittest.TestCase):
"""Account unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testAccount(self):
"""Test Account"""
# FIXME: construct object with mandatory attributes with example values
# model = factern_client.models.account.Account() # noqa: E501
pass
if __name__ == '__main__':
unittest.main()
| 18.8
| 79
| 0.679331
| 76
| 658
| 5.657895
| 0.539474
| 0.12093
| 0.07907
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.013807
| 0.229483
| 658
| 34
| 80
| 19.352941
| 0.83432
| 0.31155
| 0
| 0.214286
| 0
| 0
| 0.018735
| 0
| 0
| 0
| 0
| 0.029412
| 0
| 1
| 0.214286
| false
| 0.214286
| 0.357143
| 0
| 0.642857
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 1
| 0
| 1
| 0
|
0
| 5
|
1f1ac0e6cc7971e451b335acf6ff8ac16667042b
| 14
|
py
|
Python
|
test.py
|
nhabella/astra-bootcamp
|
d53f89d7d0310abadf32f10490831d2fa0427829
|
[
"MIT"
] | null | null | null |
test.py
|
nhabella/astra-bootcamp
|
d53f89d7d0310abadf32f10490831d2fa0427829
|
[
"MIT"
] | null | null | null |
test.py
|
nhabella/astra-bootcamp
|
d53f89d7d0310abadf32f10490831d2fa0427829
|
[
"MIT"
] | null | null | null |
print ('hai')
| 7
| 13
| 0.571429
| 2
| 14
| 4
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 14
| 1
| 14
| 14
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0.214286
| 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
|
1f5cdfecfeecbc564936e0383ef79204d45df3dd
| 7,645
|
py
|
Python
|
test/unit/mongo_class/coll_connect.py
|
deepcoder42/mongo-lib
|
fa2b65587ab88ee90c9d85f12dd642c6295e0d94
|
[
"MIT"
] | null | null | null |
test/unit/mongo_class/coll_connect.py
|
deepcoder42/mongo-lib
|
fa2b65587ab88ee90c9d85f12dd642c6295e0d94
|
[
"MIT"
] | null | null | null |
test/unit/mongo_class/coll_connect.py
|
deepcoder42/mongo-lib
|
fa2b65587ab88ee90c9d85f12dd642c6295e0d94
|
[
"MIT"
] | null | null | null |
#!/usr/bin/python
# Classification (U)
"""Program: coll_connect.py
Description: Unit testing of Coll.connect in mongo_class.py.
Usage:
test/unit/mongo_class/coll_connect.py
Arguments:
"""
# Libraries and Global Variables
# Standard
import sys
import os
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
# Third-party
import mock
# Local
sys.path.append(os.getcwd())
import mongo_class
import version
__version__ = version.__version__
class UnitTest(unittest.TestCase):
"""Class: UnitTest
Description: Class which is a representation of a unit testing.
Methods:
setUp
test_miss_coll_coll2
test_miss_coll_coll
test_coll_attr2
test_coll_attr
test_no_conn_list1
test_no_conn_list
test_fail_connection2
test_fail_connection
test_default2
test_default
"""
def setUp(self):
"""Function: setUp
Description: Initialization for unit testing.
Arguments:
"""
self.name = "Mongo_Server"
self.user = "mongo_user"
self.japd = "mongo_pd"
self.host = "host_server"
self.port = 27017
self.dbs = "test"
self.coll = "coll_name"
self.db_auth = None
self.errmsg = "Error Message"
self.errmsg2 = "Error: Unable to connect, no collection passed."
@mock.patch("mongo_class.Server.get_srv_attr")
@mock.patch("mongo_class.pymongo.MongoClient")
def test_miss_coll_coll2(self, mock_client, mock_cmd):
"""Function: test_miss_coll_coll2
Description: Test with no Collection passed.
Arguments:
"""
mock_client.return_value = True
mock_cmd.return_value = (True, None)
mongo = mongo_class.Coll(self.name, self.user, self.japd, self.host,
self.port)
mongo.conn = {"test": {"coll_name": None}}
self.assertEqual(mongo.coll_coll, None)
@mock.patch("mongo_class.Server.get_srv_attr")
@mock.patch("mongo_class.pymongo.MongoClient")
def test_miss_coll_coll(self, mock_client, mock_cmd):
"""Function: test_miss_coll_coll
Description: Test with no Collection passed.
Arguments:
"""
mock_client.return_value = True
mock_cmd.return_value = (True, None)
mongo = mongo_class.Coll(self.name, self.user, self.japd, self.host,
self.port)
mongo.conn = {"test": {"coll_name": None}}
self.assertEqual(mongo.connect(), (False, self.errmsg2))
@mock.patch("mongo_class.Server.get_srv_attr")
@mock.patch("mongo_class.pymongo.MongoClient")
def test_coll_attr2(self, mock_client, mock_cmd):
"""Function: test_coll_attr2
Description: Test coll attribute.
Arguments:
"""
mock_client.return_value = True
mock_cmd.return_value = (True, None)
mongo = mongo_class.Coll(self.name, self.user, self.japd, self.host,
self.port, coll=self.coll)
mongo.conn = {"test": {"coll_name": "connect"}}
mongo.connect()
self.assertEqual((mongo.coll), ("connect"))
@mock.patch("mongo_class.Server.get_srv_attr")
@mock.patch("mongo_class.pymongo.MongoClient")
def test_coll_attr(self, mock_client, mock_cmd):
"""Function: test_coll_attr
Description: Test coll attribute.
Arguments:
"""
mock_client.return_value = True
mock_cmd.return_value = (True, None)
mongo = mongo_class.Coll(self.name, self.user, self.japd, self.host,
self.port, coll=self.coll)
mongo.conn = {"test": {"coll_name": "connect"}}
self.assertEqual(mongo.connect(), (True, None))
@mock.patch("mongo_class.Server.get_srv_attr")
@mock.patch("mongo_class.pymongo.MongoClient")
def test_no_conn_list1(self, mock_client, mock_cmd):
"""Function: test_no_conn_list1
Description: Test with no connections passed.
Arguments:
"""
mock_client.return_value = True
mock_cmd.return_value = (True, None)
mongo = mongo_class.Coll(self.name, self.user, self.japd, self.host,
self.port, coll=self.coll)
mongo.conn = {"test": {"coll_name": "connect"}}
mongo.connect()
self.assertEqual((mongo.coll), ("connect"))
@mock.patch("mongo_class.Server.get_srv_attr")
@mock.patch("mongo_class.pymongo.MongoClient")
def test_no_conn_list(self, mock_client, mock_cmd):
"""Function: test_no_conn_list
Description: Test with no connections passed.
Arguments:
"""
mock_client.return_value = True
mock_cmd.return_value = (True, None)
mongo = mongo_class.Coll(self.name, self.user, self.japd, self.host,
self.port, coll=self.coll)
mongo.conn = {"test": {"coll_name": "connect"}}
self.assertEqual(mongo.connect(), (True, None))
@mock.patch("mongo_class.Server.get_srv_attr")
@mock.patch("mongo_class.pymongo.MongoClient")
def test_fail_connection2(self, mock_client, mock_cmd):
"""Function: test_fail_connection2
Description: Test with failed connection.
Arguments:
"""
mock_client.return_value = True
mock_cmd.return_value = (False, self.errmsg)
mongo = mongo_class.Coll(self.name, self.user, self.japd, self.host,
self.port, coll=self.coll)
self.assertEqual(mongo.coll, None)
@mock.patch("mongo_class.Server.get_srv_attr")
@mock.patch("mongo_class.pymongo.MongoClient")
def test_fail_connection(self, mock_client, mock_cmd):
"""Function: test_fail_connection
Description: Test with failed connection.
Arguments:
"""
mock_client.return_value = True
mock_cmd.return_value = (False, self.errmsg)
mongo = mongo_class.Coll(self.name, self.user, self.japd, self.host,
self.port, coll=self.coll)
self.assertEqual(mongo.connect(), (False, self.errmsg))
@mock.patch("mongo_class.Server.get_srv_attr")
@mock.patch("mongo_class.pymongo.MongoClient")
def test_default2(self, mock_client, mock_cmd):
"""Function: test_default2
Description: Test connect method with default arguments.
Arguments:
"""
mock_client.return_value = True
mock_cmd.return_value = (True, None)
mongo = mongo_class.Coll(self.name, self.user, self.japd, self.host,
self.port, coll=self.coll)
mongo.conn = {"test": {"coll_name": "connect"}}
mongo.connect()
self.assertEqual((mongo.coll), ("connect"))
@mock.patch("mongo_class.Server.get_srv_attr")
@mock.patch("mongo_class.pymongo.MongoClient")
def test_default(self, mock_client, mock_cmd):
"""Function: test_default
Description: Test connect method with default arguments.
Arguments:
"""
mock_client.return_value = True
mock_cmd.return_value = (True, None)
mongo = mongo_class.Coll(self.name, self.user, self.japd, self.host,
self.port, coll=self.coll)
mongo.conn = {"test": {"coll_name": "connect"}}
self.assertEqual(mongo.connect(), (True, None))
if __name__ == "__main__":
unittest.main()
| 26.09215
| 76
| 0.615827
| 905
| 7,645
| 4.966851
| 0.117127
| 0.073415
| 0.062291
| 0.084538
| 0.769744
| 0.769744
| 0.762625
| 0.747942
| 0.715017
| 0.679422
| 0
| 0.004483
| 0.270504
| 7,645
| 292
| 77
| 26.181507
| 0.801506
| 0.198823
| 0
| 0.663793
| 0
| 0
| 0.159874
| 0.108925
| 0
| 0
| 0
| 0
| 0.086207
| 1
| 0.094828
| false
| 0.008621
| 0.060345
| 0
| 0.163793
| 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
|
2f0d2d1a6012f51e0a2834c9370ce701a2ef9f77
| 38
|
py
|
Python
|
hello.py
|
9233/mall
|
5d545d788ac89ae5b962cc94d1c7834db048d4d1
|
[
"Apache-2.0"
] | null | null | null |
hello.py
|
9233/mall
|
5d545d788ac89ae5b962cc94d1c7834db048d4d1
|
[
"Apache-2.0"
] | null | null | null |
hello.py
|
9233/mall
|
5d545d788ac89ae5b962cc94d1c7834db048d4d1
|
[
"Apache-2.0"
] | null | null | null |
print("14:46")
print("hellp python~")
| 12.666667
| 22
| 0.657895
| 6
| 38
| 4.166667
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.114286
| 0.078947
| 38
| 2
| 23
| 19
| 0.6
| 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
|
2f22d3e73108b149db320d92aab7d3a4441bb9ba
| 398
|
py
|
Python
|
thumt/modules/__init__.py
|
THUNLP-MT/Transformer-DMB
|
14dedbedf2e369f9b8abf53d8d47c7862a951e39
|
[
"BSD-3-Clause"
] | null | null | null |
thumt/modules/__init__.py
|
THUNLP-MT/Transformer-DMB
|
14dedbedf2e369f9b8abf53d8d47c7862a951e39
|
[
"BSD-3-Clause"
] | null | null | null |
thumt/modules/__init__.py
|
THUNLP-MT/Transformer-DMB
|
14dedbedf2e369f9b8abf53d8d47c7862a951e39
|
[
"BSD-3-Clause"
] | null | null | null |
import thumt.modules.dmb
import thumt.modules.moe
from thumt.modules.affine import Affine
from thumt.modules.attention import MultiHeadAttention
from thumt.modules.embedding import PositionalEmbedding
from thumt.modules.feed_forward import FeedForward
from thumt.modules.layer_norm import LayerNorm
from thumt.modules.losses import SmoothedCrossEntropyLoss
from thumt.modules.module import Module
| 36.181818
| 57
| 0.871859
| 52
| 398
| 6.634615
| 0.384615
| 0.313043
| 0.324638
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.082915
| 398
| 10
| 58
| 39.8
| 0.945205
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
2f6fbdb53cb5005b6c7ead8ba6a4f1d7e329f285
| 191
|
py
|
Python
|
prepros/__init__.py
|
igkishore/prePros
|
92ff148721034ccca08c984e5246267fb655516a
|
[
"MIT"
] | null | null | null |
prepros/__init__.py
|
igkishore/prePros
|
92ff148721034ccca08c984e5246267fb655516a
|
[
"MIT"
] | null | null | null |
prepros/__init__.py
|
igkishore/prePros
|
92ff148721034ccca08c984e5246267fb655516a
|
[
"MIT"
] | null | null | null |
from .pros import Pros
from .imageTransform import imageTransform
from .imageFilter import imageFilter
from .edgeDetection import edgeDetection
from .dataAugmentation import dataAugmenation
| 27.285714
| 45
| 0.863874
| 20
| 191
| 8.25
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.109948
| 191
| 6
| 46
| 31.833333
| 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
|
2f91ca7d1da5621f689defe7c685a49d9aace27d
| 129
|
py
|
Python
|
ros_ws/src/baxter_interface/src/baxter_interface/head.py
|
mesneym/Baxter-Arm-PP
|
fdbf86309bc64c31af105daa026b2f8519710129
|
[
"MIT"
] | null | null | null |
ros_ws/src/baxter_interface/src/baxter_interface/head.py
|
mesneym/Baxter-Arm-PP
|
fdbf86309bc64c31af105daa026b2f8519710129
|
[
"MIT"
] | null | null | null |
ros_ws/src/baxter_interface/src/baxter_interface/head.py
|
mesneym/Baxter-Arm-PP
|
fdbf86309bc64c31af105daa026b2f8519710129
|
[
"MIT"
] | null | null | null |
version https://git-lfs.github.com/spec/v1
oid sha256:c41f5c1d8835eca735f94f98317d8646b5b4a1e84e07434433dbd4fc7c9f7c1c
size 6127
| 32.25
| 75
| 0.883721
| 13
| 129
| 8.769231
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.390244
| 0.046512
| 129
| 3
| 76
| 43
| 0.536585
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 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
| 0
| null | 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
2f9df9c47a8b2c289d4f0abd3e69b585df445c80
| 134
|
py
|
Python
|
zcrmsdk/src/com/zoho/crm/api/record/file_handler.py
|
zoho/zohocrm-python-sdk-2.0
|
3a93eb3b57fed4e08f26bd5b311e101cb2995411
|
[
"Apache-2.0"
] | null | null | null |
zcrmsdk/src/com/zoho/crm/api/record/file_handler.py
|
zoho/zohocrm-python-sdk-2.0
|
3a93eb3b57fed4e08f26bd5b311e101cb2995411
|
[
"Apache-2.0"
] | null | null | null |
zcrmsdk/src/com/zoho/crm/api/record/file_handler.py
|
zoho/zohocrm-python-sdk-2.0
|
3a93eb3b57fed4e08f26bd5b311e101cb2995411
|
[
"Apache-2.0"
] | null | null | null |
from abc import ABC, abstractmethod
class FileHandler(ABC):
def __init__(self):
"""Creates an instance of FileHandler"""
pass
| 14.888889
| 42
| 0.731343
| 17
| 134
| 5.529412
| 0.823529
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.171642
| 134
| 8
| 43
| 16.75
| 0.846847
| 0.253731
| 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
|
85eecd4581d0d0b7f2c8a9f6d7db93926d8dd1a6
| 125
|
py
|
Python
|
IncTrend/nlp_api/admin.py
|
AMOOOMA/IncTrend
|
c16cc1f91530a208122a48539d5a7bb0d3c75305
|
[
"MIT"
] | null | null | null |
IncTrend/nlp_api/admin.py
|
AMOOOMA/IncTrend
|
c16cc1f91530a208122a48539d5a7bb0d3c75305
|
[
"MIT"
] | null | null | null |
IncTrend/nlp_api/admin.py
|
AMOOOMA/IncTrend
|
c16cc1f91530a208122a48539d5a7bb0d3c75305
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Message
# Register your models here.
admin.site.register(Message)
| 20.833333
| 33
| 0.776
| 17
| 125
| 5.705882
| 0.647059
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.16
| 125
| 5
| 34
| 25
| 0.92381
| 0.208
| 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
|
85ff48d5e34f64da5bea55c92b79b027258e05f9
| 103
|
py
|
Python
|
calcium-2015/speedcameras.py
|
jcfausto/codility-challenges
|
57ef314d8902133fea78bfb91cd3f1ae5b65a7e2
|
[
"MIT"
] | null | null | null |
calcium-2015/speedcameras.py
|
jcfausto/codility-challenges
|
57ef314d8902133fea78bfb91cd3f1ae5b65a7e2
|
[
"MIT"
] | null | null | null |
calcium-2015/speedcameras.py
|
jcfausto/codility-challenges
|
57ef314d8902133fea78bfb91cd3f1ae5b65a7e2
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
class Solution:
def __str__(self):
return "SpeedCamera Codility Challenge"
| 17.166667
| 41
| 0.68932
| 12
| 103
| 5.583333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011628
| 0.165049
| 103
| 5
| 42
| 20.6
| 0.767442
| 0.203884
| 0
| 0
| 0
| 0
| 0.375
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0.333333
| 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
|
c830fdabaaf6fbcd4a7d8e6160e084f078f89b0f
| 75
|
py
|
Python
|
lib/analogues/backend/base.py
|
b8raoult/analogues
|
447c1b098298a93f45e754d95b6068df50a8ed1d
|
[
"Apache-2.0"
] | null | null | null |
lib/analogues/backend/base.py
|
b8raoult/analogues
|
447c1b098298a93f45e754d95b6068df50a8ed1d
|
[
"Apache-2.0"
] | null | null | null |
lib/analogues/backend/base.py
|
b8raoult/analogues
|
447c1b098298a93f45e754d95b6068df50a8ed1d
|
[
"Apache-2.0"
] | 1
|
2020-11-19T01:34:31.000Z
|
2020-11-19T01:34:31.000Z
|
class EngineBase:
def begin(self):
return self.engine.begin()
| 15
| 34
| 0.64
| 9
| 75
| 5.333333
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.253333
| 75
| 4
| 35
| 18.75
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0.333333
| 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
|
c83237274c23da00af9d6a4dc44ae400720c15a1
| 17,475
|
py
|
Python
|
misc/migrations/versions/19d023a4f56c_.py
|
davewood/do-portal
|
427e66a62c2fd93ce510af85a1093e431d11ca7f
|
[
"BSD-3-Clause"
] | null | null | null |
misc/migrations/versions/19d023a4f56c_.py
|
davewood/do-portal
|
427e66a62c2fd93ce510af85a1093e431d11ca7f
|
[
"BSD-3-Clause"
] | null | null | null |
misc/migrations/versions/19d023a4f56c_.py
|
davewood/do-portal
|
427e66a62c2fd93ce510af85a1093e431d11ca7f
|
[
"BSD-3-Clause"
] | null | null | null |
"""empty message
Revision ID: 19d023a4f56c
Revises: None
Create Date: 2017-03-08 14:03:11.446391
"""
# revision identifiers, used by Alembic.
revision = '19d023a4f56c'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('ah_bot_types',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=30), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('deliverables',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('deleted', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('emails',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('email', sa.String(length=255), nullable=True),
sa.Column('deleted', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('organization_groups',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('color', sa.String(length=7), nullable=True),
sa.Column('deleted', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('report_types',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=100), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('roles',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=64), nullable=True),
sa.Column('default', sa.Boolean(), nullable=True),
sa.Column('permissions', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_index(op.f('ix_roles_default'), 'roles', ['default'], unique=False)
op.create_table('tags',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=50), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.create_table('tasks_groupmeta',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('taskset_id', sa.String(length=255), nullable=True),
sa.Column('result', sa.LargeBinary(), nullable=True),
sa.Column('date_done', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('taskset_id')
)
op.create_table('tasks_taskmeta',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('task_id', sa.String(length=255), nullable=True),
sa.Column('status', sa.String(length=50), nullable=True),
sa.Column('result', sa.LargeBinary(), nullable=True),
sa.Column('date_done', sa.DateTime(), nullable=True),
sa.Column('traceback', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('task_id')
)
op.create_table('ah_bots',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('bot_type_id', sa.Integer(), nullable=True),
sa.Column('name', sa.String(length=30), nullable=True),
sa.Column('description', sa.String(length=255), nullable=True),
sa.ForeignKeyConstraint(['bot_type_id'], ['ah_bot_types.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('deliverable_files',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('deliverable_id', sa.Integer(), nullable=True),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('is_sla', sa.Integer(), nullable=True),
sa.Column('deleted', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['deliverable_id'], ['deliverables.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('organizations',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('organization_group_id', sa.Integer(), nullable=True),
sa.Column('is_sla', sa.Integer(), nullable=True),
sa.Column('abbreviation', sa.String(length=255), nullable=True),
sa.Column('old_ID', sa.String(length=5), nullable=True),
sa.Column('full_name', sa.String(length=255), nullable=True),
sa.Column('mail_template', sa.String(length=50), nullable=True),
sa.Column('mail_times', sa.Integer(), nullable=True),
sa.Column('deleted', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['organization_group_id'], ['organization_groups.id'], name='fk_org_group_id'),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_organizations_abbreviation'), 'organizations', ['abbreviation'], unique=False)
op.create_table('ah_runtime_configs',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('alias', sa.String(length=2), nullable=True),
sa.Column('ah_bot_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['ah_bot_id'], ['ah_bots.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('ah_startup_configs',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('ah_bot_id', sa.Integer(), nullable=True),
sa.Column('enabled', sa.Boolean(), nullable=True),
sa.Column('module', sa.String(length=255), nullable=True),
sa.Column('state', sa.Boolean(), nullable=True),
sa.Column('pid', sa.Integer(), nullable=True),
sa.Column('started', sa.DateTime(), nullable=True),
sa.Column('stopped', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['ah_bot_id'], ['ah_bots.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('asn',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('organization_id', sa.Integer(), nullable=True),
sa.Column('asn', sa.Integer(), nullable=True),
sa.Column('as_name', sa.String(length=255), nullable=True),
sa.Column('deleted', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['organization_id'], ['organizations.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('contactemails_organizations',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('email_id', sa.Integer(), nullable=False),
sa.Column('organization_id', sa.Integer(), nullable=False),
sa.Column('cp_access', sa.Boolean(), nullable=True),
sa.Column('fmb', sa.Boolean(), nullable=True),
sa.ForeignKeyConstraint(['email_id'], ['emails.id'], ),
sa.ForeignKeyConstraint(['organization_id'], ['organizations.id'], ),
sa.PrimaryKeyConstraint('id', 'email_id', 'organization_id')
)
op.create_table('contacts',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('organization_id', sa.Integer(), nullable=True),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('position', sa.String(length=255), nullable=False),
sa.Column('email', sa.String(length=255), nullable=False),
sa.Column('deleted', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['organization_id'], ['organizations.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('emails_organizations',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('email_id', sa.Integer(), nullable=True),
sa.Column('organization_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['email_id'], ['emails.id'], ),
sa.ForeignKeyConstraint(['organization_id'], ['organizations.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('fqdns',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('organization_id', sa.Integer(), nullable=True),
sa.Column('fqdn', sa.String(length=255), nullable=True),
sa.Column('deleted', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['organization_id'], ['organizations.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('ip_ranges',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('organization_id', sa.Integer(), nullable=True),
sa.Column('ip_range', sa.String(length=255), nullable=True),
sa.Column('deleted', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['organization_id'], ['organizations.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('users',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('role_id', sa.Integer(), nullable=True),
sa.Column('organization_id', sa.Integer(), nullable=True),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('password', sa.String(length=255), nullable=False),
sa.Column('email', sa.String(length=255), nullable=True),
sa.Column('api_key', sa.String(length=64), nullable=True),
sa.Column('is_admin', sa.Boolean(), nullable=True),
sa.Column('deleted', sa.Integer(), nullable=True),
sa.Column('otp_secret', sa.String(length=16), nullable=True),
sa.Column('otp_enabled', sa.Boolean(), nullable=False),
sa.ForeignKeyConstraint(['organization_id'], ['organizations.id'], ),
sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('email')
)
op.create_table('ah_runtime_config_params',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('ah_runtime_config_id', sa.Integer(), nullable=True),
sa.Column('key', sa.String(length=100), nullable=False),
sa.Column('value', sa.String(length=100), nullable=False),
sa.ForeignKeyConstraint(['ah_runtime_config_id'], ['ah_runtime_configs.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('ah_startup_config_params',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('ah_startup_config_id', sa.Integer(), nullable=True),
sa.Column('key', sa.String(length=100), nullable=False),
sa.Column('value', sa.String(length=100), nullable=False),
sa.ForeignKeyConstraint(['ah_startup_config_id'], ['ah_startup_configs.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('fqdns_typosquats',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('fqdn_id', sa.Integer(), nullable=True),
sa.Column('fqdn', sa.String(length=255), nullable=True),
sa.Column('dns_a', sa.String(length=255), nullable=True),
sa.Column('dns_ns', sa.String(length=255), nullable=True),
sa.Column('dns_mx', sa.String(length=255), nullable=True),
sa.Column('raw', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['fqdn_id'], ['fqdns.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('samples',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('parent_id', sa.Integer(), nullable=True),
sa.Column('filename', sa.Text(), nullable=False),
sa.Column('md5', sa.String(length=32), nullable=False),
sa.Column('sha1', sa.String(length=40), nullable=False),
sa.Column('sha256', sa.String(length=64), nullable=False),
sa.Column('sha512', sa.String(length=128), nullable=False),
sa.Column('ctph', sa.Text(), nullable=False),
sa.Column('infected', sa.Integer(), nullable=True),
sa.Column('deleted', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['parent_id'], ['samples.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='fk_sample_user_id'),
sa.PrimaryKeyConstraint('id')
)
op.create_table('vulnerabilities',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('organization_id', sa.Integer(), nullable=True),
sa.Column('incident_id', sa.Integer(), nullable=True),
sa.Column('check_string', sa.Text(), nullable=True),
sa.Column('reporter_name', sa.String(length=255), nullable=True),
sa.Column('reporter_email', sa.String(length=255), nullable=True),
sa.Column('url', sa.Text(), nullable=True),
sa.Column('request_method', sa.Enum('GET', 'POST', 'PUT', name='httpverb'), nullable=True),
sa.Column('request_data', sa.Text(), nullable=True),
sa.Column('request_response_code', sa.Integer(), nullable=True),
sa.Column('tested', sa.DateTime(), nullable=True),
sa.Column('reported', sa.DateTime(), nullable=True),
sa.Column('patched', sa.DateTime(), nullable=True),
sa.Column('published', sa.Boolean(), nullable=True),
sa.Column('scanable', sa.Boolean(), nullable=True),
sa.Column('notes', sa.Text(), nullable=True),
sa.Column('deleted', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['organization_id'], ['organizations.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('reports',
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('type_id', sa.Integer(), nullable=True),
sa.Column('sample_id', sa.Integer(), nullable=True),
sa.Column('report', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['sample_id'], ['samples.id'], ),
sa.ForeignKeyConstraint(['type_id'], ['report_types.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('tags_vulnerabilities',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('tag_id', sa.Integer(), nullable=True),
sa.Column('vulnerability_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['tag_id'], ['tags.id'], ),
sa.ForeignKeyConstraint(['vulnerability_id'], ['vulnerabilities.id'], ),
sa.PrimaryKeyConstraint('id')
)
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_table('tags_vulnerabilities')
op.drop_table('reports')
op.drop_table('vulnerabilities')
op.drop_table('samples')
op.drop_table('fqdns_typosquats')
op.drop_table('ah_startup_config_params')
op.drop_table('ah_runtime_config_params')
op.drop_table('users')
op.drop_table('ip_ranges')
op.drop_table('fqdns')
op.drop_table('emails_organizations')
op.drop_table('contacts')
op.drop_table('contactemails_organizations')
op.drop_table('asn')
op.drop_table('ah_startup_configs')
op.drop_table('ah_runtime_configs')
op.drop_index(op.f('ix_organizations_abbreviation'), table_name='organizations')
op.drop_table('organizations')
op.drop_table('deliverable_files')
op.drop_table('ah_bots')
op.drop_table('tasks_taskmeta')
op.drop_table('tasks_groupmeta')
op.drop_table('tags')
op.drop_index(op.f('ix_roles_default'), table_name='roles')
op.drop_table('roles')
op.drop_table('report_types')
op.drop_table('organization_groups')
op.drop_table('emails')
op.drop_table('deliverables')
op.drop_table('ah_bot_types')
### end Alembic commands ###
| 46.975806
| 107
| 0.671416
| 2,220
| 17,475
| 5.18018
| 0.083333
| 0.13913
| 0.183826
| 0.22087
| 0.816087
| 0.778174
| 0.71487
| 0.659304
| 0.59113
| 0.558261
| 0
| 0.010668
| 0.131044
| 17,475
| 371
| 108
| 47.102426
| 0.746658
| 0.016195
| 0
| 0.464589
| 0
| 0
| 0.180255
| 0.019523
| 0
| 0
| 0
| 0
| 0
| 1
| 0.005666
| false
| 0.002833
| 0.005666
| 0
| 0.011331
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
c08625e0c96a03b06786f80818b3dfdc5946b534
| 2,155
|
py
|
Python
|
test/operator/test_count_window.py
|
laysakura/shellstreaming
|
a1e34af507b94d51ba588ad4a039ce0115b46475
|
[
"Apache-2.0"
] | 1
|
2015-10-04T10:03:27.000Z
|
2015-10-04T10:03:27.000Z
|
test/operator/test_count_window.py
|
laysakura/shellstreaming
|
a1e34af507b94d51ba588ad4a039ce0115b46475
|
[
"Apache-2.0"
] | null | null | null |
test/operator/test_count_window.py
|
laysakura/shellstreaming
|
a1e34af507b94d51ba588ad4a039ce0115b46475
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
import nose.tools as ns
from relshell.batch import Batch
from relshell.recorddef import RecordDef
from relshell.record import Record
from shellstreaming.core.batch_queue import BatchQueue
from shellstreaming.operator.count_window import CountWindow
RDEF = RecordDef([{'name': 'col0', 'type': 'INT'}])
def _create_test_batch():
return Batch(RDEF, (Record(1), Record(2), Record(3)))
def test_count_window_usage():
# prepare input/output queue
in_q, out_q = (BatchQueue(), BatchQueue())
in_q.push(_create_test_batch())
in_q.push(None)
win = CountWindow(size=2, input_queues={'a': in_q}, output_queues={'b': out_q})
win.join()
ns.eq_(out_q.pop(), Batch(RDEF, ( Record(1),)))
ns.eq_(out_q.pop(), Batch(RDEF, (Record(1), Record(2))))
ns.eq_(out_q.pop(), Batch(RDEF, (Record(2), Record(3))))
ns.ok_(out_q.pop() is None)
def test_multiple_batch_input():
# prepare input/output queue
in_q, out_q = (BatchQueue(), BatchQueue())
in_q.push(_create_test_batch())
in_q.push(_create_test_batch())
in_q.push(None)
win = CountWindow(size=2, input_queues={'a': in_q}, output_queues={'b': out_q})
win.join()
ns.eq_(out_q.pop(), Batch(RDEF, ( Record(1),)))
ns.eq_(out_q.pop(), Batch(RDEF, (Record(1), Record(2))))
ns.eq_(out_q.pop(), Batch(RDEF, (Record(2), Record(3))))
ns.eq_(out_q.pop(), Batch(RDEF, (Record(3), Record(1))))
ns.eq_(out_q.pop(), Batch(RDEF, (Record(1), Record(2))))
ns.eq_(out_q.pop(), Batch(RDEF, (Record(2), Record(3))))
ns.ok_(out_q.pop() is None)
def test_slide_size():
# prepare input/output queue
in_q, out_q = (BatchQueue(), BatchQueue())
in_q.push(_create_test_batch())
in_q.push(_create_test_batch())
in_q.push(None)
win = CountWindow(size=2, slide_size=2,
input_queues={'a': in_q}, output_queues={'b': out_q})
win.join()
ns.eq_(out_q.pop(), Batch(RDEF, (Record(1), Record(2))))
ns.eq_(out_q.pop(), Batch(RDEF, (Record(3), Record(1))))
ns.eq_(out_q.pop(), Batch(RDEF, (Record(2), Record(3))))
ns.ok_(out_q.pop() is None)
| 32.651515
| 83
| 0.639443
| 342
| 2,155
| 3.780702
| 0.157895
| 0.064965
| 0.081207
| 0.074246
| 0.737819
| 0.737819
| 0.720031
| 0.720031
| 0.720031
| 0.720031
| 0
| 0.017338
| 0.170302
| 2,155
| 65
| 84
| 33.153846
| 0.705817
| 0.047332
| 0
| 0.688889
| 0
| 0
| 0.010254
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.088889
| false
| 0
| 0.133333
| 0.022222
| 0.244444
| 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
|
c09f0a5a254ddc0f0de8457f4dee30a99db45d6e
| 103
|
py
|
Python
|
easy_deco/__init__.py
|
crivero7/easy-deco
|
76fe838bd3d799de48faf4a71d6c93ad0ac4dafa
|
[
"MIT"
] | null | null | null |
easy_deco/__init__.py
|
crivero7/easy-deco
|
76fe838bd3d799de48faf4a71d6c93ad0ac4dafa
|
[
"MIT"
] | null | null | null |
easy_deco/__init__.py
|
crivero7/easy-deco
|
76fe838bd3d799de48faf4a71d6c93ad0ac4dafa
|
[
"MIT"
] | null | null | null |
from .progress_bar import progress_bar
from .core import decorator
from .raise_error import raise_error
| 34.333333
| 38
| 0.864078
| 16
| 103
| 5.3125
| 0.5
| 0.258824
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.106796
| 103
| 3
| 39
| 34.333333
| 0.923913
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
c09fdee1ee73d8faa7a3ad87f41d3ca07de9ec05
| 99
|
py
|
Python
|
rustplus/api/remote/__init__.py
|
nesttle/rustplus
|
0149a7126672abe6917b21c6209bdefbe7fcc346
|
[
"MIT"
] | null | null | null |
rustplus/api/remote/__init__.py
|
nesttle/rustplus
|
0149a7126672abe6917b21c6209bdefbe7fcc346
|
[
"MIT"
] | null | null | null |
rustplus/api/remote/__init__.py
|
nesttle/rustplus
|
0149a7126672abe6917b21c6209bdefbe7fcc346
|
[
"MIT"
] | null | null | null |
from .rustplus_pb2 import *
from .rustws import RustWsClient
from .token_bucket import RateLimiter
| 24.75
| 37
| 0.838384
| 13
| 99
| 6.230769
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011494
| 0.121212
| 99
| 3
| 38
| 33
| 0.91954
| 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
|
c0aa385d29412058a69a919060d9ba1f07bb2a8d
| 64
|
py
|
Python
|
dtsdb/__init__.py
|
fyhuang/archive_box
|
1cbbd839012fed5e12341b78027d132c72dd01df
|
[
"BSD-3-Clause"
] | null | null | null |
dtsdb/__init__.py
|
fyhuang/archive_box
|
1cbbd839012fed5e12341b78027d132c72dd01df
|
[
"BSD-3-Clause"
] | null | null | null |
dtsdb/__init__.py
|
fyhuang/archive_box
|
1cbbd839012fed5e12341b78027d132c72dd01df
|
[
"BSD-3-Clause"
] | null | null | null |
from .protodb import ProtoTable
from .synced_db import SyncedDb
| 21.333333
| 31
| 0.84375
| 9
| 64
| 5.888889
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125
| 64
| 2
| 32
| 32
| 0.946429
| 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
|
c0b64a1b2529b7cfb63811ba8522715155ffdd87
| 348
|
py
|
Python
|
api_demo/controllers/PropertyController.py
|
iafrohack/python_rest
|
4ce05163cf29e717171537451111d9f780126abb
|
[
"MIT"
] | null | null | null |
api_demo/controllers/PropertyController.py
|
iafrohack/python_rest
|
4ce05163cf29e717171537451111d9f780126abb
|
[
"MIT"
] | null | null | null |
api_demo/controllers/PropertyController.py
|
iafrohack/python_rest
|
4ce05163cf29e717171537451111d9f780126abb
|
[
"MIT"
] | null | null | null |
from services.interfaces.PropertyServiceInterface import PropertyServiceInterface
class PropertyController(object):
def __init__(self,
propertyService: PropertyServiceInterface):
self._propertyService = propertyService
def show(self, property_id):
return self._propertyService.get_property(property_id)
| 29
| 81
| 0.761494
| 29
| 348
| 8.827586
| 0.586207
| 0.222656
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181034
| 348
| 11
| 82
| 31.636364
| 0.898246
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0
| 0.142857
| 0.142857
| 0.714286
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
23c61f4550003c3d904ad9695cdeff6b15c6107c
| 313
|
py
|
Python
|
improved_permissions/exceptions.py
|
gabrielbiasi/django-improved-permissions
|
9cf6d0ddb8a4dcfa2e58d3adbf1357e56a64ce71
|
[
"MIT"
] | 12
|
2018-03-22T00:30:32.000Z
|
2021-04-24T16:26:08.000Z
|
improved_permissions/exceptions.py
|
s-sys/django-improved-permissions
|
9cf6d0ddb8a4dcfa2e58d3adbf1357e56a64ce71
|
[
"MIT"
] | 27
|
2018-03-18T00:43:37.000Z
|
2020-06-05T18:09:18.000Z
|
improved_permissions/exceptions.py
|
gabrielbiasi/django-improved-permissions
|
9cf6d0ddb8a4dcfa2e58d3adbf1357e56a64ce71
|
[
"MIT"
] | 2
|
2018-03-28T17:54:43.000Z
|
2021-01-11T21:17:08.000Z
|
"""permissions exceptions"""
class ImproperlyConfigured(Exception):
pass
class ParentNotFound(Exception):
pass
class RoleNotFound(Exception):
pass
class InvalidRoleAssignment(Exception):
pass
class InvalidPermissionAssignment(Exception):
pass
class NotAllowed(Exception):
pass
| 12.038462
| 45
| 0.744409
| 26
| 313
| 8.961538
| 0.423077
| 0.334764
| 0.386266
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.178914
| 313
| 25
| 46
| 12.52
| 0.906615
| 0.070288
| 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
|
23fb5e961f4da55c6ad36ba70f0800bce68e813e
| 25
|
py
|
Python
|
syft/version.py
|
iansee/FYP
|
5b35621ec137c9a0e4b6fc73b6d5b1c169e327e7
|
[
"Apache-2.0"
] | 1
|
2019-08-08T08:55:25.000Z
|
2019-08-08T08:55:25.000Z
|
syft/version.py
|
mukira/PySyft
|
94595008e8326d3111406ae143099b311fc3f2e6
|
[
"Apache-2.0"
] | null | null | null |
syft/version.py
|
mukira/PySyft
|
94595008e8326d3111406ae143099b311fc3f2e6
|
[
"Apache-2.0"
] | 1
|
2019-08-08T08:55:57.000Z
|
2019-08-08T08:55:57.000Z
|
__version__ = "0.1.22a1"
| 12.5
| 24
| 0.68
| 4
| 25
| 3.25
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.227273
| 0.12
| 25
| 1
| 25
| 25
| 0.363636
| 0
| 0
| 0
| 0
| 0
| 0.32
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.