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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2e20f9fab3ea9d4519c2d86b7a335128ff650ee0 | 55 | py | Python | AXUI/driver/windows_driver/win32/__init__.py | xcgspring/AXUI | 3e64cc6b1b4f91f21ad15aa95e4e6680f9f31c57 | [
"Apache-2.0"
] | 68 | 2015-03-24T08:40:49.000Z | 2022-01-01T13:26:32.000Z | AXUI/driver/windows_driver/win32/__init__.py | xcgspring/AXUI | 3e64cc6b1b4f91f21ad15aa95e4e6680f9f31c57 | [
"Apache-2.0"
] | 1 | 2019-05-30T00:09:47.000Z | 2019-05-30T00:09:47.000Z | AXUI/driver/windows_driver/win32/__init__.py | xcgspring/AXUI | 3e64cc6b1b4f91f21ad15aa95e4e6680f9f31c57 | [
"Apache-2.0"
] | 11 | 2015-05-07T07:13:47.000Z | 2022-02-28T05:21:16.000Z | from .keyboard import Keyboard
from .mouse import Mouse | 27.5 | 30 | 0.836364 | 8 | 55 | 5.75 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.127273 | 55 | 2 | 31 | 27.5 | 0.958333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
2e47122cba79cf491cd98a0255ca3b7ce607a59a | 257 | py | Python | whales/util/__init__.py | mwt365/chess | c35c5b78bd787f9c6a339447bf0f8af41923bce4 | [
"MIT"
] | 3 | 2019-08-20T03:27:59.000Z | 2020-11-24T00:03:34.000Z | whales/util/__init__.py | mwt365/chess | c35c5b78bd787f9c6a339447bf0f8af41923bce4 | [
"MIT"
] | 3 | 2020-05-22T02:07:15.000Z | 2020-09-26T13:43:50.000Z | whales/util/__init__.py | mwt365/chess | c35c5b78bd787f9c6a339447bf0f8af41923bce4 | [
"MIT"
] | 1 | 2020-09-14T23:13:03.000Z | 2020-09-14T23:13:03.000Z | """
General utility module.
"""
class UnsetClass:
"""
Singleton class used to implement `UNSET`.
"""
def __repr__(self):
return "<Unset>"
# Singleton object that can be used to indicate "no data available".
UNSET = UnsetClass()
| 15.117647 | 68 | 0.634241 | 29 | 257 | 5.482759 | 0.758621 | 0.075472 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.245136 | 257 | 16 | 69 | 16.0625 | 0.819588 | 0.521401 | 0 | 0 | 0 | 0 | 0.07 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0.25 | 0.75 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
2e59d09e048b3100edc68fb78c791d5f388b8142 | 175 | py | Python | examples/dashtable/snippet.py | jjhenkel/dockerizeme | eaa4fe5366f6b9adf74399eab01c712cacaeb279 | [
"Apache-2.0"
] | 21 | 2019-07-08T08:26:45.000Z | 2022-01-24T23:53:25.000Z | examples/dashtable/snippet.py | jjhenkel/dockerizeme | eaa4fe5366f6b9adf74399eab01c712cacaeb279 | [
"Apache-2.0"
] | 5 | 2019-06-15T14:47:47.000Z | 2022-02-26T05:02:56.000Z | examples/dashtable/snippet.py | jjhenkel/dockerizeme | eaa4fe5366f6b9adf74399eab01c712cacaeb279 | [
"Apache-2.0"
] | 17 | 2019-05-16T03:50:34.000Z | 2021-01-14T14:35:12.000Z | import dashtable
print(dashtable.html2md("""
<table>
<tr><th>Header 1</th><th>Header 2</th></tr>
<tr><td>Data 1</td><td>Data 2</td></tr>
</table>
""")) | 25 | 51 | 0.537143 | 27 | 175 | 3.481481 | 0.444444 | 0.170213 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035714 | 0.2 | 175 | 7 | 52 | 25 | 0.635714 | 0 | 0 | 0 | 0 | 0 | 0.715909 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.142857 | 0 | 0.142857 | 0.142857 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
2e5cfb33ceee27b828f24e4110e7dddf6a767647 | 1,099 | py | Python | lib/systems/l-glutamic_acid.py | pulsar-chem/BPModule | f8e64e04fdb01947708f098e833600c459c2ff0e | [
"BSD-3-Clause"
] | null | null | null | lib/systems/l-glutamic_acid.py | pulsar-chem/BPModule | f8e64e04fdb01947708f098e833600c459c2ff0e | [
"BSD-3-Clause"
] | null | null | null | lib/systems/l-glutamic_acid.py | pulsar-chem/BPModule | f8e64e04fdb01947708f098e833600c459c2ff0e | [
"BSD-3-Clause"
] | null | null | null | import pulsar as psr
def load_ref_system():
""" Returns l-glutamic_acid as found in the IQMol fragment library.
All credit to https://github.com/nutjunkie/IQmol
"""
return psr.make_system("""
N 0.1209 -2.2995 -0.2021
C 0.4083 -0.9510 -0.7668
C -0.0197 0.1567 0.2036
H 0.2953 -0.0889 1.2387
H 0.5152 1.0936 -0.0551
C -1.5226 0.3991 0.1502
H -1.8462 0.6291 -0.8851
H -2.0847 -0.5077 0.4535
C -1.8924 1.5597 1.0413
O -1.8774 2.7496 0.7858
O -2.3012 1.2232 2.2867
H -2.5017 2.0069 2.7891
C 1.9123 -0.8901 -1.0205
O 2.3094 -1.5372 -2.1437
O 2.7925 -0.3483 -0.3817
H 0.2282 -2.9904 -0.9133
H -0.8129 -2.3188 0.1500
H -0.1109 -0.7851 -1.7497
H 3.2561 -1.4867 -2.2319
""")
| 40.703704 | 71 | 0.410373 | 164 | 1,099 | 2.72561 | 0.560976 | 0.022371 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.504425 | 0.485896 | 1,099 | 26 | 72 | 42.269231 | 0.286726 | 0.101911 | 0 | 0 | 0 | 0 | 0.913133 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.043478 | true | 0 | 0.043478 | 0 | 0.130435 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
2e64c5515018f3358910aafdbe4a411c6ed9c861 | 858 | py | Python | Home/views.py | indoriyasboyz/E-commerce | a71e7d043899769e48992216bebebc4b43d647ca | [
"MIT"
] | null | null | null | Home/views.py | indoriyasboyz/E-commerce | a71e7d043899769e48992216bebebc4b43d647ca | [
"MIT"
] | null | null | null | Home/views.py | indoriyasboyz/E-commerce | a71e7d043899769e48992216bebebc4b43d647ca | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django.views.generic import TemplateView
from .models import Slider
class Homeview(TemplateView):
template_name = 'index.html'
context_object_name = 'object_list'
def get_context_data(self, **kwargs):
home = super(Homeview, self).get_context_data(**kwargs)
home['slider'] = Slider.objects.all()
return home
| 1.769072 | 63 | 0.324009 | 48 | 858 | 5.625 | 0.604167 | 0.074074 | 0.103704 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.631702 | 858 | 484 | 64 | 1.772727 | 0.85443 | 0 | 0 | 0 | 0 | 0 | 0.069767 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.3 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
2e682b7d1a694fe65d1e2015fea60cdf545fb9a0 | 44 | py | Python | mayday_control/scripts/physical_quantities/temperature.py | LasseBoerresen/Lumos | 2447adc7795ae07cb0a1df409d3b1a6178c2cd8b | [
"MIT"
] | null | null | null | mayday_control/scripts/physical_quantities/temperature.py | LasseBoerresen/Lumos | 2447adc7795ae07cb0a1df409d3b1a6178c2cd8b | [
"MIT"
] | null | null | null | mayday_control/scripts/physical_quantities/temperature.py | LasseBoerresen/Lumos | 2447adc7795ae07cb0a1df409d3b1a6178c2cd8b | [
"MIT"
] | null | null | null | class Temperature(float):
unit = 'degC'
| 14.666667 | 25 | 0.659091 | 5 | 44 | 5.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.204545 | 44 | 2 | 26 | 22 | 0.828571 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
2e8aa82b80ff380db468cf169c2bc715304494db | 220 | py | Python | megalinter/__init__.py | private-forks/mega-linter | e22555d5dd18f6e7c32057b87b366d22f61a115d | [
"MIT"
] | null | null | null | megalinter/__init__.py | private-forks/mega-linter | e22555d5dd18f6e7c32057b87b366d22f61a115d | [
"MIT"
] | null | null | null | megalinter/__init__.py | private-forks/mega-linter | e22555d5dd18f6e7c32057b87b366d22f61a115d | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from .alpaca import alpaca
from .Linter import Linter
from .MegaLinter import Megalinter
from .Reporter import Reporter
__all__ = ["Megalinter", "Linter", "Reporter", "config", "utils", "alpaca"]
| 27.5 | 75 | 0.745455 | 27 | 220 | 5.925926 | 0.481481 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005181 | 0.122727 | 220 | 7 | 76 | 31.428571 | 0.823834 | 0.095455 | 0 | 0 | 0 | 0 | 0.207071 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
5cee1ec3e7ef92836474d46def007c1d118f25b7 | 188 | py | Python | dist/py/rest_api/utils/logging.py | topabomb/OneClickPack | e2980dd61145be75ae07980509d6fcad161330d7 | [
"Apache-2.0"
] | 3 | 2022-03-09T02:26:33.000Z | 2022-03-20T08:51:32.000Z | dist/py/rest_api/utils/logging.py | topabomb/OneClickPack | e2980dd61145be75ae07980509d6fcad161330d7 | [
"Apache-2.0"
] | null | null | null | dist/py/rest_api/utils/logging.py | topabomb/OneClickPack | e2980dd61145be75ae07980509d6fcad161330d7 | [
"Apache-2.0"
] | null | null | null | # 重载默认print函数,使得其刷新缓冲区直接输出,避免其他控制台捕获程序捕获不到
def print(*args, end='\r\n'):
import sys
for msg in args:
sys.stdout.write(msg)
sys.stdout.write(end)
sys.stdout.flush()
| 23.5 | 42 | 0.659574 | 26 | 188 | 4.769231 | 0.653846 | 0.217742 | 0.225806 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.202128 | 188 | 7 | 43 | 26.857143 | 0.826667 | 0.212766 | 0 | 0 | 0 | 0 | 0.027397 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0 | 0.333333 | 0.166667 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
5cf8510423ef6d9030aebc62fde42c55bd650a56 | 47 | py | Python | src/tests/unit/utils/__init__.py | wilsonGmn/pyrin | 25dbe3ce17e80a43eee7cfc7140b4c268a6948e0 | [
"BSD-3-Clause"
] | null | null | null | src/tests/unit/utils/__init__.py | wilsonGmn/pyrin | 25dbe3ce17e80a43eee7cfc7140b4c268a6948e0 | [
"BSD-3-Clause"
] | null | null | null | src/tests/unit/utils/__init__.py | wilsonGmn/pyrin | 25dbe3ce17e80a43eee7cfc7140b4c268a6948e0 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
utils package.
"""
| 9.4 | 23 | 0.468085 | 5 | 47 | 4.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026316 | 0.191489 | 47 | 4 | 24 | 11.75 | 0.552632 | 0.787234 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
cf0bcf7320dd4444306a07a9369bbc24b3fa504a | 2,885 | py | Python | lab2/ag2/ag2_codec.py | mit-pdos/6.S060-labs | fc612fe2db5c4e3fc15c34dd5ab2a0b444bb5868 | [
"MIT"
] | 10 | 2021-09-08T18:07:52.000Z | 2021-12-26T15:21:26.000Z | lab2/ag2/ag2_codec.py | mit-pdos/6.S060-labs | fc612fe2db5c4e3fc15c34dd5ab2a0b444bb5868 | [
"MIT"
] | 2 | 2021-09-22T14:19:22.000Z | 2021-10-04T20:12:10.000Z | lab2/ag2/ag2_codec.py | mit-pdos/6.S060-labs | fc612fe2db5c4e3fc15c34dd5ab2a0b444bb5868 | [
"MIT"
] | 7 | 2021-09-09T15:00:25.000Z | 2021-12-08T01:20:55.000Z | #!/usr/bin/env python3
"""
The "codec" for the lab2 autograder.
Instead of doing any real encoding, it just stores the data directly
(so that further manipulation is easier).
"""
BIN_SEPARATOR = b'\x01'
INT_SEPARATOR = b'\x02'
def encode_one_int(num):
"""Convenience function for encoding a single int."""
if type(num) != int:
raise TypeError("argument must be int")
enc = Encoding()
enc.add_int(num)
return enc
def encode_one_bin(bin_data):
"""Convenience function for encoding a single bytes object."""
if type(bin_data) != bytes and type(bin_data) != Lab2Authenticator and type(bin_data) != Lab2Signature:
raise TypeError("argument must be bytes")
enc = Encoding()
enc.add_bin(bin_data)
return enc
class Lab2Authenticator:
def __init__(self, key, data):
self.key = key
self.data = data
def equals(self, other_auth):
if type(other_auth) != Lab2Authenticator:
return False
if self.key != other_auth.key:
return False
return self.data == other_auth.data
def __str__(self):
return 'Lab2Authenticator(key={}, data={})'.format(self.key, self.data)
# defined to help with debugging
def __repr__(self):
return self.__str__()
class Lab2Signature:
def __init__(self, key, data):
self.key = key
self.data = data
# def equals(self, other_auth):
# if type(other_auth) != Lab2Signature:
# return False
# if self.key != other_auth.key:
# return False
# return self.data == other_auth.data
def __str__(self):
return 'Lab2Signature(key={}, data={})'.format(self.key, self.data)
# defined to help with debugging
def __repr__(self):
return self.__str__()
class Encoding:
def __init__(self, data=None):
"""TODO doctest here
>>> x = Encoding()
"""
if data is None:
data = []
self.data = data
def add_int(self, int_data):
if type(int_data) != int:
raise TypeError("int_data must be int")
if int_data > 2**64 - 1:
raise Exception("Integer is too large to encode {}".format(int_data))
self.data.append(int_data)
def add_bin(self, bin_data):
if type(bin_data) != bytes and type(bin_data) != Lab2Authenticator and type(bin_data) != Lab2Signature:
raise TypeError("bin_data must be bytes")
if type(bin_data) == bytes and len(bin_data) > 2**64 - 1:
raise Exception("Integer is too large to encode {}".format(int_data))
self.data.append(bin_data)
def items(self):
return list(self.data)
def __str__(self):
return 'Encoding({})'.format(self.items())
# defined to help with debugging
def __repr__(self):
return '<{}>'.format(self.__str__())
| 30.052083 | 111 | 0.616291 | 377 | 2,885 | 4.488064 | 0.228117 | 0.053783 | 0.045508 | 0.033097 | 0.602837 | 0.566194 | 0.510047 | 0.510047 | 0.510047 | 0.484634 | 0 | 0.011348 | 0.266898 | 2,885 | 95 | 112 | 30.368421 | 0.788652 | 0.206239 | 0 | 0.423729 | 0 | 0 | 0.106203 | 0.020527 | 0 | 0 | 0 | 0.010526 | 0 | 1 | 0.254237 | false | 0 | 0 | 0.118644 | 0.508475 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
cf2e291dc2f25fc7b475b8c3e02aaf3b736a9d41 | 4,522 | py | Python | PyObjCTest/test_nstextattachment.py | Khan/pyobjc-framework-Cocoa | f8b015ea2a72d8d78be6084fb12925c4785b8f1f | [
"MIT"
] | 132 | 2015-01-01T10:02:42.000Z | 2022-03-09T12:51:01.000Z | mac/pyobjc-framework-Cocoa/PyObjCTest/test_nstextattachment.py | mba811/music-player | 7998986b34cfda2244ef622adefb839331b81a81 | [
"BSD-2-Clause"
] | 6 | 2015-01-06T08:23:19.000Z | 2019-03-14T12:22:06.000Z | mac/pyobjc-framework-Cocoa/PyObjCTest/test_nstextattachment.py | mba811/music-player | 7998986b34cfda2244ef622adefb839331b81a81 | [
"BSD-2-Clause"
] | 27 | 2015-02-23T11:51:43.000Z | 2022-03-07T02:34:18.000Z |
from PyObjCTools.TestSupport import *
from AppKit import *
try:
unichr
except NameError:
unichr = chr
class TestNSTextAttachmentHelper (NSObject):
def drawWithFrame_inView_(self, fr, vi): pass
def wantsToTrackMouse(self): return 1
def highlight_withFrame_inView_(self, fl, fr, vi): pass
def trackMouse_inRect_ofView_untilMouseUp_(self, ev, fr, vi, fl): pass
def cellSize(self): return 1
def cellBaselineOffset(self): return 1
def drawWithFrame_inView_characterIndex_(self, fr, vi, i): pass
def drawWithFrame_inView_characterIndex_layoutManager_(self, fr, vi, i, lm): pass
def wantsToTrackMouseForEvent_inRect_ofView_atCharacterIndex_(self, ev, fr, vi, i): return 1
def trackMouse_inRect_ofView_atCharacterIndex_untilMouseUp_(self, ev, fr, vi, i, fl): return 1
def cellFrameForTextContainer_proposedLineFragment_glyphPosition_characterIndex_(self, tc, fr, po, i): return 1
class TestNSTextAttachment (TestCase):
def testConstants(self):
self.assertEqual(NSAttachmentCharacter, unichr(0xfffc))
def testMethods(self):
self.assertResultIsBOOL(NSTextAttachmentCell.wantsToTrackMouse)
self.assertArgIsBOOL(NSTextAttachmentCell.highlight_withFrame_inView_, 0)
self.assertResultIsBOOL(NSTextAttachmentCell.trackMouse_inRect_ofView_untilMouseUp_)
self.assertArgIsBOOL(NSTextAttachmentCell.trackMouse_inRect_ofView_untilMouseUp_, 3)
self.assertResultIsBOOL(NSTextAttachmentCell.wantsToTrackMouseForEvent_inRect_ofView_atCharacterIndex_)
self.assertResultIsBOOL(NSTextAttachmentCell.trackMouse_inRect_ofView_atCharacterIndex_untilMouseUp_)
self.assertArgIsBOOL(NSTextAttachmentCell.trackMouse_inRect_ofView_atCharacterIndex_untilMouseUp_, 4)
def testProtocols(self):
self.assertArgHasType(TestNSTextAttachmentHelper.drawWithFrame_inView_, 0, NSRect.__typestr__)
self.assertResultIsBOOL(TestNSTextAttachmentHelper.wantsToTrackMouse)
self.assertArgIsBOOL(TestNSTextAttachmentHelper.highlight_withFrame_inView_, 0)
self.assertArgHasType(TestNSTextAttachmentHelper.highlight_withFrame_inView_, 1, NSRect.__typestr__)
self.assertResultIsBOOL(TestNSTextAttachmentHelper.trackMouse_inRect_ofView_untilMouseUp_)
self.assertArgHasType(TestNSTextAttachmentHelper.trackMouse_inRect_ofView_untilMouseUp_, 1, NSRect.__typestr__)
self.assertArgIsBOOL(TestNSTextAttachmentHelper.trackMouse_inRect_ofView_untilMouseUp_, 3)
self.assertResultHasType(TestNSTextAttachmentHelper.cellSize, NSSize.__typestr__)
self.assertResultHasType(TestNSTextAttachmentHelper.cellBaselineOffset, NSPoint.__typestr__)
self.assertArgHasType(TestNSTextAttachmentHelper.drawWithFrame_inView_characterIndex_, 0, NSRect.__typestr__)
self.assertArgHasType(TestNSTextAttachmentHelper.drawWithFrame_inView_characterIndex_, 2, objc._C_NSUInteger)
self.assertArgHasType(TestNSTextAttachmentHelper.drawWithFrame_inView_characterIndex_layoutManager_, 0, NSRect.__typestr__)
self.assertArgHasType(TestNSTextAttachmentHelper.drawWithFrame_inView_characterIndex_layoutManager_, 2, objc._C_NSUInteger)
self.assertResultIsBOOL(TestNSTextAttachmentHelper.wantsToTrackMouseForEvent_inRect_ofView_atCharacterIndex_)
self.assertArgHasType(TestNSTextAttachmentHelper.wantsToTrackMouseForEvent_inRect_ofView_atCharacterIndex_, 1, NSRect.__typestr__)
self.assertArgHasType(TestNSTextAttachmentHelper.wantsToTrackMouseForEvent_inRect_ofView_atCharacterIndex_, 3, objc._C_NSUInteger)
self.assertArgHasType(TestNSTextAttachmentHelper.trackMouse_inRect_ofView_atCharacterIndex_untilMouseUp_, 1, NSRect.__typestr__)
self.assertArgHasType(TestNSTextAttachmentHelper.trackMouse_inRect_ofView_atCharacterIndex_untilMouseUp_, 3, objc._C_NSUInteger)
self.assertResultHasType(TestNSTextAttachmentHelper.cellFrameForTextContainer_proposedLineFragment_glyphPosition_characterIndex_, NSRect.__typestr__)
self.assertArgHasType(TestNSTextAttachmentHelper.cellFrameForTextContainer_proposedLineFragment_glyphPosition_characterIndex_, 1, NSRect.__typestr__)
self.assertArgHasType(TestNSTextAttachmentHelper.cellFrameForTextContainer_proposedLineFragment_glyphPosition_characterIndex_, 2, NSPoint.__typestr__)
self.assertArgHasType(TestNSTextAttachmentHelper.cellFrameForTextContainer_proposedLineFragment_glyphPosition_characterIndex_, 3, objc._C_NSUInteger)
if __name__ == "__main__":
main()
| 69.569231 | 158 | 0.834144 | 383 | 4,522 | 9.347258 | 0.185379 | 0.053631 | 0.179888 | 0.118436 | 0.681844 | 0.477374 | 0.363128 | 0.213687 | 0.12514 | 0 | 0 | 0.00644 | 0.107253 | 4,522 | 64 | 159 | 70.65625 | 0.880357 | 0 | 0 | 0 | 0 | 0 | 0.00177 | 0 | 0 | 0 | 0.001327 | 0 | 0.555556 | 1 | 0.259259 | false | 0.092593 | 0.037037 | 0.111111 | 0.333333 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 4 |
cf8740859b80e684f9be1b3d310873dc551b4195 | 841 | py | Python | EEG_Lightning/dassl/modeling/backbone/__init__.py | mcd4874/NeurIPS_competition | 4df1f222929e9824a55c9c4ae6634743391b0fe9 | [
"MIT"
] | 23 | 2021-10-14T02:31:06.000Z | 2022-01-25T16:26:44.000Z | EEG_Lightning/dassl/modeling/backbone/__init__.py | mcd4874/NeurIPS_competition | 4df1f222929e9824a55c9c4ae6634743391b0fe9 | [
"MIT"
] | null | null | null | EEG_Lightning/dassl/modeling/backbone/__init__.py | mcd4874/NeurIPS_competition | 4df1f222929e9824a55c9c4ae6634743391b0fe9 | [
"MIT"
] | 1 | 2022-03-05T06:54:11.000Z | 2022-03-05T06:54:11.000Z | from .build import build_backbone, BACKBONE_REGISTRY # isort:skip
from .backbone import Backbone # isort:skip
# from .vgg import vgg16
# from .resnet import resnet18, resnet34, resnet50, resnet101, resnet152
# from .alexnet import alexnet
# from .mobilenetv2 import mobilenetv2
# from .wide_resnet import wide_resnet_28_2
# from .cnn_digitsdg import cnn_digitsdg
# from .efficientnet import (
# efficientnet_b0, efficientnet_b1, efficientnet_b2, efficientnet_b3,
# efficientnet_b4, efficientnet_b5, efficientnet_b6, efficientnet_b7
# )
# from .shufflenetv2 import (
# shufflenet_v2_x0_5, shufflenet_v2_x1_0, shufflenet_v2_x1_5,
# shufflenet_v2_x2_0
# )
# from .cnn_digitsingle import cnn_digitsingle
# from .preact_resnet18 import preact_resnet18
# from .cnn_digit5_m3sda import cnn_digit5_m3sda
from .EEGBackBone import *
| 36.565217 | 73 | 0.799049 | 110 | 841 | 5.781818 | 0.4 | 0.075472 | 0.040881 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066025 | 0.135553 | 841 | 22 | 74 | 38.227273 | 0.808803 | 0.819263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
d85aa8362637694460d66de1edebbcfa73e6e1c9 | 119 | py | Python | utils/context_processors.py | andrzejkrecicki/sm8 | 5578c28747e07691d8b88acae5cd825cdd333e93 | [
"MIT"
] | null | null | null | utils/context_processors.py | andrzejkrecicki/sm8 | 5578c28747e07691d8b88acae5cd825cdd333e93 | [
"MIT"
] | null | null | null | utils/context_processors.py | andrzejkrecicki/sm8 | 5578c28747e07691d8b88acae5cd825cdd333e93 | [
"MIT"
] | null | null | null | from django.conf import settings
def core_context_processor(request):
return {
"settings": settings,
} | 19.833333 | 36 | 0.689076 | 13 | 119 | 6.153846 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.226891 | 119 | 6 | 37 | 19.833333 | 0.869565 | 0 | 0 | 0 | 0 | 0 | 0.066667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0.2 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
d8a0649b62b67e371690205262253eb5bcab15ef | 99 | py | Python | shoppingcart/apps.py | ehedei/DATWFinalProject | c7fb0e91d092255902b75f003a711c0c19f5d3fa | [
"MIT"
] | 3 | 2021-06-23T09:57:58.000Z | 2021-07-12T19:57:46.000Z | shoppingcart/apps.py | ehedei/DATWFinalProject | c7fb0e91d092255902b75f003a711c0c19f5d3fa | [
"MIT"
] | null | null | null | shoppingcart/apps.py | ehedei/DATWFinalProject | c7fb0e91d092255902b75f003a711c0c19f5d3fa | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class ShoppingcartConfig(AppConfig):
name = 'shoppingcart'
| 16.5 | 36 | 0.777778 | 10 | 99 | 7.7 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.151515 | 99 | 5 | 37 | 19.8 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0.121212 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
d8b36fde8be1eaac3a4e0878cab9d2b69040c6bb | 2,868 | py | Python | DailyProgrammer/DP20150508C.py | DayGitH/Python-Challenges | bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf | [
"MIT"
] | 2 | 2020-12-23T18:59:22.000Z | 2021-04-14T13:16:09.000Z | DailyProgrammer/DP20150508C.py | DayGitH/Python-Challenges | bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf | [
"MIT"
] | null | null | null | DailyProgrammer/DP20150508C.py | DayGitH/Python-Challenges | bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf | [
"MIT"
] | null | null | null | """
[2015-05-08] Challenge #213 [Hard] Stepstring discrepancy
https://www.reddit.com/r/dailyprogrammer/comments/358pfk/20150508_challenge_213_hard_stepstring_discrepancy/
# Description
Define the _discrepancy_ of a string of any two symbols (I'll use `a` and `b`) to be the absolute difference between
the counts of each of the two symbols in the string. For example, all of the following strings have a discrepancy of 3:
aaa
bbb
abbbb
aababaa
baababbababababababbbaabbaaaabaaabbaa
Define a _stepstring_ of a string to be any string that can be formed by starting at any position x in the string,
stepping through the string n characters at a time, and ending before any position y. In python, this is any string
that can be formed using slice notation `s[x:y:n]`. For example, some stepstrings of the string `"abcdefghij"` are:
d
defg
acegi
bdfhj
dfh
beh
ai
abcdefghij
Your problem is, given a string of up to 10,000 characters, find the largest discrepancy of any stepstring of the
string. For instance, this string:
bbaaabababbaabbaaaabbbababbaabbbaabbaaaaabbababaaaabaabbbaaa
has this string as a stepstring (corresponding to the python slice notation `s[4:56:4]`):
aaaabaaaaabaa
which has a discrepancy of 9. Furthermore, no stepstring has a discrepancy greater than 9. So the correct solution for
this string is 9.
# Input Description
A series of strings (one per line) consisting of `a` and `b` characters.
# Output Description
For each string in the input, output the largest discrepancy of any stepstring of the string. (Optionally, also give
the slice notation values corresponding to the stepstring with the largest discrepancy.)
# Sample Input
bbaaabababbaabbaaaabbbababbaabbbaabbaaaaabbababaaaabaabbbaaa
bbaaaababbbaababbbbabbabababababaaababbbbbbaabbaababaaaabaaa
aaaababbabbaabbaabbbbbbabbbaaabbaabaabaabbbaabababbabbbbaabb
abbabbbbbababaabaaababbbbaababbabbbabbbbaabbabbaaabbaabbbbbb
# Sample Output
9
12
11
15
# Challenge Input:
[Download the challenge input here](http://pastebin.com/raw.php?i=Xt3BV8nK): 8 lines of 10,000 characters each.
# Challenge Output
113
117
121
127
136
136
138
224
#Note
This problem was inspired by [a recent mathematical
discovery](http://www.newscientist.com/article/dn25068-wikipediasize-maths-proof-too-big-for-humans-to-check.html#.Uwa72lK9jAR):
the longest string for which your program should output 2 is 1,160 characters. Every string of 1,161 characters will
yield a result of 3 or more. The proof of this fact was generated by a computer and is 13 gigabytes long!
# Credit
This challenge was submitted by /u/Cosmologicon. If you have an idea for a challenge, please share it in
/r/dailyprogrammer_ideas.
"""
def main():
pass
if __name__ == "__main__":
main()
| 38.24 | 128 | 0.766388 | 404 | 2,868 | 5.39604 | 0.490099 | 0.024771 | 0.015138 | 0.023853 | 0.099083 | 0.065138 | 0.043119 | 0.043119 | 0.043119 | 0 | 0 | 0.041242 | 0.179916 | 2,868 | 74 | 129 | 38.756757 | 0.885629 | 0.974547 | 0 | 0 | 0 | 0 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | true | 0.25 | 0 | 0 | 0.25 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
d8b4a79046f745cb05976b317998accdbea305f4 | 18 | py | Python | scripts/ecmp/__init__.py | rombie/contrail-test | a68c71d6f282142501a7e2e889bbb232fdd82dc3 | [
"Apache-2.0"
] | 5 | 2020-09-29T00:36:57.000Z | 2022-02-16T06:51:32.000Z | scripts/ecmp/__init__.py | vkolli/contrail-test-perf | db04b8924a2c330baabe3059788b149d957a7d67 | [
"Apache-2.0"
] | 27 | 2019-11-02T02:18:34.000Z | 2022-02-24T18:49:08.000Z | scripts/ecmp/__init__.py | vkolli/contrail-test-perf | db04b8924a2c330baabe3059788b149d957a7d67 | [
"Apache-2.0"
] | 20 | 2019-11-28T16:02:25.000Z | 2022-01-06T05:56:58.000Z | """ECMP tests."""
| 9 | 17 | 0.5 | 2 | 18 | 4.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 18 | 1 | 18 | 18 | 0.5625 | 0.611111 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
d8d9f51fda74b19a54d40e10faf4074f58278e72 | 6,450 | py | Python | messaging_components/clients/core/client.py | fgiorgetti/qpid-dispatch-tests | 164c609d28db87692eed53d5361aa1ee5c97375c | [
"Apache-2.0"
] | null | null | null | messaging_components/clients/core/client.py | fgiorgetti/qpid-dispatch-tests | 164c609d28db87692eed53d5361aa1ee5c97375c | [
"Apache-2.0"
] | null | null | null | messaging_components/clients/core/client.py | fgiorgetti/qpid-dispatch-tests | 164c609d28db87692eed53d5361aa1ee5c97375c | [
"Apache-2.0"
] | null | null | null | """
# TODO jstejska: Package description
"""
from autologging import logged, traced
from iqa_common.executor import Executor
from messaging_abstract.component.client import Client, Node
import messaging_components.protocols as protocols
@logged
@traced
class ClientCore(Client):
"""Internal core Proton mapping client."""
supported_protocols = [protocols.Amqp10()]
implementation = 'core'
version = '0.1'
def __init__(self, name: str, node: Node, executor: Executor):
super(ClientCore, self).__init__(name, node, executor)
#
# """
# # TODO jstejska: Package description
# """
#
# # -*- coding: utf-8 -*-
#
# import threading
#
# from proton.handlers import MessagingHandler
# from proton.reactor import Container
#
#
# class Timeout(object):
# def __init__(self, handler):
# self.registrated_handler = handler
#
# def on_timer_task(self, event):
# self.registrated_handler.timeout(event)
#
#
# class Client(MessagingHandler):
# # TODO error handling is not incorporated, this is just a raw idea
# """Client represents an entity in the framework capable of manipulation with messages (sending, receiving, parsing ...)
# """
#
# def __init__(self, blocking=False):
# """ # TODO jstejska: Description
#
# :param blocking: if clients blocks program execution - runs on foreground
# :type blocking: bool
# """
# super(Client, self).__init__()
# self.hostname = None
# self.address = None
# self.message_pool = []
# self.error = False
# self.container = None
# self.event = None
# self.thread = None
# self._blocking = blocking
#
# @property
# def msg_cnt(self):
# """ # TODO jstejska: Description
#
# :return: count of available messages
# :rtype: int
# """
# return len(self.message_pool)
#
# def run(self):
# """Starts clients.
#
# Client runs on foreground/background according to its configuration during initialization
#
# :return: None
# :rtype: # TODO jstejska: type
# """
# self.thread = threading.Thread(target=self.container.run) # assing a thread
# if self._blocking:
# self.thread.run()
# else:
# self.thread.start() # invokes separate thread of control
#
# def stop(self):
# self.thread.join(timeout=1)
#
#
# class Sender(Client):
# """Most basic example clients capable of sending messages."""
#
# def __init__(self, hostname="localhost", address="test_queue", count=1, messages=None, blocking=False):
# """ # TODO jstejska: Description
#
# :param hostname: hostname of the physical node with routers/brokers/receiver
# :type hostname: str
# :param address: address where to send (queue name, topic name)
# :type address: str
# :param count: count of messages to send - every message from the 'messages' will be sent *count* times
# :type count: int
# :param messages: pool of messages to send, note count - proton.Message
# :type messages: list
# :param blocking: if clients blocks program execution - runs on foreground
# :type blocking: bool
# """
# super(Sender, self).__init__(blocking=blocking)
# if messages is None:
# messages = []
# self.hostname = hostname
# self.address = address
# self.counter = 0
# self.max_messages = count
# self.messages = messages
# self.container = None
# self.container = Container(self)
#
# def on_start(self, event): # event loop starts
# conn = event.container.connect(self.hostname)
# event.container.create_sender(conn, self.address)
#
# def on_sendable(self,
# event): # link has credit and we can transfer messages TODO add link credit checking see dtests
# if event.sender:
# for message in self.messages:
# counter_per_message = 0
# if counter_per_message < self.max_messages:
# event.sender.send(message)
# self.message_pool.append(message) # sent messages to the pool
# counter_per_message += 1
# self.counter += 1
# if self.counter == self.max_messages:
# event.connection.close()
#
# @staticmethod
# def on_connection_closed(event):
# event.container.stop()
#
#
# class Receiver(Client):
# def __init__(self, hostname="localhost", address="test_queue", expected=1, blocking=True):
# """ # TODO jstejska: Description
#
#
# :param hostname: hostname of the physical node with routers/brokers/receiver
# :type hostname: str
# :param address: address where to send (queue name, topic name)
# :type address: str
# :param expected: expected count of messages to receive
# :type expected: int
# :param blocking: if clients blocks program execution - runs on foreground
# :type blocking: bool
# """
# super(Receiver, self).__init__(blocking=blocking)
# self.hostname = hostname
# self.confirmed = 0
# self.total = expected
# self.received = 0
# self.receiver = None
# self.address = address
# self.container = Container(self)
# self.timer = None
#
# def on_reactor_init(self, event): # called when event loop - the reactor - starts
# super(Receiver, self).on_reactor_init(event)
# self.timer = event.reactor.schedule(5, Timeout(
# self)) # schedule timeout -- good for testing purposes to not hang out
# self.receiver = event.container.create_receiver(self.hostname + "/" + self.address)
# self.receiver.open()
#
# def timeout(self, event): # TODO error handling is missing
# self.error = 1
# if self.receiver is not None:
# self.receiver.close()
# event.container.stop()
#
# def on_message(self, event): # we got a message
# if event.receiver:
# self.message_pool.append(event.message)
# self.received += 1
# if self.received == self.total:
# if self.receiver is not None:
# self.receiver.close()
# event.container.stop()
| 34.308511 | 125 | 0.606357 | 708 | 6,450 | 5.420904 | 0.264124 | 0.01876 | 0.01433 | 0.021886 | 0.217301 | 0.217301 | 0.204534 | 0.204534 | 0.181605 | 0.181605 | 0 | 0.003687 | 0.285116 | 6,450 | 187 | 126 | 34.491979 | 0.828671 | 0.870853 | 0 | 0 | 0 | 0 | 0.011006 | 0 | 0 | 0 | 0 | 0.010695 | 0 | 1 | 0.083333 | false | 0 | 0.333333 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
d8e063e417820316c521178fca6db8308e6a72f8 | 39,587 | py | Python | tests/integrated_tests/controller_tests/api_data.py | Global-Water-Security-Center/tethysapp-temp_precip_trends | 1da724ecc1b4195d21260eefe2c2d1e0b0774cb9 | [
"BSD-3-Clause"
] | null | null | null | tests/integrated_tests/controller_tests/api_data.py | Global-Water-Security-Center/tethysapp-temp_precip_trends | 1da724ecc1b4195d21260eefe2c2d1e0b0774cb9 | [
"BSD-3-Clause"
] | 1 | 2021-08-30T18:09:17.000Z | 2021-08-30T18:09:17.000Z | tests/integrated_tests/controller_tests/api_data.py | Global-Water-Security-Center/tethysapp-temp_precip_trends | 1da724ecc1b4195d21260eefe2c2d1e0b0774cb9 | [
"BSD-3-Clause"
] | null | null | null | import datetime
import xarray as xr
get_normal_data_dict = {
'coords': {
'latitude': {
'dims': ('station',),
'attrs': {'units': 'degrees_north', 'long_name': 'station latitude'},
'data': [50.66687232181073]
},
'longitude': {
'dims': ('station',),
'attrs': {'units': 'degrees_east', 'long_name': 'station longitude'},
'data': [-118.95996093749999]
},
'time': {
'dims': ('obs',),
'attrs': {'standard_name': 'time', 'long_name': 'time coordinate'},
'data': [datetime.datetime(2000, 1, 1, 0, 0), datetime.datetime(2000, 1, 2, 0, 0),
datetime.datetime(2000, 1, 3, 0, 0), datetime.datetime(2000, 1, 4, 0, 0),
datetime.datetime(2000, 1, 5, 0, 0), datetime.datetime(2000, 1, 6, 0, 0),
datetime.datetime(2000, 1, 7, 0, 0), datetime.datetime(2000, 1, 8, 0, 0),
datetime.datetime(2000, 1, 9, 0, 0), datetime.datetime(2000, 1, 10, 0, 0),
datetime.datetime(2000, 1, 11, 0, 0), datetime.datetime(2000, 1, 12, 0, 0),
datetime.datetime(2000, 1, 13, 0, 0), datetime.datetime(2000, 1, 14, 0, 0),
datetime.datetime(2000, 1, 15, 0, 0), datetime.datetime(2000, 1, 16, 0, 0),
datetime.datetime(2000, 1, 17, 0, 0), datetime.datetime(2000, 1, 18, 0, 0),
datetime.datetime(2000, 1, 19, 0, 0), datetime.datetime(2000, 1, 20, 0, 0),
datetime.datetime(2000, 1, 21, 0, 0), datetime.datetime(2000, 1, 22, 0, 0),
datetime.datetime(2000, 1, 23, 0, 0), datetime.datetime(2000, 1, 24, 0, 0),
datetime.datetime(2000, 1, 25, 0, 0), datetime.datetime(2000, 1, 26, 0, 0),
datetime.datetime(2000, 1, 27, 0, 0), datetime.datetime(2000, 1, 28, 0, 0),
datetime.datetime(2000, 1, 29, 0, 0), datetime.datetime(2000, 1, 30, 0, 0),
datetime.datetime(2000, 1, 31, 0, 0), datetime.datetime(2000, 2, 1, 0, 0),
datetime.datetime(2000, 2, 2, 0, 0), datetime.datetime(2000, 2, 3, 0, 0),
datetime.datetime(2000, 2, 4, 0, 0), datetime.datetime(2000, 2, 5, 0, 0),
datetime.datetime(2000, 2, 6, 0, 0), datetime.datetime(2000, 2, 7, 0, 0),
datetime.datetime(2000, 2, 8, 0, 0), datetime.datetime(2000, 2, 9, 0, 0),
datetime.datetime(2000, 2, 10, 0, 0), datetime.datetime(2000, 2, 11, 0, 0),
datetime.datetime(2000, 2, 12, 0, 0), datetime.datetime(2000, 2, 13, 0, 0),
datetime.datetime(2000, 2, 14, 0, 0), datetime.datetime(2000, 2, 15, 0, 0),
datetime.datetime(2000, 2, 16, 0, 0), datetime.datetime(2000, 2, 17, 0, 0),
datetime.datetime(2000, 2, 18, 0, 0), datetime.datetime(2000, 2, 19, 0, 0),
datetime.datetime(2000, 2, 20, 0, 0), datetime.datetime(2000, 2, 21, 0, 0),
datetime.datetime(2000, 2, 22, 0, 0), datetime.datetime(2000, 2, 23, 0, 0),
datetime.datetime(2000, 2, 24, 0, 0), datetime.datetime(2000, 2, 25, 0, 0),
datetime.datetime(2000, 2, 26, 0, 0), datetime.datetime(2000, 2, 27, 0, 0),
datetime.datetime(2000, 2, 28, 0, 0), datetime.datetime(2000, 2, 29, 0, 0),
datetime.datetime(2000, 3, 1, 0, 0), datetime.datetime(2000, 3, 2, 0, 0),
datetime.datetime(2000, 3, 3, 0, 0), datetime.datetime(2000, 3, 4, 0, 0),
datetime.datetime(2000, 3, 5, 0, 0), datetime.datetime(2000, 3, 6, 0, 0),
datetime.datetime(2000, 3, 7, 0, 0), datetime.datetime(2000, 3, 8, 0, 0),
datetime.datetime(2000, 3, 9, 0, 0), datetime.datetime(2000, 3, 10, 0, 0),
datetime.datetime(2000, 3, 11, 0, 0), datetime.datetime(2000, 3, 12, 0, 0),
datetime.datetime(2000, 3, 13, 0, 0), datetime.datetime(2000, 3, 14, 0, 0),
datetime.datetime(2000, 3, 15, 0, 0), datetime.datetime(2000, 3, 16, 0, 0),
datetime.datetime(2000, 3, 17, 0, 0), datetime.datetime(2000, 3, 18, 0, 0),
datetime.datetime(2000, 3, 19, 0, 0), datetime.datetime(2000, 3, 20, 0, 0),
datetime.datetime(2000, 3, 21, 0, 0), datetime.datetime(2000, 3, 22, 0, 0),
datetime.datetime(2000, 3, 23, 0, 0), datetime.datetime(2000, 3, 24, 0, 0),
datetime.datetime(2000, 3, 25, 0, 0), datetime.datetime(2000, 3, 26, 0, 0),
datetime.datetime(2000, 3, 27, 0, 0), datetime.datetime(2000, 3, 28, 0, 0),
datetime.datetime(2000, 3, 29, 0, 0), datetime.datetime(2000, 3, 30, 0, 0),
datetime.datetime(2000, 3, 31, 0, 0), datetime.datetime(2000, 4, 1, 0, 0),
datetime.datetime(2000, 4, 2, 0, 0), datetime.datetime(2000, 4, 3, 0, 0),
datetime.datetime(2000, 4, 4, 0, 0), datetime.datetime(2000, 4, 5, 0, 0),
datetime.datetime(2000, 4, 6, 0, 0), datetime.datetime(2000, 4, 7, 0, 0),
datetime.datetime(2000, 4, 8, 0, 0), datetime.datetime(2000, 4, 9, 0, 0),
datetime.datetime(2000, 4, 10, 0, 0), datetime.datetime(2000, 4, 11, 0, 0),
datetime.datetime(2000, 4, 12, 0, 0), datetime.datetime(2000, 4, 13, 0, 0),
datetime.datetime(2000, 4, 14, 0, 0), datetime.datetime(2000, 4, 15, 0, 0),
datetime.datetime(2000, 4, 16, 0, 0), datetime.datetime(2000, 4, 17, 0, 0),
datetime.datetime(2000, 4, 18, 0, 0), datetime.datetime(2000, 4, 19, 0, 0),
datetime.datetime(2000, 4, 20, 0, 0), datetime.datetime(2000, 4, 21, 0, 0),
datetime.datetime(2000, 4, 22, 0, 0), datetime.datetime(2000, 4, 23, 0, 0),
datetime.datetime(2000, 4, 24, 0, 0), datetime.datetime(2000, 4, 25, 0, 0),
datetime.datetime(2000, 4, 26, 0, 0), datetime.datetime(2000, 4, 27, 0, 0),
datetime.datetime(2000, 4, 28, 0, 0), datetime.datetime(2000, 4, 29, 0, 0),
datetime.datetime(2000, 4, 30, 0, 0), datetime.datetime(2000, 5, 1, 0, 0),
datetime.datetime(2000, 5, 2, 0, 0), datetime.datetime(2000, 5, 3, 0, 0),
datetime.datetime(2000, 5, 4, 0, 0), datetime.datetime(2000, 5, 5, 0, 0),
datetime.datetime(2000, 5, 6, 0, 0), datetime.datetime(2000, 5, 7, 0, 0),
datetime.datetime(2000, 5, 8, 0, 0), datetime.datetime(2000, 5, 9, 0, 0),
datetime.datetime(2000, 5, 10, 0, 0), datetime.datetime(2000, 5, 11, 0, 0),
datetime.datetime(2000, 5, 12, 0, 0), datetime.datetime(2000, 5, 13, 0, 0),
datetime.datetime(2000, 5, 14, 0, 0), datetime.datetime(2000, 5, 15, 0, 0),
datetime.datetime(2000, 5, 16, 0, 0), datetime.datetime(2000, 5, 17, 0, 0),
datetime.datetime(2000, 5, 18, 0, 0), datetime.datetime(2000, 5, 19, 0, 0),
datetime.datetime(2000, 5, 20, 0, 0), datetime.datetime(2000, 5, 21, 0, 0),
datetime.datetime(2000, 5, 22, 0, 0), datetime.datetime(2000, 5, 23, 0, 0),
datetime.datetime(2000, 5, 24, 0, 0), datetime.datetime(2000, 5, 25, 0, 0),
datetime.datetime(2000, 5, 26, 0, 0), datetime.datetime(2000, 5, 27, 0, 0),
datetime.datetime(2000, 5, 28, 0, 0), datetime.datetime(2000, 5, 29, 0, 0),
datetime.datetime(2000, 5, 30, 0, 0), datetime.datetime(2000, 5, 31, 0, 0),
datetime.datetime(2000, 6, 1, 0, 0), datetime.datetime(2000, 6, 2, 0, 0),
datetime.datetime(2000, 6, 3, 0, 0), datetime.datetime(2000, 6, 4, 0, 0),
datetime.datetime(2000, 6, 5, 0, 0), datetime.datetime(2000, 6, 6, 0, 0),
datetime.datetime(2000, 6, 7, 0, 0), datetime.datetime(2000, 6, 8, 0, 0),
datetime.datetime(2000, 6, 9, 0, 0), datetime.datetime(2000, 6, 10, 0, 0),
datetime.datetime(2000, 6, 11, 0, 0), datetime.datetime(2000, 6, 12, 0, 0),
datetime.datetime(2000, 6, 13, 0, 0), datetime.datetime(2000, 6, 14, 0, 0),
datetime.datetime(2000, 6, 15, 0, 0), datetime.datetime(2000, 6, 16, 0, 0),
datetime.datetime(2000, 6, 17, 0, 0), datetime.datetime(2000, 6, 18, 0, 0),
datetime.datetime(2000, 6, 19, 0, 0), datetime.datetime(2000, 6, 20, 0, 0),
datetime.datetime(2000, 6, 21, 0, 0), datetime.datetime(2000, 6, 22, 0, 0),
datetime.datetime(2000, 6, 23, 0, 0), datetime.datetime(2000, 6, 24, 0, 0),
datetime.datetime(2000, 6, 25, 0, 0), datetime.datetime(2000, 6, 26, 0, 0),
datetime.datetime(2000, 6, 27, 0, 0), datetime.datetime(2000, 6, 28, 0, 0),
datetime.datetime(2000, 6, 29, 0, 0), datetime.datetime(2000, 6, 30, 0, 0),
datetime.datetime(2000, 7, 1, 0, 0), datetime.datetime(2000, 7, 2, 0, 0),
datetime.datetime(2000, 7, 3, 0, 0), datetime.datetime(2000, 7, 4, 0, 0),
datetime.datetime(2000, 7, 5, 0, 0), datetime.datetime(2000, 7, 6, 0, 0),
datetime.datetime(2000, 7, 7, 0, 0), datetime.datetime(2000, 7, 8, 0, 0),
datetime.datetime(2000, 7, 9, 0, 0), datetime.datetime(2000, 7, 10, 0, 0),
datetime.datetime(2000, 7, 11, 0, 0), datetime.datetime(2000, 7, 12, 0, 0),
datetime.datetime(2000, 7, 13, 0, 0), datetime.datetime(2000, 7, 14, 0, 0),
datetime.datetime(2000, 7, 15, 0, 0), datetime.datetime(2000, 7, 16, 0, 0),
datetime.datetime(2000, 7, 17, 0, 0), datetime.datetime(2000, 7, 18, 0, 0),
datetime.datetime(2000, 7, 19, 0, 0), datetime.datetime(2000, 7, 20, 0, 0),
datetime.datetime(2000, 7, 21, 0, 0), datetime.datetime(2000, 7, 22, 0, 0),
datetime.datetime(2000, 7, 23, 0, 0), datetime.datetime(2000, 7, 24, 0, 0),
datetime.datetime(2000, 7, 25, 0, 0), datetime.datetime(2000, 7, 26, 0, 0),
datetime.datetime(2000, 7, 27, 0, 0), datetime.datetime(2000, 7, 28, 0, 0),
datetime.datetime(2000, 7, 29, 0, 0), datetime.datetime(2000, 7, 30, 0, 0),
datetime.datetime(2000, 7, 31, 0, 0), datetime.datetime(2000, 8, 1, 0, 0),
datetime.datetime(2000, 8, 2, 0, 0), datetime.datetime(2000, 8, 3, 0, 0),
datetime.datetime(2000, 8, 4, 0, 0), datetime.datetime(2000, 8, 5, 0, 0),
datetime.datetime(2000, 8, 6, 0, 0), datetime.datetime(2000, 8, 7, 0, 0),
datetime.datetime(2000, 8, 8, 0, 0), datetime.datetime(2000, 8, 9, 0, 0),
datetime.datetime(2000, 8, 10, 0, 0), datetime.datetime(2000, 8, 11, 0, 0),
datetime.datetime(2000, 8, 12, 0, 0), datetime.datetime(2000, 8, 13, 0, 0),
datetime.datetime(2000, 8, 14, 0, 0), datetime.datetime(2000, 8, 15, 0, 0),
datetime.datetime(2000, 8, 16, 0, 0), datetime.datetime(2000, 8, 17, 0, 0),
datetime.datetime(2000, 8, 18, 0, 0), datetime.datetime(2000, 8, 19, 0, 0),
datetime.datetime(2000, 8, 20, 0, 0), datetime.datetime(2000, 8, 21, 0, 0),
datetime.datetime(2000, 8, 22, 0, 0), datetime.datetime(2000, 8, 23, 0, 0),
datetime.datetime(2000, 8, 24, 0, 0), datetime.datetime(2000, 8, 25, 0, 0),
datetime.datetime(2000, 8, 26, 0, 0), datetime.datetime(2000, 8, 27, 0, 0),
datetime.datetime(2000, 8, 28, 0, 0), datetime.datetime(2000, 8, 29, 0, 0),
datetime.datetime(2000, 8, 30, 0, 0), datetime.datetime(2000, 8, 31, 0, 0),
datetime.datetime(2000, 9, 1, 0, 0), datetime.datetime(2000, 9, 2, 0, 0),
datetime.datetime(2000, 9, 3, 0, 0), datetime.datetime(2000, 9, 4, 0, 0),
datetime.datetime(2000, 9, 5, 0, 0), datetime.datetime(2000, 9, 6, 0, 0),
datetime.datetime(2000, 9, 7, 0, 0), datetime.datetime(2000, 9, 8, 0, 0),
datetime.datetime(2000, 9, 9, 0, 0), datetime.datetime(2000, 9, 10, 0, 0),
datetime.datetime(2000, 9, 11, 0, 0), datetime.datetime(2000, 9, 12, 0, 0),
datetime.datetime(2000, 9, 13, 0, 0), datetime.datetime(2000, 9, 14, 0, 0),
datetime.datetime(2000, 9, 15, 0, 0), datetime.datetime(2000, 9, 16, 0, 0),
datetime.datetime(2000, 9, 17, 0, 0), datetime.datetime(2000, 9, 18, 0, 0),
datetime.datetime(2000, 9, 19, 0, 0), datetime.datetime(2000, 9, 20, 0, 0),
datetime.datetime(2000, 9, 21, 0, 0), datetime.datetime(2000, 9, 22, 0, 0),
datetime.datetime(2000, 9, 23, 0, 0), datetime.datetime(2000, 9, 24, 0, 0),
datetime.datetime(2000, 9, 25, 0, 0), datetime.datetime(2000, 9, 26, 0, 0),
datetime.datetime(2000, 9, 27, 0, 0), datetime.datetime(2000, 9, 28, 0, 0),
datetime.datetime(2000, 9, 29, 0, 0), datetime.datetime(2000, 9, 30, 0, 0),
datetime.datetime(2000, 10, 1, 0, 0), datetime.datetime(2000, 10, 2, 0, 0),
datetime.datetime(2000, 10, 3, 0, 0), datetime.datetime(2000, 10, 4, 0, 0),
datetime.datetime(2000, 10, 5, 0, 0), datetime.datetime(2000, 10, 6, 0, 0),
datetime.datetime(2000, 10, 7, 0, 0), datetime.datetime(2000, 10, 8, 0, 0),
datetime.datetime(2000, 10, 9, 0, 0), datetime.datetime(2000, 10, 10, 0, 0),
datetime.datetime(2000, 10, 11, 0, 0), datetime.datetime(2000, 10, 12, 0, 0),
datetime.datetime(2000, 10, 13, 0, 0), datetime.datetime(2000, 10, 14, 0, 0),
datetime.datetime(2000, 10, 15, 0, 0), datetime.datetime(2000, 10, 16, 0, 0),
datetime.datetime(2000, 10, 17, 0, 0), datetime.datetime(2000, 10, 18, 0, 0),
datetime.datetime(2000, 10, 19, 0, 0), datetime.datetime(2000, 10, 20, 0, 0),
datetime.datetime(2000, 10, 21, 0, 0), datetime.datetime(2000, 10, 22, 0, 0),
datetime.datetime(2000, 10, 23, 0, 0), datetime.datetime(2000, 10, 24, 0, 0),
datetime.datetime(2000, 10, 25, 0, 0), datetime.datetime(2000, 10, 26, 0, 0),
datetime.datetime(2000, 10, 27, 0, 0), datetime.datetime(2000, 10, 28, 0, 0),
datetime.datetime(2000, 10, 29, 0, 0), datetime.datetime(2000, 10, 30, 0, 0),
datetime.datetime(2000, 10, 31, 0, 0), datetime.datetime(2000, 11, 1, 0, 0),
datetime.datetime(2000, 11, 2, 0, 0), datetime.datetime(2000, 11, 3, 0, 0),
datetime.datetime(2000, 11, 4, 0, 0), datetime.datetime(2000, 11, 5, 0, 0),
datetime.datetime(2000, 11, 6, 0, 0), datetime.datetime(2000, 11, 7, 0, 0),
datetime.datetime(2000, 11, 8, 0, 0), datetime.datetime(2000, 11, 9, 0, 0),
datetime.datetime(2000, 11, 10, 0, 0), datetime.datetime(2000, 11, 11, 0, 0),
datetime.datetime(2000, 11, 12, 0, 0), datetime.datetime(2000, 11, 13, 0, 0),
datetime.datetime(2000, 11, 14, 0, 0), datetime.datetime(2000, 11, 15, 0, 0),
datetime.datetime(2000, 11, 16, 0, 0), datetime.datetime(2000, 11, 17, 0, 0),
datetime.datetime(2000, 11, 18, 0, 0), datetime.datetime(2000, 11, 19, 0, 0),
datetime.datetime(2000, 11, 20, 0, 0), datetime.datetime(2000, 11, 21, 0, 0),
datetime.datetime(2000, 11, 22, 0, 0), datetime.datetime(2000, 11, 23, 0, 0),
datetime.datetime(2000, 11, 24, 0, 0), datetime.datetime(2000, 11, 25, 0, 0),
datetime.datetime(2000, 11, 26, 0, 0), datetime.datetime(2000, 11, 27, 0, 0),
datetime.datetime(2000, 11, 28, 0, 0), datetime.datetime(2000, 11, 29, 0, 0),
datetime.datetime(2000, 11, 30, 0, 0), datetime.datetime(2000, 12, 1, 0, 0),
datetime.datetime(2000, 12, 2, 0, 0), datetime.datetime(2000, 12, 3, 0, 0),
datetime.datetime(2000, 12, 4, 0, 0), datetime.datetime(2000, 12, 5, 0, 0),
datetime.datetime(2000, 12, 6, 0, 0), datetime.datetime(2000, 12, 7, 0, 0),
datetime.datetime(2000, 12, 8, 0, 0), datetime.datetime(2000, 12, 9, 0, 0),
datetime.datetime(2000, 12, 10, 0, 0), datetime.datetime(2000, 12, 11, 0, 0),
datetime.datetime(2000, 12, 12, 0, 0), datetime.datetime(2000, 12, 13, 0, 0),
datetime.datetime(2000, 12, 14, 0, 0), datetime.datetime(2000, 12, 15, 0, 0),
datetime.datetime(2000, 12, 16, 0, 0), datetime.datetime(2000, 12, 17, 0, 0),
datetime.datetime(2000, 12, 18, 0, 0), datetime.datetime(2000, 12, 19, 0, 0),
datetime.datetime(2000, 12, 20, 0, 0), datetime.datetime(2000, 12, 21, 0, 0),
datetime.datetime(2000, 12, 22, 0, 0), datetime.datetime(2000, 12, 23, 0, 0),
datetime.datetime(2000, 12, 24, 0, 0), datetime.datetime(2000, 12, 25, 0, 0),
datetime.datetime(2000, 12, 26, 0, 0), datetime.datetime(2000, 12, 27, 0, 0),
datetime.datetime(2000, 12, 28, 0, 0), datetime.datetime(2000, 12, 29, 0, 0),
datetime.datetime(2000, 12, 30, 0, 0), datetime.datetime(2000, 12, 31, 0, 0)]}},
'attrs': {'Conventions': 'CF-1.6', 'history': 'Written by CFPointWriter',
'title': 'Extract Points data from Grid file era5/normal-prcp-temp.nc',
'time_coverage_start': '2000-01-01T00:00:00Z', 'time_coverage_end': '2000-12-31T00:00:00Z',
'geospatial_lat_min': 50.66637232181073, 'geospatial_lat_max': 50.66737232181073,
'geospatial_lon_min': -118.96046093749999, 'geospatial_lon_max': -118.95946093749998,
'featureType': 'timeSeries'},
'dims': {'station': 1, 'obs': 366},
'data_vars': {
'station_id': {
'dims': ('station',),
'attrs': {'long_name': 'station identifier', 'cf_role': 'timeseries_id'},
'data': [b'GridPoint']
},
'station_description': {
'dims': ('station',),
'attrs': {'long_name': 'station description', 'standard_name': 'platform_name'},
'data': [b'Grid Point at lat/lon=50.66687232181073,-118.95996093749999']},
'stationIndex': {
'dims': ('obs',),
'attrs': {'long_name': 'station index for this observation record', 'instance_dimension': 'station'},
'data': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]},
'normal_sum_tp_mm': {
'dims': ('obs',),
'attrs': {'units': 'mm', 'long_name': 'normal_sum_tp_mm'},
'data': [0.8834426999092102, 1.3021093606948853, 1.1562389135360718, 0.8248133659362793,
1.798572063446045, 1.3793971538543701, 1.2030701637268066, 1.1913764476776123,
1.2515772581100464, 1.0604006052017212, 1.8307009935379028, 1.48170804977417,
1.2496330738067627, 1.5318950414657593, 1.5637784004211426, 1.2010200023651123,
1.5231218338012695, 1.6995210647583008, 2.162895917892456, 1.2869563102722168,
1.8743332624435425, 0.9908745288848877, 1.5489219427108765, 1.581710696220398,
1.961148977279663, 1.2416434288024902, 1.528881549835205, 1.5275287628173828,
0.8183361887931824, 1.226246953010559, 1.3908181190490723, 1.0632354021072388,
1.3949836492538452, 1.3787846565246582, 0.8567322492599487, 1.168095588684082,
1.4707516431808472, 1.3659700155258179, 1.5206345319747925, 1.4796028137207031,
1.650949478149414, 1.5863250494003296, 1.6451796293258667, 1.8885279893875122,
2.186436414718628, 1.1827868223190308, 1.693828821182251, 1.8354460000991821,
1.714165210723877, 1.71063232421875, 1.8213582038879395, 1.0077660083770752,
1.3383160829544067, 1.2038049697875977, 1.3633239269256592, 1.525235652923584,
1.4616467952728271, 1.5408953428268433, 1.3432376384735107, 1.2029389142990112,
2.2797062397003174, 2.3430862426757812, 1.3669581413269043, 1.199586272239685,
1.8089160919189453, 1.3724892139434814, 1.2016230821609497, 1.276761770248413,
1.5096659660339355, 1.4939243793487549, 1.5549923181533813, 1.747247576713562,
1.505157232284546, 1.7772021293640137, 1.261400580406189, 1.5287494659423828,
1.8091517686843872, 1.4209846258163452, 1.6252535581588745, 1.6775915622711182,
1.6486022472381592, 2.2244577407836914, 2.275409698486328, 2.0881080627441406,
2.343050241470337, 2.3212435245513916, 2.0646538734436035, 1.9205926656723022,
1.9545141458511353, 1.7579981088638306, 2.031564950942993, 2.4745090007781982,
2.1894338130950928, 0.9640341997146606, 1.2698101997375488, 1.830962061882019,
2.282038688659668, 2.5597074031829834, 2.4718453884124756, 1.965211272239685,
1.5550609827041626, 1.3692219257354736, 1.5507014989852905, 1.7219972610473633,
2.441770553588867, 1.5695720911026, 1.8834463357925415, 2.3848602771759033, 2.5298783779144287,
1.9352457523345947, 2.381423234939575, 1.628350853919983, 2.232306480407715, 2.1783852577209473,
2.9692740440368652, 3.1663997173309326, 2.4279026985168457, 2.9107983112335205,
2.3972251415252686, 1.6603813171386719, 1.7918652296066284, 2.2359437942504883,
1.9860801696777344, 1.499435305595398, 1.3621306419372559, 1.715454339981079,
2.4152932167053223, 2.7238144874572754, 2.6880733966827393, 2.5776426792144775,
2.295908212661743, 2.2023143768310547, 1.640908122062683, 1.141812801361084, 1.929598093032837,
1.6458096504211426, 2.032334089279175, 2.0523288249969482, 1.9653491973876953,
2.138004779815674, 2.1410470008850098, 2.123279333114624, 1.815234899520874, 2.366981029510498,
1.8158220052719116, 1.3353005647659302, 1.6131131649017334, 1.6094799041748047,
1.5894203186035156, 2.0360054969787598, 1.6139346361160278, 1.395927906036377,
1.7033904790878296, 1.34810209274292, 1.2454057931900024, 1.177462100982666, 1.9934461116790771,
1.9025219678878784, 2.200354814529419, 1.7789111137390137, 1.96018385887146, 1.2090449333190918,
1.5157487392425537, 1.5439081192016602, 1.2337677478790283, 0.741601288318634,
1.0612107515335083, 0.939987063407898, 1.437804937362671, 0.6825867295265198,
0.79891037940979, 0.5087683200836182, 0.5294633507728577, 0.5745163559913635,
0.9021593928337097, 1.101211667060852, 0.5204489827156067, 0.6877403855323792,
0.5301146507263184, 0.44296571612358093, 0.3506855070590973, 0.2556487023830414,
0.4965434968471527, 0.753333568572998, 0.4674091041088104, 0.6149564385414124,
0.3647845387458801, 0.48924851417541504, 0.6616204977035522, 0.6228722333908081,
0.8653138279914856, 0.6499698162078857, 0.39976009726524353, 0.8354206085205078,
0.278477281332016, 0.4611504375934601, 0.442935049533844, 0.8036360740661621,
0.7155183553695679, 0.967709481716156, 0.6407402753829956, 1.157958745956421,
0.9609462022781372, 1.5663853883743286, 1.2866252660751343, 1.0731655359268188,
0.8698267340660095, 0.5974782705307007, 0.7699467539787292, 0.8529271483421326,
0.5704760551452637, 0.6283690333366394, 0.8212069272994995, 0.960478663444519,
1.0596126317977905, 0.9070025086402893, 0.686007559299469, 0.4113451838493347,
0.48043474555015564, 0.8938892483711243, 0.560368001461029, 0.5407335162162781,
0.6254276037216187, 0.6254969239234924, 0.6967834830284119, 0.6899245381355286,
0.9658114910125732, 0.9513427019119263, 1.1082504987716675, 1.307520866394043,
0.8898847103118896, 0.8354983329772949, 0.8510369062423706, 0.6974314451217651,
1.07254159450531, 1.254237413406372, 0.6583480834960938, 0.8654849529266357,
0.38800013065338135, 0.4628647267818451, 0.6055052280426025, 0.5806525945663452,
0.8875892758369446, 1.2411737442016602, 1.5671762228012085, 0.987095832824707,
0.5294453501701355, 0.8810698390007019, 1.1075851917266846, 1.021200180053711,
1.0575288534164429, 0.8986237049102783, 0.9002524614334106, 1.297292947769165,
0.6887224316596985, 0.6416473984718323, 0.835347592830658, 1.3780194520950317,
1.0198431015014648, 1.1403956413269043, 2.2606499195098877, 1.452678918838501,
1.8098238706588745, 1.0828064680099487, 0.9121608734130859, 1.357546329498291,
1.5341484546661377, 1.2310378551483154, 0.6990559697151184, 1.107377290725708,
1.1593800783157349, 1.3545572757720947, 1.5984468460083008, 1.0520001649856567,
1.3387537002563477, 1.529124140739441, 1.9044039249420166, 1.176877737045288,
1.6105128526687622, 1.1759352684020996, 0.9380065202713013, 0.8471258878707886,
1.170287013053894, 0.9754530191421509, 1.0241769552230835, 1.4051814079284668,
1.1402519941329956, 1.1900064945220947, 1.4688630104064941, 0.9087821245193481,
0.7702696919441223, 0.8686906695365906, 1.5078027248382568, 0.9730537533760071,
1.0832339525222778, 0.797973096370697, 1.28693425655365, 1.5172497034072876,
1.41233491897583, 1.3815284967422485, 1.5621962547302246, 1.5236899852752686,
1.6638134717941284, 1.335996150970459, 1.4201205968856812, 1.094778060913086,
1.3002033233642578, 0.4449969232082367, 0.8437274098396301, 1.0260411500930786,
1.0966663360595703, 1.3884490728378296, 1.1555198431015015, 1.295694351196289,
1.611579179763794, 1.8055989742279053, 1.3211901187896729, 1.7335383892059326,
1.6134235858917236, 1.825661301612854, 1.4123567342758179, 1.6149585247039795,
1.323391079902649, 1.0603140592575073, 2.023615598678589, 1.2035374641418457,
1.202082633972168, 1.1336508989334106, 1.8235406875610352, 1.7096539735794067,
1.2003086805343628, 1.3896968364715576, 1.56449294090271, 1.388467788696289,
1.062124490737915, 1.5804845094680786, 1.4296361207962036, 1.5387300252914429,
1.0059388875961304, 1.4111888408660889, 1.7641384601593018, 1.5388598442077637,
0.925401508808136, 0.8885897397994995, 0.6793142557144165, 1.3874375820159912,
1.8582894802093506, 1.128667950630188, 1.1958938837051392, 0.9549193978309631,
1.2529207468032837, 0.8961138129234314, 1.7126818895339966, 1.063652515411377,
1.3065701723098755, 2.0049045085906982, 1.1558587551116943, 1.2830554246902466,
1.9482011795043945, 2.2377853393554688, 1.6186059713363647, 0.9888063669204712,
1.3371821641921997, 1.7315620183944702, 1.5298973321914673, 0.6932955980300903]},
'normal_mean_t2m_c': {
'dims': ('obs',),
'attrs': {'units': 'C', 'long_name': 'normal_mean_t2m_c'},
'data': [-5.9043869972229, -6.154875755310059, -6.36901330947876, -6.223363876342773,
-6.224058151245117, -6.157113075256348, -5.835471153259277, -5.304920196533203,
-5.289257049560547, -5.433412075042725, -5.909013748168945, -5.509378433227539,
-5.468820571899414, -5.430135250091553, -5.34483528137207, -5.280201435089111,
-5.109807968139648, -5.212963104248047, -5.296824932098389, -5.116939544677734,
-5.109266757965088, -5.190035820007324, -4.982577800750732, -5.175635814666748,
-5.198580265045166, -5.483608245849609, -5.719851970672607, -5.705008506774902,
-5.566929817199707, -5.371611595153809, -5.361683368682861, -5.470567226409912,
-5.04860782623291, -4.471526145935059, -4.1591715812683105, -4.161170482635498,
-4.110952377319336, -4.0438714027404785, -3.914303779602051, -4.027000904083252,
-3.626755952835083, -3.2280654907226562, -2.8569204807281494,
-2.5622806549072266, -3.0596094131469727, -2.9355220794677734,
-2.604161262512207, -2.6532866954803467, -2.9033966064453125, -2.600445508956909,
-2.24904727935791, -1.9957575798034668, -1.8795666694641113, -2.240882396697998,
-2.572990894317627, -2.5104122161865234, -2.4496846199035645, -2.28778338432312,
-1.9791229963302612, -2.119953155517578, -2.0299415588378906, -1.986243724822998,
-1.9986226558685303, -1.7518796920776367, -1.3654736280441284,
-0.9680007100105286, -0.8220723867416382, -0.3386751413345337,
0.07078942656517029, 0.21289291977882385, 0.3281913995742798,
0.47245538234710693, 0.5967400074005127, 0.7734147906303406, 0.8983818888664246,
0.8721537590026855, 1.0913033485412598, 1.411351203918457, 1.5870270729064941,
1.6770544052124023, 1.6225918531417847, 1.5367120504379272, 1.5719897747039795,
1.6062418222427368, 1.516923189163208, 1.8487581014633179, 2.0474958419799805,
2.0738940238952637, 2.633638381958008, 2.7773287296295166, 2.8269002437591553,
2.5854616165161133, 2.7389659881591797, 3.012990951538086, 3.557328224182129,
3.6569442749023438, 3.744394302368164, 3.888522148132324, 3.9155023097991943,
3.901024341583252, 4.079677104949951, 4.0756072998046875, 4.144546031951904,
4.10671329498291, 4.419687271118164, 4.662324905395508, 4.766635417938232,
4.788877487182617, 4.888323783874512, 5.277775287628174, 5.849178791046143,
5.721066474914551, 5.633642673492432, 5.591697692871094, 5.556856155395508,
5.600313663482666, 5.938451766967773, 6.103938102722168, 6.291979789733887,
6.467320442199707, 6.547372341156006, 6.8063812255859375, 6.687685489654541,
6.85529088973999, 7.4009528160095215, 7.704842567443848, 7.79671049118042,
8.146780014038086, 8.361692428588867, 8.418232917785645, 8.676843643188477,
8.66254711151123, 8.740693092346191, 9.087305068969727, 9.28481674194336,
9.848186492919922, 9.872262001037598, 9.8571138381958, 10.018067359924316,
10.102875709533691, 10.297975540161133, 10.4019193649292, 10.680313110351562,
10.56679916381836, 10.71957778930664, 10.976236343383789, 11.228572845458984,
11.169629096984863, 11.530396461486816, 11.793600082397461, 12.190803527832031,
12.658432960510254, 12.612640380859375, 12.68177604675293, 12.785806655883789,
12.736165046691895, 12.514242172241211, 12.320117950439453, 12.577031135559082,
12.522165298461914, 12.626039505004883, 13.001517295837402, 12.94879150390625,
13.043244361877441, 12.94790267944336, 13.057631492614746, 13.268044471740723,
13.741864204406738, 13.912015914916992, 13.958046913146973, 14.044785499572754,
14.04466724395752, 14.357145309448242, 14.276517868041992, 14.297982215881348,
14.264583587646484, 14.701995849609375, 14.746363639831543, 14.726926803588867,
14.913325309753418, 14.806255340576172, 14.686019897460938, 14.757694244384766,
15.049372673034668, 15.46359920501709, 15.433564186096191, 15.2009859085083,
15.36970329284668, 15.900191307067871, 16.425153732299805, 16.704927444458008,
16.376689910888672, 16.717445373535156, 16.94956398010254, 16.696128845214844,
16.62811279296875, 16.574392318725586, 16.746492385864258, 17.16143226623535,
17.3922119140625, 17.32009506225586, 17.361968994140625, 17.676881790161133,
18.07240867614746, 17.52664566040039, 17.570268630981445, 17.967573165893555,
18.51763916015625, 18.474515914916992, 18.237295150756836, 18.338924407958984,
18.53882598876953, 18.658979415893555, 18.597551345825195, 18.22317123413086,
17.799001693725586, 17.775163650512695, 17.70589828491211, 17.760984420776367,
17.901552200317383, 17.999324798583984, 18.1193904876709, 17.814315795898438,
17.705020904541016, 17.448379516601562, 17.718660354614258, 17.15749740600586,
17.1372127532959, 16.73740005493164, 17.02794075012207, 17.045127868652344,
16.971649169921875, 16.72532081604004, 16.498476028442383, 15.946175575256348,
15.604265213012695, 15.408574104309082, 15.238673210144043, 15.154642105102539,
15.496383666992188, 15.354741096496582, 15.032661437988281, 14.782695770263672,
14.550566673278809, 14.43631362915039, 14.121342658996582, 14.104408264160156,
14.294004440307617, 14.258176803588867, 13.702880859375, 13.639184951782227,
13.460232734680176, 13.298090934753418, 13.158102989196777, 13.350930213928223,
13.33679485321045, 12.993199348449707, 12.949899673461914, 12.762267112731934,
12.072270393371582, 12.122547149658203, 11.858808517456055, 11.325733184814453,
11.0779390335083, 11.358360290527344, 11.27800178527832, 11.23840045928955,
11.204880714416504, 10.906600952148438, 10.306915283203125, 9.991739273071289,
10.073695182800293, 9.988078117370605, 9.67359447479248, 8.988075256347656,
8.701506614685059, 8.49998950958252, 8.494869232177734, 8.36901569366455,
8.281622886657715, 8.067739486694336, 7.633188247680664, 7.5952982902526855,
7.003319263458252, 6.776061058044434, 6.96942663192749, 6.529757976531982,
6.212710380554199, 6.140221118927002, 5.809778690338135, 5.570686340332031,
5.61319637298584, 5.2297210693359375, 5.2048659324646, 4.943162441253662,
4.707910060882568, 4.565158367156982, 4.447474479675293, 4.2482428550720215,
3.6902518272399902, 3.3085641860961914, 2.895129919052124, 2.852085590362549,
2.940829277038574, 2.266979694366455, 2.056224822998047, 2.2010176181793213,
2.443751335144043, 1.8764128684997559, 1.9034576416015625, 1.7194502353668213,
1.4202146530151367, 1.2705928087234497, 1.3224244117736816, 0.9055443406105042,
0.6384443640708923, 0.49434104561805725, 0.4102574586868286, 0.2485962212085724,
0.018324634060263634, -0.3310288190841675, -0.42527905106544495,
-0.46363136172294617, -0.6704278588294983, -1.1460516452789307,
-1.6702779531478882, -1.70479416847229, -1.3791024684906006, -1.2045906782150269,
-1.7596502304077148, -2.0746490955352783, -1.9355111122131348,
-2.2893788814544678, -2.0893890857696533, -1.698102355003357,
-1.4944452047348022, -1.6303166151046753, -1.8431224822998047,
-2.6454083919525146, -2.8874497413635254, -3.2703826427459717,
-3.5307695865631104, -3.0090668201446533, -2.632096529006958,
-2.4058916568756104, -2.2440409660339355, -2.7209482192993164,
-2.8247828483581543, -2.5324881076812744, -2.7612006664276123,
-3.005298137664795, -3.1607916355133057, -3.648972988128662, -3.488800287246704,
-3.4853813648223877, -3.8754022121429443, -3.907853364944458, -3.744891881942749,
-3.771865129470825, -4.002835750579834, -4.160407543182373, -4.415798664093018,
-4.958073616027832, -5.214082717895508, -5.471161842346191,
-6.724740982055664]}
}
}
get_normal_data_ds = xr.Dataset.from_dict(get_normal_data_dict)
| 91.636574 | 117 | 0.576351 | 4,609 | 39,587 | 4.938815 | 0.185724 | 0.064227 | 0.321574 | 0.288626 | 0.42143 | 0.418969 | 0.027237 | 0.016079 | 0.016079 | 0.016079 | 0 | 0.568327 | 0.290171 | 39,587 | 431 | 118 | 91.849188 | 0.241744 | 0 | 0 | 0.044393 | 0 | 0 | 0.024983 | 0.001743 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.004673 | 0 | 0.004673 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
d8f959e5a98dbc723074b81342f8c142957e5265 | 110 | py | Python | test/test_preics.py | vtpl1/videonetics_api | bef179df12f449db0c50c3910daca50b7d40ac49 | [
"RSA-MD"
] | null | null | null | test/test_preics.py | vtpl1/videonetics_api | bef179df12f449db0c50c3910daca50b7d40ac49 | [
"RSA-MD"
] | 1 | 2021-02-26T07:31:37.000Z | 2021-02-26T07:31:37.000Z | test/test_preics.py | vtpl1/videonetics_api | bef179df12f449db0c50c3910daca50b7d40ac49 | [
"RSA-MD"
] | 2 | 2020-11-04T02:52:55.000Z | 2020-11-05T08:09:50.000Z | import logging
def test_job_executor(caplog):
caplog.set_level(logging.INFO)
logging.info("Started")
| 18.333333 | 34 | 0.754545 | 15 | 110 | 5.333333 | 0.733333 | 0.275 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136364 | 110 | 5 | 35 | 22 | 0.842105 | 0 | 0 | 0 | 0 | 0 | 0.063636 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
2b159bcd502876f408639e412b92a853e6c6e901 | 90 | py | Python | Basic/xiaoming.py | CrazyBBer/Python-Learn-Sample | 3bd0694327db6c662c6cc3bdf91c6261daa4b6cf | [
"MIT"
] | 2 | 2020-05-02T11:24:37.000Z | 2020-05-02T13:49:18.000Z | Basic/xiaoming.py | crazybber/pythontrip | 062ba71dfe6729ecc606eff7260b1c39497b6456 | [
"MIT"
] | null | null | null | Basic/xiaoming.py | crazybber/pythontrip | 062ba71dfe6729ecc606eff7260b1c39497b6456 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
s1 = 72
s2 = 85
r = (s2 - s1)/s1 * 100
print('rate is %.1f%%' % r) | 18 | 27 | 0.466667 | 17 | 90 | 2.470588 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.205882 | 0.244444 | 90 | 5 | 27 | 18 | 0.411765 | 0.233333 | 0 | 0 | 0 | 0 | 0.205882 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
2b422140727a2b92129b924da42c455642bb2b56 | 160 | py | Python | authentik/stages/invitation/signals.py | BeryJu/passbook | 350f0d836580f4411524614f361a76c4f27b8a2d | [
"MIT"
] | 15 | 2020-01-05T09:09:57.000Z | 2020-11-28T05:27:39.000Z | authentik/stages/invitation/signals.py | BeryJu/passbook | 350f0d836580f4411524614f361a76c4f27b8a2d | [
"MIT"
] | 302 | 2020-01-21T08:03:59.000Z | 2020-12-04T05:04:57.000Z | authentik/stages/invitation/signals.py | BeryJu/passbook | 350f0d836580f4411524614f361a76c4f27b8a2d | [
"MIT"
] | 3 | 2020-03-04T08:21:59.000Z | 2020-08-01T20:37:18.000Z | """authentik invitation signals"""
from django.core.signals import Signal
# Arguments: request: HttpRequest, invitation: Invitation
invitation_used = Signal()
| 26.666667 | 57 | 0.79375 | 17 | 160 | 7.411765 | 0.705882 | 0.31746 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.10625 | 160 | 5 | 58 | 32 | 0.881119 | 0.53125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
2b4ed075b911c215329c14ccbacd2d2c298dc493 | 222 | py | Python | Practice/Python/itertools-product().py | avantikasharma/HackerRank-Solutions | a980859ac352688853fcbcf3c7ec6d95685f99ea | [
"MIT"
] | 1 | 2018-07-08T15:44:15.000Z | 2018-07-08T15:44:15.000Z | Practice/Python/itertools-product().py | avantikasharma/HackerRank-Solutions | a980859ac352688853fcbcf3c7ec6d95685f99ea | [
"MIT"
] | null | null | null | Practice/Python/itertools-product().py | avantikasharma/HackerRank-Solutions | a980859ac352688853fcbcf3c7ec6d95685f99ea | [
"MIT"
] | 2 | 2018-08-10T06:49:34.000Z | 2020-10-01T04:50:59.000Z | # Enter your code here. Read input from STDIN. Print output to STDOUT
from itertools import product
A=list(map(int, raw_input().split()))
B=list(map(int, raw_input().split()))
A=list(product(A,B))
for i in A:
print i,
| 27.75 | 69 | 0.707207 | 41 | 222 | 3.780488 | 0.609756 | 0.103226 | 0.129032 | 0.167742 | 0.296774 | 0.296774 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144144 | 222 | 7 | 70 | 31.714286 | 0.815789 | 0.301802 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 0 | 0 | null | null | 0 | 0.166667 | null | null | 0.166667 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
2b61458f57d3865206b849588cc653acd64fd215 | 80 | py | Python | problem/10000~19999/16723/16723.py3.py | njw1204/BOJ-AC | 1de41685725ae4657a7ff94e413febd97a888567 | [
"MIT"
] | 1 | 2019-04-19T16:37:44.000Z | 2019-04-19T16:37:44.000Z | problem/10000~19999/16723/16723.py3.py | njw1204/BOJ-AC | 1de41685725ae4657a7ff94e413febd97a888567 | [
"MIT"
] | 1 | 2019-04-20T11:42:44.000Z | 2019-04-20T11:42:44.000Z | problem/10000~19999/16723/16723.py3.py | njw1204/BOJ-AC | 1de41685725ae4657a7ff94e413febd97a888567 | [
"MIT"
] | 3 | 2019-04-19T16:37:47.000Z | 2021-10-25T00:45:00.000Z | n=int(input())
i,j=2,2
a=n*2
while i<=n:
a+=(n//i)*(j*2-j)
i*=2
j*=2
print(a) | 10 | 18 | 0.4875 | 25 | 80 | 1.56 | 0.36 | 0.153846 | 0.153846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.086957 | 0.1375 | 80 | 8 | 19 | 10 | 0.478261 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.125 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
2b6cbeac55e0573333e870da306e77746258b0ea | 104 | py | Python | qlearn/stats.py | nlinker/q-learning | 140e646848a254543f03d1e10eda1bb33c92ab4a | [
"MIT"
] | 2 | 2019-06-15T14:36:43.000Z | 2019-06-20T16:23:44.000Z | qlearn/stats.py | nlinker/q-learning | 140e646848a254543f03d1e10eda1bb33c92ab4a | [
"MIT"
] | null | null | null | qlearn/stats.py | nlinker/q-learning | 140e646848a254543f03d1e10eda1bb33c92ab4a | [
"MIT"
] | null | null | null | from collections import namedtuple
Stats = namedtuple("Stats", ["episode_lengths", "episode_rewards"])
| 26 | 67 | 0.778846 | 11 | 104 | 7.181818 | 0.727273 | 0.379747 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096154 | 104 | 3 | 68 | 34.666667 | 0.840426 | 0 | 0 | 0 | 0 | 0 | 0.336538 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
991df26e248bd10118905c24697656f5dae5e4ac | 260 | py | Python | pyaz/ams/__init__.py | py-az-cli/py-az-cli | 9a7dc44e360c096a5a2f15595353e9dad88a9792 | [
"MIT"
] | null | null | null | pyaz/ams/__init__.py | py-az-cli/py-az-cli | 9a7dc44e360c096a5a2f15595353e9dad88a9792 | [
"MIT"
] | null | null | null | pyaz/ams/__init__.py | py-az-cli/py-az-cli | 9a7dc44e360c096a5a2f15595353e9dad88a9792 | [
"MIT"
] | 1 | 2022-02-03T09:12:01.000Z | 2022-02-03T09:12:01.000Z | '''
Manage Azure Media Services resources.
'''
from .. pyaz_utils import _call_az
from . import account, account_filter, asset, asset_filter, content_key_policy, job, live_event, live_output, streaming_endpoint, streaming_locator, streaming_policy, transform
| 37.142857 | 176 | 0.811538 | 34 | 260 | 5.852941 | 0.735294 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.107692 | 260 | 6 | 177 | 43.333333 | 0.857759 | 0.146154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
9936073142c2e463f1535e78288c204b30e5d4ef | 33 | py | Python | 2018_3_Cooper_Type/RoboFont/mark_current_glyph.py | benkiel/python_workshops | 9483c1fd5f7dd87e595289efb7376e1b81ff5ede | [
"MIT"
] | 6 | 2018-03-24T17:31:51.000Z | 2021-11-18T06:02:09.000Z | 2018_3_Cooper_Type/RoboFont/mark_current_glyph.py | benkiel/python_workshops | 9483c1fd5f7dd87e595289efb7376e1b81ff5ede | [
"MIT"
] | null | null | null | 2018_3_Cooper_Type/RoboFont/mark_current_glyph.py | benkiel/python_workshops | 9483c1fd5f7dd87e595289efb7376e1b81ff5ede | [
"MIT"
] | null | null | null | CurrentGlyph().mark = (1,0,0.5,1) | 33 | 33 | 0.636364 | 7 | 33 | 3 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16129 | 0.060606 | 33 | 1 | 33 | 33 | 0.516129 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
9978a8123f47a188bdcf067a17a812d95f20d151 | 105 | py | Python | fast_api_yatube/auth/schemas.py | wiky-avis/fast_api_yatube | ff7499721e3cc2803eb82daa742d0a71fa94169b | [
"MIT"
] | null | null | null | fast_api_yatube/auth/schemas.py | wiky-avis/fast_api_yatube | ff7499721e3cc2803eb82daa742d0a71fa94169b | [
"MIT"
] | 4 | 2021-09-22T18:45:44.000Z | 2022-03-12T00:57:51.000Z | fast_api_yatube/auth/schemas.py | wiky-avis/fast_api_yatube | ff7499721e3cc2803eb82daa742d0a71fa94169b | [
"MIT"
] | null | null | null | from ninja import Schema
class TokenPayload(Schema):
""" Схема для
"""
user_id: int = None
| 13.125 | 27 | 0.628571 | 13 | 105 | 5 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | 105 | 7 | 28 | 15 | 0.844156 | 0.085714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
9979b27816e150ec662ce4efef629e31143c5f5f | 532 | py | Python | marketplace/deployer_util/dict_util_test.py | dineshmudrakola/marketplace-k8s-app-tools | 9039d4ea85faf6f4959f97e2db90f1a5ec4c5aec | [
"Apache-2.0"
] | 66 | 2018-07-23T01:29:35.000Z | 2021-12-27T15:16:57.000Z | marketplace/deployer_util/dict_util_test.py | dineshmudrakola/marketplace-k8s-app-tools | 9039d4ea85faf6f4959f97e2db90f1a5ec4c5aec | [
"Apache-2.0"
] | 282 | 2018-07-18T17:39:07.000Z | 2022-02-08T09:22:33.000Z | marketplace/deployer_util/dict_util_test.py | dineshmudrakola/marketplace-k8s-app-tools | 9039d4ea85faf6f4959f97e2db90f1a5ec4c5aec | [
"Apache-2.0"
] | 61 | 2018-07-18T11:47:03.000Z | 2022-01-16T21:12:20.000Z | """Tests for dict_util."""
import dict_util
import unittest
class DictUtilTest(unittest.TestCase):
def test_deep_get(self):
c = {'c': 1}
b = {'b': c}
a = {'a': b}
self.assertEqual(dict_util.deep_get(a, 'a'), b)
self.assertEqual(dict_util.deep_get(a, 'a', 'b'), c)
self.assertEqual(dict_util.deep_get(a, 'a', 'b', 'c'), 1)
self.assertEqual(dict_util.deep_get(a, 'b'), None)
self.assertEqual(dict_util.deep_get(a, 'a', 'c'), None)
self.assertEqual(dict_util.deep_get(a, 'a', 'b', 'd'), None)
| 28 | 64 | 0.62594 | 87 | 532 | 3.643678 | 0.241379 | 0.201893 | 0.359621 | 0.435331 | 0.656151 | 0.656151 | 0.656151 | 0.55836 | 0.55836 | 0.328076 | 0 | 0.004515 | 0.167293 | 532 | 18 | 65 | 29.555556 | 0.711061 | 0.037594 | 0 | 0 | 0 | 0 | 0.029644 | 0 | 0 | 0 | 0 | 0 | 0.461538 | 1 | 0.076923 | false | 0 | 0.153846 | 0 | 0.307692 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
999c9759ba2ba4fe8f18b613316d4de5e08a5056 | 945 | py | Python | kanagam/kanagam/doctype/vehicle/vehicle.py | aerele/kanagamlogistics | e09cec5f27636a1b2135a0ba0dc37f75d3588883 | [
"MIT"
] | null | null | null | kanagam/kanagam/doctype/vehicle/vehicle.py | aerele/kanagamlogistics | e09cec5f27636a1b2135a0ba0dc37f75d3588883 | [
"MIT"
] | null | null | null | kanagam/kanagam/doctype/vehicle/vehicle.py | aerele/kanagamlogistics | e09cec5f27636a1b2135a0ba0dc37f75d3588883 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (c) 2020, regent and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
#import frappe
from frappe.model.document import Document
class Vehicle(Document):
pass
#def autoname(self):
#if self.vehicle_reg_no:
# self.vehicle_reg_no=self.vehicle_reg_no.upper()
# if self.model:
# self.model=self.model.upper()
# if self.vehicle_capacity:
# self.vehicle_capacity=vehicle_capacity.upper()
# if self.owner_name:
# self.owner_name=self.owner_name.upper()
# if self.owner_address2:
# self.owner_address2=self.owner_address2.upper()
# if self.owner_address1:
# self.owner_address1=self.owner_address1.upper()
# if self.height_ft:
# self.height_ft=self.height_ft.upper()
# if self.width_ft:
# self.width_ft=self.width_ft.upper()
# if self.length_ft:
# self.length_ft=self.length_ft.upper() | 32.586207 | 54 | 0.712169 | 134 | 945 | 4.783582 | 0.313433 | 0.084243 | 0.137285 | 0.074883 | 0.458658 | 0.458658 | 0.074883 | 0.074883 | 0 | 0 | 0 | 0.013959 | 0.166138 | 945 | 29 | 55 | 32.586207 | 0.799492 | 0.764021 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.25 | 0.5 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 4 |
41f811dc91f96dbb01c8164c83dc719c7f8c4395 | 67 | py | Python | scripts/tcutils/pkgs/__init__.py | rombie/contrail-test | a68c71d6f282142501a7e2e889bbb232fdd82dc3 | [
"Apache-2.0"
] | 5 | 2020-09-29T00:36:57.000Z | 2022-02-16T06:51:32.000Z | tcutils/pkgs/__init__.py | vkolli/contrail-test-perf | db04b8924a2c330baabe3059788b149d957a7d67 | [
"Apache-2.0"
] | 27 | 2019-11-02T02:18:34.000Z | 2022-02-24T18:49:08.000Z | tcutils/pkgs/__init__.py | vkolli/contrail-test-perf | db04b8924a2c330baabe3059788b149d957a7d67 | [
"Apache-2.0"
] | 20 | 2019-11-28T16:02:25.000Z | 2022-01-06T05:56:58.000Z | """Package directory to hold re-distributable python packages.
"""
| 22.333333 | 62 | 0.761194 | 8 | 67 | 6.375 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.119403 | 67 | 2 | 63 | 33.5 | 0.864407 | 0.880597 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
41fbfe7cacae2e6dee78b9e3d5aec4b8c1bd6e5b | 14,171 | py | Python | pymoo/problems/multi/mw.py | jarreguit/pymoo | 0496a3c6765826148d8bab21650736760517dd25 | [
"Apache-2.0"
] | 762 | 2018-06-05T20:56:09.000Z | 2021-09-14T09:09:42.000Z | pymoo/problems/multi/mw.py | jarreguit/pymoo | 0496a3c6765826148d8bab21650736760517dd25 | [
"Apache-2.0"
] | 176 | 2018-09-05T18:37:05.000Z | 2021-09-14T01:18:43.000Z | pymoo/problems/multi/mw.py | jarreguit/pymoo | 0496a3c6765826148d8bab21650736760517dd25 | [
"Apache-2.0"
] | 160 | 2018-08-05T05:31:20.000Z | 2021-09-14T09:09:45.000Z | import numpy as np
from pymoo.core.problem import Problem
# Based on the C++ implementation by the Ma and Wang
# http://www.escience.cn/people/yongwang1/index.html
from pymoo.util.remote import Remote
class MW(Problem):
def __init__(self, n_var, n_obj, n_constr, **kwargs):
if 'xl' not in kwargs:
kwargs['xl'] = 0
if 'xu' not in kwargs:
kwargs['xu'] = 1
super().__init__(n_var=n_var,
n_obj=n_obj,
n_constr=n_constr,
type_var=np.double, **kwargs)
@staticmethod
def LA1(A, B, C, D, theta):
return A * np.power(np.sin(B * np.pi * np.power(theta, C)), D)
@staticmethod
def LA2(A, B, C, D, theta):
return A * np.power(np.sin(B * np.power(theta, C)), D)
@staticmethod
def LA3(A, B, C, D, theta):
return A * np.power(np.cos(B * np.power(theta, C)), D)
def g1(self, X):
d = self.n_var
n = d - self.n_obj
z = np.power(X[:, self.n_obj - 1:], n)
i = np.arange(self.n_obj - 1, d)
exp = 1 - np.exp(-10.0 * (z - 0.5 - i / (2 * d)) * (z - 0.5 - i / (2 * d)))
distance = 1 + exp.sum(axis=1)
return distance
def g2(self, X):
d = self.n_var
n = d
i = np.arange(self.n_obj - 1, d)
z = 1 - np.exp(-10.0 * (X[:, self.n_obj - 1:] - i / n) * (X[:, self.n_obj - 1:] - i / n))
contrib = (0.1 / (n)) * z * z + 1.5 - 1.5 * np.cos(2 * np.pi * z)
distance = 1 + contrib.sum(axis=1)
return distance
def g3(self, X):
contrib = 2.0 * np.power(
X[:, self.n_obj - 1:] + (X[:, self.n_obj - 2:-1] - 0.5) * (X[:, self.n_obj - 2:-1] - 0.5) - 1.0, 2.0)
distance = 1 + contrib.sum(axis=1)
return distance
class MW1(MW):
def __init__(self, n_var=15, **kwargs):
super().__init__(n_var, 2, 1)
def _evaluate(self, X, out, *args, **kwargs):
g = self.g1(X)
f0 = X[:, 0]
f1 = g * (1 - 0.85 * f0 / g)
g0 = f0 + f1 - 1 - self.LA1(0.5, 2.0, 1.0, 8.0, np.sqrt(2.0) * f1 - np.sqrt(2.0) * f0)
out["F"] = np.column_stack([f0, f1])
out["G"] = g0.reshape((-1, 1))
def _calc_pareto_front(self, ref_dirs=None):
if ref_dirs is None:
F = np.zeros((100, 2))
F[:, 0] = np.linspace(0, 1, 100)
else:
F = ref_dirs
F[:, 1] = 1 - 0.85 * F[:, 0]
l = np.sqrt(2) * F[:, 1] - np.sqrt(2) * F[:, 0]
c = 1 - F[:, 0] - F[:, 1] + 0.5 * np.sin(2 * np.pi * l) ** 8
F = F[c >= 0]
return F
class MW2(MW):
def __init__(self, n_var=15, **kwargs):
super().__init__(n_var, 2, 1)
def _evaluate(self, X, out, *args, **kwargs):
g = self.g2(X)
f0 = X[:, 0]
f1 = g * (1 - f0 / g)
g0 = f0 + f1 - 1 - self.LA1(0.5, 3.0, 1.0, 8.0, np.sqrt(2.0) * f1 - np.sqrt(2.0) * f0)
out["F"] = np.column_stack([f0, f1])
out["G"] = g0.reshape((-1, 1))
def _calc_pareto_front(self, ref_dirs=None):
if ref_dirs is None:
F = np.zeros((100, 2))
F[:, 0] = np.linspace(0, 1, 100)
else:
F = ref_dirs
F[:, 1] = 1 - F[:, 0]
return F
class MW3(MW):
def __init__(self, n_var=15, **kwargs):
super().__init__(n_var, 2, 2)
def _evaluate(self, X, out, *args, **kwargs):
g = self.g3(X)
f0 = X[:, 0]
f1 = g * (1 - f0 / g)
g0 = f0 + f1 - 1.05 - self.LA1(0.45, 0.75, 1.0, 6.0, np.sqrt(2.0) * f1 - np.sqrt(2.0) * f0)
g1 = 0.85 - f0 - f1 + self.LA1(0.3, 0.75, 1.0, 2.0, np.sqrt(2.0) * f1 - np.sqrt(2.0) * f0)
out["F"] = np.column_stack([f0, f1])
out["G"] = np.column_stack([g0, g1])
def _calc_pareto_front(self, ref_dirs=None):
if ref_dirs is None:
F = np.zeros((100, 2))
F[:, 0] = np.linspace(0, 1, 100)
else:
F = ref_dirs
F[:, 1] = 1 - F[:, 0]
invalid = (0.85 - F[:, 0] - F[:, 1] + 0.3 * np.sin(0.75 * np.pi * np.sqrt(2) * (F[:, 1] - F[:, 0])) ** 2) > 0
while invalid.any():
F[invalid, :] *= 1.001
invalid = (0.85 - F[:, 0] - F[:, 1] + 0.3 * np.sin(
0.75 * np.pi * np.sqrt(2) * (F[:, 1] - F[:, 0])) ** 2) > 0
return F
class MW4(MW):
def __init__(self, n_var=None, n_obj=3, **kwargs):
if n_var is None:
n_var = n_obj + 12
super().__init__(n_var, n_obj, 1)
def _evaluate(self, X, out, *args, **kwargs):
g = self.g1(X)
f = g.reshape((-1, 1)) * np.ones((X.shape[0], self.n_obj))
f[:, 1:] *= X[:, (self.n_obj - 2)::-1]
f[:, 0:-1] *= np.flip(np.cumprod(1 - X[:, :(self.n_obj - 1)], axis=1), axis=1)
g0 = f.sum(axis=1) - 1 - self.LA1(0.4, 2.5, 1.0, 8.0, f[:, -1] - f[:, :-1].sum(axis=1))
out["F"] = f
out["G"] = g0.reshape((-1, 1))
def _calc_pareto_front(self, ref_dirs):
F = ref_dirs
l = F[:, -1] - np.sum(F[:, :-1], axis=1)
c = (1 + 0.4 * np.sin(2.5 * np.pi * l) ** 8) - np.sum(F, axis=1)
return F[c >= 0]
class MW5(MW):
def __init__(self, n_var=15, **kwargs):
super().__init__(n_var, 2, 3)
def _evaluate(self, X, out, *args, **kwargs):
g = self.g1(X)
f0 = g * X[:, 0]
f1 = g * np.sqrt(1.0 - np.power(f0 / g, 2.0))
with np.errstate(divide='ignore'):
atan = np.arctan(f1 / f0)
g0 = f0 ** 2 + f1 ** 2 - np.power(1.7 - self.LA2(0.2, 2.0, 1.0, 1.0, atan), 2.0)
t = 0.5 * np.pi - 2 * np.abs(atan - 0.25 * np.pi)
g1 = np.power(1 + self.LA2(0.5, 6.0, 3.0, 1.0, t), 2.0) - f0 ** 2 - f1 ** 2
g2 = np.power(1 - self.LA2(0.45, 6.0, 3.0, 1.0, t), 2.0) - f0 ** 2 - f1 ** 2
out["F"] = np.column_stack([f0, f1])
out["G"] = np.column_stack([g0, g1, g2])
def _calc_pareto_front(self, **kwargs):
return Remote.get_instance().load("pf", "MW", "MW5.pf")
class MW6(MW):
def __init__(self, n_var=15, **kwargs):
super().__init__(n_var, 2, 1, xl=0.0, xu=1.1)
def _evaluate(self, X, out, *args, **kwargs):
g = self.g2(X)
f0 = g * X[:, 0]
f1 = g * np.sqrt(1.1 * 1.1 - np.power(f0 / g, 2.0))
with np.errstate(divide='ignore'):
atan = np.arctan(f1 / f0)
g0 = f0 ** 2 / np.power(1.0 + self.LA3(0.15, 6.0, 4.0, 10.0, atan), 2.0) + f1 ** 2 / np.power(
1.0 + self.LA3(0.75, 6.0, 4.0, 10.0, atan), 2.0) - 1
out["F"] = np.column_stack([f0, f1])
out["G"] = g0.reshape((-1, 1))
def _calc_pareto_front(self, ref_dirs=None):
if ref_dirs is None:
F = np.zeros((100, 2))
F[:, 0] = np.linspace(0, 1, 100)
else:
F = ref_dirs
F[:, 1] = 1 - F[:, 0]
F = F / np.sqrt(np.sum(F ** 2, axis=1) / 1.21).reshape((-1, 1))
l = np.cos(6 * np.arctan(F[:, 1] / F[:, 0]) ** 4) ** 10
c = 1 - (F[:, 0] / (1 + 0.15 * l)) ** 2 - (F[:, 1] / (1 + 0.75 * l)) ** 2
return F[c >= 0]
class MW7(MW):
def __init__(self, n_var=15, **kwargs):
super().__init__(n_var, 2, 2)
def _evaluate(self, X, out, *args, **kwargs):
g = self.g3(X)
f0 = g * X[:, 0]
f1 = g * np.sqrt(1 - np.power(f0 / g, 2))
with np.errstate(divide='ignore'):
atan = np.arctan(f1 / f0)
g0 = f0 ** 2 + f1 ** 2 - np.power(1.2 + np.abs(self.LA2(0.4, 4.0, 1.0, 16.0, atan)), 2.0)
g1 = np.power(1.15 - self.LA2(0.2, 4.0, 1.0, 8.0, atan), 2.0) - f0 ** 2 - f1 ** 2
out["F"] = np.column_stack([f0, f1])
out["G"] = np.column_stack([g0, g1])
def _calc_pareto_front(self, **kwargs):
return Remote.get_instance().load("pf", "MW", "MW7.pf")
class MW8(MW):
def __init__(self, n_var=None, n_obj=3, **kwargs):
if n_var is None:
n_var = n_obj + 12
super().__init__(n_var, n_obj, 1)
def _evaluate(self, X, out, *args, **kwargs):
g = self.g2(X)
f = g.reshape((-1, 1)) * np.ones((X.shape[0], self.n_obj))
f[:, 1:] *= np.sin(0.5 * np.pi * X[:, (self.n_obj - 2)::-1])
cos = np.cos(0.5 * np.pi * X[:, :(self.n_obj - 1)])
f[:, 0:-1] *= np.flip(np.cumprod(cos, axis=1), axis=1)
f_squared = (f ** 2).sum(axis=1)
g0 = f_squared - (1.25 - self.LA2(0.5, 6.0, 1.0, 2.0, np.arcsin(f[:, -1] / np.sqrt(f_squared)))) * (
1.25 - self.LA2(0.5, 6.0, 1.0, 2.0, np.arcsin(f[:, -1] / np.sqrt(f_squared))))
out["F"] = f
out["G"] = g0.reshape((-1, 1))
def _calc_pareto_front(self, ref_dirs):
F = ref_dirs
F = F / np.sqrt(np.sum(F ** 2, axis=1)).reshape((-1, 1))
c = (1.25 - 0.5 * np.sin(6 * np.arcsin(F[:, -1])) ** 2) ** 2 - np.sum(F ** 2, axis=1)
return F[c >= 0]
class MW9(MW):
def __init__(self, n_var=15, **kwargs):
super().__init__(n_var, 2, 1)
def _evaluate(self, X, out, *args, **kwargs):
g = self.g1(X)
f0 = g * X[:, 0]
f1 = g * (1.0 - np.power(f0 / g, 0.6))
t1 = (1 - 0.64 * f0 * f0 - f1) * (1 - 0.36 * f0 * f0 - f1)
t2 = (1.35 * 1.35 - (f0 + 0.35) * (f0 + 0.35) - f1) * (1.15 * 1.15 - (f0 + 0.15) * (f0 + 0.15) - f1)
g0 = np.minimum(t1, t2)
out["F"] = np.column_stack([f0, f1])
out["G"] = g0.reshape((-1, 1))
def _calc_pareto_front(self, **kwargs):
return Remote.get_instance().load("pf", "MW", "MW9.pf")
class MW10(MW):
def __init__(self, n_var=15, **kwargs):
super().__init__(n_var, 2, 3)
def _evaluate(self, X, out, *args, **kwargs):
g = self.g2(X)
f0 = g * np.power(X[:, 0], self.n_var)
f1 = g * (1.0 - np.power(f0 / g, 2.0))
g0 = -1.0 * (2.0 - 4.0 * f0 * f0 - f1) * (2.0 - 8.0 * f0 * f0 - f1)
g1 = (2.0 - 2.0 * f0 * f0 - f1) * (2.0 - 16.0 * f0 * f0 - f1)
g2 = (1.0 - f0 * f0 - f1) * (1.2 - 1.2 * f0 * f0 - f1)
out["F"] = np.column_stack([f0, f1])
out["G"] = np.column_stack([g0, g1, g2])
def _calc_pareto_front(self, **kwargs):
return Remote.get_instance().load("pf", "MW", "MW10.pf")
class MW11(MW):
def __init__(self, n_var=15, **kwargs):
super().__init__(n_var, 2, 4, xl=0.0, xu=np.sqrt(2))
def _evaluate(self, X, out, *args, **kwargs):
g = self.g3(X)
f0 = g * X[:, 0]
f1 = g * np.sqrt(2.0 - np.power(f0 / g, 2.0))
g0 = -1.0 * (3.0 - f0 * f0 - f1) * (3.0 - 2.0 * f0 * f0 - f1)
g1 = (3.0 - 0.625 * f0 * f0 - f1) * (3.0 - 7.0 * f0 * f0 - f1)
g2 = -1.0 * (1.62 - 0.18 * f0 * f0 - f1) * (1.125 - 0.125 * f0 * f0 - f1)
g3 = (2.07 - 0.23 * f0 * f0 - f1) * (0.63 - 0.07 * f0 * f0 - f1)
out["F"] = np.column_stack([f0, f1])
out["G"] = np.column_stack([g0, g1, g2, g3])
def _calc_pareto_front(self, **kwargs):
return Remote.get_instance().load("pf", "MW", "MW11.pf")
class MW12(MW):
def __init__(self, n_var=15, **kwargs):
super().__init__(n_var, 2, 2)
def _evaluate(self, X, out, *args, **kwargs):
g = self.g1(X)
f0 = g * X[:, 0]
f1 = g * (0.85 - 0.8 * (f0 / g) - 0.08 * np.abs(np.sin(3.2 * np.pi * (f0 / g))))
g0 = -1.0 * (1 - 0.625 * f0 - f1 + 0.08 * np.sin(2 * np.pi * (f1 - f0 / 1.6))) * (
1.4 - 0.875 * f0 - f1 + 0.08 * np.sin(2 * np.pi * (f1 / 1.4 - f0 / 1.6)))
g1 = (1 - 0.8 * f0 - f1 + 0.08 * np.sin(2 * np.pi * (f1 - f0 / 1.5))) * (
1.8 - 1.125 * f0 - f1 + 0.08 * np.sin(2 * np.pi * (f1 / 1.8 - f0 / 1.6)))
out["F"] = np.column_stack([f0, f1])
out["G"] = np.column_stack([g0, g1])
def _calc_pareto_front(self, ref_dirs=None):
if ref_dirs is None:
F = np.zeros((100, 2))
F[:, 0] = np.linspace(0, 1, 100)
else:
F = ref_dirs
F[:, 1] = 0.85 - 0.8 * F[:, 0] - 0.08 * np.abs(np.sin(3.2 * np.pi * F[:, 0]))
invalid = (1 - 0.8 * F[:, 0] - F[:, 1] + 0.08 * np.sin(2 * np.pi * (F[:, 1] - F[:, 0] / 1.5))) * (
1.8 - 1.125 * F[:, 0] - F[:, 1] + 0.08 * np.sin(2 * np.pi * (F[:, 1] / 1.8 - F[:, 0] / 1.6))) > 0
while invalid.any():
F[invalid, :] *= 1.001
invalid = (1 - 0.8 * F[:, 0] - F[:, 1] + 0.08 * np.sin(2 * np.pi * (F[:, 1] - F[:, 0] / 1.5))) * (
1.8 - 1.125 * F[:, 0] - F[:, 1] + 0.08 * np.sin(
2 * np.pi * (F[:, 1] / 1.8 - F[:, 0] / 1.6))) > 0
return F
class MW13(MW):
def __init__(self, n_var=15, **kwargs):
super().__init__(n_var, 2, 2, xu=1.5)
def _evaluate(self, X, out, *args, **kwargs):
g = self.g2(X)
f0 = g * X[:, 0]
f1 = g * (5.0 - np.exp(f0 / g) - np.abs(0.5 * np.sin(3 * np.pi * f0 / g)))
g0 = -1.0 * (5.0 - (1 + f0 + 0.5 * f0 * f0) - 0.5 * np.sin(3 * np.pi * f0) - f1) * (
5.0 - (1 + 0.7 * f0) - 0.5 * np.sin(3 * np.pi * f0) - f1)
g1 = (5.0 - np.exp(f0) - 0.5 * np.sin(3 * np.pi * f0) - f1) * (
5.0 - (1 + 0.4 * f0) - 0.5 * np.sin(3 * np.pi * f0) - f1)
out["F"] = np.column_stack([f0, f1])
out["G"] = np.column_stack([g0, g1])
def _calc_pareto_front(self, **kwargs):
return Remote.get_instance().load("pf", "MW", "MW13.pf")
class MW14(MW):
def __init__(self, n_var=None, n_obj=3, **kwargs):
if n_var is None:
n_var = n_obj + 12
super().__init__(n_var, n_obj, 1, xu=1.5)
def _evaluate(self, X, out, *args, **kwargs):
g = self.g3(X)
f = np.zeros((X.shape[0], self.n_obj))
f[:, :-1] = X[:, :(self.n_obj - 1)]
LA1 = self.LA1(1.5, 1.1, 2.0, 1.0, f[:, :-1])
inter = (6 - np.exp(f[:, :-1]) - LA1).sum(axis=1)
f[:, -1] = g / (self.n_obj - 1) * inter
alpha = 6.1 - 1 - f[:, :-1] - 0.5 * f[:, :-1] * f[:, :-1] - LA1
g0 = f[:, -1] - 1 / (self.n_obj - 1) * alpha.sum(axis=1)
out["F"] = f
out["G"] = g0.reshape((-1, 1))
def _calc_pareto_front(self, **kwargs):
return Remote.get_instance().load("pf", "MW", "MW14.pf")
| 35.967005 | 117 | 0.450921 | 2,522 | 14,171 | 2.415147 | 0.065821 | 0.016418 | 0.024955 | 0.029552 | 0.786899 | 0.762272 | 0.736332 | 0.704646 | 0.654408 | 0.641274 | 0 | 0.122692 | 0.323619 | 14,171 | 393 | 118 | 36.058524 | 0.51278 | 0.007127 | 0 | 0.570492 | 0 | 0 | 0.009099 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.160656 | false | 0 | 0.009836 | 0.032787 | 0.285246 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
511d544881ac31b8be5a22fc7b28a362e6b00e34 | 414 | py | Python | desktop_local_tests/linux/test_linux_ip_responder_disrupt_service.py | UAEKondaya1/expressvpn_leak_testing | 9e4cee899ac04f7820ac351fa55efdc0c01370ba | [
"MIT"
] | 219 | 2017-12-12T09:42:46.000Z | 2022-03-13T08:25:13.000Z | desktop_local_tests/linux/test_linux_ip_responder_disrupt_service.py | UAEKondaya1/expressvpn_leak_testing | 9e4cee899ac04f7820ac351fa55efdc0c01370ba | [
"MIT"
] | 11 | 2017-12-14T08:14:51.000Z | 2021-08-09T18:37:45.000Z | desktop_local_tests/linux/test_linux_ip_responder_disrupt_service.py | UAEKondaya1/expressvpn_leak_testing | 9e4cee899ac04f7820ac351fa55efdc0c01370ba | [
"MIT"
] | 45 | 2017-12-14T07:26:36.000Z | 2022-03-11T09:36:56.000Z | from desktop_local_tests.local_ip_responder_test_case_with_disrupter import LocalIPResponderTestCaseWithDisrupter
from desktop_local_tests.linux.linux_service_disrupter import LinuxServiceDisrupter
class TestLinuxIPResponderDisruptService(LocalIPResponderTestCaseWithDisrupter):
# TODO: Docs
def __init__(self, devices, parameters):
super().__init__(LinuxServiceDisrupter, devices, parameters)
| 41.4 | 113 | 0.855072 | 38 | 414 | 8.789474 | 0.657895 | 0.065868 | 0.095808 | 0.125749 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096618 | 414 | 9 | 114 | 46 | 0.893048 | 0.024155 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.8 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
51384acdde25c0ddebd5a8d7ca1e49937c50822d | 146 | py | Python | electrum_gui/android/ioscallback.py | Umiiii/electrum | 9e822640680c20c69a69695c033e97605aafcdce | [
"MIT"
] | 12 | 2020-11-12T08:53:05.000Z | 2021-07-06T17:30:39.000Z | electrum_gui/android/ioscallback.py | Umiiii/electrum | 9e822640680c20c69a69695c033e97605aafcdce | [
"MIT"
] | 209 | 2020-09-23T06:58:18.000Z | 2021-11-18T11:25:41.000Z | electrum_gui/android/ioscallback.py | Umiiii/electrum | 9e822640680c20c69a69695c033e97605aafcdce | [
"MIT"
] | 19 | 2020-10-13T11:42:26.000Z | 2022-02-06T01:26:34.000Z | from .custom_objc import *
class CallHandler(OKNSObject):
value = objc_property()
@objc_method
def init(self):
return self
| 14.6 | 30 | 0.664384 | 17 | 146 | 5.529412 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.253425 | 146 | 9 | 31 | 16.222222 | 0.862385 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0.166667 | 0.833333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
5aa29b3933bb24480d61d4e4f003e13bd1452d56 | 184 | py | Python | randomras/__init__.py | quentinll/pertrenderer | d292ed4f09d49a957fba9d2f8bdd9d5c66930261 | [
"BSD-2-Clause"
] | 1 | 2022-02-03T08:31:40.000Z | 2022-02-03T08:31:40.000Z | randomras/__init__.py | quentinll/pertrenderer | d292ed4f09d49a957fba9d2f8bdd9d5c66930261 | [
"BSD-2-Clause"
] | null | null | null | randomras/__init__.py | quentinll/pertrenderer | d292ed4f09d49a957fba9d2f8bdd9d5c66930261 | [
"BSD-2-Clause"
] | null | null | null | from .random_rasterizer import SimpleShader, RandomSimpleShader
from .smoothagg import CauchyAgg,GaussianAgg,SoftAgg
from .smoothrast import SoftRast,ArctanRast,AffineRast,GaussianRast | 61.333333 | 67 | 0.88587 | 19 | 184 | 8.526316 | 0.789474 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.065217 | 184 | 3 | 67 | 61.333333 | 0.94186 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
5ab514b1a13079908998cb457b8302b2ba6aa691 | 1,883 | py | Python | easyadmin/elements/buttons.py | codemation/easyadmin | 0f305a92174a151fe08b2c8db4cf893a34055407 | [
"MIT"
] | 6 | 2021-03-30T01:28:15.000Z | 2021-12-18T00:51:14.000Z | easyadmin/elements/buttons.py | codemation/easyadmin | 0f305a92174a151fe08b2c8db4cf893a34055407 | [
"MIT"
] | 1 | 2021-05-24T01:10:35.000Z | 2021-05-24T10:17:13.000Z | easyadmin/elements/buttons.py | codemation/easyadmin | 0f305a92174a151fe08b2c8db4cf893a34055407 | [
"MIT"
] | null | null | null | def get_split_button(
name: str = "DEFAULT_BUTTON_NAME",
button_id = '',
href: str = None,
color: str = 'primary',
icon: str = 'plus',
size: str = None,
modal: str = None,
onclick: str = None
):
size = f' btn-{size}' if size else ''
href = f' href="{href}"' if href else ''
button_id = ''.join(name.split(' ')) + button_id
if onclick:
html_onclick = f' onclick="{onclick}"'
else:
html_onclick = ''
if modal:
modal = f' data-toggle="modal" data-target="#{modal}"'
else:
modal = ""
button = f"""
<a id="{button_id}" {href} class="btn btn-{color} btn-icon-split{size}"{modal}{html_onclick}>
<span class="icon text-white-50">
<i class="fas fa-{icon}"></i>
</span>
<span class="text">{name}</span>
</a>
"""
return button
# if onclick and modal:
# button = f"""{button}
# <script>
# $(document).on("click", "#{button_id}", function() {{
# {onclick}()
# }});
# </script>
# """
return button
def get_button(
name: str = "DEFAULT_BUTTON_NAME",
button_id = '',
href: str = None,
color: str = 'primary',
size: str = None,
modal: str = None,
onclick: str = None
):
button_id = ''.join(name.split(' ')) + button_id
href = f' href="{href}"' if href else ''
size = f' btn-{size}' if size else ''
if onclick:
html_onclick = f' onclick="{onclick}"'
else:
html_onclick = ''
if modal:
modal = f' data-toggle="modal" data-target="#{modal}"'
else:
modal = ""
button = f"""
<a id="{button_id}" class="btn btn-{color}{size}"{href}{modal}{html_onclick}>{name}</a>
"""
return button
# if onclick and modal:
# button = f"""{button}
# <script>
# document.on("click", "#{button_id}", function() {{
# {onclick}()
# }});
# </script>
# """
# return button | 25.445946 | 93 | 0.53744 | 234 | 1,883 | 4.226496 | 0.179487 | 0.08089 | 0.048534 | 0.040445 | 0.808898 | 0.808898 | 0.808898 | 0.659252 | 0.659252 | 0.584429 | 0 | 0.001439 | 0.261816 | 1,883 | 74 | 94 | 25.445946 | 0.710072 | 0.168348 | 0 | 0.818182 | 0 | 0.036364 | 0.355152 | 0.109527 | 0 | 0 | 0 | 0 | 0 | 1 | 0.036364 | false | 0 | 0 | 0 | 0.090909 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 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 | 4 |
5acc437572063d8384225f17f0a1f6917f8dafd5 | 77 | py | Python | venv/Lib/site-packages/mouseinfo/__main__.py | SteevenBrunner/gmail-generator | 0ab6f047faad48c388c6d7d2b887f33b6839b6f9 | [
"MIT"
] | 41 | 2021-06-19T13:57:18.000Z | 2021-12-02T17:08:53.000Z | venv/Lib/site-packages/mouseinfo/__main__.py | AMasetti/DuelLinks-Interface | bbbd9910da48685ec16027fd7c56810d61bafbb0 | [
"MIT"
] | 9 | 2021-08-14T01:27:36.000Z | 2021-08-24T18:10:18.000Z | venv/Lib/site-packages/mouseinfo/__main__.py | AMasetti/DuelLinks-Interface | bbbd9910da48685ec16027fd7c56810d61bafbb0 | [
"MIT"
] | 4 | 2021-07-02T03:09:51.000Z | 2021-11-25T13:00:10.000Z | import mouseinfo
if __name__ == '__main__':
mouseinfo.MouseInfoWindow()
| 15.4 | 31 | 0.74026 | 7 | 77 | 7 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.155844 | 77 | 4 | 32 | 19.25 | 0.753846 | 0 | 0 | 0 | 0 | 0 | 0.103896 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
5183b067f587858c8e53ded5ddeccea75f49bf5f | 5,202 | py | Python | src/Identity-API.py | akshitsingla/hackathon-dorahacks-2018 | 3ed7bbf0062dd12ab17b4999f1a722b7d066f1c1 | [
"Apache-2.0"
] | null | null | null | src/Identity-API.py | akshitsingla/hackathon-dorahacks-2018 | 3ed7bbf0062dd12ab17b4999f1a722b7d066f1c1 | [
"Apache-2.0"
] | 1 | 2019-12-29T10:18:21.000Z | 2019-12-29T10:18:21.000Z | src/Identity-API.py | akshitsingla/hackathon-dorahacks-2018 | 3ed7bbf0062dd12ab17b4999f1a722b7d066f1c1 | [
"Apache-2.0"
] | 2 | 2019-02-14T01:06:36.000Z | 2019-02-14T01:07:52.000Z | import sqlite3
sqlite_file = 'my_db.sqlite'
def connect(sqlite_file):
conn = sqlite3.connect(sqlite_file)
c = conn.cursor()
return conn, c
def close(conn):
conn.commit()
conn.close()
def get_max_user_id(cursor, print_out=False):
cursor.execute("SELECT MAX(BANKING_ID) FROM USER_DETAILS")
rows = cursor.fetchall()
user_id = rows[0][0]
if print_out:
print('\nData: {}'.format(rows))
return int(user_id)+1
def get_name(cursor, banking_id, print_out=False):
cursor.execute("SELECT * FROM USER_DETAILS WHERE BANKING_ID = '{}'".format(str(banking_id)))
rows = cursor.fetchall()
if print_out:
print('\nData: {}'.format(rows))
return rows
def add_name(cursor, banking_id, name, print_out=False):
successFlag = False
if get_name(cursor, banking_id, print_out=False):
successFlag = cursor.execute("UPDATE USER_DETAILS SET NAME = '{}' WHERE BANKING_ID = '{}'".format(name, banking_id))
else:
successFlag = cursor.execute("INSERT INTO USER_DETAILS (BANKING_ID, NAME) VALUES ('{}', '{}')".format(banking_id, name))
if print_out:
print('\nSuccess Flag : {}'.format(successFlag))
return successFlag
def get_address(cursor, banking_id, print_out=False):
cursor.execute("SELECT * FROM USER_DETAILS WHERE BANKING_ID = '{}'".format(str(banking_id)))
rows = cursor.fetchall()
if print_out:
print('\nData: {}'.format(rows))
return rows
def add_address(cursor, banking_id, address, print_out=False):
successFlag = False
if get_address(cursor, banking_id, print_out=False):
successFlag = cursor.execute("UPDATE USER_DETAILS SET ADDRESS = '{}' WHERE BANKING_ID = '{}'".format(address, banking_id))
else:
successFlag = cursor.execute("INSERT INTO USER_DETAILS (BANKING_ID, ADDRESS) VALUES ('{}', '{}')".format(banking_id, address))
if print_out:
print('\nSuccess Flag : {}'.format(successFlag))
return successFlag
def get_dob(cursor, banking_id, print_out=False):
cursor.execute("SELECT * FROM USER_DETAILS WHERE BANKING_ID = '{}'".format(str(banking_id)))
rows = cursor.fetchall()
if print_out:
print('\nData: {}'.format(rows))
return rows
def add_dob(cursor, banking_id, dob, print_out=False):
successFlag = False
if get_dob(cursor, banking_id, print_out=False):
successFlag = cursor.execute("UPDATE USER_DETAILS SET DOB = '{}' WHERE BANKING_ID = '{}'".format(dob, banking_id))
else:
successFlag = cursor.execute("INSERT INTO USER_DETAILS (BANKING_ID, DOB) VALUES ('{}', '{}')".format(banking_id, dob))
if print_out:
print('\nSuccess Flag : {}'.format(successFlag))
return successFlag
def get_doc_details(cursor, banking_id, print_out=False):
cursor.execute("SELECT * FROM DOCUMENTS_DETAILS WHERE BANKING_ID = '{}'".format(str(banking_id)))
rows = cursor.fetchall()
if print_out:
print('\nData: {}'.format(rows))
return rows
def add_doc_details(cursor, banking_id, id_type, id_number, print_out=False):
successFlag = False
if get_doc_details(cursor, banking_id, print_out=False):
successFlag = cursor.execute("UPDATE DOCUMENTS_DETAILS SET ID_TYPE = '{}', ID_NUMBER = '{}' WHERE BANKING_ID = '{}'".format(id_type, id_number, banking_id))
else:
successFlag = cursor.execute("INSERT INTO DOCUMENTS_DETAILS (BANKING_ID, ID_TYPE, ID_NUMBER) VALUES ('{}', '{}', '{}')".format(banking_id, id_type, id_number))
if print_out:
print('\nSuccess Flag : {}'.format(successFlag))
return successFlag
def get_user_score(cursor, banking_id, print_out=False):
cursor.execute("SELECT * FROM USER_SCORE WHERE BANKING_ID = {}".format(str(banking_id)))
rows = cursor.fetchall()
if print_out:
print('\nData: {}'.format(rows))
return rows
def insert_user_score(cursor, banking_id, score, print_out=False):
successFlag = False
if get_user_score(cursor, banking_id, print_out=False):
successFlag = cursor.execute("UPDATE USER_SCORE SET SCORE = '{}' WHERE BANKING_ID = '{}'".format(score, banking_id))
else:
successFlag = cursor.execute("INSERT INTO USER_SCORE (BANKING_ID, SCORE) VALUES ('{}', '{}')".format(banking_id, score))
if print_out:
print('\nSuccess Flag : {}'.format(successFlag))
return successFlag
def validate_user_name(cursor, banking_id, name, print_out=False):
cursor.execute("SELECT * FROM USER_DETAILS WHERE BANKING_ID = '{}' AND NAME = '{}'".format(banking_id, name))
rows = cursor.fetchall()
if rows:
return True
else:
return False
def validate_address(cursor, banking_id, address, print_out=False):
cursor.execute("SELECT * FROM USER_DETAILS WHERE BANKING_ID = '{}' AND ADDRESS = '{}'".format(banking_id, address))
rows = cursor.fetchall()
if rows:
return True
else:
return False
def validate_dob(cursor, banking_id, dob, print_out=False):
cursor.execute("SELECT * FROM USER_DETAILS WHERE BANKING_ID = '{}' AND DOB = '{}'".format(banking_id, dob))
rows = cursor.fetchall()
if rows:
return True
else:
return False | 40.015385 | 167 | 0.673972 | 674 | 5,202 | 4.982196 | 0.08457 | 0.147409 | 0.073556 | 0.049136 | 0.802859 | 0.782013 | 0.751936 | 0.717391 | 0.62567 | 0.597379 | 0 | 0.001184 | 0.188005 | 5,202 | 130 | 168 | 40.015385 | 0.793797 | 0 | 0 | 0.589286 | 0 | 0 | 0.253892 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.008929 | 0 | 0.3125 | 0.366071 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
51bee7cf554f86ae3460ee4e30dfa08ff549188c | 58 | py | Python | opentech/apply/utils/testing/__init__.py | JakabGy/hypha | 32634080ba1cb369f07f27f6616041e4eca8dbf2 | [
"BSD-3-Clause"
] | null | null | null | opentech/apply/utils/testing/__init__.py | JakabGy/hypha | 32634080ba1cb369f07f27f6616041e4eca8dbf2 | [
"BSD-3-Clause"
] | null | null | null | opentech/apply/utils/testing/__init__.py | JakabGy/hypha | 32634080ba1cb369f07f27f6616041e4eca8dbf2 | [
"BSD-3-Clause"
] | null | null | null | from .tests import make_request, BaseViewTestCase # NOQA
| 29 | 57 | 0.810345 | 7 | 58 | 6.571429 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137931 | 58 | 1 | 58 | 58 | 0.92 | 0.068966 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
51d567ed5fcc69121400c2a347583b1bbbc61afd | 208 | py | Python | 10-dars.py | thejorabek/python | 62ac888dedd6fcb485f2f3a074a127b2b0c45d31 | [
"Apache-2.0"
] | 1 | 2022-03-24T06:04:54.000Z | 2022-03-24T06:04:54.000Z | 10-dars.py | thejorabek/python | 62ac888dedd6fcb485f2f3a074a127b2b0c45d31 | [
"Apache-2.0"
] | null | null | null | 10-dars.py | thejorabek/python | 62ac888dedd6fcb485f2f3a074a127b2b0c45d31 | [
"Apache-2.0"
] | null | null | null | #%% Module
import library as l
#%% Module colorama
import colorama as rang
print(rang.Style.BRIGHT)
print("Abdulla")
print(rang.Fore.YELLOW)
print(rang.Back.RED)
# print(rang.Style.RESET_ALL)
print("SALOM") | 18.909091 | 29 | 0.75 | 32 | 208 | 4.84375 | 0.5625 | 0.232258 | 0.180645 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.100962 | 208 | 11 | 30 | 18.909091 | 0.828877 | 0.264423 | 0 | 0 | 0 | 0 | 0.07947 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.285714 | 0 | 0.285714 | 0.714286 | 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 | 1 | 0 | 4 |
a40ccff6d5dcd5d3bc2e68d71d90a8003e996948 | 153 | py | Python | skcuda/cuda.py | hsnyder/scikit-cuda | ab2708a1d514373d6760fa6e74ac7545b4ff8ec0 | [
"BSD-3-Clause"
] | 1 | 2021-08-14T08:12:57.000Z | 2021-08-14T08:12:57.000Z | skcuda/cuda.py | hsnyder/scikit-cuda | ab2708a1d514373d6760fa6e74ac7545b4ff8ec0 | [
"BSD-3-Clause"
] | 1 | 2019-03-02T03:03:18.000Z | 2019-03-02T03:03:18.000Z | skcuda/cuda.py | hsnyder/scikit-cuda | ab2708a1d514373d6760fa6e74ac7545b4ff8ec0 | [
"BSD-3-Clause"
] | 1 | 2021-12-26T21:31:39.000Z | 2021-12-26T21:31:39.000Z | #!/usr/bin/env python
"""
Python interface to CUDA functions.
"""
from __future__ import absolute_import
from .cudart import *
from .cudadrv import *
| 13.909091 | 38 | 0.738562 | 20 | 153 | 5.4 | 0.7 | 0.185185 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.156863 | 153 | 10 | 39 | 15.3 | 0.837209 | 0.366013 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
cfee6c008b467f7ece1743ea6c8031721c2a97c2 | 72 | py | Python | config.py | ik8/ap_clustering | 2d5ebeba0662404769f79d612c824d0765560151 | [
"Apache-2.0"
] | null | null | null | config.py | ik8/ap_clustering | 2d5ebeba0662404769f79d612c824d0765560151 | [
"Apache-2.0"
] | null | null | null | config.py | ik8/ap_clustering | 2d5ebeba0662404769f79d612c824d0765560151 | [
"Apache-2.0"
] | null | null | null | import os
MODEL_LOCATION = f"{os.path.realpath('.')}/base_model.model"
| 18 | 60 | 0.722222 | 11 | 72 | 4.545455 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 72 | 3 | 61 | 24 | 0.757576 | 0 | 0 | 0 | 0 | 0 | 0.555556 | 0.555556 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
321c0965fe3e2de31d326be6a2d057c4f95d0c34 | 146 | py | Python | config.py | cptanalatriste/team-balloon-msr | 24b76d022955d3e353cf36d2d4ddcc7242aa588b | [
"MIT"
] | 1 | 2022-03-18T02:34:14.000Z | 2022-03-18T02:34:14.000Z | config.py | cptanalatriste/code-review-reciprocity | 24b76d022955d3e353cf36d2d4ddcc7242aa588b | [
"MIT"
] | null | null | null | config.py | cptanalatriste/code-review-reciprocity | 24b76d022955d3e353cf36d2d4ddcc7242aa588b | [
"MIT"
] | null | null | null | GITHUB_API_TOKEN: list[str] = [""]
ELASTICSEARCH_HOST: str = "http://localhost:9200/"
TEXT_DIRECTORY: str = "txt/"
IMAGE_DIRECTORY: str = "img/"
| 24.333333 | 50 | 0.69863 | 19 | 146 | 5.105263 | 0.789474 | 0.247423 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.031008 | 0.116438 | 146 | 5 | 51 | 29.2 | 0.72093 | 0 | 0 | 0 | 0 | 0 | 0.205479 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
5c659ddf195d1de4143cc12a412e565babd935c1 | 6,470 | py | Python | data/pretestdata/03_parking_lot/component.py | wilsonsuen/av-testing | a6967b4cb4e4ad6b10d041ffd3dc62188fccad81 | [
"MIT"
] | null | null | null | data/pretestdata/03_parking_lot/component.py | wilsonsuen/av-testing | a6967b4cb4e4ad6b10d041ffd3dc62188fccad81 | [
"MIT"
] | null | null | null | data/pretestdata/03_parking_lot/component.py | wilsonsuen/av-testing | a6967b4cb4e4ad6b10d041ffd3dc62188fccad81 | [
"MIT"
] | null | null | null | # Data prepared using svl simulator visual editor feature.
testcasename = "Exiting Parking Lot encountering i_npc_type at c_time in c_weather day"
testcaseid = "AV-3."
components = {
"c_weather": {
"Sunny": {"rain": 0.0, "fog": 0, "wetness": 0, "cloudiness": 0, "damage": 0},
"Rainning": {"rain": 0.8, "fog": 0, "wetness": 0, "cloudiness": 0, "damage": 0},
"Foggy": {"rain": 0.0, "fog": 0.8, "wetness": 0, "cloudiness": 0, "damage": 0},
"Cloudy": {"rain": 0.0, "fog": 0, "wetness": 0, "cloudiness": 0.8, "damage": 0}
},
"c_time": {
"8:00AM": 8,
"12:00PM": 12,
"5:00PM": 17
},
"i_npc_type": {
"Jeep": "Jeep",
"SUV": "SUV",
"Sedan": "Sedan",
"Hatchback": "Hatchback",
"SchoolBus": "SchoolBus",
"BoxTruck": "BoxTruck"
},
"o_at_destination": {
"True": True,
"False": False
}
}
jsontemplate = """{
"version": "0.01",
"testcase": {
"name": "testcasename",
"id": "testcaseid",
"context": "contextinfo",
"input": "inputinfo"
},
"vseMetadata": {
"cameraSettings": {
"position": {
"x": -74.5729293823242,
"y": 60,
"z": -57.5616722106934
},
"rotation": {
"x": 90,
"y": 230.40007019043,
"z": 0
}
}
},
"map": {
"id": "2aae5d39-a11c-4516-87c4-cdc9ca784551",
"name": "AutonomouStuff",
"parameterType": "map"
},
"agents": [
{
"id": "73805704-1e46-4eb6-b5f9-ec2244d5951e",
"uid": "4a998b0d-15ff-4559-8f7b-1ef34104f963",
"variant": "Lincoln2017MKZ_LGSVL",
"modules": ["Localization","Transform","Routing","Prediction","Planning","Control"],
"type": 1,
"parameterType": "vehicle",
"transform": {
"position": {
"x": 39.9554328918457,
"y": -2.42564034461975,
"z": -70.8712387084961
},
"rotation": {
"x": 0.547064065933228,
"y": 213.232345581055,
"z": -1.33408208924379E-08
}
},
"sensorsConfigurationId": "2e9095fa-c9b9-4f3f-8d7d-65fa2bb03921",
"destinationPoint": {
"position": {
"x": 0.638561248779297,
"y": -2.7070779800415,
"z": -88.3734893798828
},
"rotation": {
"x": 359.357482910156,
"y": 257.065246582031,
"z": 0
}
}
},
{
"uid": "484ca5f3-39f9-47c8-a442-804959e6aed6",
"variant": "i_npc_type",
"type": 2,
"parameterType": "",
"transform": {
"position": {
"x": 5.89918518066406,
"y": -2.9221408367157,
"z": -112.112930297852
},
"rotation": {
"x": 359.092681884766,
"y": 320.543518066406,
"z": 0
}
},
"behaviour": {
"name": "NPCWaypointBehaviour",
"parameters": {
"isLaneChange": false,
"maxSpeed": 0
}
},
"color": {
"r": 1,
"g": 0.442666590213776,
"b": 0.251999914646149
},
"waypoints": [
{
"ordinalNumber": 0,
"position": {
"x": 0.383377075195313,
"y": -2.86623859405518,
"z": -102.718910217285
},
"angle": {
"x": 359.516052246094,
"y": 347.360076904297,
"z": 6.6703442769267E-09
},
"waitTime": 0,
"speed": 6,
"trigger": {
"effectors": []
}
},
{
"ordinalNumber": 1,
"position": {
"x": -1.84525108337402,
"y": -2.7802140712738,
"z": -92.781120300293
},
"angle": {
"x": 0.134375885128975,
"y": 76.0216293334961,
"z": 0
},
"waitTime": 0,
"speed": 6,
"trigger": {
"effectors": []
}
},
{
"ordinalNumber": 2,
"position": {
"x": 24.6181907653809,
"y": -2.84417295455933,
"z": -86.1936569213867
},
"angle": {
"x": 359.57373046875,
"y": 62.0760536193848,
"z": 2.66811639448861E-08
},
"waitTime": 0,
"speed": 6,
"trigger": {
"effectors": []
}
},
{
"ordinalNumber": 3,
"position": {
"x": 43.3689422607422,
"y": -2.60511302947998,
"z": -73.3020324707031
},
"angle": {
"x": 359.398071289063,
"y": 55.490478515625,
"z": -2.66818993566176E-08
},
"waitTime": 0,
"speed": 6,
"trigger": {
"effectors": []
}
}
]
}
],
"controllables": [],
"time": "c_time",
"weather": "c_weather",
"simulation_time": 20,
"output": { "at_destination": "o_at_destination" }
}"""
| 31.560976 | 96 | 0.34034 | 411 | 6,470 | 5.311436 | 0.49635 | 0.032982 | 0.032982 | 0.034814 | 0.136509 | 0.131929 | 0.120018 | 0.043518 | 0.026569 | 0 | 0 | 0.271736 | 0.518238 | 6,470 | 204 | 97 | 31.715686 | 0.428617 | 0.008655 | 0 | 0.190955 | 0 | 0 | 0.917498 | 0.05942 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
5ca3c9ba614a8e82151e234da8550265aebbeba9 | 91 | py | Python | jsonsam/__init__.py | project705/jsonsam | bfa78be67ef916052bf468c2cee87d89ccefeb2a | [
"MIT"
] | 1 | 2021-09-08T19:14:54.000Z | 2021-09-08T19:14:54.000Z | jsonsam/__init__.py | project705/jsonsam | bfa78be67ef916052bf468c2cee87d89ccefeb2a | [
"MIT"
] | 1 | 2021-09-08T21:43:18.000Z | 2021-09-08T21:43:18.000Z | jsonsam/__init__.py | project705/jsonsam | bfa78be67ef916052bf468c2cee87d89ccefeb2a | [
"MIT"
] | null | null | null | __version__ = '0.1.0'
from .randdict import DictGen
from .jsonsam import DictSam, JsonSam
| 18.2 | 37 | 0.769231 | 13 | 91 | 5.076923 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.038462 | 0.142857 | 91 | 4 | 38 | 22.75 | 0.807692 | 0 | 0 | 0 | 0 | 0 | 0.054945 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
5cae59ebe61e89940a910a773903a498f66d4590 | 145 | py | Python | appview/templatetags/keys.py | regisf/yablog | e80c2324bc15cbd76734f9bd417e174a488a0710 | [
"BSD-3-Clause"
] | 1 | 2018-06-07T23:10:54.000Z | 2018-06-07T23:10:54.000Z | appview/templatetags/keys.py | regisf/yablog | e80c2324bc15cbd76734f9bd417e174a488a0710 | [
"BSD-3-Clause"
] | null | null | null | appview/templatetags/keys.py | regisf/yablog | e80c2324bc15cbd76734f9bd417e174a488a0710 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: UTF-8 -*-
from django import template
register = template.Library()
@register.filter
def keys(value, arg):
return value[arg] | 16.111111 | 29 | 0.689655 | 19 | 145 | 5.263158 | 0.789474 | 0.16 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008264 | 0.165517 | 145 | 9 | 30 | 16.111111 | 0.818182 | 0.144828 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0.2 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 4 |
5cc598e029789d76155586d1ba6e18405eef8981 | 51 | py | Python | pointcloudset/io/pointcloud/__init__.py | hugoledoux/pointcloudset | 075ddc3f840cc6c2e2505452c1eb9f2e4fce5e99 | [
"MIT"
] | 23 | 2021-06-14T10:11:27.000Z | 2022-03-07T13:44:36.000Z | pointcloudset/io/pointcloud/__init__.py | hugoledoux/pointcloudset | 075ddc3f840cc6c2e2505452c1eb9f2e4fce5e99 | [
"MIT"
] | 23 | 2021-06-14T05:45:23.000Z | 2022-03-31T08:24:04.000Z | pointcloudset/io/pointcloud/__init__.py | hugoledoux/pointcloudset | 075ddc3f840cc6c2e2505452c1eb9f2e4fce5e99 | [
"MIT"
] | 3 | 2021-07-07T06:58:34.000Z | 2021-09-28T11:52:07.000Z | """
Functions for pointcloud input and output.
"""
| 12.75 | 42 | 0.705882 | 6 | 51 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.156863 | 51 | 3 | 43 | 17 | 0.837209 | 0.823529 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
5cde1f15a5afa2d97baa894f2d90f64076b20e59 | 203 | py | Python | tests/test_api_v1_system_api_error.py | pincher95/pfsense-api | 001a4b8a1ec39138668d6d92b3c9d0c89a7f1b45 | [
"Apache-2.0"
] | null | null | null | tests/test_api_v1_system_api_error.py | pincher95/pfsense-api | 001a4b8a1ec39138668d6d92b3c9d0c89a7f1b45 | [
"Apache-2.0"
] | null | null | null | tests/test_api_v1_system_api_error.py | pincher95/pfsense-api | 001a4b8a1ec39138668d6d92b3c9d0c89a7f1b45 | [
"Apache-2.0"
] | null | null | null | import e2e_test_framework
class APIE2ETestSystemAPIError(e2e_test_framework.APIE2ETest):
uri = "/api/v1/system/api/error"
get_tests = [{"name": "Read API errors"}]
APIE2ETestSystemAPIError()
| 20.3 | 62 | 0.753695 | 23 | 203 | 6.434783 | 0.73913 | 0.094595 | 0.216216 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033898 | 0.128079 | 203 | 9 | 63 | 22.555556 | 0.80226 | 0 | 0 | 0 | 0 | 0 | 0.211823 | 0.118227 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
7a201c87c0515b5031f0fc5fd0ad930803cbfedc | 67 | py | Python | pytest_flask/__init__.py | Roguelazer/pytest-flask | cfc804776f24c7230627b15bd935e5da5f809db7 | [
"MIT"
] | 392 | 2016-09-23T21:33:02.000Z | 2022-03-15T02:00:26.000Z | pytest_flask/__init__.py | Roguelazer/pytest-flask | cfc804776f24c7230627b15bd935e5da5f809db7 | [
"MIT"
] | 86 | 2016-09-14T12:04:05.000Z | 2022-03-01T16:01:31.000Z | pytest_flask/__init__.py | Roguelazer/pytest-flask | cfc804776f24c7230627b15bd935e5da5f809db7 | [
"MIT"
] | 76 | 2016-11-05T11:31:55.000Z | 2022-03-25T19:15:20.000Z | #!/usr/bin/env python
from ._version import version as __version__
| 22.333333 | 44 | 0.791045 | 10 | 67 | 4.8 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.119403 | 67 | 2 | 45 | 33.5 | 0.813559 | 0.298507 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
7a309190f32e5b8543148e0ca45aff47bb3af6a9 | 95 | py | Python | orderadmin/apps.py | jackyicu/django-orderadmin | a634c9f447fb8e352077317d9d3f43e40488e47b | [
"BSD-3-Clause"
] | null | null | null | orderadmin/apps.py | jackyicu/django-orderadmin | a634c9f447fb8e352077317d9d3f43e40488e47b | [
"BSD-3-Clause"
] | null | null | null | orderadmin/apps.py | jackyicu/django-orderadmin | a634c9f447fb8e352077317d9d3f43e40488e47b | [
"BSD-3-Clause"
] | null | null | null | from django.apps import AppConfig
class OrderadminConfig(AppConfig):
name = 'orderadmin'
| 15.833333 | 34 | 0.768421 | 10 | 95 | 7.3 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.157895 | 95 | 5 | 35 | 19 | 0.9125 | 0 | 0 | 0 | 0 | 0 | 0.105263 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
7a48fd12ab23b61e122624e87f3df1e07ffbb440 | 1,819 | py | Python | src/compas_blender/geometry/surface.py | yijiangh/compas | a9e86edf6b602f47ca051fccedcaa88a5e5d3600 | [
"MIT"
] | 1 | 2019-03-27T22:46:29.000Z | 2019-03-27T22:46:29.000Z | src/compas_blender/geometry/surface.py | yijiangh/compas | a9e86edf6b602f47ca051fccedcaa88a5e5d3600 | [
"MIT"
] | null | null | null | src/compas_blender/geometry/surface.py | yijiangh/compas | a9e86edf6b602f47ca051fccedcaa88a5e5d3600 | [
"MIT"
] | 1 | 2022-01-16T02:32:43.000Z | 2022-01-16T02:32:43.000Z |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas_blender.geometry import BlenderGeometry
__all__ = [
'BlenderSurface',
]
class BlenderSurface(BlenderGeometry):
def __init__(self, guid):
super(BlenderSurface, self).__init__()
@classmethod
def from_selection(cls):
raise NotImplementedError
def space(self, density=10):
raise NotImplementedError
def heightfield(self, density=10, over_space=True):
raise NotImplementedError
def descent(self, points=None):
raise NotImplementedError
def curvature(self, points=None):
raise NotImplementedError
def borders(self, type=1):
raise NotImplementedError
def project_point(self, point, direction=(0, 0, 1)):
raise NotImplementedError
def project_points(self, points, direction=(0, 0, 1), include_none=True):
raise NotImplementedError
def closest_point(self, point, maxdist=None):
raise NotImplementedError
def closest_points(self, points, maxdist=None):
raise NotImplementedError
def pull_point(self, point):
raise NotImplementedError
def pull_points(self, points):
raise NotImplementedError
def pull_curve(self, curve):
raise NotImplementedError
def pull_curves(self, curves):
raise NotImplementedError
def pull_mesh(self, mesh, fixed=None, d=1.0):
raise NotImplementedError
def pull_meshes(self, meshes):
raise NotImplementedError
# ==============================================================================
# Main
# ==============================================================================
if __name__ == '__main__':
pass
| 16.842593 | 80 | 0.623969 | 173 | 1,819 | 6.283237 | 0.317919 | 0.353266 | 0.372585 | 0.171113 | 0.209752 | 0.075437 | 0 | 0 | 0 | 0 | 0 | 0.0092 | 0.2232 | 1,819 | 107 | 81 | 17 | 0.760085 | 0.08906 | 0 | 0.355556 | 0 | 0 | 0.013317 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.377778 | false | 0.022222 | 0.088889 | 0 | 0.488889 | 0.022222 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
7a590c0551df3c146ec6f1c064c41e6ee52b6c57 | 57 | py | Python | asgard/workers/autoscaler/__main__.py | rockerbacon/asgard-api | 1c1eb19225ace4bbecb06b65b1b9c4ab131eb24a | [
"MIT"
] | 3 | 2020-01-10T02:16:09.000Z | 2020-02-19T18:42:37.000Z | asgard/workers/autoscaler/__main__.py | b2wdigital/asgard-api | 5444d81be33bf4af3c9cf5a2185c16ff10357034 | [
"MIT"
] | 13 | 2020-01-15T18:22:35.000Z | 2021-03-31T19:21:54.000Z | asgard/workers/autoscaler/__main__.py | rockerbacon/asgard-api | 1c1eb19225ace4bbecb06b65b1b9c4ab131eb24a | [
"MIT"
] | 6 | 2020-03-07T09:49:19.000Z | 2021-07-25T03:14:10.000Z | from asgard.workers.autoscaler.app import app
app.run()
| 14.25 | 45 | 0.789474 | 9 | 57 | 5 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.105263 | 57 | 3 | 46 | 19 | 0.882353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
7a797f4c2f18e1a8e705478bc0b2a49dc8833a35 | 174 | py | Python | newsApp/publisher.py | adityabansal/newsAroundMe | 06d30c8a281baae90f916aa0b0bfe3b4db9d2293 | [
"MIT"
] | 9 | 2017-06-22T18:42:54.000Z | 2021-03-28T18:58:44.000Z | newsApp/publisher.py | adityabansal/newsAroundMe | 06d30c8a281baae90f916aa0b0bfe3b4db9d2293 | [
"MIT"
] | 8 | 2016-10-08T12:50:50.000Z | 2022-03-11T23:13:17.000Z | newsApp/publisher.py | adityabansal/newsAroundMe | 06d30c8a281baae90f916aa0b0bfe3b4db9d2293 | [
"MIT"
] | 3 | 2018-01-18T11:01:32.000Z | 2018-11-20T08:33:30.000Z | from .dbItem import DbItem
class Publisher(DbItem):
"""
Represents a news publisher.
Each publisher consists of a unique id and a set of tags(key-value pairs).
"""
| 19.333333 | 76 | 0.712644 | 26 | 174 | 4.769231 | 0.730769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.201149 | 174 | 8 | 77 | 21.75 | 0.892086 | 0.597701 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
7ab83d70bdd160e67a6cd20b7e0450f9e2b1e45a | 9,871 | py | Python | test/test_util.py | gyosh/leekcode | c6483a2fd62307bf5ff3fbfae1960c839f2374a1 | [
"MIT"
] | null | null | null | test/test_util.py | gyosh/leekcode | c6483a2fd62307bf5ff3fbfae1960c839f2374a1 | [
"MIT"
] | 1 | 2020-05-28T03:39:33.000Z | 2020-05-30T17:30:37.000Z | test/test_util.py | gyosh/leekcode | c6483a2fd62307bf5ff3fbfae1960c839f2374a1 | [
"MIT"
] | null | null | null | import unittest
from lib.util import extract_variables
from lib.vtype import VType
class TestUtil(unittest.TestCase):
def assertFloatList(self, expected, got):
self.assertEqual(len(expected), len(got))
for i in range(len(expected)):
self.assertEqual(expected[i][0], got[i][0])
self.assertEqual(expected[i][1], got[i][1])
self.assertAlmostEqual(expected[i][2], got[i][2])
def test_extract_variables_single(self):
self.assertEqual([('a', VType(VType.INTEGER), 12)], extract_variables('a = 12'))
self.assertEqual([('numPerson', VType(VType.INTEGER), 999)], extract_variables('numPerson = 999'))
self.assertEqual([('numPerson', VType(VType.INTEGER), 0)], extract_variables('numPerson = 0'))
self.assertEqual([('numPerson', VType(VType.INTEGER), -5)], extract_variables('numPerson = -5'))
self.assertEqual([('numPerson', VType(VType.INTEGER), -51)], extract_variables('numPerson = -51'))
self.assertAlmostEqual([('prob', VType(VType.FLOAT), 0.51)], extract_variables('prob = 0.51'))
self.assertAlmostEqual([('prob', VType(VType.FLOAT), 0.51)], extract_variables('prob = .51'))
self.assertAlmostEqual([('prob', VType(VType.FLOAT), 0.0051)], extract_variables('prob = .0051'))
self.assertAlmostEqual([('prob', VType(VType.FLOAT), 1.51)], extract_variables('prob = 1.51'))
self.assertAlmostEqual([('prob', VType(VType.FLOAT), 10.51)], extract_variables('prob = 10.51'))
self.assertAlmostEqual([('prob', VType(VType.FLOAT), 10.0051)], extract_variables('prob = 10.0051'))
self.assertAlmostEqual([('prob', VType(VType.FLOAT), 10.)], extract_variables('prob = 10.'))
self.assertAlmostEqual([('prob', VType(VType.FLOAT), -0.51)], extract_variables('prob = -0.51'))
self.assertAlmostEqual([('prob', VType(VType.FLOAT), -0.51)], extract_variables('prob = -.51'))
self.assertAlmostEqual([('prob', VType(VType.FLOAT), -0.0051)], extract_variables('prob = -.0051'))
self.assertAlmostEqual([('prob', VType(VType.FLOAT), -1.51)], extract_variables('prob = -1.51'))
self.assertAlmostEqual([('prob', VType(VType.FLOAT), -10.51)], extract_variables('prob = -10.51'))
self.assertAlmostEqual([('prob', VType(VType.FLOAT), -10.0051)], extract_variables('prob = -10.0051'))
self.assertAlmostEqual([('prob', VType(VType.FLOAT), -10.)], extract_variables('prob = -10.'))
self.assertEqual([('b', VType(VType.BOOLEAN), True)], extract_variables('b = true'))
self.assertEqual([('b', VType(VType.BOOLEAN), False)], extract_variables('b = false'))
self.assertEqual([('s', VType(VType.STRING), "BORK")], extract_variables('s = "BORK"'))
self.assertEqual([('s', VType(VType.STRING), "Doge Drill")], extract_variables('s = "Doge Drill"'))
self.assertEqual([('slang', VType(VType.STRING), "doggo")], extract_variables('slang = "doggo"'))
self.assertEqual([('slang', VType(VType.STRING), "")], extract_variables('slang = ""'))
self.assertEqual([('error', VType(VType.STRING), "null")], extract_variables('error = "null"'))
self.assertEqual([('x', VType(VType.NULL), None)], extract_variables('x = null'))
self.assertEqual([('ages', VType(VType.LIST, VType(VType.INTEGER)), [21, 22])], extract_variables('ages = [21,22]'))
self.assertEqual([('ages', VType(VType.LIST, VType(VType.INTEGER)), [21, 22])], extract_variables('ages = [21, 22]'))
self.assertEqual([('ages', VType(VType.LIST, VType(VType.INTEGER)), [21, 22])], extract_variables('ages = [21 ,22]'))
self.assertEqual([('ages', VType(VType.LIST, VType(VType.INTEGER)), [21, 22])], extract_variables('ages = [21 , 22]'))
self.assertEqual([('ages', VType(VType.LIST, VType(VType.INTEGER)), [8])], extract_variables('ages = [8]'))
self.assertEqual([('pos', VType(VType.LIST, VType(VType.INTEGER)), [-54, 0, 11])], extract_variables('pos = [-54,0,11]'))
self.assertEqual([('pos', VType(VType.LIST, VType(VType.INTEGER)), [-54, 0, 11])], extract_variables('pos = [-54, 0, 11]'))
self.assertEqual([('pos', VType(VType.LIST, VType(VType.INTEGER)), [-54, 0, 11])], extract_variables('pos = [-54,\n0,\n11]'))
self.assertFloatList([('dist', VType(VType.LIST, VType(VType.FLOAT)), [1, 0, 0.5])], extract_variables('dist = [1,0,0.5]'))
self.assertFloatList([('dist', VType(VType.LIST, VType(VType.FLOAT)), [-1, 0.242])], extract_variables('dist = [-1.,0.242]'))
# Special case for unknown type
self.assertEqual([('ages', VType(VType.LIST, VType(VType.NULL)), [])], extract_variables('ages = []'))
self.assertEqual([('holey', VType(VType.LIST, VType(VType.INTEGER)), [-54, 0, None, 11])], extract_variables('holey = [-54,0,null,11]'))
self.assertEqual([('troll', VType(VType.LIST, VType(VType.STRING)), ['Zuljin', 'Senjin', None])], extract_variables('troll = ["Zuljin","Senjin",null]'))
def test_extract_variables_multi(self):
self.assertEqual([
('a', VType(VType.INTEGER), 10),
('b', VType(VType.INTEGER), -99)
], extract_variables('a = 10, b = -99'))
self.assertEqual([
('name', VType(VType.STRING), 'Kratos'),
('age', VType(VType.INTEGER), 9991)
], extract_variables('name = "Kratos", age = 9991'))
self.assertEqual([
('name', VType(VType.STRING), 'Kratos'),
('age', VType(VType.INTEGER), 9991),
('hasChild', VType(VType.BOOLEAN), True)
], extract_variables('name = "Kratos", age = 9991, hasChild = true'))
self.assertEqual([
('name', VType(VType.STRING), 'Kratos'),
('age', VType(VType.INTEGER), 9991),
('hasChild', VType(VType.BOOLEAN), True),
('blades', VType(VType.LIST, VType(VType.STRING)), ['chaos', 'athena', 'exile', None]),
('health', VType(VType.FLOAT), 0.981)
], extract_variables('name = "Kratos", age = 9991, hasChild = true, blades = ["chaos","athena","exile",null], health = 0.981'))
def test_extract_variables_value_only(self):
self.assertEqual([(None, VType(VType.INTEGER), 12)], extract_variables('12', value_only=True))
self.assertEqual([(None, VType(VType.INTEGER), 999)], extract_variables('999', value_only=True))
self.assertEqual([(None, VType(VType.INTEGER), 0)], extract_variables('0', value_only=True))
self.assertEqual([(None, VType(VType.INTEGER), -5)], extract_variables('-5', value_only=True))
self.assertEqual([(None, VType(VType.INTEGER), -51)], extract_variables('-51', value_only=True))
self.assertAlmostEqual([(None, VType(VType.FLOAT), 0.51)], extract_variables('0.51', value_only=True))
self.assertAlmostEqual([(None, VType(VType.FLOAT), 0.51)], extract_variables('.51', value_only=True))
self.assertAlmostEqual([(None, VType(VType.FLOAT), 0.0051)], extract_variables('.0051', value_only=True))
self.assertAlmostEqual([(None, VType(VType.FLOAT), 1.51)], extract_variables('1.51', value_only=True))
self.assertAlmostEqual([(None, VType(VType.FLOAT), 10.51)], extract_variables('10.51', value_only=True))
self.assertAlmostEqual([(None, VType(VType.FLOAT), 10.0051)], extract_variables('10.0051', value_only=True))
self.assertAlmostEqual([(None, VType(VType.FLOAT), 10.)], extract_variables('10.', value_only=True))
self.assertAlmostEqual([(None, VType(VType.FLOAT), -0.51)], extract_variables('-0.51', value_only=True))
self.assertAlmostEqual([(None, VType(VType.FLOAT), -0.51)], extract_variables('-.51', value_only=True))
self.assertAlmostEqual([(None, VType(VType.FLOAT), -0.0051)], extract_variables('-.0051', value_only=True))
self.assertAlmostEqual([(None, VType(VType.FLOAT), -1.51)], extract_variables('-1.51', value_only=True))
self.assertAlmostEqual([(None, VType(VType.FLOAT), -10.51)], extract_variables('-10.51', value_only=True))
self.assertAlmostEqual([(None, VType(VType.FLOAT), -10.0051)], extract_variables('-10.0051', value_only=True))
self.assertAlmostEqual([(None, VType(VType.FLOAT), -10.)], extract_variables('-10.', value_only=True))
self.assertEqual([(None, VType(VType.BOOLEAN), True)], extract_variables('true', value_only=True))
self.assertEqual([(None, VType(VType.BOOLEAN), False)], extract_variables('false', value_only=True))
self.assertEqual([(None, VType(VType.STRING), "BORK")], extract_variables('"BORK"', value_only=True))
self.assertEqual([(None, VType(VType.STRING), "Doge Drill")], extract_variables('"Doge Drill"', value_only=True))
self.assertEqual([(None, VType(VType.STRING), "doggo")], extract_variables('"doggo"', value_only=True))
self.assertEqual([(None, VType(VType.STRING), "")], extract_variables('""', value_only=True))
self.assertEqual([(None, VType(VType.LIST, VType(VType.INTEGER)), [21, 22])], extract_variables('[21,22]', value_only=True))
self.assertEqual([(None, VType(VType.LIST, VType(VType.INTEGER)), [8])], extract_variables('[8]', value_only=True))
self.assertEqual([(None, VType(VType.LIST, VType(VType.INTEGER)), [-54, 0, 11])], extract_variables('[-54,0,11]', value_only=True))
# Special case for unknown type
self.assertEqual([(None, VType(VType.LIST, VType(VType.NULL)), [])], extract_variables('[]', value_only=True))
self.assertEqual([(None, VType(VType.LIST, VType(VType.INTEGER)), [-54, 0, None, 11])], extract_variables('[-54,0,null,11]', value_only=True))
self.assertEqual([(None, VType(VType.LIST, VType(VType.STRING)), ['Zuljin', 'Senjin', None])], extract_variables('["Zuljin","Senjin",null]', value_only=True))
if __name__ == '__main__':
unittest.main()
| 72.051095 | 166 | 0.642184 | 1,195 | 9,871 | 5.2 | 0.076151 | 0.165755 | 0.074831 | 0.079337 | 0.851786 | 0.841165 | 0.717412 | 0.686836 | 0.654651 | 0.573705 | 0 | 0.04813 | 0.14963 | 9,871 | 136 | 167 | 72.580882 | 0.692161 | 0.005977 | 0 | 0.141509 | 0 | 0.009434 | 0.125395 | 0.008156 | 0 | 0 | 0 | 0 | 0.754717 | 1 | 0.037736 | false | 0 | 0.028302 | 0 | 0.075472 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
8f944fafc5875825861fbd918a4eef39a54dc48f | 367 | py | Python | tests/util/test_settings_dir.py | ion1/swtor-settings-updater | 7ac368507872bb253470b78a42a8f675c6678051 | [
"MIT"
] | null | null | null | tests/util/test_settings_dir.py | ion1/swtor-settings-updater | 7ac368507872bb253470b78a42a8f675c6678051 | [
"MIT"
] | null | null | null | tests/util/test_settings_dir.py | ion1/swtor-settings-updater | 7ac368507872bb253470b78a42a8f675c6678051 | [
"MIT"
] | null | null | null | from pathlib import Path
from typing import Any
from swtor_settings_updater.util.settings_dir import default_settings_dir
# TODO: pytest defines MonkeyPatch internally but does not seem to export it.
def test_default_settings_dir(monkeypatch: Any) -> None:
monkeypatch.setenv("LOCALAPPDATA", "foobar")
assert default_settings_dir() == Path("foobar/SWTOR")
| 33.363636 | 77 | 0.79564 | 50 | 367 | 5.64 | 0.62 | 0.156028 | 0.191489 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128065 | 367 | 10 | 78 | 36.7 | 0.88125 | 0.20436 | 0 | 0 | 0 | 0 | 0.103448 | 0 | 0 | 0 | 0 | 0.1 | 0.166667 | 1 | 0.166667 | false | 0 | 0.5 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
8f9e8dfee1412bdb8d75db1ffa146684f3c7300e | 314 | py | Python | devices/SIP04_FZJ/02_Test/test_sip04_02.py | geophysics-ubonn/reda_testing | c32f3faa685b77974b88ba1126a02afabfe5fd2d | [
"MIT"
] | null | null | null | devices/SIP04_FZJ/02_Test/test_sip04_02.py | geophysics-ubonn/reda_testing | c32f3faa685b77974b88ba1126a02afabfe5fd2d | [
"MIT"
] | null | null | null | devices/SIP04_FZJ/02_Test/test_sip04_02.py | geophysics-ubonn/reda_testing | c32f3faa685b77974b88ba1126a02afabfe5fd2d | [
"MIT"
] | 1 | 2019-06-25T09:39:40.000Z | 2019-06-25T09:39:40.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import reda
basepath = os.path.dirname(__file__) + os.sep
def test_load_mat():
sip = reda.SIP()
sip.import_sip04(basepath + 'Data/sip_dataA.mat')
def test_load_csv():
sip2 = reda.SIP()
sip2.import_sip04(basepath + 'Data/sip_dataA.csv')
| 17.444444 | 54 | 0.665605 | 48 | 314 | 4.104167 | 0.520833 | 0.071066 | 0.111675 | 0.233503 | 0.314721 | 0.314721 | 0 | 0 | 0 | 0 | 0 | 0.026923 | 0.171975 | 314 | 17 | 55 | 18.470588 | 0.730769 | 0.133758 | 0 | 0 | 0 | 0 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.444444 | 0 | 0.666667 | 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 | 1 | 0 | 1 | 0 | 0 | 4 |
8fa05b52b80b54d25bf9dbeeb169be91ec6c6524 | 44 | py | Python | maprouletteupload/config.py | ebrelsford/maprouletteupload | d8b76685c3849cc2ee96cecf14ec716999f49577 | [
"MIT"
] | null | null | null | maprouletteupload/config.py | ebrelsford/maprouletteupload | d8b76685c3849cc2ee96cecf14ec716999f49577 | [
"MIT"
] | 1 | 2016-11-14T18:56:12.000Z | 2016-11-14T18:56:12.000Z | maprouletteupload/config.py | ebrelsford/maprouletteupload | d8b76685c3849cc2ee96cecf14ec716999f49577 | [
"MIT"
] | null | null | null | API_ROOT = 'http://maproulette.org/api/v2/'
| 22 | 43 | 0.704545 | 7 | 44 | 4.285714 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02439 | 0.068182 | 44 | 1 | 44 | 44 | 0.707317 | 0 | 0 | 0 | 0 | 0 | 0.681818 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
8fb9e36a40f053dbc43b53e953dbbdf0358a99d9 | 269 | py | Python | d21/election/views.py | COEXCZ/d21 | 236a8485e40bfd388d06380b7e4087ca91b513f1 | [
"MIT"
] | null | null | null | d21/election/views.py | COEXCZ/d21 | 236a8485e40bfd388d06380b7e4087ca91b513f1 | [
"MIT"
] | null | null | null | d21/election/views.py | COEXCZ/d21 | 236a8485e40bfd388d06380b7e4087ca91b513f1 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django.views.generic import TemplateView
class ElectionListView(TemplateView): # TODO: make better base class
template_name = 'index.html'
# TODO: context
class ElectionDetailView(TemplateView):
# TODO
pass
| 20.692308 | 69 | 0.754647 | 30 | 269 | 6.733333 | 0.7 | 0.09901 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178439 | 269 | 12 | 70 | 22.416667 | 0.914027 | 0.174721 | 0 | 0 | 0 | 0 | 0.045872 | 0 | 0 | 0 | 0 | 0.083333 | 0 | 1 | 0 | false | 0.166667 | 0.333333 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 4 |
8fd24bb236cae4c1595edd556afd2de54b664bf7 | 192 | py | Python | roscraco/router/tplink/wr940n.py | spantaleev/roscraco | 87a5a7c54931d5586fd7d30c8c67a699bef69c1f | [
"BSD-3-Clause"
] | 13 | 2015-03-01T00:39:43.000Z | 2020-09-06T09:32:52.000Z | roscraco/router/tplink/wr940n.py | spantaleev/roscraco | 87a5a7c54931d5586fd7d30c8c67a699bef69c1f | [
"BSD-3-Clause"
] | 3 | 2015-08-08T01:34:35.000Z | 2017-05-14T11:07:50.000Z | roscraco/router/tplink/wr940n.py | spantaleev/roscraco | 87a5a7c54931d5586fd7d30c8c67a699bef69c1f | [
"BSD-3-Clause"
] | 11 | 2015-01-29T03:21:08.000Z | 2020-06-30T17:05:19.000Z | from .wr740n import Tplink_WR740N
class Tplink_WR940N(Tplink_WR740N):
def confirm_identity(self):
self._ensure_www_auth_header('Basic realm="TP-LINK Wireless N Router WR940N"')
| 24 | 86 | 0.765625 | 27 | 192 | 5.148148 | 0.777778 | 0.172662 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.092025 | 0.151042 | 192 | 7 | 87 | 27.428571 | 0.760736 | 0 | 0 | 0 | 0 | 0 | 0.239583 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
8f23a62e75871072559872f8b17b101babd88d1d | 191 | py | Python | reeds/function_libs/pipeline/__init__.py | candidechamp/reeds | 601e4327132f80d7e7fd90d47eecc85cecc0fdd8 | [
"MIT"
] | 3 | 2021-06-18T03:27:17.000Z | 2021-11-15T13:55:51.000Z | reeds/function_libs/pipeline/__init__.py | candidechamp/reeds | 601e4327132f80d7e7fd90d47eecc85cecc0fdd8 | [
"MIT"
] | 11 | 2021-06-25T08:53:37.000Z | 2021-10-19T10:17:58.000Z | reeds/function_libs/pipeline/__init__.py | candidechamp/reeds | 601e4327132f80d7e7fd90d47eecc85cecc0fdd8 | [
"MIT"
] | 1 | 2021-09-16T12:18:17.000Z | 2021-09-16T12:18:17.000Z | """
The pipeline submodule is providing functionality to queue RE-EDS runs into a job-scheduling system.
Therefore the submodule is divided into two parts: scheduler and workers.
""" | 38.2 | 104 | 0.759162 | 27 | 191 | 5.37037 | 0.851852 | 0.151724 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.183246 | 191 | 5 | 105 | 38.2 | 0.929487 | 0.910995 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
8f30ac6abe35d3a400a26e14653bd163ce3c74d9 | 176 | py | Python | aula4_pt1/app.py | es99/curso-flask | 03446ccc89894a2c4f2d1c14d0040e80d2226d9e | [
"Unlicense"
] | 1 | 2020-07-21T05:17:20.000Z | 2020-07-21T05:17:20.000Z | aula4_pt1/app.py | es99/curso-flask | 03446ccc89894a2c4f2d1c14d0040e80d2226d9e | [
"Unlicense"
] | null | null | null | aula4_pt1/app.py | es99/curso-flask | 03446ccc89894a2c4f2d1c14d0040e80d2226d9e | [
"Unlicense"
] | null | null | null | import views
from flask import Flask
def create_app():
""""Função principal que retorna um aplicativo"""
app = Flask(__name__)
views.init_app(app)
return app
| 17.6 | 53 | 0.693182 | 24 | 176 | 4.833333 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.215909 | 176 | 9 | 54 | 19.555556 | 0.84058 | 0.244318 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
8f4d0f9a51ffc805d47108d1f9c4dac5fee14b1e | 17 | py | Python | kharon/project_templates/settings.py | RedRussianBear/kharon | d5ec8ad059d71a69ddc90616eafea38d96de4ed6 | [
"BSD-3-Clause"
] | 1 | 2019-04-15T12:22:46.000Z | 2019-04-15T12:22:46.000Z | kharon/project_templates/settings.py | RedRussianBear/kharon | d5ec8ad059d71a69ddc90616eafea38d96de4ed6 | [
"BSD-3-Clause"
] | null | null | null | kharon/project_templates/settings.py | RedRussianBear/kharon | d5ec8ad059d71a69ddc90616eafea38d96de4ed6 | [
"BSD-3-Clause"
] | null | null | null | BAUD_RATE = 9600
| 8.5 | 16 | 0.764706 | 3 | 17 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | 0.176471 | 17 | 1 | 17 | 17 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
8f59804155447ce5a92bc03b64117df40f086361 | 91 | py | Python | gethost.py | tyutyutyu/docker-git-clone | 11c37441def9391482822f6121e8b9c7423523a1 | [
"MIT"
] | 1 | 2018-01-08T22:42:21.000Z | 2018-01-08T22:42:21.000Z | gethost.py | tyutyutyu/docker-git-clone | 11c37441def9391482822f6121e8b9c7423523a1 | [
"MIT"
] | null | null | null | gethost.py | tyutyutyu/docker-git-clone | 11c37441def9391482822f6121e8b9c7423523a1 | [
"MIT"
] | 2 | 2016-12-15T16:03:47.000Z | 2018-02-13T10:49:16.000Z | #!/usr/bin/python
import sys
from giturlparse import parse
print parse(sys.argv[1]).host
| 13 | 29 | 0.758242 | 15 | 91 | 4.6 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.0125 | 0.120879 | 91 | 6 | 30 | 15.166667 | 0.85 | 0.175824 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.666667 | null | null | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
8f6a9d51b1d4fab0d6d1a544d1b09631f7c361d8 | 241 | py | Python | sonarqube/cloud/webservices.py | 0x646e78/python-sonarqube-api | c641ab4dd180b4184f2663bd28277aa796b36417 | [
"MIT"
] | null | null | null | sonarqube/cloud/webservices.py | 0x646e78/python-sonarqube-api | c641ab4dd180b4184f2663bd28277aa796b36417 | [
"MIT"
] | null | null | null | sonarqube/cloud/webservices.py | 0x646e78/python-sonarqube-api | c641ab4dd180b4184f2663bd28277aa796b36417 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Author: Jialiang Shi
from sonarqube.community.webservices import SonarQubeWebservices
class SonarCloudWebservices(SonarQubeWebservices):
"""
SonarCloud webservices Operations
"""
| 21.909091 | 64 | 0.738589 | 22 | 241 | 8.090909 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004854 | 0.145228 | 241 | 10 | 65 | 24.1 | 0.859223 | 0.40249 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
8f6ce44966501152b092923843e88442eb6ed505 | 106 | py | Python | strategies/bak/__init__.py | dizzy21c/easyqtrs | 4704674d2175d40afdc306afd8a002a486c83220 | [
"MIT"
] | 2 | 2021-12-30T13:43:13.000Z | 2022-01-23T13:39:54.000Z | strategies/bak/__init__.py | dizzy21c/easyqtrs | 4704674d2175d40afdc306afd8a002a486c83220 | [
"MIT"
] | null | null | null | strategies/bak/__init__.py | dizzy21c/easyqtrs | 4704674d2175d40afdc306afd8a002a486c83220 | [
"MIT"
] | 4 | 2021-10-22T01:44:47.000Z | 2022-01-05T05:49:20.000Z | #!/usr/bin/python
# encoding: utf-8
"""
@author:
contact:
@file:__init__.py.py
@time: 17-3-22 上午10:28
""" | 11.777778 | 22 | 0.641509 | 18 | 106 | 3.555556 | 0.944444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106383 | 0.113208 | 106 | 9 | 23 | 11.777778 | 0.574468 | 0.886792 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
56afc56a7add6c3be45610ebf082d9e1beb9a805 | 8,148 | py | Python | test/test_slimta_smtp_auth.py | fisele/compare-slimta | 4a59bd8e0d0b01551ed6d045b7e008846c8b4a80 | [
"MIT"
] | null | null | null | test/test_slimta_smtp_auth.py | fisele/compare-slimta | 4a59bd8e0d0b01551ed6d045b7e008846c8b4a80 | [
"MIT"
] | null | null | null | test/test_slimta_smtp_auth.py | fisele/compare-slimta | 4a59bd8e0d0b01551ed6d045b7e008846c8b4a80 | [
"MIT"
] | null | null | null | import email.utils
import unittest
from mox3.mox import MoxTestBase, IsA
from gevent.ssl import SSLSocket
from pysasl import SASLAuth
from slimta.smtp.io import IO
from slimta.smtp.auth import AuthSession, ServerAuthError, \
InvalidMechanismError, AuthenticationCanceled
class TestSmtpAuth(MoxTestBase, unittest.TestCase):
def setUp(self):
super(TestSmtpAuth, self).setUp()
self.sock = self.mox.CreateMock(SSLSocket)
self.sock.fileno = lambda: -1
self.sock.getpeername = lambda: ('test', 0)
self.io = IO(self.sock)
self.make_msgid = email.utils.make_msgid = lambda: '<test@example.com>'
def test_bytes(self):
auth = AuthSession(SASLAuth(), self.io)
self.assertEqual('CRAM-MD5 LOGIN PLAIN', str(auth))
def test_invalid_mechanism(self):
auth = AuthSession(SASLAuth(), self.io)
with self.assertRaises(InvalidMechanismError):
auth.server_attempt(b'TEST')
with self.assertRaises(InvalidMechanismError):
auth.server_attempt(b'B@D')
def test_plain_noarg(self):
self.sock.sendall(b'334 \r\n')
self.sock.recv(IsA(int)).AndReturn(b'dGVzdHppZAB0ZXN0dXNlcgB0ZXN0cGFzc3dvcmQ=\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
result = auth.server_attempt(b'PLAIN')
self.assertEqual(u'testuser', result.authcid)
self.assertEqual(u'testpassword', result.secret)
self.assertEqual(u'testzid', result.authzid)
def test_plain(self):
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
result = auth.server_attempt(b'PLAIN dGVzdHppZAB0ZXN0dXNlcgB0ZXN0cGFzc3dvcmQ=')
self.assertEqual(u'testuser', result.authcid)
self.assertEqual(u'testpassword', result.secret)
self.assertEqual(u'testzid', result.authzid)
def test_plain_canceled(self):
self.sock.sendall(b'334 \r\n')
self.sock.recv(IsA(int)).AndReturn(b'*\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
with self.assertRaises(AuthenticationCanceled):
auth.server_attempt(b'PLAIN')
with self.assertRaises(AuthenticationCanceled):
auth.server_attempt(b'PLAIN *')
def test_login_noarg(self):
self.sock.sendall(b'334 VXNlcm5hbWU6\r\n')
self.sock.recv(IsA(int)).AndReturn(b'dGVzdHVzZXI=\r\n')
self.sock.sendall(b'334 UGFzc3dvcmQ6\r\n')
self.sock.recv(IsA(int)).AndReturn(b'dGVzdHBhc3N3b3Jk\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
result = auth.server_attempt(b'LOGIN')
self.assertEqual(u'testuser', result.authcid)
self.assertEqual(u'testpassword', result.secret)
self.assertEqual(None, result.authzid)
def test_login(self):
self.sock.sendall(b'334 UGFzc3dvcmQ6\r\n')
self.sock.recv(IsA(int)).AndReturn(b'dGVzdHBhc3N3b3Jk\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
result = auth.server_attempt(b'LOGIN dGVzdHVzZXI=')
self.assertEqual(u'testuser', result.authcid)
self.assertEqual(u'testpassword', result.secret)
self.assertEqual(None, result.authzid)
def test_crammd5(self):
self.sock.sendall(b'334 PHRlc3RAZXhhbXBsZS5jb20+\r\n')
self.sock.recv(IsA(int)).AndReturn(b'dGVzdHVzZXIgNDkzMzA1OGU2ZjgyOTRkZTE0NDJkMTYxOTI3ZGI5NDQ=\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
result = auth.server_attempt(b'CRAM-MD5')
self.assertEqual(u'testuser', result.authcid)
self.assertTrue(result.check_secret(u'testpassword'))
self.assertFalse(result.check_secret(u'testwrong'))
self.assertEqual(None, result.authzid)
def test_crammd5_malformed(self):
self.sock.sendall(b'334 PHRlc3RAZXhhbXBsZS5jb20+\r\n')
self.sock.recv(IsA(int)).AndReturn(b'bWFsZm9ybWVk\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
with self.assertRaises(ServerAuthError):
auth.server_attempt(b'CRAM-MD5')
def test_client_bad_mech(self):
self.sock.sendall(b'AUTH LOGIN\r\n')
self.sock.recv(IsA(int)).AndReturn(b'535 Nope!\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
reply = auth.client_attempt(u'test@example.com', u'asdf',
None, b'LOGIN')
self.assertEqual('535', reply.code)
self.assertEqual('5.0.0 Nope!', reply.message)
def test_client_plain(self):
self.sock.sendall(b'AUTH PLAIN amtsAHRlc3RAZXhhbXBsZS5jb20AYXNkZg==\r\n')
self.sock.recv(IsA(int)).AndReturn(b'235 Ok\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
reply = auth.client_attempt(u'test@example.com', u'asdf', u'jkl',
b'PLAIN')
self.assertEqual('235', reply.code)
self.assertEqual('2.0.0 Ok', reply.message)
def test_client_login(self):
self.sock.sendall(b'AUTH LOGIN\r\n')
self.sock.recv(IsA(int)).AndReturn(b'334 VXNlcm5hbWU6\r\n')
self.sock.sendall(b'dGVzdEBleGFtcGxlLmNvbQ==\r\n')
self.sock.recv(IsA(int)).AndReturn(b'334 UGFzc3dvcmQ6\r\n')
self.sock.sendall(b'YXNkZg==\r\n')
self.sock.recv(IsA(int)).AndReturn(b'235 Ok\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
reply = auth.client_attempt(u'test@example.com', u'asdf',
None, b'LOGIN')
self.assertEqual('235', reply.code)
self.assertEqual('2.0.0 Ok', reply.message)
def test_client_login_bad_username(self):
self.sock.sendall(b'AUTH LOGIN\r\n')
self.sock.recv(IsA(int)).AndReturn(b'334 VXNlcm5hbWU6\r\n')
self.sock.sendall(b'dGVzdEBleGFtcGxlLmNvbQ==\r\n')
self.sock.recv(IsA(int)).AndReturn(b'535 Nope!\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
reply = auth.client_attempt(u'test@example.com', u'asdf',
None, b'LOGIN')
self.assertEqual('535', reply.code)
self.assertEqual('5.0.0 Nope!', reply.message)
def test_client_crammd5(self):
self.sock.sendall(b'AUTH CRAM-MD5\r\n')
self.sock.recv(IsA(int)).AndReturn(b'334 dGVzdCBjaGFsbGVuZ2U=\r\n')
self.sock.sendall(b'dGVzdEBleGFtcGxlLmNvbSA1Yzk1OTBjZGE3ZTgxMDY5Mzk2ZjhiYjlkMzU1MzE1Yg==\r\n')
self.sock.recv(IsA(int)).AndReturn(b'235 Ok\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
reply = auth.client_attempt(u'test@example.com', u'asdf',
None, b'CRAM-MD5')
self.assertEqual('235', reply.code)
self.assertEqual('2.0.0 Ok', reply.message)
def test_client_xoauth2(self):
self.sock.sendall(b'AUTH XOAUTH2 dXNlcj10ZXN0QGV4YW1wbGUuY29tAWF1dGg9QmVhcmVyYXNkZgEB\r\n')
self.sock.recv(IsA(int)).AndReturn(b'235 Ok\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
reply = auth.client_attempt(u'test@example.com', u'asdf',
None, b'XOAUTH2')
self.assertEqual('235', reply.code)
self.assertEqual('2.0.0 Ok', reply.message)
def test_client_xoauth2_error(self):
self.sock.sendall(b'AUTH XOAUTH2 dXNlcj10ZXN0QGV4YW1wbGUuY29tAWF1dGg9QmVhcmVyYXNkZgEB\r\n')
self.sock.recv(IsA(int)).AndReturn(b'334 eyJzdGF0dXMiOiI0MDEiLCJzY2hlbWVzIjoiYmVhcmVyIG1hYyIsInNjb3BlIjoiaHR0cHM6Ly9tYWlsLmdvb2dsZS5jb20vIn0K\r\n')
self.sock.sendall(b'\r\n')
self.sock.recv(IsA(int)).AndReturn(b'535 Nope!\r\n')
self.mox.ReplayAll()
auth = AuthSession(SASLAuth(), self.io)
reply = auth.client_attempt(u'test@example.com', u'asdf',
None, b'XOAUTH2')
self.assertEqual('535', reply.code)
self.assertEqual('5.0.0 Nope!', reply.message)
# vim:et:fdm=marker:sts=4:sw=4:ts=4
| 44.043243 | 155 | 0.641875 | 1,008 | 8,148 | 5.135913 | 0.12004 | 0.064902 | 0.044041 | 0.048291 | 0.774773 | 0.773421 | 0.738845 | 0.717983 | 0.679351 | 0.652308 | 0 | 0.032075 | 0.21944 | 8,148 | 184 | 156 | 44.282609 | 0.781918 | 0.00405 | 0 | 0.60625 | 0 | 0 | 0.188956 | 0.074941 | 0 | 0 | 0 | 0 | 0.225 | 1 | 0.10625 | false | 0.03125 | 0.04375 | 0 | 0.15625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
56b20fc92fdd40986e751b3065d4058eb0d25c94 | 4,410 | py | Python | test/test_design_permission_set_api.py | tweak-com-public/tweak-api-client-python | 019f86da11fdb12683d516f8f37db5d717380bcc | [
"Apache-2.0"
] | null | null | null | test/test_design_permission_set_api.py | tweak-com-public/tweak-api-client-python | 019f86da11fdb12683d516f8f37db5d717380bcc | [
"Apache-2.0"
] | null | null | null | test/test_design_permission_set_api.py | tweak-com-public/tweak-api-client-python | 019f86da11fdb12683d516f8f37db5d717380bcc | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
tweak-api
Tweak API to integrate with all the Tweak services. You can find out more about Tweak at <a href='https://www.tweak.com'>https://www.tweak.com</a>, #tweak.
OpenAPI spec version: 1.0.8-beta.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import
import os
import sys
import unittest
import TweakApi
from TweakApi.rest import ApiException
from TweakApi.apis.design_permission_set_api import DesignPermissionSetApi
class TestDesignPermissionSetApi(unittest.TestCase):
""" DesignPermissionSetApi unit test stubs """
def setUp(self):
self.api = TweakApi.apis.design_permission_set_api.DesignPermissionSetApi()
def tearDown(self):
pass
def test_design_permission_sets_change_stream_get(self):
"""
Test case for design_permission_sets_change_stream_get
Create a change stream.
"""
pass
def test_design_permission_sets_change_stream_post(self):
"""
Test case for design_permission_sets_change_stream_post
Create a change stream.
"""
pass
def test_design_permission_sets_count_get(self):
"""
Test case for design_permission_sets_count_get
Count instances of the model matched by where from the data source.
"""
pass
def test_design_permission_sets_find_one_get(self):
"""
Test case for design_permission_sets_find_one_get
Find first instance of the model matched by filter from the data source.
"""
pass
def test_design_permission_sets_get(self):
"""
Test case for design_permission_sets_get
Find all instances of the model matched by filter from the data source.
"""
pass
def test_design_permission_sets_id_delete(self):
"""
Test case for design_permission_sets_id_delete
Delete a model instance by {{id}} from the data source.
"""
pass
def test_design_permission_sets_id_design_get(self):
"""
Test case for design_permission_sets_id_design_get
Fetches belongsTo relation design.
"""
pass
def test_design_permission_sets_id_exists_get(self):
"""
Test case for design_permission_sets_id_exists_get
Check whether a model instance exists in the data source.
"""
pass
def test_design_permission_sets_id_get(self):
"""
Test case for design_permission_sets_id_get
Find a model instance by {{id}} from the data source.
"""
pass
def test_design_permission_sets_id_head(self):
"""
Test case for design_permission_sets_id_head
Check whether a model instance exists in the data source.
"""
pass
def test_design_permission_sets_id_patch(self):
"""
Test case for design_permission_sets_id_patch
Patch attributes for a model instance and persist it into the data source.
"""
pass
def test_design_permission_sets_id_put(self):
"""
Test case for design_permission_sets_id_put
Replace attributes for a model instance and persist it into the data source.
"""
pass
def test_design_permission_sets_id_replace_post(self):
"""
Test case for design_permission_sets_id_replace_post
Replace attributes for a model instance and persist it into the data source.
"""
pass
def test_design_permission_sets_post(self):
"""
Test case for design_permission_sets_post
Create a new instance of the model and persist it into the data source.
"""
pass
if __name__ == '__main__':
unittest.main()
| 27.5625 | 165 | 0.675283 | 583 | 4,410 | 4.845626 | 0.253859 | 0.169912 | 0.19823 | 0.124602 | 0.631504 | 0.613097 | 0.550442 | 0.538761 | 0.384071 | 0.308319 | 0 | 0.002786 | 0.267347 | 4,410 | 159 | 166 | 27.735849 | 0.871557 | 0.535828 | 0 | 0.357143 | 0 | 0 | 0.005185 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.380952 | false | 0.357143 | 0.166667 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 4 |
56c7fe1aade4b9e3e2951ef821d2dbb9b8b05539 | 323 | py | Python | tests/hints.py | lycantropos/ground | ef6f54b8cb555af8d9202d621cac57a892ecb78d | [
"MIT"
] | 4 | 2021-05-15T19:15:56.000Z | 2021-11-30T06:19:47.000Z | tests/hints.py | lycantropos/ground | ef6f54b8cb555af8d9202d621cac57a892ecb78d | [
"MIT"
] | null | null | null | tests/hints.py | lycantropos/ground | ef6f54b8cb555af8d9202d621cac57a892ecb78d | [
"MIT"
] | null | null | null | from typing import (Sequence,
Tuple)
from hypothesis.strategies import SearchStrategy
from ground.hints import Point
Strategy = SearchStrategy
PointsPair = Tuple[Point, Point]
PointsQuadruplet = Tuple[Point, Point, Point, Point]
PointsTriplet = Tuple[Point, Point, Point]
Permutation = Sequence[int]
| 24.846154 | 52 | 0.749226 | 35 | 323 | 6.914286 | 0.485714 | 0.247934 | 0.18595 | 0.165289 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176471 | 323 | 12 | 53 | 26.916667 | 0.909774 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
56cb68bd25d4693aeddeff84d7fd65493d31b37e | 26 | py | Python | example_app/graviton2_gh_runner_flask_app/helpers/__init__.py | aws-samples/cdk-graviton2-gh-sh-runner | 4d74bb4bb625669929e6f33d931a4233d580510d | [
"MIT-0"
] | 5 | 2021-11-02T22:00:28.000Z | 2022-01-26T21:41:52.000Z | example_app/graviton2_gh_runner_flask_app/helpers/__init__.py | aws-samples/cdk-graviton2-gh-sh-runner | 4d74bb4bb625669929e6f33d931a4233d580510d | [
"MIT-0"
] | null | null | null | example_app/graviton2_gh_runner_flask_app/helpers/__init__.py | aws-samples/cdk-graviton2-gh-sh-runner | 4d74bb4bb625669929e6f33d931a4233d580510d | [
"MIT-0"
] | 4 | 2021-11-02T01:26:35.000Z | 2022-01-20T03:51:15.000Z | """Module for helpers."""
| 13 | 25 | 0.615385 | 3 | 26 | 5.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115385 | 26 | 1 | 26 | 26 | 0.695652 | 0.730769 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
56d9298e8c0c6b79b3d0e388e6bc4825b9a70ed0 | 847 | py | Python | scripts/patch_gcr_auth_json.py | jpark2111/rasaXazure | 33c31a2ee3304d4ccb34790966cedc462c6fd702 | [
"Apache-2.0"
] | null | null | null | scripts/patch_gcr_auth_json.py | jpark2111/rasaXazure | 33c31a2ee3304d4ccb34790966cedc462c6fd702 | [
"Apache-2.0"
] | null | null | null | scripts/patch_gcr_auth_json.py | jpark2111/rasaXazure | 33c31a2ee3304d4ccb34790966cedc462c6fd702 | [
"Apache-2.0"
] | null | null | null | import os
with open("deploy/gcr-auth.json", "r") as f:
lines = f.readlines()
for line in lines:
print(
line.replace(
"set_as_environment_variable-GCR_AUTH_JSON_PRIVATE_KEY_ID",
os.environ["GCR_AUTH_JSON_PRIVATE_KEY_ID"],
)
.replace(
"set_as_environment_variable-GCR_AUTH_JSON_PRIVATE_KEY",
os.environ["GCR_AUTH_JSON_PRIVATE_KEY"],
)
.replace(
"set_as_environment_variable-GCR_AUTH_JSON_CLIENT_EMAIL",
os.environ["GCR_AUTH_JSON_CLIENT_EMAIL"],
)
.replace(
"set_as_environment_variable-GCR_AUTH_JSON_CLIENT_ID",
os.environ["GCR_AUTH_JSON_CLIENT_ID"],
),
end="",
)
| 33.88 | 76 | 0.536009 | 91 | 847 | 4.483516 | 0.307692 | 0.154412 | 0.242647 | 0.22549 | 0.808824 | 0.779412 | 0.637255 | 0.490196 | 0.490196 | 0.254902 | 0 | 0 | 0.375443 | 847 | 24 | 77 | 35.291667 | 0.771267 | 0 | 0 | 0.130435 | 0 | 0 | 0.409478 | 0.383961 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.043478 | 0 | 0.043478 | 0.043478 | 0 | 0 | 0 | null | 0 | 1 | 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 | 4 |
56e63a81c482e5a513db6ce9d2369c2b4b270836 | 244 | py | Python | tshirt/tests/test_rowamp_sub.py | kglidic/tshirt | 8080d32b154bc2b4da8410b1d53c5353a8f6b9dd | [
"MIT"
] | 1 | 2020-08-09T10:28:17.000Z | 2020-08-09T10:28:17.000Z | tshirt/tests/test_rowamp_sub.py | kglidic/tshirt | 8080d32b154bc2b4da8410b1d53c5353a8f6b9dd | [
"MIT"
] | 25 | 2020-07-01T17:25:59.000Z | 2022-03-23T03:45:56.000Z | tshirt/tests/test_rowamp_sub.py | kglidic/tshirt | 8080d32b154bc2b4da8410b1d53c5353a8f6b9dd | [
"MIT"
] | 1 | 2020-06-30T15:56:32.000Z | 2020-06-30T15:56:32.000Z | import unittest
from tshirt.pipeline import phot_pipeline, spec_pipeline
from astropy.io import fits,ascii
from pkg_resources import resource_filename
from copy import deepcopy
from tshirt.pipeline import sim_data
import os
import numpy as np
| 24.4 | 56 | 0.856557 | 38 | 244 | 5.368421 | 0.605263 | 0.098039 | 0.176471 | 0.235294 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.122951 | 244 | 9 | 57 | 27.111111 | 0.953271 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
712d319481c65dd25307c608266ceb19bf03e1ed | 39 | py | Python | google_ime_skk_py/__init__.py | chaploud/google-ime-skk-py | 4df373eee893116ad391aeaa20ed2de05d5261f1 | [
"MIT"
] | null | null | null | google_ime_skk_py/__init__.py | chaploud/google-ime-skk-py | 4df373eee893116ad391aeaa20ed2de05d5261f1 | [
"MIT"
] | null | null | null | google_ime_skk_py/__init__.py | chaploud/google-ime-skk-py | 4df373eee893116ad391aeaa20ed2de05d5261f1 | [
"MIT"
] | null | null | null | """
__init__.py
google-ime-skk-py
"""
| 6.5 | 17 | 0.615385 | 6 | 39 | 3.333333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128205 | 39 | 5 | 18 | 7.8 | 0.588235 | 0.769231 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
712f105fe8dbd3959e429c1cde6b3d839340755b | 17,395 | py | Python | unit_testing/test_api_users.py | Stanford-PERTS/triton | 5a4f401fc7019d59ce4c41eafa6c5bda822fae0a | [
"CC0-1.0"
] | null | null | null | unit_testing/test_api_users.py | Stanford-PERTS/triton | 5a4f401fc7019d59ce4c41eafa6c5bda822fae0a | [
"CC0-1.0"
] | null | null | null | unit_testing/test_api_users.py | Stanford-PERTS/triton | 5a4f401fc7019d59ce4c41eafa6c5bda822fae0a | [
"CC0-1.0"
] | null | null | null | """Test endpoints
/api/users/X and
/api/teams/X/users and
/api/organizations/X/users."""
import logging
import webapp2
import webtest
from api_handlers import api_routes
from model import Team, Program, Organization, User
from unit_test_helper import ConsistencyTestCase
import config
import json
import jwt_helper
import mysql_connection
class TestApiUsers(ConsistencyTestCase):
cookie_name = config.session_cookie_name
cookie_key = config.default_session_cookie_secret_key
def set_up(self):
# Let ConsistencyTestCase set up the datastore testing stub.
super(TestApiUsers, self).set_up()
application = webapp2.WSGIApplication(
api_routes,
config={
'webapp2_extras.sessions': {
'secret_key': self.cookie_key
}
},
debug=True
)
self.testapp = webtest.TestApp(application)
with mysql_connection.connect() as sql:
sql.reset({
'program': Program.get_table_definition(),
'organization': Organization.get_table_definition(),
'team': Team.get_table_definition(),
'user': User.get_table_definition(),
})
self.program = Program.create(
name="Engagement Project",
label='ep18',
min_cycles=3,
active=True,
preview_url='foo.com',
)
self.program.put()
def login_headers(self, user):
payload = {'user_id': user.uid, 'email': user.email}
return {'Authorization': 'Bearer ' + jwt_helper.encode(payload)}
def test_get_all_requires_auth(self):
response = self.testapp.get(
'/api/users',
status=401,
)
def test_get_for_team_requires_auth(self):
response = self.testapp.get(
'/api/teams/Team_foo/users',
status=401,
)
def test_get_for_organization_requires_auth(self):
response = self.testapp.get(
'/api/organizations/Organization_foo/users',
status=401,
)
def test_get_all_forbidden(self):
"""Non-supers get 403."""
user = User.create(name='foo', email='foo@bar.com')
user.put()
response = self.testapp.get(
'/api/users',
headers=self.login_headers(user),
status=403,
)
def test_get_all_super(self):
"""Supers can query all users."""
team = Team.create(name='foo', captain_id='User_cap',
program_id=self.program.uid)
team.put()
user = User.create(name='super', email='super@bar.com',
user_type='super_admin')
user.put()
response = self.testapp.get(
'/api/users',
headers=self.login_headers(user),
)
response_list = json.loads(response.body)
self.assertEqual(len(response_list), 1)
def test_get_all_for_team(self):
"""You can list team members of your team."""
team = Team.create(name='foo', captain_id='User_cap',
program_id=self.program.uid)
team.put()
user = User.create(name='foo', email='foo@bar.com',
owned_teams=[team.uid])
user.put()
response = self.testapp.get(
'/api/teams/{}/users'.format(team.uid),
headers=self.login_headers(user),
)
response_list = json.loads(response.body)
self.assertEqual(len(response_list), 1)
def test_get_all_for_organization(self):
"""You can list co-admins of your organization."""
org = Organization.create(name='foo', program_id=self.program.uid)
org.put()
user = User.create(name='foo', email='foo@bar.com',
owned_organizations=[org.uid])
user.put()
response = self.testapp.get(
'/api/organizations/{}/users'.format(org.uid),
headers=self.login_headers(user),
)
response_list = json.loads(response.body)
self.assertEqual(len(response_list), 1)
def test_get_one_for_team(self):
"""You can get a single team member."""
team = Team.create(name='foo', captain_id='User_cap',
program_id=self.program.uid)
team.put()
teammate = User.create(name='teammate', email='teammate@bar.com',
owned_teams=[team.uid])
teammate.put()
user = User.create(name='foo', email='foo@bar.com',
owned_teams=[team.uid])
user.put()
response = self.testapp.get(
'/api/teams/{}/users/{}'.format(team.uid, teammate.uid),
headers=self.login_headers(user),
)
response_dict = json.loads(response.body)
self.assertEqual(response_dict['uid'], teammate.uid)
def test_get_one_for_organization(self):
"""You can get a single organization admin."""
org = Organization.create(name='foo', program_id=self.program.uid)
org.put()
coAdmin = User.create(name='coAdmin', email='coAdmin@bar.com',
owned_organizations=[org.uid])
coAdmin.put()
user = User.create(name='foo', email='foo@bar.com',
owned_organizations=[org.uid])
user.put()
response = self.testapp.get(
'/api/organizations/{}/users/{}'.format(org.uid, coAdmin.uid),
headers=self.login_headers(user),
)
response_dict = json.loads(response.body)
self.assertEqual(response_dict['uid'], coAdmin.uid)
def test_get_owned(self):
"""You can get yourself."""
user = User.create(name='foo', email='foo@bar.com')
user.put()
response = self.testapp.get(
'/api/users/{}'.format(user.uid),
headers=self.login_headers(user),
)
response_dict = json.loads(response.body)
self.assertEqual(response_dict['uid'], user.uid)
def test_get_all_for_other_team_forbidden(self):
"""You can't list users from someone else's teams."""
team = Team.create(name='foo', captain_id='User_cap',
program_id=self.program.uid)
team.put()
user = User.create(name='foo', email='foo@bar.com')
user.put()
response = self.testapp.get(
'/api/teams/{}/users'.format(team.uid),
headers=self.login_headers(user),
status=403
)
def test_get_all_for_other_organization(self):
"""You can't list users from someone else's organization."""
org = Organization.create(name='foo', program_id=self.program.uid)
org.put()
user = User.create(name='foo', email='foo@bar.com')
user.put()
response = self.testapp.get(
'/api/organizations/{}/users'.format(org.uid),
headers=self.login_headers(user),
status=403
)
def test_get_one_for_other_team_forbidden(self):
"""You can't list users from someone else's teams."""
team = Team.create(name='foo', captain_id='User_cap',
program_id=self.program.uid)
team.put()
teammate = User.create(name='teammate', email='teammate@bar.com',
owned_teams=[team.uid])
teammate.put()
user = User.create(name='foo', email='foo@bar.com')
user.put()
response = self.testapp.get(
'/api/teams/{}/users/{}'.format(team.uid, teammate.uid),
headers=self.login_headers(user),
status=403,
)
def test_get_one_for_other_organization_forbidden(self):
"""You can't list users from someone else's organizations."""
org = Organization.create(name='foo', program_id=self.program.uid)
org.put()
coAdmin = User.create(name='coAdmin', email='teammate@bar.com',
owned_organizations=[org.uid])
coAdmin.put()
user = User.create(name='foo', email='foo@bar.com')
user.put()
response = self.testapp.get(
'/api/organizations/{}/users/{}'.format(org.uid, coAdmin.uid),
headers=self.login_headers(user),
status=403,
)
def test_get_for_not_found_team(self):
"""You can't list users for non existant team."""
user = User.create(name='foo', email='foo@bar.com')
user.put()
response = self.testapp.get(
'/api/teams/Team_other/users',
headers=self.login_headers(user),
status=404
)
def test_get_for_not_found_organization(self):
"""You can't list users for non existant organization."""
user = User.create(name='foo', email='foo@bar.com')
user.put()
response = self.testapp.get(
'/api/organizations/Organization_other/users',
headers=self.login_headers(user),
status=404
)
def test_update_privileges_fails(self):
"""Can't escalate your privileges via user type or relationships."""
user = User.create(name='foo', email='foo@bar.com', user_type='user',
owned_teams=[], owned_organizations=[])
user.put()
# You get a 200, but the changes you requested don't happen.
response = self.testapp.put_json(
'/api/users/{}'.format(user.uid),
{'user_type': 'super_admin', 'owned_teams': ['Team_foo'],
'owned_organizations': ['Organization_foo']},
headers=self.login_headers(user),
)
user_dict = json.loads(response.body)
self.assertEqual(user.user_type, user_dict['user_type'])
self.assertEqual(user.owned_teams, user_dict['owned_teams'])
self.assertEqual(user.owned_organizations,
user_dict['owned_organizations'])
# Also not changed in the db.
fetched_user = User.get_by_id(user.uid)
self.assertEqual(user.user_type, fetched_user.user_type)
self.assertEqual(user.owned_teams, fetched_user.owned_teams)
self.assertEqual(user.owned_organizations,
fetched_user.owned_organizations)
def test_remove_from_team_forbidden(self):
"""Normally you can't modify someone else's membership."""
team = Team.create(name='foo', captain_id='User_cap',
program_id=self.program.uid)
team.put()
user = User.create(name='foo', email='foo@bar.com', user_type='user',
owned_teams=['Team_foo'])
req = User.create(name='requestor', email='bar@foo.com',
user_type='user')
user.put()
req.put()
response = self.testapp.put_json(
'/api/users/{}'.format(user.uid),
{'owned_teams': []},
headers=self.login_headers(req),
status=403,
)
# Not changed in the db.
fetched_user = User.get_by_id(user.uid)
self.assertEqual(user.user_type, fetched_user.user_type)
self.assertEqual(user.owned_teams, fetched_user.owned_teams)
def test_remove_from_organization_forbidden(self):
"""Normally you can't modify someone else's membership."""
org = Organization.create(name='foo', program_id=self.program.uid)
org.put()
user = User.create(name='Admin', email='foo@bar.com', user_type='user',
owned_organizations=['Organization_foo'])
req = User.create(name='Invalid Requestor', email='bar@foo.com',
user_type='user')
user.put()
req.put()
response = self.testapp.put_json(
'/api/users/{}'.format(user.uid),
{'owned_organizations': []},
headers=self.login_headers(req),
status=403,
)
# Not changed in the db.
fetched_user = User.get_by_id(user.uid)
self.assertEqual(user.user_type, fetched_user.user_type)
self.assertEqual(user.owned_organizations,
fetched_user.owned_organizations)
def test_remove_fellow_from_organization_success(self):
"""Admins can remove each other."""
org = Organization.create(name='foo', program_id=self.program.uid)
org.put()
user = User.create(name='Admin', email='foo@bar.com', user_type='user',
owned_organizations=['Organization_foo'])
req = User.create(name='Valid Requestor', email='bar@foo.com',
user_type='user',
owned_organizations=['Organization_foo'])
user.put()
req.put()
# Successful removal.
response = self.testapp.put_json(
'/api/users/{}'.format(user.uid),
{'owned_organizations': []},
headers=self.login_headers(req),
)
self.assertEqual(json.loads(response.body)['owned_organizations'], [])
# Changed in the db.
fetched_user = User.get_by_id(user.uid)
self.assertEqual(fetched_user.owned_organizations, [])
self.assertEqual(user.user_type, fetched_user.user_type)
def test_remove_last_from_organization_forbidden(self):
"""The last member of an organization can't leave."""
org = Organization.create(name='foo', program_id=self.program.uid)
org.put()
user = User.create(name='foo', email='foo@bar.com', user_type='user',
owned_organizations=[org.uid])
user.put()
self.testapp.put_json(
'/api/users/{}'.format(user.uid),
{'owned_organizations': []},
headers=self.login_headers(user),
)
# not changed in the db
fetched_user = User.get_by_id(user.uid)
self.assertEqual(user.user_type, fetched_user.user_type)
self.assertEqual(user.owned_organizations,
fetched_user.owned_organizations)
def test_captain_removes_teammate_success(self):
"""Captains can remove teammembers."""
team = Team.create(name='foo', program_id=self.program.uid)
user = User.create(name='foo', email='foo@bar.com', user_type='user',
owned_teams=[team.uid])
captain = User.create(name='captain', email='captain@foo.com',
user_type='user', owned_teams=[team.uid])
team.captain_id = captain.uid
user.put()
captain.put()
team.put()
response = self.testapp.put_json(
'/api/users/{}'.format(user.uid),
{'owned_teams': []},
headers=self.login_headers(captain),
)
# User is removed from team.
self.assertEqual(json.loads(response.body)['owned_teams'], [])
def test_remove_self_from_team_success(self):
"""Can remove self from team."""
team = Team.create(name='foo', captain_id='User_cap',
program_id=self.program.uid)
user = User.create(name='foo', email='foo@bar.com', user_type='user',
owned_teams=[team.uid])
user.put()
team.put()
response = self.testapp.put_json(
'/api/users/{}'.format(user.uid),
{'owned_teams': []},
headers=self.login_headers(user),
)
# User is removed from team.
self.assertEqual(json.loads(response.body)['owned_teams'], [])
def test_method_not_allowed(self):
"""Typical RestHandler methods are correctly disallowed."""
user = User.create(name='foo', email='foo@bar.com')
user.put()
self.testapp.post_json(
'/api/users',
{'name': 'new dude', 'email': 'new@dude.com'},
headers=self.login_headers(user),
status=405,
)
self.testapp.delete(
'/api/users/User_foo',
headers=self.login_headers(user),
status=405,
)
self.testapp.post_json(
'/api/teams/Team_foo/users',
{'name': 'new dude', 'email': 'new@dude.com'},
headers=self.login_headers(user),
status=405,
)
self.testapp.put_json(
'/api/teams/Team_foo/users',
{'name': 'new dude', 'email': 'new@dude.com'},
headers=self.login_headers(user),
status=405,
)
self.testapp.delete(
'/api/teams/Team_foo/users',
headers=self.login_headers(user),
status=405,
)
self.testapp.post_json(
'/api/organizations/Organization_foo/users',
{'name': 'new dude', 'email': 'new@dude.com'},
headers=self.login_headers(user),
status=405,
)
self.testapp.put_json(
'/api/organizations/Organization_foo/users',
{'name': 'new dude', 'email': 'new@dude.com'},
headers=self.login_headers(user),
status=405,
)
self.testapp.delete(
'/api/organizations/Organization_foo/users',
headers=self.login_headers(user),
status=405,
)
| 37.651515 | 79 | 0.572693 | 1,988 | 17,395 | 4.841046 | 0.094567 | 0.046758 | 0.044576 | 0.066916 | 0.785328 | 0.763404 | 0.74813 | 0.714568 | 0.690046 | 0.671446 | 0 | 0.006123 | 0.29589 | 17,395 | 461 | 80 | 37.733189 | 0.779637 | 0.073814 | 0 | 0.660477 | 0 | 0 | 0.119845 | 0.03223 | 0 | 0 | 0 | 0 | 0.061008 | 1 | 0.068966 | false | 0 | 0.026525 | 0 | 0.106101 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
852e6dc96d98be25af0a4f6c425660c205218117 | 815 | py | Python | tests/test_day_03.py | masasin/advent_of_code_2015 | 032bcf780b59d261b3913673fd33001a98f2f69d | [
"MIT"
] | null | null | null | tests/test_day_03.py | masasin/advent_of_code_2015 | 032bcf780b59d261b3913673fd33001a98f2f69d | [
"MIT"
] | null | null | null | tests/test_day_03.py | masasin/advent_of_code_2015 | 032bcf780b59d261b3913673fd33001a98f2f69d | [
"MIT"
] | null | null | null | from day_03 import move, get_visits
def test_move():
assert move(">", (0, 0)) == (1, 0)
assert move("<", (0, 0)) == (-1, 0)
assert move("^", (0, 0)) == (0, 1)
assert move("v", (0, 0)) == (0, -1)
step_1 = move("^", (0, 0))
step_2 = move(">", step_1)
step_3 = move("v", step_2)
step_4 = move("<", step_3)
assert step_1 == (0, 1)
assert step_2 == (1, 1)
assert step_3 == (1, 0)
assert step_4 == (0, 0)
def test_get_visits():
assert get_visits(">") == 2
assert get_visits("^>v<") == 4
assert get_visits("^v^v^v^v^v") == 2
assert get_visits("^>v<>^") == 4
assert get_visits(">^^v^<>v") == 5
def test_get_visits_with_robot():
assert get_visits("^v", 2) == 3
assert get_visits("^>v<", 2) == 3
assert get_visits("^v^v^v^v^v", 2) == 11
| 24.69697 | 44 | 0.51411 | 137 | 815 | 2.854015 | 0.153285 | 0.253197 | 0.306905 | 0.286445 | 0.434783 | 0.434783 | 0.434783 | 0.434783 | 0.434783 | 0.414322 | 0 | 0.082792 | 0.244172 | 815 | 32 | 45 | 25.46875 | 0.551948 | 0 | 0 | 0 | 0 | 0 | 0.065031 | 0 | 0 | 0 | 0 | 0 | 0.666667 | 1 | 0.125 | false | 0 | 0.041667 | 0 | 0.166667 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
856dba87ed67bb7a78910c57a85200d9e9a0d71b | 119 | py | Python | assignment/week2/question1.py | sptzxbbb/DeepLearning | 3aa6af3fbe11bfe2169e26a93ddf134f0026c12c | [
"MIT"
] | null | null | null | assignment/week2/question1.py | sptzxbbb/DeepLearning | 3aa6af3fbe11bfe2169e26a93ddf134f0026c12c | [
"MIT"
] | null | null | null | assignment/week2/question1.py | sptzxbbb/DeepLearning | 3aa6af3fbe11bfe2169e26a93ddf134f0026c12c | [
"MIT"
] | null | null | null | import torch
t = torch.tensor([range(10, 50)], dtype=torch.float64)
print(t)
print(torch.max(t))
print(torch.min(t))
| 14.875 | 54 | 0.697479 | 21 | 119 | 3.952381 | 0.571429 | 0.144578 | 0.26506 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.056075 | 0.10084 | 119 | 7 | 55 | 17 | 0.719626 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.6 | 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 | 1 | 0 | 4 |
a425258f44918c99abea29d30ae15ac8f1845a6a | 90 | py | Python | setup.py | dguevel/slote | 9d79370ef31bb1009fe7001d7f7c1df47a077c0b | [
"MIT"
] | null | null | null | setup.py | dguevel/slote | 9d79370ef31bb1009fe7001d7f7c1df47a077c0b | [
"MIT"
] | null | null | null | setup.py | dguevel/slote | 9d79370ef31bb1009fe7001d7f7c1df47a077c0b | [
"MIT"
] | 1 | 2018-12-16T14:13:16.000Z | 2018-12-16T14:13:16.000Z | import sys
import os
dir = os.getcwd()
if dir not in sys.path:
sys.path.append(dir)
| 11.25 | 24 | 0.677778 | 17 | 90 | 3.588235 | 0.588235 | 0.229508 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.211111 | 90 | 7 | 25 | 12.857143 | 0.859155 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
a43f2957e62a409412fa7cd4d374fbb16b05fea6 | 179 | py | Python | tools/path.py | eddiepbc/where_to_go | 4bfbe4cd4dbddadabf7a7f959ed7643dbd70f63b | [
"Apache-2.0"
] | 2 | 2019-11-06T03:20:09.000Z | 2020-04-15T17:40:02.000Z | tools/path.py | eddiepbc/where_to_go | 4bfbe4cd4dbddadabf7a7f959ed7643dbd70f63b | [
"Apache-2.0"
] | 3 | 2021-03-19T07:55:41.000Z | 2022-01-13T01:48:31.000Z | tools/path.py | eddiepbc/where_to_go | 4bfbe4cd4dbddadabf7a7f959ed7643dbd70f63b | [
"Apache-2.0"
] | 2 | 2019-11-07T03:15:36.000Z | 2019-11-07T03:20:06.000Z | import os
from pathlib import Path
dir = os.path.dirname(__file__)
rootPath = os.path.dirname(dir)
rootPath=Path(rootPath).as_posix()
tempPath = os.path.join(rootPath + "/tmp/")
| 22.375 | 43 | 0.748603 | 27 | 179 | 4.777778 | 0.518519 | 0.139535 | 0.20155 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106145 | 179 | 7 | 44 | 25.571429 | 0.80625 | 0 | 0 | 0 | 0 | 0 | 0.027933 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
f151dc1d4ee023d5c7a3ba4aea49797c17203466 | 313 | py | Python | android_file_bridge/error.py | valknight/Android-File-Bridge | 61c957ae719a6c5c2c776562a994ef58ddad472a | [
"CC-BY-3.0"
] | 2 | 2020-01-09T15:06:49.000Z | 2022-01-31T16:53:34.000Z | android_file_bridge/error.py | valknight/Android-File-Bridge | 61c957ae719a6c5c2c776562a994ef58ddad472a | [
"CC-BY-3.0"
] | null | null | null | android_file_bridge/error.py | valknight/Android-File-Bridge | 61c957ae719a6c5c2c776562a994ef58ddad472a | [
"CC-BY-3.0"
] | null | null | null | class Error(Exception):
"""Base class"""
pass
class AdbConnectionError(Exception):
"""Raised when ADB can't connect"""
pass
class AdbPushError(Exception):
"""Raised when a file can't be pushed"""
pass
class AdbPullError(Exception):
"""Raised when a file can't be pulled"""
pass
| 19.5625 | 44 | 0.658147 | 40 | 313 | 5.15 | 0.475 | 0.131068 | 0.276699 | 0.194175 | 0.291262 | 0.291262 | 0.291262 | 0.291262 | 0 | 0 | 0 | 0 | 0.217252 | 313 | 15 | 45 | 20.866667 | 0.840816 | 0.351438 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
f18b5936bbde8e7353940242eae31e3afbcfb40a | 27 | py | Python | django_t10e/__init__.py | team23/django_t10e | f25e8ac6507e05968d2dbf1003ec4cb9f35b627e | [
"BSD-3-Clause"
] | 2 | 2021-03-26T13:39:20.000Z | 2022-01-19T10:24:23.000Z | nbscript/_version.py | NordicHPC/nbscript | db82f74db109d61bc93e884a56c95152885041d1 | [
"BSD-3-Clause"
] | 2 | 2016-03-22T15:31:38.000Z | 2016-04-05T08:59:39.000Z | nbscript/_version.py | NordicHPC/nbscript | db82f74db109d61bc93e884a56c95152885041d1 | [
"BSD-3-Clause"
] | null | null | null | __version__ = '0.1.1.dev1'
| 13.5 | 26 | 0.666667 | 5 | 27 | 2.8 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 0.111111 | 27 | 1 | 27 | 27 | 0.416667 | 0 | 0 | 0 | 0 | 0 | 0.37037 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
74f70fd4985e977c24616fae356f0784d29b6a5f | 134 | py | Python | tests/test_recipes.py | tyler-a-cox/recipe-parsing | fa883f66a39063cf72912527628b082cda455e76 | [
"MIT"
] | null | null | null | tests/test_recipes.py | tyler-a-cox/recipe-parsing | fa883f66a39063cf72912527628b082cda455e76 | [
"MIT"
] | null | null | null | tests/test_recipes.py | tyler-a-cox/recipe-parsing | fa883f66a39063cf72912527628b082cda455e76 | [
"MIT"
] | null | null | null | import unittest
class TestRecipes(unittest.TestCase):
"""
"""
def __init__(self):
"""
"""
pass
| 11.166667 | 37 | 0.485075 | 10 | 134 | 6.1 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.373134 | 134 | 11 | 38 | 12.181818 | 0.72619 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.25 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 4 |
2d2ac852429ad80674d7fd7650be5a7b70b8b62c | 172 | py | Python | detawane/channel.py | slow-query/detawane | 55f6d7c6ba6fbbd0dcb814f8f0a9624c6af91fad | [
"MIT"
] | null | null | null | detawane/channel.py | slow-query/detawane | 55f6d7c6ba6fbbd0dcb814f8f0a9624c6af91fad | [
"MIT"
] | 3 | 2020-05-29T03:57:45.000Z | 2021-04-30T21:19:35.000Z | detawane/channel.py | slow-query/detawane | 55f6d7c6ba6fbbd0dcb814f8f0a9624c6af91fad | [
"MIT"
] | null | null | null | class Channel:
def __init__(self, id, owner_name):
self.id = id
self.owner_name = owner_name
self.url = "https://www.youtube.com/channel/" + id
| 28.666667 | 58 | 0.610465 | 24 | 172 | 4.083333 | 0.541667 | 0.27551 | 0.265306 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.261628 | 172 | 5 | 59 | 34.4 | 0.771654 | 0 | 0 | 0 | 0 | 0 | 0.186047 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
2d37384555744ccd9236bc9f755a2a57205e8f9c | 82 | py | Python | HelloWorld/HelloWorld.py | NoteLyfe/hacktoberfest | 1d3b3d2aba659c9b6423aeae0c38693fc39b9eae | [
"Unlicense"
] | 1 | 2021-01-20T13:11:09.000Z | 2021-01-20T13:11:09.000Z | HelloWorld/HelloWorld.py | kumarlaxit/hacktoberfest | dfd3b5c65c5058640ac4ce2d229780d074162d0a | [
"Unlicense"
] | null | null | null | HelloWorld/HelloWorld.py | kumarlaxit/hacktoberfest | dfd3b5c65c5058640ac4ce2d229780d074162d0a | [
"Unlicense"
] | null | null | null | if __name__ == "__main__":
print("Hey there viewer")
print("Hello World") | 20.5 | 29 | 0.634146 | 10 | 82 | 4.4 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.207317 | 82 | 4 | 30 | 20.5 | 0.676923 | 0 | 0 | 0 | 0 | 0 | 0.421687 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0.666667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 4 |
741797f25e4a257e015c8e792d127d7287534a71 | 633 | py | Python | chapter 6/sampleCode28.py | DTAIEB/Thoughtful-Data-Science | 8b80e8f3e33b6fdc6672ecee1f27e0b983b28241 | [
"Apache-2.0"
] | 15 | 2018-06-01T19:18:32.000Z | 2021-11-28T03:31:35.000Z | chapter 6/sampleCode28.py | chshychen/Thoughtful-Data-Science | 8b80e8f3e33b6fdc6672ecee1f27e0b983b28241 | [
"Apache-2.0"
] | 1 | 2018-12-17T02:01:42.000Z | 2018-12-17T02:01:42.000Z | chapter 6/sampleCode28.py | chshychen/Thoughtful-Data-Science | 8b80e8f3e33b6fdc6672ecee1f27e0b983b28241 | [
"Apache-2.0"
] | 10 | 2018-09-23T02:45:45.000Z | 2022-03-12T15:32:05.000Z | [[TensorGraphApp]]
return """
{%if this.custom_graph%}
<div style="margin-top:10px" pd_refresh>
<pd_script>
self.graph = self.custom_graph if self.graph is not self.custom_graph else self.parent_pixieapp.graph
</pd_script>
<span style="font-weight:bold">Select a model to display:</span>
<select>
<option {%if this.graph!=this.custom_graph%}selected{%endif%} value="main">MobileNet</option>
<option {%if this.graph==this.custom_graph%}selected{%endif%} value="custom">Custom</options>
</select>
{%endif%}
<iframe seamless style="width:1200px;height:620px;border:0" srcdoc="{{code}}"></iframe>
"""
| 39.5625 | 101 | 0.696682 | 87 | 633 | 4.965517 | 0.528736 | 0.127315 | 0.104167 | 0.078704 | 0.231481 | 0.231481 | 0.231481 | 0.231481 | 0.231481 | 0.231481 | 0 | 0.018018 | 0.123223 | 633 | 15 | 102 | 42.2 | 0.76036 | 0 | 0 | 0 | 0 | 0.266667 | 0.947867 | 0.484992 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0.066667 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
741eedddcd73384f705741cb3c6205756b199ce6 | 184 | py | Python | database/__init__.py | BrianGlassman/Budget_Buckets | acf4f10662b0f3c3cf9db1254c5397c795fb6b9d | [
"MIT"
] | null | null | null | database/__init__.py | BrianGlassman/Budget_Buckets | acf4f10662b0f3c3cf9db1254c5397c795fb6b9d | [
"MIT"
] | 1 | 2020-06-06T14:15:18.000Z | 2020-06-23T00:05:36.000Z | database/__init__.py | BrianGlassman/Budget_Buckets | acf4f10662b0f3c3cf9db1254c5397c795fb6b9d | [
"MIT"
] | null | null | null | """
Database package
Handles all the reading and writing from the various databases
Ex.
Other scripts should import from the package for the sake of abstraction/encapsulation
"""
| 23 | 86 | 0.782609 | 26 | 184 | 5.538462 | 0.807692 | 0.097222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173913 | 184 | 7 | 87 | 26.285714 | 0.947368 | 0.951087 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
742e048da83289755cc9db7292b2a39044babada | 104 | py | Python | color_augmenter/apps.py | polyedr/drfx_colour_augmenter | 626551c32dc02fac9a4aebad13f389040ab8a5d9 | [
"MIT"
] | null | null | null | color_augmenter/apps.py | polyedr/drfx_colour_augmenter | 626551c32dc02fac9a4aebad13f389040ab8a5d9 | [
"MIT"
] | null | null | null | color_augmenter/apps.py | polyedr/drfx_colour_augmenter | 626551c32dc02fac9a4aebad13f389040ab8a5d9 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class ColorAugmenterConfig(AppConfig):
name = 'color_augmenter'
| 17.333333 | 38 | 0.788462 | 11 | 104 | 7.363636 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144231 | 104 | 5 | 39 | 20.8 | 0.910112 | 0 | 0 | 0 | 0 | 0 | 0.144231 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
745427a9456117801fe978671cc2e24a4a655dfa | 4,370 | py | Python | vrequest/pybrainfuck.py | cilame/vrequest | 01d98cbd384e9dcd11dfe76a094e8d34427b4c36 | [
"MIT"
] | 40 | 2019-04-09T08:09:16.000Z | 2022-03-16T07:44:30.000Z | vrequest/pybrainfuck.py | zhangsanfu/vrequest | 0a483bb4ea86452b03ccf33869c1ebcd3f6c6d32 | [
"MIT"
] | 1 | 2019-10-08T15:04:02.000Z | 2021-04-15T06:01:21.000Z | vrequest/pybrainfuck.py | zhangsanfu/vrequest | 0a483bb4ea86452b03ccf33869c1ebcd3f6c6d32 | [
"MIT"
] | 13 | 2019-10-25T01:10:59.000Z | 2021-12-22T05:43:17.000Z | # brainfuck 和 ook 的核心算法相同,共用一个脚本
# brainfuck
def evaluate(code:str):
code = cleanup(list(code))
bmap = buildbmap(code)
cells, ptr, cellptr, ret = [0], 0, 0, []
while ptr < len(code):
cmd = code[ptr]
if cmd == ">":
cellptr += 1
if cellptr == len(cells): cells.append(0)
if cmd == "<": cellptr = 0 if cellptr <= 0 else cellptr - 1
if cmd == "+": cells[cellptr] = cells[cellptr] + 1 if cells[cellptr] < 255 else 0
if cmd == "-": cells[cellptr] = cells[cellptr] - 1 if cells[cellptr] > 0 else 255
if cmd == "[" and cells[cellptr] == 0: ptr = bmap[ptr]
if cmd == "]" and cells[cellptr] != 0: ptr = bmap[ptr]
if cmd == ",": cells[cellptr] = b'\xff'
if cmd == ".": ret.append(chr(cells[cellptr]))
ptr += 1
return ''.join(ret)
def cleanup(code):
return ''.join(filter(lambda x: x in '.,[]<>+-', code))
def buildbmap(code):
_stack, bmap = [], {}
for pos, cmd in enumerate(code):
if cmd == "[": _stack.append(pos)
if cmd == "]":
start = _stack.pop()
bmap[start] = pos
bmap[pos] = start
return bmap
import re
# ook!
def parse_ook_to_brainfuckmap(string, abc=('!', '?', '.')):
maps = {
('!', '?'): '[',
('?', '!'): ']',
('.', '.'): '+',
('!', '!'): '-',
('.', '?'): '>',
('?', '.'): '<',
('!', '.'): '.',
('.', '!'): ',',
}
a, b, c = [i if i not in r'$()*+.[]?\/^{}' else '\\'+i for i in abc]
rexgep = '|'.join([a, b, c])
v = re.findall(rexgep, string)
r = []
for i in zip(v[::2],v[1::2]):
t = [j.replace(a[-1], '!')\
.replace(b[-1], '?')\
.replace(c[-1], '.') for j in i]
t = tuple(t)
r.append(maps.get(t))
return ''.join(r)
if __name__ == '__main__':
# 普通的 brainfuck
s = '>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.>>>++++++++[<++++>-]<.>>>++++++++++[<+++++++++>-]<---.<<<<.+++.------.--------.>>+.'
print(evaluate(s))
print()
# ook 加密实际上使用三个种类的字符以长度为2的组合来对应 brainfuck 里面的八个字符,
# 实际上里面的算法还是使用的 brainfuck 的算法
s = 'Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook! Ook.'
s = parse_ook_to_brainfuckmap(s)
print(s)
print(evaluate(s))
s = '''..... ..... ..... ..... !?!!. ?.... ..... ..... ..... .?.?! .?... .!...
..... ..... !.?.. ..... !?!!. ?!!!! !!?.? !.?!! !!!.. ..... ..... .!.?.
..... ...!? !!.?. ..... ..?.? !.?.. ..... .!.?. ..... ..... !?!!. ?!!!!
!!!!! !?.?! .?!.? ..... ....! ?!!.? ..... ...?. ?!.?. ..... !.?.. .....
!?!!. ?!!!! !!?.? !.?!! !!!!! !!!!. ..... ...!. ?.... ...!? !!.?. .....
?.?!. ?..!. ?.... ..... !?!!. ?!!!! !!!!? .?!.? !!!!! !!!!! !!!.? .....
..!?! !.?.. ....? .?!.? ....! .!!!. !!!!! !!!!! !!!!! !!.?. ..... .!?!!
.?... ...?. ?!.?. ..... !.!!! !!!!! !.?.. ..... ..!?! !.?.. ..... .?.?!
.?... ..... !.?.'''
s = parse_ook_to_brainfuckmap(s)
print(s)
print(evaluate(s))
print() | 50.813953 | 1,419 | 0.429291 | 550 | 4,370 | 3.374545 | 0.134545 | 0.908405 | 1.357759 | 1.803879 | 0.600216 | 0.586746 | 0.586746 | 0.586746 | 0.586746 | 0.586746 | 0 | 0.008511 | 0.24714 | 4,370 | 86 | 1,420 | 50.813953 | 0.555623 | 0.03135 | 0 | 0.123288 | 0 | 0.013699 | 0.524959 | 0.033357 | 0 | 0 | 0 | 0 | 0 | 1 | 0.054795 | false | 0 | 0.013699 | 0.013699 | 0.123288 | 0.09589 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
745dd42121dfd176c6e364605654bcba72ca08fd | 495 | py | Python | mycalculator/mycalculator_client.py | nidaizamir/Calculator-PY | e213f863520c4c608da338bffa4e765e4eaaab8d | [
"MIT"
] | null | null | null | mycalculator/mycalculator_client.py | nidaizamir/Calculator-PY | e213f863520c4c608da338bffa4e765e4eaaab8d | [
"MIT"
] | null | null | null | mycalculator/mycalculator_client.py | nidaizamir/Calculator-PY | e213f863520c4c608da338bffa4e765e4eaaab8d | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
mycalculator
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
from mycalculator.decorators import lazy_property
from mycalculator.configuration import Configuration
from mycalculator.controllers.simple_calculator_controller import SimpleCalculatorController
class MycalculatorClient(object):
config = Configuration
@lazy_property
def simple_calculator(self):
return SimpleCalculatorController()
| 21.521739 | 92 | 0.767677 | 48 | 495 | 7.8125 | 0.6875 | 0.128 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007194 | 0.157576 | 495 | 22 | 93 | 22.5 | 0.892086 | 0.234343 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.375 | 0.125 | 0.875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 4 |
7488ce482c3244f68d99983718b07d75845b50b7 | 94 | py | Python | app.py | j-jzk/donors_registry | 554290b5b928986af95fc3723e7b9634f3356f9f | [
"MIT"
] | 3 | 2020-08-03T15:00:02.000Z | 2021-05-26T13:54:08.000Z | app.py | j-jzk/donors_registry | 554290b5b928986af95fc3723e7b9634f3356f9f | [
"MIT"
] | 128 | 2020-08-29T07:30:53.000Z | 2022-01-24T07:04:13.000Z | app.py | j-jzk/donors_registry | 554290b5b928986af95fc3723e7b9634f3356f9f | [
"MIT"
] | 9 | 2020-07-18T16:53:24.000Z | 2021-05-20T08:27:19.000Z | """Create an application instance."""
from registry.app import create_app
app = create_app()
| 18.8 | 37 | 0.755319 | 13 | 94 | 5.307692 | 0.615385 | 0.26087 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12766 | 94 | 4 | 38 | 23.5 | 0.841463 | 0.329787 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
74901052cf31dc85aee0868077135d13ba2824f6 | 74,922 | py | Python | main.py | sandhyacv/bookstore-manager | 33141217b111fc0bf34601994a128d63944235a2 | [
"MIT"
] | 3 | 2022-01-27T11:55:23.000Z | 2022-01-28T12:36:38.000Z | main.py | sandhyacv/bookstore-manager | 33141217b111fc0bf34601994a128d63944235a2 | [
"MIT"
] | 8 | 2022-01-27T11:51:49.000Z | 2022-03-05T15:34:44.000Z | main.py | sandhyacv/bookstore-manager | 33141217b111fc0bf34601994a128d63944235a2 | [
"MIT"
] | 1 | 2022-01-31T07:01:55.000Z | 2022-01-31T07:01:55.000Z | # tkinter installation: `pip install tk`.
from tkinter import *
# import themed widgets and messagebox.
from tkinter import ttk, messagebox
from datetime import date
# mysql installation: mysql.com/downloads/.
import mysql.connector
# mode holds access level of current user.
mode = ""
# mysql connection.
mycon = mysql.connector.connect(host = "localhost",user = "root", passwd = "ladybug04", database = "bookstore")
def goodBye():
# displays a messagebox when the window/root is closed.
messagebox.showinfo("Bookstore Manager", "Thank You for Using BMS")
root.destroy()
def loggedOut():
# displays a messagebox when user logs out. moves user to welcome page.
messagebox.showinfo("Bookstore Manager", "Thank You for Using BMS")
welcomePage()
def clearEntry(event):
# clears text in entry widget when clicked inside.
event.widget.configure(state=NORMAL)
event.widget.delete(0, END)
def adminLogin(event=None):
global mode
# sets access mode to admin if username and password match.
if userVar.get() == "admin" and pswdVar.get() == "admin@123":
mode = "admin"
homeAdmin()
else:
messagebox.showerror("Bookstore Manager", "Enter correct username/password.")
def memberLogin(event=None):
# sets access mode to member and user id to corresponding customer id
# if name and contact exist in members.
global mode
global user
mycursor = mycon.cursor()
mycursor.execute(f"SELECT custid FROM customers WHERE name = '{userV.get()}' AND contact = '{pswdV.get()}' AND member = 'y'")
users = mycursor.fetchall()
if len(users) == 1:
user = users[0][0]
mode = "memb"
homeMember()
elif len(users) == 0:
messagebox.showerror("Bookstore Manager","Please enter valid name and contact.")
def welcomePage():
# root definition and configuration.
global root
root.destroy()
root = Tk()
root.title("Bookstore Management System")
root.geometry('960x540')
root.iconbitmap(r"images\bms.ico")
# window transparency.
root.attributes("-alpha", 0.95)
# calls goodBye() when window is closed.
root.wm_protocol("WM_DELETE_WINDOW", goodBye)
root.resizable(FALSE,FALSE)
# frame definition and configuration.
sty = ttk.Style()
sty.configure("Bookstore.TFrame", background="#FFFFFF", borderwidth=5, relief=FLAT)
mainframe = ttk.Frame(root, style="Bookstore.TFrame")
mainframe.grid(column=0, row=0)
# background images.
bgtitle = PhotoImage(file=r"images\welcometitle.png")
Label(mainframe, image = bgtitle, bg="#FFFFFF").grid(row=0, column=0, columnspan=8)
bgimage = PhotoImage(file=r"images\welcomecloud.png")
Label(mainframe, image = bgimage, bg="#FFFFFF").grid(row=0, column=8, rowspan=6)
# labels and admin mode button and customer mode button.
Label(mainframe, text = "Login As", font = ("Berlin Sans FB", 24), bg="#FFFFFF", fg="#2e2e2e").grid(row=1, column=0, sticky=(W), padx = 15)
Button(mainframe, text = "Admin", width = 20, bg="#2e2e2e", fg="#FFFFFF", font = ("Berlin Sans FB", 10), bd=2, cursor="hand2", relief=GROOVE, command = asAdmin).grid(row=2, column=0, pady = 5)
Button(mainframe, text = "Customer", width = 20, bg="#2e2e2e", fg="#FFFFFF", font = ("Berlin Sans FB", 10), bd=2, cursor="hand2", relief=GROOVE, command = asCustomer).grid(row=3, column=0, pady = 5)
root.mainloop()
def asAdmin():
global root
global userVar
global pswdVar
global clicked
# root definition and configuration.
root.destroy()
root = Tk()
root.title("Bookstore Management System")
root.geometry('960x540')
root.iconbitmap(r"images\bms.ico")
root.attributes("-alpha", 0.95)
root.wm_protocol("WM_DELETE_WINDOW", goodBye)
root.resizable(FALSE,FALSE)
# frame definition and configuration.
sty = ttk.Style()
sty.configure("Bookstore.TFrame", background="#FFFFFF", borderwidth=5, relief=FLAT)
mainframe = ttk.Frame(root, style="Bookstore.TFrame")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
# background image.
titleImg = PhotoImage(file = r"images\titlestrip.png").subsample(2,2)
Label(mainframe, image = titleImg, bg="#FFFFFF").grid(row=0, column=0)
Label(mainframe, text = "LOGIN", font = ("Berlin Sans FB", 24), bg="#FFFFFF", fg="#2e5170").grid(row=2, column=0, pady=30)
# username entry widget.
userVar = StringVar()
userEntry = Entry(mainframe, width=40, font=("Berlin Sans FB", 14), textvariable=userVar, fg="#2e2e2e", bg="#FFFFFF", borderwidth=1)
userEntry.insert(0, " Enter Username and Password")
userEntry.grid(row=4, column=0, ipady=10, pady=10)
# remove default text when entry widget is clicked.
clicked = userEntry.bind('<Button-1>', clearEntry)
# password entry widget.
pswdVar = StringVar()
pswdEntry = Entry(mainframe, width=40, font=("Berlin Sans FB", 14), textvariable=pswdVar, fg="#2e2e2e", bg="#FFFFFF", borderwidth=1, show = "*")
pswdEntry.insert(0, " xxx")
pswdEntry.grid(row=6, column=0, ipady=10, pady=10)
# remove default text when entry widget is clicked.
clicked = pswdEntry.bind('<Button-1>', clearEntry)
# login button and go back button.
Label(mainframe, text = " ", height=2, bg="#ffffff").grid(row=7, column=0)
Button(mainframe, text = "Login", pady = 5, width = 20, bg="#2e2e2e", fg="#FFFFFF", font = ("Berlin Sans FB", 14), bd=2, cursor="hand2", relief=GROOVE, command = adminLogin).grid(row=8, column=0, pady=10)
root.bind("<Return>", adminLogin)
Button(mainframe, text = "Go Back", pady=5, width = 20, bg="#9e9e9e", fg="#2e5170", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command=welcomePage).grid(row=9, column=0, pady=10)
root.mainloop()
def homeAdmin():
# holds search results.
results = []
def searchBox(evt):
# removes results from previous search.
for result in results:
result.destroy()
data = []
columns = ('ID', 'Book Name', 'Author', 'Genre', 'Price', 'New', 'Used')
data.append(columns)
# get current category and search box entry.
searchCtg.selection_clear()
if searchCtg.current() == 0:
pass
elif searchCtg.current() == 1:
ctg = "name"
elif searchCtg.current() == 2:
ctg = "author"
elif searchCtg.current() == 3:
ctg = "genre"
elif searchCtg.current() == 4:
ctg = "publisher"
se = searchEntry.get()
# retrieve data and display it.
mycursor = mycon.cursor()
mycursor.execute(f"SELECT bookid, name, author, genre, price, new, used FROM books WHERE {ctg} LIKE '%{se}%' ORDER BY {ctg}")
contain = mycursor.fetchall()
data.extend(contain[0:5])
rown = 5
# no results found.
if len(data) == 1:
empty = Label(mainframe, text = " No Matching Records", bg = "#FFFFFF", font = ("Berlin Sans FB", 16))
empty.grid(row=rown, column=0, columnspan = 5, sticky=(W), padx=10, pady=5)
results.append(empty)
rown = rown + 1
else:
for record in data:
# print records in columns.
# string formatting of this type requires monospaced fonts to print properly.
txt = "{: <5} {: <23} {: <23} {: <16} {: <8} {: <6} {: <6}".format(*record)
rec = Label(mainframe, text = txt, bg = "#FFFFFF", font = ("Courier", 12))
rec.grid(row=rown, column=0, columnspan = 5, sticky=(W), padx=10, pady=5)
results.append(rec)
rown = rown + 1
goback = Button(mainframe, text = "Go Back", pady=3, width = 12, bg="#9e9e9e", fg="#2e5170", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command=asAdmin)
goback.grid(row=rown, column=4, sticky=(E), padx=28, pady=10)
results.append(goback)
# root definition and configuration.
global root
root.destroy()
root = Tk()
root.title("Bookstore Management System")
root.geometry('960x540')
root.iconbitmap(r"images\bms.ico")
root.attributes("-alpha", 0.95)
root.wm_protocol("WM_DELETE_WINDOW", goodBye)
root.resizable(FALSE,FALSE)
# frame definition and configuration.
sty = ttk.Style()
sty.configure("Bookstore.TFrame", background="#FFFFFF", borderwidth=5, relief=FLAT)
mainframe = ttk.Frame(root, style="Bookstore.TFrame")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
# background image.
titleImg = PhotoImage(file = r"images\titlestrip.png").subsample(2,2)
Label(mainframe, image = titleImg, bg="#FFFFFF").grid(row=0, column=0, columnspan=5, rowspan=2)
Button(mainframe, text = "LOGOUT", width = 12, bg = "#41404A", fg = "#FFFFFF", font = ("Berlin Sans FB", 14), relief = FLAT, cursor="hand2", command = loggedOut).grid(row=1, column=4)
# menu buttons.
Button(mainframe, text = "Book Procured", width=14, bg="#9e9e9e", fg="#2e5170", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command = bookProcured).grid(row=2, column=0, pady=10)
Button(mainframe, text = "Reserve Book", width=14, bg="#9e9e9e", fg="#2e5170", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command = bookReserved).grid(row=2, column=1, pady=10)
Button(mainframe, text = "Check Out", width=14, bg="#9e9e9e", fg="#2e5170", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command = CheckOut).grid(row=2, column=2, pady=10)
Button(mainframe, text = "Book Details", width=14, bg="#9e9e9e", fg="#2e5170", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command = bookDetails).grid(row=2, column=3, pady=10)
Button(mainframe, text = "Member Details", width=14, bg="#9e9e9e", fg="#2e5170", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command = editMember).grid(row=2, column=4, pady=10)
# search category combobox. choose category to search in.
global searchCtg
searchVar = StringVar()
searchCtg = ttk.Combobox(mainframe, textvariable = searchVar, font=("Berlin Sans FB", 16), width=9, foreground="#2e2e2e", background="#FFFFFF")
searchCtg['values'] = (' Search By', ' Book Name', ' Author', ' Genre', ' Publisher')
searchCtg.current(0)
searchCtg.state(["readonly"])
# searchCtg.bind('<<ComboboxSelected>>', searchBox)
mainframe.option_add('*TCombobox*Listbox.font', ("Berlin Sans FB", 16))
searchCtg.grid(row=3, column=0, ipadx=4, ipady=3, pady=14)
# search entry box. enter what to search for.
search = StringVar()
searchEntry = Entry(mainframe, width=54, font=("Berlin Sans FB", 16), textvariable=search, fg="#2e2e2e", bg="#FFFFFF", borderwidth=1)
searchEntry.insert(0, " Enter Search Query")
searchEntry.grid(row=3, column=1, columnspan=4, ipadx=5, ipady=5, padx=10, pady=14)
root.bind("<Return>", searchBox)
clicked = searchEntry.bind('<Button-1>', clearEntry)
# clear button and go back button.
Button(mainframe, text = "Clear", width = 12, bg = "#41404A", fg = "#FFFFFF", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command = lambda: searchEntry.delete(0, END)).grid(row=4, column=4, sticky=(E), padx=28)
gbk = Button(mainframe, text = "Go Back", pady=3, width = 12, bg="#9e9e9e", fg="#2e5170", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command=asAdmin)
gbk.grid(row=5, column=4, sticky=(E), padx=28, pady=10)
results.append(gbk)
root.mainloop()
def asCustomer():
#root definition and configuration.
global root
root.destroy()
root = Tk()
root.title("Bookstore Management System")
root.geometry('960x540')
root.iconbitmap(r"images\bms.ico")
root.attributes("-alpha", 0.95)
root.wm_protocol("WM_DELETE_WINDOW", goodBye)
root.resizable(FALSE,FALSE)
# frame definition and configuration.
sty = ttk.Style()
sty.configure("Bookstore.TFrame", background="#FFFFFF", borderwidth=5, relief=FLAT)
mainframe = ttk.Frame(root, style="Bookstore.TFrame")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
# background image.
titleImg = PhotoImage(file = r"images\titlestrip.png").subsample(2,2)
Label(mainframe, image = titleImg, bg="#FFFFFF").grid(row=0, column=0, columnspan=2)
Label(mainframe, text = "MEMBER LOGIN", font = ("Berlin Sans FB", 24), bg="#FFFFFF", fg="#2e5170").grid(row=1, column=0, pady=15, columnspan=2)
# username entry widget.
global userV
userV = StringVar()
userE = Entry(mainframe, width=40, font=("Berlin Sans FB", 14), textvariable=userV, fg="#2e2e2e", bg="#FFFFFF", borderwidth=1)
userE.insert(0, " Enter Name and Contact Number")
userE.grid(row=2, column=0, ipady=10, pady=10, columnspan=2)
# clear default text when entry widget is clicked.
clicked = userE.bind('<Button-1>', clearEntry)
# password entry widget.
global pswdV
pswdV = StringVar()
pswdE = Entry(mainframe, width=40, font=("Berlin Sans FB", 14), textvariable=pswdV, fg="#2e2e2e", bg="#FFFFFF", borderwidth=1, show="x")
pswdE.insert(0, " xxxxxxxxxx")
pswdE.grid(row=3, column=0, ipady=10, pady=10, columnspan=2)
# clear default text when entry widget is clicked.
clicked = pswdE.bind('<Button-1>', clearEntry)
# login button and guest button.
Label(mainframe, text = " ", height=2, bg="#ffffff").grid(row=4, column=0, columnspan=2)
Button(mainframe, text = "Login", pady = 5, width = 20, bg="#2e2e2e", fg="#FFFFFF", font = ("Berlin Sans FB", 14), bd=2, cursor="hand2", relief=GROOVE, command = memberLogin).grid(row=5, column=0, pady=10, columnspan=2)
Label(mainframe, text = "OR", font = ("Berlin Sans FB", 16), bg="#FFFFFF", fg="#2e5170").grid(row=6, column=0, pady=10, columnspan=2)
Button(mainframe, text = "Continue as Guest", pady = 5, width = 20, bg="#2e2e2e", fg="#FFFFFF", font = ("Berlin Sans FB", 14), bd=2, cursor="hand2", relief=GROOVE, command = homeGuest).grid(row=7, column=0, pady=10, columnspan=2)
# enter/return key bound to call memberLogin.
root.bind("<Return>", memberLogin)
# go back button.
Button(mainframe, text = "Go Back", pady=5, width = 15, bg="#9e9e9e", fg="#2e5170", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command=welcomePage).grid(row=7, column=1, pady=10, sticky=(E), padx=25)
root.mainloop()
def homeMember():
# search results
results = []
def searchBox(evt):
# removes results from previous search.
for result in results:
result.destroy()
data = []
columns = ('ID', 'Book Name', 'Author', 'Genre', 'Price', 'New', 'Used')
data.append(columns)
# get current category and search box entry.
searchCtg.selection_clear()
if searchCtg.current() == 0:
pass
elif searchCtg.current() == 1:
ctg = "name"
elif searchCtg.current() == 2:
ctg = "author"
elif searchCtg.current() == 3:
ctg = "genre"
elif searchCtg.current() == 4:
ctg = "publisher"
se = searchEntry.get()
# retrieve data and display it.
mycursor = mycon.cursor()
mycursor.execute(f"SELECT bookid, name, author, genre, price, new, used FROM books WHERE {ctg} LIKE '%{se}%' ORDER BY {ctg}")
contain = mycursor.fetchall()
data.extend(contain[0:5])
# rown = 5
rown = 4
if len(data) == 1:
empty = Label(mainframe, text = " No Matching Records", bg = "#FFFFFF", font = ("Berlin Sans FB", 16))
empty.grid(row=rown, column=0, columnspan = 5, sticky=(W), padx=10, pady=5)
results.append(empty)
rown = rown + 1
else:
for record in data:
txt = "{: <5} {: <23} {: <23} {: <16} {: <8} {: <6} {: <6}".format(*record)
# string formatting of this type requires monospaced fonts to print properly.
rec = Label(mainframe, text = txt, bg = "#FFFFFF", font = ("Courier", 12))
rec.grid(row=rown, column=0, columnspan = 5, sticky=(W), padx=10, pady=5)
results.append(rec)
rown = rown + 1
goback = Button(mainframe, text = "Go Back", pady=3, width = 12, bg="#9e9e9e", fg="#2e5170", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command=asCustomer)
goback.grid(row=rown, column=1, sticky=(E), padx=28, pady=10)
results.append(goback)
# root definition and configuration.
global root
root.destroy()
root = Tk()
root.title("Bookstore Management System")
root.geometry('960x540')
root.iconbitmap(r"images\bms.ico")
root.attributes("-alpha", 0.95)
root.wm_protocol("WM_DELETE_WINDOW", goodBye)
root.resizable(FALSE,FALSE)
# frame definition and configuration.
sty = ttk.Style()
sty.configure("Bookstore.TFrame", background="#FFFFFF", borderwidth=5, relief=FLAT)
mainframe = ttk.Frame(root, style="Bookstore.TFrame")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
# background image.
titleImg = PhotoImage(file = r"images\titlestrip.png").subsample(2,2)
Label(mainframe, image = titleImg, bg="#FFFFFF").grid(row=0, column=0, columnspan=2, rowspan=2)
Button(mainframe, text = "LOGOUT", width = 12, bg = "#41404A", fg = "#FFFFFF", font = ("Berlin Sans FB", 14), relief = "flat", cursor="hand2", command = loggedOut).grid(row=1, column=1, sticky=(E), padx=45)
# menu button.
Button(mainframe, text = "Reserve Book", width=18, bg="#9e9e9e", fg="#2e5170", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command = bookReserved).grid(row=3, column=0)
# search category combobox. choose category to search in.
global searchCtg
searchVar = StringVar()
searchCtg = ttk.Combobox(mainframe, textvariable = searchVar, font=("Berlin Sans FB", 16), width=12, foreground="#2e2e2e", background="#FFFFFF")
searchCtg['values'] = (' Search By', ' Book Name', ' Author', ' Genre', ' Publisher')
searchCtg.current(0)
searchCtg.state(["readonly"])
# searchCtg.bind('<<ComboboxSelected>>', searchBox)
mainframe.option_add('*TCombobox*Listbox.font', ("Berlin Sans FB", 16))
searchCtg.grid(row=2, column=0, ipadx=4, ipady=3)
# search entry box. enter what to search for.
search = StringVar()
searchEntry = Entry(mainframe, width=50, font=("Berlin Sans FB", 16), textvariable=search, fg="#2e2e2e", bg="#FFFFFF", borderwidth=1)
searchEntry.insert(0, " Enter Search Query")
searchEntry.grid(row=2, column=1, ipadx=5, ipady=5, pady=10)
root.bind("<Return>", searchBox)
clicked = searchEntry.bind('<Button-1>', clearEntry)
# clear and go back buttons.
Button(mainframe, text = "Clear", width = 12, bg = "#41404A", fg = "#FFFFFF", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command = lambda: searchEntry.delete(0, END)).grid(row=3, column=1, sticky=(E), padx=28)
gbk = Button(mainframe, text = "Go Back", pady=3, width = 12, bg="#9e9e9e", fg="#2e5170", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command=asCustomer)
gbk.grid(row=4, column=1, sticky=(E), padx=28, pady=10)
results.append(gbk)
root.mainloop()
def homeGuest():
# search results
results = []
def searchBox(evt):
# removes results from previous search.
for result in results:
result.destroy()
data = []
columns = ('ID', 'Book Name', 'Author', 'Genre', 'Price', 'New', 'Used')
data.append(columns)
# get current category and search box entry.
searchCtg.selection_clear()
if searchCtg.current() == 0:
pass
elif searchCtg.current() == 1:
ctg = "name"
elif searchCtg.current() == 2:
ctg = "author"
elif searchCtg.current() == 3:
ctg = "genre"
elif searchCtg.current() == 4:
ctg = "publisher"
se = searchEntry.get()
# retrieve data and display it.
mycursor = mycon.cursor()
mycursor.execute(f"SELECT bookid, name, author, genre, price, new, used FROM books WHERE {ctg} LIKE '%{se}%' ORDER BY {ctg}")
contain = mycursor.fetchall()
data.extend(contain[0:5])
# rown = 5
rown = 4
if len(data) == 1:
empty = Label(mainframe, text = " No Matching Records", bg = "#FFFFFF", font = ("Berlin Sans FB", 16))
empty.grid(row=rown, column=0, columnspan = 5, sticky=(W), padx=10, pady=5)
results.append(empty)
rown = rown + 1
else:
for record in data:
txt = "{: <5} {: <23} {: <23} {: <16} {: <8} {: <6} {: <6}".format(*record)
# string formatting of this type requires monospaced fonts to print properly.
rec = Label(mainframe, text = txt, bg = "#FFFFFF", font = ("Courier", 12))
rec.grid(row=rown, column=0, columnspan = 5, sticky=(W), padx=10, pady=5)
results.append(rec)
rown = rown + 1
goback = Button(mainframe, text = "Go Back", pady=3, width = 12, bg="#9e9e9e", fg="#2e5170", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command=asCustomer)
goback.grid(row=rown, column=1, sticky=(E), padx=28, pady=10)
results.append(goback)
# root definition and configuration.
global root
root.destroy()
root = Tk()
root.title("Bookstore Management System")
root.geometry('960x540')
root.iconbitmap(r"images\bms.ico")
root.attributes("-alpha", 0.95)
root.wm_protocol("WM_DELETE_WINDOW", goodBye)
root.resizable(FALSE,FALSE)
# frame definition and configuration.
sty = ttk.Style()
sty.configure("Bookstore.TFrame", background="#FFFFFF", borderwidth=5, relief=FLAT)
mainframe = ttk.Frame(root, style="Bookstore.TFrame")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
# background image.
titleImg = PhotoImage(file = r"images\titlestrip.png").subsample(2,2)
Label(mainframe, image = titleImg, bg="#FFFFFF").grid(row=0, column=0, columnspan=2, rowspan=2)
Button(mainframe, text = "LOGOUT", width = 12, bg = "#41404A", fg = "#FFFFFF", font = ("Berlin Sans FB", 14), relief = "flat", cursor="hand2", command = loggedOut).grid(row=1, column=1, sticky=(E), padx=45)
# search category combobox. choose category to search in.
global searchCtg
searchVar = StringVar()
searchCtg = ttk.Combobox(mainframe, textvariable = searchVar, font=("Berlin Sans FB", 16), width=12, foreground="#2e2e2e", background="#FFFFFF")
searchCtg['values'] = (' Search By', ' Book Name', ' Author', ' Genre', ' Publisher')
searchCtg.current(0)
searchCtg.state(["readonly"])
# searchCtg.bind('<<ComboboxSelected>>', searchBox)
mainframe.option_add('*TCombobox*Listbox.font', ("Berlin Sans FB", 16))
searchCtg.grid(row=2, column=0, ipadx=4, ipady=3)
# search entry box. enter what to search for.
search = StringVar()
searchEntry = Entry(mainframe, width=50, font=("Berlin Sans FB", 16), textvariable=search, fg="#2e2e2e", bg="#FFFFFF", borderwidth=1)
searchEntry.insert(0, " Enter Search Query")
searchEntry.grid(row=2, column=1, ipadx=5, ipady=5, pady=10)
root.bind("<Return>", searchBox)
clicked = searchEntry.bind('<Button-1>', clearEntry)
# clear and go back buttons.
Button(mainframe, text = "Clear", width = 15, bg="#9e9e9e", fg="#2e5170", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command = lambda: searchEntry.delete(0, END)).grid(row=3, column=1, sticky=(E), padx=28)
gbk = Button(mainframe, text = "Go Back", pady=3, width = 15, bg="#9e9e9e", fg="#2e5170", font = ("Berlin Sans FB", 14), cursor="hand2", relief=GROOVE, command=asCustomer)
gbk.grid(row=4, column=1, sticky=(E), padx=28, pady=10)
results.append(gbk)
root.mainloop()
def bookProcured():
def addTrans():
# ADD button is clicked.
# bill total.
Atotal = float(addBookPriceE.get())*int(addCopiesE.get())
Label(addTransF, text=str(Atotal), bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=9, column=1)
# adding records to "fromven" table.
mycursor = mycon.cursor()
mycursor.execute(f"INSERT INTO fromven(vendid,bookid,copies,cost) VALUES ({int(addSuppIDE.get())},{int(addBookIDE.get())},{int(addCopiesE.get())},{Atotal})")
mycon.commit()
# mycursor.execute(f"INSERT INTO vendors(vendid,name,contact) VALUES ({int(addSuppIDE.get())},'{addSuppNameE.get()}','{addContactE.get()}') ON DUPLICATE KEY UPDATE")
mycon.commit()
# clear all entries after adding
addBookPriceE.delete(0, END)
addBookIDE.delete(0, END)
addContactE.delete(0, END)
addSuppNameE.delete(0, END)
addCopiesE.delete(0, END)
addSuppIDE.delete(0, END)
# updates transaction id.
tid.destroy()
mycursor = mycon.cursor()
mycursor.execute("SELECT transid FROM fromven ORDER BY transid DESC LIMIT 1")
transid = mycursor.fetchone()
transactionid = transid[0]+1
trid = Label(addTransF, text=transactionid, bg="#FFFFFF", font = ("Berlin Sans FB", 12))
trid.grid(row=3, column=1, sticky=(W), padx=10, pady=10)
return
def modTrans():
# MODIFY button is clicked.
# new bill total.
Mtotal = int(modBookPriceE.get())*int(modCopiesE.get())
Label(modTransF, text=str(Mtotal), bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=9, column=1)
# update records in "fromven" table.
mycursor = mycon.cursor()
mycursor.execute(f"UPDATE fromven SET vendid = {int(modSuppIDE.get())}, bookid = {int(modBookIDE.get())}, copies = {int(modCopiesE.get())}, cost = {Mtotal} WHERE transid = {int(modTransIDE.get())}")
mycon.commit()
# clear all entries after adding
modBookPriceE.delete(0, END)
modBookIDE.delete(0, END)
modContactE.delete(0, END)
modSuppNameE.delete(0, END)
modCopiesE.delete(0, END)
modSuppIDE.delete(0, END)
modTransIDE.delete(0, END)
return
def delTrans():
# REMOVE button is clicked.
# remove records from "fromven" table.
mycursor = mycon.cursor()
mycursor.execute(f"DELETE FROM fromven WHERE transid = {int(delTransIDE.get())}")
mycon.commit()
# clear all entries after removing
delTransIDE.delete(0, END)
return
# root definition and configuration.
global root
root.destroy()
root = Tk()
root.title("Bookstore Management System")
root.geometry('960x540')
root.iconbitmap(r"images\bms.ico")
root.attributes("-alpha", 0.95)
root.wm_protocol("WM_DELETE_WINDOW", goodBye)
root.resizable(FALSE,FALSE)
# styles.
sty1 = ttk.Style()
sty1.configure("Bookstore.TFrame", background="#FFFFFF", borderwidth=5, relief=FLAT)
sty2 = ttk.Style()
sty2.configure("Bookstore.TNotebook", background="#FFFFFF", padding=10, tabmargins=2)
sty3 = ttk.Style()
sty3.configure("Bookstore.TNotebook.Tab", font=("Berlin Sans FB", 12), padding=5)
# mainframe definition and configuration.
mainframe = ttk.Frame(root, style="Bookstore.TFrame")
mainframe.grid(column=0, row=0)
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
# background image.
titleImg = PhotoImage(file = r"images\titlestrip.png").subsample(2,2)
Label(mainframe, image = titleImg, bg="#FFFFFF").grid(row=0, column=0, columnspan=6, rowspan=2)
Button(mainframe, text = "LOGOUT", width = 12, bg = "#41404A", fg = "#FFFFFF", font = ("Berlin Sans FB", 12), relief = "flat", cursor="hand2", command = loggedOut).grid(row=1, column=5)
# notebook and frames definition.
procureNBK = ttk.Notebook(mainframe, width=940, height=390, style="Bookstore.TNotebook")
addTransF = ttk.Frame(procureNBK, style="Bookstore.TFrame")
modTransF = ttk.Frame(procureNBK, style="Bookstore.TFrame")
delTransF = ttk.Frame(procureNBK, style="Bookstore.TFrame")
procureNBK.add(addTransF, text='New Supplier Transaction', padding=5)
procureNBK.add(modTransF, text='Modify Supplier Transaction', padding=5)
procureNBK.add(delTransF, text='Remove Supplier Transaction', padding=5)
procureNBK.grid(row=2, column=0, columnspan=6, sticky=(W))
# add transaction frame.
# transaction id is auto incremented.
Label(addTransF, text="Transaction ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=3, column=0, sticky=(E), padx=10, pady=10)
mycursor = mycon.cursor()
mycursor.execute("SELECT transid FROM fromven ORDER BY transid DESC LIMIT 1")
transid = mycursor.fetchone()
transactionid = transid[0]+1
tid = Label(addTransF, text=transactionid, bg="#FFFFFF", font = ("Berlin Sans FB", 12))
tid.grid(row=3, column=1, sticky=(W), padx=10, pady=10)
# labels and entry widgets for transaction details.
addSuppID = StringVar()
Label(addTransF, text="Supplier ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=4, column=0, sticky=(E), padx=10, pady=10)
addSuppIDE = Entry(addTransF, textvariable=addSuppID, width=40, font = ("Berlin Sans FB", 12), bd=2)
addSuppIDE.grid(row=4, column=1, padx=10, pady=10, columnspan=3)
addSuppName = StringVar()
Label(addTransF, text="Supplier Name:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=5, column=0, sticky=(E), padx=10, pady=10)
addSuppNameE = Entry(addTransF, textvariable=addSuppName, width=40, font = ("Berlin Sans FB", 12), bd=2)
addSuppNameE.grid(row=5, column=1, padx=10, pady=10, columnspan=3)
addContact = StringVar()
Label(addTransF, text=" Phone Number:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=6, column=0, sticky=(E), padx=10, pady=10)
addContactE = Entry(addTransF, textvariable=addContact, width=40, font = ("Berlin Sans FB", 12), bd=2)
addContactE.grid(row=6, column=1, padx=10, pady=10, columnspan=3)
addBookID = StringVar()
Label(addTransF, text="Book ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=7, column=0, sticky=(E), padx=10, pady=10)
addBookIDE = Entry(addTransF, textvariable=addBookID, width=40, font = ("Berlin Sans FB", 12), bd=2)
addBookIDE.grid(row=7, column=1, padx=10, pady=10, columnspan=3)
addBookPrice = StringVar()
Label(addTransF, text="Book Price:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=8, column=0, sticky=(E), padx=10, pady=10)
addBookPriceE = Entry(addTransF, textvariable=addBookPrice, width=10, font = ("Berlin Sans FB", 12), bd=2)
addBookPriceE.grid(row=8, column=1, padx=10, pady=10)
addCopies = StringVar()
Label(addTransF, text="Number of Copies:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=8, column=2, sticky=(E), padx=10, pady=10)
addCopiesE = Entry(addTransF, textvariable=addCopies, width=10, font = ("Berlin Sans FB", 12), bd=2)
addCopiesE.grid(row=8, column=3, padx=10, pady=10)
Label(addTransF, text="Total Cost:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=9, column=0, sticky=(E), padx=10, pady=10)
# add and go back button.
Button(addTransF, text="Add", command=addTrans, width=17, cursor="hand2", font = ("Berlin Sans FB", 12)).grid(row=10, column=4, padx=20, pady=10)
Button(addTransF, text = "Go Back", width = 10, pady=2, font = ("Berlin Sans FB", 12), cursor="hand2", command=homeAdmin).grid(row=10, column=5, sticky=(E), padx=15, pady=10)
# modify transaction frame.
# labels and entry widgets for transaction details.
modTransID = StringVar()
Label(modTransF, text="Transaction ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=3, column=0, sticky=(E), padx=10, pady=10)
modTransIDE = Entry(modTransF, textvariable=modTransID, width=40, font = ("Berlin Sans FB", 12), bd=2)
modTransIDE.grid(row=3, column=1, padx=10, pady=10, columnspan=3)
modSuppID = StringVar()
Label(modTransF, text="Supplier ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=4, column=0, sticky=(E), padx=10, pady=10)
modSuppIDE = Entry(modTransF, textvariable=modSuppID, width=40, font = ("Berlin Sans FB", 12), bd=2)
modSuppIDE.grid(row=4, column=1, padx=10, pady=10, columnspan=3)
modSuppName = StringVar()
Label(modTransF, text="Supplier Name:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=5, column=0, sticky=(E), padx=10, pady=10)
modSuppNameE = Entry(modTransF, textvariable=modSuppName, width=40, font = ("Berlin Sans FB", 12), bd=2)
modSuppNameE.grid(row=5, column=1, padx=10, pady=10, columnspan=3)
modContact = StringVar()
Label(modTransF, text=" Phone Number:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=6, column=0, sticky=(E), padx=10, pady=10)
modContactE = Entry(modTransF, textvariable=modContact, width=40, font = ("Berlin Sans FB", 12), bd=2)
modContactE.grid(row=6, column=1, padx=10, pady=10, columnspan=3)
modBookID = StringVar()
Label(modTransF, text="Book ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=7, column=0, sticky=(E), padx=10, pady=10)
modBookIDE = Entry(modTransF, textvariable=modBookID, width=40, font = ("Berlin Sans FB", 12), bd=2)
modBookIDE.grid(row=7, column=1, padx=10, pady=10, columnspan=3)
modBookPrice = StringVar()
Label(modTransF, text="Book Price:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=8, column=0, sticky=(E), padx=10, pady=10)
modBookPriceE = Entry(modTransF, textvariable=modBookPrice, width=10, font = ("Berlin Sans FB", 12), bd=2)
modBookPriceE.grid(row=8, column=1, padx=10, pady=10)
modCopies = StringVar()
Label(modTransF, text="Number of Copies:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=8, column=2, sticky=(E), padx=10, pady=10)
modCopiesE = Entry(modTransF, textvariable=modCopies, width=10, font = ("Berlin Sans FB", 12), bd=2)
modCopiesE.grid(row=8, column=3, padx=10, pady=10)
Label(modTransF, text="Total Cost:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=9, column=0, sticky=(E), padx=10, pady=10)
# modify and go back button.
Button(modTransF, text="Modify", command=modTrans, width=17, cursor="hand2", font = ("Berlin Sans FB", 12)).grid(row=10, column=4, padx=20, pady=10)
Button(modTransF, text = "Go Back", width = 10, pady=2, font = ("Berlin Sans FB", 12), cursor="hand2", command=homeAdmin).grid(row=10, column=5, sticky=(E), padx=15, pady=10)
# remove transaction frame.
delTransID = StringVar()
Label(delTransF, text=" Transaction ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=3, column=0, padx=10, pady=10)
delTransIDE = Entry(delTransF, textvariable=delTransID, width=40, font = ("Berlin Sans FB", 12), bd=2)
delTransIDE.grid(row=3, column=1, padx=10, pady=10, columnspan=3)
# remove and go back button.
Button(delTransF, text="Remove", command=delTrans, width=17, cursor="hand2", font = ("Berlin Sans FB", 12)).grid(row=4, column=4, padx=20, pady=40)
Button(delTransF, text = "Go Back", width = 10, pady=2, font = ("Berlin Sans FB", 12), cursor="hand2", command=homeAdmin).grid(row=4, column=5, sticky=(E), padx=15, pady=10)
root.mainloop()
def bookReserved():
def addRes():
# add button clicked.
# adding record to "reserved" table.
mycursor = mycon.cursor()
# mycursor.execute(f"INSERT INTO reserved(custid, bookid, copies, date, fulfilled) VALUES ({int(addCustIDE.get())},{int(addBookIDE.get())},{int(addCopiesE.get())},{addDateE.get()},{addFulfilledE.get()})")
if mode == "memb":
mycursor.execute(f"INSERT INTO reserved(custid, bookid, copies, date) VALUES ({int(user)},{int(addBookIDE.get())},{int(addCopiesE.get())},'{str(date.today())}')")
mycon.commit()
elif mode == "admin":
mycursor.execute(f"INSERT INTO reserved(custid, bookid, copies, date) VALUES ({int(addCustIDE.get())},{int(addBookIDE.get())},{int(addCopiesE.get())},'{str(date.today())}')")
mycon.commit()
addCustIDE.delete(0, END)
# clear all entries after adding
addBookIDE.delete(0, END)
addCopiesE.delete(0, END)
# addDateE.delete(0, END)
# addFulfilledE.delete(0, END)
# updates reservation id.
rid.destroy()
mycursor = mycon.cursor()
mycursor.execute("SELECT resid FROM reserved ORDER BY resid DESC LIMIT 1")
transid = mycursor.fetchone()
transactionid = transid[0]+1
trid = Label(addResF, text=transactionid, bg="#FFFFFF", font = ("Berlin Sans FB", 12))
trid.grid(row=3, column=1, sticky=(W), padx=10, pady=10)
return
def modRes():
# modify button clicked.
# updating record in "reserved" table.
mycursor = mycon.cursor()
mycursor.execute(f"UPDATE reserved SET custid = {int(modCustIDE.get())}, bookid = {int(modBookIDE.get())}, copies = {int(modCopiesE.get())}, date = '{modDateE.get()}', fulfilled = '{modFulfilledE.get()}' WHERE resid = {int(modResIDE.get())}")
mycon.commit()
# clear all entries after modifying
modResIDE.delete(0, END)
modCustIDE.delete(0, END)
modBookIDE.delete(0, END)
modCopiesE.delete(0, END)
modDateE.delete(0, END)
modFulfilledE.delete(0, END)
return
def delRes():
# remove button clicked.
# deleting record from "reserved" table.
mycursor = mycon.cursor()
mycursor.execute(f"DELETE FROM reserved WHERE resid = {int(delResIDE.get())}")
mycon.commit()
# clear all entries after removing
delResIDE.delete(0, END)
return
# root definition and configuration.
global root
root.destroy()
root = Tk()
root.title("Bookstore Management System")
root.geometry('960x540')
root.iconbitmap(r"images\bms.ico")
root.attributes("-alpha", 0.95)
root.wm_protocol("WM_DELETE_WINDOW", goodBye)
root.resizable(FALSE,FALSE)
# styles.
sty1 = ttk.Style()
sty1.configure("Bookstore.TFrame", background="#FFFFFF", borderwidth=5, relief=FLAT)
sty2 = ttk.Style()
sty2.configure("Bookstore.TNotebook", background="#FFFFFF", padding=10, tabmargins=2)
sty3 = ttk.Style()
sty3.configure("Bookstore.TNotebook.Tab", font=("Berlin Sans FB", 12), padding=5)
# mainframe definition and configuration.
mainframe = ttk.Frame(root, style="Bookstore.TFrame")
mainframe.grid(column=0, row=0)
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
# background image.
titleImg = PhotoImage(file = r"images\titlestrip.png").subsample(2,2)
Label(mainframe, image = titleImg, bg="#FFFFFF").grid(row=0, column=0, columnspan=4, rowspan=2)
Button(mainframe, text = "LOGOUT", width = 12, bg = "#41404A", fg = "#FFFFFF", font = ("Berlin Sans FB", 12), relief = "flat", cursor="hand2", command = loggedOut).grid(row=1, column=3)
# notebook and frames definition.
reserveNBK = ttk.Notebook(mainframe, width=940, height=390, style="Bookstore.TNotebook")
addResF = ttk.Frame(reserveNBK, style="Bookstore.TFrame")
modResF = ttk.Frame(reserveNBK, style="Bookstore.TFrame")
delResF = ttk.Frame(reserveNBK, style="Bookstore.TFrame")
reserveNBK.add(addResF, text='New Reservation', padding=40)
reserveNBK.add(modResF, text='Modify Reservation', padding=40)
reserveNBK.add(delResF, text='Remove Reservation', padding=40)
reserveNBK.grid(row=2, column=0, columnspan=4, sticky=(W))
# add reservation frame.
# reservation id is auto-incremented.
Label(addResF, text="Reservation ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=3, column=0, sticky=(E), padx=10, pady=10)
mycursor = mycon.cursor()
mycursor.execute("SELECT resid FROM reserved ORDER BY resid DESC LIMIT 1")
resid = mycursor.fetchone()
reservationid = resid[0]+1
rid = Label(addResF, text=reservationid, bg="#FFFFFF", font = ("Berlin Sans FB", 12))
rid.grid(row=3, column=1, sticky=(W), padx=10, pady=10)
# labels and entry widgets for reservation details.
addCustID = StringVar()
Label(addResF, text="Customer ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=4, column=0, sticky=(E), padx=10, pady=10)
if mode == "memb":
# user id automatically displayed for members.
Label(addResF, text=user, bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=4, column=1, sticky=(W), padx=10, pady=10)
elif mode == "admin":
addCustIDE = Entry(addResF, textvariable=addCustID, width=40, font = ("Berlin Sans FB", 12), bd=2)
addCustIDE.grid(row=4, column=1, padx=10, pady=10)
addBookID = StringVar()
Label(addResF, text="Book IDs:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=5, column=0, sticky=(E), padx=10, pady=10)
addBookIDE = Entry(addResF, textvariable=addBookID, width=40, font = ("Berlin Sans FB", 12), bd=2)
addBookIDE.grid(row=5, column=1, padx=10, pady=10)
addCopies = StringVar()
Label(addResF, text="Copies:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=6, column=0, sticky=(E), padx=10, pady=10)
addCopiesE = Entry(addResF, textvariable=addCopies, width=40, font = ("Berlin Sans FB", 12), bd=2)
addCopiesE.grid(row=6, column=1, padx=10, pady=10)
# addDate = StringVar()
Label(addResF, text="Date:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=7, column=0, sticky=(E), padx=10, pady=10)
Label(addResF, text = str(date.today()), bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=7, column=1, sticky=(W), padx=10, pady=10)
# addDateE = Entry(addResF, textvariable=addDate, width=40, font = ("Berlin Sans FB", 12), bd=2)
# addDateE.grid(row=7, column=1, padx=10, pady=10)
# new reservations would anyways be unfulfilled?
# addFulfilled = StringVar()
# Label(addResF, text="Fulfilled(y/n):", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=8, column=0, sticky=(E), padx=10, pady=10)
# addFulfilledE = Entry(addResF, textvariable=addFulfilled, width=40, font = ("Berlin Sans FB", 12), bd=2)
# addFulfilledE.grid(row=8, column=1, padx=10, pady=10)
# add button.
Button(addResF, text="Add", command=addRes, cursor="hand2", width=17, font = ("Berlin Sans FB", 12)).grid(row=9, column=2, padx=20, pady=40)
# go back button.
if mode == "admin":
Button(addResF, text = "Go Back", width = 10, pady=2, font = ("Berlin Sans FB", 12), cursor="hand2", command=homeAdmin).grid(row=9, column=3, sticky=(E), padx=5, pady=10)
elif mode == "memb":
Button(addResF, text = "Go Back", width = 10, pady=2, font = ("Berlin Sans FB", 12), cursor="hand2", command=homeMember).grid(row=9, column=3, sticky=(E), padx=5, pady=10)
# modify reservation frame.
# labels and entry widgets for reservation details.
modResID = StringVar()
Label(modResF, text="Reservation ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=3, column=0, sticky=(E), padx=10, pady=10)
modResIDE = Entry(modResF, textvariable=modResID, width=40, font = ("Berlin Sans FB", 12), bd=2)
modResIDE.grid(row=3, column=1, padx=10, pady=10)
modCustID = StringVar()
Label(modResF, text="Customer ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=4, column=0, sticky=(E), padx=10, pady=10)
modCustIDE = Entry(modResF, textvariable=modCustID, width=40, font = ("Berlin Sans FB", 12), bd=2)
modCustIDE.grid(row=4, column=1, padx=10, pady=10)
modBookID = StringVar()
Label(modResF, text="Book IDs:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=5, column=0, sticky=(E), padx=10, pady=10)
modBookIDE = Entry(modResF, textvariable=modBookID, width=40, font = ("Berlin Sans FB", 12), bd=2)
modBookIDE.grid(row=5, column=1, padx=10, pady=10)
modCopies = StringVar()
Label(modResF, text="Copies:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=6, column=0, sticky=(E), padx=10, pady=10)
modCopiesE = Entry(modResF, textvariable=modCopies, width=40, font = ("Berlin Sans FB", 12), bd=2)
modCopiesE.grid(row=6, column=1, padx=10, pady=10)
modDate = StringVar()
Label(modResF, text="Date:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=7, column=0, sticky=(E), padx=10, pady=10)
modDateE = Entry(modResF, textvariable=modDate, width=40, font = ("Berlin Sans FB", 12), bd=2)
modDateE.grid(row=7, column=1, padx=10, pady=10)
modFulfilled = StringVar()
Label(modResF, text="Fulfilled(y/n):", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=8, column=0, sticky=(E), padx=10, pady=10)
modFulfilledE = Entry(modResF, textvariable=modFulfilled, width=40, font = ("Berlin Sans FB", 12), bd=2)
modFulfilledE.grid(row=8, column=1, padx=10, pady=10)
# modify button.
Button(modResF, text="Modify", command=modRes, cursor="hand2", width=17, font = ("Berlin Sans FB", 12)).grid(row=9, column=2, padx=20, pady=10)
# go back button.
if mode == "admin":
Button(modResF, text = "Go Back", width = 10, pady=2, font = ("Berlin Sans FB", 12), cursor="hand2", command=homeAdmin).grid(row=9, column=3, sticky=(E), padx=5, pady=10)
elif mode == "memb":
Button(modResF, text = "Go Back", width = 10, pady=2, font = ("Berlin Sans FB", 12), cursor="hand2", command=homeMember).grid(row=9, column=3, sticky=(E), padx=5, pady=10)
# delete transaction frame.
delResID = StringVar()
Label(delResF, text="Reservation ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=3, column=0, padx=10, pady=10)
delResIDE = Entry(delResF, textvariable=delResID, width=40, font = ("Berlin Sans FB", 12), bd=2)
delResIDE.grid(row=3, column=1, padx=10, pady=10)
# remove button.
Button(delResF, text="Remove", command=delRes, cursor="hand2", width=17, font = ("Berlin Sans FB", 12)).grid(row=4, column=2, padx=20, pady=40)
# go back button.
if mode == "admin":
Button(delResF, text = "Go Back", width = 10, pady=2, font = ("Berlin Sans FB", 12), cursor="hand2", command=homeAdmin).grid(row=4, column=3, sticky=(E), padx=5, pady=10)
elif mode == "memb":
Button(delResF, text = "Go Back", width = 10, pady=2, font = ("Berlin Sans FB", 12), cursor="hand2", command=homeMember).grid(row=4, column=3, sticky=(E), padx=5, pady=10)
root.mainloop()
def CheckOut():
def addTrans():
# check if customer already exists in "customers" table.
name = addCustFNameE.get() + " " + addCustLNameE.get()
mycursor = mycon.cursor()
mycursor.execute(f"SELECT custid FROM customers WHERE name = '{name}' AND contact = '{addContactE.get()}'")
custid = mycursor.fetchone()
if custid == None:
# if new customer, create record in "customers" table.
mycursor.execute(f"INSERT INTO customers(name, contact) VALUES ('{name}', '{addContactE.get()}')")
mycon.commit()
# retrieve customer id from "customers" table.
mycursor.execute(f"SELECT custid FROM customers WHERE name = '{name}' AND contact = '{addContactE.get()}'")
custid = mycursor.fetchone()
customerid = custid[0]
# retrieve book price from "books" table.
mycursor.execute(f"SELECT price FROM books WHERE bookid = {int(addBookIDE.get())}")
price = mycursor.fetchone()
pricebook = price[0]
# retrieve member status from "customers" table.
mycursor.execute(f"SELECT member FROM customers WHERE custid = {customerid}")
memberstatus = mycursor.fetchone()
memberstatusstr = memberstatus[0]
# check if customer is a member. if member apply discount.
if memberstatusstr == "y":
discount = 0.1
else:
discount = 0
totalnodiscount = float(pricebook) * int(addCopies.get())
total = totalnodiscount - (discount)*(totalnodiscount)
# displays bill details.
messagebox.showinfo("Bookstore Manager", f"Total Cost : ₹{totalnodiscount} \nDiscount : {discount*100}% \nAmount Payable: ₹{total}")
# create new transaction in "checkout" table.
mycursor.execute(f"INSERT INTO checkout(custid,bookid,copies,price,discounted) VALUES ({customerid}, {int(addBookIDE.get())}, {int(addCopiesE.get())}, {totalnodiscount}, {total})")
mycon.commit()
# update copies available in "books" table.
if addNorUE.get() == "n":
mycursor.execute(f"UPDATE books SET new = new - {int(addCopiesE.get())} WHERE bookid = {int(addBookIDE.get())}")
elif addNorUE.get() == "u":
mycursor.execute(f"UPDATE books SET used = used - {int(addCopiesE.get())} WHERE bookid = {int(addBookIDE.get())}")
mycon.commit()
# clear all entries after adding
addBookIDE.delete(0, END)
addContactE.delete(0, END)
addCopiesE.delete(0, END)
addCustFNameE.delete(0, END)
addCustLNameE.delete(0, END)
addNorUE.delete(0, END)
# updates transaction id.
tid.destroy()
mycursor = mycon.cursor()
mycursor.execute("SELECT transid FROM checkout ORDER BY transid DESC LIMIT 1")
transid = mycursor.fetchone()
transactionid = transid[0]+1
trid = Label(addTransF, text=transactionid, bg="#FFFFFF", font = ("Berlin Sans FB", 12))
trid.grid(row=3, column=1, sticky=(W), padx=10, pady=10)
return
# root definition and configuration.
global root
root.destroy()
root = Tk()
root.title("Bookstore Management System")
root.geometry('960x540')
root.iconbitmap(r"images\bms.ico")
root.attributes("-alpha", 0.95)
root.wm_protocol("WM_DELETE_WINDOW", goodBye)
root.resizable(FALSE,FALSE)
# styles.
sty1 = ttk.Style()
sty1.configure("Bookstore.TFrame", background="#FFFFFF", borderwidth=5, relief=FLAT)
sty2 = ttk.Style()
sty2.configure("Bookstore.TNotebook", background="#FFFFFF", padding=10, tabmargins=2)
sty3 = ttk.Style()
sty3.configure("Bookstore.TNotebook.Tab", font=("Berlin Sans FB", 12), padding=5)
# maninframe definition and configuration.
mainframe = ttk.Frame(root, style="Bookstore.TFrame")
mainframe.grid(column=0, row=0)
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
# background image.
titleImg = PhotoImage(file = r"images\titlestrip.png").subsample(2,2)
Label(mainframe, image = titleImg, bg="#FFFFFF").grid(row=0, column=0, columnspan=4, rowspan=2)
Button(mainframe, text = "LOGOUT", width = 12, bg = "#41404A", fg = "#FFFFFF", font = ("Berlin Sans FB", 12), relief = "flat", cursor="hand2", command = loggedOut).grid(row=1, column=3)
# notebook and frames definition.
checkOutNBK = ttk.Notebook(mainframe, width=940, height=390, style="Bookstore.TNotebook")
addTransF = ttk.Frame(checkOutNBK, style="Bookstore.TFrame")
checkOutNBK.add(addTransF, text='New Check Out')
checkOutNBK.grid(row=2, column=0, columnspan=4, sticky=(W))
# add transaction frame.
# transaction id is auto incremented.
Label(addTransF, text="Transaction ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=3, column=0, sticky=(E), padx=10, pady=10)
mycursor = mycon.cursor()
mycursor.execute("SELECT transid FROM checkout ORDER BY transid DESC LIMIT 1")
transid = mycursor.fetchone()
transactionid = transid[0]+1
tid = Label(addTransF, text=transactionid, bg="#FFFFFF", font = ("Berlin Sans FB", 12))
tid.grid(row=3, column=1, sticky=(W), padx=10, pady=10)
# labels and entries for checkout details.
addCustFName = StringVar()
Label(addTransF, text="Customer First Name:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=5, column=0, sticky=(E), padx=10, pady=10)
addCustFNameE = Entry(addTransF, textvariable=addCustFName, width=40, font = ("Berlin Sans FB", 12), bd=2)
addCustFNameE.grid(row=5, column=1, padx=10, pady=10)
addCustLName = StringVar()
Label(addTransF, text="Customer Last Name:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=6, column=0, sticky=(E), padx=10, pady=10)
addCustLNameE = Entry(addTransF, textvariable=addCustLName, width=40, font = ("Berlin Sans FB", 12), bd=2)
addCustLNameE.grid(row=6, column=1, padx=10, pady=10)
addContact = StringVar()
Label(addTransF, text=" Phone Number:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=7, column=0, sticky=(E), padx=10, pady=10)
addContactE = Entry(addTransF, textvariable=addContact, width=40, font = ("Berlin Sans FB", 12), bd=2)
addContactE.grid(row=7, column=1, padx=10, pady=10)
addBookID = StringVar()
Label(addTransF, text="Book IDs:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=8, column=0, sticky=(E), padx=10, pady=10)
addBookIDE = Entry(addTransF, textvariable=addBookID, width=40, font = ("Berlin Sans FB", 12), bd=2)
addBookIDE.grid(row=8, column=1, padx=10, pady=10)
addCopies = StringVar()
Label(addTransF, text="Copies:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=9, column=0, sticky=(E), padx=10, pady=10)
addCopiesE = Entry(addTransF, textvariable=addCopies, width=40, font = ("Berlin Sans FB", 12), bd=2)
addCopiesE.grid(row=9, column=1, padx=10, pady=10)
addNorU = StringVar()
Label(addTransF, text="New or Used (n/u): ", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=10, column=0, sticky=(E), padx=10, pady=10)
addNorUE = Entry(addTransF, textvariable=addNorU, width=40, font = ("Berlin Sans FB", 12), bd=2)
addNorUE.grid(row=10, column=1, padx=10, pady=10)
# add and go back button.
Button(addTransF, text="Add", command=addTrans, cursor="hand2", width=17, font = ("Berlin Sans FB", 12)).grid(row=11, column=2, padx=20, pady=30)
Button(addTransF, text = "Go Back", width = 10, pady=2, font = ("Berlin Sans FB", 12), cursor="hand2", command=homeAdmin).grid(row=11, column=3, sticky=(E), padx=15, pady=10)
root.mainloop()
def bookDetails():
def addBook():
# add button clicked.
# create new record in "books" table.
mycursor = mycon.cursor()
mycursor.execute(f"INSERT INTO books(name,author,genre,publisher,yop,price,new,used) VALUES ('{addBookNameE.get()}','{addBookAuthE.get()}','{addBookGenreE.get()}','{addBookPubE.get()}','{addBookYoPE.get()}',{float(addBookPriceE.get())},{int(addBookNewE.get())},{int(addBookSecE.get())})")
mycon.commit()
# clear all entries after adding
addBookAuthE.delete(0, END)
addBookGenreE.delete(0, END)
addBookNameE.delete(0, END)
addBookNewE.delete(0, END)
addBookPriceE.delete(0, END)
addBookPubE.delete(0, END)
addBookSecE.delete(0, END)
addBookYoPE.delete(0, END)
# updates book id.
bkid.destroy()
mycursor = mycon.cursor()
mycursor.execute("SELECT bookid FROM books ORDER BY bookid DESC LIMIT 1")
transid = mycursor.fetchone()
transactionid = transid[0]+1
trid = Label(addBookF, text=transactionid, bg="#FFFFFF", font = ("Berlin Sans FB", 12))
trid.grid(row=3, column=1, sticky=(W), padx=10, pady=10)
return
def modBook():
# modify button clicked.
# update record in "books" table.
mycursor = mycon.cursor()
mycursor.execute(f"UPDATE books SET name = '{modBookNameE.get()}', author = '{modBookAuthE.get()}', genre = '{modBookGenreE.get()}', publisher = '{modBookPubE.get()}', yop = '{modBookYoPE.get()}', price = {float(modBookPriceE.get())}, new = {int(modBookNewE.get())}, used = {int(modBookSecE.get())} WHERE bookID = {int(modBookIDE.get())}")
mycon.commit()
# clear all entries after modifying
modBookAuthE.delete(0, END)
modBookGenreE.delete(0, END)
modBookIDE.delete(0, END)
modBookNameE.delete(0, END)
modBookNewE.delete(0, END)
modBookPriceE.delete(0, END)
modBookPubE.delete(0, END)
modBookSecE.delete(0, END)
modBookYoPE.delete(0, END)
return
# root definition and configuration.
global root
root.destroy()
root = Tk()
root.title("Bookstore Management System")
root.geometry('960x540')
root.iconbitmap(r"images\bms.ico")
root.attributes("-alpha", 0.95)
root.wm_protocol("WM_DELETE_WINDOW", goodBye)
root.resizable(FALSE,FALSE)
# styles.
sty1 = ttk.Style()
sty1.configure("Bookstore.TFrame", background="#FFFFFF", borderwidth=5, relief=FLAT)
sty2 = ttk.Style()
sty2.configure("Bookstore.TNotebook", background="#FFFFFF", padding=10)
sty3 = ttk.Style()
sty3.configure("Bookstore.TNotebook.Tab", font=("Berlin Sans FB", 12), padding=5)
# mainframe definition and configuration.
mainframe = ttk.Frame(root, style="Bookstore.TFrame")
mainframe.grid(column=0, row=0)
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
# background image.
titleImg = PhotoImage(file = r"images\titlestrip.png").subsample(2,2)
Label(mainframe, image = titleImg, bg="#FFFFFF").grid(row=0, column=0, columnspan=6, rowspan=2)
Button(mainframe, text = "LOGOUT", width = 12, bg = "#41404A", fg = "#FFFFFF", font = ("Berlin Sans FB", 12), relief = "flat", cursor="hand2", command = loggedOut).grid(row=1, column=5)
# notebook and frames defintion.
BookNBK = ttk.Notebook(mainframe, width=940, height=390, style="Bookstore.TNotebook")
addBookF = ttk.Frame(BookNBK, style="Bookstore.TFrame")
modBookF = ttk.Frame(BookNBK, style="Bookstore.TFrame")
BookNBK.add(addBookF, text='Add Book', padding = 5)
BookNBK.add(modBookF, text='Modify Book', padding = 5)
BookNBK.grid(row=2, column=0, columnspan=6, sticky=(W))
# add book frame.
# book id is auto incremented.
Label(addBookF, text="Book ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=3, column=0, sticky=(E), padx=10, pady=10)
mycursor = mycon.cursor()
mycursor.execute("SELECT bookid FROM books ORDER BY bookid DESC LIMIT 1")
bookid = mycursor.fetchone()
bid = bookid[0]+1
bkid = Label(addBookF, text=bid, bg="#FFFFFF", font = ("Berlin Sans FB", 12))
bkid.grid(row=3, column=1, sticky=(W), padx=10, pady=10)
# labels and entry widgets for book details.
addBookName = StringVar()
Label(addBookF, text="Book Name:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=4, column=0, sticky=(E), padx=10, pady=10)
addBookNameE = Entry(addBookF, textvariable=addBookName, width=40, font = ("Berlin Sans FB", 12), bd=2)
addBookNameE.grid(row=4, column=1, padx=10, pady=10, columnspan=3)
addBookAuth = StringVar()
Label(addBookF, text="Author:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=5, column=0, sticky=(E), padx=10, pady=10)
addBookAuthE = Entry(addBookF, textvariable=addBookAuth, width=40, font = ("Berlin Sans FB", 12), bd=2)
addBookAuthE.grid(row=5, column=1, padx=10, pady=10, columnspan=3)
addBookGenre = StringVar()
Label(addBookF, text="Genre:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=6, column=0, sticky=(E), padx=10, pady=10)
addBookGenreE = Entry(addBookF, textvariable=addBookGenre, width=40, font = ("Berlin Sans FB", 12), bd=2)
addBookGenreE.grid(row=6, column=1, padx=10, pady=10, columnspan=3)
addBookPub = StringVar()
Label(addBookF, text="Publisher:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=7, column=0, sticky=(E), padx=10, pady=10)
addBookPubE = Entry(addBookF, textvariable=addBookPub, width=40, font = ("Berlin Sans FB", 12), bd=2)
addBookPubE.grid(row=7, column=1, padx=10, pady=10, columnspan=3)
addBookYoP = StringVar()
Label(addBookF, text="Year of Publication:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=8, column=0, sticky=(E), padx=10, pady=10)
addBookYoPE = Entry(addBookF, textvariable=addBookYoP, width=40, font = ("Berlin Sans FB", 12), bd=2)
addBookYoPE.grid(row=8, column=1, padx=10, pady=10, columnspan=3)
addBookNew = StringVar()
Label(addBookF, text="New Copies:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=9, column=0, sticky=(E), padx=10, pady=10)
addBookNewE = Entry(addBookF, textvariable=addBookNew, width=10, font = ("Berlin Sans FB", 12), bd=2)
addBookNewE.grid(row=9, column=1, padx=10, pady=10)
addBookSec = StringVar()
Label(addBookF, text="Second Hand Copies:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=9, column=2, sticky=(E), padx=10, pady=10)
addBookSecE = Entry(addBookF, textvariable=addBookSec, width=10, font = ("Berlin Sans FB", 12), bd=2)
addBookSecE.grid(row=9, column=3, padx=10, pady=10)
addBookPrice = StringVar()
Label(addBookF, text="Book Price:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=10, column=0, sticky=(E), padx=10, pady=10)
addBookPriceE = Entry(addBookF, textvariable=addBookPrice, width=10, font = ("Berlin Sans FB", 12), bd=2)
addBookPriceE.grid(row=10, column=1, padx=10, pady=10)
# add button and go back button.
Button(addBookF, text="Add", command=addBook, cursor="hand2", width=17, font = ("Berlin Sans FB", 12)).grid(row=10, column=5, padx=20, pady=10)
Button(addBookF, text = "Go Back", width = 10, pady=2, font = ("Berlin Sans FB", 12), cursor="hand2", command=homeAdmin).grid(row=10, column=6, sticky=(E), padx=15, pady=10)
# modify book frame.
# labels and entry widgets for book details.
modBookID = StringVar()
Label(modBookF, text="Book ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=3, column=0, sticky=(E), padx=10, pady=10)
modBookIDE = Entry(modBookF, textvariable=modBookID, width=40, font = ("Berlin Sans FB", 12), bd=2)
modBookIDE.grid(row=3, column=1, padx=10, pady=10, columnspan=3)
modBookName = StringVar()
Label(modBookF, text="Book Name:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=4, column=0, sticky=(E), padx=10, pady=10)
modBookNameE = Entry(modBookF, textvariable=modBookName, width=40, font = ("Berlin Sans FB", 12), bd=2)
modBookNameE.grid(row=4, column=1, padx=10, pady=10, columnspan=3)
modBookAuth = StringVar()
Label(modBookF, text="Author:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=5, column=0, sticky=(E), padx=10, pady=10)
modBookAuthE = Entry(modBookF, textvariable=modBookAuth, width=40, font = ("Berlin Sans FB", 12), bd=2)
modBookAuthE.grid(row=5, column=1, padx=10, pady=10, columnspan=3)
modBookGenre = StringVar()
Label(modBookF, text="Genre:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=6, column=0, sticky=(E), padx=10, pady=10)
modBookGenreE = Entry(modBookF, textvariable=modBookGenre, width=40, font = ("Berlin Sans FB", 12), bd=2)
modBookGenreE.grid(row=6, column=1, padx=10, pady=10, columnspan=3)
modBookPub = StringVar()
Label(modBookF, text="Publisher:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=7, column=0, sticky=(E), padx=10, pady=10)
modBookPubE = Entry(modBookF, textvariable=modBookPub, width=40, font = ("Berlin Sans FB", 12), bd=2)
modBookPubE.grid(row=7, column=1, padx=10, pady=10, columnspan=3)
modBookYoP = StringVar()
Label(modBookF, text="Year of Publication:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=8, column=0, sticky=(E), padx=10, pady=10)
modBookYoPE = Entry(modBookF, textvariable=modBookYoP, width=40, font = ("Berlin Sans FB", 12), bd=2)
modBookYoPE.grid(row=8, column=1, padx=10, pady=10, columnspan=3)
modBookNew = StringVar()
Label(modBookF, text="New Copies:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=9, column=0, sticky=(E), padx=10, pady=10)
modBookNewE = Entry(modBookF, textvariable=modBookNew, width=10, font = ("Berlin Sans FB", 12), bd=2)
modBookNewE.grid(row=9, column=1, padx=10, pady=10)
modBookSec = StringVar()
Label(modBookF, text="Second Hand Copies:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=9, column=2, sticky=(E), padx=10, pady=10)
modBookSecE = Entry(modBookF, textvariable=modBookSec, width=10, font = ("Berlin Sans FB", 12), bd=2)
modBookSecE.grid(row=9, column=3, padx=10, pady=10)
modBookPrice = StringVar()
Label(modBookF, text="Book Price:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=10, column=0, sticky=(E), padx=10, pady=10)
modBookPriceE = Entry(modBookF, textvariable=modBookPrice, width=10, font = ("Berlin Sans FB", 12), bd=2)
modBookPriceE.grid(row=10, column=1, padx=10, pady=10)
# modify and go back button.
Button(modBookF, text="Modify", command=modBook, cursor="hand2", width=17, font = ("Berlin Sans FB", 12)).grid(row=10, column=5, padx=20, pady=10)
Button(modBookF, text = "Go Back", width = 10, pady=2, font = ("Berlin Sans FB", 12), cursor="hand2", command=homeAdmin).grid(row=10, column=6, sticky=(E), padx=15, pady=10)
root.mainloop()
def editMember():
def addMember():
# todo: if customer does not already exist?
# add button clicked.
# update member status of existing customer to 'y'.
membername = addMemberFNameE.get() + " " + addMemberLNameE.get()
mycursor = mycon.cursor()
mycursor.execute(f"UPDATE customers SET member = 'y' WHERE name LIKE '{membername}' AND contact LIKE '{addMemberContactE.get()}'" )
mycon.commit()
# display member id.
mycursor.execute(f"SELECT custid FROM customers WHERE name LIKE '{membername}' AND contact LIKE '{addMemberContactE.get()}'")
customerid = mycursor.fetchone()
displayMemberID = 0
displayMemberID = customerid[0]
messagebox.showinfo("Bookstore Manager", f"Your Member ID Is: {displayMemberID}")
# clear all entries after adding
addMemberFNameE.delete(0, END)
addMemberLNameE.delete(0, END)
addMemberContactE.delete(0, END)
return
def modMember():
# modify button clicked.
# update record in "customers" table.
membername = modMemberFNameE.get() + " " + modMemberLNameE.get()
mycursor=mycon.cursor()
mycursor.execute(f"UPDATE customers SET name = '{membername}', contact = '{modMemberContactE.get()}' WHERE custid = {int(modMemberIDE.get())}")
mycon.commit()
# clear all entries after modifying
modMemberContactE.delete(0, END)
modMemberFNameE.delete(0, END)
modMemberLNameE.delete(0, END)
modMemberIDE.delete(0, END)
return
def delMember():
# remove button clicked.
# set member status of existing member to 'n'.
mycursor = mycon.cursor()
mycursor.execute(f"UPDATE customers SET member = 'n' WHERE custid = {delMemberIDE.get()}")
mycon.commit()
# clear all entries after removing
delMemberIDE.delete(0, END)
return
# root definition and configuration.
global root
root.destroy()
root = Tk()
root.title("Bookstore Management System")
root.geometry('960x540')
root.iconbitmap(r"images\bms.ico")
root.attributes("-alpha", 0.95)
root.wm_protocol("WM_DELETE_WINDOW", goodBye)
root.resizable(FALSE,FALSE)
# styles.
sty1 = ttk.Style()
sty1.configure("Bookstore.TFrame", background="#FFFFFF", borderwidth=5, relief=FLAT)
sty2 = ttk.Style()
sty2.configure("Bookstore.TNotebook", background="#FFFFFF", padding=10, tabmargins=2)
sty3 = ttk.Style()
sty3.configure("Bookstore.TNotebook.Tab", font=("Berlin Sans FB", 12), padding=5)
# mainframe definition and configuration.
mainframe = ttk.Frame(root, style="Bookstore.TFrame")
mainframe.grid(column=0, row=0)
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
# background image.
titleImg = PhotoImage(file = r"images\titlestrip.png").subsample(2,2)
Label(mainframe, image = titleImg, bg="#FFFFFF").grid(row=0, column=0, columnspan=4, rowspan=2)
Button(mainframe, text = "LOGOUT", width = 12, bg = "#41404A", fg = "#FFFFFF", font = ("Berlin Sans FB", 12), relief = "flat", cursor="hand2", command = loggedOut).grid(row=1, column=3)
# notebook and frames definition.
memberNBK = ttk.Notebook(mainframe, width=940, height=390, style="Bookstore.TNotebook")
addMemberF = ttk.Frame(memberNBK, style="Bookstore.TFrame")
modMemberF = ttk.Frame(memberNBK, style="Bookstore.TFrame")
delMemberF = ttk.Frame(memberNBK, style="Bookstore.TFrame")
memberNBK.add(addMemberF, text='Add Member', padding=47)
memberNBK.add(modMemberF, text='Modify Member', padding=47)
memberNBK.add(delMemberF, text='Remove Member', padding=47)
memberNBK.grid(row=2, column=0, columnspan=4, sticky=(W))
# add member frame.
addMemberFName = StringVar()
Label(addMemberF, text="First Name:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=4, column=0, sticky=(E), padx=10, pady=10)
addMemberFNameE = Entry(addMemberF, textvariable=addMemberFName, width=40, font = ("Berlin Sans FB", 12), bd=2)
addMemberFNameE.grid(row=4, column=1, padx=10, pady=10)
addMemberLName = StringVar()
Label(addMemberF, text="Last Name:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=5, column=0, sticky=(E), padx=10, pady=10)
addMemberLNameE = Entry(addMemberF, textvariable=addMemberLName, width=40, font = ("Berlin Sans FB", 12), bd=2)
addMemberLNameE.grid(row=5, column=1, padx=10, pady=10)
addMemberContact = StringVar()
Label(addMemberF, text=" Phone Number:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=6, column=0, sticky=(E), padx=10, pady=10)
addMemberContactE = Entry(addMemberF, textvariable=addMemberContact, width=40, font = ("Berlin Sans FB", 12), bd=2)
addMemberContactE.grid(row=6, column=1, padx=10, pady=10)
# add and go back button.
Button(addMemberF, text="Add", command=addMember, cursor="hand2", width=17, font = ("Berlin Sans FB", 12)).grid(row=7, column=2, padx=20, pady=20)
Button(addMemberF, text = "Go Back", width = 10, pady=2, font = ("Berlin Sans FB", 12), cursor="hand2", command=homeAdmin).grid(row=8, column=2, sticky=(E), padx=15, pady=10)
# modify member frame.
modMemberID = StringVar()
Label(modMemberF, text="Customer ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=3, column=0, sticky=(E), padx=10, pady=10)
modMemberIDE = Entry(modMemberF, textvariable=modMemberID, width=40, font = ("Berlin Sans FB", 12), bd=2)
modMemberIDE.grid(row=3, column=1, padx=10, pady=10)
modMemberFName = StringVar()
Label(modMemberF, text="New First Name:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=4, column=0, sticky=(E), padx=10, pady=10)
modMemberFNameE = Entry(modMemberF, textvariable=modMemberFName, width=40, font = ("Berlin Sans FB", 12), bd=2)
modMemberFNameE.grid(row=4, column=1, padx=10, pady=10)
modMemberLName = StringVar()
Label(modMemberF, text="New Last Name:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=5, column=0, sticky=(E), padx=10, pady=10)
modMemberLNameE = Entry(modMemberF, textvariable=modMemberLName, width=40, font = ("Berlin Sans FB", 12), bd=2)
modMemberLNameE.grid(row=5, column=1, padx=10, pady=10)
modMemberContact = StringVar()
Label(modMemberF, text="New Phone Number:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=6, column=0, sticky=(E), padx=10, pady=10)
modMemberContactE = Entry(modMemberF, textvariable=modMemberContact, width=40, font = ("Berlin Sans FB", 12), bd=2)
modMemberContactE.grid(row=6, column=1, padx=10, pady=10)
# modify and go back button.
Button(modMemberF, text="Modify", command=modMember, cursor="hand2", width=17, font = ("Berlin Sans FB", 12)).grid(row=7, column=2, padx=20, pady=20)
Button(modMemberF, text = "Go Back", width = 10, pady=2, font = ("Berlin Sans FB", 12), cursor="hand2", command=homeAdmin).grid(row=8, column=2, sticky=(E), padx=15, pady=10)
# delete member frame.
delMemberID = StringVar()
Label(delMemberF, text=" Customer ID:", bg="#FFFFFF", font = ("Berlin Sans FB", 12)).grid(row=3, column=0, padx=10, pady=10)
delMemberIDE = Entry(delMemberF, textvariable=delMemberID, width=40, font = ("Berlin Sans FB", 12), bd=2)
delMemberIDE.grid(row=3, column=1, padx=10, pady=10)
# remove and go back button.
Button(delMemberF, text="Remove", command=delMember, cursor="hand2", width=17, font = ("Berlin Sans FB", 12)).grid(row=4, column=2, padx=20, pady=20)
Button(delMemberF, text = "Go Back", width = 10, pady=2, font = ("Berlin Sans FB", 12), cursor="hand2", command=homeAdmin).grid(row=5, column=2, sticky=(E), padx=15, pady=10)
root.mainloop()
# main.
# root definition and configuration.
root = Tk()
root.title("Bookstore Management System")
root.geometry('960x540')
root.iconbitmap(r"images\bms.ico")
root.attributes("-alpha", 0.95)
root.wm_protocol("WM_DELETE_WINDOW", goodBye)
root.resizable(FALSE,FALSE)
# mainframe definition and configuration.
sty = ttk.Style()
sty.configure("Bookstore.TFrame", background="#FFFFFF", borderwidth=5, relief=FLAT)
mainframe = ttk.Frame(root, style="Bookstore.TFrame")
mainframe.grid(column=0, row=0)
# background image.
bgtitle = PhotoImage(file=r"images\welcometitle.png")
Label(mainframe, image = bgtitle, bg="#FFFFFF").grid(row=0, column=0, columnspan=8)
bgimage = PhotoImage(file=r"images\welcomecloud.png")
Label(mainframe, image = bgimage, bg="#FFFFFF").grid(row=0, column=8, rowspan=6)
# login mode buttons.
Label(mainframe, text = "Login As", font = ("Berlin Sans FB", 24), bg="#FFFFFF", fg="#2e2e2e").grid(row=1, column=0, sticky=(W), padx = 15)
Button(mainframe, text = "Admin", width = 20, bg="#2e2e2e", fg="#FFFFFF", font = ("Berlin Sans FB", 10), bd=2, cursor="hand2", relief=GROOVE, command = asAdmin).grid(row=2, column=0, pady = 5)
Button(mainframe, text = "Customer", width = 20, bg="#2e2e2e", fg="#FFFFFF", font = ("Berlin Sans FB", 10), bd=2, cursor="hand2", relief=GROOVE, command = asCustomer).grid(row=3, column=0, pady = 5)
root.mainloop()
mycon.close()
| 53.363248 | 347 | 0.6471 | 9,978 | 74,922 | 4.854881 | 0.056925 | 0.033669 | 0.062714 | 0.071673 | 0.774514 | 0.745737 | 0.722369 | 0.704946 | 0.687895 | 0.633892 | 0 | 0.04706 | 0.188836 | 74,922 | 1,403 | 348 | 53.401283 | 0.749992 | 0.097408 | 0 | 0.535433 | 0 | 0.019685 | 0.19425 | 0.027903 | 0 | 0 | 0 | 0.000713 | 0 | 1 | 0.030512 | false | 0.005906 | 0.003937 | 0 | 0.04626 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
7767f7e2c68e3e4ceaa3f513126ac909117b18d2 | 233 | py | Python | examples/presentation/tests/test_step_one.py | dbatten5/dagster | d76e50295054ffe5a72f9b292ef57febae499528 | [
"Apache-2.0"
] | 4,606 | 2018-06-21T17:45:20.000Z | 2022-03-31T23:39:42.000Z | examples/presentation/tests/test_step_one.py | dbatten5/dagster | d76e50295054ffe5a72f9b292ef57febae499528 | [
"Apache-2.0"
] | 6,221 | 2018-06-12T04:36:01.000Z | 2022-03-31T21:43:05.000Z | examples/presentation/tests/test_step_one.py | dbatten5/dagster | d76e50295054ffe5a72f9b292ef57febae499528 | [
"Apache-2.0"
] | 619 | 2018-08-22T22:43:09.000Z | 2022-03-31T22:48:06.000Z | import pytest
from dagster import seven
from ..step_one import compute_top_quartile
@pytest.mark.skipif(seven.IS_WINDOWS, reason="Unix-only test")
def test_top_quartile(snapshot):
snapshot.assert_match(compute_top_quartile())
| 23.3 | 62 | 0.811159 | 34 | 233 | 5.294118 | 0.647059 | 0.183333 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.098712 | 233 | 9 | 63 | 25.888889 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0.060086 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0.166667 | false | 0 | 0.5 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
777cec8b6018cf049cd17c144c18f9521225bdb0 | 238 | py | Python | facturas/admin.py | Etxea/gestion_eide_web | 8a59be1ddb59a4713cb3346534fd01f643d8f924 | [
"MIT"
] | null | null | null | facturas/admin.py | Etxea/gestion_eide_web | 8a59be1ddb59a4713cb3346534fd01f643d8f924 | [
"MIT"
] | null | null | null | facturas/admin.py | Etxea/gestion_eide_web | 8a59be1ddb59a4713cb3346534fd01f643d8f924 | [
"MIT"
] | null | null | null | from models import *
from django.contrib import admin
class FacturaAdmin(admin.ModelAdmin):
pass
class ConceptoAdmin(admin.ModelAdmin):
pass
admin.site.register(Factura,FacturaAdmin)
admin.site.register(Concepto,ConceptoAdmin)
| 19.833333 | 43 | 0.802521 | 28 | 238 | 6.821429 | 0.535714 | 0.17801 | 0.198953 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113445 | 238 | 11 | 44 | 21.636364 | 0.905213 | 0 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.25 | 0.25 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 4 |
77856ce3b472091bdd8609857542ac897be9ff29 | 303 | py | Python | 2417.py | ShawonBarman/URI-Online-judge-Ad-Hoc-level-problem-solution-in-python | 9a0f0ad5efd4a9e73589c357ab4b34b7c73a11da | [
"MIT"
] | 1 | 2022-01-14T08:45:32.000Z | 2022-01-14T08:45:32.000Z | 2417.py | ShawonBarman/URI-Online-judge-Ad-Hoc-level-problem-solution-in-python | 9a0f0ad5efd4a9e73589c357ab4b34b7c73a11da | [
"MIT"
] | null | null | null | 2417.py | ShawonBarman/URI-Online-judge-Ad-Hoc-level-problem-solution-in-python | 9a0f0ad5efd4a9e73589c357ab4b34b7c73a11da | [
"MIT"
] | null | null | null | cv, ce, cs, fv, fe, fs = map(int, input().split())
total_point_C = (cv*3)+(ce*1)
total_point_F = (fv*3)+(fe*1)
if total_point_C == total_point_F and cs == fs:
print("=")
elif (total_point_C > total_point_F) or (total_point_C == total_point_F and cs > fs):
print("C")
else:
print("F") | 33.666667 | 86 | 0.617162 | 57 | 303 | 3 | 0.385965 | 0.467836 | 0.25731 | 0.280702 | 0.526316 | 0.526316 | 0.397661 | 0.397661 | 0.397661 | 0.397661 | 0 | 0.016327 | 0.191419 | 303 | 9 | 87 | 33.666667 | 0.681633 | 0 | 0 | 0 | 0 | 0 | 0.010135 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
77bb3dbdf33d08c9d496618342814f1f26856eec | 2,403 | py | Python | accelbyte_py_sdk/api/basic/wrappers/__init__.py | encyphered/accelbyte-python-sdk | 09c1e989d7251de308150fdcd3119d662ca2d205 | [
"MIT"
] | null | null | null | accelbyte_py_sdk/api/basic/wrappers/__init__.py | encyphered/accelbyte-python-sdk | 09c1e989d7251de308150fdcd3119d662ca2d205 | [
"MIT"
] | null | null | null | accelbyte_py_sdk/api/basic/wrappers/__init__.py | encyphered/accelbyte-python-sdk | 09c1e989d7251de308150fdcd3119d662ca2d205 | [
"MIT"
] | null | null | null | """Auto-generated package that contains utility functions for the basic API."""
__version__ = "1.17.0"
__author__ = "AccelByte"
__email__ = "dev@accelbyte.net"
# pylint: disable=line-too-long
from ._file_upload import generated_upload_url
from ._file_upload import generated_user_upload_content_url
from ._file_upload import public_generated_upload_url
from ._file_upload import public_generated_user_upload_content_url
from ._misc import update_country_group
from ._misc import delete_country_group
from ._misc import get_languages
from ._misc import get_time_zones
from ._misc import get_country_groups
from ._misc import add_country_group
from ._misc import get_countries
from ._misc import public_get_time_zones
from ._misc import public_get_languages
from ._misc import public_get_countries
from ._namespace import get_namespaces
from ._namespace import create_namespace
from ._namespace import change_namespace_status
from ._namespace import update_namespace
from ._namespace import get_namespace_publisher
from ._namespace import get_namespace
from ._namespace import delete_namespace
from ._namespace import public_get_namespace_publisher
from ._namespace import public_get_namespaces
from ._anonymization import anonymize_user_profile
from ._user_profile import get_user_profile_info
from ._user_profile import update_user_profile
from ._user_profile import delete_user_profile
from ._user_profile import get_private_custom_attributes_info
from ._user_profile import update_private_custom_attributes_partially
from ._user_profile import get_custom_attributes_info
from ._user_profile import update_custom_attributes_partially
from ._user_profile import enable_user_profile_status
from ._user_profile import public_get_user_profile_public_info
from ._user_profile import get_my_profile_info
from ._user_profile import update_my_profile
from ._user_profile import create_my_profile
from ._user_profile import get_user_zip_code
from ._user_profile import update_user_zip_code
from ._user_profile import public_get_user_profile_public_info_by_ids
from ._user_profile import get_custom_attributes_info_1
from ._user_profile import update_custom_attributes_partially_1
from ._user_profile import public_get_user_profile_info
from ._user_profile import public_update_user_profile
from ._user_profile import public_create_user_profile
from ._user_profile import public_enable_user_profile_status
| 42.157895 | 79 | 0.883895 | 351 | 2,403 | 5.475783 | 0.185185 | 0.183143 | 0.163892 | 0.229448 | 0.736733 | 0.618626 | 0.473985 | 0.23205 | 0.05307 | 0.05307 | 0 | 0.002733 | 0.086558 | 2,403 | 56 | 80 | 42.910714 | 0.872893 | 0.043279 | 0 | 0 | 1 | 0 | 0.013956 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.9375 | 0 | 0.9375 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
77f6032a69f15b2118a1e40755a28e239b616381 | 271 | py | Python | slackbot_settings.py | letalvoj/zomato-slack-bot | 533d6cf3e2b60c627901b230af3e70c384668307 | [
"MIT"
] | 1 | 2018-05-27T21:10:05.000Z | 2018-05-27T21:10:05.000Z | slackbot_settings.py | letalvoj/zomato-slack-bot | 533d6cf3e2b60c627901b230af3e70c384668307 | [
"MIT"
] | null | null | null | slackbot_settings.py | letalvoj/zomato-slack-bot | 533d6cf3e2b60c627901b230af3e70c384668307 | [
"MIT"
] | 3 | 2017-02-02T06:22:04.000Z | 2018-10-02T05:38:26.000Z | import settings_local
# WARN: DO NOT MODIFY unless the slackbot api changes.
# This file is required by the slackbot module.
# The actual settings are stored in `settings_local.py`
API_TOKEN = settings_local.SLACKBOT_API_TOKEN
PLUGINS = settings_local.SLACKBOT_PLUGINS
| 30.111111 | 55 | 0.815498 | 41 | 271 | 5.195122 | 0.609756 | 0.244131 | 0.197183 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136531 | 271 | 8 | 56 | 33.875 | 0.910256 | 0.560886 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 |
7ae9c9edb0e380d7e9b3e26e32877002365f71f7 | 161 | py | Python | verpy/__init__.py | bynoud/verpy | 33a7bfa42a306f0fd8c2845a2b3fc390bc4d3d2b | [
"MIT"
] | null | null | null | verpy/__init__.py | bynoud/verpy | 33a7bfa42a306f0fd8c2845a2b3fc390bc4d3d2b | [
"MIT"
] | null | null | null | verpy/__init__.py | bynoud/verpy | 33a7bfa42a306f0fd8c2845a2b3fc390bc4d3d2b | [
"MIT"
] | null | null | null | import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
logger.addHandler(ch)
| 23 | 36 | 0.813665 | 20 | 161 | 6.35 | 0.5 | 0.23622 | 0.314961 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068323 | 161 | 6 | 37 | 26.833333 | 0.846667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
7aeae4c755140bb313d88403265403585c8e967e | 37 | py | Python | thermo-env/lib/python3.5/sre_constants.py | ndebuhr/thermoModelingAlpha | 9e1a0f9ac4caabf386c1e3103ec69f269131a6b9 | [
"MIT"
] | 4 | 2017-09-24T21:30:46.000Z | 2019-06-01T13:37:44.000Z | thermo-env/lib/python3.5/sre_constants.py | ndebuhr/thermo-state-solver | 9e1a0f9ac4caabf386c1e3103ec69f269131a6b9 | [
"MIT"
] | 19 | 2020-01-28T21:41:50.000Z | 2022-03-11T23:17:39.000Z | thermo-env/lib/python3.5/sre_constants.py | ndebuhr/thermo-state-solver | 9e1a0f9ac4caabf386c1e3103ec69f269131a6b9 | [
"MIT"
] | null | null | null | /usr/lib64/python3.5/sre_constants.py | 37 | 37 | 0.837838 | 7 | 37 | 4.285714 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.108108 | 0 | 37 | 1 | 37 | 37 | 0.702703 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
7afb3f8054a3757f3461e1e7628716d0c6f20868 | 128 | py | Python | segmate/__init__.py | justacid/segmate | 7b66b207ca353805f7ad9c7e003645cd2cbc227a | [
"MIT"
] | null | null | null | segmate/__init__.py | justacid/segmate | 7b66b207ca353805f7ad9c7e003645cd2cbc227a | [
"MIT"
] | null | null | null | segmate/__init__.py | justacid/segmate | 7b66b207ca353805f7ad9c7e003645cd2cbc227a | [
"MIT"
] | null | null | null | def get_version():
version_info = (0, 10, 1)
return ".".join(str(c) for c in version_info)
__version__ = get_version()
| 21.333333 | 49 | 0.65625 | 20 | 128 | 3.8 | 0.65 | 0.263158 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.038835 | 0.195313 | 128 | 5 | 50 | 25.6 | 0.699029 | 0 | 0 | 0 | 0 | 0 | 0.007813 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
7afe846954e0409522ac1456983311aafad6a2f6 | 100 | py | Python | utils/color.py | kuyu12/pygame_fight_game | 3bbc286b9f33c6d6d9db9bea21f9b7af15247df5 | [
"MIT"
] | 1 | 2020-08-03T07:54:59.000Z | 2020-08-03T07:54:59.000Z | utils/color.py | kuyu12/pygame_fight_game | 3bbc286b9f33c6d6d9db9bea21f9b7af15247df5 | [
"MIT"
] | null | null | null | utils/color.py | kuyu12/pygame_fight_game | 3bbc286b9f33c6d6d9db9bea21f9b7af15247df5 | [
"MIT"
] | null | null | null | RED = (237, 0, 38)
BLUE = (47, 86, 233)
BLACK = (0, 0, 0)
WHITE = (255,255,255)
GREY = (200,200,200) | 20 | 21 | 0.55 | 20 | 100 | 2.75 | 0.65 | 0.072727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.425 | 0.2 | 100 | 5 | 22 | 20 | 0.2625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
bb07234e5e1257af70b20f5a5775f491daf8b75a | 215 | py | Python | ex031.py | noahbarros/Python-Exercises | fafda898473bc984280e201ed11d8ad76cc8624a | [
"MIT"
] | 1 | 2021-07-13T21:41:00.000Z | 2021-07-13T21:41:00.000Z | ex031.py | noahbarros/Python-Exercises | fafda898473bc984280e201ed11d8ad76cc8624a | [
"MIT"
] | null | null | null | ex031.py | noahbarros/Python-Exercises | fafda898473bc984280e201ed11d8ad76cc8624a | [
"MIT"
] | null | null | null | d = float(input('Qual a distância da viagem em Km? '))
if d <= 200:
print(f'O valor cobrado por essa viagem é de R$ {d * 0.5 :.2f}')
else:
print(f'O valor cobrado por essa viagem é de R$ {d * 0.5 :.2f}') | 43 | 69 | 0.6 | 44 | 215 | 2.931818 | 0.590909 | 0.093023 | 0.108527 | 0.186047 | 0.635659 | 0.635659 | 0.635659 | 0.635659 | 0.635659 | 0.635659 | 0 | 0.055215 | 0.24186 | 215 | 5 | 70 | 43 | 0.736196 | 0 | 0 | 0.4 | 0 | 0 | 0.669811 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.4 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
bb264080c69eedcf7d53fad214155b75a607cff7 | 85 | py | Python | old/get-sum.py | zerexei/codewars-solutions | 0e1e9c3ce28bb8926561d5dd504f650aca47ca96 | [
"MIT"
] | null | null | null | old/get-sum.py | zerexei/codewars-solutions | 0e1e9c3ce28bb8926561d5dd504f650aca47ca96 | [
"MIT"
] | null | null | null | old/get-sum.py | zerexei/codewars-solutions | 0e1e9c3ce28bb8926561d5dd504f650aca47ca96 | [
"MIT"
] | null | null | null | # sum of min to max
def get_sum(a,b):
return sum(range(min(a, b), max(a, b) + 1)) | 28.333333 | 47 | 0.588235 | 20 | 85 | 2.45 | 0.6 | 0.122449 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014925 | 0.211765 | 85 | 3 | 47 | 28.333333 | 0.716418 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.5 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 4 |
24751cb8564f650abc888b9adc962b4b789c2556 | 195 | py | Python | search_tests/documents/apps.py | ephes/search_tests | 0afc75d94a67d3d622332ebb86fa2a738b55bf19 | [
"MIT"
] | null | null | null | search_tests/documents/apps.py | ephes/search_tests | 0afc75d94a67d3d622332ebb86fa2a738b55bf19 | [
"MIT"
] | null | null | null | search_tests/documents/apps.py | ephes/search_tests | 0afc75d94a67d3d622332ebb86fa2a738b55bf19 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class DocumentsConfig(AppConfig):
name = "search_tests.documents"
verbose_name = _("Documents")
| 24.375 | 54 | 0.779487 | 23 | 195 | 6.391304 | 0.73913 | 0.136054 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.14359 | 195 | 7 | 55 | 27.857143 | 0.88024 | 0 | 0 | 0 | 0 | 0 | 0.158974 | 0.112821 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.