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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b6467407f1b228f51182d97c74853c2be6eb8393 | 22 | py | Python | aliyun-python-sdk-imm/aliyunsdkimm/__init__.py | yndu13/aliyun-openapi-python-sdk | 12ace4fb39fe2fb0e3927a4b1b43ee4872da43f5 | [
"Apache-2.0"
] | null | null | null | aliyun-python-sdk-imm/aliyunsdkimm/__init__.py | yndu13/aliyun-openapi-python-sdk | 12ace4fb39fe2fb0e3927a4b1b43ee4872da43f5 | [
"Apache-2.0"
] | null | null | null | aliyun-python-sdk-imm/aliyunsdkimm/__init__.py | yndu13/aliyun-openapi-python-sdk | 12ace4fb39fe2fb0e3927a4b1b43ee4872da43f5 | [
"Apache-2.0"
] | null | null | null | __version__ = '1.23.7' | 22 | 22 | 0.681818 | 4 | 22 | 2.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 0.090909 | 22 | 1 | 22 | 22 | 0.35 | 0 | 0 | 0 | 0 | 0 | 0.26087 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
b65e264cc618a4a06bfbad5eb8424957fe86e7f7 | 451 | py | Python | day01/t01/views.py | kai1218/Django | 4ed6646fe1724c524510fe8ec2dea30a1ff0a5fe | [
"Apache-2.0"
] | null | null | null | day01/t01/views.py | kai1218/Django | 4ed6646fe1724c524510fe8ec2dea30a1ff0a5fe | [
"Apache-2.0"
] | null | null | null | day01/t01/views.py | kai1218/Django | 4ed6646fe1724c524510fe8ec2dea30a1ff0a5fe | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.http import HttpResponse
from django.shortcuts import render
from .models import Engineer
# Create your views here.
def index(request):
return HttpResponse("<h1>Django hahah</h1>")
def my_html(req):
return render(req,"my_index.html")
def get_data(req):
data = Engineer.objects.all()
print(data)
return render(req,"my_index.html",context={"my_data":data}) | 30.066667 | 63 | 0.731707 | 65 | 451 | 4.923077 | 0.523077 | 0.0625 | 0.09375 | 0.10625 | 0.1625 | 0.1625 | 0 | 0 | 0 | 0 | 0 | 0.007732 | 0.13969 | 451 | 15 | 63 | 30.066667 | 0.81701 | 0.099778 | 0 | 0 | 0 | 0 | 0.133663 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.333333 | 0.166667 | 0.833333 | 0.083333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 4 |
b665249cb123334f8a76d511d531eebb7783854f | 123 | py | Python | plotter/plotter.py | briehanrahan/subdiver | 92373f29dac2342e8a7e716a2966ce394f18fd1b | [
"CC0-1.0"
] | null | null | null | plotter/plotter.py | briehanrahan/subdiver | 92373f29dac2342e8a7e716a2966ce394f18fd1b | [
"CC0-1.0"
] | null | null | null | plotter/plotter.py | briehanrahan/subdiver | 92373f29dac2342e8a7e716a2966ce394f18fd1b | [
"CC0-1.0"
] | null | null | null | import ingestor.ingestor
collected_posts = ingestor.collect_posts('NeutralPolitics', 1000)
print(collected_posts.head())
| 20.5 | 65 | 0.821138 | 14 | 123 | 7 | 0.642857 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035088 | 0.073171 | 123 | 5 | 66 | 24.6 | 0.824561 | 0 | 0 | 0 | 0 | 0 | 0.122951 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
b680d2bc5c6b328e95f71f3a1fdb9c3c594619a7 | 156 | py | Python | lang/py/cookbook/v2/source/cb2_4_10_sol_2.py | ch1huizong/learning | 632267634a9fd84a5f5116de09ff1e2681a6cc85 | [
"MIT"
] | null | null | null | lang/py/cookbook/v2/source/cb2_4_10_sol_2.py | ch1huizong/learning | 632267634a9fd84a5f5116de09ff1e2681a6cc85 | [
"MIT"
] | null | null | null | lang/py/cookbook/v2/source/cb2_4_10_sol_2.py | ch1huizong/learning | 632267634a9fd84a5f5116de09ff1e2681a6cc85 | [
"MIT"
] | null | null | null | def addword(theIndex, word, pagenumber):
if word in theIndex:
theIndex[word].append(pagenumber)
else:
theIndex[word] = [pagenumber]
| 26 | 41 | 0.653846 | 17 | 156 | 6 | 0.529412 | 0.352941 | 0.431373 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.237179 | 156 | 5 | 42 | 31.2 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
b688e6a9b4224b83fcdf7c3cff7d43340d8ad5b5 | 52,425 | py | Python | heat/tests/engine/test_scheduler.py | noironetworks/heat | 7cdadf1155f4d94cf8f967635b98e4012a7acfb7 | [
"Apache-2.0"
] | 1 | 2018-07-04T07:59:26.000Z | 2018-07-04T07:59:26.000Z | heat/tests/engine/test_scheduler.py | noironetworks/heat | 7cdadf1155f4d94cf8f967635b98e4012a7acfb7 | [
"Apache-2.0"
] | 5 | 2019-08-14T06:46:03.000Z | 2021-12-13T20:01:25.000Z | heat/tests/engine/test_scheduler.py | noironetworks/heat | 7cdadf1155f4d94cf8f967635b98e4012a7acfb7 | [
"Apache-2.0"
] | 2 | 2020-03-15T01:24:15.000Z | 2020-07-22T20:34:26.000Z | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import contextlib
import itertools
import eventlet
import mock
import six
from heat.common.i18n import repr_wrapper
from heat.common import timeutils
from heat.engine import dependencies
from heat.engine import scheduler
from heat.tests import common
class DummyTask(object):
def __init__(self, num_steps=3, delays=None):
self.num_steps = num_steps
if delays is not None:
self.delays = iter(delays)
else:
self.delays = itertools.repeat(None)
def __call__(self, *args, **kwargs):
for i in range(1, self.num_steps + 1):
self.do_step(i, *args, **kwargs)
yield next(self.delays)
def do_step(self, step_num, *args, **kwargs):
pass
class ExceptionGroupTest(common.HeatTestCase):
def test_contains_exceptions(self):
exception_group = scheduler.ExceptionGroup()
self.assertIsInstance(exception_group.exceptions, list)
def test_can_be_initialized_with_a_list_of_exceptions(self):
ex1 = Exception("ex 1")
ex2 = Exception("ex 2")
exception_group = scheduler.ExceptionGroup([ex1, ex2])
self.assertIn(ex1, exception_group.exceptions)
self.assertIn(ex2, exception_group.exceptions)
def test_can_add_exceptions_after_init(self):
ex = Exception()
exception_group = scheduler.ExceptionGroup()
exception_group.exceptions.append(ex)
self.assertIn(ex, exception_group.exceptions)
def test_str_representation_aggregates_all_exceptions(self):
ex1 = Exception("ex 1")
ex2 = Exception("ex 2")
exception_group = scheduler.ExceptionGroup([ex1, ex2])
self.assertEqual("['ex 1', 'ex 2']", six.text_type(exception_group))
class StepTracker(object):
def __init__(self):
self.expected_groups = []
self.side_effects = {}
def expect_call_group(self, step_num, targets):
self.expected_groups.append(set((step_num, t) for t in targets))
def expect_call(self, step_num, target):
self.expect_call_group(step_num, (target,))
def raise_on(self, step_num, target, exc):
self.side_effects[(step_num, target)] = exc
def sleep_on(self, step_num, target, sleep_time):
self.side_effects[(step_num, target)] = float(sleep_time)
def side_effect(self, step_num, target):
se = self.side_effects.get((step_num, target), None)
if isinstance(se, BaseException):
raise se
if isinstance(se, float):
eventlet.sleep(se)
def verify_calls(self, mock_step):
actual_calls = mock_step.mock_calls
CallList = type(actual_calls)
idx = 0
try:
for group in self.expected_groups:
group_len = len(group)
group_actual = CallList(actual_calls[idx:idx + group_len])
idx += group_len
mock_step.mock_calls = group_actual
mock_step.assert_has_calls(
[mock.call(s, t) for s, t in group],
any_order=True)
finally:
mock_step.actual_calls = actual_calls
if len(actual_calls) > idx:
raise AssertionError("Unexpected calls: %s" %
CallList(actual_calls[idx:]))
class DependencyTaskGroupTest(common.HeatTestCase):
def setUp(self):
super(DependencyTaskGroupTest, self).setUp()
self.aggregate_exceptions = False
self.error_wait_time = None
self.reverse_order = False
@contextlib.contextmanager
def _dep_test(self, *edges):
dummy = DummyTask(getattr(self, 'steps', 3))
deps = dependencies.Dependencies(edges)
tg = scheduler.DependencyTaskGroup(
deps, dummy, reverse=self.reverse_order,
error_wait_time=self.error_wait_time,
aggregate_exceptions=self.aggregate_exceptions)
tracker = StepTracker()
yield tracker
dummy.do_step = mock.Mock(side_effect=tracker.side_effect)
scheduler.TaskRunner(tg)(wait_time=None)
tracker.verify_calls(dummy.do_step)
def test_test(self):
def failing_test():
with self._dep_test(('only', None)) as track:
track.expect_call(1, 'only')
track.expect_call(3, 'only')
self.assertRaises(AssertionError, failing_test)
@mock.patch.object(scheduler.TaskRunner, '_sleep')
def test_no_steps(self, mock_sleep):
self.steps = 0
with self._dep_test(('second', 'first')):
pass
def test_single_node(self):
with self._dep_test(('only', None)) as track:
track.expect_call(1, 'only')
track.expect_call(2, 'only')
track.expect_call(3, 'only')
def test_disjoint(self):
with self._dep_test(('1', None), ('2', None)) as track:
track.expect_call_group(1, ('1', '2'))
track.expect_call_group(2, ('1', '2'))
track.expect_call_group(3, ('1', '2'))
def test_single_fwd(self):
with self._dep_test(('second', 'first')) as track:
track.expect_call(1, 'first')
track.expect_call(2, 'first')
track.expect_call(3, 'first')
track.expect_call(1, 'second')
track.expect_call(2, 'second')
track.expect_call(3, 'second')
def test_chain_fwd(self):
with self._dep_test(('third', 'second'),
('second', 'first')) as track:
track.expect_call(1, 'first')
track.expect_call(2, 'first')
track.expect_call(3, 'first')
track.expect_call(1, 'second')
track.expect_call(2, 'second')
track.expect_call(3, 'second')
track.expect_call(1, 'third')
track.expect_call(2, 'third')
track.expect_call(3, 'third')
def test_diamond_fwd(self):
with self._dep_test(('last', 'mid1'), ('last', 'mid2'),
('mid1', 'first'), ('mid2', 'first')) as track:
track.expect_call(1, 'first')
track.expect_call(2, 'first')
track.expect_call(3, 'first')
track.expect_call_group(1, ('mid1', 'mid2'))
track.expect_call_group(2, ('mid1', 'mid2'))
track.expect_call_group(3, ('mid1', 'mid2'))
track.expect_call(1, 'last')
track.expect_call(2, 'last')
track.expect_call(3, 'last')
def test_complex_fwd(self):
with self._dep_test(('last', 'mid1'), ('last', 'mid2'),
('mid1', 'mid3'), ('mid1', 'first'),
('mid3', 'first'), ('mid2', 'first')) as track:
track.expect_call(1, 'first')
track.expect_call(2, 'first')
track.expect_call(3, 'first')
track.expect_call_group(1, ('mid2', 'mid3'))
track.expect_call_group(2, ('mid2', 'mid3'))
track.expect_call_group(3, ('mid2', 'mid3'))
track.expect_call(1, 'mid1')
track.expect_call(2, 'mid1')
track.expect_call(3, 'mid1')
track.expect_call(1, 'last')
track.expect_call(2, 'last')
track.expect_call(3, 'last')
def test_many_edges_fwd(self):
with self._dep_test(('last', 'e1'), ('last', 'mid1'), ('last', 'mid2'),
('mid1', 'e2'), ('mid1', 'mid3'),
('mid2', 'mid3'),
('mid3', 'e3')) as track:
track.expect_call_group(1, ('e1', 'e2', 'e3'))
track.expect_call_group(2, ('e1', 'e2', 'e3'))
track.expect_call_group(3, ('e1', 'e2', 'e3'))
track.expect_call(1, 'mid3')
track.expect_call(2, 'mid3')
track.expect_call(3, 'mid3')
track.expect_call_group(1, ('mid2', 'mid1'))
track.expect_call_group(2, ('mid2', 'mid1'))
track.expect_call_group(3, ('mid2', 'mid1'))
track.expect_call(1, 'last')
track.expect_call(2, 'last')
track.expect_call(3, 'last')
def test_dbldiamond_fwd(self):
with self._dep_test(('last', 'a1'), ('last', 'a2'),
('a1', 'b1'), ('a2', 'b1'), ('a2', 'b2'),
('b1', 'first'), ('b2', 'first')) as track:
track.expect_call(1, 'first')
track.expect_call(2, 'first')
track.expect_call(3, 'first')
track.expect_call_group(1, ('b1', 'b2'))
track.expect_call_group(2, ('b1', 'b2'))
track.expect_call_group(3, ('b1', 'b2'))
track.expect_call_group(1, ('a1', 'a2'))
track.expect_call_group(2, ('a1', 'a2'))
track.expect_call_group(3, ('a1', 'a2'))
track.expect_call(1, 'last')
track.expect_call(2, 'last')
track.expect_call(3, 'last')
def test_circular_deps(self):
d = dependencies.Dependencies([('first', 'second'),
('second', 'third'),
('third', 'first')])
self.assertRaises(dependencies.CircularDependencyException,
scheduler.DependencyTaskGroup, d)
def test_aggregate_exceptions_raises_all_at_the_end(self):
def run_tasks_with_exceptions(e1=None, e2=None):
self.aggregate_exceptions = True
tasks = (('A', None), ('B', None), ('C', None))
with self._dep_test(*tasks) as track:
track.expect_call_group(1, ('A', 'B', 'C'))
track.raise_on(1, 'C', e1)
track.expect_call_group(2, ('A', 'B'))
track.raise_on(2, 'B', e2)
track.expect_call(3, 'A')
e1 = Exception('e1')
e2 = Exception('e2')
exc = self.assertRaises(scheduler.ExceptionGroup,
run_tasks_with_exceptions, e1, e2)
self.assertEqual(set([e1, e2]), set(exc.exceptions))
def test_aggregate_exceptions_cancels_dependent_tasks_recursively(self):
def run_tasks_with_exceptions(e1=None, e2=None):
self.aggregate_exceptions = True
tasks = (('A', None), ('B', 'A'), ('C', 'B'))
with self._dep_test(*tasks) as track:
track.expect_call(1, 'A')
track.raise_on(1, 'A', e1)
e1 = Exception('e1')
exc = self.assertRaises(scheduler.ExceptionGroup,
run_tasks_with_exceptions, e1)
self.assertEqual([e1], exc.exceptions)
def test_aggregate_exceptions_cancels_tasks_in_reverse_order(self):
def run_tasks_with_exceptions(e1=None, e2=None):
self.reverse_order = True
self.aggregate_exceptions = True
tasks = (('A', None), ('B', 'A'), ('C', 'B'))
with self._dep_test(*tasks) as track:
track.expect_call(1, 'C')
track.raise_on(1, 'C', e1)
e1 = Exception('e1')
exc = self.assertRaises(scheduler.ExceptionGroup,
run_tasks_with_exceptions, e1)
self.assertEqual([e1], exc.exceptions)
def test_exceptions_on_cancel(self):
class TestException(Exception):
pass
class ExceptionOnExit(Exception):
pass
cancelled = []
def task_func(arg):
for i in range(4):
if i > 1:
raise TestException
try:
yield
except GeneratorExit:
cancelled.append(arg)
raise ExceptionOnExit
tasks = (('A', None), ('B', None), ('C', None))
deps = dependencies.Dependencies(tasks)
tg = scheduler.DependencyTaskGroup(deps, task_func)
task = tg()
next(task)
next(task)
self.assertRaises(TestException, next, task)
self.assertEqual(len(tasks) - 1, len(cancelled))
def test_exception_grace_period(self):
e1 = Exception('e1')
def run_tasks_with_exceptions():
self.error_wait_time = 5
tasks = (('A', None), ('B', None), ('C', 'A'))
with self._dep_test(*tasks) as track:
track.expect_call_group(1, ('A', 'B'))
track.expect_call_group(2, ('A', 'B'))
track.raise_on(2, 'B', e1)
track.expect_call(3, 'B')
exc = self.assertRaises(type(e1), run_tasks_with_exceptions)
self.assertEqual(e1, exc)
def test_exception_grace_period_expired(self):
e1 = Exception('e1')
def run_tasks_with_exceptions():
self.steps = 5
self.error_wait_time = 0.05
def sleep():
eventlet.sleep(self.error_wait_time)
tasks = (('A', None), ('B', None), ('C', 'A'))
with self._dep_test(*tasks) as track:
track.expect_call_group(1, ('A', 'B'))
track.expect_call_group(2, ('A', 'B'))
track.raise_on(2, 'B', e1)
track.expect_call(3, 'B')
track.expect_call(4, 'B')
track.sleep_on(4, 'B', self.error_wait_time)
exc = self.assertRaises(type(e1), run_tasks_with_exceptions)
self.assertEqual(e1, exc)
def test_exception_grace_period_per_task(self):
e1 = Exception('e1')
def get_wait_time(key):
if key == 'B':
return 5
else:
return None
def run_tasks_with_exceptions():
self.error_wait_time = get_wait_time
tasks = (('A', None), ('B', None), ('C', 'A'))
with self._dep_test(*tasks) as track:
track.expect_call_group(1, ('A', 'B'))
track.expect_call_group(2, ('A', 'B'))
track.raise_on(2, 'A', e1)
track.expect_call(3, 'B')
exc = self.assertRaises(type(e1), run_tasks_with_exceptions)
self.assertEqual(e1, exc)
def test_thrown_exception_order(self):
e1 = Exception('e1')
e2 = Exception('e2')
tasks = (('A', None), ('B', None), ('C', 'A'))
deps = dependencies.Dependencies(tasks)
tg = scheduler.DependencyTaskGroup(
deps, DummyTask(), reverse=self.reverse_order,
error_wait_time=1,
aggregate_exceptions=self.aggregate_exceptions)
task = tg()
next(task)
task.throw(e1)
next(task)
tg.error_wait_time = None
exc = self.assertRaises(type(e2), task.throw, e2)
self.assertIs(e2, exc)
class TaskTest(common.HeatTestCase):
def setUp(self):
super(TaskTest, self).setUp()
scheduler.ENABLE_SLEEP = True
self.mock_sleep = self.patchobject(scheduler.TaskRunner, '_sleep',
return_value=None)
def test_run(self):
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
scheduler.TaskRunner(task)()
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3)])
self.assertEqual(3, task.do_step.call_count)
self.assertEqual(3, self.mock_sleep.call_count)
def test_run_as_task(self):
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
tr = scheduler.TaskRunner(task)
rt = tr.as_task()
for step in rt:
pass
self.assertTrue(tr.done())
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3)])
self.assertEqual(3, task.do_step.call_count)
self.mock_sleep.assert_not_called()
def test_run_as_task_started(self):
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
tr = scheduler.TaskRunner(task)
tr.start()
for step in tr.as_task():
pass
self.assertTrue(tr.done())
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3)])
self.assertEqual(3, task.do_step.call_count)
self.mock_sleep.assert_not_called()
def test_run_as_task_cancel(self):
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
tr = scheduler.TaskRunner(task)
rt = tr.as_task()
next(rt)
rt.close()
self.assertTrue(tr.done())
task.do_step.assert_called_once_with(1)
self.mock_sleep.assert_not_called()
def test_run_as_task_exception(self):
class TestException(Exception):
pass
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
tr = scheduler.TaskRunner(task)
rt = tr.as_task()
next(rt)
self.assertRaises(TestException, rt.throw, TestException)
self.assertTrue(tr.done())
task.do_step.assert_called_once_with(1)
self.mock_sleep.assert_not_called()
def test_run_as_task_swallow_exception(self):
class TestException(Exception):
pass
def task():
try:
yield
except TestException:
yield
tr = scheduler.TaskRunner(task)
rt = tr.as_task()
next(rt)
rt.throw(TestException)
self.assertFalse(tr.done())
self.assertRaises(StopIteration, next, rt)
self.assertTrue(tr.done())
def test_run_delays(self):
task = DummyTask(delays=itertools.repeat(2))
task.do_step = mock.Mock(return_value=None)
scheduler.TaskRunner(task)()
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3)])
self.assertEqual(3, task.do_step.call_count)
self.mock_sleep.assert_has_calls([mock.call(0),
mock.call(1),
mock.call(1),
mock.call(1),
mock.call(1),
mock.call(1)])
self.assertEqual(6, self.mock_sleep.call_count)
def test_run_delays_dynamic(self):
task = DummyTask(delays=[2, 4, 1])
task.do_step = mock.Mock(return_value=None)
scheduler.TaskRunner(task)()
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3)])
self.assertEqual(3, task.do_step.call_count)
self.mock_sleep.assert_has_calls([mock.call(0),
mock.call(1),
mock.call(1),
mock.call(1),
mock.call(1),
mock.call(1),
mock.call(1)])
self.assertEqual(7, self.mock_sleep.call_count)
def test_run_wait_time(self):
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
scheduler.TaskRunner(task)(wait_time=42)
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3)])
self.assertEqual(3, task.do_step.call_count)
self.mock_sleep.assert_has_calls([mock.call(0),
mock.call(42),
mock.call(42)])
self.assertEqual(3, self.mock_sleep.call_count)
def test_start_run(self):
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
runner = scheduler.TaskRunner(task)
runner.start()
runner.run_to_completion()
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3)])
self.assertEqual(3, task.do_step.call_count)
self.mock_sleep.assert_has_calls([mock.call(1), mock.call(1)])
self.assertEqual(2, self.mock_sleep.call_count)
def test_start_run_wait_time(self):
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
runner = scheduler.TaskRunner(task)
runner.start()
runner.run_to_completion(wait_time=24)
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3)])
self.assertEqual(3, task.do_step.call_count)
self.mock_sleep.assert_has_calls([mock.call(24), mock.call(24)])
self.assertEqual(2, self.mock_sleep.call_count)
def test_run_progress(self):
progress_count = []
def progress():
progress_count.append(None)
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
scheduler.TaskRunner(task)(progress_callback=progress)
self.assertEqual(task.num_steps, len(progress_count))
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3)])
self.assertEqual(3, task.do_step.call_count)
self.mock_sleep.assert_has_calls([mock.call(0),
mock.call(1),
mock.call(1)])
self.assertEqual(3, self.mock_sleep.call_count)
def test_start_run_progress(self):
progress_count = []
def progress():
progress_count.append(None)
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
runner = scheduler.TaskRunner(task)
runner.start()
runner.run_to_completion(progress_callback=progress)
self.assertEqual(task.num_steps - 1, len(progress_count))
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3)])
self.assertEqual(3, task.do_step.call_count)
self.mock_sleep.assert_has_calls([mock.call(1), mock.call(1)])
self.assertEqual(2, self.mock_sleep.call_count)
def test_run_as_task_progress(self):
progress_count = []
def progress():
progress_count.append(None)
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
tr = scheduler.TaskRunner(task)
rt = tr.as_task(progress_callback=progress)
for step in rt:
pass
self.assertEqual(task.num_steps, len(progress_count))
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3)])
self.assertEqual(3, task.do_step.call_count)
self.mock_sleep.assert_not_called()
def test_run_progress_exception(self):
class TestException(Exception):
pass
progress_count = []
def progress():
if progress_count:
raise TestException
progress_count.append(None)
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
self.assertRaises(TestException, scheduler.TaskRunner(task),
progress_callback=progress)
self.assertEqual(1, len(progress_count))
task.do_step.assert_has_calls([mock.call(1), mock.call(2)])
self.assertEqual(2, task.do_step.call_count)
self.mock_sleep.assert_has_calls([mock.call(0), mock.call(1)])
self.assertEqual(2, self.mock_sleep.call_count)
def test_start_run_progress_exception(self):
class TestException(Exception):
pass
progress_count = []
def progress():
if progress_count:
raise TestException
progress_count.append(None)
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
runner = scheduler.TaskRunner(task)
runner.start()
self.assertRaises(TestException, runner.run_to_completion,
progress_callback=progress)
self.assertEqual(1, len(progress_count))
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3)])
self.assertEqual(3, task.do_step.call_count)
self.mock_sleep.assert_has_calls([mock.call(1), mock.call(1)])
self.assertEqual(2, self.mock_sleep.call_count)
def test_run_as_task_progress_exception(self):
class TestException(Exception):
pass
progress_count = []
def progress():
if progress_count:
raise TestException
progress_count.append(None)
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
tr = scheduler.TaskRunner(task)
rt = tr.as_task(progress_callback=progress)
next(rt)
next(rt)
self.assertRaises(TestException, next, rt)
self.assertEqual(1, len(progress_count))
task.do_step.assert_has_calls([mock.call(1), mock.call(2)])
self.assertEqual(2, task.do_step.call_count)
self.mock_sleep.assert_not_called()
def test_run_progress_exception_swallow(self):
class TestException(Exception):
pass
progress_count = []
def progress():
try:
if not progress_count:
raise TestException
finally:
progress_count.append(None)
def task():
try:
yield
except TestException:
yield
scheduler.TaskRunner(task)(progress_callback=progress)
self.assertEqual(2, len(progress_count))
self.mock_sleep.assert_has_calls([mock.call(0), mock.call(1)])
self.assertEqual(2, self.mock_sleep.call_count)
def test_start_run_progress_exception_swallow(self):
class TestException(Exception):
pass
progress_count = []
def progress():
try:
if not progress_count:
raise TestException
finally:
progress_count.append(None)
def task():
yield
try:
yield
except TestException:
yield
runner = scheduler.TaskRunner(task)
runner.start()
runner.run_to_completion(progress_callback=progress)
self.assertEqual(2, len(progress_count))
self.mock_sleep.assert_has_calls([mock.call(1), mock.call(1)])
self.assertEqual(2, self.mock_sleep.call_count)
def test_run_as_task_progress_exception_swallow(self):
class TestException(Exception):
pass
progress_count = []
def progress():
try:
if not progress_count:
raise TestException
finally:
progress_count.append(None)
def task():
try:
yield
except TestException:
yield
tr = scheduler.TaskRunner(task)
rt = tr.as_task(progress_callback=progress)
next(rt)
next(rt)
self.assertRaises(StopIteration, next, rt)
self.assertEqual(2, len(progress_count))
def test_args(self):
args = ['foo', 'bar']
kwargs = {'baz': 'quux', 'blarg': 'wibble'}
task = mock.Mock()
runner = scheduler.TaskRunner(task, *args, **kwargs)
runner(wait_time=None)
task.assert_called_with(*args, **kwargs)
def test_non_callable(self):
self.assertRaises(AssertionError, scheduler.TaskRunner, object())
def test_stepping(self):
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
runner = scheduler.TaskRunner(task)
runner.start()
self.assertFalse(runner.step())
self.assertTrue(runner)
self.assertFalse(runner.step())
self.assertTrue(runner.step())
self.assertFalse(runner)
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3)])
self.assertEqual(3, task.do_step.call_count)
self.mock_sleep.assert_not_called()
def test_start_no_steps(self):
task = DummyTask(0)
task.do_step = mock.Mock(return_value=None)
runner = scheduler.TaskRunner(task)
runner.start()
self.assertTrue(runner.done())
self.assertTrue(runner.step())
task.do_step.assert_not_called()
self.mock_sleep.assert_not_called()
def test_start_only(self):
task = DummyTask()
task.do_step = mock.Mock(return_value=None)
runner = scheduler.TaskRunner(task)
self.assertFalse(runner.started())
runner.start()
self.assertTrue(runner.started())
task.do_step.assert_called_once_with(1)
self.mock_sleep.assert_not_called()
def test_double_start(self):
runner = scheduler.TaskRunner(DummyTask())
runner.start()
self.assertRaises(AssertionError, runner.start)
def test_start_cancelled(self):
runner = scheduler.TaskRunner(DummyTask())
runner.cancel()
self.assertRaises(AssertionError, runner.start)
def test_call_double_start(self):
runner = scheduler.TaskRunner(DummyTask())
runner(wait_time=None)
self.assertRaises(AssertionError, runner.start)
def test_start_function(self):
def task():
pass
runner = scheduler.TaskRunner(task)
runner.start()
self.assertTrue(runner.started())
self.assertTrue(runner.done())
self.assertTrue(runner.step())
def test_repeated_done(self):
task = DummyTask(0)
task.do_step = mock.Mock(return_value=None)
runner = scheduler.TaskRunner(task)
runner.start()
self.assertTrue(runner.step())
self.assertTrue(runner.step())
task.do_step.assert_not_called()
self.mock_sleep.assert_not_called()
def test_timeout(self):
st = timeutils.wallclock()
def task():
while True:
yield
self.patchobject(timeutils, 'wallclock',
side_effect=[st, st + 0.5, st + 1.5])
runner = scheduler.TaskRunner(task)
runner.start(timeout=1)
self.assertTrue(runner)
self.assertRaises(scheduler.Timeout, runner.step)
self.assertEqual(3, timeutils.wallclock.call_count)
def test_timeout_return(self):
st = timeutils.wallclock()
def task():
while True:
try:
yield
except scheduler.Timeout:
return
self.patchobject(timeutils, 'wallclock',
side_effect=[st, st + 0.5, st + 1.5])
runner = scheduler.TaskRunner(task)
runner.start(timeout=1)
self.assertTrue(runner)
self.assertTrue(runner.step())
self.assertFalse(runner)
self.assertEqual(3, timeutils.wallclock.call_count)
def test_timeout_swallowed(self):
st = timeutils.wallclock()
def task():
while True:
try:
yield
except scheduler.Timeout:
yield
self.fail('Task still running')
self.patchobject(timeutils, 'wallclock',
side_effect=[st, st + 0.5, st + 1.5])
runner = scheduler.TaskRunner(task)
runner.start(timeout=1)
self.assertTrue(runner)
self.assertTrue(runner.step())
self.assertFalse(runner)
self.assertTrue(runner.step())
self.assertEqual(3, timeutils.wallclock.call_count)
def test_as_task_timeout(self):
st = timeutils.wallclock()
def task():
while True:
yield
self.patchobject(timeutils, 'wallclock',
side_effect=[st, st + 0.5, st + 1.5])
runner = scheduler.TaskRunner(task)
rt = runner.as_task(timeout=1)
next(rt)
self.assertTrue(runner)
self.assertRaises(scheduler.Timeout, next, rt)
self.assertEqual(3, timeutils.wallclock.call_count)
def test_as_task_timeout_shorter(self):
st = timeutils.wallclock()
def task():
while True:
yield
self.patchobject(timeutils, 'wallclock',
side_effect=[st, st + 0.5, st + 0.7,
st + 1.6, st + 2.6])
runner = scheduler.TaskRunner(task)
runner.start(timeout=10)
self.assertTrue(runner)
rt = runner.as_task(timeout=1)
next(rt)
self.assertRaises(scheduler.Timeout, next, rt)
self.assertEqual(5, timeutils.wallclock.call_count)
def test_as_task_timeout_longer(self):
st = timeutils.wallclock()
def task():
while True:
yield
self.patchobject(timeutils, 'wallclock',
side_effect=[st, st + 0.5, st + 0.6, st + 1.5])
runner = scheduler.TaskRunner(task)
runner.start(timeout=1)
self.assertTrue(runner)
rt = runner.as_task(timeout=10)
self.assertRaises(scheduler.Timeout, next, rt)
self.assertEqual(4, timeutils.wallclock.call_count)
def test_cancel_not_started(self):
task = DummyTask(1)
task.do_step = mock.Mock(return_value=None)
runner = scheduler.TaskRunner(task)
self.assertFalse(runner.started())
runner.cancel()
self.assertTrue(runner.done())
task.do_step.assert_not_called()
self.mock_sleep.assert_not_called()
def test_cancel_done(self):
task = DummyTask(1)
task.do_step = mock.Mock(return_value=None)
runner = scheduler.TaskRunner(task)
self.assertFalse(runner.started())
runner.start()
self.assertTrue(runner.started())
self.assertTrue(runner.step())
self.assertTrue(runner.done())
runner.cancel()
self.assertTrue(runner.done())
self.assertTrue(runner.step())
task.do_step.assert_called_once_with(1)
self.mock_sleep.assert_not_called()
def test_cancel(self):
task = DummyTask(3)
task.do_step = mock.Mock(return_value=None)
runner = scheduler.TaskRunner(task)
self.assertFalse(runner.started())
runner.start()
self.assertTrue(runner.started())
self.assertFalse(runner.step())
runner.cancel()
self.assertTrue(runner.step())
task.do_step.assert_has_calls([mock.call(1), mock.call(2)])
self.assertEqual(2, task.do_step.call_count)
self.mock_sleep.assert_not_called()
def test_cancel_grace_period(self):
st = timeutils.wallclock()
task = DummyTask(5)
task.do_step = mock.Mock(return_value=None)
self.patchobject(timeutils, 'wallclock',
side_effect=[st, st + 0.5, st + 1.0, st + 1.5])
runner = scheduler.TaskRunner(task)
self.assertFalse(runner.started())
runner.start()
self.assertTrue(runner.started())
self.assertFalse(runner.step())
runner.cancel(grace_period=1.0)
self.assertFalse(runner.step())
self.assertFalse(runner.step())
self.assertTrue(runner.step())
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3), mock.call(4)])
self.assertEqual(4, task.do_step.call_count)
self.mock_sleep.assert_not_called()
self.assertEqual(4, timeutils.wallclock.call_count)
def test_cancel_grace_period_before_timeout(self):
st = timeutils.wallclock()
task = DummyTask(5)
task.do_step = mock.Mock(return_value=None)
self.patchobject(timeutils, 'wallclock',
side_effect=[st, st + 0.1, st + 0.2, st + 0.2,
st + 0.5, st + 1.0, st + 1.5])
runner = scheduler.TaskRunner(task)
self.assertFalse(runner.started())
runner.start(timeout=10)
self.assertTrue(runner.started())
self.assertFalse(runner.step())
runner.cancel(grace_period=1.0)
self.assertFalse(runner.step())
self.assertFalse(runner.step())
self.assertTrue(runner.step())
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3), mock.call(4)])
self.assertEqual(4, task.do_step.call_count)
self.mock_sleep.assert_not_called()
self.assertEqual(7, timeutils.wallclock.call_count)
def test_cancel_grace_period_after_timeout(self):
st = timeutils.wallclock()
task = DummyTask(5)
task.do_step = mock.Mock(return_value=None)
self.patchobject(timeutils, 'wallclock',
side_effect=[st, st + 0.1, st + 0.2, st + 0.2,
st + 0.5, st + 1.0, st + 1.5])
runner = scheduler.TaskRunner(task)
self.assertFalse(runner.started())
runner.start(timeout=1.25)
self.assertTrue(runner.started())
self.assertFalse(runner.step())
runner.cancel(grace_period=3)
self.assertFalse(runner.step())
self.assertFalse(runner.step())
self.assertRaises(scheduler.Timeout, runner.step)
task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3), mock.call(4)])
self.assertEqual(4, task.do_step.call_count)
self.mock_sleep.assert_not_called()
self.assertEqual(7, timeutils.wallclock.call_count)
def test_cancel_grace_period_not_started(self):
task = DummyTask(1)
task.do_step = mock.Mock(return_value=None)
runner = scheduler.TaskRunner(task)
self.assertFalse(runner.started())
runner.cancel(grace_period=0.5)
self.assertTrue(runner.done())
task.do_step.assert_not_called()
self.mock_sleep.assert_not_called()
class TaskSleepTest(common.HeatTestCase):
def setUp(self):
super(TaskSleepTest, self).setUp()
scheduler.ENABLE_SLEEP = True
self.mock_sleep = self.patchobject(eventlet, 'sleep',
return_value=None)
def test_sleep(self):
sleep_time = 42
runner = scheduler.TaskRunner(DummyTask())
runner(wait_time=sleep_time)
self.mock_sleep.assert_any_call(0)
self.mock_sleep.assert_called_with(sleep_time)
def test_sleep_zero(self):
runner = scheduler.TaskRunner(DummyTask())
runner(wait_time=0)
self.mock_sleep.assert_called_with(0)
def test_sleep_none(self):
runner = scheduler.TaskRunner(DummyTask())
runner(wait_time=None)
self.mock_sleep.assert_not_called()
class TimeoutTest(common.HeatTestCase):
def test_compare(self):
task = scheduler.TaskRunner(DummyTask())
earlier = scheduler.Timeout(task, 10)
eventlet.sleep(0.01)
later = scheduler.Timeout(task, 10)
self.assertTrue(earlier.earlier_than(later))
self.assertFalse(later.earlier_than(earlier))
class DescriptionTest(common.HeatTestCase):
def setUp(self):
super(DescriptionTest, self).setUp()
def test_func(self):
def f():
pass
self.assertEqual('f', scheduler.task_description(f))
def test_lambda(self):
l = lambda: None
self.assertEqual('<lambda>', scheduler.task_description(l))
def test_method(self):
class C(object):
def __str__(self):
return 'C "o"'
def __repr__(self):
return 'o'
def m(self):
pass
self.assertEqual('m from C "o"', scheduler.task_description(C().m))
def test_object(self):
class C(object):
def __str__(self):
return 'C "o"'
def __repr__(self):
return 'o'
def __call__(self):
pass
self.assertEqual('o', scheduler.task_description(C()))
def test_unicode(self):
@repr_wrapper
@six.python_2_unicode_compatible
class C(object):
def __str__(self):
return u'C "\u2665"'
def __repr__(self):
return u'\u2665'
def __call__(self):
pass
def m(self):
pass
self.assertEqual(u'm from C "\u2665"',
scheduler.task_description(C().m))
self.assertEqual(u'\u2665',
scheduler.task_description(C()))
class WrapperTaskTest(common.HeatTestCase):
def setUp(self):
super(WrapperTaskTest, self).setUp()
def test_wrap(self):
child_tasks = [DummyTask() for i in range(3)]
@scheduler.wrappertask
def task():
for child_task in child_tasks:
yield child_task()
yield
for child_task in child_tasks:
child_task.do_step = mock.Mock(return_value=None)
self.patchobject(scheduler.TaskRunner, '_sleep', return_value=None)
scheduler.TaskRunner(task)()
for child_task in child_tasks:
child_task.do_step.assert_has_calls([mock.call(1), mock.call(2),
mock.call(3)])
self.assertEqual(3, child_task.do_step.call_count)
scheduler.TaskRunner._sleep.assert_any_call(0)
scheduler.TaskRunner._sleep.assert_called_with(1)
self.assertEqual(1 + len(child_tasks) * 3,
scheduler.TaskRunner._sleep.call_count)
def test_parent_yield_value(self):
@scheduler.wrappertask
def parent_task():
yield
yield 3
yield iter([1, 2, 4])
task = parent_task()
self.assertIsNone(next(task))
self.assertEqual(3, next(task))
self.assertEqual([1, 2, 4], list(next(task)))
def test_child_yield_value(self):
def child_task():
yield
yield 3
yield iter([1, 2, 4])
@scheduler.wrappertask
def parent_task():
yield child_task()
task = parent_task()
self.assertIsNone(next(task))
self.assertEqual(3, next(task))
self.assertEqual([1, 2, 4], list(next(task)))
def test_child_exception(self):
class MyException(Exception):
pass
def child_task():
yield
raise MyException()
@scheduler.wrappertask
def parent_task():
try:
yield child_task()
except MyException:
raise
else:
self.fail('No exception raised in parent_task')
task = parent_task()
next(task)
self.assertRaises(MyException, next, task)
def test_child_exception_exit(self):
class MyException(Exception):
pass
def child_task():
yield
raise MyException()
@scheduler.wrappertask
def parent_task():
try:
yield child_task()
except MyException:
return
else:
self.fail('No exception raised in parent_task')
task = parent_task()
next(task)
self.assertRaises(StopIteration, next, task)
def test_child_exception_swallow(self):
class MyException(Exception):
pass
def child_task():
yield
raise MyException()
@scheduler.wrappertask
def parent_task():
try:
yield child_task()
except MyException:
yield
else:
self.fail('No exception raised in parent_task')
yield
task = parent_task()
next(task)
next(task)
def test_child_exception_swallow_next(self):
class MyException(Exception):
pass
def child_task():
yield
raise MyException()
dummy = DummyTask()
@scheduler.wrappertask
def parent_task():
try:
yield child_task()
except MyException:
pass
else:
self.fail('No exception raised in parent_task')
yield dummy()
task = parent_task()
next(task)
dummy.do_step = mock.Mock(return_value=None)
for i in range(1, dummy.num_steps + 1):
next(task)
self.assertRaises(StopIteration, next, task)
dummy.do_step.assert_has_calls([mock.call(i)
for i in range(1,
dummy.num_steps + 1)])
self.assertEqual(dummy.num_steps, dummy.do_step.call_count)
def test_thrown_exception_swallow_next(self):
class MyException(Exception):
pass
dummy = DummyTask()
@scheduler.wrappertask
def child_task():
try:
yield
except MyException:
yield dummy()
else:
self.fail('No exception raised in child_task')
@scheduler.wrappertask
def parent_task():
yield child_task()
task = parent_task()
dummy.do_step = mock.Mock(return_value=None)
next(task)
task.throw(MyException)
for i in range(2, dummy.num_steps + 1):
next(task)
self.assertRaises(StopIteration, next, task)
dummy.do_step.assert_has_calls([mock.call(i)
for i in range(1,
dummy.num_steps + 1)])
self.assertEqual(dummy.num_steps, dummy.do_step.call_count)
def test_thrown_exception_raise(self):
class MyException(Exception):
pass
dummy = DummyTask()
@scheduler.wrappertask
def child_task():
try:
yield
except MyException:
raise
else:
self.fail('No exception raised in child_task')
@scheduler.wrappertask
def parent_task():
try:
yield child_task()
except MyException:
yield dummy()
task = parent_task()
dummy.do_step = mock.Mock(return_value=None)
next(task)
task.throw(MyException)
for i in range(2, dummy.num_steps + 1):
next(task)
self.assertRaises(StopIteration, next, task)
dummy.do_step.assert_has_calls([mock.call(i)
for i in range(1,
dummy.num_steps + 1)])
self.assertEqual(dummy.num_steps, dummy.do_step.call_count)
def test_thrown_exception_exit(self):
class MyException(Exception):
pass
dummy = DummyTask()
@scheduler.wrappertask
def child_task():
try:
yield
except MyException:
return
else:
self.fail('No exception raised in child_task')
@scheduler.wrappertask
def parent_task():
yield child_task()
yield dummy()
task = parent_task()
dummy.do_step = mock.Mock(return_value=None)
next(task)
task.throw(MyException)
for i in range(2, dummy.num_steps + 1):
next(task)
self.assertRaises(StopIteration, next, task)
dummy.do_step.assert_has_calls([mock.call(i)
for i in range(1,
dummy.num_steps + 1)])
self.assertEqual(dummy.num_steps, dummy.do_step.call_count)
def test_parent_exception(self):
class MyException(Exception):
pass
def child_task():
yield
@scheduler.wrappertask
def parent_task():
yield child_task()
raise MyException()
task = parent_task()
next(task)
self.assertRaises(MyException, next, task)
def test_parent_throw(self):
class MyException(Exception):
pass
@scheduler.wrappertask
def parent_task():
try:
yield DummyTask()()
except MyException:
raise
else:
self.fail('No exception raised in parent_task')
task = parent_task()
next(task)
self.assertRaises(MyException, task.throw, MyException())
def test_parent_throw_exit(self):
class MyException(Exception):
pass
@scheduler.wrappertask
def parent_task():
try:
yield DummyTask()()
except MyException:
return
else:
self.fail('No exception raised in parent_task')
task = parent_task()
next(task)
self.assertRaises(StopIteration, task.throw, MyException())
def test_parent_cancel(self):
@scheduler.wrappertask
def parent_task():
try:
yield
except GeneratorExit:
raise
else:
self.fail('parent_task not closed')
task = parent_task()
next(task)
task.close()
def test_parent_cancel_exit(self):
@scheduler.wrappertask
def parent_task():
try:
yield
except GeneratorExit:
return
else:
self.fail('parent_task not closed')
task = parent_task()
next(task)
task.close()
def test_cancel(self):
def child_task():
try:
yield
except GeneratorExit:
raise
else:
self.fail('child_task not closed')
@scheduler.wrappertask
def parent_task():
try:
yield child_task()
except GeneratorExit:
raise
else:
self.fail('parent_task not closed')
task = parent_task()
next(task)
task.close()
def test_cancel_exit(self):
def child_task():
try:
yield
except GeneratorExit:
return
else:
self.fail('child_task not closed')
@scheduler.wrappertask
def parent_task():
try:
yield child_task()
except GeneratorExit:
raise
else:
self.fail('parent_task not closed')
task = parent_task()
next(task)
task.close()
def test_cancel_parent_exit(self):
def child_task():
try:
yield
except GeneratorExit:
return
else:
self.fail('child_task not closed')
@scheduler.wrappertask
def parent_task():
try:
yield child_task()
except GeneratorExit:
return
else:
self.fail('parent_task not closed')
task = parent_task()
next(task)
task.close()
| 30.639977 | 79 | 0.558493 | 5,838 | 52,425 | 4.813292 | 0.05567 | 0.0279 | 0.044306 | 0.023061 | 0.7979 | 0.771495 | 0.72427 | 0.69274 | 0.660427 | 0.641637 | 0 | 0.016488 | 0.332475 | 52,425 | 1,710 | 80 | 30.657895 | 0.786484 | 0.010415 | 0 | 0.729457 | 0 | 0 | 0.027611 | 0 | 0 | 0 | 0 | 0 | 0.191473 | 1 | 0.139535 | false | 0.024806 | 0.007752 | 0.004651 | 0.184496 | 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 | 0 | 0 | 0 | 4 |
b6979054c2cfc886bc6eca825014fda285208618 | 187 | py | Python | sense/__init__.py | alberttjc/sense | 42fbe7aa2f2eb69c93e9162f78bc3fab3a351259 | [
"MIT"
] | 483 | 2020-12-14T23:13:48.000Z | 2021-07-29T06:01:44.000Z | sense/__init__.py | alberttjc/sense | 42fbe7aa2f2eb69c93e9162f78bc3fab3a351259 | [
"MIT"
] | 55 | 2020-12-16T23:20:15.000Z | 2021-07-12T18:15:48.000Z | sense/__init__.py | alberttjc/sense | 42fbe7aa2f2eb69c93e9162f78bc3fab3a351259 | [
"MIT"
] | 52 | 2021-01-07T02:17:27.000Z | 2021-07-29T02:06:34.000Z | import os
SOURCE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(SOURCE_DIR)
RESOURCES_DIR = os.path.join(ROOT_DIR, 'resources')
SPLITS = ['train', 'valid']
| 23.375 | 55 | 0.743316 | 29 | 187 | 4.482759 | 0.482759 | 0.184615 | 0.207692 | 0.246154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096257 | 187 | 7 | 56 | 26.714286 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0.101604 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
fce42a5a221b6ae793926b49cff2d2879f6983f7 | 57 | py | Python | setup.py | erikescher/git-anon | 491f3896860943fca4208147abecfb9337180164 | [
"MIT"
] | null | null | null | setup.py | erikescher/git-anon | 491f3896860943fca4208147abecfb9337180164 | [
"MIT"
] | null | null | null | setup.py | erikescher/git-anon | 491f3896860943fca4208147abecfb9337180164 | [
"MIT"
] | null | null | null | #!/usr/bin/python3
from setuptools import setup
setup()
| 11.4 | 28 | 0.754386 | 8 | 57 | 5.375 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02 | 0.122807 | 57 | 4 | 29 | 14.25 | 0.84 | 0.298246 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
fcf22f6d5c0580722fa2690852643e09cc6f4e98 | 2,882 | py | Python | extra/unused/rock_fig.py | whyjz/CARST | 875c915e835b0e09a7eccb58833719bbfc85b635 | [
"MIT"
] | 10 | 2018-01-02T18:03:07.000Z | 2022-01-25T05:36:21.000Z | extra/unused/rock_fig.py | whyjz/CARST | 875c915e835b0e09a7eccb58833719bbfc85b635 | [
"MIT"
] | 1 | 2020-04-14T16:57:15.000Z | 2020-05-15T16:10:17.000Z | extra/unused/rock_fig.py | whyjz/CARST | 875c915e835b0e09a7eccb58833719bbfc85b635 | [
"MIT"
] | 4 | 2016-08-12T15:06:48.000Z | 2019-11-27T05:33:50.000Z | #!/usr/bin/python
import subprocess;
import sys;
name=sys.argv[1];
path="./";
if name.find("/") > -1:
path=name[:name.rfind("/")+1];
infile=open(name,"r");
line=infile.readline().strip();
if not line:
print("Empty");
infile.close();
exit();
elements=line.split();
r=255;
g=0;
b=0;
thickness="0.75";
count=0;
first=True;
times=[];
elevs=[];
t_e={};
t_std={};
x=elements[0].strip();
y=elements[1].strip();
elev=float(elements[2].strip());
time=float(elements[3].strip());
stdv=float(elements[4].strip());
if elev < 450 and elev > 0:
elevs.append(elev);
times.append(time);
t_e[time]=elev;
t_std[time]=stdv;
prev_x=x;
prev_y=y;
psname="";
while 1:
line=infile.readline().strip();
if not line:
break;
elements=line.split();
x=elements[0].strip();
y=elements[1].strip();
elev=float(elements[2].strip());
time=float(elements[3].strip());
stdv=float(elements[4].strip());
if elev > 450 or elev < 0:
continue;
elevs.append(elev);
times.append(time);
t_e[time]=elev;
t_std[time]=stdv;
if x != prev_x or y != prev_y:
t_e=sorted(t_e.items());
t_std=sorted(t_std.items());
outfile=open("temp","w");
for i in range(0,len(t_e)):
outfile.write(str(t_e[i][0])+" "+str(t_e[i][1])+" "+str(t_std[i][1])+"\n");
outfile.close();
t_e={};
t_std={};
cmd="";
psname=name[:name.rfind(".")]+"_"+str(count)+".ps";
if first:
#cmd="\npsxy temp -JX5i -R51000/56000/500/700 -Ba730f365g365/a50f50g50 -W"+thickness+"p,"+str(r)+"/"+str(g)+"/"+str(b)+" -K > "+psname+"\n";
cmd="\npsxy temp -X4c -JX5i -R51000/56000/0/450 -Ba730f365g365:\"Modified Julian Day\":/a50f50g50:\"Elevation (m)\":WeSn -Ey -Ss0.25c -W0.5p,black -G"+str(r)+"/"+str(g)+"/"+str(b)+" > "+psname+"\n";
first=False;
else:
#cmd="\npsxy temp -JX5i -R51000/56000/500/700 -Ba730f365g365/a50f50g50 -W"+thickness+"p,"+str(r)+"/"+str(g)+"/"+str(b)+" -K -O >> "+psname+"\n";
cmd="\npsxy temp -X4c -JX5i -R51000/56000/0/450 -Ba730f365g365:\"Modified Julian Day\":/a50f50g50:\"Elevation (m)\":WeSn -Ey -Ss0.25c -W0.5p,black -G"+str(r)+"/"+str(g)+"/"+str(b)+" > "+psname+"\n";
count=count+1;
subprocess.call(cmd,shell=True,stdout=subprocess.PIPE);
r=r-3;
g=g+3;
b=b+3;
#thickness=str(float(thickness)-0.05);
prev_x=x;
prev_y=y;
t_e=sorted(t_e.items());
t_std=sorted(t_std.items());
outfile=open("temp","w");
for i in range(0,len(t_e)):
outfile.write(str(t_e[i][0])+" "+str(t_e[i][1])+" "+str(t_std[i][1])+"\n");
outfile.close();
#cmd="\npsxy temp -JX5i -R51000/56000/500/700 -Ba730f365g365/a50f50g50 -W"+thickness+"p,"+str(r)+"/"+str(g)+"/"+str(b)+" -O >> "+psname+"\n";
cmd="\npsxy temp -X4c -JX5i -R51000/56000/0/450 -Ba730f365g365:\"Modified Julian Day\":/a50f50g50:\"Elevation (m)\":WeSn -Ey -Ss0.25c -W0.5p,black -G"+str(r)+"/"+str(g)+"/"+str(b)+" > "+psname+"\n";
cmd+="\nrm temp\n";
subprocess.call(cmd,shell=True,stdout=subprocess.PIPE);
infile.close();
exit();
| 29.71134 | 202 | 0.620749 | 489 | 2,882 | 3.595092 | 0.214724 | 0.015927 | 0.040956 | 0.027304 | 0.774744 | 0.774744 | 0.761661 | 0.725256 | 0.672924 | 0.672924 | 0 | 0.096488 | 0.100972 | 2,882 | 96 | 203 | 30.020833 | 0.582015 | 0.16551 | 0 | 0.616279 | 0 | 0 | 0.16125 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.023256 | 0 | 0.023256 | 0.011628 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
1e0cabf7bbf601dfdadf14c9a7a6146de8e74b40 | 448 | py | Python | shortit/conftest.py | m7salam/shortit | c575acb4e8b447ac62abdf899063357f1569e93d | [
"MIT"
] | null | null | null | shortit/conftest.py | m7salam/shortit | c575acb4e8b447ac62abdf899063357f1569e93d | [
"MIT"
] | 2 | 2022-03-01T00:07:15.000Z | 2022-03-02T00:17:58.000Z | shortit/conftest.py | m7salam/shortit | c575acb4e8b447ac62abdf899063357f1569e93d | [
"MIT"
] | null | null | null | import pytest
from shortit.users.models import User
from shortit.shortener.models import ShortUrl
from shortit.users.tests.factories import UserFactory
from shortit.shortener.tests.factories import UrlFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> User:
return UserFactory()
@pytest.fixture
def url() -> ShortUrl:
return UrlFactory()
| 20.363636 | 56 | 0.78125 | 56 | 448 | 6.214286 | 0.446429 | 0.126437 | 0.091954 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129464 | 448 | 21 | 57 | 21.333333 | 0.892308 | 0 | 0 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.357143 | 0.142857 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 4 |
1e147880f32b3d48916f1f5e922d46838c77859b | 192 | py | Python | module1/digits_game/game_d.py | Strugglingrookie/oldboy2 | 8ed6723cab1f54f2ff8ea0947c6f982aef7e1b47 | [
"Apache-2.0"
] | 1 | 2021-06-15T07:01:23.000Z | 2021-06-15T07:01:23.000Z | module1/digits_game/game_d.py | Strugglingrookie/oldboy2 | 8ed6723cab1f54f2ff8ea0947c6f982aef7e1b47 | [
"Apache-2.0"
] | 3 | 2020-02-13T14:35:36.000Z | 2021-06-10T21:27:14.000Z | module1/digits_game/game_d.py | Strugglingrookie/oldboy2 | 8ed6723cab1f54f2ff8ea0947c6f982aef7e1b47 | [
"Apache-2.0"
] | 1 | 2020-04-09T02:13:12.000Z | 2020-04-09T02:13:12.000Z | # 练习1:猜年龄游戏 (10分钟)
# 要求:
# 允许用户最多尝试3次,3次都没猜对的话,就直接退出,如果猜对了,打印恭喜信息并退出
#
# 练习2:猜年龄游戏升级版 (10分钟)
# 要求:
# 允许用户最多尝试3次
# 每尝试3次后,如果还没猜对,就问用户是否还想继续玩,如果回答Y或y, 就继续让其猜3次,以此往复,如果回答N或n,就退出程序
# 如何猜对了,就直接退出
| 17.454545 | 64 | 0.739583 | 24 | 192 | 5.916667 | 0.833333 | 0.084507 | 0.225352 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.064327 | 0.109375 | 192 | 10 | 65 | 19.2 | 0.766082 | 0.895833 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
1e895a6d4149f0e5866fed0ccfa78a984bedf04e | 120 | py | Python | tatsu/__main__.py | smarty-timmi/TatSu | f09240959b51782cc3c38a9059b32f212077c802 | [
"BSD-2-Clause"
] | 1 | 2021-02-25T10:44:10.000Z | 2021-02-25T10:44:10.000Z | tatsu/__main__.py | smarty-timmi/TatSu | f09240959b51782cc3c38a9059b32f212077c802 | [
"BSD-2-Clause"
] | null | null | null | tatsu/__main__.py | smarty-timmi/TatSu | f09240959b51782cc3c38a9059b32f212077c802 | [
"BSD-2-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import generator_stop
import tatsu
if __name__ == '__main__':
tatsu.main()
| 17.142857 | 37 | 0.683333 | 15 | 120 | 4.6 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010101 | 0.175 | 120 | 6 | 38 | 20 | 0.686869 | 0.175 | 0 | 0 | 0 | 0 | 0.082474 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
1ea083824314ef9c57bb25536c511edca6866278 | 80 | py | Python | setup.py | paxtonfitzpatrick/gittracker | 307686d29128a563d57230b1d1fa2e2568ac734b | [
"BSD-3-Clause"
] | 1 | 2020-04-14T15:47:34.000Z | 2020-04-14T15:47:34.000Z | setup.py | paxtonfitzpatrick/gittracker | 307686d29128a563d57230b1d1fa2e2568ac734b | [
"BSD-3-Clause"
] | 10 | 2020-04-06T19:41:24.000Z | 2020-04-25T23:22:27.000Z | setup.py | paxtonfitzpatrick/gittracker | 307686d29128a563d57230b1d1fa2e2568ac734b | [
"BSD-3-Clause"
] | null | null | null | from setuptools import setup
# reads metadata & options from setup.cfg
setup()
| 16 | 41 | 0.775 | 11 | 80 | 5.636364 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1625 | 80 | 4 | 42 | 20 | 0.925373 | 0.4875 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
94b6fa76b80e36fb48131cf3a00175ece3ab951a | 129 | py | Python | tests/utils.py | werthm/becquerel | 975c522419eb4245efb0069b4aac23520703deb5 | [
"BSD-3-Clause-LBNL"
] | 33 | 2018-04-17T14:31:20.000Z | 2022-03-28T20:07:56.000Z | tests/utils.py | werthm/becquerel | 975c522419eb4245efb0069b4aac23520703deb5 | [
"BSD-3-Clause-LBNL"
] | 228 | 2017-06-14T20:12:36.000Z | 2022-03-31T23:55:56.000Z | tests/utils.py | werthm/becquerel | 975c522419eb4245efb0069b4aac23520703deb5 | [
"BSD-3-Clause-LBNL"
] | 14 | 2017-06-15T20:56:23.000Z | 2022-03-08T11:40:43.000Z | """Helpers for testing."""
from pathlib import Path
TESTS_PATH = Path(__file__).parent.absolute()
REPO_PATH = TESTS_PATH.parent
| 21.5 | 45 | 0.767442 | 18 | 129 | 5.111111 | 0.666667 | 0.195652 | 0.282609 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.108527 | 129 | 5 | 46 | 25.8 | 0.8 | 0.155039 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 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 | 0 | 0 | 0 | 4 |
94fa1a6664f970e78ddcd4877ac248df3db60ea3 | 132 | py | Python | salt/_grains/minion_ip.py | aronysidoro/saltstack-django-uwsgi-nginx | 8eb7cd451fad800e55bdb4a3167a5c06a68f4362 | [
"MIT"
] | 1 | 2015-06-19T14:26:23.000Z | 2015-06-19T14:26:23.000Z | salt/_grains/minion_ip.py | aronysidoro/saltstack-django-uwsgi-nginx | 8eb7cd451fad800e55bdb4a3167a5c06a68f4362 | [
"MIT"
] | 4 | 2020-02-11T22:23:37.000Z | 2021-06-10T17:43:38.000Z | salt/_grains/minion_ip.py | aaronlelevier/saltstack-django-uwsgi-nginx | 8eb7cd451fad800e55bdb4a3167a5c06a68f4362 | [
"MIT"
] | 1 | 2015-07-07T01:43:31.000Z | 2015-07-07T01:43:31.000Z | #!/usr/bin/env python
import socket
def minion_ip():
return {
'minion_ip': socket.gethostbyname(socket.getfqdn())
} | 18.857143 | 59 | 0.651515 | 16 | 132 | 5.25 | 0.75 | 0.190476 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.204545 | 132 | 7 | 60 | 18.857143 | 0.8 | 0.151515 | 0 | 0 | 0 | 0 | 0.080357 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | true | 0 | 0.2 | 0.2 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 4 |
bf47f63c59f359cb5ab78ff5fde50283e2a4bcea | 24 | py | Python | emulation_system/emulation_system/commands/__init__.py | Opentrons/ot3-emulator | 90fad37b54dc3b003732220e630185de1a1d5dfd | [
"Apache-2.0"
] | 3 | 2022-02-15T23:58:01.000Z | 2022-03-17T19:32:15.000Z | emulation_system/emulation_system/commands/__init__.py | Opentrons/opentrons-emulation | aee3b362ef47190b35a1a99d040f5d87800e740b | [
"Apache-2.0"
] | 23 | 2021-11-17T17:55:22.000Z | 2022-03-29T19:15:20.000Z | emulation_system/emulation_system/commands/__init__.py | Opentrons/opentrons-emulation | aee3b362ef47190b35a1a99d040f5d87800e740b | [
"Apache-2.0"
] | null | null | null | """commands package."""
| 12 | 23 | 0.625 | 2 | 24 | 7.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 24 | 1 | 24 | 24 | 0.681818 | 0.708333 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
bf491bc9e6cc3a01b3c1e72d5b3475e91afb93ef | 252 | py | Python | solutions/575_distribute_candies.py | YiqunPeng/leetcode_pro | 7e6376984f9baec49a5e827d98330fe3d1b656f0 | [
"MIT"
] | null | null | null | solutions/575_distribute_candies.py | YiqunPeng/leetcode_pro | 7e6376984f9baec49a5e827d98330fe3d1b656f0 | [
"MIT"
] | null | null | null | solutions/575_distribute_candies.py | YiqunPeng/leetcode_pro | 7e6376984f9baec49a5e827d98330fe3d1b656f0 | [
"MIT"
] | null | null | null | class Solution:
def distributeCandies(self, candyType: List[int]) -> int:
"""Hash set.
"""
s = set(candyType)
if len(s) > len(candyType) // 2:
return len(candyType) // 2
else:
return len(s)
| 25.2 | 61 | 0.507937 | 28 | 252 | 4.571429 | 0.571429 | 0.0625 | 0.203125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01227 | 0.353175 | 252 | 9 | 62 | 28 | 0.773006 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
bf5bb698696c19e2b714e6f7d12f8860cdac00ee | 26 | py | Python | venv/Lib/site-packages/pyfiglet/version.py | yusufhilmi/hermes-face-animations | bc1fc4376042485568dea8ffdbb8626823257bc3 | [
"MIT"
] | 2 | 2018-11-17T10:11:46.000Z | 2018-11-17T10:11:49.000Z | venv/Lib/site-packages/pyfiglet/version.py | yusufhilmi/hermes-face-animations | bc1fc4376042485568dea8ffdbb8626823257bc3 | [
"MIT"
] | null | null | null | venv/Lib/site-packages/pyfiglet/version.py | yusufhilmi/hermes-face-animations | bc1fc4376042485568dea8ffdbb8626823257bc3 | [
"MIT"
] | null | null | null | __version__ = '0.8.post0'
| 13 | 25 | 0.692308 | 4 | 26 | 3.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130435 | 0.115385 | 26 | 1 | 26 | 26 | 0.478261 | 0 | 0 | 0 | 0 | 0 | 0.346154 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
bf6b1cc5b65a34090354982583d6cd193b526c79 | 2,089 | py | Python | pypadre/pod/repository/serializer/serialiser.py | padre-lab-eu/pypadre | c244a5f1d4eb7bf168cc06dd9b43416883534268 | [
"MIT"
] | 3 | 2019-12-19T13:29:52.000Z | 2019-12-20T07:32:05.000Z | pypadre/pod/repository/serializer/serialiser.py | padre-lab-eu/pypadre | c244a5f1d4eb7bf168cc06dd9b43416883534268 | [
"MIT"
] | 1 | 2019-12-16T13:39:24.000Z | 2019-12-16T13:39:24.000Z | pypadre/pod/repository/serializer/serialiser.py | padre-lab-eu/pypadre | c244a5f1d4eb7bf168cc06dd9b43416883534268 | [
"MIT"
] | null | null | null | import json
import pickle
import dill
import yaml
import msgpack_numpy as mn
# TODO : we should support faster / more sophisticated / cross-plattform serialisation. for example using pyarrow
# TODO: write PickleSerialiser Test
from pypadre.pod.repository.serializer.i_serializer import Serializer
class PickleSerializer(Serializer):
"""
Serialiser using pythons pickle.
"""
@staticmethod
def serialise(obj):
"""
serializes the object and returns a byte object
:param obj: object to serialise
:return: byte object (TODO: Specify more precise)
"""
return pickle.dumps(obj)
@staticmethod
def deserialize(buffer):
"""
Deserialize a object
:param buffer:
:return:
"""
return pickle.loads(buffer)
class DillSerializer(Serializer):
"""
Serialiser using pythons pickle.
"""
@staticmethod
def serialise(obj):
"""
serializes the object and returns a byte object
:param obj: object to serialise
:return: byte object (TODO: Specify more precise)
"""
return dill.dumps(obj)
@staticmethod
def deserialize(buffer):
"""
Deserialize a object
:param buffer:
:return:
"""
return dill.loads(buffer)
class JSonSerializer(Serializer):
@staticmethod
def serialise(obj):
return json.dumps(obj)
@staticmethod
def deserialize(buffer):
return json.loads(buffer)
class YamlSerializer(Serializer):
@staticmethod
def serialise(obj):
return yaml.dump(obj)
@staticmethod
def deserialize(buffer):
return yaml.load(buffer, Loader=yaml.FullLoader)
class TextSerializer(Serializer):
@staticmethod
def serialise(obj):
return obj
@staticmethod
def deserialize(buffer):
return buffer
class MsgPack(Serializer):
@staticmethod
def serialise(obj):
return mn.dumps(obj)
@staticmethod
def deserialize(buffer):
return mn.loads(buffer)
| 20.89 | 113 | 0.63954 | 213 | 2,089 | 6.262911 | 0.300469 | 0.134933 | 0.107946 | 0.121439 | 0.641679 | 0.641679 | 0.451274 | 0.382309 | 0.382309 | 0.382309 | 0 | 0 | 0.278602 | 2,089 | 99 | 114 | 21.10101 | 0.885202 | 0.269028 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030303 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0.166667 | 0.75 | 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 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
bf857e0a22c76dab7090c67960e35d36a52e9299 | 56 | py | Python | paper_code/distributed_evolution/envs/__init__.py | adam-katona/QualityEvolvabilityES | ebb96e1dbc2422109714c0f5c8174073f9cc6c6f | [
"MIT"
] | 1 | 2021-10-06T15:08:42.000Z | 2021-10-06T15:08:42.000Z | paper_code/distributed_evolution/envs/__init__.py | adam-katona/QualityEvolvabilityES | ebb96e1dbc2422109714c0f5c8174073f9cc6c6f | [
"MIT"
] | null | null | null | paper_code/distributed_evolution/envs/__init__.py | adam-katona/QualityEvolvabilityES | ebb96e1dbc2422109714c0f5c8174073f9cc6c6f | [
"MIT"
] | null | null | null | from .ant import AntEnv
from .cheetah import CheetahEnv
| 18.666667 | 31 | 0.821429 | 8 | 56 | 5.75 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 56 | 2 | 32 | 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 | 0 | 0 | 0 | 4 |
bf884b1e0cdd8c9e6cbdeb86d41cc88513d6a71c | 2,424 | py | Python | npt/parser.py | jfdm/ips-protodesc-code | d89260a67d9ca43fbdc92b6df205372274ae275b | [
"BSD-2-Clause"
] | 11 | 2020-08-18T18:22:14.000Z | 2022-03-21T10:23:16.000Z | npt/parser.py | fork-bombed/ips-protodesc-code | af1a574f5441668e0cc2909076021386770c1e0d | [
"BSD-2-Clause"
] | 11 | 2020-04-06T11:05:58.000Z | 2020-09-04T16:10:56.000Z | npt/parser.py | fork-bombed/ips-protodesc-code | af1a574f5441668e0cc2909076021386770c1e0d | [
"BSD-2-Clause"
] | 2 | 2020-07-13T09:09:26.000Z | 2022-03-21T10:23:26.000Z | # =================================================================================================
# Copyright (C) 2018-2020 University of Glasgow
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# SPDX-License-Identifier: BSD-2-Clause
# =================================================================================================
import abc
from typing import Dict, List, Tuple, Optional, Any, Union
from npt.protocol import Protocol
import npt.rfc as rfc
class Parser(abc.ABC):
@abc.abstractmethod
def build_protocol(self, proto: Optional[Protocol], input: Union[str, rfc.RFC], name: str=None) -> Protocol:
"""
Build a Protocol object for the protocol represented by the input string.
Arguments:
proto -- A protocol object. If specified, the input parser should augment this Protocol
rather than creating a new Protocol. This allows input parsers to be chained
together to define a single Protocol.
input -- A string representing a protocol definition or RFC DOM object
Returns:
A Protocol object
"""
pass
| 44.888889 | 112 | 0.671617 | 306 | 2,424 | 5.316993 | 0.519608 | 0.022127 | 0.027658 | 0.028273 | 0.113092 | 0.083589 | 0.083589 | 0.083589 | 0.083589 | 0.083589 | 0 | 0.005658 | 0.19802 | 2,424 | 53 | 113 | 45.735849 | 0.831276 | 0.812294 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0.125 | 0.5 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 4 |
bf938188c5d4bf002044944bd02ced90890215ad | 108 | py | Python | easygmail/exceptions.py | AlanTheKnight/easygmail | 607224805e3dd4f30f611f86c6ea1c3abeb40a13 | [
"MIT"
] | null | null | null | easygmail/exceptions.py | AlanTheKnight/easygmail | 607224805e3dd4f30f611f86c6ea1c3abeb40a13 | [
"MIT"
] | null | null | null | easygmail/exceptions.py | AlanTheKnight/easygmail | 607224805e3dd4f30f611f86c6ea1c3abeb40a13 | [
"MIT"
] | null | null | null | class GmailException(Exception):
"""Base class for every exception raised by gmail package."""
pass
| 27 | 65 | 0.722222 | 13 | 108 | 6 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.185185 | 108 | 3 | 66 | 36 | 0.886364 | 0.509259 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
bfabd664d57d5a40c3d0f6b33e5c878ce5912840 | 15 | py | Python | tests/__init__.py | gboehl/sequence-jacobian | 01d177cc254a2ccee57a3ed273117bea58554be2 | [
"MIT"
] | null | null | null | tests/__init__.py | gboehl/sequence-jacobian | 01d177cc254a2ccee57a3ed273117bea58554be2 | [
"MIT"
] | null | null | null | tests/__init__.py | gboehl/sequence-jacobian | 01d177cc254a2ccee57a3ed273117bea58554be2 | [
"MIT"
] | null | null | null | """All tests""" | 15 | 15 | 0.533333 | 2 | 15 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066667 | 15 | 1 | 15 | 15 | 0.571429 | 0.6 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
bfaf3940d2a24eb0910a88277e7d1d0606d4aa8e | 271 | py | Python | code_snippets/results/result.api-dashboard-get-all.py | brettlangdon/documentation | 87c23cb1d5e3e877bb37a19f7231b5d9239509dc | [
"BSD-3-Clause"
] | null | null | null | code_snippets/results/result.api-dashboard-get-all.py | brettlangdon/documentation | 87c23cb1d5e3e877bb37a19f7231b5d9239509dc | [
"BSD-3-Clause"
] | null | null | null | code_snippets/results/result.api-dashboard-get-all.py | brettlangdon/documentation | 87c23cb1d5e3e877bb37a19f7231b5d9239509dc | [
"BSD-3-Clause"
] | null | null | null | [{'description': 'This has all the new hotness.',
'id': '2551',
'resource': '/api/v1/dash/2551',
'title': 'New and Improved Dashboard'},
{'description': 'And they are marvelous.',
'id': '2552',
'resource': '/api/v1/dash/2552',
'title': 'My First Metrics'}
]
| 27.1 | 49 | 0.608856 | 35 | 271 | 4.714286 | 0.685714 | 0.133333 | 0.157576 | 0.206061 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.078947 | 0.158672 | 271 | 9 | 50 | 30.111111 | 0.644737 | 0 | 0 | 0 | 0 | 0 | 0.693727 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
bfcbfc7d6145e4d81bcf4a57c21c4f0d0229cd21 | 172 | py | Python | stdlib/glob_qs.py | bpuderer/python-snippets27 | 8d51ff34c48bee1247575536d8ed506eafde8631 | [
"MIT"
] | 3 | 2015-11-20T14:30:53.000Z | 2015-12-19T05:55:19.000Z | stdlib/glob_qs.py | bpuderer/python-snippets27 | 8d51ff34c48bee1247575536d8ed506eafde8631 | [
"MIT"
] | null | null | null | stdlib/glob_qs.py | bpuderer/python-snippets27 | 8d51ff34c48bee1247575536d8ed506eafde8631 | [
"MIT"
] | 1 | 2016-01-05T20:54:49.000Z | 2016-01-05T20:54:49.000Z | import glob
# find pathnames matching Unix shell style pattern
print glob.glob("o*.py")
# iglob returns iterator
for pathname in glob.iglob("o*.py"):
print pathname
| 17.2 | 50 | 0.732558 | 26 | 172 | 4.846154 | 0.692308 | 0.047619 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.168605 | 172 | 9 | 51 | 19.111111 | 0.881119 | 0.412791 | 0 | 0 | 0 | 0 | 0.102041 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.25 | null | null | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
bfcf9157808f17a0fa144ade89afe47aba565558 | 366 | py | Python | tests/unit/data/entity/test_entity.py | suamin/nemex | 05d93c788bf1493a1f6da01e9eee03120da0f7d4 | [
"MIT"
] | 2 | 2021-03-24T12:12:55.000Z | 2021-05-02T11:48:47.000Z | tests/unit/data/entity/test_entity.py | suamin/nemex | 05d93c788bf1493a1f6da01e9eee03120da0f7d4 | [
"MIT"
] | null | null | null | tests/unit/data/entity/test_entity.py | suamin/nemex | 05d93c788bf1493a1f6da01e9eee03120da0f7d4 | [
"MIT"
] | 1 | 2021-05-16T17:44:08.000Z | 2021-05-16T17:44:08.000Z | import unittest
from nemex import Entity
class TestEntity(unittest.TestCase):
def setUp(self) -> None:
# TODO: Setup test.
self.entity = Entity(0, "")
return None
def test_example(self):
return self.assertEqual("", "")
def tearDown(self) -> None:
return None
if __name__ == '__main__':
unittest.main()
| 16.636364 | 39 | 0.603825 | 41 | 366 | 5.170732 | 0.536585 | 0.075472 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003788 | 0.278689 | 366 | 21 | 40 | 17.428571 | 0.799242 | 0.046448 | 0 | 0.166667 | 0 | 0 | 0.023055 | 0 | 0 | 0 | 0 | 0.047619 | 0.083333 | 1 | 0.25 | false | 0 | 0.166667 | 0.166667 | 0.75 | 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 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
44a1076d14d7ac0a010e51be6cd9c1dac9a63b59 | 5,784 | py | Python | app/pybracket/basicBrackets.py | tennis-aa/tennis-bracket2 | 9e5f0c86a9fc2b1ed4d1ea11ac170f94d60a45dd | [
"MIT"
] | null | null | null | app/pybracket/basicBrackets.py | tennis-aa/tennis-bracket2 | 9e5f0c86a9fc2b1ed4d1ea11ac170f94d60a45dd | [
"MIT"
] | null | null | null | app/pybracket/basicBrackets.py | tennis-aa/tennis-bracket2 | 9e5f0c86a9fc2b1ed4d1ea11ac170f94d60a45dd | [
"MIT"
] | null | null | null | from random import random
import math
def generateMonkeys(players,n):
# helper variables
bracketSize = len(players)
rounds = math.log(bracketSize,2)
if not rounds.is_integer():
raise ValueError("bracketSize has to be 2^n")
rounds = int(rounds)
counter = [0]*(rounds+1)
for j in range(rounds):
counter[j+1] = counter[j] + int(bracketSize/(2**j))
# generate random brackets
monkeys = {}
for k in range(n):
bracket = []
for i in range(int(bracketSize/2)):
if players[2*i]=="Bye":
bracket.append(2*i+1)
elif players[2*i+1]=="Bye":
bracket.append(2*i)
elif random() < 0.5:
bracket.append(2*i)
else:
bracket.append(2*i+1)
for j in range(1,rounds):
for i in range(int(bracketSize/(2**(j+1)))):
if random()<0.5:
bracket.append(bracket[counter[j]-bracketSize+2*i])
else:
bracket.append(bracket[counter[j]-bracketSize+2*i+1])
monkeys["monkey"+str(k)] = bracket
return monkeys
def generateBots(players,elo,n,sets=3):
# helper variables
bracketSize = len(players)
rounds = math.log(bracketSize,2)
if not rounds.is_integer():
raise ValueError("bracketSize has to be 2^n")
rounds = int(rounds)
counter = [0]*(rounds+1)
for j in range(rounds):
counter[j+1] = counter[j] + int(bracketSize/(2**j))
# generate brackets based on probabilities from elo
bots = {}
for k in range(n):
bracket = []
bracket_elo = []
for i in range(int(bracketSize/2)):
if players[2*i]=="Bye":
bracket.append(2*i+1)
bracket_elo.append(elo[2*i+1])
continue
elif players[2*i+1]=="Bye":
bracket.append(2*i)
bracket_elo.append(elo[2*i])
continue
Q1 = 10**(elo[2*i]/400)
Q2 = 10**(elo[2*i+1]/400)
probability = Q1/(Q1+Q2)
if sets == 5:
probability = fiveodds_eff(probability)
if random() < probability:
bracket.append(2*i)
bracket_elo.append(elo[2*i])
else:
bracket.append(2*i+1)
bracket_elo.append(elo[2*i+1])
for j in range(1,rounds):
for i in range(int(bracketSize/(2**(j+1)))):
Q1 = 10**(bracket_elo[counter[j]-bracketSize+2*i]/400)
Q2 = 10**(bracket_elo[counter[j]-bracketSize+2*i+1]/400)
probability = Q1/(Q1+Q2)
if sets == 5:
probability = fiveodds_eff(probability)
if random() < probability:
bracket.append(bracket[counter[j]-bracketSize+2*i])
bracket_elo.append(bracket_elo[counter[j]-bracketSize+2*i])
else:
bracket.append(bracket[counter[j]-bracketSize+2*i+1])
bracket_elo.append(bracket_elo[counter[j]-bracketSize+2*i+1])
bots["bot"+str(k)] = bracket
return bots
def generateElo(players,elo):
# helper variables
bracketSize = len(players)
rounds = math.log(bracketSize,2)
if not rounds.is_integer():
raise ValueError("bracketSize has to be 2^n")
rounds = int(rounds)
counter = [0]*(rounds+1)
for j in range(rounds):
counter[j+1] = counter[j] + int(bracketSize/(2**j))
# generate brackets based on probabilities from elo
bracket = []
bracket_elo = []
for i in range(int(bracketSize/2)):
if players[2*i]=="Bye":
bracket.append(2*i+1)
bracket_elo.append(elo[2*i+1])
continue
elif players[2*i+1]=="Bye":
bracket.append(2*i)
bracket_elo.append(elo[2*i])
continue
if elo[2*i]>elo[2*i+1]:
bracket.append(2*i)
bracket_elo.append(elo[2*i])
else:
bracket.append(2*i+1)
bracket_elo.append(elo[2*i+1])
for j in range(1,rounds):
for i in range(int(bracketSize/(2**(j+1)))):
if bracket_elo[counter[j]-bracketSize+2*i]>bracket_elo[counter[j]-bracketSize+2*i+1]:
bracket.append(bracket[counter[j]-bracketSize+2*i])
bracket_elo.append(bracket_elo[counter[j]-bracketSize+2*i])
else:
bracket.append(bracket[counter[j]-bracketSize+2*i+1])
bracket_elo.append(bracket_elo[counter[j]-bracketSize+2*i+1])
return bracket
# The following function computes the probability of winning a 5 set match given the probability of winning a 3 set match.
# The elo ratings used in this package are for 3 set matches. A conversion is necessary for 5 set matches.
# This function was taken from https://github.com/JeffSackmann/tennis_misc/blob/master/fiveSetProb.py
# import numpy
# def fiveodds(p3):
# p1 = numpy.roots([-2, 3, 0, -1*p3])[1]
# p5 = (p1**3)*(4 - 3*p1 + (6*(1-p1)*(1-p1)))
# return p5
# Because it is too computationally expensive to solve the cubic equation numerically, the following does the same
# computation using the cubic formula
def fiveodds_eff(p3):
p1 = cubic_formula(-2,3,0,-p3,2).real
p5 = (p1**3)*(4 - 3*p1 + (6*(1-p1)*(1-p1)))
return p5
def cubic_formula(a,b,c,d,k):
# https://en.wikipedia.org/wiki/Cubic_equation#General_cubic_formula
delta0 = b**2 - 3*a*c
delta1 = 2*b**3 - 9*a*b*c +27*a**2*d
xi = (-1+(-3)**(1/2))/2
C = xi**k*((delta1+(delta1**2-4*delta0**3)**(1/2))/2)**(1/3)
x = -1/(3*a)*(b+C+delta0/C)
return x | 35.268293 | 122 | 0.552559 | 804 | 5,784 | 3.932836 | 0.161692 | 0.02783 | 0.020873 | 0.088552 | 0.737824 | 0.708096 | 0.698292 | 0.688488 | 0.645794 | 0.645794 | 0 | 0.050919 | 0.303942 | 5,784 | 164 | 123 | 35.268293 | 0.734476 | 0.147303 | 0 | 0.752 | 1 | 0 | 0.020757 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.04 | false | 0 | 0.016 | 0 | 0.096 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
44ba1c18f451820291edf6a378ccb81bbc5e3203 | 73 | py | Python | sfcsmCtrl/S3/__init__.py | chenhui0228/sfcsm | ef9adbc7d2ec8d97cee053678002b65ca41b804b | [
"Apache-2.0"
] | 1 | 2018-06-04T06:26:27.000Z | 2018-06-04T06:26:27.000Z | sfcsmCtrl/S3/__init__.py | chenhui0228/sfcsm | ef9adbc7d2ec8d97cee053678002b65ca41b804b | [
"Apache-2.0"
] | null | null | null | sfcsmCtrl/S3/__init__.py | chenhui0228/sfcsm | ef9adbc7d2ec8d97cee053678002b65ca41b804b | [
"Apache-2.0"
] | null | null | null | __author__ = 'alain.dechorgnat@orange.com'
import bucket
import utils
| 18.25 | 43 | 0.780822 | 9 | 73 | 5.888889 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136986 | 73 | 3 | 44 | 24.333333 | 0.84127 | 0 | 0 | 0 | 0 | 0 | 0.385714 | 0.385714 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
44c157fcb942f96b7a4190f440a3015dc9f1dbd9 | 11,950 | py | Python | fplsupercharge/protos/team_pb2.py | obarbier/fpl | 545c0e9b9307030f4683e6b2c6f4961893ade935 | [
"MIT"
] | null | null | null | fplsupercharge/protos/team_pb2.py | obarbier/fpl | 545c0e9b9307030f4683e6b2c6f4961893ade935 | [
"MIT"
] | 22 | 2020-07-10T18:01:51.000Z | 2020-08-12T23:55:31.000Z | fplsupercharge/protos/team_pb2.py | obarbier/fpl | 545c0e9b9307030f4683e6b2c6f4961893ade935 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: team.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='team.proto',
package='fpl',
syntax='proto2',
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\nteam.proto\x12\x03\x66pl\"\xb3\x03\n\x04Team\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x05\x12\x0c\n\x04\x64raw\x18\x02 \x01(\x05\x12\x0c\n\x04\x66orm\x18\x03 \x01(\x05\x12\n\n\x02id\x18\x04 \x01(\x05\x12\x0c\n\x04loss\x18\x05 \x01(\x05\x12\x0c\n\x04name\x18\x06 \x01(\t\x12\x0e\n\x06played\x18\x07 \x01(\x05\x12\x0e\n\x06points\x18\x08 \x01(\x05\x12\x10\n\x08position\x18\t \x01(\x05\x12\x12\n\nshort_name\x18\n \x01(\t\x12\x10\n\x08strength\x18\x0b \x01(\x05\x12\x15\n\rteam_division\x18\x0c \x01(\x05\x12\x13\n\x0bunavailable\x18\r \x01(\x08\x12\x0b\n\x03win\x18\x0e \x01(\x05\x12\x1d\n\x15strength_overall_home\x18\x0f \x01(\x05\x12\x1d\n\x15strength_overall_away\x18\x10 \x01(\x05\x12\x1c\n\x14strength_attack_home\x18\x11 \x01(\x05\x12\x1c\n\x14strength_attack_away\x18\x12 \x01(\x05\x12\x1d\n\x15strength_defence_home\x18\x13 \x01(\x05\x12\x1d\n\x15strength_defence_away\x18\x14 \x01(\x05\x12\x10\n\x08pulse_id\x18\x15 \x01(\x05\" \n\x05Teams\x12\x17\n\x04team\x18\x01 \x03(\x0b\x32\t.fpl.Team'
)
_TEAM = _descriptor.Descriptor(
name='Team',
full_name='fpl.Team',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='code', full_name='fpl.Team.code', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='draw', full_name='fpl.Team.draw', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='form', full_name='fpl.Team.form', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='id', full_name='fpl.Team.id', index=3,
number=4, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='loss', full_name='fpl.Team.loss', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='name', full_name='fpl.Team.name', index=5,
number=6, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='played', full_name='fpl.Team.played', index=6,
number=7, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='points', full_name='fpl.Team.points', index=7,
number=8, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='position', full_name='fpl.Team.position', index=8,
number=9, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='short_name', full_name='fpl.Team.short_name', index=9,
number=10, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='strength', full_name='fpl.Team.strength', index=10,
number=11, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='team_division', full_name='fpl.Team.team_division', index=11,
number=12, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='unavailable', full_name='fpl.Team.unavailable', index=12,
number=13, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='win', full_name='fpl.Team.win', index=13,
number=14, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='strength_overall_home', full_name='fpl.Team.strength_overall_home', index=14,
number=15, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='strength_overall_away', full_name='fpl.Team.strength_overall_away', index=15,
number=16, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='strength_attack_home', full_name='fpl.Team.strength_attack_home', index=16,
number=17, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='strength_attack_away', full_name='fpl.Team.strength_attack_away', index=17,
number=18, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='strength_defence_home', full_name='fpl.Team.strength_defence_home', index=18,
number=19, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='strength_defence_away', full_name='fpl.Team.strength_defence_away', index=19,
number=20, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='pulse_id', full_name='fpl.Team.pulse_id', index=20,
number=21, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=20,
serialized_end=455,
)
_TEAMS = _descriptor.Descriptor(
name='Teams',
full_name='fpl.Teams',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='team', full_name='fpl.Teams.team', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=457,
serialized_end=489,
)
_TEAMS.fields_by_name['team'].message_type = _TEAM
DESCRIPTOR.message_types_by_name['Team'] = _TEAM
DESCRIPTOR.message_types_by_name['Teams'] = _TEAMS
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
Team = _reflection.GeneratedProtocolMessageType('Team', (_message.Message,), {
'DESCRIPTOR' : _TEAM,
'__module__' : 'team_pb2'
# @@protoc_insertion_point(class_scope:fpl.Team)
})
_sym_db.RegisterMessage(Team)
Teams = _reflection.GeneratedProtocolMessageType('Teams', (_message.Message,), {
'DESCRIPTOR' : _TEAMS,
'__module__' : 'team_pb2'
# @@protoc_insertion_point(class_scope:fpl.Teams)
})
_sym_db.RegisterMessage(Teams)
# @@protoc_insertion_point(module_scope)
| 47.420635 | 1,016 | 0.74318 | 1,652 | 11,950 | 5.064165 | 0.103511 | 0.065025 | 0.102199 | 0.080684 | 0.764164 | 0.738943 | 0.699498 | 0.672723 | 0.668181 | 0.657184 | 0 | 0.044928 | 0.133891 | 11,950 | 251 | 1,017 | 47.609562 | 0.763382 | 0.022176 | 0 | 0.656388 | 1 | 0.004405 | 0.153036 | 0.106791 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.017621 | 0 | 0.017621 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
44d9f76f50fff2c171369aaf9abf446383490689 | 66 | py | Python | counter/database/__init__.py | V3lop5/python-starter | 96ab58b68101f6bdf278f5b4a3275b5456057300 | [
"MIT"
] | 1 | 2021-12-10T19:41:01.000Z | 2021-12-10T19:41:01.000Z | ensysmod/database/__init__.py | NOWUM/EnSysMod | 18c8a2198db3510e667c1f0298d00a3dfcb0aab7 | [
"MIT"
] | 83 | 2021-10-20T22:54:28.000Z | 2022-03-24T19:07:06.000Z | counter/database/__init__.py | V3lop5/python-starter | 96ab58b68101f6bdf278f5b4a3275b5456057300 | [
"MIT"
] | null | null | null | """
This package contains everything needed for the database.
"""
| 16.5 | 57 | 0.742424 | 8 | 66 | 6.125 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.151515 | 66 | 3 | 58 | 22 | 0.875 | 0.863636 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
44dc8c65047ccf774144382ec5a96f04600a24ae | 113 | py | Python | Models/Teacher.py | erikhalperin/Scheduler | 1c24e6a14693260b809e9600c43d3f6df476e6c8 | [
"MIT"
] | 1 | 2020-02-08T15:46:56.000Z | 2020-02-08T15:46:56.000Z | Models/Teacher.py | erikhalperin/Scheduler | 1c24e6a14693260b809e9600c43d3f6df476e6c8 | [
"MIT"
] | null | null | null | Models/Teacher.py | erikhalperin/Scheduler | 1c24e6a14693260b809e9600c43d3f6df476e6c8 | [
"MIT"
] | null | null | null | class Teacher:
def __init__(self, name, subjects):
self.name = name
self.subjects = subjects
| 22.6 | 39 | 0.628319 | 13 | 113 | 5.153846 | 0.538462 | 0.238806 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.283186 | 113 | 4 | 40 | 28.25 | 0.82716 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
44f924c16c0aa26b3ba4129e0136fb107411699a | 896 | py | Python | tests/test_ccomplex.py | urbanij/python-ccomplex | 47a805e3fb3e706a55820967040c8b2cbeb30f2c | [
"BSD-2-Clause"
] | null | null | null | tests/test_ccomplex.py | urbanij/python-ccomplex | 47a805e3fb3e706a55820967040c8b2cbeb30f2c | [
"BSD-2-Clause"
] | null | null | null | tests/test_ccomplex.py | urbanij/python-ccomplex | 47a805e3fb3e706a55820967040c8b2cbeb30f2c | [
"BSD-2-Clause"
] | null | null | null | from ccomplex.cli import main
def test_main():
assert main([]) == 0
from ccomplex import ccomplex
def test():
assert str(ccomplex(0.0 + 0j)) == '0'
assert str(ccomplex(0)) == '0'
assert str(ccomplex(12)) == '12'
assert str(ccomplex(54+32j)) == '54 + j32'
assert str(ccomplex(-32+54j)) == '-32 + j54'
assert str(ccomplex(0+4.0j)) == 'j4'
assert str(ccomplex(-2.0+0.13j)) == '-2 + j0.13'
assert str(ccomplex(-2+32.0j)) == '-2 + j32'
assert str(ccomplex(12-23.43j)) == '12 - j23.43'
assert str(ccomplex(2.0-4.1j)) == '2 - j4.1'
assert str(ccomplex(3e-6+0j)) == '3e-06'
def test_approx():
assert str(ccomplex(4/5)) == '0.8'
assert str(ccomplex(1e-12+32.2j)) == 'j32.2'
assert str(ccomplex(1e14+.22j)) == '100000000000000'
assert str(ccomplex(.32+1e-22j)) == '0.32'
| 28.903226 | 60 | 0.543527 | 133 | 896 | 3.646617 | 0.308271 | 0.278351 | 0.525773 | 0.11134 | 0.156701 | 0 | 0 | 0 | 0 | 0 | 0 | 0.168909 | 0.253348 | 896 | 30 | 61 | 29.866667 | 0.556054 | 0 | 0 | 0 | 0 | 0 | 0.102793 | 0 | 0 | 0 | 0 | 0 | 0.761905 | 1 | 0.142857 | true | 0 | 0.095238 | 0 | 0.238095 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
44ff087854b294b9b58c1f3a1ba36c7461df7dc3 | 1,309 | py | Python | test/test_reader/test_reader.py | JuAbels/CAVE | 344cf9bf6d205cfe892780cd13c94e67a5e8549c | [
"BSD-3-Clause"
] | 51 | 2019-02-01T19:43:37.000Z | 2022-03-16T09:07:03.000Z | test/test_reader/test_reader.py | JuAbels/CAVE | 344cf9bf6d205cfe892780cd13c94e67a5e8549c | [
"BSD-3-Clause"
] | 2 | 2019-02-23T18:54:22.000Z | 2019-11-09T01:30:32.000Z | test/test_reader/test_reader.py | JuAbels/CAVE | 344cf9bf6d205cfe892780cd13c94e67a5e8549c | [
"BSD-3-Clause"
] | 35 | 2019-02-08T02:00:31.000Z | 2022-03-01T23:17:00.000Z | import unittest
from cave.reader.configurator_run import ConfiguratorRun
class TestReader(unittest.TestCase):
def test_smac2_format(self):
""" test whether smac2-format is correctly interpreted """
folder = "test/test_files/test_reader/SMAC2/run-1"
ta_exec_dir = "test/test_files/test_reader/SMAC2/run-1/smac-output/aclib/state-run1/"
cr = ConfiguratorRun(folder, ta_exec_dir, file_format="SMAC2", validation_format=None)
self.assertEqual(len(cr.original_runhistory.data), 99)
self.assertEqual(len(cr.original_runhistory.get_all_configs()), 43)
self.assertIsNone(cr.validated_runhistory)
self.assertEqual(len(cr.combined_runhistory.data), 99)
self.assertEqual(len(cr.combined_runhistory.get_all_configs()), 43)
cr = ConfiguratorRun(folder, ta_exec_dir, file_format="SMAC2", validation_format="SMAC2")
self.assertEqual(len(cr.original_runhistory.data), 99)
self.assertEqual(len(cr.original_runhistory.get_all_configs()), 43)
self.assertEqual(len(cr.validated_runhistory.data), 27)
self.assertEqual(len(cr.validated_runhistory.get_all_configs()), 3)
self.assertEqual(len(cr.combined_runhistory.data), 126)
self.assertEqual(len(cr.combined_runhistory.get_all_configs()), 45)
| 50.346154 | 97 | 0.734148 | 169 | 1,309 | 5.461538 | 0.307692 | 0.162514 | 0.195016 | 0.216685 | 0.710726 | 0.708559 | 0.628386 | 0.535211 | 0.465872 | 0.355363 | 0 | 0.026906 | 0.148205 | 1,309 | 25 | 98 | 52.36 | 0.800897 | 0.038197 | 0 | 0.210526 | 0 | 0.052632 | 0.098321 | 0.086331 | 0 | 0 | 0 | 0 | 0.578947 | 1 | 0.052632 | false | 0 | 0.105263 | 0 | 0.210526 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
78010a4a0badd64698be7e32b2bae85dc26191e4 | 16,963 | py | Python | stubs.min/System/__init___parts/Environment.py | hdm-dt-fb/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | 1 | 2017-07-25T14:30:18.000Z | 2017-07-25T14:30:18.000Z | stubs.min/System/__init___parts/Environment.py | hdm-dt-fb/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | null | null | null | stubs.min/System/__init___parts/Environment.py | hdm-dt-fb/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | null | null | null | class Environment(object):
""" Provides information about,and means to manipulate,the current environment and platform. This class cannot be inherited. """
@staticmethod
def Exit(exitCode):
"""
Exit(exitCode: int)
Terminates this process and gives the underlying operating system the specified
exit code.
exitCode: Exit code to be given to the operating system.
"""
pass
@staticmethod
def ExpandEnvironmentVariables(name):
"""
ExpandEnvironmentVariables(name: str) -> str
Replaces the name of each environment variable embedded in the specified string
with the string equivalent of the value of the variable,then returns the
resulting string.
name: A string containing the names of zero or more environment variables. Each
environment variable is quoted with the percent sign character (%).
Returns: A string with each environment variable replaced by its value.
"""
pass
@staticmethod
def FailFast(message,exception=None):
"""
FailFast(message: str,exception: Exception)
Immediately terminates a process after writing a message to the Windows
Application event log,and then includes the message and exception information
in error reporting to Microsoft.
message: A message that explains why the process was terminated,or null if no
explanation is provided.
exception: An exception that represents the error that caused the termination. This is
typically the exception in a catch block.
FailFast(message: str)
Immediately terminates a process after writing a message to the Windows
Application event log,and then includes the message in error reporting to
Microsoft.
message: A message that explains why the process was terminated,or null if no
explanation is provided.
"""
pass
@staticmethod
def GetCommandLineArgs():
"""
GetCommandLineArgs() -> Array[str]
Returns a string array containing the command-line arguments for the current
process.
Returns: An array of string where each element contains a command-line argument. The
first element is the executable file name,and the following zero or more
elements contain the remaining command-line arguments.
"""
pass
@staticmethod
def GetEnvironmentVariable(variable,target=None):
"""
GetEnvironmentVariable(variable: str,target: EnvironmentVariableTarget) -> str
Retrieves the value of an environment variable from the current process or from
the Windows operating system registry key for the current user or local
machine.
variable: The name of an environment variable.
target: One of the System.EnvironmentVariableTarget values.
Returns: The value of the environment variable specified by the variable and target
parameters,or null if the environment variable is not found.
GetEnvironmentVariable(variable: str) -> str
Retrieves the value of an environment variable from the current process.
variable: The name of the environment variable.
Returns: The value of the environment variable specified by variable,or null if the
environment variable is not found.
"""
pass
@staticmethod
def GetEnvironmentVariables(target=None):
"""
GetEnvironmentVariables(target: EnvironmentVariableTarget) -> IDictionary
Retrieves all environment variable names and their values from the current
process,or from the Windows operating system registry key for the current user
or local machine.
target: One of the System.EnvironmentVariableTarget values.
Returns: A dictionary that contains all environment variable names and their values from
the source specified by the target parameter; otherwise,an empty dictionary if
no environment variables are found.
GetEnvironmentVariables() -> IDictionary
Retrieves all environment variable names and their values from the current
process.
Returns: A dictionary that contains all environment variable names and their values;
otherwise,an empty dictionary if no environment variables are found.
"""
pass
@staticmethod
def GetFolderPath(folder,option=None):
"""
GetFolderPath(folder: SpecialFolder,option: SpecialFolderOption) -> str
GetFolderPath(folder: SpecialFolder) -> str
"""
pass
@staticmethod
def GetLogicalDrives():
"""
GetLogicalDrives() -> Array[str]
Returns an array of string containing the names of the logical drives on the
current computer.
Returns: An array of strings where each element contains the name of a logical drive.
For example,if the computer's hard drive is the first logical drive,the first
element returned is "C:\".
"""
pass
@staticmethod
def SetEnvironmentVariable(variable,value,target=None):
"""
SetEnvironmentVariable(variable: str,value: str,target: EnvironmentVariableTarget)
Creates,modifies,or deletes an environment variable stored in the current
process or in the Windows operating system registry key reserved for the
current user or local machine.
variable: The name of an environment variable.
value: A value to assign to variable.
target: One of the System.EnvironmentVariableTarget values.
SetEnvironmentVariable(variable: str,value: str)
Creates,modifies,or deletes an environment variable stored in the current
process.
variable: The name of an environment variable.
value: A value to assign to variable.
"""
pass
CommandLine='"C:\\Program Files\\Autodesk\\Revit 2017\\Revit.exe" /language ENU'
CurrentDirectory='D:\\Dropbox\\Shared\\dev\\repos\\ironpython-stubs'
CurrentManagedThreadId=1
ExitCode=0
HasShutdownStarted=False
Is64BitOperatingSystem=True
Is64BitProcess=True
MachineName='STUDIO-SSD'
NewLine='\r\n'
OSVersion=None
ProcessorCount=8
SpecialFolder=None
SpecialFolderOption=None
StackTrace=' at System.Environment.GetStackTrace(Exception e,Boolean needFileInfo)\r\n at System.Environment.get_StackTrace()\r\n at Microsoft.Scripting.Interpreter.FuncCallInstruction`1.Run(InterpretedFrame frame)\r\n at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)\r\n at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0,T1 arg1,T2 arg2)\r\n at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site,T0 arg0,T1 arg1)\r\n at Microsoft.Scripting.Interpreter.FuncCallInstruction`5.Run(InterpretedFrame frame)\r\n at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)\r\n at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0,T1 arg1,T2 arg2)\r\n at IronPython.Runtime.Types.BuiltinFunction.Call0(CodeContext context,SiteLocalStorage`1 storage,Object instance)\r\n at IronPython.Runtime.Types.ReflectedProperty.CallGetter(CodeContext context,PythonType owner,SiteLocalStorage`1 storage,Object instance)\r\n at IronPython.Runtime.Types.ReflectedProperty.TryGetValue(CodeContext context,Object instance,PythonType owner,Object& value)\r\n at IronPython.Runtime.Binding.MetaPythonType.FastGetBinderHelper.SlotAccessDelegate.Target(CodeContext context,Object self,Object& result)\r\n at IronPython.Runtime.Types.TypeGetBase.RunDelegates(Object self,CodeContext context)\r\n at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site,T0 arg0,T1 arg1)\r\n at IronPython.Runtime.Types.PythonType.TryGetBoundAttr(CodeContext context,Object o,String name,Object& ret)\r\n at IronPython.Runtime.Operations.PythonOps.GetBoundAttr(CodeContext context,Object o,String name)\r\n at redo_class$768(Closure ,PythonFunction ,Object ,Object ,Object ,Object ,Object ,Object ,Object ,Object )\r\n at CallSite.Target(Closure ,CallSite ,CodeContext ,Object ,Object ,Object ,Object ,Object ,Object ,Object ,Object )\r\n at redo$749(Closure ,PythonFunction ,Object ,Object ,Object )\r\n at System.Dynamic.UpdateDelegates.UpdateAndExecute5[T0,T1,T2,T3,T4,TRet](CallSite site,T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4)\r\n at IronPython.Runtime.Method.MethodBinding`2.SelfTarget(CallSite site,CodeContext context,Object target,T0 arg0,T1 arg1)\r\n at redo_module$746(Closure ,PythonFunction ,Object ,Object ,Object ,Object )\r\n at process_one$736(Closure ,PythonFunction ,Object ,Object ,Object ,Object ,Object )\r\n at lambda_method(Closure ,Object[] ,StrongBox`1[] ,InterpretedFrame )\r\n at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)\r\n at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0)\r\n at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site,T0 arg0,T1 arg1)\r\n at Microsoft.Scripting.Interpreter.FuncCallInstruction`5.Run(InterpretedFrame frame)\r\n at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)\r\n at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0,T1 arg1,T2 arg2)\r\n at IronPython.Compiler.Ast.CallExpression.Invoke0Instruction.Run(InterpretedFrame frame)\r\n at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)\r\n at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0,T1 arg1)\r\n at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)\r\n at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)\r\n at Microsoft.Scripting.Hosting.ScriptSource.ExecuteAndWrap(ScriptScope scope,ObjectHandle& exception)\r\n at PythonConsoleControl.PythonConsole.<>c__DisplayClass56_1.<ExecuteStatements>b__0()\r\n at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback,Object args,Int32 numArgs)\r\n at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source,Delegate callback,Object args,Int32 numArgs,Delegate catchHandler)\r\n at System.Windows.Threading.DispatcherOperation.InvokeImpl()\r\n at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean preserveSyncCtx)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean preserveSyncCtx)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state)\r\n at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext,ContextCallback callback,Object state)\r\n at System.Windows.Threading.DispatcherOperation.Invoke()\r\n at System.Windows.Threading.Dispatcher.ProcessQueue()\r\n at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam,Boolean& handled)\r\n at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam,Boolean& handled)\r\n at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)\r\n at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback,Object args,Int32 numArgs)\r\n at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source,Delegate callback,Object args,Int32 numArgs,Delegate catchHandler)\r\n at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority,TimeSpan timeout,Delegate method,Object args,Int32 numArgs)\r\n at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam)\r\n at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)\r\n at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)\r\n at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)\r\n at System.Windows.Window.ShowHelper(Object booleanBox)\r\n at System.Windows.Window.ShowDialog()\r\n at RevitPythonShell.IronPythonConsoleCommand.Execute(ExternalCommandData commandData,String& message,ElementSet elements)\r\n at apiManagedExecuteCommand(AString* assemblyName,AString* className,AString* vendorDescription,MFCApp* pMFCApp,DBView* pDBView,AString* message,Set<ElementId\\,std::less<ElementId>\\,tnallc<ElementId> >* ids,Map<AString\\,AString\\,std::less<AString>\\,tnallc<std::pair<AString const \\,AString> > >* data,AString* exceptionName,AString* exceptionMessage)\r\n at RevitAPIUILinkBinder.revitAPIExecuteCommand(AString* )\r\n at RevitAPIUILinkBinder.revitAPIExecuteCommand(AString* )\r\n at UIFrameworkServices.ExternalCommandHelper.executeExternalCommand(String commandId)\r\n at UIFramework.CustomRibbonItemHandler.Execute(Object parameter)\r\n at Autodesk.Windows.InternalCommands.OnExecuteGenericCommand(Object sender,ExecutedRoutedEventArgs args)\r\n at System.Windows.Input.CommandBinding.OnExecuted(Object sender,ExecutedRoutedEventArgs e)\r\n at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender,ExecutedRoutedEventArgs e,CommandBinding commandBinding)\r\n at System.Windows.Input.CommandManager.FindCommandBinding(Object sender,RoutedEventArgs e,ICommand command,Boolean execute)\r\n at System.Windows.Input.CommandManager.OnExecuted(Object sender,ExecutedRoutedEventArgs e)\r\n at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler,Object target)\r\n at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target,RoutedEventArgs routedEventArgs)\r\n at System.Windows.EventRoute.InvokeHandlersImpl(Object source,RoutedEventArgs args,Boolean reRaised)\r\n at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender,RoutedEventArgs args)\r\n at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter,IInputElement target,Boolean userInitiated)\r\n at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource,Boolean userInitiated)\r\n at System.Windows.Controls.Primitives.ButtonBase.OnClick()\r\n at Autodesk.Private.Windows.ComboButton.OnClick()\r\n at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)\r\n at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler,Object target)\r\n at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target,RoutedEventArgs routedEventArgs)\r\n at System.Windows.EventRoute.InvokeHandlersImpl(Object source,RoutedEventArgs args,Boolean reRaised)\r\n at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender,RoutedEventArgs args,RoutedEvent newEvent)\r\n at System.Windows.UIElement.OnMouseUpThunk(Object sender,MouseButtonEventArgs e)\r\n at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler,Object target)\r\n at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target,RoutedEventArgs routedEventArgs)\r\n at System.Windows.EventRoute.InvokeHandlersImpl(Object source,RoutedEventArgs args,Boolean reRaised)\r\n at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender,RoutedEventArgs args)\r\n at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)\r\n at System.Windows.Input.InputManager.ProcessStagingArea()\r\n at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)\r\n at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)\r\n at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd,InputMode mode,Int32 timestamp,RawMouseActions actions,Int32 x,Int32 y,Int32 wheel)\r\n at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd,WindowMessage msg,IntPtr wParam,IntPtr lParam,Boolean& handled)\r\n at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam,Boolean& handled)\r\n at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam,Boolean& handled)\r\n at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)\r\n at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback,Object args,Int32 numArgs)\r\n at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source,Delegate callback,Object args,Int32 numArgs,Delegate catchHandler)\r\n at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority,TimeSpan timeout,Delegate method,Object args,Int32 numArgs)\r\n at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam)'
SystemDirectory='C:\\WINDOWS\\system32'
SystemPageSize=4096
TickCount=10105453
UserDomainName='STUDIO-SSD'
UserInteractive=True
UserName='gtalarico'
Version=None
WorkingSet=None
__all__=[
'Exit',
'ExpandEnvironmentVariables',
'FailFast',
'GetCommandLineArgs',
'GetEnvironmentVariable',
'GetEnvironmentVariables',
'GetFolderPath',
'GetLogicalDrives',
'SetEnvironmentVariable',
'SpecialFolder',
'SpecialFolderOption',
]
| 87.891192 | 10,350 | 0.788363 | 2,074 | 16,963 | 6.441176 | 0.216972 | 0.015121 | 0.029942 | 0.037428 | 0.607231 | 0.58178 | 0.552511 | 0.50131 | 0.470095 | 0.447863 | 0 | 0.012435 | 0.12769 | 16,963 | 192 | 10,351 | 88.348958 | 0.890383 | 0.275836 | 0 | 0.285714 | 0 | 0.015873 | 0.906993 | 0.580363 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0.142857 | 0 | 0 | 0.52381 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
7899c80113092a0e3094b969140ea900f7fffa20 | 239 | py | Python | pipetorch/train/__init__.py | jeroenvuurens/pipetorch | 92250df3f6ad1b409dfb32d492130029c076150b | [
"MIT"
] | null | null | null | pipetorch/train/__init__.py | jeroenvuurens/pipetorch | 92250df3f6ad1b409dfb32d492130029c076150b | [
"MIT"
] | null | null | null | pipetorch/train/__init__.py | jeroenvuurens/pipetorch | 92250df3f6ad1b409dfb32d492130029c076150b | [
"MIT"
] | null | null | null | from .trainer import trainer, to_numpy
import torch
from torch import nn
from torch.optim import *
from torch.optim.lr_scheduler import *
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.metrics import *
| 23.9 | 38 | 0.811715 | 39 | 239 | 4.923077 | 0.487179 | 0.140625 | 0.145833 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146444 | 239 | 9 | 39 | 26.555556 | 0.941176 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
78a393cee84a0dc636449ef4ef75c1b313105497 | 129 | py | Python | manticore_django/admin.py | yeti/manticore-django | 2bbbe6bc933e9ed6d7ebd9a4582f60f9ca4f104b | [
"MIT"
] | 2 | 2020-04-19T11:11:41.000Z | 2020-04-19T11:11:44.000Z | manticore_django/admin.py | yeti/manticore-django | 2bbbe6bc933e9ed6d7ebd9a4582f60f9ca4f104b | [
"MIT"
] | 3 | 2015-11-13T18:38:33.000Z | 2017-03-23T16:46:45.000Z | manticore_django/admin.py | yeti/manticore-django | 2bbbe6bc933e9ed6d7ebd9a4582f60f9ca4f104b | [
"MIT"
] | 4 | 2015-12-07T18:52:43.000Z | 2017-03-23T00:03:57.000Z | from django.contrib import admin
class MediaAdmin(admin.ModelAdmin):
list_display = ('type', 'original_file', 'thumbnail')
| 21.5 | 57 | 0.744186 | 15 | 129 | 6.266667 | 0.933333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131783 | 129 | 5 | 58 | 25.8 | 0.839286 | 0 | 0 | 0 | 0 | 0 | 0.20155 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
155a2bd36c8641283f8b9bc4db82ad515d679580 | 96 | py | Python | kymatio/scattering3d/__init__.py | GReguig/kymatio | e0fc10057f5f8bb947068bc40afff8d3d3729052 | [
"BSD-3-Clause"
] | 516 | 2018-11-18T06:11:16.000Z | 2022-03-21T22:35:06.000Z | kymatio/scattering3d/__init__.py | GReguig/kymatio | e0fc10057f5f8bb947068bc40afff8d3d3729052 | [
"BSD-3-Clause"
] | 558 | 2018-11-19T22:21:12.000Z | 2022-03-28T14:59:15.000Z | kymatio/scattering3d/__init__.py | GReguig/kymatio | e0fc10057f5f8bb947068bc40afff8d3d3729052 | [
"BSD-3-Clause"
] | 119 | 2018-11-18T06:05:39.000Z | 2022-03-26T06:59:37.000Z | from .frontend.entry import HarmonicScatteringEntry3D
__all__ = ['HarmonicScatteringEntry3D']
| 19.2 | 53 | 0.833333 | 7 | 96 | 10.857143 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022989 | 0.09375 | 96 | 4 | 54 | 24 | 0.850575 | 0 | 0 | 0 | 0 | 0 | 0.260417 | 0.260417 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
157db40b02c45a987bb88156613d257b7a32be02 | 314 | py | Python | api/routers/chat.py | oil-rope/oil-and-rope | 6d59c87d4809f120417a90c1624952085486bb06 | [
"MIT"
] | 8 | 2019-08-27T20:08:22.000Z | 2021-07-23T22:49:47.000Z | api/routers/chat.py | oil-rope/oil-and-rope | 6d59c87d4809f120417a90c1624952085486bb06 | [
"MIT"
] | 73 | 2020-03-11T18:07:29.000Z | 2022-03-28T18:07:47.000Z | api/routers/chat.py | oil-rope/oil-and-rope | 6d59c87d4809f120417a90c1624952085486bb06 | [
"MIT"
] | 4 | 2020-02-22T19:44:17.000Z | 2022-03-08T09:42:45.000Z | from ..viewsets.chat import ChatMessageViewSet, ChatViewSet
from .routers import OilAndRopeDefaultRouter
router = OilAndRopeDefaultRouter()
router.register(prefix=r'chat', viewset=ChatViewSet, basename='chat')
router.register(prefix=r'message', viewset=ChatMessageViewSet, basename='message')
urls = router.urls
| 34.888889 | 82 | 0.818471 | 33 | 314 | 7.787879 | 0.484848 | 0.225681 | 0.155642 | 0.163424 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.073248 | 314 | 8 | 83 | 39.25 | 0.883162 | 0 | 0 | 0 | 0 | 0 | 0.070064 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
157f22eaf7147e1fbac76a80e4f2afd2da7d48d4 | 100 | py | Python | projects/world/main.py | moreal/appengine-routing-test | f53f69526a6413a575423ca51bc9a399bb6d1ee4 | [
"MIT"
] | 2 | 2019-04-08T10:03:39.000Z | 2019-04-08T10:19:07.000Z | projects/world/main.py | moreal/appengine-routing-test | f53f69526a6413a575423ca51bc9a399bb6d1ee4 | [
"MIT"
] | 2 | 2019-04-08T22:48:01.000Z | 2019-04-13T11:10:23.000Z | projects/world/main.py | moreal/appengine-routing-test | f53f69526a6413a575423ca51bc9a399bb6d1ee4 | [
"MIT"
] | null | null | null | from flask import Flask
app = Flask(__name__)
@app.route('/world')
def world():
return "world" | 14.285714 | 23 | 0.68 | 14 | 100 | 4.571429 | 0.642857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.17 | 100 | 7 | 24 | 14.285714 | 0.771084 | 0 | 0 | 0 | 0 | 0 | 0.108911 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0.2 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
15b30cb6e5766cf32fbbd65bc3cb98758651cc83 | 57 | py | Python | bidwire/notifiers/__init__.py | RagtagOpen/bidwire | 0de7ee2dce87127f69e0c4bdc2c7b080cd1d4a45 | [
"MIT"
] | 5 | 2017-04-14T22:55:42.000Z | 2020-02-16T19:35:11.000Z | bidwire/scrapers/__init__.py | RagtagOpen/bidwire | 0de7ee2dce87127f69e0c4bdc2c7b080cd1d4a45 | [
"MIT"
] | 15 | 2017-04-02T21:46:10.000Z | 2018-07-26T04:39:14.000Z | bidwire/scrapers/__init__.py | RagtagOpen/bidwire | 0de7ee2dce87127f69e0c4bdc2c7b080cd1d4a45 | [
"MIT"
] | 7 | 2017-04-07T01:10:43.000Z | 2018-02-22T00:00:30.000Z | # Intentionally left empty to set this as Python package
| 28.5 | 56 | 0.807018 | 9 | 57 | 5.111111 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.175439 | 57 | 1 | 57 | 57 | 0.978723 | 0.947368 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
ec7422bcb2f93eb8f2e5437750f603dd74931d81 | 851 | py | Python | setup.py | pR0Ps/pelican-yaml-metadata | cdc1b9708916410e455e8e258e3d39a9d575c7b5 | [
"MIT"
] | 3 | 2019-02-26T07:49:29.000Z | 2022-02-10T11:58:21.000Z | setup.py | pR0Ps/pelican-yaml-metadata | cdc1b9708916410e455e8e258e3d39a9d575c7b5 | [
"MIT"
] | 3 | 2017-08-21T03:47:18.000Z | 2021-06-08T03:16:17.000Z | setup.py | pR0Ps/pelican-yaml-metadata | cdc1b9708916410e455e8e258e3d39a9d575c7b5 | [
"MIT"
] | 5 | 2017-08-01T15:21:15.000Z | 2021-12-10T16:32:20.000Z | #!/usr/bin/env python
from setuptools import setup
setup(
name="pelican-yaml-metadata",
version="2.0.0",
description="A Pelican plugin that parses metadata from YAML headers in markdown files",
url="https://github.com/pR0Ps/pelican-yaml-metadata",
license="MIT",
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Framework :: Pelican",
"Framework :: Pelican :: Plugins",
"Operating System :: OS Independent",
],
packages=["pelican.plugins.yaml_metadata"],
install_requires=[
"pelican>=4.5,<5.0.0",
"markdown>=3.3.4,<4.0.0",
"pyYAML>=5.4.1,<6.0.0",
],
)
| 30.392857 | 92 | 0.591069 | 101 | 851 | 4.960396 | 0.514851 | 0.189621 | 0.249501 | 0.259481 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04644 | 0.240893 | 851 | 27 | 93 | 31.518519 | 0.729102 | 0.023502 | 0 | 0.083333 | 0 | 0 | 0.609639 | 0.086747 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.041667 | 0 | 0.041667 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
eca00db2f24dead3473346a46d2994836afff30d | 176 | py | Python | Aulas/Aula 06b.py | Henrique-Sc/cursoemvideo-python | 65768bf1b4a3ee4f720d2e8e446d358e750e95cf | [
"MIT"
] | null | null | null | Aulas/Aula 06b.py | Henrique-Sc/cursoemvideo-python | 65768bf1b4a3ee4f720d2e8e446d358e750e95cf | [
"MIT"
] | null | null | null | Aulas/Aula 06b.py | Henrique-Sc/cursoemvideo-python | 65768bf1b4a3ee4f720d2e8e446d358e750e95cf | [
"MIT"
] | null | null | null | a = input('Digite algo: ')
print('Só é composto por números?', a.isnumeric())
print('Só é composto por letras?', a.isalpha())
print('Só contém letras e números?', a.isalnum())
| 35.2 | 50 | 0.681818 | 28 | 176 | 4.285714 | 0.571429 | 0.175 | 0.133333 | 0.266667 | 0.316667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130682 | 176 | 4 | 51 | 44 | 0.784314 | 0 | 0 | 0 | 0 | 0 | 0.517045 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.75 | 1 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
ecd5295a8ea9a7370778e666dc3186472ac4da58 | 112 | py | Python | mldm/common/__init__.py | huangjianqin/mldm | 65605e44cba632ce7726b8027166c9860cd8651e | [
"Apache-2.0"
] | null | null | null | mldm/common/__init__.py | huangjianqin/mldm | 65605e44cba632ce7726b8027166c9860cd8651e | [
"Apache-2.0"
] | null | null | null | mldm/common/__init__.py | huangjianqin/mldm | 65605e44cba632ce7726b8027166c9860cd8651e | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created on 2017/9/3 21:35
# Project: mldm
# Author: huangjianqin | 22.4 | 27 | 0.651786 | 18 | 112 | 4.055556 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115789 | 0.151786 | 112 | 5 | 28 | 22.4 | 0.652632 | 0.919643 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
ecea7822d6c21d03b88fdca414ab2436601ffd2c | 1,249 | py | Python | alpyro_msgs/sensor_msgs/imu.py | rho2/alpyro_msgs | b5a680976c40c83df70d61bb2db1de32a1cde8d3 | [
"MIT"
] | 1 | 2020-12-13T13:07:10.000Z | 2020-12-13T13:07:10.000Z | alpyro_msgs/sensor_msgs/imu.py | rho2/alpyro_msgs | b5a680976c40c83df70d61bb2db1de32a1cde8d3 | [
"MIT"
] | null | null | null | alpyro_msgs/sensor_msgs/imu.py | rho2/alpyro_msgs | b5a680976c40c83df70d61bb2db1de32a1cde8d3 | [
"MIT"
] | null | null | null | from typing import List
from typing_extensions import Annotated
from alpyro_msgs import RosMessage, float64
from alpyro_msgs.geometry_msgs.quaternion import Quaternion
from alpyro_msgs.geometry_msgs.vector3 import Vector3
from alpyro_msgs.std_msgs.header import Header
class Imu(RosMessage):
__msg_typ__ = "sensor_msgs/Imu"
__msg_def__ = "c3RkX21zZ3MvSGVhZGVyIGhlYWRlcgogIHVpbnQzMiBzZXEKICB0aW1lIHN0YW1wCiAgc3RyaW5nIGZyYW1lX2lkCmdlb21ldHJ5X21zZ3MvUXVhdGVybmlvbiBvcmllbnRhdGlvbgogIGZsb2F0NjQgeAogIGZsb2F0NjQgeQogIGZsb2F0NjQgegogIGZsb2F0NjQgdwpmbG9hdDY0WzldIG9yaWVudGF0aW9uX2NvdmFyaWFuY2UKZ2VvbWV0cnlfbXNncy9WZWN0b3IzIGFuZ3VsYXJfdmVsb2NpdHkKICBmbG9hdDY0IHgKICBmbG9hdDY0IHkKICBmbG9hdDY0IHoKZmxvYXQ2NFs5XSBhbmd1bGFyX3ZlbG9jaXR5X2NvdmFyaWFuY2UKZ2VvbWV0cnlfbXNncy9WZWN0b3IzIGxpbmVhcl9hY2NlbGVyYXRpb24KICBmbG9hdDY0IHgKICBmbG9hdDY0IHkKICBmbG9hdDY0IHoKZmxvYXQ2NFs5XSBsaW5lYXJfYWNjZWxlcmF0aW9uX2NvdmFyaWFuY2UKCg=="
__md5_sum__ = "6a62c6daae103f4ff57a132d6f95cec2"
header: Header
orientation: Quaternion
orientation_covariance: Annotated[List[float64], 9, 0]
angular_velocity: Vector3
angular_velocity_covariance: Annotated[List[float64], 9, 0]
linear_acceleration: Vector3
linear_acceleration_covariance: Annotated[List[float64], 9, 0]
| 59.47619 | 582 | 0.899119 | 86 | 1,249 | 12.697674 | 0.383721 | 0.03663 | 0.051282 | 0.082418 | 0.135531 | 0.087912 | 0 | 0 | 0 | 0 | 0 | 0.095727 | 0.063251 | 1,249 | 20 | 583 | 62.45 | 0.837607 | 0 | 0 | 0 | 0 | 0 | 0.489191 | 0.477182 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.352941 | 0 | 1 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
01ac7a0873af3fa8a68d1e874ee6b5c0867f7795 | 1,978 | py | Python | tests/test_data_formats.py | theartofcleancode/cfbanking | fb4fdbb61206eb4596c4319a20fca689a6c9c365 | [
"MIT"
] | null | null | null | tests/test_data_formats.py | theartofcleancode/cfbanking | fb4fdbb61206eb4596c4319a20fca689a6c9c365 | [
"MIT"
] | null | null | null | tests/test_data_formats.py | theartofcleancode/cfbanking | fb4fdbb61206eb4596c4319a20fca689a6c9c365 | [
"MIT"
] | null | null | null | import unittest
import pythonapi as api
class TestReqestClientData(unittest.TestCase):
def test_read_client(self):
data = (('firstname', 'moctar'),
('lastname', 'diallo'),
('address', 'plateau'),
('balance', '8000'))
req = api.TupleRequest(data)
self.assertEqual(req.data, {
'firstname': 'moctar',
'lastname': 'diallo',
'address': 'plateau',
'balance': '8000'
})
def test_read_client_for_user(self):
data = (('client',
(('firstname', 'moctar'),
('lastname', 'diallo'),
('address', 'medina'),
('balance', '8000'))),)
req = api.TupleRequest(data)
self.assertEqual(req.data, {
'client': {
'firstname': 'moctar',
'lastname': 'diallo',
'address': 'medina',
'balance': '8000'
}
})
class TestReqestAccountData(unittest.TestCase):
def test_account(self):
data = (('action', 'deposit'),
('account', (
('client', (
('firstname', 'moctar'),
('lastname', 'diallo'),
('address', 'medina'),
('balance', '80000'))
),
('code', '4455'),
('amount', '5000'))
))
req = api.TupleRequest(data)
self.assertEqual(req.data, {
'action': 'deposit',
'account': {
'client': {
'firstname': 'moctar',
'lastname': 'diallo',
'address': 'medina',
'balance': '80000'
},
'code': '4455',
'amount': '5000'
}
})
if __name__ == '__main__':
unittest.main() | 30.90625 | 50 | 0.397877 | 128 | 1,978 | 6.03125 | 0.3125 | 0.11658 | 0.178756 | 0.225389 | 0.733161 | 0.733161 | 0.733161 | 0.733161 | 0.681347 | 0.550518 | 0 | 0.038356 | 0.446411 | 1,978 | 64 | 51 | 30.90625 | 0.666667 | 0 | 0 | 0.440678 | 0 | 0 | 0.217281 | 0 | 0 | 0 | 0 | 0 | 0.050847 | 1 | 0.050847 | false | 0 | 0.033898 | 0 | 0.118644 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
01b4c0a07317cd4857c209e7329b12b21d66d8d7 | 289 | py | Python | tsutils/__init__.py | RheingoldRiver/tsutils | e9727c65cdb5d712de93825b47fa4881d07eb50a | [
"MIT"
] | null | null | null | tsutils/__init__.py | RheingoldRiver/tsutils | e9727c65cdb5d712de93825b47fa4881d07eb50a | [
"MIT"
] | null | null | null | tsutils/__init__.py | RheingoldRiver/tsutils | e9727c65cdb5d712de93825b47fa4881d07eb50a | [
"MIT"
] | null | null | null | from .cog_settings import *
from .emoji import *
from .formatting import *
from .helper_classes import *
from .helper_functions import *
from .json_utils import *
from .old_menu import *
from .menu.footers import *
from .pad import *
from .tsubaki import *
from .user_interaction import *
| 24.083333 | 31 | 0.768166 | 40 | 289 | 5.4 | 0.45 | 0.462963 | 0.148148 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152249 | 289 | 11 | 32 | 26.272727 | 0.881633 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
01b6d5b38fd4390e44c22df501ce3e324fd4307e | 76 | py | Python | flask-forum.py | fxa90id/up-flask-forum | 1652aab2be7ac42a86c6ddb6ae8b2cde9e1b5ce6 | [
"BSD-3-Clause"
] | null | null | null | flask-forum.py | fxa90id/up-flask-forum | 1652aab2be7ac42a86c6ddb6ae8b2cde9e1b5ce6 | [
"BSD-3-Clause"
] | 1 | 2015-01-18T12:26:27.000Z | 2015-01-18T12:26:27.000Z | flask-forum.py | fxa90id/up-flask-forum | 1652aab2be7ac42a86c6ddb6ae8b2cde9e1b5ce6 | [
"BSD-3-Clause"
] | null | null | null |
if __name__ == '__main__':
from views import *
app.run(debug=True)
| 15.2 | 26 | 0.631579 | 10 | 76 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.236842 | 76 | 4 | 27 | 19 | 0.689655 | 0 | 0 | 0 | 0 | 0 | 0.106667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
01c3673db69d8eb8dd752f13f30796cebc71e570 | 219 | py | Python | accounts/models.py | frankmaina/django2fa | a878c88096f79b851e24d9f296776010e0e68f79 | [
"MIT"
] | 2 | 2015-10-12T14:23:35.000Z | 2020-08-25T08:46:37.000Z | accounts/models.py | frankmaina/django2fa | a878c88096f79b851e24d9f296776010e0e68f79 | [
"MIT"
] | null | null | null | accounts/models.py | frankmaina/django2fa | a878c88096f79b851e24d9f296776010e0e68f79 | [
"MIT"
] | null | null | null | from django.db import models
from django.forms import ModelForm
from django.contrib.auth.models import User
class UserProfile(models.Model):
user = models.ForeignKey(User)
phone_number = models.IntegerField()
| 24.333333 | 43 | 0.785388 | 29 | 219 | 5.896552 | 0.586207 | 0.175439 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136986 | 219 | 8 | 44 | 27.375 | 0.904762 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
01ef58494abf6507dc7e5084df3080b5e4fdfc89 | 158 | py | Python | optional_programming.py | BjornChrisnach/Python_6hour_course | 0949387c2e423ed0ba7914db7c58af2f913bda1c | [
"MIT"
] | null | null | null | optional_programming.py | BjornChrisnach/Python_6hour_course | 0949387c2e423ed0ba7914db7c58af2f913bda1c | [
"MIT"
] | null | null | null | optional_programming.py | BjornChrisnach/Python_6hour_course | 0949387c2e423ed0ba7914db7c58af2f913bda1c | [
"MIT"
] | null | null | null | # optional programming
def func(x=3, text="2"):
print(x)
if text == "1":
print("Text is 1")
else:
print("Text is not 1")
func()
| 14.363636 | 30 | 0.512658 | 24 | 158 | 3.375 | 0.583333 | 0.222222 | 0.271605 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.046296 | 0.316456 | 158 | 10 | 31 | 15.8 | 0.703704 | 0.126582 | 0 | 0 | 0 | 0 | 0.176471 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0 | 0.142857 | 0.428571 | 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 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
bf153ebc3a5aa1cc42e63bceb54815d4480af087 | 4,224 | py | Python | instabot/bot/bot_support.py | xleatz/instabottr | 9e8167a9bf9e7aab0ee821b4b7b05db8f8cb34d3 | [
"Apache-2.0"
] | null | null | null | instabot/bot/bot_support.py | xleatz/instabottr | 9e8167a9bf9e7aab0ee821b4b7b05db8f8cb34d3 | [
"Apache-2.0"
] | null | null | null | instabot/bot/bot_support.py | xleatz/instabottr | 9e8167a9bf9e7aab0ee821b4b7b05db8f8cb34d3 | [
"Apache-2.0"
] | null | null | null | """
Support instabot's methods.
"""
from __future__ import unicode_literals
import codecs
import os
import re
import sys
import huepy
def check_if_file_exists(file_path, quiet=False):
if not os.path.exists(file_path):
if not quiet:
print("Can't find '%s' file." % file_path)
return False
return True
def read_list_from_file(file_path, quiet=False):
"""
Reads list from file. One line - one item.
Returns the list if file items.
"""
try:
if not check_if_file_exists(file_path, quiet=quiet):
return []
with codecs.open(file_path, "r", encoding="utf-8") as f:
content = f.readlines()
if sys.version_info[0] < 3:
content = [str(item.encode("utf8")) for item in content]
content = [item.strip() for item in content]
return [i for i in content if i]
except Exception as exception:
print(str(exception))
return []
def console_print(self, text, color=None):
if self.verbosity:
text = "\n" + text
if color is not None:
text = getattr(huepy, color)(text)
print(text)
def extract_urls(text):
url_regex = r"((?:(?:http|https|Http|Https|rtsp|Rtsp)://(?:(?:[a-zA-Z0-9$\-\_\.\+\!\*\'\(\)\,\;\?\&\=]|(?:%[a-fA-F0-9]{2})){1,64}(?::(?:[a-zA-Z0-9$\-\_\.\+\!\*\'\(\)\,\;\?\&\=]|(?:%[a-fA-F0-9]{2})){1,25})?@)?)?(?:(?:(?:[a-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\_][a-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\_\-]{0,64}\.)+(?:(?:aero|arpa|asia|a[cdefgilmnoqrstuwxz])|(?:biz|b[abdefghijmnorstvwyz])|(?:cat|com|coop|c[acdfghiklmnoruvxyz])|d[ejkmoz]|(?:edu|e[cegrstu])|f[ijkmor]|(?:gov|g[abdefghilmnpqrstuwy])|h[kmnrtu]|(?:info|int|i[delmnoqrst])|(?:jobs|j[emop])|k[eghimnprwyz]|l[abcikrstuvy]|(?:mil|mobi|museum|m[acdeghklmnopqrstuvwxyz])|(?:name|net|n[acefgilopruz])|(?:org|om)|(?:pro|p[aefghklmnrstwy])|qa|r[eosuw]|s[abcdeghijklmnortuvyz]|(?:tel|travel|t[cdfghjklmnoprtvwz])|u[agksyz]|v[aceginu]|w[fs]|(?:\u03B4\u03BF\u03BA\u03B9\u03BC\u03AE|\u0438\u0441\u043F\u044B\u0442\u0430\u043D\u0438\u0435|\u0440\u0444|\u0441\u0440\u0431|\u05D8\u05E2\u05E1\u05D8|\u0622\u0632\u0645\u0627\u06CC\u0634\u06CC|\u0625\u062E\u062A\u0628\u0627\u0631|\u0627\u0644\u0627\u0631\u062F\u0646|\u0627\u0644\u062C\u0632\u0627\u0626\u0631|\u0627\u0644\u0633\u0639\u0648\u062F\u064A\u0629|\u0627\u0644\u0645\u063A\u0631\u0628|\u0627\u0645\u0627\u0631\u0627\u062A|\u0628\u06BE\u0627\u0631\u062A|\u062A\u0648\u0646\u0633|\u0633\u0648\u0631\u064A\u0629|\u0641\u0644\u0633\u0637\u064A\u0646|\u0642\u0637\u0631|\u0645\u0635\u0631|\u092A\u0930\u0940\u0915\u094D\u0937\u093E|\u092D\u093E\u0930\u0924|\u09AD\u09BE\u09B0\u09A4|\u0A2D\u0A3E\u0A30\u0A24|\u0AAD\u0ABE\u0AB0\u0AA4|\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE|\u0B87\u0BB2\u0B99\u0BCD\u0B95\u0BC8|\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD|\u0BAA\u0BB0\u0BBF\u0B9F\u0BCD\u0B9A\u0BC8|\u0C2D\u0C3E\u0C30\u0C24\u0C4D|\u0DBD\u0D82\u0D9A\u0DCF|\u0E44\u0E17\u0E22|\u30C6\u30B9\u30C8|\u4E2D\u56FD|\u4E2D\u570B|\u53F0\u6E7E|\u53F0\u7063|\u65B0\u52A0\u5761|\u6D4B\u8BD5|\u6E2C\u8A66|\u9999\u6E2F|\uD14C\uC2A4\uD2B8|\uD55C\uAD6D|xn--0zwm56d|xn--11b5bs3a9aj6g|xn--3e0b707e|xn--45brj9c|xn--80akhbyknj4f|xn--90a3ac|xn--9t4b11yi5a|xn--clchc0ea0b2g2a9gcd|xn--deba0ad|xn--fiqs8s|xn--fiqz9s|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--g6w251d|xn--gecrj9c|xn--h2brj9c|xn--hgbk6aj7f53bba|xn--hlcj6aya9esc7a|xn--j6w193g|xn--jxalpdlp|xn--kgbechtv|xn--kprw13d|xn--kpry57d|xn--lgbbat1ad8j|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbbh1a71e|xn--mgbc0a9azcg|xn--mgberp4a5d4ar|xn--o3cw4h|xn--ogbpf8fl|xn--p1ai|xn--pgbs0dh|xn--s9brj9c|xn--wgbh1c|xn--wgbl6a|xn--xkc2al3hye2a|xn--xkc2dl3a5ee0h|xn--yfro4i67o|xn--ygbi2ammx|xn--zckzah|xxx)|y[et]|z[amw]))|(?:(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9])))(?::\d{1,5})?(?:/(?:(?:[a-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\;\/\?\:\@\&\=\#\~\-\.\+\!\*\'\(\)\,\_])|(?:%[a-fA-F0-9]{2}))*)?)(?:\b|$)" # noqa
urls = re.findall(url_regex, text)
return urls
| 76.8 | 2,955 | 0.657197 | 664 | 4,224 | 4.135542 | 0.483434 | 0.009468 | 0.006555 | 0.010925 | 0.103059 | 0.100874 | 0.100874 | 0.079024 | 0.079024 | 0.079024 | 0 | 0.207346 | 0.091146 | 4,224 | 54 | 2,956 | 78.222222 | 0.507945 | 0.025568 | 0 | 0.057143 | 0 | 0.028571 | 0.726515 | 0.71842 | 0 | 0 | 0 | 0 | 0 | 1 | 0.114286 | false | 0 | 0.171429 | 0 | 0.457143 | 0.114286 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
bf27c00fca6f9edc38016fe24bd5852689ddfdc9 | 19,834 | py | Python | tests/tests/test_database_lookups.py | Aristotle-Metadata-Enterprises/django-garne | c8166d1146c078091edfd487a57706a279de7b63 | [
"BSD-3-Clause"
] | 62 | 2021-08-10T00:16:55.000Z | 2022-03-28T01:10:13.000Z | tests/tests/test_database_lookups.py | Aristotle-Metadata-Enterprises/django-garne | c8166d1146c078091edfd487a57706a279de7b63 | [
"BSD-3-Clause"
] | 33 | 2021-01-02T01:25:15.000Z | 2022-03-31T04:23:53.000Z | tests/tests/test_database_lookups.py | Aristotle-Metadata-Enterprises/django-garne | c8166d1146c078091edfd487a57706a279de7b63 | [
"BSD-3-Clause"
] | 2 | 2020-10-12T05:20:21.000Z | 2022-02-28T13:55:23.000Z | from django.db import connection
from django.db.models.functions import Lower
from django.test import TestCase
from garnett.expressions import L
from garnett.patch import apply_patches, revert_patches
from unittest import skipIf, skipUnless
from garnett.context import set_field_language
from library_app.models import Book
class TestLanguageLookups(TestCase):
@set_field_language("en")
def setUp(self):
self.book_data = dict(
title={
"en": "A good book",
"de": "Eine gut buch",
},
author="I. M. Nice",
description="A book on how to be good, and stuff",
category={"dewey": 222},
number_of_pages=100,
)
Book.objects.create(**self.book_data)
def test_HasLang(self):
books = Book.objects.all()
self.assertTrue(books.filter(title__has_lang="en").exists())
self.assertTrue(books.filter(title__has_lang="de").exists())
self.assertFalse(books.filter(title__has_lang="fr").exists())
def test_HasLangs(self):
books = Book.objects.all()
self.assertTrue(books.filter(title__has_langs=["en", "de"]).exists())
self.assertTrue(books.filter(title__has_langs=["de"]).exists())
self.assertTrue(books.filter(title__has_langs=["en"]).exists())
self.assertFalse(books.filter(title__has_langs=["en", "de", "fr"]).exists())
self.assertFalse(books.filter(title__has_langs=["en", "fr"]).exists())
self.assertFalse(books.filter(title__has_langs=["fr"]).exists())
class TestLookups(TestCase):
@set_field_language("en")
def setUp(self):
self.book_data = dict(
title={
"en": "A good book",
"de": "Eine gut buch",
},
author="I. M. Nice",
description="A book on how to be good, and stuff",
category={"dewey": 222},
number_of_pages=100,
)
Book.objects.create(**self.book_data)
@skipIf(connection.vendor == "mysql", "MariaDB uses case insensitive matching here")
def test_exact(self):
books = Book.objects.all()
with set_field_language("en"):
self.assertTrue(
books.filter(title__en=self.book_data["title"]["en"]).exists()
)
self.assertTrue(books.filter(title=self.book_data["title"]["en"]).exists())
self.assertFalse(books.filter(title=self.book_data["title"]["de"]).exists())
# An inexact match won't be returned as true
self.assertFalse(
books.filter(title=self.book_data["title"]["en"].upper()).exists()
)
self.assertFalse(books.filter(title="A GOoD bOoK").exists())
with set_field_language("de"):
self.assertFalse(books.filter(title=self.book_data["title"]["en"]).exists())
self.assertTrue(books.filter(title=self.book_data["title"]["de"]).exists())
@skipUnless(connection.vendor == "mysql", "Provide some coverage for MariaDB")
def test_exact_mysql(self):
books = Book.objects.all()
with set_field_language("en"):
self.assertTrue(books.filter(title=self.book_data["title"]["en"]).exists())
self.assertFalse(books.filter(title=self.book_data["title"]["de"]).exists())
# An inexact match shouldn't be returned as true, but is
# We have this test so if this changes we will know.
self.assertTrue(
books.filter(title=self.book_data["title"]["en"].upper()).exists()
)
with set_field_language("de"):
self.assertFalse(books.filter(title=self.book_data["title"]["en"]).exists())
self.assertTrue(books.filter(title=self.book_data["title"]["de"]).exists())
def test_iexact(self):
books = Book.objects.all()
with set_field_language("en"):
self.assertTrue(
books.filter(
title__iexact=self.book_data["title"]["en"].upper()
).exists()
)
self.assertFalse(
books.filter(
title__iexact=self.book_data["title"]["de"].upper()
).exists()
)
with set_field_language("de"):
self.assertFalse(
books.filter(
title__iexact=self.book_data["title"]["en"].upper()
).exists()
)
self.assertTrue(
books.filter(
title__iexact=self.book_data["title"]["de"].upper()
).exists()
)
@skipIf(connection.vendor == "sqlite", "SQLite uses case insensitive matching")
def test_contains(self):
books = Book.objects.all()
with set_field_language("en"):
self.assertTrue(books.filter(title__contains="good").exists())
self.assertFalse(books.filter(title__contains="gut").exists())
# An inexact match shouldn't be returned
# But it is. This isn't a deal breaker right now :/
self.assertFalse(books.filter(title__contains="GOOD").exists())
self.assertFalse(books.filter(title__contains="GUT").exists())
with set_field_language("de"):
self.assertFalse(books.filter(title__contains="good").exists())
self.assertTrue(books.filter(title__contains="gut").exists())
@skipUnless(connection.vendor == "sqlite", "Provide some coverage for SQLite")
def test_contains_sqlite(self):
books = Book.objects.all()
with set_field_language("en"):
self.assertTrue(books.filter(title__contains="good").exists())
self.assertFalse(books.filter(title__contains="gut").exists())
# An inexact match shouldn't be returned
# But it is. This isn't a deal breaker right now :/
# We have this test so if this changes we will know.
self.assertTrue(books.filter(title__contains="GOOD").exists())
self.assertFalse(books.filter(title__contains="GUT").exists())
with set_field_language("de"):
self.assertFalse(books.filter(title__contains="good").exists())
self.assertTrue(books.filter(title__contains="gut").exists())
def test_icontains(self):
books = Book.objects.all()
with set_field_language("en"):
self.assertTrue(books.filter(title__icontains="good").exists())
self.assertFalse(books.filter(title__icontains="gut").exists())
self.assertTrue(books.filter(title__icontains="GOOD").exists())
with set_field_language("de"):
self.assertFalse(books.filter(title__icontains="good").exists())
self.assertTrue(books.filter(title__icontains="gut").exists())
self.assertTrue(books.filter(title__icontains="GUT").exists())
@skipIf(connection.vendor == "sqlite", "SQLite uses case insensitive matching")
def test_startswith(self):
books = Book.objects.all()
with set_field_language("en"):
self.assertTrue(books.filter(title__startswith="A goo").exists())
self.assertFalse(books.filter(title__startswith="a goo").exists())
self.assertFalse(books.filter(title__startswith="Eine").exists())
with set_field_language("de"):
self.assertFalse(books.filter(title__startswith="A good").exists())
self.assertTrue(books.filter(title__startswith="Eine gut").exists())
def test_istartswith(self):
books = Book.objects.all()
with set_field_language("en"):
self.assertTrue(books.filter(title__istartswith="A go").exists())
self.assertTrue(books.filter(title__istartswith="a go").exists())
self.assertFalse(books.filter(title__istartswith="Eine").exists())
with set_field_language("de"):
self.assertFalse(books.filter(title__istartswith="a go").exists())
self.assertTrue(books.filter(title__istartswith="eine g").exists())
@skipIf(connection.vendor == "sqlite", "SQLite uses case insensitive matching")
def test_endswith(self):
books = Book.objects.all()
with set_field_language("en"):
self.assertTrue(books.filter(title__endswith="book").exists())
self.assertFalse(books.filter(title__endswith="BOOK").exists())
self.assertFalse(books.filter(title__endswith="buch").exists())
with set_field_language("de"):
self.assertFalse(books.filter(title__endswith="book").exists())
self.assertTrue(books.filter(title__endswith="buch").exists())
self.assertFalse(books.filter(title__endswith="BUCH").exists())
def test_iendswith(self):
books = Book.objects.all()
with set_field_language("en"):
self.assertTrue(books.filter(title__iendswith="book").exists())
self.assertTrue(books.filter(title__iendswith="BOOK").exists())
self.assertFalse(books.filter(title__iendswith="BUCH").exists())
with set_field_language("de"):
self.assertFalse(books.filter(title__iendswith="BOOK").exists())
self.assertTrue(books.filter(title__iendswith="BUCH").exists())
@skipIf(connection.vendor == "sqlite", "SQLite uses case insensitive matching")
def test_regex(self):
books = Book.objects.all()
with set_field_language("en"):
self.assertTrue(books.filter(title__regex="^A.+book$").exists())
self.assertFalse(books.filter(title__regex="^A.+BOOK$").exists())
self.assertFalse(books.filter(title__regex="^Ei.+buch$").exists())
with set_field_language("de"):
self.assertFalse(books.filter(title__regex="^A.+book$").exists())
self.assertTrue(books.filter(title__regex="^Ei.+buch$").exists())
def test_iregex(self):
books = Book.objects.all()
with set_field_language("en"):
self.assertTrue(books.filter(title__iregex="^A.+book$").exists())
self.assertTrue(books.filter(title__iregex="^A.+BOOK$").exists())
self.assertFalse(books.filter(title__iregex="^Ei.+buch$").exists())
with set_field_language("de"):
self.assertFalse(books.filter(title__iregex="^A.+book$").exists())
self.assertTrue(books.filter(title__iregex="^Ei.+buch$").exists())
def test_languagelookups(self):
# noqa: E731
books = Book.objects.all()
for lookup in [
"contains",
"icontains",
"endswith",
"iendswith",
"startswith",
"istartswith",
]:
en_str = "A good book"
de_str = "Eine gut buch"
case_sensitive = True
if lookup.startswith("i"):
case_sensitive = False
en_str = en_str.upper()
de_str = de_str.upper()
if "starts" in lookup or "contains" in lookup:
en_str = en_str[0:-2]
de_str = de_str[0:-2]
if "end" in lookup or "contains" in lookup:
en_str = en_str[2:]
de_str = de_str[2:]
try:
with set_field_language("en"):
self.assertFalse(
books.filter(**{f"title__en__{lookup}": de_str}).exists()
)
self.assertTrue(
books.filter(**{f"title__en__{lookup}": en_str}).exists()
)
self.assertTrue(
books.filter(**{f"title__de__{lookup}": de_str}).exists()
)
# TODO: This test fails - maybe an issue with JSON contains in SQLite?
from django.db import connection
if case_sensitive and connection.vendor != "sqlite":
self.assertFalse(
books.filter(
**{f"title__en__{lookup}": en_str.upper()}
).exists()
)
self.assertFalse(
books.filter(
**{f"title__de__{lookup}": de_str.upper()}
).exists()
)
with set_field_language("de"):
self.assertFalse(
books.filter(**{f"title__en__{lookup}": de_str}).exists()
)
self.assertTrue(
books.filter(**{f"title__en__{lookup}": en_str}).exists()
)
self.assertTrue(
books.filter(**{f"title__de__{lookup}": de_str}).exists()
)
except: # noqa: E722 , pragma: no cover
print(f"failed on {lookup} -- '{en_str}', '{de_str}'")
raise
class TestValuesList(TestCase):
@set_field_language("en")
def setUp(self):
apply_patches()
self.book_data = dict(
title={
"en": "A good book",
"de": "Eine gut buch",
},
author="I. M. Nice",
description="A book on how to be good, and stuff",
category={"dewey": 222},
number_of_pages=100,
)
Book.objects.create(**self.book_data)
def tearDown(self):
revert_patches()
def test_values(self):
books = Book.objects.all()
with set_field_language("en"):
self.assertEqual("A good book", books.values("title__en")[0]["title__en"])
self.assertEqual("A good book", books.values("title")[0]["title"])
with set_field_language("de"):
self.assertEqual("Eine gut buch", books.values("title")[0]["title"])
self.assertEqual("Eine gut buch", books.values("title")[0]["title"])
self.assertEqual("A good book", books.values("title__en")[0]["title__en"])
def test_values_list(self):
books = Book.objects.all()
with set_field_language("en"):
self.assertEqual(
"A good book", books.values_list("title__en", flat=True)[0]
)
self.assertEqual("A good book", books.values_list("title", flat=True)[0])
with set_field_language("de"):
self.assertEqual("Eine gut buch", books.values("title")[0]["title"])
self.assertEqual("Eine gut buch", books.values_list("title", flat=True)[0])
self.assertEqual(
"A good book", books.values_list("title__en", flat=True)[0]
)
@skipIf(connection.vendor == "mysql", "MariaDB has issues with JSON F lookups")
def test_f_lookup(self):
from garnett.expressions import LangF as F
from django.db.models.functions import Upper
self.book_data = dict(
title={
"en": "Mr. Bob Bobbertson",
"de": "Herr Bob Bobbertson",
},
author="Mr. Bob Bobbertson",
description="Mr. Bob Bobbertson's amazing self-titled autobiography",
category={
"dewey": 222,
"subject": "Mr. Bob Bobbertson",
},
number_of_pages=100,
)
Book.objects.create(**self.book_data)
books = Book.objects.all()
self.assertTrue( # Author match
books.filter(description__istartswith=F("author")).exists()
)
with set_field_language("en"):
annotated = books.annotate(en_title=F("title"))[0]
self.assertEqual(annotated.title, annotated.en_title)
annotated = books.annotate(en_title=F("title__en"))[0]
self.assertEqual(annotated.title, annotated.en_title)
self.assertTrue( # Author=Title match
books.filter(author=F("title")).exists()
)
self.assertTrue( # Title=Author match
books.filter(title__en__iexact=F("author")).exists()
)
self.assertTrue( # Title=Author match
books.filter(title__exact=F("author")).exists()
)
self.assertTrue( # Title=Author match
books.filter(title=F("author")).exists()
)
self.assertFalse( # Title=Author match
books.filter(title=Upper(F("author"))).exists()
)
self.assertTrue( # Title=Author match
books.filter(title__en__iexact=F("author")).exists()
)
self.assertTrue( # Title=Author match
books.filter(title__en__exact=F("author")).exists()
)
self.assertTrue( # Description matches Author
books.filter(description__istartswith=F("author")).exists()
)
self.assertTrue( # Description en matches Author
books.filter(description__en__istartswith=F("author")).exists()
)
self.assertTrue( # Description starts with Title
books.filter(description__istartswith=F("title")).exists()
)
class TestExpressions(TestCase):
"""Test queries using language lookup expression"""
def setUp(self):
with set_field_language("en"):
self.book = Book.objects.create(
title={
"en": "Testing for dummies",
"de": "Testen auf Dummies",
},
author="For dummies",
description={
"en": "Testing but for dummies",
"de": "Testen aber für Dummies",
},
category={"cat": "book"},
number_of_pages=2,
)
def test_order_by_translate_field(self):
with set_field_language("en"):
qs = Book.objects.order_by(L("title"))
self.assertEqual(qs.count(), 1)
self.assertEqual(qs[0].title, "Testing for dummies")
def test_order_by_lower_translate_field(self):
with set_field_language("en"):
qs = Book.objects.order_by(Lower(L("title")))
self.assertEqual(qs.count(), 1)
self.assertEqual(qs[0].title, "Testing for dummies")
def test_annotate_translate_field(self):
with set_field_language("en"):
qs = Book.objects.annotate(foo=L("title"))
self.assertEqual(qs.count(), 1)
self.assertEqual(qs[0].foo, "Testing for dummies")
def test_annotate_lower_translate_field(self):
with set_field_language("en"):
qs = Book.objects.annotate(foo=Lower(L("title")))
self.assertEqual(qs.count(), 1)
self.assertEqual(qs[0].foo, "testing for dummies")
@skipIf(connection.vendor == "sqlite", "JSONField contains isn't avaliable on sqlite")
class TestJSONFieldLookups(TestCase):
"""Tests to ensure we are not messing with json field functionality"""
def setUp(self):
with set_field_language("en"):
self.book = Book.objects.create(
title="book",
author="Book guy",
description="cool book",
category={
"data": {
"is": "nested",
}
},
number_of_pages=1000,
)
def test_root_contains(self):
qs = Book.objects.filter(category__contains={"data": {"is": "nested"}})
self.assertCountEqual(qs, [self.book])
def test_sub_contains(self):
qs = Book.objects.filter(category__data__contains={"is": "nested"})
self.assertCountEqual(qs, [self.book])
| 41.320833 | 90 | 0.567863 | 2,162 | 19,834 | 5.018964 | 0.098057 | 0.094277 | 0.117961 | 0.094461 | 0.818081 | 0.789973 | 0.758087 | 0.69671 | 0.668326 | 0.631094 | 0 | 0.004372 | 0.296612 | 19,834 | 479 | 91 | 41.407098 | 0.773421 | 0.041948 | 0 | 0.486352 | 0 | 0 | 0.110912 | 0 | 0 | 0 | 0 | 0.002088 | 0.28536 | 1 | 0.074442 | false | 0 | 0.027295 | 0 | 0.114144 | 0.002481 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
1725a24d25876099c3b23c23f64a958bc61b4cbd | 396 | py | Python | Computer science/Programming languages/Python/Control flow/Functions/Main body/Declaring a function/miles_away.py | chanchanchong/PYTHON-TRACK-IN-HYPERSKILL | 462fe08ff4a2b183fd45a0235ab1ec7a788bd54c | [
"MIT"
] | null | null | null | Computer science/Programming languages/Python/Control flow/Functions/Main body/Declaring a function/miles_away.py | chanchanchong/PYTHON-TRACK-IN-HYPERSKILL | 462fe08ff4a2b183fd45a0235ab1ec7a788bd54c | [
"MIT"
] | null | null | null | Computer science/Programming languages/Python/Control flow/Functions/Main body/Declaring a function/miles_away.py | chanchanchong/PYTHON-TRACK-IN-HYPERSKILL | 462fe08ff4a2b183fd45a0235ab1ec7a788bd54c | [
"MIT"
] | null | null | null | # Let's take your skill of converting miles to kilometers to the next
# level! Define a function that accepts the number of miles and
# returns this distance in kilometers.
# Assume that one mile is approximately equal to 1.609
# kilometers.
# You don't have to handle input, just implement the function.
# put your python code here
def mi_to_km(number_miles):
return number_miles * 1.609
| 30.461538 | 69 | 0.765152 | 67 | 396 | 4.462687 | 0.716418 | 0.026756 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024768 | 0.184343 | 396 | 12 | 70 | 33 | 0.900929 | 0.80303 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
1726549428ac5a1431ecb5bbb3b094719d279d37 | 1,428 | py | Python | tmp/454. Rectangle Area.py | runzezhang/Data-Structure-and-Algorithm-Notebook | 15a94d7df2ac1d2ad081004d61433324654085e5 | [
"Apache-2.0"
] | 1 | 2020-07-24T03:37:05.000Z | 2020-07-24T03:37:05.000Z | tmp/454. Rectangle Area.py | runzezhang/Code-NoteBook | 15a94d7df2ac1d2ad081004d61433324654085e5 | [
"Apache-2.0"
] | null | null | null | tmp/454. Rectangle Area.py | runzezhang/Code-NoteBook | 15a94d7df2ac1d2ad081004d61433324654085e5 | [
"Apache-2.0"
] | null | null | null | # Description
# Implement a Rectangle class which include the following attributes and methods:
# Two public attributes width and height.
# A constructor which expects two parameters width and height of type int.
# A method getArea which would calculate the size of the rectangle and return.
# Description
# Implement a Rectangle class which include the following attributes and methods:
# Two public attributes width and height.
# A constructor which expects two parameters width and height of type int.
# A method getArea which would calculate the size of the rectangle and return.
# Have you met this question in a real interview?
# Example
# Example1:
# Java:
# Rectangle rec = new Rectangle(3, 4);
# rec.getArea(); // should get 12,3*4=12
# Python:
# rec = Rectangle(3, 4)
# rec.getArea()
# Example2:
# Java:
# Rectangle rec = new Rectangle(4, 4);
# rec.getArea(); // should get 16,4*4=16
# Python:
# rec = Rectangle(4, 4)
# rec.getArea()
class Rectangle:
'''
* Define a constructor which expects two parameters width and height here.
'''
# write your code here
def __init__(self, width, height):
self.height = height
self.width = width
'''
* Define a public method `getArea` which can calculate the area of the
* rectangle and return.
'''
# write your code here
def getArea(self):
return self.width*self.height | 28.56 | 81 | 0.684874 | 197 | 1,428 | 4.944162 | 0.299492 | 0.041068 | 0.071869 | 0.073922 | 0.743326 | 0.534908 | 0.534908 | 0.534908 | 0.534908 | 0.482546 | 0 | 0.020036 | 0.231092 | 1,428 | 50 | 82 | 28.56 | 0.867031 | 0.730392 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.166667 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
17597c228af9ff306ca202c4e1e8ac68db067cf9 | 192 | py | Python | utils.py | jscarlson/zi2zi-pytorch | 3409165b304ccf1d5a5c2329a9f0f0897b3495dc | [
"Apache-2.0"
] | 81 | 2020-07-08T15:38:00.000Z | 2022-03-30T16:20:27.000Z | utils.py | max32002/zi2zi-pytorch | a1680937e55672e2cc1a58a73cd0fb5062d00246 | [
"Apache-2.0"
] | 29 | 2020-07-30T06:28:29.000Z | 2022-03-23T14:31:52.000Z | utils.py | max32002/zi2zi-pytorch | a1680937e55672e2cc1a58a73cd0fb5062d00246 | [
"Apache-2.0"
] | 21 | 2020-08-17T05:52:28.000Z | 2022-03-24T10:05:43.000Z | import re
def natural_key(string_):
"""See http://www.codinghorror.com/blog/archives/001018.html"""
return [int(s) if s.isdigit() else s for s in re.split(r'(\d+)', string_.lower())] | 32 | 86 | 0.666667 | 32 | 192 | 3.90625 | 0.84375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036145 | 0.135417 | 192 | 6 | 86 | 32 | 0.716867 | 0.296875 | 0 | 0 | 0 | 0 | 0.038462 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
1759a0488bf383a6cec34b029d55a8d7d83d72f2 | 102 | py | Python | CodeWars/7 Kyu/Alphabet symmetry.py | anubhab-code/Competitive-Programming | de28cb7d44044b9e7d8bdb475da61e37c018ac35 | [
"MIT"
] | null | null | null | CodeWars/7 Kyu/Alphabet symmetry.py | anubhab-code/Competitive-Programming | de28cb7d44044b9e7d8bdb475da61e37c018ac35 | [
"MIT"
] | null | null | null | CodeWars/7 Kyu/Alphabet symmetry.py | anubhab-code/Competitive-Programming | de28cb7d44044b9e7d8bdb475da61e37c018ac35 | [
"MIT"
] | null | null | null | def solve(arr):
return [sum(i == ord(c) - ord('A') for i, c in enumerate(s.upper())) for s in arr] | 51 | 86 | 0.588235 | 21 | 102 | 2.857143 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.196078 | 102 | 2 | 86 | 51 | 0.731707 | 0 | 0 | 0 | 0 | 0 | 0.009709 | 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 | 0 | 0 | 0 | 4 |
177211d833a296b250c8f220c850a4960a8aef8a | 202 | py | Python | src/PyBrBot/db/pydoc/fields.py | edvitor13/pybrbot | 3bd153bba3188162649a8d4805ca683a2b47768c | [
"MIT"
] | 8 | 2021-08-03T01:36:21.000Z | 2022-01-14T22:44:21.000Z | src/PyBrBot/db/pydoc/fields.py | edvitor13/pybrbot | 3bd153bba3188162649a8d4805ca683a2b47768c | [
"MIT"
] | null | null | null | src/PyBrBot/db/pydoc/fields.py | edvitor13/pybrbot | 3bd153bba3188162649a8d4805ca683a2b47768c | [
"MIT"
] | 2 | 2021-08-22T21:51:52.000Z | 2022-01-14T22:45:02.000Z | from ..active_record import ActiveRecord
from src.PyBrBot.config import Config
class Fields(ActiveRecord):
def __init__(self):
super().__init__(Config.get("database_pydoc"), "fields")
| 25.25 | 64 | 0.727723 | 24 | 202 | 5.708333 | 0.708333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.158416 | 202 | 7 | 65 | 28.857143 | 0.805882 | 0 | 0 | 0 | 0 | 0 | 0.09901 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
17854228081a1693e80fc57340190119f6f4024b | 69 | py | Python | pyiomica/data/__init__.py | benstear/pyiomica | bc26032b610fc911cc03b54115d6abdf53a56fce | [
"MIT"
] | 12 | 2019-11-22T21:44:13.000Z | 2022-03-06T21:46:31.000Z | pyiomica/data/__init__.py | benstear/pyiomica | bc26032b610fc911cc03b54115d6abdf53a56fce | [
"MIT"
] | null | null | null | pyiomica/data/__init__.py | benstear/pyiomica | bc26032b610fc911cc03b54115d6abdf53a56fce | [
"MIT"
] | 5 | 2019-07-25T21:03:42.000Z | 2021-06-09T02:14:30.000Z | '''Collection of data necessary for funning PyIOmica's functions'''
| 34.5 | 68 | 0.768116 | 9 | 69 | 5.888889 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130435 | 69 | 1 | 69 | 69 | 0.883333 | 0.884058 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
178574fd47f5e6e010dc4e47aa2014f28bf024f6 | 225 | py | Python | app/employee/views.py | kennyaires/employer-register-service | ad424c509a6951e66b0197e9ba03e07b818bd227 | [
"MIT"
] | 1 | 2020-03-27T11:39:45.000Z | 2020-03-27T11:39:45.000Z | app/employee/views.py | kennyaires/employee-register-service | ad424c509a6951e66b0197e9ba03e07b818bd227 | [
"MIT"
] | null | null | null | app/employee/views.py | kennyaires/employee-register-service | ad424c509a6951e66b0197e9ba03e07b818bd227 | [
"MIT"
] | null | null | null | from rest_framework import generics
from employee.serializers import EmployeeSerializer
class CreateEmployeeView(generics.CreateAPIView):
"""Create a new user in the system"""
serializer_class = EmployeeSerializer
| 25 | 51 | 0.808889 | 24 | 225 | 7.5 | 0.791667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137778 | 225 | 8 | 52 | 28.125 | 0.927835 | 0.137778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
bd792e3c048f30bf2cef93ab09ed5c8162266316 | 661 | py | Python | eda5/core/managers.py | vasjapavlovic/eda5 | bc4b387b24239ea1dfb927657f05ddabbf707479 | [
"BSD-3-Clause"
] | null | null | null | eda5/core/managers.py | vasjapavlovic/eda5 | bc4b387b24239ea1dfb927657f05ddabbf707479 | [
"BSD-3-Clause"
] | null | null | null | eda5/core/managers.py | vasjapavlovic/eda5 | bc4b387b24239ea1dfb927657f05ddabbf707479 | [
"BSD-3-Clause"
] | null | null | null | from django.db import models
class StatusManager(models.Manager):
use_for_related_fields = True
''' ne prikaži objektov s statusom = izbrisano '''
def not_deleted(self, **kwargs):
return self.exclude(status=5, **kwargs)
''' ne prikaži objektov s statusom = zaključeno '''
def not_closed(self, **kwargs):
return self.exclude(status=4, **kwargs)
''' ne prikaži objektov s statusom = draft '''
def not_draft(self, **kwargs):
return self.exclude(status=0, **kwargs)
''' ne prikaži objektov s statusom = vcakanju '''
def not_vcakanju(self, **kwargs):
return self.exclude(status=1, **kwargs)
| 28.73913 | 55 | 0.652042 | 82 | 661 | 5.170732 | 0.426829 | 0.084906 | 0.160377 | 0.169811 | 0.599057 | 0.537736 | 0 | 0 | 0 | 0 | 0 | 0.007737 | 0.217852 | 661 | 22 | 56 | 30.045455 | 0.812379 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.363636 | false | 0 | 0.090909 | 0.363636 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
bdc3f42253204b807e88ae3ac23dfab3a427b0f2 | 133 | py | Python | odd_even.py | ashik39/Python-workouts | 4ace5c0d0e3c754d0c9ac7bb73b6f7a6b326300d | [
"bzip2-1.0.6"
] | null | null | null | odd_even.py | ashik39/Python-workouts | 4ace5c0d0e3c754d0c9ac7bb73b6f7a6b326300d | [
"bzip2-1.0.6"
] | null | null | null | odd_even.py | ashik39/Python-workouts | 4ace5c0d0e3c754d0c9ac7bb73b6f7a6b326300d | [
"bzip2-1.0.6"
] | null | null | null | a=int(input("Enter A value:"))
#b=int(input("Enter B value:"))
if a%2==0:
print(a,"is even")
else:
print(a,"A is odd")
| 19 | 32 | 0.548872 | 26 | 133 | 2.807692 | 0.538462 | 0.219178 | 0.356164 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019048 | 0.210526 | 133 | 6 | 33 | 22.166667 | 0.67619 | 0.225564 | 0 | 0 | 0 | 0 | 0.302083 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.4 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
bde37d3586be490d3c31be5b861548e8e18d7904 | 36 | py | Python | file_1.py | Ogbekar/dinatesting | d851d4a0d375a5ca575ebc4720fa7e2d760a986b | [
"MIT"
] | null | null | null | file_1.py | Ogbekar/dinatesting | d851d4a0d375a5ca575ebc4720fa7e2d760a986b | [
"MIT"
] | null | null | null | file_1.py | Ogbekar/dinatesting | d851d4a0d375a5ca575ebc4720fa7e2d760a986b | [
"MIT"
] | null | null | null | var1 = 1
var2 = 2
print(var1+var2)
| 7.2 | 16 | 0.638889 | 7 | 36 | 3.285714 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.214286 | 0.222222 | 36 | 4 | 17 | 9 | 0.607143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
da03c3529badf4fec0f9d990b0f8a6c385d4c166 | 100 | py | Python | accounting_ar/apps.py | mbaragiola/heimdallerp | 8d32131a20bd0f3609d772ac437f4f24622abfc7 | [
"0BSD"
] | 8 | 2016-04-07T11:58:42.000Z | 2019-06-24T01:38:12.000Z | accounting_ar/apps.py | mbaragiola/heimdallerp | 8d32131a20bd0f3609d772ac437f4f24622abfc7 | [
"0BSD"
] | null | null | null | accounting_ar/apps.py | mbaragiola/heimdallerp | 8d32131a20bd0f3609d772ac437f4f24622abfc7 | [
"0BSD"
] | null | null | null | from django.apps import AppConfig
class AccountingArConfig(AppConfig):
name = 'accounting_ar'
| 16.666667 | 36 | 0.78 | 11 | 100 | 7 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15 | 100 | 5 | 37 | 20 | 0.905882 | 0 | 0 | 0 | 0 | 0 | 0.13 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
da364caa013635ed8e16208528f32bdceb928ac2 | 2,595 | py | Python | S4/S4 Library/simulation/delivery/scheduled_delivery_loot_op.py | NeonOcean/Environment | ca658cf66e8fd6866c22a4a0136d415705b36d26 | [
"CC-BY-4.0"
] | 1 | 2021-05-20T19:33:37.000Z | 2021-05-20T19:33:37.000Z | S4/S4 Library/simulation/delivery/scheduled_delivery_loot_op.py | NeonOcean/Environment | ca658cf66e8fd6866c22a4a0136d415705b36d26 | [
"CC-BY-4.0"
] | null | null | null | S4/S4 Library/simulation/delivery/scheduled_delivery_loot_op.py | NeonOcean/Environment | ca658cf66e8fd6866c22a4a0136d415705b36d26 | [
"CC-BY-4.0"
] | null | null | null | from date_and_time import create_time_span
from interactions import ParticipantTypeSingleSim
from interactions.object_rewards import ObjectRewardsOperation
from interactions.utils import LootType
from sims4.tuning.instances import HashedTunedInstanceMetaclass
from sims4.tuning.tunable import TunableSimMinute, OptionalTunable, HasTunableReference, HasTunableSingletonFactory, AutoFactoryInit, TunableEnumEntry
from sims4.utils import classproperty, flexmethod
from ui.ui_dialog_notification import TunableUiDialogNotificationSnippet
import services
import sims4.resources
class ScheduledDeliveryLoot(HasTunableReference, HasTunableSingletonFactory, AutoFactoryInit, metaclass=HashedTunedInstanceMetaclass, manager=services.get_instance_manager(sims4.resources.Types.ACTION)):
INSTANCE_TUNABLES = {'participant': TunableEnumEntry(description='\n Sim who is getting the delivery delivered to their household.\n ', tunable_type=ParticipantTypeSingleSim, default=ParticipantTypeSingleSim.Actor), 'time_from_now': TunableSimMinute(description='\n How far from now we want our delivery.\n ', default=1440, minimum=1, maximum=10080), 'not_home_notification': OptionalTunable(description='\n If enabled, a notification will be displayed when the Sim is not\n currently home when the object(s) would be delivered.\n The object will be in the mailbox when they arrive back at their\n home lot.\n ', tunable=TunableUiDialogNotificationSnippet()), 'at_home_notification': OptionalTunable(description='\n The notification that will be displayed when the Sim is at\n home when the object(s) would be delivered. The object(s)\n will end up in hidden inventory waiting to be delivered by\n the mailman.\n ', tunable=TunableUiDialogNotificationSnippet()), 'objects_to_deliver': ObjectRewardsOperation.TunableFactory(description='\n The objects to be delivered. When participants are used \n within this structure, only Sim-type participants will resolve.\n ', locked_args={'notification': None, 'place_in_mailbox': True, 'force_family_inventory': False})}
@classproperty
def loot_type(self):
return LootType.SCHEDULED_DELIVERY
@flexmethod
def apply_to_resolver(cls, inst, resolver, skip_test=False):
subject = resolver.get_participant(cls.participant)
subject.household.delivery_tracker.request_delivery(subject.sim_id, cls.guid64, create_time_span(minutes=cls.time_from_now))
| 112.826087 | 1,453 | 0.764933 | 297 | 2,595 | 6.558923 | 0.444444 | 0.030801 | 0.0154 | 0.043121 | 0.106776 | 0.062628 | 0.062628 | 0.034908 | 0 | 0 | 0 | 0.007863 | 0.166859 | 2,595 | 22 | 1,454 | 117.954545 | 0.893154 | 0 | 0 | 0 | 0 | 0.157895 | 0.371484 | 0.01657 | 0 | 0 | 0 | 0 | 0 | 1 | 0.105263 | false | 0 | 0.526316 | 0.052632 | 0.789474 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
da44e499b3d29be3edcb2382292498046542a36c | 14,112 | py | Python | burisim/ui/display.py | rjw57/buri-simulator-python | 328da1998880c295cecd356cdc2a13405b0169bd | [
"MIT"
] | 5 | 2016-02-29T15:29:28.000Z | 2019-05-30T15:29:35.000Z | burisim/ui/display.py | rjw57/buri-simulator-python | 328da1998880c295cecd356cdc2a13405b0169bd | [
"MIT"
] | null | null | null | burisim/ui/display.py | rjw57/buri-simulator-python | 328da1998880c295cecd356cdc2a13405b0169bd | [
"MIT"
] | 2 | 2020-03-07T20:00:08.000Z | 2020-07-25T14:22:33.000Z | # Make py2 like py3
from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import ( # pylint: disable=redefined-builtin, unused-import
bytes, dict, int, list, object, range, str,
ascii, chr, hex, input, next, oct, open,
pow, round, super,
filter, map, zip
)
import struct
import threading
from PySide import QtCore, QtGui
import pyte
class ScreenView(QtGui.QFrame):
def __init__(self, *args, **kwargs):
super(ScreenView, self).__init__()
self.setFrameShape(QtGui.QFrame.StyledPanel)
self.setFrameShadow(QtGui.QFrame.Sunken)
self._screen = None
self._cached_screen_size = None
@property
def screen(self):
return self._screen
@screen.setter
def screen(self, v):
self._screen = v
self._adjust_to_screen()
def contents_changed(self):
self.update()
if self._cached_screen_size != self.screen.size:
self._cached_screen_size = self.screen.size
self.updateGeometry()
def _adjust_to_screen(self):
self.updateGeometry()
def paintEvent(self, event):
super(ScreenView, self).paintEvent(event)
fw = self.frameWidth()
fm = self.fontMetrics()
p = QtGui.QPainter(self)
p.fillRect(
self.frameRect().adjusted(-fw, -fw, -fw, -fw),
QtGui.qRgb(40, 40, 40)
)
if self._screen is None:
return
cw, ch = fm.width('X'), fm.lineSpacing()
x0, y0 = fw, fw
h, w = self._screen.size
bg = QtGui.qRgb(0, 0, 0)
fg = QtGui.qRgb(255, 255, 255)
cbg = QtGui.qRgb(255, 255, 255)
cfg = QtGui.qRgb(0, 0, 0)
p.fillRect(x0, y0, w*cw, h*ch, bg)
c = self._screen.cursor
to = fm.ascent()
for y, line in enumerate(self._screen.buffer):
py = y * ch + y0
for x, char in enumerate(line):
p.setPen(fg)
px = x * cw + x0
if (x, y) == (c.x, c.y):
if self.hasFocus():
p.fillRect(px, py, cw, ch, cbg)
p.setPen(cfg)
else:
p.setPen(cbg)
p.drawRect(px, py, cw, ch)
p.setPen(fg)
p.drawText(px, py + to, char.data)
def sizeHint(self):
return self.minimumSize()
def minimumSize(self):
if self._screen is None:
return QtCore.QSize(0,0)
fw = self.frameWidth()
fm = self.fontMetrics()
h, w = self._screen.size
return QtCore.QSize(2*fw + w*fm.width('X'), 2*fw + h*fm.lineSpacing())
class TerminalView(QtGui.QWidget):
transmitByte = QtCore.Signal(int)
def __init__(self, *args, **kwargs):
super(TerminalView, self).__init__()
self.screen = pyte.DiffScreen(80, 24)
self.charSize = QtCore.QSize(8, 12)
self.stream = pyte.ByteStream()
self.stream.attach(self.screen)
self._input_buffer_lock = threading.Lock()
self._input_buffer = QtCore.QBuffer()
self._input_buffer.bytesWritten.connect(self._have_input)
self._input_buffer.open(
QtCore.QIODevice.WriteOnly | QtCore.QIODevice.Unbuffered
)
l = QtGui.QVBoxLayout()
l.setContentsMargins(0, 0, 0, 0)
self.setLayout(l)
self._screen_view = ScreenView()
self._screen_view.screen = self.screen
self._screen_view.installEventFilter(self)
self._screen_view.setFont(QtGui.QFont('Monospace'))
self._screen_view.setFocusPolicy(QtCore.Qt.StrongFocus)
l.addWidget(self._screen_view)
def receiveByte(self, b):
with self._input_buffer_lock:
self._input_buffer.putChar(b)
def keyReleaseEvent(self, e):
t = e.text()
if t == '':
return super(TerminalView, self).keyReleaseEvent(e)
for c in t:
self.transmitByte.emit(ord(c))
def _have_input(self):
with self._input_buffer_lock:
self._input_buffer.close()
bs = b''.join(self._input_buffer.data())
self._input_buffer.setData(b'')
self._input_buffer.open(
QtCore.QIODevice.WriteOnly | QtCore.QIODevice.Unbuffered
)
self.stream.feed(bs)
self._screen_view.contents_changed()
class HD44780View(QtGui.QWidget):
def __init__(self, *args, **kwargs):
super(HD44780View, self).__init__()
self.rows = 4
self.cols = 20
self._display = None
# compose font pixmaps
self._font = []
self._update_font()
@property
def display(self):
return self._display
@display.setter
def display(self, d):
if self._display is not None:
self._display.update.disconnect(self._display_update)
self._display = d
self._display.update.connect(self._display_update)
self.update()
def minimumSize(self):
return self.sizeHint()
def sizeHint(self):
if len(self._font) > 0:
w = self._font[0].size().width()
h = self._font[0].size().height()
else:
w, h = 1, 1
return QtCore.QSize(self.cols * w, self.rows * h)
def paintEvent(self, _):
if len(self._font) == 0 or self._display is None:
return
p = QtGui.QPainter()
assert p.begin(self)
def paint_row(y, contents):
for c, v in enumerate(contents):
im = self._font[v]
p.drawImage(c*im.width(), y, im)
rh = self._font[0].height()
paint_row(0*rh, self._display.ddram[:20])
paint_row(1*rh, self._display.ddram[64:84])
paint_row(2*rh, self._display.ddram[20:40])
paint_row(3*rh, self._display.ddram[84:104])
p.end()
def _display_update(self):
self.update()
def _update_font(self):
px_size = 2
px_space = 2
lcd_bg = QtGui.qRgb(0, 0, 20)
lcd_off = QtGui.qRgb(60, 40, 20)
lcd_on = QtGui.qRgb(250, 220, 20)
def render_char(c):
# Create QImage
im = QtGui.QImage(
5*(px_size+px_space) + px_space,
8*(px_size+px_space) + px_space,
QtGui.QImage.Format_RGB32
)
im.fill(lcd_bg)
p = QtGui.QPainter()
assert p.begin(im)
for r_idx, r_def in enumerate((list(c) + [0]*8)[:8]):
for c_idx in range(5):
c = lcd_off if r_def & (1<<(4-c_idx)) == 0 else lcd_on
p.fillRect(
(px_space+px_size)*c_idx + px_space,
(px_space+px_size)*r_idx + px_space,
px_size, px_size, c
)
p.end()
return im
# render char rom font
self._font = list(render_char(c) for c in CHAR_ROM)
self.updateGeometry()
CHAR_ROM = [
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[4, 4, 4, 4, 4, 0, 4],
[10,10,10, 0, 0, 0, 0],
[10,10,31,10,31,10,10],
[4,15,20,14, 5,30, 4],
[24,25, 2, 4, 8,19, 3],
[12,18,20, 8,21,18,13],
[12, 4, 8, 0, 0, 0, 0],
[2, 4, 8, 8, 8, 4, 2],
[8, 4, 2, 2, 2, 4, 8],
[0, 4,21,14,21, 4, 0],
[0, 4, 4,31, 4, 4, 0],
[0, 0, 0, 0,12, 4, 8],
[0, 0, 0,31, 0, 0, 0],
[0, 0, 0, 0, 0,12,12],
[0, 1, 2, 4, 8,16, 0],
[14,17,19,21,25,17,14],
[4,12, 4, 4, 4, 4,14],
[14,17, 1, 2, 4, 8,31],
[31, 2, 4, 2, 1,17,14],
[2, 6,10,18,31, 2, 2],
[31,16,30, 1, 1,17,14],
[6, 8,16,30,17,17,14],
[31, 1, 2, 4, 8, 8, 8],
[14,17,17,14,17,17,14],
[14,17,17,15, 1, 2,12],
[0,12,12, 0,12,12, 0],
[0,12,12, 0,12, 4, 8],
[2, 4, 8,16, 8, 4, 2],
[0, 0,31, 0,31, 0, 0],
[16, 8, 4, 2, 4, 8,16],
[14,17, 1, 2, 4, 0, 4],
[14,17, 1,13,21,21,14],
[14,17,17,17,31,17,17],
[30,17,17,30,17,17,30],
[14,17,16,16,16,17,14],
[30,17,17,17,17,17,30],
[31,16,16,30,16,16,31],
[31,16,16,30,16,16,16],
[14,17,16,23,17,17,15],
[17,17,17,31,17,17,17],
[14, 4, 4, 4, 4, 4,14],
[7, 2, 2, 2, 2,18,12 ],
[17,18,20,24,20,18,17],
[16,16,16,16,16,16,31],
[17,27,21,21,17,17,17],
[17,17,25,21,19,17,17],
[14,17,17,17,17,17,14],
[30,17,17,30,16,16,16],
[14,17,17,17,21,18,13],
[30,17,17,30,20,18,17],
[15,16,16,14, 1, 1,30],
[31, 4, 4, 4, 4, 4, 4],
[17,17,17,17,17,17,14],
[17,17,17,17,17,10, 4],
[17,17,17,21,21,21,10],
[17,17,10, 4,10,17,17],
[17,17,17,10, 4, 4, 4],
[31, 1, 2, 4, 8,16,31],
[14, 8, 8, 8, 8, 8,14],
[17,10,31, 4,31, 4, 4],
[14, 2, 2, 2, 2, 2,14],
[4,10,17, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0,31],
[8, 4, 2, 0, 0, 0, 0],
[0, 0,14, 1,15,17,15],
[16,16,22,25,17,17,30],
[0, 0,14,16,16,17,14 ],
[1, 1,13,19,17,17,15],
[0, 0,14,17,31,16,14],
[6, 9, 8,28, 8, 8, 8],
[0, 0,15,17,15, 1,14],
[16,16,22,25,17,17,17],
[4, 0,12, 4, 4, 4,14 ],
[2, 6, 2, 2, 2,18,12],
[16,16,18,20,24,20,18],
[12, 4, 4, 4, 4, 4,14],
[0, 0,26,21,21,17,17],
[0, 0,22,25,17,17,17],
[0, 0,14,17,17,17,14],
[0, 0,30,17,30,16,16],
[0, 0,13,19,15, 1, 1],
[0, 0,22,25,16,16,16],
[0, 0,15,16,14, 1,30],
[8, 8,28, 8, 8, 9, 6],
[0, 0,17,17,17,19,13],
[0, 0,17,17,17,10, 4],
[0, 0,17,17,21,21,10],
[0, 0,17,10, 4,10,17],
[0, 0,17,17,15, 1,14],
[0, 0,31, 2, 4, 8,31],
[2, 4, 4, 8, 4, 4, 2],
[4, 4, 4, 4, 4, 4, 4],
[8, 4, 4, 2, 4, 4, 8],
[0, 4, 2,31, 2, 4, 0],
[0, 4, 8,31, 8, 4, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0,28,20,28],
[7, 4, 4, 4, 0, 0, 0],
[0, 0, 0, 4, 4, 4,28],
[0, 0, 0, 0,16, 8, 4],
[0, 0, 0,12,12, 0, 0],
[0,31, 1,31, 1, 2, 4],
[0, 0,31, 1, 6, 4, 8],
[0, 0, 2, 4,12,20, 4],
[0, 0, 4,31,17, 1, 6],
[0, 0, 0,31, 4, 4,31],
[0, 0, 2,31, 6,10,18],
[0, 0, 8,31, 9,10, 8],
[0, 0, 0,14, 2, 2,31],
[0, 0,30, 2,30, 2,30],
[0, 0, 0,21,21, 1, 6],
[0, 0, 0, 0,31, 0, 0],
[31, 1, 5, 6, 4, 4, 8],
[1, 2, 4,12,20, 4, 4],
[4,31,17,17, 1, 2, 4],
[0, 0,31, 4, 4, 4,31],
[2,31, 2, 6,10,18, 2],
[8,31, 9, 9, 9, 9,18],
[4,31, 4,31, 4, 4, 4],
[0,15, 9,17, 1, 2,12],
[8,15,18, 2, 2, 2, 4],
[0,31, 1, 1, 1, 1,31],
[10,31,10,10, 2, 4, 8],
[0,24, 1,25, 1, 2,28],
[0,31, 1, 2, 4,10,17],
[8,31, 9,10, 8, 8, 7],
[0,17,17, 9, 1, 2,12],
[0,15, 9,21, 3, 2,12],
[2,28, 4,31, 4, 4, 8],
[0,21,21, 1, 1, 2, 4],
[14, 0,31, 4, 4, 4, 8],
[8, 8, 8,12,10, 8, 8],
[4, 4,31, 4, 4, 8,16],
[0,14, 0, 0, 0, 0,31],
[0,31, 1,10, 4,10,16],
[4,31, 2, 4,14,21, 4],
[2, 2, 2, 2, 2, 4, 8],
[0, 4, 2,17,17,17,17],
[16,16,31,16,16,16,15],
[0,31, 1, 1, 1, 2,12],
[0, 8,20, 2, 1, 1, 0],
[4,31, 4, 4,21,21, 4],
[0,31, 1, 1,10, 4, 2],
[0,14, 0,14, 0,14, 1],
[0, 4, 8,16,17,31, 1],
[0, 1, 1,10, 4,10,16],
[0,31, 8,31, 8, 8, 7],
[8, 8,31, 9,10, 8, 8],
[0,14, 2, 2, 2, 2,31],
[0,31, 1,31, 1, 1,31],
[14, 0,31, 1, 1, 2, 4],
[18,18,18,18, 2, 4, 8],
[0, 4,20,20,21,21,22],
[0,16,16,17,18,20,24],
[0,31,17,17,17,17,31],
[0,31,17,17, 1, 2, 4],
[0,24, 0, 1, 1, 2,28],
[4,18, 8, 0, 0, 0, 0],
[28,20,28, 0, 0, 0, 0],
[0, 0, 9,21,18,18,13 ],
[10, 0,14, 1,15,17,15],
[0,14,17,30,17,30,16],
[0, 0,14,16,12,17,14],
[0,17,17,17,19,29,16],
[0, 0,15,20,18,17,14],
[0, 6, 9,17,17,30,16],
[0,15,17,17,17,15, 1],
[0, 0, 7, 4, 4,20, 8],
[2,26, 2, 0, 0, 0, 0],
[2, 0, 6, 2, 2, 2, 2],
[0,20, 8,20, 0, 0, 0],
[4,14,20,21,14, 4, 0],
[8, 8,28, 8,28, 8,15],
[14, 0,22,25,17,17,17],
[10, 0,14,17,17,17,14],
[0,22,25,17,17,30,16],
[0,13,19,17,17,15, 1 ],
[14,17,31,17,17,14, 0],
[0, 0, 0, 0,11,21,26 ],
[0,14,17,17,10,27, 0],
[10, 0,17,17,17,19,13],
[31,16, 8, 4, 8,16,31],
[0,31,10,10,10,19, 0 ],
[31, 0,17,10, 4,10,17],
[0,17,17,17,17,15, 1],
[1,30, 4,31, 4, 4, 0],
[0,31, 8,15, 9,17, 0],
[0,31,21,31,17,17, 0 ],
[0, 0, 4, 0,31, 0, 4 ],
[0, 0, 0, 0, 0, 0, 0 ],
[31,31,31,31,31,31,31],
]
| 27.889328 | 84 | 0.453019 | 2,672 | 14,112 | 2.329341 | 0.08982 | 0.189589 | 0.253535 | 0.320051 | 0.360058 | 0.256266 | 0.154724 | 0.135283 | 0.100418 | 0.09849 | 0 | 0.27016 | 0.325113 | 14,112 | 505 | 85 | 27.944554 | 0.383347 | 0.008645 | 0 | 0.241611 | 0 | 0 | 0.000787 | 0 | 0 | 0 | 0 | 0 | 0.004474 | 1 | 0.049217 | false | 0 | 0.013423 | 0.008949 | 0.096197 | 0.002237 | 0 | 0 | 0 | null | 0 | 1 | 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 | 0 | 0 | 4 |
e54c092c5a93ba73cdc3448efedccb87961bac79 | 54 | py | Python | src/kwidgets/uix/__init__.py | man-vs-electron/kwidgets | 86943d0255ee11c6ebf0bd481cfa0ebc7ac42154 | [
"Apache-2.0"
] | null | null | null | src/kwidgets/uix/__init__.py | man-vs-electron/kwidgets | 86943d0255ee11c6ebf0bd481cfa0ebc7ac42154 | [
"Apache-2.0"
] | 3 | 2021-11-27T18:02:01.000Z | 2022-03-25T21:19:25.000Z | src/kwidgets/uix/__init__.py | man-vs-electron/kwidgets | 86943d0255ee11c6ebf0bd481cfa0ebc7ac42154 | [
"Apache-2.0"
] | null | null | null | """ Various general use user interface components
""" | 18 | 49 | 0.740741 | 6 | 54 | 6.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148148 | 54 | 3 | 50 | 18 | 0.869565 | 0.833333 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
e54f7cce0c419908a9ce2f7da57e6c59c3852e3f | 270 | py | Python | tests/pytests/apps/__init__.py | Grant-Block/pylith | f6338261b17551eba879da998a5aaf2d91f5f658 | [
"MIT"
] | 93 | 2015-01-08T16:41:22.000Z | 2022-02-25T13:40:02.000Z | tests/pytests/apps/__init__.py | Grant-Block/pylith | f6338261b17551eba879da998a5aaf2d91f5f658 | [
"MIT"
] | 277 | 2015-02-20T16:27:35.000Z | 2022-03-30T21:13:09.000Z | tests/pytests/apps/__init__.py | Grant-Block/pylith | f6338261b17551eba879da998a5aaf2d91f5f658 | [
"MIT"
] | 71 | 2015-03-24T12:11:08.000Z | 2022-03-03T04:26:02.000Z | from .TestPetscApplication import TestPetscApplication
from .TestPyLithApp import TestPyLithApp
from .TestEqInfoApp import TestEqInfoApp
def test_classes():
return [
TestPetscApplication,
TestPyLithApp,
TestEqInfoApp,
]
# End of file
| 18 | 54 | 0.733333 | 22 | 270 | 8.954545 | 0.545455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 270 | 14 | 55 | 19.285714 | 0.938095 | 0.040741 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | true | 0 | 0.333333 | 0.111111 | 0.555556 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 4 |
e558a41b3ee2a11063dd57e7390fa719f4126f09 | 193 | py | Python | src/airfly/_vendor/airflow/providers/redis/sensors/redis_key.py | ryanchao2012/airfly | 230ddd88885defc67485fa0c51f66c4a67ae98a9 | [
"MIT"
] | 7 | 2021-09-27T11:38:48.000Z | 2022-02-01T06:06:24.000Z | src/airfly/_vendor/airflow/providers/redis/sensors/redis_key.py | ryanchao2012/airfly | 230ddd88885defc67485fa0c51f66c4a67ae98a9 | [
"MIT"
] | null | null | null | src/airfly/_vendor/airflow/providers/redis/sensors/redis_key.py | ryanchao2012/airfly | 230ddd88885defc67485fa0c51f66c4a67ae98a9 | [
"MIT"
] | null | null | null | # Auto generated by 'inv collect-airflow'
from airfly._vendor.airflow.sensors.base import BaseSensorOperator
class RedisKeySensor(BaseSensorOperator):
key: "str"
redis_conn_id: "str"
| 24.125 | 66 | 0.777202 | 23 | 193 | 6.391304 | 0.869565 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134715 | 193 | 7 | 67 | 27.571429 | 0.88024 | 0.202073 | 0 | 0 | 1 | 0 | 0.039474 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
e558b782261b5815cbb7386f25c379a311ac6fc2 | 106 | py | Python | config.py | romgille/FlappyLearning | c08b5b2965db0fbcc5e2d61c3e4da39cea1a6a1c | [
"MIT"
] | null | null | null | config.py | romgille/FlappyLearning | c08b5b2965db0fbcc5e2d61c3e4da39cea1a6a1c | [
"MIT"
] | null | null | null | config.py | romgille/FlappyLearning | c08b5b2965db0fbcc5e2d61c3e4da39cea1a6a1c | [
"MIT"
] | null | null | null | import json
cfg = []
with open('conf.json', 'r') as json_data_file:
cfg = json.load(json_data_file)
| 15.142857 | 46 | 0.669811 | 18 | 106 | 3.722222 | 0.611111 | 0.238806 | 0.358209 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.179245 | 106 | 6 | 47 | 17.666667 | 0.770115 | 0 | 0 | 0 | 0 | 0 | 0.09434 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
e561390ac0b395effdaa9beac045b73a469d2cde | 1,958 | py | Python | electronicparsers/__init__.py | nomad-coe/electronic-parsers | defb47be6ac22b2e48d4fb9204c85390a3c2f328 | [
"Apache-2.0"
] | null | null | null | electronicparsers/__init__.py | nomad-coe/electronic-parsers | defb47be6ac22b2e48d4fb9204c85390a3c2f328 | [
"Apache-2.0"
] | null | null | null | electronicparsers/__init__.py | nomad-coe/electronic-parsers | defb47be6ac22b2e48d4fb9204c85390a3c2f328 | [
"Apache-2.0"
] | null | null | null | #
# Copyright The NOMAD Authors.
#
# This file is part of NOMAD.
# See https://nomad-lab.eu for further info.
#
# 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.
#
from .abinit.parser import AbinitParser
from .atk.parser import ATKParser
from .band.parser import BandParser
from .bigdft.parser import BigDFTParser
from .castep.parser import CastepParser
from .charmm.parser import CharmmParser
from .cp2k.parser import CP2KParser
from .cpmd.parser import CPMDParser
from .crystal.parser import CrystalParser
from .dmol3.parser import Dmol3Parser
from .elk.parser import ElkParser
from .exciting.parser import ExcitingParser
from .fhiaims.parser import FHIAimsParser
from .fleur.parser import FleurParser
from .fplo.parser import FploParser
from .gamess.parser import GamessParser
from .gaussian.parser import GaussianParser
from .gpaw.parser import GPAWParser
from .molcas.parser import MolcasParser
from .mopac.parser import MopacParser
from .nwchem.parser import NWChemParser
from .octopus.parser import OctopusParser
from .onetep.parser import OnetepParser
from .orca.parser import OrcaParser
from .psi4.parser import Psi4Parser
from .qball.parser import QBallParser
from .qbox.parser import QboxParser
from .quantumespresso.parser import QuantumEspressoParser
from .siesta.parser import SiestaParser
from .turbomole.parser import TurbomoleParser
from .vasp.parser import VASPParser
from .wien2k.parser import Wien2kParser
from .yambo.parser import YamboParser
| 37.653846 | 74 | 0.814607 | 269 | 1,958 | 5.929368 | 0.509294 | 0.248276 | 0.016301 | 0.020063 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007013 | 0.126149 | 1,958 | 51 | 75 | 38.392157 | 0.92519 | 0.31716 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
e572e232af2fd52936c3966931167fe7ded553e4 | 500 | py | Python | src/test_contains_duplicate.py | manoldonev/algo-challenges | 0ecbc79fdc62d6f4712405a55bbab3e49d5139a6 | [
"MIT"
] | null | null | null | src/test_contains_duplicate.py | manoldonev/algo-challenges | 0ecbc79fdc62d6f4712405a55bbab3e49d5139a6 | [
"MIT"
] | null | null | null | src/test_contains_duplicate.py | manoldonev/algo-challenges | 0ecbc79fdc62d6f4712405a55bbab3e49d5139a6 | [
"MIT"
] | null | null | null |
import unittest
from contains_duplicate import contains_duplicate
class ContainsDuplicate(unittest.TestCase):
"""Tests for contains duplicate challenge"""
def test_case_1(self):
self.assertTrue(contains_duplicate([1, 2, 3, 1]))
def test_case_2(self):
self.assertFalse(contains_duplicate([1, 2, 3, 4]))
def test_case_3(self):
self.assertTrue(contains_duplicate([1, 1, 1, 3, 3, 4, 3, 2, 4, 2]))
if __name__ == "__main__":
unittest.main(verbosity=2)
| 22.727273 | 75 | 0.682 | 69 | 500 | 4.666667 | 0.362319 | 0.31677 | 0.102484 | 0.161491 | 0.291925 | 0.223602 | 0 | 0 | 0 | 0 | 0 | 0.054321 | 0.19 | 500 | 21 | 76 | 23.809524 | 0.740741 | 0.076 | 0 | 0 | 0 | 0 | 0.017582 | 0 | 0 | 0 | 0 | 0 | 0.272727 | 1 | 0.272727 | false | 0 | 0.181818 | 0 | 0.545455 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
e58d2196dc3f165f64bf9dc5e444099d21de8091 | 41 | py | Python | chmap/coronal_holes/tracking/src/__init__.py | predsci/CHD | 35f29d1b62861f4ffed57b38d18689b282664bcf | [
"Apache-2.0"
] | 3 | 2021-06-29T00:23:47.000Z | 2021-09-17T18:29:05.000Z | chmap/coronal_holes/tracking/src/__init__.py | predsci/CHD | 35f29d1b62861f4ffed57b38d18689b282664bcf | [
"Apache-2.0"
] | null | null | null | chmap/coronal_holes/tracking/src/__init__.py | predsci/CHD | 35f29d1b62861f4ffed57b38d18689b282664bcf | [
"Apache-2.0"
] | 1 | 2021-12-08T06:26:18.000Z | 2021-12-08T06:26:18.000Z | """ Tracking Algorithm source code. """
| 13.666667 | 39 | 0.658537 | 4 | 41 | 6.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.170732 | 41 | 2 | 40 | 20.5 | 0.794118 | 0.756098 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
e5b17ef65d7622b01e1046e73c8d6d318862aaf8 | 61 | py | Python | pathlib_tree/mounts/platform/__init__.py | hile/pathlib-tree | 73fe3132472548ca2480b3ab3278dfaab252b149 | [
"PSF-2.0"
] | 2 | 2022-01-11T14:50:24.000Z | 2022-03-16T21:37:09.000Z | pathlib_tree/mounts/platform/__init__.py | hile/pathlib-tree | 73fe3132472548ca2480b3ab3278dfaab252b149 | [
"PSF-2.0"
] | null | null | null | pathlib_tree/mounts/platform/__init__.py | hile/pathlib-tree | 73fe3132472548ca2480b3ab3278dfaab252b149 | [
"PSF-2.0"
] | null | null | null | """
OS platform specific implementations for mountpoints
"""
| 15.25 | 52 | 0.770492 | 6 | 61 | 7.833333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131148 | 61 | 3 | 53 | 20.333333 | 0.886792 | 0.852459 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
e5bfd8c6c133447e6f67f142c95b466a0c244d1d | 90 | py | Python | apps/gauth/apps.py | kentuck13/django-example | 791200e256c74882f3e1602eaca6985e5e3ea0b0 | [
"MIT"
] | 3 | 2018-10-08T20:23:18.000Z | 2021-02-15T10:27:27.000Z | apps/gauth/apps.py | myrubapa/django-example | e7c80235d59cc9fa4acf7abbe03f84cfeb5c042c | [
"MIT"
] | null | null | null | apps/gauth/apps.py | myrubapa/django-example | e7c80235d59cc9fa4acf7abbe03f84cfeb5c042c | [
"MIT"
] | 3 | 2018-09-12T08:38:46.000Z | 2021-12-12T10:00:18.000Z | from django.apps import AppConfig
class GauthConfig(AppConfig):
name = 'apps.gauth'
| 15 | 33 | 0.744444 | 11 | 90 | 6.090909 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 90 | 5 | 34 | 18 | 0.893333 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
e5cb7ba6ed1b05fe2a8fc4be6e26b7657c062eba | 56 | py | Python | tests/multivariate/common_informations/__init__.py | Ejjaffe/dit | c9d206f03d1de5a0a298b1d0ea9d79ea5e789ee1 | [
"BSD-3-Clause"
] | 1 | 2020-03-13T10:30:11.000Z | 2020-03-13T10:30:11.000Z | tests/multivariate/common_informations/__init__.py | Ejjaffe/dit | c9d206f03d1de5a0a298b1d0ea9d79ea5e789ee1 | [
"BSD-3-Clause"
] | null | null | null | tests/multivariate/common_informations/__init__.py | Ejjaffe/dit | c9d206f03d1de5a0a298b1d0ea9d79ea5e789ee1 | [
"BSD-3-Clause"
] | null | null | null | """
Tests for dit.multivariate.common_informations.
"""
| 14 | 47 | 0.75 | 6 | 56 | 6.833333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.089286 | 56 | 3 | 48 | 18.666667 | 0.803922 | 0.839286 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
e5d7ddf353e262cc6c31958e4b2bef591e41dbb9 | 657 | py | Python | src/scenes/elements/__init__.py | GRUPO-ES2-GJLRT/XADREZ_ES2 | 2a0d05a17590311d140fa287f69b8704346a493d | [
"MIT"
] | 1 | 2015-05-02T23:02:12.000Z | 2015-05-02T23:02:12.000Z | src/scenes/elements/__init__.py | GRUPO-ES2-GJLRT/XADREZ_ES2 | 2a0d05a17590311d140fa287f69b8704346a493d | [
"MIT"
] | null | null | null | src/scenes/elements/__init__.py | GRUPO-ES2-GJLRT/XADREZ_ES2 | 2a0d05a17590311d140fa287f69b8704346a493d | [
"MIT"
] | null | null | null | # coding: UTF-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from .game_div import GameDiv
from .chess_element import ChessElement
from .game_text_element import GameTextElement
from .image_element import ImageElement
from .pieces_element import PiecesElement
from .rect_element import RectElement
from .square_element import SquareElement
from .snap_element import SnapElement
from .button_group import ButtonGroup
from .list_option_element import ListOptionElement
from .number_option_element import NumberOptionElement
from .tree_element import TreeElement
from .others import Font, Image
| 36.5 | 57 | 0.832572 | 81 | 657 | 6.481481 | 0.518519 | 0.247619 | 0.072381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001757 | 0.133942 | 657 | 17 | 58 | 38.647059 | 0.920914 | 0.019787 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.933333 | 0 | 0.933333 | 0.066667 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
e5da2e004aaf5d19a4ac33585bd297f0644eba11 | 95 | py | Python | python_work/simple_message.py | lucas-jsvd/python_crash_course_2nd | 8404e7769bef7b90b9b0897996c3a3f969bb72bd | [
"Unlicense"
] | null | null | null | python_work/simple_message.py | lucas-jsvd/python_crash_course_2nd | 8404e7769bef7b90b9b0897996c3a3f969bb72bd | [
"Unlicense"
] | null | null | null | python_work/simple_message.py | lucas-jsvd/python_crash_course_2nd | 8404e7769bef7b90b9b0897996c3a3f969bb72bd | [
"Unlicense"
] | null | null | null | message = "Estou aprendendo Python, lendo este livro e fazendo seus exercicios."
print(message) | 47.5 | 80 | 0.8 | 13 | 95 | 5.846154 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126316 | 95 | 2 | 81 | 47.5 | 0.915663 | 0 | 0 | 0 | 0 | 0 | 0.708333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
e5ff8a3892072b487513fed6c7c7a7c1a8df7bd5 | 193 | py | Python | forocacao/app/apps.py | javierwilson/resilienciacafe | 303615e1e3c9bd9ed9e5e7b7ccab0d8a061dc3fc | [
"BSD-3-Clause"
] | null | null | null | forocacao/app/apps.py | javierwilson/resilienciacafe | 303615e1e3c9bd9ed9e5e7b7ccab0d8a061dc3fc | [
"BSD-3-Clause"
] | null | null | null | forocacao/app/apps.py | javierwilson/resilienciacafe | 303615e1e3c9bd9ed9e5e7b7ccab0d8a061dc3fc | [
"BSD-3-Clause"
] | 1 | 2020-10-24T20:47:17.000Z | 2020-10-24T20:47:17.000Z | from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class EventAppConfig(AppConfig):
name = 'forocacao.app'
verbose_name = _('Event Management')
| 24.125 | 55 | 0.772021 | 23 | 193 | 6.304348 | 0.782609 | 0.137931 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.150259 | 193 | 7 | 56 | 27.571429 | 0.884146 | 0 | 0 | 0 | 0 | 0 | 0.150259 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
f904b7caacfefd045d8cd9dba1543307e5c14fb1 | 105 | py | Python | tt/exceptz/BadArguments.py | sebastian-lemke/tt | 2ff1ec23d206632446b08e56add1a8852af7415a | [
"MIT"
] | 13 | 2020-06-23T18:05:14.000Z | 2022-01-26T17:37:59.000Z | tt/exceptz/BadArguments.py | sebastian-lemke/tt | 2ff1ec23d206632446b08e56add1a8852af7415a | [
"MIT"
] | 6 | 2020-03-26T00:47:52.000Z | 2022-02-15T13:03:05.000Z | tt/exceptz/BadArguments.py | sebastian-lemke/tt | 2ff1ec23d206632446b08e56add1a8852af7415a | [
"MIT"
] | 5 | 2021-02-12T15:58:39.000Z | 2021-11-17T09:27:26.000Z | import .TIError
class BadArguments(TIError):
"""The command line arguments passed are not valid."""
| 21 | 58 | 0.733333 | 13 | 105 | 5.923077 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.161905 | 105 | 4 | 59 | 26.25 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.5 | null | null | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
f918591ce5a3f6c6a39d8f5bcd8215ecd6cfb554 | 104 | py | Python | scripts/npc/elizaHarp3.py | G00dBye/YYMS | 1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb | [
"MIT"
] | 54 | 2019-04-16T23:24:48.000Z | 2021-12-18T11:41:50.000Z | scripts/npc/elizaHarp3.py | G00dBye/YYMS | 1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb | [
"MIT"
] | 3 | 2019-05-19T15:19:41.000Z | 2020-04-27T16:29:16.000Z | scripts/npc/elizaHarp3.py | G00dBye/YYMS | 1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb | [
"MIT"
] | 49 | 2020-11-25T23:29:16.000Z | 2022-03-26T16:20:24.000Z | # Harp String <E> (2012029) | Eliza's Garden (920020000)
# Author: Tiger
sm.playSound("orbis/mi", 100)
| 20.8 | 56 | 0.682692 | 15 | 104 | 4.733333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.213483 | 0.144231 | 104 | 4 | 57 | 26 | 0.58427 | 0.653846 | 0 | 0 | 0 | 0 | 0.242424 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
f9279dd2438b8baa68f4fba32a348838636cb536 | 291 | py | Python | deployment/docker/manage.py | edoburu/demo.django-fluent.org | 10556eb383849fb20b8c6958d87c4b9f94085af2 | [
"CC-BY-3.0"
] | 24 | 2016-09-09T02:54:18.000Z | 2021-02-28T05:35:01.000Z | deployment/docker/manage.py | edoburu/demo.django-fluent.org | 10556eb383849fb20b8c6958d87c4b9f94085af2 | [
"CC-BY-3.0"
] | 288 | 2017-04-13T16:00:23.000Z | 2022-01-06T13:48:02.000Z | deployment/docker/manage.py | edoburu/demo.django-fluent.org | 10556eb383849fb20b8c6958d87c4b9f94085af2 | [
"CC-BY-3.0"
] | 5 | 2017-03-20T10:37:59.000Z | 2020-07-28T15:44:08.000Z | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
# Make sure manage.py can be called from the $PATH
from django.core.management import execute_from_command_line
os.chdir('/app/src')
sys.path.insert(0, '/app/src')
execute_from_command_line(sys.argv)
| 26.454545 | 64 | 0.714777 | 46 | 291 | 4.217391 | 0.695652 | 0.113402 | 0.185567 | 0.226804 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004132 | 0.168385 | 291 | 10 | 65 | 29.1 | 0.797521 | 0.237113 | 0 | 0 | 0 | 0 | 0.109091 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.428571 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
00a7877f74ea288ee509ad5d496d615baf32c468 | 150 | py | Python | bids/layout/__init__.py | miykael/pybids | 826591b991ac9a380b46ac8412167de2f3aa87a6 | [
"MIT"
] | 1 | 2021-06-18T20:25:28.000Z | 2021-06-18T20:25:28.000Z | bids/layout/__init__.py | miykael/pybids | 826591b991ac9a380b46ac8412167de2f3aa87a6 | [
"MIT"
] | null | null | null | bids/layout/__init__.py | miykael/pybids | 826591b991ac9a380b46ac8412167de2f3aa87a6 | [
"MIT"
] | null | null | null | from .layout import BIDSLayout, add_config_paths
from .validation import BIDSValidator
__all__ = ["BIDSLayout", "BIDSValidator", "add_config_paths"]
| 30 | 61 | 0.806667 | 17 | 150 | 6.647059 | 0.588235 | 0.159292 | 0.247788 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 150 | 4 | 62 | 37.5 | 0.837037 | 0 | 0 | 0 | 0 | 0 | 0.26 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
00ad5f6eaae30f71a18cfde91722df34e11392eb | 4,595 | py | Python | tests/test_deployment.py | tbartelmess/python-nomad | 3ddbf904af2947992722a9dcf58c23eb0078fc8f | [
"MIT"
] | null | null | null | tests/test_deployment.py | tbartelmess/python-nomad | 3ddbf904af2947992722a9dcf58c23eb0078fc8f | [
"MIT"
] | null | null | null | tests/test_deployment.py | tbartelmess/python-nomad | 3ddbf904af2947992722a9dcf58c23eb0078fc8f | [
"MIT"
] | null | null | null | import pytest
import tests.common as common
import os
import nomad
@pytest.fixture
def nomad_setup():
n = nomad.Nomad(host=common.IP, port=common.NOMAD_PORT, verify=False, token=common.NOMAD_TOKEN)
return n
# integration tests requires nomad Vagrant VM or Binary running
@pytest.mark.skipif(tuple(int(i) for i in os.environ.get("NOMAD_VERSION").split(".")) < (0, 6, 0), reason="Not supported in version")
def test_get_deployment(nomad_setup):
deploymentID = nomad_setup.deployments.get_deployments()[0]["ID"]
assert isinstance(nomad_setup.deployment.get_deployment(deploymentID), dict)
assert deploymentID == nomad_setup.deployment.get_deployment(deploymentID)["ID"]
@pytest.mark.skipif(tuple(int(i) for i in os.environ.get("NOMAD_VERSION").split(".")) < (0, 6, 0), reason="Not supported in version")
def test_get_deployment_allocations(nomad_setup):
deploymentID = nomad_setup.deployments.get_deployments()[0]["ID"]
assert isinstance(nomad_setup.deployment.get_deployment_allocations(deploymentID), list)
assert isinstance(nomad_setup.deployment.get_deployment_allocations(deploymentID)[0], dict)
assert "example" == nomad_setup.deployment.get_deployment_allocations(deploymentID)[0]["JobID"]
@pytest.mark.skipif(tuple(int(i) for i in os.environ.get("NOMAD_VERSION").split(".")) < (0, 6, 0), reason="Not supported in version")
def test_fail_deployment(nomad_setup):
deploymentID = nomad_setup.deployments.get_deployments()[0]["ID"]
try:
nomad_setup.deployment.fail_deployment(deploymentID)
except nomad.api.exceptions.URLNotFoundNomadException as err:
assert err.nomad_resp.text == "can't fail terminal deployment"
@pytest.mark.skipif(tuple(int(i) for i in os.environ.get("NOMAD_VERSION").split(".")) < (0, 6, 0), reason="Not supported in version")
def test_pause_deployment(nomad_setup):
deploymentID = nomad_setup.deployments.get_deployments()[0]["ID"]
try:
nomad_setup.deployment.pause_deployment(deploymentID, False)
except nomad.api.exceptions.URLNotFoundNomadException as err:
assert err.nomad_resp.text == "can't resume terminal deployment"
@pytest.mark.skipif(tuple(int(i) for i in os.environ.get("NOMAD_VERSION").split(".")) < (0, 6, 0), reason="Not supported in version")
def test_promote_all_deployment(nomad_setup):
deploymentID = nomad_setup.deployments.get_deployments()[0]["ID"]
try:
nomad_setup.deployment.promote_deployment_all(deploymentID)
except nomad.api.exceptions.URLNotFoundNomadException as err:
assert err.nomad_resp.text == "can't promote terminal deployment"
@pytest.mark.skipif(tuple(int(i) for i in os.environ.get("NOMAD_VERSION").split(".")) < (0, 6, 0), reason="Not supported in version")
def test_promote_all_deployment(nomad_setup):
deploymentID = nomad_setup.deployments.get_deployments()[0]["ID"]
try:
nomad_setup.deployment.promote_deployment_groups(deploymentID)
except nomad.api.exceptions.URLNotFoundNomadException as err:
assert err.nomad_resp.text == "can't promote terminal deployment"
@pytest.mark.skipif(tuple(int(i) for i in os.environ.get("NOMAD_VERSION").split(".")) < (0, 6, 0), reason="Not supported in version")
def test_deployment_allocation_health(nomad_setup):
deploymentID = nomad_setup.deployments.get_deployments()[0]["ID"]
allocationID = nomad_setup.deployment.get_deployment(deploymentID)["ID"]
try:
nomad_setup.deployment.deployment_allocation_health(deploymentID, unhealthy_allocations=[allocationID])
except nomad.api.exceptions.URLNotFoundNomadException as err:
assert err.nomad_resp.text == "can't set health of allocations for a terminal deployment"
def test_dunder_getitem_exist(nomad_setup):
evalID = nomad_setup.job.get_allocations("example")[0]["EvalID"]
e = nomad_setup.evaluation[evalID]
assert isinstance(e, dict)
def test_dunder_getitem_not_exist(nomad_setup):
with pytest.raises(KeyError):
_ = nomad_setup.deployment["nope"]
def test_dunder_contain_exists(nomad_setup):
evalID = nomad_setup.job.get_allocations("example")[0]["EvalID"]
assert evalID in nomad_setup.evaluation
def test_dunder_contain_not_exist(nomad_setup):
assert "nope" not in nomad_setup.deployment
def test_dunder_str(nomad_setup):
assert isinstance(str(nomad_setup.deployment), str)
def test_dunder_repr(nomad_setup):
assert isinstance(repr(nomad_setup.deployment), str)
def test_dunder_getattr(nomad_setup):
with pytest.raises(AttributeError):
_ = nomad_setup.deployment.does_not_exist
| 44.61165 | 133 | 0.756257 | 616 | 4,595 | 5.438312 | 0.154221 | 0.125373 | 0.095522 | 0.043881 | 0.731642 | 0.709254 | 0.705672 | 0.656119 | 0.638806 | 0.610448 | 0 | 0.007937 | 0.122524 | 4,595 | 102 | 134 | 45.04902 | 0.822917 | 0.013275 | 0 | 0.405405 | 0 | 0 | 0.113636 | 0 | 0 | 0 | 0 | 0 | 0.202703 | 1 | 0.202703 | false | 0 | 0.054054 | 0 | 0.27027 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
00de2e8ec3e9d828ec30d2fe9c5049919870f36f | 97 | py | Python | nyoka/PMML44/behaviors/addRule.py | maxibor/nyoka | 19f480eee608035aa5fba368c96d4143bc2f5710 | [
"Apache-2.0"
] | 71 | 2020-08-24T07:59:56.000Z | 2022-03-21T08:36:35.000Z | nyoka/PMML43Ext/behaviors/addRule.py | Chiragasourabh/nyoka | 44003b5dc500b18d3a2b2c6ed6fc4db217e2d2c0 | [
"Apache-2.0"
] | 16 | 2020-09-02T10:27:36.000Z | 2022-03-31T05:37:12.000Z | nyoka/PMML43Ext/behaviors/addRule.py | Chiragasourabh/nyoka | 44003b5dc500b18d3a2b2c6ed6fc4db217e2d2c0 | [
"Apache-2.0"
] | 16 | 2020-09-17T15:01:33.000Z | 2022-03-28T03:13:25.000Z | self.AssociationRule.append(value)
self.numberOfRules = len(self.AssociationRule) | 48.5 | 54 | 0.71134 | 9 | 97 | 7.666667 | 0.666667 | 0.550725 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195876 | 97 | 2 | 54 | 48.5 | 0.884615 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
daa2ddb4dc5317acd0f15af368ed16ecff3db9b9 | 21 | py | Python | data/studio21_generated/introductory/4933/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | data/studio21_generated/introductory/4933/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | data/studio21_generated/introductory/4933/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | def random_case(x):
| 10.5 | 19 | 0.714286 | 4 | 21 | 3.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 21 | 2 | 20 | 10.5 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
daab6eaa9a29b648c80680bdc17ff9b231f28948 | 171 | py | Python | sfft/utils/meta/__init__.py | thomasvrussell/sfft | 7b165ac301254ca61dc966e5915c1a407fad6f88 | [
"MIT"
] | 8 | 2021-09-20T04:21:26.000Z | 2021-09-22T14:28:10.000Z | sfft/utils/meta/__init__.py | thomasvrussell/sfft | 7b165ac301254ca61dc966e5915c1a407fad6f88 | [
"MIT"
] | null | null | null | sfft/utils/meta/__init__.py | thomasvrussell/sfft | 7b165ac301254ca61dc966e5915c1a407fad6f88 | [
"MIT"
] | 2 | 2021-09-22T06:52:56.000Z | 2021-09-22T22:54:47.000Z | """
Remarks on Internal Packages Imports:
NONE
"""
from .FileLockKit import FileLock
from .MultiProc import Multi_Proc
from .TimeoutKit import Timeout, TimeoutAfter
| 17.1 | 45 | 0.777778 | 20 | 171 | 6.6 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.157895 | 171 | 9 | 46 | 19 | 0.916667 | 0.269006 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
dac1043372e3eed1b35fe0c2f146528ab99bf61b | 192 | py | Python | nixui/graphics/icon.py | adrianparvino/nix-gui | 569337b614d72d26769b49457c929c67367a5584 | [
"MIT"
] | null | null | null | nixui/graphics/icon.py | adrianparvino/nix-gui | 569337b614d72d26769b49457c929c67367a5584 | [
"MIT"
] | null | null | null | nixui/graphics/icon.py | adrianparvino/nix-gui | 569337b614d72d26769b49457c929c67367a5584 | [
"MIT"
] | null | null | null | from PyQt5 import QtGui
import pkgutil
def get_icon(filename):
pmap = QtGui.QPixmap()
pmap.loadFromData(pkgutil.get_data('nixui', f'icons/{filename}'))
return QtGui.QIcon(pmap)
| 19.2 | 69 | 0.71875 | 26 | 192 | 5.230769 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006173 | 0.15625 | 192 | 9 | 70 | 21.333333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0.109375 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
dac7c990535253359f09d7210147e44657c040a6 | 46 | py | Python | dfapi/__init__.py | altest-com/dnfas-api | 56b4dfbef33fd9ad6e6504d1cb88105069b57d70 | [
"MIT"
] | null | null | null | dfapi/__init__.py | altest-com/dnfas-api | 56b4dfbef33fd9ad6e6504d1cb88105069b57d70 | [
"MIT"
] | 1 | 2020-03-31T17:20:57.000Z | 2020-04-01T17:40:31.000Z | dfapi/__init__.py | altest-com/dnfas-api | 56b4dfbef33fd9ad6e6504d1cb88105069b57d70 | [
"MIT"
] | null | null | null | default_app_config = 'dfapi.apps.DfapiConfig'
| 23 | 45 | 0.826087 | 6 | 46 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.065217 | 46 | 1 | 46 | 46 | 0.837209 | 0 | 0 | 0 | 0 | 0 | 0.478261 | 0.478261 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
dada3df7625c477cdf9a7bb65c4435d3363efb19 | 34 | py | Python | open without for.py | Arjitg450/Python-Programs | 0630422c9002632a91b5ccf75f6cd02308c6e929 | [
"MIT"
] | null | null | null | open without for.py | Arjitg450/Python-Programs | 0630422c9002632a91b5ccf75f6cd02308c6e929 | [
"MIT"
] | null | null | null | open without for.py | Arjitg450/Python-Programs | 0630422c9002632a91b5ccf75f6cd02308c6e929 | [
"MIT"
] | null | null | null | fh = open("ss.txt","r")
print(fh)
| 11.333333 | 23 | 0.558824 | 7 | 34 | 2.714286 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117647 | 34 | 2 | 24 | 17 | 0.633333 | 0 | 0 | 0 | 0 | 0 | 0.205882 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 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 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
dafd039009061bde6f1df3e78944f5b61342f1cd | 54 | py | Python | paka/webstatic/__init__.py | PavloKapyshin/paka.webstatic | 43cd02dea5ab0e77e21e96f730a2106bac752401 | [
"BSD-3-Clause"
] | null | null | null | paka/webstatic/__init__.py | PavloKapyshin/paka.webstatic | 43cd02dea5ab0e77e21e96f730a2106bac752401 | [
"BSD-3-Clause"
] | null | null | null | paka/webstatic/__init__.py | PavloKapyshin/paka.webstatic | 43cd02dea5ab0e77e21e96f730a2106bac752401 | [
"BSD-3-Clause"
] | null | null | null | """Simple utilities for web-related static things."""
| 27 | 53 | 0.740741 | 7 | 54 | 5.714286 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 54 | 1 | 54 | 54 | 0.833333 | 0.87037 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
974e88b5653d05f68ae5dd94cb9756aca7d0262e | 316 | py | Python | profile_generator/model/color/space/color_space.py | nethy/profile-generator | 9bc54bed36b84b45902d75a273739480b4ff2204 | [
"MIT"
] | null | null | null | profile_generator/model/color/space/color_space.py | nethy/profile-generator | 9bc54bed36b84b45902d75a273739480b4ff2204 | [
"MIT"
] | null | null | null | profile_generator/model/color/space/color_space.py | nethy/profile-generator | 9bc54bed36b84b45902d75a273739480b4ff2204 | [
"MIT"
] | null | null | null | from collections.abc import Callable
from typing import NamedTuple
from profile_generator.model.linalg import Matrix, Vector
class ColorSpace(NamedTuple):
xyz_matrix: Matrix
xyz_inverse_matrix: Matrix
white_point: Vector
gamma: Callable[[float], float]
inverse_gamma: Callable[[float], float]
| 24.307692 | 57 | 0.772152 | 39 | 316 | 6.102564 | 0.538462 | 0.10084 | 0.151261 | 0.193277 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.158228 | 316 | 12 | 58 | 26.333333 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
9756f454b17003c9ab5431e30b32696b6b66af4b | 250 | py | Python | examples/print_tree.py | aoertel/ultrametric-matrix-tools | e8429b7b25403357d06f07427eee6d6023c06c01 | [
"Apache-2.0"
] | 1 | 2022-01-19T10:09:23.000Z | 2022-01-19T10:09:23.000Z | examples/print_tree.py | aoertel/ultrametric-matrix-tools | e8429b7b25403357d06f07427eee6d6023c06c01 | [
"Apache-2.0"
] | null | null | null | examples/print_tree.py | aoertel/ultrametric-matrix-tools | e8429b7b25403357d06f07427eee6d6023c06c01 | [
"Apache-2.0"
] | null | null | null | from ultrametric_matrix_tools import UltrametricTree
import numpy as np
matrix = np.array([[0.0, 1.0, 3.0, 1.0], [1.0, 3.0, 1.0, 1.0], [
3.0, 1.0, 5.0, 1.0], [1.0, 1.0, 1.0, 1.0]])
tree = UltrametricTree(matrix)
tree.print_tree()
| 27.777778 | 64 | 0.592 | 51 | 250 | 2.843137 | 0.313725 | 0.151724 | 0.227586 | 0.165517 | 0.206897 | 0.206897 | 0.206897 | 0.206897 | 0.206897 | 0.131034 | 0 | 0.160804 | 0.204 | 250 | 8 | 65 | 31.25 | 0.567839 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.166667 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
97c6b3a5b3da885209a8ce77ba7066c995001e55 | 160 | py | Python | routerling/__init__.py | rayattack/pyrouterling | 124a36e5266d18a6f6d1e33287b7cf4338054d54 | [
"MIT"
] | 1 | 2021-03-06T20:26:36.000Z | 2021-03-06T20:26:36.000Z | routerling/__init__.py | rayattack/routerling | 124a36e5266d18a6f6d1e33287b7cf4338054d54 | [
"MIT"
] | null | null | null | routerling/__init__.py | rayattack/routerling | 124a36e5266d18a6f6d1e33287b7cf4338054d54 | [
"MIT"
] | null | null | null | from .router import Router
from .request import HttpRequest
from .response import ResponseWriter
from .context import Context
__version___ = '0.3.2'
| 17.777778 | 37 | 0.75625 | 20 | 160 | 5.8 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023077 | 0.1875 | 160 | 8 | 38 | 20 | 0.869231 | 0 | 0 | 0 | 0 | 0 | 0.032895 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
8aec3b2edd85286d7b4cb96e7a9c05475b087e94 | 4,055 | py | Python | api/access/utils.py | SHARANTANGEDA/CueObserve | c3fbd77058101154ab59fc0e88bf6c02f8e2b446 | [
"Apache-2.0"
] | null | null | null | api/access/utils.py | SHARANTANGEDA/CueObserve | c3fbd77058101154ab59fc0e88bf6c02f8e2b446 | [
"Apache-2.0"
] | null | null | null | api/access/utils.py | SHARANTANGEDA/CueObserve | c3fbd77058101154ab59fc0e88bf6c02f8e2b446 | [
"Apache-2.0"
] | null | null | null | import pandas as pd
def aggregateDf(df, timestampCol):
"""
Utility function to aggregate dataframe on timestamp column
"""
df.dropna(inplace=True)
df = df.groupby(timestampCol).sum()
df.reset_index(inplace=True)
df.columns = ["ds" if col == timestampCol else "y" for col in df.columns]
return df
def prepareAnomalyDataframes(datasetDf, timestampCol, metricCol, dimensionCol=None, operation=None,value=10):
"""
Utility function to prepare anomaly dataframes by grouping on dimension
"""
dimValsData = []
if dimensionCol:
if operation == "Top":
dimValsData = topNDimensionalValues(datasetDf, timestampCol, metricCol, dimensionCol, value)
elif operation == "Min % Contribution":
dimValsData = contributionOnDimensionalValues(datasetDf, timestampCol, metricCol, dimensionCol, value)
elif operation == "Min Value":
dimValsData = minValueOnDimensionalValues(datasetDf, timestampCol, metricCol, dimensionCol, value)
else:
tempDf = datasetDf[[timestampCol, metricCol]]
dimValsData.append({"dimVal": None, "contriPercent": 100.0, "df": aggregateDf(tempDf, timestampCol)})
return dimValsData
def topNDimensionalValues(datasetDf, timestampCol, metricCol, dimensionCol=None, topN=10):
"""
Utility function to prepare anomaly dataframes by grouping on dimension for Top N dimensional values
"""
datasetDf[metricCol] = pd.to_numeric(datasetDf[metricCol])
dimValsData = []
datasetDf = datasetDf[[timestampCol, dimensionCol, metricCol]]
topValsDf = datasetDf[[dimensionCol, metricCol]].groupby(dimensionCol).sum().sort_values(metricCol, ascending=False)
dimVals = list(topValsDf[:topN].index)
total = datasetDf[metricCol].sum()
for dimVal in dimVals:
tempDf = datasetDf[datasetDf[dimensionCol] == dimVal][[timestampCol, metricCol]]
contriPercent = int(10000 * (tempDf[metricCol].sum() / total)) / 100
dimValsData.append({"dimVal": dimVal, "contriPercent": contriPercent, "df": aggregateDf(tempDf, timestampCol)})
return dimValsData
def contributionOnDimensionalValues(datasetDf, timestampCol, metricCol, dimensionCol=None, value=1):
"""
Utility function to prepare anomaly dataframes by grouping on dimension for dimensional values
"""
datasetDf[metricCol] = pd.to_numeric(datasetDf[metricCol])
dimValsData = []
datasetDf = datasetDf[[timestampCol, dimensionCol, metricCol]]
topValsDf = datasetDf[[dimensionCol, metricCol]].groupby(dimensionCol).sum().sort_values(metricCol, ascending=False)
dimVals = list(topValsDf[:].index)
total = datasetDf[metricCol].sum()
for dimVal in dimVals:
tempDf = datasetDf[datasetDf[dimensionCol] == dimVal][[timestampCol, metricCol]]
contriPercent = int(10000 * (tempDf[metricCol].sum() / total)) / 100
if contriPercent >= value:
dimValsData.append({"dimVal": dimVal, "contriPercent": contriPercent, "df": aggregateDf(tempDf, timestampCol)})
return dimValsData
def minValueOnDimensionalValues(datasetDf, timestampCol, metricCol, dimensionCol=None, value=1):
"""
Utility function to prepare anomaly dataframes by grouping on dimension for dimensional values
"""
datasetDf[metricCol] = pd.to_numeric(datasetDf[metricCol])
dimValsData = []
datasetDf = datasetDf[[timestampCol, dimensionCol, metricCol]]
topValsDf = datasetDf[[dimensionCol, metricCol]].groupby(dimensionCol).sum().sort_values(metricCol, ascending=False)
dimVals = list(topValsDf[:].index)
total = datasetDf[metricCol].sum()
for dimVal in dimVals:
tempDf = datasetDf[datasetDf[dimensionCol] == dimVal][[timestampCol, metricCol]]
totalSum = tempDf[metricCol].sum()
if totalSum >= value:
contriPercent = int(10000 * (totalSum / total)) / 100
dimValsData.append({"dimVal": dimVal, "contriPercent": contriPercent, "df": aggregateDf(tempDf, timestampCol)})
return dimValsData
| 45.561798 | 123 | 0.705549 | 388 | 4,055 | 7.35567 | 0.195876 | 0.080939 | 0.084093 | 0.103013 | 0.810091 | 0.706027 | 0.706027 | 0.688157 | 0.644008 | 0.644008 | 0 | 0.010263 | 0.182984 | 4,055 | 88 | 124 | 46.079545 | 0.851192 | 0.104069 | 0 | 0.559322 | 0 | 0 | 0.032911 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.084746 | false | 0 | 0.016949 | 0 | 0.186441 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
c120afbc5c8c88e2f1388422b96b8410e746ba83 | 201 | py | Python | pybricksdev/__main__.py | thesynman/pybricksdev | 6f34cfb7a5f26628fe3cedae1ce51ee6024f57b9 | [
"MIT"
] | 25 | 2020-06-15T07:24:33.000Z | 2022-03-12T16:10:02.000Z | pybricksdev/__main__.py | thesynman/pybricksdev | 6f34cfb7a5f26628fe3cedae1ce51ee6024f57b9 | [
"MIT"
] | 29 | 2020-06-18T19:55:51.000Z | 2022-03-01T21:50:38.000Z | pybricksdev/__main__.py | thesynman/pybricksdev | 6f34cfb7a5f26628fe3cedae1ce51ee6024f57b9 | [
"MIT"
] | 12 | 2020-06-16T04:38:16.000Z | 2022-02-23T09:15:36.000Z | # SPDX-License-Identifier: MIT
# Copyright (c) 2019-2020 The Pybricks Authors
"""Main entry point for running pybricksdev as a module."""
from .cli import main
if __name__ == "__main__":
main()
| 20.1 | 59 | 0.711443 | 28 | 201 | 4.821429 | 0.892857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.048193 | 0.174129 | 201 | 9 | 60 | 22.333333 | 0.76506 | 0.636816 | 0 | 0 | 0 | 0 | 0.121212 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
c138de2e9b134961e8d9b0bbbbc0510278bec02b | 2,538 | py | Python | 728.self-dividing-numbers.py | W-KE/Leetcode-Solutions | b6f40e45ddfa1a61a05f832b79581a34dab832cd | [
"MIT"
] | null | null | null | 728.self-dividing-numbers.py | W-KE/Leetcode-Solutions | b6f40e45ddfa1a61a05f832b79581a34dab832cd | [
"MIT"
] | null | null | null | 728.self-dividing-numbers.py | W-KE/Leetcode-Solutions | b6f40e45ddfa1a61a05f832b79581a34dab832cd | [
"MIT"
] | null | null | null | # class Solution:
# def selfDividingNumbers(self, left: int, right: int) -> List[int]:
# all_dividing_numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 22, 24, 33, 36, 44, 48, 55, 66, 77, 88, 99, 111, 112, 115, 122, 124, 126, 128, 132, 135, 144, 155, 162, 168, 175, 184, 212, 216, 222, 224, 244, 248, 264, 288, 312, 315, 324, 333, 336, 366, 384, 396, 412, 424, 432, 444, 448, 488, 515, 555, 612, 624, 636, 648, 666, 672, 728, 735, 777, 784, 816, 824, 848, 864, 888, 936, 999, 1111, 1112, 1113, 1115, 1116, 1122, 1124, 1128, 1131, 1144, 1155, 1164, 1176, 1184, 1197, 1212, 1222, 1224, 1236, 1244, 1248, 1266, 1288, 1296, 1311, 1326, 1332, 1335, 1344, 1362, 1368, 1395, 1412, 1416, 1424, 1444, 1448, 1464, 1488, 1515, 1555, 1575, 1626, 1632, 1644, 1662, 1692, 1715, 1722, 1764, 1771, 1824, 1848, 1888, 1926, 1935, 1944, 1962, 2112, 2122, 2124, 2128, 2136, 2144, 2166, 2184, 2196, 2212, 2222, 2224, 2226, 2232, 2244, 2248, 2262, 2288, 2316, 2322, 2328, 2364, 2412, 2424, 2436, 2444, 2448, 2488, 2616, 2622, 2664, 2688, 2744, 2772, 2824, 2832, 2848, 2888, 2916, 3111, 3126, 3132, 3135, 3144, 3162, 3168, 3171, 3195, 3216, 3222, 3264, 3276, 3288, 3312, 3315, 3324, 3333, 3336, 3339, 3366, 3384, 3393, 3432, 3444, 3492, 3555, 3612, 3624, 3636, 3648, 3666, 3717, 3816, 3864, 3888, 3915, 3924, 3933, 3996, 4112, 4116, 4124, 4128, 4144, 4164, 4172, 4184, 4212, 4224, 4236, 4244, 4248, 4288, 4332, 4344, 4368, 4392, 4412, 4416, 4424, 4444, 4448, 4464, 4488, 4632, 4644, 4824, 4848, 4872, 4888, 4896, 4932, 4968, 5115, 5155, 5355, 5515, 5535, 5555, 5775, 6126, 6132, 6144, 6162, 6168, 6192, 6216, 6222, 6264, 6288, 6312, 6324, 6336, 6366, 6384, 6432, 6444, 6612, 6624, 6636, 6648, 6666, 6696, 6762, 6816, 6864, 6888, 6912, 6966, 6984, 7112, 7119, 7175, 7224, 7266, 7371, 7448, 7476, 7644, 7728, 7777, 7784, 8112, 8128, 8136, 8144, 8184, 8224, 8232, 8248, 8288, 8328, 8424, 8448, 8488, 8496, 8616, 8664, 8688, 8736, 8824, 8832, 8848, 8888, 8928, 9126, 9135, 9144, 9162, 9216, 9288, 9315, 9324, 9333, 9396, 9432, 9612, 9648, 9666, 9864, 9936, 9999]
# result = []
# for i in all_dividing_numbers:
# if i < left:
# continue
# if i > right:
# break
# result.append(i)
# return result
#
result = {}
for i in range(1, 10001):
dividing = True
for s in str(i):
if s == "0":
dividing = False
break
if i % int(s) != 0:
dividing = False
break
result[i] = dividing
print(result)
| 90.642857 | 1,956 | 0.602837 | 406 | 2,538 | 3.758621 | 0.906404 | 0.005898 | 0.023591 | 0.015727 | 0.026212 | 0 | 0 | 0 | 0 | 0 | 0 | 0.647545 | 0.237589 | 2,538 | 27 | 1,957 | 94 | 0.141085 | 0.886131 | 0 | 0.333333 | 0 | 0 | 0.003663 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.083333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
c1b7914b6584bfaa45fe6b3df1f87ef3f0fdea81 | 84 | py | Python | tests/perfs/test_ozone_perf_measure_L2.py | jmabry/pyaf | afbc15a851a2445a7824bf255af612dc429265af | [
"BSD-3-Clause"
] | null | null | null | tests/perfs/test_ozone_perf_measure_L2.py | jmabry/pyaf | afbc15a851a2445a7824bf255af612dc429265af | [
"BSD-3-Clause"
] | 1 | 2019-11-30T23:39:38.000Z | 2019-12-01T04:34:35.000Z | tests/perfs/test_ozone_perf_measure_L2.py | jmabry/pyaf | afbc15a851a2445a7824bf255af612dc429265af | [
"BSD-3-Clause"
] | null | null | null |
import pyaf.tests.perfs.test_ozone_perf_measure as tperf
tperf.build_model("L2");
| 16.8 | 56 | 0.809524 | 14 | 84 | 4.571429 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012987 | 0.083333 | 84 | 4 | 57 | 21 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0.024096 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
c1c17c61e63a33affd097cf559086cd05346d86e | 489 | py | Python | conference/users.py | fpierfed/epcon | f9bfa95529fe6a59c4ca21baf05af0ca37ab3d17 | [
"BSD-2-Clause"
] | 40 | 2015-03-03T22:14:58.000Z | 2022-02-15T22:27:48.000Z | conference/users.py | fpierfed/epcon | f9bfa95529fe6a59c4ca21baf05af0ca37ab3d17 | [
"BSD-2-Clause"
] | 699 | 2015-01-21T10:13:29.000Z | 2022-02-08T09:26:36.000Z | conference/users.py | fpierfed/epcon | f9bfa95529fe6a59c4ca21baf05af0ca37ab3d17 | [
"BSD-2-Clause"
] | 96 | 2015-01-22T11:03:13.000Z | 2022-01-31T05:35:34.000Z | """
This module takes care of a lot of user related things.
It's a good place to put validators and user management functions/classes
"""
import os
RANDOM_USERNAME_LENGTH = 12
def generate_random_username():
"""Returns random username of length set by RANDOM_USERNAME_LENGTH
The generated names will always start with 'ep' to make sure that we
don't generate numeric only names.
"""
return 'ep' + os.urandom(100).hex()[:RANDOM_USERNAME_LENGTH-2]
| 25.736842 | 75 | 0.711656 | 73 | 489 | 4.657534 | 0.726027 | 0.205882 | 0.176471 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015625 | 0.214724 | 489 | 18 | 76 | 27.166667 | 0.869792 | 0.609407 | 0 | 0 | 1 | 0 | 0.013605 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
c1cf4eb299100394bf86e80b30970e9f427365c8 | 773 | py | Python | deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/ARB/cl_event.py | ShujaKhalid/deep-rl | 99c6ba6c3095d1bfdab81bd01395ced96bddd611 | [
"MIT"
] | 210 | 2016-04-09T14:26:00.000Z | 2022-03-25T18:36:19.000Z | deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/ARB/cl_event.py | ShujaKhalid/deep-rl | 99c6ba6c3095d1bfdab81bd01395ced96bddd611 | [
"MIT"
] | 72 | 2016-09-04T09:30:19.000Z | 2022-03-27T17:06:53.000Z | deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/ARB/cl_event.py | ShujaKhalid/deep-rl | 99c6ba6c3095d1bfdab81bd01395ced96bddd611 | [
"MIT"
] | 64 | 2016-04-09T14:26:49.000Z | 2022-03-21T11:19:47.000Z | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_EXTENSION_NAME = 'GL_ARB_cl_event'
def _f( function ):
return _p.createFunction( function,_p.PLATFORM.GL,'GL_ARB_cl_event',error_checker=_errors._error_checker)
GL_SYNC_CL_EVENT_ARB=_C('GL_SYNC_CL_EVENT_ARB',0x8240)
GL_SYNC_CL_EVENT_COMPLETE_ARB=_C('GL_SYNC_CL_EVENT_COMPLETE_ARB',0x8241)
@_f
@_p.types(_cs.GLsync,ctypes.POINTER(_cs._cl_context),ctypes.POINTER(_cs._cl_event),_cs.GLbitfield)
def glCreateSyncFromCLeventARB(context,event,flags):pass
| 40.684211 | 109 | 0.815006 | 126 | 773 | 4.587302 | 0.420635 | 0.084775 | 0.055363 | 0.089965 | 0.254325 | 0.114187 | 0 | 0 | 0 | 0 | 0 | 0.014164 | 0.086675 | 773 | 18 | 110 | 42.944444 | 0.804533 | 0.129366 | 0 | 0 | 1 | 0 | 0.118619 | 0.043544 | 0 | 0 | 0.018018 | 0 | 0 | 1 | 0.142857 | false | 0.071429 | 0.428571 | 0.071429 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 4 |
c1f60f6306c0e43e26c11479ef77a483239e4f78 | 96 | py | Python | tests/fixtures/packages/loader/load2/jsub_ext3/repo/sqlite.py | xianghuzhao/jsub | fda16e9a0983410d33e454d9f1c4a94134e49d41 | [
"MIT"
] | 2 | 2017-05-26T07:17:34.000Z | 2019-04-08T05:53:35.000Z | tests/fixtures/packages/loader/load2/jsub_ext3/repo/sqlite.py | xianghuzhao/jsub | fda16e9a0983410d33e454d9f1c4a94134e49d41 | [
"MIT"
] | null | null | null | tests/fixtures/packages/loader/load2/jsub_ext3/repo/sqlite.py | xianghuzhao/jsub | fda16e9a0983410d33e454d9f1c4a94134e49d41 | [
"MIT"
] | 1 | 2019-04-08T06:52:46.000Z | 2019-04-08T06:52:46.000Z | class Sqlite:
def __init__(self):
self.desc = 'load2: jsub_ext3.repo.sqlite.Sqlite'
| 24 | 57 | 0.666667 | 13 | 96 | 4.538462 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026316 | 0.208333 | 96 | 3 | 58 | 32 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0.364583 | 0.291667 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
de0fce091011f5363dec768c811e05acccbff73d | 18,950 | py | Python | migrations/sqlite_versions/2020-04-23_bcff0ccb4fbd_base.py | debrief/pepys-import | 12d29c0e0f69e1119400334983947893e7679b6b | [
"Apache-2.0"
] | 4 | 2021-05-14T08:22:47.000Z | 2022-02-04T19:48:25.000Z | migrations/sqlite_versions/2020-04-23_bcff0ccb4fbd_base.py | debrief/pepys-import | 12d29c0e0f69e1119400334983947893e7679b6b | [
"Apache-2.0"
] | 1,083 | 2019-11-06T17:01:07.000Z | 2022-03-25T10:26:51.000Z | migrations/sqlite_versions/2020-04-23_bcff0ccb4fbd_base.py | debrief/pepys-import | 12d29c0e0f69e1119400334983947893e7679b6b | [
"Apache-2.0"
] | 4 | 2019-11-06T12:00:45.000Z | 2021-06-09T04:18:28.000Z | """base
Revision ID: bcff0ccb4fbd
Revises:
Create Date: 2020-04-23 12:25:08.210628
"""
import geoalchemy2
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "bcff0ccb4fbd"
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"Activations",
sa.Column("activation_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("sensor_id", sa.Integer(), nullable=False),
sa.Column("start", sa.TIMESTAMP(), nullable=False),
sa.Column("end", sa.TIMESTAMP(), nullable=False),
sa.Column("min_range", sa.REAL(), nullable=True),
sa.Column("max_range", sa.REAL(), nullable=True),
sa.Column("left_arc", sa.REAL(), nullable=True),
sa.Column("right_arc", sa.REAL(), nullable=True),
sa.Column("source_id", sa.Integer(), nullable=False),
sa.Column("privacy_id", sa.Integer(), nullable=True),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("activation_id"),
)
op.create_table(
"Changes",
sa.Column("change_id", sa.Integer(), nullable=False),
sa.Column("user", sa.String(length=150), nullable=False),
sa.Column("modified", sa.DATE(), nullable=False),
sa.Column("reason", sa.String(length=500), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("change_id"),
)
op.create_table(
"ClassificationTypes",
sa.Column("class_type_id", sa.Integer(), nullable=False),
sa.Column("class_type", sa.String(length=150), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("class_type_id"),
)
op.create_table(
"CommentTypes",
sa.Column("comment_type_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("comment_type_id"),
)
op.create_table(
"Comments",
sa.Column("comment_id", sa.Integer(), nullable=False),
sa.Column("platform_id", sa.Integer(), nullable=True),
sa.Column("time", sa.TIMESTAMP(), nullable=False),
sa.Column("comment_type_id", sa.Integer(), nullable=False),
sa.Column("content", sa.String(length=150), nullable=False),
sa.Column("source_id", sa.Integer(), nullable=False),
sa.Column("privacy_id", sa.Integer(), nullable=True),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("comment_id"),
)
op.create_table(
"CommodityTypes",
sa.Column("commodity_type_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("commodity_type_id"),
)
op.create_table(
"ConfidenceLevels",
sa.Column("confidence_level_id", sa.Integer(), nullable=False),
sa.Column("level", sa.String(length=150), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("confidence_level_id"),
)
op.create_table(
"ContactTypes",
sa.Column("contact_type_id", sa.Integer(), nullable=False),
sa.Column("contact_type", sa.String(length=150), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("contact_type_id"),
)
op.create_table(
"Contacts",
sa.Column("contact_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=True),
sa.Column("sensor_id", sa.Integer(), nullable=False),
sa.Column("time", sa.TIMESTAMP(), nullable=False),
sa.Column("bearing", sa.REAL(), nullable=True),
sa.Column("rel_bearing", sa.REAL(), nullable=True),
sa.Column("ambig_bearing", sa.REAL(), nullable=True),
sa.Column("freq", sa.REAL(), nullable=True),
sa.Column("range", sa.REAL(), nullable=True),
sa.Column(
"location",
geoalchemy2.types.Geometry(geometry_type="POINT", srid=4326, management=True),
nullable=True,
),
sa.Column("elevation", sa.REAL(), nullable=True),
sa.Column("major", sa.REAL(), nullable=True),
sa.Column("minor", sa.REAL(), nullable=True),
sa.Column("orientation", sa.REAL(), nullable=True),
sa.Column("classification", sa.String(length=150), nullable=True),
sa.Column("confidence", sa.String(length=150), nullable=True),
sa.Column("contact_type", sa.String(length=150), nullable=True),
sa.Column("mla", sa.REAL(), nullable=True),
sa.Column("soa", sa.REAL(), nullable=True),
sa.Column("subject_id", sa.Integer(), nullable=True),
sa.Column("source_id", sa.Integer(), nullable=False),
sa.Column("privacy_id", sa.Integer(), nullable=True),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("contact_id"),
)
op.create_table(
"DatafileTypes",
sa.Column("datafile_type_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("datafile_type_id"),
)
op.create_table(
"Datafiles",
sa.Column("datafile_id", sa.Integer(), nullable=False),
sa.Column("simulated", sa.Boolean(), nullable=False),
sa.Column("privacy_id", sa.Integer(), nullable=False),
sa.Column("datafile_type_id", sa.Integer(), nullable=False),
sa.Column("reference", sa.String(length=150), nullable=True),
sa.Column("url", sa.String(length=150), nullable=True),
sa.Column("size", sa.Integer(), nullable=False),
sa.Column("hash", sa.String(length=32), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("datafile_id"),
)
op.create_table(
"Extractions",
sa.Column("extraction_id", sa.Integer(), nullable=False),
sa.Column("table", sa.String(length=150), nullable=False),
sa.Column("field", sa.String(length=150), nullable=False),
sa.Column("chars", sa.String(length=150), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("extraction_id"),
)
op.create_table(
"Geometries",
sa.Column("geometry_id", sa.Integer(), nullable=False),
sa.Column("geometry", geoalchemy2.types.Geometry(management=True), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("geo_type_id", sa.Integer(), nullable=False),
sa.Column("geo_sub_type_id", sa.Integer(), nullable=False),
sa.Column("start", sa.TIMESTAMP(), nullable=True),
sa.Column("end", sa.TIMESTAMP(), nullable=True),
sa.Column("task_id", sa.Integer(), nullable=True),
sa.Column("subject_platform_id", sa.Integer(), nullable=True),
sa.Column("sensor_platform_id", sa.Integer(), nullable=True),
sa.Column("source_id", sa.Integer(), nullable=False),
sa.Column("privacy_id", sa.Integer(), nullable=True),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("geometry_id"),
)
op.create_table(
"GeometrySubTypes",
sa.Column("geo_sub_type_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("parent", sa.Integer(), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("geo_sub_type_id"),
)
op.create_table(
"GeometryTypes",
sa.Column("geo_type_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("geo_type_id"),
)
op.create_table(
"HostedBy",
sa.Column("hosted_by_id", sa.Integer(), nullable=False),
sa.Column("subject_id", sa.Integer(), nullable=False),
sa.Column("host_id", sa.Integer(), nullable=False),
sa.Column("hosted_from", sa.DATE(), nullable=False),
sa.Column("host_to", sa.DATE(), nullable=False),
sa.Column("privacy_id", sa.Integer(), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("hosted_by_id"),
)
op.create_table(
"Logs",
sa.Column("log_id", sa.Integer(), nullable=False),
sa.Column("table", sa.String(length=150), nullable=False),
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("field", sa.String(length=150), nullable=True),
sa.Column("new_value", sa.String(length=150), nullable=True),
sa.Column("change_id", sa.Integer(), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("log_id"),
)
op.create_table(
"LogsHoldings",
sa.Column("logs_holding_id", sa.Integer(), nullable=False),
sa.Column("time", sa.TIMESTAMP(), nullable=False),
sa.Column("commodity_id", sa.Integer(), nullable=False),
sa.Column("quantity", sa.REAL(), nullable=False),
sa.Column("unit_type_id", sa.Integer(), nullable=False),
sa.Column("platform_id", sa.Integer(), nullable=False),
sa.Column("comment", sa.String(length=150), nullable=False),
sa.Column("source_id", sa.Integer(), nullable=False),
sa.Column("privacy_id", sa.Integer(), nullable=True),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("logs_holding_id"),
)
op.create_table(
"Media",
sa.Column("media_id", sa.Integer(), nullable=False),
sa.Column("platform_id", sa.Integer(), nullable=True),
sa.Column("subject_id", sa.Integer(), nullable=True),
sa.Column("sensor_id", sa.Integer(), nullable=True),
sa.Column(
"location",
geoalchemy2.types.Geometry(geometry_type="POINT", srid=4326, management=True),
nullable=True,
),
sa.Column("elevation", sa.REAL(), nullable=True),
sa.Column("time", sa.TIMESTAMP(), nullable=True),
sa.Column("media_type_id", sa.Integer(), nullable=False),
sa.Column("url", sa.String(length=150), nullable=False),
sa.Column("source_id", sa.Integer(), nullable=False),
sa.Column("privacy_id", sa.Integer(), nullable=True),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("media_id"),
)
op.create_table(
"MediaTypes",
sa.Column("media_type_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("media_type_id"),
)
op.create_table(
"Nationalities",
sa.Column("nationality_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("nationality_id"),
)
op.create_table(
"Participants",
sa.Column("participant_id", sa.Integer(), nullable=False),
sa.Column("platform_id", sa.Integer(), nullable=False),
sa.Column("task_id", sa.Integer(), nullable=False),
sa.Column("start", sa.TIMESTAMP(), nullable=True),
sa.Column("end", sa.TIMESTAMP(), nullable=True),
sa.Column("force", sa.String(length=150), nullable=True),
sa.Column("privacy_id", sa.Integer(), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("participant_id"),
)
op.create_table(
"PlatformTypes",
sa.Column("platform_type_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=True),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("platform_type_id"),
)
op.create_table(
"Platforms",
sa.Column("platform_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("pennant", sa.String(length=10), nullable=True),
sa.Column("trigraph", sa.String(length=3), nullable=True),
sa.Column("quadgraph", sa.String(length=4), nullable=True),
sa.Column("nationality_id", sa.Integer(), nullable=False),
sa.Column("platform_type_id", sa.Integer(), nullable=False),
sa.Column("privacy_id", sa.Integer(), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("platform_id"),
)
op.create_table(
"Privacies",
sa.Column("privacy_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("privacy_id"),
)
op.create_table(
"SensorTypes",
sa.Column("sensor_type_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=True),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("sensor_type_id"),
)
op.create_table(
"Sensors",
sa.Column("sensor_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("sensor_type_id", sa.Integer(), nullable=False),
sa.Column("host", sa.Integer(), nullable=False),
sa.Column("privacy_id", sa.Integer(), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("sensor_id"),
)
op.create_table(
"States",
sa.Column("state_id", sa.Integer(), nullable=False),
sa.Column("time", sa.TIMESTAMP(), nullable=False),
sa.Column("sensor_id", sa.Integer(), nullable=False),
sa.Column(
"location",
geoalchemy2.types.Geometry(geometry_type="POINT", srid=4326, management=True),
nullable=True,
),
sa.Column("elevation", sa.REAL(), nullable=True),
sa.Column("heading", sa.REAL(), nullable=True),
sa.Column("course", sa.REAL(), nullable=True),
sa.Column("speed", sa.REAL(), nullable=True),
sa.Column("source_id", sa.Integer(), nullable=False),
sa.Column("privacy_id", sa.Integer(), nullable=True),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("state_id"),
)
op.create_table(
"Synonyms",
sa.Column("synonym_id", sa.Integer(), nullable=False),
sa.Column("table", sa.String(length=150), nullable=False),
sa.Column("entity", sa.Integer(), nullable=False),
sa.Column("synonym", sa.String(length=150), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("synonym_id"),
)
op.create_table(
"TaggedItems",
sa.Column("tagged_item_id", sa.Integer(), nullable=False),
sa.Column("tag_id", sa.Integer(), nullable=False),
sa.Column("item_id", sa.Integer(), nullable=False),
sa.Column("tagged_by_id", sa.Integer(), nullable=False),
sa.Column("private", sa.Boolean(), nullable=False),
sa.Column("tagged_on", sa.DATE(), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("tagged_item_id"),
)
op.create_table(
"Tags",
sa.Column("tag_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("tag_id"),
)
op.create_table(
"Tasks",
sa.Column("task_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("parent_id", sa.Integer(), nullable=False),
sa.Column("start", sa.TIMESTAMP(), nullable=False),
sa.Column("end", sa.TIMESTAMP(), nullable=False),
sa.Column("environment", sa.String(length=150), nullable=True),
sa.Column("location", sa.String(length=150), nullable=True),
sa.Column("privacy_id", sa.Integer(), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("task_id"),
)
op.create_table(
"UnitTypes",
sa.Column("unit_type_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("unit_type_id"),
)
op.create_table(
"Users",
sa.Column("user_id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=150), nullable=False),
sa.Column("created_date", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("user_id"),
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table("Users")
op.drop_table("UnitTypes")
op.drop_table("Tasks")
op.drop_table("Tags")
op.drop_table("TaggedItems")
op.drop_table("Synonyms")
op.drop_table("States")
op.drop_table("Sensors")
op.drop_table("SensorTypes")
op.drop_table("Privacies")
op.drop_table("Platforms")
op.drop_table("PlatformTypes")
op.drop_table("Participants")
op.drop_table("Nationalities")
op.drop_table("MediaTypes")
op.drop_table("Media")
op.drop_table("LogsHoldings")
op.drop_table("Logs")
op.drop_table("HostedBy")
op.drop_table("GeometryTypes")
op.drop_table("GeometrySubTypes")
op.drop_table("Geometries")
op.drop_table("Extractions")
op.drop_table("Datafiles")
op.drop_table("DatafileTypes")
op.drop_table("Contacts")
op.drop_table("ContactTypes")
op.drop_table("ConfidenceLevels")
op.drop_table("CommodityTypes")
op.drop_table("Comments")
op.drop_table("CommentTypes")
op.drop_table("ClassificationTypes")
op.drop_table("Changes")
op.drop_table("Activations")
# ### end Alembic commands ###
| 44.693396 | 91 | 0.629288 | 2,274 | 18,950 | 5.119173 | 0.078716 | 0.147754 | 0.157203 | 0.220084 | 0.778713 | 0.758096 | 0.727429 | 0.69427 | 0.63199 | 0.623056 | 0 | 0.011564 | 0.196834 | 18,950 | 423 | 92 | 44.799054 | 0.753285 | 0.014406 | 0 | 0.433498 | 0 | 0 | 0.163788 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.004926 | false | 0 | 0.007389 | 0 | 0.012315 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
e705b607002453f6c1b55a303e9129f6970dff3a | 643 | py | Python | src/encoded/tests/features/test_matrix.py | utsw-bicf/cognitionexplorer | df7cbca95870d3776d5b22d062b6a5be864f0948 | [
"MIT"
] | 1 | 2019-07-18T21:57:10.000Z | 2019-07-18T21:57:10.000Z | src/encoded/tests/features/test_matrix.py | utsw-bicf/pandiseased | ecb2c305a5c4bf468b0964137984d1800c798f01 | [
"MIT"
] | 321 | 2019-08-20T19:32:17.000Z | 2021-10-15T20:00:02.000Z | src/encoded/tests/features/test_matrix.py | utsw-bicf/cognitionexplorer | df7cbca95870d3776d5b22d062b6a5be864f0948 | [
"MIT"
] | 2 | 2019-09-20T19:58:08.000Z | 2020-01-28T15:04:31.000Z | """ These scenarios do not require the workbook fixture, but get it anyway.
"""
import pytest
from pytest_bdd import scenarios
pytestmark = [
pytest.mark.bdd,
pytest.mark.usefixtures('index_workbook'),
]
scenarios(
'matrix_entex.feature',
'matrix_experiment.feature',
'matrix_reference_epigenome.feature',
'matrix_chip_seq.feature',
'matrix_mouse_development.feature',
'matrix_reference_epigenome_homo_sapien_all.feature',
'matrix_reference_epigenome_homo_sapien_nonroadmap.feature',
'matrix_reference_epigenome_mus_musculus.feature',
'matrix_sescc_stem_cell.feature',
strict_gherkin=False,
)
| 27.956522 | 75 | 0.768274 | 75 | 643 | 6.213333 | 0.56 | 0.223176 | 0.188841 | 0.266094 | 0.175966 | 0.175966 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136858 | 643 | 22 | 76 | 29.227273 | 0.83964 | 0.11042 | 0 | 0 | 0 | 0 | 0.588652 | 0.528369 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.111111 | 0 | 0.111111 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.