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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f6b2a8a44b35922fa37f22ff27c3d61073560129 | 209 | py | Python | tests/core/pyspec/eth2spec/test/utils/__init__.py | jacobkaufmann/consensus-specs | 6d1be4af3d26c31a2dfadb984423ae0fe32b739c | [
"CC0-1.0"
] | 2,161 | 2018-09-20T09:40:27.000Z | 2021-08-17T16:48:29.000Z | tests/core/pyspec/eth2spec/test/utils/__init__.py | jacobkaufmann/consensus-specs | 6d1be4af3d26c31a2dfadb984423ae0fe32b739c | [
"CC0-1.0"
] | 1,573 | 2018-09-22T06:33:19.000Z | 2021-08-18T00:54:44.000Z | tests/core/pyspec/eth2spec/test/utils/__init__.py | jacobkaufmann/consensus-specs | 6d1be4af3d26c31a2dfadb984423ae0fe32b739c | [
"CC0-1.0"
] | 502 | 2018-09-22T04:37:36.000Z | 2021-08-17T09:34:45.000Z | from .utils import (
vector_test,
with_meta_tags,
build_transition_test,
)
__all__ = [ # avoid "unused import" lint error
"vector_test",
"with_meta_tags",
"build_transition_test",
]
| 16.076923 | 47 | 0.669856 | 25 | 209 | 5.04 | 0.6 | 0.15873 | 0.222222 | 0.285714 | 0.650794 | 0.650794 | 0.650794 | 0.650794 | 0 | 0 | 0 | 0 | 0.229665 | 209 | 12 | 48 | 17.416667 | 0.782609 | 0.15311 | 0 | 0 | 0 | 0 | 0.262857 | 0.12 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.1 | 0 | 0.1 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f6d24869e82adbf118e4325a0d70dc3edf2df270 | 295 | py | Python | pjnturtle/__init__.py | RetoKrummenacher/PJNturtle | 2f8603fec2d155d92247305722c7224ed51c6dc6 | [
"BSD-3-Clause"
] | null | null | null | pjnturtle/__init__.py | RetoKrummenacher/PJNturtle | 2f8603fec2d155d92247305722c7224ed51c6dc6 | [
"BSD-3-Clause"
] | null | null | null | pjnturtle/__init__.py | RetoKrummenacher/PJNturtle | 2f8603fec2d155d92247305722c7224ed51c6dc6 | [
"BSD-3-Clause"
] | 1 | 2022-03-16T07:48:55.000Z | 2022-03-16T07:48:55.000Z | # -*- coding: utf-8 -*-
# turtle.py
# Copyright (C) 2022 Reto Krummenacher and contributors
#
# This module is part of PJNturtle and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from pjnturtle.turtle import *
from pjnturtle.common.color import Color
| 26.818182 | 69 | 0.752542 | 43 | 295 | 5.162791 | 0.767442 | 0.09009 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019763 | 0.142373 | 295 | 10 | 70 | 29.5 | 0.857708 | 0.705085 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
f6ed4be10515c1a053cefd4b9e054bce462056ca | 114 | py | Python | backend/bussen/show.py | Daanvdk/duunbox | 7ea3397a48cf34faefb856b511526bffc88598be | [
"MIT"
] | null | null | null | backend/bussen/show.py | Daanvdk/duunbox | 7ea3397a48cf34faefb856b511526bffc88598be | [
"MIT"
] | 5 | 2021-03-30T12:57:03.000Z | 2021-09-22T18:47:27.000Z | backend/bussen/show.py | daanvdk/duunbox | 7ea3397a48cf34faefb856b511526bffc88598be | [
"MIT"
] | null | null | null | def show_state(state, player):
return {
'hands': state['hands'],
'turn': state['turn'],
}
| 19 | 32 | 0.508772 | 12 | 114 | 4.75 | 0.583333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.298246 | 114 | 5 | 33 | 22.8 | 0.7125 | 0 | 0 | 0 | 0 | 0 | 0.157895 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0.2 | 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 | 0 | 1 | 0 | 0 | 0 | 3 |
10042159e3a625c5130046042e56e631aceb33c7 | 1,608 | py | Python | factual/v2/__init__.py | casebeer/factual | f2795a8c9fd447c5d62887ae0f960481ce13be84 | [
"BSD-2-Clause"
] | 4 | 2015-01-02T01:16:52.000Z | 2016-04-05T03:29:32.000Z | factual/v2/__init__.py | casebeer/factual | f2795a8c9fd447c5d62887ae0f960481ce13be84 | [
"BSD-2-Clause"
] | null | null | null | factual/v2/__init__.py | casebeer/factual | f2795a8c9fd447c5d62887ae0f960481ce13be84 | [
"BSD-2-Clause"
] | null | null | null | '''
Factual Server API Wrapper
===========================
This package wraps the Factual "Server" API. Its query style is SQLAlchemy-inspired and designed
to make it easy to build "read" requests by chaining filter calls together.
API actions other than "read" are supported via the same syntax for consistency.
Basic Usage:
from factual import *
from factual.v2.tables import USPOI,USLocalPlaypen
s = Session(api_key="deadbeef")
my_place = s.read(USPOI).search("coffee").run().records()[0]
# you can also build requests one piece at a time:
query = s.read(USPOI)
query.filter({"name": "Foobar"})
if test_address != None:
query.filter({"address": test_address})
response = query.run()
records = response.records()
# limiting categories and using the filter helper functions:
from factual.v2.filter_helpers import *
q = s.read(USPOI).filter(or_(bw_("category", "Food"), bw_("category", "Arts")))
q.search("Foobar")
records = q.run().records()
# geo queries:
coffee_places = s.read(USPOI).search("coffee").within(40.7353,-73.9912,1000).run().records()
# modify a record in the Playpen:
p = s.read(USLocalPlaypen).search("coffee").count(1).run().records()[0]
p['address'] += "/Foobar"
s.input(USLocalPlaypen).values(p).comment("Silly update test").run()
See also the session.Session and requests.Read documentation.
'''
import logging
logging.basicConfig(level=logging.DEBUG)
from session import Session
import filter_helpers
import factual.common.category_helpers as category_helpers
import tables
| 32.16 | 96 | 0.691542 | 218 | 1,608 | 5.045872 | 0.518349 | 0.022727 | 0.036364 | 0.029091 | 0.04 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015683 | 0.167289 | 1,608 | 49 | 97 | 32.816327 | 0.805825 | 0.898632 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.833333 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
10147ffca32398701208489bc420a42426217536 | 1,141 | py | Python | myexample/t7.py | johnson7788/transformers | 005519f2c50851b219d6946ea4d6ef9ec4f87bbc | [
"Apache-2.0"
] | null | null | null | myexample/t7.py | johnson7788/transformers | 005519f2c50851b219d6946ea4d6ef9ec4f87bbc | [
"Apache-2.0"
] | null | null | null | myexample/t7.py | johnson7788/transformers | 005519f2c50851b219d6946ea4d6ef9ec4f87bbc | [
"Apache-2.0"
] | null | null | null | from transformers import pipeline
nlp = pipeline("ner")
sequence = "Hugging Face Inc. is a company based in New York City. Its headquarters are in DUMBO, therefore very"
"close to the Manhattan Bridge which is visible from the window."
print(nlp(sequence))
# [
# {'word': 'Hu', 'score': 0.9995632767677307, 'entity': 'I-ORG'},
# {'word': '##gging', 'score': 0.9915938973426819, 'entity': 'I-ORG'},
# {'word': 'Face', 'score': 0.9982671737670898, 'entity': 'I-ORG'},
# {'word': 'Inc', 'score': 0.9994403719902039, 'entity': 'I-ORG'},
# {'word': 'New', 'score': 0.9994346499443054, 'entity': 'I-LOC'},
# {'word': 'York', 'score': 0.9993270635604858, 'entity': 'I-LOC'},
# {'word': 'City', 'score': 0.9993864893913269, 'entity': 'I-LOC'},
# {'word': 'D', 'score': 0.9825621843338013, 'entity': 'I-LOC'},
# {'word': '##UM', 'score': 0.936983048915863, 'entity': 'I-LOC'},
# {'word': '##BO', 'score': 0.8987102508544922, 'entity': 'I-LOC'},
# {'word': 'Manhattan', 'score': 0.9758241176605225, 'entity': 'I-LOC'},
# {'word': 'Bridge', 'score': 0.990249514579773, 'entity': 'I-LOC'}
# ] | 54.333333 | 113 | 0.591586 | 136 | 1,141 | 4.963235 | 0.419118 | 0.106667 | 0.118519 | 0.145185 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.21174 | 0.163891 | 1,141 | 21 | 114 | 54.333333 | 0.495807 | 0.733567 | 0 | 0 | 0 | 0.2 | 0.584507 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.2 | null | null | 0.2 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
63d9e9cade04c4a5f9df85522e03374a1b0582e2 | 278 | py | Python | amazon_scraper/main/forms.py | RNostrand/Amazon-Price-Tracker | f425027aa80e22c5891fc3d14ff7880b74b30ddf | [
"MIT"
] | null | null | null | amazon_scraper/main/forms.py | RNostrand/Amazon-Price-Tracker | f425027aa80e22c5891fc3d14ff7880b74b30ddf | [
"MIT"
] | null | null | null | amazon_scraper/main/forms.py | RNostrand/Amazon-Price-Tracker | f425027aa80e22c5891fc3d14ff7880b74b30ddf | [
"MIT"
] | null | null | null | from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, TextAreaField
from wtforms.validators import DataRequired
class SearchForm(FlaskForm):
search = StringField("Search for an Item", validators=[DataRequired()])
submit = SubmitField("Search")
| 30.888889 | 75 | 0.791367 | 30 | 278 | 7.3 | 0.6 | 0.100457 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129496 | 278 | 8 | 76 | 34.75 | 0.904959 | 0 | 0 | 0 | 0 | 0 | 0.086331 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
63dd498a671fbe8b97288527bdadaa4664e61e44 | 160 | py | Python | wideresnet/keras/__init__.py | paradoxysm/wideresnet | 43fae6426ccc12ede30eb8c917b211254d5fc42d | [
"BSD-3-Clause"
] | 1 | 2022-02-26T13:15:59.000Z | 2022-02-26T13:15:59.000Z | wideresnet/keras/__init__.py | paradoxysm/wideresnet | 43fae6426ccc12ede30eb8c917b211254d5fc42d | [
"BSD-3-Clause"
] | null | null | null | wideresnet/keras/__init__.py | paradoxysm/wideresnet | 43fae6426ccc12ede30eb8c917b211254d5fc42d | [
"BSD-3-Clause"
] | null | null | null | from ._kaiming_normal import KaimingNormal
from ._sgd import SGDtorch
from .model import WideResNet
__all__ = [
'KaimingNormal',
'SGDtorch',
'WideResNet'
]
| 16 | 42 | 0.76875 | 17 | 160 | 6.823529 | 0.588235 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.14375 | 160 | 9 | 43 | 17.777778 | 0.846715 | 0 | 0 | 0 | 0 | 0 | 0.19375 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.375 | 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 |
63e896fbeaec53eff3c32cb2d0b4dc585f1897c8 | 469 | py | Python | tests/test_fetch_check_aux.py | ffreemt/align-model-pool | aebf065ac41b182e112b0444aacce3f8a947c595 | [
"MIT"
] | null | null | null | tests/test_fetch_check_aux.py | ffreemt/align-model-pool | aebf065ac41b182e112b0444aacce3f8a947c595 | [
"MIT"
] | null | null | null | tests/test_fetch_check_aux.py | ffreemt/align-model-pool | aebf065ac41b182e112b0444aacce3f8a947c595 | [
"MIT"
] | null | null | null | """Test fetch_check_aux."""
# from model_pool import fetch_check_aux
from model_pool.fetch_check_aux import fetch_check_aux
from logzero import logger
def test_fetch_check_aux1():
"""Test fetch_check_aux 1"""
try:
res = fetch_check_aux("/root")
except PermissionError:
# may not be able to write to /root
# write to ~
res = fetch_check_aux()
except Exception:
logger.exception("")
raise
assert res
| 23.45 | 54 | 0.663113 | 64 | 469 | 4.5625 | 0.421875 | 0.273973 | 0.311644 | 0.174658 | 0.277397 | 0.178082 | 0 | 0 | 0 | 0 | 0 | 0.005714 | 0.253731 | 469 | 19 | 55 | 24.684211 | 0.828571 | 0.275053 | 0 | 0 | 0 | 0 | 0.015291 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 1 | 0.090909 | false | 0 | 0.181818 | 0 | 0.272727 | 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 |
63ec1e58c769aca8e558ed50bd1104f36f854aff | 1,194 | py | Python | Scripts/simulation/services/object_routing_service.py | velocist/TS4CheatsInfo | b59ea7e5f4bd01d3b3bd7603843d525a9c179867 | [
"Apache-2.0"
] | null | null | null | Scripts/simulation/services/object_routing_service.py | velocist/TS4CheatsInfo | b59ea7e5f4bd01d3b3bd7603843d525a9c179867 | [
"Apache-2.0"
] | null | null | null | Scripts/simulation/services/object_routing_service.py | velocist/TS4CheatsInfo | b59ea7e5f4bd01d3b3bd7603843d525a9c179867 | [
"Apache-2.0"
] | null | null | null | # uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\services\object_routing_service.py
# Compiled at: 2019-07-27 01:18:42
# Size of source mod 2**32: 1294 bytes
from _weakrefset import WeakSet
from event_testing.register_test_event_mixin import RegisterTestEventMixin
from sims4.service_manager import Service
from _collections import defaultdict
class ObjectRoutingService(RegisterTestEventMixin, Service):
def __init__(self, *args, **kwargs):
(super().__init__)(*args, **kwargs)
self._active_objects = defaultdict(WeakSet)
def on_routing_start(self, obj, tracking_category, behavior):
self._active_objects[tracking_category].add(obj)
def on_routing_stop(self, obj, tracking_category):
self._active_objects[tracking_category].remove(obj)
def get_routing_object_set(self, tracking_category):
return self._active_objects[tracking_category]
def get_routing_object_count(self, tracking_category):
return len(self.get_routing_object_set(tracking_category)) | 42.642857 | 107 | 0.767169 | 165 | 1,194 | 5.272727 | 0.545455 | 0.147126 | 0.078161 | 0.086207 | 0.113793 | 0 | 0 | 0 | 0 | 0 | 0 | 0.064078 | 0.137353 | 1,194 | 28 | 108 | 42.642857 | 0.780583 | 0.264657 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3125 | false | 0 | 0.25 | 0.125 | 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 |
63f339e9d0f0046c693cfae602537dc3efce3819 | 28,713 | py | Python | sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 8 | 2021-01-13T23:44:08.000Z | 2021-03-17T10:13:36.000Z | sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 226 | 2019-07-24T07:57:21.000Z | 2019-10-15T01:07:24.000Z | sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 2 | 2021-05-23T16:46:31.000Z | 2021-05-26T23:51:09.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
try:
from ._models_py3 import AccessInformationContract
from ._models_py3 import AccessInformationUpdateParameters
from ._models_py3 import AdditionalLocation
from ._models_py3 import ApiContract
from ._models_py3 import ApiContractProperties
from ._models_py3 import ApiCreateOrUpdateParameter
from ._models_py3 import ApiCreateOrUpdatePropertiesWsdlSelector
from ._models_py3 import ApiEntityBaseContract
from ._models_py3 import ApiExportResult
from ._models_py3 import ApiExportResultValue
from ._models_py3 import ApiManagementServiceApplyNetworkConfigurationParameters
from ._models_py3 import ApiManagementServiceBackupRestoreParameters
from ._models_py3 import ApiManagementServiceBaseProperties
from ._models_py3 import ApiManagementServiceCheckNameAvailabilityParameters
from ._models_py3 import ApiManagementServiceGetSsoTokenResult
from ._models_py3 import ApiManagementServiceIdentity
from ._models_py3 import ApiManagementServiceNameAvailabilityResult
from ._models_py3 import ApiManagementServiceResource
from ._models_py3 import ApiManagementServiceSkuProperties
from ._models_py3 import ApiManagementServiceUpdateParameters
from ._models_py3 import ApimResource
from ._models_py3 import ApiReleaseContract
from ._models_py3 import ApiRevisionContract
from ._models_py3 import ApiRevisionInfoContract
from ._models_py3 import ApiTagResourceContractProperties
from ._models_py3 import ApiUpdateContract
from ._models_py3 import ApiVersionConstraint
from ._models_py3 import ApiVersionSetContract
from ._models_py3 import ApiVersionSetContractDetails
from ._models_py3 import ApiVersionSetEntityBase
from ._models_py3 import ApiVersionSetUpdateParameters
from ._models_py3 import AssociationContract
from ._models_py3 import AuthenticationSettingsContract
from ._models_py3 import AuthorizationServerContract
from ._models_py3 import AuthorizationServerContractBaseProperties
from ._models_py3 import AuthorizationServerUpdateContract
from ._models_py3 import BackendAuthorizationHeaderCredentials
from ._models_py3 import BackendBaseParameters
from ._models_py3 import BackendContract
from ._models_py3 import BackendCredentialsContract
from ._models_py3 import BackendProperties
from ._models_py3 import BackendProxyContract
from ._models_py3 import BackendReconnectContract
from ._models_py3 import BackendServiceFabricClusterProperties
from ._models_py3 import BackendTlsProperties
from ._models_py3 import BackendUpdateParameters
from ._models_py3 import BodyDiagnosticSettings
from ._models_py3 import CacheContract
from ._models_py3 import CacheUpdateParameters
from ._models_py3 import CertificateConfiguration
from ._models_py3 import CertificateContract
from ._models_py3 import CertificateCreateOrUpdateParameters
from ._models_py3 import CertificateInformation
from ._models_py3 import ClientSecretContract
from ._models_py3 import ConnectivityStatusContract
from ._models_py3 import DeployConfigurationParameters
from ._models_py3 import DiagnosticContract
from ._models_py3 import EmailTemplateContract
from ._models_py3 import EmailTemplateParametersContractProperties
from ._models_py3 import EmailTemplateUpdateParameters
from ._models_py3 import ErrorFieldContract
from ._models_py3 import ErrorResponse, ErrorResponseException
from ._models_py3 import ErrorResponseBody
from ._models_py3 import GatewayContract
from ._models_py3 import GatewayHostnameConfigurationContract
from ._models_py3 import GatewayKeyRegenerationRequestContract
from ._models_py3 import GatewayKeysContract
from ._models_py3 import GatewayTokenContract
from ._models_py3 import GatewayTokenRequestContract
from ._models_py3 import GenerateSsoUrlResult
from ._models_py3 import GroupContract
from ._models_py3 import GroupContractProperties
from ._models_py3 import GroupCreateParameters
from ._models_py3 import GroupUpdateParameters
from ._models_py3 import HostnameConfiguration
from ._models_py3 import HttpMessageDiagnostic
from ._models_py3 import IdentityProviderBaseParameters
from ._models_py3 import IdentityProviderContract
from ._models_py3 import IdentityProviderCreateContract
from ._models_py3 import IdentityProviderUpdateParameters
from ._models_py3 import IssueAttachmentContract
from ._models_py3 import IssueCommentContract
from ._models_py3 import IssueContract
from ._models_py3 import IssueContractBaseProperties
from ._models_py3 import IssueUpdateContract
from ._models_py3 import LoggerContract
from ._models_py3 import LoggerUpdateContract
from ._models_py3 import NamedValueContract
from ._models_py3 import NamedValueCreateContract
from ._models_py3 import NamedValueEntityBaseParameters
from ._models_py3 import NamedValueUpdateParameters
from ._models_py3 import NetworkStatusContract
from ._models_py3 import NetworkStatusContractByLocation
from ._models_py3 import NotificationContract
from ._models_py3 import OAuth2AuthenticationSettingsContract
from ._models_py3 import OpenIdAuthenticationSettingsContract
from ._models_py3 import OpenidConnectProviderContract
from ._models_py3 import OpenidConnectProviderUpdateContract
from ._models_py3 import Operation
from ._models_py3 import OperationContract
from ._models_py3 import OperationDisplay
from ._models_py3 import OperationEntityBaseContract
from ._models_py3 import OperationResultContract
from ._models_py3 import OperationResultLogItemContract
from ._models_py3 import OperationTagResourceContractProperties
from ._models_py3 import OperationUpdateContract
from ._models_py3 import ParameterContract
from ._models_py3 import PipelineDiagnosticSettings
from ._models_py3 import PolicyCollection
from ._models_py3 import PolicyContract
from ._models_py3 import PolicyDescriptionCollection
from ._models_py3 import PolicyDescriptionContract
from ._models_py3 import PortalDelegationSettings
from ._models_py3 import PortalSettingValidationKeyContract
from ._models_py3 import PortalSigninSettings
from ._models_py3 import PortalSignupSettings
from ._models_py3 import ProductContract
from ._models_py3 import ProductEntityBaseParameters
from ._models_py3 import ProductTagResourceContractProperties
from ._models_py3 import ProductUpdateParameters
from ._models_py3 import PropertyValueContract
from ._models_py3 import QuotaCounterCollection
from ._models_py3 import QuotaCounterContract
from ._models_py3 import QuotaCounterValueContract
from ._models_py3 import QuotaCounterValueContractProperties
from ._models_py3 import RecipientEmailCollection
from ._models_py3 import RecipientEmailContract
from ._models_py3 import RecipientsContractProperties
from ._models_py3 import RecipientUserCollection
from ._models_py3 import RecipientUserContract
from ._models_py3 import RegionContract
from ._models_py3 import RegistrationDelegationSettingsProperties
from ._models_py3 import ReportRecordContract
from ._models_py3 import RepresentationContract
from ._models_py3 import RequestContract
from ._models_py3 import RequestReportRecordContract
from ._models_py3 import Resource
from ._models_py3 import ResourceLocationDataContract
from ._models_py3 import ResourceSku
from ._models_py3 import ResourceSkuCapacity
from ._models_py3 import ResourceSkuResult
from ._models_py3 import ResponseContract
from ._models_py3 import SamplingSettings
from ._models_py3 import SaveConfigurationParameter
from ._models_py3 import SchemaContract
from ._models_py3 import SubscriptionContract
from ._models_py3 import SubscriptionCreateParameters
from ._models_py3 import SubscriptionKeyParameterNamesContract
from ._models_py3 import SubscriptionKeysContract
from ._models_py3 import SubscriptionsDelegationSettingsProperties
from ._models_py3 import SubscriptionUpdateParameters
from ._models_py3 import TagContract
from ._models_py3 import TagCreateUpdateParameters
from ._models_py3 import TagDescriptionContract
from ._models_py3 import TagDescriptionCreateParameters
from ._models_py3 import TagResourceContract
from ._models_py3 import TagTagResourceContractProperties
from ._models_py3 import TenantConfigurationSyncStateContract
from ._models_py3 import TermsOfServiceProperties
from ._models_py3 import TokenBodyParameterContract
from ._models_py3 import UserContract
from ._models_py3 import UserCreateParameters
from ._models_py3 import UserEntityBaseParameters
from ._models_py3 import UserIdentityContract
from ._models_py3 import UserIdentityProperties
from ._models_py3 import UserTokenParameters
from ._models_py3 import UserTokenResult
from ._models_py3 import UserUpdateParameters
from ._models_py3 import VirtualNetworkConfiguration
from ._models_py3 import X509CertificateName
except (SyntaxError, ImportError):
from ._models import AccessInformationContract
from ._models import AccessInformationUpdateParameters
from ._models import AdditionalLocation
from ._models import ApiContract
from ._models import ApiContractProperties
from ._models import ApiCreateOrUpdateParameter
from ._models import ApiCreateOrUpdatePropertiesWsdlSelector
from ._models import ApiEntityBaseContract
from ._models import ApiExportResult
from ._models import ApiExportResultValue
from ._models import ApiManagementServiceApplyNetworkConfigurationParameters
from ._models import ApiManagementServiceBackupRestoreParameters
from ._models import ApiManagementServiceBaseProperties
from ._models import ApiManagementServiceCheckNameAvailabilityParameters
from ._models import ApiManagementServiceGetSsoTokenResult
from ._models import ApiManagementServiceIdentity
from ._models import ApiManagementServiceNameAvailabilityResult
from ._models import ApiManagementServiceResource
from ._models import ApiManagementServiceSkuProperties
from ._models import ApiManagementServiceUpdateParameters
from ._models import ApimResource
from ._models import ApiReleaseContract
from ._models import ApiRevisionContract
from ._models import ApiRevisionInfoContract
from ._models import ApiTagResourceContractProperties
from ._models import ApiUpdateContract
from ._models import ApiVersionConstraint
from ._models import ApiVersionSetContract
from ._models import ApiVersionSetContractDetails
from ._models import ApiVersionSetEntityBase
from ._models import ApiVersionSetUpdateParameters
from ._models import AssociationContract
from ._models import AuthenticationSettingsContract
from ._models import AuthorizationServerContract
from ._models import AuthorizationServerContractBaseProperties
from ._models import AuthorizationServerUpdateContract
from ._models import BackendAuthorizationHeaderCredentials
from ._models import BackendBaseParameters
from ._models import BackendContract
from ._models import BackendCredentialsContract
from ._models import BackendProperties
from ._models import BackendProxyContract
from ._models import BackendReconnectContract
from ._models import BackendServiceFabricClusterProperties
from ._models import BackendTlsProperties
from ._models import BackendUpdateParameters
from ._models import BodyDiagnosticSettings
from ._models import CacheContract
from ._models import CacheUpdateParameters
from ._models import CertificateConfiguration
from ._models import CertificateContract
from ._models import CertificateCreateOrUpdateParameters
from ._models import CertificateInformation
from ._models import ClientSecretContract
from ._models import ConnectivityStatusContract
from ._models import DeployConfigurationParameters
from ._models import DiagnosticContract
from ._models import EmailTemplateContract
from ._models import EmailTemplateParametersContractProperties
from ._models import EmailTemplateUpdateParameters
from ._models import ErrorFieldContract
from ._models import ErrorResponse, ErrorResponseException
from ._models import ErrorResponseBody
from ._models import GatewayContract
from ._models import GatewayHostnameConfigurationContract
from ._models import GatewayKeyRegenerationRequestContract
from ._models import GatewayKeysContract
from ._models import GatewayTokenContract
from ._models import GatewayTokenRequestContract
from ._models import GenerateSsoUrlResult
from ._models import GroupContract
from ._models import GroupContractProperties
from ._models import GroupCreateParameters
from ._models import GroupUpdateParameters
from ._models import HostnameConfiguration
from ._models import HttpMessageDiagnostic
from ._models import IdentityProviderBaseParameters
from ._models import IdentityProviderContract
from ._models import IdentityProviderCreateContract
from ._models import IdentityProviderUpdateParameters
from ._models import IssueAttachmentContract
from ._models import IssueCommentContract
from ._models import IssueContract
from ._models import IssueContractBaseProperties
from ._models import IssueUpdateContract
from ._models import LoggerContract
from ._models import LoggerUpdateContract
from ._models import NamedValueContract
from ._models import NamedValueCreateContract
from ._models import NamedValueEntityBaseParameters
from ._models import NamedValueUpdateParameters
from ._models import NetworkStatusContract
from ._models import NetworkStatusContractByLocation
from ._models import NotificationContract
from ._models import OAuth2AuthenticationSettingsContract
from ._models import OpenIdAuthenticationSettingsContract
from ._models import OpenidConnectProviderContract
from ._models import OpenidConnectProviderUpdateContract
from ._models import Operation
from ._models import OperationContract
from ._models import OperationDisplay
from ._models import OperationEntityBaseContract
from ._models import OperationResultContract
from ._models import OperationResultLogItemContract
from ._models import OperationTagResourceContractProperties
from ._models import OperationUpdateContract
from ._models import ParameterContract
from ._models import PipelineDiagnosticSettings
from ._models import PolicyCollection
from ._models import PolicyContract
from ._models import PolicyDescriptionCollection
from ._models import PolicyDescriptionContract
from ._models import PortalDelegationSettings
from ._models import PortalSettingValidationKeyContract
from ._models import PortalSigninSettings
from ._models import PortalSignupSettings
from ._models import ProductContract
from ._models import ProductEntityBaseParameters
from ._models import ProductTagResourceContractProperties
from ._models import ProductUpdateParameters
from ._models import PropertyValueContract
from ._models import QuotaCounterCollection
from ._models import QuotaCounterContract
from ._models import QuotaCounterValueContract
from ._models import QuotaCounterValueContractProperties
from ._models import RecipientEmailCollection
from ._models import RecipientEmailContract
from ._models import RecipientsContractProperties
from ._models import RecipientUserCollection
from ._models import RecipientUserContract
from ._models import RegionContract
from ._models import RegistrationDelegationSettingsProperties
from ._models import ReportRecordContract
from ._models import RepresentationContract
from ._models import RequestContract
from ._models import RequestReportRecordContract
from ._models import Resource
from ._models import ResourceLocationDataContract
from ._models import ResourceSku
from ._models import ResourceSkuCapacity
from ._models import ResourceSkuResult
from ._models import ResponseContract
from ._models import SamplingSettings
from ._models import SaveConfigurationParameter
from ._models import SchemaContract
from ._models import SubscriptionContract
from ._models import SubscriptionCreateParameters
from ._models import SubscriptionKeyParameterNamesContract
from ._models import SubscriptionKeysContract
from ._models import SubscriptionsDelegationSettingsProperties
from ._models import SubscriptionUpdateParameters
from ._models import TagContract
from ._models import TagCreateUpdateParameters
from ._models import TagDescriptionContract
from ._models import TagDescriptionCreateParameters
from ._models import TagResourceContract
from ._models import TagTagResourceContractProperties
from ._models import TenantConfigurationSyncStateContract
from ._models import TermsOfServiceProperties
from ._models import TokenBodyParameterContract
from ._models import UserContract
from ._models import UserCreateParameters
from ._models import UserEntityBaseParameters
from ._models import UserIdentityContract
from ._models import UserIdentityProperties
from ._models import UserTokenParameters
from ._models import UserTokenResult
from ._models import UserUpdateParameters
from ._models import VirtualNetworkConfiguration
from ._models import X509CertificateName
from ._paged_models import ApiContractPaged
from ._paged_models import ApiManagementServiceResourcePaged
from ._paged_models import ApiReleaseContractPaged
from ._paged_models import ApiRevisionContractPaged
from ._paged_models import ApiVersionSetContractPaged
from ._paged_models import AuthorizationServerContractPaged
from ._paged_models import BackendContractPaged
from ._paged_models import CacheContractPaged
from ._paged_models import CertificateContractPaged
from ._paged_models import DiagnosticContractPaged
from ._paged_models import EmailTemplateContractPaged
from ._paged_models import GatewayContractPaged
from ._paged_models import GatewayHostnameConfigurationContractPaged
from ._paged_models import GroupContractPaged
from ._paged_models import IdentityProviderContractPaged
from ._paged_models import IssueAttachmentContractPaged
from ._paged_models import IssueCommentContractPaged
from ._paged_models import IssueContractPaged
from ._paged_models import LoggerContractPaged
from ._paged_models import NamedValueContractPaged
from ._paged_models import NotificationContractPaged
from ._paged_models import OpenidConnectProviderContractPaged
from ._paged_models import OperationContractPaged
from ._paged_models import OperationPaged
from ._paged_models import ProductContractPaged
from ._paged_models import RegionContractPaged
from ._paged_models import ReportRecordContractPaged
from ._paged_models import RequestReportRecordContractPaged
from ._paged_models import ResourceSkuResultPaged
from ._paged_models import SchemaContractPaged
from ._paged_models import SubscriptionContractPaged
from ._paged_models import TagContractPaged
from ._paged_models import TagDescriptionContractPaged
from ._paged_models import TagResourceContractPaged
from ._paged_models import UserContractPaged
from ._paged_models import UserIdentityContractPaged
from ._api_management_client_enums import (
ExportResultFormat,
ProductState,
BearerTokenSendingMethods,
Protocol,
ContentFormat,
SoapApiType,
ApiType,
State,
SamplingType,
AlwaysLog,
HttpCorrelationProtocol,
Verbosity,
PolicyContentFormat,
VersioningScheme,
GrantType,
AuthorizationMethod,
ClientAuthenticationMethod,
BearerTokenSendingMethod,
BackendProtocol,
SkuType,
ResourceSkuCapacityScaleType,
HostnameType,
VirtualNetworkType,
ApimIdentityType,
NameAvailabilityReason,
ProvisioningState,
KeyType,
AppType,
Confirmation,
UserState,
GroupType,
IdentityProviderType,
LoggerType,
ConnectivityStatusType,
SubscriptionState,
AsyncOperationStatus,
NotificationName,
PolicyExportFormat,
TemplateName,
PolicyScopeContract,
ExportFormat,
)
__all__ = [
'AccessInformationContract',
'AccessInformationUpdateParameters',
'AdditionalLocation',
'ApiContract',
'ApiContractProperties',
'ApiCreateOrUpdateParameter',
'ApiCreateOrUpdatePropertiesWsdlSelector',
'ApiEntityBaseContract',
'ApiExportResult',
'ApiExportResultValue',
'ApiManagementServiceApplyNetworkConfigurationParameters',
'ApiManagementServiceBackupRestoreParameters',
'ApiManagementServiceBaseProperties',
'ApiManagementServiceCheckNameAvailabilityParameters',
'ApiManagementServiceGetSsoTokenResult',
'ApiManagementServiceIdentity',
'ApiManagementServiceNameAvailabilityResult',
'ApiManagementServiceResource',
'ApiManagementServiceSkuProperties',
'ApiManagementServiceUpdateParameters',
'ApimResource',
'ApiReleaseContract',
'ApiRevisionContract',
'ApiRevisionInfoContract',
'ApiTagResourceContractProperties',
'ApiUpdateContract',
'ApiVersionConstraint',
'ApiVersionSetContract',
'ApiVersionSetContractDetails',
'ApiVersionSetEntityBase',
'ApiVersionSetUpdateParameters',
'AssociationContract',
'AuthenticationSettingsContract',
'AuthorizationServerContract',
'AuthorizationServerContractBaseProperties',
'AuthorizationServerUpdateContract',
'BackendAuthorizationHeaderCredentials',
'BackendBaseParameters',
'BackendContract',
'BackendCredentialsContract',
'BackendProperties',
'BackendProxyContract',
'BackendReconnectContract',
'BackendServiceFabricClusterProperties',
'BackendTlsProperties',
'BackendUpdateParameters',
'BodyDiagnosticSettings',
'CacheContract',
'CacheUpdateParameters',
'CertificateConfiguration',
'CertificateContract',
'CertificateCreateOrUpdateParameters',
'CertificateInformation',
'ClientSecretContract',
'ConnectivityStatusContract',
'DeployConfigurationParameters',
'DiagnosticContract',
'EmailTemplateContract',
'EmailTemplateParametersContractProperties',
'EmailTemplateUpdateParameters',
'ErrorFieldContract',
'ErrorResponse', 'ErrorResponseException',
'ErrorResponseBody',
'GatewayContract',
'GatewayHostnameConfigurationContract',
'GatewayKeyRegenerationRequestContract',
'GatewayKeysContract',
'GatewayTokenContract',
'GatewayTokenRequestContract',
'GenerateSsoUrlResult',
'GroupContract',
'GroupContractProperties',
'GroupCreateParameters',
'GroupUpdateParameters',
'HostnameConfiguration',
'HttpMessageDiagnostic',
'IdentityProviderBaseParameters',
'IdentityProviderContract',
'IdentityProviderCreateContract',
'IdentityProviderUpdateParameters',
'IssueAttachmentContract',
'IssueCommentContract',
'IssueContract',
'IssueContractBaseProperties',
'IssueUpdateContract',
'LoggerContract',
'LoggerUpdateContract',
'NamedValueContract',
'NamedValueCreateContract',
'NamedValueEntityBaseParameters',
'NamedValueUpdateParameters',
'NetworkStatusContract',
'NetworkStatusContractByLocation',
'NotificationContract',
'OAuth2AuthenticationSettingsContract',
'OpenIdAuthenticationSettingsContract',
'OpenidConnectProviderContract',
'OpenidConnectProviderUpdateContract',
'Operation',
'OperationContract',
'OperationDisplay',
'OperationEntityBaseContract',
'OperationResultContract',
'OperationResultLogItemContract',
'OperationTagResourceContractProperties',
'OperationUpdateContract',
'ParameterContract',
'PipelineDiagnosticSettings',
'PolicyCollection',
'PolicyContract',
'PolicyDescriptionCollection',
'PolicyDescriptionContract',
'PortalDelegationSettings',
'PortalSettingValidationKeyContract',
'PortalSigninSettings',
'PortalSignupSettings',
'ProductContract',
'ProductEntityBaseParameters',
'ProductTagResourceContractProperties',
'ProductUpdateParameters',
'PropertyValueContract',
'QuotaCounterCollection',
'QuotaCounterContract',
'QuotaCounterValueContract',
'QuotaCounterValueContractProperties',
'RecipientEmailCollection',
'RecipientEmailContract',
'RecipientsContractProperties',
'RecipientUserCollection',
'RecipientUserContract',
'RegionContract',
'RegistrationDelegationSettingsProperties',
'ReportRecordContract',
'RepresentationContract',
'RequestContract',
'RequestReportRecordContract',
'Resource',
'ResourceLocationDataContract',
'ResourceSku',
'ResourceSkuCapacity',
'ResourceSkuResult',
'ResponseContract',
'SamplingSettings',
'SaveConfigurationParameter',
'SchemaContract',
'SubscriptionContract',
'SubscriptionCreateParameters',
'SubscriptionKeyParameterNamesContract',
'SubscriptionKeysContract',
'SubscriptionsDelegationSettingsProperties',
'SubscriptionUpdateParameters',
'TagContract',
'TagCreateUpdateParameters',
'TagDescriptionContract',
'TagDescriptionCreateParameters',
'TagResourceContract',
'TagTagResourceContractProperties',
'TenantConfigurationSyncStateContract',
'TermsOfServiceProperties',
'TokenBodyParameterContract',
'UserContract',
'UserCreateParameters',
'UserEntityBaseParameters',
'UserIdentityContract',
'UserIdentityProperties',
'UserTokenParameters',
'UserTokenResult',
'UserUpdateParameters',
'VirtualNetworkConfiguration',
'X509CertificateName',
'ApiContractPaged',
'TagResourceContractPaged',
'ApiRevisionContractPaged',
'ApiReleaseContractPaged',
'OperationContractPaged',
'TagContractPaged',
'ProductContractPaged',
'SchemaContractPaged',
'DiagnosticContractPaged',
'IssueContractPaged',
'IssueCommentContractPaged',
'IssueAttachmentContractPaged',
'TagDescriptionContractPaged',
'ApiVersionSetContractPaged',
'AuthorizationServerContractPaged',
'BackendContractPaged',
'CacheContractPaged',
'CertificateContractPaged',
'OperationPaged',
'ResourceSkuResultPaged',
'ApiManagementServiceResourcePaged',
'EmailTemplateContractPaged',
'GatewayContractPaged',
'GatewayHostnameConfigurationContractPaged',
'GroupContractPaged',
'UserContractPaged',
'IdentityProviderContractPaged',
'LoggerContractPaged',
'NamedValueContractPaged',
'NotificationContractPaged',
'OpenidConnectProviderContractPaged',
'SubscriptionContractPaged',
'RegionContractPaged',
'ReportRecordContractPaged',
'RequestReportRecordContractPaged',
'UserIdentityContractPaged',
'ExportResultFormat',
'ProductState',
'BearerTokenSendingMethods',
'Protocol',
'ContentFormat',
'SoapApiType',
'ApiType',
'State',
'SamplingType',
'AlwaysLog',
'HttpCorrelationProtocol',
'Verbosity',
'PolicyContentFormat',
'VersioningScheme',
'GrantType',
'AuthorizationMethod',
'ClientAuthenticationMethod',
'BearerTokenSendingMethod',
'BackendProtocol',
'SkuType',
'ResourceSkuCapacityScaleType',
'HostnameType',
'VirtualNetworkType',
'ApimIdentityType',
'NameAvailabilityReason',
'ProvisioningState',
'KeyType',
'AppType',
'Confirmation',
'UserState',
'GroupType',
'IdentityProviderType',
'LoggerType',
'ConnectivityStatusType',
'SubscriptionState',
'AsyncOperationStatus',
'NotificationName',
'PolicyExportFormat',
'TemplateName',
'PolicyScopeContract',
'ExportFormat',
]
| 42.039531 | 84 | 0.800683 | 2,059 | 28,713 | 10.879068 | 0.146187 | 0.151786 | 0.098661 | 0.144196 | 0.059018 | 0.054464 | 0.054464 | 0.054464 | 0.054464 | 0.054464 | 0 | 0.00752 | 0.152474 | 28,713 | 682 | 85 | 42.101173 | 0.912965 | 0.015742 | 0 | 0 | 0 | 0 | 0.198726 | 0.137381 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.564179 | 0 | 0.564179 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
121fcfa55a97359635e26cb0a9822bbde202305a | 275 | py | Python | book/admin.py | ShanghaitechGeekPie/bookshelf | bc3469ecbb44723bb28ccaaccee60d211ca3f94a | [
"Apache-2.0"
] | 1 | 2018-06-27T14:00:02.000Z | 2018-06-27T14:00:02.000Z | book/admin.py | ShanghaitechGeekPie/bookshelf | bc3469ecbb44723bb28ccaaccee60d211ca3f94a | [
"Apache-2.0"
] | 1 | 2018-12-28T06:45:48.000Z | 2018-12-28T06:45:48.000Z | book/admin.py | ShanghaitechGeekPie/bookshelf | bc3469ecbb44723bb28ccaaccee60d211ca3f94a | [
"Apache-2.0"
] | 2 | 2018-07-09T11:16:05.000Z | 2019-04-17T10:00:44.000Z | from django.contrib import admin
from .models import *
admin.site.register(Book)
admin.site.register(BorrowRecord)
admin.site.register(DevoteRecord)
# Register your models here.
class BookAdmin(admin.ModelAdmin):
list_display = ['borrow_date', 'begin_time', 'end_time']
| 27.5 | 60 | 0.781818 | 36 | 275 | 5.861111 | 0.638889 | 0.127962 | 0.241706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101818 | 275 | 9 | 61 | 30.555556 | 0.854251 | 0.094545 | 0 | 0 | 0 | 0 | 0.117409 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
122e119dae034692f0ca43f87d175a9e3c436773 | 580 | py | Python | pygpseq/__init__.py | BiCroLab/pygpseq | e6c61f0aab39b4750c0cb97e1bfd2aca81afdd7e | [
"MIT"
] | null | null | null | pygpseq/__init__.py | BiCroLab/pygpseq | e6c61f0aab39b4750c0cb97e1bfd2aca81afdd7e | [
"MIT"
] | null | null | null | pygpseq/__init__.py | BiCroLab/pygpseq | e6c61f0aab39b4750c0cb97e1bfd2aca81afdd7e | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
'''
@author: Gabriele Girelli
@email: gigi.ga90@gmail.com
@description: pygpseq package.
'''
# DEPENDENCIES =================================================================
__all__ = ['jinja2', 'joblib', 'matplotlib', 'numpy', 'pandas', 'pickle',
'scipy', 'skimage', 'weasyprint']
import os
import time
from joblib import Parallel, delayed
from pygpseq import anim, const, fish, tools
# END ==========================================================================
################################################################################ | 25.217391 | 80 | 0.42069 | 42 | 580 | 5.714286 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007648 | 0.098276 | 580 | 23 | 81 | 25.217391 | 0.451243 | 0.456897 | 0 | 0 | 0 | 0 | 0.269912 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0.166667 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
124e0364e15389ae17d1c005e799d27530491268 | 566 | py | Python | agiletoolkit/github/__init__.py | quantmind/agile-toolkit | 6c0cd1b846fa205f9e44a9034ef9b45655b613b6 | [
"BSD-3-Clause"
] | null | null | null | agiletoolkit/github/__init__.py | quantmind/agile-toolkit | 6c0cd1b846fa205f9e44a9034ef9b45655b613b6 | [
"BSD-3-Clause"
] | 9 | 2019-02-19T15:10:44.000Z | 2020-08-03T14:29:41.000Z | agiletoolkit/github/__init__.py | quantmind/agile-toolkit | 6c0cd1b846fa205f9e44a9034ef9b45655b613b6 | [
"BSD-3-Clause"
] | null | null | null | import click
from .info import auth, info
from .labels import labels
from .milestones import milestones
from .release import release
from .remote import remote
from .validate import validate
@click.group(invoke_without_command=True)
@click.pass_context
def git(ctx):
"""Github client command repo management
"""
if not ctx.invoked_subcommand:
click.echo(ctx.get_help())
git.add_command(info)
git.add_command(auth)
git.add_command(labels)
git.add_command(milestones)
git.add_command(release)
git.add_command(remote)
git.add_command(validate)
| 20.962963 | 44 | 0.779152 | 82 | 566 | 5.231707 | 0.390244 | 0.097902 | 0.212121 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128975 | 566 | 26 | 45 | 21.769231 | 0.870183 | 0.065371 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | false | 0.052632 | 0.368421 | 0 | 0.421053 | 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 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
89cc2943e2f164f52b49022bd1b2bf30d488891a | 993 | py | Python | anthill/platform/api/rest/handlers/list.py | 0x55AAh/anthill_gaming | 475af798bd08d85fc0fbfce9d2ba710f73252c15 | [
"MIT"
] | 1 | 2018-11-30T21:56:14.000Z | 2018-11-30T21:56:14.000Z | anthill/platform/api/rest/handlers/list.py | 0x55AAh/anthill_gaming | 475af798bd08d85fc0fbfce9d2ba710f73252c15 | [
"MIT"
] | null | null | null | anthill/platform/api/rest/handlers/list.py | 0x55AAh/anthill_gaming | 475af798bd08d85fc0fbfce9d2ba710f73252c15 | [
"MIT"
] | null | null | null | from anthill.platform.api.rest.handlers.base import MarshmallowMixin
from anthill.framework.handlers.base import RequestHandler
from anthill.framework.core.paginator import Paginator
class MultipleObjectMixin:
"""A mixin for handlers manipulating multiple objects."""
allow_empty = True
queryset = None
model = None
paginate_by = None
paginate_orphans = 0
context_object_name = None
paginator_class = Paginator
page_kwarg = 'page'
ordering = None
class MarshmallowMultipleObjectsMixin(MarshmallowMixin):
def get_schema(self):
schema_class = self.get_schema_class()
return schema_class(many=True)
def get_schema_class(self):
if self.schema_class is None:
# TODO
pass
return super().get_schema_class()
class ListMixin(MultipleObjectMixin, MarshmallowMultipleObjectsMixin):
pass
class ListHandler(ListMixin, RequestHandler):
"""A handler for displaying a list of objects."""
| 26.837838 | 70 | 0.725076 | 110 | 993 | 6.390909 | 0.5 | 0.093883 | 0.059744 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001267 | 0.205438 | 993 | 36 | 71 | 27.583333 | 0.889734 | 0.101712 | 0 | 0.083333 | 0 | 0 | 0.00454 | 0 | 0 | 0 | 0 | 0.027778 | 0 | 1 | 0.083333 | false | 0.083333 | 0.125 | 0 | 0.833333 | 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 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
89e9a41923603d3fe8d0aebf5ac00f8e66990c0e | 14,061 | py | Python | src/py/gfs/api/graphql/client/gfsgql.py | whoopsjohnnie/gfsinteg | 93b89f3eda3a2c214864dd7142e17c8d191531ff | [
"BSD-2-Clause"
] | 1 | 2021-11-29T02:28:00.000Z | 2021-11-29T02:28:00.000Z | src/py/gfs/api/graphql/client/gfsgql.py | whoopsjohnnie/gfsinteg | 93b89f3eda3a2c214864dd7142e17c8d191531ff | [
"BSD-2-Clause"
] | null | null | null | src/py/gfs/api/graphql/client/gfsgql.py | whoopsjohnnie/gfsinteg | 93b89f3eda3a2c214864dd7142e17c8d191531ff | [
"BSD-2-Clause"
] | null | null | null |
#
# Copyright (c) 2020, 2021, John Grundback
# All rights reserved.
#
from python_graphql_client import GraphqlClient
#
# GFS GraphQL client error class
#
# class GFSGQLError(Exception):
# def __init__(self, error):
# pass
#
# GFS GraphQL client
#
class GFSGQL():
logger = GFSLogger.getLogger("GFSGQL")
def __init__(
self,
gfs_host,
gfs_port,
gfs_username,
gfs_password,
**kwargs):
self.gfs_host = gfs_host
self.gfs_port = gfs_port
self.gfs_username = gfs_username
self.gfs_password = gfs_password
self.api_namespace = "gfs1"
self.gfs_gqlurl = "http://" + self.gfs_host + ":" + self.gfs_port + "/" + self.api_namespace + "/" + "graphql"
self.gfs_gqlclient = GraphqlClient(
endpoint=self.gfs_gqlurl
)
def gqlencodedict(self, data = {}):
_list = []
for key in data:
val = data.get(key)
_list.append(key + ":" + str(self.gqlencode(val)))
return "{" + ", ".join(_list) + "}"
def gqlencodelist(self, data = []):
_list = []
for val in data:
_list.append(str(self.gqlencode(val)))
return "[" + ", ".join(_list) + "]"
def gqlencode(self, data):
if isinstance(data, list):
return self.gqlencodelist(data)
elif isinstance(data, dict):
return self.gqlencodedict(data)
elif isinstance(data, int):
return str(data)
else:
# return "\"" + str(data) + "\""
return str(data)
def gqlargs(self, match = {}):
return str(self.gqlencode({
"$" + key: value for key, value in match.items()
}))[1:-1]
def gqlvars(self, match = {}):
return str(self.gqlencode({
key: "$" + key for key, value in match.items()
}))[1:-1]
def gqldata(self, data = {}):
return str(self.gqlencode(data))[1:-1]
def gqlfields(self, fields = {}):
# return str(self.gqlencode(fields))[1:-1]
# return ", ".join(fields)
ret = ""
if isinstance(fields, list):
for val in fields:
# val = fields.get(key)
if isinstance(val, dict):
ret += val + " {" + self.gqlfields(val) + "}" + ", "
elif val:
ret += val + ", "
elif isinstance(fields, dict):
for key in fields:
val = fields.get(key)
if isinstance(val, dict):
ret += key + " {" + self.gqlfields(val) + "}" + ", "
elif val:
ret += key + ", "
else:
pass
return ret
#
#
#
def gqlexec(self, query, variables = {}):
self.logger.debug("Running GQL query: ")
self.logger.debug(query)
self.logger.debug("with variables: ")
self.logger.debug(variables)
data = {}
try:
# Synchronous request
data = self.gfs_gqlclient.execute(
query=query,
variables=variables
)
except Exception as e:
raise GFSGQLError("GQL GraphQL error " + str(
e.response.json())
)
self.logger.debug("GQL query result")
self.logger.debug(data)
if data and "errors" in data:
raise GFSGQLError("GQL GraphQL error " + str(
data)
)
return data
def gqlquery(self, resource, arguments = {}, variables = {}, fields = {}):
self.logger.debug("")
self.logger.debug("GQL query of resource: " + resource)
self.logger.debug("arguments: " + str(arguments))
self.logger.debug("variables: " + str(variables))
self.logger.debug("fields: " + str(fields))
query = """
query %s {
%s {
%s
}
}
""" % (
"%ss" % (resource),
"%ss" % (resource),
self.gqlfields(fields)
)
if arguments:
query = """
query %s(%s) {
%s(%s) {
%s
}
}
""" % (
"%ss" % (resource),
self.gqlargs(arguments),
"%ss" % (resource),
self.gqlvars(variables),
self.gqlfields(fields)
)
self.logger.debug("Running GQL query: ")
self.logger.debug(query)
self.logger.debug("with variables: ")
self.logger.debug(variables)
data = {}
try:
# Synchronous request
data = self.gfs_gqlclient.execute(
query=query,
variables=variables
)
except Exception as e:
raise GFSGQLError("GQL GraphQL error " + str(
e.response.json())
)
self.logger.debug("GQL query result")
self.logger.debug(data)
if data and "errors" in data:
raise GFSGQLError("GQL GraphQL error " + str(
data)
)
return data.get(
"data", {}
).get(
"%ss" % (resource), []
)
def gqlget(self, resource, arguments = {}, variables = {}, fields = {}):
self.logger.debug("")
self.logger.debug("GQL get of resource: " + resource)
self.logger.debug("arguments: " + str(arguments))
self.logger.debug("variables: " + str(variables))
self.logger.debug("fields: " + str(fields))
query = """
query %s(%s) {
%s(%s) {
%s
}
}
""" % (
resource,
self.gqlargs(arguments),
resource,
self.gqlvars(variables),
self.gqlfields(fields)
)
self.logger.debug("Running GQL query: ")
self.logger.debug(query)
self.logger.debug("with variables: ")
self.logger.debug(variables)
data = {}
try:
# Synchronous request
data = self.gfs_gqlclient.execute(
query=query,
variables=variables
)
except Exception as e:
raise GFSGQLError("GQL GraphQL error " + str(
e.response.json())
)
self.logger.debug("GQL query result")
self.logger.debug(data)
if data and "errors" in data:
raise GFSGQLError("GQL GraphQL error " + str(
data)
)
return data.get(
"data", {}
).get(
resource, []
)
def gqlcreate(self, resource, arguments = {}, variables = {}, fields = {}):
self.logger.debug("")
self.logger.debug("GQL create of resource: " + resource)
self.logger.debug("arguments: " + str(arguments))
self.logger.debug("variables:")
self.logger.debug(variables)
self.logger.debug("fields: " + str(fields))
resource = resource.replace(":", "").replace("@", "").replace("-", "")
query="""
mutation %s(%s) {
%s(%s) {
instance {
%s
},
ok,
error
}
}
""" % (
"create%s" % ((resource[0].upper() + resource[1:])),
self.gqlargs(arguments),
"create%s" % ((resource[0].upper() + resource[1:])),
self.gqlvars(variables),
self.gqlfields(fields)
)
self.logger.debug("Running GQL mutation: ")
self.logger.debug(query)
self.logger.debug("with variables: ")
self.logger.debug(variables)
data = {}
try:
# Synchronous request
data = self.gfs_gqlclient.execute(
query=query,
variables=variables
)
except Exception as e:
raise GFSGQLError("GQL GraphQL error " + str(
e.response.json())
)
self.logger.debug("GQL mutation result")
self.logger.debug(data)
if data and "errors" in data:
raise GFSGQLError("GQL GraphQL error " + str(
data)
)
if data and "error" in data.get("data", {}).get("create%s" % ((resource[0].upper() + resource[1:])), {}):
if data.get("data", {}).get("create%s" % ((resource[0].upper() + resource[1:])), {}).get("error", None):
raise GFSGQLError("GQL GraphQL error " + str(
data.get("data", {}).get("create%s" % ((resource[0].upper() + resource[1:])), {}).get("error", None))
)
return data.get(
"data", {}
).get(
"create%s" % ((resource[0].upper() + resource[1:])), {}
)
# .get(
# "instance", {}
# )
def gqlupdate(self, resource, arguments = {}, variables = {}, fields = {}):
self.logger.debug("")
self.logger.debug("GQL update of resource: " + resource)
self.logger.debug("arguments: " + str(arguments))
self.logger.debug("variables:")
self.logger.debug(variables)
self.logger.debug("fields: " + str(fields))
query="""
mutation %s(%s) {
%s(%s) {
instance {
%s
},
ok
}
}
""" % (
"update%s" % ((resource[0].upper() + resource[1:])),
self.gqlargs(arguments),
"update%s" % ((resource[0].upper() + resource[1:])),
self.gqlvars(variables),
self.gqlfields(fields)
)
self.logger.debug("Running GQL mutation: ")
self.logger.debug(query)
self.logger.debug("with variables: ")
self.logger.debug(variables)
data = {}
try:
# Synchronous request
data = self.gfs_gqlclient.execute(
query=query,
variables=variables
)
except Exception as e:
raise GFSGQLError("GQL GraphQL error " + str(
e.response.json())
)
self.logger.debug("GQL mutation result")
self.logger.debug(data)
if data and "errors" in data:
raise GFSGQLError("GQL GraphQL error " + str(
data)
)
if data and "error" in data.get("data", {}).get("update%s" % ((resource[0].upper() + resource[1:])), {}):
if data.get("data", {}).get("update%s" % ((resource[0].upper() + resource[1:])), {}).get("error", None):
raise GFSGQLError("GQL GraphQL error " + str(
data.get("data", {}).get("update%s" % ((resource[0].upper() + resource[1:])), {}).get("error", None))
)
return data.get(
"data", {}
).get(
"update%s" % ((resource[0].upper() + resource[1:])), {}
)
# .get(
# "instance", {}
# )
def gqldelete(self, resource, arguments = {}, variables = {}):
self.logger.debug("")
self.logger.debug("GQL delete of resource: " + resource)
self.logger.debug("arguments: " + str(arguments))
self.logger.debug("variables: " + str(variables))
query="""
mutation %s(%s) {
%s(%s) {
ok
}
}
""" % (
"delete%s" % ((resource[0].upper() + resource[1:])),
self.gqlargs(arguments),
"delete%s" % ((resource[0].upper() + resource[1:])),
self.gqlvars(variables)
)
self.logger.debug("Running GQL mutation: ")
self.logger.debug(query)
self.logger.debug("with variables: ")
self.logger.debug(variables)
data = {}
try:
# Synchronous request
data = self.gfs_gqlclient.execute(
query=query,
variables=variables
)
except Exception as e:
raise GFSGQLError("GQL GraphQL error " + str(
e.response.json())
)
self.logger.debug("GQL mutation result")
self.logger.debug(data)
if data and "errors" in data:
raise GFSGQLError("GQL GraphQL error " + str(
data)
)
if data and "error" in data.get("data", {}).get("delete%s" % ((resource[0].upper() + resource[1:])), {}):
if data.get("data", {}).get("delete%s" % ((resource[0].upper() + resource[1:])), {}).get("error", None):
raise GFSGQLError("GQL GraphQL error " + str(
data.get("data", {}).get("delete%s" % ((resource[0].upper() + resource[1:])), {}).get("error", None))
)
return data.get(
"data", {}
).get(
"delete%s" % ((resource[0].upper() + resource[1:])), {}
)
#
#
#
def exec(self, query, variables = {}):
return self.gqlexec(query, variables)
def query(self, resource, arguments = {}, variables = {}, fields = {}):
return self.gqlquery(resource, arguments, variables, fields)
def get(self, resource, arguments = {}, variables = {}, fields = {}):
return self.gqlget(resource, arguments, variables, fields)
def create(self, resource, arguments = {}, variables = {}, fields = {}):
return self.gqlcreate(resource, arguments, variables, fields)
def update(self, resource, arguments = {}, variables = {}, fields = {}):
return self.gqlupdate(resource, arguments, variables, fields)
def delete(self, resource, arguments = {}, variables = {}):
return self.gqldelete(resource, arguments, variables)
| 28.991753 | 121 | 0.473153 | 1,311 | 14,061 | 5.043478 | 0.084668 | 0.093769 | 0.140653 | 0.040835 | 0.78297 | 0.752571 | 0.740774 | 0.6951 | 0.678766 | 0.638536 | 0 | 0.006085 | 0.380556 | 14,061 | 484 | 122 | 29.051653 | 0.753042 | 0.03435 | 0 | 0.595506 | 0 | 0 | 0.155908 | 0 | 0.002809 | 0 | 0 | 0 | 0 | 1 | 0.05618 | false | 0.008427 | 0.002809 | 0.025281 | 0.126404 | 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 |
89f34571398b0403e21feb0b4ec4e89ce1561f1f | 963 | py | Python | api/licences/views/open_general_licences.py | django-doctor/lite-api | 1ba278ba22ebcbb977dd7c31dd3701151cd036bf | [
"MIT"
] | 3 | 2019-05-15T09:30:39.000Z | 2020-04-22T16:14:23.000Z | api/licences/views/open_general_licences.py | django-doctor/lite-api | 1ba278ba22ebcbb977dd7c31dd3701151cd036bf | [
"MIT"
] | 85 | 2019-04-24T10:39:35.000Z | 2022-03-21T14:52:12.000Z | api/licences/views/open_general_licences.py | django-doctor/lite-api | 1ba278ba22ebcbb977dd7c31dd3701151cd036bf | [
"MIT"
] | 1 | 2021-01-17T11:12:19.000Z | 2021-01-17T11:12:19.000Z | from django.http import JsonResponse
from rest_framework import status
from rest_framework.views import APIView
from api.core.authentication import ExporterAuthentication
from api.open_general_licences.helpers import get_open_general_licence
from api.organisations.libraries.get_organisation import get_request_user_organisation
class Create(APIView):
authentication_classes = (ExporterAuthentication,)
def post(self, request, *args, **kwargs):
organisation = get_request_user_organisation(request)
open_general_licence = get_open_general_licence(request.data.get("open_general_licence"))
open_general_licence_id, registrations = organisation.register_open_general_licence(
open_general_licence, request.user.exporteruser
)
return JsonResponse(
data={"open_general_licence": open_general_licence_id, "registrations": registrations},
status=status.HTTP_201_CREATED,
)
| 41.869565 | 99 | 0.779855 | 108 | 963 | 6.611111 | 0.37963 | 0.154062 | 0.226891 | 0.088235 | 0.193277 | 0.193277 | 0.142857 | 0.142857 | 0 | 0 | 0 | 0.003695 | 0.156802 | 963 | 22 | 100 | 43.772727 | 0.875616 | 0 | 0 | 0 | 0 | 0 | 0.055036 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0 | 0.333333 | 0 | 0.555556 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
d6058c20d148c522caeac357ed082a3628b40798 | 310 | py | Python | Game/data/items/__init__.py | joaompinto/2DExplorer | 1c172c208535a3121e9fee3cf6d64b6b8ec3684f | [
"MIT"
] | 9 | 2016-07-25T04:16:46.000Z | 2020-05-07T16:27:26.000Z | Game/data/items/__init__.py | joaompinto/2DExplorer | 1c172c208535a3121e9fee3cf6d64b6b8ec3684f | [
"MIT"
] | null | null | null | Game/data/items/__init__.py | joaompinto/2DExplorer | 1c172c208535a3121e9fee3cf6d64b6b8ec3684f | [
"MIT"
] | 2 | 2017-03-04T09:49:02.000Z | 2020-04-10T00:13:45.000Z | __all__ = ['Item-BronzeAxe', 'Item-BronzePickaxe', 'Item-Coal', 'Item-Copper', 'Item-CopperAxe', 'Item-CopperPickaxe', 'Item-Dirt', 'Item-IronSword', 'Item-Stick', 'Item-Stone', 'Item-StoneBrick', 'Item-Torch', 'Item-WoodenBack', 'Item-WoodenChest', 'Item-WoodenDoor', 'Item-WoodenPickaxe', 'Item-WoodenPlank'] | 310 | 310 | 0.716129 | 35 | 310 | 6.228571 | 0.542857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058065 | 310 | 1 | 310 | 310 | 0.746575 | 0 | 0 | 0 | 0 | 0 | 0.745981 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c3924d1e639fb1c74bb9a9bb6fbf927d805fa2aa | 83 | py | Python | esp8266/main.py | jimmo/stair-lights | 39429d7e695c97e45188b8379325393caf5add02 | [
"MIT"
] | null | null | null | esp8266/main.py | jimmo/stair-lights | 39429d7e695c97e45188b8379325393caf5add02 | [
"MIT"
] | null | null | null | esp8266/main.py | jimmo/stair-lights | 39429d7e695c97e45188b8379325393caf5add02 | [
"MIT"
] | null | null | null | def main():
import stairs
stairs.server()
if __name__ == '__main__':
main()
| 11.857143 | 26 | 0.638554 | 10 | 83 | 4.5 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.204819 | 83 | 6 | 27 | 13.833333 | 0.681818 | 0 | 0 | 0 | 0 | 0 | 0.096386 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | true | 0 | 0.2 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c3965a53614321753bde77b3a243ed1a87f63b11 | 5,299 | py | Python | burton/translation/test/basetests.py | Extensis/Burton | a948f045a021f468ef34d6e8e6b8a5caaa132e27 | [
"MIT"
] | 2 | 2018-01-09T23:32:35.000Z | 2018-08-10T23:48:33.000Z | burton/translation/test/basetests.py | Extensis/Burton | a948f045a021f468ef34d6e8e6b8a5caaa132e27 | [
"MIT"
] | null | null | null | burton/translation/test/basetests.py | Extensis/Burton | a948f045a021f468ef34d6e8e6b8a5caaa132e27 | [
"MIT"
] | 5 | 2017-03-23T16:49:46.000Z | 2022-02-18T12:06:59.000Z | import unittest
from burton import translation
class BaseTests(unittest.TestCase):
def test_add_translation(self):
trans = translation.Base("Italian", "it-IT", "en", "", "", "")
trans.add_translation(u"Some native string", u"Some translation")
self.assertEquals(
trans.translation_dict,
{
u"Some native string" : u"Some translation",
u"Some native string..." : u"Some translation...",
u"Some native string\xe2\x80\xa6" : u"Some translation\xe2\x80\xa6"
}
)
def test_add_translation_with_ellipses(self):
trans = translation.Base("Italian", "it-IT", "en", "", "", "")
trans.add_translation(u"Translated D...", None)
trans.add_translation(u"Translated E\xe2\x80\xa6", None)
trans.add_translation(u"Translated D", u"Translated D")
trans.add_translation(u"Translated E", u"Translated E")
trans.add_translation(u"Untranslated D...", None)
trans.add_translation(u"Untranslated E\xe2\x80\xa6", None)
trans.add_translation(u"Translated D...", None)
trans.add_translation(u"Translated E\xe2\x80\xa6", None)
trans.add_translation(u"Translated F...", u"Translated F...")
trans.add_translation(u"Translated G\xe2\x80\xa6", u"Translated G\xe2\x80\xa6")
self.assertEquals(
trans._translation_dict,
{
u"Translated D" : u"Translated D",
u"Translated E" : u"Translated E",
u"Untranslated D" : None,
u"Untranslated E" : None,
u"Translated F..." : u"Translated F...",
u"Translated G\xe2\x80\xa6" : u"Translated G\xe2\x80\xa6"
}
)
def test_delete_translation(self):
trans = translation.Base("Italian", "it-IT", "en", "", "", "")
trans.add_translation(u"Some native string", u"Some translation")
self.assertEquals(
trans.translation_dict,
{
u"Some native string" : u"Some translation",
u"Some native string..." : u"Some translation...",
u"Some native string\xe2\x80\xa6" : u"Some translation\xe2\x80\xa6"
}
)
trans.delete_translation(u"Some native string")
self.assertEquals(trans.translation_dict,{})
def test_get_translation(self):
trans = translation.Base("Italian", "it-IT", "en", "", "", "")
trans.add_translation(u"Some native string", u"Some translation")
self.assertEquals(
trans.get_translation(u"Some native string"),
u"Some translation"
)
def test_combine_with(self):
trans1 = trans = translation.Base("Italian", "it-IT", "en", "", "", "")
trans1.add_translation(u"Some native string", u"Some translation")
trans1.add_translation(u"Some other string", u"Some other translation")
trans2 = trans = translation.Base("Italian", "it-IT", "en", "", "", "")
trans2.add_translation(u"Some native string", u"Different translation")
trans2.add_translation(u"Some other string", None)
trans2.add_translation(u"Some new string", u"Some new translation")
trans1.combine_with(trans2)
self.assertEquals(
trans1.translation_dict,
{
u"Some native string" : u"Different translation",
u"Some native string..." : u"Different translation...",
u"Some native string\xe2\x80\xa6" : u"Different translation\xe2\x80\xa6",
u"Some other string" : u"Some other translation",
u"Some other string..." : u"Some other translation...",
u"Some other string\xe2\x80\xa6" : u"Some other translation\xe2\x80\xa6",
u"Some new string" : u"Some new translation",
u"Some new string..." : u"Some new translation...",
u"Some new string\xe2\x80\xa6" : u"Some new translation\xe2\x80\xa6",
}
)
def test_remove_untranslated_strings(self):
trans = trans = translation.Base("Italian", "it-IT", "en", "", "", "")
trans.add_translation(u"Some native string", u"Some translation")
trans.add_translation(u"Some other string", None)
trans.remove_untranslated_strings()
self.assertEquals(
trans.translation_dict,
{
u"Some native string" : u"Some translation",
u"Some native string..." : u"Some translation...",
u"Some native string\xe2\x80\xa6" : u"Some translation\xe2\x80\xa6"
}
)
def test_remove_translated_strings(self):
trans = trans = translation.Base("Italian", "it-IT", "en", "", "", "")
trans.add_translation(u"Some native string", u"Some translation")
trans.add_translation(u"Some other string", None)
trans.remove_translated_strings()
self.assertEquals(
trans.translation_dict,
{ u"Some other string" : None }
)
| 43.434426 | 90 | 0.564069 | 595 | 5,299 | 4.931092 | 0.07563 | 0.097137 | 0.141786 | 0.121677 | 0.896046 | 0.834015 | 0.738582 | 0.685072 | 0.634628 | 0.583845 | 0 | 0.023376 | 0.305718 | 5,299 | 121 | 91 | 43.793388 | 0.774123 | 0 | 0 | 0.362745 | 0 | 0 | 0.334969 | 0.026043 | 0 | 0 | 0 | 0 | 0.078431 | 1 | 0.068627 | false | 0 | 0.019608 | 0 | 0.098039 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c39b461641d8856c5f5833cde8429434add582d3 | 227 | py | Python | train/preprocess/seq2seq/text_processors.py | Sushentsev/PopNet | 1a0836e50c4f7730a7b9e30698298511e6bf5f12 | [
"Apache-2.0"
] | null | null | null | train/preprocess/seq2seq/text_processors.py | Sushentsev/PopNet | 1a0836e50c4f7730a7b9e30698298511e6bf5f12 | [
"Apache-2.0"
] | null | null | null | train/preprocess/seq2seq/text_processors.py | Sushentsev/PopNet | 1a0836e50c4f7730a7b9e30698298511e6bf5f12 | [
"Apache-2.0"
] | null | null | null | from typing import List
from spacy.tokens import Token
class SpacyTextPreprocessor:
def preprocess(self, text: List[Token]) -> List[str]:
return [token.text.lower().strip() for token in text if token.is_alpha()]
| 25.222222 | 81 | 0.718062 | 32 | 227 | 5.0625 | 0.6875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.171806 | 227 | 8 | 82 | 28.375 | 0.861702 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0.2 | 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 | 1 | 0 | 0 | 0 | 3 |
c3a792b54f1640bca855d78df183428b7bcf7e65 | 886 | py | Python | captchabreaker/image_processing/operations/parameters/Integer.py | arthurwozniak/CaptchaBreaker | 697daa0bc592bf3ac7b4711d821c4387b129b334 | [
"MIT"
] | 1 | 2020-08-08T22:27:30.000Z | 2020-08-08T22:27:30.000Z | captchabreaker/image_processing/operations/parameters/Integer.py | arthurwozniak/CaptchaBreaker | 697daa0bc592bf3ac7b4711d821c4387b129b334 | [
"MIT"
] | null | null | null | captchabreaker/image_processing/operations/parameters/Integer.py | arthurwozniak/CaptchaBreaker | 697daa0bc592bf3ac7b4711d821c4387b129b334 | [
"MIT"
] | null | null | null | import uuid
class Integer:
_html_pattern = \
"""<div class="col-md-6"><label for="{4}">{5}</label></div>
<div class="col-md-6"><input class="form-control" type="number" id="{4}" data-class="{0}" data-name="{5}" data-type="value" min="{1}" max="{2}" value="{3}" onChange="fileSelectChanged()"></div>"""
def __init__(self, value=0, min=0, max=255, name="variable"):
self.value = value
self.min = min
self.max = max
self.name = name
self.id = uuid.uuid4().hex
def __int__(self):
return self.value
def html(self):
html = self._html_pattern.format(self.__class__.__name__ ,self.min, self.max, self.value, self.id, self.name)
return html
def __str__(self):
return "[{0}; value: {1}]".format(self.__class__.__name__, self.value)
def __repr__(self):
return self.__str__() | 29.533333 | 200 | 0.593679 | 124 | 886 | 3.919355 | 0.346774 | 0.092593 | 0.045267 | 0.053498 | 0.152263 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025937 | 0.216704 | 886 | 30 | 201 | 29.533333 | 0.674352 | 0 | 0 | 0 | 0 | 0 | 0.039936 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.277778 | false | 0 | 0.055556 | 0.166667 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
c3b5ffa90849badb04bda4eae523516319e5163f | 14,379 | py | Python | tests/test_combine.py | gburlet/pysox | 4de1bcf42f7b435ac5b561adcba1009045c401e3 | [
"BSD-3-Clause"
] | null | null | null | tests/test_combine.py | gburlet/pysox | 4de1bcf42f7b435ac5b561adcba1009045c401e3 | [
"BSD-3-Clause"
] | null | null | null | tests/test_combine.py | gburlet/pysox | 4de1bcf42f7b435ac5b561adcba1009045c401e3 | [
"BSD-3-Clause"
] | null | null | null | import unittest
import os
from sox import combine
from sox.core import SoxError
def relpath(f):
return os.path.join(os.path.dirname(__file__), f)
INPUT_WAV = relpath('data/input.wav')
INPUT_WAV2 = relpath('data/input2.wav')
INPUT_WAV3 = relpath('data/input3.wav')
INPUT_AIFF = relpath('data/input.aiff')
INPUT_FILE_INVALID = relpath('data/input.xyz')
OUTPUT_FILE = relpath('data/output.wav')
def new_combiner():
return combine.Combiner()
class TestCombineDefault(unittest.TestCase):
def setUp(self):
self.cbn = new_combiner()
def test_globals(self):
expected = ['-D', '-V2']
actual = self.cbn.globals
self.assertEqual(expected, actual)
def test_output_format(self):
expected = {}
actual = self.cbn.output_format
self.assertEqual(expected, actual)
def test_effects(self):
expected = []
actual = self.cbn.effects
self.assertEqual(expected, actual)
def test_effects_log(self):
expected = []
actual = self.cbn.effects_log
self.assertEqual(expected, actual)
def test_build(self):
expected_result = True
actual_result = self.cbn.build(
[INPUT_WAV, INPUT_WAV], OUTPUT_FILE, 'concatenate'
)
self.assertEqual(expected_result, actual_result)
def test_build_with_vols(self):
expected_result = True
actual_result = self.cbn.build(
[INPUT_WAV, INPUT_WAV], OUTPUT_FILE, 'mix',
input_volumes=[0.5, 2]
)
self.assertEqual(expected_result, actual_result)
def test_failed_build(self):
cbn = new_combiner()
with self.assertRaises(SoxError):
cbn.build(
[INPUT_FILE_INVALID, INPUT_WAV], OUTPUT_FILE, 'concatenate'
)
def test_build_with_output_format(self):
expected_result = True
cbn = new_combiner()
cbn.set_output_format(rate=8000)
actual_result = self.cbn.build(
[INPUT_WAV, INPUT_WAV], OUTPUT_FILE, 'concatenate'
)
self.assertEqual(expected_result, actual_result)
class TestCombineTypes(unittest.TestCase):
def setUp(self):
self.cbn = new_combiner()
def test_concatenate(self):
expected = True
actual = self.cbn.build(
[INPUT_WAV, INPUT_WAV], OUTPUT_FILE, 'concatenate'
)
self.assertEqual(expected, actual)
def test_merge(self):
expected = True
actual = self.cbn.build([INPUT_WAV, INPUT_WAV], OUTPUT_FILE, 'merge')
self.assertEqual(expected, actual)
def test_mix(self):
expected = True
actual = self.cbn.build([INPUT_WAV, INPUT_WAV], OUTPUT_FILE, 'mix')
self.assertEqual(expected, actual)
def test_mixpower(self):
expected = True
actual = self.cbn.build(
[INPUT_WAV, INPUT_WAV], OUTPUT_FILE, 'mix-power'
)
self.assertEqual(expected, actual)
def test_multiply(self):
expected = True
actual = self.cbn.build(
[INPUT_WAV, INPUT_WAV], OUTPUT_FILE, 'multiply'
)
self.assertEqual(expected, actual)
class TestSetInputFormat(unittest.TestCase):
def test_none(self):
cbn = new_combiner()
cbn.set_input_format()
expected = []
actual = cbn.input_format
self.assertEqual(expected, actual)
def test_file_type(self):
cbn = new_combiner()
cbn.set_input_format(file_type=['wav', 'aiff'])
expected = [['-t', 'wav'], ['-t', 'aiff']]
actual = cbn.input_format
self.assertEqual(expected, actual)
def test_invalid_file_type(self):
cbn = new_combiner()
with self.assertRaises(ValueError):
cbn.set_input_format(file_type='wav')
def test_invalid_file_type_val(self):
cbn = new_combiner()
with self.assertRaises(ValueError):
cbn.set_input_format(file_type=['xyz', 'wav'])
def test_rate(self):
cbn = new_combiner()
cbn.set_input_format(rate=[2000, 44100, 22050])
expected = [['-r', '2000'], ['-r', '44100'], ['-r', '22050']]
actual = cbn.input_format
self.assertEqual(expected, actual)
def test_invalid_rate(self):
cbn = new_combiner()
with self.assertRaises(ValueError):
cbn.set_input_format(rate=2000)
def test_invalid_rate_val(self):
cbn = new_combiner()
with self.assertRaises(ValueError):
cbn.set_input_format(rate=[-2, 'a'])
def test_bits(self):
cbn = new_combiner()
cbn.set_input_format(bits=[16])
expected = [['-b', '16']]
actual = cbn.input_format
self.assertEqual(expected, actual)
def test_invalid_bits(self):
cbn = new_combiner()
with self.assertRaises(ValueError):
cbn.set_input_format(bits=32)
def test_invalid_bits_val(self):
cbn = new_combiner()
with self.assertRaises(ValueError):
cbn.set_input_format(bits=[0])
def test_channels(self):
cbn = new_combiner()
cbn.set_input_format(channels=[1, 2, 3])
expected = [['-c', '1'], ['-c', '2'], ['-c', '3']]
actual = cbn.input_format
self.assertEqual(expected, actual)
def test_invalid_channels(self):
cbn = new_combiner()
with self.assertRaises(ValueError):
cbn.set_input_format(channels='x')
def test_invalid_channels_val(self):
cbn = new_combiner()
with self.assertRaises(ValueError):
cbn.set_input_format(channels=[1.5, 2, 3])
def test_encoding(self):
cbn = new_combiner()
cbn.set_input_format(encoding=['floating-point', 'oki-adpcm'])
expected = [['-e', 'floating-point'], ['-e', 'oki-adpcm']]
actual = cbn.input_format
self.assertEqual(expected, actual)
def test_invalid_encoding(self):
cbn = new_combiner()
with self.assertRaises(ValueError):
cbn.set_input_format(encoding='wav')
def test_invalid_encoding_val(self):
cbn = new_combiner()
with self.assertRaises(ValueError):
cbn.set_input_format(encoding=['xyz', 'wav'])
def test_ignore_length(self):
cbn = new_combiner()
cbn.set_input_format(ignore_length=[True, False, True])
expected = [['--ignore-length'], [], ['--ignore-length']]
actual = cbn.input_format
self.assertEqual(expected, actual)
def test_invalid_ignore_length(self):
cbn = new_combiner()
with self.assertRaises(ValueError):
cbn.set_input_format(ignore_length=1)
def test_invalid_ignore_length_val(self):
cbn = new_combiner()
with self.assertRaises(ValueError):
cbn.set_input_format(ignore_length=[False, True, 3])
def test_multiple_same_len(self):
cbn = new_combiner()
cbn.set_input_format(rate=[44100, 2000], bits=[32, 8])
expected = [['-r', '44100', '-b', '32'], ['-r', '2000', '-b', '8']]
actual = cbn.input_format
self.assertEqual(expected, actual)
def test_multiple_different_len(self):
cbn = new_combiner()
cbn.set_input_format(rate=[44100, 2000], bits=[32, 8, 16])
expected = [
['-r', '44100', '-b', '32'],
['-r', '2000', '-b', '8'],
['-b', '16']
]
actual = cbn.input_format
self.assertEqual(expected, actual)
def test_build_same_len(self):
cbn = new_combiner()
cbn.set_input_format(rate=[44100, 44100], channels=[1, 1])
actual = cbn.build([INPUT_WAV, INPUT_WAV], OUTPUT_FILE, 'mix')
expected = True
self.assertEqual(expected, actual)
def test_build_same_len_vol(self):
cbn = new_combiner()
cbn.set_input_format(rate=[44100, 44100], channels=[1, 1])
actual = cbn.build(
[INPUT_WAV, INPUT_WAV], OUTPUT_FILE, 'mix', input_volumes=[1, 2]
)
expected = True
self.assertEqual(expected, actual)
def test_build_greater_len(self):
cbn = new_combiner()
cbn.set_input_format(rate=[44100, 44100, 44100], channels=[1, 1])
actual = cbn.build([INPUT_WAV, INPUT_WAV], OUTPUT_FILE, 'mix')
expected = True
self.assertEqual(expected, actual)
def test_build_greater_len_vol(self):
cbn = new_combiner()
cbn.set_input_format(rate=[44100, 44100, 44100], channels=[1, 1])
actual = cbn.build(
[INPUT_WAV, INPUT_WAV], OUTPUT_FILE, 'mix', input_volumes=[1, 2]
)
expected = True
self.assertEqual(expected, actual)
def test_build_lesser_len(self):
cbn = new_combiner()
cbn.set_input_format(rate=[44100, 44100], channels=[1, 1])
actual = cbn.build(
[INPUT_WAV, INPUT_WAV, INPUT_WAV], OUTPUT_FILE, 'mix'
)
expected = True
self.assertEqual(expected, actual)
def test_build_lesser_len_vol(self):
cbn = new_combiner()
cbn.set_input_format(rate=[44100, 44100], channels=[1, 1])
actual = cbn.build(
[INPUT_WAV, INPUT_WAV, INPUT_WAV], OUTPUT_FILE, 'mix',
input_volumes=[1, 2]
)
expected = True
self.assertEqual(expected, actual)
class TestValidateFileFormats(unittest.TestCase):
def test_different_samplerates(self):
with self.assertRaises(IOError):
combine._validate_file_formats([INPUT_WAV, INPUT_WAV2], 'mix')
def test_different_num_channels(self):
with self.assertRaises(IOError):
combine._validate_file_formats(
[INPUT_WAV, INPUT_WAV3], 'concatenate'
)
class TestValidateSampleRates(unittest.TestCase):
def test_different_samplerates(self):
with self.assertRaises(IOError):
combine._validate_sample_rates([INPUT_WAV, INPUT_WAV2], 'mix')
def test_same_samplerates(self):
expected = None
actual = combine._validate_sample_rates([INPUT_WAV, INPUT_WAV], 'mix')
self.assertEqual(expected, actual)
class TestValidateNumChannels(unittest.TestCase):
def test_different_numchannels(self):
with self.assertRaises(IOError):
combine._validate_num_channels([INPUT_WAV, INPUT_WAV3], 'mix')
def test_same_numchannels(self):
expected = None
actual = combine._validate_num_channels([INPUT_WAV, INPUT_WAV], 'mix')
self.assertEqual(expected, actual)
class TestBuildInputFormatList(unittest.TestCase):
def test_none(self):
expected = [['-v', '1'], ['-v', '1']]
actual = combine._build_input_format_list(
[INPUT_WAV, INPUT_WAV], None, None
)
self.assertEqual(expected, actual)
def test_equal_num_vol(self):
expected = [['-v', '0.5'], ['-v', '1.1']]
actual = combine._build_input_format_list(
[INPUT_WAV, INPUT_WAV], [0.5, 1.1], None
)
self.assertEqual(expected, actual)
def test_greater_num_vol(self):
actual = combine._build_input_format_list(
[INPUT_WAV, INPUT_WAV], [0.5, 1.1, 3], None
)
expected = [['-v', '0.5'], ['-v', '1.1']]
self.assertEqual(expected, actual)
def test_lesser_num_vol(self):
actual = combine._build_input_format_list(
[INPUT_WAV, INPUT_WAV, INPUT_WAV], [0.5, 1.1], None
)
expected = [['-v', '0.5'], ['-v', '1.1'], ['-v', '1']]
self.assertEqual(expected, actual)
def test_equal_num_fmt(self):
expected = [['-v', '1', '-t', 'wav'], ['-v', '1', '-t', 'aiff']]
actual = combine._build_input_format_list(
[INPUT_WAV, INPUT_WAV], None, [['-t', 'wav'], ['-t', 'aiff']]
)
self.assertEqual(expected, actual)
def test_greater_num_fmt(self):
actual = combine._build_input_format_list(
[INPUT_WAV, INPUT_WAV], None,
[['-t', 'wav'], ['-t', 'aiff'], ['-t', 'wav']]
)
expected = [['-v', '1', '-t', 'wav'], ['-v', '1', '-t', 'aiff']]
self.assertEqual(expected, actual)
def test_lesser_num_fmt(self):
actual = combine._build_input_format_list(
[INPUT_WAV, INPUT_WAV, INPUT_WAV], None,
[['-t', 'wav'], ['-t', 'aiff']]
)
expected = [
['-v', '1', '-t', 'wav'], ['-v', '1', '-t', 'aiff'], ['-v', '1']
]
self.assertEqual(expected, actual)
class TestCombinePreview(unittest.TestCase):
def setUp(self):
self.cbn = new_combiner()
self.cbn.trim(0, 0.1)
def test_valid(self):
expected = None
actual = self.cbn.preview([INPUT_WAV, INPUT_WAV], 'mix')
self.assertEqual(expected, actual)
def test_valid_vol(self):
expected = None
actual = self.cbn.preview([INPUT_WAV, INPUT_WAV], 'mix', [1.0, 0.5])
self.assertEqual(expected, actual)
class TestBuildInputArgs(unittest.TestCase):
def test_unequal_length(self):
with self.assertRaises(ValueError):
combine._build_input_args([INPUT_WAV, INPUT_WAV], [['-v', '1']])
def test_basic(self):
expected = ['-v', '1', INPUT_WAV, '-v', '1', INPUT_WAV]
actual = combine._build_input_args(
[INPUT_WAV, INPUT_WAV], [['-v', '1'], ['-v', '1']]
)
self.assertEqual(expected, actual)
class TestValidateCombineType(unittest.TestCase):
def test_valid(self):
actual = combine._validate_combine_type('mix')
expected = None
self.assertEqual(expected, actual)
def test_invalid(self):
with self.assertRaises(ValueError):
combine._validate_combine_type('combine')
class TestValidateVolumes(unittest.TestCase):
def test_valid_none(self):
actual = combine._validate_volumes(None)
expected = None
self.assertEqual(expected, actual)
def test_valid_list(self):
actual = combine._validate_volumes([1, 0.1, 3])
expected = None
self.assertEqual(expected, actual)
def test_invalid_type(self):
with self.assertRaises(TypeError):
combine._validate_volumes(1)
def test_invalid_vol(self):
with self.assertRaises(ValueError):
combine._validate_volumes([1.1, 'z', -0.5, 2])
| 31.811947 | 78 | 0.608526 | 1,693 | 14,379 | 4.917897 | 0.077377 | 0.064377 | 0.116022 | 0.13584 | 0.809032 | 0.760149 | 0.713188 | 0.641004 | 0.56858 | 0.524261 | 0 | 0.024831 | 0.257807 | 14,379 | 451 | 79 | 31.882483 | 0.755341 | 0 | 0 | 0.477654 | 0 | 0 | 0.039433 | 0 | 0 | 0 | 0 | 0 | 0.175978 | 1 | 0.189944 | false | 0 | 0.011173 | 0.005587 | 0.23743 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c3b7c64cd922a4f834662ba94c2d432af278d5d1 | 815 | py | Python | python_crash_course/section_3_1.py | eugenewyj/eugene-python-samples | 5f248a333353fed065c21b8135b67eb7354a2b61 | [
"Apache-2.0"
] | null | null | null | python_crash_course/section_3_1.py | eugenewyj/eugene-python-samples | 5f248a333353fed065c21b8135b67eb7354a2b61 | [
"Apache-2.0"
] | 1 | 2021-06-01T22:51:34.000Z | 2021-06-01T22:51:34.000Z | python_crash_course/section_3_1.py | eugenewyj/eugene-python-samples | 5f248a333353fed065c21b8135b67eb7354a2b61 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
list_samples = ['元素1', '元素2', '元素3', '元素4']
print(list_samples)
# 获取列表指定元素
print(list_samples[0].title())
print(list_samples[-1].title())
# 修改元素
list_samples[0] = '修改后的元素1'
print(list_samples)
# 末尾添加元素
list_samples.append("末尾添加元素")
print(list_samples)
# 插入元素
list_samples.insert(0, "新插入元素")
print(list_samples)
# 删除元素
del list_samples[0]
print(list_samples)
# pop删除
last_item = list_samples.pop()
print(list_samples)
print(last_item)
pop_item = list_samples.pop(0)
print(list_samples)
print(last_item)
# remove
list_samples.remove('元素2')
print(list_samples)
# 排序
list_samples.sort(reverse=True)
print(list_samples)
list_samples.sort(reverse=False)
print(list_samples)
print(sorted(list_samples, reverse=True))
print(list_samples)
# 反向排序
list_samples.reverse()
print(list_samples)
| 16.3 | 43 | 0.755828 | 121 | 815 | 4.842975 | 0.289256 | 0.488055 | 0.382253 | 0.107509 | 0.191126 | 0.098976 | 0 | 0 | 0 | 0 | 0 | 0.017591 | 0.093252 | 815 | 49 | 44 | 16.632653 | 0.775372 | 0.089571 | 0 | 0.5 | 0 | 0 | 0.045144 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.607143 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
c3e6a879ab4ab6bab1268cba32bba056d813775c | 5,407 | py | Python | abupy/UmpBu/ABuUmpMainJump.py | luqin/firefly | 2e5ab17f2d20deb3c68c927f6208ea89db7c639d | [
"MIT"
] | 1 | 2019-05-28T05:54:42.000Z | 2019-05-28T05:54:42.000Z | abupy/UmpBu/ABuUmpMainJump.py | momantang/cobrass | f11435d4836aa29078a3cd4beb4ca88967300c84 | [
"Apache-2.0"
] | 9 | 2020-03-24T16:45:25.000Z | 2022-03-11T23:40:51.000Z | abupy/UmpBu/ABuUmpMainJump.py | luqin/firefly | 2e5ab17f2d20deb3c68c927f6208ea89db7c639d | [
"MIT"
] | 1 | 2021-09-08T17:39:58.000Z | 2021-09-08T17:39:58.000Z | # -*- encoding:utf-8 -*-
"""示例ump主裁特征跳空模块"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from ..TradeBu.ABuMLFeature import AbuFeatureJump
from ..MLBu.ABuMLPd import AbuMLPd
from .ABuUmpBase import ump_main_make_xy, BuyUmpMixin
from .ABuUmpMainBase import AbuUmpMainBase
__author__ = '阿布'
__weixin__ = 'abu_quant'
class UmpJumpFiter(AbuMLPd):
"""
内部类,只需要实现make_xy,且使用ump_main_make_xy装饰
在__init__中通过:
self.fiter_cls = self.get_fiter_class()
self.fiter = self.fiter_cls(orders_pd=self.orders_pd, **kwarg)
构造裁判的filter以及重要的self.fiter.df,即pd.DataFrame对象特征
"""
@ump_main_make_xy
def make_xy(self, **kwarg):
"""
make_xy通过装饰器ump_main_make_xy进行二次包装
这里只需要使用filter选取需要的特征,即从self.order_has_ret中使用filter选取特征列形成df
:param kwarg: ump_main_make_xy装饰器中使用kwarg
kwargs['orders_pd'] 做为必须要有的关键字参数:交易训练集数据,pd.DataFrame对象
kwargs['scaler'] 做为可选关键字参数:控制在make_xy中返回的特征矩阵数据是否进行标准化处理
:return: self.order_has_ret中使用filter选取特征列形成jump_df
ump_main_make_xy装饰器在make_xy返回jump_df后做转换matrix,形成x,y等工作
"""
# 'regex=result|buy_diff_down_days|buy_diff_up_days|buy_jump_down_power|buy_jump_up_power'
regex = 'result|{}'.format('|'.join(AbuFeatureJump().get_feature_ump_keys(ump_cls=AbuUmpMainJump)))
# noinspection PyUnresolvedReferences
jump_df = self.order_has_ret.filter(regex=regex)
"""
eg: jump_df
result buy_jump_down_power buy_diff_down_days \
2014-09-24 0 0.000 0
2014-10-24 0 0.000 0
2014-10-29 1 -1.109 278
2014-10-29 1 0.000 0
2014-10-29 1 -1.522 75
2014-10-29 1 -1.109 278
2014-11-03 1 -1.451 78
2014-11-11 1 0.000 0
2014-11-12 0 -1.863 82
2014-11-26 0 -2.115 96
... ... ... ...
2016-03-14 1 -2.965 56
2016-03-14 0 -2.323 67
2016-03-30 0 -1.744 74
2016-04-04 1 -2.085 36
2016-04-13 0 -2.940 47
2016-04-14 0 -1.764 100
2016-04-15 0 -1.455 101
2016-04-15 0 -1.455 101
2016-04-29 1 -1.178 24
2016-04-29 1 -1.178 24
buy_jump_up_power buy_diff_up_days
2014-09-24 3.344 61
2014-10-24 3.344 91
2014-10-29 2.920 95
2014-10-29 1.283 243
2014-10-29 3.727 238
2014-10-29 2.920 95
2014-11-03 1.014 214
2014-11-11 1.291 256
2014-11-12 1.606 256
2014-11-26 1.772 270
... ... ...
2016-03-14 2.682 14
2016-03-14 2.478 246
2016-03-30 2.621 32
2016-04-04 1.507 45
2016-04-13 1.678 56
2016-04-14 1.158 71
2016-04-15 1.075 58
2016-04-15 1.075 58
2016-04-29 3.259 0
2016-04-29 3.259 0
"""
return jump_df
class AbuUmpMainJump(AbuUmpMainBase, BuyUmpMixin):
"""主裁跳空特征类,AbuUmpMainBase子类,混入BuyUmpMixin,做为买入ump类"""
def get_predict_col(self):
"""
主裁跳空特征keys:['buy_diff_down_days', 'buy_diff_up_days', 'buy_jump_down_power', 'buy_jump_up_power']
:return: ['buy_diff_down_days', 'buy_diff_up_days', 'buy_jump_down_power', 'buy_jump_up_power']
"""
return AbuFeatureJump().get_feature_ump_keys(ump_cls=AbuUmpMainJump)
def get_fiter_class(self):
"""
主裁特征跳空返回的AbuMLPd子类:AbuUmpMainJump.UmpJumpFiter
:return: AbuUmpMainJump.UmpJumpFiter
"""
return UmpJumpFiter
@classmethod
def class_unique_id(cls):
"""
具体ump类关键字唯一名称,类方法:return 'jump_main'
主要针对外部user设置自定义ump使用, 需要user自己保证class_unique_id的唯一性,内部不做检测
具体使用见ABuUmpManager中extend_ump_block方法
"""
return 'jump_main'
| 45.436975 | 107 | 0.442389 | 547 | 5,407 | 4.124314 | 0.338208 | 0.037234 | 0.028369 | 0.019947 | 0.242465 | 0.229167 | 0.220301 | 0.18617 | 0.099291 | 0.082447 | 0 | 0.211379 | 0.486407 | 5,407 | 118 | 108 | 45.822034 | 0.601008 | 0.229517 | 0 | 0 | 0 | 0 | 0.030519 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.173913 | false | 0 | 0.304348 | 0 | 0.73913 | 0.043478 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 |
c3f2374a17a9b248945183b28a85dc3cfa99acea | 252 | py | Python | py_snappy/exceptions.py | jmcph4/py-snappy | 1b254774f6c4daccba99114704cb9ecd589e6345 | [
"MIT"
] | null | null | null | py_snappy/exceptions.py | jmcph4/py-snappy | 1b254774f6c4daccba99114704cb9ecd589e6345 | [
"MIT"
] | null | null | null | py_snappy/exceptions.py | jmcph4/py-snappy | 1b254774f6c4daccba99114704cb9ecd589e6345 | [
"MIT"
] | null | null | null | class BaseSnappyError(Exception):
"""
Base error class for snappy module.
"""
class CorruptError(BaseSnappyError):
"""
Corrupt input.
"""
class TooLargeError(BaseSnappyError):
"""
Decoded block is too large.
"""
| 14.823529 | 39 | 0.623016 | 22 | 252 | 7.136364 | 0.772727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.257937 | 252 | 16 | 40 | 15.75 | 0.839572 | 0.309524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
c3fc53ef6ebb5f91af9220c74058ad7acda01e0f | 278 | py | Python | QUANTAXIS/QATask/tasks.py | 5267/QUANTAXIS | c3f38b805939e33309e2da7ea8cb32d245c3edfb | [
"MIT"
] | 5 | 2017-06-30T04:42:29.000Z | 2018-01-05T09:20:28.000Z | QUANTAXIS/QATask/tasks.py | 5267/QUANTAXIS | c3f38b805939e33309e2da7ea8cb32d245c3edfb | [
"MIT"
] | null | null | null | QUANTAXIS/QATask/tasks.py | 5267/QUANTAXIS | c3f38b805939e33309e2da7ea8cb32d245c3edfb | [
"MIT"
] | null | null | null | from celery import Celery
import QUANTAXIS
quantaxis = Celery('tasks', backend='amqp://guest@localhost//', broker='amqp://guest@localhost//')
@quantaxis.task
def save_data(all):
pass
def update_data():
pass
def update_spider(name):
pass
def update_all_spiders():
pass | 18.533333 | 98 | 0.73741 | 38 | 278 | 5.263158 | 0.526316 | 0.105 | 0.195 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.122302 | 278 | 15 | 99 | 18.533333 | 0.819672 | 0 | 0 | 0.333333 | 0 | 0 | 0.189964 | 0.172043 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0.333333 | 0.166667 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
6131d01928ed07b7639be6be225eda8360d5131d | 83 | py | Python | src/thermostat/streamlit/download.py | MNasert/thermostat-1 | 983a1121687e0abfb70f874a6d36b1597d8012a4 | [
"Apache-2.0"
] | 91 | 2021-07-03T11:02:26.000Z | 2022-03-24T13:16:29.000Z | src/thermostat/streamlit/download.py | MNasert/thermostat-1 | 983a1121687e0abfb70f874a6d36b1597d8012a4 | [
"Apache-2.0"
] | 3 | 2021-11-06T13:36:17.000Z | 2022-03-18T13:25:36.000Z | src/thermostat/streamlit/download.py | MNasert/thermostat-1 | 983a1121687e0abfb70f874a6d36b1597d8012a4 | [
"Apache-2.0"
] | 4 | 2021-11-05T04:07:01.000Z | 2022-02-09T03:27:25.000Z | import thermostat
data = thermostat.load("imdb-bert-lig", cache_dir="~/datasets")
| 20.75 | 63 | 0.746988 | 11 | 83 | 5.545455 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.084337 | 83 | 3 | 64 | 27.666667 | 0.802632 | 0 | 0 | 0 | 0 | 0 | 0.277108 | 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 |
613562b48cd079bb2f25f0fbf3f58c4cc044bda4 | 262 | py | Python | robovat/robots/franka_panda_free/__init__.py | Steve-Tod/robovat | c87a7ba4228f0a4df2c35c3220d24ff7855eaf9e | [
"MIT"
] | null | null | null | robovat/robots/franka_panda_free/__init__.py | Steve-Tod/robovat | c87a7ba4228f0a4df2c35c3220d24ff7855eaf9e | [
"MIT"
] | null | null | null | robovat/robots/franka_panda_free/__init__.py | Steve-Tod/robovat | c87a7ba4228f0a4df2c35c3220d24ff7855eaf9e | [
"MIT"
] | null | null | null | from .franka_panda_sim_free import FrankaPandaSimFree
def factory(simulator=None, config=None):
assert simulator is not None
# Always use the default real-world Sawyer configuration.
return FrankaPandaSimFree(simulator=simulator, config=config) | 37.428571 | 65 | 0.790076 | 32 | 262 | 6.375 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152672 | 262 | 7 | 66 | 37.428571 | 0.918919 | 0.209924 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
614beed9a041fc223f09b1b74ecc3fa54c705651 | 547 | py | Python | project_name/misc/views.py | django-quickstart/1.5-webfaction | a236081c644eafe500c009c993a204d817742256 | [
"MIT"
] | 1 | 2015-10-18T12:02:59.000Z | 2015-10-18T12:02:59.000Z | project_name/misc/views.py | django-quickstart/1.5-webfaction | a236081c644eafe500c009c993a204d817742256 | [
"MIT"
] | null | null | null | project_name/misc/views.py | django-quickstart/1.5-webfaction | a236081c644eafe500c009c993a204d817742256 | [
"MIT"
] | null | null | null | from django.core.paginator import Paginator
from django.shortcuts import render_to_response, get_object_or_404, HttpResponseRedirect
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect, Http404, HttpResponsePermanentRedirect
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
def home(request):
return render_to_response('home.html', locals(), context_instance=RequestContext(request))
| 45.583333 | 98 | 0.857404 | 65 | 547 | 7.076923 | 0.569231 | 0.152174 | 0.091304 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011976 | 0.084095 | 547 | 11 | 99 | 49.727273 | 0.906188 | 0 | 0 | 0 | 0 | 0 | 0.016453 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.777778 | 0.111111 | 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 |
6159657c23d7eab8c6bc001278608a42d7f97b3a | 804 | py | Python | project/utils/settings_handler.py | MahjongRepository/tenhou-python-bot | e07f480d519930148534e02978ef7687f424924e | [
"MIT"
] | 201 | 2016-06-11T20:04:09.000Z | 2021-12-30T06:32:09.000Z | project/utils/settings_handler.py | MahjongRepository/tenhou-python-bot | e07f480d519930148534e02978ef7687f424924e | [
"MIT"
] | 131 | 2016-05-21T08:06:44.000Z | 2021-03-01T01:01:50.000Z | project/utils/settings_handler.py | MahjongRepository/tenhou-python-bot | e07f480d519930148534e02978ef7687f424924e | [
"MIT"
] | 68 | 2016-10-12T16:17:07.000Z | 2022-02-26T17:36:17.000Z | import importlib
class SettingsSingleton:
"""
Let's load a settings in the memory one time when the app starts
Than override some settings with command arguments
After this we not should change the object
"""
instance = None
def __init__(self):
if not SettingsSingleton.instance:
SettingsSingleton.instance = Settings()
def __getattr__(self, name):
return getattr(self.instance, name)
def __setattr__(self, key, value):
return setattr(self.instance, key, value)
class Settings:
def __init__(self):
mod = importlib.import_module("settings.base")
for setting in dir(mod):
setting_value = getattr(mod, setting)
setattr(self, setting, setting_value)
settings = SettingsSingleton()
| 23.647059 | 68 | 0.666667 | 93 | 804 | 5.55914 | 0.516129 | 0.06383 | 0.042553 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.257463 | 804 | 33 | 69 | 24.363636 | 0.865997 | 0.196517 | 0 | 0.117647 | 0 | 0 | 0.0209 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0 | 0.117647 | 0.117647 | 0.647059 | 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 |
61678423bbdaf4d7c1cada70a347e72e54d1005f | 6,772 | py | Python | test/language/optional_members/python/OptionalExpressionTest.py | dkBrazz/zserio | 29dd8145b7d851fac682d3afe991185ea2eac318 | [
"BSD-3-Clause"
] | 86 | 2018-09-06T09:30:53.000Z | 2022-03-27T01:12:36.000Z | test/language/optional_members/python/OptionalExpressionTest.py | dkBrazz/zserio | 29dd8145b7d851fac682d3afe991185ea2eac318 | [
"BSD-3-Clause"
] | 362 | 2018-09-04T20:21:24.000Z | 2022-03-30T15:14:38.000Z | test/language/optional_members/python/OptionalExpressionTest.py | dkBrazz/zserio | 29dd8145b7d851fac682d3afe991185ea2eac318 | [
"BSD-3-Clause"
] | 20 | 2018-09-10T15:59:02.000Z | 2021-12-01T15:38:22.000Z | import unittest
import zserio
from testutils import getZserioApi
class OptionalExpressionTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.api = getZserioApi(__file__, "optional_members.zs").optional_expression
def testConstructor(self):
container = self.api.Container()
self.assertEqual(None, container.basic_color)
self.assertEqual(None, container.num_black_tones)
self.assertEqual(None, container.black_color)
container = self.api.Container(self.api.BasicColor.BLACK, self.NUM_BLACK_TONES)
self.assertEqual(self.api.BasicColor.BLACK, container.basic_color)
self.assertEqual(self.NUM_BLACK_TONES, container.num_black_tones)
self.assertEqual(None, container.black_color)
container = self.api.Container(basic_color_=self.api.BasicColor.BLACK,
num_black_tones_=self.NUM_BLACK_TONES)
self.assertEqual(self.api.BasicColor.BLACK, container.basic_color)
self.assertEqual(self.NUM_BLACK_TONES, container.num_black_tones)
self.assertEqual(None, container.black_color)
def testEq(self):
container1 = self.api.Container()
container2 = self.api.Container()
self.assertTrue(container1 == container2)
container1.basic_color = self.api.BasicColor.WHITE
container2.basic_color = self.api.BasicColor.BLACK
container2.num_black_tones = self.NUM_BLACK_TONES
container2.black_color = self._createBlackColor(self.NUM_BLACK_TONES)
self.assertFalse(container1 == container2)
container2.basic_color = self.api.BasicColor.WHITE
container2.num_black_tones = None
container2.black_color = None
self.assertTrue(container1 == container2)
def testHash(self):
container1 = self.api.Container()
container2 = self.api.Container()
self.assertEqual(hash(container1), hash(container2))
container1.basic_color = self.api.BasicColor.WHITE
container2.basic_color = self.api.BasicColor.BLACK
container2.num_black_tones = self.NUM_BLACK_TONES
container2.black_color = self._createBlackColor(self.NUM_BLACK_TONES)
self.assertTrue(hash(container1) != hash(container2))
container2.basic_color = self.api.BasicColor.WHITE
container2.num_black_tones = None
container2.black_color = None
self.assertEqual(hash(container1), hash(container2))
def testIsNumBlackTonesUsed(self):
container = self.api.Container()
container.basic_color = self.api.BasicColor.WHITE
self.assertFalse(container.is_num_black_tones_used())
container.basic_color = self.api.BasicColor.BLACK
container.num_black_tones = self.NUM_BLACK_TONES
self.assertTrue(container.is_num_black_tones_used())
self.assertEqual(self.NUM_BLACK_TONES, container.num_black_tones)
def testIsBlackColorUsed(self):
container = self.api.Container()
container.basic_color = self.api.BasicColor.WHITE
self.assertFalse(container.is_black_color_used())
container.basic_color = self.api.BasicColor.BLACK
blackColor = self._createBlackColor(self.NUM_BLACK_TONES)
container.black_color = blackColor
self.assertTrue(container.is_black_color_used())
self.assertTrue(blackColor == container.black_color)
def testBitSizeOf(self):
container = self.api.Container()
container.basic_color = self.api.BasicColor.WHITE
self.assertEqual(self.CONTAINER_BIT_SIZE_WITHOUT_OPTIONAL, container.bitsizeof())
container.basic_color = self.api.BasicColor.BLACK
container.num_black_tones = self.NUM_BLACK_TONES
container.black_color = self._createBlackColor(self.NUM_BLACK_TONES)
self.assertEqual(self.CONTAINER_BIT_SIZE_WITH_OPTIONAL, container.bitsizeof())
def testInitializeOffsets(self):
container = self.api.Container()
container.basic_color = self.api.BasicColor.WHITE
bitPosition = 1
self.assertEqual(bitPosition + self.CONTAINER_BIT_SIZE_WITHOUT_OPTIONAL,
container.initialize_offsets(bitPosition))
container.basic_color = self.api.BasicColor.BLACK
container.num_black_tones = self.NUM_BLACK_TONES
container.black_color = self._createBlackColor(self.NUM_BLACK_TONES)
self.assertEqual(bitPosition + self.CONTAINER_BIT_SIZE_WITH_OPTIONAL,
container.initialize_offsets(bitPosition))
def testWrite(self):
container = self.api.Container()
container.basic_color = self.api.BasicColor.WHITE
writer = zserio.BitStreamWriter()
container.write(writer)
reader = zserio.BitStreamReader(writer.byte_array, writer.bitposition)
self._checkContainerInStream(reader, self.api.BasicColor.WHITE, self.NUM_BLACK_TONES)
reader.bitposition = 0
readContainer = self.api.Container.from_reader(reader)
self.assertEqual(self.api.BasicColor.WHITE, readContainer.basic_color)
self.assertFalse(readContainer.is_num_black_tones_used())
self.assertFalse(readContainer.is_black_color_used())
container.basic_color = self.api.BasicColor.BLACK
container.num_black_tones = self.NUM_BLACK_TONES
blackColor = self._createBlackColor(self.NUM_BLACK_TONES)
container.black_color = blackColor
writer = zserio.BitStreamWriter()
container.write(writer)
reader = zserio.BitStreamReader(writer.byte_array, writer.bitposition)
self._checkContainerInStream(reader, self.api.BasicColor.BLACK, self.NUM_BLACK_TONES)
reader.bitposition = 0
readContainer = self.api.Container.from_reader(reader)
self.assertEqual(self.api.BasicColor.BLACK, readContainer.basic_color)
self.assertEqual(self.NUM_BLACK_TONES, readContainer.num_black_tones)
self.assertTrue(blackColor == readContainer.black_color)
self.assertTrue(readContainer.is_num_black_tones_used())
self.assertTrue(readContainer.is_black_color_used())
def _createBlackColor(self, numBlackTones):
return self.api.BlackColor(numBlackTones, [i + 1 for i in range(numBlackTones)])
def _checkContainerInStream(self, reader, basicColor, numBlackTones):
self.assertEqual(basicColor.value, reader.read_bits(8))
if basicColor == self.api.BasicColor.BLACK:
self.assertEqual(numBlackTones, reader.read_bits(8))
for i in range(numBlackTones):
self.assertEqual(i + 1, reader.read_signed_bits(32))
NUM_BLACK_TONES = 2
CONTAINER_BIT_SIZE_WITHOUT_OPTIONAL = 8
CONTAINER_BIT_SIZE_WITH_OPTIONAL = 8 + 8 + 32 * 2
| 46.068027 | 93 | 0.719285 | 757 | 6,772 | 6.190225 | 0.10568 | 0.059752 | 0.108195 | 0.072557 | 0.801323 | 0.723218 | 0.692275 | 0.625907 | 0.607554 | 0.607554 | 0 | 0.008419 | 0.193148 | 6,772 | 146 | 94 | 46.383562 | 0.849195 | 0 | 0 | 0.561983 | 0 | 0 | 0.002806 | 0 | 0 | 0 | 0 | 0 | 0.297521 | 1 | 0.090909 | false | 0 | 0.024793 | 0.008264 | 0.157025 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
616b03ba4ebce60f12c018b8045d41a0c836a28d | 918 | py | Python | tools/leetcode.021.Merge Two Sorted Lists/leetcode.021.Merge Two Sorted Lists.submission3.py | tedye/leetcode | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | [
"MIT"
] | 4 | 2015-10-10T00:30:55.000Z | 2020-07-27T19:45:54.000Z | tools/leetcode.021.Merge Two Sorted Lists/leetcode.021.Merge Two Sorted Lists.submission3.py | tedye/leetcode | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | [
"MIT"
] | null | null | null | tools/leetcode.021.Merge Two Sorted Lists/leetcode.021.Merge Two Sorted Lists.submission3.py | tedye/leetcode | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | [
"MIT"
] | null | null | null | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param two ListNodes
# @return a ListNode
def mergeTwoLists(self, l1, l2):
if l1 == None: return l2
if l2 == None: return l1
temp1 = l1
temp2 = l2
temp3 = ListNode(-1) # dummy head
temp = temp3
while temp1 != None and temp2 != None:
if temp1.val <= temp2.val:
temp3.next = temp1
temp1 = temp1.next
temp3 = temp3.next
elif temp1.val > temp2.val:
temp3.next = temp2
temp2 = temp2.next
temp3 = temp3.next
if temp1 == None:
temp3.next = temp2
elif temp2 == None:
temp3.next = temp1
return temp.next | 918 | 918 | 0.478214 | 100 | 918 | 4.35 | 0.34 | 0.124138 | 0.05977 | 0.073563 | 0.114943 | 0.114943 | 0 | 0 | 0 | 0 | 0 | 0.071705 | 0.437909 | 918 | 1 | 918 | 918 | 0.771318 | 0.990196 | 0 | 0.272727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.045455 | false | 0 | 0 | 0 | 0.136364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
61a5e093c15bffb05b7112743e74f09346f15023 | 328 | py | Python | hilearn/__init__.py | huangyh09/hilearn | 039010d94925d384030bdb9b2d5c06f849f17afa | [
"Apache-2.0"
] | 4 | 2017-07-12T07:47:28.000Z | 2020-09-27T13:08:10.000Z | hilearn/__init__.py | huangyh09/hilearn | 039010d94925d384030bdb9b2d5c06f849f17afa | [
"Apache-2.0"
] | null | null | null | hilearn/__init__.py | huangyh09/hilearn | 039010d94925d384030bdb9b2d5c06f849f17afa | [
"Apache-2.0"
] | 2 | 2020-09-28T11:00:00.000Z | 2021-07-03T03:32:41.000Z | # Copyright(c) 2019, The HiLearn developer (Yuanhua Huang)
from .version import __version__
from .utils.base import match, id_mapping, rm_none
from .stats.base_stats import permutation_test
from .models.cross_validation import CrossValidation
from .models.mix_linear_regression import MixLinearRegression
from .plot import *
| 29.818182 | 61 | 0.829268 | 44 | 328 | 5.931818 | 0.681818 | 0.076628 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013746 | 0.112805 | 328 | 10 | 62 | 32.8 | 0.883162 | 0.170732 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
61b8671da9a40bd21715626fd07055f0c7d4f9b2 | 1,741 | py | Python | laph3x_test.py | strickyak/aphid | 12469858facdc9d7f110bf6c895e58eae9fb728f | [
"MIT"
] | 2 | 2015-05-25T10:47:30.000Z | 2017-12-12T18:15:00.000Z | laph3x_test.py | strickyak/aphid | 12469858facdc9d7f110bf6c895e58eae9fb728f | [
"MIT"
] | null | null | null | laph3x_test.py | strickyak/aphid | 12469858facdc9d7f110bf6c895e58eae9fb728f | [
"MIT"
] | null | null | null | import laph3 as L
t1 = L.Compile(`
a = bilbo
b = {
c = {
d = frodo
}
e = {
d = samwise
}
}
`)
must t1.Resolve('/') == set(['a', 'b'])
must t1.Resolve('/a') == 'bilbo'
must t1.Resolve('/b') == set(['c', 'e'])
must t1.Resolve('/b/c') == set(['d'])
must t1.Resolve('/b/c/d') == 'frodo'
################################
t2 = L.Compile(`
Q = { a = 111 ; b = 222 }
R = Q { a = 777 ; c = 888}
`)
must t2.Resolve('/') == set(['Q', 'R'])
must t2.Resolve('/Q') == set(['a', 'b'])
must t2.Resolve('/R') == set(['a', 'b', 'c'])
must t2.Resolve('/Q/a') == '111'
must t2.Resolve('/Q/b') == '222'
must t2.Resolve('/R/a') == '777'
must t2.Resolve('/R/b') == '222'
must t2.Resolve('/R/c') == '888'
################################
t3 = L.Compile(`
X = {
M = { a = 111 ; b = 222 }
N = { c = 333 ; d = 444 }
}
Y = X {
M { a = 555 ; f = 666 }
P = { z = 888 }
}
`)
must t3.Resolve('/') == set(['X', 'Y'])
must t3.Resolve('/X') == set(['M', 'N'])
must t3.Resolve('/Y') == set(['M', 'N', 'P'])
must t3.Resolve('/X/M/a') == '111'
must t3.Resolve('/X/M/b') == '222'
must t3.Resolve('/X/N/c') == '333'
must t3.Resolve('/X/N/d') == '444'
must t3.Resolve('/Y/M') == set(['a', 'b', 'f'])
must t3.Resolve('/Y/M/a') == '555'
must t3.Resolve('/Y/M/b') == '222'
must t3.Resolve('/Y/M/f') == '666'
must t3.Resolve('/Y/N/d') == '444'
must t3.Resolve('/Y/P/z') == '888'
################################
t4 = L.Compile(`
OLD = {
info = { age = old }
P = info { size = small }
Q = P { size = medium }
}
NEW = OLD {
info { age = new }
}
`)
must t4.Resolve('/NEW/P/size') == 'small'
must t4.Resolve('/NEW/P/age') == 'new'
################################
print 'OKAY laph3_alt.py'
| 20.72619 | 47 | 0.429064 | 269 | 1,741 | 2.773234 | 0.178439 | 0.104558 | 0.226542 | 0.131367 | 0.336461 | 0.147453 | 0.050938 | 0 | 0 | 0 | 0 | 0.080088 | 0.218265 | 1,741 | 83 | 48 | 20.975904 | 0.468038 | 0 | 0 | 0.061538 | 0 | 0 | 0.138252 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.015385 | null | null | 0.015385 | 0 | 0 | 0 | null | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f604d41f6ef4e2e6d81e07dc877eac4a79f0e1aa | 108 | py | Python | help_call.py | Qui-Gon-Jin/Revised-Bot | 256b094d71e83d9315ed5fab42772bef6ea82cde | [
"MIT"
] | 1 | 2021-02-23T08:31:29.000Z | 2021-02-23T08:31:29.000Z | help_call.py | Qui-Gon-Jin/Revised-Bot | 256b094d71e83d9315ed5fab42772bef6ea82cde | [
"MIT"
] | null | null | null | help_call.py | Qui-Gon-Jin/Revised-Bot | 256b094d71e83d9315ed5fab42772bef6ea82cde | [
"MIT"
] | null | null | null | def help():
help_file = "help.txt"
with open(help_file) as help:
content = help.read()
return(content)
| 18 | 30 | 0.685185 | 17 | 108 | 4.235294 | 0.588235 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 108 | 5 | 31 | 21.6 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0.074074 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.2 | 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 |
f609b3ef81a2f71dcf3e5d38e124ca81e3f05644 | 207 | py | Python | benchmark/pysas7bdat.py | olivia76/cpp-sas7bdat | 1cd22561a13ee3df6bcec0b057f928de2014b81f | [
"Apache-2.0"
] | 4 | 2021-12-23T13:24:03.000Z | 2022-02-24T10:20:12.000Z | benchmark/pysas7bdat.py | olivia76/cpp-sas7bdat | 1cd22561a13ee3df6bcec0b057f928de2014b81f | [
"Apache-2.0"
] | 6 | 2022-02-23T14:05:53.000Z | 2022-03-17T13:47:46.000Z | benchmark/pysas7bdat.py | olivia76/cpp-sas7bdat | 1cd22561a13ee3df6bcec0b057f928de2014b81f | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
from sas7bdat import SAS7BDAT
import sys
def main(inputfilename):
sas = SAS7BDAT(inputfilename)
for row in sas:
pass
if __name__ == '__main__':
main(sys.argv[1])
| 15.923077 | 33 | 0.671498 | 28 | 207 | 4.678571 | 0.714286 | 0.21374 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024845 | 0.222222 | 207 | 12 | 34 | 17.25 | 0.78882 | 0.096618 | 0 | 0 | 0 | 0 | 0.043011 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0.125 | 0.25 | 0 | 0.375 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
f615089eacec5cfaec8ac030fbda6607e078b242 | 86 | py | Python | data/studio21_generated/interview/1673/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | data/studio21_generated/interview/1673/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | data/studio21_generated/interview/1673/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | class Solution:
def minFallingPathSum(self, arr: List[List[int]]) -> int:
| 28.666667 | 61 | 0.627907 | 10 | 86 | 5.4 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.232558 | 86 | 3 | 62 | 28.666667 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f6284decdfa61ea5298e71fcb9c258236194b38a | 1,470 | bzl | Python | tools/bazel_deps.bzl | longlho/gazelle_typescript | 0abc1c732d37e60ec0092143d78c0875722dc980 | [
"MIT"
] | 2 | 2022-02-18T21:24:00.000Z | 2022-03-23T06:15:37.000Z | tools/bazel_deps.bzl | longlho/gazelle_typescript | 0abc1c732d37e60ec0092143d78c0875722dc980 | [
"MIT"
] | null | null | null | tools/bazel_deps.bzl | longlho/gazelle_typescript | 0abc1c732d37e60ec0092143d78c0875722dc980 | [
"MIT"
] | null | null | null | # Third-party dependencies fetched by Bazel
# Unlike WORKSPACE, the content of this file is unordered.
# We keep them separate to make the WORKSPACE file more maintainable.
# Install the nodejs "bootstrap" package
# This provides the basic tools for running and packaging nodejs programs in Bazel
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def fetch_dependencies():
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "8f5f192ba02319254aaf2cdcca00ec12eaafeb979a80a1e946773c520ae0a2c9",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.7.0/rules_nodejs-3.7.0.tar.gz"],
)
http_archive(
name = "io_bazel_rules_go",
sha256 = "8e968b5fcea1d2d64071872b12737bbb5514524ee5f0a4f54f5920266c261acb",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip",
],
)
http_archive(
name = "bazel_gazelle",
sha256 = "62ca106be173579c0a167deb23358fdfe71ffa1e4cfdddf5582af26520f1c66f",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
],
)
| 45.9375 | 132 | 0.706803 | 180 | 1,470 | 5.661111 | 0.394444 | 0.044161 | 0.093229 | 0.070658 | 0.349362 | 0.315996 | 0.315996 | 0.315996 | 0.266928 | 0.266928 | 0 | 0.132401 | 0.172789 | 1,470 | 31 | 133 | 47.419355 | 0.705592 | 0.194558 | 0 | 0.304348 | 0 | 0.217391 | 0.677419 | 0.220713 | 0 | 0 | 0 | 0 | 0 | 1 | 0.043478 | true | 0 | 0 | 0 | 0.043478 | 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 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f62c8e08ce2f1609ed891605aa46b061bd211608 | 2,368 | py | Python | gitql/ast.py | mackong/gitql | ca6ca3f99106385ca5876abfa0410a5f216a2444 | [
"MIT"
] | null | null | null | gitql/ast.py | mackong/gitql | ca6ca3f99106385ca5876abfa0410a5f216a2444 | [
"MIT"
] | null | null | null | gitql/ast.py | mackong/gitql | ca6ca3f99106385ca5876abfa0410a5f216a2444 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .token import TokenType, Token
class AST(object):
"""Base class of Abstract-Syntax-Tree. """
pass
class NumNode(AST):
"""Number node."""
def __init__(self, token):
self.token = token
self.value = token.value
def __repr__(self):
return '{!r}'.foramt(self.value)
class StringNode(AST):
"""String node."""
def __init__(self, token):
self.token = token
self.value = token.value
def __repr__(self):
return '{!r}'.format(self.value)
class IdentifierNode(AST):
"""Identifier node."""
def __init__(self, token):
self.token = token
self.value = token.value
def __repr__(self):
return '{!r}'.format(self.value)
class UnaryOpNode(AST):
"""Unary operator node."""
def __init__(self, expr, op):
self.expr = expr
self.token = self.op = op
def __repr__(self):
return '{!r}: ({!r})'.format(self.op.value, self.expr)
class BinOpNode(AST):
"""Binary operator node."""
def __init__(self, left, op, right):
self.left = left
self.token = self.op = op
self.right = right
def __repr__(self):
return '({!r} {!r} {!r})'.format(self.left, self.op.value, self.right)
class WhereNode(AST):
"""Where clauses node."""
def __init__(self, cond):
self.cond = cond
def __repr__(self):
return '{!r}'.format(self.cond)
class OrderNode(AST):
"""Order by node."""
def __init__(self, field, order):
self.field = field
self.token = self.order = order
self.asc = self.token.token_type == TokenType.T_ASC
def __repr__(self):
return '{!r} {!r}'.format(self.field, self.asc)
class LimitNode(AST):
"""Limit node."""
def __init__(self,
limit=Token(TokenType.T_NUMBER, 10),
offset=Token(TokenType.T_NUMBER, 0)):
self.limit = limit
self.offset = offset
def __repr__(self):
return '{!r} {!r}'.format(self.limit.value, self.offset.value)
class SelectNode(AST):
"""Select statement node."""
def __init__(self, fields, table, where, order, limit):
self.fields = fields
self.table = table
self.where = where
self.order = order
self.limit = limit
| 21.142857 | 78 | 0.577703 | 291 | 2,368 | 4.453608 | 0.226804 | 0.069444 | 0.076389 | 0.104167 | 0.36034 | 0.298611 | 0.283951 | 0.262346 | 0.195216 | 0.195216 | 0 | 0.002313 | 0.269848 | 2,368 | 111 | 79 | 21.333333 | 0.747253 | 0.09924 | 0 | 0.377049 | 0 | 0 | 0.029793 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.278689 | false | 0.016393 | 0.016393 | 0.131148 | 0.590164 | 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 |
f6333bd7b289956b06e50019627ae9dd3baa8095 | 379 | py | Python | test-data/unit/fixtures/classmethod.py | ddfisher/mypy | be0e8f2f9e40b50de8219994867e0102e017129a | [
"PSF-2.0"
] | null | null | null | test-data/unit/fixtures/classmethod.py | ddfisher/mypy | be0e8f2f9e40b50de8219994867e0102e017129a | [
"PSF-2.0"
] | null | null | null | test-data/unit/fixtures/classmethod.py | ddfisher/mypy | be0e8f2f9e40b50de8219994867e0102e017129a | [
"PSF-2.0"
] | null | null | null | import typing
class object:
def __init__(self) -> None: pass
class type:
def __init__(self, x) -> None: pass
def mro(self) -> typing.Any: pass
class function: pass
# Dummy definitions.
classmethod = object()
staticmethod = object()
class int:
@classmethod
def from_bytes(cls, bytes: bytes, byteorder: str) -> int: pass
class str: pass
class bytes: pass
| 17.227273 | 66 | 0.686016 | 51 | 379 | 4.921569 | 0.470588 | 0.143426 | 0.087649 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.205805 | 379 | 21 | 67 | 18.047619 | 0.833887 | 0.047493 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.5 | 0.071429 | 0 | 0.785714 | 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 |
f65351d094914025c58e93ba850a5cdb895111aa | 241 | py | Python | ker/__init__.py | csvwolf/ker.py | ac86e1f01cdef0f3ae8b45022df20e8f4fcc9a76 | [
"MIT"
] | 5 | 2019-09-30T08:40:53.000Z | 2019-10-14T10:22:06.000Z | ker/__init__.py | csvwolf/ker.py | ac86e1f01cdef0f3ae8b45022df20e8f4fcc9a76 | [
"MIT"
] | null | null | null | ker/__init__.py | csvwolf/ker.py | ac86e1f01cdef0f3ae8b45022df20e8f4fcc9a76 | [
"MIT"
] | null | null | null | """
Export all functions in ker.py to direct import
Etc:
from ker import Ker # which is in ker.main
from ker import HostkerException # which is in ker.utils.request
"""
from ker.main import *
from ker.utils import *
from ker.api import *
| 18.538462 | 64 | 0.738589 | 41 | 241 | 4.341463 | 0.439024 | 0.196629 | 0.146067 | 0.134831 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.182573 | 241 | 12 | 65 | 20.083333 | 0.903553 | 0.676349 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
f679dc2b40201a9a1c4ca8b9853838b63766bbf6 | 189 | py | Python | commons/utils.py | UKnowWhoIm/student-mail-benefits | 2d28dc6103dc37c64f4d7ddbaabebb4c67fb0fcd | [
"MIT"
] | null | null | null | commons/utils.py | UKnowWhoIm/student-mail-benefits | 2d28dc6103dc37c64f4d7ddbaabebb4c67fb0fcd | [
"MIT"
] | 8 | 2021-01-07T14:50:01.000Z | 2021-04-01T13:10:47.000Z | commons/utils.py | UKnowWhoIm/student-mail-benefits | 2d28dc6103dc37c64f4d7ddbaabebb4c67fb0fcd | [
"MIT"
] | 2 | 2021-01-08T13:50:35.000Z | 2021-01-19T07:35:35.000Z | import os
from django.contrib.auth.hashers import get_hasher
def hash_function(string):
hasher = get_hasher()
return hasher.encode(string, os.environ.get("HASH_TOKEN_SALT", ""))
| 21 | 71 | 0.746032 | 27 | 189 | 5.037037 | 0.666667 | 0.132353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137566 | 189 | 8 | 72 | 23.625 | 0.834356 | 0 | 0 | 0 | 0 | 0 | 0.079365 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
9ca3b49bca2e12d0667973728f8442941d24729a | 55 | py | Python | src/__init__.py | ldgabbay/mkciud | f7413588ce65d9a42c627fb2bdb4b3f1e8bcdca6 | [
"MIT"
] | null | null | null | src/__init__.py | ldgabbay/mkciud | f7413588ce65d9a42c627fb2bdb4b3f1e8bcdca6 | [
"MIT"
] | null | null | null | src/__init__.py | ldgabbay/mkciud | f7413588ce65d9a42c627fb2bdb4b3f1e8bcdca6 | [
"MIT"
] | null | null | null | __version__ = "1.0.0"
from ._internal import UserData
| 13.75 | 31 | 0.745455 | 8 | 55 | 4.5 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.06383 | 0.145455 | 55 | 3 | 32 | 18.333333 | 0.702128 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 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 |
9cac1b502a24d4541bc001b63635cb9ae5a659f1 | 1,371 | py | Python | picraft/enums/__init__.py | DannyGoodall/picraft | 27cb3ab2384367e29d0eb0d964b635fb37516e37 | [
"BSD-3-Clause"
] | null | null | null | picraft/enums/__init__.py | DannyGoodall/picraft | 27cb3ab2384367e29d0eb0d964b635fb37516e37 | [
"BSD-3-Clause"
] | null | null | null | picraft/enums/__init__.py | DannyGoodall/picraft | 27cb3ab2384367e29d0eb0d964b635fb37516e37 | [
"BSD-3-Clause"
] | null | null | null | from .vegetation import Tree, TREE_TYPES, enum_tree_types, BambooLeaves, BAMBOO_LEAF_TYPES, enum_bamboo_leaves
from .instrument import Instrument, INSTRUMENT_TYPES, enum_instruments
from .positional import Compass, CARDINAL_COMPASS_TYPES, INTERCARDINAL_COMPASS_TYPES, SECONDARY_INTERCARDINAL_COMPASS_TYPES, \
UPDOWNTYPES, enum_up_down, enum_intercardinal_compass, enum_cardinal_compass_types, \
enum_secondary_intercardinal_compass, RailShape, RAIL_SHAPE_TYPES, enum_rail_shapes
from .block import SlabType, SLAB_TYPES, enum_slabs, BisectedType, BISECTED_TYPES, enum_bisected_types, \
BISECTED_DOOR_TYPES, enum_bisected_doors, StairType, STAIRTYPES, enum_stairs, \
ChestType, CHEST_TYPES, enum_chests, WallHeightType, WALL_HEIGHT_TYPES, enum_wall_heights, \
ComparatorType, COMPARATOR_TYPES, enum_comparator_types, \
StructureBlockType, STRUCTURE_BLOCK_TYPES, enum_structure_block_types, \
BedType, BED_TYPES, enum_bed_types, TechnicalPistonType, TECHNICAL_PISTON_TYPES, enum_technical_pistons, \
DoorHingeType, DOOR_HINGE_TYPES, enum_door_hinge_types
from .faces import AttachedFaceType, ATTACHED_FACES_TYPE, enum_attached_faces, \
JigsawOrientationType, JIGSAW_ORIENTATION_TYPES, enum_jigsaw_orientation, \
BellAttachmentType, BELL_ATTACHMENT_TYPES, enum_bell_attachments
from .general import BooleanString, BOOLEAN_STRING_TYPES
| 80.647059 | 126 | 0.849745 | 162 | 1,371 | 6.697531 | 0.425926 | 0.141014 | 0.036866 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09628 | 1,371 | 16 | 127 | 85.6875 | 0.875706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.1875 | 0.375 | 0 | 0.375 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
9cb0062b9720b9d72beef50ef155ca604ed1f111 | 286 | py | Python | roslip/db.py | AlexFerrero/roslip-opensource | 3d8529f9ffb628e148023b9b9b7e68fe2b9986af | [
"MIT"
] | null | null | null | roslip/db.py | AlexFerrero/roslip-opensource | 3d8529f9ffb628e148023b9b9b7e68fe2b9986af | [
"MIT"
] | null | null | null | roslip/db.py | AlexFerrero/roslip-opensource | 3d8529f9ffb628e148023b9b9b7e68fe2b9986af | [
"MIT"
] | 3 | 2021-07-11T15:04:17.000Z | 2021-11-27T23:52:20.000Z | import os
from redis import Redis
from roslip.config import config
REDIS_URI = config["REDIS_URI"]
REDIS_PORT = config["REDIS_PORT"]
REDIS_PW = config["REDIS_PW"]
def get_db():
return Redis(REDIS_URI,
REDIS_PORT,
password=REDIS_PW)
| 20.428571 | 36 | 0.63986 | 38 | 286 | 4.552632 | 0.368421 | 0.254335 | 0.16185 | 0.196532 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.276224 | 286 | 13 | 37 | 22 | 0.835749 | 0 | 0 | 0 | 0 | 0 | 0.098901 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0.1 | 0.3 | 0.1 | 0.5 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
9cc590a3c1d3a3c7722156274b328b8180dbc5b8 | 532 | py | Python | Programming_in_Python/Cyclic Sort/Cyclic_Sort.py | vivekagarwal2349/Mini_Python_Projects | 96fa28d851cddefa5d9a63823b1a9b04ad6c3e04 | [
"MIT"
] | 1 | 2021-10-03T06:02:40.000Z | 2021-10-03T06:02:40.000Z | Programming_in_Python/Cyclic Sort/Cyclic_Sort.py | vivekagarwal2349/Mini_Python_Projects | 96fa28d851cddefa5d9a63823b1a9b04ad6c3e04 | [
"MIT"
] | 1 | 2021-10-09T18:22:23.000Z | 2021-10-09T23:00:31.000Z | Programming_in_Python/Cyclic Sort/Cyclic_Sort.py | vivekagarwal2349/Mini_Python_Projects | 96fa28d851cddefa5d9a63823b1a9b04ad6c3e04 | [
"MIT"
] | null | null | null | # Our Input Array
arr = [3,2,4,1]
def Cyclic_sort(arr):
"""
This function will check if the element at i is at the correct index
or not. If it is not at the correct index then it will swap places and if
it is then we will increment the value of i by 1.
"""
i = 0
while i < len(arr):
correct_index = arr[i] - 1
if arr[i] != arr[correct_index]:
arr[i], arr[correct_index] = arr[correct_index], arr[i]
else:
i += 1
return arr
print(Cyclic_sort(arr))
| 24.181818 | 78 | 0.588346 | 91 | 532 | 3.373626 | 0.450549 | 0.234528 | 0.19544 | 0.234528 | 0.247557 | 0.13355 | 0 | 0 | 0 | 0 | 0 | 0.021918 | 0.31391 | 532 | 21 | 79 | 25.333333 | 0.819178 | 0.394737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0 | 0 | 0.181818 | 0.090909 | 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 |
9cd2a16c808445cd0f245a5c2e3e91e82abd701c | 3,294 | py | Python | gufe/tests/conftest.py | OpenFreeEnergy/gufe | 3ee39f695e70c17cf1205597379f4be0481ca781 | [
"MIT"
] | 6 | 2022-03-25T09:52:10.000Z | 2022-03-29T19:24:47.000Z | gufe/tests/conftest.py | OpenFreeEnergy/gufe | 3ee39f695e70c17cf1205597379f4be0481ca781 | [
"MIT"
] | 12 | 2022-03-25T19:57:53.000Z | 2022-03-31T20:12:50.000Z | gufe/tests/conftest.py | OpenFreeEnergy/gufe | 3ee39f695e70c17cf1205597379f4be0481ca781 | [
"MIT"
] | null | null | null | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/gufe
import importlib.resources
import pytest
from rdkit import Chem
import gufe
## data file paths
@pytest.fixture
def serialization_template():
def inner(filename):
loc = "gufe.tests.data"
tmpl = importlib.resources.read_text(loc, filename)
return tmpl.format(OFE_VERSION=gufe.__version__)
return inner
@pytest.fixture
def toluene_mol2_path():
with importlib.resources.path('gufe.tests.data', 'toluene.mol2') as f:
yield str(f)
@pytest.fixture
def multi_molecule_sdf():
fn = 'multi_molecule.sdf'
with importlib.resources.path('gufe.tests.data', fn) as f:
yield str(f)
@pytest.fixture
def PDB_181L_path():
with importlib.resources.path('gufe.tests.data', '181l.pdb') as f:
yield str(f)
@pytest.fixture
def PDBx_181L_path():
with importlib.resources.path('gufe.tests.data', '181l.cif') as f:
yield str(f)
## RDKit molecules
@pytest.fixture
def benzene_modifications():
with importlib.resources.path('gufe.tests.data',
'benzene_modifications.sdf') as f:
supp = Chem.SDMolSupplier(str(f), removeHs=False)
mols = list(supp)
return {m.GetProp('_Name'): m for m in mols}
## Components
@pytest.fixture
def benzene(benzene_modifications):
return gufe.SmallMoleculeComponent(benzene_modifications["benzene"])
@pytest.fixture
def toluene(benzene_modifications):
return gufe.SmallMoleculeComponent(benzene_modifications["toluene"])
@pytest.fixture
def phenol(benzene_modifications):
return gufe.SmallMoleculeComponent(benzene_modifications['phenol'])
@pytest.fixture
def benzonitrile(benzene_modifications):
return gufe.SmallMoleculeComponent(benzene_modifications["benzonitrile"])
@pytest.fixture
def anisole(benzene_modifications):
return gufe.SmallMoleculeComponent(benzene_modifications["anisole"])
@pytest.fixture
def benzaldehyde(benzene_modifications):
return gufe.SmallMoleculeComponent(benzene_modifications["benzaldehyde"])
@pytest.fixture
def styrene(benzene_modifications):
return gufe.SmallMoleculeComponent(benzene_modifications["styrene"])
@pytest.fixture(scope="session")
def ethane():
return gufe.SmallMoleculeComponent(Chem.MolFromSmiles("CC"))
@pytest.fixture
def prot_comp(PDB_181L_path):
yield gufe.ProteinComponent.from_pdbfile(PDB_181L_path)
@pytest.fixture
def solv_comp():
yield gufe.SolventComponent(positive_ion="K", negative_ion="Cl")
@pytest.fixture
def toluene_ligand_comp(benzene_modifications):
yield gufe.SmallMoleculeComponent.from_rdkit(benzene_modifications["toluene"])
@pytest.fixture
def phenol_ligand_comp(benzene_modifications):
yield gufe.SmallMoleculeComponent.from_rdkit(benzene_modifications["phenol"])
## ChemicalSystems
@pytest.fixture
def solvated_complex(prot_comp, solv_comp, toluene_ligand_comp):
return gufe.ChemicalSystem(
{"protein": prot_comp, "solvent": solv_comp, "ligand": toluene_ligand_comp},
)
@pytest.fixture
def solvated_ligand(solv_comp, toluene_ligand_comp):
return gufe.ChemicalSystem(
{"ligand": toluene_ligand_comp, "solvent": solv_comp},
)
| 23.528571 | 84 | 0.745902 | 389 | 3,294 | 6.141388 | 0.267352 | 0.108832 | 0.12725 | 0.087903 | 0.48514 | 0.480117 | 0.480117 | 0.212223 | 0.118041 | 0.118041 | 0 | 0.00711 | 0.146023 | 3,294 | 139 | 85 | 23.697842 | 0.842161 | 0.054948 | 0 | 0.308642 | 0 | 0 | 0.090909 | 0.008059 | 0 | 0 | 0 | 0 | 0 | 1 | 0.259259 | false | 0 | 0.123457 | 0.123457 | 0.54321 | 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 |
9cee7479213effeb1dfe65574beb72de37621749 | 8,672 | py | Python | vortex/ui/graphicsdatamodel.py | dsparrow27/vortexUI | 2feb629a0c6214c9f6b1d7867a3afd43fbba8739 | [
"MIT"
] | null | null | null | vortex/ui/graphicsdatamodel.py | dsparrow27/vortexUI | 2feb629a0c6214c9f6b1d7867a3afd43fbba8739 | [
"MIT"
] | null | null | null | vortex/ui/graphicsdatamodel.py | dsparrow27/vortexUI | 2feb629a0c6214c9f6b1d7867a3afd43fbba8739 | [
"MIT"
] | 1 | 2020-09-08T16:12:51.000Z | 2020-09-08T16:12:51.000Z | from qt import QtGui, QtCore
class ObjectModel(QtCore.QObject):
"""ObjectModel class Handles communication between the GUI Elements and the core engine logic,
Any subclass of ObjectModel must emit the following Signals which require objectModel or attributeModel
this will mean you will need to translate any client logic and objects back the objectModel currently
being referenced.
addConnectionSig
removeConnectionSig
addAttributeSig
nodeNameChangedSig
removeAttributeSig
attributeNameChangedSig
valueChangedSig
selectionChangedSig
parentChangedSig
progressUpdatedSig
"""
# constants for attribute visibility
ATTRIBUTE_VIS_LEVEL_ZERO = 0
ATTRIBUTE_VIS_LEVEL_ONE = 1
ATTRIBUTE_VIS_LEVEL_TWO = 2
# subclass should emit these signals to update the GUI from the core
# signals connected by the graphics scene
addConnectionSig = QtCore.Signal(object, object) # sourceAttrModel, destAttrModel
removeConnectionSig = QtCore.Signal(object, object) # sourceAttributeModel, destinationModel
# connected by the GraphicsNode
addAttributeSig = QtCore.Signal(object) # attributeModel
nodeNameChangedSig = QtCore.Signal(object) # objectModel
removeAttributeSig = QtCore.Signal(object) # attributeModel
attributeNameChangedSig = QtCore.Signal(object) # attributeModel
valueChangedSig = QtCore.Signal(object) # attributeModel
selectionChangedSig = QtCore.Signal(bool) # selectionState
parentChangedSig = QtCore.Signal(object, object) # childObjectModel, parentObjectModel
progressUpdatedSig = QtCore.Signal(object, object) # objectModel
requestRefresh = QtCore.Signal()
def __init__(self, config, parent=None):
super(ObjectModel, self).__init__()
self.config = config
self._parent = parent
self._children = []
self._icon = ""
self._attributes = []
if parent is not None and self not in parent.children():
parent._children.append(self)
def __repr__(self):
return "<{}-{}>".format(self.__class__.__name__, self.text())
def icon(self):
"""Icon path for the node
:rtype: str
"""
return self._icon
def isSelected(self):
"""Returns if the node is currently selected
:rtype: bool
"""
return False
def setSelected(self, value):
"""Sets the nodes selection state, gets called from the nodeEditor each time a node is selected.
:param value: True if the node has been selected in the UI
:type value: bool
"""
pass
def isCompound(self):
"""Returns True if the node is a compound, Compounds a treated as special entities, Eg. Expansion
:rtype: bool
"""
return False
def category(self):
"""This method returns the node category, each node should be associated with one category the default is 'Basic'.
The category is used for the widgets to organize the node library.
:return: This node category
:rtype: str
"""
return "Basic"
def parentObject(self):
"""Parent Object Model, should be a compound node.
:return: The parent compound ObjectModel
:rtype: ::class:`ObjectModel`
"""
return self._parent
def child(self, index):
"""Retrieve's the child objectModel by index
:param index: The child index
:type index: int
:return: The child Node ObjectModel
:rtype: ::class:`ObjectModel`
"""
if index in xrange(len(self._children)):
return self._children[index]
def children(self):
return self._children
def __hash__(self):
return id(self)
def text(self):
"""The primary node text usually the node name.
:return: The Text to display
:rtype: str
"""
return "primary header"
def setText(self, value):
pass
def secondaryText(self):
"""The Secondary text to display just under the primary text (self.text()).
:rtype: str
"""
return ""
def attribute(self, name):
"""Return the attributeModel by name.
:param name: The attribute name.
:type name: str
:return: An existing AttributeModel of this node
:rtype: ::class:`ObjectModel` or None
"""
for attr in self.attributes():
if attr.text() == name:
return attr
def attributes(self, inputs=True, outputs=True, attributeVisLevel=0):
"""List of Attribute models to display on the node.
:param inputs: return inputs
:type inputs: bool
:param outputs: Return outputs
:type outputs: bool
:param attributeVisLevel:
:type attributeVisLevel: int
:return: Returns a list of AttributeModels containing inputs and outputs(depending of parameters)
:rtype: list(::class::`AttributeModel`)
"""
return []
def canCreateAttributes(self):
"""Determines if the user can create attributes on this node.
:rtype: bool
"""
return False
def createAttribute(self, **kwargs):
pass
def deleteAttribute(self, attribute):
pass
def hasAttribute(self, name):
return self.attribute(name) is not None
def toolTip(self):
"""The Tooltip to display.
:return: The tooltip which will be display when hovering over the node.
:rtype: str
"""
return "hello world"
def minimumHeight(self):
return 80
def minimumWidth(self):
return 150
def cornerRounding(self):
return 10
# colors
def backgroundColour(self):
return QtGui.QColor(31, 33, 34, 200)
def headerColor(self):
return QtGui.QColor("#4A71AB")
def headerButtonColor(self):
return QtGui.QColor(255, 255, 255)
def selectedNodeColour(self):
return QtGui.QColor(180, 255, 180, 200)
def unSelectedNodeColour(self):
return self.backgroundColour()
def edgeColour(self):
return QtGui.QColor(0.0, 0.0, 0.0, 255)
def edgeThickness(self):
return 3
def deleteChild(self, child):
return False
def supportsContextMenu(self):
return False
def contextMenu(self, menu):
pass
def attributeWidget(self, parent):
pass
class AttributeModel(QtCore.QObject):
def __init__(self, objectModel, parent=None):
"""
:param objectModel: The Node ObjectModel
:type objectModel: ::class:`ObjectModel`
"""
super(AttributeModel, self).__init__()
self.objectModel = objectModel
self.parent = parent
def __repr__(self):
return "<{}-{}>".format(self.__class__.__name__, self.text())
def __eq__(self, other):
return hash(self) == hash(other)
def __ne__(self, other):
return hash(self) != hash(other)
def __hash__(self):
return id(self)
def text(self):
return "attributeName"
def setValue(self, value):
pass
def value(self):
return
def textAlignment(self):
if self.isInput():
return QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter
else:
return QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter
def setText(self, text):
return False
def isArray(self):
return False
def isElement(self):
if self.parent is not None:
return self.parent.isArray()
def isCompound(self):
return False
def elements(self):
return []
def children(self):
return []
def canAcceptConnection(self, plug):
return True
def acceptsMultipleConnections(self):
if self.isInput():
return False
return True
def isConnected(self):
return False
def createConnection(self, attribute):
return False
def deleteConnection(self, attribute):
return False
def toolTip(self):
return "Im a tooltip for attributes"
def size(self):
return QtCore.QSize(150, 30)
def textColour(self):
return QtGui.QColor(200, 200, 200)
def isInput(self):
return True
def isOutput(self):
return True
def highlightColor(self):
return QtGui.QColor(255, 255, 255)
def itemEdgeColor(self):
return QtGui.QColor(0, 180, 0)
def itemColour(self):
return QtGui.QColor(0, 180, 0)
| 26.519878 | 122 | 0.625115 | 941 | 8,672 | 5.68119 | 0.269926 | 0.057987 | 0.028807 | 0.035354 | 0.109428 | 0.064908 | 0.064908 | 0.055181 | 0.030303 | 0.017583 | 0 | 0.014142 | 0.29059 | 8,672 | 326 | 123 | 26.601227 | 0.854844 | 0.317113 | 0 | 0.298137 | 0 | 0 | 0.01693 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.391304 | false | 0.043478 | 0.006211 | 0.242236 | 0.844721 | 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 |
1411420408b1f285001ad3155f9e1849f4599544 | 567 | py | Python | neuroballad/models/abstracts.py | KathyFeiyang/Neuroballad | e02506f81a2af4125b58b34849135ef8eead314c | [
"BSD-3-Clause"
] | 3 | 2019-04-03T02:54:46.000Z | 2021-12-24T11:40:33.000Z | neuroballad/models/abstracts.py | KathyFeiyang/Neuroballad | e02506f81a2af4125b58b34849135ef8eead314c | [
"BSD-3-Clause"
] | null | null | null | neuroballad/models/abstracts.py | KathyFeiyang/Neuroballad | e02506f81a2af4125b58b34849135ef8eead314c | [
"BSD-3-Clause"
] | 2 | 2019-11-03T16:12:28.000Z | 2020-10-30T03:21:03.000Z | from .element import Element
class Activator(Element):
element_class = 'abstract'
states = {}
params = {'beta': 1.0,
'K': 1.0,
'n': 1.0}
class Repressor(Element):
element_class = 'abstract'
states = {}
params = {'beta': 1.0,
'K': 1.0,
'n': 1.0}
class Integrator(Element):
element_class = 'abstract'
states = {}
params = {'gamma': 0.0}
class CurrentModulator(Element):
element_class = 'abstract'
states = {}
params = {'A': 1.0,
'shift': 0.0}
| 21 | 32 | 0.5097 | 63 | 567 | 4.52381 | 0.301587 | 0.049123 | 0.266667 | 0.378947 | 0.666667 | 0.666667 | 0.392982 | 0.392982 | 0.392982 | 0.392982 | 0 | 0.047493 | 0.33157 | 567 | 26 | 33 | 21.807692 | 0.704485 | 0 | 0 | 0.636364 | 0 | 0 | 0.097002 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.772727 | 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 |
142c76bbe57566fa69df6dd4079db82ac67315db | 715 | py | Python | shrinkwrap-worker/__init__.py | Codeusa/Shrinkwrap-worker | 49c0243d7a0ca565636e01433286297f9d4f0a14 | [
"MIT"
] | 1 | 2021-06-27T17:38:40.000Z | 2021-06-27T17:38:40.000Z | shrinkwrap-worker/__init__.py | AndrewMD5/Shrinkwrap-worker | 49c0243d7a0ca565636e01433286297f9d4f0a14 | [
"MIT"
] | null | null | null | shrinkwrap-worker/__init__.py | AndrewMD5/Shrinkwrap-worker | 49c0243d7a0ca565636e01433286297f9d4f0a14 | [
"MIT"
] | null | null | null | """
Shrinkwrap-worker module provides a threading framework for managing a constant pool
of worker threads that perform arbitrary jobs. It is based on the 2.7 workerpool release
Tips:
* Workers can be terminated using a SuicideJob which raises a TerminationNotice
exception.
* Performing a del on a pool object will cause the pool to terminate all of its
workers.
* WorkerPool implements a simple map method which allows distributing work in a
similar fashion as using a normal map operation.
* EquippedWorkers can be used to maintain an active resource which is required
for performing a specialized type of job.
"""
from .exceptions import *
from .jobs import *
from .pools import *
from .workers import *
| 28.6 | 88 | 0.79021 | 109 | 715 | 5.183486 | 0.669725 | 0.053097 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003384 | 0.173427 | 715 | 24 | 89 | 29.791667 | 0.952623 | 0.858741 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
143721f25f86282dafb39bc36385d9ddbf584166 | 156 | py | Python | test_api/test_core.py | testwhitebaby/apitest-python | 9c042fb3430c37c464297f6664b7fd03cd4122f7 | [
"Apache-2.0"
] | null | null | null | test_api/test_core.py | testwhitebaby/apitest-python | 9c042fb3430c37c464297f6664b7fd03cd4122f7 | [
"Apache-2.0"
] | null | null | null | test_api/test_core.py | testwhitebaby/apitest-python | 9c042fb3430c37c464297f6664b7fd03cd4122f7 | [
"Apache-2.0"
] | null | null | null | import requests
def test_httpbin_get():
r = requests.get("https://www.baidu.com",headers={"accept": "application/json"})
assert r.status_code ==200 | 31.2 | 84 | 0.705128 | 22 | 156 | 4.863636 | 0.863636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021898 | 0.121795 | 156 | 5 | 85 | 31.2 | 0.759124 | 0 | 0 | 0 | 0 | 0 | 0.273885 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 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 |
1439bcea632e74fa0ba4027b7dfc09dff810172f | 164 | py | Python | apiaudio/api_resources/syncTTS.py | aflorithmic/aflr_python | 505317bec82f9c4bacc1604b6e90e6468d87607b | [
"MIT"
] | 20 | 2021-03-18T20:50:24.000Z | 2021-07-14T08:02:06.000Z | apiaudio/api_resources/syncTTS.py | aflorithmic/aflr_python | 505317bec82f9c4bacc1604b6e90e6468d87607b | [
"MIT"
] | 5 | 2021-05-20T12:45:52.000Z | 2021-06-07T08:30:18.000Z | apiaudio/api_resources/syncTTS.py | aflorithmic/aflr_python | 505317bec82f9c4bacc1604b6e90e6468d87607b | [
"MIT"
] | 5 | 2021-02-26T09:06:04.000Z | 2021-04-01T16:51:58.000Z | from apiaudio.helper_classes import CreatableResource
class SyncTTS(CreatableResource):
OBJECT_NAME = "SyncTTS"
resource_path = "/sync_speech/synthesize"
| 23.428571 | 53 | 0.792683 | 17 | 164 | 7.411765 | 0.882353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134146 | 164 | 6 | 54 | 27.333333 | 0.887324 | 0 | 0 | 0 | 0 | 0 | 0.182927 | 0.140244 | 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 |
144f346a8c7f8e650a33b965ae2cd524a37d26e1 | 968 | py | Python | tests/base.py | nh2/hetznercloud-py | 182caf09f7ed397adeb284662e6e0edcfe6b9dfa | [
"MIT"
] | 19 | 2018-02-05T09:01:14.000Z | 2018-08-30T18:16:53.000Z | tests/base.py | nh2/hetznercloud-py | 182caf09f7ed397adeb284662e6e0edcfe6b9dfa | [
"MIT"
] | 24 | 2018-02-21T08:42:21.000Z | 2018-09-02T09:46:09.000Z | tests/base.py | nh2/hetznercloud-py | 182caf09f7ed397adeb284662e6e0edcfe6b9dfa | [
"MIT"
] | 7 | 2018-02-28T12:16:51.000Z | 2018-08-21T13:49:29.000Z | import unittest
from hetznercloud import HetznerCloudClient, SERVER_TYPE_1CPU_2GB, IMAGE_UBUNTU_1604, FLOATING_IP_TYPE_IPv4
from .shared import valid_configuration
class BaseHetznerTest(unittest.TestCase):
def setUp(self):
self.client = HetznerCloudClient(valid_configuration)
self.servers = self.client.servers()
def tearDown(self):
for server in self.servers.get_all():
server.delete()
for ssh_key in self.client.ssh_keys().get_all():
ssh_key.delete()
for ip in self.client.floating_ips().get_all():
ip.delete()
def create_server(self, name, start_after_create=True):
return self.servers.create(name, SERVER_TYPE_1CPU_2GB, IMAGE_UBUNTU_1604, start_after_create=start_after_create)
def create_floating_ip(self, description):
return self.client.floating_ips().create(FLOATING_IP_TYPE_IPv4, home_location=1, description=description) | 40.333333 | 121 | 0.715909 | 123 | 968 | 5.341463 | 0.373984 | 0.076104 | 0.073059 | 0.05175 | 0.097412 | 0.097412 | 0.097412 | 0 | 0 | 0 | 0 | 0.01933 | 0.198347 | 968 | 24 | 122 | 40.333333 | 0.82732 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.166667 | 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 |
145b54f0d5bc5952f303c3355063ac2017332b45 | 135 | py | Python | 60min_tutorial/main.py | Odin-son/pytorch-octo-chainsaw | e31172e088020ad5059119eadcd029e7688f7cb9 | [
"MIT"
] | null | null | null | 60min_tutorial/main.py | Odin-son/pytorch-octo-chainsaw | e31172e088020ad5059119eadcd029e7688f7cb9 | [
"MIT"
] | null | null | null | 60min_tutorial/main.py | Odin-son/pytorch-octo-chainsaw | e31172e088020ad5059119eadcd029e7688f7cb9 | [
"MIT"
] | null | null | null | import torch
from .net import *
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
print(device)
#net.to(device) | 19.285714 | 71 | 0.725926 | 22 | 135 | 4.409091 | 0.636364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008403 | 0.118519 | 135 | 7 | 72 | 19.285714 | 0.806723 | 0.103704 | 0 | 0 | 0 | 0 | 0.07438 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0.25 | 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 |
14635cd08d464696a1a07b3f3a914ff952790e88 | 2,025 | py | Python | aws_embedded_metrics/environment/lambda_environment.py | 02strich/aws-embedded-metrics-python | 4c5718e580dfb12529673a6b54810adfbfd54242 | [
"Apache-2.0"
] | 130 | 2019-11-18T19:39:55.000Z | 2022-03-28T09:56:25.000Z | aws_embedded_metrics/environment/lambda_environment.py | 02strich/aws-embedded-metrics-python | 4c5718e580dfb12529673a6b54810adfbfd54242 | [
"Apache-2.0"
] | 50 | 2019-11-18T22:22:33.000Z | 2022-02-06T11:03:31.000Z | aws_embedded_metrics/environment/lambda_environment.py | 02strich/aws-embedded-metrics-python | 4c5718e580dfb12529673a6b54810adfbfd54242 | [
"Apache-2.0"
] | 23 | 2019-11-19T00:06:41.000Z | 2021-12-09T02:01:40.000Z | # Copyright 2019 Amazon.com, Inc. or its affiliates.
# Licensed under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from aws_embedded_metrics.environment import Environment
from aws_embedded_metrics.logger.metrics_context import MetricsContext
from aws_embedded_metrics.sinks import Sink
from aws_embedded_metrics.sinks.stdout_sink import StdoutSink
import os
def get_env(key: str) -> str:
if key in os.environ:
return os.environ[key]
return ""
sink = StdoutSink()
class LambdaEnvironment(Environment):
async def probe(self) -> bool:
return len(get_env("AWS_LAMBDA_FUNCTION_NAME")) > 0
def get_name(self) -> str:
return self.get_log_group_name()
def get_type(self) -> str:
return "AWS::Lambda::Function"
def get_log_group_name(self) -> str:
return get_env("AWS_LAMBDA_FUNCTION_NAME")
def configure_context(self, context: MetricsContext) -> None:
context.set_property("executionEnvironment", get_env("AWS_EXECUTION_ENV"))
context.set_property("memorySize", get_env("AWS_LAMBDA_FUNCTION_MEMORY_SIZE"))
context.set_property("functionVersion", get_env("AWS_LAMBDA_FUNCTION_VERSION"))
context.set_property("logStreamId", get_env("AWS_LAMBDA_LOG_STREAM_NAME"))
trace_id = get_env("_X_AMZN_TRACE_ID")
if len(trace_id) > 0 and "Sampled=1" in trace_id:
context.set_property("traceId", trace_id)
def get_sink(self) -> Sink:
"""Create the appropriate sink for this environment."""
return sink
| 36.160714 | 87 | 0.729383 | 284 | 2,025 | 4.989437 | 0.429577 | 0.033874 | 0.038109 | 0.052929 | 0.10868 | 0.038109 | 0 | 0 | 0 | 0 | 0 | 0.006631 | 0.180741 | 2,025 | 55 | 88 | 36.818182 | 0.847498 | 0.308148 | 0 | 0 | 0 | 0 | 0.186416 | 0.110549 | 0 | 0 | 0 | 0 | 0 | 1 | 0.206897 | false | 0 | 0.172414 | 0.103448 | 0.655172 | 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 |
1464d82c87c248db60e7183656e604eda49e0380 | 60 | py | Python | {{cookiecutter.project_name}}/{{cookiecutter.app_name}}/api/__init__.py | DevAerial/flask-api-template | 6d3f745f2dacb793c4bdc6aaaceb86eb472efe55 | [
"MIT"
] | null | null | null | {{cookiecutter.project_name}}/{{cookiecutter.app_name}}/api/__init__.py | DevAerial/flask-api-template | 6d3f745f2dacb793c4bdc6aaaceb86eb472efe55 | [
"MIT"
] | null | null | null | {{cookiecutter.project_name}}/{{cookiecutter.app_name}}/api/__init__.py | DevAerial/flask-api-template | 6d3f745f2dacb793c4bdc6aaaceb86eb472efe55 | [
"MIT"
] | null | null | null | from .views import blueprint
__all__ = [
'blueprint',
] | 12 | 28 | 0.666667 | 6 | 60 | 6 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.216667 | 60 | 5 | 29 | 12 | 0.765957 | 0 | 0 | 0 | 0 | 0 | 0.147541 | 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 |
14778445831c5ac22f08f998cbd65d05a877eb70 | 1,071 | py | Python | xrpl/models/transactions/check_cancel.py | florent-uzio/xrpl-py | ce396a15a6fc39ca20e035636463b58b231ffeac | [
"0BSD"
] | null | null | null | xrpl/models/transactions/check_cancel.py | florent-uzio/xrpl-py | ce396a15a6fc39ca20e035636463b58b231ffeac | [
"0BSD"
] | null | null | null | xrpl/models/transactions/check_cancel.py | florent-uzio/xrpl-py | ce396a15a6fc39ca20e035636463b58b231ffeac | [
"0BSD"
] | null | null | null | """Model for CheckCancel transaction type."""
from dataclasses import dataclass, field
from xrpl.models.required import REQUIRED
from xrpl.models.transactions.transaction import Transaction
from xrpl.models.transactions.types import TransactionType
from xrpl.models.utils import require_kwargs_on_init
@require_kwargs_on_init
@dataclass(frozen=True)
class CheckCancel(Transaction):
"""
Represents a `CheckCancel <https://xrpl.org/checkcancel.html>`_ transaction,
which cancels an unredeemed Check, removing it from the ledger
without sending any money. The source or the destination of the check
can cancel a Check at any time using this transaction type. If the
Check has expired, any address can cancel it.
"""
#: The ID of the `Check ledger object
#: <https://xrpl.org/check.html>`_ to cancel, as a 64-character
#: hexadecimal string. This field is required.
check_id: str = REQUIRED # type: ignore
transaction_type: TransactionType = field(
default=TransactionType.CHECK_CANCEL,
init=False,
)
| 35.7 | 80 | 0.746965 | 141 | 1,071 | 5.595745 | 0.489362 | 0.040558 | 0.070976 | 0.065906 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00227 | 0.177404 | 1,071 | 29 | 81 | 36.931034 | 0.893303 | 0.484594 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.384615 | 0 | 0.615385 | 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 |
148e61e43858af6bb72511c2de209ad5eb17587a | 1,048 | py | Python | ECC_03_projective_double_alw_add_comb2/ecdsa.py | d-klein/ecdsa_playground | d5543095176405b82e4bc09c5565a89c2b405c45 | [
"MIT"
] | null | null | null | ECC_03_projective_double_alw_add_comb2/ecdsa.py | d-klein/ecdsa_playground | d5543095176405b82e4bc09c5565a89c2b405c45 | [
"MIT"
] | null | null | null | ECC_03_projective_double_alw_add_comb2/ecdsa.py | d-klein/ecdsa_playground | d5543095176405b82e4bc09c5565a89c2b405c45 | [
"MIT"
] | null | null | null | from .curve_projective import Point
## ecdsa with base point blinding and double & add by using projective coordinates
##
## randomly generate z
## project coordinates to (xz,yz,z)
## perform scalar multiplication (optimized)
## get r := x/z mod p
## compute s as normal
def ecdsa(k, m, d, ecc_curve_projective):
k = k % ecc_curve_projective.n
# we need a random point for the dummy add operation
# here we simply take G1, i.e. one point that needs
# to be precomputed for the comb2 scalar multiplication anyway
random_point_idx = 0
Q = ecc_curve_projective.scalarMultComb2Masked(k, ecc_curve_projective.proBasePoint, random_point_idx)
affQ = ecc_curve_projective.pro2aff(Q)
r = affQ.x
if (r == 0):
raise ValueError("ecdsa_k: r == 0!")
kinv = ecc_curve_projective.inv_mod(k, ecc_curve_projective.n)
s = (kinv * ((m + ((r * d)% ecc_curve_projective.n)) % ecc_curve_projective.n)) % ecc_curve_projective.n
if (s == 0):
raise ValueError("ecdsa_k: s == 0!")
return Point(r, s)
| 38.814815 | 108 | 0.69084 | 160 | 1,048 | 4.35 | 0.46875 | 0.237069 | 0.258621 | 0.136494 | 0.202586 | 0.081897 | 0.081897 | 0.081897 | 0 | 0 | 0 | 0.010804 | 0.205153 | 1,048 | 26 | 109 | 40.307692 | 0.82473 | 0.362595 | 0 | 0 | 1 | 0 | 0.049231 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0.071429 | 0 | 0.214286 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
14a50550278c2d51d3d4b4b02eb91914a8885c63 | 341 | py | Python | .vscode/settings.py | igorkf/trink | e95119e9bc7e8f6d22bd792330df1b953df7becb | [
"MIT"
] | null | null | null | .vscode/settings.py | igorkf/trink | e95119e9bc7e8f6d22bd792330df1b953df7becb | [
"MIT"
] | null | null | null | .vscode/settings.py | igorkf/trink | e95119e9bc7e8f6d22bd792330df1b953df7becb | [
"MIT"
] | null | null | null | {
"files.associations": {
"**/*.html": "html",
"**/templates/**/*.html": "django-html",
"**/templates/**/*": "django-txt",
"**/requirements{/**,*}.{txt,in}": "pip-requirements"
},
"emmet.includeLanguages": {
"django-html": "html"
},
"python.pythonPath": "/usr/local/bin/python3"
}
| 26.230769 | 61 | 0.489736 | 27 | 341 | 6.185185 | 0.62963 | 0.095808 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003831 | 0.234604 | 341 | 12 | 62 | 28.416667 | 0.636015 | 0 | 0 | 0 | 0 | 0 | 0.627566 | 0.284457 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
14a7af805223b73a542770f20a12496a2a049b68 | 166 | py | Python | octocd/config.py | kristoy0/octocd | bbb018c6f0e315f801bb5fcb30b93ad0adf0ad80 | [
"MIT"
] | null | null | null | octocd/config.py | kristoy0/octocd | bbb018c6f0e315f801bb5fcb30b93ad0adf0ad80 | [
"MIT"
] | null | null | null | octocd/config.py | kristoy0/octocd | bbb018c6f0e315f801bb5fcb30b93ad0adf0ad80 | [
"MIT"
] | null | null | null | class DevConfig(object):
DEBUG = True
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/octocd'
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = 'DEV_KEY'
| 27.666667 | 53 | 0.716867 | 19 | 166 | 5.947368 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.180723 | 166 | 5 | 54 | 33.2 | 0.830882 | 0 | 0 | 0 | 0 | 0 | 0.168675 | 0.126506 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
1adfd5eed415b3ed237446e96d06ce06d6b24050 | 361 | py | Python | eventy/serializer/dummy.py | Qotto/eventy | 793da793627976ee0251a7dd037b2da02254b000 | [
"MIT"
] | 3 | 2020-08-11T09:00:11.000Z | 2021-08-20T00:30:06.000Z | eventy/serializer/dummy.py | Qotto/eventy | 793da793627976ee0251a7dd037b2da02254b000 | [
"MIT"
] | null | null | null | eventy/serializer/dummy.py | Qotto/eventy | 793da793627976ee0251a7dd037b2da02254b000 | [
"MIT"
] | null | null | null | # coding: utf-8
# Copyright (c) Qotto, 2018
from ..event.base import BaseEvent
from .base import BaseEventSerializer
__all__ = [
'DummyEventSerializer',
]
class DummyEventSerializer(BaseEventSerializer):
def encode(self, event: BaseEvent) -> BaseEvent:
return event
def decode(self, event: BaseEvent) -> BaseEvent:
return event
| 20.055556 | 52 | 0.706371 | 37 | 361 | 6.783784 | 0.567568 | 0.079681 | 0.143426 | 0.215139 | 0.302789 | 0.302789 | 0 | 0 | 0 | 0 | 0 | 0.017301 | 0.199446 | 361 | 17 | 53 | 21.235294 | 0.851211 | 0.108033 | 0 | 0.2 | 0 | 0 | 0.062696 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0.2 | 0.7 | 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 | 0 | 1 | 1 | 0 | 0 | 3 |
1aecaa4eb331d7d86775cce49f9e8884b7c4c4c6 | 173 | py | Python | models/education.py | baimamboukar/portfolio_backend | 1c121dc94c4ca30078e8b8872f753051292a2bbf | [
"MIT"
] | null | null | null | models/education.py | baimamboukar/portfolio_backend | 1c121dc94c4ca30078e8b8872f753051292a2bbf | [
"MIT"
] | null | null | null | models/education.py | baimamboukar/portfolio_backend | 1c121dc94c4ca30078e8b8872f753051292a2bbf | [
"MIT"
] | null | null | null | class Education:
def __init__(self, school, time, title, desc):
self.school = school
self.time = time
self.title = title
self.desc = desc | 28.833333 | 50 | 0.589595 | 21 | 173 | 4.666667 | 0.428571 | 0.204082 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.317919 | 173 | 6 | 51 | 28.833333 | 0.830508 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
210647099146b05e9382e39d227c8ed07eed2188 | 402 | py | Python | feedback_test/unit/util.py | isabella232/mdc-feedback | 49579bcc7063af472cc15f6e31a39ae57aaf0422 | [
"MIT"
] | 4 | 2015-05-11T22:05:46.000Z | 2015-08-19T18:44:19.000Z | feedback_test/unit/util.py | Code-for-Miami/mdc-inspectors-dashboard | 5667d1d60a42ed689a26bda8adaea90b9ae1c452 | [
"MIT"
] | 324 | 2015-05-11T21:46:44.000Z | 2016-05-17T14:59:19.000Z | feedback_test/unit/util.py | Code-for-Miami/mdc-inspectors-dashboard | 5667d1d60a42ed689a26bda8adaea90b9ae1c452 | [
"MIT"
] | 4 | 2016-01-21T09:42:45.000Z | 2021-04-16T09:51:00.000Z | # -*- coding: utf-8 -*-
# See:
# https://github.com/codeforamerica/pittsburgh-purchasing-suite/blob/master/purchasing_test/unit/util.py
import datetime
from feedback.user.models import User
def create_a_user(email='foo@foo.com'):
return User(email=email, first_name='foo', last_name='foo')
def insert_a_user(email='foo@foo.com'):
user = create_a_user(email)
user.save()
return user
| 25.125 | 104 | 0.726368 | 61 | 402 | 4.639344 | 0.557377 | 0.127208 | 0.106007 | 0.113074 | 0.134276 | 0.134276 | 0 | 0 | 0 | 0 | 0 | 0.002833 | 0.121891 | 402 | 15 | 105 | 26.8 | 0.798867 | 0.320896 | 0 | 0 | 0 | 0 | 0.104089 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.125 | 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 |
211b392287bd720f22203ca75c999e1154dd76c6 | 330 | py | Python | top/__init__.py | 0phoff/topcraft | d1dde9e151e0a5693c4a2231c5b11170d9664817 | [
"MIT"
] | null | null | null | top/__init__.py | 0phoff/topcraft | d1dde9e151e0a5693c4a2231c5b11170d9664817 | [
"MIT"
] | null | null | null | top/__init__.py | 0phoff/topcraft | d1dde9e151e0a5693c4a2231c5b11170d9664817 | [
"MIT"
] | null | null | null | # Expose to root
from ._gc import *
del _gc
from ._log import *
del _log
from ._memory import *
del _memory
from ._profile import *
del _profile
from ._time import *
del _time
# Export submodule
from . import _meta as meta
# Miniver stuff
# https://github.com/jbweston/miniver
from ._version import __version__
del _version
| 13.75 | 37 | 0.751515 | 48 | 330 | 4.8125 | 0.458333 | 0.194805 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 330 | 23 | 38 | 14.347826 | 0.855556 | 0.245455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.538462 | 0 | 0.538462 | 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 |
21220820b55253e37e6ceffa4049e0a09b25eec4 | 2,951 | py | Python | core/evals/pickle_handler.py | Alexjsenn/FedScale | 2048cabfba94d029b562a62d765a27225b7c1016 | [
"Apache-2.0"
] | null | null | null | core/evals/pickle_handler.py | Alexjsenn/FedScale | 2048cabfba94d029b562a62d765a27225b7c1016 | [
"Apache-2.0"
] | null | null | null | core/evals/pickle_handler.py | Alexjsenn/FedScale | 2048cabfba94d029b562a62d765a27225b7c1016 | [
"Apache-2.0"
] | null | null | null | import pickle
import os
import argparse
import matplotlib.pyplot as plt
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument("-a", "--a", dest = "a", default = True, help="All (print)")
args = parser.parse_args()
print( "Print all? {}".format(args.a))
if args.a == "False":
var = input("Number of cifar100 logging folder: ")
pickle_file = open("/home/ubuntu/FedScale/core/evals/logs/cifar100/"+ var +"/aggregator/testing_perf", "rb")
objects = []
while True:
try:
objects.append(pickle.load(pickle_file))
except EOFError:
break
pickle_file.close()
#print(objects[0]['perf'])
epochs = 0
loss = []
top_five = []
for key, value in objects[0]['perf'].items():
print(key, value)
loss.append(value['loss'])
top_five.append(value['top_5'])
epochs = epochs+1
epochs_l = np.arange(1, epochs + 1)
plt.figure(var + '_Loss')
plt.title("Testing Performance; Loss")
plt.plot(epochs_l, loss, label="Test")
plt.xlabel("Epochs")
plt.ylabel("Loss")
plt.legend(loc='best')
plt.savefig(var + '_Loss' + '.png')
plt.figure(var + '_Acc')
plt.title("Testing Performance; Accuracy")
plt.plot(epochs_l,top_five, label="Test")
plt.xlabel("Epochs")
plt.ylabel("Accuracy")
plt.legend(loc='best')
plt.savefig(var + '_Acc' + '.png')
else:
#need a list of all folders in /home/ubuntu/FedScale/core/evals/logs/cifar100
cifar100_directory_contents = os.listdir("/home/ubuntu/FedScale/core/evals/logs/cifar100/")
#print(cifar100_directory_contents)
for experiment in cifar100_directory_contents:
print("Experiment folder : {}".format(experiment))
pickle_file = open("/home/ubuntu/FedScale/core/evals/logs/cifar100/"+ experiment +"/aggregator/testing_perf", "rb")
objects = []
while True:
try:
objects.append(pickle.load(pickle_file))
except EOFError:
break
pickle_file.close()
#print(objects[0]['perf'])
epochs = 0
loss = []
top_five = []
for key, value in objects[0]['perf'].items():
print(key, value)
loss.append(value['loss'])
top_five.append(value['top_5'])
epochs = epochs+1
epochs_l = np.arange(1, epochs + 1)
plt.figure(experiment + '_Loss')
plt.title("Testing Performance; Loss")
plt.plot(epochs_l, loss, label="Test")
plt.xlabel("Epochs")
plt.ylabel("Loss")
plt.legend(loc='best')
plt.savefig(experiment + '_Loss' + '.png')
plt.figure(experiment + '_Acc')
plt.title("Testing Performance; Accuracy")
plt.plot(epochs_l, top_five, label="Test")
plt.xlabel("Epochs")
plt.ylabel("Accuracy")
plt.legend(loc='best')
plt.savefig(experiment + '_Acc' + '.png')
| 32.428571 | 123 | 0.599119 | 361 | 2,951 | 4.792244 | 0.252078 | 0.034682 | 0.041619 | 0.050867 | 0.714451 | 0.714451 | 0.714451 | 0.654335 | 0.654335 | 0.654335 | 0 | 0.017102 | 0.247035 | 2,951 | 90 | 124 | 32.788889 | 0.761476 | 0.054219 | 0 | 0.675325 | 0 | 0 | 0.197846 | 0.067864 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.064935 | 0 | 0.064935 | 0.064935 | 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 |
2123fb300a51cf8ee825ac14e63dc07fd008cef7 | 224 | py | Python | Codechef/atm.py | maalolankannan1/HacktoberFest2021-1 | c23136d5aaabd198f5af60ad1b990a4788a40d51 | [
"Apache-2.0"
] | 11 | 2021-10-01T06:53:31.000Z | 2022-02-05T20:36:20.000Z | Codechef/atm.py | maalolankannan1/HacktoberFest2021-1 | c23136d5aaabd198f5af60ad1b990a4788a40d51 | [
"Apache-2.0"
] | 37 | 2021-10-01T06:54:01.000Z | 2021-10-20T18:02:31.000Z | Codechef/atm.py | maalolankannan1/HacktoberFest2021-1 | c23136d5aaabd198f5af60ad1b990a4788a40d51 | [
"Apache-2.0"
] | 110 | 2021-10-01T06:51:28.000Z | 2021-10-31T18:00:55.000Z | w, b = input().split()
w = int(w)
b = float(b)
if (w % 5 == 0 and b>(w+.5)):
b = b - w - 0.5
print('%.2f' % b)
else:
print('%.2f' % b) | 28 | 41 | 0.267857 | 30 | 224 | 2 | 0.433333 | 0.066667 | 0.266667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.067961 | 0.540179 | 224 | 8 | 42 | 28 | 0.514563 | 0 | 0 | 0.25 | 0 | 0 | 0.036697 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 |
21345e7d8907271a80a7ea0d5f1b548b88aa16b3 | 92 | py | Python | component/parameter/cumsum.py | sepal-contrib/cumsum_change | e7eb763ae94ae7967ba3ceb97626fbef66a13510 | [
"MIT"
] | 1 | 2021-06-18T09:15:19.000Z | 2021-06-18T09:15:19.000Z | component/parameter/cumsum.py | sepal-contrib/cumsum_change | e7eb763ae94ae7967ba3ceb97626fbef66a13510 | [
"MIT"
] | 2 | 2021-11-30T10:50:18.000Z | 2022-01-13T12:32:37.000Z | component/parameter/cumsum.py | sepal-contrib/cumsum_change | e7eb763ae94ae7967ba3ceb97626fbef66a13510 | [
"MIT"
] | 1 | 2021-12-08T14:07:23.000Z | 2021-12-08T14:07:23.000Z | # minimum number of images in the historical period to give accurate results
min_images = 5
| 30.666667 | 76 | 0.804348 | 15 | 92 | 4.866667 | 0.933333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013158 | 0.173913 | 92 | 2 | 77 | 46 | 0.947368 | 0.804348 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2146321e968ea5877af5f82f153ef45afeda564a | 193 | py | Python | artifacts/serializers.py | kackey0-1/drf-sample | 914907320bc317240b4d7c07968b6d4ea80b4511 | [
"MIT"
] | null | null | null | artifacts/serializers.py | kackey0-1/drf-sample | 914907320bc317240b4d7c07968b6d4ea80b4511 | [
"MIT"
] | 6 | 2021-03-30T12:05:07.000Z | 2021-04-05T14:21:46.000Z | artifacts/serializers.py | kackey0-1/drf-sample | 914907320bc317240b4d7c07968b6d4ea80b4511 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from .models import Artifact
class ArtifactSerializer(serializers.ModelSerializer):
class Meta:
model = Artifact
fields = '__all__'
| 21.444444 | 54 | 0.740933 | 19 | 193 | 7.263158 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.207254 | 193 | 8 | 55 | 24.125 | 0.901961 | 0 | 0 | 0 | 0 | 0 | 0.036269 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2154faaf08c832b07b02c79ba6be80365aa68e92 | 692 | py | Python | Preview/customizegui.py | Deteriorator/Programming-Python | 0c259093de011c0d5dadaba256a2bc9b2294e6c8 | [
"Apache-2.0"
] | null | null | null | Preview/customizegui.py | Deteriorator/Programming-Python | 0c259093de011c0d5dadaba256a2bc9b2294e6c8 | [
"Apache-2.0"
] | null | null | null | Preview/customizegui.py | Deteriorator/Programming-Python | 0c259093de011c0d5dadaba256a2bc9b2294e6c8 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
-------------------------------------------------------------------------------
@Name: customizegui.py
@Desc:
@Author: liangz.org@gmail.com
@Create: 2020.05.07 17:08
-------------------------------------------------------------------------------
@Change: 2020.05.07
-------------------------------------------------------------------------------
"""
from tkinter import mainloop
from tkinter.messagebox import showinfo
from tkinter102 import MyGui
class CustomGUI(MyGui):
def reply(self):
showinfo(title='popup', message='Ouch!')
if __name__ == '__main__':
CustomGUI().pack()
mainloop()
| 26.615385 | 79 | 0.413295 | 56 | 692 | 4.964286 | 0.767857 | 0.043165 | 0.057554 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040609 | 0.145954 | 692 | 25 | 80 | 27.68 | 0.42978 | 0.605491 | 0 | 0 | 0 | 0 | 0.068441 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0 | 0.555556 | 0 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
2156c6c0148ed785936aa14a59277881dd0ddfaf | 185 | py | Python | projects/kc_projects/keyboard_automate.py | nduprincekc/python-mini-projects | 5501399694ca2361f251c6190a1e450011101477 | [
"MIT"
] | null | null | null | projects/kc_projects/keyboard_automate.py | nduprincekc/python-mini-projects | 5501399694ca2361f251c6190a1e450011101477 | [
"MIT"
] | null | null | null | projects/kc_projects/keyboard_automate.py | nduprincekc/python-mini-projects | 5501399694ca2361f251c6190a1e450011101477 | [
"MIT"
] | null | null | null | import pyautogui
pyautogui.click(200,200);
#print(pyautogui.KEY_NAMES)
pyautogui.typewrite('emma', interval= 0)
#print(pyautogui.KEYBOARD_KEYS)
pyautogui.screenshot('i am cool.png')
| 18.5 | 40 | 0.783784 | 25 | 185 | 5.72 | 0.72 | 0.195804 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040936 | 0.075676 | 185 | 9 | 41 | 20.555556 | 0.795322 | 0.302703 | 0 | 0 | 0 | 0 | 0.133858 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2156f7653ae9d975b5dc5e6facb326352107084d | 275 | py | Python | website/migrations/0004_merge_20190301_0134.py | alexdzul/fcp | 94b6677d823f79d6a9d85c80c7fd5d5ce62a3c18 | [
"MIT"
] | null | null | null | website/migrations/0004_merge_20190301_0134.py | alexdzul/fcp | 94b6677d823f79d6a9d85c80c7fd5d5ce62a3c18 | [
"MIT"
] | null | null | null | website/migrations/0004_merge_20190301_0134.py | alexdzul/fcp | 94b6677d823f79d6a9d85c80c7fd5d5ce62a3c18 | [
"MIT"
] | null | null | null | # Generated by Django 2.1.7 on 2019-03-01 01:34
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('website', '0003_merge_20190301_0116'),
('website', '0003_merge_20190228_1926'),
]
operations = [
]
| 18.333333 | 48 | 0.650909 | 33 | 275 | 5.242424 | 0.787879 | 0.127168 | 0.184971 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.221698 | 0.229091 | 275 | 14 | 49 | 19.642857 | 0.59434 | 0.163636 | 0 | 0 | 1 | 0 | 0.27193 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 |
dcd1217f4739ac4493df56eedeb1682b1664e8db | 95 | pyt | Python | ratings/redsolution_setup/templates/urls.pyt | redsolution/django-generic-ratings | fe319ea5bc5097f23ef89e2ba5c387c03954151d | [
"MIT"
] | null | null | null | ratings/redsolution_setup/templates/urls.pyt | redsolution/django-generic-ratings | fe319ea5bc5097f23ef89e2ba5c387c03954151d | [
"MIT"
] | null | null | null | ratings/redsolution_setup/templates/urls.pyt | redsolution/django-generic-ratings | fe319ea5bc5097f23ef89e2ba5c387c03954151d | [
"MIT"
] | null | null | null | # ---- ratings ----
urlpatterns += patterns('',
(r'^ratings/', include('ratings.urls')),
) | 19 | 44 | 0.547368 | 8 | 95 | 6.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147368 | 95 | 5 | 45 | 19 | 0.641975 | 0.178947 | 0 | 0 | 0 | 0 | 0.272727 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dcdade7db5620f1af88905235f51ba2646c76d38 | 232 | py | Python | DataEntry/StudentDataEnter.py | abandw1/CodingCliques | b28872fae02d94d93382a7ab7f63da89afbd2ec6 | [
"Unlicense"
] | null | null | null | DataEntry/StudentDataEnter.py | abandw1/CodingCliques | b28872fae02d94d93382a7ab7f63da89afbd2ec6 | [
"Unlicense"
] | null | null | null | DataEntry/StudentDataEnter.py | abandw1/CodingCliques | b28872fae02d94d93382a7ab7f63da89afbd2ec6 | [
"Unlicense"
] | null | null | null | import csv
continueRun = True
while continueRun == True:
TempData = input("Data: ")
with open("answers.txt", "a") as myfile:
myfile.write("\n"+TempData)
if input("Another? ") == "N":
continueRun = False
| 23.2 | 44 | 0.599138 | 27 | 232 | 5.148148 | 0.740741 | 0.215827 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.241379 | 232 | 9 | 45 | 25.777778 | 0.789773 | 0 | 0 | 0 | 0 | 0 | 0.12931 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.125 | 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 |
dcf438c80094d380f0c01c6f7b2e880a5a2ceb60 | 4,024 | py | Python | tests/test_cli.py | atruslow/little-cheesemonger | fc5e9e985d00efa144c382887a36abc88ab20e8f | [
"MIT"
] | null | null | null | tests/test_cli.py | atruslow/little-cheesemonger | fc5e9e985d00efa144c382887a36abc88ab20e8f | [
"MIT"
] | null | null | null | tests/test_cli.py | atruslow/little-cheesemonger | fc5e9e985d00efa144c382887a36abc88ab20e8f | [
"MIT"
] | null | null | null | import logging
import pytest
from click.testing import CliRunner
from little_cheesemonger._cli import _process_kwargs, entrypoint
from little_cheesemonger._errors import LittleCheesemongerError
@pytest.fixture
def cli_runner():
return CliRunner()
def test_process_kwargs__return_dict():
assert _process_kwargs(("foo=bar", "baz=qux")) == {"foo": "bar", "baz": "qux"}
def test_process_kwargs__malformed_mapping_string__raise_LittleCheesemongerError():
with pytest.raises(LittleCheesemongerError):
_process_kwargs(("invalid",))
def test_entrypoint__no_args(cli_runner):
result = cli_runner.invoke(entrypoint)
assert result.exit_code == 0
def test_entrypoint__custom_directory(cli_runner):
result = cli_runner.invoke(entrypoint, ["my_directory"])
assert result.exit_code == 0
def test_entrypoint__debug_not_set__log_level_set_to_WARNING(cli_runner):
result = cli_runner.invoke(entrypoint)
assert logging.getLogger("little_cheesemonger").level == logging.WARNING
assert result.exit_code == 0
def test_entrypoint__debug_set__log_level_set_to_DEBUG(cli_runner):
result = cli_runner.invoke(entrypoint, ["--debug"])
assert logging.getLogger("little_cheesemonger").level == logging.DEBUG
assert result.exit_code == 0
def test_entrypoint__custom_data_loader(cli_runner):
result = cli_runner.invoke(entrypoint, ["--data-loader", "my_custom.data.loader"])
assert result.exit_code == 0
def test_entrypoint__custom_data_loader_shorthand(cli_runner):
result = cli_runner.invoke(entrypoint, ["-dl", "my_custom.data.loader"])
assert result.exit_code == 0
def test_entrypoint__custom_data_loader_and_arg(cli_runner):
result = cli_runner.invoke(
entrypoint,
["--data-loader", "my_custom.data.loader", "--data-loader-arg", "baz"],
)
assert result.exit_code == 0
def test_entrypoint__custom_data_loader_and_arg_shorthand(cli_runner):
result = cli_runner.invoke(
entrypoint, ["--data-loader", "my_custom.data.loader", "-dl", "baz"]
)
assert result.exit_code == 0
def test_entrypoint__custom_data_loader_and_multiple_args(cli_runner):
result = cli_runner.invoke(
entrypoint,
[
"--data-loader",
"my_custom.data.loader",
"--data-loader-arg",
"baz",
"--data-loader-arg",
"qux",
],
)
assert result.exit_code == 0
def test_entrypoint__data_loader_args_without_custom_loader(cli_runner):
result = cli_runner.invoke(entrypoint, ["--data-loader-arg", "baz"])
assert result.exit_code == 1
def test_entrypoint__custom_data_loader_and_kwarg(cli_runner):
result = cli_runner.invoke(
entrypoint,
["--data-loader", "my_custom.data.loader", "--data-loader-kwarg", "baz=qux"],
)
assert result.exit_code == 0
def test_entrypoint__custom_data_loader_and_kwarg_shorthand(cli_runner):
result = cli_runner.invoke(
entrypoint, ["--data-loader", "my_custom.data.loader", "-dlk", "baz=qux"]
)
assert result.exit_code == 0
def test_entrypoint__custom_data_loader_and_multiple_kwargs(cli_runner):
result = cli_runner.invoke(
entrypoint,
[
"--data-loader",
"my_custom.data.loader",
"--data-loader-kwarg",
"foo=bar",
"--data-loader-kwarg",
"baz=qux",
],
)
assert result.exit_code == 0
def test_entrypoint__data_loader_kwargs_without_custom_loader(cli_runner):
result = cli_runner.invoke(entrypoint, ["--data-loader-kwarg", "baz=qux"])
assert result.exit_code == 1
def test_entrypoint__data_loader_with_arg_and_kwarg(cli_runner):
result = cli_runner.invoke(
entrypoint,
[
"--data-loader",
"my_custom.data.loader",
"--data-loader-arg",
"foo",
"--data-loader-kwarg",
"baz=qux",
],
)
assert result.exit_code == 0
| 25.794872 | 86 | 0.678926 | 488 | 4,024 | 5.204918 | 0.127049 | 0.149606 | 0.107087 | 0.106299 | 0.790551 | 0.774016 | 0.774016 | 0.703937 | 0.614961 | 0.551575 | 0 | 0.004669 | 0.201541 | 4,024 | 155 | 87 | 25.96129 | 0.78587 | 0 | 0 | 0.46 | 0 | 0 | 0.157306 | 0.046968 | 0 | 0 | 0 | 0 | 0.18 | 1 | 0.18 | false | 0 | 0.05 | 0.01 | 0.24 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dcf7d6d2d805ee73f6f71b207c9eef5a91650f11 | 131 | py | Python | src/110B.py | viing937/codeforces | d694eb6967cd56af02963c3a662066048cb78d07 | [
"MIT"
] | 2 | 2016-08-19T09:47:03.000Z | 2016-10-01T10:15:03.000Z | src/110B.py | viing937/codeforces | d694eb6967cd56af02963c3a662066048cb78d07 | [
"MIT"
] | null | null | null | src/110B.py | viing937/codeforces | d694eb6967cd56af02963c3a662066048cb78d07 | [
"MIT"
] | 1 | 2015-07-01T23:57:32.000Z | 2015-07-01T23:57:32.000Z | n = int(input())
ans = n//4*"abcd"
if n%4==1:
ans += "a"
elif n%4==2:
ans += "ab"
elif n%4==3:
ans += "abc"
print(ans)
| 13.1 | 17 | 0.458015 | 27 | 131 | 2.222222 | 0.555556 | 0.133333 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.072165 | 0.259542 | 131 | 9 | 18 | 14.555556 | 0.546392 | 0 | 0 | 0 | 0 | 0 | 0.076336 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.111111 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0d030966fad41e89e0a4653b977ae7f59ea25670 | 6,139 | py | Python | authors/settings.py | andela/ah-backend-odin | 0e9ef1a10c8a3f6736999a5111736f7bd7236689 | [
"BSD-3-Clause"
] | null | null | null | authors/settings.py | andela/ah-backend-odin | 0e9ef1a10c8a3f6736999a5111736f7bd7236689 | [
"BSD-3-Clause"
] | 43 | 2018-10-25T10:14:52.000Z | 2022-03-11T23:33:46.000Z | authors/settings.py | andela/ah-backend-odin | 0e9ef1a10c8a3f6736999a5111736f7bd7236689 | [
"BSD-3-Clause"
] | 4 | 2018-10-29T07:04:58.000Z | 2020-04-02T14:15:10.000Z | """
Django settings for authors project.
Generated by 'django-admin startproject' using Django 1.11.14.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '7pgozr2jn7zs_o%i8id6=rddie!*0f0qy3$oy$(8231i^4*@u3'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['authors-haven-odin.herokuapp.com', 'localhost', '127.0.0.1']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'corsheaders',
'django_extensions',
'rest_framework',
'authors.apps.authentication',
'authors.apps.core',
'authors.apps.profiles',
'authors.apps.password_reset_token',
'authors.apps.articles',
'taggit',
'taggit_serializer',
'authors.apps.reporter',
'drf_yasg',
'authors.apps.follower',
'django_nose',
]
SWAGGER_SETTINGS = {
'SECURITY_DEFINITIONS': {
'api_key': {
'type': 'apiKey',
'in': 'header',
'name': 'Authorization'
}
},
}
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
ROOT_URLCONF = 'authors.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'authors.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
# Heroku Database Config
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.environ.get('DB_NAME', 'authors'),
'USER': os.environ.get('DB_USER', 'postgres'),
'PASSWORD': os.environ.get('DB_PASSWORD'),
'HOST': os.environ.get('DB_HOST', 'localhost'),
'PORT': os.environ.get('DB_PORT', '5432'),
}
}
# Local Postgres Database Config
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql',
# 'NAME': 'authors_haven',
# 'USER': 'postgres',
# 'PASSWORD': 'password',
# 'HOST': '127.0.0.1',
# 'PORT': '5432',
# }
# }
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
# }
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Africa/Kampala'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = 'staticfiles/'
MEDIA_ROOT = "media/"
CORS_ORIGIN_ALLOW_ALL = True
# Tell Django about the custom `User` model we created. The string
# `authentication.User` tells Django we are referring to the `User` model in
# the `authentication` module. This module is registered above in a setting
# called `INSTALLED_APPS`.
AUTH_USER_MODEL = 'authentication.User'
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS':
'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 5,
'MAX_PAGE_SIZE': 5,
'EXCEPTION_HANDLER': 'authors.apps.core.exceptions.core_exception_handler',
'NON_FIELD_ERRORS_KEY': 'error',
'TEST_REQUEST_DEFAULT_FORMAT': 'json',
'TEST_REQUEST_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'authors.apps.authentication.backends.JWTAuthentication',
),
}
JWT = {
# The algorithm to use for encoding and decoding jwt tokens
'ALGORITHM': 'HS256',
'EXPIRATION_IN_MINUTES': 60,
'TOKEN_PREFIX': 'bearer'
}
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = os.environ.get('EMAIL_HOST')
EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD')
EMAIL_PORT = os.environ.get('EMAIL_PORT')
BASE_URL = 'http://127.0.0.1:8000'
TAGGIT_CASE_INSENSITIVE = True
WPM = 200
PASSWORD_RESET_LINK = 'https://ah-frontend-odin-staging.herokuapp.com/complete_reset?token={}'
| 28.290323 | 94 | 0.683499 | 682 | 6,139 | 6.001466 | 0.390029 | 0.047642 | 0.026387 | 0.042756 | 0.173223 | 0.141705 | 0.087466 | 0.087466 | 0.060347 | 0 | 0 | 0.017582 | 0.175436 | 6,139 | 216 | 95 | 28.421296 | 0.790992 | 0.280339 | 0 | 0.030769 | 1 | 0 | 0.561985 | 0.400732 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.069231 | 0.007692 | 0 | 0.007692 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
0d1654d7f700b9b2d0b40153e9978b3ea74beaac | 108 | py | Python | flying_robots/debug.py | bunburya/flying-robots | 6cb61913d07c6200f036ea05b7b0ca952aad5eb9 | [
"MIT"
] | 1 | 2019-11-16T14:42:52.000Z | 2019-11-16T14:42:52.000Z | flying_robots/debug.py | bunburya/FlyingRobots | 6cb61913d07c6200f036ea05b7b0ca952aad5eb9 | [
"MIT"
] | null | null | null | flying_robots/debug.py | bunburya/FlyingRobots | 6cb61913d07c6200f036ea05b7b0ca952aad5eb9 | [
"MIT"
] | null | null | null | LOGFILE = '/tmp/robots.log'
def log(msg):
with open(LOGFILE, 'a') as f:
f.write(str(msg)+'\n')
| 18 | 33 | 0.555556 | 18 | 108 | 3.333333 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 108 | 5 | 34 | 21.6 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0d1efcf08fe46f16a48071188448ad1658187396 | 1,010 | py | Python | somen/somen/pytorch_utility/extensions/__init__.py | pfnet-research/kaggle-hpa-2021-7th-place-solution | 109a074b983e03498630d13adc5383fcc56f8314 | [
"MIT"
] | 8 | 2021-05-28T06:40:14.000Z | 2021-07-09T15:16:03.000Z | somen/somen/pytorch_utility/extensions/__init__.py | pfnet-research/kaggle-hpa-2021-7th-place-solution | 109a074b983e03498630d13adc5383fcc56f8314 | [
"MIT"
] | null | null | null | somen/somen/pytorch_utility/extensions/__init__.py | pfnet-research/kaggle-hpa-2021-7th-place-solution | 109a074b983e03498630d13adc5383fcc56f8314 | [
"MIT"
] | null | null | null | from somen.pytorch_utility.extensions.best_value_snapshot import BestValueSnapshot
from somen.pytorch_utility.extensions.distributed_batch_evaluator import DistributedBatchEvaluator
from somen.pytorch_utility.extensions.distributed_evaluator import DistributedEvaluator
from somen.pytorch_utility.extensions.evaluator import Evaluator
from somen.pytorch_utility.extensions.extension import Extension
from somen.pytorch_utility.extensions.extension_saver import ExtensionSaver
from somen.pytorch_utility.extensions.get_attached_extension import get_attached_extension
from somen.pytorch_utility.extensions.log_report import LogReport
from somen.pytorch_utility.extensions.lr_scheduler import LRScheduler
from somen.pytorch_utility.extensions.summary import DictSummary
__all__ = [
"DictSummary",
"Extension",
"LogReport",
"Evaluator",
"BestValueSnapshot",
"ExtensionSaver",
"get_attached_extension",
"LRScheduler",
"DistributedBatchEvaluator",
"DistributedEvaluator",
]
| 42.083333 | 98 | 0.843564 | 105 | 1,010 | 7.847619 | 0.27619 | 0.109223 | 0.194175 | 0.279126 | 0.470874 | 0.270631 | 0 | 0 | 0 | 0 | 0 | 0 | 0.094059 | 1,010 | 23 | 99 | 43.913043 | 0.900546 | 0 | 0 | 0 | 0 | 0 | 0.145545 | 0.046535 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.454545 | 0 | 0.454545 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
0d277e469aee8b206b04b6972c291507fdc83fa9 | 304 | py | Python | calculatorerror.py | Otumian-empire/My-Exception | 90e80853384039cb53301f540c4624e80345b028 | [
"MIT"
] | null | null | null | calculatorerror.py | Otumian-empire/My-Exception | 90e80853384039cb53301f540c4624e80345b028 | [
"MIT"
] | null | null | null | calculatorerror.py | Otumian-empire/My-Exception | 90e80853384039cb53301f540c4624e80345b028 | [
"MIT"
] | null | null | null | # user defined-exceptions
# an exception class, that will serve as the base file for calculations
class CalculatorError(Exception):
""" Base class for my exception handlers for the calculator class\n
None value may be returned after a calculation, when an exception is
caught """
pass
| 30.4 | 73 | 0.743421 | 43 | 304 | 5.255814 | 0.744186 | 0.097345 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.207237 | 304 | 9 | 74 | 33.777778 | 0.937759 | 0.773026 | 0 | 0 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
0d291bce7a56ef3e21885b5d23cfe11d6ce21e1c | 850 | py | Python | src/CarMonitor/decoder.py | alexjch/car_monitor | a4ce1c52e1504bde4f99f2bd055018972cd763a0 | [
"MIT"
] | 4 | 2016-03-16T23:53:46.000Z | 2020-09-01T17:54:22.000Z | src/CarMonitor/decoder.py | alexjch/car_monitor | a4ce1c52e1504bde4f99f2bd055018972cd763a0 | [
"MIT"
] | null | null | null | src/CarMonitor/decoder.py | alexjch/car_monitor | a4ce1c52e1504bde4f99f2bd055018972cd763a0 | [
"MIT"
] | null | null | null |
from exceptions import Exception
class DecodeException(Exception):
def __init__(self):
Exception.__init__(self)
def __str__(self):
return "Unable to decode exception"
def remove_space(value):
return value.replace(" ", "")
def h2i(value_str):
return int("0x{}".format(value_str), 16)
def mask(value, length):
return value & int("0x0{}".format("".join(['F' for i in range(0, length)])), 16)
"""Helper method that checks returning header and strips it"""
def decode_odb_msg(odb_request, odb_response):
ack = h2i(remove_space(odb_response)) >> (len(remove_space(odb_response))*4 - 16)
req, resp = map(h2i, map(remove_space, [odb_request, odb_response]))
if req & ack == req:
length = len(remove_space(odb_response)) - 4
return mask(resp, length)
raise DecodeException()
| 25.757576 | 85 | 0.668235 | 115 | 850 | 4.695652 | 0.469565 | 0.101852 | 0.103704 | 0.122222 | 0.096296 | 0.096296 | 0 | 0 | 0 | 0 | 0 | 0.02193 | 0.195294 | 850 | 32 | 86 | 26.5625 | 0.767544 | 0 | 0 | 0 | 0 | 0 | 0.047074 | 0 | 0 | 0 | 0.003817 | 0 | 0 | 1 | 0.315789 | false | 0 | 0.052632 | 0.210526 | 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 |
0d2ff1e3370da39fd72510ca1327bd73b57843c9 | 486 | py | Python | back-end/utils.py | cmillani/SPaaS | 5c37f6f6583411c856e2cefa9e94971c472f30b5 | [
"MIT"
] | null | null | null | back-end/utils.py | cmillani/SPaaS | 5c37f6f6583411c856e2cefa9e94971c472f30b5 | [
"MIT"
] | null | null | null | back-end/utils.py | cmillani/SPaaS | 5c37f6f6583411c856e2cefa9e94971c472f30b5 | [
"MIT"
] | null | null | null | import os
import pymongo
from flask import abort, g, Flask, request, Response
from Mechanisms.Blob.BlobMechanismFactory import BlobMechanismFactory
from flask_cors import CORS
from celery import Celery
app = Flask(__name__)
db_client = pymongo.MongoClient(os.environ['SPASS_CONNECTION_STRING']).spassDatabase
CORS(app)
blobMechanism = BlobMechanismFactory.getMechanism()
celery = Celery(app.name, broker=os.environ['SPASS_CELERY_BROKER'], backend=os.environ['SPASS_CELERY_BROKER']) | 30.375 | 110 | 0.823045 | 61 | 486 | 6.360656 | 0.459016 | 0.069588 | 0.108247 | 0.103093 | 0.134021 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.088477 | 486 | 16 | 110 | 30.375 | 0.875847 | 0 | 0 | 0 | 0 | 0 | 0.125257 | 0.047228 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.181818 | 0.545455 | 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 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
0d33579f367a7131cbac07c2540daee418b2d260 | 86 | py | Python | python first.py | darkless456/Python | 1ba37d028e4a818ccfffc18682c1bac15554e3ac | [
"MIT"
] | null | null | null | python first.py | darkless456/Python | 1ba37d028e4a818ccfffc18682c1bac15554e3ac | [
"MIT"
] | null | null | null | python first.py | darkless456/Python | 1ba37d028e4a818ccfffc18682c1bac15554e3ac | [
"MIT"
] | null | null | null |
miles = 1000.0 # A floating point
name = "John" # A string
print(miles)
print(name)
| 12.285714 | 33 | 0.674419 | 14 | 86 | 4.142857 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.072464 | 0.197674 | 86 | 6 | 34 | 14.333333 | 0.768116 | 0.290698 | 0 | 0 | 0 | 0 | 0.070175 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
0d46ce39f03ed728f8738decc8e9cf6e696d9f4e | 278 | py | Python | backend/models/AbstractModel.py | bobmayuze/SDnD-Spring20 | 8fdb9c17e5f071bd63da19fdd9d39ff616ae09db | [
"MIT"
] | 1 | 2020-05-04T22:52:30.000Z | 2020-05-04T22:52:30.000Z | backend/models/AbstractModel.py | aneeshv12/SDnD-Spring20 | 8fdb9c17e5f071bd63da19fdd9d39ff616ae09db | [
"MIT"
] | 4 | 2021-03-10T16:02:03.000Z | 2022-02-27T03:41:56.000Z | backend/models/AbstractModel.py | aneeshv12/SDnD-Spring20 | 8fdb9c17e5f071bd63da19fdd9d39ff616ae09db | [
"MIT"
] | 1 | 2021-09-09T23:51:18.000Z | 2021-09-09T23:51:18.000Z | """
Superclass for all models
All model should be serializable in the database
"""
from abc import ABC, abstractmethod
import database
class AbstractModel(ABC):
def __init__(self):
self.db = database.getDB()
@abstractmethod
def serialize(self):
pass | 21.384615 | 48 | 0.705036 | 34 | 278 | 5.647059 | 0.705882 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.215827 | 278 | 13 | 49 | 21.384615 | 0.880734 | 0.266187 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.125 | 0.25 | 0 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
b4a6d438e8693a864d058916ddd3d23c97c49853 | 99 | py | Python | 7-file-io/file_read.py | elbeg/introduction-to-python | c8a88b1c83c573f623b81fbdb4324aefa9bfbb50 | [
"BSD-2-Clause"
] | 5 | 2015-09-22T19:38:06.000Z | 2017-04-27T13:14:00.000Z | 7-file-io/file_read.py | elbeg/introduction-to-python | c8a88b1c83c573f623b81fbdb4324aefa9bfbb50 | [
"BSD-2-Clause"
] | 3 | 2015-12-14T16:27:54.000Z | 2018-03-08T16:28:30.000Z | 7-file-io/file_read.py | elbeg/introduction-to-python | c8a88b1c83c573f623b81fbdb4324aefa9bfbb50 | [
"BSD-2-Clause"
] | 11 | 2015-09-30T15:24:00.000Z | 2018-07-12T15:15:44.000Z | lorem_file = open("lorem.txt")
for line in lorem_file:
print(line.rstrip())
lorem_file.close()
| 19.8 | 30 | 0.717172 | 16 | 99 | 4.25 | 0.625 | 0.397059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131313 | 99 | 4 | 31 | 24.75 | 0.790698 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 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 |
b4c92f06e02a787d0ec8693d4927d8c74d963578 | 277 | py | Python | cracking_the_coding_interview_qs/17.16/get_max_minutes_test.py | angelusualle/algorithms | 86286a49db2a755bc57330cb455bcbd8241ea6be | [
"Apache-2.0"
] | null | null | null | cracking_the_coding_interview_qs/17.16/get_max_minutes_test.py | angelusualle/algorithms | 86286a49db2a755bc57330cb455bcbd8241ea6be | [
"Apache-2.0"
] | null | null | null | cracking_the_coding_interview_qs/17.16/get_max_minutes_test.py | angelusualle/algorithms | 86286a49db2a755bc57330cb455bcbd8241ea6be | [
"Apache-2.0"
] | null | null | null | import unittest
from get_max_minutes import get_max_minutes
class Test_Case_Get_Max_Minutes(unittest.TestCase):
def test_get_max_minutes(self):
self.assertEqual(get_max_minutes([30, 15, 60, 75, 45, 15, 15, 45]), 180)
if __name__ == '__main__':
unittest.main() | 30.777778 | 80 | 0.743682 | 43 | 277 | 4.302326 | 0.511628 | 0.162162 | 0.351351 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.080508 | 0.148014 | 277 | 9 | 81 | 30.777778 | 0.70339 | 0 | 0 | 0 | 0 | 0 | 0.028777 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.142857 | false | 0 | 0.285714 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
b4d012ee5b0b008686c5280fc859c699dd2a039b | 559 | py | Python | evoke/lib/__init__.py | howiemac/evoke5 | 430d6dfd719f8c88a4c3de2b735f8736187ff19b | [
"BSD-3-Clause"
] | null | null | null | evoke/lib/__init__.py | howiemac/evoke5 | 430d6dfd719f8c88a4c3de2b735f8736187ff19b | [
"BSD-3-Clause"
] | null | null | null | evoke/lib/__init__.py | howiemac/evoke5 | 430d6dfd719f8c88a4c3de2b735f8736187ff19b | [
"BSD-3-Clause"
] | null | null | null | """
evoke library type interface
(IHM April 2017)
"""
#make everything visible as evoke.lib.types
from .INT import INT, SMALLINT, TINYINT
from .DOUBLE import DOUBLE, HUGEDECIMAL
from .FLOAT import FLOAT
from .STR import TAG, STR, CHAR
from .DATE import DATE
from .TEXT import TEXT
from .REL import REL
from .FLAG import FLAG
from .BLOB import BLOB
from .library import sql_list, safeint, httpDate, page, prev, next, url_safe, elapsed, delf
from .email import email
from .error import Error
from .permit import Permit, Condition
from .bug import send_error
| 24.304348 | 91 | 0.774597 | 87 | 559 | 4.942529 | 0.528736 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008475 | 0.155635 | 559 | 22 | 92 | 25.409091 | 0.902542 | 0.161002 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
b4d19467a4d0ab046cb8400aa8f24f45f54f1486 | 2,776 | py | Python | dojo/db_migrations/0072_composite_index.py | mtcolman/django-DefectDojo | 76175aca446e077884bdb5e1d8e2a671a0840775 | [
"BSD-3-Clause"
] | 1,772 | 2018-01-22T23:32:15.000Z | 2022-03-31T14:49:33.000Z | dojo/db_migrations/0072_composite_index.py | mtcolman/django-DefectDojo | 76175aca446e077884bdb5e1d8e2a671a0840775 | [
"BSD-3-Clause"
] | 3,461 | 2018-01-20T19:12:28.000Z | 2022-03-31T17:14:39.000Z | dojo/db_migrations/0072_composite_index.py | mtcolman/django-DefectDojo | 76175aca446e077884bdb5e1d8e2a671a0840775 | [
"BSD-3-Clause"
] | 1,173 | 2018-01-23T07:10:23.000Z | 2022-03-31T14:40:43.000Z | # Generated by Django 2.2.17 on 2021-02-03 08:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dojo', '0071_product_type_enhancement'),
]
operations = [
migrations.AddIndex(
model_name='finding',
index=models.Index(fields=['test', 'active', 'verified'], name='dojo_findin_test_id_bfc47c_idx'),
),
migrations.AddIndex(
model_name='endpoint',
index=models.Index(fields=['product', 'mitigated'], name='dojo_endpoi_product_b80e9a_idx'),
),
migrations.AddIndex(
model_name='endpoint_status',
index=models.Index(fields=['finding', 'mitigated'], name='dojo_endpoi_finding_0fa5ce_idx'),
),
migrations.AddIndex(
model_name='endpoint_status',
index=models.Index(fields=['endpoint', 'mitigated'], name='dojo_endpoi_endpoin_d85400_idx'),
),
migrations.AddIndex(
model_name='engagement',
index=models.Index(fields=['product', 'active'], name='dojo_engage_product_16b039_idx'),
),
migrations.AddIndex(
model_name='finding',
index=models.Index(fields=['test', 'is_Mitigated'], name='dojo_findin_test_id_afee7e_idx'),
),
migrations.AddIndex(
model_name='finding',
index=models.Index(fields=['test', 'duplicate'], name='dojo_findin_test_id_52d78d_idx'),
),
migrations.AddIndex(
model_name='finding',
index=models.Index(fields=['test', 'out_of_scope'], name='dojo_findin_test_id_742a6f_idx'),
),
migrations.AddIndex(
model_name='finding',
index=models.Index(fields=['test', 'false_p'], name='dojo_findin_test_id_188e8a_idx'),
),
migrations.AddIndex(
model_name='finding',
index=models.Index(fields=['test', 'unique_id_from_tool', 'duplicate'], name='dojo_findin_test_id_269acb_idx'),
),
migrations.AddIndex(
model_name='finding',
index=models.Index(fields=['test', 'hash_code', 'duplicate'], name='dojo_findin_test_id_e54563_idx'),
),
migrations.AddIndex(
model_name='finding',
index=models.Index(fields=['test', 'component_name'], name='dojo_findin_test_id_396336_idx'),
),
migrations.AddIndex(
model_name='notifications',
index=models.Index(fields=['user', 'product'], name='dojo_notifi_user_id_575989_idx'),
),
migrations.AddIndex(
model_name='test',
index=models.Index(fields=['engagement', 'test_type'], name='dojo_test_engagem_bb6b41_idx'),
),
]
| 39.657143 | 123 | 0.60879 | 291 | 2,776 | 5.484536 | 0.254296 | 0.157895 | 0.201754 | 0.236842 | 0.630326 | 0.474937 | 0.396617 | 0.396617 | 0.396617 | 0.396617 | 0 | 0.035181 | 0.252522 | 2,776 | 69 | 124 | 40.231884 | 0.733976 | 0.016571 | 0 | 0.603175 | 1 | 0 | 0.296921 | 0.163856 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.015873 | 0 | 0.063492 | 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 |
371b36e8a49224674db77f9b3a715bdf2a3436c2 | 569 | py | Python | home/models.py | ayushnanda21/Icebegin-Django | 2bdbbc4f83ae8e3ce49f7d2c204cf58b73c24394 | [
"MIT"
] | null | null | null | home/models.py | ayushnanda21/Icebegin-Django | 2bdbbc4f83ae8e3ce49f7d2c204cf58b73c24394 | [
"MIT"
] | null | null | null | home/models.py | ayushnanda21/Icebegin-Django | 2bdbbc4f83ae8e3ce49f7d2c204cf58b73c24394 | [
"MIT"
] | null | null | null | from django.db import models
# Create your models here.
# makemigrations - create changes and store in a file
# migrate - apply the pending chnages created by make migrations
class Contact(models.Model): #this class contact means a table/excel sheet in database
name= models.CharField(max_length=122)
email= models.CharField(max_length=122)
phone=models.CharField(max_length=12)
desc= models.TextField()
date=models.DateField()
def __str__(self):
return self.name #to return name of person in database instead of anonymous | 35.5625 | 90 | 0.73638 | 80 | 569 | 5.15 | 0.675 | 0.109223 | 0.131068 | 0.174757 | 0.131068 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017391 | 0.191564 | 569 | 16 | 91 | 35.5625 | 0.878261 | 0.44464 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.111111 | 0.111111 | 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 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
2e97ab412cef43d9a95899497eaffc4ba3dc2bb4 | 205 | py | Python | scripts/portal/inPTjob2.py | G00dBye/YYMS | 1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb | [
"MIT"
] | 54 | 2019-04-16T23:24:48.000Z | 2021-12-18T11:41:50.000Z | scripts/portal/inPTjob2.py | G00dBye/YYMS | 1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb | [
"MIT"
] | 3 | 2019-05-19T15:19:41.000Z | 2020-04-27T16:29:16.000Z | scripts/portal/inPTjob2.py | G00dBye/YYMS | 1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb | [
"MIT"
] | 49 | 2020-11-25T23:29:16.000Z | 2022-03-26T16:20:24.000Z | # 200020001
if 2400 == chr.getJob():
sm.warp(915010000, 1)# should be instance ?
elif 2410 <= chr.getJob() <= 2411:
sm.warp(915020000, 2)
else:
sm.chat("Only Phantoms can enter.")
sm.dispose()
| 22.777778 | 47 | 0.643902 | 30 | 205 | 4.4 | 0.8 | 0.136364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.245509 | 0.185366 | 205 | 8 | 48 | 25.625 | 0.54491 | 0.146341 | 0 | 0 | 0 | 0 | 0.139535 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2eb57e79d56f696478b5c73c4e77da562a0e1646 | 618 | py | Python | application/Post.py | andrew749/andrew749.github.io | 3b39cad5706557358311ba73b2ec77b7b73d90b7 | [
"Apache-2.0"
] | null | null | null | application/Post.py | andrew749/andrew749.github.io | 3b39cad5706557358311ba73b2ec77b7b73d90b7 | [
"Apache-2.0"
] | null | null | null | application/Post.py | andrew749/andrew749.github.io | 3b39cad5706557358311ba73b2ec77b7b73d90b7 | [
"Apache-2.0"
] | null | null | null | from flask import url_for
class Post:
def __init__(self, title, subtitle, content, date):
self.title = title
self.subtitle = subtitle
self.date = date
self.content = content
def getTitle(self):
return self.title
def __json__(self):
return dict(
title=self.title,
subtitle=self.subtitle,
date=self.date,
content=self.content,
url=url_for('blog_post', blog_slug=self.title)
)
def serialize(self):
return self.__json__()
def to_json(self):
return self.__json__()
| 22.071429 | 58 | 0.576052 | 71 | 618 | 4.71831 | 0.309859 | 0.134328 | 0.125373 | 0.107463 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.331715 | 618 | 27 | 59 | 22.888889 | 0.811138 | 0 | 0 | 0.095238 | 0 | 0 | 0.014587 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.238095 | false | 0 | 0.047619 | 0.190476 | 0.52381 | 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 |
2ed6957f8f02012515033409174a3e0f0299c0b8 | 2,000 | py | Python | config/credentials.py | adele-angel/selenium-test-automation | 23aac2e195883ea72cf0f2668cdb7cedd885ec24 | [
"MIT"
] | null | null | null | config/credentials.py | adele-angel/selenium-test-automation | 23aac2e195883ea72cf0f2668cdb7cedd885ec24 | [
"MIT"
] | null | null | null | config/credentials.py | adele-angel/selenium-test-automation | 23aac2e195883ea72cf0f2668cdb7cedd885ec24 | [
"MIT"
] | null | null | null | class Credentials:
BASE_URL = "http://localhost:8080"
# Login Page
LOGIN_PAGE_TITLE = "OpenProject"
USERNAME = "admin"
PASSWORD = "qazwsxedcr"
# Home Page
HOME_PAGE_TITLE = "OpenProject"
HOME_PAGE_SELECTED_PROJECT = "TestProject1"
# New Project page
NEW_PROJECT_PAGE_TITLE = "New project | OpenProject"
NEW_PROJECT_NAME = "Hello World! 1#2@3"
NEW_PROJECT_DESCRIPTION = "French fries, or simply fries, chips, finger chips, hot chips or French-fried potatoes, are deep-fried potatoes, which have been cut into batons."
NEW_PROJECT_STATUS = "On track"
# Project Overview Page
PROJECT_OVERVIEW_PAGE_TITLE = "Overview"
# Work Packages Page
WORK_PACKAGES_PAGE_TITLE_1 = "Work Packages | {} | OpenProject"
WORK_PACKAGES_PAGE_TITLE_2 = "All open | {} | OpenProject"
WORK_PACKAGE_FORM_TITLE = "New TASK"
NEW_TASK_TYPE = "TASK"
NEW_TASK_SUBJECT = "My Task 1"
NEW_TASK_DESCRIPTION = "123 @ # $ ./ - Lorem ipsum dolor sit amet, consectetur adipiscing elit. In eleifend at magna eu lobortis. Vestibulum ante ipsum primis in faucibus orci luctus et " \
"ultrices posuere cubilia curae; Aenean quis sodales lacus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Phasellus accumsan consectetur arcu, " \
"eu pellentesque nunc gravida et. Sed posuere non massa sit amet mattis. Aenean fermentum euismod purus, id elementum nisl vulputate nec. Integer quis urna molestie, " \
"interdum orci quis, molestie ligula. Suspendisse potenti. Etiam placerat, turpis id convallis sagittis, magna metus porta eros, in finibus sapien arcu ac tortor. " \
"Praesent tempus, nibh ornare pulvinar placerat, augue elit dictum arcu, sit amet ultricies erat ante fermentum metus. "
NEW_WORK_PACKAGE_PAGE_TITLE = "New work package | {} | OpenProject"
CREATED_TASK_PAGE_TITLE = "Task: {} (#{}) | {} | OpenProject"
| 57.142857 | 196 | 0.696 | 250 | 2,000 | 5.392 | 0.548 | 0.053412 | 0.035608 | 0.031157 | 0.037092 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009109 | 0.2315 | 2,000 | 34 | 197 | 58.823529 | 0.867925 | 0.039 | 0 | 0 | 0 | 0.25 | 0.620042 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.041667 | 0 | 0 | 0.833333 | 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 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
2c076bae3740a92771acd7ac5c0b8bfbefcd67e3 | 4,646 | py | Python | tests/unit/notice_packager/test_notice_packager.py | meaningfy-ws/ted-xml-2-rdf | ac26a19f3761b7cf79d79a46be6323b658f067eb | [
"Apache-2.0"
] | 1 | 2022-03-21T12:32:52.000Z | 2022-03-21T12:32:52.000Z | tests/unit/notice_packager/test_notice_packager.py | meaningfy-ws/ted-xml-2-rdf | ac26a19f3761b7cf79d79a46be6323b658f067eb | [
"Apache-2.0"
] | 24 | 2022-02-10T10:43:56.000Z | 2022-03-29T12:36:21.000Z | tests/unit/notice_packager/test_notice_packager.py | meaningfy-ws/ted-sws | d1e351eacb2900f84ec7edc457e49d8202fbaff5 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python3
# test_notice_packager.py
# Date: 08/03/2022
# Author: Kolea PLESCO
# Email: kalean.bl@gmail.com
""" """
import base64
import os
import pytest
from ted_sws.notice_packager.model.metadata import ACTION_CREATE, ACTION_UPDATE
from ted_sws.notice_packager.services.notice_packager import create_notice_package
from tests import TEST_DATA_PATH
def test_notice_packager(notice_sample_metadata):
encoded_package_content = create_notice_package(notice_sample_metadata)
assert encoded_package_content is not None
raw_package_content = base64.b64decode(encoded_package_content)
assert b'mets.xml.dmd.rdf' in raw_package_content
assert b'mets.xml' in raw_package_content
assert b'tmd.rdf' in raw_package_content
def test_notice_packager_with_create_action(notice_sample_metadata):
encoded_package_content = create_notice_package(notice_sample_metadata, action=ACTION_CREATE)
assert encoded_package_content is not None
raw_package_content = base64.b64decode(encoded_package_content)
assert b'mets2create.mets.xml' in raw_package_content
def test_notice_packager_with_update_action(notice_sample_metadata):
encoded_package_content = create_notice_package(notice_sample_metadata, action=ACTION_UPDATE)
assert encoded_package_content is not None
raw_package_content = base64.b64decode(encoded_package_content)
assert b'mets2update.mets.xml' in raw_package_content
def test_notice_packager_with_wrong_input_data_type(notice_sample_metadata):
input_data = 123 # wrong input_data type
with pytest.raises(TypeError):
create_notice_package(input_data)
def test_notice_packager_with_notice(notice_2018):
encoded_package_content = create_notice_package(notice_2018)
assert encoded_package_content is not None
def test_notice_packager_with_notice_id(notice_2018, notice_repository):
notice_id = 'fake-notice-id'
notice_repository.add(notice_2018)
encoded_package_content = create_notice_package(in_data=notice_2018.ted_id, notice_repository=notice_repository)
assert encoded_package_content is not None
with pytest.raises(TypeError):
create_notice_package(in_data=notice_id, notice_repository=None)
with pytest.raises(TypeError):
notice_id = 'fake-wrong-notice-id'
create_notice_package(in_data=notice_id, notice_repository=notice_repository)
def test_notice_packager_with_extra_files(notice_2018):
encoded_package_content = create_notice_package(
notice_2018,
extra_files=[
TEST_DATA_PATH / "notice_packager" / "notice.xml"
]
)
assert encoded_package_content is not None
def test_notice_packager_with_non_existent_files(notice_2018):
encoded_package_content = create_notice_package(
notice_2018,
extra_files=[
TEST_DATA_PATH / "notice_packager" / "non_existent_notice_file.xml"
]
)
assert encoded_package_content is not None
def test_notice_packager_with_rdf_content(notice_2018, rdf_content):
encoded_rdf_content = base64.b64encode(bytes(rdf_content, 'utf-8'))
encoded_package_content = create_notice_package(
notice_2018,
rdf_content=encoded_rdf_content
)
assert encoded_package_content is not None
encoded_package_content = create_notice_package(
notice_2018,
rdf_content=str(encoded_rdf_content, 'utf-8')
)
assert encoded_package_content is not None
encoded_package_content = create_notice_package(
notice_2018,
rdf_content=rdf_content.encode("utf-8")
)
assert encoded_package_content is not None
def test_notice_packager_with_save_to(notice_sample_metadata, rdf_content):
package_path = create_notice_package(
notice_sample_metadata,
save_to=TEST_DATA_PATH / "notice_packager" / "packages" / "fake-archive.zip"
)
assert os.path.exists(package_path)
os.remove(package_path)
package_path = create_notice_package(
notice_sample_metadata,
save_to=TEST_DATA_PATH / "notice_packager" / "packages"
)
assert os.path.exists(package_path)
os.remove(package_path)
encoded_rdf_content = base64.b64encode(bytes(rdf_content, 'utf-8'))
package_path = create_notice_package(
notice_sample_metadata,
rdf_content=encoded_rdf_content,
save_to=TEST_DATA_PATH / "notice_packager" / "packages" / "fake-rdf.zip"
)
assert os.path.exists(package_path)
os.remove(package_path)
package_path = create_notice_package(
notice_sample_metadata,
save_to=""
)
assert package_path is not None
| 32.71831 | 116 | 0.768188 | 617 | 4,646 | 5.34846 | 0.137763 | 0.131515 | 0.146364 | 0.098485 | 0.814545 | 0.749394 | 0.714545 | 0.671515 | 0.641212 | 0.581212 | 0 | 0.023742 | 0.165949 | 4,646 | 141 | 117 | 32.950355 | 0.827871 | 0.027766 | 0 | 0.444444 | 0 | 0 | 0.064387 | 0.006217 | 0 | 0 | 0 | 0 | 0.191919 | 1 | 0.10101 | false | 0 | 0.060606 | 0 | 0.161616 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2c16b96230336644e12a35a9684d43abcee3ab7c | 85 | py | Python | meth5/__init__.py | snajder-r/MetH5Format | 4db69fedc5e830fe660a87bdcb3cc29f7d414ae5 | [
"MIT"
] | 2 | 2020-10-16T08:50:41.000Z | 2020-12-02T22:51:54.000Z | meth5/__init__.py | snajder-r/MetH5Format | 4db69fedc5e830fe660a87bdcb3cc29f7d414ae5 | [
"MIT"
] | null | null | null | meth5/__init__.py | snajder-r/MetH5Format | 4db69fedc5e830fe660a87bdcb3cc29f7d414ae5 | [
"MIT"
] | null | null | null | __description__ = "HDF5-based container format for Methylation calls from long reads" | 85 | 85 | 0.835294 | 11 | 85 | 6.090909 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013333 | 0.117647 | 85 | 1 | 85 | 85 | 0.88 | 0 | 0 | 0 | 0 | 0 | 0.755814 | 0 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2c18294b94511c6473d785e252557d1cfe8927ed | 25 | py | Python | lang/py/cookbook/v2/source/cb2_4_15_exm_1.py | ch1huizong/learning | 632267634a9fd84a5f5116de09ff1e2681a6cc85 | [
"MIT"
] | null | null | null | lang/py/cookbook/v2/source/cb2_4_15_exm_1.py | ch1huizong/learning | 632267634a9fd84a5f5116de09ff1e2681a6cc85 | [
"MIT"
] | null | null | null | lang/py/cookbook/v2/source/cb2_4_15_exm_1.py | ch1huizong/learning | 632267634a9fd84a5f5116de09ff1e2681a6cc85 | [
"MIT"
] | null | null | null | list_of_values = d1[key]
| 12.5 | 24 | 0.76 | 5 | 25 | 3.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045455 | 0.12 | 25 | 1 | 25 | 25 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
2c1e46890abc321bd18f1dba1c58ab8c354cf694 | 2,587 | py | Python | jupyter/notebooks/jupyter_apis/API_Client.py | lucia15/cdr-plugin-folder-to-folder | 6dc245086d613a07e0fc63057d1ca1da965feccd | [
"Apache-2.0"
] | null | null | null | jupyter/notebooks/jupyter_apis/API_Client.py | lucia15/cdr-plugin-folder-to-folder | 6dc245086d613a07e0fc63057d1ca1da965feccd | [
"Apache-2.0"
] | null | null | null | jupyter/notebooks/jupyter_apis/API_Client.py | lucia15/cdr-plugin-folder-to-folder | 6dc245086d613a07e0fc63057d1ca1da965feccd | [
"Apache-2.0"
] | 1 | 2022-02-21T15:48:51.000Z | 2022-02-21T15:48:51.000Z | import os
from urllib.parse import urljoin
import requests
import json
from osbot_utils.utils.Http import GET_json,POST,POST_json
from osbot_utils.utils.Json import str_to_json, json_to_str
DEFAULT_API_SERVER = 'http://api:8880'
class API_Client:
def __init__(self, url_server=DEFAULT_API_SERVER):
self.server_ip = url_server
# helper methods
def _resolve_url(self, path=""):
return urljoin(self.server_ip, path)
def _request_get(self, path):
url = self._resolve_url(path)
return GET_json(url)
def _request_post(self, path):
url = self._resolve_url(path)
return POST(url=url,data=b'', headers=None)
def _request_http_post(self,path,data,headers):
url = self._resolve_url(path)
return requests.post(url=url, data=data, headers=headers)
# API methods
def clear_data_and_status(self):
return self._request_post('/pre-processor/clear-data-and-status')
def health(self):
return self._request_get('/health')
def version(self):
return self._request_get('/version')
def pre_process(self):
return self._request_post('/pre-processor/pre-process')
def process_files(self):
assert self.pre_process() == '["Processing is done"]'
assert self.start_process() == '"Loop completed"'
return "all files processed "
def start_process(self):
return self._request_post('/processing/start')
def stop_process(self):
return self._request_post('/processing/stop')
def configure_environment(self, data):
headers = { 'accept': 'application/json' ,
'Content-Type': 'application/json'}
post_data = json_to_str(data)
return self._request_http_post(path="configuration/configure_env",headers=headers,data=post_data)
def set_gw_sdk_endpoints(self,data):
headers = { 'accept': 'application/json' ,
'Content-Type': 'application/json'}
post_data = json_to_str(data)
return self._request_http_post(path="configuration/configure_gw_sdk_endpoints", headers=headers, data=post_data)
# helper methods
def configure(self, data_paths, sdk_endpoints, clear_data=False):
status = {}
if clear_data:
status['clear_data_and_status'] = self.clear_data_and_status()
status['configure_environment'] = self.configure_environment(data=data_paths)
status['set_gw_sdk_endpoints'] = self.set_gw_sdk_endpoints(data=sdk_endpoints)
return status
| 33.597403 | 120 | 0.673367 | 330 | 2,587 | 4.975758 | 0.212121 | 0.048721 | 0.082826 | 0.076736 | 0.459196 | 0.322777 | 0.302071 | 0.205847 | 0.163216 | 0.163216 | 0 | 0.00198 | 0.219173 | 2,587 | 76 | 121 | 34.039474 | 0.810891 | 0.015848 | 0 | 0.166667 | 0 | 0 | 0.162141 | 0.067296 | 0 | 0 | 0 | 0 | 0.037037 | 1 | 0.277778 | false | 0 | 0.111111 | 0.12963 | 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 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
2c324a060d2535d653d9fa0c8bf2793797ab4fcc | 2,248 | py | Python | tests/python/frontend/mxnet/model_zoo/__init__.py | XiaoSong9905/tvm | 48940f697e15d5b50fa1f032003e6c700ae1e423 | [
"Apache-2.0"
] | 4,640 | 2017-08-17T19:22:15.000Z | 2019-11-04T15:29:46.000Z | tests/python/frontend/mxnet/model_zoo/__init__.py | XiaoSong9905/tvm | 48940f697e15d5b50fa1f032003e6c700ae1e423 | [
"Apache-2.0"
] | 3,022 | 2020-11-24T14:02:31.000Z | 2022-03-31T23:55:31.000Z | tests/python/frontend/mxnet/model_zoo/__init__.py | XiaoSong9905/tvm | 48940f697e15d5b50fa1f032003e6c700ae1e423 | [
"Apache-2.0"
] | 1,352 | 2017-08-17T19:30:38.000Z | 2019-11-04T16:09:29.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.
"""MXNet model zoo for testing purposes."""
from __future__ import absolute_import
from . import mlp, vgg, resnet, dqn, inception_v3, squeezenet, dcgan
import tvm.relay.testing
# mlp
def mx_mlp():
num_class = 10
return mlp.get_symbol(num_class)
def relay_mlp():
num_class = 10
return tvm.relay.testing.mlp.get_workload(1, num_class)[0]
# vgg
def mx_vgg(num_layers):
num_class = 1000
return vgg.get_symbol(num_class, num_layers)
def relay_vgg(num_layers):
num_class = 1000
return tvm.relay.testing.vgg.get_workload(1, num_class, num_layers=num_layers)[0]
# resnet
def mx_resnet(num_layers):
num_class = 1000
return resnet.get_symbol(num_class, num_layers, "3,224,224")
def relay_resnet(num_layers):
num_class = 1000
return tvm.relay.testing.resnet.get_workload(1, num_class, num_layers=num_layers)[0]
# dqn
mx_dqn = dqn.get_symbol
def relay_dqn():
return tvm.relay.testing.dqn.get_workload(1)[0]
# squeezenet
def mx_squeezenet(version):
return squeezenet.get_symbol(version=version)
def relay_squeezenet(version):
return tvm.relay.testing.squeezenet.get_workload(1, version=version)[0]
# inception
mx_inception_v3 = inception_v3.get_symbol
def relay_inception_v3():
return tvm.relay.testing.inception_v3.get_workload(1)[0]
# dcgan generator
mx_dcgan = dcgan.get_symbol
def relay_dcgan(batch_size):
return tvm.relay.testing.dcgan.get_workload(batch_size=batch_size)[0]
| 25.83908 | 88 | 0.757562 | 348 | 2,248 | 4.712644 | 0.310345 | 0.058537 | 0.073171 | 0.089634 | 0.209756 | 0.17439 | 0.142683 | 0.09878 | 0.09878 | 0.047561 | 0 | 0.025776 | 0.154359 | 2,248 | 86 | 89 | 26.139535 | 0.836928 | 0.376779 | 0 | 0.176471 | 0 | 0 | 0.006555 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.323529 | false | 0 | 0.088235 | 0.147059 | 0.735294 | 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 |
25ae1fa00263173978ea7aac59cd9b263c636cea | 1,170 | py | Python | api/jobby/django_config.py | Quving/jobby | 813ca3b4172bdce844095551f74366540ae17229 | [
"MIT"
] | 1 | 2020-12-26T06:36:46.000Z | 2020-12-26T06:36:46.000Z | api/jobby/django_config.py | Quving/jobby | 813ca3b4172bdce844095551f74366540ae17229 | [
"MIT"
] | null | null | null | api/jobby/django_config.py | Quving/jobby | 813ca3b4172bdce844095551f74366540ae17229 | [
"MIT"
] | null | null | null | import os
class DjangoConfig:
PROJECT_NAME = 'JOBBY'
if os.getenv('DJANGO_MODE') == 'production':
IS_DEBUG = False
elif os.getenv('DJANGO_MODE') == 'development':
IS_DEBUG = True
else:
IS_DEBUG = False
USE_HTTPS = os.getenv(PROJECT_NAME + '_USE_HTTPS') == 'true'
SECRET_KEY = os.getenv(PROJECT_NAME + '_SECRET_KEY', None)
DB_NAME = os.getenv(PROJECT_NAME + "_DB_NAME", None)
DB_USER = os.getenv(PROJECT_NAME + "_DB_USER", None)
DB_PASS = os.getenv(PROJECT_NAME + "_DB_PASS", None)
DB_HOST = os.getenv(PROJECT_NAME + "_DB_HOST", None)
DB_PORT = int(os.getenv(PROJECT_NAME + "_DB_PORT", None))
EMAIL_HOST = os.getenv(PROJECT_NAME + "_EMAIL_HOST", None)
EMAIL_USER = os.getenv(PROJECT_NAME + "_EMAIL_USER", None)
EMAIL_PASS = os.getenv(PROJECT_NAME + "_EMAIL_PASS", None)
EMAIL_DEFAULT = os.getenv(PROJECT_NAME + "_EMAIL_DEFAULT", None)
def check_env(self):
attrs = [i for i in dir(self) if not i.startswith('_') and i.isupper()]
for attr in attrs:
if getattr(self, attr) is None:
raise Exception('Env \'{}\' is not set.'.format(attr))
| 37.741935 | 79 | 0.646154 | 165 | 1,170 | 4.266667 | 0.309091 | 0.147727 | 0.234375 | 0.296875 | 0.319602 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.220513 | 1,170 | 30 | 80 | 39 | 0.77193 | 0 | 0 | 0.08 | 0 | 0 | 0.152137 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.04 | false | 0.08 | 0.04 | 0 | 0.6 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
25d5e3af16a45b9687ef83573cf482daaee2c7a7 | 285 | py | Python | qtrader/agents/uniform.py | parrondo/qtrader | 09f20d305c465d8faf5c85ce0b98c7fdfb69bfde | [
"Apache-2.0"
] | null | null | null | qtrader/agents/uniform.py | parrondo/qtrader | 09f20d305c465d8faf5c85ce0b98c7fdfb69bfde | [
"Apache-2.0"
] | null | null | null | qtrader/agents/uniform.py | parrondo/qtrader | 09f20d305c465d8faf5c85ce0b98c7fdfb69bfde | [
"Apache-2.0"
] | null | null | null | import numpy as np
from qtrader.agents.base import BaseAgent
class UniformAgent(BaseAgent):
"""Uniform agent."""
def __init__(self, action_space):
self.N = action_space.shape[0]
def act(self, observation, reward, done):
return np.ones(self.N) / self.N
| 20.357143 | 45 | 0.673684 | 39 | 285 | 4.769231 | 0.692308 | 0.080645 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004444 | 0.210526 | 285 | 13 | 46 | 21.923077 | 0.822222 | 0.049123 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.285714 | 0.142857 | 0.857143 | 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 |
d326161d197f9810c3a9ffe70df9ea7442755031 | 787 | py | Python | checkov/terraform/checks/resource/gcp/GKEMetadataServerisEnabled.py | kylelaker/checkov | 6eada26030a87f397a6bf1831827b3dc6c5dad2d | [
"Apache-2.0"
] | 3 | 2021-04-19T17:17:21.000Z | 2021-09-06T06:31:09.000Z | checkov/terraform/checks/resource/gcp/GKEMetadataServerisEnabled.py | kylelaker/checkov | 6eada26030a87f397a6bf1831827b3dc6c5dad2d | [
"Apache-2.0"
] | 16 | 2021-03-09T07:38:38.000Z | 2021-06-09T03:53:55.000Z | checkov/terraform/checks/resource/gcp/GKEMetadataServerisEnabled.py | kylelaker/checkov | 6eada26030a87f397a6bf1831827b3dc6c5dad2d | [
"Apache-2.0"
] | 1 | 2022-01-06T08:04:56.000Z | 2022-01-06T08:04:56.000Z | from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceValueCheck
from checkov.common.models.enums import CheckCategories
class GKEMetadataServerisEnabled(BaseResourceValueCheck):
def __init__(self):
name = "Ensure the GKE Metadata Server is Enabled"
id = "CKV_GCP_69"
supported_resources = ['google_container_cluster','google_container_node_pool']
categories = [CheckCategories.KUBERNETES]
super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)
def get_inspected_key(self):
return 'node_config/[0]/workload_metadata_config/[0]/node_metadata'
def get_expected_values(self):
return "GKE_METADATA_SERVER"
check = GKEMetadataServerisEnabled()
| 37.47619 | 106 | 0.767471 | 86 | 787 | 6.662791 | 0.581395 | 0.094241 | 0.059337 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005988 | 0.151207 | 787 | 20 | 107 | 39.35 | 0.851796 | 0 | 0 | 0 | 0 | 0 | 0.226175 | 0.13723 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.142857 | 0.142857 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
d32acba9d551d9292546679e1277eb78e85648db | 725 | py | Python | AXF/App/migrations/0003_auto_20181213_1706.py | sajinchang/django_axf | cc6878cfa48cc31fe753aa4213a163bd98942795 | [
"Apache-2.0"
] | null | null | null | AXF/App/migrations/0003_auto_20181213_1706.py | sajinchang/django_axf | cc6878cfa48cc31fe753aa4213a163bd98942795 | [
"Apache-2.0"
] | null | null | null | AXF/App/migrations/0003_auto_20181213_1706.py | sajinchang/django_axf | cc6878cfa48cc31fe753aa4213a163bd98942795 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-12-13 17:06
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('App', '0002_foodtype_mianshow_shop'),
]
operations = [
migrations.RenameField(
model_name='mianshow',
old_name='logname1',
new_name='longname1',
),
migrations.RenameField(
model_name='mianshow',
old_name='logname2',
new_name='longname2',
),
migrations.RenameField(
model_name='mianshow',
old_name='logname3',
new_name='longname3',
),
]
| 23.387097 | 48 | 0.565517 | 69 | 725 | 5.695652 | 0.608696 | 0.160305 | 0.198473 | 0.229008 | 0.343511 | 0.343511 | 0.343511 | 0 | 0 | 0 | 0 | 0.054878 | 0.321379 | 725 | 30 | 49 | 24.166667 | 0.743902 | 0.093793 | 0 | 0.391304 | 1 | 0 | 0.16055 | 0.041284 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.086957 | 0 | 0.217391 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.