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
93d66f35931dd0f543eb8cc50fc99b691a5620d9
828
py
Python
transible/plugins/aws_ansible/amazon_ansible.py
sshnaidm/transible
770949da4d30736799e3c629aea98b6cd53d60bc
[ "Apache-2.0" ]
15
2019-12-02T19:11:09.000Z
2021-12-01T04:50:09.000Z
transible/plugins/aws_ansible/amazon_ansible.py
sshnaidm/transible
770949da4d30736799e3c629aea98b6cd53d60bc
[ "Apache-2.0" ]
null
null
null
transible/plugins/aws_ansible/amazon_ansible.py
sshnaidm/transible
770949da4d30736799e3c629aea98b6cd53d60bc
[ "Apache-2.0" ]
2
2019-12-03T14:49:16.000Z
2019-12-09T06:20:45.000Z
class AmazonAnsible: """Main class to generate Ansible playbooks from Amazon Args: debug (bool, optional): debug option. Defaults to False. from_file (str, optional): Optional file with all data. Defaults to ''. """ class AmazonAnsibleCalculation: """Class to generate all Ansible playbooks. Args: data (dict): Amazon info data to be used to generate the playbooks. debug (bool, optional): debug option. Defaults to False. """ def __init__(self, data, debug=False): self.debug = debug self.data = data class AmazonInfo: """Retrieve information about Amazon cloud Args: debug (bool, optional): debug option. Defaults to False. """ def __init__(self, debug=False): self.debug = debug self.data = {}
26.709677
79
0.63285
97
828
5.309278
0.360825
0.07767
0.099029
0.128155
0.43301
0.43301
0.43301
0.308738
0.308738
0.209709
0
0
0.275362
828
30
80
27.6
0.858333
0.595411
0
0.222222
1
0
0
0
0
0
0
0
0
1
0.222222
false
0
0
0
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
93e18c50f38eaea4575b1e1f8ce2007f06e3b692
327
py
Python
performance-storage-service/pss_project/api/serializers/rest/metadata/NoisePageMetadataSerializer.py
cmu-db/noisepage-stats
d61a0e143904748b3f7f43628a5b29769a5c9cf8
[ "MIT" ]
23
2020-12-22T20:19:51.000Z
2021-11-24T06:11:01.000Z
performance-storage-service/pss_project/api/serializers/rest/metadata/NoisePageMetadataSerializer.py
cmu-db/noisepage-test
d61a0e143904748b3f7f43628a5b29769a5c9cf8
[ "MIT" ]
13
2020-06-05T22:36:49.000Z
2020-11-10T16:25:04.000Z
performance-storage-service/pss_project/api/serializers/rest/metadata/NoisePageMetadataSerializer.py
cmu-db/noisepage-test
d61a0e143904748b3f7f43628a5b29769a5c9cf8
[ "MIT" ]
2
2020-06-08T18:03:34.000Z
2020-10-06T18:01:35.000Z
from rest_framework.serializers import Serializer, CharField from pss_project.api.models.rest.metadata.NoisePageMetadata import NoisePageMetadata class NoisePageMetadataSerializer(Serializer): # Fields db_version = CharField() def create(self, validated_data): return NoisePageMetadata(**validated_data)
29.727273
84
0.798165
33
327
7.757576
0.727273
0.101563
0
0
0
0
0
0
0
0
0
0
0.134557
327
10
85
32.7
0.904594
0.018349
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0.166667
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
3
9e14c7a4217eeb315100b8e602791442bd09996a
257
py
Python
code/baseline.py
Heitao5200/nd_1
8dbc21adfa0e3ee5471fc73096605193de4fa6a2
[ "MIT" ]
null
null
null
code/baseline.py
Heitao5200/nd_1
8dbc21adfa0e3ee5471fc73096605193de4fa6a2
[ "MIT" ]
null
null
null
code/baseline.py
Heitao5200/nd_1
8dbc21adfa0e3ee5471fc73096605193de4fa6a2
[ "MIT" ]
null
null
null
import numpy as np import pandas as pd train = pd.read_csv('../data/train.csv') test = pd.read_csv('../data/testA.csv') sample_submit = pd.read_csv('../data/sample_submit.csv',nrows= 10) print(666) print(train.info()) print(test.info()) print(sample_submit)
28.555556
66
0.727626
44
257
4.113636
0.431818
0.099448
0.149171
0.21547
0
0
0
0
0
0
0
0.021186
0.081712
257
9
67
28.555556
0.745763
0
0
0
0
0
0.228682
0.096899
0
0
0
0
0
1
0
false
0
0.222222
0
0.222222
0.444444
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
f57524eb8ab6dc63471e870c627f5ddf962c1068
3,071
py
Python
python/iceberg/api/transforms/identity.py
moulimukherjee/incubator-iceberg
bf7edc4b325df6dd80d86fea0149d2be0ad09468
[ "Apache-2.0" ]
2,161
2020-05-28T01:20:01.000Z
2022-03-31T14:48:04.000Z
python/iceberg/api/transforms/identity.py
moulimukherjee/incubator-iceberg
bf7edc4b325df6dd80d86fea0149d2be0ad09468
[ "Apache-2.0" ]
3,096
2020-05-27T20:57:13.000Z
2022-03-31T22:55:42.000Z
python/iceberg/api/transforms/identity.py
moulimukherjee/incubator-iceberg
bf7edc4b325df6dd80d86fea0149d2be0ad09468
[ "Apache-2.0" ]
879
2020-05-28T01:20:01.000Z
2022-03-31T12:48:48.000Z
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you 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 .transform import Transform from .transform_util import TransformUtil from ..expressions import Expressions from ..types import TypeID class Identity(Transform): @staticmethod def get(type_var): return Identity(type_var) def __init__(self, type_var): self.type_var = type_var def apply(self, value): return value def can_transform(self, type_var): return type_var.is_primitive_type() def get_result_type(self, source_type): return source_type def project(self, name, predicate): return self.project_strict(name, predicate) def project_strict(self, name, predicate): if predicate.lit is not None: return Expressions.predicate(predicate.op, name, predicate.lit.value) else: return Expressions.predicate(predicate.op, name) def to_human_string(self, value): if value is None: return "null" if self.type_var.type_id == TypeID.DATE: return TransformUtil.human_day(value) elif self.type_var.type_id == TypeID.TIME: return TransformUtil.human_time(value) elif self.type_var.type_id == TypeID.TIMESTAMP: if self.type_var.adjust_to_utc: return TransformUtil.human_timestamp_with_timezone(value) else: return TransformUtil.human_timestamp_without_timezone(value) elif self.type_var.type_id in (TypeID.BINARY, TypeID.FIXED): raise NotImplementedError() # if isinstance(value, bytearray): # return base64.b64encode(value) # elif isinstance(value, bytes): # return base64.b64encode(bytes(value)) # else: # raise RuntimeError("Unsupported binary type: %s" % value.__class__.__name__) else: return str(value) def __str__(self): return "identity" def __eq__(self, other): if id(self) == id(other): return True if other is None or not isinstance(other, Identity): return False return self.type_var == other.type_var def __hash__(self): return hash(self.__key()) def __key(self): return Identity.__class__, self.type_var
33.380435
94
0.669163
388
3,071
5.108247
0.350515
0.052977
0.0555
0.037841
0.098385
0.098385
0.045409
0.032291
0
0
0
0.005242
0.25464
3,071
91
95
33.747253
0.860638
0.319114
0
0.058824
0
0
0.005803
0
0
0
0
0
0
1
0.235294
false
0
0.078431
0.156863
0.705882
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
0
1
1
0
0
3
f5832a66f5ab8365268dc79098d8ec3840e2a905
2,134
py
Python
kge/ui/ui_manager.py
Fredkiss3/kge
389d5ab21ecb6dc1a25dd9f98245ba5938a5d253
[ "CC0-1.0" ]
4
2020-03-17T02:15:10.000Z
2021-06-29T13:34:40.000Z
kge/ui/ui_manager.py
Fredkiss3/kge
389d5ab21ecb6dc1a25dd9f98245ba5938a5d253
[ "CC0-1.0" ]
4
2020-05-23T05:47:30.000Z
2022-01-13T02:15:35.000Z
kge/ui/ui_manager.py
Fredkiss3/kge
389d5ab21ecb6dc1a25dd9f98245ba5938a5d253
[ "CC0-1.0" ]
null
null
null
from typing import Callable, Set, Union, Type import kge.inputs.keys as Keys from kge.core import events # from kge.core.component_system import ComponentSystem # from kge.ui.canvas_renderer import CanvasRenderer from kge.core.system import System from kge.utils.vector import Vector from kge.ui.canvas import Canvas, Clear, ClickDown, ClickUp, Hover, CanvasEvent from kge.utils.spatial_hash import Box class UIManager(System): """ A system that dispatch events to canvas FIXME : CANVAS SHOULD NOT BE AFFECTED BY ZOOM """ _stated = set() # type: Set[Canvas] _searchSize = Vector.Unit() / 32 def __enter__(self): pass def on_key_down(self, ev: events.KeyDown, dispatch: Callable): # TODO : SHOULD DO SOMETHIN' (?) if ev.key is Keys.Up: pass elif ev.key is Keys.Down: pass def on_key_up(self): # TODO : SHOULD DO SOMETHIN' (?) pass def dispatch(self, ev:Union[events.MouseMotion, events.MouseDown, events.MouseUp], e: Union[Type[ClickUp], Type[ClickDown], Type[Hover]]): # FIXME : IS THIS PERFORMANT ? self.clear_canvases() canvases = ev.scene.spatial_hash.search(ev.position, self._searchSize, Canvas) # For testing if canvas collide with mouse box = Box(ev.position, self._searchSize) # Clear all canvases for canvas in canvases: # type: Canvas cbox = Box(canvas.position, canvas.scale) if box.overlaps(cbox) and canvas.visible: canvas.dispatch(e(zone=box)) self._stated.add(canvas) def on_mouse_motion(self, ev: events.MouseMotion, dispatch: Callable): self.dispatch(ev, Hover) def clear_canvases(self): for c in self._stated: c.dispatch(Clear()) self._stated = set() def on_mouse_down(self, ev: events.MouseDown, dispatch: Callable): self.dispatch(ev, ClickDown) def on_mouse_up(self, ev: events.MouseUp, dispatch: Callable): self.dispatch(ev, ClickUp)
31.382353
143
0.633552
269
2,134
4.925651
0.330855
0.036981
0.036226
0.063396
0.067925
0
0
0
0
0
0
0.001288
0.272259
2,134
67
144
31.850746
0.8519
0.174321
0
0.105263
0
0
0
0
0
0
0
0.029851
0
1
0.210526
false
0.105263
0.184211
0
0.473684
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
1
0
0
0
0
0
3
1921e0ff9a4ffc28f8ebfad29345c962a8824ff6
240
py
Python
factory/Factory/factories/chevy_factory.py
Tomvictor/python-design-patterns
6b99607d721bbe03d26a0a451a10e88cd1c1d112
[ "MIT" ]
null
null
null
factory/Factory/factories/chevy_factory.py
Tomvictor/python-design-patterns
6b99607d721bbe03d26a0a451a10e88cd1c1d112
[ "MIT" ]
null
null
null
factory/Factory/factories/chevy_factory.py
Tomvictor/python-design-patterns
6b99607d721bbe03d26a0a451a10e88cd1c1d112
[ "MIT" ]
null
null
null
from .abs_factory import AbsFactory from autos.chevyvolt import ChevyVolt class ChevyFactory(AbsFactory): def create_auto(self): self.chevy = chevy = ChevyVolt() chevy.name = 'Chevy Volt' return chevy
24
41
0.670833
27
240
5.888889
0.62963
0
0
0
0
0
0
0
0
0
0
0
0.258333
240
9
42
26.666667
0.893258
0
0
0
0
0
0.04329
0
0
0
0
0
0
1
0.142857
false
0
0.285714
0
0.714286
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
0
1
0
0
3
1934a263073941d83bd788e20670adca9b1f54ca
100
py
Python
06 - WeiXin/run.py
Jianfu-She/PySpider
4f28753fc5340ddd06c5af6d3f6968ab308cf5d9
[ "Apache-2.0" ]
null
null
null
06 - WeiXin/run.py
Jianfu-She/PySpider
4f28753fc5340ddd06c5af6d3f6968ab308cf5d9
[ "Apache-2.0" ]
3
2021-09-08T01:11:16.000Z
2022-03-02T15:14:03.000Z
06 - WeiXin/run.py
Jianfu-She/PySpider
4f28753fc5340ddd06c5af6d3f6968ab308cf5d9
[ "Apache-2.0" ]
1
2019-08-04T09:57:29.000Z
2019-08-04T09:57:29.000Z
from weixin.spider import Spider if __name__ == '__main__': spider = Spider() spider.run()
16.666667
32
0.67
12
100
4.916667
0.666667
0.40678
0
0
0
0
0
0
0
0
0
0
0.21
100
5
33
20
0.746835
0
0
0
0
0
0.08
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
1940382083184a65f3afbc528bf88d59980d18ed
85
py
Python
shiba/optim/__init__.py
A-Jacobson/shiba
e98c1ce29c9c89bfe6c02eddce2b842fc613c3f2
[ "MIT" ]
2
2019-05-06T16:35:36.000Z
2019-12-13T23:58:04.000Z
shiba/optim/__init__.py
A-Jacobson/shiba
e98c1ce29c9c89bfe6c02eddce2b842fc613c3f2
[ "MIT" ]
1
2019-11-15T00:43:52.000Z
2019-11-15T00:43:52.000Z
shiba/optim/__init__.py
A-Jacobson/shiba
e98c1ce29c9c89bfe6c02eddce2b842fc613c3f2
[ "MIT" ]
1
2019-09-04T16:02:00.000Z
2019-09-04T16:02:00.000Z
from .adamW import AdamW from .qhadamW import QHAdamW __all__ = ('AdamW', 'QHAdamW')
21.25
30
0.741176
11
85
5.363636
0.454545
0
0
0
0
0
0
0
0
0
0
0
0.141176
85
4
30
21.25
0.808219
0
0
0
0
0
0.139535
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
1952f0f22e5d64b8ba6de50102f08280c671fadc
539
py
Python
boxuegu/boxuegu/apps/operation/adminx.py
1111111111122222222223333333333/Django_boxuegu
cec4451bcc55f04013efd4e4cb7c4098a0fd5056
[ "MIT" ]
null
null
null
boxuegu/boxuegu/apps/operation/adminx.py
1111111111122222222223333333333/Django_boxuegu
cec4451bcc55f04013efd4e4cb7c4098a0fd5056
[ "MIT" ]
6
2021-02-08T20:30:13.000Z
2022-03-11T23:50:00.000Z
boxuegu/boxuegu/apps/operation/adminx.py
1111111111122222222223333333333/Django_boxuegu
cec4451bcc55f04013efd4e4cb7c4098a0fd5056
[ "MIT" ]
null
null
null
import xadmin from .models import Course, UserAsk, UserCourse, UserFavorite, UserMessage class CourseAdmin(object): pass class UserAskAdmin(object): pass class UserCourseAdmin(object): pass class UserFavoriteAdmin(object): pass class UserMessageAdmin(object): pass xadmin.site.register(Course, CourseAdmin) xadmin.site.register(UserAsk, UserAskAdmin) xadmin.site.register(UserCourse, UserCourseAdmin) xadmin.site.register(UserFavorite, UserFavoriteAdmin) xadmin.site.register(UserMessage, UserMessageAdmin)
17.966667
74
0.792208
55
539
7.763636
0.345455
0.117096
0.210773
0
0
0
0
0
0
0
0
0
0.124304
539
29
75
18.586207
0.904661
0
0
0.294118
0
0
0
0
0
0
0
0
0
1
0
true
0.294118
0.117647
0
0.411765
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
3
1958ee8008ba88aea5fb3660d9f2b2025afe2994
79
py
Python
pypeflow/plugins/contrib/__init__.py
pypeflow/pypeflow
69de9f6d41cfa62aab53fb242d141d8cfc1f84d3
[ "MIT" ]
2
2015-07-03T04:01:44.000Z
2016-02-04T13:39:06.000Z
pypeflow/plugins/contrib/__init__.py
pypeflow/pypeflow
69de9f6d41cfa62aab53fb242d141d8cfc1f84d3
[ "MIT" ]
null
null
null
pypeflow/plugins/contrib/__init__.py
pypeflow/pypeflow
69de9f6d41cfa62aab53fb242d141d8cfc1f84d3
[ "MIT" ]
null
null
null
# coding: utf-8 from __future__ import unicode_literals __author__ = 'gleber'
15.8
39
0.78481
10
79
5.3
1
0
0
0
0
0
0
0
0
0
0
0.014706
0.139241
79
4
40
19.75
0.764706
0.164557
0
0
0
0
0.09375
0
0
0
0
0
0
1
0
false
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
0
0
1
0
0
0
0
3
196fbdb8b0657d253133dcc32cefab74b42e52a0
152
py
Python
yeahyeah/config.py
sjoerdk/yeahyeah
75a6b07337c86cd23cdd1e5953f783a1eeb53c31
[ "MIT" ]
null
null
null
yeahyeah/config.py
sjoerdk/yeahyeah
75a6b07337c86cd23cdd1e5953f783a1eeb53c31
[ "MIT" ]
246
2019-03-28T09:28:41.000Z
2022-03-31T23:56:01.000Z
yeahyeah/config.py
sjoerdk/yeahyeah
75a6b07337c86cd23cdd1e5953f783a1eeb53c31
[ "MIT" ]
1
2021-11-09T01:21:33.000Z
2021-11-09T01:21:33.000Z
from pathlib import Path # This needs to be in a separate module for easy mocking during tests CORE_CONFIG_PATH = Path.home() / ".config" / "yeahyeah"
30.4
69
0.75
24
152
4.666667
0.875
0
0
0
0
0
0
0
0
0
0
0
0.171053
152
4
70
38
0.888889
0.440789
0
0
0
0
0.180723
0
0
0
0
0
0
1
0
false
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
0
0
1
0
0
0
0
3
197638c37a684d69d939e33eb738c3313918efa0
1,436
py
Python
examples/optimization_applications/search_space_example.py
nevinadalal/Hyperactive
3232ffeda70c5d4853b9e71aaf5d1e761c0db9c2
[ "MIT" ]
4
2019-06-09T08:04:01.000Z
2019-06-26T05:45:09.000Z
examples/optimization_applications/search_space_example.py
SimonBlanke/hyperactive
2137f682dd6351dc5c4de8d0d3ad3bd637af57dd
[ "MIT" ]
null
null
null
examples/optimization_applications/search_space_example.py
SimonBlanke/hyperactive
2137f682dd6351dc5c4de8d0d3ad3bd637af57dd
[ "MIT" ]
null
null
null
""" Hyperactive is very versatile, because it can handle not just numerical or string variables in the search space, but also functions. If you want to search for the best list, numpy array, dataframed or class you can put them into a function that returns them as shown in the example below. This enables many possibilities for more complex optimization applications. Neural architecture search, feature engineering, ensemble optimization and many other applications are only possible or much easier if you can put functions in the search space. """ from hyperactive import Hyperactive def function_0(): # do stuff in function0 return def function_1(): # do stuff in function1 return def function_2(): # do stuff in function2 return def list1(): return [1, 0, 0] def list2(): return [0, 1, 0] def list3(): return [0, 0, 1] # Hyperactive can handle python objects in the search space search_space = { "int": list(range(1, 10)), "float": [0.1, 0.01, 0.001], "string": ["string1", "string2"], "function": [function_0, function_1, function_2], "list": [list1, list2, list3], } def objective_function(para): # score must be a number score = 1 return score hyper = Hyperactive() hyper.add_search(objective_function, search_space, n_iter=20) hyper.run() search_data = hyper.search_data(objective_function) print("\n Search Data: \n", search_data)
22.092308
103
0.708914
210
1,436
4.771429
0.485714
0.05489
0.032934
0.047904
0
0
0
0
0
0
0
0.035745
0.201253
1,436
64
104
22.4375
0.837838
0.482591
0
0.107143
0
0
0.079343
0
0
0
0
0
0
1
0.25
false
0
0.035714
0.214286
0.535714
0.035714
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
0
1
1
0
0
3
1976c8290b8fbf5153976f05a2ea4f2a0a7ce369
35
py
Python
athanor_staff/__init__.py
volundmush/athanor_staff
76b01355b0725fecff2654bce6df86f3070981d8
[ "BSD-3-Clause" ]
null
null
null
athanor_staff/__init__.py
volundmush/athanor_staff
76b01355b0725fecff2654bce6df86f3070981d8
[ "BSD-3-Clause" ]
null
null
null
athanor_staff/__init__.py
volundmush/athanor_staff
76b01355b0725fecff2654bce6df86f3070981d8
[ "BSD-3-Clause" ]
null
null
null
INSTALLED_APPS = ["athanor_staff"]
17.5
34
0.771429
4
35
6.25
1
0
0
0
0
0
0
0
0
0
0
0
0.085714
35
1
35
35
0.78125
0
0
0
0
0
0.371429
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
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
19a28c5a64422a4919dbbf5e29d0a2e246406b80
74
py
Python
Ejercicios Uri/1004.py
GabrielRojas74/Talleres-AyP
346b87ddc118b4c8f45fe083f63b4bacb5d01d19
[ "MIT" ]
null
null
null
Ejercicios Uri/1004.py
GabrielRojas74/Talleres-AyP
346b87ddc118b4c8f45fe083f63b4bacb5d01d19
[ "MIT" ]
null
null
null
Ejercicios Uri/1004.py
GabrielRojas74/Talleres-AyP
346b87ddc118b4c8f45fe083f63b4bacb5d01d19
[ "MIT" ]
null
null
null
A = int(input()) B = int(input()) PROD = A*B print("PROD = " + str(PROD))
14.8
28
0.540541
13
74
3.076923
0.538462
0.4
0
0
0
0
0
0
0
0
0
0
0.189189
74
4
29
18.5
0.666667
0
0
0
0
0
0.094595
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
2701bbfa5e956680c2cb3ea184b59e32f148cc43
504
py
Python
src/api/domain/operation/GetDataOperationJobList/GetDataOperationJobListRequest.py
PythonDataIntegrator/pythondataintegrator
6167778c36c2295e36199ac0d4d256a4a0c28d7a
[ "MIT" ]
14
2020-12-19T15:06:13.000Z
2022-01-12T19:52:17.000Z
src/api/domain/operation/GetDataOperationJobList/GetDataOperationJobListRequest.py
PythonDataIntegrator/pythondataintegrator
6167778c36c2295e36199ac0d4d256a4a0c28d7a
[ "MIT" ]
43
2021-01-06T22:05:22.000Z
2022-03-10T10:30:30.000Z
src/api/domain/operation/GetDataOperationJobList/GetDataOperationJobListRequest.py
PythonDataIntegrator/pythondataintegrator
6167778c36c2295e36199ac0d4d256a4a0c28d7a
[ "MIT" ]
4
2020-12-18T23:10:09.000Z
2021-04-02T13:03:12.000Z
from typing import Optional from infrastructure.cqrs.decorators.requestclass import requestclass from domain.common.request_parameter.OrderByParameter import OrderByParameter from domain.common.request_parameter.PagingParameter import PagingParameter @requestclass class GetDataOperationJobListRequest(PagingParameter, OrderByParameter): DataOperationId: Optional[int] = None DataOperationName: Optional[str] = None OnlyCron: Optional[bool] = None OnlyUndeleted: Optional[bool] = None
36
77
0.831349
48
504
8.6875
0.5
0.047962
0.076739
0.110312
0.153477
0
0
0
0
0
0
0
0.109127
504
13
78
38.769231
0.928731
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.4
0
0.9
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
273bf6f9e9acbf6bdf2dca5898991d8c28ac1b28
560
py
Python
lib/markdown/extensions/nofollow.py
gluwer/przepisymm
dc83fdc4068fb0102a87081bd519807fd66397c2
[ "BSD-3-Clause" ]
null
null
null
lib/markdown/extensions/nofollow.py
gluwer/przepisymm
dc83fdc4068fb0102a87081bd519807fd66397c2
[ "BSD-3-Clause" ]
null
null
null
lib/markdown/extensions/nofollow.py
gluwer/przepisymm
dc83fdc4068fb0102a87081bd519807fd66397c2
[ "BSD-3-Clause" ]
null
null
null
import markdown import re R_NOFOLLOW = re.compile('<a (?![^>]*rel=["\']nofollow[\'"])') S_NOFOLLOW = '<a rel="nofollow" ' class NofollowPostprocessor(markdown.postprocessors.Postprocessor): def run(self, text): return R_NOFOLLOW.sub(S_NOFOLLOW, text) class NofollowExtension(markdown.Extension): """ Add nofollow for links to Markdown. """ def extendMarkdown(self, md, md_globals): md.postprocessors.add('nofollow', NofollowPostprocessor(md), '_end') def makeExtension(configs={}): return NofollowExtension(configs=configs)
31.111111
76
0.710714
62
560
6.322581
0.5
0.045918
0.061224
0
0
0
0
0
0
0
0
0
0.139286
560
18
77
31.111111
0.813278
0.0625
0
0
0
0
0.098456
0
0
0
0
0
0
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
0
0
0
1
0
0
0
1
1
0
0
3
2740b2159fbf5f24eefd44bb6c5a56afe8c31aa6
2,464
py
Python
mySQL_Python_Examples/IEF_Database_Insert_population.py
tmillross/IE_data_commons
ca42444e4da99e0f34c34c76de49dabf80b324b0
[ "MIT" ]
13
2018-07-11T08:21:16.000Z
2022-03-25T13:40:08.000Z
mySQL_Python_Examples/IEF_Database_Insert_population.py
tmillross/IE_data_commons
ca42444e4da99e0f34c34c76de49dabf80b324b0
[ "MIT" ]
23
2018-06-22T12:35:50.000Z
2021-08-03T17:23:13.000Z
mySQL_Python_Examples/IEF_Database_Insert_population.py
tmillross/IE_data_commons
ca42444e4da99e0f34c34c76de49dabf80b324b0
[ "MIT" ]
2
2018-09-12T07:17:49.000Z
2019-06-14T15:12:22.000Z
# -*- coding: utf-8 -*- """ Created on Thu Nov 30 16:57:29 2017 @author: spauliuk """ import pymysql import datetime import numpy as np import IEDC_PW conn = pymysql.connect(host='www.industrialecology.uni-freiburg.de', port=3306, user=IEDC_PW.IEDC_write_access_user, passwd=IEDC_PW.IEDC_write_access_user_PW, db='iefdatabase_test') cur = conn.cursor() # 0) add new unit to unit table: sql = "INSERT INTO iefdatabase_test.unit_classification (UnitID,SiUnitID,UnitCode,UnitName,Factor)VALUES(49,1,'k','thousand',1000);" cur.execute(sql) # 1) Add new data set to dataset table: sql = "INSERT INTO iefdatabase_test.dataset (System_ID,System_definition,Dataset_name,Reference_date,Most_recent_update,Corresponding_author_info,Other_author_info,Document_reference,region,Time_period_of_analysis,Indicator_element,Comment)VALUES(2, 'XXX.png', 'Historic population by country', %s, %s, 'Pauliuk, Stefan', 'Tao Wang, Daniel B Müller', '10.1016/j.resconrec.2012.11.008', 'World', '1700-2008', 'Population', 'Compiled from other statistical sources');" cur.execute(sql,(datetime.datetime(2012, 8, 5, 0, 0),datetime.datetime(2012, 8, 5, 0, 0))) # 2) Add processes for new data set to process table: sql = "INSERT INTO iefdatabase_test.process_list (system_id,process_id,process_name,process_code,process_type,comment,color,angle,width,height,xPos,yPos)VALUES(2,1,'Population', '', '', '', '[(35,35,35)]', '[0]', '[100.00]', '[100.00]', '[300]', '[200]');" cur.execute(sql) # 3) Read population dataset from xls and insert into db stocks: system_id = 2 stock_dataset_number = 1 Process_id = 1 FilePath = 'C:\\Users\\spauliuk\\FILES\\ARBEIT\\PROJECTS\\Database\\IndEcolFreiburg_Database\\CSVexport_SteelCycle_Population\\P1_D.csv' lines = open(FilePath,'r').read().split('\n') for line in lines: if line != '': cols = line.split(',') CountryID = int(cols[3]) YearID = int(cols[4]) PopValue = np.float(cols[8]) # Add data into db: sql = "INSERT INTO iefdatabase_test.stocks (system_id,stock_dataset_number,process_id,country_iso_code,year,age_cohort,indicator_element,aspect_of_dataset,value,error_type,error_value_1,error_value_2,data_quality,unit_id,comment )VALUES(%s,%s,%s,'%s',%s,'','Population','Stock',%s,'','','','',49,'');" cur.execute(sql,(system_id,stock_dataset_number,Process_id,CountryID,YearID,PopValue)) stock_dataset_number += 1 # 4) close connection cur.close() conn.close()
47.384615
466
0.72849
370
2,464
4.67027
0.486486
0.043403
0.030093
0.055556
0.170718
0.154514
0.068287
0
0
0
0
0.04849
0.112825
2,464
51
467
48.313725
0.741537
0.09862
0
0.071429
0
0.178571
0.606329
0.451373
0
0
0
0
0
0
null
null
0.035714
0.142857
null
null
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
1
1
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
27482418dbfba809001857bbcd7689328bd04d1c
156
py
Python
pitu/gray.py
kenblikylee/pitu
4cca09e5f3ddaf725e63e3b46f2bed83a5c8f918
[ "MIT" ]
12
2019-11-04T05:35:03.000Z
2020-02-21T08:03:07.000Z
pitu/gray.py
gaecom/pitu
e4ec86f045d6820c283a88485b19db3d605c6a9c
[ "MIT" ]
2
2020-03-04T05:13:35.000Z
2020-11-29T11:35:22.000Z
pitu/gray.py
gaecom/pitu
e4ec86f045d6820c283a88485b19db3d605c6a9c
[ "MIT" ]
3
2019-11-05T04:51:28.000Z
2020-02-21T08:02:14.000Z
from .photo import Photo def gray(photo, params, show=False): _photo = Photo(photo).gray() _photo.save('gray-' + photo) if show: _photo.show()
22.285714
36
0.653846
22
156
4.5
0.454545
0.272727
0
0
0
0
0
0
0
0
0
0
0.192308
156
6
37
26
0.785714
0
0
0
0
0
0.032051
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.4
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
275f5eb0acc7da03032a2d016d6a9a26c54c013e
404
py
Python
democrasite/conftest.py
mfosterw/cookiestocracy
6912e9e7c3006024d0fbee61dce5c48e63e9e231
[ "MIT" ]
null
null
null
democrasite/conftest.py
mfosterw/cookiestocracy
6912e9e7c3006024d0fbee61dce5c48e63e9e231
[ "MIT" ]
9
2021-07-18T17:16:42.000Z
2022-03-31T00:19:14.000Z
democrasite/conftest.py
mfosterw/cookiestocracy
6912e9e7c3006024d0fbee61dce5c48e63e9e231
[ "MIT" ]
null
null
null
import pytest from democrasite.users.models import User from democrasite.users.tests.factories import UserFactory @pytest.fixture(autouse=True) def media_storage(settings, tmpdir): settings.MEDIA_ROOT = tmpdir.strpath @pytest.fixture(autouse=True) def enable_db_access_for_all_tests(db): # pylint: disable=unused-argument pass @pytest.fixture def user() -> User: return UserFactory()
20.2
74
0.779703
53
404
5.811321
0.584906
0.126623
0.12987
0.155844
0.175325
0
0
0
0
0
0
0
0.126238
404
19
75
21.263158
0.872521
0.076733
0
0.166667
0
0
0
0
0
0
0
0
0
1
0.25
false
0.083333
0.25
0.083333
0.583333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
27697a5a18a4e97999994949208762c60c8c3d7d
243
py
Python
fastapi-sync/src/models/base.py
LexGalante/karro
d255bd6d7e19b4a40b2ff3ba837dd64f1cb1eed6
[ "MIT" ]
2
2020-11-17T03:19:01.000Z
2021-02-22T15:01:40.000Z
fastapi-sync/src/models/base.py
LexGalante/karro
d255bd6d7e19b4a40b2ff3ba837dd64f1cb1eed6
[ "MIT" ]
null
null
null
fastapi-sync/src/models/base.py
LexGalante/karro
d255bd6d7e19b4a40b2ff3ba837dd64f1cb1eed6
[ "MIT" ]
1
2021-12-02T11:08:29.000Z
2021-12-02T11:08:29.000Z
from sqlalchemy.ext.declarative import as_declarative from sqlalchemy import Column, Integer @as_declarative() class Base: __table_args__ = {'schema': 'public'} id = Column(Integer, primary_key=True, index=True, autoincrement=True)
24.3
74
0.765432
30
243
5.933333
0.666667
0.157303
0
0
0
0
0
0
0
0
0
0
0.135802
243
9
75
27
0.847619
0
0
0
0
0
0.049383
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.833333
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
0
0
1
0
1
0
0
3
27bec64e49475202d63e1e459508ce1c6692b57c
399
py
Python
profiles/migrations/0023_remove_newsletter_fields.py
Sukriva/open-city-profile
8c8df883457b9c79534dc9f7b57d556143362229
[ "MIT" ]
5
2020-03-17T15:56:17.000Z
2022-01-31T13:43:31.000Z
profiles/migrations/0023_remove_newsletter_fields.py
Sukriva/open-city-profile
8c8df883457b9c79534dc9f7b57d556143362229
[ "MIT" ]
337
2018-05-21T08:35:05.000Z
2022-03-14T07:38:15.000Z
profiles/migrations/0023_remove_newsletter_fields.py
Sukriva/open-city-profile
8c8df883457b9c79534dc9f7b57d556143362229
[ "MIT" ]
10
2019-08-05T08:16:06.000Z
2021-08-06T15:08:44.000Z
# Generated by Django 2.2.10 on 2020-03-30 06:22 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("profiles", "0022_add_newsletter_options"), ] operations = [ migrations.RemoveField(model_name="profile", name="newsletters_via_email",), migrations.RemoveField(model_name="profile", name="newsletters_via_sms",), ]
24.9375
84
0.694236
46
399
5.826087
0.695652
0.156716
0.19403
0.223881
0.410448
0.410448
0.410448
0.410448
0
0
0
0.06135
0.182957
399
15
85
26.6
0.760736
0.115288
0
0
1
0
0.253561
0.136752
0
0
0
0
0
1
0
false
0
0.111111
0
0.444444
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
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
27c2d441e88966e39cf024b80529211f8e75136d
311
py
Python
release/stubs.min/System/__init___parts/FtpStyleUriParser.py
tranconbv/ironpython-stubs
a601759e6c6819beff8e6b639d18a24b7e351851
[ "MIT" ]
null
null
null
release/stubs.min/System/__init___parts/FtpStyleUriParser.py
tranconbv/ironpython-stubs
a601759e6c6819beff8e6b639d18a24b7e351851
[ "MIT" ]
null
null
null
release/stubs.min/System/__init___parts/FtpStyleUriParser.py
tranconbv/ironpython-stubs
a601759e6c6819beff8e6b639d18a24b7e351851
[ "MIT" ]
null
null
null
class FtpStyleUriParser(UriParser): """ A customizable parser based on the File Transfer Protocol (FTP) scheme. FtpStyleUriParser() """ def ZZZ(self): """hardcoded/mock instance of the class""" return FtpStyleUriParser() instance=ZZZ() """hardcoded/returns an instance of the class"""
25.916667
74
0.697749
35
311
6.2
0.685714
0.092166
0.119816
0.165899
0
0
0
0
0
0
0
0
0.186495
311
11
75
28.272727
0.857708
0.421222
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0
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
1
0
0
0
0
1
0
0
3
27d2c3eac2e74469eddf8010b4ad614799bf2306
27
py
Python
TikzBuilder/__init__.py
rblack42/TikzBuilder
ec69517db422ebda947c6e236c0b9ea597c3a934
[ "BSD-3-Clause" ]
null
null
null
TikzBuilder/__init__.py
rblack42/TikzBuilder
ec69517db422ebda947c6e236c0b9ea597c3a934
[ "BSD-3-Clause" ]
null
null
null
TikzBuilder/__init__.py
rblack42/TikzBuilder
ec69517db422ebda947c6e236c0b9ea597c3a934
[ "BSD-3-Clause" ]
null
null
null
__all__ = ['TikzBuilder']
9
25
0.666667
2
27
7
1
0
0
0
0
0
0
0
0
0
0
0
0.148148
27
2
26
13.5
0.608696
0
0
0
0
0
0.423077
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
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
7e0dbfeb1854683752f9295aa567b86e589da40e
216
py
Python
ecommerce/profiles/admin.py
kurniantoska/ecommerce
a30c51417dd8183517cb2feb8f0efdc8ec202421
[ "MIT" ]
null
null
null
ecommerce/profiles/admin.py
kurniantoska/ecommerce
a30c51417dd8183517cb2feb8f0efdc8ec202421
[ "MIT" ]
null
null
null
ecommerce/profiles/admin.py
kurniantoska/ecommerce
a30c51417dd8183517cb2feb8f0efdc8ec202421
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import Profile # Register your models here. class ProfileAdmin(admin.ModelAdmin): class Meta: fields = '__all__' admin.site.register(Profile, ProfileAdmin)
21.6
42
0.75463
26
216
6.115385
0.653846
0
0
0
0
0
0
0
0
0
0
0
0.166667
216
10
42
21.6
0.883333
0.12037
0
0
0
0
0.037037
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
fd830541ce91868a247dc0b1a215b27802ce9a2f
7,379
py
Python
thesis/src/consultas/cons_scopes_simple.py
gmonce/bioscope
b5ad3b5a769b92ef071954c6ff9fc0ebf5b6d4e3
[ "MIT" ]
1
2022-03-30T09:24:01.000Z
2022-03-30T09:24:01.000Z
thesis/src/consultas/cons_scopes_simple.py
gmonce/bioscope
b5ad3b5a769b92ef071954c6ff9fc0ebf5b6d4e3
[ "MIT" ]
1
2020-04-07T20:42:23.000Z
2020-04-11T17:06:53.000Z
thesis/src/consultas/cons_scopes_simple.py
gmonce/bioscope
b5ad3b5a769b92ef071954c6ff9fc0ebf5b6d4e3
[ "MIT" ]
1
2022-03-30T09:24:04.000Z
2022-03-30T09:24:04.000Z
# -*- coding: utf-8 -*- # Uso: python cons_scopes_simple.py $BIOSCOPE tabla # Script que mira las oraciones en el corpus de entrenamiento y se fija si coincide con el scope de algún constituyente del aŕbol sintáctico import pln_inco.bioscope as bioscope import pln_inco.bioscope.util import os.path import time import sys import yaml import sqlite3 working_dir=sys.argv[1] table=sys.argv[2] dbname=os.path.join(working_dir,'bioscope.db') script_name=os.path.join(sys.path[0],sys.argv[0]) t0=time.clock() # Inicializo la conección a la base de datos conn= sqlite3.connect(dbname) conn.text_factory = str conn.row_factory=sqlite3.Row c=conn.cursor() c1=conn.cursor() err=conn.cursor() # Inicializo el diccionario de hedge cues hc_list=dict([]) #Consulto todas las oraciones con error err.execute("select document_id,sentence_id,hc_start from "+ table+" where scope<>guessed_scope group by document_id,sentence_id,hc_start") for e in err: c.execute("select document_id,sentence_id,hc_start,hc_token,pos,hc_parent_pos,hc_gparent_pos,hc_ggparent_pos, passive_voice from "+table+" where document_id=? and sentence_id=? and hc_start=? and token_num=hc_start", [e['document_id'],e['sentence_id'], e['hc_start']]) for row in c: hc_token=row['hc_token'] pos=row['pos'] sentence_id=row['sentence_id'] route=pos #if hc_token not in hc_list: # hc_list[hc_token]=dict([]) #if route not in hc_list[hc_token]: # hc_list[hc_token][route]=[0,0,0,0,[],[],0,0,[],0] found=False # Veo si coincide el scope con el padre c1.execute("select count(*) cant from "+table+" where document_id=? and sentence_id=? and hc_start=? and scope<>in_hc_parent_scope",(row['document_id'],row['sentence_Id'],row['hc_start'])) for row1 in c1: if row1['cant']==0: #hc_list[hc_token][route][0]+=1 coincidence='P' found=True # Veo si coincide el scope con el abuelo if not found: c1.execute("select count(*) cant from "+table+" where document_id=? and sentence_id=? and hc_start=? and scope<>in_hc_gparent_scope",(row['document_id'],row['sentence_Id'],row['hc_start'])) for row1 in c1: if row1['cant']==0: #hc_list[hc_token][route][1]+=1 coincidence='GP' found=True # Veo si coincide el scope con el bisabuelo if not found: c1.execute("select count(*) cant from "+table+" where document_id=? and sentence_id=? and hc_start=? and scope<>in_hc_ggparent_scope",(row['document_id'],row['sentence_Id'],row['hc_start'])) for row1 in c1: if row1['cant']==0: #hc_list[hc_token][route][2]+=1 coincidence='GGP' found=True # Veo si coincide con el scope del tatarabuelo if not found: c1.execute("select count(*) cant from "+table+" where document_id=? and sentence_id=? and hc_start=? and scope<>in_hc_gggparent_scope",(row['document_id'],row['sentence_Id'],row['hc_start'])) for row1 in c1: if row1['cant']==0: #hc_list[hc_token][route][9]+=1 coincidence='GGGP' found=True # Veo si coincide con algun scope de mas arriba if not found: c1.execute("select count(*) cant from "+table+" where document_id=? and sentence_id=? and hc_start=? and scope<>in_nextS_scope",(row['document_id'],row['sentence_Id'],row['hc_start'])) for row1 in c1: if row1['cant']==0: coincidence='OTHER' found=True # No coincide con ninguno if not found: coincidence='NONE' # Veo ahora si lo guessed coincide con alguno found=False # Veo si coincide el scope con el padre c1.execute("select count(*) cant from "+table+" where document_id=? and sentence_id=? and hc_start=? and guessed_scope<>in_hc_parent_scope",(row['document_id'],row['sentence_Id'],row['hc_start'])) for row1 in c1: if row1['cant']==0: #hc_list[hc_token][route][0]+=1 gcoincidence='P' found=True # Veo si coincide el scope con el abuelo if not found: c1.execute("select count(*) cant from "+table+" where document_id=? and sentence_id=? and hc_start=? and guessed_scope<>in_hc_gparent_scope",(row['document_id'],row['sentence_Id'],row['hc_start'])) for row1 in c1: if row1['cant']==0: #hc_list[hc_token][route][1]+=1 gcoincidence='GP' found=True # Veo si coincide el scope con el bisabuelo if not found: c1.execute("select count(*) cant from "+table+" where document_id=? and sentence_id=? and hc_start=? and guessed_scope<>in_hc_ggparent_scope",(row['document_id'],row['sentence_Id'],row['hc_start'])) for row1 in c1: if row1['cant']==0: #hc_list[hc_token][route][2]+=1 gcoincidence='GGP' found=True # Veo si coincide con el scope del tatarabuelo if not found: c1.execute("select count(*) cant from "+table+" where document_id=? and sentence_id=? and hc_start=? and guessed_scope<>in_hc_gggparent_scope",(row['document_id'],row['sentence_Id'],row['hc_start'])) for row1 in c1: if row1['cant']==0: #hc_list[hc_token][route][9]+=1 gcoincidence='GGGP' found=True # Veo si coincide con algun scope de mas arriba if not found: c1.execute("select count(*) cant from "+table+" where document_id=? and sentence_id=? and hc_start=? and guessed_scope<>in_nextS_scope",(row['document_id'],row['sentence_Id'],row['hc_start'])) for row1 in c1: if row1['cant']==0: gcoincidence='OTHER' found=True # No coincide con ninguno if not found: gcoincidence='NONE' # Obtengo el texto del scope predicho # Primero obtengo el comienzo c1.execute("select token_num from "+table+" where document_id=? and sentence_id=? and hc_start=? and scope='F'",(row['document_id'],row['sentence_id'], row['hc_start'])) first=None for row1 in c1: first=row1['token_num'] last=None # Obtengo el final c1.execute("select token_num from "+table+" where document_id=? and sentence_id=? and hc_start=? and scope='L'",(row['document_id'],row['sentence_id'], row['hc_start'])) for row1 in c1: last=row1['token_num'] # Obtengo el texto if first and last: c1.execute("select word from "+table+" where document_id=? and sentence_id=? and hc_start=? and token_num between ? and ?",(row['document_id'],row['sentence_id'], row['hc_start'],first,last)) texto="" for row1 in c1: texto+=row1['word'] texto+=" " texto=texto[0:len(texto)-1] else: texto="None" # Obtengo el texto del scope original # Primero obtengo el comienzo first=None c1.execute("select token_num from "+table+" where document_id=? and sentence_id=? and hc_start=? and guessed_scope='F'",(row['document_id'],row['sentence_id'], row['hc_start'])) for row1 in c1: first=row1['token_num'] # Obtengo el final last=None c1.execute("select token_num from "+table+" where document_id=? and sentence_id=? and hc_start=? and guessed_scope='L'",(row['document_id'],row['sentence_id'], row['hc_start'])) for row1 in c1: last=row1['token_num'] # Obtengo el texto if first and last: c1.execute("select word from "+table+" where document_id=? and sentence_id=? and hc_start=? and token_num between ? and ?",(row['document_id'],row['sentence_id'], row['hc_start'],first,last)) gtexto="" for row1 in c1: gtexto+=row1['word'] gtexto+=" " gtexto=gtexto[0:len(gtexto)-1] else: gtexto="None" # Muestro los resultados print "#".join([sentence_id,str(e['hc_start']),hc_token,route,coincidence, gcoincidence,texto,gtexto])
37.841026
269
0.692099
1,194
7,379
4.103015
0.132328
0.081649
0.051439
0.076342
0.72525
0.714023
0.692794
0.692794
0.667279
0.667279
0
0.017866
0.158016
7,379
194
270
38.036082
0.770642
0.196775
0
0.492063
0
0
0.458376
0.076283
0
0
0
0
0
0
null
null
0.007937
0.055556
null
null
0.007937
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
fd9618664966e322d4e9be3a30506b9e85c4dc6e
25
py
Python
application/lib/storage/__init__.py
taewookimfardark/gnp_server
3318d3348c4f0849eb9e3523d27259647aa1f706
[ "Apache-2.0" ]
null
null
null
application/lib/storage/__init__.py
taewookimfardark/gnp_server
3318d3348c4f0849eb9e3523d27259647aa1f706
[ "Apache-2.0" ]
null
null
null
application/lib/storage/__init__.py
taewookimfardark/gnp_server
3318d3348c4f0849eb9e3523d27259647aa1f706
[ "Apache-2.0" ]
null
null
null
__author__ = 'taewookim'
12.5
24
0.76
2
25
7.5
1
0
0
0
0
0
0
0
0
0
0
0
0.12
25
1
25
25
0.681818
0
0
0
0
0
0.36
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
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
fdaa540df99f3efc90e8ab036e19bbb63a0ffe02
250
py
Python
sample/models.py
imtapps/django-google-maps
1c85102b05a0dc86a5b04f913c79534cdb0f0801
[ "BSD-2-Clause" ]
null
null
null
sample/models.py
imtapps/django-google-maps
1c85102b05a0dc86a5b04f913c79534cdb0f0801
[ "BSD-2-Clause" ]
null
null
null
sample/models.py
imtapps/django-google-maps
1c85102b05a0dc86a5b04f913c79534cdb0f0801
[ "BSD-2-Clause" ]
null
null
null
from django.db import models from django_google_maps.fields import AddressField, GeoLocationField # Create your models here. class SampleModel(models.Model): address = AddressField(max_length=100) geolocation = GeoLocationField(blank=True)
27.777778
68
0.804
30
250
6.6
0.766667
0.10101
0
0
0
0
0
0
0
0
0
0.013761
0.128
250
8
69
31.25
0.894495
0.096
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
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
0
0
1
0
1
0
0
3
fdb4558075775c0ec22400a6d39583aa8dba89c7
12,133
py
Python
engine/stats/modifiers.py
kiciek/WarhammerStatsEngine
3e4396435e9ba0edb89aba64d101dd79a1814093
[ "MIT" ]
null
null
null
engine/stats/modifiers.py
kiciek/WarhammerStatsEngine
3e4396435e9ba0edb89aba64d101dd79a1814093
[ "MIT" ]
null
null
null
engine/stats/modifiers.py
kiciek/WarhammerStatsEngine
3e4396435e9ba0edb89aba64d101dd79a1814093
[ "MIT" ]
null
null
null
from .pmf import PMF, PMFCollection class Modifier(object): """ Base class for Modifiers. 'priority' is used for order of opperations and for re-rolls it determines the which re-roll is applied. e.g. full re-roll > re-roll failed > re-roll 1s """ priority = 0 def __init__(self, *args, **kwargs): pass def modify_dice(self, col, thresh=None, mod_thresh=None): return col def modify_re_roll(self, col, thresh=None, mod_thresh=None): return col def modify_threshold(self, thresh): return thresh def modify_save(self, save): return save def modify_ap(self, ap): return ap def modify_invuln(self, invuln): return invuln def mod_extra_hit(self): return None def extra_hit(self): return None def mod_extra_shot(self): return None def extra_shot(self): return None def mod_extra_wound(self): return None def extra_wound(self): return None def mod_mortal_wound(self): return None def mortal_wound(self): return None def modify_drones(self): return False, 7, 7 def modify_self_wounds(self): return 0 class MinimumValue(Modifier): def __init__(self, min_val): self.min_val = min_val def modify_dice(self, col, thresh=None, mod_thresh=None): return col.map(lambda x: x.min(self.min_val)) class ExplodingDice(Modifier): def __init__(self, thresh, value): self.thresh = max(0, min(7, thresh)) self.value = value def _pmf_collection(self): return PMFCollection([PMF.static(0)] * self.thresh + [PMF.static(self.value)] * (7 - self.thresh)) class ModExtraHit(ExplodingDice): def mod_extra_hit(self): return self._pmf_collection() class ExtraHit(ExplodingDice): def extra_hit(self): return self._pmf_collection() class ModExtraAttack(ExplodingDice): def mod_extra_shot(self): return self._pmf_collection() class ExtraShot(ExplodingDice): def extra_shot(self): return self._pmf_collection() class ModExtraWound(ExplodingDice): def mod_extra_wound(self): return self._pmf_collection() class ExtraWound(ExplodingDice): def extra_wound(self): return self._pmf_collection() class GenerateMortalWound(ExplodingDice): def mortal_wound(self): return self._pmf_collection() class ModGenerateMortalWound(ExplodingDice): def mod_mortal_wound(self): return self._pmf_collection() class Haywire(ExplodingDice): def mod_mortal_wound(self): col = [PMF.static(0), PMF.static(0), PMF.static(0), PMF.static(0), PMF.static(1), PMF.static(1), PMF.dn(3)] return PMFCollection(col) class ReRollOnes(Modifier): priority = 1 def modify_re_roll(self, col, thresh=None, mod_thresh=None): return col.map(lambda x: x.re_roll_value(1)) class ReRollFailed(Modifier): priority = 99 def modify_re_roll(self, col, thresh=None, mod_thresh=None): rr_thresh = min(thresh, mod_thresh) return col.map(lambda x: x.re_roll_less_than(rr_thresh)) class ReRollOneDice(Modifier): def modify_re_roll(self, col, thresh=None, mod_thresh=None): pmfs = col.pmfs if not pmfs: return col pmfs[0] = pmfs[0].re_roll_less_than(thresh) return PMFCollection(pmfs) class ModReRollOneDice(Modifier): def modify_re_roll(self, col, thresh=None, mod_thresh=None): pmfs = col.pmfs if not pmfs: return col pmfs[0] = pmfs[0].re_roll_less_than(mod_thresh) return PMFCollection(pmfs) class ReRollOneDiceVolume(Modifier): def modify_re_roll(self, col, thresh=None, mod_thresh=None): pmfs = col.pmfs if not pmfs: return col pmfs[0] = pmfs[0].re_roll_less_than(pmfs[0].mean()) return PMFCollection(pmfs) class ReRollAll(Modifier): priority = 100 def modify_re_roll(self, col, thresh=None, mod_thresh=None): return col.map(lambda x: x.re_roll_less_than(mod_thresh)) class ReRollLessThanExpectedValue(Modifier): priority = 98 def modify_re_roll(self, col, thresh=None, mod_thresh=None): return col.map(lambda x: x.re_roll_less_than(x.mean())) class Melta(Modifier): def modify_dice(self, col, thresh=None, mod_thresh=None): return col.map(lambda x: x.melta()) class AddNTo(Modifier): def __init__(self, value=0, *args, **kwargs): self.n = value self.priority = self.n class AddNToThreshold(AddNTo): def modify_threshold(self, thresh): return thresh - self.n class AddNToAP(AddNTo): def modify_ap(self, ap): return ap - self.n class AddNToSave(AddNTo): def modify_save(self, save): return save - self.n class AddNToInvuln(AddNTo): def modify_invuln(self, invuln): return invuln - self.n class AddNToVolume(AddNTo): def modify_dice(self, col, thresh=None, mod_thresh=None): return col.map(lambda x: x.roll(self.n)) class AddD6(AddNTo): def modify_dice(self, col, thresh=None, mod_thresh=None): return PMFCollection(col.pmfs+[PMF.dn(6)]) class AddD3(AddNTo): def modify_dice(self, col, thresh=None, mod_thresh=None): return PMFCollection(col.pmfs+[PMF.dn(3)]) class SetToN(Modifier): def __init__(self, value=0, *args, **kwargs): self.n = value class SetThresholdToN(SetToN): def modify_threshold(self, thresh): return self.n class SetAPToN(SetToN): def modify_ap(self, ap): return self.n class SetSaveToN(SetToN): def modify_save(self, save): return self.n class SetInvulnToN(SetToN): def modify_invuln(self, invuln): return self.n class IgnoreAP(Modifier): def __init__(self, value=0, *args, **kwargs): self.ap = value def modify_ap(self, ap): return 0 if ap <= self.ap else ap class IgnoreInvuln(Modifier): def modify_invuln(self, ap): return 7 class HalfDamage(Modifier): def modify_dice(self, col, thresh=None, mod_thresh=None): return col.map(lambda x: x.div_min_one(2)) class ShieldDrone(Modifier): def modify_drones(self): return True, 2, 5 class NormalDrone(Modifier): def modify_drones(self): return True, 2, 7 class Overheat(Modifier): def modify_self_wounds(self): return 2 class ModifierCollection(object): """ Used to keep track of any modifiers to the attack """ def __init__(self, data=None): self._data = {'shots': [], 'hit': [], 'wound': [], 'pen': [], 'fnp': [], 'damage': []} self.merge_dicts(data or {}) def merge_dicts(self, mod_dict): for mod_name in self._data: self._data[mod_name] += mod_dict.get(mod_name, []) self._sort_modifiers() def add_mods(self, mod_name, mods): self._data[mod_name] += mods def _sort_modifiers(self): for mod_name in self._data: self._data[mod_name] = sorted( self._data[mod_name], key=lambda x: x.priority, reverse=True ) def _shot_mods(self): return self._data.get('shots', []) def _hit_mods(self): return self._data.get('hit', []) def _wound_mods(self): return self._data.get('wound', []) def _pen_mods(self): return self._data.get('pen', []) def _fnp_mods(self): return self._data.get('fnp', []) def _damage_mods(self): return self._data.get('damage', []) def _get_mods(self, mods_name): return self._data.get(mods_name, []) def _mod_dice(self, col, mods, thresh=None, mod_thresh=None): """ Apply dice modifications. Rerolls happen before modifiers. """ for mod in mods: col = mod.modify_re_roll(col, thresh, mod_thresh) for mod in mods: col = mod.modify_dice(col, thresh, mod_thresh) return col def modify_shot_dice(self, dists): """ Modify the PMF of shot volume the dice. Ususally for re-rolls. """ return self._mod_dice(dists, self._shot_mods()) def modify_hit_thresh(self, thresh): """ Modify the hit threshold. Important to note the -1 to hit modifiers actually are a +1 to the threshold. Similarly +1 to hits are -1 to the threshold. """ if thresh == 1: # Handle the case where the weapon is auto hit. No to hit modifiers map return thresh for mod in self._hit_mods(): thresh = mod.modify_threshold(thresh) return max(thresh, 2) #1's always fail def modify_hit_dice(self, dists, thresh, mod_thresh): """ Modify the PMF of hit dice. Ususally for re-rolls. """ return self._mod_dice(dists, self._hit_mods(), thresh, mod_thresh) def modify_wound_thresh(self, thresh): """ Modify the wound threshold. Important to note the -1 to wound modifiers actually are a +1 to the threshold. Similarly +1 are -1 to the threshold. """ for mod in self._wound_mods(): thresh = mod.modify_threshold(thresh) return max(2, thresh) # 1's always fail def modify_wound_dice(self, dists, thresh, mod_thresh): """ Modify the PMF of hit dice. Ususally for re-rolls. """ return self._mod_dice(dists, self._wound_mods(), thresh, mod_thresh) def modify_pen_thresh(self, save, ap, invuln): """ Modify the pen threshold by modifying the save, ap, and invuln """ for mod in self._pen_mods(): save = mod.modify_save(save) for mod in self._pen_mods(): ap = mod.modify_ap(ap) for mod in self._pen_mods(): invuln = mod.modify_invuln(invuln) return min(max(save + ap, 2), max(invuln, 2)) # 1's alwasys fail def modify_pen_dice(self, dists, thresh, mod_thresh): """ Modify the PMF of the pen dice. Ususally for re-rolls. """ return self._mod_dice(dists, self._pen_mods(), thresh, mod_thresh) def modify_drone(self): """ Return if the attack should be modified by saviour protocols """ enabled = False thresh = 7 fnp = 7 for mod in self._pen_mods(): e, t, f = mod.modify_drones() enabled = enabled or e thresh = thresh if thresh < t else t fnp = fnp if fnp < f else f return enabled, thresh, fnp def modify_self_wounds(self): """ Return threshold for self wound """ thresh = 0 for mod in self._hit_mods(): mod_thresh = mod.modify_self_wounds() thresh = thresh if thresh > mod_thresh else mod_thresh return thresh def modify_fnp_thresh(self, thresh): """ Modify the fnp threshold. I think some death guard units can do this? """ for mod in self._fnp_mods(): thresh = mod.modify_save(thresh) return max(thresh, 2) # 1's alwasys fail def modify_fnp_dice(self, dists, thresh, mod_thresh): """ Modify the PMF of the FNP dice. Ususally for re-rolls. """ return self._mod_dice(dists, self._fnp_mods(), thresh, mod_thresh) def modify_damage_dice(self, dists): """ Modify the damage dice """ return self._mod_dice(dists, self._damage_mods()) def sum_generators(self, mod_list, attr_name): cols = [getattr(mod, attr_name)() for mod in mod_list] cols = [x for x in cols if x] return PMFCollection.add_many(cols) def get_mod_extra_hit(self): """ Generate extra hits on a modfiable value """ return self.sum_generators(self._hit_mods(), 'mod_extra_hit') def get_extra_hit(self): """ Generate extra hits on a static value """ return self.sum_generators(self._hit_mods(), 'extra_hit') def get_mod_extra_shot(self): """ Generate extra shots on a modfiable value """ return self.sum_generators(self._hit_mods(), 'mod_extra_shot') def get_extra_shot(self): """ Generate extra shots on a static value """ return self.sum_generators(self._hit_mods(), 'extra_shot') def get_mod_extra_wound(self): """ Generate extra wounds on a modfiable value """ return self.sum_generators(self._wound_mods(), 'mod_extra_wound') def get_extra_wound(self): """ Generate extra wounds on a static value """ return self.sum_generators(self._wound_mods(), 'extra_wound') def get_mod_mortal_wounds(self, mods_name): """ Generate mortal wounds on a modfiable value """ return self.sum_generators(self._get_mods(mods_name), 'mod_mortal_wound') def get_mortal_wounds(self, mods_name): """ Generate mortal wounds on a static value """ return self.sum_generators(self._get_mods(mods_name), 'mortal_wound')
25.068182
111
0.683013
1,780
12,133
4.45
0.114607
0.052266
0.026259
0.038379
0.62429
0.576316
0.452721
0.397046
0.310441
0.305517
0
0.007027
0.202423
12,133
483
112
25.120083
0.811512
0.129482
0
0.380282
0
0
0.014694
0
0
0
0
0
0
1
0.320423
false
0.003521
0.003521
0.190141
0.78169
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
0
1
1
0
0
3
fde4444d8aa3bbb11a2e42be755048422166a96b
7,783
py
Python
LightningFunc/step.py
Leyan529/ImageSegmentationPL
c41d6b4d2fa86620601dd4401775494d372f07b2
[ "MIT" ]
null
null
null
LightningFunc/step.py
Leyan529/ImageSegmentationPL
c41d6b4d2fa86620601dd4401775494d372f07b2
[ "MIT" ]
null
null
null
LightningFunc/step.py
Leyan529/ImageSegmentationPL
c41d6b4d2fa86620601dd4401775494d372f07b2
[ "MIT" ]
null
null
null
import torch from torch._C import dtype from torchvision.utils import save_image from LightningFunc.utils import * from LightningFunc.optimizer import get_lr import numpy as np import cv2 def training_step(self, batch, batch_idx): # training_step defined the train loop. # It is independent of forward x, y = batch self.reference_image = x out = self.forward(x) loss = self.criterion(out, y) # acc predicted = np.argmax(out.clone().detach().data.cpu().numpy(), axis=1) self.prepare_matrix(y.clone().detach().cpu().numpy(), predicted) self.logger.experiment.add_scalars("Loss/Step", {"Train":loss}, self.global_step) return {'loss':loss} def training_epoch_end(self, outputs): # 在Validation的一個Epoch結束後,計算平均的Loss及Acc. avg_loss = torch.stack([x['loss'] for x in outputs]).mean() avg_train_Acc, avg_train_Acc_class, avg_train_mIoU, avg_train_FWIoU = self.generate_score() self.confusion_matrix = np.zeros((self.num_classes,) * 2) self.logger.experiment.add_scalars("Loss/Epoch", {"Train":avg_loss}, self.current_epoch) self.logger.experiment.add_scalars("Accuracy/Acc_normal", {"Train":avg_train_Acc}, self.current_epoch) self.logger.experiment.add_scalars("Accuracy/Acc_class", {"Train":avg_train_Acc_class}, self.current_epoch) self.logger.experiment.add_scalars("Accuracy/mIoU", {"Train":avg_train_mIoU}, self.current_epoch) self.logger.experiment.add_scalars("Accuracy/FWIoU", {"Train":avg_train_FWIoU}, self.current_epoch) if(self.current_epoch==1): self.logger.experiment.add_graph(self, self.sampleImg) # iterating through all parameters for name,params in self.named_parameters(): self.logger.experiment.add_histogram(name,params,self.current_epoch) def validation_step(self, batch, batch_idx): x, y = batch out = self.forward(x) loss = self.criterion(out, y) # acc predicted = np.argmax(out.clone().detach().data.cpu().numpy(), axis=1) self.prepare_matrix(y.clone().detach().cpu().numpy(), predicted) # show result pred_rgb = decode_seg_map_sequence(predicted, self.args.data_module) orign_img = np.array(x[0].cpu(), dtype=np.float64) orign_img = orign_img.transpose((1, 2, 0)) orign_img *= (0.229, 0.224, 0.225) orign_img += (0.485, 0.456, 0.406) orign_img *= 255.0 orign_img = cv2.resize(orign_img, dsize=(512, 256), interpolation=cv2.INTER_LINEAR) # ratio = 0.7 ratio = 0.0 pred_rgb = pred_rgb[0].cpu().numpy().transpose((1, 2, 0))*255 pred_rgb = cv2.resize(pred_rgb, dsize=(512, 256), interpolation=cv2.INTER_LINEAR) pred_rgb = np.add(orign_img*ratio , pred_rgb*(1 - ratio)) # loss values = {'val_loss':loss} self.log_dict(values, logger=True, on_epoch=True) return {'val_loss':loss, "orign_img": torch.from_numpy(orign_img/255).type(torch.FloatTensor), \ "pred_img":torch.from_numpy(pred_rgb/255).type(torch.FloatTensor) } def validation_epoch_end(self, outputs): # 在Validation的一個Epoch結束後,計算平均的Loss及Acc. avg_loss = torch.stack([x['val_loss'] for x in outputs]).mean() avg_Val_Acc, avg_Val_Acc_class, avg_Val_mIoU, avg_Val_FWIoU = self.generate_score() self.confusion_matrix = np.zeros((self.num_classes,) * 2) self.logger.experiment.add_scalars("Loss/Epoch", {"Val":avg_loss}, self.current_epoch) self.logger.experiment.add_scalars("Loss/Step", {"Val":avg_loss}, self.global_step) self.logger.experiment.add_scalars("Accuracy/Acc_normal", {"Val":avg_Val_Acc}, self.current_epoch) self.logger.experiment.add_scalars("Accuracy/Acc_class", {"Val":avg_Val_Acc_class}, self.current_epoch) self.logger.experiment.add_scalars("Accuracy/mIoU", {"Val":avg_Val_mIoU}, self.current_epoch) self.logger.experiment.add_scalars("Accuracy/FWIoU", {"Val":avg_Val_FWIoU}, self.current_epoch) orign_imgs = torch.stack([x['orign_img'] for x in outputs[:4]]) orign_imgs = orign_imgs[:,:,:,[2,1,0]] self.logger.experiment.add_image("validation_%s/orign_img" %(self.current_epoch), orign_imgs, self.current_epoch, dataformats="NHWC") pred_imgs = torch.stack([x['pred_img'] for x in outputs[:4]]) pred_imgs = pred_imgs[:,:,:,[2,1,0]] self.logger.experiment.add_image("validation_%s/pred_img" %(self.current_epoch), pred_imgs, self.current_epoch, dataformats="NHWC") self.write_Best_model_path() def test_step(self, batch, batch_idx): #定義 Test 階段 x, y = batch out = self.forward(x) # acc predicted = np.argmax(out.clone().detach().data.cpu().numpy(), axis=1) self.prepare_matrix(y.clone().detach().cpu().numpy(), predicted) # show result pred_rgb = decode_seg_map_sequence(predicted, self.args.data_module) orign_img = np.array(x[0].cpu(), dtype=np.float64) orign_img = orign_img.transpose((1, 2, 0)) orign_img *= (0.229, 0.224, 0.225) orign_img += (0.485, 0.456, 0.406) orign_img *= 255.0 orign_img = cv2.resize(orign_img, dsize=(512, 256), interpolation=cv2.INTER_LINEAR) # ratio = 0.7 ratio = 0.0 pred_rgb = pred_rgb[0].cpu().numpy().transpose((1, 2, 0))*255 pred_rgb = cv2.resize(pred_rgb, dsize=(512, 256), interpolation=cv2.INTER_LINEAR) pred_rgb = np.add(orign_img*ratio , pred_rgb*(1 - ratio)) # orign_y = np.array(y.cpu(), dtype=np.float64) # orign_y = orign_y.transpose((1, 2, 0)) # orign_y *= 255.0 # write cv2 IMG # cv2.imwrite(os.path.join(self.dir, 'orign_img.png'.format(batch_idx)), orign_img) # cv2.imwrite(os.path.join(self.dir, 'orign_y.png'.format(batch_idx)), orign_y) # cv2.imwrite(os.path.join(self.dir, 'pred_rgb.png'.format(batch_idx)), pred_rgb) return {"orign_img": torch.from_numpy(orign_img/255).type(torch.FloatTensor), \ "pred_img":torch.from_numpy(pred_rgb/255).type(torch.FloatTensor) } def test_epoch_end(self, outputs): # 在test的一個Epoch結束後,計算平均的Loss及Acc. # if self.args.data_module not in ["Cityscapes"]: avg_Test_Acc, avg_Test_Acc_class, avg_Test_mIoU, avg_Test_FWIoU = self.generate_score() self.confusion_matrix = np.zeros((self.num_classes,) * 2) self.logger.experiment.add_scalars("Test/Acc_normal", {"":avg_Test_Acc}, self.current_epoch) self.logger.experiment.add_scalars("Test/Acc_class", {"":avg_Test_Acc_class}, self.current_epoch) self.logger.experiment.add_scalars("Test/mIoU", {"":avg_Test_mIoU}, self.current_epoch) self.logger.experiment.add_scalars("Test/FWIoU", {"":avg_Test_FWIoU}, self.current_epoch) # logging reference image orign_imgs = torch.stack([x['orign_img'] for x in outputs[:4]]) orign_imgs = orign_imgs[:,:,:,[2,1,0]] self.logger.experiment.add_image("Test_%s/orign_img" %(self.current_epoch), orign_imgs, self.current_epoch, dataformats="NHWC") pred_imgs = torch.stack([x['pred_img'] for x in outputs[:4]]) pred_imgs = pred_imgs[:,:,:,[2,1,0]] self.logger.experiment.add_image("Test_%s/pred_img" %(self.current_epoch), pred_imgs, self.current_epoch, dataformats="NHWC")
44.221591
114
0.635745
1,057
7,783
4.445601
0.143803
0.04767
0.08172
0.107682
0.763567
0.722494
0.722494
0.688444
0.677165
0.638647
0
0.028614
0.223179
7,783
176
115
44.221591
0.748594
0.091867
0
0.554545
0
0
0.066453
0.006558
0
0
0
0
0
1
0.054545
false
0
0.063636
0
0.145455
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
0
0
0
0
0
0
0
0
3
fdf5e7706fc6679da48cd91a2530c7f85e111c68
372
py
Python
spiders/utils/dynamics.py
jacobic/spiders
287dcf041ba248dd369646236cdbf07ecf32d4e8
[ "MIT" ]
null
null
null
spiders/utils/dynamics.py
jacobic/spiders
287dcf041ba248dd369646236cdbf07ecf32d4e8
[ "MIT" ]
null
null
null
spiders/utils/dynamics.py
jacobic/spiders
287dcf041ba248dd369646236cdbf07ecf32d4e8
[ "MIT" ]
null
null
null
from astropy import constants def proper_velocity(zi, zclu): # Computes proper velocities of member galaxes in numpy array # zclu comes from clusterZ definition """ zi: redshift of the members zclu: cluster redshift Returns array of velocities (Ruel et al. 2014) """ return constants.c * (zi - zclu) / (1. + zclu)
26.571429
65
0.634409
46
372
5.108696
0.695652
0.051064
0
0
0
0
0
0
0
0
0
0.019011
0.293011
372
13
66
28.615385
0.874525
0.526882
0
0
0
0
0
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
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
3
8bf66708bf0aa2c079f32207b30c73988620ed9f
27
py
Python
applications/STORAGE/redisPSCO/COMPSs-Redis-bundle/python/storage/__init__.py
srgrr/TFM
f6c302547fdfc9b1df3423cc4e927cd6bb83b345
[ "MIT" ]
6
2019-01-02T10:39:32.000Z
2019-05-22T14:01:41.000Z
applications/STORAGE/redisPSCO/python/storage/__init__.py
srgrr/TFM
f6c302547fdfc9b1df3423cc4e927cd6bb83b345
[ "MIT" ]
1
2019-11-13T14:30:21.000Z
2019-11-13T14:30:21.000Z
applications/STORAGE/redisPSCO/python/storage/__init__.py
srgrr/TFM
f6c302547fdfc9b1df3423cc4e927cd6bb83b345
[ "MIT" ]
null
null
null
__name__ = "redispycompss"
13.5
26
0.777778
2
27
8.5
1
0
0
0
0
0
0
0
0
0
0
0
0.111111
27
1
27
27
0.708333
0
0
0
0
0
0.481481
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
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
e30864c53f11f67ca877299b3fa5502aa908de27
443
py
Python
bouncer/app/internal.py
Klarrio/bouncer
f2116912adc43dafbb4b96668ebca17b3f924603
[ "Apache-2.0" ]
6
2018-11-30T22:10:20.000Z
2022-02-13T14:20:37.000Z
bouncer/app/internal.py
Klarrio/bouncer
f2116912adc43dafbb4b96668ebca17b3f924603
[ "Apache-2.0" ]
6
2018-11-30T10:38:23.000Z
2019-08-19T08:27:59.000Z
bouncer/app/internal.py
Klarrio/bouncer
f2116912adc43dafbb4b96668ebca17b3f924603
[ "Apache-2.0" ]
7
2018-11-28T14:50:50.000Z
2022-03-01T13:16:36.000Z
# Copyright (C) Mesosphere, Inc. See LICENSE file for details. """Implement handlers for /internal* endpoints.""" from bouncer.app import http_openapi_spec_utf8 def get_module_route_handlers(): return { '/internal/openapispec.yaml': OpenAPISpecYAML } class OpenAPISpecYAML: def on_get(self, req, resp): resp.content_type = 'application/x-yaml; charset=utf-8' resp.data = http_openapi_spec_utf8
21.095238
63
0.702032
55
443
5.454545
0.763636
0.073333
0.1
0.126667
0
0
0
0
0
0
0
0.008451
0.198646
443
20
64
22.15
0.83662
0.239278
0
0
0
0
0.178248
0.07855
0
0
0
0
0
1
0.222222
false
0
0.111111
0.111111
0.555556
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
0
1
1
0
0
3
e31d969d816f0c9243bb8264a123d39874586fc3
113
py
Python
TPs/TP7/test0.py
Aympab/BigDataHadoopSparkDaskCourse
42f9e0475cbd7c5db240ccc6dc00c19b9006012a
[ "Apache-2.0" ]
null
null
null
TPs/TP7/test0.py
Aympab/BigDataHadoopSparkDaskCourse
42f9e0475cbd7c5db240ccc6dc00c19b9006012a
[ "Apache-2.0" ]
null
null
null
TPs/TP7/test0.py
Aympab/BigDataHadoopSparkDaskCourse
42f9e0475cbd7c5db240ccc6dc00c19b9006012a
[ "Apache-2.0" ]
1
2022-01-31T17:14:27.000Z
2022-01-31T17:14:27.000Z
import pyspark from pyspark import SparkContext sc =SparkContext() nums= sc.parallelize([1,2,3,4]) nums.take(1)
18.833333
32
0.761062
18
113
4.777778
0.666667
0
0
0
0
0
0
0
0
0
0
0.049505
0.106195
113
5
33
22.6
0.80198
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
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
0
0
0
3
e3390ac808e3c887645e988c97be5049924aea26
209
py
Python
test_xml.py
tooploox/SPCConvert
c56b472e7f4ccb466c0eb9791bd6c4f6c828216e
[ "MIT" ]
2
2019-05-03T05:02:58.000Z
2022-01-10T18:23:38.000Z
test_xml.py
MicroscopeIT/SPCConvert
c56b472e7f4ccb466c0eb9791bd6c4f6c828216e
[ "MIT" ]
1
2020-03-06T00:28:22.000Z
2020-03-06T00:28:22.000Z
test_xml.py
hab-spc/SPCConvert
a31716a5b3e48a5ae333e5086a922e320ad16dbf
[ "MIT" ]
4
2018-02-07T10:12:33.000Z
2021-07-12T22:44:56.000Z
import os import sys import json cfg = xmlsettings.XMLSettings(os.path.join(sys.path[0],'settings.xml')) with open(os.path.join(sys.path[0],'config.json')) as data_file: data = json.load(data_file)
20.9
71
0.712919
35
209
4.2
0.514286
0.081633
0.136054
0.176871
0.244898
0.244898
0
0
0
0
0
0.010989
0.129187
209
9
72
23.222222
0.796703
0
0
0
0
0
0.110577
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
e34f3ff4da512947982b8972f3fb6ada0f6d85c5
1,158
py
Python
src/sima/workflow/blueprints/modelinputslot.py
SINTEF/simapy
650b8c2f15503dad98e2bfc0d0788509593822c7
[ "MIT" ]
null
null
null
src/sima/workflow/blueprints/modelinputslot.py
SINTEF/simapy
650b8c2f15503dad98e2bfc0d0788509593822c7
[ "MIT" ]
null
null
null
src/sima/workflow/blueprints/modelinputslot.py
SINTEF/simapy
650b8c2f15503dad98e2bfc0d0788509593822c7
[ "MIT" ]
null
null
null
# # Generated with ModelInputSlotBlueprint from dmt.blueprint import Blueprint from dmt.dimension import Dimension from dmt.attribute import Attribute from dmt.enum_attribute import EnumAttribute from dmt.blueprint_attribute import BlueprintAttribute from sima.post.blueprints.inputslot import InputSlotBlueprint class ModelInputSlotBlueprint(InputSlotBlueprint): """""" def __init__(self, name="ModelInputSlot", package_path="sima/workflow", description=""): super().__init__(name,package_path,description) self.attributes.append(Attribute("name","string","",default="")) self.attributes.append(Attribute("description","string","",default="")) self.attributes.append(Attribute("_id","string","",default="")) self.attributes.append(BlueprintAttribute("scriptableValues","sima/sima/ScriptableValue","",True,Dimension("*"))) self.attributes.append(BlueprintAttribute("reference","sima/condition/ModelReferenceVariable","Model reference to be replaced",False)) self.attributes.append(Attribute("replaceChildren","boolean","If checked the children of the reference will replaced",default=False))
57.9
142
0.763385
118
1,158
7.381356
0.440678
0.096441
0.137773
0.13318
0.134328
0.096441
0
0
0
0
0
0
0.105354
1,158
20
143
57.9
0.840734
0.032815
0
0
1
0
0.231323
0.055806
0
0
0
0
0
1
0.066667
false
0
0.4
0
0.533333
0.4
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
0
1
0
1
0
0
3
e34fe49af969eb34af635294209bdbbd22e79a63
5,763
py
Python
app/forms.py
ES-UFABC/Grupo2.3
37387e8c472ab7d68a7eda51070b1320ff7ac843
[ "MIT" ]
null
null
null
app/forms.py
ES-UFABC/Grupo2.3
37387e8c472ab7d68a7eda51070b1320ff7ac843
[ "MIT" ]
8
2022-03-21T21:54:12.000Z
2022-03-28T22:59:15.000Z
app/forms.py
ES-UFABC/Grupo-17
37387e8c472ab7d68a7eda51070b1320ff7ac843
[ "MIT" ]
1
2022-02-24T00:23:38.000Z
2022-02-24T00:23:38.000Z
from flask_wtf import FlaskForm from wtforms import StringField, TextAreaField, DateField, DateTimeLocalField, PasswordField, SubmitField, SelectField, \ IntegerField from wtforms.validators import InputRequired, DataRequired, EqualTo class CreateUserForm(FlaskForm): name = StringField(u'Nome', validators=[InputRequired()]) email = StringField(u'E-mail', validators=[InputRequired()]) password = PasswordField(u'Senha', validators=[InputRequired()]) password_confirmation = PasswordField(u'Confirmação de Senha', validators=[InputRequired(), DataRequired(), EqualTo('password')]) hotel_id = SelectField('Hotel', validators=[DataRequired()]) profile = SelectField(u'Tipo de usuário', validators=[InputRequired()], choices=['admin', 'gerente', 'recepcionista', 'financeiro']) # date = DateTimeField(u'Data', format='%d/%m/%Y %H:%M') # recaptcha = RecaptchaField(u'Recaptcha') class EditarUsuario(FlaskForm): name = StringField(u'Nome', validators=[InputRequired()]) email = StringField(u'E-mail', validators=[InputRequired()]) hotel_id = SelectField('Hotel', validators=[DataRequired()]) profile = SelectField(u'Tipo de usuário', validators=[InputRequired()], choices=['admin', 'gerente', 'recepcionista', 'financeiro']) submeter = SubmitField('Submeter') class LoginForm(FlaskForm): email = StringField(u'Email', validators=[InputRequired()]) password = PasswordField(u'Senha', validators=[InputRequired()]) class AdicionarHotel(FlaskForm): name = StringField('Nome', validators=[DataRequired()]) phone = StringField('Telefone', validators=[DataRequired()]) email = StringField('E-mail', validators=[DataRequired()]) cnpj = StringField('CNPJ', validators=[DataRequired()]) endereco = StringField('Endereço', validators=[DataRequired()]) numero = StringField('Número', validators=[DataRequired()]) complemento = StringField('Complemento') bairro = StringField('Bairro', validators=[DataRequired()]) cidade = StringField('Cidade', validators=[DataRequired()]) estado = StringField('Estado', validators=[DataRequired()]) pais = StringField('Pais', validators=[DataRequired()]) cep = StringField('CEP', validators=[DataRequired()]) submeter = SubmitField('Adicionar') class AdicionarQuarto(FlaskForm): hotel_id = SelectField('Hotel', validators=[DataRequired()]) name = StringField('Nome', validators=[DataRequired()]) short_description = StringField('Descrição', validators=[DataRequired()]) number = StringField('Número', validators=[DataRequired()]) kind = StringField('Tipo', validators=[DataRequired()]) phone_extension = StringField('Extensão telefone', validators=[DataRequired()]) price = StringField('Preço', validators=[DataRequired()]) guest_limit = StringField('Número de hóspedes', validators=[DataRequired()]) submeter = SubmitField('Submeter') class AdicionarReserva(FlaskForm): room_id = SelectField('Quarto', validators=[DataRequired()]) guest_id = SelectField('Hóspede', validators=[DataRequired()]) total_guests = IntegerField('Quantidade de hóspedes', validators=[DataRequired()]) check_in = DateField('Data Entrada', validators=[DataRequired()]) check_out = DateField('Data Saída', validators=[DataRequired()]) payment_type = SelectField('Tipo de pagamento', validators=[DataRequired()], choices=[("credit_card", "Cartão de crédito"), ("pix", "Pix")]) # status = StringField('Status', validators=[DataRequired()]) submeter = SubmitField('Salvar') class AdicionarHospede(FlaskForm): hotel_id = SelectField('Hotel', validators=[DataRequired()]) name = StringField(u'Nome', validators=[InputRequired()]) email = StringField(u'E-mail', validators=[InputRequired()]) phone = StringField('Telefone', validators=[DataRequired()]) cpf = StringField('CPF', validators=[DataRequired()]) birthday = StringField('Data Nascimento', validators=[DataRequired()]) endereco = StringField('Endereço', validators=[DataRequired()]) numero = StringField('Número', validators=[DataRequired()]) complemento = StringField('Complemento') bairro = StringField('Bairro', validators=[DataRequired()]) cidade = StringField('Cidade', validators=[DataRequired()]) estado = StringField('Estado', validators=[DataRequired()]) pais = StringField('Pais', validators=[DataRequired()]) cep = StringField('CEP', validators=[DataRequired()]) submeter = SubmitField('Salvar') class VerificarDisponibilidade(FlaskForm): total_guests = IntegerField('Quantidade de hóspedes', validators=[DataRequired()]) check_in = DateField('Data Entrada', validators=[DataRequired()]) check_out = DateField('Data Saída', validators=[DataRequired()]) submeter = SubmitField('Reservar') class Contas(FlaskForm): hotel_id = SelectField('Hotel', validators=[DataRequired()]) guest_id = SelectField('Nome', validators=[DataRequired()]) tipo = SelectField('Tipo', choices=['Contas a pagar', 'Contas a receber'], validators=[DataRequired()]) descricao = StringField('Descrição', validators=[DataRequired()]) valor = StringField('Valor', validators=[DataRequired()]) data_pagamento = DateField('Data pagamento') submeter = SubmitField('Submeter') class Estoque(FlaskForm): hotel_id = SelectField('Hotel', validators=[DataRequired()]) categoria = StringField('Categoria', validators=[DataRequired()]) nome = StringField('Nome', validators=[DataRequired()]) detalhes = StringField('Detalhes', validators=[DataRequired()]) submeter = SubmitField('Submeter')
46.104
121
0.701544
501
5,763
8.023952
0.237525
0.279104
0.026866
0.034328
0.59403
0.515672
0.5
0.473134
0.442537
0.41194
0
0
0.145063
5,763
124
122
46.475806
0.815912
0.026896
0
0.549451
0
0
0.127409
0
0
0
0
0
0
1
0
false
0.054945
0.032967
0
0.945055
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
0
1
0
0
1
0
0
3
e360734a5e67b0f37d17c3a1c470e85a7cc61fac
1,459
py
Python
lambdata/test_helper_functions.py
RyanFikejs/lambdata-ryanfikejs
649edc445b854902447fe67ebab44f936fcead29
[ "MIT" ]
null
null
null
lambdata/test_helper_functions.py
RyanFikejs/lambdata-ryanfikejs
649edc445b854902447fe67ebab44f936fcead29
[ "MIT" ]
null
null
null
lambdata/test_helper_functions.py
RyanFikejs/lambdata-ryanfikejs
649edc445b854902447fe67ebab44f936fcead29
[ "MIT" ]
null
null
null
"""Practice tests for helper functions""" import pytest import pandas as pd from numpy import random from lambdata.helper_functions import DataFrameHelper as dfh from lambdata.helper_functions import SeriesHelper as sh # Create several random dataframes for testing purposes dfh_dict = {} for n in range(1, 10): df = pd.DataFrame(random.randint(0,100,size=(60,5)), columns=list('ABCDE')) #TODO insert random number of NaN values into each df dfh_dict[f"dfh{n}"] = dfh(df) ### This first group of tests apply to the DataFrameHelper class def test_null_count(): """Testing the null count function""" for i in dfh_dict: total_nulls = 0 for col in dfh_dict[i].df.columns: total_nulls += dfh_dict[i].df[col].isnull().sum() assert dfh_dict[i].null_count() == total_nulls assert dfh_dict[i].null_count().dtype == 'int64' def test_train_test_split(): """Testing the train/test set splitting function""" pass def test_randomize(): """Testing the randomize function""" pass ### This second group of tests apply to the SeriesHelper class def test_addy_split(): """Testing the address splitting function""" pass def test_abbr_2_st(): """Testing the state abbreviation function""" pass def test_list_2_series(): """Testing the 'list to series' function""" pass def test_split_dates(): """Testing the date splitting function""" pass
25.155172
64
0.688828
210
1,459
4.642857
0.414286
0.050256
0.032821
0.077949
0.217436
0.092308
0
0
0
0
0
0.012942
0.20562
1,459
58
65
25.155172
0.8283
0.35915
0
0.206897
0
0
0.018018
0
0
0
0
0.017241
0.068966
1
0.241379
false
0.206897
0.172414
0
0.413793
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
1
0
0
0
0
0
3
e37c1a302d2144a699ccac608a6f5031c401df82
127
py
Python
python/8Kyu/Enumerable Magic #25 - Take the First N Elements.py
athasv/Codewars-data
5e106466e709fd776f23585ad9f652d0d65b48d3
[ "MIT" ]
null
null
null
python/8Kyu/Enumerable Magic #25 - Take the First N Elements.py
athasv/Codewars-data
5e106466e709fd776f23585ad9f652d0d65b48d3
[ "MIT" ]
null
null
null
python/8Kyu/Enumerable Magic #25 - Take the First N Elements.py
athasv/Codewars-data
5e106466e709fd776f23585ad9f652d0d65b48d3
[ "MIT" ]
null
null
null
def take(arr,n): if not arr: return [] if arr[0] is not None: return [arr[i] for i in range(len(arr)) if i < n]
31.75
57
0.559055
26
127
2.730769
0.576923
0
0
0
0
0
0
0
0
0
0
0.011111
0.291339
127
4
57
31.75
0.777778
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
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
e37e31270b69923b2f2dfd409737e2d3f1bcdf3a
14,980
py
Python
somm_airdrop/etherscan/get_somm_v2_mints_burns.py
VolumeFi/somm_airdrop
c744e3d25072a72d789619fe628d52dfe504c36a
[ "MIT" ]
null
null
null
somm_airdrop/etherscan/get_somm_v2_mints_burns.py
VolumeFi/somm_airdrop
c744e3d25072a72d789619fe628d52dfe504c36a
[ "MIT" ]
null
null
null
somm_airdrop/etherscan/get_somm_v2_mints_burns.py
VolumeFi/somm_airdrop
c744e3d25072a72d789619fe628d52dfe504c36a
[ "MIT" ]
3
2022-01-27T13:40:40.000Z
2022-02-12T13:10:32.000Z
import logging from pprint import pprint from web3 import Web3 from decoding_utils import decode_log import json import pandas as pd from tqdm import tqdm from somm_airdrop.etherscan.etherscan_connector import EtherscanConnector import math import datetime api_rate_limit_message = "Max rate limit reached" # Etherscan Logs: # https://docs.etherscan.io/api-endpoints/logs # ====================================================================================================================== SOMM_V2_CONTRACTS = [ { "name": "Release1 Add", "address": "0xFd8A61F94604aeD5977B31930b48f1a94ff3a195", "abi": [{"name":"TestValue","inputs":[{"type":"uint256","name":"value","indexed":False},{"type":"string","name":"text","indexed":False}],"anonymous":False,"type":"event"},{"name":"TestAddress","inputs":[{"type":"address","name":"addr","indexed":False},{"type":"string","name":"text","indexed":False}],"anonymous":False,"type":"event"},{"name":"TestData","inputs":[{"type":"bytes32","name":"data","indexed":False},{"type":"string","name":"text","indexed":False}],"anonymous":False,"type":"event"},{"outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"name":"investTokenForEthPair","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"token"},{"type":"address","name":"pair"},{"type":"uint256","name":"amount"},{"type":"uint256","name":"minPoolTokens"}],"stateMutability":"payable","type":"function"},{"name":"investTokenForEthPair","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"token"},{"type":"address","name":"pair"},{"type":"uint256","name":"amount"},{"type":"uint256","name":"minPoolTokens"},{"type":"uint256","name":"deadline"}],"stateMutability":"payable","type":"function"},{"name":"pause","outputs":[],"inputs":[{"type":"bool","name":"_paused"}],"stateMutability":"nonpayable","type":"function","gas":36577},{"name":"newAdmin","outputs":[],"inputs":[{"type":"address","name":"_admin"}],"stateMutability":"nonpayable","type":"function","gas":36607},{"name":"newFeeAmount","outputs":[],"inputs":[{"type":"uint256","name":"_feeAmount"}],"stateMutability":"nonpayable","type":"function","gas":36537},{"name":"newFeeAddress","outputs":[],"inputs":[{"type":"address","name":"_feeAddress"}],"stateMutability":"nonpayable","type":"function","gas":36667},{"name":"seizeMany","outputs":[],"inputs":[{"type":"address[8]","name":"token"},{"type":"uint256[8]","name":"amount"},{"type":"address[8]","name":"to"}],"stateMutability":"nonpayable","type":"function","gas":282577},{"name":"seize","outputs":[],"inputs":[{"type":"address","name":"token"},{"type":"uint256","name":"amount"},{"type":"address","name":"to"}],"stateMutability":"nonpayable","type":"function","gas":36677},{"stateMutability":"payable","type":"fallback"},{"name":"paused","outputs":[{"type":"bool","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1571},{"name":"admin","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1601},{"name":"feeAmount","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1631},{"name":"feeAddress","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1661}], "topic0": "0x4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f" # Mint }, { "name": "Release1 Remove", "address": "0x418915329226AE7fCcB20A2354BbbF0F6c22Bd92", "abi": [{"outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"name":"divestEthPairToToken","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"pair"},{"type":"address","name":"token"},{"type":"uint256","name":"amount"}],"stateMutability":"payable","type":"function"},{"name":"divestEthPairToToken","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"pair"},{"type":"address","name":"token"},{"type":"uint256","name":"amount"},{"type":"uint256","name":"deadline"}],"stateMutability":"payable","type":"function"},{"name":"pause","outputs":[],"inputs":[{"type":"bool","name":"_paused"}],"stateMutability":"nonpayable","type":"function","gas":36397},{"name":"newAdmin","outputs":[],"inputs":[{"type":"address","name":"_admin"}],"stateMutability":"nonpayable","type":"function","gas":36427},{"name":"newFeeAmount","outputs":[],"inputs":[{"type":"uint256","name":"_feeAmount"}],"stateMutability":"nonpayable","type":"function","gas":36357},{"name":"newFeeAddress","outputs":[],"inputs":[{"type":"address","name":"_feeAddress"}],"stateMutability":"nonpayable","type":"function","gas":36487},{"stateMutability":"payable","type":"fallback"},{"name":"paused","outputs":[{"type":"bool","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1331},{"name":"admin","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1361},{"name":"feeAmount","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1391},{"name":"feeAddress","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1421}], "topic0": "0xdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496" # Burn }, { "name": "Release2 Add", "address": "0xA522AA47C40F2BAC847cbe4D37455c521E69DEa7", "abi": [{"name":"LPTokenMint","inputs":[{"type":"address","name":"msg_sender","indexed":False},{"type":"uint256","name":"liquidity","indexed":False}],"anonymous":False,"type":"event"},{"outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"name":"investTokenForUniPair","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"token"},{"type":"address","name":"pair"},{"type":"uint256","name":"amount"},{"type":"uint256","name":"minPoolTokens"}],"stateMutability":"payable","type":"function"},{"name":"investTokenForUniPair","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"token"},{"type":"address","name":"pair"},{"type":"uint256","name":"amount"},{"type":"uint256","name":"minPoolTokens"},{"type":"uint256","name":"deadline"}],"stateMutability":"payable","type":"function"},{"name":"addLiquidity","outputs":[{"type":"uint256","name":""},{"type":"uint256","name":""},{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"tokenA"},{"type":"address","name":"tokenB"},{"type":"uint256","name":"amountADesired"},{"type":"uint256","name":"amountBDesired"},{"type":"uint256","name":"amountAMin"},{"type":"uint256","name":"amountBMin"},{"type":"address","name":"to"}],"stateMutability":"nonpayable","type":"function"},{"name":"addLiquidity","outputs":[{"type":"uint256","name":""},{"type":"uint256","name":""},{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"tokenA"},{"type":"address","name":"tokenB"},{"type":"uint256","name":"amountADesired"},{"type":"uint256","name":"amountBDesired"},{"type":"uint256","name":"amountAMin"},{"type":"uint256","name":"amountBMin"},{"type":"address","name":"to"},{"type":"uint256","name":"deadline"}],"stateMutability":"nonpayable","type":"function"},{"name":"addLiquidityETH","outputs":[{"type":"uint256","name":""},{"type":"uint256","name":""},{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"token"},{"type":"uint256","name":"amountTokenDesired"},{"type":"uint256","name":"amountTokenMin"},{"type":"uint256","name":"amountETHMin"},{"type":"address","name":"to"}],"stateMutability":"payable","type":"function"},{"name":"addLiquidityETH","outputs":[{"type":"uint256","name":""},{"type":"uint256","name":""},{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"token"},{"type":"uint256","name":"amountTokenDesired"},{"type":"uint256","name":"amountTokenMin"},{"type":"uint256","name":"amountETHMin"},{"type":"address","name":"to"},{"type":"uint256","name":"deadline"}],"stateMutability":"payable","type":"function"},{"name":"pause","outputs":[],"inputs":[{"type":"bool","name":"_paused"}],"stateMutability":"nonpayable","type":"function","gas":36727},{"name":"newAdmin","outputs":[],"inputs":[{"type":"address","name":"_admin"}],"stateMutability":"nonpayable","type":"function","gas":36757},{"name":"newFeeAmount","outputs":[],"inputs":[{"type":"uint256","name":"_feeAmount"}],"stateMutability":"nonpayable","type":"function","gas":36687},{"name":"newFeeAddress","outputs":[],"inputs":[{"type":"address","name":"_feeAddress"}],"stateMutability":"nonpayable","type":"function","gas":36817},{"stateMutability":"payable","type":"fallback"},{"name":"paused","outputs":[{"type":"bool","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1661},{"name":"admin","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1691},{"name":"feeAmount","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1721},{"name":"feeAddress","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1751}], "topic0": "0x4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f" # Mint }, { "name": "Release2 Remove", "address": "0x430f33353490b256D2fD7bBD9DaDF3BB7f905E78", "abi": [{"stateMutability":"nonpayable","type":"constructor","inputs":[],"outputs":[]},{"stateMutability":"payable","type":"function","name":"divestUniPairToToken","inputs":[{"name":"pair","type":"address"},{"name":"token","type":"address"},{"name":"amount","type":"uint256"},{"name":"minTokenAmount","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"payable","type":"function","name":"divestUniPairToToken","inputs":[{"name":"pair","type":"address"},{"name":"token","type":"address"},{"name":"amount","type":"uint256"},{"name":"minTokenAmount","type":"uint256"},{"name":"deadline","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"removeLiquidity","inputs":[{"name":"tokenA","type":"address"},{"name":"tokenB","type":"address"},{"name":"liquidity","type":"uint256"},{"name":"amountAMin","type":"uint256"},{"name":"amountBMin","type":"uint256"},{"name":"to","type":"address"}],"outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"removeLiquidity","inputs":[{"name":"tokenA","type":"address"},{"name":"tokenB","type":"address"},{"name":"liquidity","type":"uint256"},{"name":"amountAMin","type":"uint256"},{"name":"amountBMin","type":"uint256"},{"name":"to","type":"address"},{"name":"deadline","type":"uint256"}],"outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"removeLiquidityETH","inputs":[{"name":"token","type":"address"},{"name":"liquidity","type":"uint256"},{"name":"amountTokenMin","type":"uint256"},{"name":"amountETHMin","type":"uint256"},{"name":"to","type":"address"}],"outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"removeLiquidityETH","inputs":[{"name":"token","type":"address"},{"name":"liquidity","type":"uint256"},{"name":"amountTokenMin","type":"uint256"},{"name":"amountETHMin","type":"uint256"},{"name":"to","type":"address"},{"name":"deadline","type":"uint256"}],"outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"pause","inputs":[{"name":"_paused","type":"bool"}],"outputs":[],"gas":36454},{"stateMutability":"nonpayable","type":"function","name":"newAdmin","inputs":[{"name":"_admin","type":"address"}],"outputs":[],"gas":36484},{"stateMutability":"nonpayable","type":"function","name":"newFeeAmount","inputs":[{"name":"_feeAmount","type":"uint256"}],"outputs":[],"gas":36414},{"stateMutability":"nonpayable","type":"function","name":"newFeeAddress","inputs":[{"name":"_feeAddress","type":"address"}],"outputs":[],"gas":36544},{"stateMutability":"payable","type":"fallback"},{"stateMutability":"view","type":"function","name":"paused","inputs":[],"outputs":[{"name":"","type":"bool"}],"gas":1388},{"stateMutability":"view","type":"function","name":"admin","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":1418},{"stateMutability":"view","type":"function","name":"feeAmount","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":1448},{"stateMutability":"view","type":"function","name":"feeAddress","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":1478}], "topic0": "0xdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496" # Burn } ] if __name__ == "__main__": etherscan_conn = EtherscanConnector() mints_burns_dict = [] # Get latest block number before October 31, 2021 timestamp = int(datetime.datetime.strptime('10/31/2021', '%m/%d/%Y').strftime("%s")) maximum_block_number = int(etherscan_conn.get_block_number_before_timestamp(timestamp=timestamp)) for somm_contract_dict in SOMM_V2_CONTRACTS: normal_txs = etherscan_conn.get_normal_transactions(somm_contract_dict["address"]) for tx_dict in tqdm(normal_txs): tx_hash = tx_dict['hash'] tx_receipt = etherscan_conn.get_tx_receipt(tx_hash=tx_hash) all_tx_logs = tx_receipt['logs'] if len(all_tx_logs) > 0: # Select log with topic0 for tx_log in all_tx_logs: if tx_log["topics"][0] == somm_contract_dict['topic0']: decoded_event = decode_log(data=tx_log['data'], topics=tx_log['topics'], abi=etherscan_conn.get_contract_abi(address=tx_log['address'])) decoded_event_dict = json.loads(decoded_event[1]) event_dict = {} # event_dict keys: [pool, liquidity, somm_user_address] event_dict['liquidity'] = int(math.sqrt(decoded_event_dict['amount0'] * decoded_event_dict['amount1'])) if decoded_event[0] == "Burn": event_dict['liquidity'] *= -1 event_dict['somm_user_address'] = tx_receipt['from'] event_dict["pool"] = tx_log["address"] # Only count transactions with block number < maximum block number if int(tx_receipt['blockNumber'], 16) < maximum_block_number: mints_burns_dict.append(event_dict) mints_burns_df = pd.DataFrame(mints_burns_dict) unique_somm_users = mints_burns_df['somm_user_address'].unique().tolist() mints_burns_df.to_csv("somm_v2_mints_burns.csv") pd.Series(mints_burns_df['somm_user_address'].unique()).to_csv("somm_v2_user_addresses.csv") breakpoint()
161.075269
3,711
0.632109
1,502
14,980
6.215712
0.139814
0.103685
0.120501
0.095116
0.69473
0.65874
0.652099
0.631748
0.619002
0.610111
0
0.052352
0.057677
14,980
93
3,712
161.075269
0.609025
0.025968
0
0.060606
0
0
0.537792
0.038752
0
0
0.02963
0
0
1
0
false
0
0.151515
0
0.151515
0.015152
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
8b5857f67885458d6af5edbcd3f8fbe7370c8830
79
py
Python
waterbutler/__init__.py
birdbrained/waterbutler
60a6eb7f2dfce88b7a00457034c01b20da0aef23
[ "Apache-2.0" ]
null
null
null
waterbutler/__init__.py
birdbrained/waterbutler
60a6eb7f2dfce88b7a00457034c01b20da0aef23
[ "Apache-2.0" ]
null
null
null
waterbutler/__init__.py
birdbrained/waterbutler
60a6eb7f2dfce88b7a00457034c01b20da0aef23
[ "Apache-2.0" ]
null
null
null
__version__ = '0.20.0' __import__('pkg_resources').declare_namespace(__name__)
26.333333
55
0.797468
10
79
4.9
0.9
0
0
0
0
0
0
0
0
0
0
0.053333
0.050633
79
2
56
39.5
0.6
0
0
0
0
0
0.240506
0
0
0
0
0
0
1
0
false
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
0
0
1
0
0
0
0
3
8b5e29bfaca5c04160993fb7fd3b983943c933f7
381
py
Python
pytype/tools/xref/testdata/class_def.py
adamcataldo/pytype
7163e85880b52d53d58044e53157e2a21988308e
[ "Apache-2.0" ]
2
2019-07-25T12:53:02.000Z
2019-08-18T16:26:16.000Z
pytype/tools/xref/testdata/class_def.py
adamcataldo/pytype
7163e85880b52d53d58044e53157e2a21988308e
[ "Apache-2.0" ]
null
null
null
pytype/tools/xref/testdata/class_def.py
adamcataldo/pytype
7163e85880b52d53d58044e53157e2a21988308e
[ "Apache-2.0" ]
null
null
null
# pylint: skip-file #- @A defines/binding ClassA #- @object ref vname("module.object", _, _, "pytd:__builtin__", _) #- ClassA.node/kind class class A(object): pass #- @B defines/binding ClassB #- @A ref ClassA #- ClassB.node/kind class class B(A): pass #- @Foo defines/binding ClassFoo #- @A ref ClassA #- @B ref ClassB #- ClassFoo.node/kind class class Foo(A, B): pass
16.565217
66
0.669291
56
381
4.428571
0.375
0.169355
0.157258
0.217742
0
0
0
0
0
0
0
0
0.170604
381
22
67
17.318182
0.78481
0.750656
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
0
0
0
null
0
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
1
0
0
0
0
0
3
8b6a0a20dfa310edc63ec4965c690a31a64622c9
181
py
Python
HelmholtzAI/benchmarks/implementations/src/deepCam/data/tar-untar.py
mlcommons/hpc_results_v1.0
a3f7469937aa44a48e186160a2e97464970cf72f
[ "Apache-2.0" ]
3
2021-11-18T20:01:35.000Z
2021-12-17T17:47:23.000Z
HelmholtzAI/benchmarks/implementations/src/deepCam/data/tar-untar.py
mlcommons/hpc_results_v1.0
a3f7469937aa44a48e186160a2e97464970cf72f
[ "Apache-2.0" ]
1
2022-03-16T07:29:30.000Z
2022-03-31T10:19:07.000Z
HelmholtzAI/benchmarks/implementations/src/deepCam/data/tar-untar.py
mlcommons/hpc_results_v1.0
a3f7469937aa44a48e186160a2e97464970cf72f
[ "Apache-2.0" ]
1
2021-11-18T01:53:25.000Z
2021-11-18T01:53:25.000Z
import os import tarfile import glob from mpi4py import MPI def tarball_files_by_year(dir): # create a tarball of the files in each year files = os.listdir(dir) pass
15.083333
48
0.729282
30
181
4.3
0.7
0
0
0
0
0
0
0
0
0
0
0.007143
0.226519
181
11
49
16.454545
0.914286
0.232044
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0.142857
0.571429
0
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
0
0
1
1
0
1
0
0
3
8b7d2cc9f0a7a70928f666f751d2d61a5ce7a56f
838
py
Python
main/forms.py
JYOOrepository/django-tickets-1
2656457378f7d982680e26265a50f2f00bc64369
[ "MIT" ]
10
2015-09-15T22:01:21.000Z
2022-03-10T16:30:30.000Z
main/forms.py
JYOOrepository/django-tickets-1
2656457378f7d982680e26265a50f2f00bc64369
[ "MIT" ]
1
2021-02-28T11:39:42.000Z
2021-02-28T11:39:42.000Z
main/forms.py
JYOOrepository/django-tickets-1
2656457378f7d982680e26265a50f2f00bc64369
[ "MIT" ]
6
2017-01-20T18:49:58.000Z
2022-02-15T20:57:17.000Z
# -*- coding: utf-8 -*- from django import forms from django.contrib.auth.models import User from .models import Ticket, FollowUp, Attachment class UserSettingsForm(forms.ModelForm): class Meta: model = User fields = ('first_name', 'last_name', 'email',) class TicketCreateForm(forms.ModelForm): class Meta: model = Ticket fields = ('title', 'description') class TicketEditForm(forms.ModelForm): class Meta: model = Ticket fields = ('title', 'owner', 'description', 'status', 'waiting_for', 'assigned_to') class FollowupForm(forms.ModelForm): class Meta: model = FollowUp fields = ('ticket', 'title', 'text', 'user') class AttachmentForm(forms.ModelForm): class Meta: model = Attachment fields = ('file',)
20.95
57
0.621718
85
838
6.082353
0.447059
0.135397
0.183752
0.222437
0.336557
0.174081
0.174081
0.174081
0
0
0
0.001597
0.252983
838
39
58
21.487179
0.824281
0.02506
0
0.291667
0
0
0.137423
0
0
0
0
0
0
1
0
false
0
0.125
0
0.541667
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
8b944392234fa899448b814979ee4f641bf278e8
721
py
Python
data/train/python/8b944392234fa899448b814979ee4f641bf278e8blueprints.py
harshp8l/deep-learning-lang-detection
2a54293181c1c2b1a2b840ddee4d4d80177efb33
[ "MIT" ]
84
2017-10-25T15:49:21.000Z
2021-11-28T21:25:54.000Z
data/train/python/8b944392234fa899448b814979ee4f641bf278e8blueprints.py
vassalos/deep-learning-lang-detection
cbb00b3e81bed3a64553f9c6aa6138b2511e544e
[ "MIT" ]
5
2018-03-29T11:50:46.000Z
2021-04-26T13:33:18.000Z
data/train/python/8b944392234fa899448b814979ee4f641bf278e8blueprints.py
vassalos/deep-learning-lang-detection
cbb00b3e81bed3a64553f9c6aa6138b2511e544e
[ "MIT" ]
24
2017-11-22T08:31:00.000Z
2022-03-27T01:22:31.000Z
from flask import Blueprint from ctflorals.controllers import HomeController from ctflorals.controllers import AboutController from ctflorals.controllers import GalleryController from ctflorals.controllers import TestimonialsController ctflorals = Blueprint('ctflorals', __name__, template_folder='views', static_folder='../resources') @ctflorals.route("/") def home(): return HomeController().index() @ctflorals.route("/about/") def about(): return AboutController().index() @ctflorals.route("/gallery/") def gallery(): return GalleryController().index() @ctflorals.route("/testimonials/") def testimonials(): return TestimonialsController().index()
23.258065
56
0.722607
65
721
7.923077
0.369231
0.100971
0.186408
0.23301
0
0
0
0
0
0
0
0
0.160888
721
30
57
24.033333
0.85124
0
0
0
0
0
0.079057
0
0
0
0
0
0
1
0.2
false
0
0.25
0.2
0.65
0.1
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
3
8ba9adb8f979166d7cd39195cd716de47bb64c3c
114
py
Python
timedelta.py
MatheusSouza70/Exerc-cios-Python
f8878a0c9d62e49db61dcbce0ee10a161e12a894
[ "MIT" ]
1
2022-03-14T01:35:09.000Z
2022-03-14T01:35:09.000Z
timedelta.py
MatheusSouza70/Exerc-cios-Python
f8878a0c9d62e49db61dcbce0ee10a161e12a894
[ "MIT" ]
null
null
null
timedelta.py
MatheusSouza70/Exerc-cios-Python
f8878a0c9d62e49db61dcbce0ee10a161e12a894
[ "MIT" ]
null
null
null
import datetime entrada = input("Informe a data: ") datainicial = datetime.datetime.strptime(entrada,"dd/mm/aa")
38
60
0.754386
15
114
5.733333
0.8
0
0
0
0
0
0
0
0
0
0
0
0.105263
114
3
60
38
0.843137
0
0
0
0
0
0.212389
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
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
3
8bb84a4d1d6bf8bc62227551233fff530d7a0b80
1,041
py
Python
tests/test_convert.py
gastoneb/PyETo
8bb427654b144141442a3b88754ba637644e47e9
[ "BSD-3-Clause" ]
100
2015-05-12T13:48:48.000Z
2022-03-30T08:16:30.000Z
tests/test_convert.py
tigerforeveryoung/PyETo
0b7ac9f149f4c89c5b5759a875010c521aa07f0f
[ "BSD-3-Clause" ]
11
2015-09-11T10:01:46.000Z
2021-12-09T15:25:47.000Z
tests/test_convert.py
tigerforeveryoung/PyETo
0b7ac9f149f4c89c5b5759a875010c521aa07f0f
[ "BSD-3-Clause" ]
74
2015-08-23T20:05:10.000Z
2022-02-25T12:55:29.000Z
""" Unit test script for convert.py """ import unittest import pyeto class TestConvert(unittest.TestCase): def test_celsius2kelvin(self): self.assertEqual(pyeto.celsius2kelvin(0), 273.15) def test_kelvin2celsius(self): self.assertEqual(pyeto.kelvin2celsius(273.15), 0.0) def test_deg2rad(self): self.assertEqual(pyeto.deg2rad(0), 0.0) # Test values obtained form online conversion calculator self.assertAlmostEqual(pyeto.deg2rad(-90), -1.5707963268, 10) self.assertAlmostEqual(pyeto.deg2rad(90), 1.5707963268, 10) self.assertAlmostEqual(pyeto.deg2rad(360), 6.2831853072, 10) def test_rad2deg(self): self.assertEqual(pyeto.rad2deg(0), 0.0) # Test values obtained form online conversion calculator self.assertAlmostEqual(pyeto.rad2deg(-1.5707963268), -90.0) self.assertAlmostEqual(pyeto.rad2deg(1.5707963268), 90.0) self.assertAlmostEqual(pyeto.rad2deg(6.2831853072), 360.0) if __name__ == '__main__': unittest.main()
30.617647
69
0.698367
126
1,041
5.674603
0.309524
0.176224
0.218182
0.134266
0.500699
0.500699
0.500699
0.500699
0.500699
0.500699
0
0.143361
0.182517
1,041
34
70
30.617647
0.696827
0.136407
0
0
0
0
0.008979
0
0
0
0
0
0.526316
1
0.210526
false
0
0.105263
0
0.368421
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
1
0
0
0
0
0
0
0
3
8bca5c2f3ad49fe0250d6b506fe41e658af1bd61
182
py
Python
departure/provider/tfl_tube/commons.py
Woll78/departure-python
86eccd40291ad560d5859a120dd6c99aa5c4bd12
[ "MIT" ]
4
2020-10-18T18:12:04.000Z
2022-03-31T19:13:08.000Z
departure/provider/tfl_tube/commons.py
Woll78/departure-python
86eccd40291ad560d5859a120dd6c99aa5c4bd12
[ "MIT" ]
null
null
null
departure/provider/tfl_tube/commons.py
Woll78/departure-python
86eccd40291ad560d5859a120dd6c99aa5c4bd12
[ "MIT" ]
1
2021-11-19T10:37:26.000Z
2021-11-19T10:37:26.000Z
import os class TflTubeException(Exception): pass def check_env_vars(): if "TFL_APP_KEY" not in os.environ: raise TflTubeException("missing env var TFL_APP_KEY")
16.545455
61
0.71978
26
182
4.807692
0.769231
0.096
0.144
0
0
0
0
0
0
0
0
0
0.203297
182
10
62
18.2
0.862069
0
0
0
0
0
0.208791
0
0
0
0
0
0
1
0.166667
true
0.166667
0.166667
0
0.5
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
1
0
0
0
0
0
3
8bcec95c28817792e2950c069f8bce95a2fbc265
3,023
py
Python
src/base/migrations/0004_auto_20180223_0823.py
jhernandez18p/mobyapp
4add7bd3b3f1e933bbb6941674bf84f4c4462685
[ "MIT" ]
null
null
null
src/base/migrations/0004_auto_20180223_0823.py
jhernandez18p/mobyapp
4add7bd3b3f1e933bbb6941674bf84f4c4462685
[ "MIT" ]
7
2020-06-05T17:31:06.000Z
2022-03-11T23:16:34.000Z
src/base/migrations/0004_auto_20180223_0823.py
jhernandez18p/mobyapp
4add7bd3b3f1e933bbb6941674bf84f4c4462685
[ "MIT" ]
null
null
null
# Generated by Django 2.0 on 2018-02-23 13:23 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('base', '0003_auto_20180223_0814'), ] operations = [ migrations.AlterField( model_name='socialmedia', name='icon', field=models.CharField(blank=True, choices=[('fa-500px', '500px'), ('fa-amazon', 'Amazon'), ('fa-cc-amex', 'Amex'), ('fa-angellist', 'Angellist'), ('fa-behance', 'Behanse'), ('fa-behance', 'Behanse'), ('fa-behance-square', 'Behanse1'), ('fa-bitbucket', 'Bitbucket'), ('fa-bitbucket-square', 'Bitbucket1'), ('fa-btc', 'BitCoin'), ('fa-buysellads', 'Buysellads'), ('fa-codepen ', 'Codepen'), ('fa-digg', 'Digg'), ('fa-cc-diners-club', 'Dinners Clud'), ('fa-cc-discover', 'Discover'), ('fa-dribbble', 'Dribble'), ('fa-dropbox', 'Dropbox'), ('fa-facebook', 'Facebook'), ('fa-facebook', 'Facebook'), ('fa-facebook-square', 'Facebook1'), ('fa-facebook-official', 'Facebook2'), ('fa-github', 'GitHub'), ('fa-github-alt ', 'GitHub1'), ('fa-github-square', 'GitHub2'), ('fa-gitlab', 'GitLab'), ('fa-google-wallet ', 'Google Wallet'), ('fa-google', 'Google'), ('fa-google-plus', 'Google+'), ('fa-google-plus-square', 'Google+1'), ('fa-google-plus-official', 'Google+2'), ('fa-hacker-news', 'Hacker News'), ('fa-instagram', 'Instagram'), ('fa-cc-jcb', 'JCB'), ('fa-jsfiddle', 'JsFiddle'), ('fa-linkedin', 'LinkedIn'), ('fa-linkedin-square', 'LinkedIn1'), ('fa-cc-mastercard ', 'MasterCard'), ('fa-medium', 'Medium'), ('fa-meetup', 'Meetup'), ('fa-opencart', 'Opencart'), ('fa-cc-paypal', 'Paypal'), ('fa-paypal', 'Paypal'), ('fa-pinterest', 'Printerest'), ('fa-pinterest-square', 'Printerest1'), ('fa-pinterest-p', 'Printerest2'), ('fa-quora', 'Quora'), ('fa-reddit', 'Reddit'), ('fa-reddit-square', 'Reddit1'), ('fa-reddit-alien', 'Reddit2'), ('fa-skype', 'Skype'), ('fa-slack', 'Slack'), ('fa-slideshare', 'Slideshare'), ('fa-snapchat', 'Snapchat'), ('fa-snapchat-square', 'Snapchat1'), ('fa-snapchat-ghost', 'Snapchat2'), ('fa-soundcloud', 'Soundcloud'), ('fa-spotify', 'Spotify'), ('fa-stack-overflow ', 'Stack Overflow'), ('fa-cc-stripe', 'Stripe'), ('fa-telegram', 'Telegram'), ('fa-trello', 'Trello'), ('fa-tripadvisor', 'Tripadvisor'), ('fa-tumblr', 'Tumblr'), ('fa-tumblr-square', 'Tumblr1'), ('fa-twitch', 'Twitch'), ('fa-twitter', 'Twitter'), ('fa-twitter-square', 'Twitter1'), ('fa-usb', 'USB'), ('fa-viacoin', 'Viacoin'), ('fa-vimeo-square', 'Vimeo'), ('fa-vine', 'Vine'), ('fa-cc-visa', 'Visa'), ('fa-weixin', 'Weixin'), ('fa-whatsapp', 'Whatsapp'), ('fa-wikipedia-w', 'Wikipedia'), ('fa-windows', 'Windows'), ('fa-wordpress', 'Wordpress'), ('fa-wpbeginner', 'WPBeguinner'), ('fa-wpforms', 'WpForms'), ('fa-xing-square', 'Xing Square'), ('fa-xing', 'Xing'), ('fa-y-combinator', 'Y Combinator'), ('fa-yahoo', 'Yahoo'), ('fa-yelp', 'Yelp'), ('fa-youtube', 'YouTube'), ('fa-youtube-square', 'YouTube1'), ('fa-youtube-play', 'YouTube2')], max_length=1444, verbose_name='Icono'), ), ]
159.105263
2,689
0.611644
354
3,023
5.206215
0.40113
0.017363
0.019533
0.019533
0.047206
0
0
0
0
0
0
0.021651
0.098578
3,023
18
2,690
167.944444
0.654679
0.014224
0
0
1
0
0.594359
0.022498
0
0
0
0
0
1
0
false
0
0.083333
0
0.333333
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
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
8bd4946d3c51c5194a7421330708fb8bf444497b
60
py
Python
backend/config/settings/components/env.py
offurface/logistic-company
1e98b1191fd9ee63fbd9d6c2eef1354822e53d14
[ "MIT" ]
null
null
null
backend/config/settings/components/env.py
offurface/logistic-company
1e98b1191fd9ee63fbd9d6c2eef1354822e53d14
[ "MIT" ]
null
null
null
backend/config/settings/components/env.py
offurface/logistic-company
1e98b1191fd9ee63fbd9d6c2eef1354822e53d14
[ "MIT" ]
null
null
null
import environ env = environ.Env( DEBUG=(bool, True) )
10
22
0.65
8
60
4.875
0.75
0.512821
0
0
0
0
0
0
0
0
0
0
0.216667
60
5
23
12
0.829787
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
8bd6779520a832c43c96b5cbdbbd7ebc79d627d3
708
py
Python
elasticmagic/ext/queryfilter/__init__.py
kvasnevskyi/elasticmagic
55e790ca3453fb331167ed7841e5a69edec5ccfb
[ "Apache-2.0" ]
25
2015-04-27T12:43:12.000Z
2021-04-06T07:11:48.000Z
elasticmagic/ext/queryfilter/__init__.py
kvasnevskyi/elasticmagic
55e790ca3453fb331167ed7841e5a69edec5ccfb
[ "Apache-2.0" ]
41
2015-09-28T10:51:59.000Z
2021-07-23T16:09:19.000Z
elasticmagic/ext/queryfilter/__init__.py
kvasnevskyi/elasticmagic
55e790ca3453fb331167ed7841e5a69edec5ccfb
[ "Apache-2.0" ]
12
2015-08-28T17:30:02.000Z
2021-12-01T15:36:23.000Z
from .queryfilter import QueryFilter, FacetFilter, RangeFilter from .queryfilter import FacetQueryFilter, FacetQueryValue from .queryfilter import SimpleFilter, SimpleQueryFilter, SimpleQueryValue from .queryfilter import OrderingFilter, OrderingValue from .queryfilter import PageFilter from .queryfilter import NestedFacetFilter, NestedRangeFilter from .queryfilter import BinaryFilter __all__ = [ 'BinaryFilter', 'FacetFilter', 'FacetQueryFilter', 'FacetQueryValue', 'NestedFacetFilter', 'NestedRangeFilter', 'OrderingFilter', 'OrderingValue', 'PageFilter', 'QueryFilter', 'RangeFilter', 'SimpleFilter', 'SimpleQueryFilter', 'SimpleQueryValue', ]
27.230769
74
0.759887
50
708
10.68
0.34
0.196629
0.275281
0
0
0
0
0
0
0
0
0
0.15678
708
25
75
28.32
0.894472
0
0
0
0
0
0.271186
0
0
0
0
0
0
1
0
false
0
0.304348
0
0.304348
0
0
0
1
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
8bec46d3d255d3383f11fd8aa008732be96df2eb
120
py
Python
inlineedit/apps.py
VolkerGoeschl/django-inlineedit
c1656e8c647c02a87c077001775bd8e98d564647
[ "MIT" ]
null
null
null
inlineedit/apps.py
VolkerGoeschl/django-inlineedit
c1656e8c647c02a87c077001775bd8e98d564647
[ "MIT" ]
null
null
null
inlineedit/apps.py
VolkerGoeschl/django-inlineedit
c1656e8c647c02a87c077001775bd8e98d564647
[ "MIT" ]
null
null
null
from django.apps import AppConfig class InlineeditConfig(AppConfig): label = "inlineedit" name = 'inlineedit'
17.142857
34
0.733333
12
120
7.333333
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.183333
120
6
35
20
0.897959
0
0
0
0
0
0.166667
0
0
0
0
0
0
1
0
false
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
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
4735e07882d8148525e6d459f69418dd4f1044f8
779
py
Python
controller/login/register.py
johndao1005/SDV602-Milestone2-QuangThanhDao
5818f11db599042ab0ba7379fb08cb27932f7cc1
[ "MIT" ]
1
2021-09-30T01:25:23.000Z
2021-09-30T01:25:23.000Z
controller/login/register.py
johndao1005/SDV602-Milestone2-QuangThanhDao
5818f11db599042ab0ba7379fb08cb27932f7cc1
[ "MIT" ]
3
2021-08-31T09:36:06.000Z
2021-09-03T08:22:36.000Z
controller/login/register.py
johndao1005/SDV602-Milestone2-QuangThanhDao
5818f11db599042ab0ba7379fb08cb27932f7cc1
[ "MIT" ]
null
null
null
""" Creating new user after checking all the input. the user will be added into the remote data source and input the login details into the login window """ def makeUser(self,name,pw,pw2,email): """Checking input is valid and not already exist in the current database before creating new user instance Args: name (string): username taken from user input, need to be more than 2 characters and less than 20 characters pw (string): password taken from user input, need to be more than 8 character and less than 20 characters pw2 (string): confirm password, need to be identical with password input email (string): email from user, need to have @ and valid email name """ self.destroy() pass
51.933333
148
0.685494
116
779
4.603448
0.5
0.044944
0.044944
0.067416
0.213483
0.127341
0.127341
0.127341
0.127341
0
0
0.013913
0.261874
779
15
149
51.933333
0.914783
0.81258
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0.333333
0
0
0.333333
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
1
0
0
0
0
0
3
473ef4d9c29fe6705dd613791294f05d95e3ea33
363
py
Python
Alvin1.py
allenalvin333/12
7b0e3fc4c3887dd872fd8faed3b39eada57d4c7e
[ "MIT" ]
null
null
null
Alvin1.py
allenalvin333/12
7b0e3fc4c3887dd872fd8faed3b39eada57d4c7e
[ "MIT" ]
null
null
null
Alvin1.py
allenalvin333/12
7b0e3fc4c3887dd872fd8faed3b39eada57d4c7e
[ "MIT" ]
null
null
null
al = raw_input("Enter the String: ") a = al.lower() b = len(a) s = "" for i in range(0,b): if a[i] == 'a': s = s+'1' elif a[i] == 'e': s = s+'2' elif a[i] == 'i': s = s+'3' elif a[i] == 'o': s = s+'4' elif a[i] == 'u': s = s+'5' else: s = s+a[i].upper() print s
17.285714
37
0.327824
62
363
1.903226
0.467742
0.101695
0.20339
0
0
0
0
0
0
0
0
0.029703
0.443526
363
20
38
18.15
0.554455
0
0
0
0
0
0.081633
0
0
0
0
0
0
0
null
null
0
0
null
null
0.055556
0
0
1
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
475c7c66f600cc7fa880549ce3f29232c977bc4d
2,439
py
Python
test/nodes/test_accumulate.py
HerySon/timeflux
01a5a27a3368afe8b0c1da475f84618e11ffec3b
[ "MIT" ]
123
2019-01-09T08:57:39.000Z
2022-03-18T18:59:51.000Z
test/nodes/test_accumulate.py
HerySon/timeflux
01a5a27a3368afe8b0c1da475f84618e11ffec3b
[ "MIT" ]
43
2019-03-08T10:16:39.000Z
2021-06-14T17:17:18.000Z
test/nodes/test_accumulate.py
HerySon/timeflux
01a5a27a3368afe8b0c1da475f84618e11ffec3b
[ "MIT" ]
18
2019-03-26T08:51:21.000Z
2021-10-14T23:10:33.000Z
"""Tests for accumulate.py""" import pandas as pd import xarray as xr from timeflux.helpers.testing import DummyData, DummyXArray from timeflux.nodes.accumulate import AppendDataFrame, AppendDataArray xarray_data = DummyXArray() pandas_data = DummyData() def test_append_dataframe(): """"Test node AppendDataFrame""" node = AppendDataFrame() pandas_data.reset() node.clear() # gate is not closed, data should be accumulated but not released # first chunk node.i.data = pandas_data.next(5) node.update() # assert no output assert node.o.data == None # assert the data has been buffered pd.testing.assert_frame_equal(pandas_data._data.iloc[:5, :], node._data) # second chunk node.clear() node.i.data = pandas_data.next(10) node.update() # assert no output assert node.o.data == None # assert the buffer is the concatenation of the 2 accumulated chunks pd.testing.assert_frame_equal(pandas_data._data.iloc[:15, :], node._data) # now a meta is received, assessing that the gate has just closed node.i.data = pandas_data.next(5) node.i.meta = {'gate_status': 'closed'} node.update() # assert output data is the concatenation of the 3 chunks pd.testing.assert_frame_equal(pandas_data._data.iloc[:20, :], node.o.data) def test_append_dataarray(): """"Test node AppendDataArray""" node = AppendDataArray(dim='time') xarray_data.reset() node.clear() # gate is not closed, data should be accumulated but not released # first chunk node.i.data = xarray_data.next(5) node.update() # assert no output assert node.o.data == None # assert the data has been buffered xr.testing.assert_equal(xarray_data._data.isel({'time': slice(0, 5)}), node._data_list[0]) # second chunk node.clear() node.i.data = xarray_data.next(10) node.update() # assert no output assert node.o.data == None # assert the buffer is the concatenation of the 2 accumulated chunks xr.testing.assert_equal(xarray_data._data.isel({'time': slice(5, 15)}), node._data_list[1]) # now a meta is received, assessing that the gate has just closed node.i.data = xarray_data.next(5) node.i.meta = {'gate_status': 'closed'} node.update() # assert output data is the concatenation of the 3 chunks xr.testing.assert_equal(xarray_data._data.isel({'time': slice(0, 20)}), node.o.data)
34.842857
95
0.692907
356
2,439
4.626404
0.224719
0.048573
0.032787
0.031573
0.741955
0.741955
0.734669
0.699454
0.684882
0.658774
0
0.013726
0.193522
2,439
69
96
35.347826
0.823589
0.314063
0
0.5
0
0
0.030488
0
0
0
0
0
0.25
1
0.05
false
0
0.1
0
0.15
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
0
0
0
0
0
0
0
0
3
4764c5147f99d04ca00f8f21665bfcebc43100f2
1,548
py
Python
apps/flights/models.py
Houston-ARTCC/information-display-system
a98fa032cd2e94111be0f60914141ddab21b2e50
[ "MIT" ]
1
2021-12-24T09:21:56.000Z
2021-12-24T09:21:56.000Z
apps/flights/models.py
Houston-ARTCC/information-display-system
a98fa032cd2e94111be0f60914141ddab21b2e50
[ "MIT" ]
null
null
null
apps/flights/models.py
Houston-ARTCC/information-display-system
a98fa032cd2e94111be0f60914141ddab21b2e50
[ "MIT" ]
null
null
null
from django.db import models class EnrouteFlight(models.Model): # 3 callsign = models.CharField(max_length=255) # 4 aircraft = models.CharField(max_length=255) # 5 tas_filed = models.IntegerField(null=True, blank=True) # 8 tas_actual = models.IntegerField(null=True, blank=True) # 11 prev_fix = models.CharField(max_length=255, null=True, blank=True) # 12 prev_fix_time = models.IntegerField(null=True, blank=True) # 13 prev_fix_time_rev = models.IntegerField(null=True, blank=True) # 14 prev_fix_time_actual = models.IntegerField(null=True, blank=True) # 14a post_fix_plus = models.IntegerField(null=True, blank=True) # 15 post_fix_time = models.IntegerField(null=True, blank=True) # 18 post_fix_time_actual = models.IntegerField(null=True, blank=True) # 19 post_fix = models.CharField(max_length=255, null=True, blank=True) # 20 altitude = models.IntegerField(null=True, blank=True) # 21 next_fix = models.CharField(max_length=255, null=True, blank=True) # 22 next_fix_time = models.IntegerField(null=True, blank=True) # 23 arrival = models.BooleanField() # 24 requested_altitude = models.IntegerField(null=True, blank=True) # 25 route = models.TextField(null=True, blank=True) # 27 transponder = models.IntegerField(null=True, blank=True) coast = models.BooleanField(default=False) discarded = models.BooleanField(default=False) def __str__(self): return self.callsign
31.591837
70
0.692506
203
1,548
5.123153
0.305419
0.123077
0.2
0.261538
0.657692
0.605769
0.471154
0.349038
0.227885
0.135577
0
0.039453
0.197674
1,548
48
71
32.25
0.797907
0.034238
0
0
0
0
0
0
0
0
0
0
0
1
0.04
false
0
0.04
0.04
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
4777ae464f22d0777ef6e90c4880e464f3b0d977
1,746
py
Python
case/month_case.py
mikerah13/python_samples
c4cd8af3cee99a5199dd2231f182240c35984b97
[ "MIT" ]
null
null
null
case/month_case.py
mikerah13/python_samples
c4cd8af3cee99a5199dd2231f182240c35984b97
[ "MIT" ]
null
null
null
case/month_case.py
mikerah13/python_samples
c4cd8af3cee99a5199dd2231f182240c35984b97
[ "MIT" ]
null
null
null
""" month picker simple case implementation in python """ class Case(object): """ class to return a month """ def what_month(self, num): """ returns the month Arguments: num {int} -- month Returns: string -- month """ method_name = "month_{}".format(num) method = getattr(self, method_name, lambda: "Invalid Input") return method() @staticmethod def month_1(): ''' jan ''' return "January" @staticmethod def month_2(): ''' feb ''' return "February" @staticmethod def month_3(): ''' mar ''' return "March" @staticmethod def month_4(): ''' apr ''' return "April" @staticmethod def month_5(): ''' may ''' return "May" @staticmethod def month_6(): ''' jun ''' return "June" @staticmethod def month_7(): ''' jul ''' return "July" @staticmethod def month_8(): ''' aug ''' return "August" @staticmethod def month_9(): ''' sep ''' return "Setember" @staticmethod def month_10(): ''' oct ''' return "October" @staticmethod def month_11(): ''' nov ''' return "November" @staticmethod def month_12(): ''' dec ''' return "December" if __name__ == "__main__": MY_MONTH = Case() print(MY_MONTH.what_month(input("Please Enter the Month Number: ")))
15.315789
72
0.438144
146
1,746
5.054795
0.486301
0.243902
0.325203
0
0
0
0
0
0
0
0
0.015337
0.439863
1,746
113
73
15.451327
0.739264
0.116838
0
0.272727
0
0
0.111953
0
0
0
0
0
0
1
0.295455
false
0
0
0
0.613636
0.022727
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
4785aeec50459b5c794e4cc079c54e6357d0e3d3
826
py
Python
gameplay/Achievement.py
WilliamDASILVA/TheMysteryOfSchweitzer
f81edc2e202bd5009fc96ccfbbfcc40bc135a17a
[ "MIT" ]
null
null
null
gameplay/Achievement.py
WilliamDASILVA/TheMysteryOfSchweitzer
f81edc2e202bd5009fc96ccfbbfcc40bc135a17a
[ "MIT" ]
null
null
null
gameplay/Achievement.py
WilliamDASILVA/TheMysteryOfSchweitzer
f81edc2e202bd5009fc96ccfbbfcc40bc135a17a
[ "MIT" ]
null
null
null
from engine import Global; # --------------------------------------------------- *\ # [class] Achievement() # # * Create an achievement element * # # --------------------------------------------------- */ class Achievement(): def __init__(self, name = None, description = None, functionToCallWhenAchieve = None): self.isDone = False; self.name = name; self.description = description; self.functionToCallWhenAchieve = functionToCallWhenAchieve; def setName(self, name): self.name = name; def setDescription(self, description): self.description = description; def getStatus(self): return self.isDone; def getName(self): return self.name; def getDescription(self): return self.description; # set the achievement done def done(self): self.isDone = True; self.functionToCallWhenAchieve();
21.736842
87
0.628329
77
826
6.688312
0.363636
0.07767
0.081553
0
0
0
0
0
0
0
0
0
0.150121
826
37
88
22.324324
0.733618
0.232446
0
0.2
0
0
0
0
0
0
0
0
0
1
0.35
false
0
0.05
0.15
0.6
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
0
1
1
0
0
3
479e3778a0522482bca10122b77163b637c3db2c
479
py
Python
revibe/_errors/platforms.py
Revibe-Music/core-services
6b11cf16ad2c35d948f3a5c0e7a161e5b7cfc1b2
[ "MIT" ]
2
2022-01-24T23:30:18.000Z
2022-01-26T00:21:22.000Z
revibe/_errors/platforms.py
Revibe-Music/core-services
6b11cf16ad2c35d948f3a5c0e7a161e5b7cfc1b2
[ "MIT" ]
null
null
null
revibe/_errors/platforms.py
Revibe-Music/core-services
6b11cf16ad2c35d948f3a5c0e7a161e5b7cfc1b2
[ "MIT" ]
null
null
null
from rest_framework.exceptions import APIException from revibe._errors import network from revibe._helpers import const, status # ----------------------------------------------------------------------------- class InvalidPlatformContent(network.ProgramError): default_detail = "Invalid platform content" class InvalidPlatformOperation(Exception): pass class PlatformNotFoundError(network.BadRequestError): default_detail = "The requested platform does not exist"
31.933333
79
0.686848
42
479
7.714286
0.714286
0.061728
0
0
0
0
0
0
0
0
0
0
0.106472
479
15
80
31.933333
0.757009
0.160752
0
0
0
0
0.15212
0
0
0
0
0
0
1
0
false
0.111111
0.333333
0
0.888889
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
0
0
1
1
0
1
0
0
3
47a8b4c5ecefa24111662275036b8a86fc4bcfb9
292
py
Python
sample/Weight.py
kishore03109/PersonalTrainerBot
12616f9001ef4c8640a8d6df27b29f85c0dff58d
[ "MIT" ]
null
null
null
sample/Weight.py
kishore03109/PersonalTrainerBot
12616f9001ef4c8640a8d6df27b29f85c0dff58d
[ "MIT" ]
null
null
null
sample/Weight.py
kishore03109/PersonalTrainerBot
12616f9001ef4c8640a8d6df27b29f85c0dff58d
[ "MIT" ]
null
null
null
from datetime import datetime class Weight: def __init__(self, value, tz=None): self.value = value self.datetime = datetime.now(tz).strftime('%D') def __repr__(self): return '{value:' + self.value \ + ', datetime:'+str(self.datetime) + '}'
22.461538
56
0.578767
33
292
4.878788
0.515152
0.167702
0
0
0
0
0
0
0
0
0
0
0.273973
292
12
57
24.333333
0.759434
0
0
0
0
0
0.072165
0
0
0
0
0
0
1
0.25
false
0
0.125
0.125
0.625
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
0
1
1
0
0
3
47b705185ef01e8147d00ae336d286d67d9e6c78
1,776
py
Python
database/models.py
SebastjanLeskovar/thundergames
7a716dfc8ded43c5eab2833740a8fb0df99aafab
[ "MIT" ]
null
null
null
database/models.py
SebastjanLeskovar/thundergames
7a716dfc8ded43c5eab2833740a8fb0df99aafab
[ "MIT" ]
null
null
null
database/models.py
SebastjanLeskovar/thundergames
7a716dfc8ded43c5eab2833740a8fb0df99aafab
[ "MIT" ]
null
null
null
from django.db import models from django.urls import reverse class TimeStampedModel(models.Model): """An abstract base class model that provides self-updating 'created' and 'modified' fields. """ created = models.DateTimeField(auto_now_add=True) modified = models.DateTimeField(auto_now=True) class MainGenre(TimeStampedModel): """Model to create MainGenre objects.""" name = models.CharField("Name", max_length=50) image = models.ImageField("Image", upload_to='main_genre', blank=True, default='default.png') def __str__(self): return self.name def get_absolute_url(self): return reverse('database:main-genre', kwargs={'pk': self.pk}) class Subgenre(TimeStampedModel): """Model to create Subgenre objects.""" name = models.CharField("Name", max_length=50) main_genre = models.ForeignKey(MainGenre, verbose_name="main genre", on_delete=models.SET("Please select main genre.")) image = models.ImageField("Image", upload_to='subgenre', blank=True, default='default.png') def __str__(self): return self.name def get_absolute_url(self): return reverse('database:subgenre', kwargs={'pk': self.pk}) class Game(TimeStampedModel): """Model to create Game objects.""" name = models.CharField("Name", max_length=50) main_genre = models.ForeignKey(MainGenre, verbose_name="main genre", blank=True, on_delete=models.SET("Please select main genre.")) subgenres = models.ManyToManyField(Subgenre, verbose_name="Subgenre", blank=True) image = models.ImageField("Image", upload_to='game', blank=True, default='default.png') def __str__(self): return self.name def get_absolute_url(self): return reverse('database:game', kwargs={'pk': self.pk})
37.787234
135
0.707207
225
1,776
5.426667
0.28
0.058968
0.056511
0.071253
0.592138
0.561016
0.477477
0.477477
0.381654
0.381654
0
0.004016
0.158784
1,776
46
136
38.608696
0.813253
0.105856
0
0.413793
0
0
0.137644
0
0
0
0
0
0
1
0.206897
false
0
0.068966
0.206897
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
47c68f97f0b4ef020a13fc1e558df4deceff8942
837
py
Python
invenio_records_lom/services/schemas.py
tu-graz-library/invenio-records-lom
c811506e51a1ed15d11cf10d6e6ef83a4ecc202b
[ "MIT" ]
null
null
null
invenio_records_lom/services/schemas.py
tu-graz-library/invenio-records-lom
c811506e51a1ed15d11cf10d6e6ef83a4ecc202b
[ "MIT" ]
18
2020-10-21T07:58:14.000Z
2022-03-29T12:10:25.000Z
invenio_records_lom/services/schemas.py
tu-graz-library/invenio-records-lom
c811506e51a1ed15d11cf10d6e6ef83a4ecc202b
[ "MIT" ]
7
2020-10-06T08:46:40.000Z
2021-07-06T13:21:29.000Z
# -*- coding: utf-8 -*- # # Copyright (C) 2021 Graz University of Technology. # # invenio-records-lom is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Marshmallow schema for validating LOM JSONs.""" from marshmallow import Schema class LOMRecordSchema(Schema): """Marshmallow schema for validating LOM JSONs.""" # TODO: write schema def load(self, data, *, many=None, partial=None, unknown=None): """Overwrite validation: pipe data through unchanged and unvalidated for now.""" return data # TODO: is: (obj: LOMDraft) -> LOMDraft; should be: (obj: LOMDraft) -> json def dump(self, obj, *, many=None): """Overwrite validation: pipe obj through unchanged and unvalidated for now.""" return obj
32.192308
88
0.684588
109
837
5.256881
0.59633
0.059337
0.069808
0.104712
0.279232
0.279232
0.146597
0
0
0
0
0.007508
0.204301
837
25
89
33.48
0.852853
0.661888
0
0
0
0
0
0
0
0
0
0.04
0
1
0.333333
false
0
0.166667
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
0
1
0
0
3
47ce210ce35d9f0746e0d9629800ebc4a673fc83
76
py
Python
electron apps/old/general_neural_network/python/test.py
quasarbright/quasarbright.github.io
942710adf4a2531d033023a6f750efeddf3e9050
[ "MIT" ]
1
2021-01-23T13:50:34.000Z
2021-01-23T13:50:34.000Z
electron apps/old/general_neural_network/python/test.py
quasarbright/quasarbright.github.io
942710adf4a2531d033023a6f750efeddf3e9050
[ "MIT" ]
40
2018-02-19T19:37:24.000Z
2022-03-25T18:34:22.000Z
electron apps/old/general_neural_network/python/test.py
quasarbright/quasarbright.github.io
942710adf4a2531d033023a6f750efeddf3e9050
[ "MIT" ]
1
2018-12-07T03:07:21.000Z
2018-12-07T03:07:21.000Z
import sys, time for x in range(5): print(sys.argv) # time.sleep(2)
15.2
19
0.618421
14
76
3.357143
0.857143
0
0
0
0
0
0
0
0
0
0
0.034483
0.236842
76
4
20
19
0.775862
0.171053
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.333333
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
0
0
0
3
47dd4f490441c164b742ed90650131576a832dea
305
py
Python
test.py
gonzalo10/recipe-scrapers
e0abe9b66ed377f0ca9133fae2636bac6f9407e7
[ "MIT" ]
null
null
null
test.py
gonzalo10/recipe-scrapers
e0abe9b66ed377f0ca9133fae2636bac6f9407e7
[ "MIT" ]
null
null
null
test.py
gonzalo10/recipe-scrapers
e0abe9b66ed377f0ca9133fae2636bac6f9407e7
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from runScraper import test, scrapeRecipeUrl from parser import parseIngredients test('https://healthyfitnessmeals.com/artichoke-stuffed-chicken/') # ingredient = parseIngredients( # ["cans refrigerated crescent dinner rolls"]) # print(ingredient) # print(scrapeRecipeUrl)
23.461538
66
0.757377
30
305
7.7
0.766667
0
0
0
0
0
0
0
0
0
0
0.003731
0.121311
305
12
67
25.416667
0.858209
0.465574
0
0
0
0
0.369427
0
0
0
0
0
0
1
0
true
0
0.666667
0
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
0
0
0
0
1
0
1
0
1
0
0
3
47f2f85f64526db1e4cdb462d88a6766758eb289
201
py
Python
data/overall_updates.py
starrybouquet/sj-fanfic-recs
c2120c1461f53947cba4b5c5bdec634ae2b0b144
[ "MIT" ]
null
null
null
data/overall_updates.py
starrybouquet/sj-fanfic-recs
c2120c1461f53947cba4b5c5bdec634ae2b0b144
[ "MIT" ]
null
null
null
data/overall_updates.py
starrybouquet/sj-fanfic-recs
c2120c1461f53947cba4b5c5bdec634ae2b0b144
[ "MIT" ]
null
null
null
def add_filters_to_legend(): pass def extend_data_from_recs(): pass def find_errors(): '''find errors such as restricted works, etc. where data needs to be entered manually''' pass
16.75
92
0.701493
30
201
4.466667
0.733333
0.104478
0
0
0
0
0
0
0
0
0
0
0.21393
201
11
93
18.272727
0.848101
0.40796
0
0.5
0
0
0
0
0
0
0
0
0
1
0.5
true
0.5
0
0
0.5
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
1
1
0
0
0
0
0
3
47f9fa26f98e7529ae1d7d422a0678aee2c8e796
452
py
Python
redis_websocket_api/exceptions.py
cclauss/redis-websocket-api
f4867f2eb2f6d0634ee4cd12021235ed5d0b6d1b
[ "MIT" ]
6
2020-08-04T15:25:51.000Z
2021-11-30T22:15:44.000Z
redis_websocket_api/exceptions.py
cclauss/redis-websocket-api
f4867f2eb2f6d0634ee4cd12021235ed5d0b6d1b
[ "MIT" ]
8
2019-08-05T13:26:21.000Z
2021-10-02T10:30:56.000Z
redis_websocket_api/exceptions.py
cclauss/redis-websocket-api
f4867f2eb2f6d0634ee4cd12021235ed5d0b6d1b
[ "MIT" ]
3
2019-08-04T06:30:05.000Z
2021-11-09T08:15:47.000Z
class APIError(Exception): """Base exception for errors raised by high-level websocket API.""" class MessageHandlerError(APIError): """Decoding or parsing a message failed.""" class RemoteMessageHandlerError(MessageHandlerError): """Raised for errors directly caused by messages from the client.""" class InternalMessageHandlerError(MessageHandlerError): """Raised for errors directly caused by messages from internal sources."""
30.133333
78
0.765487
48
452
7.208333
0.604167
0.078035
0.16185
0.196532
0.358382
0.358382
0.358382
0.358382
0.358382
0
0
0
0.143805
452
14
79
32.285714
0.894057
0.511062
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
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
0
0
1
0
0
3
9a0065e76a1835ec4747efed01ccc14a4a984f87
66
py
Python
tug_observers/tug_observer_plugins/tug_observer_plugin_utils/scripts/hypothesis_check/single_value_hypothesis_check/__init__.py
annajohny/sdp
2f66e226fc335ae357001d07fbc74d30ab469509
[ "BSD-3-Clause" ]
null
null
null
tug_observers/tug_observer_plugins/tug_observer_plugin_utils/scripts/hypothesis_check/single_value_hypothesis_check/__init__.py
annajohny/sdp
2f66e226fc335ae357001d07fbc74d30ab469509
[ "BSD-3-Clause" ]
null
null
null
tug_observers/tug_observer_plugins/tug_observer_plugin_utils/scripts/hypothesis_check/single_value_hypothesis_check/__init__.py
annajohny/sdp
2f66e226fc335ae357001d07fbc74d30ab469509
[ "BSD-3-Clause" ]
null
null
null
__all__ = ['single_value_hypothesis_check'] __author__ = 'stefan'
22
43
0.787879
7
66
5.857143
1
0
0
0
0
0
0
0
0
0
0
0
0.090909
66
2
44
33
0.683333
0
0
0
0
0
0.530303
0.439394
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
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
3
9a0d01af6ad32aefa7a05126b118104acfa98f30
1,321
py
Python
app/datasets/AugmentConfig.py
taoyilee/Keras_MedicalImgAI
02ecf1f52ee91e3050b2d30f602a3161ff0726cf
[ "MIT" ]
26
2018-03-14T13:58:22.000Z
2022-02-11T14:32:48.000Z
app/datasets/AugmentConfig.py
taoyilee/Keras_MedicalImgAI
02ecf1f52ee91e3050b2d30f602a3161ff0726cf
[ "MIT" ]
3
2018-11-09T21:54:03.000Z
2020-05-08T09:07:06.000Z
app/datasets/AugmentConfig.py
taoyilee/Keras_MedicalImgAI
02ecf1f52ee91e3050b2d30f602a3161ff0726cf
[ "MIT" ]
9
2018-03-14T13:58:25.000Z
2020-06-02T03:21:48.000Z
import configparser from app.imagetoolbox.ImageConfigBase import ImageConfigBase from app.utilities.util_config import assign_fallback class AugmentConfig(ImageConfigBase): SECTION = "IMAGE-AUGMENATION" _train_augmentation = True _dev_augmentation = False _random_horz_flip = False _random_vert_flip = False _flip_prob = 0.5 def __init__(self, cp: configparser.ConfigParser): super(AugmentConfig, self).__init__(cp) if self.SECTION not in self.cp.sections(): self.cp.read_dict({self.SECTION: {}}) @property def train_augmentation(self): return assign_fallback(self.cp[self.SECTION].getboolean("train_augmentation"), self._train_augmentation) @property def dev_augmentation(self): return assign_fallback(self.cp[self.SECTION].getboolean("dev_augmentation"), self._dev_augmentation) @property def flip_prob(self): return assign_fallback(self.cp[self.SECTION].getfloat("flip_prob"), self._flip_prob) @property def random_horz_flip(self): return assign_fallback(self.cp[self.SECTION].getboolean("random_horz_flip"), self._random_horz_flip) @property def random_vert_flip(self): return assign_fallback(self.cp[self.SECTION].getboolean("random_vert_flip"), self._random_vert_flip)
33.025
112
0.735806
161
1,321
5.701863
0.267081
0.052288
0.087146
0.130719
0.314815
0.314815
0.314815
0.314815
0.270153
0.270153
0
0.001815
0.165784
1,321
39
113
33.871795
0.831216
0
0
0.172414
0
0
0.069644
0
0
0
0
0
0
1
0.206897
false
0
0.103448
0.172414
0.724138
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
0
1
1
0
0
3
9a284b83c7950d0b48841c8e509b0b4457299117
5,995
py
Python
hotpot_km/tests/test_initialize.py
datalayer-externals/jupyter-kernel-manager-pool
6d2f573cb1acbd8ea4682c27b29a3fa2d09ba4e4
[ "BSD-3-Clause-Clear" ]
4
2021-02-23T12:21:43.000Z
2021-10-14T16:16:59.000Z
hotpot_km/tests/test_initialize.py
datalayer-externals/jupyter-kernel-manager-pool
6d2f573cb1acbd8ea4682c27b29a3fa2d09ba4e4
[ "BSD-3-Clause-Clear" ]
10
2021-02-23T16:26:25.000Z
2021-08-16T13:22:53.000Z
hotpot_km/tests/test_initialize.py
datalayer-externals/jupyter-kernel-manager-pool
6d2f573cb1acbd8ea4682c27b29a3fa2d09ba4e4
[ "BSD-3-Clause-Clear" ]
2
2021-02-23T09:02:17.000Z
2021-08-19T07:09:29.000Z
import asyncio from contextlib import asynccontextmanager from unittest import mock from pathlib import Path from subprocess import PIPE from tempfile import TemporaryDirectory from unittest import TestCase from jupyter_client.kernelspec import NATIVE_KERNEL_NAME import pytest from tornado.testing import AsyncTestCase, gen_test from traitlets.config.loader import Config from ..client_helper import ExecClient try: from .. import ( PooledKernelManager, PooledMappingKernelManager, MaximumKernelsException, ) except ImportError: pass from .utils import async_shutdown_all_direct class TestInitializePooled(AsyncTestCase): # This is a snaity check for test_imports @gen_test(timeout=20) async def test_imports_not_used(self): c = Config() c.PooledKernelManager.kernel_pools = {NATIVE_KERNEL_NAME: 1} c.PooledKernelManager.strict_pool_names = True c.python_imports = [] km = PooledKernelManager(config=c) try: kid = await km.start_kernel() kernel = km.get_kernel(kid) self.assertIsNotNone(kernel) client = ExecClient(kernel, _store_outputs=True) async with client.setup_kernel(): await client.execute('import sys\nprint("turtle" in sys.modules)') self.assertEqual( client._outputs, [{"name": "stdout", "output_type": "stream", "text": "False\n"}], ) finally: await km.shutdown_all() @gen_test(timeout=20) async def test_imports(self): c = Config() c.PooledKernelManager.kernel_pools = {NATIVE_KERNEL_NAME: 1} c.PooledKernelManager.strict_pool_names = True c.PooledKernelManager.python_imports = ["turtle"] # Need mapping to resolve kernel language km = PooledKernelManager(config=c) try: kid = await km.start_kernel() kernel = km.get_kernel(kid) self.assertIsNotNone(kernel) client = ExecClient(kernel, _store_outputs=True) async with client.setup_kernel(): await client.execute('import sys\nprint("turtle" in sys.modules)') self.assertEqual( client._outputs, [{"name": "stdout", "output_type": "stream", "text": "True\n"}], ) finally: await km.shutdown_all() @pytest.mark.xfail() # initialize happens before update, so this won't work @gen_test(timeout=20) async def test_cwd_import(self): with TemporaryDirectory() as tmp_dir: # create a lcoal py module in cwd to test import foo_mod = Path(tmp_dir) / "foo_module.py" foo_mod.write_text("foo = 1") c = Config() c.PooledKernelManager.kernel_pools = {NATIVE_KERNEL_NAME: 1} c.PooledKernelManager.strict_pool_names = True c.PooledKernelManager.python_imports = ["foo_module"] km = PooledKernelManager(config=c) try: kid = await km.start_kernel(cwd=tmp_dir) kernel = km.get_kernel(kid) self.assertIsNotNone(kernel) client = ExecClient(kernel, _store_outputs=True) async with client.setup_kernel(): await client.execute('import sys\nprint("foo_module" in sys.modules)') self.assertEqual( client._outputs, [{"name": "stdout", "output_type": "stream", "text": "True\n"}], ) finally: await km.shutdown_all() @gen_test(timeout=20) async def test_file_init(self): with TemporaryDirectory() as tmp_dir: c = Config() c.PooledKernelManager.kernel_pools = {NATIVE_KERNEL_NAME: 1} c.PooledKernelManager.strict_pool_names = True # Need mapping manager to resolve init files: km = PooledKernelManager(config=c) with mock.patch("jupyter_core.paths.jupyter_config_path") as jcp: jcp.return_value = [tmp_dir] # create a local py module in cwd to test import foo_mod = Path(tmp_dir) / f"kernel_pool_init_{NATIVE_KERNEL_NAME}.py" foo_mod.write_text("foo = 1") try: kid = await km.start_kernel() kernel = km.get_kernel(kid) self.assertIsNotNone(kernel) client = ExecClient(kernel, _store_outputs=True) async with client.setup_kernel(): await client.execute("print(foo)") self.assertEqual( client._outputs, [{"name": "stdout", "output_type": "stream", "text": "1\n"}], ) finally: await km.shutdown_all() @gen_test(timeout=20) async def test_init(self): with TemporaryDirectory() as tmp_dir: c = Config() c.PooledKernelManager.kernel_pools = {NATIVE_KERNEL_NAME: 1} c.PooledKernelManager.strict_pool_names = True c.PooledKernelManager.initialization_code = {NATIVE_KERNEL_NAME: "import turtle"} # Need mapping manager to resolve init files: km = PooledKernelManager(config=c) await km.wait_for_pool() try: kid = await km.start_kernel() kernel = km.get_kernel(kid) self.assertIsNotNone(kernel) client = ExecClient(kernel, _store_outputs=True) async with client.setup_kernel(): await client.execute('import sys\nprint("turtle" in sys.modules)') self.assertEqual( client._outputs, [{"name": "stdout", "output_type": "stream", "text": "True\n"}], ) finally: await km.shutdown_all()
37.236025
93
0.589491
633
5,995
5.391785
0.210111
0.076179
0.037504
0.02344
0.726047
0.726047
0.716086
0.695576
0.68327
0.68327
0
0.004412
0.319433
5,995
161
94
37.236025
0.832108
0.052377
0
0.651515
0
0
0.087945
0.0178
0
0
0
0
0.075758
1
0
false
0.007576
0.19697
0
0.204545
0.037879
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
0
0
0
0
0
0
0
0
3
9a40be908b08af34233c8d77338d93f5a27b919e
458
py
Python
CollegeDatabasePython/Student.py
Sejoslaw/CollegeDatabase
7dedd9df3a961202e94a90a14b2c3a78847439dd
[ "Zlib" ]
null
null
null
CollegeDatabasePython/Student.py
Sejoslaw/CollegeDatabase
7dedd9df3a961202e94a90a14b2c3a78847439dd
[ "Zlib" ]
null
null
null
CollegeDatabasePython/Student.py
Sejoslaw/CollegeDatabase
7dedd9df3a961202e94a90a14b2c3a78847439dd
[ "Zlib" ]
null
null
null
from AbstractPerson import AbstractPerson import string class Student(AbstractPerson): def __init__(self, firstName, lastName, groupId): AbstractPerson.__init__(self, firstName, lastName) self.GroupId = groupId def GroupId(self): return self.GroupId def ToString(self): return "Student[Id = {0}, First Name = {1}, Last Name {2}, GroupId = {3}]".format(self.Id, self.FirstName, self.LastName, self.GroupId);
32.714286
144
0.683406
53
458
5.754717
0.433962
0.127869
0.111475
0.163934
0
0
0
0
0
0
0
0.010959
0.203057
458
14
144
32.714286
0.824658
0
0
0
0
0.1
0.141612
0
0
0
0
0
0
1
0.3
false
0
0.2
0.2
0.8
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
0
0
0
3
7be8d3cd6f88dfba15a15e7fd2507a1253c8f7ca
1,543
py
Python
OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GL/EXT/polygon_offset.py
JE-Chen/je_old_repo
a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5
[ "MIT" ]
null
null
null
OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GL/EXT/polygon_offset.py
JE-Chen/je_old_repo
a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5
[ "MIT" ]
null
null
null
OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GL/EXT/polygon_offset.py
JE-Chen/je_old_repo
a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5
[ "MIT" ]
null
null
null
'''OpenGL extension EXT.polygon_offset This module customises the behaviour of the OpenGL.raw.GL.EXT.polygon_offset to provide a more Python-friendly API Overview (from the spec) The depth values of fragments generated by rendering polygons are displaced by an amount that is proportional to the maximum absolute value of the depth slope of the polygon, measured and applied in window coordinates. This displacement allows lines (or points) and polygons in the same plane to be rendered without interaction -- the lines rendered either completely in front of or behind the polygons (depending on the sign of the offset factor). It also allows multiple coplanar polygons to be rendered without interaction, if different offset factors are used for each polygon. Applications include rendering hidden-line images, rendering solids with highlighted edges, and applying `decals' to surfaces. The official definition of this extension is available here: http://www.opengl.org/registry/specs/EXT/polygon_offset.txt ''' from OpenGL import platform, constant, arrays from OpenGL import extensions, wrapper import ctypes from OpenGL.raw.GL import _types, _glgets from OpenGL.raw.GL.EXT.polygon_offset import * from OpenGL.raw.GL.EXT.polygon_offset import _EXTENSION_NAME def glInitPolygonOffsetEXT(): '''Return boolean indicating whether this extension is available''' from OpenGL import extensions return extensions.hasGLExtension( _EXTENSION_NAME ) ### END AUTOGENERATED SECTION
41.702703
73
0.785483
216
1,543
5.560185
0.546296
0.049958
0.066611
0.034971
0.134055
0.084097
0.061615
0.061615
0
0
0
0
0.167855
1,543
37
74
41.702703
0.935358
0.777058
0
0
0
0
0
0
0
0
0
0
0
1
0.111111
true
0
0.777778
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
7bfc5cf9606ae0e95e9c5725ebe828ec749b97df
552
py
Python
mando/tests/capture.py
mollypi/mando
8e28ada5654693cf51f05ccd74fd3bfce2984e02
[ "MIT" ]
46
2015-01-03T16:06:17.000Z
2022-03-31T12:50:34.000Z
mando/tests/capture.py
mollypi/mando
8e28ada5654693cf51f05ccd74fd3bfce2984e02
[ "MIT" ]
40
2015-01-03T16:32:22.000Z
2022-03-05T19:51:09.000Z
mando/tests/capture.py
mollypi/mando
8e28ada5654693cf51f05ccd74fd3bfce2984e02
[ "MIT" ]
15
2015-01-20T03:08:21.000Z
2021-12-15T07:43:34.000Z
#!/usr/bin/env python ''' Capture function ---------------------------------- ''' import sys from contextlib import contextmanager try: from cStringIO import StringIO except ImportError: from io import StringIO @contextmanager def capture_sys_output(): capture_out, capture_err = StringIO(), StringIO() current_out, current_err = sys.stdout, sys.stderr try: sys.stdout, sys.stderr = capture_out, capture_err yield capture_out, capture_err finally: sys.stdout, sys.stderr = current_out, current_err
20.444444
57
0.67029
65
552
5.507692
0.4
0.083799
0.142458
0.167598
0
0
0
0
0
0
0
0
0.192029
552
26
58
21.230769
0.802691
0.130435
0
0.133333
0
0
0
0
0
0
0
0
0
1
0.066667
true
0
0.333333
0
0.4
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
0
0
0
3
d002dbb26129b139fcfff1650d10e0c6fb39725a
409
py
Python
tag.py
oliviazz/noteable
fda68f819e64b99f8d67d34227cbe74b6f2a08bc
[ "MIT" ]
null
null
null
tag.py
oliviazz/noteable
fda68f819e64b99f8d67d34227cbe74b6f2a08bc
[ "MIT" ]
null
null
null
tag.py
oliviazz/noteable
fda68f819e64b99f8d67d34227cbe74b6f2a08bc
[ "MIT" ]
null
null
null
#!/usr/bin/env python #----------------------------------------------------------------------- # tag.py # Author: Olivia Zhang, Zoe Barnswell, Lyra Katzman #----------------------------------------------------------------------- #----------------------------------------------------------------------- class Tag: # def __init__(self, tagID): self.tagID = tagID self.numArticles = 0
31.461538
72
0.288509
25
409
4.56
0.8
0.157895
0
0
0
0
0
0
0
0
0
0.002817
0.132029
409
13
73
31.461538
0.31831
0.711491
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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
d01d3f74de2cf80db1c148df3598cd8fee729a0c
481
py
Python
mason/test/support/clients/test2/scheduler.py
kyprifog/mason
bf45672124ef841bc16216c293034f4ccc506621
[ "Apache-2.0" ]
4
2021-04-12T17:49:34.000Z
2022-01-23T19:54:29.000Z
mason/test/support/clients/test2/scheduler.py
kyprifog/mason
bf45672124ef841bc16216c293034f4ccc506621
[ "Apache-2.0" ]
24
2021-04-30T18:40:25.000Z
2021-05-12T20:52:06.000Z
mason/test/support/clients/test2/scheduler.py
kyprifog/mason
bf45672124ef841bc16216c293034f4ccc506621
[ "Apache-2.0" ]
3
2021-04-12T19:40:43.000Z
2021-09-07T21:56:36.000Z
from typing import Union, Optional from mason.clients.engines.scheduler import SchedulerClient from mason.engines.scheduler.models.schedule import Schedule, InvalidSchedule from mason.test.support.clients.test import TestClient class Test2SchedulerClient(SchedulerClient): def __init__(self, client: TestClient): self.client = client def validate_schedule(self, schedule: Optional[str] = None) -> Union[Optional[Schedule], InvalidSchedule]: return None
34.357143
110
0.783784
54
481
6.888889
0.481481
0.072581
0
0
0
0
0
0
0
0
0
0.00241
0.137214
481
13
111
37
0.893976
0
0
0
0
0
0
0
0
0
0
0
0
1
0.222222
false
0
0.444444
0.111111
0.888889
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
0
0
0
3
d02cf0a83177c34be3a94976eda10b48db06fdff
240
py
Python
forms.py
deeplook/slackipy
9195ddb2de15e6e9eb8c3343fc3bd86b5b5a9c62
[ "MIT" ]
103
2015-11-09T07:15:18.000Z
2019-10-03T16:08:18.000Z
forms.py
deeplook/slackipy
9195ddb2de15e6e9eb8c3343fc3bd86b5b5a9c62
[ "MIT" ]
7
2015-11-11T09:30:17.000Z
2021-09-09T03:36:26.000Z
forms.py
deeplook/slackipy
9195ddb2de15e6e9eb8c3343fc3bd86b5b5a9c62
[ "MIT" ]
15
2015-11-08T07:38:02.000Z
2021-09-05T13:59:37.000Z
from flask_wtf import Form from wtforms import validators from wtforms.fields.html5 import EmailField class InviteForm(Form): email = EmailField('Email Address', [validators.DataRequired(), validators.Email()])
26.666667
71
0.7125
26
240
6.538462
0.576923
0.129412
0
0
0
0
0
0
0
0
0
0.005236
0.204167
240
8
72
30
0.884817
0
0
0
0
0
0.054167
0
0
0
0
0
0
1
0
false
0
0.5
0
0.833333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
d0716e0fb511539838ed4c192af48c44c50b2785
152
py
Python
WebVisualizations/Data.py
qizhengyaoyao/Web-Design-Challenge
7f5420163e8c3eca14fb11c6f92f1f32d7a4194c
[ "ADSL" ]
null
null
null
WebVisualizations/Data.py
qizhengyaoyao/Web-Design-Challenge
7f5420163e8c3eca14fb11c6f92f1f32d7a4194c
[ "ADSL" ]
null
null
null
WebVisualizations/Data.py
qizhengyaoyao/Web-Design-Challenge
7f5420163e8c3eca14fb11c6f92f1f32d7a4194c
[ "ADSL" ]
null
null
null
import pandas as pd cities = pd.read_csv("../Resources/cities.csv") cities.set_index('City_ID', inplace=True) cities.to_html("../Resources/cities.html")
38
47
0.756579
24
152
4.625
0.666667
0.27027
0
0
0
0
0
0
0
0
0
0
0.059211
152
4
48
38
0.776224
0
0
0
0
0
0.352941
0.30719
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
d07398159a8c43d5f5043d0fd39525a97b1414b9
1,478
py
Python
pliers/extractors/api/__init__.py
adelavega/pliers
dee21102689c77a56b7da48bf9a0ac10c90be0eb
[ "BSD-3-Clause" ]
null
null
null
pliers/extractors/api/__init__.py
adelavega/pliers
dee21102689c77a56b7da48bf9a0ac10c90be0eb
[ "BSD-3-Clause" ]
null
null
null
pliers/extractors/api/__init__.py
adelavega/pliers
dee21102689c77a56b7da48bf9a0ac10c90be0eb
[ "BSD-3-Clause" ]
null
null
null
from .clarifai import ClarifaiAPIExtractor from .indico import (IndicoAPITextExtractor, IndicoAPIImageExtractor) from .google import (GoogleVisionAPIFaceExtractor, GoogleVisionAPILabelExtractor, GoogleVisionAPIPropertyExtractor, GoogleVisionAPISafeSearchExtractor, GoogleVisionAPIWebEntitiesExtractor) from .microsoft import (MicrosoftAPIFaceExtractor, MicrosoftAPIFaceEmotionExtractor, MicrosoftVisionAPIExtractor, MicrosoftVisionAPITagExtractor, MicrosoftVisionAPICategoryExtractor, MicrosoftVisionAPIImageTypeExtractor, MicrosoftVisionAPIColorExtractor, MicrosoftVisionAPIAdultExtractor) __all__ = [ 'ClarifaiAPIExtractor', 'IndicoAPITextExtractor', 'IndicoAPIImageExtractor', 'GoogleVisionAPIFaceExtractor', 'GoogleVisionAPILabelExtractor', 'GoogleVisionAPIPropertyExtractor', 'GoogleVisionAPISafeSearchExtractor', 'GoogleVisionAPIWebEntitiesExtractor', 'MicrosoftAPIFaceExtractor', 'MicrosoftAPIFaceEmotionExtractor', 'MicrosoftVisionAPIExtractor', 'MicrosoftVisionAPITagExtractor', 'MicrosoftVisionAPICategoryExtractor', 'MicrosoftVisionAPIImageTypeExtractor', 'MicrosoftVisionAPIColorExtractor', 'MicrosoftVisionAPIAdultExtractor' ]
41.055556
61
0.690122
45
1,478
22.577778
0.511111
0.088583
0.175197
0.242126
0.801181
0.490157
0.490157
0.490157
0
0
0
0
0.261164
1,478
35
62
42.228571
0.930403
0
0
0
0
0
0.31935
0.305819
0
0
0
0
0
1
0
false
0
0.117647
0
0.117647
0
0
0
1
null
0
0
1
1
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
0
0
3
d07ebfb2bc17510975625680315f9f960a059a21
126
py
Python
piconly.py
robinwyss/raspberry-scripts
1e5423271711eb1df69031ed8cd2638d35bbc50f
[ "MIT" ]
null
null
null
piconly.py
robinwyss/raspberry-scripts
1e5423271711eb1df69031ed8cd2638d35bbc50f
[ "MIT" ]
null
null
null
piconly.py
robinwyss/raspberry-scripts
1e5423271711eb1df69031ed8cd2638d35bbc50f
[ "MIT" ]
null
null
null
#!/usr/bin/env python import camera print("taking a picture") imagePath = camera.capture() print("captured %s" % imagePath)
15.75
32
0.722222
17
126
5.352941
0.823529
0
0
0
0
0
0
0
0
0
0
0
0.126984
126
7
33
18
0.827273
0.15873
0
0
0
0
0.257143
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
d086870cb5aff6bd8e6189f835ffce11a3f4c2c9
888
py
Python
jetscape_analysis/analysis/reader/reader_base.py
raymondEhlers/JETSCAPE-analysis
c650fac0f8bfc4a2efa9342d47531420daf54f35
[ "BSD-3-Clause" ]
1
2020-07-18T17:36:08.000Z
2020-07-18T17:36:08.000Z
jetscape_analysis/analysis/reader/reader_base.py
raymondEhlers/JETSCAPE-analysis
c650fac0f8bfc4a2efa9342d47531420daf54f35
[ "BSD-3-Clause" ]
null
null
null
jetscape_analysis/analysis/reader/reader_base.py
raymondEhlers/JETSCAPE-analysis
c650fac0f8bfc4a2efa9342d47531420daf54f35
[ "BSD-3-Clause" ]
null
null
null
#!/usr/bin/env python3 """ Reader base class Author: James Mulligan (james.mulligan@berkeley.edu) """ from __future__ import print_function # Base class from jetscape_analysis.base import common_base ################################################################ class ReaderBase(common_base.CommonBase): # --------------------------------------------------------------- # Constructor # --------------------------------------------------------------- def __init__(self, input_file="", **kwargs): super(ReaderBase, self).__init__(**kwargs) # --------------------------------------------------------------- # Generator (in pythonic sense) to loop over all events # --------------------------------------------------------------- def __call__(self, n_events): for i in range(0, n_events): yield self.next_event()
29.6
69
0.422297
70
888
5.014286
0.685714
0.076923
0
0
0
0
0
0
0
0
0
0.002663
0.154279
888
29
70
30.62069
0.464714
0.47973
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.625
0.125
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
d0967c5ac05c0133ee4d6e77672474574e7d1868
2,828
py
Python
fhirtordf/rdfsupport/dottednamespace.py
dnstone/fhirtordf
2ec2ac2ea66798a39fa0c3f27c9803f69e7710d1
[ "Apache-2.0" ]
null
null
null
fhirtordf/rdfsupport/dottednamespace.py
dnstone/fhirtordf
2ec2ac2ea66798a39fa0c3f27c9803f69e7710d1
[ "Apache-2.0" ]
null
null
null
fhirtordf/rdfsupport/dottednamespace.py
dnstone/fhirtordf
2ec2ac2ea66798a39fa0c3f27c9803f69e7710d1
[ "Apache-2.0" ]
null
null
null
# Copyright (c) 2017, Mayo Clinic # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # # 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. # # Neither the name of the Mayo Clinic nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # 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. from rdflib import Namespace, URIRef class DottedNamespace(Namespace): """ An RDF namespace that supports the FHIR dotted notation (e.g. fhir:Patient.status) """ def __new__(cls, value): return Namespace.__new__(cls, value) def __getattribute__(self, item: str) -> "DottedURIRef": if item == 'index': return DottedURIRef(str(self) + item) else: return super().__getattribute__(item) def __getattr__(self, item: str) -> "DottedURIRef": return DottedURIRef(str(self) + item) def __eq__(self, other): return super().__eq__(other) def __hash__(self): return super().__hash__() class DottedURIRef(URIRef): """ A URIRef that supports the FHIR dotted notation """ def __new__(cls, value, base=None): return URIRef.__new__(cls, value, base) def __getattr__(self, item: str) -> "DottedURIRef": return DottedURIRef(str(self) + '.' + item) def __eq__(self, other): if isinstance(self, URIRef) and isinstance(other, URIRef): return str(self) == str(other) else: return False def __hash__(self): fqn = URIRef.__module__ + '.' + URIRef.__name__ return hash(fqn) ^ hash(str(self))
38.216216
86
0.704385
365
2,828
5.282192
0.441096
0.024896
0.022822
0.035788
0.223548
0.18361
0.149378
0.149378
0.149378
0.149378
0
0.001808
0.217822
2,828
73
87
38.739726
0.869801
0.573904
0
0.357143
0
0
0.037456
0
0
0
0
0
0
1
0.321429
false
0
0.035714
0.214286
0.821429
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
0
1
1
0
0
3
d0b094aee2624153e8d70ddd6c9e2a248b08e5b7
1,005
py
Python
toml_adapt/ToolExtraction.py
StrajnarFilip/toml-adapt
e86731378b6fa779d07bd9bed9abdaf3ad112d5e
[ "MIT" ]
1
2021-06-01T13:07:45.000Z
2021-06-01T13:07:45.000Z
toml_adapt/ToolExtraction.py
StrajnarFilip/toml-adapt
e86731378b6fa779d07bd9bed9abdaf3ad112d5e
[ "MIT" ]
20
2021-06-05T12:27:45.000Z
2022-02-28T15:53:03.000Z
toml_adapt/ToolExtraction.py
StrajnarFilip/toml-adapt
e86731378b6fa779d07bd9bed9abdaf3ad112d5e
[ "MIT" ]
2
2021-06-04T20:58:45.000Z
2022-01-05T20:39:12.000Z
import pathlib from typing import Any, Dict, MutableMapping import toml def IsSpecificPythonTool(toml_file_path: str, tool_name:str): toml_loaded: MutableMapping[str,Any]=toml.load(toml_file_path) if(toml_loaded.keys().__contains__("tool")): toml_tool: Dict[str,Any]=toml_loaded["tool"] if(toml_tool.keys().__contains__(tool_name)): return True return False def IsFileFlit(toml_file_path: str) -> bool: return IsSpecificPythonTool(toml_file_path,"flit") def IsFilePoetry(toml_file_path: str) -> bool: return IsSpecificPythonTool(toml_file_path,"poetry") def IsFileCargo(toml_file_path: str) -> bool: """ Cargo requires the file to be named Cargo.toml Checking only file path should not be ambiguous """ return pathlib.Path(toml_file_path).name == "Cargo.toml" def IsFileJuliaPkg(toml_file_path: str) -> bool: """ Julia's pkg tool uses Project.toml file. """ return pathlib.Path(toml_file_path).name == "Project.toml"
33.5
66
0.718408
137
1,005
5.014599
0.335766
0.128093
0.174672
0.10917
0.317322
0.262009
0.262009
0.165939
0.165939
0.165939
0
0
0.169154
1,005
30
67
33.5
0.822754
0.134328
0
0
0
0
0.047847
0
0
0
0
0
0
1
0.277778
false
0
0.166667
0.111111
0.777778
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
d0bf9dac421a820289451456f7dbba76dcba9978
131
py
Python
src/ConsoleColors/PrintColor.py
flexiooss/flexio-flow
47491c7e5b49a02dc859028de0d486edc0014b26
[ "Apache-2.0" ]
null
null
null
src/ConsoleColors/PrintColor.py
flexiooss/flexio-flow
47491c7e5b49a02dc859028de0d486edc0014b26
[ "Apache-2.0" ]
44
2019-04-05T06:08:15.000Z
2021-09-13T19:37:49.000Z
src/ConsoleColors/PrintColor.py
flexiooss/flexio-flow
47491c7e5b49a02dc859028de0d486edc0014b26
[ "Apache-2.0" ]
null
null
null
from ConsoleColors.Fg import Fg class PrintColor: @staticmethod def log(text: str): print(text + Fg.RESET.value)
16.375
36
0.671756
17
131
5.176471
0.823529
0
0
0
0
0
0
0
0
0
0
0
0.236641
131
7
37
18.714286
0.88
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.6
0.2
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
0
1
0
0
3
d0c9a0f29762b4e11b74e189c42b7eb9d9c9da9c
234
py
Python
tests/datatypes/totest-anyType.py
thorstenb/pyxb
634e86f61dfb73a2900f32fc3d819e9c25365a49
[ "Apache-2.0" ]
null
null
null
tests/datatypes/totest-anyType.py
thorstenb/pyxb
634e86f61dfb73a2900f32fc3d819e9c25365a49
[ "Apache-2.0" ]
null
null
null
tests/datatypes/totest-anyType.py
thorstenb/pyxb
634e86f61dfb73a2900f32fc3d819e9c25365a49
[ "Apache-2.0" ]
null
null
null
import unittest import pyxb.binding.datatypes as xsd class Test_anyType (unittest.TestCase): def testRange (self): self.assertFalse("Datatype anyType test not implemented") if __name__ == '__main__': unittest.main()
23.4
65
0.735043
28
234
5.821429
0.75
0
0
0
0
0
0
0
0
0
0
0
0.17094
234
9
66
26
0.840206
0
0
0
0
0
0.192308
0
0
0
0
0
0.142857
1
0.142857
false
0
0.285714
0
0.571429
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
d0c9c6990692d5181a10261a4bebd0db07d18402
148
py
Python
infra/app.py
imrehg/ecs-deploy
5a642b1b22fcf39ba8dcf5a14e3080ec56b38feb
[ "MIT" ]
null
null
null
infra/app.py
imrehg/ecs-deploy
5a642b1b22fcf39ba8dcf5a14e3080ec56b38feb
[ "MIT" ]
null
null
null
infra/app.py
imrehg/ecs-deploy
5a642b1b22fcf39ba8dcf5a14e3080ec56b38feb
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 from aws_cdk import core from infra.infra_stack import InfraStack app = core.App() InfraStack(app, "infra") app.synth()
12.333333
40
0.736486
23
148
4.652174
0.608696
0.242991
0
0
0
0
0
0
0
0
0
0.007874
0.141892
148
11
41
13.454545
0.834646
0.141892
0
0
0
0
0.039683
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
d0ca1684c1e235d80a135411e4ec5a28bc0398e3
461
py
Python
mainS.py
Sniper970119/MemoryAssistInPython
434efd09edbda7919a3f754374add7f34912fab7
[ "MIT" ]
19
2019-02-11T01:39:32.000Z
2022-03-05T05:14:34.000Z
mainS.py
Sniper970119/MemoryAssistInPython
434efd09edbda7919a3f754374add7f34912fab7
[ "MIT" ]
1
2020-02-04T15:20:04.000Z
2020-06-04T05:02:06.000Z
mainS.py
Sniper970119/MemoryAssistInPython
434efd09edbda7919a3f754374add7f34912fab7
[ "MIT" ]
5
2019-04-20T07:23:25.000Z
2021-03-24T03:13:01.000Z
# -*- coding:utf-8 -*- from src.Server.Conf.config import * from src.Server.MessageTransferSystem.VersionControlSystem import versionControl from src.Server.MessageReportSystem.messageReportSystem import MessageReportSystem import os # 主界面 if __name__ == '__main__': versionControl.VersionControl() threading.Thread(target=MessageReportSystem().run()).start() # schedule.every().monday.at("00:00").do(MessageReportSystem().run()) # while True:
35.461538
82
0.763557
48
461
7.166667
0.645833
0.061047
0.113372
0
0
0
0
0
0
0
0
0.012107
0.104121
461
13
83
35.461538
0.820823
0.225597
0
0
0
0
0.022663
0
0
0
0
0
0
1
0
true
0
0.571429
0
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
d0f656b2fe1afde643d3112318bb530230fae2a5
203
py
Python
src/payu_payment/serializers.py
wilantury/payu_integration_backend
229ecf0b24e112d0fa84ad557b7e5ca8eab8a66a
[ "MIT" ]
null
null
null
src/payu_payment/serializers.py
wilantury/payu_integration_backend
229ecf0b24e112d0fa84ad557b7e5ca8eab8a66a
[ "MIT" ]
null
null
null
src/payu_payment/serializers.py
wilantury/payu_integration_backend
229ecf0b24e112d0fa84ad557b7e5ca8eab8a66a
[ "MIT" ]
null
null
null
from rest_framework import serializers from .models import LogPurchase class LogPurchaseSerializer(serializers.ModelSerializer): class Meta: model = LogPurchase fields = '__all__'
20.3
57
0.748768
19
203
7.736842
0.736842
0
0
0
0
0
0
0
0
0
0
0
0.20197
203
10
58
20.3
0.907407
0
0
0
0
0
0.034483
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
1901fb6a46a9d87a7fa24096de857ae426a698dd
429
py
Python
Paracha_Junaid/Assignments/Python/Web_fund/grade.py
webguru001/Python-Django-Web
6264bc4c90ef1432ba0902c76b567cf3caaae221
[ "MIT" ]
5
2019-05-17T01:30:02.000Z
2021-06-17T21:02:58.000Z
Paracha_Junaid/Assignments/Python/Web_fund/grade.py
curest0x1021/Python-Django-Web
6264bc4c90ef1432ba0902c76b567cf3caaae221
[ "MIT" ]
null
null
null
Paracha_Junaid/Assignments/Python/Web_fund/grade.py
curest0x1021/Python-Django-Web
6264bc4c90ef1432ba0902c76b567cf3caaae221
[ "MIT" ]
null
null
null
def grade(x): if 101>x>=90: return 'Your Grade is A' elif 89>=x>=80: return 'Your Grade is B' elif 79>=x>=70: return 'Your Grade is C' elif 69>=x>=60: return 'Your Grade is D' return 'not a correct value' y = ['Score and Grade'] for i in range (0,10): a = input('Enter a score between 60 and 100. ->') x = ('Score: '+ str(a)+ ';'+ grade(a)) y.append(x) i+=1 print '\n'.join(y) print 'End of the program. Bye!'
20.428571
50
0.601399
84
429
3.071429
0.559524
0.155039
0.232558
0.263566
0
0
0
0
0
0
0
0.076923
0.212121
429
20
51
21.45
0.686391
0
0
0
0
0
0.382284
0
0
0
0
0
0
0
null
null
0
0
null
null
0.111111
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
1
0
0
0
0
0
0
0
0
3
ef9b38195cd26fe3dd7ce0d3caf81fb96adfa802
163
py
Python
utils/paths.py
Pipe-Runner-Lab/cornell_birdcall_identification
79a807c4a7e368b2ffcb7ecc91176c2bc03f650a
[ "MIT" ]
null
null
null
utils/paths.py
Pipe-Runner-Lab/cornell_birdcall_identification
79a807c4a7e368b2ffcb7ecc91176c2bc03f650a
[ "MIT" ]
7
2021-08-23T20:52:07.000Z
2022-03-12T00:48:51.000Z
utils/paths.py
Pipe-Runner-Lab/cornell_birdcall_identification
79a807c4a7e368b2ffcb7ecc91176c2bc03f650a
[ "MIT" ]
null
null
null
CONFIG_DIR = '__config__' DATA_ROOT_DIR = '__data__' RESULTS_ROOT_DIR = '__results__' TB_DIR = '__runs__' WEIGHTS_DIR = '__weights__' NOISE_ROOT_DIR = "__noise__"
23.285714
32
0.779141
21
163
4.47619
0.428571
0.223404
0
0
0
0
0
0
0
0
0
0
0.110429
163
6
33
27.166667
0.648276
0
0
0
0
0
0.349693
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
ef9c6d8cdfc486f467a855476126907fbf14a657
641
py
Python
scripts/py-scripts/except-class.py
loafdog/loaf-src
3450b059a0a8d13c6709d63867888c113cd4a063
[ "Apache-2.0" ]
null
null
null
scripts/py-scripts/except-class.py
loafdog/loaf-src
3450b059a0a8d13c6709d63867888c113cd4a063
[ "Apache-2.0" ]
null
null
null
scripts/py-scripts/except-class.py
loafdog/loaf-src
3450b059a0a8d13c6709d63867888c113cd4a063
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/python class B: pass class C(B): pass class D(C): pass for c in [B, C, D]: try: raise c() except D: print "D" except C: print "C" except B: print "B" for c in [B, C, D]: try: raise c() except B as b: print "B ",str(b),str(B) # every exception will be caught by B block. for c in [B, C, D]: try: raise c() except D: print "D" except C: print "C" # exception will be generated here because when you raise B() there is # no except B line. You can't catch exceptions from base class using # derived classes
16.868421
70
0.535101
106
641
3.235849
0.386792
0.081633
0.052478
0.061224
0.326531
0.326531
0.326531
0.326531
0.326531
0.326531
0
0
0.357254
641
37
71
17.324324
0.832524
0.332293
0
0.740741
0
0
0.016548
0
0
0
0
0
0
0
null
null
0.111111
0
null
null
0.222222
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
1
0
0
1
0
0
0
0
0
3
efaba035a7ed7385d108f37502d3e57cbb758b3f
1,379
py
Python
lib/search/problem.py
timofurrer/aoc-2020
446b688a57601d9891f520e43b7f822c373a6ff4
[ "MIT" ]
null
null
null
lib/search/problem.py
timofurrer/aoc-2020
446b688a57601d9891f520e43b7f822c373a6ff4
[ "MIT" ]
null
null
null
lib/search/problem.py
timofurrer/aoc-2020
446b688a57601d9891f520e43b7f822c373a6ff4
[ "MIT" ]
null
null
null
""" This module provies common implementation of Search problems. These problem implementation can be used with the search optimization algorithms in ``lib.search``. """ from lib.search.graph import Location, Graph class StartEndGraphProblem: """The implementation of a problem to find "a" path from a start to end.""" def __init__(self, graph: Graph, start: Location, goal: Location): self.graph = graph self.start = start self.goal = goal def goal_test(self, state): """Return True if the state is a goal. The default method compares the state to self.goal or checks for state in self.goal if it is a list, as specified in the constructor. Override this method if checking against a single self.goal is not enough.""" return state == self.goal def actions(self, loc: Location): """The actions at a graph node are just its neighbors.""" return self.graph.children(loc) def path_cost(self, cost_so_far, from_loc: Location, to_loc: Location): return cost_so_far + (self.graph.cost(from_loc, to_loc) or float("inf")) class StartEndPathProblem: def __init__(self, start: Location, goal: Location, actions): self.start = start self.goal = goal self.actions = actions def goal_test(self, current): return self.goal == current
33.634146
80
0.678028
194
1,379
4.721649
0.381443
0.061135
0.024017
0.054585
0.056769
0.056769
0
0
0
0
0
0
0.235678
1,379
41
81
33.634146
0.86907
0.383611
0
0.210526
0
0
0.003731
0
0
0
0
0
0
1
0.315789
false
0
0.052632
0.105263
0.684211
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
0
1
1
0
0
3
efcc0f31a49648f802bdca7df3b2d5090b62b1bf
445
py
Python
Solutions/Python/annee_bissextile.py
N07070/Projects
6fb6ff76696ba1db56e7449fa8913de1c1b32d06
[ "MIT" ]
null
null
null
Solutions/Python/annee_bissextile.py
N07070/Projects
6fb6ff76696ba1db56e7449fa8913de1c1b32d06
[ "MIT" ]
null
null
null
Solutions/Python/annee_bissextile.py
N07070/Projects
6fb6ff76696ba1db56e7449fa8913de1c1b32d06
[ "MIT" ]
null
null
null
#!/usr/bin/python # -*- coding: utf-8 -*- # Public Domain 2014 - Created by N07070 annee_user = input('Please enter a year in the YYYY format >> ') print 'Thanks, and your year is...' annee_user = int(annee_user) if annee_user % 4 == 0: if annee_user % 100 == 0: print 'Well, nothing special...' else: print 'Bissextile !' elif annee_user % 400 == 0: print 'Bissextile !' else: print 'Well, nothing special...'
24.722222
64
0.624719
63
445
4.31746
0.634921
0.198529
0.080882
0.169118
0
0
0
0
0
0
0
0.05848
0.231461
445
17
65
26.176471
0.736842
0.173034
0
0.5
0
0
0.386301
0
0
0
0
0
0
0
null
null
0
0
null
null
0.416667
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
1
0
0
0
0
0
0
1
0
3
efcecd34b78b5b67c47958ba2d1d9b0b981ab273
254
py
Python
python/testData/inspections/PyUnresolvedReferencesInspection/docstring.py
truthiswill/intellij-community
fff88cfb0dc168eea18ecb745d3e5b93f57b0b95
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/inspections/PyUnresolvedReferencesInspection/docstring.py
truthiswill/intellij-community
fff88cfb0dc168eea18ecb745d3e5b93f57b0b95
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
python/testData/inspections/PyUnresolvedReferencesInspection/docstring.py
truthiswill/intellij-community
fff88cfb0dc168eea18ecb745d3e5b93f57b0b95
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
class Test(object): """ @cvar some: some variable @type some: C{str} """ some = 'hello' def __init__(self): self.some1 = 10 def q(self, another): """ @param another: another variable @type another: C{str} """ pass
14.941176
36
0.562992
32
254
4.34375
0.59375
0.172662
0
0
0
0
0
0
0
0
0
0.016484
0.283465
254
17
37
14.941176
0.747253
0.389764
0
0
0
0
0.04065
0
0
0
0
0
0
1
0.333333
false
0.166667
0
0
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
0
0
0
1
0
1
0
0
1
0
0
3
efe4a8354b97cdb87d09e9762158f4aaf4a5787b
625
py
Python
Codewars/Test/Compare_power_test.py
maxcohen31/A-bored-math-student
007beb4dabf7b4406f48e9a3a967c29d032eab89
[ "MIT" ]
null
null
null
Codewars/Test/Compare_power_test.py
maxcohen31/A-bored-math-student
007beb4dabf7b4406f48e9a3a967c29d032eab89
[ "MIT" ]
null
null
null
Codewars/Test/Compare_power_test.py
maxcohen31/A-bored-math-student
007beb4dabf7b4406f48e9a3a967c29d032eab89
[ "MIT" ]
null
null
null
import unittest from random import randint from Compare_powers_6_kyu import compare_powers class Powers(unittest.TestCase): def test_1(self): a = [2, 5] b = [3, 9] result = 1 self.assertEqual(compare_powers(a, b), result) def test_2(self): a = [33, 99] b = [22, 99] result = -1 self.assertEqual(compare_powers(a, b), result) def test_3(self): a = [2, 5] b = [2, 5] result = 0 self.assertEqual(compare_powers(a, b), result) if __name__ == "__main__": unittest.main()
24.038462
60
0.5296
80
625
3.9125
0.375
0.207668
0.210863
0.268371
0.485623
0.434505
0.434505
0.319489
0.319489
0.319489
0
0.057357
0.3584
625
26
61
24.038462
0.723192
0
0
0.238095
0
0
0.01278
0
0
0
0
0
0.142857
1
0.142857
false
0
0.142857
0
0.333333
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
efec84ec14aa021eb5ed33bf4069ac71586f2a87
478
py
Python
base/__init__.py
sapanz/Odoo-Server-Tool
b98c048a9b980772286af87b3ff96efd094883e2
[ "MIT" ]
6
2018-12-04T11:03:18.000Z
2018-12-14T08:10:04.000Z
base/__init__.py
MohitGhodasara/OdooServerTool-Source
28ec79b435fa3789ca523c40ae08753123a40ebd
[ "MIT" ]
3
2018-12-04T07:08:47.000Z
2018-12-04T07:16:19.000Z
base/__init__.py
MohitGhodasara/OdooServerTool-Source
28ec79b435fa3789ca523c40ae08753123a40ebd
[ "MIT" ]
5
2019-08-12T04:32:34.000Z
2020-06-01T15:06:08.000Z
import sys from . import baseutils from . import config_manager from . import version_manager from . import psql_database from . import slash_x if sys.version_info[0] >= 3: import tkinter as tk import tkinter.ttk as ttk from tkinter import font from tkinter import messagebox from tkinter import filedialog else: import Tkinter as tk import tkFont as font import tkMessageBox as messagebox import tkFileDialog as filedialog import ttk
21.727273
37
0.746862
67
478
5.253731
0.38806
0.142045
0.144886
0.096591
0.130682
0
0
0
0
0
0
0.005405
0.225941
478
21
38
22.761905
0.945946
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.888889
0
0.888889
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
0
1
0
1
0
1
0
0
3
4bc71640256c03f46abaadff183f3b0124ec1d6c
1,308
py
Python
tests/test_flask_getenvvalue.py
yukkeorg/Flask_GetEnvValue
bf406a8161fced5bb18bbaaa8eff64dfd407baa1
[ "MIT" ]
null
null
null
tests/test_flask_getenvvalue.py
yukkeorg/Flask_GetEnvValue
bf406a8161fced5bb18bbaaa8eff64dfd407baa1
[ "MIT" ]
null
null
null
tests/test_flask_getenvvalue.py
yukkeorg/Flask_GetEnvValue
bf406a8161fced5bb18bbaaa8eff64dfd407baa1
[ "MIT" ]
null
null
null
import os from flask import Flask from flask_getenvvalue import GetEnvValue def test_getenvvalue_default(): app = Flask(__name__) app.config["FLASK_GETENVVALUE_TEST"] = "123456" os.environ["FLASK_GETENVVALUE_TEST"] = "ABCDEF" GetEnvValue(app, envnames=["FLASK_GETENVVALUE_TEST", "FLASK_GETENVVALUE_UNDEFINED"]) assert app.config["FLASK_GETENVVALUE_TEST"] == "ABCDEF" assert "FLASK_GETENVVALUE_UNDEFINED" not in app.config def test_getenvvalue_disable_ignore_undefined(): app = Flask(__name__) app.config["FLASK_GETENVVALUE_TEST"] = "123456" os.environ["FLASK_GETENVVALUE_TEST"] = "ABCDEF" GetEnvValue(app, envnames=["FLASK_GETENVVALUE_TEST", "FLASK_GETENVVALUE_UNDEFINED"], ignore_undefined=False) assert app.config["FLASK_GETENVVALUE_TEST"] == "ABCDEF" assert app.config["FLASK_GETENVVALUE_UNDEFINED"] is None def test_getenvvalue_enable_protect_exists(): app = Flask(__name__) app.config["FLASK_GETENVVALUE_TEST"] = "123456" os.environ["FLASK_GETENVVALUE_TEST"] = "ABCDEF" GetEnvValue(app, envnames=["FLASK_GETENVVALUE_TEST"], protect_exists=True) assert app.config["FLASK_GETENVVALUE_TEST"] == "123456"
30.418605
62
0.68578
139
1,308
6.043165
0.201439
0.32381
0.285714
0.208333
0.692857
0.663095
0.614286
0.614286
0.502381
0.502381
0
0.023256
0.211009
1,308
42
63
31.142857
0.790698
0
0
0.448276
0
0
0.325688
0.284404
0
0
0
0
0.172414
1
0.103448
false
0
0.103448
0
0.206897
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
4bd12f596e5235663cc1ca9a5d9c95c8aac23cee
457
py
Python
tests/test_sorting_and_searching/test_counting_sort.py
ueg1990/aids
bb543c6f53983d59edbc6a522ca10d64efd9c42e
[ "MIT" ]
null
null
null
tests/test_sorting_and_searching/test_counting_sort.py
ueg1990/aids
bb543c6f53983d59edbc6a522ca10d64efd9c42e
[ "MIT" ]
null
null
null
tests/test_sorting_and_searching/test_counting_sort.py
ueg1990/aids
bb543c6f53983d59edbc6a522ca10d64efd9c42e
[ "MIT" ]
null
null
null
import unittest from aids.sorting_and_searching.counting_sort import counting_sort class CountingSortTestCase(unittest.TestCase): ''' Unit tests for counting sort ''' def setUp(self): self.example = [4,3,2,1,4,3,2,4,3,4] def test_selection_sort(self): self.assertEqual(counting_sort(self.example), [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) def tearDown(self): pass if __name__ == '__main__': unittest.main()
20.772727
85
0.649891
66
457
4.272727
0.469697
0.170213
0.021277
0
0
0
0
0
0
0
0
0.056022
0.218818
457
21
86
21.761905
0.733894
0.061269
0
0
0
0
0.019417
0
0
0
0
0
0.090909
1
0.272727
false
0.090909
0.181818
0
0.545455
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
4bd76434e611efc172ed76586fcb86ef0fcf0392
134
py
Python
sparrow_cloud/apps/schema_command/schemas/incompatible_settings.py
LaEmma/sparrow_cloud
fb9f76ea70b3ba5782c33f3b3379e2ffe4bab08c
[ "MIT" ]
15
2019-09-24T09:32:32.000Z
2021-12-30T08:07:41.000Z
sparrow_cloud/apps/schema_command/schemas/incompatible_settings.py
LaEmma/sparrow_cloud
fb9f76ea70b3ba5782c33f3b3379e2ffe4bab08c
[ "MIT" ]
13
2019-09-06T03:20:02.000Z
2021-09-27T03:37:25.000Z
sparrow_cloud/apps/schema_command/schemas/incompatible_settings.py
LaEmma/sparrow_cloud
fb9f76ea70b3ba5782c33f3b3379e2ffe4bab08c
[ "MIT" ]
17
2019-09-02T06:31:05.000Z
2021-10-08T04:23:23.000Z
""" drf 不兼容的配置项 """ SCHEMA_COERCE_METHOD_NAMES = { 'retrieve': 'read', 'destroy': 'delete' } SCHEMA_COERCE_PATH_PK = True
14.888889
30
0.641791
15
134
5.333333
0.866667
0.3
0
0
0
0
0
0
0
0
0
0
0.201493
134
8
31
16.75
0.747664
0.08209
0
0
0
0
0.225225
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
4bf21d8661464e6f6fdc91b434922d3b768df022
391
py
Python
Easy/268. Missing Number/solution (3).py
czs108/LeetCode-Solutions
889f5b6a573769ad077a6283c058ed925d52c9ec
[ "MIT" ]
3
2020-05-09T12:55:09.000Z
2022-03-11T18:56:05.000Z
Easy/268. Missing Number/solution (3).py
czs108/LeetCode-Solutions
889f5b6a573769ad077a6283c058ed925d52c9ec
[ "MIT" ]
null
null
null
Easy/268. Missing Number/solution (3).py
czs108/LeetCode-Solutions
889f5b6a573769ad077a6283c058ed925d52c9ec
[ "MIT" ]
1
2022-03-11T18:56:16.000Z
2022-03-11T18:56:16.000Z
# 268. Missing Number # Runtime: 132 ms, faster than 76.58% of Python3 online submissions for Missing Number. # Memory Usage: 15.5 MB, less than 51.40% of Python3 online submissions for Missing Number. class Solution: # Gauss' Formula def missingNumber(self, nums: list[int]) -> int: expected_sum = len(nums) * (len(nums) + 1) // 2 return expected_sum - sum(nums)
32.583333
91
0.680307
57
391
4.631579
0.684211
0.147727
0.113636
0.19697
0.318182
0.318182
0.318182
0
0
0
0
0.068404
0.214834
391
12
92
32.583333
0.791531
0.537084
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0
0
0.75
0
0
0
0
null
0
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
3
4bfb62cc857ebf933adb86e61a487ec537f9eb11
213
py
Python
pysyft_proto/proto.py
IonesioJunior/proto
699cef5de30c4bc84c1b3394e5c5d0465132d5b8
[ "Apache-2.0" ]
null
null
null
pysyft_proto/proto.py
IonesioJunior/proto
699cef5de30c4bc84c1b3394e5c5d0465132d5b8
[ "Apache-2.0" ]
null
null
null
pysyft_proto/proto.py
IonesioJunior/proto
699cef5de30c4bc84c1b3394e5c5d0465132d5b8
[ "Apache-2.0" ]
null
null
null
from pkg_resources import resource_string import json proto_info = None try: proto_json = resource_string(__name__, 'proto.json') proto_info = json.loads(proto_json) except Exception: pass
19.363636
57
0.7277
28
213
5.142857
0.571429
0.1875
0.180556
0
0
0
0
0
0
0
0
0
0.206573
213
10
58
21.3
0.852071
0
0
0
0
0
0.049261
0
0
0
0
0
0
1
0
false
0.125
0.25
0
0.25
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
ef2f2bec941a91a819b1acafd9b73a6d02d15c62
64
py
Python
test25.py
JarkJiao/Python_learning_TestCase
cc77a7a20b01e230e0edd818532570a7d8853b03
[ "MIT" ]
null
null
null
test25.py
JarkJiao/Python_learning_TestCase
cc77a7a20b01e230e0edd818532570a7d8853b03
[ "MIT" ]
null
null
null
test25.py
JarkJiao/Python_learning_TestCase
cc77a7a20b01e230e0edd818532570a7d8853b03
[ "MIT" ]
null
null
null
s=0 t=1 for n in range(1,21): t *= n s += t print s
5.818182
21
0.4375
16
64
1.75
0.625
0
0
0
0
0
0
0
0
0
0
0.131579
0.40625
64
10
22
6.4
0.605263
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0.166667
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
ef3a3f872dc9a62ee6ede709f7fb68990399415a
259
py
Python
src/ribo_api/serializers/event.py
RinPham/RiBo-Core
8c5a00a215b42aad2f6a4167b9cb97fe11d78823
[ "MIT" ]
null
null
null
src/ribo_api/serializers/event.py
RinPham/RiBo-Core
8c5a00a215b42aad2f6a4167b9cb97fe11d78823
[ "MIT" ]
null
null
null
src/ribo_api/serializers/event.py
RinPham/RiBo-Core
8c5a00a215b42aad2f6a4167b9cb97fe11d78823
[ "MIT" ]
null
null
null
from rest_framework_mongoengine.serializers import DocumentSerializer from ribo_api.models.events import Event from ribo_api.models.task import Task class EventSerializer(DocumentSerializer): class Meta: model = Event fields = '__all__'
25.9
69
0.779923
30
259
6.466667
0.633333
0.082474
0.113402
0.175258
0
0
0
0
0
0
0
0
0.169884
259
10
70
25.9
0.902326
0
0
0
0
0
0.026923
0
0
0
0
0
0
1
0
false
0
0.428571
0
0.714286
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
0
0
1
0
1
0
0
3