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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f91807af3e7ac683841310ab31e18d4892b06a39 | 337 | py | Python | rspec/spec_commands/bundle.py | astrauka/SublimeRSpec | 329b6ca928a82a834e7a55e7298fcfc1015a8a4b | [
"MIT"
] | 66 | 2016-04-05T07:21:36.000Z | 2022-01-13T12:18:36.000Z | rspec/spec_commands/bundle.py | astrauka/SublimeRSpec | 329b6ca928a82a834e7a55e7298fcfc1015a8a4b | [
"MIT"
] | 39 | 2016-04-26T15:28:52.000Z | 2021-12-01T12:32:43.000Z | rspec/spec_commands/bundle.py | astrauka/SublimeRSpec | 329b6ca928a82a834e7a55e7298fcfc1015a8a4b | [
"MIT"
] | 20 | 2016-05-16T23:35:03.000Z | 2022-01-09T00:24:24.000Z | import os
class Bundle:
def __init__(self, context):
self.context = context
def result(self):
if not self.context.from_settings("check_for_bundler"):
return
if self.gemfile_exists():
return "bundle exec"
def gemfile_exists(self):
return self.context.gemfile_path()
| 21.0625 | 63 | 0.623145 | 40 | 337 | 5 | 0.525 | 0.22 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.287834 | 337 | 15 | 64 | 22.466667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0.083086 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.090909 | 0.090909 | 0.727273 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
f924762c5de2a5d7721ad2fd0968f128a0f2e1a8 | 1,555 | py | Python | tests/base_tests.py | cyphyhouse/CyPyHous3 | 9ba2e9681391d6b9773258bcc73b5e10f403dda7 | [
"MIT"
] | 4 | 2019-05-25T00:48:40.000Z | 2019-09-16T05:20:29.000Z | tests/base_tests.py | cyphyhouse/CyPyHous3 | 9ba2e9681391d6b9773258bcc73b5e10f403dda7 | [
"MIT"
] | 17 | 2019-05-22T20:05:46.000Z | 2020-02-24T16:18:59.000Z | tests/base_tests.py | cyphyhouse/CyPyHous3 | 9ba2e9681391d6b9773258bcc73b5e10f403dda7 | [
"MIT"
] | 2 | 2019-06-19T20:41:55.000Z | 2022-02-16T13:09:40.000Z | # Copyright (c) 2019 CyPhyHouse. All Rights Reserved.
# base test suite
import unittest
import tests.base.test_agent_config as test_agent_config
import tests.base.test_agent_thread as test_agent_thread
import tests.base.test_cylobs as test_cylobs
import tests.base.test_message as test_message
import tests.base.test_moat_config as test_moat_config
import tests.base.test_mutex_handler as test_mutex_handler
import tests.base.test_obstacle as test_obstacle
import tests.base.test_planner as test_planner
import tests.base.test_pos as test_pos
import tests.base.test_roundobs as test_roundobs
import tests.base.test_seg as test_seg
import tests.base.test_msg_create as test_msg_create
import tests.base.test_dsm as test_dsm
import tests.base.test_dsm_allread as test_dsm_allread
import tests.base.test_dsm_allwrite as test_dsm_allwrite
import tests.base.test_gvh as test_gvh
def main():
suite = unittest.TestSuite()
loader = unittest.TestLoader()
modules = [
test_agent_config,
test_agent_thread,
test_moat_config,
test_mutex_handler,
test_obstacle,
test_planner,
test_pos,
test_roundobs,
test_seg,
test_cylobs,
test_message,
test_msg_create,
test_dsm,
test_dsm_allread,
test_dsm_allwrite,
test_gvh
]
suite.addTests(loader.loadTestsFromModule(m) for m in modules)
runner = unittest.TextTestRunner(verbosity=3)
result = runner.run(suite)
return result
if __name__ == "__main__":
main()
| 28.796296 | 66 | 0.753055 | 226 | 1,555 | 4.840708 | 0.234513 | 0.124314 | 0.219378 | 0.277879 | 0.132541 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003968 | 0.189711 | 1,555 | 53 | 67 | 29.339623 | 0.864286 | 0.043087 | 0 | 0 | 0 | 0 | 0.005387 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.022727 | false | 0 | 0.386364 | 0 | 0.431818 | 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 |
005d84b448dc2d20c33cf19a69e09e31e85f9304 | 390 | py | Python | Tareas/ejercicio6.py | pelahumi/calentamiento | a7d602bde16bec4952fd6ea5b346cd0e2feb5a2c | [
"Apache-2.0"
] | null | null | null | Tareas/ejercicio6.py | pelahumi/calentamiento | a7d602bde16bec4952fd6ea5b346cd0e2feb5a2c | [
"Apache-2.0"
] | null | null | null | Tareas/ejercicio6.py | pelahumi/calentamiento | a7d602bde16bec4952fd6ea5b346cd0e2feb5a2c | [
"Apache-2.0"
] | null | null | null | customer_basket_cost = 34
customer_basket_weight = 44
shipping_cost = customer_basket_weight * 1.2
#Write if statement here to calculate the total cost
if customer_basket_weight >= 100:
coste_cesta = customer_basket_cost
print("Total: " + str(coste_cesta) + " euros")
else:
coste_cesta = customer_basket_cost + shipping_cost
print("Total: " + str(coste_cesta) + " euros")
| 30 | 54 | 0.74359 | 54 | 390 | 5.037037 | 0.444444 | 0.308824 | 0.198529 | 0.176471 | 0.426471 | 0.235294 | 0.235294 | 0 | 0 | 0 | 0 | 0.027692 | 0.166667 | 390 | 12 | 55 | 32.5 | 0.809231 | 0.130769 | 0 | 0.222222 | 0 | 0 | 0.076923 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.222222 | 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 |
0060a683e371d4d3d2b26cda9fedee13a7812be9 | 4,116 | py | Python | exercises/en/test_04_14.py | UBC-MDS/exploratory-data-viz | 83b704ce10d1ff5e10bfd4cdfa872ac52993fd54 | [
"CC-BY-4.0"
] | null | null | null | exercises/en/test_04_14.py | UBC-MDS/exploratory-data-viz | 83b704ce10d1ff5e10bfd4cdfa872ac52993fd54 | [
"CC-BY-4.0"
] | 88 | 2020-12-04T06:56:51.000Z | 2021-05-10T22:02:45.000Z | exercises/en/test_04_14.py | UBC-MDS/exploratory-data-viz | 83b704ce10d1ff5e10bfd4cdfa872ac52993fd54 | [
"CC-BY-4.0"
] | 4 | 2021-01-13T09:30:57.000Z | 2021-08-03T20:49:31.000Z | def test():
# Here we can either check objects created in the solution code, or the
# string value of the solution, available as __solution__. A helper for
# printing formatted messages is available as __msg__. See the testTemplate
# in the meta.json for details.
# If an assertion fails, the message will be displayed
assert not cat_cols is None, "Your answer for cat_cols does not exist. Have you assigned the list of labels for categorical columns to the correct variable name?"
assert type(cat_cols) == list, "cat_cols does not appear to be of type list. Can you store all the labels of the categorical columns into a list called cat_cols?"
assert set(cat_cols) == set(['species', 'island', 'sex']), "Make sure you only include the categorical columns in cat_cols. Hint: there are 3 categorical columns in the dataframe."
assert cat_cols == ['species', 'island', 'sex'], "You're close. Please make sure that the categorical columns are ordered in the same order they appear in the dataframe."
assert not categorical_plots is None, "Your answer for categorical_plots does not exist. Have you assigned the chart object to the correct variable name?"
assert type(categorical_plots) == alt.vegalite.v4.api.RepeatChart, "Your answer is not an Altair RepeatChart object. Check to make sure that you have assigned an alt.Chart object to categorical_plots and that you are repeating by columns in cat_cols."
assert categorical_plots.spec.mark == 'circle', "Make sure you are using the 'mark_circle' to generate the plots."
assert (
([categorical_plots.spec.encoding.x.shorthand,
categorical_plots.spec.encoding.y.shorthand] ==
[alt.RepeatRef(repeat = 'row'),
alt.RepeatRef(repeat = 'column')]) or
([categorical_plots.spec.encoding.x.shorthand,
categorical_plots.spec.encoding.y.shorthand] ==
[alt.RepeatRef(repeat = 'column'),
alt.RepeatRef(repeat = 'row')])
), "Make sure you specify that the chart set-up is repeated for different rows & columns as the x-axis and y-axis encodings. Hint: use alt.repeat() with row and column arguments."
assert categorical_plots.spec.encoding.x.type == "nominal", "Make sure you let Altair know that alt.repeat() on the x-axis encoding is a nominal type. Altair can't infer the type since alt.repeat() is not a column in the dataframe."
assert categorical_plots.spec.encoding.y.type == "nominal", "Make sure you let Altair know that alt.repeat() on the y-axis encoding is a nominal type. Altair can't infer the type since alt.repeat() is not a column in the dataframe."
assert categorical_plots.spec.encoding.color != alt.utils.schemapi.Undefined and (
categorical_plots.spec.encoding.color.field in {'count()', 'count():quantitative', 'count():Q'} or
categorical_plots.spec.encoding.color.shorthand in {'count()', 'count():quantitative', 'count():Q'}
), "Make sure you are using 'count()' as the color encoding."
assert categorical_plots.spec.encoding.color.title is None, "Make sure you specify that no title should be assigned for color encoding. Hint: use None"
assert categorical_plots.spec.encoding.size != alt.utils.schemapi.Undefined and (
categorical_plots.spec.encoding.size.field in {'count()', 'count():quantitative', 'count():Q'} or
categorical_plots.spec.encoding.size.shorthand in {'count()', 'count():quantitative', 'count():Q'}
), "Make sure you are using 'count()' as the size encoding."
assert categorical_plots.spec.encoding.size.title is None, "Make sure you specify that no title should be assigned for size encoding. Hint: use None"
assert categorical_plots.resolve != alt.utils.schemapi.Undefined and categorical_plots.resolve.scale != alt.utils.schemapi.Undefined and (
categorical_plots.resolve.scale.color == "independent" and
categorical_plots.resolve.scale.size == "independent"
), "Make sure to give the size and colour channels independent scales. Hint: use resolve_scale"
__msg__.good("You're correct, well done!")
| 85.75 | 255 | 0.727162 | 604 | 4,116 | 4.879139 | 0.25 | 0.124873 | 0.101798 | 0.133017 | 0.557177 | 0.512725 | 0.460129 | 0.38887 | 0.38887 | 0.312861 | 0 | 0.000589 | 0.175413 | 4,116 | 47 | 256 | 87.574468 | 0.867708 | 0.071914 | 0 | 0.114286 | 0 | 0.228571 | 0.52753 | 0 | 0 | 0 | 0 | 0 | 0.428571 | 1 | 0.028571 | true | 0 | 0 | 0 | 0.028571 | 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 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
00ae68c9f2bfdbcaee551271e69e33514b4b1a9b | 257 | py | Python | src/infrastructure/Normalizer.py | opengeekv2/python-app-exercise | ff3c7e3bac33e1426ab845b08f259b4812230fb3 | [
"MIT"
] | null | null | null | src/infrastructure/Normalizer.py | opengeekv2/python-app-exercise | ff3c7e3bac33e1426ab845b08f259b4812230fb3 | [
"MIT"
] | null | null | null | src/infrastructure/Normalizer.py | opengeekv2/python-app-exercise | ff3c7e3bac33e1426ab845b08f259b4812230fb3 | [
"MIT"
] | null | null | null | from abc import ABC, abstractmethod
from src.model.todo import ToDo
class Normalizer(ABC):
@abstractmethod
def denormalize(self, todo_dict: dict) -> ToDo:
pass
@abstractmethod
def normalize(self, todo: ToDo) -> dict:
pass
| 19.769231 | 51 | 0.673152 | 31 | 257 | 5.548387 | 0.483871 | 0.197674 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.241245 | 257 | 12 | 52 | 21.416667 | 0.882051 | 0 | 0 | 0.444444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0.222222 | 0.222222 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
00ec2e36fc385d6afb06d81a999512c6ac61806c | 1,004 | py | Python | pollumeter/pollumeterbeta/migrations/0007_auto_20200315_0406.py | dhruvildave/pollumeter | 3eb6eceae4a8a9bb3fb95e2e3b0385f8472c4a65 | [
"BSD-3-Clause"
] | null | null | null | pollumeter/pollumeterbeta/migrations/0007_auto_20200315_0406.py | dhruvildave/pollumeter | 3eb6eceae4a8a9bb3fb95e2e3b0385f8472c4a65 | [
"BSD-3-Clause"
] | 3 | 2021-03-11T01:34:50.000Z | 2022-02-27T08:15:58.000Z | pollumeter/pollumeterbeta/migrations/0007_auto_20200315_0406.py | dhruvildave/pollumeter | 3eb6eceae4a8a9bb3fb95e2e3b0385f8472c4a65 | [
"BSD-3-Clause"
] | 1 | 2020-03-21T12:37:56.000Z | 2020-03-21T12:37:56.000Z | # Generated by Django 3.0.4 on 2020-03-15 04:06
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('pollumeterbeta', '0006_auto_20200314_2046'),
]
operations = [
migrations.RenameField(
model_name='pollimetermodel',
old_name='fac_avg_speed',
new_name='indpro',
),
migrations.RenameField(
model_name='pollimetermodel',
old_name='fac_indfert',
new_name='traf',
),
migrations.RemoveField(
model_name='pollimetermodel',
name='fac_indfood',
),
migrations.RemoveField(
model_name='pollimetermodel',
name='fac_indman',
),
migrations.RemoveField(
model_name='pollimetermodel',
name='fac_indpharm',
),
migrations.RemoveField(
model_name='pollimetermodel',
name='fac_indtech',
),
]
| 25.1 | 54 | 0.553785 | 85 | 1,004 | 6.305882 | 0.494118 | 0.100746 | 0.268657 | 0.223881 | 0.593284 | 0.593284 | 0.593284 | 0.205224 | 0 | 0 | 0 | 0.046899 | 0.341633 | 1,004 | 39 | 55 | 25.74359 | 0.763994 | 0.044821 | 0 | 0.545455 | 1 | 0 | 0.214211 | 0.024033 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.030303 | 0 | 0.121212 | 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 |
dab3920e5559ac421906e2cb20424748b9c076f6 | 265 | py | Python | budgetApp/admin.py | tamihaimov/PyBudget | 74bff7d3639cd4badccba377db08a6a8fc5d8d9f | [
"Apache-2.0"
] | null | null | null | budgetApp/admin.py | tamihaimov/PyBudget | 74bff7d3639cd4badccba377db08a6a8fc5d8d9f | [
"Apache-2.0"
] | null | null | null | budgetApp/admin.py | tamihaimov/PyBudget | 74bff7d3639cd4badccba377db08a6a8fc5d8d9f | [
"Apache-2.0"
] | null | null | null | from django.contrib import admin
from .models import *
admin.site.register(BudgetAccount)
admin.site.register(UserBudget)
admin.site.register(Envelope)
admin.site.register(Transaction)
admin.site.register(ScheduledTransaction)
admin.site.register(SavingsHistory)
| 24.090909 | 41 | 0.837736 | 32 | 265 | 6.9375 | 0.4375 | 0.243243 | 0.459459 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.060377 | 265 | 10 | 42 | 26.5 | 0.891566 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dac3e2d25d4d6b194fa204aeda3656557464c505 | 1,085 | py | Python | authentication/adapter.py | rafalbielech/Django-Home-application | cff6429e33a91336cb377fe01e86ff274ca56f43 | [
"MIT"
] | null | null | null | authentication/adapter.py | rafalbielech/Django-Home-application | cff6429e33a91336cb377fe01e86ff274ca56f43 | [
"MIT"
] | null | null | null | authentication/adapter.py | rafalbielech/Django-Home-application | cff6429e33a91336cb377fe01e86ff274ca56f43 | [
"MIT"
] | null | null | null | from allauth.account.adapter import DefaultAccountAdapter
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from allauth.exceptions import ImmediateHttpResponse
from django.shortcuts import render, redirect
from django.contrib.auth import get_user_model
from django.conf import settings
User = get_user_model()
class MySocialAccount(DefaultSocialAccountAdapter):
def pre_social_login(self, request, sociallogin):
user = sociallogin.user.email
if user in settings.CONFIG.get("config", {}).get("email_login_allow_list", []):
pass
else:
raise ImmediateHttpResponse(render(request, "error/page-403.html", {"email": user}))
class NoNewUsersAccountAdapter(DefaultAccountAdapter):
def is_open_for_signup(self, request):
"""
Checks whether or not the site is open for signups.
Next to simply returning True/False you can also intervene the
regular flow by raising an ImmediateHttpResponse
(Comment reproduced from the overridden method.)
"""
return True
| 35 | 96 | 0.735484 | 123 | 1,085 | 6.390244 | 0.609756 | 0.041985 | 0.030534 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003429 | 0.193548 | 1,085 | 30 | 97 | 36.166667 | 0.894857 | 0.197235 | 0 | 0 | 0 | 0 | 0.063183 | 0.026731 | 0 | 0 | 0 | 0 | 0 | 1 | 0.117647 | false | 0.058824 | 0.352941 | 0 | 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 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
dac818113dffbfb4510abb19e6f78220c29dc8cc | 2,021 | py | Python | app/models.py | neerajkarlus/vivahavedi | d03dc2a42401e866a747440a173ddd5008621f1f | [
"MIT"
] | null | null | null | app/models.py | neerajkarlus/vivahavedi | d03dc2a42401e866a747440a173ddd5008621f1f | [
"MIT"
] | null | null | null | app/models.py | neerajkarlus/vivahavedi | d03dc2a42401e866a747440a173ddd5008621f1f | [
"MIT"
] | null | null | null | from django.db import models
from datetime import datetime, date
community_choice = (
('Syro-Malabar','SYRO-MALABAR'),
('Latin', 'LATIN'),
('Malankara','MALANKARA'),
)
fam_choice = (
('Low','LOW'),
('Middle', 'MIDDLE'),
('Upper Middle','UPPER MIDDLE'),
('Rich','RICH'),
)
# Create your models here.
class Profile(models.Model):
Name = models.CharField(max_length=50, blank=True, null=True)
Address = models.CharField(max_length=200, blank=True, null=True)
Age = models.CharField(max_length=5, blank=True, null=True)
Sex = models.CharField(max_length=10, blank=True, null=True)
Education = models.CharField(max_length=100, blank=True, null=True)
Occupation = models.CharField(max_length=100, blank=True, null=True)
Height = models.CharField(max_length=5, blank=True, null=True)
Weight = models.CharField(max_length=5, blank=True, null=True)
email = models.EmailField(max_length=255, blank=True, null=True)
Mobile_no = models.CharField(max_length=15, blank=True, null=True)
Diocese = models.CharField(max_length=200, blank=True, null=True)
Parish = models.CharField(max_length=200, blank=True, null=True)
Community = models.CharField(max_length=50, choices=community_choice, default=community_choice[0][0])
Town = models.CharField(max_length=50, blank=True, null=True)
Family_Status = models.CharField(max_length=50, choices=fam_choice, default=fam_choice[0][0])
Name_of_the_Parent = models.CharField(max_length=50, blank=True, null=True)
Parent_mobile = models.CharField(max_length=15, blank=True, null=True)
Partners_Requirements = models.CharField(max_length=500, blank=True, null=True)
Contact_address = models.CharField(max_length=200, blank=True, null=True)
Office_use = models.CharField(max_length=200, blank=True, null=True)
Place = models.CharField(max_length=15, blank=True, null=True)
date = models.DateField(default=datetime.now(), blank=True)
def __str__(self):
return self.Name | 49.292683 | 105 | 0.72192 | 281 | 2,021 | 5.049822 | 0.259786 | 0.133192 | 0.2537 | 0.338266 | 0.544045 | 0.544045 | 0.497533 | 0.497533 | 0.497533 | 0.071882 | 0 | 0.029851 | 0.13805 | 2,021 | 41 | 106 | 49.292683 | 0.78473 | 0.011875 | 0 | 0 | 0 | 0 | 0.051102 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.026316 | false | 0 | 0.052632 | 0.026316 | 0.710526 | 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 |
dafce8d3d68a3e53073372bb37929c6868959e52 | 917 | py | Python | explainaboard/processors/processor_registry.py | hwidjaja/ExplainaBoard | 0e670ad2df9326eb6b4ad99ba435fd7b6806557a | [
"MIT"
] | null | null | null | explainaboard/processors/processor_registry.py | hwidjaja/ExplainaBoard | 0e670ad2df9326eb6b4ad99ba435fd7b6806557a | [
"MIT"
] | null | null | null | explainaboard/processors/processor_registry.py | hwidjaja/ExplainaBoard | 0e670ad2df9326eb6b4ad99ba435fd7b6806557a | [
"MIT"
] | null | null | null | from __future__ import annotations
from explainaboard import TaskType
from explainaboard.metric import MetricConfig
from explainaboard.processors.processor import Processor
_processor_registry: dict = {}
def get_processor(task: TaskType | str) -> Processor:
"""
return a processor based on the task type
TODO: error handling
"""
task_cast: TaskType = TaskType(task)
return _processor_registry[task_cast]()
def register_processor(task_type: TaskType):
"""
a register for task specific processors.
example usage: `@register_processor(TaskType.text_classification)`
"""
def register_processor_fn(cls):
_processor_registry[task_type] = cls
return cls
return register_processor_fn
def get_metric_list_for_processor(task: TaskType) -> list[MetricConfig]:
processor_class = _processor_registry[task]
return processor_class.full_metric_list()
| 26.2 | 72 | 0.751363 | 106 | 917 | 6.198113 | 0.358491 | 0.103501 | 0.09589 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.175573 | 917 | 34 | 73 | 26.970588 | 0.869048 | 0.185387 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029412 | 0 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
971b9130c3bc632578e5d3b88f474633cd55e34f | 163 | py | Python | src/simple-neopixel.py | athenian-programming/cpx-tutorial | 77fcc45a5515b985751dd62c94c44431b6787ac5 | [
"Apache-2.0"
] | null | null | null | src/simple-neopixel.py | athenian-programming/cpx-tutorial | 77fcc45a5515b985751dd62c94c44431b6787ac5 | [
"Apache-2.0"
] | null | null | null | src/simple-neopixel.py | athenian-programming/cpx-tutorial | 77fcc45a5515b985751dd62c94c44431b6787ac5 | [
"Apache-2.0"
] | null | null | null | import neopixel
import board
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness = .01)
while True:
for i in range(10):
pixels[i] = (0, 0, 255)
| 20.375 | 64 | 0.662577 | 24 | 163 | 4.5 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.085938 | 0.214724 | 163 | 7 | 65 | 23.285714 | 0.757813 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 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 |
97223422b39632579e93aa67c24a6a8bc25fe67b | 6,134 | py | Python | annofabapi/dataclass/statistics.py | kurusugawa-computer/annofab-api-python-client | 9920e0745f1ee8ea79c26e26a61013b415351982 | [
"MIT"
] | 17 | 2019-05-04T04:24:28.000Z | 2021-12-14T02:43:24.000Z | annofabapi/dataclass/statistics.py | kurusugawa-computer/annofab-api-python-client | 9920e0745f1ee8ea79c26e26a61013b415351982 | [
"MIT"
] | 214 | 2019-05-13T01:07:28.000Z | 2022-03-28T20:02:34.000Z | annofabapi/dataclass/statistics.py | kurusugawa-computer/annofab-api-python-client | 9920e0745f1ee8ea79c26e26a61013b415351982 | [
"MIT"
] | 2 | 2019-06-15T05:01:50.000Z | 2019-07-04T02:29:55.000Z | # flake8: noqa: W291
# pylint: disable=too-many-lines,trailing-whitespace
"""
annofabapiのmodelをDataClassで定義したクラス
Note:
このファイルはopenapi-generatorで自動生成される。詳細は generate/README.mdを参照.
oneOf, allOfなどは正しく表現できない可能性がある。
"""
import warnings # pylint: disable=unused-import
from dataclasses import dataclass
from typing import Any, Dict, List, NewType, Optional, Tuple, Union # pylint: disable=unused-import
from dataclasses_json import DataClassJsonMixin
from annofabapi.models import GraphType, TaskPhase, TaskStatus
@dataclass
class ProjectTaskStatistics(DataClassJsonMixin):
""" """
phase: TaskPhase
""""""
status: TaskStatus
""""""
count: int
"""タスク数"""
work_timespan: int
"""累計実作業時間(ミリ秒)"""
@dataclass
class ProjectTaskStatisticsHistory(DataClassJsonMixin):
""" """
date: Optional[str]
""""""
tasks: Optional[List[ProjectTaskStatistics]]
""""""
@dataclass
class ProjectAccountStatisticsHistory(DataClassJsonMixin):
""" """
date: str
""""""
tasks_completed: int
"""教師付フェーズのタスクを提出した回数、または検査/受入フェーズのタスクを合格/差戻にした回数。 たとえば、あるタスクのタスク履歴が下表の状態だった場合、2020-04-01の`tasks_completed`は以下の通りになります。 * Alice: 1 * Bob: 1 * Chris: 2 <table> <tr> <th>担当者</th> <th>フェーズ</th> <th>作業内容</th> <th>完了日時</th> </tr> <tr> <td>Alice</td> <td>教師付</td> <td>提出する</td> <td>2020-04-01 09:00</td> </tr> <tr> <td>Chris</td> <td>受入</td> <td>差し戻す</td> <td>2020-04-01 10:00</td> </tr> <tr> <td>Bob</td> <td>教師付</td> <td>提出する</td> <td>2020-04-01 11:00</td> </tr> <tr> <td>Chris</td> <td>受入</td> <td>合格にする</td> <td>2020-04-01 12:00</td> </tr> </table> """
tasks_rejected: int
"""教師付フェーズを担当したタスクが差し戻された回数、または受入フェーズを担当したタスクが受入完了を取り消された回数。 たとえば、あるタスクのタスク履歴が下表の状態だった場合、2020-04-01の`tasks_rejected`は以下の通りになります。 * Alice: 1 * Bob: 1 * Chris: 1 <table> <tr> <th>担当者</th> <th>フェーズ</th> <th>作業内容</th> <th>完了日時</th> </tr> <tr> <td>Alice</td> <td>教師付</td> <td>提出する</td> <td>2020-04-01 09:00</td> </tr> <tr> <td>Chris</td> <td>受入</td> <td>差し戻す</td> <td>2020-04-01 10:00</td> </tr> <tr> <td>Bob</td> <td>教師付</td> <td>提出する</td> <td>2020-04-01 11:00</td> </tr> <tr> <td>Chris</td> <td>受入</td> <td>差し戻す</td> <td>2020-04-01 12:00</td> </tr> <tr> <td>Bob</td> <td>教師付</td> <td>提出する</td> <td>2020-04-01 13:00</td> </tr> <tr> <td>Chris</td> <td>受入</td> <td>合格にする</td> <td>2020-04-01 14:00</td> </tr> <tr> <td>Dave</td> <td>受入</td> <td>受入完了状態を取り消して、再度合格にする</td> <td>2020-04-01 15:00</td> </tr> </table> """
worktime: str
"""作業時間(ISO 8601 duration)"""
@dataclass
class ProjectAccountStatistics(DataClassJsonMixin):
""" """
account_id: str
""""""
histories: List[ProjectAccountStatisticsHistory]
""""""
@dataclass
class InspectionStatisticsPhrases(DataClassJsonMixin):
"""
ラベル外指摘の集計結果
"""
phrases: Dict[str, int]
"""定型指摘ごとの合計数。キーは定型指摘ID、値は指摘数"""
no_phrase: int
"""非定型指摘の合計数"""
@dataclass
class InspectionStatisticsBreakdown(DataClassJsonMixin):
"""
検査コメント数の集計結果
"""
labels: Dict[str, InspectionStatisticsPhrases]
"""ラベルごとの指摘集計結果。キーは`label_id`"""
no_label: InspectionStatisticsPhrases
""""""
@dataclass
class InspectionStatistics(DataClassJsonMixin):
""" """
project_id: str
"""プロジェクトID。[値の制約についてはこちら。](#section/API-Convention/APIID) """
date: str
"""集計日"""
breakdown: InspectionStatisticsBreakdown
""""""
@dataclass
class PhaseStatistics(DataClassJsonMixin):
""" """
phase: TaskPhase
""""""
worktime: str
"""累積作業時間(ISO 8601 duration)"""
@dataclass
class TaskPhaseStatistics(DataClassJsonMixin):
""" """
project_id: str
"""プロジェクトID。[値の制約についてはこちら。](#section/API-Convention/APIID) """
date: str
""""""
phases: List[PhaseStatistics]
"""タスクのフェーズごとの集計結果"""
@dataclass
class LabelStatistics(DataClassJsonMixin):
""" """
label_id: str
""""""
completed: int
"""ラベルごとの受入が完了したアノテーション数"""
wip: int
"""ラベルごとの受入が完了していないアノテーション数"""
@dataclass
class HistogramItem(DataClassJsonMixin):
""" """
begin: float
""""""
end: float
""""""
count: int
""""""
@dataclass
class WorktimeStatisticsItem(DataClassJsonMixin):
""" """
phase: TaskPhase
""""""
histogram: List[HistogramItem]
""""""
average: str
"""作業時間の平均(ISO 8601 duration)"""
standard_deviation: str
"""作業時間の標準偏差(ISO 8601 duration)"""
@dataclass
class AccountWorktimeStatistics(DataClassJsonMixin):
""" """
account_id: str
""""""
by_tasks: List[WorktimeStatisticsItem]
"""ユーザごとのタスク1個当たりの作業時間情報(動画プロジェクトの場合は空リスト)"""
by_inputs: List[WorktimeStatisticsItem]
"""ユーザごとの画像1個当たりの作業時間情報(動画プロジェクトの場合は空リスト)"""
by_minutes: List[WorktimeStatisticsItem]
"""ユーザごとの動画1分当たりの作業時間情報(画像プロジェクトの場合は空リスト)"""
@dataclass
class WorktimeStatistics(DataClassJsonMixin):
""" """
project_id: str
"""プロジェクトID。[値の制約についてはこちら。](#section/API-Convention/APIID) """
date: str
""""""
by_tasks: List[WorktimeStatisticsItem]
"""タスク1個当たりの作業時間情報(動画プロジェクトの場合は空リスト)"""
by_inputs: List[WorktimeStatisticsItem]
"""画像1個当たりの作業時間情報(動画プロジェクトの場合は空リスト)"""
by_minutes: List[WorktimeStatisticsItem]
"""動画1分当たりの作業時間情報(画像プロジェクトの場合は空リスト)"""
accounts: List[AccountWorktimeStatistics]
"""ユーザごとの作業時間情報"""
@dataclass
class Marker(DataClassJsonMixin):
""" """
marker_id: Optional[str]
"""マーカーID。[値の制約についてはこちら。](#section/API-Convention/APIID) """
title: Optional[str]
""""""
graph_type: Optional[GraphType]
""""""
marked_at: Optional[str]
"""グラフ上のマーカー位置(x軸)"""
@dataclass
class Markers(DataClassJsonMixin):
""" """
project_id: Optional[str]
"""プロジェクトID。[値の制約についてはこちら。](#section/API-Convention/APIID) """
markers: Optional[List[Marker]]
""""""
updated_datetime: Optional[str]
""""""
| 23.960938 | 975 | 0.616563 | 613 | 6,134 | 6.125612 | 0.2969 | 0.035153 | 0.017577 | 0.029294 | 0.381891 | 0.268176 | 0.211718 | 0.198935 | 0.198935 | 0.196272 | 0 | 0.036976 | 0.206391 | 6,134 | 255 | 976 | 24.054902 | 0.734388 | 0.048419 | 0 | 0.431818 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.056818 | 0 | 0.818182 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
97244854ecd6458b86c3953bfae23adb50bed79c | 183 | py | Python | Python3/Django/HelloREST/api/views/index.py | youngqqcn/QBlockChainNotes | 85122049024dc5555705bf016312491a51966621 | [
"MIT"
] | 24 | 2018-11-01T03:36:43.000Z | 2022-03-28T08:20:30.000Z | Python3/Django/HelloREST/api/views/index.py | songning4/QBlockChainNotes | d65ede073f5a20f728f41cc6850409693820cdb1 | [
"MIT"
] | 57 | 2019-12-04T08:26:47.000Z | 2022-03-08T07:35:15.000Z | Python3/Django/HelloREST/api/views/index.py | youngqqcn/QBlockChainNotes | 85122049024dc5555705bf016312491a51966621 | [
"MIT"
] | 11 | 2019-01-04T08:41:57.000Z | 2022-03-16T03:51:36.000Z | # from django.http import JsonResponse
#
#
# def index(request):
#
# data = {
# 'status' : 200,
# 'msg' : 'success'
# }
# return JsonResponse(data = data) | 18.3 | 39 | 0.52459 | 17 | 183 | 5.647059 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024 | 0.31694 | 183 | 10 | 39 | 18.3 | 0.744 | 0.89071 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
972dda367cf2b498bee7e3f4a4221245b97de169 | 850 | py | Python | pyspark_utilities/pandas_udfs/__init__.py | zaksamalik/pyspark-utilities | da9f843bdf03658d58d1dbc8d5f3067bd6702494 | [
"MIT"
] | 9 | 2020-03-10T10:31:06.000Z | 2021-12-03T03:43:00.000Z | pyspark_utilities/pandas_udfs/__init__.py | zaksamalik/pyspark-utilities | da9f843bdf03658d58d1dbc8d5f3067bd6702494 | [
"MIT"
] | null | null | null | pyspark_utilities/pandas_udfs/__init__.py | zaksamalik/pyspark-utilities | da9f843bdf03658d58d1dbc8d5f3067bd6702494 | [
"MIT"
] | 2 | 2020-11-14T15:13:43.000Z | 2021-12-22T11:33:03.000Z | from .datetime_udfs import (pd_is_holiday_usa, pd_normalize_date_md, pd_normalize_date_dm, pd_normalize_timestamp_md,
pd_normalize_timestamp_dm)
from .fuzzy_match_udfs import (pd_fuzz_ratio, pd_fuzz_partial_ratio, pd_fuzz_token_set_ratio,
pd_fuzz_partial_token_set_ratio, pd_fuzz_token_sort_ratio,
pd_fuzz_partial_token_sort_ratio, pd_damerau_levenshtein_distance, pd_hamming_distance,
pd_jaro_distance, pd_jaro_winkler, pd_match_rating_codex, pd_match_rating_comparison,
pd_metaphone, pd_nysiis, pd_porter_stem)
from .general_udfs import (pd_clean_string, pd_empty_string_to_null, pd_map_booleans_ynu, pd_generate_uuid,
pd_string_to_double_pfd, pd_string_to_double_cfd)
| 85 | 118 | 0.710588 | 115 | 850 | 4.556522 | 0.417391 | 0.068702 | 0.104962 | 0.103053 | 0.129771 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.251765 | 850 | 9 | 119 | 94.444444 | 0.823899 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
9744f6938e8dc6b98759591eb4f76928f2aa13fc | 70 | py | Python | favs/items.py | stleon/habr_favs | 7a654c0e9ff48bbc62b7e5a8df3d699184d50cdb | [
"MIT"
] | 3 | 2016-11-29T14:10:24.000Z | 2021-11-12T11:42:16.000Z | favs/items.py | stleon/habr_favs | 7a654c0e9ff48bbc62b7e5a8df3d699184d50cdb | [
"MIT"
] | 5 | 2021-05-24T16:56:30.000Z | 2022-03-11T23:14:36.000Z | favs/items.py | stleon/habr_favs | 7a654c0e9ff48bbc62b7e5a8df3d699184d50cdb | [
"MIT"
] | null | null | null | import scrapy
class TagItem(scrapy.Item):
name = scrapy.Field()
| 11.666667 | 27 | 0.7 | 9 | 70 | 5.444444 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.185714 | 70 | 5 | 28 | 14 | 0.859649 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
97716a72ce75d3ffc6f652fbd2a1412fe792525b | 417 | py | Python | classes/restaurant_foods.py | itucsdb1708/itucsdb15 | bdb6ce1f0507318d7c007801a5e538cb315b3afa | [
"BSD-3-Clause"
] | 4 | 2017-10-11T09:47:03.000Z | 2018-08-09T06:45:55.000Z | classes/restaurant_foods.py | itucsdb1708/itucsdb15 | bdb6ce1f0507318d7c007801a5e538cb315b3afa | [
"BSD-3-Clause"
] | 25 | 2017-10-04T09:51:26.000Z | 2017-12-21T20:12:11.000Z | classes/restaurant_foods.py | itucsdb1708/itucsdb15 | bdb6ce1f0507318d7c007801a5e538cb315b3afa | [
"BSD-3-Clause"
] | 2 | 2018-12-24T19:30:03.000Z | 2019-12-18T12:50:54.000Z | #from server import app
import psycopg2 as dbapi2
from flask import current_app
from flask_login import UserMixin
from passlib.apps import custom_app_context as pwd_context
#from passlib.ext.django.models import password_context
class RestaurantFoods():
def __init__(self, primaryId, restaurantId, foodId):
self.primaryId = primaryId
self.restaurantId = restaurantId
self.foodId = foodId
| 32.076923 | 58 | 0.779376 | 53 | 417 | 5.943396 | 0.528302 | 0.057143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00578 | 0.170264 | 417 | 12 | 59 | 34.75 | 0.904624 | 0.182254 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0.111111 | 0.444444 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
979990280ecae2f40cb84e9c59c182138ed50b3d | 221 | py | Python | classical_method/common.py | MihawkHu/Reading_Comprehension | ee2d1ccb8dc1adcbff7e1980be1742babaf07056 | [
"MIT"
] | 1 | 2017-06-28T12:37:22.000Z | 2017-06-28T12:37:22.000Z | classical_method/common.py | MihawkHu/Reading_Comprehension | ee2d1ccb8dc1adcbff7e1980be1742babaf07056 | [
"MIT"
] | null | null | null | classical_method/common.py | MihawkHu/Reading_Comprehension | ee2d1ccb8dc1adcbff7e1980be1742babaf07056 | [
"MIT"
] | null | null | null | import os
import numpy as np
import numpy.linalg as npla
import numpy.random as npr
import theano
import theano.tensor as T
if theano.config.floatX == 'float32':
FX = np.float32
else:
FX = np.float64
floatX = FX
| 17 | 37 | 0.733032 | 37 | 221 | 4.378378 | 0.513514 | 0.203704 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033708 | 0.19457 | 221 | 12 | 38 | 18.416667 | 0.876404 | 0 | 0 | 0 | 0 | 0 | 0.031674 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.545455 | 0 | 0.545455 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
97a9d3ac933d1af9b4c44d22421592f9814cdc0f | 3,282 | py | Python | tests/test_serialization.py | Apkawa/django-snapshot-field | 431055e7c78bbb40e54de54ceb2005f8ce618e31 | [
"MIT"
] | null | null | null | tests/test_serialization.py | Apkawa/django-snapshot-field | 431055e7c78bbb40e54de54ceb2005f8ce618e31 | [
"MIT"
] | 1 | 2019-12-16T10:33:47.000Z | 2019-12-16T10:33:47.000Z | tests/test_serialization.py | Apkawa/django-snapshot-field | 431055e7c78bbb40e54de54ceb2005f8ce618e31 | [
"MIT"
] | null | null | null | import json
from snapshot_field.utils import (
serialize_object,
deserialize_object,
serialize_object_json,
deserialize_object_json,
)
from tests.models import Example, ExampleReference
def test_simple_serialize_and_deserialization():
obj = Example.objects.create(name="test_name")
result = serialize_object(obj)
obj_snapshot = deserialize_object(result)
assert obj.id == obj_snapshot.id
assert obj.name == obj_snapshot.name
def test_simple_serialize_and_deserialize_refs():
obj = Example.objects.create(name="test_name")
obj_ref = ExampleReference.objects.create(name="refname", ref=obj)
result = serialize_object(obj_ref, refs=["ref"])
obj_snapshot = deserialize_object(result)
assert obj_ref.id == obj_snapshot.id
assert obj_ref.name == obj_snapshot.name
assert obj_ref.ref.name == obj.name
def test_json_serialize_deserialize():
obj = Example.objects.create(name="test_name")
obj_ref = ExampleReference.objects.create(name="refname", ref=obj)
result = serialize_object_json(obj_ref, refs=["ref"])
obj_snapshot = deserialize_object_json(result)
assert obj_ref.id == obj_snapshot.id
assert obj_ref.name == obj_snapshot.name
assert obj_ref.ref.name == obj.name
def test_json_serialize_deserialize_deleted_obj():
obj = Example.objects.create(name="test_name")
obj_ref = ExampleReference.objects.create(name="refname", ref=obj)
result = serialize_object_json(obj_ref, refs=["ref"])
expect_data = {
"model": "tests.examplereference",
"pk": obj_ref.id,
"fields": {"name": "refname", "long_name": "", "ref": obj.id},
"refs": {
"ref": {
"model": "tests.example",
"pk": obj.id,
"fields": {"name": "test_name"},
"refs": {},
}
},
}
obj.delete()
obj_ref.delete()
assert json.loads(result) == expect_data
obj_snapshot = deserialize_object_json(result)
assert obj_ref.name == obj_snapshot.name
assert obj_ref.ref.name == obj.name
def test_json_serialize_deserialize_with_non_existed_fields():
obj = Example.objects.create(name="test_name")
obj_ref = ExampleReference.objects.create(name="refname", ref=obj)
result = serialize_object_json(obj_ref, refs=["ref"])
result_dict = json.loads(result)
# Unexisted fields and refs must be ignore
result_dict["fields"]["slug"] = "removed field"
result = json.dumps(result_dict)
obj_snapshot = deserialize_object_json(result)
assert obj_ref.id == obj_snapshot.id
assert obj_ref.name == obj_snapshot.name
assert obj_ref.ref.name == obj.name
def test_json_serialize_deserialize_with_new_fields():
obj = Example.objects.create(name="test_name")
obj_ref = ExampleReference.objects.create(name="refname", ref=obj)
result = serialize_object_json(obj_ref, refs=["ref"])
result_dict = json.loads(result)
# Maybe ref has been create after serialization
del result_dict["fields"]["long_name"]
result = json.dumps(result_dict)
obj_snapshot = deserialize_object_json(result)
assert obj_ref.id == obj_snapshot.id
assert obj_ref.name == obj_snapshot.name
assert obj_ref.ref.name == obj.name
| 31.864078 | 70 | 0.694394 | 426 | 3,282 | 5.075117 | 0.129108 | 0.072155 | 0.077706 | 0.06383 | 0.738205 | 0.715079 | 0.703978 | 0.6679 | 0.648936 | 0.63136 | 0 | 0 | 0.1883 | 3,282 | 102 | 71 | 32.176471 | 0.811562 | 0.026204 | 0 | 0.52 | 0 | 0 | 0.078296 | 0.00689 | 0 | 0 | 0 | 0 | 0.226667 | 1 | 0.08 | false | 0 | 0.04 | 0 | 0.12 | 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 |
97c87a8211abcddb935b031f41caca57c07df9b3 | 128 | py | Python | src/dlltracer/__init__.py | microsoft/dlltracer-python | 7abc673b153d68a0c83dd5e7f001a6db75a17329 | [
"MIT"
] | 8 | 2021-06-25T01:38:57.000Z | 2021-11-08T11:17:42.000Z | src/dlltracer/__init__.py | microsoft/dlltracer-python | 7abc673b153d68a0c83dd5e7f001a6db75a17329 | [
"MIT"
] | 1 | 2021-07-03T01:44:34.000Z | 2021-08-11T14:12:16.000Z | src/dlltracer/__init__.py | microsoft/dlltracer-python | 7abc673b153d68a0c83dd5e7f001a6db75a17329 | [
"MIT"
] | null | null | null | from ._native import Trace, LoadEvent, LoadFailedEvent, DebugEvent
__author__ = "Microsoft Corporation <python@microsoft.com>"
| 32 | 66 | 0.8125 | 13 | 128 | 7.615385 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101563 | 128 | 3 | 67 | 42.666667 | 0.86087 | 0 | 0 | 0 | 0 | 0 | 0.34375 | 0.171875 | 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 |
97cc90347db079a5d5efef5e0cc4c076ac2d766f | 2,162 | py | Python | tests/test_extension.py | faparicioaldo/Documentacion | 1bb71ed51abb1f26731ce2bd052dc59a5fe9cda8 | [
"MIT"
] | null | null | null | tests/test_extension.py | faparicioaldo/Documentacion | 1bb71ed51abb1f26731ce2bd052dc59a5fe9cda8 | [
"MIT"
] | null | null | null | tests/test_extension.py | faparicioaldo/Documentacion | 1bb71ed51abb1f26731ce2bd052dc59a5fe9cda8 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Test working of extension."""
import os
import pytest
from tests import TEST_DOCS_SRC
from sphinx_search.extension import ASSETS_FILES
@pytest.mark.sphinx(srcdir=TEST_DOCS_SRC)
def test_static_files_exists(app, status, warning):
"""Test if the static files are present in the _build folder."""
app.build()
path = app.outdir
static_files = ASSETS_FILES['minified'] + ASSETS_FILES['un-minified']
for file in static_files:
file_path = os.path.join(path, '_static', file)
assert (
os.path.exists(file_path)
), f'{file_path} should be present in the _build folder'
@pytest.mark.sphinx(
srcdir=TEST_DOCS_SRC,
confoverrides={
'rtd_sphinx_search_file_type': 'minified'
}
)
def test_minified_static_files_injected_in_html(selenium, app, status, warning):
"""Test if the static files are correctly injected in the html."""
app.build()
path = app.outdir / 'index.html'
selenium.get(f'file://{path}')
page_source = selenium.page_source
assert app.config.rtd_sphinx_search_file_type == 'minified'
file_type = app.config.rtd_sphinx_search_file_type
files = ASSETS_FILES[file_type]
for file in files:
file_name = file.split('/')[-1]
assert (
page_source.count(file_name) == 1
), f'{file} should be present in the page source'
@pytest.mark.sphinx(
srcdir=TEST_DOCS_SRC,
confoverrides={
'rtd_sphinx_search_file_type': 'un-minified'
}
)
def test_un_minified_static_files_injected_in_html(selenium, app, status, warning):
"""Test if the static files are correctly injected in the html."""
app.build()
path = app.outdir / 'index.html'
selenium.get(f'file://{path}')
page_source = selenium.page_source
assert app.config.rtd_sphinx_search_file_type == 'un-minified'
file_type = app.config.rtd_sphinx_search_file_type
files = ASSETS_FILES[file_type]
for file in files:
file_name = file.split('/')[-1]
assert (
page_source.count(file_name) == 1
), f'{file_name} should be present in the page source'
| 28.077922 | 83 | 0.678076 | 301 | 2,162 | 4.614618 | 0.199336 | 0.057595 | 0.064795 | 0.082073 | 0.782577 | 0.728582 | 0.722822 | 0.647228 | 0.647228 | 0.61915 | 0 | 0.002927 | 0.209991 | 2,162 | 76 | 84 | 28.447368 | 0.810304 | 0.106383 | 0 | 0.538462 | 0 | 0 | 0.160649 | 0.028257 | 0 | 0 | 0 | 0 | 0.096154 | 1 | 0.057692 | false | 0 | 0.076923 | 0 | 0.134615 | 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 |
8ae3ac44bf8ecb9d90c7115cf59bd53146941603 | 156 | py | Python | datasets/__init__.py | bomtorazek/LateTemporalModeling3DCNN | a385c0b7b58116e274bed8b0e5fe6ac978ccb61c | [
"MIT"
] | 3 | 2021-03-12T13:37:27.000Z | 2021-03-29T04:41:00.000Z | datasets/__init__.py | bomtorazek/LateTemporalModeling3DCNN | a385c0b7b58116e274bed8b0e5fe6ac978ccb61c | [
"MIT"
] | 3 | 2021-03-17T02:00:29.000Z | 2021-04-01T05:49:54.000Z | datasets/__init__.py | bomtorazek/LateTemporalModeling3DCNN | a385c0b7b58116e274bed8b0e5fe6ac978ccb61c | [
"MIT"
] | 1 | 2021-03-12T02:38:19.000Z | 2021-03-12T02:38:19.000Z | from .ucf101 import ucf101
from .hmdb51 import hmdb51
from .cvpr import cvpr
from .cvpr_le import cvpr_le
__all__ = ('ucf101','hmdb51', 'cvpr', 'cvpr_le')
| 22.285714 | 48 | 0.74359 | 24 | 156 | 4.541667 | 0.291667 | 0.165138 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.11194 | 0.141026 | 156 | 6 | 49 | 26 | 0.701493 | 0 | 0 | 0 | 0 | 0 | 0.147436 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8ae414268100887f044782416373ac9139c4c3ce | 3,519 | py | Python | tests/test_reporting.py | jleverenz/dupi | c2283f06fab173bce0c6186ca22dbd42973a2774 | [
"MIT"
] | null | null | null | tests/test_reporting.py | jleverenz/dupi | c2283f06fab173bce0c6186ca22dbd42973a2774 | [
"MIT"
] | null | null | null | tests/test_reporting.py | jleverenz/dupi | c2283f06fab173bce0c6186ca22dbd42973a2774 | [
"MIT"
] | null | null | null | from tests.common import * # dupi/tests/common
import io
import sys
from pyfakefs import fake_filesystem_unittest
from dupi import conf, core
from dupi.index import Index
# TODO order is not deterministic while based on os.walk
class TestReporting(fake_filesystem_unittest.TestCase):
# Override run() to wrap each test in a context redirecting stderr
def run(self, result=None):
err_out = io.StringIO()
with redirect_stderr(err_out):
super().run(result)
def setUp(self):
self.setUpPyfakefs()
# Touch the default index file location on fake filesystem,
# to be sure parent dir structure exists.
self.fs.CreateFile(conf.index_file, create_missing_dirs=True)
# Setup index
self.index = Index(conf.index_file)
def test_list_empty(self):
core.update_index(self.index, ['/test'])
results = core.list_duplicates(self.index)
self.assertEqual(0, len(list(results)))
def test_list_no_duplicates(self):
self.fs.CreateFile('/test/file1', contents='abc')
self.fs.CreateFile('/test/file3', contents='defg')
self.fs.CreateFile('/test/file4', contents='hijk')
core.update_index(self.index, ['/test'])
results = core.list_duplicates(self.index)
self.assertEqual(0, len(list(results)))
def test_list(self):
self.fs.CreateFile('/test/file1', contents='abc')
self.fs.CreateFile('/test/file2', contents='abc')
self.fs.CreateFile('/test/file3', contents='defg')
self.fs.CreateFile('/test/file4', contents='hijk')
self.fs.CreateFile('/test/afile', contents='abc')
core.update_index(self.index, ['/test'])
results = core.list_duplicates(self.index)
self.assertSetEqual(set(results), {'/test/file1', '/test/file2'})
def test_list_with_originals(self):
self.fs.CreateFile('/test/file1', contents='abc')
self.fs.CreateFile('/test/file2', contents='abc')
self.fs.CreateFile('/test/file3', contents='defg')
self.fs.CreateFile('/test/file4', contents='hijk')
self.fs.CreateFile('/test/afile', contents='abc')
core.update_index(self.index, ['/test'])
results = core.list_duplicates_with_originals(self.index)
self.assertEqual(1, len(results))
orig, *dupes = results[0]
self.assertEqual('/test/afile', orig)
self.assertSetEqual(set(dupes),
{'/test/file1', '/test/file2'})
def test_list_empty_with_originals(self):
core.update_index(self.index, ['/test'])
results = core.list_duplicates_with_originals(self.index)
self.assertEqual(0, len(results))
def test_list_no_duplicates_with_originals(self):
self.fs.CreateFile('/test/file1', contents='abc')
self.fs.CreateFile('/test/file3', contents='defg')
self.fs.CreateFile('/test/file4', contents='hijk')
core.update_index(self.index, ['/test'])
results = core.list_duplicates_with_originals(self.index)
self.assertEqual(0, len(results))
def test_list_duplicates_with_originals_pairs(self):
self.fs.CreateFile('/test/file1', contents='abc')
self.fs.CreateFile('/test/file2', contents='abc')
core.update_index(self.index, ['/test'])
results = core.list_duplicates_with_originals(self.index)
self.assertEqual(1, len(results))
self.assertSetEqual(set(results[0]), {'/test/file1', '/test/file2'})
| 37.83871 | 76 | 0.654731 | 438 | 3,519 | 5.13242 | 0.210046 | 0.050712 | 0.135231 | 0.160142 | 0.662811 | 0.662811 | 0.652135 | 0.626335 | 0.626335 | 0.626335 | 0 | 0.010684 | 0.202046 | 3,519 | 92 | 77 | 38.25 | 0.789886 | 0.07019 | 0 | 0.575758 | 0 | 0 | 0.113936 | 0 | 0 | 0 | 0 | 0.01087 | 0.151515 | 1 | 0.136364 | false | 0 | 0.090909 | 0 | 0.242424 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c1057e2999cc34357ecd30fd13043756cb243d7a | 441 | py | Python | quotes/migrations/0008_auto_20190803_1026.py | quattad/django-web-app | 410e70140f912fd139ed75ad626615f977da0dba | [
"MIT"
] | null | null | null | quotes/migrations/0008_auto_20190803_1026.py | quattad/django-web-app | 410e70140f912fd139ed75ad626615f977da0dba | [
"MIT"
] | 26 | 2019-09-09T14:11:35.000Z | 2022-03-21T22:17:27.000Z | quotes/migrations/0008_auto_20190803_1026.py | quattad/quote-buddy | 410e70140f912fd139ed75ad626615f977da0dba | [
"MIT"
] | null | null | null | # Generated by Django 2.2.3 on 2019-08-03 02:26
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('quotes', '0007_auto_20190730_2313'),
]
operations = [
migrations.RemoveField(
model_name='quote',
name='user_favourited',
),
migrations.RemoveField(
model_name='quote',
name='user_liked',
),
]
| 20.045455 | 47 | 0.569161 | 44 | 441 | 5.545455 | 0.704545 | 0.172131 | 0.213115 | 0.245902 | 0.352459 | 0.352459 | 0.352459 | 0 | 0 | 0 | 0 | 0.103333 | 0.319728 | 441 | 21 | 48 | 21 | 0.71 | 0.102041 | 0 | 0.4 | 1 | 0 | 0.162437 | 0.058376 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 0 | 0.266667 | 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 |
c12837ae8dd8e0dd2a14655aa7452a662c8ff79c | 3,034 | py | Python | tests/test_utils_stack.py | jiz148/rift-projects | 59949f7dc9b217f1fc6c1a9558505d50287b008d | [
"MIT"
] | null | null | null | tests/test_utils_stack.py | jiz148/rift-projects | 59949f7dc9b217f1fc6c1a9558505d50287b008d | [
"MIT"
] | null | null | null | tests/test_utils_stack.py | jiz148/rift-projects | 59949f7dc9b217f1fc6c1a9558505d50287b008d | [
"MIT"
] | 2 | 2019-09-01T02:21:42.000Z | 2019-09-01T02:21:51.000Z | import unittest
from interview.utils.stack import Stack
class TestStack(unittest.TestCase):
def setUp(self):
self.example_basic_stack = Stack()
self.example_empty_item_stack = Stack()
pass
def test_has_space(self):
"""
test interview.utils.stack :: Stack :: _has_space
"""
# when size < limit
self.example_basic_stack.size = 999
returned = self.example_basic_stack._has_space()
self.assertTrue(returned)
# when size >= limit
self.example_basic_stack.size = 1000
returned = self.example_basic_stack._has_space()
self.assertFalse(returned)
def test_is_empty(self):
"""
test interview.utils.stack :: Stack :: is_empty
"""
# when stack is empty
self.example_basic_stack.size = 0
returned = self.example_basic_stack.is_empty()
self.assertTrue(returned)
# when stack is not empty
self.example_basic_stack.size = 1
returned = self.example_basic_stack.is_empty()
self.assertFalse(returned)
def test_peek(self):
"""
test interview.utils.stack :: Stack :: peek
"""
self.example_empty_item_stack.reset_from_list([1, 2, 3, 4, 5])
expected = 1
returned = self.example_empty_item_stack.peek()
self.assertEqual(expected, returned)
# when size = 0
expected = None
self.example_empty_item_stack = Stack()
returned = self.example_empty_item_stack.peek()
self.assertEqual(expected, returned)
def test_pop(self):
"""
test interview.utils.stack :: Stack :: pop
"""
self.example_empty_item_stack.reset_from_list([1, 2, 3, 4, 5])
expected, expected_list = 1, [2, 3, 4, 5]
returned = self.example_empty_item_stack.pop()
returned_list = self.example_empty_item_stack.to_list()
self.assertEqual((expected, expected_list), (returned, returned_list))
# when size = 0
self.example_empty_item_stack = Stack()
expected, expected_list = None, []
returned = self.example_empty_item_stack.pop()
returned_list = self.example_empty_item_stack.to_list()
self.assertEqual((expected, expected_list), (returned, returned_list))
def test_push(self):
"""
test interview.utils.stack :: Stack :: push
"""
self.example_empty_item_stack.reset_from_list([1, 2, 3, 4, 5])
expected = [9, 1, 2, 3, 4, 5]
self.example_empty_item_stack.push(9)
returned = self.example_empty_item_stack.to_list()
self.assertEqual(expected, returned)
# when stack does not have space
self.example_empty_item_stack.reset_from_list([1, 2, 3, 4, 5])
expected = [1, 2, 3, 4, 5]
self.example_empty_item_stack.limit = 5
self.example_empty_item_stack.push(9)
returned = self.example_empty_item_stack.to_list()
self.assertEqual(expected, returned)
| 34.089888 | 78 | 0.632169 | 380 | 3,034 | 4.763158 | 0.126316 | 0.164088 | 0.159116 | 0.198895 | 0.807735 | 0.774586 | 0.598343 | 0.598343 | 0.466851 | 0.466851 | 0 | 0.02286 | 0.264667 | 3,034 | 88 | 79 | 34.477273 | 0.788436 | 0.121622 | 0 | 0.584906 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.188679 | 1 | 0.113208 | false | 0.018868 | 0.037736 | 0 | 0.169811 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c12f5425aad3eac2b7c38a1ff1c924d94308beb8 | 224 | py | Python | x.py | efe3535/pythonexamples | 676aeb5d730dc0fc364083fccbd8c241de5bdc0a | [
"CC0-1.0"
] | 1 | 2020-11-30T06:53:06.000Z | 2020-11-30T06:53:06.000Z | x.py | efeduino/pythonexamples | 676aeb5d730dc0fc364083fccbd8c241de5bdc0a | [
"CC0-1.0"
] | 2 | 2021-05-16T06:34:36.000Z | 2021-06-05T16:44:15.000Z | x.py | efeduino/pythonexamples | 676aeb5d730dc0fc364083fccbd8c241de5bdc0a | [
"CC0-1.0"
] | 1 | 2021-06-04T12:17:31.000Z | 2021-06-04T12:17:31.000Z | token = 'VdINGcwGZsIvUTbuZl3PRTvX2MhkdieXFk9cnNRA4J8hP-jw1obnY6KCfXpRJFTA'
import lyricsgenius
genius = lyricsgenius.Genius(token)
muzik = input("Şarkı sözü ara:")
song = genius.search_song(muzik)
print(song.lyrics) | 28 | 75 | 0.794643 | 22 | 224 | 8.045455 | 0.681818 | 0.20339 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035176 | 0.111607 | 224 | 8 | 76 | 28 | 0.854271 | 0 | 0 | 0 | 0 | 0 | 0.362385 | 0.293578 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0.166667 | 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 |
c136ed8980cbe982b8760918a4ef02dceca74464 | 144 | py | Python | src/tests/conftest.py | RAIL-group/RAIL-software-infrastructure-demos | 98efc7d5d93957e85e9a10cb3881bf824b3f6187 | [
"MIT"
] | 2 | 2021-12-27T11:46:01.000Z | 2022-03-24T01:19:18.000Z | src/tests/conftest.py | RAIL-group/RAIL-software-infrastructure-demos | 98efc7d5d93957e85e9a10cb3881bf824b3f6187 | [
"MIT"
] | null | null | null | src/tests/conftest.py | RAIL-group/RAIL-software-infrastructure-demos | 98efc7d5d93957e85e9a10cb3881bf824b3f6187 | [
"MIT"
] | 1 | 2022-03-11T18:21:35.000Z | 2022-03-11T18:21:35.000Z |
def pytest_addoption(parser):
parser.addoption("--unity_exe_path",
action="store",
default=None)
| 24 | 40 | 0.527778 | 13 | 144 | 5.615385 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.361111 | 144 | 5 | 41 | 28.8 | 0.793478 | 0 | 0 | 0 | 0 | 0 | 0.146853 | 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 |
c14ec87c85ff51cc3f611f7a516c8bfb34d2d58e | 333 | py | Python | til-ginconfig/main.py | kpvla/til | 093159d0dc2c0fcace69afdaeb503ea7e8983395 | [
"MIT"
] | null | null | null | til-ginconfig/main.py | kpvla/til | 093159d0dc2c0fcace69afdaeb503ea7e8983395 | [
"MIT"
] | 13 | 2021-03-10T00:22:01.000Z | 2022-02-26T23:05:02.000Z | til-ginconfig/main.py | kpvla/til | 093159d0dc2c0fcace69afdaeb503ea7e8983395 | [
"MIT"
] | null | null | null | import gin
@gin.configurable
def inner(d=0, e=0):
return d + e
@gin.configurable
def build(a=0, b=0, c=0, inner=None):
s = inner()
print(a + b + c + s)
@gin.configurable
def build_other(inner=None):
print(inner())
if __name__ == "__main__":
gin.parse_config_file("main.gin")
build()
build_other()
| 13.875 | 37 | 0.618619 | 53 | 333 | 3.660377 | 0.433962 | 0.231959 | 0.278351 | 0.237113 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019231 | 0.219219 | 333 | 23 | 38 | 14.478261 | 0.726923 | 0 | 0 | 0.2 | 0 | 0 | 0.048048 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.066667 | 0.066667 | 0.333333 | 0.133333 | 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 |
c173350c26d9235573d5aabe1554e185806c6b5e | 178 | py | Python | src/posts/urls.py | ChaosDynamix/Afterlife | 629f5857a5124b0685deda3dd2ae618b55da29ac | [
"MIT"
] | null | null | null | src/posts/urls.py | ChaosDynamix/Afterlife | 629f5857a5124b0685deda3dd2ae618b55da29ac | [
"MIT"
] | null | null | null | src/posts/urls.py | ChaosDynamix/Afterlife | 629f5857a5124b0685deda3dd2ae618b55da29ac | [
"MIT"
] | null | null | null | from django.urls import path
from posts import views
urlpatterns = [
path('', views.posts_index, name='postsIndex'),
path('tags/', views.posts_tags, name='postsTags'),
] | 25.428571 | 54 | 0.702247 | 23 | 178 | 5.347826 | 0.565217 | 0.162602 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146067 | 178 | 7 | 55 | 25.428571 | 0.809211 | 0 | 0 | 0 | 0 | 0 | 0.134078 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
c19f54546fcb3a19c9b50bc88e7f1a7f819bf3ae | 253 | py | Python | example/test/core/material/medium/quadratic.py | dmilos/IceRay | 4e01f141363c0d126d3c700c1f5f892967e3d520 | [
"MIT-0"
] | 2 | 2020-09-04T12:27:15.000Z | 2022-01-17T14:49:40.000Z | example/test/core/material/medium/quadratic.py | dmilos/IceRay | 4e01f141363c0d126d3c700c1f5f892967e3d520 | [
"MIT-0"
] | null | null | null | example/test/core/material/medium/quadratic.py | dmilos/IceRay | 4e01f141363c0d126d3c700c1f5f892967e3d520 | [
"MIT-0"
] | 1 | 2020-09-04T12:27:52.000Z | 2020-09-04T12:27:52.000Z | import IceRayCpp
import IceRayCpp
def name( ):
return "quadratic"
def make( value = IceRayCpp.GraphTypeColorRGB().fill( 0.9 ) ):
m = IceRayCpp.MaterialMediumQuadratic( value, 0.1, 0.1, 0.1 )
return { 'this': m }
make( ) | 18.071429 | 66 | 0.612648 | 30 | 253 | 5.166667 | 0.533333 | 0.03871 | 0.03871 | 0.051613 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.042553 | 0.256917 | 253 | 14 | 67 | 18.071429 | 0.781915 | 0 | 0 | 0.25 | 0 | 0 | 0.053942 | 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 |
c1b609fbe9e62b22c953b5d0144737b8412e5893 | 118 | py | Python | Lib/test/lazyimports/dict_update.py | mananpal1997/cinder | a8804cc6e3a5861463ff959abcd09ad60a0763e5 | [
"CNRI-Python-GPL-Compatible"
] | 1,886 | 2021-05-03T23:58:43.000Z | 2022-03-31T19:15:58.000Z | Lib/test/lazyimports/dict_update.py | mananpal1997/cinder | a8804cc6e3a5861463ff959abcd09ad60a0763e5 | [
"CNRI-Python-GPL-Compatible"
] | 70 | 2021-05-04T23:25:35.000Z | 2022-03-31T18:42:08.000Z | Lib/test/lazyimports/dict_update.py | mananpal1997/cinder | a8804cc6e3a5861463ff959abcd09ad60a0763e5 | [
"CNRI-Python-GPL-Compatible"
] | 52 | 2021-05-04T21:26:03.000Z | 2022-03-08T18:02:56.000Z | from __future__ import lazy_imports
import warnings
vars = {}
vars.update(globals())
print(repr(vars['warnings']))
| 13.111111 | 35 | 0.745763 | 15 | 118 | 5.533333 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.118644 | 118 | 8 | 36 | 14.75 | 0.798077 | 0 | 0 | 0 | 0 | 0 | 0.068376 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
c1c24d1bef512da4b8bab0302b96bc52076167c5 | 1,417 | py | Python | test/test_system_main.py | Virtual-Y-Monster/Sudoku | 5ecffacb2269f3ab54eab297292b518191889273 | [
"MIT"
] | 2 | 2021-07-21T09:15:12.000Z | 2022-01-15T22:36:39.000Z | Sudoku/test/test_system_main.py | RyanShaw3/MyScripts | 940597fd0e33378897388c63b03f52fa7294ac05 | [
"MIT"
] | null | null | null | Sudoku/test/test_system_main.py | RyanShaw3/MyScripts | 940597fd0e33378897388c63b03f52fa7294ac05 | [
"MIT"
] | 1 | 2022-01-15T22:39:28.000Z | 2022-01-15T22:39:28.000Z | """
主函数的测试模块
该模块是用于测试main模块的单元测试
:copyright: (c) 2021 by 李浚哲.
"""
import sys
from main import main
def test_main():
"""
测试main函数对输入指令的处理
"""
# 备份标准输出
started_out = sys.stdout
# 重定位标准输出到文件
sys.stdout = open('main_out.txt', 'w')
# python main.py
main(['main.py'])
print('-' * 20)
# python main.py -h
main(['main.py', '-h'])
print('-' * 20)
# python main.py --help
main(['main.py', '--help'])
print('-' * 20)
# python main.py abc
main(['main.py', 'abc'])
print('-' * 20)
# python main.py -c 0
main(['main.py', '-c', '0'])
print('-' * 20)
# python main.py -c 1000001
main(['main.py', '-c', '1000001'])
print('-' * 20)
# python main.py -c 10
main(['main.py', '-c', '10'])
print('-' * 20)
# python main.py -c abc
main(['main.py', '-c', 'abc'])
print('-' * 20)
# python main.py -s games.txt
main(['main.py', '-s', 'games.txt'])
print('-' * 20)
# python main.py -s not_exists.txt
main(['main.py', '-s', 'not_exists.txt'])
print('-' * 20)
# python main.py -s abc
main(['main.py', '-s', 'abc'])
print('-' * 20)
# python main.py -n games.txt
main(['main.py', '-n', 'games.txt'])
# python main.py -s games.txt extra_parameter
main(['main.py', '-s', 'games.txt', 'extra_parameter'])
# 恢复标准输出
sys.stdout.close()
sys.stdout = started_out
| 22.854839 | 59 | 0.518701 | 194 | 1,417 | 3.747423 | 0.21134 | 0.21458 | 0.21458 | 0.257221 | 0.526823 | 0.404402 | 0.143054 | 0 | 0 | 0 | 0 | 0.043519 | 0.254058 | 1,417 | 61 | 60 | 23.229508 | 0.644276 | 0.296401 | 0 | 0.354839 | 0 | 0 | 0.225235 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.032258 | false | 0 | 0.064516 | 0 | 0.096774 | 0.354839 | 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 |
c1c712580a222dcd8c545d68d544146d5bd8e9a7 | 100 | py | Python | configs/benchmarks/classification/imagenet/imagenet_per_1/r50_sz224_4xb64_head1_lr0_01_step_ep20.py | Westlake-AI/openmixup | ea81250819e740dd823e30cb7ce382d14a3c1b91 | [
"Apache-2.0"
] | 10 | 2021-12-30T10:22:27.000Z | 2022-03-30T02:31:38.000Z | configs/benchmarks/classification/imagenet/imagenet_per_1/r50_sz224_4xb64_head1_lr0_01_step_ep20.py | Westlake-AI/openmixup | ea81250819e740dd823e30cb7ce382d14a3c1b91 | [
"Apache-2.0"
] | 3 | 2022-01-20T21:02:48.000Z | 2022-03-19T13:49:45.000Z | configs/benchmarks/classification/imagenet/imagenet_per_10/r50_sz224_4xb64_head1_lr0_01_step_ep20.py | Westlake-AI/openmixup | ea81250819e740dd823e30cb7ce382d14a3c1b91 | [
"Apache-2.0"
] | null | null | null | _base_ = [
'r50_sz224_4xb64_head1_lr0_1_step_ep20.py',
]
# optimizer
optimizer = dict(lr=0.01)
| 14.285714 | 47 | 0.72 | 16 | 100 | 3.9375 | 0.9375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.188235 | 0.15 | 100 | 6 | 48 | 16.666667 | 0.552941 | 0.09 | 0 | 0 | 0 | 0 | 0.449438 | 0.449438 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c1ea2e7744b1110ea5c576148cba631bc2ef373c | 994 | py | Python | SpoTwillio/lib/python3.6/site-packages/twilio/rest/taskrouter/v1/__init__.py | Natfan/funlittlethings | 80d5378b45b5c0ead725942ee50403bd057514a6 | [
"MIT"
] | 30 | 2018-06-12T12:00:53.000Z | 2021-05-02T01:27:16.000Z | SpoTwillio/lib/python3.6/site-packages/twilio/rest/taskrouter/v1/__init__.py | Natfan/funlittlethings | 80d5378b45b5c0ead725942ee50403bd057514a6 | [
"MIT"
] | 11 | 2019-12-26T17:21:03.000Z | 2022-03-21T22:17:07.000Z | SpoTwillio/lib/python3.6/site-packages/twilio/rest/taskrouter/v1/__init__.py | Natfan/funlittlethings | 80d5378b45b5c0ead725942ee50403bd057514a6 | [
"MIT"
] | 4 | 2018-06-12T14:14:20.000Z | 2018-06-19T16:01:49.000Z | # coding=utf-8
"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base.version import Version
from twilio.rest.taskrouter.v1.workspace import WorkspaceList
class V1(Version):
def __init__(self, domain):
"""
Initialize the V1 version of Taskrouter
:returns: V1 version of Taskrouter
:rtype: twilio.rest.taskrouter.v1.V1.V1
"""
super(V1, self).__init__(domain)
self.version = 'v1'
self._workspaces = None
@property
def workspaces(self):
"""
:rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceList
"""
if self._workspaces is None:
self._workspaces = WorkspaceList(self)
return self._workspaces
def __repr__(self):
"""
Provide a friendly representation
:returns: Machine friendly representation
:rtype: str
"""
return '<Twilio.Taskrouter.V1>'
| 23.116279 | 65 | 0.584507 | 101 | 994 | 5.504951 | 0.425743 | 0.086331 | 0.107914 | 0.118705 | 0.169065 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021583 | 0.300805 | 994 | 42 | 66 | 23.666667 | 0.778417 | 0.374245 | 0 | 0 | 1 | 0 | 0.046784 | 0.042885 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.142857 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
a9af410fd18638d8be6fbaad3b8d66d3943bc56c | 426 | py | Python | Code07-01.py | seryeongi/learn_algorithm | a9dbe26176d7c27b26689989de698b89ac6772a3 | [
"Apache-2.0"
] | null | null | null | Code07-01.py | seryeongi/learn_algorithm | a9dbe26176d7c27b26689989de698b89ac6772a3 | [
"Apache-2.0"
] | null | null | null | Code07-01.py | seryeongi/learn_algorithm | a9dbe26176d7c27b26689989de698b89ac6772a3 | [
"Apache-2.0"
] | null | null | null | SIZE = 5
queue = [None for _ in range(SIZE)]
front, rear = -1, -1
rear += 1
queue[rear] = '화사'
rear += 1
queue[rear] = '솔라'
rear += 1
queue[rear] = '문별'
print('출구<--',queue,'<--입구')
front += 1
data = queue[front]
queue[front] = None
print('추출-->',data)
front += 1
data = queue[front]
queue[front] = None
print('추출-->',data)
front += 1
data = queue[front]
queue[front] = None
print('추출-->',data)
print('출구<--',queue,'<--입구')
| 16.384615 | 35 | 0.589202 | 68 | 426 | 3.676471 | 0.264706 | 0.24 | 0.12 | 0.168 | 0.54 | 0.54 | 0.54 | 0.54 | 0.54 | 0.54 | 0 | 0.02507 | 0.157277 | 426 | 25 | 36 | 17.04 | 0.671309 | 0 | 0 | 0.73913 | 0 | 0 | 0.096244 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.217391 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a9b03b713c1f8260608b82ba40bfbc2b0a9e8877 | 192 | py | Python | tests/status_enum_test.py | isouzasoares/needle-forms | 1cdb097e1e9801d53607683aa6dcb645b1b82226 | [
"MIT"
] | null | null | null | tests/status_enum_test.py | isouzasoares/needle-forms | 1cdb097e1e9801d53607683aa6dcb645b1b82226 | [
"MIT"
] | 3 | 2020-03-31T04:49:13.000Z | 2021-04-30T21:03:00.000Z | tests/status_enum_test.py | isouzasoares/needle-forms | 1cdb097e1e9801d53607683aa6dcb645b1b82226 | [
"MIT"
] | 2 | 2019-11-05T14:48:39.000Z | 2020-03-26T20:17:42.000Z | """Tests for the StatusEnum class"""
from enums.status_enum import StatusEnum
def test_status_enum():
"""Test"""
for status in StatusEnum:
assert status.value in range(1, 5)
| 21.333333 | 42 | 0.6875 | 27 | 192 | 4.777778 | 0.666667 | 0.155039 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013072 | 0.203125 | 192 | 8 | 43 | 24 | 0.830065 | 0.182292 | 0 | 0 | 0 | 0 | 0 | 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 |
a9bd931b813507218156ab76dd6ebede433ec88b | 3,106 | py | Python | statsbiblioteket/harvest/harvest.py | statsbiblioteket/python-harvest | 3bbc913edc8d191c012e4316200c5794b72fa93e | [
"MIT"
] | null | null | null | statsbiblioteket/harvest/harvest.py | statsbiblioteket/python-harvest | 3bbc913edc8d191c012e4316200c5794b72fa93e | [
"MIT"
] | null | null | null | statsbiblioteket/harvest/harvest.py | statsbiblioteket/python-harvest | 3bbc913edc8d191c012e4316200c5794b72fa93e | [
"MIT"
] | null | null | null | import logging
from statsbiblioteket.harvest.clients import Clients
from statsbiblioteket.harvest.contacts import Contacts
from statsbiblioteket.harvest.expense_categories import ExpenseCategories
from statsbiblioteket.harvest.expenses import Expenses
from statsbiblioteket.harvest.invoices import Invoices
from statsbiblioteket.harvest.projects import Projects
from statsbiblioteket.harvest.task_assignments import TaskAssignments
from statsbiblioteket.harvest.tasks import Tasks
from statsbiblioteket.harvest.timetracking import Timetracking
from statsbiblioteket.harvest.users import Users
class Harvest(Clients, Contacts, ExpenseCategories, Invoices, Users, Projects,
Tasks, Timetracking, TaskAssignments, Expenses):
"""
Harvest class to implement Harvest API
"""
@classmethod
def oath(cls, uri, client_id, token):
return Harvest(uri=uri, client_id=client_id, token=token)
@classmethod
def basic(cls, uri, email, password, put_auth_in_header=True):
return Harvest(uri=uri, email=email, password=password,
put_auth_in_header=put_auth_in_header)
def __init__(self, uri, email=None, password=None, client_id=None,
token=None, put_auth_in_header=True):
super(Harvest, self).__init__(uri, email, password, client_id, token)
# Accounts
@property
def who_am_i(self):
"""
who_am_i property
http://help.getharvest.com/api/introduction/overview/who-am-i/
::
{
'company': {
'active': True,
'base_uri': 'https://statsbiblioteket.harvestapp.com',
'clock': '24h',
'color_scheme': 'red',
'decimal_symbol': ',',
'full_domain': 'statsbiblioteket.harvestapp.com',
'modules': {
'approval': False,
'estimates': False,
'expenses': False,
'invoices': False
},
'name': 'State and University Library',
'plan_type': 'business-v3',
'thousands_separator': '.',
'time_format': 'hours_minutes',
'week_start_day': 'Monday'
},
'user': {
'admin': True,
'avatar_url': '/assets/profile_images/abraj_albait_towers.png?1456217395',
'email': 'abr@statsbiblioteket.dk',
'first_name': 'Asger',
'id': 1221014,
'last_name': 'Askov-Blekinge',
'project_manager': {
'can_create_invoices': True,
'can_create_projects': True,
'can_see_rates': True,
'is_project_manager': False
},
'timestamp_timers': False,
'timezone': 'Berlin',
'timezone_identifier': 'Europe/Berlin',
'timezone_utc_offset': 7200
}
}
"""
return self._get('/account/who_am_i')
| 36.116279 | 90 | 0.580167 | 290 | 3,106 | 5.996552 | 0.448276 | 0.115009 | 0.155262 | 0.034503 | 0.039678 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011342 | 0.318738 | 3,106 | 85 | 91 | 36.541176 | 0.810491 | 0.435609 | 0 | 0.076923 | 0 | 0 | 0.012283 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0.153846 | 0.423077 | 0.076923 | 0.730769 | 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 |
a9c9142058b107c5045474b16a3e5978d7c200b4 | 166 | py | Python | askup_lti/urls.py | raccoongang/askup | f74f04bff9db16eabe64b35776ae8d545963d324 | [
"MIT"
] | null | null | null | askup_lti/urls.py | raccoongang/askup | f74f04bff9db16eabe64b35776ae8d545963d324 | [
"MIT"
] | 19 | 2017-12-22T09:25:56.000Z | 2018-08-21T08:18:24.000Z | askup_lti/urls.py | raccoongang/askup | f74f04bff9db16eabe64b35776ae8d545963d324 | [
"MIT"
] | null | null | null | from django.conf.urls import url
from .provider import lti_launch
urlpatterns = [
url(r'^launch/?(?:/qset/(?P<qset_id>\d+)/?)?$', lti_launch, name='launch'),
]
| 20.75 | 79 | 0.656627 | 24 | 166 | 4.416667 | 0.666667 | 0.169811 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126506 | 166 | 7 | 80 | 23.714286 | 0.731034 | 0 | 0 | 0 | 0 | 0 | 0.271084 | 0.23494 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a9cf0027cedacdca2625c735ff45e14b3251028d | 222 | py | Python | qcore/tests/test_disallow_inheritance.py | corey-sobel/qcore | 719a44617789e3cc384ce860031d9479ee0877e4 | [
"Apache-2.0"
] | 83 | 2016-09-16T19:43:20.000Z | 2022-03-02T12:00:20.000Z | qcore/tests/test_disallow_inheritance.py | corey-sobel/qcore | 719a44617789e3cc384ce860031d9479ee0877e4 | [
"Apache-2.0"
] | 20 | 2016-10-07T23:25:22.000Z | 2022-02-22T17:46:42.000Z | qcore/tests/test_disallow_inheritance.py | corey-sobel/qcore | 719a44617789e3cc384ce860031d9479ee0877e4 | [
"Apache-2.0"
] | 22 | 2016-10-01T20:34:10.000Z | 2022-01-31T23:15:40.000Z | import qcore
from qcore.asserts import AssertRaises
class Foo(metaclass=qcore.DisallowInheritance):
pass
def test_disallow_inheritance():
with AssertRaises(TypeError):
class Bar(Foo):
pass
| 15.857143 | 47 | 0.711712 | 24 | 222 | 6.5 | 0.708333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.220721 | 222 | 13 | 48 | 17.076923 | 0.901734 | 0 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.125 | true | 0.25 | 0.25 | 0 | 0.625 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
a9f58c89dda7d3a311b0ef24d2f8120ad5a3b507 | 52 | py | Python | distribute_setup.py | gary-pickens/HouseMonitor | 4b169bdbeed9013e1824d4bb929970ae0c27a6c9 | [
"MIT"
] | 1 | 2021-06-28T06:52:03.000Z | 2021-06-28T06:52:03.000Z | distribute_setup.py | gary-pickens/HouseMonitor | 4b169bdbeed9013e1824d4bb929970ae0c27a6c9 | [
"MIT"
] | null | null | null | distribute_setup.py | gary-pickens/HouseMonitor | 4b169bdbeed9013e1824d4bb929970ae0c27a6c9 | [
"MIT"
] | null | null | null | '''
Created on Nov 21, 2012
@author: Gary
'''
| 8.666667 | 24 | 0.538462 | 7 | 52 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.162162 | 0.288462 | 52 | 5 | 25 | 10.4 | 0.594595 | 0.730769 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a9ff07d044da0783d31d0640b0de079cb0074e11 | 1,647 | py | Python | release/stubs.min/Rhino/DocObjects/__init___parts/InstanceDefinitionArchiveFileStatus.py | YKato521/ironpython-stubs | b1f7c580de48528490b3ee5791b04898be95a9ae | [
"MIT"
] | null | null | null | release/stubs.min/Rhino/DocObjects/__init___parts/InstanceDefinitionArchiveFileStatus.py | YKato521/ironpython-stubs | b1f7c580de48528490b3ee5791b04898be95a9ae | [
"MIT"
] | null | null | null | release/stubs.min/Rhino/DocObjects/__init___parts/InstanceDefinitionArchiveFileStatus.py | YKato521/ironpython-stubs | b1f7c580de48528490b3ee5791b04898be95a9ae | [
"MIT"
] | null | null | null | class InstanceDefinitionArchiveFileStatus(
Enum, IComparable, IFormattable, IConvertible
):
"""
The archive file of a linked instance definition can have the following possible states.
Use InstanceObject.ArchiveFileStatus to query a instance definition's archive file status.
enum InstanceDefinitionArchiveFileStatus,values: LinkedFileIsDifferent (3),LinkedFileIsNewer (1),LinkedFileIsOlder (2),LinkedFileIsUpToDate (0),LinkedFileNotFound (-1),LinkedFileNotReadable (-2),NotALinkedInstanceDefinition (-3)
"""
def __eq__(self, *args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
def __format__(self, *args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __ge__(self, *args):
pass
def __gt__(self, *args):
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __le__(self, *args):
pass
def __lt__(self, *args):
pass
def __ne__(self, *args):
pass
def __reduce_ex__(self, *args):
pass
def __str__(self, *args):
pass
LinkedFileIsDifferent = None
LinkedFileIsNewer = None
LinkedFileIsOlder = None
LinkedFileIsUpToDate = None
LinkedFileNotFound = None
LinkedFileNotReadable = None
NotALinkedInstanceDefinition = None
value__ = None
| 29.945455 | 230 | 0.646023 | 163 | 1,647 | 5.944785 | 0.398773 | 0.082559 | 0.086687 | 0.092879 | 0.133127 | 0.133127 | 0.133127 | 0.116615 | 0.116615 | 0.116615 | 0 | 0.005636 | 0.245902 | 1,647 | 54 | 231 | 30.5 | 0.774557 | 0.451123 | 0 | 0.322581 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.322581 | false | 0.322581 | 0 | 0 | 0.612903 | 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 |
a9ffcb8b38da7b224ff816176584569b21ce09db | 315 | py | Python | backend/boards/admin.py | LucasSantosGuedes/App-Gestao | 88b21208f9a2585421d0b949d2d44cdde72f0ec9 | [
"MIT"
] | 142 | 2020-09-21T15:43:17.000Z | 2022-03-26T09:21:23.000Z | backend/boards/admin.py | LucasSantosGuedes/App-Gestao | 88b21208f9a2585421d0b949d2d44cdde72f0ec9 | [
"MIT"
] | 2 | 2021-03-31T10:15:31.000Z | 2021-11-30T18:04:52.000Z | backend/boards/admin.py | LucasSantosGuedes/App-Gestao | 88b21208f9a2585421d0b949d2d44cdde72f0ec9 | [
"MIT"
] | 49 | 2020-10-23T21:21:22.000Z | 2022-03-24T10:11:47.000Z | from django.contrib import admin
from .models import Board, List, Item, Label, Comment, Attachment, Notification
admin.site.register(Board)
admin.site.register(List)
admin.site.register(Item)
admin.site.register(Label)
admin.site.register(Comment)
admin.site.register(Attachment)
admin.site.register(Notification)
| 28.636364 | 79 | 0.815873 | 43 | 315 | 5.976744 | 0.348837 | 0.245136 | 0.463035 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.069841 | 315 | 10 | 80 | 31.5 | 0.877133 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.222222 | 0 | 0.222222 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e70b5d58a1eaed351d01ddbde516b1aa4cf0ca30 | 100 | py | Python | getinfo.py | davicn/covid19_predict | 4f0e67d58ea6d262ae48b515833f20918a40e019 | [
"MIT"
] | null | null | null | getinfo.py | davicn/covid19_predict | 4f0e67d58ea6d262ae48b515833f20918a40e019 | [
"MIT"
] | null | null | null | getinfo.py | davicn/covid19_predict | 4f0e67d58ea6d262ae48b515833f20918a40e019 | [
"MIT"
] | null | null | null | import requests
r = requests.get('https://covid19-brazil-api.now.sh/api/report/v1')
print(r.json()) | 25 | 67 | 0.73 | 17 | 100 | 4.294118 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.031915 | 0.06 | 100 | 4 | 68 | 25 | 0.744681 | 0 | 0 | 0 | 0 | 0 | 0.465347 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e71b559356d4a48dddaea75329ca2c109bec2f17 | 6,479 | py | Python | Comparison/venv/Include/proto_data_utils/Data/SQdata_dir.py | fyancy/SSMN | 9a807d7e926fc6ff347cfd19ffbb6462b6a49dea | [
"MIT"
] | 5 | 2021-04-11T12:02:34.000Z | 2022-03-29T01:31:39.000Z | Comparison/venv/Include/proto_data_utils/Data/SQdata_dir.py | fyancy/SSMN | 9a807d7e926fc6ff347cfd19ffbb6462b6a49dea | [
"MIT"
] | null | null | null | Comparison/venv/Include/proto_data_utils/Data/SQdata_dir.py | fyancy/SSMN | 9a807d7e926fc6ff347cfd19ffbb6462b6a49dea | [
"MIT"
] | 5 | 2021-09-17T00:10:36.000Z | 2022-03-21T12:10:39.000Z | """
SQ数据集数据文件目录
文件获取举例:inner2['29'][2],
得到的是内圈2下29Hz的第2个文件(actually 3rd),
默认文件夹内排列顺序,每一个转速下共有3个文件[0~2]
train_dir109 1-故障程度 09-转速(Hz)
train 均使用第0个数据文件,test均使用第1个数据文件
"""
# home = r'G:\dataset\SQdata' # U盘
home = r'F:\dataset\SQdata' # 本地F盘
inner1 = {'09': [home + r'\inner1\09\REC3585_ch2.txt', home + r'\inner1\09\REC3586_ch2.txt',
home + r'\inner1\09\REC3587_ch2.txt'],
'19': [home + r'\inner1\19\REC3588_ch2.txt', home + r'\inner1\19\REC3589_ch2.txt',
home + r'\inner1\19\REC3590_ch2.txt'],
'29': [home + r'\inner1\29\REC3591_ch2.txt', home + r'\inner1\29\REC3592_ch2.txt',
home + r'\inner1\29\REC3593_ch2.txt'],
'39': [home + r'\inner1\39\REC3594_ch2.txt', home + r'\inner1\39\REC3595_ch2.txt',
home + r'\inner1\39\REC3596_ch2.txt']}
inner2 = {'09': [home + r'\inner2\09\REC3607_ch2.txt', home + r'\inner2\09\REC3608_ch2.txt',
home + r'\inner2\09\REC3609_ch2.txt'],
'19': [home + r'\inner2\19\REC3610_ch2.txt', home + r'\inner2\19\REC3611_ch2.txt',
home + r'\inner2\19\REC3612_ch2.txt'],
'29': [home + r'\inner2\29\REC3613_ch2.txt', home + r'\inner2\29\REC3614_ch2.txt',
home + r'\inner2\29\REC3615_ch2.txt'],
'39': [home + r'\inner2\39\REC3616_ch2.txt', home + r'\inner2\39\REC3617_ch2.txt',
home + r'\inner2\39\REC3618_ch2.txt']}
inner3 = {'09': [home + r'\inner3\09\REC3520_ch2.txt', home + r'\inner3\09\REC3521_ch2.txt',
home + r'\inner3\09\REC3522_ch2.txt'],
'19': [home + r'\inner3\19\REC3523_ch2.txt', home + r'\inner3\19\REC3524_ch2.txt',
home + r'\inner3\19\REC3525_ch2.txt'],
'29': [home + r'\inner3\29\REC3526_ch2.txt', home + r'\inner3\29\REC3527_ch2.txt',
home + r'\inner3\29\REC3528_ch2.txt'],
'39': [home + r'\inner3\39\REC3529_ch2.txt', home + r'\inner3\39\REC3530_ch2.txt',
home + r'\inner3\39\REC3531_ch2.txt']}
outer1 = {'09': [home + r'\outer1\09\REC3500_ch2.txt', home + r'\outer1\09\REC3501_ch2.txt',
home + r'\outer1\09\REC3502_ch2.txt'],
'19': [home + r'\outer1\19\REC3503_ch2.txt', home + r'\outer1\19\REC3504_ch2.txt',
home + r'\outer1\19\REC3505_ch2.txt'],
'29': [home + r'\outer1\29\REC3506_ch2.txt', home + r'\outer1\29\REC3507_ch2.txt',
home + r'\outer1\29\REC3508_ch2.txt'],
'39': [home + r'\outer1\39\REC3510_ch2.txt', home + r'\outer1\39\REC3511_ch2.txt',
home + r'\outer1\39\REC3512_ch2.txt']}
outer2 = {'09': [home + r'\outer2\09\REC3482_ch2.txt', home + r'\outer2\09\REC3483_ch2.txt',
home + r'\outer2\09\REC3484_ch2.txt'],
'19': [home + r'\outer2\19\REC3485_ch2.txt', home + r'\outer2\19\REC3486_ch2.txt',
home + r'\outer2\19\REC3487_ch2.txt'],
'29': [home + r'\outer2\29\REC3488_ch2.txt', home + r'\outer2\29\REC3489_ch2.txt',
home + r'\outer2\29\REC3490_ch2.txt'],
'39': [home + r'\outer2\39\REC3491_ch2.txt', home + r'\outer2\39\REC3492_ch2.txt',
home + r'\outer2\39\REC3493_ch2.txt']}
outer3 = {'09': [home + r'\outer3\09\REC3464_ch2.txt', home + r'\outer3\09\REC3465_ch2.txt',
home + r'\outer3\09\REC3466_ch2.txt'],
'19': [home + r'\outer3\19\REC3467_ch2.txt', home + r'\outer3\19\REC3468_ch2.txt',
home + r'\outer3\19\REC3469_ch2.txt'],
'29': [home + r'\outer3\29\REC3470_ch2.txt', home + r'\outer3\29\REC3471_ch2.txt',
home + r'\outer3\29\REC3472_ch2.txt'],
'39': [home + r'\outer3\39\REC3473_ch2.txt', home + r'\outer3\39\REC3474_ch2.txt',
home + r'\outer3\39\REC3475_ch2.txt']}
normal = {'09': [home + r'\normal\09\REC3629_ch2.txt', home + r'\normal\09\REC3630_ch2.txt',
home + r'\normal\09\REC3631_ch2.txt'],
'19': [home + r'\normal\19\REC3632_ch2.txt', home + r'\normal\19\REC3633_ch2.txt',
home + r'\normal\19\REC3634_ch2.txt'],
'29': [home + r'\normal\29\REC3635_ch2.txt', home + r'\normal\29\REC3636_ch2.txt',
home + r'\normal\29\REC3637_ch2.txt'],
'39': [home + r'\normal\39\REC3638_ch2.txt', home + r'\normal\39\REC3639_ch2.txt',
home + r'\normal\39\REC3640_ch2.txt']}
# -------------------------------------------------------------------------
# -----------------------------train_dir-----------------------------------
train3_dir109 = [normal['09'][0], inner1['09'][0], outer1['09'][0]]
train3_dir139 = [normal['39'][0], inner1['39'][0], outer1['39'][0]]
train3_dir239 = [normal['39'][0], inner2['39'][0], outer2['39'][0]]
train3_dir309 = [normal['09'][0], inner3['09'][0], outer3['09'][0]]
# 区分故障类别
sq3_39_0 = [normal['39'][0], inner3['39'][0], outer3['39'][0]]
sq3_39_1 = [normal['39'][1], inner3['39'][1], outer3['39'][1]]
sq3_29_0 = [normal['29'][0], inner3['29'][0], outer3['29'][0]]
sq3_29_1 = [normal['29'][1], inner3['29'][1], outer3['29'][1]]
# 区分故障类别同时区分出故障严重程度
sq7_39_0 = [normal['39'][0], inner1['39'][0], inner2['39'][0], inner3['39'][0],
outer1['39'][0], outer2['39'][0], outer3['39'][0]]
sq7_39_1 = [normal['39'][1], inner1['39'][1], inner2['39'][1], inner3['39'][1],
outer1['39'][1], outer2['39'][1], outer3['39'][1]]
sq7_29_0 = [normal['29'][0], inner1['29'][0], inner2['29'][0], inner3['29'][0],
outer1['29'][0], outer2['29'][0], outer3['29'][0]]
sq7_29_1 = [normal['29'][1], inner1['29'][1], inner2['29'][1], inner3['29'][1],
outer1['29'][1], outer2['29'][1], outer3['29'][1]]
# 多转速情况下
sq3_09 = [normal['09'][0], inner3['09'][0], outer3['09'][0]]
sq3_19 = [normal['19'][0], inner3['19'][0], outer3['19'][0]]
sq3_29 = [normal['29'][0], inner3['29'][0], outer3['29'][0]]
sq3_39 = [normal['39'][0], inner3['39'][0], outer3['39'][0]]
sq3_09_ = [normal['09'][1], inner3['09'][1], outer3['09'][1]]
sq3_19_ = [normal['19'][1], inner3['19'][1], outer3['19'][1]]
sq3_29_ = [normal['29'][1], inner3['29'][1], outer3['29'][1]]
sq3_39_ = [normal['39'][1], inner3['39'][1], outer3['39'][1]]
# sq_NC = [normal['09'][0], normal['19'][0], normal['29'][0], normal['39'][0]]
# sq_IF = [inner3['09'][0], inner3['19'][0], inner3['29'][0], inner3['39'][0]]
# sq_OF = [outer3['09'][0], outer3['19'][0], outer3['29'][0], outer3['39'][0]]
if __name__ == '__main__':
pass
| 55.853448 | 92 | 0.551937 | 984 | 6,479 | 3.503049 | 0.14126 | 0.124746 | 0.16246 | 0.178706 | 0.537569 | 0.400928 | 0.08181 | 0.08181 | 0.08181 | 0.034813 | 0 | 0.217317 | 0.188918 | 6,479 | 115 | 93 | 56.33913 | 0.43863 | 0.09415 | 0 | 0 | 0 | 0 | 0.413092 | 0.37327 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.012048 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e729bb91e2c53d2213d9487ab5cf930f17e8340d | 63 | py | Python | individ2/__init__.py | work-acc/praktika17 | 62dbcd3d57fe0e559d91269f445874d2b3c7c867 | [
"MIT"
] | null | null | null | individ2/__init__.py | work-acc/praktika17 | 62dbcd3d57fe0e559d91269f445874d2b3c7c867 | [
"MIT"
] | null | null | null | individ2/__init__.py | work-acc/praktika17 | 62dbcd3d57fe0e559d91269f445874d2b3c7c867 | [
"MIT"
] | null | null | null | from .individ2 import Triangle # noqa
__all__ = ["individ2"] | 15.75 | 38 | 0.714286 | 7 | 63 | 5.857143 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.038462 | 0.174603 | 63 | 4 | 39 | 15.75 | 0.75 | 0.063492 | 0 | 0 | 0 | 0 | 0.137931 | 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 |
e75d40dcf2be4dcc94bb76ae0c40149f5634dfd1 | 2,539 | py | Python | pyrobolearn/models/nn/bnn.py | Pandinosaurus/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | [
"Apache-2.0"
] | 2 | 2021-01-21T21:08:30.000Z | 2022-03-29T16:45:49.000Z | pyrobolearn/models/nn/bnn.py | Pandinosaurus/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | [
"Apache-2.0"
] | null | null | null | pyrobolearn/models/nn/bnn.py | Pandinosaurus/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | [
"Apache-2.0"
] | 1 | 2020-09-29T21:25:39.000Z | 2020-09-29T21:25:39.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""Provide Bayesian Neural Networks.
This file provides Bayesian neural networks which add uncertainty to the the prediction of NNs. In a bayesian neural
network, the weights and biases have a prior probability distribution attached to them. The posterior distribution on
these parameters is computed after training the model on some data.
Several approaches to learning Bayesian neural networks have been proposed in the literature:
- Laplace approximation [5,4]
- Monte Carlo
- MC Dropout [8,9]
- Variational Inference (Bayes by Backprop [7,10])
References:
[1] "Deep Learning" (http://www.deeplearningbook.org/), Goodfellow et al., 2016
[2] PyTorch: https://pytorch.org/
[3] Pyro: https://pyro.ai/
[4] "Pattern Recognition and Machine Learning" (section 5.7), Bishop, 2006
[5] "Practical Bayesian Framework for Backpropagation Networks", MacKay, 1992
(https://authors.library.caltech.edu/13793/1/MACnc92b.pdf)
[6] "Bayesian Learning for Neural Networks" (PhD thesis), Neal, 1995
(http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.446.9306&rep=rep1&type=pdf)
[7] "Weight Uncertainty in Neural Networks", Blundell et al., 2015 (https://arxiv.org/abs/1505.05424)
[8] "Dropout as a Bayesian Approximation: Representing Model Uncertainty in Deep Learning", Gal et al., 2015
(https://arxiv.org/abs/1506.02142 and appendix: https://arxiv.org/abs/1506.02157)
[9] "Uncertainty in Deep Learning" (PhD thesis), Gal, 2016
[10] "A Comprehensive guide to Bayesian Convolutional Neural Network with Variational Inference", Shridhar et al.,
2019 (https://arxiv.org/pdf/1901.02731.pdf)
[11] Blog post: "Making your Neural Network Say 'I Don't Know' - Bayesian NNs using Pyro and PyTorch":
https://towardsdatascience.com/making-your-neural-network-say-i-dont-know-bayesian-nns-using-pyro-and-pytorch\
-b1c24e6ab8cd
Interesting implementations:
- https://github.com/kumar-shridhar/PyTorch-BayesianCNN
- https://github.com/anassinator/bnn
- https://github.com/paraschopra/bayesian-neural-network-mnist
"""
import torch
from pyrobolearn.models.nn.dnn import NN
__author__ = "Brian Delhaisse"
__copyright__ = "Copyright 2018, PyRoboLearn"
__credits__ = ["Brian Delhaisse"]
__license__ = "GNU GPLv3"
__version__ = "1.0.0"
__maintainer__ = "Brian Delhaisse"
__email__ = "briandelhaisse@gmail.com"
__status__ = "Development"
# TODO: implement
class BNN(NN):
r"""Bayesian Neural Networks"""
pass
| 43.775862 | 118 | 0.734541 | 348 | 2,539 | 5.267241 | 0.557471 | 0.045827 | 0.048009 | 0.026187 | 0.105837 | 0.092744 | 0.063284 | 0 | 0 | 0 | 0 | 0.057381 | 0.148878 | 2,539 | 57 | 119 | 44.54386 | 0.790838 | 0.855061 | 0 | 0 | 0 | 0 | 0.341808 | 0.067797 | 0 | 0 | 0 | 0.017544 | 0 | 1 | 0 | false | 0.071429 | 0.142857 | 0 | 0.214286 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
e76c7e9d659470ee6f03076b0d21983e775662b7 | 175 | py | Python | src/operations/credentials.py | DualKeysCeo/pyOS-v2 | caa66714231e59a071ff77547b1c82194dac2f0f | [
"MIT"
] | null | null | null | src/operations/credentials.py | DualKeysCeo/pyOS-v2 | caa66714231e59a071ff77547b1c82194dac2f0f | [
"MIT"
] | null | null | null | src/operations/credentials.py | DualKeysCeo/pyOS-v2 | caa66714231e59a071ff77547b1c82194dac2f0f | [
"MIT"
] | 1 | 2018-10-18T02:01:29.000Z | 2018-10-18T02:01:29.000Z | import os
def change(user, passw):
fp = open(os.path.dirname(__file__) + "\\..\\user\\user_login.info", "w+")
fp.write(user + "\n")
fp.write(passw)
fp.close() | 25 | 78 | 0.588571 | 26 | 175 | 3.769231 | 0.653846 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.182857 | 175 | 7 | 79 | 25 | 0.685315 | 0 | 0 | 0 | 0 | 0 | 0.176136 | 0.153409 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.333333 | 0.166667 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
e7795abcf7865f12ae017690ebb898fc593898c5 | 750 | py | Python | nanome/util/__init__.py | nezix/nanome-lib | e602cc9e63d1e2499c0f865da7ddbfbda44f0509 | [
"MIT"
] | 3 | 2020-07-02T13:08:27.000Z | 2021-11-24T14:32:53.000Z | nanome/util/__init__.py | nezix/nanome-lib | e602cc9e63d1e2499c0f865da7ddbfbda44f0509 | [
"MIT"
] | 11 | 2020-09-14T17:01:47.000Z | 2022-02-18T04:00:52.000Z | nanome/util/__init__.py | nezix/nanome-lib | e602cc9e63d1e2499c0f865da7ddbfbda44f0509 | [
"MIT"
] | 5 | 2020-08-12T16:30:03.000Z | 2021-12-06T18:04:23.000Z | # flake8: noqa
from . import *
# classes
from .string_builder import StringBuilder
from .color import Color
from .logs import Logs
from .enum import Enum, IntEnum, auto
try:
from .enum import reset_auto
except:
pass
try:
from .asyncio import async_callback
except:
pass
from . import enums
from . import complex_save_options
from .import_utils import ImportUtils
from .octree import Octree
from .quaternion import Quaternion
from .vector3 import Vector3
from .matrix import Matrix
from .file import FileMeta, FileError
from .file import DirectoryErrorCode, DirectoryRequestResult, DirectoryRequestOptions, FileErrorCode, FileData, FileSaveData, DirectoryEntry
from .process import Process
from .complex_utils import ComplexUtils
| 23.4375 | 140 | 0.802667 | 93 | 750 | 6.397849 | 0.451613 | 0.067227 | 0.047059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00471 | 0.150667 | 750 | 31 | 141 | 24.193548 | 0.929356 | 0.026667 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.083333 | 0.75 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
e779f2f3c2928684f034d82afbcd389f2ca9a01a | 4,343 | py | Python | ptth/tests/test_request.py | wagamama/python-ptth | 589f1d2bff178cc34ad2e71328c4a4d65e690df6 | [
"Apache-2.0"
] | null | null | null | ptth/tests/test_request.py | wagamama/python-ptth | 589f1d2bff178cc34ad2e71328c4a4d65e690df6 | [
"Apache-2.0"
] | 5 | 2015-09-10T15:51:01.000Z | 2015-12-11T13:55:37.000Z | ptth/tests/test_request.py | wagamama/python-ptth | 589f1d2bff178cc34ad2e71328c4a4d65e690df6 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import unittest
import ptth
class TestRequest(unittest.TestCase):
def test_dump(self):
r = ptth.Request('POST', '/',
headers=ptth.Headers({'a': 'b'}),
data='test')
self.assertEqual('POST / HTTP/1.1\r\n' +
'a: b\r\n' +
'\r\n' +
'test',
r.dump())
def test_dump_no_data(self):
r = ptth.Request('GET', '/',
headers=ptth.Headers({'a': 'b'}))
self.assertEqual('GET / HTTP/1.1\r\n' +
'a: b\r\n' +
'\r\n',
r.dump())
def test_dump_no_headers(self):
r = ptth.Request('GET', '/',
data='test data')
self.assertEqual('GET / HTTP/1.1\r\n' +
'\r\n' +
'test data',
r.dump())
def test_dump_default(self):
r = ptth.Request('POST', '/')
self.assertEqual('POST / HTTP/1.1\r\n' +
'\r\n',
r.dump())
def test_method_url(self):
r = ptth.Request('PUT', '/sample')
self.assertEqual('PUT', r.method)
self.assertEqual('/sample', r.url)
def test_headers(self):
r = ptth.Request('POST', '/',
headers=ptth.Headers({'a': 'b'}))
self.assertEqual('b', r.headers['a'])
def test_data(self):
r = ptth.Request('PUT', '/',
data='abcdefg\n')
self.assertEqual('abcdefg\n', r.data)
def test_load(self):
r = ptth.Request.load('POST /test HTTP/1.1\r\n' +
'header1: value1\r\n' +
'header2: value2\r\n' +
'\r\n' +
'this is request data\n')
self.assertIsNotNone(r)
self.assertEqual('POST', r.method)
self.assertEqual('/test', r.url)
self.assertEqual('value1', r.headers['header1'])
self.assertEqual('value2', r.headers['header2'])
self.assertEqual('this is request data\n', r.data)
def test_load_no_header_data(self):
r = ptth.Request.load('POST /test HTTP/1.1\r\n' +
'\r\n')
self.assertIsNotNone(r)
self.assertEqual('POST', r.method)
self.assertEqual('/test', r.url)
def test_load_no_data(self):
r = ptth.Request.load('POST /test HTTP/1.1\r\n' +
'header1: value1\r\n' +
'\r\n')
self.assertIsNotNone(r)
self.assertEqual('POST', r.method)
self.assertEqual('/test', r.url)
self.assertEqual('value1', r.headers['header1'])
def test_load_no_header(self):
r = ptth.Request.load('POST /test HTTP/1.1\r\n' +
'\r\n' +
'this is request data\n')
self.assertIsNotNone(r)
self.assertEqual('POST', r.method)
self.assertEqual('/test', r.url)
self.assertEqual('this is request data\n', r.data)
def test_load_wrong_method_url(self):
r = ptth.Request.load('GET/sample HTTP/1.1')
self.assertIsNone(r)
r = ptth.Request.load('GET/sample HTTP/1.1\r\n')
self.assertIsNone(r)
r = ptth.Request.load('GET/sample HTTP/1.1\r\n' +
'header1: value1\r\n' +
'\r\n')
self.assertIsNone(r)
def test_load_wrong_header(self):
r = ptth.Request.load('POST /test HTTP/1.1\r\n' +
'header1: value1\r\n')
self.assertIsNone(r)
def test_load_data_with_CRLF(self):
r = ptth.Request.load('GET /sample HTTP/1.1\r\n' +
'header1: value1\r\n' +
'\r\n' +
'\r\n' +
'this is data')
self.assertIsNotNone(r)
self.assertEqual('GET', r.method)
self.assertEqual('/sample', r.url)
self.assertEqual('value1', r.headers['header1'])
self.assertEqual('\r\nthis is data', r.data)
if __name__ == '__main__':
unittest.main()
| 35.598361 | 58 | 0.461202 | 501 | 4,343 | 3.912176 | 0.097804 | 0.031633 | 0.097959 | 0.114286 | 0.845408 | 0.762755 | 0.709184 | 0.659694 | 0.57398 | 0.57398 | 0 | 0.01759 | 0.384757 | 4,343 | 121 | 59 | 35.892562 | 0.715943 | 0.004835 | 0 | 0.621359 | 0 | 0 | 0.178935 | 0 | 0 | 0 | 0 | 0 | 0.330097 | 1 | 0.135922 | false | 0 | 0.019417 | 0 | 0.165049 | 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 |
e78aad7911706bf611188817b3f294e25fd50e16 | 1,091 | py | Python | {{cookiecutter.project_name}}/{{cookiecutter.app_name}}/api/v1/views.py | rajeshkaushik/cookiecutter-flask-restplus | f5cc9e8af027d3166b0ba4eacbfc33a7bc735a78 | [
"MIT"
] | 2 | 2019-09-16T07:53:12.000Z | 2021-07-16T10:05:18.000Z | {{cookiecutter.project_name}}/{{cookiecutter.app_name}}/api/v1/views.py | rajeshkaushik/cookiecutter-flask-restplus | f5cc9e8af027d3166b0ba4eacbfc33a7bc735a78 | [
"MIT"
] | null | null | null | {{cookiecutter.project_name}}/{{cookiecutter.app_name}}/api/v1/views.py | rajeshkaushik/cookiecutter-flask-restplus | f5cc9e8af027d3166b0ba4eacbfc33a7bc735a78 | [
"MIT"
] | null | null | null | from flask_restplus import fields
from flask import request
from {{cookiecutter.app_name}}.custom_resource import CustomResource as Resource
from {{cookiecutter.app_name}}.api import ns
from {{cookiecutter.app_name}}.custom_error_message import custom_abort
model_find_lead = ns.model('find_lead', {
"firstName": fields.String(required=False),
"lastName": fields.String(required=False),
"emailAddress": fields.String(required=False),
"phoneNumber": fields.String(required=False),
'facilityID': fields.String(required=False),
"tokenID": fields.String(required=True),
'dataSourceID': fields.String(required=False),
'outreachCode': fields.String(required=False),
})
@ns.route('/lead', methods=['GET'])
class Lead(Resource):
@ns.expect(model_find_lead, validate=True)
def get(self):
"""
Get {{cookiecutter.app_name}} from Engage
"""
data = request.json
if not data:
custom_abort(
400, 'Empty input data', 'Empty input data'
)
return {'lead': request.json}, 200
| 31.171429 | 80 | 0.67461 | 127 | 1,091 | 5.677165 | 0.401575 | 0.133148 | 0.221914 | 0.242718 | 0.080444 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00681 | 0.192484 | 1,091 | 34 | 81 | 32.088235 | 0.811578 | 0 | 0 | 0 | 0 | 0 | 0.130604 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.2 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e7984b1da7a188b02cfe7cab1078b42abc424e30 | 1,500 | py | Python | conf/constant.py | Heisenberg2017/LogColorizer | 61ac64d1e4e8b1cc4d0e3104d25ff20d7ce39262 | [
"MIT"
] | null | null | null | conf/constant.py | Heisenberg2017/LogColorizer | 61ac64d1e4e8b1cc4d0e3104d25ff20d7ce39262 | [
"MIT"
] | null | null | null | conf/constant.py | Heisenberg2017/LogColorizer | 61ac64d1e4e8b1cc4d0e3104d25ff20d7ce39262 | [
"MIT"
] | null | null | null | # coding=utf-8
font = {
"black": "\033[30m{content}\033[0m",
"red": "\033[31m{content}\033[0m",
"green": "\033[32m{content}\033[0m",
"yellow": "\033[33m{content}\033[0m",
"blue": "\033[34m{content}\033[0m",
"purple ": "\033[35m{content}\033[0m",
"celeste": "\033[36m{content}\033[0m",
"white": "\033[37m{content}\033[0m"
}
font_background = {
"black": "\033[40;37m{content}\033[0m",
"read": "\033[41;37m{content}\033[0m",
"green": "\033[42;37m{content}\033[0m",
"yellow": "\033[43;37m{content}\033[0m",
"blue": "\033[44;37m{content}\033[0m",
"purple": "\033[45;37m{content}\033[0m",
"celeste": "\033[46;37m{content}\033[0m",
"white": "\033[47;30m{content}\033[0m",
}
# % echo -e '\u2620' # \u takes four hexadecimal digits
# ☠
# % echo -e '\U0001f602' # \U takes eight hexadecimal digits
emoji = {
"warn": u"\u26A0\uFE0F INFO",
"earth": u"\U0001F310",
"project": u"\U0001F4C1",
"keystone": u"\U0001F510",
"glance": u"\U0001F4BF",
"nova": u"\U0001F31F",
"edit": u"\U0001F4DD",
"fire": u"\U0001F525",
"exec": u"\U0001F5A5",
"failed": u"\U0001F621",
"succeed": u"\U0001F600",
"clock": u"\U0001F552",
"horizon": u"\U0001F579",
}
if __name__ == '__main__':
for k, v in font.items():
print(v.format(content='test...'))
for k, v in font_background.items():
print(v.format(content='test...'))
for k, v in emoji.items():
print("%s: %s" % (k, v))
| 27.777778 | 60 | 0.559333 | 206 | 1,500 | 4.029126 | 0.412621 | 0.192771 | 0.231325 | 0.144578 | 0.398795 | 0.084337 | 0.084337 | 0.084337 | 0.084337 | 0.084337 | 0 | 0.208574 | 0.191333 | 1,500 | 53 | 61 | 28.301887 | 0.474856 | 0.086 | 0 | 0.047619 | 0 | 0 | 0.533724 | 0.29912 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.071429 | 0 | 0 | 0 | null | 0 | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e7ba20530f17d356fe812ecada0df8cc5b475aef | 424 | py | Python | pascal/core/ast.py | yngtodd/pascal | 7c19eea08eaaaf16a12e454bd24762603e292c2c | [
"BSD-3-Clause"
] | null | null | null | pascal/core/ast.py | yngtodd/pascal | 7c19eea08eaaaf16a12e454bd24762603e292c2c | [
"BSD-3-Clause"
] | null | null | null | pascal/core/ast.py | yngtodd/pascal | 7c19eea08eaaaf16a12e454bd24762603e292c2c | [
"BSD-3-Clause"
] | 1 | 2019-12-25T15:12:29.000Z | 2019-12-25T15:12:29.000Z | class AST:
""" Base class for abstract syntax trees """
pass
class BinOp(AST):
""" Binary operation for abstract syntax trees """
def __init__(self, left, op, right):
self.left = left
self.op = op
self.right = right
class Num(AST):
""" Node for numbers in abstract syntax trees """
def __init__(self, token):
self.token = token
self.value = token.value
| 19.272727 | 54 | 0.59434 | 54 | 424 | 4.518519 | 0.425926 | 0.172131 | 0.233607 | 0.180328 | 0.245902 | 0.245902 | 0 | 0 | 0 | 0 | 0 | 0 | 0.29717 | 424 | 21 | 55 | 20.190476 | 0.818792 | 0.290094 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0.090909 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
e7cf2c36a1d4aaef99b93c385a10d1654f2804f9 | 19,359 | py | Python | utils.py | calebjcourtney/adventofcode_2019 | 309a4af955174338da0900d5c7823683e7e13ddb | [
"MIT"
] | null | null | null | utils.py | calebjcourtney/adventofcode_2019 | 309a4af955174338da0900d5c7823683e7e13ddb | [
"MIT"
] | null | null | null | utils.py | calebjcourtney/adventofcode_2019 | 309a4af955174338da0900d5c7823683e7e13ddb | [
"MIT"
] | null | null | null | from collections import Counter, defaultdict
import networkx as nx
from typing import List
from enum import Enum
import math
def read_data() -> str:
return open('input.txt', 'r').read()
# DAY 1 #
def get_recursive_fuel(mass: int) -> int:
# from day 1, calculates the fuel (recursively) required based on mass size given
fuel = (mass // 3) - 2
return 0 if fuel < 0 else fuel + get_recursive_fuel(fuel)
#### DAY 4 ####
def has_adjacent_characters(text: str, count: int = 2) -> bool:
# checks to see if there are two characters next to each other
c = "".join([key for key, value in Counter(text).items() if value == count])
for x in c:
if x * count in text:
return True
return False
def has_exactly_count(text: str, count: int) -> bool:
# checks a string for if character occurs count times
return count in Counter(text).values() # thanks coandco for the idea here
def string_never_decreasing(text: str) -> bool:
# checks to see if the text of a string is always increasing
for x in range(len(text) - 1):
if text[x + 1] < text[x]:
return False
return True
###### DAY 6 ######
def count_orbit_connections(input_data: List[List]):
graph = nx.DiGraph()
graph.add_edges_from(input_data)
orbit_count = sum([predecessor_count(node, graph) for node in graph.nodes])
return orbit_count
def predecessor_count(node, graph) -> int:
predecessors = list(graph.predecessors(node))
predecessors_sum = len(predecessors)
# recursion actually worked on this problem!
return sum([predecessors_sum + predecessor_count(pred, graph) for pred in predecessors])
def get_distance_between_objects(input_data: List[List], first_object: str, second_object: str) -> int:
graph = nx.Graph()
graph.add_edges_from(input_data)
path = nx.shortest_path(graph, first_object, second_object)
return len(path)
########## DAY 10 ##########
def get_angle(point_one, point_two):
return math.degrees(math.atan2(point_one.x - point_two.x, point_one.y - point_two.y) % (2 * math.pi))
def get_distance(point_one, point_two):
return math.sqrt((point_one.x - point_two.x) ** 2 + (point_one.y - point_two.y) ** 2)
############ DAY 12 ############
def least_common_multiple(x, y):
return x // math.gcd(x, y) * y
class Moon:
def __init__(
self,
x: int,
y: int,
z: int,
velocity_x: int = 0,
velocity_y: int = 0,
velocity_z: int = 0
):
self.x = x
self.y = y
self.z = z
self.velocity_x = velocity_x
self.velocity_y = velocity_y
self.velocity_z = velocity_z
def shift_moon(self):
self.x += self.velocity_x
self.y += self.velocity_y
self.z += self.velocity_z
def calculate_potential_energy(self) -> int:
return abs(self.x) + abs(self.y) + abs(self.z)
def calculate_kinetic_energy(self) -> int:
return abs(self.velocity_x) + abs(self.velocity_y) + abs(self.velocity_z)
def calculate_total_energy(self) -> int:
return self.calculate_potential_energy() * self.calculate_kinetic_energy()
@staticmethod
def apply_gravity(moon_a, moon_b) -> None:
# change x values
if moon_a.x > moon_b.x:
moon_a.velocity_x -= 1
moon_b.velocity_x += 1
elif moon_a.x < moon_b.x:
moon_a.velocity_x += 1
moon_b.velocity_x -= 1
# change y values
if moon_a.y > moon_b.y:
moon_a.velocity_y -= 1
moon_b.velocity_y += 1
elif moon_a.y < moon_b.y:
moon_a.velocity_y += 1
moon_b.velocity_y -= 1
# change z values
if moon_a.z > moon_b.z:
moon_a.velocity_z -= 1
moon_b.velocity_z += 1
elif moon_a.z < moon_b.z:
moon_a.velocity_z += 1
moon_b.velocity_z -= 1
############### DAYS 2, 5, 7, 9, 11 - will probably be heavily used ################
class State(Enum):
INIT = 1
LIVE = 2
HALT = 99
class IntCodeComputer:
def __init__(self, codes: List) -> None:
self.code = defaultdict(int, enumerate(codes)) # thanks Peter200lx
self.inputs = []
self.default_input = 0
self.outputs = []
self.cursorPos = 0
self.debug = False
self.modes = []
self.relativebase = 0
self.opmapping = {
1: self.op_add,
2: self.op_mutliplication,
3: self.op_input,
4: self.op_output,
5: self.op_jumpiftrue,
6: self.op_jumpiffalse,
7: self.op_lessthan,
8: self.op_equals,
9: self.op_relativebase,
99: self.op_kill
}
self.state = State.INIT
def input(self, in_value: int):
# this allows for multiple inputs into the program, which will be used and removed one by one
self.inputs.append(in_value)
return self
def set_input(self, in_value: int):
# this allows for multiple inputs into the program
self.default_input = in_value
return self
def _inc(self, i: int = 1) -> None:
self.cursorPos += i
def set_debugger(self, debug: bool = True):
self.debug = debug
return self
def debug_print(self, op_name, message) -> None:
if self.debug and op_name == 'output':
print(f"{self.cursorPos - 1}: {op_name} -> {message}")
def _next_instruction(self):
instruction = self.code[self.cursorPos]
modes, opcode = divmod(instruction, 100)
self.modes = [int(x) for x in reversed(str(modes))]
self._inc()
return opcode
def _next_mode(self):
if len(self.modes) > 0:
return self.modes.pop(0)
return 0
def _get_parameter(self):
value = self.code[self.cursorPos]
mode = self._next_mode()
# Position Mode
if mode == 0:
value = self.code[value]
# Immediate Mode
elif mode == 1:
pass
elif mode == 2:
value = self.code[self.relativebase + value]
else:
raise Exception(f"Invalid Mode: {mode}")
self._inc()
return value
def _get_dest_parameter(self):
value = self.code[self.cursorPos]
mode = self._next_mode() # Throw away
if mode == 1:
raise Exception(f"Mode for get dest parameter {mode}")
self._inc()
value += (self.relativebase if mode == 2 else 0)
return value
def run(self) -> int or None:
if self.state == State.LIVE:
raise Exception("This is already live. What are you doing?")
self.state = State.LIVE
while self.state == State.LIVE:
op = self._next_instruction()
if op in self.opmapping:
self.opmapping[op]()
else:
print(f"unknown opcode {op} at cursorPos {self.cursorPos - 1}: {self.code[self.cursorPos - 1]}")
print(self.code)
return None
return self.outputs
def op_add(self) -> None:
arg1 = self._get_parameter()
arg2 = self._get_parameter()
pos = self._get_dest_parameter()
self.debug_print('add', f"value({self.code[pos]}) in pos({pos}) -> {arg1 + arg2}")
self.code[pos] = arg1 + arg2
def op_mutliplication(self) -> None:
arg1 = self._get_parameter()
arg2 = self._get_parameter()
pos = self._get_dest_parameter()
self.debug_print('multiply', f"value({self.code[pos]}) in pos({pos}) -> {arg1 * arg2}")
self.code[pos] = arg1 * arg2
def op_input(self) -> None:
pos = self._get_dest_parameter()
try:
new_val = self.inputs.pop(0)
except IndexError:
new_val = self.default_input
self.code[pos] = new_val
self.debug_print('input', f"pos({pos}) = {self.code[pos]}")
def op_output(self) -> int:
output_val = self._get_parameter()
self.debug_print('output', f"adding({output_val}) to last item in outputs")
self.outputs.append(output_val)
def op_jumpiftrue(self) -> None:
arg1 = self._get_parameter()
arg2 = self._get_parameter()
if arg1 == 1:
self.cursorPos = arg2
def op_jumpiffalse(self) -> None:
arg1 = self._get_parameter()
arg2 = self._get_parameter()
if arg1 == 0:
self.cursorPos = arg2
def op_lessthan(self) -> None:
arg1 = self._get_parameter()
arg2 = self._get_parameter()
pos = self._get_dest_parameter()
self.code[pos] = 1 if arg1 < arg2 else 0
def op_equals(self) -> None:
arg1 = self._get_parameter()
arg2 = self._get_parameter()
pos = self._get_dest_parameter()
self.code[pos] = 1 if arg1 == arg2 else 0
def op_relativebase(self):
arg1 = self._get_parameter()
self.debug_print('relativebase', f"modifying relbase value({self.relativebase}) -> {self.relativebase + arg1}")
self.relativebase += arg1
def op_kill(self):
self.debug_print("kill", "killing the computer")
self.state = State.HALT
class PaintingBot(IntCodeComputer):
"""docstring for PaintingBot"""
def run(self) -> int or None:
self.state = State.LIVE
while len(self.outputs) < 2:
op = self._next_instruction()
if op in self.opmapping:
self.opmapping[op]()
else:
print(f"unknown opcode {op} at cursorPos {self.cursorPos - 1}: {self.code[self.cursorPos - 1]}")
print(self.code)
return None
return self.outputs
########################## TESTS ##########################
def test_recursivefuel():
assert(get_recursive_fuel(12) == 2)
assert(get_recursive_fuel(14) == 2)
assert(get_recursive_fuel(1969) == 966)
assert(get_recursive_fuel(100756) == 50346)
def test_adjacent_characters():
assert(has_adjacent_characters('free') is True)
assert(has_adjacent_characters('free', 3) is False)
def test_stringdecreasing():
assert(string_never_decreasing('free') is False)
assert(string_never_decreasing('abc') is True)
assert(string_never_decreasing('123abc') is True)
def test_countorbitconn():
day6_sample = [
["COM", "B"],
["B", "C"],
["C", "D"],
["D", "E"],
["E", "F"],
["B", "G"],
["G", "H"],
["D", "I"],
["E", "J"],
["J", "K"],
["K", "L"]
]
assert(count_orbit_connections(day6_sample) == 42)
def test_distancebetweenobjects():
day6_sample = [
["COM", "B"],
["B", "C"],
["C", "D"],
["D", "E"],
["E", "F"],
["B", "G"],
["G", "H"],
["D", "I"],
["E", "J"],
["J", "K"],
["K", "L"],
["K", "YOU"],
["I", "SAN"]
]
assert(get_distance_between_objects(day6_sample, "YOU", "SAN") == 7)
def test_intcodecomputer():
sample1 = [3, 225, 1, 225, 6, 6, 1100, 1, 238, 225, 104, 0, 1101, 33, 37, 225, 101, 6, 218, 224, 1001, 224, -82, 224, 4, 224, 102, 8, 223, 223, 101, 7, 224, 224, 1, 223, 224, 223, 1102, 87, 62, 225, 1102, 75, 65, 224, 1001, 224, -4875, 224, 4, 224, 1002, 223, 8, 223, 1001, 224, 5, 224, 1, 224, 223, 223, 1102, 49, 27, 225, 1101, 6, 9, 225, 2, 69, 118, 224, 101, -300, 224, 224, 4, 224, 102, 8, 223, 223, 101, 6, 224, 224, 1, 224, 223, 223, 1101, 76, 37, 224, 1001, 224, -113, 224, 4, 224, 1002, 223, 8, 223, 101, 5, 224, 224, 1, 224, 223, 223, 1101, 47, 50, 225, 102, 43, 165, 224, 1001, 224, -473, 224, 4, 224, 102, 8, 223, 223, 1001, 224, 3, 224, 1, 224, 223, 223, 1002, 39, 86, 224, 101, -7482, 224, 224, 4, 224, 102, 8, 223, 223, 1001, 224, 6, 224, 1, 223, 224, 223, 1102, 11, 82, 225, 1, 213, 65, 224, 1001, 224, -102, 224, 4, 224, 1002, 223, 8, 223, 1001, 224, 6, 224, 1, 224, 223, 223, 1001, 14, 83, 224, 1001, 224, -120, 224, 4, 224, 1002, 223, 8, 223, 101, 1, 224, 224, 1, 223, 224, 223, 1102, 53, 39, 225, 1101, 65, 76, 225, 4, 223, 99, 0, 0, 0, 677, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1105, 0, 99999, 1105, 227, 247, 1105, 1, 99999, 1005, 227, 99999, 1005, 0, 256, 1105, 1, 99999, 1106, 227, 99999, 1106, 0, 265, 1105, 1, 99999, 1006, 0, 99999, 1006, 227, 274, 1105, 1, 99999, 1105, 1, 280, 1105, 1, 99999, 1, 225, 225, 225, 1101, 294, 0, 0, 105, 1, 0, 1105, 1, 99999, 1106, 0, 300, 1105, 1, 99999, 1, 225, 225, 225, 1101, 314, 0, 0, 106, 0, 0, 1105, 1, 99999, 1107, 677, 226, 224, 1002, 223, 2, 223, 1005, 224, 329, 101, 1, 223, 223, 8, 677, 226, 224, 102, 2, 223, 223, 1006, 224, 344, 1001, 223, 1, 223, 108, 677, 677, 224, 1002, 223, 2, 223, 1006, 224, 359, 1001, 223, 1, 223, 1108, 226, 677, 224, 102, 2, 223, 223, 1006, 224, 374, 1001, 223, 1, 223, 1008, 677, 226, 224, 102, 2, 223, 223, 1005, 224, 389, 101, 1, 223, 223, 7, 226, 677, 224, 102, 2, 223, 223, 1005, 224, 404, 1001, 223, 1, 223, 1007, 677, 677, 224, 1002, 223, 2, 223, 1006, 224, 419, 101, 1, 223, 223, 107, 677, 226, 224, 102, 2, 223, 223, 1006, 224, 434, 101, 1, 223, 223, 7, 677, 677, 224, 1002, 223, 2, 223, 1005, 224, 449, 101, 1, 223, 223, 108, 677, 226, 224, 1002, 223, 2, 223, 1006, 224, 464, 101, 1, 223, 223, 1008, 226, 226, 224, 1002, 223, 2, 223, 1006, 224, 479, 101, 1, 223, 223, 107, 677, 677, 224, 1002, 223, 2, 223, 1006, 224, 494, 1001, 223, 1, 223, 1108, 677, 226, 224, 102, 2, 223, 223, 1005, 224, 509, 101, 1, 223, 223, 1007, 226, 677, 224, 102, 2, 223, 223, 1005, 224, 524, 1001, 223, 1, 223, 1008, 677, 677, 224, 102, 2, 223, 223, 1005, 224, 539, 1001, 223, 1, 223, 1107, 677, 677, 224, 1002, 223, 2, 223, 1006, 224, 554, 1001, 223, 1, 223, 1007, 226, 226, 224, 1002, 223, 2, 223, 1005, 224, 569, 1001, 223, 1, 223, 7, 677, 226, 224, 1002, 223, 2, 223, 1006, 224, 584, 1001, 223, 1, 223, 108, 226, 226, 224, 102, 2, 223, 223, 1005, 224, 599, 1001, 223, 1, 223, 8, 677, 677, 224, 102, 2, 223, 223, 1005, 224, 614, 1001, 223, 1, 223, 1107, 226, 677, 224, 102, 2, 223, 223, 1005, 224, 629, 1001, 223, 1, 223, 8, 226, 677, 224, 102, 2, 223, 223, 1006, 224, 644, 1001, 223, 1, 223, 1108, 226, 226, 224, 1002, 223, 2, 223, 1006, 224, 659, 101, 1, 223, 223, 107, 226, 226, 224, 1002, 223, 2, 223, 1006, 224, 674, 1001, 223, 1, 223, 4, 223, 99, 226]
result = IntCodeComputer(sample1).set_input(1).run()
assert(result[-1] == 16209841)
# result = IntCodeComputer(sample1).set_input(5).run()
# assert(result[-1] == 8834787)
sample2 = [109, 1, 204, -1, 1001, 100, 1, 100, 1008, 100, 16, 101, 1006, 101, 0, 99]
result = IntCodeComputer(sample2).set_input(1).run()
for x in range(len(sample2)):
assert(result[x] == sample2[x])
sample3 = [1102, 34463338, 34463338, 63, 1007, 63, 34463338, 63, 1005, 63, 53, 1101, 3, 0, 1000, 109, 988, 209, 12, 9, 1000, 209, 6, 209, 3, 203, 0, 1008, 1000, 1, 63, 1005, 63, 65, 1008, 1000, 2, 63, 1005, 63, 904, 1008, 1000, 0, 63, 1005, 63, 58, 4, 25, 104, 0, 99, 4, 0, 104, 0, 99, 4, 17, 104, 0, 99, 0, 0, 1101, 25, 0, 1016, 1102, 760, 1, 1023, 1102, 1, 20, 1003, 1102, 1, 22, 1015, 1102, 1, 34, 1000, 1101, 0, 32, 1006, 1101, 21, 0, 1017, 1102, 39, 1, 1010, 1101, 30, 0, 1005, 1101, 0, 1, 1021, 1101, 0, 0, 1020, 1102, 1, 35, 1007, 1102, 1, 23, 1014, 1102, 1, 29, 1019, 1101, 767, 0, 1022, 1102, 216, 1, 1025, 1102, 38, 1, 1011, 1101, 778, 0, 1029, 1102, 1, 31, 1009, 1101, 0, 28, 1004, 1101, 33, 0, 1008, 1102, 1, 444, 1027, 1102, 221, 1, 1024, 1102, 1, 451, 1026, 1101, 787, 0, 1028, 1101, 27, 0, 1018, 1101, 0, 24, 1013, 1102, 26, 1, 1012, 1101, 0, 36, 1002, 1102, 37, 1, 1001, 109, 28, 21101, 40, 0, -9, 1008, 1019, 41, 63, 1005, 63, 205, 1001, 64, 1, 64, 1105, 1, 207, 4, 187, 1002, 64, 2, 64, 109, -9, 2105, 1, 5, 4, 213, 1106, 0, 225, 1001, 64, 1, 64, 1002, 64, 2, 64, 109, -9, 1206, 10, 243, 4, 231, 1001, 64, 1, 64, 1105, 1, 243, 1002, 64, 2, 64, 109, -3, 1208, 2, 31, 63, 1005, 63, 261, 4, 249, 1106, 0, 265, 1001, 64, 1, 64, 1002, 64, 2, 64, 109, 5, 21108, 41, 41, 0, 1005, 1012, 287, 4, 271, 1001, 64, 1, 64, 1105, 1, 287, 1002, 64, 2, 64, 109, 6, 21102, 42, 1, -5, 1008, 1013, 45, 63, 1005, 63, 307, 1105, 1, 313, 4, 293, 1001, 64, 1, 64, 1002, 64, 2, 64, 109, -9, 1201, 0, 0, 63, 1008, 63, 29, 63, 1005, 63, 333, 1106, 0, 339, 4, 319, 1001, 64, 1, 64, 1002, 64, 2, 64, 109, -13, 2102, 1, 4, 63, 1008, 63, 34, 63, 1005, 63, 361, 4, 345, 1105, 1, 365, 1001, 64, 1, 64, 1002, 64, 2, 64, 109, 5, 1201, 7, 0, 63, 1008, 63, 33, 63, 1005, 63, 387, 4, 371, 1105, 1, 391, 1001, 64, 1, 64, 1002, 64, 2, 64, 109, 7, 1202, 1, 1, 63, 1008, 63, 32, 63, 1005, 63, 411, 1105, 1, 417, 4, 397, 1001, 64, 1, 64, 1002, 64, 2, 64, 109, 20, 1205, -7, 431, 4, 423, 1106, 0, 435, 1001, 64, 1, 64, 1002, 64, 2, 64, 109, 2, 2106, 0, -3, 1001, 64, 1, 64, 1105, 1, 453, 4, 441, 1002, 64, 2, 64, 109, -7, 21101, 43, 0, -9, 1008, 1014, 43, 63, 1005, 63, 479, 4, 459, 1001, 64, 1, 64, 1105, 1, 479, 1002, 64, 2, 64, 109, -5, 21108, 44, 43, 0, 1005, 1018, 495, 1105, 1, 501, 4, 485, 1001, 64, 1, 64, 1002, 64, 2, 64, 109, -7, 1205, 9, 517, 1001, 64, 1, 64, 1105, 1, 519, 4, 507, 1002, 64, 2, 64, 109, 11, 1206, -1, 531, 1106, 0, 537, 4, 525, 1001, 64, 1, 64, 1002, 64, 2, 64, 109, -15, 1208, 0, 36, 63, 1005, 63, 557, 1001, 64, 1, 64, 1106, 0, 559, 4, 543, 1002, 64, 2, 64, 109, 7, 2101, 0, -7, 63, 1008, 63, 35, 63, 1005, 63, 581, 4, 565, 1106, 0, 585, 1001, 64, 1, 64, 1002, 64, 2, 64, 109, -3, 21107, 45, 46, 4, 1005, 1015, 607, 4, 591, 1001, 64, 1, 64, 1105, 1, 607, 1002, 64, 2, 64, 109, -16, 2102, 1, 10, 63, 1008, 63, 31, 63, 1005, 63, 631, 1001, 64, 1, 64, 1106, 0, 633, 4, 613, 1002, 64, 2, 64, 109, 1, 2107, 33, 10, 63, 1005, 63, 649, 1106, 0, 655, 4, 639, 1001, 64, 1, 64, 1002, 64, 2, 64, 109, 17, 2101, 0, -9, 63, 1008, 63, 31, 63, 1005, 63, 679, 1001, 64, 1, 64, 1106, 0, 681, 4, 661, 1002, 64, 2, 64, 109, -6, 2107, 34, 0, 63, 1005, 63, 703, 4, 687, 1001, 64, 1, 64, 1106, 0, 703, 1002, 64, 2, 64, 109, 5, 1207, -5, 34, 63, 1005, 63, 719, 1105, 1, 725, 4, 709, 1001, 64, 1, 64, 1002, 64, 2, 64, 109, -15, 1202, 6, 1, 63, 1008, 63, 20, 63, 1005, 63, 751, 4, 731, 1001, 64, 1, 64, 1105, 1, 751, 1002, 64, 2, 64, 109, 21, 2105, 1, 5, 1001, 64, 1, 64, 1106, 0, 769, 4, 757, 1002, 64, 2, 64, 109, 5, 2106, 0, 5, 4, 775, 1001, 64, 1, 64, 1106, 0, 787, 1002, 64, 2, 64, 109, -27, 1207, 4, 35, 63, 1005, 63, 809, 4, 793, 1001, 64, 1, 64, 1106, 0, 809, 1002, 64, 2, 64, 109, 13, 2108, 33, -1, 63, 1005, 63, 831, 4, 815, 1001, 64, 1, 64, 1106, 0, 831, 1002, 64, 2, 64, 109, 4, 21107, 46, 45, 1, 1005, 1014, 851, 1001, 64, 1, 64, 1105, 1, 853, 4, 837, 1002, 64, 2, 64, 109, 3, 21102, 47, 1, -3, 1008, 1013, 47, 63, 1005, 63, 875, 4, 859, 1106, 0, 879, 1001, 64, 1, 64, 1002, 64, 2, 64, 109, -9, 2108, 28, 2, 63, 1005, 63, 895, 1106, 0, 901, 4, 885, 1001, 64, 1, 64, 4, 64, 99, 21101, 27, 0, 1, 21102, 1, 915, 0, 1106, 0, 922, 21201, 1, 59074, 1, 204, 1, 99, 109, 3, 1207, -2, 3, 63, 1005, 63, 964, 21201, -2, -1, 1, 21102, 942, 1, 0, 1105, 1, 922, 21201, 1, 0, -1, 21201, -2, -3, 1, 21102, 1, 957, 0, 1105, 1, 922, 22201, 1, -1, -2, 1106, 0, 968, 22102, 1, -2, -2, 109, -3, 2105, 1, 0]
result = IntCodeComputer(sample3).set_input(1).run()
print(result)
assert(result[-1] == 3518157894)
| 45.125874 | 4,381 | 0.568418 | 3,187 | 19,359 | 3.36743 | 0.167869 | 0.01789 | 0.020872 | 0.026836 | 0.403187 | 0.336657 | 0.264816 | 0.245248 | 0.22596 | 0.157753 | 0 | 0.314194 | 0.262307 | 19,359 | 428 | 4,382 | 45.231308 | 0.437294 | 0.040343 | 0 | 0.276451 | 0 | 0.006826 | 0.039279 | 0.006628 | 0 | 0 | 0 | 0 | 0.047782 | 1 | 0.153584 | false | 0.003413 | 0.017065 | 0.027304 | 0.290102 | 0.044369 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e7d2b4d44f67ab65bee6fec45e1ecdcc70d5a674 | 158 | py | Python | packet-classification/node.py | danibachar/datastream-with-skip-list | c45e6a47b79acc75d6ea513c26881b43320a088c | [
"MIT"
] | null | null | null | packet-classification/node.py | danibachar/datastream-with-skip-list | c45e6a47b79acc75d6ea513c26881b43320a088c | [
"MIT"
] | null | null | null | packet-classification/node.py | danibachar/datastream-with-skip-list | c45e6a47b79acc75d6ea513c26881b43320a088c | [
"MIT"
] | null | null | null | # Wrapper node Model
# Holds the rules and associated key
class Node:
def __init__(self, rules, key) -> None:
self.rules = rules
self.key = key
| 22.571429 | 41 | 0.664557 | 23 | 158 | 4.391304 | 0.608696 | 0.178218 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.246835 | 158 | 6 | 42 | 26.333333 | 0.84874 | 0.335443 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
99bc62e23296f0fd8f20e052967bb8e9923bf495 | 359 | py | Python | python/function/make_pizzas.py | letitgone/python-crash-course | 2551f2977f2814393fc4f44b8e2f20bdcc20141b | [
"MIT"
] | null | null | null | python/function/make_pizzas.py | letitgone/python-crash-course | 2551f2977f2814393fc4f44b8e2f20bdcc20141b | [
"MIT"
] | null | null | null | python/function/make_pizzas.py | letitgone/python-crash-course | 2551f2977f2814393fc4f44b8e2f20bdcc20141b | [
"MIT"
] | null | null | null | # @Author ZhangGJ
# @Date 2020/12/28 23:11
from pizza import make_pizza
import person
from gavin import function as fu
from formatted_name import get_formatted_name as name
from greeter import *
print(make_pizza('test'))
print(person.build_person('test1', 'test2'))
print(fu.person)
print(name('test1', 'test2'))
print(get_formatted_name('test1', 'test2'))
| 23.933333 | 53 | 0.766017 | 56 | 359 | 4.767857 | 0.464286 | 0.146067 | 0.11985 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05625 | 0.108635 | 359 | 14 | 54 | 25.642857 | 0.778125 | 0.10585 | 0 | 0 | 0 | 0 | 0.106918 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0.5 | 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 | 0 | 1 | 0 | 3 |
99c684b0db2b05295322a1865a64eb1eb29080ff | 124 | py | Python | list_tuple/10.py | mdazharuddin1011999/IoT_Assignment_2 | aea8cd6938ac1021b37aebb837a493e5613015e7 | [
"MIT"
] | null | null | null | list_tuple/10.py | mdazharuddin1011999/IoT_Assignment_2 | aea8cd6938ac1021b37aebb837a493e5613015e7 | [
"MIT"
] | null | null | null | list_tuple/10.py | mdazharuddin1011999/IoT_Assignment_2 | aea8cd6938ac1021b37aebb837a493e5613015e7 | [
"MIT"
] | null | null | null | from math import pi, exp
consts = (pi, exp)
print("Area of circle is:", consts[0]*int(input("Enter radius of circle: "))**2) | 41.333333 | 80 | 0.677419 | 22 | 124 | 3.818182 | 0.772727 | 0.119048 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018692 | 0.137097 | 124 | 3 | 80 | 41.333333 | 0.766355 | 0 | 0 | 0 | 0 | 0 | 0.336 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
99d57ad7127ec9bbf66e5aee8f646fea47b73bd2 | 341 | py | Python | fplassist/admin.py | mdameenh/elysia | ff173f036d13c179191a75c3d54e47314435bc28 | [
"BSD-3-Clause"
] | null | null | null | fplassist/admin.py | mdameenh/elysia | ff173f036d13c179191a75c3d54e47314435bc28 | [
"BSD-3-Clause"
] | 3 | 2020-02-11T23:32:55.000Z | 2021-06-10T19:02:19.000Z | fplassist/admin.py | mdameenh/elysia | ff173f036d13c179191a75c3d54e47314435bc28 | [
"BSD-3-Clause"
] | null | null | null | from django.contrib import admin
# Register your models here.
from .models import Team_Info, Player_Info, Player_Basic_Stats, Player_Detailed_Stats, FPL_Config
admin.site.register(Team_Info)
admin.site.register(Player_Info)
admin.site.register(Player_Basic_Stats)
admin.site.register(Player_Detailed_Stats)
admin.site.register(FPL_Config)
| 31 | 97 | 0.847507 | 51 | 341 | 5.392157 | 0.352941 | 0.163636 | 0.309091 | 0.250909 | 0.196364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.070381 | 341 | 10 | 98 | 34.1 | 0.867508 | 0.076246 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.285714 | 0 | 0.285714 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
99db426911c176e1d4a8fa660b86d5b5a5e085db | 56 | py | Python | example/exampleapp/__init__.py | etanttila/django-lti-login | 2d27010946f96094e42008aa54240e965e7b7e95 | [
"MIT"
] | 2 | 2018-06-05T12:30:04.000Z | 2020-09-14T12:04:18.000Z | example/exampleapp/__init__.py | etanttila/django-lti-login | 2d27010946f96094e42008aa54240e965e7b7e95 | [
"MIT"
] | null | null | null | example/exampleapp/__init__.py | etanttila/django-lti-login | 2d27010946f96094e42008aa54240e965e7b7e95 | [
"MIT"
] | 2 | 2021-06-23T14:09:44.000Z | 2021-09-09T14:30:20.000Z | default_app_config = 'exampleapp.apps.ExampleAppConfig'
| 28 | 55 | 0.857143 | 6 | 56 | 7.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.053571 | 56 | 1 | 56 | 56 | 0.867925 | 0 | 0 | 0 | 0 | 0 | 0.571429 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
99e5101b47fc27ea39fdbe16a984b58cbe8b2289 | 157 | py | Python | Curso-em-video-Python/PycharmProjects/pythonExercicios/ex025 - SILVA.py | sartinicj/curso-em-video-python | 8cb4ca05a88351c44aa4a7befc59c9596a50f268 | [
"MIT"
] | null | null | null | Curso-em-video-Python/PycharmProjects/pythonExercicios/ex025 - SILVA.py | sartinicj/curso-em-video-python | 8cb4ca05a88351c44aa4a7befc59c9596a50f268 | [
"MIT"
] | null | null | null | Curso-em-video-Python/PycharmProjects/pythonExercicios/ex025 - SILVA.py | sartinicj/curso-em-video-python | 8cb4ca05a88351c44aa4a7befc59c9596a50f268 | [
"MIT"
] | null | null | null | nome = input('Digite o nome: ')
print('Tem Silva no nome digitado? {}'.format('SILVA' in nome))
#print('Seu nome tem Silva? {}'.format(nome[:5] == 'SILVA')) | 39.25 | 63 | 0.636943 | 24 | 157 | 4.166667 | 0.541667 | 0.18 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007353 | 0.133758 | 157 | 4 | 64 | 39.25 | 0.727941 | 0.375796 | 0 | 0 | 0 | 0 | 0.510204 | 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 |
99eb20ae382e2201cf7b93ea9b52b2a6a3e62501 | 17,763 | py | Python | tests/unit/test_generator__context.py | RerrerBuub/asciidoxy | 3402f37d59e30975e9919653465839e396f05513 | [
"Apache-2.0"
] | 14 | 2020-04-28T08:51:43.000Z | 2022-02-12T13:40:34.000Z | tests/unit/test_generator__context.py | RerrerBuub/asciidoxy | 3402f37d59e30975e9919653465839e396f05513 | [
"Apache-2.0"
] | 47 | 2020-05-18T14:19:31.000Z | 2022-03-04T13:46:46.000Z | tests/unit/test_generator__context.py | RerrerBuub/asciidoxy | 3402f37d59e30975e9919653465839e396f05513 | [
"Apache-2.0"
] | 8 | 2020-05-17T20:52:42.000Z | 2022-02-25T16:16:01.000Z | # Copyright (C) 2019-2021, TomTom (http://tomtom.com).
#
# 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.
"""Tests for the generator's context."""
import pytest
from pathlib import Path
from asciidoxy.generator.context import StackFrame, stacktrace
from asciidoxy.generator.errors import ConsistencyError, DuplicateAnchorError, UnknownAnchorError
from asciidoxy.generator.navigation import DocumentTreeNode
from .builders import make_compound
def test_create_sub_context(empty_context):
context = empty_context
context.namespace = "ns"
context.language = "lang"
context.source_language = "java"
context.warnings_are_errors = True
context.multipage = True
context.embedded = True
context.env.variable = 42
sub = context.sub_context()
assert sub is not context
assert sub.base_dir == context.base_dir
assert sub.namespace == "ns"
assert sub.language == "lang"
assert sub.source_language == "java"
assert sub.env is not context.env
assert sub.env.variable == 42
assert sub.warnings_are_errors is True
assert sub.multipage is True
assert sub.embedded is True
assert sub.reference is context.reference
assert sub.progress is context.progress
assert sub.linked is context.linked
assert sub.inserted is context.inserted
assert sub.anchors is context.anchors
assert sub.in_to_out_file_map is context.in_to_out_file_map
assert sub.embedded_file_map is context.embedded_file_map
assert sub.current_document is context.current_document
assert sub.current_package is context.current_package
assert sub.call_stack is context.call_stack
assert sub.insert_filter is not context.insert_filter
sub.namespace = "other"
sub.language = "objc"
sub.source_language = "python"
sub.env.variable = 50
assert context.namespace == "ns"
assert context.language == "lang"
assert context.source_language == "java"
assert context.env.variable == 42
assert "element" not in context.linked
assert "element" not in context.inserted
sub.linked["element"].append([])
sub.inserted["element"] = Path("path")
assert "element" in context.linked
assert "element" in context.inserted
def test_file_with_element__different_file(empty_context):
empty_context.multipage = True
empty_context.current_document.in_file = Path("file_1.adoc")
empty_context.insert(make_compound(language="lang", name="type1"))
empty_context.insert(make_compound(language="lang", name="type2"))
empty_context.current_document.in_file = Path("file_2.adoc")
empty_context.insert(make_compound(language="lang", name="type3"))
empty_context.insert(make_compound(language="lang", name="type4"))
assert empty_context.file_with_element("lang-type1") == Path("file_1.adoc")
assert empty_context.file_with_element("lang-type2") == Path("file_1.adoc")
def test_file_with_element__same_file(empty_context):
empty_context.multipage = True
empty_context.current_document.in_file = Path("file_1.adoc")
empty_context.insert(make_compound(language="lang", name="type1"))
empty_context.insert(make_compound(language="lang", name="type2"))
empty_context.current_document.in_file = Path("file_2.adoc")
empty_context.insert(make_compound(language="lang", name="type3"))
empty_context.insert(make_compound(language="lang", name="type4"))
assert empty_context.file_with_element("lang-type3") is None
assert empty_context.file_with_element("lang-type4") is None
def test_file_with_element__not_in_singlepage(empty_context):
empty_context.multipage = False
empty_context.current_document.in_file = Path("file_1.adoc")
empty_context.insert(make_compound(language="lang", name="type1"))
empty_context.insert(make_compound(language="lang", name="type2"))
empty_context.current_document.in_file = Path("file_2.adoc")
empty_context.insert(make_compound(language="lang", name="type3"))
empty_context.insert(make_compound(language="lang", name="type4"))
assert empty_context.file_with_element("lang-type1") is None
assert empty_context.file_with_element("lang-type2") is None
assert empty_context.file_with_element("lang-type3") is None
assert empty_context.file_with_element("lang-type4") is None
def test_file_with_element__element_not_found(empty_context):
empty_context.multipage = True
assert empty_context.file_with_element("element-id-1") is None
def test_register_adoc_file(empty_context, input_file):
out_file = empty_context.register_adoc_file(input_file)
assert out_file.parent == input_file.parent
assert out_file.name.endswith(input_file.name)
assert out_file.name.startswith(".asciidoxy.")
assert out_file != input_file
def test_register_adoc_file__always_returns_same_file(empty_context, input_file):
out_file = empty_context.register_adoc_file(input_file)
assert empty_context.register_adoc_file(input_file) == out_file
def test_register_adoc_file__embedded(empty_context, input_file):
empty_context.embedded = True
embedded_file = input_file.with_name("embedded.adoc")
out_file = empty_context.register_adoc_file(embedded_file)
assert out_file.parent == embedded_file.parent
assert out_file.name.endswith(embedded_file.name)
assert out_file.name.startswith(".asciidoxy.")
assert out_file != embedded_file
def test_register_adoc_file__embedded__always_returns_same_file(empty_context, input_file):
empty_context.embedded = True
embedded_file = input_file.with_name("embedded.adoc")
out_file = empty_context.register_adoc_file(embedded_file)
assert empty_context.register_adoc_file(embedded_file) == out_file
def test_register_adoc_file__embedded__different_file_when_embedded_in_different_file(
empty_context, input_file):
empty_context.embedded = True
embedded_file = input_file.with_name("embedded.adoc")
out_file = empty_context.register_adoc_file(embedded_file)
other_input_file = input_file.with_name("other_file.adoc")
empty_context.current_document.in_file = other_input_file
assert empty_context.register_adoc_file(embedded_file) != out_file
def test_link_to_adoc_file__singlepage__known_file(empty_context, input_file):
linked_file = input_file.with_name("linked_file.adoc")
linked_out_file = empty_context.register_adoc_file(linked_file)
assert empty_context.link_to_adoc_file(linked_file) == linked_out_file.relative_to(
input_file.parent)
def test_link_to_adoc_file__singlepage__unknown_file(empty_context, input_file):
linked_file = input_file.with_name("linked_file.adoc")
assert empty_context.link_to_adoc_file(linked_file) == linked_file.relative_to(
input_file.parent)
def test_link_to_adoc_file__singlepage__embedded_file(empty_context, input_file):
empty_context.embedded = True
linked_file = input_file.with_name("linked_file.adoc")
linked_out_file = empty_context.register_adoc_file(linked_file)
empty_context.embedded = False
assert empty_context.link_to_adoc_file(linked_file) == linked_out_file.relative_to(
input_file.parent)
def test_link_to_adoc_file__multipage__known_file(empty_context, input_file):
empty_context.multipage = True
linked_file = input_file.with_name("linked_file.adoc")
empty_context.register_adoc_file(linked_file)
assert empty_context.link_to_adoc_file(linked_file) == linked_file.relative_to(
input_file.parent)
def test_link_to_adoc_file__multipage__unknown_file(empty_context, input_file):
empty_context.multipage = True
linked_file = input_file.with_name("linked_file.adoc")
assert empty_context.link_to_adoc_file(linked_file) == linked_file.relative_to(
input_file.parent)
def test_link_to_adoc_file__multipage__embedded_file(empty_context, input_file):
empty_context.multipage = True
empty_context.embedded = True
linked_file = input_file.with_name("linked_file.adoc")
linked_out_file = empty_context.register_adoc_file(linked_file)
empty_context.embedded = False
assert empty_context.link_to_adoc_file(linked_file) == linked_out_file.relative_to(
input_file.parent)
def test_docinfo_footer_file__singlepage(empty_context, input_file):
footer_file = empty_context.docinfo_footer_file()
assert footer_file.parent == input_file.parent
assert footer_file.name == f".asciidoxy.{input_file.stem}-docinfo-footer.html"
def test_docinfo_footer_file__singlepage__included(empty_context, input_file):
empty_context.register_adoc_file(input_file)
included_file = input_file.with_name("sub_doc.adoc")
empty_context.current_document = DocumentTreeNode(included_file, empty_context.current_document)
empty_context.register_adoc_file(included_file)
footer_file = empty_context.docinfo_footer_file()
assert footer_file.parent == input_file.parent
assert footer_file.name == f".asciidoxy.{input_file.stem}-docinfo-footer.html"
def test_docinfo_footer_file__singlepage__embedded(empty_context, input_file):
empty_context.register_adoc_file(input_file)
embedded_file = input_file.with_name("sub_doc.adoc")
empty_context.embedded = True
empty_context.register_adoc_file(embedded_file)
footer_file = empty_context.docinfo_footer_file()
assert footer_file.parent == input_file.parent
assert footer_file.name == f".asciidoxy.{input_file.stem}-docinfo-footer.html"
def test_docinfo_footer_file__multipage(empty_context, input_file):
empty_context.multipage = True
footer_file = empty_context.docinfo_footer_file()
assert footer_file.parent == input_file.parent
assert footer_file.name == f".asciidoxy.{input_file.stem}-docinfo-footer.html"
def test_docinfo_footer_file__multipage__included(empty_context, input_file):
empty_context.multipage = True
empty_context.register_adoc_file(input_file)
included_file = input_file.with_name("sub_doc.adoc")
empty_context.current_document = DocumentTreeNode(included_file, empty_context.current_document)
empty_context.register_adoc_file(included_file)
footer_file = empty_context.docinfo_footer_file()
assert footer_file.parent == input_file.parent
assert footer_file.name == f".asciidoxy.{included_file.stem}-docinfo-footer.html"
def test_docinfo_footer_file__multipage__embedded(empty_context, input_file):
empty_context.multipage = True
empty_context.register_adoc_file(input_file)
embedded_file = input_file.with_name("sub_doc.adoc")
empty_context.embedded = True
empty_context.register_adoc_file(embedded_file)
footer_file = empty_context.docinfo_footer_file()
assert footer_file.parent == input_file.parent
assert footer_file.name == f".asciidoxy.{input_file.stem}-docinfo-footer.html"
def test_register_and_link_to_anchor__same_file(empty_context, input_file):
empty_context.register_anchor("my-anchor", "anchor text", input_file)
assert empty_context.link_to_anchor("my-anchor") == (Path(input_file.name), "anchor text")
def test_register_and_link_to_anchor__different_file(empty_context, input_file):
other_file = input_file.with_name("other.adoc")
empty_context.register_anchor("my-anchor", "anchor text", other_file)
assert empty_context.link_to_anchor("my-anchor") == (Path(other_file.name), "anchor text")
def test_register_and_link_to_anchor__no_link_text(empty_context, input_file):
empty_context.register_anchor("my-anchor", None, input_file)
assert empty_context.link_to_anchor("my-anchor") == (Path(input_file.name), None)
def test_register_anchor__duplicate_name(empty_context, input_file):
empty_context.register_anchor("my-anchor", None, input_file)
with pytest.raises(DuplicateAnchorError):
empty_context.register_anchor("my-anchor", None, input_file)
def test_link_to_anchor__unknown(empty_context, input_file):
with pytest.raises(UnknownAnchorError):
empty_context.link_to_anchor("my-anchor")
def test_link_to_element__single_link(empty_context, input_file):
empty_context.push_stack("link(\"MyElement\")", input_file, "INPUT")
empty_context.link_to_element("my-element-id")
empty_context.pop_stack()
assert "my-element-id" in empty_context.linked
assert empty_context.linked["my-element-id"] == [
[
StackFrame("link(\"MyElement\")", input_file, "INPUT", False),
],
]
def test_link_to_element__multiple_links(empty_context, input_file):
empty_context.push_stack("link(\"MyElement\")", input_file, "INPUT")
empty_context.link_to_element("my-element-id")
empty_context.pop_stack()
other_file = input_file.parent / "other_file.adoc"
empty_context.push_stack("link(\"MyElement\")", other_file, "INPUT")
empty_context.link_to_element("my-element-id")
empty_context.pop_stack()
assert "my-element-id" in empty_context.linked
assert empty_context.linked["my-element-id"] == [
[
StackFrame("link(\"MyElement\")", input_file, "INPUT", False),
],
[
StackFrame("link(\"MyElement\")", other_file, "INPUT", False),
],
]
def test_link_to_element__nested_call_stack(empty_context, input_file):
empty_context.push_stack("include(\"other_file.adoc\")", input_file, "INPUT")
other_file = input_file.parent / "other_file.adoc"
empty_context.push_stack("insert(\"MyElement\")", other_file)
empty_context.push_stack("link(\"OtherElement\")")
empty_context.link_to_element("other-element-id")
empty_context.pop_stack()
empty_context.pop_stack()
empty_context.pop_stack()
assert "other-element-id" in empty_context.linked
assert empty_context.linked["other-element-id"] == [
[
StackFrame("include(\"other_file.adoc\")", input_file, "INPUT", False),
StackFrame("insert(\"MyElement\")", other_file, None, False),
StackFrame("link(\"OtherElement\")", None, None, False),
],
]
def test_insert__store_stacktrace(empty_context, input_file):
empty_context.push_stack("include(\"other_file.adoc\")", input_file, "INPUT")
element = make_compound(id="cpp-my_element", name="MyElement")
empty_context.insert(element)
empty_context.pop_stack()
assert element.id in empty_context.inserted
assert empty_context.inserted[element.id] == (input_file, [
StackFrame("include(\"other_file.adoc\")", input_file, "INPUT", False),
])
def test_insert__duplicate(empty_context, input_file):
empty_context.warnings_are_errors = True
element = make_compound(id="cpp-my_element", name="MyElement")
other_file = input_file.parent / "other_file.adoc"
empty_context.push_stack("include(\"other_file.adoc\")", input_file)
empty_context.insert(element)
empty_context.pop_stack()
empty_context.push_stack("insert(\"MyElement\")", other_file)
with pytest.raises(ConsistencyError) as exc_info:
empty_context.insert(element)
empty_context.pop_stack()
assert exc_info.value.msg == f"""\
Duplicate insertion of MyElement.
Trying to insert at:
Commands in input files:
{other_file}:
insert("MyElement")
Previously inserted at:
Commands in input files:
{input_file}:
include("other_file.adoc")"""
def test_stacktrace__external_only(input_file):
other_file = input_file.parent / "other_file.adoc"
trace = [
StackFrame("include('other_file.adoc')", input_file, "INPUT", False),
StackFrame("insert('MyElement')", other_file, "INPUT", False),
]
assert stacktrace(trace) == f"""\
Commands in input files:
{input_file}:
include('other_file.adoc')
{other_file}:
insert('MyElement')"""
def test_stacktrace__external_only__other_package(input_file):
other_file = input_file.parent / "other_file.adoc"
trace = [
StackFrame("include('other_file.adoc')", input_file, "pkga", False),
StackFrame("insert('MyElement')", other_file, "pkgb", False),
]
assert stacktrace(trace) == f"""\
Commands in input files:
pkga:/{input_file}:
include('other_file.adoc')
pkgb:/{other_file}:
insert('MyElement')"""
def test_stacktrace__external_and_internal(input_file):
other_file = input_file.parent / "other_file.adoc"
trace = [
StackFrame("include('other_file.adoc')", input_file, "INPUT", False),
StackFrame("insert('MyElement')", other_file, "INPUT", False),
StackFrame("insert('OtherElement')", None, None, True),
StackFrame("link('GreatElement')", None, None, True),
]
assert stacktrace(trace) == f"""\
Commands in input files:
{input_file}:
include('other_file.adoc')
{other_file}:
insert('MyElement')
Internal AsciiDoxy commands:
insert('OtherElement')
link('GreatElement')"""
def test_stacktrace__internal_only(input_file):
trace = [
StackFrame("insert('OtherElement')", None, None, True),
StackFrame("link('GreatElement')", None, None, True),
]
assert stacktrace(trace) == """\
Internal AsciiDoxy commands:
insert('OtherElement')
link('GreatElement')"""
def test_stacktrace__empty(input_file):
assert stacktrace([]) == ""
| 37.238994 | 100 | 0.752294 | 2,384 | 17,763 | 5.239094 | 0.080956 | 0.152762 | 0.069175 | 0.045396 | 0.789992 | 0.75004 | 0.713931 | 0.696237 | 0.653002 | 0.614492 | 0 | 0.003211 | 0.140911 | 17,763 | 476 | 101 | 37.317227 | 0.815269 | 0.034228 | 0 | 0.543027 | 0 | 0 | 0.144308 | 0.032736 | 0 | 0 | 0 | 0 | 0.249258 | 1 | 0.109792 | false | 0 | 0.017804 | 0 | 0.127596 | 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 |
99fc6185b4ec43fedc91c63d6bbfde62f5f149c7 | 7,935 | py | Python | Projects/HerdImmunity/simulation.py | AbdullahNoori/CS-1.1-Intro-to-Programming | 3b3ab4a7ff5c44ce9d74df767a8d5d3cf2a3ee2e | [
"MIT"
] | null | null | null | Projects/HerdImmunity/simulation.py | AbdullahNoori/CS-1.1-Intro-to-Programming | 3b3ab4a7ff5c44ce9d74df767a8d5d3cf2a3ee2e | [
"MIT"
] | null | null | null | Projects/HerdImmunity/simulation.py | AbdullahNoori/CS-1.1-Intro-to-Programming | 3b3ab4a7ff5c44ce9d74df767a8d5d3cf2a3ee2e | [
"MIT"
] | null | null | null | import random, sys
random.seed(42)
from person import Person
from logger import Logger
from virus import Virus
class Simulation(object):
''' Main class that will run the herd immunity simulation program.
Expects initialization parameters passed as command line arguments when file is run.
Simulates the spread of a virus through a given population. The percentage of the
population that are vaccinated, the size of the population, and the amount of initially
infected people in a population are all variables that can be set when the program is run.
'''
def __init__(self, pop_size, vacc_percentage, initial_infected=1, virus):
''' Logger object logger records all events during the simulation.
Population represents all Persons in the population.
The next_person_id is the next available id for all created Persons,
and should have a unique _id value.
The vaccination percentage represents the total percentage of population
vaccinated at the start of the simulation.
You will need to keep track of the number of people currently infected with the disease.
The total infected people is the running total that have been infected since the
simulation began, including the currently infected people who died.
You will also need to keep track of the number of people that have die as a result
of the infection.
All arguments will be passed as command-line arguments when the file is run.
HINT: Look in the if __name__ == "__main__" function at the bottom.
'''
# TODO: Create a Logger object and bind it to self.logger.
# Remember to call the appropriate logger method in the corresponding parts of the simulation.
# TODO: Call self._create_population() and pass in the correct parameters.
# Store the array that this method will return in the self.population attribute.
# TODO: Store each newly infected person's ID in newly_infected attribute.
# At the end of each time step, call self._infect_newly_infected()
# and then reset .newly_infected back to an empty list.
self.logger = None
self.population = [] # List of Person objects
self.pop_size = pop_size # Int
self.next_person_id = 0 # Int
self.virus = virus # Virus object
self.initial_infected = initial_infected # Int
self.total_infected = 0 # Int
self.current_infected = 0 # Int
self.vacc_percentage = vacc_percentage # float between 0 and 1
self.total_dead = 0 # Int
self.file_name = "{}_simulation_pop_{}_vp_{}_infected_{}.txt".format(
virus_name, population_size, vacc_percentage, initial_infected)
self.newly_infected = []
def _create_population(self, initial_infected):
'''This method will create the initial population.
Args:
initial_infected (int): The number of infected people that the simulation
will begin with.
Returns:
list: A list of Person objects.
'''
# TODO: Finish this method! This method should be called when the simulation
# begins, to create the population that will be used. This method should return
# an array filled with Person objects that matches the specifications of the
# simulation (correct number of people in the population, correct percentage of
# people vaccinated, correct number of initially infected people).
# Use the attributes created in the init method to create a population that has
# the correct intial vaccination percentage and initial infected.
pass
def _simulation_should_continue(self):
''' The simulation should only end if the entire population is dead
or everyone is vaccinated.
Returns:
bool: True for simulation should continue, False if it should end.
'''
# TODO: Complete this helper method. Returns a Boolean.
pass
def run(self):
''' This method should run the simulation until all requirements for ending
the simulation are met.
'''
# TODO: Finish this method. To simplify the logic here, use the helper method
# _simulation_should_continue() to tell us whether or not we should continue
# the simulation and run at least 1 more time_step.
# TODO: Keep track of the number of time steps that have passed.
# HINT: You may want to call the logger's log_time_step() method at the end of each time step.
# TODO: Set this variable using a helper
time_step_counter = 0
should_continue = None
while should_continue:
# TODO: for every iteration of this loop, call self.time_step() to compute another
# round of this simulation.
print('The simulation has ended after {time_step_counter} turns.'.format(time_step_counter))
pass
def time_step(self):
''' This method should contain all the logic for computing one time step
in the simulation.
This includes:
1. 100 total interactions with a randon person for each infected person
in the population
2. If the person is dead, grab another random person from the population.
Since we don't interact with dead people, this does not count as an interaction.
3. Otherwise call simulation.interaction(person, random_person) and
increment interaction counter by 1.
'''
# TODO: Finish this method.
pass
def interaction(self, person, random_person):
'''This method should be called any time two living people are selected for an
interaction. It assumes that only living people are passed in as parameters.
Args:
person1 (person): The initial infected person
random_person (person): The person that person1 interacts with.
'''
# Assert statements are included to make sure that only living people are passed
# in as params
assert person.is_alive == True
assert random_person.is_alive == True
# TODO: Finish this method.
# The possible cases you'll need to cover are listed below:
# random_person is vaccinated:
# nothing happens to random person.
# random_person is already infected:
# nothing happens to random person.
# random_person is healthy, but unvaccinated:
# generate a random number between 0 and 1. If that number is smaller
# than repro_rate, random_person's ID should be appended to
# Simulation object's newly_infected array, so that their .infected
# attribute can be changed to True at the end of the time step.
# TODO: Call slogger method during this method.
pass
def _infect_newly_infected(self):
''' This method should iterate through the list of ._id stored in self.newly_infected
and update each Person object with the disease. '''
# TODO: Call this method at the end of every time step and infect each Person.
# TODO: Once you have iterated through the entire list of self.newly_infected, remember
# to reset self.newly_infected back to an empty list.
pass
if __name__ == "__main__":
params = sys.argv[1:]
virus_name = str(params[0])
repro_num = float(params[1])
mortality_rate = float(params[2])
pop_size = int(params[3])
vacc_percentage = float(params[4])
if len(params) == 6:
initial_infected = int(params[5])
else:
initial_infected = 1
virus = Virus(name, repro_rate, mortality_rate)
sim = Simulation(pop_size, vacc_percentage, initial_infected, virus)
sim.run()
| 46.133721 | 102 | 0.668683 | 1,069 | 7,935 | 4.859682 | 0.254443 | 0.026949 | 0.018479 | 0.0077 | 0.112223 | 0.092397 | 0.061983 | 0.041963 | 0.01309 | 0 | 0 | 0.005427 | 0.280151 | 7,935 | 171 | 103 | 46.403509 | 0.904062 | 0.323503 | 0 | 0.115385 | 0 | 0 | 0.046664 | 0.018317 | 0 | 0 | 0 | 0.040936 | 0.038462 | 0 | null | null | 0.115385 | 0.076923 | null | null | 0.019231 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
820c78b8eb4c73745c010e6088567e9599acd10a | 338 | py | Python | tr/vendor/bup/lib/bup/path.py | DentonGentry/gfiber-catawampus | b01e4444f3c7f12b1af7837203b37060fd443bb7 | [
"Apache-2.0"
] | 2 | 2017-10-03T16:06:29.000Z | 2020-09-08T13:03:13.000Z | tr/vendor/bup/lib/bup/path.py | DentonGentry/gfiber-catawampus | b01e4444f3c7f12b1af7837203b37060fd443bb7 | [
"Apache-2.0"
] | null | null | null | tr/vendor/bup/lib/bup/path.py | DentonGentry/gfiber-catawampus | b01e4444f3c7f12b1af7837203b37060fd443bb7 | [
"Apache-2.0"
] | 1 | 2017-05-07T17:39:02.000Z | 2017-05-07T17:39:02.000Z | """This is a separate module so we can cleanly getcwd() before anyone
does chdir().
"""
import sys, os
startdir = os.getcwd()
def exe():
return (os.environ.get('BUP_MAIN_EXE') or
os.path.join(startdir, sys.argv[0]))
def exedir():
return os.path.split(exe())[0]
def exefile():
return os.path.split(exe())[1]
| 19.882353 | 69 | 0.633136 | 53 | 338 | 4 | 0.641509 | 0.113208 | 0.113208 | 0.160377 | 0.188679 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01107 | 0.198225 | 338 | 16 | 70 | 21.125 | 0.771218 | 0.236686 | 0 | 0 | 0 | 0 | 0.048387 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.111111 | 0.333333 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
82119cb1c74f70232711cfbedb9085b76c266f29 | 520 | py | Python | tasks-deploy/qr-pano/generate.py | chankruze/qctf-school-2018 | 1e732cf264ee0a94bc2fc1fd8cf3a20660d57605 | [
"MIT"
] | null | null | null | tasks-deploy/qr-pano/generate.py | chankruze/qctf-school-2018 | 1e732cf264ee0a94bc2fc1fd8cf3a20660d57605 | [
"MIT"
] | null | null | null | tasks-deploy/qr-pano/generate.py | chankruze/qctf-school-2018 | 1e732cf264ee0a94bc2fc1fd8cf3a20660d57605 | [
"MIT"
] | null | null | null | TITLE = 'Красивое место'
STATEMENT = '''
Солнце над Зоной — редкое явление.
Но в те дни, когда оно пробивается из-за туч, можно заметить интересную особенность: его свет не похож на то, к чему привыкли люди до катастрофы. Более того, порой оно высвечивает то, что сложно увидеть в обычном сумраке затянутого облаками неба.
В один такой день, восхищённый внезапно открывшейся панорамой, я сделал [фотоснимок](/static/files/7bjf8qvcne/photo.jpg).
'''
def generate(context):
return TaskStatement(TITLE, STATEMENT)
| 43.333333 | 247 | 0.773077 | 74 | 520 | 5.445946 | 0.918919 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004535 | 0.151923 | 520 | 11 | 248 | 47.272727 | 0.907029 | 0 | 0 | 0 | 0 | 0.25 | 0.813462 | 0.094231 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0 | 0.125 | 0.25 | 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 | 1 | 0 | 0 | 0 | 3 |
821a89e42dd159404ae9d3107beeb31ff717707b | 1,732 | py | Python | cfgtree/storages/anyconfig.py | Stibbons/cfgtree | 77454c2fde6092d555403deb1feee9746b6700b7 | [
"MIT"
] | null | null | null | cfgtree/storages/anyconfig.py | Stibbons/cfgtree | 77454c2fde6092d555403deb1feee9746b6700b7 | [
"MIT"
] | 2 | 2018-01-27T21:25:09.000Z | 2018-01-27T21:25:27.000Z | cfgtree/storages/anyconfig.py | Stibbons/cfgtree | 77454c2fde6092d555403deb1feee9746b6700b7 | [
"MIT"
] | null | null | null | # coding: utf-8
# Standard Libraries
import logging
from pathlib import Path
from typing import Dict
# Third Party Libraries
import anyconfig
# Cfgtree modules
from cfgtree.storages._single_file import SingleFileStorage
log = logging.getLogger(__name__)
class AnyConfigStorage(SingleFileStorage):
"""
Settings are stored in a single file handled by AnyConfig.
Supported file formats:
- JSON
- INI
- YAML (if ruamel.yaml is installed)
- TOML (if toml is installed)
Usage:
.. code-block:: python
class MyAppConfig(ConfigBaseModel):
environ_var_prefix = "MYAPP_"
cmd_line_parser = # ...
model = {
"configfile": ConfigFileCfg(default_filename="config.yaml",
long_param="--config-file", summary="Config file"),
# ...
}
"""
default_filename = None
"""Default filename for the configuration file (handled by anyconfig)
Example::
myconfig.yaml
"""
environ_var = None
"""Environment variable to set the configuration file name
Example::
DOPPLERR_COMMON_CONFIG_FILE="myconfig.yaml"
"""
short_param = None
"""Short parameter to specify the configure file name
Example::
-g myconfig.yaml
"""
long_param = None
"""Short parameter to specify the configure file name
Example::
--config-file myconfig.yaml
"""
def load_bare_config(self, config_file_path: Path):
return anyconfig.load(config_file_path.absolute().as_posix())
def save_bare_config_dict(self, bare_cfg: Dict):
return anyconfig.dump(bare_cfg, self.get_config_file())
| 21.121951 | 95 | 0.635104 | 190 | 1,732 | 5.610526 | 0.494737 | 0.065666 | 0.042214 | 0.041276 | 0.110694 | 0.110694 | 0.110694 | 0.110694 | 0.110694 | 0.110694 | 0 | 0.000799 | 0.277136 | 1,732 | 81 | 96 | 21.382716 | 0.850639 | 0.341801 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.133333 | false | 0 | 0.333333 | 0.133333 | 0.933333 | 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 |
82461e54a58ec29ab026ef040d4c619296df7140 | 161 | py | Python | side experiment/api.py | AlexGogev/My-Projects | e7cd57f443c9ba99f855c9e5c11a4bb46418d4f9 | [
"MIT"
] | null | null | null | side experiment/api.py | AlexGogev/My-Projects | e7cd57f443c9ba99f855c9e5c11a4bb46418d4f9 | [
"MIT"
] | null | null | null | side experiment/api.py | AlexGogev/My-Projects | e7cd57f443c9ba99f855c9e5c11a4bb46418d4f9 | [
"MIT"
] | null | null | null | import requests
import json
for i in range(10):
response = requests.get(url="https://catfact.ninja/fact")
data = response.json()
print(data["fact"]) | 23 | 61 | 0.677019 | 23 | 161 | 4.73913 | 0.73913 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014925 | 0.167702 | 161 | 7 | 62 | 23 | 0.798507 | 0 | 0 | 0 | 0 | 0 | 0.185185 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.166667 | 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 |
412e79d4a00454b620747d0dee850484b10d85b3 | 179 | py | Python | submission/run.py | kevinmooreiii/moldriver | 65a0a9cef8971737076f81720a61aa5b607333d2 | [
"Apache-2.0"
] | null | null | null | submission/run.py | kevinmooreiii/moldriver | 65a0a9cef8971737076f81720a61aa5b607333d2 | [
"Apache-2.0"
] | null | null | null | submission/run.py | kevinmooreiii/moldriver | 65a0a9cef8971737076f81720a61aa5b607333d2 | [
"Apache-2.0"
] | null | null | null | import read_dat
PARAMS = read_dat.params('params.dat')
for attr in dir(PARAMS):
if '__' not in attr:
print(attr, getattr(PARAMS, attr), type(getattr(PARAMS, attr)))
| 22.375 | 71 | 0.675978 | 27 | 179 | 4.333333 | 0.481481 | 0.119658 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.184358 | 179 | 7 | 72 | 25.571429 | 0.80137 | 0 | 0 | 0 | 0 | 0 | 0.067039 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.2 | 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 |
4148db2912f25880e3c9643af4f4e11188ccc7c3 | 165 | py | Python | ex021.py | LucasLCarreira/Python | 03bd64837d74315687e567261a149f0176496348 | [
"MIT"
] | 1 | 2020-04-21T19:14:50.000Z | 2020-04-21T19:14:50.000Z | ex021.py | LucasLCarreira/Python | 03bd64837d74315687e567261a149f0176496348 | [
"MIT"
] | null | null | null | ex021.py | LucasLCarreira/Python | 03bd64837d74315687e567261a149f0176496348 | [
"MIT"
] | null | null | null | # Exercício Python 020
# Programa que abra e reproduza um arquivo mp3
from pygame import mixer
mixer.init()
mixer.music.load('ex021.mp3')
mixer.music.play()
input()
| 20.625 | 46 | 0.763636 | 26 | 165 | 4.846154 | 0.807692 | 0.15873 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.055556 | 0.127273 | 165 | 7 | 47 | 23.571429 | 0.819444 | 0.393939 | 0 | 0 | 0 | 0 | 0.092784 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 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 |
415596664036c2c88bf1dbd9bae52f1cc5defa13 | 335 | py | Python | pyhfo/io/__init__.py | andersonbrisil/pyhfo | 0fdbe834442550117dc9d9c8f611989bb600db62 | [
"MIT"
] | null | null | null | pyhfo/io/__init__.py | andersonbrisil/pyhfo | 0fdbe834442550117dc9d9c8f611989bb600db62 | [
"MIT"
] | null | null | null | pyhfo/io/__init__.py | andersonbrisil/pyhfo | 0fdbe834442550117dc9d9c8f611989bb600db62 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 16 19:04:40 2015
@author: anderson
io __init__ : Input-Output Module
"""
from o_functions import save_dataset
from i_functions import open_dataset, loadRDH, loadMAT, loadSPK_waveclus
from converting import converting_intan_directory
from read_header import read_header
| 18.611111 | 72 | 0.752239 | 47 | 335 | 5.085106 | 0.765957 | 0.125523 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047101 | 0.176119 | 335 | 18 | 73 | 18.611111 | 0.818841 | 0.334328 | 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 |
4167cf8757bd4fce9808bfe490bd7ed3653f3af3 | 290 | py | Python | lib/disco/schemes/scheme_http.py | jgrnt/disco | 83874d93e74491c15699233865880ffb9ca7c2a0 | [
"BSD-3-Clause"
] | 786 | 2015-01-01T12:35:40.000Z | 2022-03-19T04:39:22.000Z | lib/disco/schemes/scheme_http.py | jgrnt/disco | 83874d93e74491c15699233865880ffb9ca7c2a0 | [
"BSD-3-Clause"
] | 51 | 2015-01-19T20:07:01.000Z | 2019-10-19T21:03:06.000Z | lib/disco/schemes/scheme_http.py | jgrnt/disco | 83874d93e74491c15699233865880ffb9ca7c2a0 | [
"BSD-3-Clause"
] | 122 | 2015-01-05T18:16:03.000Z | 2021-07-10T12:35:22.000Z | from disco import comm
def open(url, task=None):
return comm.open_url(url)
def input_stream(fd, sze, url, params):
"""Opens the specified url using an http client."""
import disco.worker
file = open(url, task=disco.worker.active_task)
return file, len(file), file.url
| 26.363636 | 55 | 0.696552 | 46 | 290 | 4.326087 | 0.565217 | 0.105528 | 0.110553 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.186207 | 290 | 10 | 56 | 29 | 0.84322 | 0.155172 | 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 |
416f0a53e4e09a888e7949a5541d1455ee237458 | 87 | py | Python | 10950.py | pgw00/Beakjoon-python | 677bf6ece5be4843a37aace02edaa29c532721fb | [
"MIT"
] | null | null | null | 10950.py | pgw00/Beakjoon-python | 677bf6ece5be4843a37aace02edaa29c532721fb | [
"MIT"
] | null | null | null | 10950.py | pgw00/Beakjoon-python | 677bf6ece5be4843a37aace02edaa29c532721fb | [
"MIT"
] | null | null | null | x=int(input())
for i in range(0,x):
a,b=map(int,input().split())
print(a+b)
| 12.428571 | 32 | 0.54023 | 18 | 87 | 2.611111 | 0.722222 | 0.340426 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014493 | 0.206897 | 87 | 6 | 33 | 14.5 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
417abc43d8c9da77acf2de0c19ed8932c061b34b | 5,143 | py | Python | backend/treeckle/treeckle/settings.py | CAPTxTreeckle/Treeckle-2.0 | 3a7f4c1a265b836a870ff34e6faff8b292002a52 | [
"MIT"
] | null | null | null | backend/treeckle/treeckle/settings.py | CAPTxTreeckle/Treeckle-2.0 | 3a7f4c1a265b836a870ff34e6faff8b292002a52 | [
"MIT"
] | 5 | 2020-11-19T09:12:48.000Z | 2020-12-23T21:46:19.000Z | backend/treeckle/treeckle/settings.py | CAPTxTreeckle/Treeckle-2.0 | 3a7f4c1a265b836a870ff34e6faff8b292002a52 | [
"MIT"
] | 4 | 2020-05-13T12:47:15.000Z | 2021-07-13T17:01:38.000Z | """
Django settings for treeckle project.
Generated by 'django-admin startproject' using Django 3.1.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os
from pathlib import Path
from datetime import timedelta
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.getenv("SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = bool(os.getenv("DEBUG", 0))
# CORS is disabled in debug mode
CORS_ALLOW_ALL_ORIGINS = bool(DEBUG)
ALLOWED_HOSTS = os.getenv("DJANGO_ALLOWED_HOSTS").split(" ")
SITE_ID = 1
# Application definition
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.sites",
"django.contrib.flatpages",
"anymail",
"treeckle",
"organizations",
"email_service",
"content_delivery_service",
"authentication",
"users",
"events",
"venues",
"bookings",
]
if DEBUG:
INSTALLED_APPS.append("corsheaders")
ANYMAIL = {
"MAILGUN_API_KEY": os.getenv("MAILGUN_API_KEY"),
"MAILGUN_SENDER_DOMAIN": os.getenv("MAILGUN_SERVER_NAME"),
}
EMAIL_BACKEND = "anymail.backends.mailgun.EmailBackend"
DEFAULT_FROM_EMAIL = "Treeckle <no-reply@treeckle.com>"
SERVER_EMAIL = "backend-server@treeckle.com"
REST_FRAMEWORK = {
"DEFAULT_AUTHENTICATION_CLASSES": (
"rest_framework_simplejwt.authentication.JWTTokenUserAuthentication",
),
"DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.IsAuthenticated",),
"DEFAULT_RENDERER_CLASSES": (
"djangorestframework_camel_case.render.CamelCaseJSONRenderer",
"djangorestframework_camel_case.render.CamelCaseBrowsableAPIRenderer",
),
"DEFAULT_PARSER_CLASSES": (
"djangorestframework_camel_case.parser.CamelCaseJSONParser",
),
"JSON_UNDERSCOREIZE": {
"no_underscore_before_number": True,
},
}
SIMPLE_JWT = {
"ACCESS_TOKEN_LIFETIME": timedelta(days=14) if DEBUG else timedelta(minutes=10),
"REFRESH_TOKEN_LIFETIME": timedelta(days=14),
"ROTATE_REFRESH_TOKENS": True,
}
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"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",
"django.contrib.flatpages.middleware.FlatpageFallbackMiddleware",
]
ROOT_URLCONF = "treeckle.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [BASE_DIR / "templates"],
"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",
"treeckle.module.context_processors.site",
],
},
},
]
WSGI_APPLICATION = "treeckle.wsgi.application"
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
"default": {
"ENGINE": os.getenv("SQL_ENGINE", "django.db.backends.postgresql"),
"NAME": os.getenv("SQL_DATABASE", BASE_DIR / "db.postgresql"),
"USER": os.getenv("SQL_USER", "user"),
"PASSWORD": os.getenv("SQL_PASSWORD", "password"),
"HOST": os.getenv("SQL_HOST", "localhost"),
"PORT": os.getenv("SQL_PORT", "5432"),
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/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/3.1/topics/i18n/
LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
# To serve django admin css when in production
STATIC_URL = "/api/static/"
STATIC_ROOT = "static"
| 28.103825 | 91 | 0.701731 | 553 | 5,143 | 6.361664 | 0.403255 | 0.066515 | 0.043775 | 0.049744 | 0.136157 | 0.120239 | 0.075895 | 0.075895 | 0.03411 | 0 | 0 | 0.00817 | 0.167023 | 5,143 | 182 | 92 | 28.258242 | 0.813025 | 0.205522 | 0 | 0.02521 | 1 | 0 | 0.556021 | 0.43216 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.05042 | 0.02521 | 0 | 0.02521 | 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 |
4187f5c70ddf40c456dd2f38019b4af7774feba7 | 1,105 | py | Python | _assignments/advanced/funcprog/funcprog_closure_a.py | sages-pl/2022-01-pythonsqlalchemy-aptiv | 1d6d856608e9dbe25b139e8968c48b7f46753b84 | [
"MIT"
] | null | null | null | _assignments/advanced/funcprog/funcprog_closure_a.py | sages-pl/2022-01-pythonsqlalchemy-aptiv | 1d6d856608e9dbe25b139e8968c48b7f46753b84 | [
"MIT"
] | null | null | null | _assignments/advanced/funcprog/funcprog_closure_a.py | sages-pl/2022-01-pythonsqlalchemy-aptiv | 1d6d856608e9dbe25b139e8968c48b7f46753b84 | [
"MIT"
] | null | null | null | """
* Assignment: FuncProg Closure Define
* Complexity: easy
* Lines of code: 4 lines
* Time: 5 min
English:
1. Define function `check` with `func: Callable` as a parameter
2. Define closure function `wrapper` inside `check`
3. Function `wrapper` takes `*args` and `**kwargs` as arguments
4. Function `wrapper` returns `None`
5. Function `check` must return `wrapper: Callable`
6. Run doctests - all must succeed
Polish:
1. Zdefiniuj funkcję `check`, z `func: Callable` jako parametr
2. Zdefiniuj funkcję closure `wrapper` wewnątrz `check`
3. Funkcja `wrapper` przyjmuje `*args` i `**kwargs` jako argumenty
4. Funkcja `wrapper` zwraca `None`
5. Funkcja `check` ma zwracać `wrapper: Callable`
6. Uruchom doctesty - wszystkie muszą się powieść
Tests:
>>> import sys; sys.tracebacklimit = 0
>>> assert callable(check)
>>> assert callable(check(lambda:...))
>>> result = check(lambda:...).__call__()
>>> result is None
True
"""
# Callable: parameter: func; inside: wrapper with args, kwargs; return: wrapper
def check():
...
| 28.333333 | 79 | 0.665158 | 137 | 1,105 | 5.335766 | 0.532847 | 0.06156 | 0.043776 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017182 | 0.209955 | 1,105 | 38 | 80 | 29.078947 | 0.82016 | 0.968326 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | true | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
41897480c22b3a95fe4835e50a1d0343a35afc95 | 2,885 | py | Python | test/test_util.py | tjdevries/easy_python_requirements | 2bf905f34065637cbc781d17d8e5806892fb66d5 | [
"MIT"
] | null | null | null | test/test_util.py | tjdevries/easy_python_requirements | 2bf905f34065637cbc781d17d8e5806892fb66d5 | [
"MIT"
] | 2 | 2016-07-01T13:47:43.000Z | 2021-11-28T23:07:17.000Z | test/test_util.py | tjdevries/easy_python_requirements | 2bf905f34065637cbc781d17d8e5806892fb66d5 | [
"MIT"
] | 1 | 2021-11-28T21:50:41.000Z | 2021-11-28T21:50:41.000Z | from easy_python_requirements import util
class TestIndentString:
def test_none(self):
assert util.indent_string(None) == ''
def test_no_newline(self):
assert util.indent_string('no newline') == ' no newline\n'
def test_with_multiple_newlines(self):
s = 'wow newlines\n\n\n'
assert util.indent_string(s) == ' wow newlines\n'
def test_with_newline(self):
assert util.indent_string('with newline\n') == ' with newline\n'
def test_with_newline_and_indent(self):
assert util.indent_string('with newline\n', 2) == ' with newline\n'
def test_with_other_spacing(self):
assert util.indent_string('new spacing', 2, '~~~') == '~~~~~~new spacing\n'
class TestGetRelativePath:
def test_no_relative_path(self):
from mock_functions.test_module_stuff import FirstClass
assert util.get_relative_path(FirstClass, 'bad path') != 'mock_functions/test_module_stuff.py'
def test_relative_path(self):
from mock_functions.test_module_stuff import FirstClass
assert util.get_relative_path(FirstClass) == 'mock_functions/test_module_stuff.py'
class TestGetDepthOfFile:
def test_no_depth(self):
assert util.get_depth_of_file('file.py') == 1
def test_get_one_depth(self):
assert util.get_depth_of_file('folder/file.py') == 2
def test_ignores_leading_dot_slash(self):
assert util.get_depth_of_file('.\\folder\\file.py') == 2
def test_does_not_ignore_leading_slash(self):
# TODO: Decide if this is the behavior I want
assert util.get_depth_of_file('/usr/file.py') == 3
def test_handles_mixed_slashes(self):
assert util.get_depth_of_file('this/folder\\mixed.py') == 3
class TestGetType:
def test_is_class(self):
from mock_functions.test_module_stuff import FirstClass
assert util.get_type(FirstClass) == 'class'
def test_is_function(self):
from mock_functions.test_module_stuff import FirstClass
assert util.get_type(FirstClass.function_that_should_not_change) == 'function'
def test_is_string(self):
assert util.get_type('hello') == "<class 'str'>"
class TestGetters:
def test_get_functions(self):
from mock_functions.test_module_stuff import FirstClass
assert util.get_functions(FirstClass)[0][0] == 'function_that_should_not_change'
def test_get_classes(self):
from mock_functions import test_module_stuff
class_list = util.get_classes(test_module_stuff)
assert all(any(class_name in item[0] for item in class_list) for class_name in ['FirstClass', 'SecondClass', 'ThirdClass'])
def test_get_modules(self):
import mock_functions
module_list = util.get_modules(mock_functions.test_module_stuff)
assert any('__loader__' in item[0] for item in module_list)
| 35.182927 | 131 | 0.704333 | 401 | 2,885 | 4.743142 | 0.221945 | 0.069926 | 0.075184 | 0.09674 | 0.543113 | 0.452681 | 0.346477 | 0.331756 | 0.271819 | 0.271819 | 0 | 0.004741 | 0.195841 | 2,885 | 81 | 132 | 35.617284 | 0.815086 | 0.014905 | 0 | 0.092593 | 0 | 0 | 0.146479 | 0.042958 | 0 | 0 | 0 | 0.012346 | 0.351852 | 1 | 0.351852 | false | 0 | 0.148148 | 0 | 0.592593 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
41931d4369a899064cfdb752b537301147793689 | 46 | py | Python | lib/__init__.py | federico123579/BigBrother | 9b61dcf8fd84b6491690ae83bf695bc2b64b17b3 | [
"MIT"
] | 29 | 2017-03-14T11:48:54.000Z | 2022-02-22T02:01:25.000Z | lib/__init__.py | federico123579/BigBrother | 9b61dcf8fd84b6491690ae83bf695bc2b64b17b3 | [
"MIT"
] | null | null | null | lib/__init__.py | federico123579/BigBrother | 9b61dcf8fd84b6491690ae83bf695bc2b64b17b3 | [
"MIT"
] | 10 | 2017-07-16T18:58:05.000Z | 2021-09-27T23:45:24.000Z | __all__ = ['base', 'bbro', 'clint', 'sentry']
| 23 | 45 | 0.565217 | 5 | 46 | 4.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130435 | 46 | 1 | 46 | 46 | 0.55 | 0 | 0 | 0 | 0 | 0 | 0.413043 | 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 |
41a2ee3eb2635c96f57d7fa5b6506db0a33609f9 | 3,819 | py | Python | amps.py | leon3110l/rs2tsl | 49fb25eb4813c41e2f1bb3ebaf2b84db19400142 | [
"MIT"
] | null | null | null | amps.py | leon3110l/rs2tsl | 49fb25eb4813c41e2f1bb3ebaf2b84db19400142 | [
"MIT"
] | 1 | 2021-03-05T00:45:33.000Z | 2021-03-05T00:45:33.000Z | amps.py | leon3110l/rs2tsl | 49fb25eb4813c41e2f1bb3ebaf2b84db19400142 | [
"MIT"
] | null | null | null | from katana_tsl_patch.katana.pedals.amp import Amp, AmpType
import json
from translate import translate
def create_amp(amp_type: AmpType):
def _create(knobs):
return Amp(
amp_type,
**knobs
)
return _create
amps = {
"DEFAULT": create_amp(AmpType.CLEAN),
"Amp_AT120": create_amp(AmpType.CLEAN),
"Amp_AT20": create_amp(AmpType.CLEAN),
"Amp_BT15": create_amp(AmpType.CLEAN),
"Amp_BT30": create_amp(AmpType.CLEAN),
"Amp_BT45": create_amp(AmpType.CLEAN),
"Amp_CA100": create_amp(AmpType.CLEAN),
"Amp_CA38": create_amp(AmpType.CLEAN),
"Amp_CA85": create_amp(AmpType.CLEAN),
"Amp_CS100": create_amp(AmpType.CLEAN),
"Amp_CS120": create_amp(AmpType.CLEAN),
"Amp_CS90": create_amp(AmpType.CLEAN),
"Amp_EN30": create_amp(AmpType.CLEAN),
"Amp_EN50": create_amp(AmpType.CLEAN),
"Amp_GB100": create_amp(AmpType.CLEAN),
"Amp_GB38": create_amp(AmpType.CLEAN),
"Amp_GB50": create_amp(AmpType.CLEAN),
"Amp_GibsonGA88": create_amp(AmpType.CLEAN),
"Amp_HG100": create_amp(AmpType.CLEAN),
"Amp_HG180": create_amp(AmpType.CLEAN),
"Amp_HG500": create_amp(AmpType.CLEAN),
"Amp_Marshall1962Bluesbreaker": create_amp(AmpType.CLEAN),
"Amp_MarshallDSL100H": create_amp(AmpType.CLEAN),
"Amp_MarshallDSL15H": create_amp(AmpType.CLEAN),
"Amp_MarshallJCM800": create_amp(AmpType.CLEAN),
"Amp_MarshallJTM45": create_amp(AmpType.CLEAN),
"Amp_MarshallJVM410H": create_amp(AmpType.CLEAN),
"Amp_MarshallPlexi": create_amp(AmpType.CLEAN),
"Amp_OrangeAD50": create_amp(AmpType.CLEAN),
"Amp_OrangeJimmyBean": create_amp(AmpType.CLEAN),
"Amp_OrangeOR100": create_amp(AmpType.CLEAN),
"Amp_OrangeOR50H": create_amp(AmpType.CLEAN),
"Amp_OrangeRockerverb": create_amp(AmpType.CLEAN),
"Amp_OrangeTinyTerror": create_amp(AmpType.CLEAN),
"Amp_TW22": create_amp(AmpType.CLEAN),
"Amp_TW26": create_amp(AmpType.CLEAN),
"Amp_TW40": create_amp(AmpType.CLEAN),
"Bass_Amp_BT600B": create_amp(AmpType.CLEAN),
"Bass_Amp_BT880B": create_amp(AmpType.CLEAN),
"Bass_Amp_BT975B": create_amp(AmpType.CLEAN),
"Bass_Amp_CH300B": create_amp(AmpType.CLEAN),
"Bass_Amp_CH350B": create_amp(AmpType.CLEAN),
"Bass_Amp_CH600B": create_amp(AmpType.CLEAN),
"Bass_Amp_CS240B": create_amp(AmpType.CLEAN),
"Bass_Amp_CS300B": create_amp(AmpType.CLEAN),
"Bass_Amp_CS75B": create_amp(AmpType.CLEAN),
"Bass_Amp_EdenE300": create_amp(AmpType.CLEAN),
"Bass_Amp_EdenWT550": create_amp(AmpType.CLEAN),
"Bass_Amp_EdenWT800": create_amp(AmpType.CLEAN),
"Bass_Amp_HT100B": create_amp(AmpType.CLEAN),
"Bass_Amp_HT300B": create_amp(AmpType.CLEAN),
"Bass_Amp_HT400B": create_amp(AmpType.CLEAN),
"Bass_Amp_LT25B": create_amp(AmpType.CLEAN),
"Bass_Amp_LT85B": create_amp(AmpType.CLEAN),
"Bass_Amp_OrangeAD200B": create_amp(AmpType.CLEAN),
"DI_Amp_BassDriver": create_amp(AmpType.CLEAN),
"DI_Amp_MixerPre": create_amp(AmpType.CLEAN),
"DI_Amp_TubePre": create_amp(AmpType.CLEAN),
}
def get_amp(amp_key: str, knob_values):
knobs = {}
for key, value in knob_values.items():
key = key.replace(amp_key + "_", "").lower()
if(key in ['gain', 'bass', 'mid', 'treble']):
knobs[translate(key)] = value
if(amp_key not in amps):
amp_key = "DEFAULT"
return amps[amp_key](knobs)
if __name__ == "__main__":
with open('bob_redemption.json') as file:
bob = json.load(file)
for key, song in bob['Entries'].items():
tones = song['Attributes']['Tones']
for tone in tones:
tone_name = tone['Name']
print(tone_name)
get_amp(tone['GearList']['Amp']['Key'], tone['GearList']['Amp']['KnobValues'])
| 37.441176 | 94 | 0.686043 | 494 | 3,819 | 4.97166 | 0.222672 | 0.240228 | 0.37785 | 0.495928 | 0.588762 | 0.236971 | 0 | 0 | 0 | 0 | 0 | 0.040694 | 0.16994 | 3,819 | 101 | 95 | 37.811881 | 0.734069 | 0 | 0 | 0 | 0 | 0 | 0.231474 | 0.012831 | 0 | 0 | 0 | 0 | 0 | 1 | 0.034091 | false | 0 | 0.034091 | 0.011364 | 0.102273 | 0.011364 | 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 |
41b13e2dbcf1d04105160f3f0fd5d4f39edacd0d | 1,770 | py | Python | mintersdk/test/test_check.py | eternalflow/minter-sdk | 3145f37f66d890941c00c80dc325883fae8aee4b | [
"MIT"
] | 29 | 2019-05-24T18:23:14.000Z | 2021-11-08T08:50:49.000Z | mintersdk/test/test_check.py | eternalflow/minter-sdk | 3145f37f66d890941c00c80dc325883fae8aee4b | [
"MIT"
] | 6 | 2019-08-01T07:41:23.000Z | 2022-01-19T09:53:56.000Z | mintersdk/test/test_check.py | eternalflow/minter-sdk | 3145f37f66d890941c00c80dc325883fae8aee4b | [
"MIT"
] | 28 | 2019-05-24T15:30:40.000Z | 2022-03-17T22:41:35.000Z | import unittest
from mintersdk.sdk.check import MinterCheck
from mintersdk.sdk.transactions import MinterTx
class TestMinterCheck(unittest.TestCase):
def setUp(self):
self.PRIVATE_KEY = '64e27afaab363f21eec05291084367f6f1297a7b280d69d672febecda94a09ea'
self.ADDRESS = 'Mxa7bc33954f1ce855ed1a8c768fdd32ed927def47'
self.PASSPHRASE = 'pass'
self.VALID_CHECK = 'Mcf8ae8334383002830f423f8a4d4e5400000000000000888ac7230489e800008a4d4e5400000000000000b841497c5f3e6fc182fd1a791522a9ef7576710bdfbc86fdbf165476ef220e89f9ff1380f93f2d9a2f92fdab0edc1e2605cc2c69b707cd404b2cb1522b7aba4defd5001ba083c9945169f0a7bbe596973b32dc887608780580b1d3bc7b188bedb3bd385594a047b2d5345946ed5498f5bee713f86276aac046a5fef820beaee77a9b6f9bc1df'
self.VALID_PROOF = 'da021d4f84728e0d3d312a18ec84c21768e0caa12a53cb0a1452771f72b0d1a91770ae139fd6c23bcf8cec50f5f2e733eabb8482cf29ee540e56c6639aac469600'
self.CHECK = MinterCheck(
nonce=480,
due_block=999999,
coin='MNT',
value=10,
passphrase=self.PASSPHRASE,
chain_id=MinterTx.TESTNET_CHAIN_ID,
gas_coin='MNT'
)
def test_check(self):
check = self.CHECK.sign(self.PRIVATE_KEY)
self.assertEqual(check, self.VALID_CHECK)
def test_proof(self):
proof = MinterCheck.proof(
address=self.ADDRESS,
passphrase=self.PASSPHRASE
)
self.assertEqual(proof, self.VALID_PROOF)
def test_fromraw(self):
check = MinterCheck.from_raw(rawcheck=self.VALID_CHECK)
self.assertEqual(
check.owner,
'Mxce931863b9c94a526d94acd8090c1c5955a6eb4b'
)
self.assertEqual(check.gas_coin, self.CHECK.gas_coin)
| 38.478261 | 383 | 0.738983 | 125 | 1,770 | 10.32 | 0.376 | 0.034884 | 0.032558 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.286723 | 0.2 | 1,770 | 45 | 384 | 39.333333 | 0.624294 | 0 | 0 | 0 | 0 | 0 | 0.362712 | 0.357062 | 0 | 0 | 0 | 0 | 0.114286 | 1 | 0.114286 | false | 0.085714 | 0.085714 | 0 | 0.228571 | 0 | 0 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
68b74b87be61f082bcfda59e583988e74fbe3a7b | 175 | py | Python | src/contrib/add.py | KrisSaxton/hub | ba52c85c1cd2974bd4199bf51ce0678c5eff44e1 | [
"Apache-2.0"
] | 3 | 2018-02-03T17:20:24.000Z | 2021-05-29T18:11:06.000Z | src/contrib/add.py | sysbot/hub | ba52c85c1cd2974bd4199bf51ce0678c5eff44e1 | [
"Apache-2.0"
] | null | null | null | src/contrib/add.py | sysbot/hub | ba52c85c1cd2974bd4199bf51ce0678c5eff44e1 | [
"Apache-2.0"
] | 1 | 2019-11-28T11:50:56.000Z | 2019-11-28T11:50:56.000Z | #!/usr/bin/env python
from api import task
@task(async=True)
def add(arg1, arg2):
print 'Passing parent id to end point %s' % add.state.parent_id
return arg1 + arg2
| 19.444444 | 67 | 0.691429 | 30 | 175 | 4 | 0.8 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.028369 | 0.194286 | 175 | 8 | 68 | 21.875 | 0.822695 | 0.114286 | 0 | 0 | 0 | 0 | 0.214286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.2 | 0.2 | null | null | 0.2 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
68db197c1f970b898775956d71124339eebfc166 | 209 | py | Python | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}.py | farooq-teqniqly/cookiecutter-databricks-notebook | 31a4d1faeb9edf5953bd7a617707b2cd4bd39f86 | [
"MIT"
] | null | null | null | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}.py | farooq-teqniqly/cookiecutter-databricks-notebook | 31a4d1faeb9edf5953bd7a617707b2cd4bd39f86 | [
"MIT"
] | null | null | null | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}.py | farooq-teqniqly/cookiecutter-databricks-notebook | 31a4d1faeb9edf5953bd7a617707b2cd4bd39f86 | [
"MIT"
] | null | null | null | """
The Notebook module.
"""
class Notebook:
"""
This notebook does...
"""
def run(self):
"""
Your notebook code goes here.
"""
notebook = Notebook()
notebook.run()
| 11.611111 | 37 | 0.511962 | 20 | 209 | 5.35 | 0.65 | 0.299065 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.330144 | 209 | 17 | 38 | 12.294118 | 0.764286 | 0.344498 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
68e7ee66235755ca6dc52c4d4bd86531c3d75f0f | 171 | py | Python | ex10_5.py | DexHunter/Think-Python-book-exercise-solutions | d0abae261eda1dca99043e17e8a1e614caad2140 | [
"CC-BY-4.0"
] | 24 | 2019-05-07T15:11:28.000Z | 2022-03-02T04:50:28.000Z | ex10_5.py | Dekzu/Think-Python-book-exercise-solutions | d0abae261eda1dca99043e17e8a1e614caad2140 | [
"CC-BY-4.0"
] | null | null | null | ex10_5.py | Dekzu/Think-Python-book-exercise-solutions | d0abae261eda1dca99043e17e8a1e614caad2140 | [
"CC-BY-4.0"
] | 19 | 2019-08-05T20:59:04.000Z | 2022-03-07T05:13:32.000Z | def is_sorted(l):
if len(l) == 1:
return True
else:
if(l[0] > l[1]):
return False
return is_sorted(l[1:])
print is_sorted([1,2,2])
print is_sorted(['b','a']) | 17.1 | 26 | 0.590643 | 34 | 171 | 2.852941 | 0.470588 | 0.329897 | 0.185567 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.050725 | 0.192982 | 171 | 10 | 26 | 17.1 | 0.652174 | 0 | 0 | 0 | 0 | 0 | 0.011628 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.222222 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
68f155c8a9a9383c1155fa59b58be9220da9a6ce | 1,185 | py | Python | venv/lib/python2.7/site-packages/tests/test_wrappers.py | taulanthoti/data-management-system | c7daddf56f7e28223e19ea53b94691d58de0c132 | [
"CC0-1.0"
] | null | null | null | venv/lib/python2.7/site-packages/tests/test_wrappers.py | taulanthoti/data-management-system | c7daddf56f7e28223e19ea53b94691d58de0c132 | [
"CC0-1.0"
] | null | null | null | venv/lib/python2.7/site-packages/tests/test_wrappers.py | taulanthoti/data-management-system | c7daddf56f7e28223e19ea53b94691d58de0c132 | [
"CC0-1.0"
] | null | null | null | from tests import util
from werkzeug.exceptions import HTTPException
class CollectionTest(util.FlaskPyMongoTest):
def test_find_one_or_404(self):
self.mongo.db.things.remove()
try:
self.mongo.db.things.find_one_or_404({'_id': 'thing'})
except HTTPException as notfound:
assert notfound.code == 404, "raised wrong exception"
self.mongo.db.things.insert({'_id': 'thing', 'val': 'foo'}, safe=True)
# now it should not raise
thing = self.mongo.db.things.find_one_or_404({'_id': 'thing'})
assert thing['val'] == 'foo', 'got wrong thing'
# also test with dotted-named collections
self.mongo.db.things.morethings.remove()
try:
self.mongo.db.things.morethings.find_one_or_404({'_id': 'thing'})
except HTTPException as notfound:
assert notfound.code == 404, "raised wrong exception"
self.mongo.db.things.morethings.insert({'_id': 'thing', 'val': 'foo'}, safe=True)
# now it should not raise
thing = self.mongo.db.things.morethings.find_one_or_404({'_id': 'thing'})
assert thing['val'] == 'foo', 'got wrong thing'
| 35.909091 | 89 | 0.632911 | 152 | 1,185 | 4.789474 | 0.322368 | 0.098901 | 0.120879 | 0.186813 | 0.762363 | 0.711538 | 0.686813 | 0.686813 | 0.686813 | 0.686813 | 0 | 0.023026 | 0.23038 | 1,185 | 32 | 90 | 37.03125 | 0.775219 | 0.073418 | 0 | 0.4 | 0 | 0 | 0.133455 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.05 | false | 0 | 0.1 | 0 | 0.2 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ec00a694efa86020e592f1e4e3b5362c706adc3a | 54 | py | Python | jj/requests/__init__.py | TeoDV/jj | a58d91ad7b37ba3115daea4890190abede8f3353 | [
"Apache-2.0"
] | 4 | 2020-09-08T08:14:21.000Z | 2022-01-27T19:22:53.000Z | jj/requests/__init__.py | TeoDV/jj | a58d91ad7b37ba3115daea4890190abede8f3353 | [
"Apache-2.0"
] | 19 | 2018-02-13T05:51:25.000Z | 2022-03-27T22:48:11.000Z | jj/requests/__init__.py | TeoDV/jj | a58d91ad7b37ba3115daea4890190abede8f3353 | [
"Apache-2.0"
] | 3 | 2017-11-17T13:25:23.000Z | 2022-02-03T12:57:00.000Z | from ._request import Request
__all__ = ("Request",)
| 13.5 | 29 | 0.722222 | 6 | 54 | 5.666667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148148 | 54 | 3 | 30 | 18 | 0.73913 | 0 | 0 | 0 | 0 | 0 | 0.12963 | 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 |
ec05d0f0fa5cc20b88c3ef1a8cc6f011ae4f4ae9 | 46 | py | Python | python/defs.py | WatForm/fortress-eval-poremba-symmetry | a3ff188428145938f419e0a045dba024cdd867f1 | [
"MIT"
] | null | null | null | python/defs.py | WatForm/fortress-eval-poremba-symmetry | a3ff188428145938f419e0a045dba024cdd867f1 | [
"MIT"
] | null | null | null | python/defs.py | WatForm/fortress-eval-poremba-symmetry | a3ff188428145938f419e0a045dba024cdd867f1 | [
"MIT"
] | null | null | null | benchmarksdir = "../UF/"
thisdirprefix = "./"
| 15.333333 | 24 | 0.608696 | 3 | 46 | 9.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130435 | 46 | 2 | 25 | 23 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0.173913 | 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 |
ec0ed1ee1d45f1d99f998b9a7a894b0926053fc2 | 38 | py | Python | lists/stocks.py | migueldv90/stock-analysis | 2f0a4487a4afd779022f355dafbe88352791b012 | [
"MIT"
] | null | null | null | lists/stocks.py | migueldv90/stock-analysis | 2f0a4487a4afd779022f355dafbe88352791b012 | [
"MIT"
] | null | null | null | lists/stocks.py | migueldv90/stock-analysis | 2f0a4487a4afd779022f355dafbe88352791b012 | [
"MIT"
] | null | null | null | tickers = [
'aapl',
'tsla',
]
| 7.6 | 11 | 0.394737 | 3 | 38 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.368421 | 38 | 4 | 12 | 9.5 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0.210526 | 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 |
ec253a4e9d38c14af99894fd08da676a0ff3ba7c | 610 | py | Python | lib/babelfont/groups.py | moyogo/babelfont | 8cc4a622c55bea407345ff93dc115d41a47488d8 | [
"BSD-3-Clause"
] | 38 | 2020-03-27T21:13:07.000Z | 2021-07-18T14:01:17.000Z | lib/babelfont/groups.py | moyogo/babelfont | 8cc4a622c55bea407345ff93dc115d41a47488d8 | [
"BSD-3-Clause"
] | 17 | 2020-06-23T07:16:32.000Z | 2022-03-26T08:42:05.000Z | lib/babelfont/groups.py | moyogo/babelfont | 8cc4a622c55bea407345ff93dc115d41a47488d8 | [
"BSD-3-Clause"
] | 7 | 2020-03-27T22:47:19.000Z | 2021-03-24T10:01:20.000Z | from fontParts.base.groups import BaseGroups
from collections import OrderedDict
class Groups(BaseGroups):
def __init__(self, **kwargs):
self._dict = OrderedDict()
super(BaseGroups, self).__init__(self, **kwargs)
def _set_font(self, font):
self._font = font
def _getItem(self, attr):
if not attr in self._dict:
return None
return self._dict[attr]
def _setItem(self, attr, value):
self._dict[attr] = value
def _contains(self, attr):
return attr in self._dict
def _items(self):
return self._dict.items()
| 22.592593 | 56 | 0.634426 | 75 | 610 | 4.88 | 0.373333 | 0.131148 | 0.076503 | 0.076503 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.267213 | 610 | 26 | 57 | 23.461538 | 0.818792 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.111111 | 0.111111 | 0.722222 | 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 |
ec3717473dd04161711cd48868406941d4360239 | 1,360 | py | Python | school/models.py | Ededu1984/Django_API_School | c3f45fa8036bcf72ccc06c4337010e0eecc4d0fe | [
"MIT"
] | null | null | null | school/models.py | Ededu1984/Django_API_School | c3f45fa8036bcf72ccc06c4337010e0eecc4d0fe | [
"MIT"
] | null | null | null | school/models.py | Ededu1984/Django_API_School | c3f45fa8036bcf72ccc06c4337010e0eecc4d0fe | [
"MIT"
] | null | null | null | from django.db import models
class Student(models.Model):
STATUS = (
('activate', 'Activate'),
('not activate', 'Not Activate')
)
name = models.CharField(max_length=30)
email = models.EmailField(blank=False, max_length=30)
rg = models.CharField(max_length=9, unique=True)
cpf = models.CharField(max_length=11, unique=True)
birth_date = models.DateField()
cell_phone = models.CharField(max_length=14)
status = models.CharField(max_length=12, choices=STATUS, blank=False, null=False,default='activate')
def __str__(self):
return self.name
class Course(models.Model):
LEVEL = (
('B', 'Basic'),
('I', 'Intermediate'),
('A', 'Advanced')
)
course_code = models.CharField(max_length=10, unique=True)
description = models.CharField(max_length=100)
level = models.CharField(max_length=1, choices=LEVEL, blank=False, null=False,default='B')
def __str__(self):
return self.description
class Enrollment(models.Model):
PERIOD = (
('M', 'Morning'),
('A', 'Afternoon'),
('N', 'Night')
)
student = models.ForeignKey(Student, on_delete=models.CASCADE)
course = models.ForeignKey(Course, on_delete=models.CASCADE)
period = models.CharField(max_length=1, choices=PERIOD, blank=False, null=False,default='M')
| 31.627907 | 104 | 0.654412 | 164 | 1,360 | 5.286585 | 0.390244 | 0.103806 | 0.186851 | 0.249135 | 0.209919 | 0.073818 | 0 | 0 | 0 | 0 | 0 | 0.016559 | 0.200735 | 1,360 | 42 | 105 | 32.380952 | 0.781049 | 0 | 0 | 0.057143 | 0 | 0 | 0.07511 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.057143 | false | 0 | 0.028571 | 0.057143 | 0.685714 | 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 |
ec3e8465ba95ef42aaacdf2e72ba771c8f1fef2f | 851 | py | Python | src/degrees/major.py | RaylaKurosaki1503/Student_Information_System | 9550e9ee9fa39b9aa49ab70310977c1eda9e2f87 | [
"MIT"
] | 1 | 2022-02-15T05:31:38.000Z | 2022-02-15T05:31:38.000Z | src/degrees/major.py | RaylaKurosaki1503/Student_Information_System | 9550e9ee9fa39b9aa49ab70310977c1eda9e2f87 | [
"MIT"
] | null | null | null | src/degrees/major.py | RaylaKurosaki1503/Student_Information_System | 9550e9ee9fa39b9aa49ab70310977c1eda9e2f87 | [
"MIT"
] | null | null | null | """
Author: Rayla Kurosaki
File: major.py
Description: This file contains the functionality to represent a major.
"""
import __utils__ as utils
class Major:
def __init__(self, name, degree):
"""
Create an instance of a major.
"""
self.name = name
self.degree = degree
self.gpa = "n/a"
self.courses = {}
pass
def get_name(self):
"""
Gets the name of the major.
:return: The name of the major.
"""
return self.name
def get_degree(self):
"""
Gets the degree of the major.
:return: The degree of the major.
"""
return self.degree
def get_gpa(self):
"""
Get the GPA for this major.
:return: The GPA for this major.
"""
return self.gpa
pass
| 17.729167 | 71 | 0.532315 | 104 | 851 | 4.25 | 0.336538 | 0.149321 | 0.090498 | 0.144796 | 0.343891 | 0.325792 | 0 | 0 | 0 | 0 | 0 | 0 | 0.374853 | 851 | 47 | 72 | 18.106383 | 0.830827 | 0.387779 | 0 | 0.133333 | 0 | 0 | 0.007557 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0.133333 | 0.066667 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
ec41b258a3fc95f5a3d0e0c670eb5840d5280b95 | 5,296 | py | Python | tests/test_timeseries.py | jmcph4/quantmotion | 84ec703be327c9f06019677ba17687df1e71b624 | [
"MIT"
] | null | null | null | tests/test_timeseries.py | jmcph4/quantmotion | 84ec703be327c9f06019677ba17687df1e71b624 | [
"MIT"
] | null | null | null | tests/test_timeseries.py | jmcph4/quantmotion | 84ec703be327c9f06019677ba17687df1e71b624 | [
"MIT"
] | 2 | 2018-09-05T12:55:11.000Z | 2021-12-14T01:58:46.000Z | import unittest
from datetime import datetime
from copy import deepcopy
from quantmotion.ohlcvdata import OHLCVData
from quantmotion.timeseries import TimeSeries
class TestTimeSeries(unittest.TestCase):
__valid_initial_data = [
[(datetime(2018, 1, 1), OHLCVData(1.00, 2.43, 0.52, 1.50, 100)),
(datetime(2018, 1, 2), OHLCVData(2.00, 2.05, 1.95, 2.00, 5400))],
[(datetime(2017, 1, 1), OHLCVData(4.50, 4.60, 2.40, 3.50, 567)),
(datetime(2017, 1, 2), OHLCVData(3.50, 5.50, 2.30, 4.00, 900))]
]
__not_found_key = datetime(2001, 1, 1)
__not_found_value = OHLCVData(-100, -200, -50, -120, -100)
def test___init___normal(self):
actual_ts = TimeSeries()
expected_ts = TimeSeries()
self.assertEqual(actual_ts, expected_ts)
def test___init___initial_data(self):
actual_ts = TimeSeries(init=self.__valid_initial_data[0])
expected_ts = TimeSeries(init=self.__valid_initial_data[0])
self.assertEqual(actual_ts, expected_ts)
def test___getitem___normal(self):
actual_ts = TimeSeries(init=self.__valid_initial_data[0])
actual_item = actual_ts[self.__valid_initial_data[0][0][0]]
expected_ts = TimeSeries(init=self.__valid_initial_data[0])
expected_item = self.__valid_initial_data[0][0][1]
self.assertEqual(actual_item, expected_item)
self.assertEqual(len(actual_ts), len(expected_ts))
def test___getitem___slice(self):
ts = TimeSeries(init=self.__valid_initial_data[0])
actual_ts = ts[self.__valid_initial_data[0][1][0]:]
expected_ts = TimeSeries(init=self.__valid_initial_data[0][1:])
self.assertEqual(actual_ts, expected_ts)
def test___getitem___not_found(self):
actual_ts = TimeSeries(init=self.__valid_initial_data[0])
with self.assertRaises(KeyError):
item = actual_ts[self.__not_found_key]
def test___setitem___normal(self):
actual_ts = TimeSeries(init=self.__valid_initial_data[0])
actual_ts[self.__valid_initial_data[0][0][0]] = self.__valid_initial_data[0][1][1]
self.assertEqual(actual_ts[self.__valid_initial_data[0][0][0]], self.__valid_initial_data[0][1][1])
def test___setitem___not_found(self):
actual_ts = TimeSeries(init=self.__valid_initial_data[0])
actual_ts[self.__not_found_key] = self.__not_found_value
data = deepcopy(self.__valid_initial_data[0])
data.append((self.__not_found_key, self.__not_found_value))
expected_ts = TimeSeries(init=data)
self.assertEqual(actual_ts, expected_ts)
def test___delitem___normal(self):
actual_ts = TimeSeries(init=self.__valid_initial_data[0])
del actual_ts[self.__valid_initial_data[0][0][0]]
expected_ts = TimeSeries(init=self.__valid_initial_data[0][1:])
self.assertEqual(actual_ts, expected_ts)
def test___delitem___not_found(self):
actual_ts = TimeSeries(init=self.__valid_initial_data[0])
with self.assertRaises(KeyError):
del actual_ts[self.__not_found_key]
def test___eq___normal(self):
a = TimeSeries(init=self.__valid_initial_data[0])
b = TimeSeries(init=self.__valid_initial_data[0])
self.assertTrue(a == b)
def test___eq___unequal(self):
a = TimeSeries(init=self.__valid_initial_data[0])
b = TimeSeries(init=self.__valid_initial_data[1])
self.assertFalse(a == b)
def test___iter___normal(self):
actual_ts = TimeSeries(init=self.__valid_initial_data[0])
actual_items = []
for k, v in actual_ts:
actual_items.append((k, v))
expected_items = deepcopy(self.__valid_initial_data[0])
expected_ts = TimeSeries(init=expected_items)
self.assertEqual(actual_items, expected_items)
self.assertEqual(actual_ts, expected_ts)
def test_insert_normal(self):
actual_ts = TimeSeries(init=self.__valid_initial_data[0])
actual_ts.insert(self.__not_found_key, self.__not_found_value)
expected_values = deepcopy(self.__valid_initial_data[0])
expected_values.append((self.__not_found_key, self.__not_found_value))
expected_ts = TimeSeries(init=expected_values)
self.assertEqual(actual_ts, expected_ts)
def test_remove_normal(self):
actual_ts = TimeSeries(init=self.__valid_initial_data[0])
actual_ts.remove(self.__valid_initial_data[0][0][0])
expected_ts = TimeSeries(init=self.__valid_initial_data[0][1:])
self.assertEqual(actual_ts, expected_ts)
def test___add___normal(self):
a = TimeSeries(init=self.__valid_initial_data[0])
b = TimeSeries(init=self.__valid_initial_data[1])
c = a + b
expected_ts = TimeSeries(init=self.__valid_initial_data[0] +
self.__valid_initial_data[1])
self.assertEqual(c, expected_ts)
def test___sub___normal(self):
a = TimeSeries(init=self.__valid_initial_data[0])
b = TimeSeries(init=self.__valid_initial_data[0])
c = a - b
expected_ts = TimeSeries()
self.assertEqual(c, expected_ts)
if __name__ == "__main__":
unittest.main()
| 34.167742 | 107 | 0.679758 | 714 | 5,296 | 4.52381 | 0.117647 | 0.136223 | 0.193189 | 0.235294 | 0.775232 | 0.709598 | 0.670588 | 0.656656 | 0.591022 | 0.530031 | 0 | 0.039122 | 0.208459 | 5,296 | 154 | 108 | 34.38961 | 0.731393 | 0 | 0 | 0.362745 | 0 | 0 | 0.001511 | 0 | 0 | 0 | 0 | 0 | 0.176471 | 1 | 0.156863 | false | 0 | 0.04902 | 0 | 0.245098 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ec4e45155547acc1e508c3b1ca3d5f7ce31f6569 | 63,866 | py | Python | diplomacy_research/proto/diplomacy_tensorflow/core/profiler/tfprof_log_pb2.py | wwongkamjan/dipnet_press | 787263c1b9484698904f525c8d78d0e333e1c0d9 | [
"MIT"
] | 39 | 2019-09-06T13:42:24.000Z | 2022-03-18T18:38:43.000Z | diplomacy_research/proto/diplomacy_tensorflow/core/profiler/tfprof_log_pb2.py | wwongkamjan/dipnet_press | 787263c1b9484698904f525c8d78d0e333e1c0d9 | [
"MIT"
] | 9 | 2019-09-19T22:35:32.000Z | 2022-02-24T18:04:57.000Z | diplomacy_research/proto/diplomacy_tensorflow/core/profiler/tfprof_log_pb2.py | wwongkamjan/dipnet_press | 787263c1b9484698904f525c8d78d0e333e1c0d9 | [
"MIT"
] | 8 | 2019-10-16T21:09:14.000Z | 2022-02-23T05:20:37.000Z | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: diplomacy_tensorflow/core/profiler/tfprof_log.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from diplomacy_tensorflow.core.framework import attr_value_pb2 as diplomacy__tensorflow_dot_core_dot_framework_dot_attr__value__pb2
from diplomacy_tensorflow.core.framework import step_stats_pb2 as diplomacy__tensorflow_dot_core_dot_framework_dot_step__stats__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='diplomacy_tensorflow/core/profiler/tfprof_log.proto',
package='diplomacy.tensorflow.tfprof',
syntax='proto3',
serialized_options=None,
serialized_pb=_b('\n3diplomacy_tensorflow/core/profiler/tfprof_log.proto\x12\x1b\x64iplomacy.tensorflow.tfprof\x1a\x34\x64iplomacy_tensorflow/core/framework/attr_value.proto\x1a\x34\x64iplomacy_tensorflow/core/framework/step_stats.proto\"\xe9\x01\n\x07\x43odeDef\x12:\n\x06traces\x18\x01 \x03(\x0b\x32*.diplomacy.tensorflow.tfprof.CodeDef.Trace\x1a\xa1\x01\n\x05Trace\x12\x10\n\x04\x66ile\x18\x01 \x01(\tB\x02\x18\x01\x12\x0f\n\x07\x66ile_id\x18\x06 \x01(\x03\x12\x0e\n\x06lineno\x18\x02 \x01(\x05\x12\x14\n\x08\x66unction\x18\x03 \x01(\tB\x02\x18\x01\x12\x13\n\x0b\x66unction_id\x18\x07 \x01(\x03\x12\x10\n\x04line\x18\x04 \x01(\tB\x02\x18\x01\x12\x0f\n\x07line_id\x18\x08 \x01(\x03\x12\x17\n\x0f\x66unc_start_line\x18\x05 \x01(\x05\"t\n\nOpLogEntry\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\tfloat_ops\x18\x02 \x01(\x03\x12\r\n\x05types\x18\x03 \x03(\t\x12\x36\n\x08\x63ode_def\x18\x04 \x01(\x0b\x32$.diplomacy.tensorflow.tfprof.CodeDef\"\xcc\x01\n\nOpLogProto\x12<\n\x0blog_entries\x18\x01 \x03(\x0b\x32\'.diplomacy.tensorflow.tfprof.OpLogEntry\x12M\n\x0cid_to_string\x18\x02 \x03(\x0b\x32\x37.diplomacy.tensorflow.tfprof.OpLogProto.IdToStringEntry\x1a\x31\n\x0fIdToStringEntry\x12\x0b\n\x03key\x18\x01 \x01(\x03\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xf2\x02\n\x0cProfileProto\x12\x43\n\x05nodes\x18\x01 \x03(\x0b\x32\x34.diplomacy.tensorflow.tfprof.ProfileProto.NodesEntry\x12\x11\n\thas_trace\x18\x02 \x01(\x08\x12\x1f\n\x17miss_accelerator_stream\x18\x05 \x01(\x08\x12\r\n\x05steps\x18\x03 \x03(\x03\x12O\n\x0cid_to_string\x18\x04 \x03(\x0b\x32\x39.diplomacy.tensorflow.tfprof.ProfileProto.IdToStringEntry\x1aV\n\nNodesEntry\x12\x0b\n\x03key\x18\x01 \x01(\x03\x12\x37\n\x05value\x18\x02 \x01(\x0b\x32(.diplomacy.tensorflow.tfprof.ProfileNode:\x02\x38\x01\x1a\x31\n\x0fIdToStringEntry\x12\x0b\n\x03key\x18\x01 \x01(\x03\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xcb\t\n\x0bProfileNode\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\n\n\x02op\x18\t \x01(\t\x12\n\n\x02id\x18\r \x01(\x03\x12\x44\n\x06inputs\x18\x02 \x03(\x0b\x32\x34.diplomacy.tensorflow.tfprof.ProfileNode.InputsEntry\x12O\n\x0cinput_shapes\x18\x10 \x03(\x0b\x32\x39.diplomacy.tensorflow.tfprof.ProfileNode.InputShapesEntry\x12\x46\n\x07outputs\x18\x03 \x03(\x0b\x32\x35.diplomacy.tensorflow.tfprof.ProfileNode.OutputsEntry\x12Q\n\routput_shapes\x18\x0f \x03(\x0b\x32:.diplomacy.tensorflow.tfprof.ProfileNode.OutputShapesEntry\x12V\n\x10src_output_index\x18\x0e \x03(\x0b\x32<.diplomacy.tensorflow.tfprof.ProfileNode.SrcOutputIndexEntry\x12\r\n\x05shape\x18\x04 \x03(\x03\x12\x10\n\x08op_types\x18\x05 \x03(\t\x12\x18\n\x10\x63\x61nonical_device\x18\x06 \x01(\t\x12\x13\n\x0bhost_device\x18\x07 \x01(\t\x12\x11\n\tfloat_ops\x18\x08 \x01(\x03\x12\x33\n\x05trace\x18\n \x01(\x0b\x32$.diplomacy.tensorflow.tfprof.CodeDef\x12\x42\n\x05\x61ttrs\x18\x0b \x03(\x0b\x32\x33.diplomacy.tensorflow.tfprof.ProfileNode.AttrsEntry\x12\x42\n\x05\x65xecs\x18\x0c \x03(\x0b\x32\x33.diplomacy.tensorflow.tfprof.ProfileNode.ExecsEntry\x1a-\n\x0bInputsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\r\n\x05value\x18\x02 \x01(\x03:\x02\x38\x01\x1aV\n\x10InputShapesEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".diplomacy.tensorflow.tfprof.Tuple:\x02\x38\x01\x1a.\n\x0cOutputsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\r\n\x05value\x18\x02 \x01(\x03:\x02\x38\x01\x1aW\n\x11OutputShapesEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".diplomacy.tensorflow.tfprof.Tuple:\x02\x38\x01\x1a\x35\n\x13SrcOutputIndexEntry\x12\x0b\n\x03key\x18\x01 \x01(\x03\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1aM\n\nAttrsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.diplomacy.tensorflow.AttrValue:\x02\x38\x01\x1aV\n\nExecsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x03\x12\x37\n\x05value\x18\x02 \x01(\x0b\x32(.diplomacy.tensorflow.tfprof.ExecProfile:\x02\x38\x01\"\xc0\x04\n\x0b\x45xecProfile\x12\x11\n\trun_count\x18\x01 \x01(\x03\x12\x18\n\x10\x61ll_start_micros\x18\x02 \x01(\x03\x12\x19\n\x11latest_end_micros\x18\x03 \x01(\x03\x12Y\n\x11\x61\x63\x63\x65lerator_execs\x18\x04 \x03(\x0b\x32>.diplomacy.tensorflow.tfprof.ExecProfile.AcceleratorExecsEntry\x12I\n\tcpu_execs\x18\x05 \x03(\x0b\x32\x36.diplomacy.tensorflow.tfprof.ExecProfile.CpuExecsEntry\x12=\n\x0cmemory_execs\x18\x07 \x03(\x0b\x32\'.diplomacy.tensorflow.tfprof.ExecMemory\x12;\n\x0b\x61llocations\x18\x0b \x03(\x0b\x32&.diplomacy.tensorflow.AllocationRecord\x12\x0f\n\x07\x64\x65vices\x18\x06 \x03(\t\x1a^\n\x15\x41\x63\x63\x65leratorExecsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x34\n\x05value\x18\x02 \x01(\x0b\x32%.diplomacy.tensorflow.tfprof.ExecTime:\x02\x38\x01\x1aV\n\rCpuExecsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x34\n\x05value\x18\x02 \x01(\x0b\x32%.diplomacy.tensorflow.tfprof.ExecTime:\x02\x38\x01\"=\n\x08\x45xecTime\x12\x31\n\x05times\x18\x01 \x03(\x0b\x32\".diplomacy.tensorflow.tfprof.Tuple\"\xc8\x03\n\nExecMemory\x12\x15\n\rmemory_micros\x18\x01 \x01(\x03\x12\x17\n\x0fhost_temp_bytes\x18\x02 \x01(\x03\x12\x1d\n\x15host_persistent_bytes\x18\x03 \x01(\x03\x12\x1e\n\x16\x61\x63\x63\x65lerator_temp_bytes\x18\x04 \x01(\x03\x12$\n\x1c\x61\x63\x63\x65lerator_persistent_bytes\x18\x05 \x01(\x03\x12\x17\n\x0frequested_bytes\x18\x06 \x01(\x03\x12\x12\n\npeak_bytes\x18\x07 \x01(\x03\x12\x16\n\x0eresidual_bytes\x18\x08 \x01(\x03\x12\x14\n\x0coutput_bytes\x18\t \x01(\x03\x12\x1e\n\x16\x61llocator_bytes_in_use\x18\n \x01(\x03\x12P\n\routput_memory\x18\x0b \x03(\x0b\x32\x39.diplomacy.tensorflow.tfprof.ExecMemory.OutputMemoryEntry\x1aX\n\x11OutputMemoryEntry\x12\x0b\n\x03key\x18\x01 \x01(\x05\x12\x32\n\x05value\x18\x02 \x01(\x0b\x32#.diplomacy.tensorflow.tfprof.Memory:\x02\x38\x01\"\x1d\n\x05Tuple\x12\x14\n\x0cint64_values\x18\x01 \x03(\x03\"$\n\x06Memory\x12\r\n\x05\x62ytes\x18\x01 \x01(\x03\x12\x0b\n\x03ptr\x18\x02 \x01(\x04\x62\x06proto3')
,
dependencies=[diplomacy__tensorflow_dot_core_dot_framework_dot_attr__value__pb2.DESCRIPTOR,diplomacy__tensorflow_dot_core_dot_framework_dot_step__stats__pb2.DESCRIPTOR,])
_CODEDEF_TRACE = _descriptor.Descriptor(
name='Trace',
full_name='diplomacy.tensorflow.tfprof.CodeDef.Trace',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='file', full_name='diplomacy.tensorflow.tfprof.CodeDef.Trace.file', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=_b('\030\001'), file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='file_id', full_name='diplomacy.tensorflow.tfprof.CodeDef.Trace.file_id', index=1,
number=6, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='lineno', full_name='diplomacy.tensorflow.tfprof.CodeDef.Trace.lineno', index=2,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='function', full_name='diplomacy.tensorflow.tfprof.CodeDef.Trace.function', index=3,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=_b('\030\001'), file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='function_id', full_name='diplomacy.tensorflow.tfprof.CodeDef.Trace.function_id', index=4,
number=7, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='line', full_name='diplomacy.tensorflow.tfprof.CodeDef.Trace.line', index=5,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=_b('\030\001'), file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='line_id', full_name='diplomacy.tensorflow.tfprof.CodeDef.Trace.line_id', index=6,
number=8, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='func_start_line', full_name='diplomacy.tensorflow.tfprof.CodeDef.Trace.func_start_line', index=7,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=265,
serialized_end=426,
)
_CODEDEF = _descriptor.Descriptor(
name='CodeDef',
full_name='diplomacy.tensorflow.tfprof.CodeDef',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='traces', full_name='diplomacy.tensorflow.tfprof.CodeDef.traces', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[_CODEDEF_TRACE, ],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=193,
serialized_end=426,
)
_OPLOGENTRY = _descriptor.Descriptor(
name='OpLogEntry',
full_name='diplomacy.tensorflow.tfprof.OpLogEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='diplomacy.tensorflow.tfprof.OpLogEntry.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='float_ops', full_name='diplomacy.tensorflow.tfprof.OpLogEntry.float_ops', index=1,
number=2, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='types', full_name='diplomacy.tensorflow.tfprof.OpLogEntry.types', index=2,
number=3, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='code_def', full_name='diplomacy.tensorflow.tfprof.OpLogEntry.code_def', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=428,
serialized_end=544,
)
_OPLOGPROTO_IDTOSTRINGENTRY = _descriptor.Descriptor(
name='IdToStringEntry',
full_name='diplomacy.tensorflow.tfprof.OpLogProto.IdToStringEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='diplomacy.tensorflow.tfprof.OpLogProto.IdToStringEntry.key', index=0,
number=1, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='value', full_name='diplomacy.tensorflow.tfprof.OpLogProto.IdToStringEntry.value', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=_b('8\001'),
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=702,
serialized_end=751,
)
_OPLOGPROTO = _descriptor.Descriptor(
name='OpLogProto',
full_name='diplomacy.tensorflow.tfprof.OpLogProto',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='log_entries', full_name='diplomacy.tensorflow.tfprof.OpLogProto.log_entries', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='id_to_string', full_name='diplomacy.tensorflow.tfprof.OpLogProto.id_to_string', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[_OPLOGPROTO_IDTOSTRINGENTRY, ],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=547,
serialized_end=751,
)
_PROFILEPROTO_NODESENTRY = _descriptor.Descriptor(
name='NodesEntry',
full_name='diplomacy.tensorflow.tfprof.ProfileProto.NodesEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='diplomacy.tensorflow.tfprof.ProfileProto.NodesEntry.key', index=0,
number=1, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='value', full_name='diplomacy.tensorflow.tfprof.ProfileProto.NodesEntry.value', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=_b('8\001'),
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=987,
serialized_end=1073,
)
_PROFILEPROTO_IDTOSTRINGENTRY = _descriptor.Descriptor(
name='IdToStringEntry',
full_name='diplomacy.tensorflow.tfprof.ProfileProto.IdToStringEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='diplomacy.tensorflow.tfprof.ProfileProto.IdToStringEntry.key', index=0,
number=1, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='value', full_name='diplomacy.tensorflow.tfprof.ProfileProto.IdToStringEntry.value', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=_b('8\001'),
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=702,
serialized_end=751,
)
_PROFILEPROTO = _descriptor.Descriptor(
name='ProfileProto',
full_name='diplomacy.tensorflow.tfprof.ProfileProto',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='nodes', full_name='diplomacy.tensorflow.tfprof.ProfileProto.nodes', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='has_trace', full_name='diplomacy.tensorflow.tfprof.ProfileProto.has_trace', index=1,
number=2, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='miss_accelerator_stream', full_name='diplomacy.tensorflow.tfprof.ProfileProto.miss_accelerator_stream', index=2,
number=5, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='steps', full_name='diplomacy.tensorflow.tfprof.ProfileProto.steps', index=3,
number=3, type=3, cpp_type=2, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='id_to_string', full_name='diplomacy.tensorflow.tfprof.ProfileProto.id_to_string', index=4,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[_PROFILEPROTO_NODESENTRY, _PROFILEPROTO_IDTOSTRINGENTRY, ],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=754,
serialized_end=1124,
)
_PROFILENODE_INPUTSENTRY = _descriptor.Descriptor(
name='InputsEntry',
full_name='diplomacy.tensorflow.tfprof.ProfileNode.InputsEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='diplomacy.tensorflow.tfprof.ProfileNode.InputsEntry.key', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='value', full_name='diplomacy.tensorflow.tfprof.ProfileNode.InputsEntry.value', index=1,
number=2, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=_b('8\001'),
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1862,
serialized_end=1907,
)
_PROFILENODE_INPUTSHAPESENTRY = _descriptor.Descriptor(
name='InputShapesEntry',
full_name='diplomacy.tensorflow.tfprof.ProfileNode.InputShapesEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='diplomacy.tensorflow.tfprof.ProfileNode.InputShapesEntry.key', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='value', full_name='diplomacy.tensorflow.tfprof.ProfileNode.InputShapesEntry.value', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=_b('8\001'),
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1909,
serialized_end=1995,
)
_PROFILENODE_OUTPUTSENTRY = _descriptor.Descriptor(
name='OutputsEntry',
full_name='diplomacy.tensorflow.tfprof.ProfileNode.OutputsEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='diplomacy.tensorflow.tfprof.ProfileNode.OutputsEntry.key', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='value', full_name='diplomacy.tensorflow.tfprof.ProfileNode.OutputsEntry.value', index=1,
number=2, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=_b('8\001'),
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1997,
serialized_end=2043,
)
_PROFILENODE_OUTPUTSHAPESENTRY = _descriptor.Descriptor(
name='OutputShapesEntry',
full_name='diplomacy.tensorflow.tfprof.ProfileNode.OutputShapesEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='diplomacy.tensorflow.tfprof.ProfileNode.OutputShapesEntry.key', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='value', full_name='diplomacy.tensorflow.tfprof.ProfileNode.OutputShapesEntry.value', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=_b('8\001'),
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=2045,
serialized_end=2132,
)
_PROFILENODE_SRCOUTPUTINDEXENTRY = _descriptor.Descriptor(
name='SrcOutputIndexEntry',
full_name='diplomacy.tensorflow.tfprof.ProfileNode.SrcOutputIndexEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='diplomacy.tensorflow.tfprof.ProfileNode.SrcOutputIndexEntry.key', index=0,
number=1, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='value', full_name='diplomacy.tensorflow.tfprof.ProfileNode.SrcOutputIndexEntry.value', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=_b('8\001'),
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=2134,
serialized_end=2187,
)
_PROFILENODE_ATTRSENTRY = _descriptor.Descriptor(
name='AttrsEntry',
full_name='diplomacy.tensorflow.tfprof.ProfileNode.AttrsEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='diplomacy.tensorflow.tfprof.ProfileNode.AttrsEntry.key', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='value', full_name='diplomacy.tensorflow.tfprof.ProfileNode.AttrsEntry.value', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=_b('8\001'),
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=2189,
serialized_end=2266,
)
_PROFILENODE_EXECSENTRY = _descriptor.Descriptor(
name='ExecsEntry',
full_name='diplomacy.tensorflow.tfprof.ProfileNode.ExecsEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='diplomacy.tensorflow.tfprof.ProfileNode.ExecsEntry.key', index=0,
number=1, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='value', full_name='diplomacy.tensorflow.tfprof.ProfileNode.ExecsEntry.value', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=_b('8\001'),
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=2268,
serialized_end=2354,
)
_PROFILENODE = _descriptor.Descriptor(
name='ProfileNode',
full_name='diplomacy.tensorflow.tfprof.ProfileNode',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='diplomacy.tensorflow.tfprof.ProfileNode.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='op', full_name='diplomacy.tensorflow.tfprof.ProfileNode.op', index=1,
number=9, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='id', full_name='diplomacy.tensorflow.tfprof.ProfileNode.id', index=2,
number=13, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='inputs', full_name='diplomacy.tensorflow.tfprof.ProfileNode.inputs', index=3,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='input_shapes', full_name='diplomacy.tensorflow.tfprof.ProfileNode.input_shapes', index=4,
number=16, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='outputs', full_name='diplomacy.tensorflow.tfprof.ProfileNode.outputs', index=5,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='output_shapes', full_name='diplomacy.tensorflow.tfprof.ProfileNode.output_shapes', index=6,
number=15, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='src_output_index', full_name='diplomacy.tensorflow.tfprof.ProfileNode.src_output_index', index=7,
number=14, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='shape', full_name='diplomacy.tensorflow.tfprof.ProfileNode.shape', index=8,
number=4, type=3, cpp_type=2, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='op_types', full_name='diplomacy.tensorflow.tfprof.ProfileNode.op_types', index=9,
number=5, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='canonical_device', full_name='diplomacy.tensorflow.tfprof.ProfileNode.canonical_device', index=10,
number=6, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='host_device', full_name='diplomacy.tensorflow.tfprof.ProfileNode.host_device', index=11,
number=7, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='float_ops', full_name='diplomacy.tensorflow.tfprof.ProfileNode.float_ops', index=12,
number=8, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='trace', full_name='diplomacy.tensorflow.tfprof.ProfileNode.trace', index=13,
number=10, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='attrs', full_name='diplomacy.tensorflow.tfprof.ProfileNode.attrs', index=14,
number=11, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='execs', full_name='diplomacy.tensorflow.tfprof.ProfileNode.execs', index=15,
number=12, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[_PROFILENODE_INPUTSENTRY, _PROFILENODE_INPUTSHAPESENTRY, _PROFILENODE_OUTPUTSENTRY, _PROFILENODE_OUTPUTSHAPESENTRY, _PROFILENODE_SRCOUTPUTINDEXENTRY, _PROFILENODE_ATTRSENTRY, _PROFILENODE_EXECSENTRY, ],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1127,
serialized_end=2354,
)
_EXECPROFILE_ACCELERATOREXECSENTRY = _descriptor.Descriptor(
name='AcceleratorExecsEntry',
full_name='diplomacy.tensorflow.tfprof.ExecProfile.AcceleratorExecsEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='diplomacy.tensorflow.tfprof.ExecProfile.AcceleratorExecsEntry.key', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='value', full_name='diplomacy.tensorflow.tfprof.ExecProfile.AcceleratorExecsEntry.value', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=_b('8\001'),
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=2751,
serialized_end=2845,
)
_EXECPROFILE_CPUEXECSENTRY = _descriptor.Descriptor(
name='CpuExecsEntry',
full_name='diplomacy.tensorflow.tfprof.ExecProfile.CpuExecsEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='diplomacy.tensorflow.tfprof.ExecProfile.CpuExecsEntry.key', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='value', full_name='diplomacy.tensorflow.tfprof.ExecProfile.CpuExecsEntry.value', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=_b('8\001'),
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=2847,
serialized_end=2933,
)
_EXECPROFILE = _descriptor.Descriptor(
name='ExecProfile',
full_name='diplomacy.tensorflow.tfprof.ExecProfile',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='run_count', full_name='diplomacy.tensorflow.tfprof.ExecProfile.run_count', index=0,
number=1, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='all_start_micros', full_name='diplomacy.tensorflow.tfprof.ExecProfile.all_start_micros', index=1,
number=2, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='latest_end_micros', full_name='diplomacy.tensorflow.tfprof.ExecProfile.latest_end_micros', index=2,
number=3, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='accelerator_execs', full_name='diplomacy.tensorflow.tfprof.ExecProfile.accelerator_execs', index=3,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cpu_execs', full_name='diplomacy.tensorflow.tfprof.ExecProfile.cpu_execs', index=4,
number=5, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='memory_execs', full_name='diplomacy.tensorflow.tfprof.ExecProfile.memory_execs', index=5,
number=7, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='allocations', full_name='diplomacy.tensorflow.tfprof.ExecProfile.allocations', index=6,
number=11, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='devices', full_name='diplomacy.tensorflow.tfprof.ExecProfile.devices', index=7,
number=6, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[_EXECPROFILE_ACCELERATOREXECSENTRY, _EXECPROFILE_CPUEXECSENTRY, ],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=2357,
serialized_end=2933,
)
_EXECTIME = _descriptor.Descriptor(
name='ExecTime',
full_name='diplomacy.tensorflow.tfprof.ExecTime',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='times', full_name='diplomacy.tensorflow.tfprof.ExecTime.times', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=2935,
serialized_end=2996,
)
_EXECMEMORY_OUTPUTMEMORYENTRY = _descriptor.Descriptor(
name='OutputMemoryEntry',
full_name='diplomacy.tensorflow.tfprof.ExecMemory.OutputMemoryEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='diplomacy.tensorflow.tfprof.ExecMemory.OutputMemoryEntry.key', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='value', full_name='diplomacy.tensorflow.tfprof.ExecMemory.OutputMemoryEntry.value', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=_b('8\001'),
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=3367,
serialized_end=3455,
)
_EXECMEMORY = _descriptor.Descriptor(
name='ExecMemory',
full_name='diplomacy.tensorflow.tfprof.ExecMemory',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='memory_micros', full_name='diplomacy.tensorflow.tfprof.ExecMemory.memory_micros', index=0,
number=1, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='host_temp_bytes', full_name='diplomacy.tensorflow.tfprof.ExecMemory.host_temp_bytes', index=1,
number=2, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='host_persistent_bytes', full_name='diplomacy.tensorflow.tfprof.ExecMemory.host_persistent_bytes', index=2,
number=3, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='accelerator_temp_bytes', full_name='diplomacy.tensorflow.tfprof.ExecMemory.accelerator_temp_bytes', index=3,
number=4, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='accelerator_persistent_bytes', full_name='diplomacy.tensorflow.tfprof.ExecMemory.accelerator_persistent_bytes', index=4,
number=5, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='requested_bytes', full_name='diplomacy.tensorflow.tfprof.ExecMemory.requested_bytes', index=5,
number=6, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='peak_bytes', full_name='diplomacy.tensorflow.tfprof.ExecMemory.peak_bytes', index=6,
number=7, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='residual_bytes', full_name='diplomacy.tensorflow.tfprof.ExecMemory.residual_bytes', index=7,
number=8, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='output_bytes', full_name='diplomacy.tensorflow.tfprof.ExecMemory.output_bytes', index=8,
number=9, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='allocator_bytes_in_use', full_name='diplomacy.tensorflow.tfprof.ExecMemory.allocator_bytes_in_use', index=9,
number=10, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='output_memory', full_name='diplomacy.tensorflow.tfprof.ExecMemory.output_memory', index=10,
number=11, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[_EXECMEMORY_OUTPUTMEMORYENTRY, ],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=2999,
serialized_end=3455,
)
_TUPLE = _descriptor.Descriptor(
name='Tuple',
full_name='diplomacy.tensorflow.tfprof.Tuple',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='int64_values', full_name='diplomacy.tensorflow.tfprof.Tuple.int64_values', index=0,
number=1, type=3, cpp_type=2, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=3457,
serialized_end=3486,
)
_MEMORY = _descriptor.Descriptor(
name='Memory',
full_name='diplomacy.tensorflow.tfprof.Memory',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='bytes', full_name='diplomacy.tensorflow.tfprof.Memory.bytes', index=0,
number=1, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='ptr', full_name='diplomacy.tensorflow.tfprof.Memory.ptr', index=1,
number=2, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=3488,
serialized_end=3524,
)
_CODEDEF_TRACE.containing_type = _CODEDEF
_CODEDEF.fields_by_name['traces'].message_type = _CODEDEF_TRACE
_OPLOGENTRY.fields_by_name['code_def'].message_type = _CODEDEF
_OPLOGPROTO_IDTOSTRINGENTRY.containing_type = _OPLOGPROTO
_OPLOGPROTO.fields_by_name['log_entries'].message_type = _OPLOGENTRY
_OPLOGPROTO.fields_by_name['id_to_string'].message_type = _OPLOGPROTO_IDTOSTRINGENTRY
_PROFILEPROTO_NODESENTRY.fields_by_name['value'].message_type = _PROFILENODE
_PROFILEPROTO_NODESENTRY.containing_type = _PROFILEPROTO
_PROFILEPROTO_IDTOSTRINGENTRY.containing_type = _PROFILEPROTO
_PROFILEPROTO.fields_by_name['nodes'].message_type = _PROFILEPROTO_NODESENTRY
_PROFILEPROTO.fields_by_name['id_to_string'].message_type = _PROFILEPROTO_IDTOSTRINGENTRY
_PROFILENODE_INPUTSENTRY.containing_type = _PROFILENODE
_PROFILENODE_INPUTSHAPESENTRY.fields_by_name['value'].message_type = _TUPLE
_PROFILENODE_INPUTSHAPESENTRY.containing_type = _PROFILENODE
_PROFILENODE_OUTPUTSENTRY.containing_type = _PROFILENODE
_PROFILENODE_OUTPUTSHAPESENTRY.fields_by_name['value'].message_type = _TUPLE
_PROFILENODE_OUTPUTSHAPESENTRY.containing_type = _PROFILENODE
_PROFILENODE_SRCOUTPUTINDEXENTRY.containing_type = _PROFILENODE
_PROFILENODE_ATTRSENTRY.fields_by_name['value'].message_type = diplomacy__tensorflow_dot_core_dot_framework_dot_attr__value__pb2._ATTRVALUE
_PROFILENODE_ATTRSENTRY.containing_type = _PROFILENODE
_PROFILENODE_EXECSENTRY.fields_by_name['value'].message_type = _EXECPROFILE
_PROFILENODE_EXECSENTRY.containing_type = _PROFILENODE
_PROFILENODE.fields_by_name['inputs'].message_type = _PROFILENODE_INPUTSENTRY
_PROFILENODE.fields_by_name['input_shapes'].message_type = _PROFILENODE_INPUTSHAPESENTRY
_PROFILENODE.fields_by_name['outputs'].message_type = _PROFILENODE_OUTPUTSENTRY
_PROFILENODE.fields_by_name['output_shapes'].message_type = _PROFILENODE_OUTPUTSHAPESENTRY
_PROFILENODE.fields_by_name['src_output_index'].message_type = _PROFILENODE_SRCOUTPUTINDEXENTRY
_PROFILENODE.fields_by_name['trace'].message_type = _CODEDEF
_PROFILENODE.fields_by_name['attrs'].message_type = _PROFILENODE_ATTRSENTRY
_PROFILENODE.fields_by_name['execs'].message_type = _PROFILENODE_EXECSENTRY
_EXECPROFILE_ACCELERATOREXECSENTRY.fields_by_name['value'].message_type = _EXECTIME
_EXECPROFILE_ACCELERATOREXECSENTRY.containing_type = _EXECPROFILE
_EXECPROFILE_CPUEXECSENTRY.fields_by_name['value'].message_type = _EXECTIME
_EXECPROFILE_CPUEXECSENTRY.containing_type = _EXECPROFILE
_EXECPROFILE.fields_by_name['accelerator_execs'].message_type = _EXECPROFILE_ACCELERATOREXECSENTRY
_EXECPROFILE.fields_by_name['cpu_execs'].message_type = _EXECPROFILE_CPUEXECSENTRY
_EXECPROFILE.fields_by_name['memory_execs'].message_type = _EXECMEMORY
_EXECPROFILE.fields_by_name['allocations'].message_type = diplomacy__tensorflow_dot_core_dot_framework_dot_step__stats__pb2._ALLOCATIONRECORD
_EXECTIME.fields_by_name['times'].message_type = _TUPLE
_EXECMEMORY_OUTPUTMEMORYENTRY.fields_by_name['value'].message_type = _MEMORY
_EXECMEMORY_OUTPUTMEMORYENTRY.containing_type = _EXECMEMORY
_EXECMEMORY.fields_by_name['output_memory'].message_type = _EXECMEMORY_OUTPUTMEMORYENTRY
DESCRIPTOR.message_types_by_name['CodeDef'] = _CODEDEF
DESCRIPTOR.message_types_by_name['OpLogEntry'] = _OPLOGENTRY
DESCRIPTOR.message_types_by_name['OpLogProto'] = _OPLOGPROTO
DESCRIPTOR.message_types_by_name['ProfileProto'] = _PROFILEPROTO
DESCRIPTOR.message_types_by_name['ProfileNode'] = _PROFILENODE
DESCRIPTOR.message_types_by_name['ExecProfile'] = _EXECPROFILE
DESCRIPTOR.message_types_by_name['ExecTime'] = _EXECTIME
DESCRIPTOR.message_types_by_name['ExecMemory'] = _EXECMEMORY
DESCRIPTOR.message_types_by_name['Tuple'] = _TUPLE
DESCRIPTOR.message_types_by_name['Memory'] = _MEMORY
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
CodeDef = _reflection.GeneratedProtocolMessageType('CodeDef', (_message.Message,), dict(
Trace = _reflection.GeneratedProtocolMessageType('Trace', (_message.Message,), dict(
DESCRIPTOR = _CODEDEF_TRACE,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.CodeDef.Trace)
))
,
DESCRIPTOR = _CODEDEF,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.CodeDef)
))
_sym_db.RegisterMessage(CodeDef)
_sym_db.RegisterMessage(CodeDef.Trace)
OpLogEntry = _reflection.GeneratedProtocolMessageType('OpLogEntry', (_message.Message,), dict(
DESCRIPTOR = _OPLOGENTRY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.OpLogEntry)
))
_sym_db.RegisterMessage(OpLogEntry)
OpLogProto = _reflection.GeneratedProtocolMessageType('OpLogProto', (_message.Message,), dict(
IdToStringEntry = _reflection.GeneratedProtocolMessageType('IdToStringEntry', (_message.Message,), dict(
DESCRIPTOR = _OPLOGPROTO_IDTOSTRINGENTRY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.OpLogProto.IdToStringEntry)
))
,
DESCRIPTOR = _OPLOGPROTO,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.OpLogProto)
))
_sym_db.RegisterMessage(OpLogProto)
_sym_db.RegisterMessage(OpLogProto.IdToStringEntry)
ProfileProto = _reflection.GeneratedProtocolMessageType('ProfileProto', (_message.Message,), dict(
NodesEntry = _reflection.GeneratedProtocolMessageType('NodesEntry', (_message.Message,), dict(
DESCRIPTOR = _PROFILEPROTO_NODESENTRY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ProfileProto.NodesEntry)
))
,
IdToStringEntry = _reflection.GeneratedProtocolMessageType('IdToStringEntry', (_message.Message,), dict(
DESCRIPTOR = _PROFILEPROTO_IDTOSTRINGENTRY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ProfileProto.IdToStringEntry)
))
,
DESCRIPTOR = _PROFILEPROTO,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ProfileProto)
))
_sym_db.RegisterMessage(ProfileProto)
_sym_db.RegisterMessage(ProfileProto.NodesEntry)
_sym_db.RegisterMessage(ProfileProto.IdToStringEntry)
ProfileNode = _reflection.GeneratedProtocolMessageType('ProfileNode', (_message.Message,), dict(
InputsEntry = _reflection.GeneratedProtocolMessageType('InputsEntry', (_message.Message,), dict(
DESCRIPTOR = _PROFILENODE_INPUTSENTRY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ProfileNode.InputsEntry)
))
,
InputShapesEntry = _reflection.GeneratedProtocolMessageType('InputShapesEntry', (_message.Message,), dict(
DESCRIPTOR = _PROFILENODE_INPUTSHAPESENTRY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ProfileNode.InputShapesEntry)
))
,
OutputsEntry = _reflection.GeneratedProtocolMessageType('OutputsEntry', (_message.Message,), dict(
DESCRIPTOR = _PROFILENODE_OUTPUTSENTRY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ProfileNode.OutputsEntry)
))
,
OutputShapesEntry = _reflection.GeneratedProtocolMessageType('OutputShapesEntry', (_message.Message,), dict(
DESCRIPTOR = _PROFILENODE_OUTPUTSHAPESENTRY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ProfileNode.OutputShapesEntry)
))
,
SrcOutputIndexEntry = _reflection.GeneratedProtocolMessageType('SrcOutputIndexEntry', (_message.Message,), dict(
DESCRIPTOR = _PROFILENODE_SRCOUTPUTINDEXENTRY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ProfileNode.SrcOutputIndexEntry)
))
,
AttrsEntry = _reflection.GeneratedProtocolMessageType('AttrsEntry', (_message.Message,), dict(
DESCRIPTOR = _PROFILENODE_ATTRSENTRY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ProfileNode.AttrsEntry)
))
,
ExecsEntry = _reflection.GeneratedProtocolMessageType('ExecsEntry', (_message.Message,), dict(
DESCRIPTOR = _PROFILENODE_EXECSENTRY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ProfileNode.ExecsEntry)
))
,
DESCRIPTOR = _PROFILENODE,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ProfileNode)
))
_sym_db.RegisterMessage(ProfileNode)
_sym_db.RegisterMessage(ProfileNode.InputsEntry)
_sym_db.RegisterMessage(ProfileNode.InputShapesEntry)
_sym_db.RegisterMessage(ProfileNode.OutputsEntry)
_sym_db.RegisterMessage(ProfileNode.OutputShapesEntry)
_sym_db.RegisterMessage(ProfileNode.SrcOutputIndexEntry)
_sym_db.RegisterMessage(ProfileNode.AttrsEntry)
_sym_db.RegisterMessage(ProfileNode.ExecsEntry)
ExecProfile = _reflection.GeneratedProtocolMessageType('ExecProfile', (_message.Message,), dict(
AcceleratorExecsEntry = _reflection.GeneratedProtocolMessageType('AcceleratorExecsEntry', (_message.Message,), dict(
DESCRIPTOR = _EXECPROFILE_ACCELERATOREXECSENTRY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ExecProfile.AcceleratorExecsEntry)
))
,
CpuExecsEntry = _reflection.GeneratedProtocolMessageType('CpuExecsEntry', (_message.Message,), dict(
DESCRIPTOR = _EXECPROFILE_CPUEXECSENTRY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ExecProfile.CpuExecsEntry)
))
,
DESCRIPTOR = _EXECPROFILE,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ExecProfile)
))
_sym_db.RegisterMessage(ExecProfile)
_sym_db.RegisterMessage(ExecProfile.AcceleratorExecsEntry)
_sym_db.RegisterMessage(ExecProfile.CpuExecsEntry)
ExecTime = _reflection.GeneratedProtocolMessageType('ExecTime', (_message.Message,), dict(
DESCRIPTOR = _EXECTIME,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ExecTime)
))
_sym_db.RegisterMessage(ExecTime)
ExecMemory = _reflection.GeneratedProtocolMessageType('ExecMemory', (_message.Message,), dict(
OutputMemoryEntry = _reflection.GeneratedProtocolMessageType('OutputMemoryEntry', (_message.Message,), dict(
DESCRIPTOR = _EXECMEMORY_OUTPUTMEMORYENTRY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ExecMemory.OutputMemoryEntry)
))
,
DESCRIPTOR = _EXECMEMORY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.ExecMemory)
))
_sym_db.RegisterMessage(ExecMemory)
_sym_db.RegisterMessage(ExecMemory.OutputMemoryEntry)
Tuple = _reflection.GeneratedProtocolMessageType('Tuple', (_message.Message,), dict(
DESCRIPTOR = _TUPLE,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.Tuple)
))
_sym_db.RegisterMessage(Tuple)
Memory = _reflection.GeneratedProtocolMessageType('Memory', (_message.Message,), dict(
DESCRIPTOR = _MEMORY,
__module__ = 'diplomacy_tensorflow.core.profiler.tfprof_log_pb2'
# @@protoc_insertion_point(class_scope:diplomacy.tensorflow.tfprof.Memory)
))
_sym_db.RegisterMessage(Memory)
_CODEDEF_TRACE.fields_by_name['file']._options = None
_CODEDEF_TRACE.fields_by_name['function']._options = None
_CODEDEF_TRACE.fields_by_name['line']._options = None
_OPLOGPROTO_IDTOSTRINGENTRY._options = None
_PROFILEPROTO_NODESENTRY._options = None
_PROFILEPROTO_IDTOSTRINGENTRY._options = None
_PROFILENODE_INPUTSENTRY._options = None
_PROFILENODE_INPUTSHAPESENTRY._options = None
_PROFILENODE_OUTPUTSENTRY._options = None
_PROFILENODE_OUTPUTSHAPESENTRY._options = None
_PROFILENODE_SRCOUTPUTINDEXENTRY._options = None
_PROFILENODE_ATTRSENTRY._options = None
_PROFILENODE_EXECSENTRY._options = None
_EXECPROFILE_ACCELERATOREXECSENTRY._options = None
_EXECPROFILE_CPUEXECSENTRY._options = None
_EXECMEMORY_OUTPUTMEMORYENTRY._options = None
# @@protoc_insertion_point(module_scope)
| 44.320611 | 5,891 | 0.759324 | 7,885 | 63,866 | 5.856944 | 0.047939 | 0.048331 | 0.086614 | 0.063726 | 0.769326 | 0.724871 | 0.680157 | 0.6265 | 0.59625 | 0.593218 | 0 | 0.039031 | 0.118655 | 63,866 | 1,440 | 5,892 | 44.351389 | 0.781428 | 0.035105 | 0 | 0.689501 | 1 | 0.003723 | 0.189301 | 0.159477 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.005212 | 0 | 0.005212 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6b57a91a639465ebe9f1c9337bf98a3cc0661d78 | 100 | py | Python | pyvisdk/__init__.py | Infinidat/pyvisdk | f2f4e5f50da16f659ccc1d84b6a00f397fa997f8 | [
"MIT"
] | null | null | null | pyvisdk/__init__.py | Infinidat/pyvisdk | f2f4e5f50da16f659ccc1d84b6a00f397fa997f8 | [
"MIT"
] | null | null | null | pyvisdk/__init__.py | Infinidat/pyvisdk | f2f4e5f50da16f659ccc1d84b6a00f397fa997f8 | [
"MIT"
] | null | null | null | __version__ = '0.9.45'
Version = __version__ # for backware compatibility
from vim import Vim, Sms
| 20 | 50 | 0.76 | 14 | 100 | 4.857143 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047619 | 0.16 | 100 | 4 | 51 | 25 | 0.761905 | 0.26 | 0 | 0 | 0 | 0 | 0.083333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
6b67f9e528dac16645e929ce6b166e5dff07121b | 9,155 | gyp | Python | binding.gyp | worldmaking/node-gles3 | cd0735c24c37d465e9ea786b0d6d9a88f724eba5 | [
"MIT"
] | 8 | 2021-01-18T21:05:51.000Z | 2022-01-26T01:40:46.000Z | binding.gyp | worldmaking/node-gles3 | cd0735c24c37d465e9ea786b0d6d9a88f724eba5 | [
"MIT"
] | 5 | 2020-05-21T22:01:16.000Z | 2020-08-20T15:35:12.000Z | binding.gyp | worldmaking/node-gles3 | cd0735c24c37d465e9ea786b0d6d9a88f724eba5 | [
"MIT"
] | 4 | 2020-10-02T18:14:15.000Z | 2022-01-26T02:04:21.000Z | {
"targets": [
{
"target_name": "gles3",
"sources": [ "src/node-gles3.cpp" ],
'include_dirs': [
'src', 'src/include'
],
'cflags':[],
'conditions': [
['OS=="mac"',
{
'libraries': [
'-lGLEW',
'-framework OpenGL'
],
'include_dirs': [
'./node_modules/native-graphics-deps/include'
],
'library_dirs': [
'../node_modules/native-graphics-deps/lib/macos/glew'
],
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.13',
'OTHER_CFLAGS': [
"-Wno-unused-but-set-variable","-Wno-unused-parameter","-Wno-unused-variable","-Wno-int-to-void-pointer-cast"
],
}
}
],
['OS=="linux"', {
'libraries': [
'-lGLEW','-lGL']
}
],
['OS=="win"',
{
'include_dirs': [
'./node_modules/native-graphics-deps/include',
],
'library_dirs': [
'./node_modules/native-graphics-deps/lib/windows/glew',
'lib/<(target_arch)',
],
'libraries': [
'glew32.lib',
'opengl32.lib'
],
'defines' : [
'WIN32_LEAN_AND_MEAN',
'VC_EXTRALEAN'
],
'msvs_settings' : {
'VCCLCompilerTool' : {
'AdditionalOptions' : []
},
'VCLinkerTool' : {
'AdditionalOptions' : ['/OPT:REF','/OPT:ICF','/LTCG']
},
},
'copies': [
{
'destination': './build/<(CONFIGURATION_NAME)/',
'files': [
'./node_modules/native-graphics-deps/lib/windows/glew/glew32.dll'
]
}
],
}
],
],
},
{
"target_name": "glfw3",
"sources": [ "src/node-glfw3.cpp" ],
'include_dirs': [
'src', 'src/include'
],
'cflags':[],
'conditions': [
['OS=="mac"',
{
'libraries': [
'-framework Cocoa',
'../node_modules/native-graphics-deps/lib/macos/glfw/libglfw3.a'
],
'include_dirs': [
'./node_modules/native-graphics-deps/include'
],
'library_dirs': [
],
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.13',
'OTHER_CFLAGS': [
"-Wno-unused-but-set-variable","-Wno-unused-parameter","-Wno-unused-variable"
],
}
}
],
['OS=="linux"', {
'libraries': []
}
],
['OS=="win"',
{
'include_dirs': [
'./node_modules/native-graphics-deps/include',
],
'library_dirs': [
'./node_modules/native-graphics-deps/lib/windows/glfw'
],
'libraries': [
'glfw3dll.lib'
],
'defines' : [
'WIN32_LEAN_AND_MEAN',
'VC_EXTRALEAN'
],
'msvs_settings' : {
'VCCLCompilerTool' : {
'AdditionalOptions' : []
},
'VCLinkerTool' : {
'AdditionalOptions' : ['/OPT:REF','/OPT:ICF','/LTCG']
},
},
'copies': [
{
'destination': './build/<(CONFIGURATION_NAME)/',
'files': [
'./node_modules/native-graphics-deps/lib/windows/glfw/glfw3.dll'
]
}
],
}
],
],
},
{
"target_name": "openvr",
"sources": [ "src/node-openvr.cpp" ],
'include_dirs': [
'./node_modules/native-graphics-deps/include',
'./node_modules/native-openvr-deps/headers',
'src', 'src/include'
],
"cflags": ["-std=c++11", "-Wall", "-pedantic"],
'conditions': [
['OS=="mac"',
{
'libraries': [
],
'library_dirs': [
],
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.13',
'OTHER_CFLAGS': [
"-Wno-unused-but-set-variable","-Wno-unused-parameter","-Wno-unused-variable","-Wno-int-to-void-pointer-cast"
],
},
'copies': [
{
'destination': './build/<(CONFIGURATION_NAME)/',
'files': [
'./node_modules/native-openvr-deps/lib/osx32/libopenvr_api.dylib'
]
}
],
}
],
['OS=="linux"', {
'libraries': [
'-lGLEW','-lGL']
}
],
['OS=="win"',
{
'library_dirs': [
'./node_modules/native-openvr-deps/lib/win64',
],
'libraries': [
'openvr_api.lib'
],
'defines' : [
'WIN32_LEAN_AND_MEAN',
'VC_EXTRALEAN'
],
'msvs_settings' : {
'VCCLCompilerTool' : {
'AdditionalOptions' : []
},
'VCLinkerTool' : {
'AdditionalOptions' : ['/OPT:REF','/OPT:ICF','/LTCG']
},
},
'copies': [
{
'destination': './build/<(CONFIGURATION_NAME)/',
'files': [
'./node_modules/native-openvr-deps/bin/win64/openvr_api.dll'
]
}
],
}
],
],
},
{
"target_name": "audio",
"sources": [ "src/node-audio.cpp" ],
"defines": [],
"cflags": ["-std=c++11", "-Wall", "-pedantic"],
'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],
"include_dirs": [
"<!(node -p \"require('node-addon-api').include_dir\")",
"src/miniaudio.h"
],
"libraries": [],
"dependencies": [],
"conditions": [
['OS=="win"', {
'msvs_settings': {
'VCCLCompilerTool': { 'ExceptionHandling': 1 },
}
}],
['OS=="mac"', {
'cflags+': ['-fvisibility=hidden'],
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'CLANG_CXX_LIBRARY': 'libc++',
'MACOSX_DEPLOYMENT_TARGET': '10.7',
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
},
}],
['OS=="linux"', {}],
],
},
{
"target_name": "zed",
"sources": [],
"defines": [],
"cflags": ["-std=c++11", "-Wall", "-pedantic"],
"include_dirs": [
"<!(node -p \"require('node-addon-api').include_dir\")",
],
"libraries": [],
"dependencies": [],
"conditions": [
['OS=="win"', {
"sources": [ "src/node-zed.cpp" ],
'include_dirs': [
"$(CUDA_PATH)/include",
"$(ZED_SDK_ROOT_DIR)/include"],
'library_dirs': [
'$(ZED_SDK_ROOT_DIR)/lib',
],
'libraries': [
'sl_zed64.lib'
],
'msvs_settings': {
'VCCLCompilerTool': { 'ExceptionHandling': 1 }
}
}],
['OS=="mac"', {
'cflags+': ['-fvisibility=hidden'],
'xcode_settings': {},
}],
['OS=="linux"', {}],
],
},
{
"target_name": "realsense",
"sources": [ "src/node-realsense.cpp" ],
"defines": [],
"cflags": ["-std=c++11", "-Wall", "-pedantic"],
"include_dirs": [
"<!(node -p \"require('node-addon-api').include_dir\")"
],
"libraries": [],
"dependencies": [],
"conditions": [
['OS=="win"', {
'include_dirs': [
"C:\\Program Files (x86)\\Intel RealSense SDK 2.0\\include"
],
'library_dirs': [
'C:\\Program Files (x86)\\Intel RealSense SDK 2.0\\lib\\x64',
],
'libraries': [
'-lrealsense2.lib'
],
'msvs_settings': {
'VCCLCompilerTool': { 'ExceptionHandling': 1 }
},
"copies": [{
'destination': './build/<(CONFIGURATION_NAME)/',
'files': ['C:\\Program Files (x86)\\Intel RealSense SDK 2.0\\bin\\x64\\realsense2.dll']
}]
}],
['OS=="mac"', {
'cflags+': ['-fvisibility=hidden'],
'xcode_settings': {},
}],
['OS=="linux"', {}],
],
}
]
} | 29.532258 | 125 | 0.38012 | 618 | 9,155 | 5.461165 | 0.213592 | 0.048889 | 0.075556 | 0.081481 | 0.761185 | 0.739259 | 0.693926 | 0.665778 | 0.636148 | 0.609481 | 0 | 0.013924 | 0.443037 | 9,155 | 310 | 126 | 29.532258 | 0.64797 | 0.002075 | 0 | 0.640777 | 0 | 0.003236 | 0.423864 | 0.149425 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6b68064894358b2687d6d8c25905ff9d4b1b50bd | 206 | py | Python | tests/sandbox/.venv_ccf_sandbox/lib/python3.8/site-packages/adtk/metrics/__init__.py | iLuSIAnn/test | 10d0a20dc1a646b5c1f6c7bff2960e3f5df0510e | [
"Apache-2.0"
] | null | null | null | tests/sandbox/.venv_ccf_sandbox/lib/python3.8/site-packages/adtk/metrics/__init__.py | iLuSIAnn/test | 10d0a20dc1a646b5c1f6c7bff2960e3f5df0510e | [
"Apache-2.0"
] | null | null | null | tests/sandbox/.venv_ccf_sandbox/lib/python3.8/site-packages/adtk/metrics/__init__.py | iLuSIAnn/test | 10d0a20dc1a646b5c1f6c7bff2960e3f5df0510e | [
"Apache-2.0"
] | null | null | null | """
Module of metrics that measure the quality of detection results against true
anomalies.
"""
from ._metrics import f1_score, iou, precision, recall
__all__ = ["recall", "precision", "f1_score", "iou"]
| 22.888889 | 76 | 0.73301 | 27 | 206 | 5.333333 | 0.740741 | 0.097222 | 0.138889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011364 | 0.145631 | 206 | 8 | 77 | 25.75 | 0.806818 | 0.42233 | 0 | 0 | 0 | 0 | 0.234234 | 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 |
6b91c58ef005466ef729ed975ff1db97bef30c17 | 10,742 | py | Python | src/domainClient/models/domain_search_service_v2_model_domain_search_web_api_v2_models_search_location.py | diabolical-ninja/smart-property-search | 0931c7c8195ec21cbd56768c9c84cea2927a9e1d | [
"MIT"
] | 5 | 2021-04-12T04:10:42.000Z | 2021-04-28T05:54:22.000Z | src/domainClient/models/domain_search_service_v2_model_domain_search_web_api_v2_models_search_location.py | diabolical-ninja/smart-property-search | 0931c7c8195ec21cbd56768c9c84cea2927a9e1d | [
"MIT"
] | 35 | 2020-05-26T14:21:37.000Z | 2022-03-29T16:14:42.000Z | src/domainClient/models/domain_search_service_v2_model_domain_search_web_api_v2_models_search_location.py | diabolical-ninja/smart-property-search | 0931c7c8195ec21cbd56768c9c84cea2927a9e1d | [
"MIT"
] | 2 | 2020-05-26T14:02:12.000Z | 2022-01-10T08:19:49.000Z | # coding: utf-8
"""
Domain Group API V1
Provides public access to Domain's microservices # noqa: E501
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'state': 'str',
'region': 'str',
'area': 'str',
'suburb': 'str',
'post_code': 'str',
'include_surrounding_suburbs': 'bool',
'surrounding_radius_in_meters': 'int',
'defines_postcode_only': 'bool'
}
attribute_map = {
'state': 'state',
'region': 'region',
'area': 'area',
'suburb': 'suburb',
'post_code': 'postCode',
'include_surrounding_suburbs': 'includeSurroundingSuburbs',
'surrounding_radius_in_meters': 'surroundingRadiusInMeters',
'defines_postcode_only': 'definesPostcodeOnly'
}
def __init__(self, state=None, region=None, area=None, suburb=None, post_code=None, include_surrounding_suburbs=None, surrounding_radius_in_meters=None, defines_postcode_only=None): # noqa: E501
"""DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation - a model defined in Swagger""" # noqa: E501
self._state = None
self._region = None
self._area = None
self._suburb = None
self._post_code = None
self._include_surrounding_suburbs = None
self._surrounding_radius_in_meters = None
self._defines_postcode_only = None
self.discriminator = None
if state is not None:
self.state = state
if region is not None:
self.region = region
if area is not None:
self.area = area
if suburb is not None:
self.suburb = suburb
if post_code is not None:
self.post_code = post_code
if include_surrounding_suburbs is not None:
self.include_surrounding_suburbs = include_surrounding_suburbs
if surrounding_radius_in_meters is not None:
self.surrounding_radius_in_meters = surrounding_radius_in_meters
if defines_postcode_only is not None:
self.defines_postcode_only = defines_postcode_only
@property
def state(self):
"""Gets the state of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:return: The state of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:rtype: str
"""
return self._state
@state.setter
def state(self, state):
"""Sets the state of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation.
:param state: The state of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:type: str
"""
allowed_values = ["ACT", "NSW", "QLD", "VIC", "SA", "WA", "NT", "TAS"] # noqa: E501
if state not in allowed_values:
raise ValueError(
"Invalid value for `state` ({0}), must be one of {1}" # noqa: E501
.format(state, allowed_values)
)
self._state = state
@property
def region(self):
"""Gets the region of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:return: The region of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:rtype: str
"""
return self._region
@region.setter
def region(self, region):
"""Sets the region of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation.
:param region: The region of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:type: str
"""
self._region = region
@property
def area(self):
"""Gets the area of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:return: The area of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:rtype: str
"""
return self._area
@area.setter
def area(self, area):
"""Sets the area of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation.
:param area: The area of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:type: str
"""
self._area = area
@property
def suburb(self):
"""Gets the suburb of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:return: The suburb of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:rtype: str
"""
return self._suburb
@suburb.setter
def suburb(self, suburb):
"""Sets the suburb of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation.
:param suburb: The suburb of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:type: str
"""
self._suburb = suburb
@property
def post_code(self):
"""Gets the post_code of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:return: The post_code of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:rtype: str
"""
return self._post_code
@post_code.setter
def post_code(self, post_code):
"""Sets the post_code of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation.
:param post_code: The post_code of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:type: str
"""
self._post_code = post_code
@property
def include_surrounding_suburbs(self):
"""Gets the include_surrounding_suburbs of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:return: The include_surrounding_suburbs of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:rtype: bool
"""
return self._include_surrounding_suburbs
@include_surrounding_suburbs.setter
def include_surrounding_suburbs(self, include_surrounding_suburbs):
"""Sets the include_surrounding_suburbs of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation.
:param include_surrounding_suburbs: The include_surrounding_suburbs of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:type: bool
"""
self._include_surrounding_suburbs = include_surrounding_suburbs
@property
def surrounding_radius_in_meters(self):
"""Gets the surrounding_radius_in_meters of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:return: The surrounding_radius_in_meters of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:rtype: int
"""
return self._surrounding_radius_in_meters
@surrounding_radius_in_meters.setter
def surrounding_radius_in_meters(self, surrounding_radius_in_meters):
"""Sets the surrounding_radius_in_meters of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation.
:param surrounding_radius_in_meters: The surrounding_radius_in_meters of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:type: int
"""
self._surrounding_radius_in_meters = surrounding_radius_in_meters
@property
def defines_postcode_only(self):
"""Gets the defines_postcode_only of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:return: The defines_postcode_only of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:rtype: bool
"""
return self._defines_postcode_only
@defines_postcode_only.setter
def defines_postcode_only(self, defines_postcode_only):
"""Sets the defines_postcode_only of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation.
:param defines_postcode_only: The defines_postcode_only of this DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation. # noqa: E501
:type: bool
"""
self._defines_postcode_only = defines_postcode_only
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, DomainSearchServiceV2ModelDomainSearchWebApiV2ModelsSearchLocation):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other
| 35.335526 | 199 | 0.675852 | 1,009 | 10,742 | 6.978196 | 0.144698 | 0.027269 | 0.327226 | 0.259054 | 0.598921 | 0.512143 | 0.484732 | 0.339867 | 0.244283 | 0.05681 | 0 | 0.021142 | 0.251443 | 10,742 | 303 | 200 | 35.452145 | 0.854496 | 0.422919 | 0 | 0.072993 | 1 | 0 | 0.079784 | 0.037567 | 0 | 0 | 0 | 0 | 0 | 1 | 0.160584 | false | 0 | 0.021898 | 0 | 0.306569 | 0.014599 | 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 |
6ba0f9e5a2c0435281e089a3fff4347106832d44 | 1,688 | py | Python | python/.ipynb_checkpoints/meta1-checkpoint.py | lukasjoc/scritps | ebcffef0a3977ab8bb1bebf20383c350bd7baa37 | [
"0BSD"
] | 1 | 2020-11-09T19:32:43.000Z | 2020-11-09T19:32:43.000Z | python/.ipynb_checkpoints/meta1-checkpoint.py | lukasjoc/scritps | ebcffef0a3977ab8bb1bebf20383c350bd7baa37 | [
"0BSD"
] | null | null | null | python/.ipynb_checkpoints/meta1-checkpoint.py | lukasjoc/scritps | ebcffef0a3977ab8bb1bebf20383c350bd7baa37 | [
"0BSD"
] | null | null | null | # from functools import wraps
# def debugMethod(func, cls=None):
# '''decorator for debugging passed function'''
# @wraps(func)
# def wrapper(*args, **kwargs):
# print({
# 'class': cls, # class object, not string
# 'method': func.__qualname__, # method name, string
# 'args': args, # all args, including self
# 'kwargs': kwargs
# })
# return func(*args, **kwargs)
# return wrapper
class Meta(type):
# def __new__(cls, clsname, bases, clsdict):
# obj = super().__new__(cls, clsname, bases, clsdict)
# def IS_DUNDER(x): return x.startswith("__") and x.endswith("__")
# for item, val in vars(obj).items():
# if callable(val):
# # setattr(obj, item, debugMethod(val, cls=cls))
# pass
# return obj
def __getattribute__(self, name):
print({'action': "get", 'attr': name})
return object.__getattribute__(self, name)
class A(object, metaclass=Meta):
# def __init__(self):
# pass
# def __setattr__(self, name, value):
# print("setting attribute", name, value)
# return super().__setattr__(name, value)
# def __getattribute__(self, name):
# print("getting attribute", name)
# return super().__getattribute__(name)
def add(self, x, y):
return x+y
def mul(self, x, y):
return x*y
a = A()
# a.mul(2, 3)
# a.mul(0, 100)
# a.mul(2, 100)
# a.mul(2323, 3)
# a.mul(2, 2)
# a.mul(2, 3414)
# another setter
a.x = 200
# print(vars(a))
# # settter
# a.x = 1000
# # setter
# a.x = "23931903"
# # finally a getter
# my_getter_val = a.x
| 23.774648 | 73 | 0.558649 | 209 | 1,688 | 4.287081 | 0.38756 | 0.026786 | 0.022321 | 0.040179 | 0.149554 | 0.03125 | 0 | 0 | 0 | 0 | 0 | 0.030705 | 0.286137 | 1,688 | 70 | 74 | 24.114286 | 0.712863 | 0.723341 | 0 | 0 | 0 | 0 | 0.03125 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0 | 0.181818 | 0.727273 | 0.090909 | 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 |
6ba79453016718b99febd98312a723a888018e94 | 1,046 | py | Python | spacy_entities/tag_data.py | MartinoMensio/botcycle-nlu | 42177de3e53f0c96c4b76ce41c9a1d3b4effd680 | [
"MIT"
] | 1 | 2017-09-27T15:34:22.000Z | 2017-09-27T15:34:22.000Z | spacy_entities/tag_data.py | MartinoMensio/botcycle-nlu | 42177de3e53f0c96c4b76ce41c9a1d3b4effd680 | [
"MIT"
] | null | null | null | spacy_entities/tag_data.py | MartinoMensio/botcycle-nlu | 42177de3e53f0c96c4b76ce41c9a1d3b4effd680 | [
"MIT"
] | null | null | null | import json
def load_expressions():
"""
Returns the expressions_file loaded from JSON
"""
with open('../data/BotCycle/expressions.json') as expressions_file:
return json.load(expressions_file)
def load_expressions_atis():
with open('../data/atis_parsed_texts.json') as expressions_file:
return json.load(expressions_file)
def load_entities():
"""
Returns a list of names of the entities (excluding intent)
"""
# TODO dynamic look into entities folder
return ['location']
def load_entities_atis():
with open('../data/atis_entities.json') as expressions_file:
return json.load(expressions_file)
def tag(expressions):
"""Returns a list of objects like `{'text': SENTENCE, entities: [{'entity': ENTITY_NAME, 'value': ENTITY_VALUE, 'start': INT, 'end', INT}]}`"""
array = expressions['data']
result = list(map(lambda x: {'text': x['text'], 'entities': [
ent for ent in x['entities'] if ent['entity'] != "intent"], }, array))
return result
| 29.055556 | 147 | 0.655832 | 131 | 1,046 | 5.099237 | 0.396947 | 0.157186 | 0.053892 | 0.094311 | 0.30988 | 0.25 | 0.25 | 0.25 | 0.25 | 0.25 | 0 | 0 | 0.202677 | 1,046 | 35 | 148 | 29.885714 | 0.800959 | 0.269598 | 0 | 0.176471 | 0 | 0 | 0.188446 | 0.122421 | 0 | 0 | 0 | 0.028571 | 0 | 1 | 0.294118 | false | 0 | 0.058824 | 0 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
6ba79df3b5193fdc9dc355e2a5a463a2481d2633 | 1,378 | py | Python | esque_wire/protocol/serializers/api/sync_group_response.py | real-digital/esque-wire | eb02c49f38b89ad5e5d25aad15fb4ad795e52807 | [
"MIT"
] | null | null | null | esque_wire/protocol/serializers/api/sync_group_response.py | real-digital/esque-wire | eb02c49f38b89ad5e5d25aad15fb4ad795e52807 | [
"MIT"
] | 7 | 2019-11-26T08:19:49.000Z | 2021-03-15T14:27:47.000Z | esque_wire/protocol/serializers/api/sync_group_response.py | real-digital/esque-wire | eb02c49f38b89ad5e5d25aad15fb4ad795e52807 | [
"MIT"
] | null | null | null | ###############################################################
# Autogenerated module. Please don't modify. #
# Edit according file in protocol_generator/templates instead #
###############################################################
from typing import Dict
from ...structs.api.sync_group_response import SyncGroupResponseData
from ._main_serializers import (
ClassSerializer,
DummySerializer,
Schema,
bytesSerializer,
errorCodeSerializer,
int32Serializer,
)
syncGroupResponseDataSchemas: Dict[int, Schema] = {
0: [
("error_code", errorCodeSerializer),
("assignment", bytesSerializer),
("throttle_time_ms", DummySerializer(int32Serializer.default)),
],
1: [("throttle_time_ms", int32Serializer), ("error_code", errorCodeSerializer), ("assignment", bytesSerializer)],
2: [("throttle_time_ms", int32Serializer), ("error_code", errorCodeSerializer), ("assignment", bytesSerializer)],
3: [("throttle_time_ms", int32Serializer), ("error_code", errorCodeSerializer), ("assignment", bytesSerializer)],
}
syncGroupResponseDataSerializers: Dict[int, ClassSerializer[SyncGroupResponseData]] = {
version: ClassSerializer(SyncGroupResponseData, schema) for version, schema in syncGroupResponseDataSchemas.items()
}
syncGroupResponseDataSerializers[-1] = syncGroupResponseDataSerializers[3]
| 39.371429 | 119 | 0.67344 | 101 | 1,378 | 9.019802 | 0.485149 | 0.039517 | 0.122942 | 0.16685 | 0.328211 | 0.270033 | 0.270033 | 0.270033 | 0.270033 | 0 | 0 | 0.0134 | 0.133527 | 1,378 | 34 | 120 | 40.529412 | 0.749581 | 0.087083 | 0 | 0 | 1 | 0 | 0.127886 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.125 | 0 | 0.125 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6ba7d349cd16686e5cf2db7a45c45ade9c467838 | 228 | py | Python | python_sudoku/sudoku_test.py | magicmage6/magic_sudoku | aabaf65fd14966db4bf1a52e0b89e59c31b3bd29 | [
"Unlicense"
] | 1 | 2020-07-04T22:58:52.000Z | 2020-07-04T22:58:52.000Z | python_sudoku/sudoku_test.py | magicmage6/python_sudoko | aabaf65fd14966db4bf1a52e0b89e59c31b3bd29 | [
"Unlicense"
] | null | null | null | python_sudoku/sudoku_test.py | magicmage6/python_sudoko | aabaf65fd14966db4bf1a52e0b89e59c31b3bd29 | [
"Unlicense"
] | null | null | null | import generator_test
import solver_test
def main():
print('Testing sudoku solver.')
solver_test.test_solvers()
print('Testing sudoku generator.')
generator_test.test_generators()
if __name__ == '__main__':
main()
| 16.285714 | 36 | 0.741228 | 28 | 228 | 5.535714 | 0.464286 | 0.167742 | 0.232258 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144737 | 228 | 13 | 37 | 17.538462 | 0.794872 | 0 | 0 | 0 | 0 | 0 | 0.241228 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | true | 0 | 0.222222 | 0 | 0.333333 | 0.222222 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6bb28c941feab2f9cd9efd53968d83c6f0562481 | 835 | py | Python | Estudo/cursoemvideo/tkinter/basic/aula12.py | ndrsilva/ndrsilva | bf2214c9a1ea3a9a107fcdd7fd7cb3443df24e2a | [
"MIT"
] | null | null | null | Estudo/cursoemvideo/tkinter/basic/aula12.py | ndrsilva/ndrsilva | bf2214c9a1ea3a9a107fcdd7fd7cb3443df24e2a | [
"MIT"
] | null | null | null | Estudo/cursoemvideo/tkinter/basic/aula12.py | ndrsilva/ndrsilva | bf2214c9a1ea3a9a107fcdd7fd7cb3443df24e2a | [
"MIT"
] | null | null | null | from tkinter import *
menu_inicial = Tk()
menu_inicial.title('Titulo')
menu_inicial.geometry('400x600')
label_01 = Label(
menu_inicial,
text="solid",
font= 'Arial 20',
bd=10,
relief="solid"
).pack()
label_02 = Label(
menu_inicial,
text="groove",
font="Arial 20",
bd=10,
relief="groove"
).pack()
label_03 = Label(
menu_inicial,
text="flat",
font="Arial 20",
bd=10,
relief="raised"
).pack()
label_04 = Label(
menu_inicial,
text="sunken",
font="Arial 20",
bd=10,
relief="sunken",
).pack()
label_05 = Label(
menu_inicial,
text="ridge",
font="Arial 20",
bd=10,
relief="ridge"
).pack()
label_06 = Label(
menu_inicial,
text="Arial raised",
font="Arial 20",
bd=10,
relief="raised"
).pack()
menu_inicial.mainloop()
| 14.649123 | 32 | 0.594012 | 108 | 835 | 4.444444 | 0.296296 | 0.229167 | 0.2 | 0.25 | 0.304167 | 0.304167 | 0.129167 | 0.129167 | 0 | 0 | 0 | 0.066246 | 0.240719 | 835 | 56 | 33 | 14.910714 | 0.690852 | 0 | 0 | 0.531915 | 0 | 0 | 0.159281 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.021277 | 0 | 0.021277 | 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 |
6bbc7aebc10b89deec99c344cafbec3a9f00598b | 2,177 | py | Python | Examples/PolynomialBernoulliExamples.py | SymmetricChaos/FiniteFields | 65258e06b7f04ce15223c1bc0c2384ef5e9cec1a | [
"MIT"
] | 1 | 2021-08-22T15:03:59.000Z | 2021-08-22T15:03:59.000Z | Examples/PolynomialBernoulliExamples.py | SymmetricChaos/NumberTheory | 65258e06b7f04ce15223c1bc0c2384ef5e9cec1a | [
"MIT"
] | null | null | null | Examples/PolynomialBernoulliExamples.py | SymmetricChaos/NumberTheory | 65258e06b7f04ce15223c1bc0c2384ef5e9cec1a | [
"MIT"
] | null | null | null | from Polynomials import Polynomial
from Rationals import Rational
print("Say we have a biased coin. It has P(Heads) = .6 and P(Tails) = .4 which we could represent as a Bernoulli distribution. However another option is to encode it as a polynomial generating function. That would be:")
Bern = Polynomial([.4,.6])
print(Bern)
print("\nTHis is useful because the coefficients of polynomials distribute over each other when multiplying. That is exactly what happens when we try to calculate the probabilities associated with flipping the coin multiple times.")
print("")
for i in range(2,6):
Bin = Bern**i
print(round(Bin,2))
print("""
Let's see why with two coin flips (removing decimals for ease of reading)
(6x + 4) * (6x + 4)
6x*6x + 6x*4 + 6x*4 + 4*4
36x^2 + 48x + 16
""")
print("The probability of independent events both happening comes from multiplying together the probability of each. This is exactly what happens when we distribute the coefficients for polynomial multiplication, every pair gets multiplied together.")
print("\nWhen events are mutually exclusive the probability of both happening comes from adding them together. Since each possible permutation is mutually exclusive we can in fact add them together. That justifies summing terms we consider equivalent.")
print("\n\nEven better this means that we can easily generalize to more interesting distributions like the multinomial.")
print("\nSay we have a die with the sides {1,2,3,4,5,6} we can represent this as a polynomial like this.")
c = Rational(1,6)
dice = Polynomial([0,c,c,c,c,c,c])
print(dice)
print("\nNotice that we have no zeroth order coefficient because there is no side with a value of 0.")
print("\nFor the same reasons that we can represent multiple coins by multiplying together their generating functions together we can multiply the generating functions for dice together.")
print("\nSo if we multiply three dice together:\n")
A = dice**3
pA = Polynomial([round(float(i),3) for i in A.coef])
print(pA)
print("\nNotice that there are no terms of order 0, 1, or 2 since those outcomes are not possible. You cannot roll three ordinary dice and get a sum of 2.")
| 48.377778 | 253 | 0.757924 | 362 | 2,177 | 4.558011 | 0.455801 | 0.015152 | 0.007273 | 0.007273 | 0.035152 | 0.031515 | 0 | 0 | 0 | 0 | 0 | 0.023039 | 0.162609 | 2,177 | 44 | 254 | 49.477273 | 0.882063 | 0 | 0 | 0 | 0 | 0.233333 | 0.793294 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 0 | 0.066667 | 0.533333 | 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 | 0 | 1 | 0 | 3 |
6be0acef51bcdc77fc959d4b20cb4d66b2c189fe | 139 | py | Python | app/shortener/forms.py | pattu777/URL-Shortener | 555f2ce881398cd351285ca9fe40669f4617cee9 | [
"MIT"
] | null | null | null | app/shortener/forms.py | pattu777/URL-Shortener | 555f2ce881398cd351285ca9fe40669f4617cee9 | [
"MIT"
] | 2 | 2020-02-11T23:38:41.000Z | 2020-06-05T17:34:10.000Z | app/shortener/forms.py | pattu777/URL-Shortener | 555f2ce881398cd351285ca9fe40669f4617cee9 | [
"MIT"
] | null | null | null | from django import forms
from .models import URL
class URLForm(forms.ModelForm):
class Meta:
model = URL
fields = ('long_url',)
| 12.636364 | 31 | 0.697842 | 19 | 139 | 5.052632 | 0.684211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.208633 | 139 | 11 | 32 | 12.636364 | 0.872727 | 0 | 0 | 0 | 0 | 0 | 0.057143 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
6bec13d32e97ef9a08044e71a9f3d1288f958ec5 | 513 | py | Python | toontown/safezone/DistributedMMPianoAI.py | LittleNed/toontown-stride | 1252a8f9a8816c1810106006d09c8bdfe6ad1e57 | [
"Apache-2.0"
] | 3 | 2020-01-02T08:43:36.000Z | 2020-07-05T08:59:02.000Z | toontown/safezone/DistributedMMPianoAI.py | NoraTT/Historical-Commits-Project-Altis-Source | fe88e6d07edf418f7de6ad5b3d9ecb3d0d285179 | [
"Apache-2.0"
] | null | null | null | toontown/safezone/DistributedMMPianoAI.py | NoraTT/Historical-Commits-Project-Altis-Source | fe88e6d07edf418f7de6ad5b3d9ecb3d0d285179 | [
"Apache-2.0"
] | 4 | 2019-06-20T23:45:23.000Z | 2020-10-14T20:30:15.000Z | from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedMMPianoAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedMMPianoAI")
def requestSpeedUp(self):
pass
def requestChangeDirection(self):
pass
def setSpeed(self, todo0, todo1, todo2):
pass
def playSpeedUp(self, todo0):
pass
def playChangeDirection(self, todo0):
pass
| 23.318182 | 80 | 0.732943 | 44 | 513 | 8.545455 | 0.5 | 0.074468 | 0.058511 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012225 | 0.202729 | 513 | 21 | 81 | 24.428571 | 0.90709 | 0 | 0 | 0.357143 | 0 | 0 | 0.039063 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.357143 | false | 0.357143 | 0.142857 | 0 | 0.642857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
d40e074b6e2764a105f1fd9d2ac8c4e7bdffed87 | 10,496 | py | Python | api/tests.py | zachtib/Frisky | 84303915e701aa14dec80da4cfff4d731284c99d | [
"MIT"
] | 5 | 2020-01-22T18:16:59.000Z | 2021-06-14T13:23:57.000Z | api/tests.py | zachtib/Frisky | 84303915e701aa14dec80da4cfff4d731284c99d | [
"MIT"
] | 104 | 2020-02-12T00:36:14.000Z | 2022-02-10T08:18:28.000Z | api/tests.py | zachtib/Frisky | 84303915e701aa14dec80da4cfff4d731284c99d | [
"MIT"
] | 4 | 2020-01-30T15:44:04.000Z | 2020-08-27T19:22:57.000Z | import json
import uuid
from io import StringIO
from typing import Dict
import jwt
from django.conf import settings
from django.core.management import call_command, CommandError
from api.models import ApiToken
from frisky.models import Workspace
from frisky.test import FriskyTestCase
class ApiTestCase(FriskyTestCase):
def setUp(self) -> None:
super().setUp()
self.workspace.kind = Workspace.Kind.SLACK
self.workspace.save()
def create_valid_token(self, payload: Dict[str, str], omit_workspace=False) -> str:
created_token = ApiToken.objects.create(name='Testing Token')
payload['uuid'] = str(created_token.uuid)
if not omit_workspace:
payload['workspace_id'] = str(self.workspace.id)
token = jwt.encode(payload, settings.JWT_SECRET, algorithm='HS256').decode()
return token
def create_revoked_token(self, payload: Dict[str, str]) -> str:
created_token = ApiToken.objects.create(name='Revoked Token', revoked=True)
payload['uuid'] = str(created_token.uuid)
payload['workspace_id'] = str(self.workspace.id)
token = jwt.encode(payload, settings.JWT_SECRET, algorithm='HS256').decode()
return token
class LearnApiTests(ApiTestCase):
def test_success(self):
self.send_message('?learn api_test abcdefg')
token = self.create_valid_token({'label': 'api_test'})
response = self.client.get('/api/random/', HTTP_AUTHORIZATION=f'Bearer {token}')
self.assertEqual(response.status_code, 200)
content = json.loads(response.content)
self.assertEqual(content['result'], 'abcdefg')
def test_token_without_workspace_404s(self):
self.send_message('?learn api_test abcdefg')
token = self.create_valid_token({'label': 'api_test'}, omit_workspace=True)
response = self.client.get('/api/random/', HTTP_AUTHORIZATION=f'Bearer {token}')
self.assertEqual(response.status_code, 404)
def test_token_with_invalid_workspace_404s(self):
self.send_message('?learn api_test abcdefg')
token = self.create_valid_token({'label': 'api_test', 'workspace_id': '123'}, omit_workspace=True)
response = self.client.get('/api/random/', HTTP_AUTHORIZATION=f'Bearer {token}')
self.assertEqual(response.status_code, 404)
def test_token_with_nonexistant_workspace_404s(self):
self.send_message('?learn api_test abcdefg')
token = self.create_valid_token({'label': 'api_test', 'workspace_id': str(uuid.uuid4())}, omit_workspace=True)
response = self.client.get('/api/random/', HTTP_AUTHORIZATION=f'Bearer {token}')
self.assertEqual(response.status_code, 404)
def test_revoked_token_404s(self):
token = self.create_revoked_token({'label': 'api_test'})
response = self.client.get('/api/random/', HTTP_AUTHORIZATION=f'Bearer {token}')
self.assertEqual(response.status_code, 404)
def test_valid_token_not_in_db_404s(self):
payload = {'label': 'api_test', 'workspace_id': str(self.workspace.id)}
token = jwt.encode(payload, settings.JWT_SECRET, algorithm='HS256').decode()
response = self.client.get('/api/random/', HTTP_AUTHORIZATION=f'Bearer {token}')
self.assertEqual(response.status_code, 404)
def test_invalid_jwt_404s(self):
token = jwt.encode(
{
'label': 'api_test',
'workspace_id': str(self.workspace.id)
},
'my_fake_secret',
algorithm='HS256').decode()
response = self.client.get('/api/random/', HTTP_AUTHORIZATION=f'Bearer {token}')
self.assertEqual(response.status_code, 404)
def test_no_learns_for_label_404s(self):
self.send_message('?learn api_test abcdefg')
token = self.create_valid_token({'label': 'api_test_2'})
response = self.client.get('/api/random/', HTTP_AUTHORIZATION=f'Bearer {token}')
self.assertEqual(response.status_code, 404)
def test_missing_auth_header_404s(self):
response = self.client.get('/api/random/')
self.assertEqual(response.status_code, 404)
def test_non_bearer_auth_header_404s(self):
response = self.client.get('/api/random/', HTTP_AUTHORIZATION=f'Basic foobar')
self.assertEqual(response.status_code, 404)
class GeneralApiTests(ApiTestCase):
def test_general_get_404s(self):
response = self.client.get('/api/response/')
self.assertEqual(response.status_code, 404)
def test_general_without_workspace_404s(self):
token = self.create_valid_token({'general': 'true'}, omit_workspace=True)
response = self.client.post(
'/api/response/',
data=json.dumps({
'username': self.get_user('testuser').name,
'channel': self.get_channel('bot-testing').name,
'message': '?ping'
}),
content_type='application/json',
HTTP_AUTHORIZATION=f'Bearer {token}'
)
self.assertEqual(response.status_code, 404)
def test_general_with_invalid_workspace_404s(self):
token = self.create_valid_token({'general': 'true', 'workspace_id': '123'}, omit_workspace=True)
response = self.client.post(
'/api/response/',
data=json.dumps({
'username': self.get_user('testuser').name,
'channel': self.get_channel('bot-testing').name,
'message': '?ping'
}),
content_type='application/json',
HTTP_AUTHORIZATION=f'Bearer {token}'
)
self.assertEqual(response.status_code, 404)
def test_general_with_non_slack_workspace_is_like_nah(self):
workspace = Workspace.objects.create(kind=Workspace.Kind.NONE, team_id='W00002', name='Testing2',
domain='testing2', access_token='super_secret_token')
token = self.create_valid_token({'general': 'true', 'workspace_id': str(workspace.id)}, omit_workspace=True)
response = self.client.post(
'/api/response/',
data=json.dumps({
'username': self.get_user('testuser').name,
'channel': self.get_channel('bot-testing').name,
'message': '?ping'
}),
content_type='application/json',
HTTP_AUTHORIZATION=f'Bearer {token}'
)
self.assertEqual(response.status_code, 404)
def test_general_with_nonexistant_workspace_404s(self):
token = self.create_valid_token({'general': 'true', 'workspace_id': str(uuid.uuid4())}, omit_workspace=True)
response = self.client.post(
'/api/response/',
data=json.dumps({
'username': self.get_user('testuser').name,
'channel': self.get_channel('bot-testing').name,
'message': '?ping'
}),
content_type='application/json',
HTTP_AUTHORIZATION=f'Bearer {token}'
)
self.assertEqual(response.status_code, 404)
def test_general_ping(self):
token = self.create_valid_token({'general': 'true'})
response = self.client.post(
'/api/response/',
data=json.dumps({
'username': self.get_user('testuser').name,
'channel': self.get_channel('bot-testing').name,
'message': '?ping'
}),
content_type='application/json',
HTTP_AUTHORIZATION=f'Bearer {token}'
)
self.assertEqual(response.status_code, 200)
content = json.loads(response.content)
self.assertEqual(content['replies'], ['pong'])
def test_api_prepends_prefix_ping(self):
token = self.create_valid_token({'general': 'true'})
response = self.client.post(
'/api/response/',
data=json.dumps({
'username': self.get_user('testuser').name,
'channel': self.get_channel('bot-testing').name,
'message': 'ping'
}),
content_type='application/json',
HTTP_AUTHORIZATION=f'Bearer {token}'
)
self.assertEqual(response.status_code, 200)
content = json.loads(response.content)
self.assertEqual(content['replies'], ['pong'])
def test_learn_token_invalid(self):
token = self.create_valid_token({'label': 'api_test'})
response = self.client.post(
'/api/response/',
data=json.dumps({
'username': 'testuser',
'channel': 'bot-testing',
'message': '?ping'
}),
content_type='application/json',
HTTP_AUTHORIZATION=f'Bearer {token}'
)
self.assertEqual(response.status_code, 404)
class CommandsTestCase(ApiTestCase):
def test_issue_jwt_noop(self):
out = StringIO()
with self.assertRaises(CommandError, msg='Error: the following arguments are required: --workspace_id'):
call_command('issuejwt', stdout=out, name='testing')
def test_issue_jwt_learn(self):
out = StringIO()
call_command('issuejwt', stdout=out, name='testing', learn='abcde', workspace_id=str(self.workspace.id))
_, output = out.getvalue().split(' ')
decoded_value = jwt.decode(output, key=settings.JWT_SECRET, algorithms=['HS256'])
token = ApiToken.objects.get(uuid=decoded_value['uuid'])
self.assertEqual(decoded_value['label'], 'abcde')
self.assertEqual(token.name, 'testing')
def test_issue_jwt_general(self):
out = StringIO()
call_command('issuejwt', name='testing', general=True, workspace_id=str(self.workspace.id), stdout=out)
_, output = out.getvalue().split(' ')
decoded_value = jwt.decode(output, key=settings.JWT_SECRET, algorithms=['HS256'])
token = ApiToken.objects.get(uuid=decoded_value['uuid'])
self.assertEqual(decoded_value['general'], 'true')
self.assertEqual(token.name, 'testing')
class MiscApiTestCase(ApiTestCase):
def test_api_config(self):
from api.apps import ApiConfig
self.assertEqual(ApiConfig.name, 'api')
def test_api_str(self):
self.create_valid_token({'label': 'api_test'})
api_token = ApiToken.objects.get(id=1)
self.assertEqual('ApiToken: Testing Token', str(api_token))
| 37.219858 | 118 | 0.630812 | 1,186 | 10,496 | 5.376897 | 0.128162 | 0.04234 | 0.050808 | 0.081857 | 0.789713 | 0.770739 | 0.72934 | 0.687314 | 0.680571 | 0.660655 | 0 | 0.015966 | 0.236185 | 10,496 | 281 | 119 | 37.352313 | 0.779469 | 0 | 0 | 0.56872 | 0 | 0 | 0.156917 | 0 | 0 | 0 | 0 | 0 | 0.132701 | 1 | 0.123223 | false | 0 | 0.052133 | 0 | 0.208531 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.