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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
190b1c55d886e97f65a88164433039c8d97d11f5 | 417 | py | Python | WEEKS/CD_Sata-Structures/general/practice/PYTHON/24 - minesweeper.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/CD_Sata-Structures/general/practice/PYTHON/24 - minesweeper.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/CD_Sata-Structures/general/practice/PYTHON/24 - minesweeper.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | def minesweeper(matrix):
row = len(matrix)
col = len(matrix[0])
def neighbouring_squares(i, j):
return sum(
matrix[x][y]
for x in range(i - 1, i + 2)
if 0 <= x < row
for y in range(j - 1, j + 2)
if 0 <= y < col
if i != x or j != y
)
return [[neighbouring_squares(i, j) for j in range(col)] for i in range(row)]
| 26.0625 | 81 | 0.467626 | 65 | 417 | 2.969231 | 0.338462 | 0.145078 | 0.207254 | 0.217617 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02834 | 0.407674 | 417 | 15 | 82 | 27.8 | 0.753036 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0 | 0.076923 | 0.307692 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ef69e633e5049e4dd55d70c1d4c136690d1770f2 | 3,957 | py | Python | tmp/xua-skeleton.py | kmirzavaziri/xua-cli | e442f7522665cf6a4605acce3c023e8194f07176 | [
"MIT"
] | null | null | null | tmp/xua-skeleton.py | kmirzavaziri/xua-cli | e442f7522665cf6a4605acce3c023e8194f07176 | [
"MIT"
] | null | null | null | tmp/xua-skeleton.py | kmirzavaziri/xua-cli | e442f7522665cf6a4605acce3c023e8194f07176 | [
"MIT"
] | null | null | null | import os
class Xua:
def __init__(rootDir=None):
"""Initialize an instance of class Xua.
Args:
rootDir (str): Path of root directory of the xua project. Defaults to os.getcwd().
"""
if not dir:
dir = os.getcwd()
os.chdir(rootDir)
# # # # # # # # # # # # # # # #
# T E M P L A T E S
# # # # # # # # # # # # # # # #
def templateProject(self):
"""Creates a template project in the current working directory.
Raises:
Exception: If the directory is not empty, raises "Directory is not empty".
Returns:
list: A list of all created files.
"""
# TODO implement
return []
def templateSuper(self):
"""Generates template content for xua Super.
Returns:
str: The content of the template file
"""
# TODO implement
return ''
def templateEntity(self):
"""Generates template content for xua Entity.
Returns:
str: The content of the template file
"""
# TODO implement
return ''
def templateMethod(self):
"""Generates template content for xua Method.
Returns:
str: The content of the template file
"""
# TODO implement
return ''
def templateService(self, lang='php'):
"""Generates template content for xua Service.
Args:
lang (str, optional): The language of the service. Defaults to 'php'.
Returns:
str: The content of the template file
"""
# TODO implement
return ''
def templateInterface(self):
"""Generates template content for xua Interface.
Returns:
str: The content of the template file
"""
# TODO implement
return ''
# # # # # # # # # # # # # # # #
# B U I L D
# # # # # # # # # # # # # # # #
def buildBase(self, project):
"""Builds the base of the resulting project. The created files are guaranteed to be inside the folder PROJECT-DEST-DIR/XUA, the only
exception is for server/php project which has another file PROJECT-DEST-DIR/index.php.
Args:
project (str): The resulting project name, one of values:
'server/php',
'marshal/dart', 'marshal/java', 'marshal/javascript', 'marshal/kotlin', 'marshal/objectivec', 'marshal/swift',
'doc/latex', 'doc/html',
Returns:
list: A list of all created files.
"""
# TODO implement
return []
def buildBaseSingular(self, project, filename):
"""Just like the Xua.buildBase method but builds only one file of the base. Efficient when only some of the base files are corrupt.
Args:
project (str): The resulting project name, one of values:
'server/php',
'marshal/dart', 'marshal/java', 'marshal/javascript', 'marshal/kotlin', 'marshal/objectivec', 'marshal/swift',
'doc/latex', 'doc/html',
filename (str): path of the file that needs to be rebuilt, relative to the project destination directory.
"""
# TODO implement
return
def buildSingular(self, project, filename):
"""builds a single file into a project.
Args:
project (str): The resulting project name, one of values:
'server/php',
'marshal/dart', 'marshal/java', 'marshal/javascript', 'marshal/kotlin', 'marshal/objectivec', 'marshal/swift',
'doc/latex', 'doc/html',
filename (str): path of the source file that needs to be built.
Returns:
list: A list of built files generated from the source file.
"""
# TODO implement
return []
| 29.095588 | 140 | 0.541572 | 427 | 3,957 | 5.009368 | 0.290398 | 0.02805 | 0.079944 | 0.071996 | 0.523142 | 0.484806 | 0.421225 | 0.421225 | 0.421225 | 0.421225 | 0 | 0 | 0.357341 | 3,957 | 135 | 141 | 29.311111 | 0.841133 | 0.652262 | 0 | 0.333333 | 0 | 0 | 0.003571 | 0 | 0 | 0 | 0 | 0.066667 | 0 | 1 | 0.416667 | false | 0 | 0.041667 | 0 | 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 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ef6cae2a5e798a185328ef0f56f799e386c40760 | 230 | py | Python | sfaira/unit_tests/data_for_tests/loaders/consts.py | theislab/sfaira | 77a7b49936047a0cdddc5ace4482186a868c3a7a | [
"BSD-3-Clause"
] | 110 | 2020-09-08T07:47:15.000Z | 2022-03-29T03:33:56.000Z | sfaira/unit_tests/data_for_tests/loaders/consts.py | theislab/sfaira | 77a7b49936047a0cdddc5ace4482186a868c3a7a | [
"BSD-3-Clause"
] | 405 | 2020-09-15T15:05:46.000Z | 2022-03-16T14:44:23.000Z | sfaira/unit_tests/data_for_tests/loaders/consts.py | theislab/sfaira | 77a7b49936047a0cdddc5ace4482186a868c3a7a | [
"BSD-3-Clause"
] | 20 | 2021-03-30T15:30:14.000Z | 2022-03-07T12:52:58.000Z | ASSEMBLY_HUMAN = "Homo_sapiens.GRCh38.104"
ASSEMBLY_MOUSE = "Mus_musculus.GRCm39.104"
CELLTYPES = ["adventitial cell", "endothelial cell", "acinar cell", "pancreatic PP cell", "type B pancreatic cell"]
CL_VERSION = "v2021-08-10"
| 38.333333 | 115 | 0.752174 | 31 | 230 | 5.419355 | 0.774194 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.087805 | 0.108696 | 230 | 5 | 116 | 46 | 0.731707 | 0 | 0 | 0 | 0 | 0 | 0.608696 | 0.2 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ef7435c664746283b71bceded2067c1f2271f952 | 1,677 | py | Python | test/test_du_sort.py | meqif/du_sort | 050ddb9b8f500ae954c725ca0d93ff9beae9bb64 | [
"MIT"
] | 1 | 2020-02-18T10:10:21.000Z | 2020-02-18T10:10:21.000Z | test/test_du_sort.py | meqif/du_sort | 050ddb9b8f500ae954c725ca0d93ff9beae9bb64 | [
"MIT"
] | null | null | null | test/test_du_sort.py | meqif/du_sort | 050ddb9b8f500ae954c725ca0d93ff9beae9bb64 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
#
# Copyright (c) 2011 Ricardo Martins
#
# Licensed under the MIT License.
# http://www.opensource.org/licenses/mit-license.php
from nose.tools import *
from du_sort import *
def test_prefix_multiplier_known_prefixes():
""" Check if all known units are associated with the correct multiplier. """
for index, unit in enumerate(["B", "K", "M", "G", "T", "P"]):
eq_(get_prefix_multiplier(unit), 1024 ** index)
def test_prefix_multiplier_invalid_prefixes():
""" Check if invalid units are rejected. """
assert_raises(PrefixMultiplierError, get_prefix_multiplier, "D")
def test_convert_dimensional_sizes():
""" Check if sizes with units are converted to their value in bytes. """
assert size_to_bytes("0B") == 0
assert size_to_bytes("4.0K") == 4096
assert size_to_bytes("113.5M") == 119013376
def test_convert_dimensional_sizes_with_comma():
""" Check if sizes with commas as decimal separator are treated correctly. """
assert size_to_bytes("4,0K") == 4096
def test_parse_du_output():
""" Check if du output is correctly parsed. """
assert sort_criterion("4,0K\tLICENSE") == 4096
assert sort_criterion("0\tREADME") == 0
assert sort_criterion("123.0M LONGSPACE") == 128974848
def test_parse_adimensional_sizes():
""" Check if filesizes without units are not mangled. """
assert sort_criterion("5072\ttestfile") == 5072
def test_sort():
""" Check if sort order is correct. """
original = ["12.0K\tREADME", "2.0G\tfoo", "0\ttestfile", "5.3M\tblob"]
expected = ["0\ttestfile", "12.0K\tREADME", "5.3M\tblob", "2.0G\tfoo"]
assert sort(original) == expected
| 37.266667 | 82 | 0.68873 | 234 | 1,677 | 4.75641 | 0.478632 | 0.044025 | 0.043127 | 0.061096 | 0.097035 | 0.043127 | 0.043127 | 0 | 0 | 0 | 0 | 0.057637 | 0.172332 | 1,677 | 44 | 83 | 38.113636 | 0.744236 | 0.303518 | 0 | 0 | 0 | 0 | 0.154464 | 0 | 0 | 0 | 0 | 0 | 0.434783 | 1 | 0.304348 | false | 0 | 0.086957 | 0 | 0.391304 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ef757cf503e654fbe29ffb65b24fb07fd1786507 | 303 | py | Python | NetCatKS/Dispatcher/api/interfaces/validator/__init__.py | dimddev/NetCatKS-CP | 2d9e72b2422e344569fd4eb154866b98e9707561 | [
"BSD-2-Clause"
] | null | null | null | NetCatKS/Dispatcher/api/interfaces/validator/__init__.py | dimddev/NetCatKS-CP | 2d9e72b2422e344569fd4eb154866b98e9707561 | [
"BSD-2-Clause"
] | null | null | null | NetCatKS/Dispatcher/api/interfaces/validator/__init__.py | dimddev/NetCatKS-CP | 2d9e72b2422e344569fd4eb154866b98e9707561 | [
"BSD-2-Clause"
] | null | null | null | __author__ = 'dimd'
from zope.interface import Interface
class IDispatchAPIValidator(Interface):
def validate(check_one, check_two):
"""
validate whether in_dict.keys.sort() is equal to self.to_dict().keys().sort()
:param in_dict: dict
:return: bool
"""
| 20.2 | 85 | 0.640264 | 36 | 303 | 5.138889 | 0.694444 | 0.064865 | 0.12973 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.247525 | 303 | 14 | 86 | 21.642857 | 0.811404 | 0.369637 | 0 | 0 | 0 | 0 | 0.02649 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
ef7fe6a7aaad6a7f98afd84fe664cca12205e360 | 1,606 | py | Python | ucb_cs61A/projects/scheme/tests/01.py | tavaresdong/courses-notes | 7fb89103bca679f5ef9b14cbc777152daac1402e | [
"MIT"
] | null | null | null | ucb_cs61A/projects/scheme/tests/01.py | tavaresdong/courses-notes | 7fb89103bca679f5ef9b14cbc777152daac1402e | [
"MIT"
] | 1 | 2017-07-31T08:15:26.000Z | 2017-07-31T08:15:26.000Z | ucb_cs61A/projects/scheme/tests/01.py | tavaresdong/courses-notes | 7fb89103bca679f5ef9b14cbc777152daac1402e | [
"MIT"
] | 1 | 2019-10-06T16:52:31.000Z | 2019-10-06T16:52:31.000Z | test = {
'name': 'Question 1',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> read_line('3')
3
>>> read_line('-123')
-123
>>> read_line('1.25')
1.25
>>> read_line('true')
True
>>> read_line('(a)')
Pair('a', nil)
>>> read_line(')')
SyntaxError
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> read_line(" (quote x) ")
Pair('quote', Pair('x', nil))
>>> read_line(" 'x ")
Pair('quote', Pair('x', nil))
>>> read_line(" (a b) ")
Pair('a', Pair('b', nil))
>>> read_line(" '(a b) ")
Pair('quote', Pair(Pair('a', Pair('b', nil)), nil))
>>> read_line(" '((a)) ")
Pair('quote', Pair(Pair(Pair('a', nil), nil), nil))
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> read_line("(a (b 'c))")
Pair('a', Pair(Pair('b', Pair(Pair('quote', Pair('c', nil)), nil)), nil))
>>> read_line("(a (b '(c d)))")
Pair('a', Pair(Pair('b', Pair(Pair('quote', Pair(Pair('c', Pair('d', nil)), nil)), nil)), nil))
>>> read_line("')")
SyntaxError
""",
'hidden': False,
'locked': False
}
],
'scored': True,
'setup': r"""
>>> from scheme_reader import *
""",
'teardown': '',
'type': 'doctest'
}
]
} | 25.903226 | 105 | 0.356787 | 159 | 1,606 | 3.509434 | 0.226415 | 0.200717 | 0.137993 | 0.086022 | 0.596774 | 0.489247 | 0.448029 | 0.448029 | 0.111111 | 0 | 0 | 0.016878 | 0.409714 | 1,606 | 62 | 106 | 25.903226 | 0.57173 | 0 | 0 | 0.274194 | 0 | 0.032258 | 0.756689 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.016129 | 0 | 0.016129 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ef8561d8e5765aa9c050bc1d601e063adb533a5a | 880 | py | Python | biobb_adapters/pycompss/biobb_chemistry/acpype/acpype_params_gmx_pc.py | jfennick/biobb_adapters | a37c1c696476c93225e7d3c661b0d4393af9dfe1 | [
"Apache-2.0"
] | null | null | null | biobb_adapters/pycompss/biobb_chemistry/acpype/acpype_params_gmx_pc.py | jfennick/biobb_adapters | a37c1c696476c93225e7d3c661b0d4393af9dfe1 | [
"Apache-2.0"
] | 4 | 2019-03-04T15:22:06.000Z | 2021-09-24T14:43:48.000Z | biobb_adapters/pycompss/biobb_chemistry/acpype/acpype_params_gmx_pc.py | jfennick/biobb_adapters | a37c1c696476c93225e7d3c661b0d4393af9dfe1 | [
"Apache-2.0"
] | 2 | 2020-09-08T05:26:23.000Z | 2022-03-28T07:09:20.000Z | import traceback
from pycompss.api.task import task
from pycompss.api.constraint import constraint
from pycompss.api.parameter import FILE_IN, FILE_OUT
from biobb_common.tools import file_utils as fu
from biobb_chemistry.acpype import acpype_params_gmx
@task(input_path=FILE_IN, output_path_gro=FILE_OUT, output_path_itp=FILE_OUT, output_path_top=FILE_OUT)
def acpype_params_gmx_pc(input_path, output_path_gro, output_path_itp, output_path_top, properties, **kwargs):
try:
acpype_params_gmx.AcpypeParamsGMX(input_path=input_path, output_path_gro=output_path_gro, output_path_itp=output_path_itp, output_path_top=output_path_top, properties=properties, **kwargs).launch()
except Exception:
traceback.print_exc()
fu.write_failed_output(output_path_gro)
fu.write_failed_output(output_path_itp)
fu.write_failed_output(output_path_top)
| 51.764706 | 205 | 0.819318 | 135 | 880 | 4.918519 | 0.296296 | 0.225904 | 0.097892 | 0.085843 | 0.314759 | 0.314759 | 0.15512 | 0.108434 | 0 | 0 | 0 | 0 | 0.111364 | 880 | 16 | 206 | 55 | 0.849105 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0 | 0.4 | 0 | 0.466667 | 0.066667 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
efa0edb6830ecdd8f62c11503e224d5300cba3ce | 556 | py | Python | api/migrations/0006_auto_20210319_1914.py | folksgl/identity-give-transaction-logging | 68497ad03b7cea5f340eae65ebb9b26a084b5c6f | [
"CC0-1.0"
] | null | null | null | api/migrations/0006_auto_20210319_1914.py | folksgl/identity-give-transaction-logging | 68497ad03b7cea5f340eae65ebb9b26a084b5c6f | [
"CC0-1.0"
] | null | null | null | api/migrations/0006_auto_20210319_1914.py | folksgl/identity-give-transaction-logging | 68497ad03b7cea5f340eae65ebb9b26a084b5c6f | [
"CC0-1.0"
] | null | null | null | # Generated by Django 3.1.5 on 2021-03-19 19:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("api", "0005_auto_20210319_1640"),
]
operations = [
migrations.AlterField(
model_name="transactionrecord",
name="csp",
field=models.CharField(max_length=16),
),
migrations.AlterField(
model_name="transactionrecord",
name="provider",
field=models.CharField(max_length=16),
),
]
| 23.166667 | 50 | 0.586331 | 55 | 556 | 5.8 | 0.654545 | 0.125392 | 0.15674 | 0.181818 | 0.507837 | 0.507837 | 0 | 0 | 0 | 0 | 0 | 0.090206 | 0.302158 | 556 | 23 | 51 | 24.173913 | 0.731959 | 0.080935 | 0 | 0.470588 | 1 | 0 | 0.139489 | 0.045187 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.235294 | 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 | 0 | 0 | 0 | 0 | 0 | 2 |
efc47ee94f8ccd46030548fed80045357ae40159 | 435 | py | Python | market/authentications/tests/test_setup.py | hbvj99/market-api | 489c9433556002cb391b93cbd6486da739c2418a | [
"MIT"
] | 1 | 2021-08-28T05:30:40.000Z | 2021-08-28T05:30:40.000Z | market/authentications/tests/test_setup.py | hbvj99/market-api | 489c9433556002cb391b93cbd6486da739c2418a | [
"MIT"
] | 1 | 2022-01-14T08:57:19.000Z | 2022-01-14T08:57:20.000Z | market/authentications/tests/test_setup.py | hbvj99/market-api | 489c9433556002cb391b93cbd6486da739c2418a | [
"MIT"
] | 1 | 2022-01-11T10:14:27.000Z | 2022-01-11T10:14:27.000Z | from django.urls import reverse
from rest_framework.test import APITestCase
class TestSetUp(APITestCase):
def setUp(self):
self.register_url = reverse('user-register')
self.login_url = 'api/v1/auth/token/'
self.user_data = {
'email': 'admin@admin.com',
'password': '@Aq123456',
}
return super().setUp()
def tearDown(self):
return super().tearDown()
| 21.75 | 52 | 0.602299 | 48 | 435 | 5.375 | 0.645833 | 0.085271 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022082 | 0.271264 | 435 | 19 | 53 | 22.894737 | 0.791798 | 0 | 0 | 0 | 0 | 0 | 0.156322 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0.076923 | 0.153846 | 0.076923 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
efc8add53c9633e840c5f7e5152865760c50b810 | 1,091 | py | Python | steamspy/ss.py | itoama/steamspy-get | 6e6cdc2b2d233e53b5e1f5943ea10e8b2e46d851 | [
"MIT"
] | null | null | null | steamspy/ss.py | itoama/steamspy-get | 6e6cdc2b2d233e53b5e1f5943ea10e8b2e46d851 | [
"MIT"
] | null | null | null | steamspy/ss.py | itoama/steamspy-get | 6e6cdc2b2d233e53b5e1f5943ea10e8b2e46d851 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import requests
class Connection():
base_url = 'https://steamspy.com/api.php'
def request(self,url):
body = requests.get(self.base_url + url)
return body
class Response():
def __init__(self,status,data):
self.status = status
self.data = data
connect = Connection()
def appdetails(appid):
req = connect.request("?request=appdetails&appid={}".format(appid))
return Response(req.status_code, req.json())
def genre(genre):
req = connect.request("?request=appdetails&appid={}".format(genre))
return Response(req.status_code, req.json())
def top100in2weeks():
req = connect.request("?request=top100in2weeks")
return Response(req.status_code, req.json())
def top100forever():
req = connect.request("?request=top100forever")
return Response(req.status_code, req.json())
def top100owned():
req = connect.request("?request=top100owned")
return Response(req.status_code, req.json())
def all():
req = connect.request("?request=all")
return Response(req.status_code, req.json())
| 27.275 | 71 | 0.678277 | 134 | 1,091 | 5.432836 | 0.268657 | 0.082418 | 0.14011 | 0.197802 | 0.424451 | 0.424451 | 0.424451 | 0.254121 | 0 | 0 | 0 | 0.023128 | 0.167736 | 1,091 | 39 | 72 | 27.974359 | 0.778634 | 0.019248 | 0 | 0.206897 | 0 | 0 | 0.150749 | 0.094569 | 0 | 0 | 0 | 0 | 0 | 1 | 0.275862 | false | 0 | 0.034483 | 0 | 0.655172 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
efe2f11d17888a06328ba9ad5210b136db8bc099 | 800 | py | Python | node/less.py | muddyfish/PYKE | f1bb0f5d7af5663129bd37ca58a0246e5a3699c7 | [
"MIT"
] | 24 | 2016-02-21T07:41:45.000Z | 2021-08-12T04:34:00.000Z | node/less.py | muddyfish/PYKE | f1bb0f5d7af5663129bd37ca58a0246e5a3699c7 | [
"MIT"
] | 1 | 2017-08-18T08:14:57.000Z | 2017-08-19T14:59:08.000Z | node/less.py | muddyfish/PYKE | f1bb0f5d7af5663129bd37ca58a0246e5a3699c7 | [
"MIT"
] | 4 | 2016-08-06T18:07:13.000Z | 2017-08-12T13:51:52.000Z | #!/usr/bin/env python
from nodes import Node
class Less(Node):
char = "<"
args = 2
results = 1
@Node.test_func([4,2], [0])
@Node.test_func([0,0], [0])
@Node.test_func([4,5], [1])
def func(self, a,b):
"""a<b"""
return (a<b)+0
@Node.test_func(["test",2], ["te"])
def indexable_1(self, a:Node.indexable, b:int):
"""a[:b]"""
return [a[:b]]
@Node.test_func([1,"test"], ["tes"])
def indexable_2(self, a:int, b:Node.indexable):
"""b[:-a]"""
return [b[:-a]]
def inf_over_n(self, n: int, inf: Node.infinite):
return inf.modify(inf.filter_code, "{}>".format(n))
def inf_under_n(self, inf: Node.infinite, n: int):
return inf.modify(inf.filter_code, "{}<".format(n))
| 25 | 59 | 0.5175 | 121 | 800 | 3.31405 | 0.31405 | 0.099751 | 0.149626 | 0.097257 | 0.224439 | 0.174564 | 0.174564 | 0.174564 | 0 | 0 | 0 | 0.027119 | 0.2625 | 800 | 31 | 60 | 25.806452 | 0.652542 | 0.04625 | 0 | 0 | 0 | 0 | 0.026774 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.05 | 0.1 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
efe3b83c6214d8e3dea9e103b915f1a7655e5e51 | 994 | py | Python | amfe/__init__.py | c-meyer/github-spielwiese | 0dad8df6277a09b2f250010b476854dc91d4d8ad | [
"BSD-3-Clause"
] | null | null | null | amfe/__init__.py | c-meyer/github-spielwiese | 0dad8df6277a09b2f250010b476854dc91d4d8ad | [
"BSD-3-Clause"
] | null | null | null | amfe/__init__.py | c-meyer/github-spielwiese | 0dad8df6277a09b2f250010b476854dc91d4d8ad | [
"BSD-3-Clause"
] | null | null | null | #!/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017, Lehrstuhl fuer Angewandte Mechanik, Technische
# Universitaet Muenchen.
#
# Distributed under BSD-3-Clause License. See LICENSE-File for more information
#
"""
Module for advanced nonlinear finite element analysis. This software is
developed and maintained at the Chair for Applied Mechanics,
Technical University of Munich.
Authors:
Johannes Rutzmoser, Fabian Gruber
"""
from __future__ import absolute_import
# Finite Element stuff
from .assembly import *
from .boundary import *
from .element import *
from .material import *
from .mechanical_system import *
from .mesh import *
from .solver import *
from .tools import *
# Reduction stuff
from .reduced_basis import *
from .hyper_red import *
# Structural dynamics
from .structural_dynamics import *
# Commented out as a dill dependency is required only here
from .num_exp_toolbox import *
# from .hyper_red import *
__author__ = 'Johannes Rutzmoser, Fabian Gruber'
| 23.666667 | 79 | 0.77163 | 129 | 994 | 5.821705 | 0.666667 | 0.11984 | 0.061252 | 0.07723 | 0.063915 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008323 | 0.153924 | 994 | 41 | 80 | 24.243902 | 0.884661 | 0.55835 | 0 | 0 | 0 | 0 | 0.078759 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.928571 | 0 | 0.928571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
efff4fd2b092944eb403e968ef0f56adc330a50b | 211 | py | Python | script-under-itest.py | solarkennedy/instant-py-bt | f615a7511fe9b04520efcfa2f484cb61efa56aa5 | [
"Apache-2.0"
] | 1 | 2020-04-28T03:45:47.000Z | 2020-04-28T03:45:47.000Z | script-under-itest.py | solarkennedy/instant-py-bt | f615a7511fe9b04520efcfa2f484cb61efa56aa5 | [
"Apache-2.0"
] | 1 | 2018-08-11T07:47:33.000Z | 2018-08-11T07:47:33.000Z | script-under-itest.py | solarkennedy/instant-py-bt | f615a7511fe9b04520efcfa2f484cb61efa56aa5 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
import time
def level3():
while True:
level3="level3"
time.sleep(1)
def level2():
level3()
def level1():
level2()
if __name__ == '__main__':
level1()
| 10.55 | 26 | 0.563981 | 25 | 211 | 4.44 | 0.68 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.059603 | 0.28436 | 211 | 19 | 27 | 11.105263 | 0.675497 | 0.094787 | 0 | 0 | 0 | 0 | 0.073684 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.090909 | 0 | 0.363636 | 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 | 0 | 0 | 0 | 0 | 2 |
4bd0c3afcac3a268209e9980200d08e6e86b72f9 | 549 | py | Python | dielectric.py | FlorSanders/EM_Scattering | bf61f8454ed8e3ba9f7265d88e2dd706b3746111 | [
"MIT"
] | null | null | null | dielectric.py | FlorSanders/EM_Scattering | bf61f8454ed8e3ba9f7265d88e2dd706b3746111 | [
"MIT"
] | 1 | 2021-08-24T05:03:05.000Z | 2021-10-31T06:00:34.000Z | dielectric.py | FlorSanders/EM_Scattering | bf61f8454ed8e3ba9f7265d88e2dd706b3746111 | [
"MIT"
] | null | null | null | ### Dielectric class
class Dielectric:
## Intialization function with all properties
def __init__(self, pos_x, pos_y, width, height, eps_r):
self.pos_x = pos_x
self.pos_y = pos_y
self.width = width
self.height = height
self.eps_r = eps_r
## String representation functions
def __str__(self):
return "x: {}, y: {}, w: {}, h: {}, eps_r: {}".format(
self.pos_x, self.pos_y, self.width, self.height, self.eps_r
)
def __repr__(self):
return self.__str__()
| 28.894737 | 71 | 0.588342 | 74 | 549 | 3.972973 | 0.351351 | 0.119048 | 0.081633 | 0.07483 | 0.081633 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.287796 | 549 | 18 | 72 | 30.5 | 0.751918 | 0.165756 | 0 | 0 | 0 | 0 | 0.082222 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0 | 0.153846 | 0.461538 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
4bdc7e580bd7e23a74fde883a37f9ad781910b41 | 737 | py | Python | core/migrations/0013_abouttext.py | mhn-mnsr/Portfolio | 3414eff08d7974965717b95537d5972312003030 | [
"MIT"
] | 6 | 2018-02-01T16:57:29.000Z | 2022-02-08T08:30:35.000Z | core/migrations/0013_abouttext.py | mhn-mnsr/Portfolio | 3414eff08d7974965717b95537d5972312003030 | [
"MIT"
] | 2 | 2018-01-28T10:32:09.000Z | 2018-04-17T13:41:11.000Z | core/migrations/0013_abouttext.py | mhn-mnsr/Portfolio | 3414eff08d7974965717b95537d5972312003030 | [
"MIT"
] | 4 | 2019-08-08T20:15:33.000Z | 2020-10-01T04:18:32.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-09 15:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0012_auto_20170909_1433'),
]
operations = [
migrations.CreateModel(
name='AboutText',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('about_text', models.TextField()),
('profile_text', models.TextField()),
('skill_text', models.TextField()),
('certification_text', models.TextField()),
],
),
]
| 28.346154 | 114 | 0.573948 | 72 | 737 | 5.666667 | 0.694444 | 0.098039 | 0.186275 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.062977 | 0.28901 | 737 | 25 | 115 | 29.48 | 0.715649 | 0.092266 | 0 | 0 | 1 | 0 | 0.135135 | 0.034535 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.111111 | 0 | 0.277778 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4bf0a2f6e12435b11b464d6f58d1cc1a967584eb | 9,460 | py | Python | pysnmp/CONV-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/CONV-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/CONV-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module CONV-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CONV-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:11:06 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection")
Alias, cxConv = mibBuilder.importSymbols("CXProduct-SMI", "Alias", "cxConv")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
ObjectIdentity, iso, Bits, TimeTicks, Counter32, Counter64, Gauge32, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, Unsigned32, NotificationType, ModuleIdentity, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "iso", "Bits", "TimeTicks", "Counter32", "Counter64", "Gauge32", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "Unsigned32", "NotificationType", "ModuleIdentity", "Integer32")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
cxConvTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 1), )
if mibBuilder.loadTexts: cxConvTable.setStatus('mandatory')
cxConvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 1, 1), ).setIndexNames((0, "CONV-MIB", "cxConvPort"))
if mibBuilder.loadTexts: cxConvEntry.setStatus('mandatory')
cxConvPort = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxConvPort.setStatus('mandatory')
cxConvPortAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 1, 1, 2), Alias()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxConvPortAlias.setStatus('mandatory')
cxConvRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("invalid", 1), ("valid", 2))).clone('valid')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxConvRowStatus.setStatus('mandatory')
cxConvIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 1, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxConvIfIndex.setStatus('mandatory')
cxConvState = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 2))).clone('on')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxConvState.setStatus('mandatory')
cxConvCompression = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 1, 1, 6), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxConvCompression.setStatus('mandatory')
cxConvCompCompatibility = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("compatibleMemotec", 1), ("compatibleACC", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxConvCompCompatibility.setStatus('mandatory')
cxFwkCircuitTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2), )
if mibBuilder.loadTexts: cxFwkCircuitTable.setStatus('mandatory')
cxFwkCircuitEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1), ).setIndexNames((0, "CONV-MIB", "cxFwkCircuitPort"))
if mibBuilder.loadTexts: cxFwkCircuitEntry.setStatus('mandatory')
cxFwkCircuitPort = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxFwkCircuitPort.setStatus('mandatory')
cxFwkCircuitState = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(256, 1, 2, 3, 4))).clone(namedValues=NamedValues(("idle", 256), ("opened", 1), ("closed", 2), ("opening", 3), ("openFailed", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxFwkCircuitState.setStatus('mandatory')
cxFwkCircuitRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("invalid", 1), ("valid", 2))).clone('valid')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxFwkCircuitRowStatus.setStatus('mandatory')
cxFwkServiceType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 256))).clone(namedValues=NamedValues(("frameRelay", 1), ("notSpecified", 256)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxFwkServiceType.setStatus('mandatory')
cxFwkServiceProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("cls", 1), ("pvc", 2), ("svc", 3), ("char", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxFwkServiceProtocol.setStatus('mandatory')
cxFwkServiceName = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxFwkServiceName.setStatus('mandatory')
cxFwkDestAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(20, 20)).setFixedLength(20)).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxFwkDestAddress.setStatus('mandatory')
cxFwkDestAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 8), Alias()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxFwkDestAlias.setStatus('mandatory')
cxFwkServiceCircuitMdu = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 8192)).clone(1600)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxFwkServiceCircuitMdu.setStatus('mandatory')
cxFwkServiceCost = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1000000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxFwkServiceCost.setStatus('mandatory')
cxFwkServiceCardId = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxFwkServiceCardId.setStatus('mandatory')
cxFwkServiceSapId = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxFwkServiceSapId.setStatus('mandatory')
cxFwkServiceRouteRef = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxFwkServiceRouteRef.setStatus('mandatory')
cxFwkStatsInternalErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxFwkStatsInternalErrors.setStatus('mandatory')
cxFwkStatsRegistrationErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxFwkStatsRegistrationErrors.setStatus('mandatory')
cxFwkStatsQueryErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxFwkStatsQueryErrors.setStatus('mandatory')
cxFwkStatsOpenErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxFwkStatsOpenErrors.setStatus('mandatory')
cxFwkStatsResets = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 8, 2, 1, 19), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxFwkStatsResets.setStatus('mandatory')
mibBuilder.exportSymbols("CONV-MIB", cxConvState=cxConvState, cxConvRowStatus=cxConvRowStatus, cxConvPortAlias=cxConvPortAlias, cxFwkServiceCardId=cxFwkServiceCardId, cxFwkStatsOpenErrors=cxFwkStatsOpenErrors, cxFwkDestAlias=cxFwkDestAlias, cxConvCompCompatibility=cxConvCompCompatibility, cxFwkStatsQueryErrors=cxFwkStatsQueryErrors, cxFwkServiceName=cxFwkServiceName, cxFwkServiceProtocol=cxFwkServiceProtocol, cxFwkDestAddress=cxFwkDestAddress, cxConvEntry=cxConvEntry, cxConvIfIndex=cxConvIfIndex, cxFwkServiceCircuitMdu=cxFwkServiceCircuitMdu, cxFwkServiceCost=cxFwkServiceCost, cxFwkCircuitPort=cxFwkCircuitPort, cxFwkStatsInternalErrors=cxFwkStatsInternalErrors, cxFwkServiceSapId=cxFwkServiceSapId, cxFwkCircuitTable=cxFwkCircuitTable, cxFwkStatsRegistrationErrors=cxFwkStatsRegistrationErrors, cxConvPort=cxConvPort, cxFwkCircuitEntry=cxFwkCircuitEntry, cxFwkCircuitState=cxFwkCircuitState, cxFwkCircuitRowStatus=cxFwkCircuitRowStatus, cxFwkServiceType=cxFwkServiceType, cxFwkStatsResets=cxFwkStatsResets, cxFwkServiceRouteRef=cxFwkServiceRouteRef, cxConvTable=cxConvTable, cxConvCompression=cxConvCompression)
| 127.837838 | 1,119 | 0.757294 | 1,086 | 9,460 | 6.596685 | 0.151934 | 0.0134 | 0.012563 | 0.016192 | 0.480039 | 0.340034 | 0.25 | 0.241625 | 0.241625 | 0.232133 | 0 | 0.076959 | 0.082452 | 9,460 | 73 | 1,120 | 129.589041 | 0.748387 | 0.03277 | 0 | 0 | 0 | 0 | 0.123181 | 0.004813 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.106061 | 0 | 0.106061 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4bf53c23748eb9562777c4c07ea86572901c5149 | 690 | py | Python | src/FeatureCreator/DeepFMFeatureCreator.py | xiaoye-hua/recommendation_system | 860fcbe221f69030a26e4eee291270922e48e9ee | [
"MIT"
] | null | null | null | src/FeatureCreator/DeepFMFeatureCreator.py | xiaoye-hua/recommendation_system | 860fcbe221f69030a26e4eee291270922e48e9ee | [
"MIT"
] | null | null | null | src/FeatureCreator/DeepFMFeatureCreator.py | xiaoye-hua/recommendation_system | 860fcbe221f69030a26e4eee291270922e48e9ee | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# @File : DeepFMFeatureCreator.py
# @Author : Hua Guo
# @Time : 2021/11/7 上午9:40
# @Disc :
import pandas as pd
from typing import Tuple, List
from src.FeatureCreator import BaseFeatureCreator
from src.config import criteo_dense_features, criteo_sparse_features
class DeepFMFeatureCreator(BaseFeatureCreator):
def get_features(self, df: pd.DataFrame, **kwargs) -> Tuple[pd.DataFrame, List[str]]:
df[criteo_sparse_features] = df[criteo_sparse_features].fillna('-1', )
df[criteo_dense_features] = df[criteo_dense_features].fillna(0, )
feature_cols = criteo_sparse_features+criteo_dense_features
return df, feature_cols
| 34.5 | 89 | 0.728986 | 88 | 690 | 5.5 | 0.522727 | 0.090909 | 0.157025 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022569 | 0.165217 | 690 | 19 | 90 | 36.315789 | 0.817708 | 0.165217 | 0 | 0 | 0 | 0 | 0.003509 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.4 | 0 | 0.7 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
4bf5db5ee2310386ed1fce2acae05b3b9ee19981 | 688 | py | Python | backend/api/models/competitions.py | ChristchurchCityWeightlifting/lifter-api | a82b79c75106e7f4f8ea4b4e3e12d727213445e3 | [
"MIT"
] | null | null | null | backend/api/models/competitions.py | ChristchurchCityWeightlifting/lifter-api | a82b79c75106e7f4f8ea4b4e3e12d727213445e3 | [
"MIT"
] | 5 | 2022-03-07T08:30:47.000Z | 2022-03-22T09:15:52.000Z | backend/api/models/competitions.py | ChristchurchCityWeightlifting/lifter-api | a82b79c75106e7f4f8ea4b4e3e12d727213445e3 | [
"MIT"
] | null | null | null | from config.settings.base import HASHID_FIELD_SALT
from django.db import models
from hashid_field import HashidAutoField
class Competition(models.Model):
reference_id = HashidAutoField(
primary_key=True, salt=f"competitionmodel_reference_id_{HASHID_FIELD_SALT}"
)
competition_name = models.CharField(max_length=128, blank=True)
# TODO: list of gyms?
location = models.CharField(max_length=128, blank=True)
date_start = models.DateField(blank=True)
date_end = models.DateField(blank=True)
class Meta:
ordering = ["-date_start", "competition_name"]
def __str__(self):
return f"{self.competition_name} {self.date_start.year}"
| 31.272727 | 83 | 0.736919 | 88 | 688 | 5.5 | 0.5 | 0.07438 | 0.061983 | 0.099174 | 0.14876 | 0.14876 | 0.14876 | 0 | 0 | 0 | 0 | 0.010471 | 0.167151 | 688 | 21 | 84 | 32.761905 | 0.834206 | 0.027616 | 0 | 0 | 0 | 0 | 0.182909 | 0.14093 | 0 | 0 | 0 | 0.047619 | 0 | 1 | 0.066667 | false | 0 | 0.2 | 0.066667 | 0.8 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
4bf5f4463f906aae4c1bbd935ffa5e34a5c6f153 | 521 | py | Python | mmdet/core/bbox/assigners/__init__.py | yanglinGEM/ReDet | 80cb7b0643c57aa2641ad6a1fc5eada4e575fcfe | [
"Apache-2.0"
] | 270 | 2021-03-14T03:36:53.000Z | 2022-03-31T02:44:12.000Z | mmdet/core/bbox/assigners/__init__.py | yanglinGEM/ReDet | 80cb7b0643c57aa2641ad6a1fc5eada4e575fcfe | [
"Apache-2.0"
] | 148 | 2021-03-18T09:44:02.000Z | 2022-03-31T06:01:39.000Z | mmdet/core/bbox/assigners/__init__.py | yanglinGEM/ReDet | 80cb7b0643c57aa2641ad6a1fc5eada4e575fcfe | [
"Apache-2.0"
] | 70 | 2021-03-14T15:18:25.000Z | 2022-03-21T07:36:21.000Z | from .base_assigner import BaseAssigner
from .max_iou_assigner import MaxIoUAssigner
from .approx_max_iou_assigner import ApproxMaxIoUAssigner
from .assign_result import AssignResult
from .max_iou_assigner_hbb_cy import MaxIoUAssignerCy
from .max_iou_assigner_rbbox import MaxIoUAssignerRbbox
from .approx_max_iou_assigner_cy import ApproxMaxIoUAssignerCy
__all__ = [
'BaseAssigner', 'MaxIoUAssigner', 'ApproxMaxIoUAssigner', 'AssignResult',
'MaxIoUAssignerCy', 'MaxIoUAssignerRbbox','ApproxMaxIoUAssignerCy'
]
| 40.076923 | 77 | 0.850288 | 54 | 521 | 7.796296 | 0.37037 | 0.071259 | 0.166271 | 0.128266 | 0.114014 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.092131 | 521 | 12 | 78 | 43.416667 | 0.890063 | 0 | 0 | 0 | 0 | 0 | 0.220729 | 0.042226 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.636364 | 0 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
4bf66fda677cb9d3cbea5c696c2235509322c90f | 250 | py | Python | tests/types/test_camel_json.py | kikeh/django-graphql-extensions | 951b295235ca68270066cc70148e2ae937d4eb56 | [
"MIT"
] | 1 | 2019-06-19T12:05:24.000Z | 2019-06-19T12:05:24.000Z | tests/types/test_camel_json.py | kikeh/django-graphql-extensions | 951b295235ca68270066cc70148e2ae937d4eb56 | [
"MIT"
] | null | null | null | tests/types/test_camel_json.py | kikeh/django-graphql-extensions | 951b295235ca68270066cc70148e2ae937d4eb56 | [
"MIT"
] | null | null | null | from django.test import TestCase
from graphql_extensions import types
class CamelJSONTypeTests(TestCase):
def test_camel_json(self):
json_type = types.CamelJSON()
self.assertIn('aB', json_type.serialize({'a_b': None}).keys())
| 22.727273 | 70 | 0.72 | 32 | 250 | 5.4375 | 0.71875 | 0.091954 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.168 | 250 | 10 | 71 | 25 | 0.836538 | 0 | 0 | 0 | 0 | 0 | 0.02 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
4bfcf98b651c9e490a20056edf749ad524dbdaec | 769 | py | Python | tests/unit/collector/test_mock_MockSummarizer.py | shane-breeze/AlphaTwirl | 59dbd5348af31d02e133d43fd5bfaad6b99a155e | [
"BSD-3-Clause"
] | null | null | null | tests/unit/collector/test_mock_MockSummarizer.py | shane-breeze/AlphaTwirl | 59dbd5348af31d02e133d43fd5bfaad6b99a155e | [
"BSD-3-Clause"
] | 7 | 2018-02-26T10:32:26.000Z | 2018-03-19T12:27:12.000Z | tests/unit/collector/test_mock_MockSummarizer.py | shane-breeze/AlphaTwirl | 59dbd5348af31d02e133d43fd5bfaad6b99a155e | [
"BSD-3-Clause"
] | null | null | null | import unittest
from .mock import MockSummarizer
##__________________________________________________________________||
class TestMockSummarizer(unittest.TestCase):
def setUp(self):
self.obj1 = MockSummarizer((1, 2))
self.obj2 = MockSummarizer((3, 4))
def tearDown(self):
pass
def test_repr(self):
repr(self.obj1)
def test_add(self):
obj3 = self.obj1 + self.obj2
self.assertEqual((1, 2, 3, 4), obj3._results)
def test_radd(self):
obj3 = sum([self.obj1, self.obj2])
self.assertEqual((1, 2, 3, 4), obj3._results)
def test_to_tuple_list(self):
self.assertEqual((1, 2), self.obj1.to_tuple_list())
##__________________________________________________________________||
| 25.633333 | 70 | 0.674902 | 84 | 769 | 4.488095 | 0.357143 | 0.106101 | 0.127321 | 0.135279 | 0.281167 | 0.281167 | 0.281167 | 0.281167 | 0.281167 | 0.281167 | 0 | 0.042623 | 0.206762 | 769 | 29 | 71 | 26.517241 | 0.57541 | 0.176853 | 0 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0.333333 | false | 0.055556 | 0.111111 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
4bfdadde10979c9830c24fc6794d83d87d421315 | 1,847 | py | Python | tests.py | lion137/Propositional_calcullus_evaluate | 6197877df6a051bcce9c133e648abb6fb4bd66cb | [
"MIT"
] | 3 | 2019-10-28T22:06:49.000Z | 2020-03-19T09:18:10.000Z | tests.py | lion137/Propositional_calcullus_evaluate | 6197877df6a051bcce9c133e648abb6fb4bd66cb | [
"MIT"
] | 1 | 2019-11-02T20:42:34.000Z | 2019-11-05T02:22:29.000Z | tests.py | lion137/propositional_calculus_evaluate | 6197877df6a051bcce9c133e648abb6fb4bd66cb | [
"MIT"
] | null | null | null | #
# Tests file
#
from eval import *
import pytest
def test_eval():
assert process("a && (a =>b) => b") == "Formula is tautology"
assert process("(P || (Q || R)) <=>((P || Q) || R)") == "Formula is tautology"
assert process("~(Q && P) <=> (~P || ~Q)") == "Formula is tautology"
assert process("((P => Q) && (Q => R)) => (P => R)") == "Formula is tautology"
assert process("~(Q && P) <=> (~P || Z)") == "Formula is satisfiable"
assert process("P && Q") == "Formula is satisfiable"
def test_bal_parenthesis1():
assert bal_parenthesis("()") is True
assert bal_parenthesis("(()") is False
assert bal_parenthesis("())") is False
def test_after_letter():
assert after_letter("(A => ~B)") is True
assert after_letter("(A => B~)") is False
assert after_letter("(A(B) => B)") is False
assert after_letter("()") is True
def test_after_left_paren():
assert after_left_paren("(A || B") is True
assert after_left_paren("(~A || B") is True
assert after_left_paren("((A) || B") is True
assert after_left_paren("(=> ~A") is False
def test_operands_operators_number():
assert operands_operators_number("") is True
assert operands_operators_number("A => A ~") is True
assert operands_operators_number("A => A => ~A => ") is False
def test_formula_start():
assert formula_start("") is True
assert formula_start("( )(") is True
assert formula_start("=>") is False
assert formula_start("~=>sss") is True
assert formula_start("a~~a~") is True
def test_check():
assert check("") is True
assert check("~(A)") is True
assert check("~)") == "Syntax error"
assert check("(AA => AA") == "Invalid symbols"
assert check("(A => ") == "Syntax error"
assert check("A => A)") == "Syntax error"
assert check("~A => ~") == "Syntax error"
| 29.31746 | 82 | 0.600975 | 250 | 1,847 | 4.28 | 0.16 | 0.078505 | 0.134579 | 0.08972 | 0.61215 | 0.48972 | 0.357944 | 0.296262 | 0.227103 | 0.098131 | 0 | 0.000684 | 0.208446 | 1,847 | 62 | 83 | 29.790323 | 0.73119 | 0.005414 | 0 | 0 | 0 | 0 | 0.256831 | 0 | 0 | 0 | 0 | 0 | 0.780488 | 1 | 0.170732 | true | 0 | 0.04878 | 0 | 0.219512 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ef0f7d7fb7adac1de85c9a48f9595cdd600eb26f | 4,749 | py | Python | RIR_Generation/Augment_RIR.py | ishine/IR-GAN | 3f21355b1071384a9700bf7f4916273281f41a41 | [
"MIT"
] | 15 | 2020-10-31T22:28:45.000Z | 2022-02-12T14:02:51.000Z | RIR_Generation/Augment_RIR.py | ishine/IR-GAN | 3f21355b1071384a9700bf7f4916273281f41a41 | [
"MIT"
] | null | null | null | RIR_Generation/Augment_RIR.py | ishine/IR-GAN | 3f21355b1071384a9700bf7f4916273281f41a41 | [
"MIT"
] | 5 | 2020-11-22T12:36:08.000Z | 2021-10-31T08:06:34.000Z | import matlab.engine
import tensorflow as tf
from IPython.display import display, Audio
import math
import os
import numpy as np
import librosa
eng = matlab.engine.start_matlab()
tf.reset_default_graph()
saver = tf.train.import_meta_graph('infer.meta')
graph = tf.get_default_graph()
sess = tf.InteractiveSession()
saver.restore(sess, 'model.ckpt')
#The number of augmented data to be generated
augment_sum = 1000
#Directory pointing to real RIRs
directory = '../RIR/'
entries = os.listdir(directory)
#Reverberation
bin_NRT = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
bin_RT = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
NRT_start =0.6
NRT_width =0.05
NRT_size =36
#Direct to Reverberant Ratio
bin_NDRR = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
bin_DRR = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
NDRR_start =-18
NDRR_width =2
NDRR_size =16
#Early to Late Index
bin_NCTE = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
bin_CTE = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
NCTE_start =-5
NCTE_width =1
NCTE_size =27
#Early Decay TIme
bin_NEDT = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
bin_EDT = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
NEDT_start =0
NEDT_width =0.1
NEDT_size =16
sample_n = 0
print("Learning the distribution of real RIRs")
for name in entries:
# print("Name ",name)
file = directory +name
IrStat = eng.iosr.acoustics.irStats(file,nargout=5)
RT60 = IrStat[0]
DRR = IrStat[1]
CTE = IrStat[2]
EDT = IrStat[4]
for i in range(NRT_size):
if((RT60>=(NRT_start+(NRT_width*i))) and (RT60<(NRT_start+(NRT_width*(i+1))))):
for j in range(NDRR_size):
if((DRR>=(NDRR_start+(NDRR_width*j))) and (DRR<(NDRR_start+(NDRR_width*(j+1))))):
for k in range(NCTE_size):
if((CTE>=(NCTE_start+(NCTE_width*k))) and (CTE<(NCTE_start+(NCTE_width*(k+1))))):
for l in range(NEDT_size):
if((EDT>=(NEDT_start+(NEDT_width*l))) and (EDT<(NEDT_start+(NEDT_width*(l+1))))):
sample_n = sample_n+1
bin_NRT[i] = bin_NRT[i]+1
bin_NDRR[j] = bin_NDRR[j]+1
bin_NCTE[k] = bin_NCTE[k] +1
bin_NEDT[l] = bin_NEDT[l] +1
sample_ratio = math.ceil((augment_sum/sample_n)*1.5)
print("IR Statistics Distribution of real RIR")
bin_NRT=[element * math.ceil(sample_ratio) for element in bin_NRT]
bin_NDRR=[element * math.ceil(sample_ratio) for element in bin_NDRR]
bin_NCTE=[element * math.ceil(sample_ratio) for element in bin_NCTE]
bin_NEDT=[element * math.ceil(sample_ratio) for element in bin_NEDT]
print("RT Distribution : ", bin_NRT)
print("DRR Distribution : ", bin_NDRR)
print("CTE Distribution : ", bin_NCTE)
print("EDT Distribution : ", bin_NEDT)
sample_n=0
while(sample_n<augment_sum):
# Create 50 random latent vectors z
_z = (np.random.rand(1000, 100) * 2.) - 1
z = graph.get_tensor_by_name('z:0')
G_z = graph.get_tensor_by_name('G_z:0')
_G_z = sess.run(G_z, {z: _z})
for i in range (1000):
wav=_G_z[i][0:16000]
name = str(sample_n)+'.wav'
librosa.output.write_wav(path=name,y=wav,sr=16000)
IrStat = eng.iosr.acoustics.irStats(name,nargout=5)
RT60 = IrStat[0]
DRR = IrStat[1]
CTE = IrStat[2]
EDT = IrStat[4]
for i in range(NRT_size):
if(bin_RT[i]<bin_NRT[i]):
if((RT60>=(NRT_start+(NRT_width*i))) and (RT60<(NRT_start+(NRT_width*(i+1))))):
for j in range(NDRR_size):
if(bin_DRR[j]<bin_NDRR[j]):
if((DRR>=(NDRR_start+(NDRR_width*j))) and (DRR<(NDRR_start+(NDRR_width*(j+1))))):
for k in range(NCTE_size):
if(bin_CTE[k]<bin_NCTE[k]):
if((CTE>=(NCTE_start+(NCTE_width*k))) and (CTE<(NCTE_start+(NCTE_width*(k+1))))):
for l in range(NEDT_size):
if(bin_EDT[l]<bin_NEDT[l]):
if((EDT>=(NEDT_start+(NEDT_width*l))) and (EDT<(NEDT_start+(NEDT_width*(l+1))))):
sample_n = sample_n+1
bin_RT[i] = bin_RT[i]+1
bin_DRR[j] = bin_DRR[j]+1
bin_CTE[k] = bin_CTE[k] +1
bin_EDT[l] = bin_EDT[l] +1
print("sample : ",sample_n)
print("target RT Distribution : ", bin_NRT)
print("current RT Distribution: ", bin_RT)
print("target DRR Distribution : ", bin_NDRR)
print("current DRR Distribution : ", bin_DRR)
print("target CTE Distribution : ", bin_NCTE)
print("current CTE Distribution : ", bin_CTE)
print("target EDT Distribution : ", bin_NEDT)
print("current EDT Distribution : ", bin_EDT)
| 32.751724 | 121 | 0.60518 | 865 | 4,749 | 3.154913 | 0.147977 | 0.133382 | 0.191279 | 0.243313 | 0.480762 | 0.401612 | 0.386222 | 0.386222 | 0.386222 | 0.326127 | 0 | 0.077694 | 0.222152 | 4,749 | 144 | 122 | 32.979167 | 0.661072 | 0.042956 | 0 | 0.256881 | 0 | 0 | 0.090046 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.073395 | 0 | 0.073395 | 0.137615 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ef19b84018a4d6b35c55204ac9c6f7a2155b887c | 6,018 | py | Python | test/tool_shed/base/test_db_util.py | thata/galaxy-dist | 6c3ffa064faf0c500f5594ed7b58ed839b00f337 | [
"CC-BY-3.0"
] | 2 | 2016-02-23T00:09:14.000Z | 2019-02-11T07:48:44.000Z | test/tool_shed/base/test_db_util.py | thata/galaxy-dist | 6c3ffa064faf0c500f5594ed7b58ed839b00f337 | [
"CC-BY-3.0"
] | null | null | null | test/tool_shed/base/test_db_util.py | thata/galaxy-dist | 6c3ffa064faf0c500f5594ed7b58ed839b00f337 | [
"CC-BY-3.0"
] | 6 | 2015-05-27T13:09:50.000Z | 2019-02-11T07:48:46.000Z | import galaxy.model
import galaxy.webapps.community.model as model
from galaxy.model.orm import *
from galaxy.webapps.community.model.mapping import context as sa_session
from galaxy.model.mapping import context as ga_session
def delete_obj( obj ):
sa_session.delete( obj )
sa_session.flush()
def delete_user_roles( user ):
for ura in user.roles:
sa_session.delete( ura )
sa_session.flush()
def flush( obj ):
sa_session.add( obj )
sa_session.flush()
def get_all_repositories():
return sa_session.query( model.Repository ).all()
def get_all_installed_repositories( actually_installed=False ):
if actually_installed:
return ga_session.query( galaxy.model.ToolShedRepository ) \
.filter( and_( galaxy.model.ToolShedRepository.table.c.deleted == False,
galaxy.model.ToolShedRepository.table.c.uninstalled == False,
galaxy.model.ToolShedRepository.table.c.status == galaxy.model.ToolShedRepository.installation_status.INSTALLED ) ) \
.all()
else:
return ga_session.query( galaxy.model.ToolShedRepository ).all()
def get_category_by_name( name ):
return sa_session.query( model.Category ) \
.filter( model.Category.table.c.name == name ) \
.first()
def get_default_user_permissions_by_role( role ):
return sa_session.query( model.DefaultUserPermissions ) \
.filter( model.DefaultUserPermissions.table.c.role_id == role.id ) \
.all()
def get_default_user_permissions_by_user( user ):
return sa_session.query( model.DefaultUserPermissions ) \
.filter( model.DefaultUserPermissions.table.c.user_id==user.id ) \
.all()
def get_galaxy_repository_by_name_owner_changeset_revision( repository_name, owner, changeset_revision ):
return ga_session.query( galaxy.model.ToolShedRepository ) \
.filter( and_( galaxy.model.ToolShedRepository.table.c.name == repository_name,
galaxy.model.ToolShedRepository.table.c.owner == owner,
galaxy.model.ToolShedRepository.table.c.changeset_revision == changeset_revision ) ) \
.first()
def get_installed_repository_by_id( repository_id ):
return ga_session.query( galaxy.model.ToolShedRepository ) \
.filter( galaxy.model.ToolShedRepository.table.c.id == repository_id ) \
.first()
def get_installed_repository_by_name_owner( repository_name, owner ):
return ga_session.query( galaxy.model.ToolShedRepository ) \
.filter( and_( galaxy.model.ToolShedRepository.table.c.name == repository_name,
galaxy.model.ToolShedRepository.table.c.owner == owner ) ) \
.first()
def get_private_role( user ):
for role in user.all_roles():
if role.name == user.email and role.description == 'Private Role for %s' % user.email:
return role
raise AssertionError( "Private role not found for user '%s'" % user.email )
def get_repository_by_id( repository_id ):
return sa_session.query( model.Repository ) \
.filter( model.Repository.table.c.id == repository_id ) \
.first()
def get_repository_review_by_user_id_changeset_revision( user_id, repository_id, changeset_revision ):
review = sa_session.query( model.RepositoryReview ) \
.filter( and_( model.RepositoryReview.table.c.user_id == user_id,
model.RepositoryReview.table.c.repository_id == repository_id,
model.RepositoryReview.table.c.changeset_revision == changeset_revision ) ) \
.first()
return review
def get_role_by_name( role_name ):
return sa_session.query( model.Role ) \
.filter( model.Role.table.c.name == role_name ) \
.first()
def get_user( email ):
return sa_session.query( model.User ) \
.filter( model.User.table.c.email==email ) \
.first()
def get_user_by_name( username ):
return sa_session.query( model.User ) \
.filter( model.User.table.c.username==username ) \
.first()
def mark_obj_deleted( obj ):
obj.deleted = True
sa_session.add( obj )
sa_session.flush()
def refresh( obj ):
sa_session.refresh( obj )
def ga_refresh( obj ):
ga_session.refresh( obj )
def get_galaxy_private_role( user ):
for role in user.all_roles():
if role.name == user.email and role.description == 'Private Role for %s' % user.email:
return role
raise AssertionError( "Private role not found for user '%s'" % user.email )
def get_galaxy_user( email ):
return ga_session.query( galaxy.model.User ) \
.filter( galaxy.model.User.table.c.email==email ) \
.first()
def get_repository_by_name_and_owner( name, owner_username ):
owner = get_user_by_name( owner_username )
repository = sa_session.query( model.Repository ) \
.filter( and_( model.Repository.table.c.name == name,
model.Repository.table.c.user_id == owner.id ) ) \
.first()
return repository
def get_repository_metadata_by_repository_id_changeset_revision( repository_id, changeset_revision ):
repository_metadata = sa_session.query( model.RepositoryMetadata ) \
.filter( and_( model.RepositoryMetadata.table.c.repository_id == repository_id,
model.RepositoryMetadata.table.c.changeset_revision == changeset_revision ) ) \
.first()
return repository_metadata
| 53.256637 | 157 | 0.622964 | 660 | 6,018 | 5.44697 | 0.107576 | 0.040056 | 0.121001 | 0.058136 | 0.615299 | 0.549374 | 0.421975 | 0.376356 | 0.297636 | 0.28178 | 0 | 0 | 0.282486 | 6,018 | 112 | 158 | 53.732143 | 0.832561 | 0 | 0 | 0.351351 | 0 | 0 | 0.018279 | 0 | 0 | 0 | 0 | 0 | 0.018018 | 1 | 0.216216 | false | 0 | 0.045045 | 0.108108 | 0.432432 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
ef4b3e458d2d63b0fc1a45047f41f4eecab646da | 8,273 | py | Python | tests/weighted_layers_test.py | googleinterns/loop-project | 28acb1c815e0a65f51e809d278eea08ffb06483e | [
"Apache-2.0"
] | 3 | 2020-05-29T00:34:34.000Z | 2020-12-14T21:50:12.000Z | tests/weighted_layers_test.py | googleinterns/loop-project | 28acb1c815e0a65f51e809d278eea08ffb06483e | [
"Apache-2.0"
] | 2 | 2020-07-21T00:57:15.000Z | 2020-09-04T22:09:33.000Z | tests/weighted_layers_test.py | googleinterns/loop-project | 28acb1c815e0a65f51e809d278eea08ffb06483e | [
"Apache-2.0"
] | null | null | null | import unittest
import numpy as np
import tensorflow as tf
import lib.weighted_layers_v2 as wl
from lib.weighted_resblock import MixtureWeight
class WeightedConv2DTest(tf.test.TestCase):
"""WeightedConv2D test class."""
def setUp(self):
"""Sets default parameters."""
super(WeightedConv2DTest, self).setUp()
self.kernel_size = 3
self.activation = 'relu'
self.filters = 40
self.input_channel = 20
self.num_templates = 10
self.kernel = np.random.rand(self.num_templates, self.kernel_size,
self.kernel_size, self.input_channel,
self.filters)
self.bias = np.random.rand(self.num_templates, self.filters)
self.kernel_init = tf.constant_initializer(self.kernel)
self.bias_init = tf.constant_initializer(self.bias)
self.padding = 'same'
xi_init = tf.random_uniform_initializer(minval=0.0, maxval=1.0)
self.xi = MixtureWeight(num_templates=self.num_templates,
initializer=xi_init)
def _create_default_w_conv(self):
"""Creates an instance of WeightedConv2D with dedault parameters."""
return wl.WeightedConv2D(
filters=self.filters, activation=self.activation, padding=self.padding,
kernel_size=self.kernel_size, num_templates=self.num_templates,
kernel_initializer=self.kernel_init, bias_initializer=self.bias_init)
def _get_default_inputs(self, in_shape):
"""returns default layer inputs."""
layer_inputs = tf.Variable(np.random.rand(*in_shape), dtype=tf.float32)
return [layer_inputs, self.xi(None)[0]]
def test_output_shape(self):
"""checks if the shape of the output tensor is correct."""
w_conv = self._create_default_w_conv()
input_shape = (32, 16, 16, self.input_channel)
inputs = self._get_default_inputs(input_shape)
output = w_conv(inputs)
expected_shape = (32, 16, 16, self.filters)
self.assertAllEqual(expected_shape, output.shape)
def test_output_values(self):
"""checks if the output tensor is computed correctly."""
w_conv = self._create_default_w_conv()
w_conv.activation = None
input_shape = (32, 16, 16, self.input_channel)
inputs = self._get_default_inputs(input_shape)
w_output = w_conv(inputs)
# the output of weighted convolution should be same as linear combination of
# outputs of regular convolution with template weights in case when no
# activation is used.
expected_output = tf.zeros_like(w_output)
conv = tf.keras.layers.Conv2D(filters=self.filters, activation=None,
padding=self.padding,
kernel_size=self.kernel_size)
conv.build(input_shape)
for t in range(self.num_templates):
conv.kernel = self.kernel[t]
conv.bias = self.bias[t]
conv_out = conv(inputs[0])
expected_output += inputs[1][t]*conv_out
self.assertAllClose(expected_output, w_output, rtol=1e-05)
class WeightedDepthwiseConv2DTest(tf.test.TestCase):
"""Weighted depthwise convolution test class."""
def setUp(self):
"""Sets default parameters."""
super(WeightedDepthwiseConv2DTest, self).setUp()
self.kernel_size = 3
self.activation = 'relu'
self.depth_multiplier = 2
self.input_channel = 20
self.num_templates = 10
self.kernel = np.random.rand(self.num_templates, self.kernel_size,
self.kernel_size, self.input_channel,
self.depth_multiplier).astype(np.float32)
self.bias = np.random.rand(
self.num_templates,
self.input_channel * self.depth_multiplier).astype(np.float32)
self.kernel_init = tf.constant_initializer(self.kernel)
self.bias_init = tf.constant_initializer(self.bias)
self.padding = 'same'
self.xi_initializer = tf.random_uniform_initializer(minval=0.0, maxval=1.0)
self.xi = MixtureWeight(num_templates=self.num_templates,
initializer=self.xi_initializer)
def _create_default_depth_conv(self):
"""Creates a WeightedDepthwiseConv2D instance with default parameters."""
return wl.WeightedDepthwiseConv2D(
depth_multiplier=self.depth_multiplier, activation=self.activation,
padding=self.padding, kernel_size=self.kernel_size,
num_templates=self.num_templates, bias_initializer=self.bias_init,
depthwise_initializer=self.kernel_init)
def _get_default_inputs(self, in_shape):
"""returns default layer inputs."""
layer_inputs = tf.Variable(np.random.rand(*in_shape), dtype=tf.float32)
return [layer_inputs, self.xi(None)[0]]
def test_output_shape(self):
"""checks if the shape of the output tensor is correct."""
w_d_conv = self._create_default_depth_conv()
input_shape = (32, 64, 64, self.input_channel)
inputs = self._get_default_inputs(input_shape)
output = w_d_conv(inputs)
expected_shape = (32, 64, 64, self.input_channel*self.depth_multiplier)
self.assertAllEqual(expected_shape, output.shape)
def test_output_value(self):
"""checks if the value of the output tensor is correct."""
w_d_conv = self._create_default_depth_conv()
w_d_conv.activation = None
input_shape = (32, 16, 16, self.input_channel)
inputs = self._get_default_inputs(input_shape)
w_d_output = w_d_conv(inputs)
# the output of weighted convolution should be same as linear combination of
# outputs of regular convolution with template weights in case when no
# activation is used.
expected_output = tf.zeros_like(w_d_output)
conv = tf.keras.layers.DepthwiseConv2D(
depth_multiplier=self.depth_multiplier, activation=None,
padding=self.padding, kernel_size=self.kernel_size)
conv.build(input_shape)
for t in range(self.num_templates):
conv.depthwise_kernel = self.kernel[t]
conv.bias = self.bias[t]
conv_out = conv(inputs[0])
expected_output += inputs[1][t]*conv_out
self.assertAllClose(expected_output, w_d_output, rtol=1e-05)
class WeightedBatchNormalizationTest(tf.test.TestCase):
""""WeightedBatchNormalizationSeparate test class."""
def setUp(self):
"""Sets default parameters."""
self.num_templates = 10
self.input_channels = 40
self.gamma_template = np.random.rand(
self.num_templates, self.input_channels).astype(np.float32)
self.beta_template = np.random.rand(
self.num_templates, self.input_channels).astype(np.float32)
self.beta_init = tf.constant_initializer(self.beta_template)
self.gamma_init = tf.constant_initializer(self.gamma_template)
self.xi_initializer = tf.random_uniform_initializer(minval=0.0, maxval=1.0)
self.xi = MixtureWeight(num_templates=self.num_templates,
initializer=self.xi_initializer)
def test_output_shape(self):
"""checks if the output shape is same as input shape."""
input_shape = (256, 16, 16, self.input_channels)
inputs = tf.random.normal(input_shape)
bn = wl.WeightedBatchNormalizationSeparate(
num_templates=self.num_templates, gamma_initializer=self.gamma_init,
beta_initializer=self.beta_init)
outputs = bn([inputs, self.xi(None)[0]], training=True)
self.assertAllEqual(input_shape, outputs.shape)
def test_output_moments(self):
"""checks if the output moments match to the mixture of moments."""
input_shape = (256, 16, 16, self.input_channels)
inputs = tf.random.normal(input_shape, mean=2.5, stddev=8.0)
bn = wl.WeightedBatchNormalizationSeparate(
num_templates=self.num_templates, gamma_initializer=self.gamma_init,
beta_initializer=self.beta_init)
outputs = bn([inputs, self.xi(None)[0]], training=True)
reduction_axes = range(len(input_shape) - 1)
mean, var = tf.nn.moments(outputs, reduction_axes)
reshaped_mix_w = tf.reshape(self.xi(None), [self.num_templates, 1])
mix_gamma = tf.reduce_sum(reshaped_mix_w * self.gamma_template, axis=0)
mix_beta = tf.reduce_sum(reshaped_mix_w * self.beta_template, axis=0)
self.assertAllClose(mean, mix_beta, rtol=1e-03)
self.assertAllClose(tf.math.sqrt(var), mix_gamma, rtol=1e-03)
if __name__ == '__main__':
unittest.main(argv=['first-arg-is-ignored'], exit=False)
| 43.542105 | 80 | 0.709054 | 1,109 | 8,273 | 5.061317 | 0.149684 | 0.055585 | 0.05416 | 0.023695 | 0.762694 | 0.705327 | 0.689827 | 0.663994 | 0.651167 | 0.601995 | 0 | 0.019465 | 0.18651 | 8,273 | 189 | 81 | 43.772487 | 0.814562 | 0.125106 | 0 | 0.503448 | 0 | 0 | 0.006152 | 0 | 0 | 0 | 0 | 0 | 0.048276 | 1 | 0.089655 | false | 0 | 0.034483 | 0 | 0.172414 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ef620ad768c27c6b7ea78cae18337808814644da | 466 | py | Python | msgboard/migrations/0002_test_data.py | djonli-ux/beyond-tutorial | 23255e3d59e087451590f54ddb2f708163cdefe3 | [
"MIT"
] | null | null | null | msgboard/migrations/0002_test_data.py | djonli-ux/beyond-tutorial | 23255e3d59e087451590f54ddb2f708163cdefe3 | [
"MIT"
] | null | null | null | msgboard/migrations/0002_test_data.py | djonli-ux/beyond-tutorial | 23255e3d59e087451590f54ddb2f708163cdefe3 | [
"MIT"
] | null | null | null | from django.db import migrations, transaction
class Migration(migrations.Migration):
dependencies = [
('msgboard', '0001_initial'),
]
def generate_data(apps, schema_editor):
from msgboard.models import Message
test_data = [
('Test User1', 'A simple test message'),
('Test User2', 'Another simple test message'),
]
with transaction.atomic():
for author, text in test_data:
Message(author=author, text=text).save()
operations = [
migrations.RunPython(generate_data),
] | 27.411765 | 46 | 0.761803 | 59 | 466 | 5.915254 | 0.59322 | 0.068768 | 0.097421 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014388 | 0.10515 | 466 | 17 | 47 | 27.411765 | 0.822542 | 0 | 0 | 0 | 1 | 0 | 0.188437 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.117647 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3227c64ab730359adca1392431b9f15947c78828 | 447 | py | Python | app/api/admin.py | KimSoyoung227/gaesaenack-cowork-study | d30bdfbf738d72f1752ff86067fadbe68559b60e | [
"MIT"
] | null | null | null | app/api/admin.py | KimSoyoung227/gaesaenack-cowork-study | d30bdfbf738d72f1752ff86067fadbe68559b60e | [
"MIT"
] | 1 | 2019-04-13T11:54:50.000Z | 2019-04-13T11:54:50.000Z | app/api/admin.py | KimSoyoung227/gaesaenack-cowork-study | d30bdfbf738d72f1752ff86067fadbe68559b60e | [
"MIT"
] | 4 | 2019-04-13T06:55:25.000Z | 2019-04-13T07:02:36.000Z | from app.api import apiRestful
from flask_restplus import Resource
class Admin:
@apiRestful.route('/admin/anotheradmin')
class AnotherAdminView(Resource):
def get(self):
return {"return" : "Hello World from AnotherMyAdmin!"}, 200
@apiRestful.route('/admin/myadminview')
class MyAdminView(Resource):
def get(self):
return {"return" : "Hello World from MyAdmin!"}, 200
| 22.35 | 71 | 0.63311 | 46 | 447 | 6.130435 | 0.5 | 0.106383 | 0.141844 | 0.12766 | 0.312057 | 0.312057 | 0.312057 | 0.312057 | 0.312057 | 0 | 0 | 0.018127 | 0.259508 | 447 | 19 | 72 | 23.526316 | 0.833837 | 0 | 0 | 0.181818 | 0 | 0 | 0.237136 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.181818 | 0.181818 | 0.818182 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
3244323d90c4f2bc8a0bade2c55470c79c7d29fb | 342 | py | Python | backend/app/mongodb_models/user.py | shizidushu/simple-report-data-table-vuetify | 41a459a2d8ae23f32b7aaa717ebf4182a625eecc | [
"MIT"
] | 13 | 2020-01-06T13:35:22.000Z | 2021-07-27T15:54:19.000Z | backend/app/mongodb_models/user.py | shizidushu/simple-report-data-table-vuetify | 41a459a2d8ae23f32b7aaa717ebf4182a625eecc | [
"MIT"
] | 5 | 2021-03-10T03:27:24.000Z | 2022-02-26T22:02:32.000Z | backend/app/mongodb_models/user.py | shizidushu/simple-report-data-table-vuetify | 41a459a2d8ae23f32b7aaa717ebf4182a625eecc | [
"MIT"
] | 3 | 2020-01-06T13:38:26.000Z | 2021-04-26T11:03:42.000Z | from mongoengine import Document, StringField, BooleanField, IntField, ListField, ReferenceField, EmailField, LongField
from mongoengine import NULLIFY, PULL
class User(Document):
ID = LongField(unique=True, required=True)
Username = StringField(required=True)
Password = StringField()
IsLock = BooleanField(required=True)
| 31.090909 | 119 | 0.77193 | 35 | 342 | 7.542857 | 0.628571 | 0.136364 | 0.159091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146199 | 342 | 10 | 120 | 34.2 | 0.90411 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.142857 | 0.285714 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
3245ca70a95030fe99198c2fd08fdff9ba5b3dc8 | 1,752 | py | Python | page/tests/test_views.py | igorkf/my-two-cents | 10c8cd368e60640ed5f64421da5997421236a5c7 | [
"MIT"
] | null | null | null | page/tests/test_views.py | igorkf/my-two-cents | 10c8cd368e60640ed5f64421da5997421236a5c7 | [
"MIT"
] | 1 | 2021-06-17T18:20:33.000Z | 2021-06-17T18:22:50.000Z | page/tests/test_views.py | igorkf/my-two-cents | 10c8cd368e60640ed5f64421da5997421236a5c7 | [
"MIT"
] | null | null | null | from django.test import TestCase, RequestFactory
from .. import views
# Create your tests here.
# TODO: write mixin
class IndexViewTest(TestCase):
url = '/'
template_name = 'page/index.html'
def test_if_url_exists_at_desired_location(self):
response = self.client.get(self.url)
status_code = response.status_code
self.assertEqual(status_code, 200)
def test_if_url_uses_correct_template(self):
response = self.client.get(self.url)
self.assertTemplateUsed(response, self.template_name)
class WhoAmIViewTest(TestCase):
url = '/who-am-i'
def test_if_url_exists_at_desired_location(self):
response = self.client.get(self.url)
status_code = response.status_code
self.assertEqual(status_code, 200)
class PostsViewTest(TestCase):
url = '/posts'
template_name = 'page/posts.html'
def test_if_url_exists_at_desired_location(self):
response = self.client.get(self.url)
status_code = response.status_code
self.assertEqual(status_code, 200)
def test_if_url_uses_correct_template(self):
response = self.client.get(self.url)
self.assertTemplateUsed(response, self.template_name)
def test_if_posts_is_in_context(self):
request = RequestFactory().get(self.url)
view = views.PostsView()
view.setup(request)
view.object_list = view.get_queryset()
context = view.get_context_data()
self.assertIn('posts', context)
class ProjectsViewTest(TestCase):
url = '/projects'
def test_if_url_exists_at_desired_location(self):
response = self.client.get(self.url)
status_code = response.status_code
self.assertEqual(status_code, 200)
| 26.953846 | 61 | 0.696347 | 221 | 1,752 | 5.253394 | 0.266968 | 0.103359 | 0.054264 | 0.062016 | 0.618432 | 0.618432 | 0.618432 | 0.618432 | 0.618432 | 0.618432 | 0 | 0.008646 | 0.207763 | 1,752 | 64 | 62 | 27.375 | 0.82781 | 0.023402 | 0 | 0.536585 | 0 | 0 | 0.035129 | 0 | 0 | 0 | 0 | 0.015625 | 0.170732 | 1 | 0.170732 | false | 0 | 0.04878 | 0 | 0.463415 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3251aa7d6d72a784623be2021d1ae53497539f90 | 13,474 | py | Python | pfim/pfim.py | apetcho/pfim | b3b06ba0f0ff53ea27cb453cdd7a5a95112071c1 | [
"BSD-2-Clause"
] | null | null | null | pfim/pfim.py | apetcho/pfim | b3b06ba0f0ff53ea27cb453cdd7a5a95112071c1 | [
"BSD-2-Clause"
] | null | null | null | pfim/pfim.py | apetcho/pfim | b3b06ba0f0ff53ea27cb453cdd7a5a95112071c1 | [
"BSD-2-Clause"
] | null | null | null | """PFIM: Personal Finance Manager"""
import os
from queue import Queue
import sys
import sqlite3
import logging
import statistics
import functools
from datetime import date, timedelta
from enum import Enum, auto
from collections import namedtuple
from typing import List, Dict, Callable, Generator, Mapping, Union
## -- set up a logger for the application
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
_filehandler = logging.FileHandler(
os.path.join(os.environ["HOME"], ".pfim.log"))
_filehandler.setLevel(logging.DEBUG)
_consolehandler = logging.StreamHandler()
_consolehandler.setLevel(logging.ERROR)
_formatter = logging.Formatter(
"[%(asctime)s]::%(name)s::%(message)s")
_filehandler.setFormatter(_formatter)
_consolehandler.setFormatter(_formatter)
# Global Constants and Structures
PfimEntry = namedtuple("PfimEntry", "date tag description amount")
PfimOutput = namedtuple("PfimOutput", "report summary")
PfimQuery = namedtuple("PfimQuery", "query args")
_DBNAME = os.path.join(os.environ["HOME"], ".pfimdata.db")
_EARN_KIND = "E"
_SPENT_KIND = "S"
# ---- DATABASE OPERATION CONSTANT ----
RECORD = 1
FETCH = 2
UPDATE = 3
DELETE = 4
_PFIMCmdDoc = {}
def _register_cmd_doc(func):
functools.wraps(func)
def wrapper(*args, **kws):
fname = func.__name__
fname = fname[1:] if fname.startswith("_") else fname
# fname = fname[:len(fname)-4] if fname[-4:] == "_doc" else fname
_PFIMCmdDoc[fname] = func.__doc__
return
return wrapper
#-record-rcv, -record-xpx, -show, -show-rcv, -show-xpx, -update,
#-update-rcv, -update-xpx, -delete, -delete-rcv, -delete-xpx
@_register_cmd_doc
def _record_rcv():
"""record_rcv()
Record an income entry into PFIM backend database.
This command requires information supplied through its options.
The option are as follow.
Options:
--tag Tag given to this entry. The tag option can be ignored. If
ignored, the field will simply be filled with a default
symbol "N/A", meaning Not Available.
--date This is the date on which the supposed entry was actually
made. The date option can be ignored, in which the current
date is considered.
--descr A short description for the entry. It must not exceed 30
ASCII characters, otherwise it will be truncated.
--amount The value of the income being entered into the database.
Example
-------
In pfim default mode:
$ pfim --date=2021-12-26 --descr="Payment from M. Eric" --tag=PWM \
--amount=275.00
In interactive mode:
$ pfim --interactive
pfim>> record_rcv --date=2021-12 --descr="Payment from M. Eric" --tag=PWM \
--amount=275.00
"""
pass
_record_rcv()
@_register_cmd_doc
def _record_xpx():
"""record_xpx()
Record an expense entry into PFIM backend database.
This command requires information supplied through its options.
The option are as follow.
Options:
--tag Tag given to this entry. The tag option can be ignored. If
ignored, the field will simply be filled with a default
symbol "N/A", meaning Not Available.
--date This is the date on which the supposed entry was actually
made. The date option can be ignored, in which the current
date is considered.
--descr A short description for the entry. It must not exceed 30
ASCII characters, otherwise it will be truncated.
--amount The value of the expense being entered into the database.
Example
-------
In pfim default mode:
$ pfim --date=2021-12-26 --descr="Bought Cinema ticket" --tag=OUT \
--amount=75.00
In interactive mode:
$ pfim --interactive
pfim>> record_rcv --date=2021-12 --descr="Bout Ciema ticket" --tag=OUT \
--amount=275.00
"""
pass
@_register_cmd_doc
def _show():
"""show()
"""
pass
@_register_cmd_doc
def _show_xpx():
"""show_xpx()
"""
pass
@_register_cmd_doc
def _show_rcv():
"""show_rcv()
"""
pass
@_register_cmd_doc
def _update():
"""update()
"""
pass
@_register_cmd_doc
def _update_xpx():
"""update_xpx()
"""
pass
@_register_cmd_doc
def _update_rcv():
"""update_rcv()
"""
pass
@_register_cmd_doc
def _delete():
"""delete()
"""
pass
@_register_cmd_doc
def _delete_xpx():
"""delete_xpx()
"""
pass
@_register_cmd_doc
def _delete_rcv():
"""delete_rcv()
"""
pass
# --- PFIM utility class --
class OutputBeautify:
def __init__(self, textstr: str):
#self._logger = logging.getLogger("pfim.Pfim.OutPutBeautify")
self._textstr = textstr
def decorate(self, color="green", slant="normal", underline=False,
bold=False):
mapping = {
"black": 30, "red": 31, "green": 32, "yellow": 33,
"blue": 34, "magenta": 35, "cyan": 36, "white": 37,
}
stylemap = {"noraml": 0, "bold": 1, "italic": 3, "underline": 4}
base = 38
if color.lower() in mapping.keys():
cval = mapping[color.lower()]
else:
cval = mapping["black"]
txt = self._textstr
if slant.lower() in ("italic", "normal"):
sval = stylemap[slant.lower()]
else:
sval = stylemap["normal"]
uval = stylemap["underline"] if underline else None
bval = stylemap["bold"] if bold else None
deco = f"\x1b[{base};" #"\x1b[m"
if sval:
deco = deco + f"{sval};"
if uval:
deco = deco + f"{uval};"
if bval:
deco = deco + f"{bval};"
deco = deco + f"{cval}m;{txt}\x1b[m"
return deco
def _adapter(dateObj: date):
return dateObj.isoformat()
def _converter(datestr: str):
return date.fromisoformat(datestr)
sqlite3.register_adapter(date, _adapter)
sqlite3.register_converter("date", _converter)
class PfimQueryCmdEnum(Enum):
RECORD_RCV = auto()
RECORD_XPX = auto()
SHOW = auto()
SHOW_RCV = auto()
SHOW_XPX = auto()
UPDATE = auto()
# UPDATE_DESC = auto() # FIXME: maybe included as a new command
UPDATE_RCV = auto()
UPDATE_XPX = auto()
DELETE = auto()
DELETE_RCV = auto()
DELETE_XPX = auto()
def _validate_datestr(datestr: str) -> bool:
result = None
try:
result = date.fromisoformat(datestr)
except Exception:
result = None
if result is None:
return False
return True
class PfimData:
"""PFIM database interface."""
def __init__(self):
self._logger = logging.getLogger("pfim.PfimData")
# start the db: create a new if it doesn't exists
sql = """CREATE TABLE IF NOT EXISTS pfim(
id INTEGER PRIMARY KEY AUTOINCREMENT NON NULL,
opdate DATE,
tag TEXT,
description TEXT,
amount REAL
)"""
with sqlite3.connect(_DBNAME,
detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES
) as conn:
conn.cursor().execute(sql).commit()
def _run_query(self, query, *args, out=False) ->Union[sqlite3.Cursor, None]:
retval = None
with sqlite3.connect(_DBNAME) as conn:
if args:
retval = conn.cursor().execute(query, args)
else:
retval = conn.cursor().execute(query)
conn.commit()
if out:
return retval
def add_entry(self, query: str, *args) -> None:
try:
self._run_query(query, args)
self._logger.debug("New entry added")
except sqlite3.Error as err:
self._logger.error(f"Failed to add a new entry to database. {err}")
sys.exit(1)
def fetch(self, query: str, *args) -> Generator:
try:
retval = self._run_query(query, args)
self._logger.debug("Fetched data from database")
except sqlite3.Error as err:
self._logger.error(f"Failed to fetch data from database. {err}")
sys.exit(1)
for row in retval:
yield row
def update(self, query: str, *args) -> None:
try:
retval = self._run_query(query, args)
self._logger.debug("Updated database content")
except sqlite3.Error as err:
self._logger.error(f"Failed to update database content. {err}")
sys.exit(1)
for row in retval:
yield row
def delete(self, query: str, *args) -> None:
try:
retval = self._run_query(query, args)
self._logger.debug("Deleted data from database")
except sqlite3.Error as err:
self._logger.error(f"Failed to delete data from database. {err}")
sys.exit(1)
for row in retval:
yield row
class InteractivePfim:
# Use builtin module *Cmd* ?
PROMPT = "pfim>> "
def __init__(self):
self._logger = logging.getLogger("pfim.InteractivePfim")
pass
def record(self, kw: Dict) -> PfimQuery:
pass
def report(self, kw: Dict) -> PfimQuery:
pass
def delete(self, kw: Dict) -> PfimQuery:
pass
def update(self, kw: Dict) -> PfimQuery:
pass
def quit(self) -> None:
import sys
sys.exit(0)
def clear_console(self) -> None:
pass
class Report:
def __init__(self):
self._logger = logging.getLogger("pfim.Report")
self._fmt = None
self._head = None
self._line = None
def create_entry(self, *args, **kw):
pass
class ReportSummary:
def __init__(self, data: List[float]):
self._logger = logging.getLogger("pfim.ReportSummary")
self._data = data
self._compute()
def _compute(self):
self._count = len(self._data)
self._min = min(self._data)
self._max = max(self._data)
self._median = statistics.median(self._data)
self._mean = statistics.fmean(self._data)
self._stdev = statistics.stdev(self._data)
def __str__(self):
summary = f"""
SUMMARY
-------
Count: {self._count}
Minimum: {self._min}
Maximum: {self._max}
Average: {self._mean}
Median: {self._median}
Stdev: {self._stdev}
"""
return summary
class PfimCore:
"""PFIM Core class."""
prolog = ""
epilog = ""
def __init__(self):
self._logger = logging.getLogger("pfim.PfimCore")
self._mode = None
self._output = None
self._query_history = Queue(maxsize=128)
def record(self, kw: Dict) -> PfimQuery:
pass
def update(self, kw: Dict) -> PfimQuery:
pass
def delete(self, kw: Dict) -> PfimQuery:
pass
def report(self, kw: Dict) -> PfimQuery:
pass
def make_output(self) -> PfimOutput:
pass
def write_output(self, file=sys.stdout):
pass
def process_fetch_result(self, *args) -> None:
pass
""" def create_query(self, cmd: PfimQueryCmdEnum, kw: Dict) -> str:
# -- Create a new query--
query = None
# addgrp
# addcmds = (record-rcv|record-xpx)
# addOpts = [recDate|recTag]
if cmd == PfimQueryCmdEnum.RECORD_RCV:
# TODO: make query then return it immediatly
return query
if cmd == PfimQueryCmdEnum.RECORD_XPX:
# TODO: make query then return it immediatly
return query
# showcmds=(show|show-rcv|show-spent)
# showOpts=[sort-(date|tag|amount)]|[after-date|before-date|on-date|
# --desc]
if cmd == PfimQueryCmdEnum.SHOW:
# TODO: make query then return it immediatly
return query
if cmd == PfimQueryCmdEnum.SHOW_RCV:
# TODO: make query then return it immediatly
return query
if cmd == PfimQueryCmdEnum.SHOW_XPX:
# TODO: make query then return it immediatly
return query
# upcmds = (update|update-rcv|update-spent)
# upOpts = [(old-tag, new-tag)|(old-date,new-date)|(old-amount,
# new-amount)]
if cmd == PfimQueryCmdEnum.UPDATE:
# TODO: make query then return it immediatly
return query
if cmd == PfimQueryCmdEnum.UPDATE_RCV:
# TODO: make query then return it immediatly
return query
if cmd == PfimQueryCmdEnum.UPDATE_XPX:
# TODO: make query then return it immediatly
return query
# rmcmds = (delete|delete-rcv|delete-spent)
# rmOpts = [target-tag|target-date|target-mount]
if cmd == PfimQueryCmdEnum.DELETE:
# TODO: make query then return it immediatly
return query
if cmd == PfimQueryCmdEnum.DELETE_RCV:
# TODO: make query then return it immediatly
return query
if cmd == PfimQueryCmdEnum.DELETE_XPX:
# TODO: make query then return it immediatly
return query
"""
del _filehandler, _consolehandler, _formatter
| 27.554192 | 80 | 0.588615 | 1,582 | 13,474 | 4.87421 | 0.21871 | 0.018156 | 0.021787 | 0.024251 | 0.446505 | 0.423032 | 0.381403 | 0.381403 | 0.353132 | 0.353132 | 0 | 0.010962 | 0.302657 | 13,474 | 488 | 81 | 27.610656 | 0.809706 | 0.213077 | 0 | 0.291667 | 0 | 0 | 0.132882 | 0.004357 | 0 | 0 | 0 | 0.02459 | 0 | 1 | 0.166667 | false | 0.094697 | 0.045455 | 0.007576 | 0.32197 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
326126aa088417351b7cdc7f5925da5f1445a60f | 771 | py | Python | wienerschnitzelgemeinschaft/src/keras_losses.py | guitarmind/HPA-competition-solutions | 547d53aaca148fdb5f4585526ad7364dfa47967d | [
"MIT"
] | null | null | null | wienerschnitzelgemeinschaft/src/keras_losses.py | guitarmind/HPA-competition-solutions | 547d53aaca148fdb5f4585526ad7364dfa47967d | [
"MIT"
] | null | null | null | wienerschnitzelgemeinschaft/src/keras_losses.py | guitarmind/HPA-competition-solutions | 547d53aaca148fdb5f4585526ad7364dfa47967d | [
"MIT"
] | null | null | null | from keras_metrics import f1, f1b
import keras.backend as K
import tensorflow as tf
def f1_loss(y_true, y_pred):
return 1 - K.mean(f1(y_true, y_pred))
def f1b_loss(y_true, y_pred):
return 1-K.mean(f1b(y_true, y_pred))
def KerasFocalLoss(target, input):
"""
Should be applied without sigmoid activtion layer
from https://www.kaggle.com/rejpalcz/focalloss-for-keras
:param target:
:param input:
:return:
"""
gamma = 2.
input = tf.cast(input, tf.float32)
max_val = K.relu(-input)
loss = input - input * target + max_val + K.log(K.exp(-max_val) + K.exp(-input - max_val))
invprobs = tf.log_sigmoid(-input * (target * 2.0 - 1.0))
loss = K.exp(invprobs * gamma) * loss
return K.mean(K.sum(loss, axis=1))
| 24.09375 | 94 | 0.651102 | 126 | 771 | 3.857143 | 0.396825 | 0.041152 | 0.049383 | 0.082305 | 0.160494 | 0.106996 | 0.106996 | 0.106996 | 0.106996 | 0 | 0 | 0.026316 | 0.211414 | 771 | 31 | 95 | 24.870968 | 0.773026 | 0.18677 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0.133333 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
3267375b3400501ac160d58442cf682d973c1b95 | 14,784 | py | Python | containerd/events/container_pb2.py | neuro-inc/platform-container-runtime | f7d426191767da1a1d673a1f3fc9264a3dccb9ad | [
"Apache-2.0"
] | null | null | null | containerd/events/container_pb2.py | neuro-inc/platform-container-runtime | f7d426191767da1a1d673a1f3fc9264a3dccb9ad | [
"Apache-2.0"
] | 51 | 2021-11-15T03:15:19.000Z | 2022-02-23T08:18:46.000Z | containerd/events/container_pb2.py | neuro-inc/platform-container-runtime | f7d426191767da1a1d673a1f3fc9264a3dccb9ad | [
"Apache-2.0"
] | null | null | null | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: containerd/events/container.proto
"""Generated protocol buffer code."""
from google.protobuf import (
descriptor as _descriptor,
message as _message,
reflection as _reflection,
symbol_database as _symbol_database,
)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2
from containerd.protobuf.plugin import (
fieldpath_pb2 as containerd_dot_protobuf_dot_plugin_dot_fieldpath__pb2,
)
from github.com.gogo.protobuf.gogoproto import (
gogo_pb2 as github_dot_com_dot_gogo_dot_protobuf_dot_gogoproto_dot_gogo__pb2,
)
DESCRIPTOR = _descriptor.FileDescriptor(
name="containerd/events/container.proto",
package="containerd.events",
syntax="proto3",
serialized_options=b"Z2github.com/containerd/containerd/api/events;events\240\364\036\001",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n!containerd/events/container.proto\x12\x11\x63ontainerd.events\x1a\x19google/protobuf/any.proto\x1a-github.com/gogo/protobuf/gogoproto/gogo.proto\x1a*containerd/protobuf/plugin/fieldpath.proto"\xa9\x01\n\x0f\x43ontainerCreate\x12\n\n\x02id\x18\x01 \x01(\t\x12\r\n\x05image\x18\x02 \x01(\t\x12;\n\x07runtime\x18\x03 \x01(\x0b\x32*.containerd.events.ContainerCreate.Runtime\x1a>\n\x07Runtime\x12\x0c\n\x04name\x18\x01 \x01(\t\x12%\n\x07options\x18\x02 \x01(\x0b\x32\x14.google.protobuf.Any"\xb1\x01\n\x0f\x43ontainerUpdate\x12\n\n\x02id\x18\x01 \x01(\t\x12\r\n\x05image\x18\x02 \x01(\t\x12>\n\x06labels\x18\x03 \x03(\x0b\x32..containerd.events.ContainerUpdate.LabelsEntry\x12\x14\n\x0csnapshot_key\x18\x04 \x01(\t\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x1d\n\x0f\x43ontainerDelete\x12\n\n\x02id\x18\x01 \x01(\tB8Z2github.com/containerd/containerd/api/events;events\xa0\xf4\x1e\x01X\x01X\x02\x62\x06proto3',
dependencies=[
google_dot_protobuf_dot_any__pb2.DESCRIPTOR,
github_dot_com_dot_gogo_dot_protobuf_dot_gogoproto_dot_gogo__pb2.DESCRIPTOR,
containerd_dot_protobuf_dot_plugin_dot_fieldpath__pb2.DESCRIPTOR,
],
)
_CONTAINERCREATE_RUNTIME = _descriptor.Descriptor(
name="Runtime",
full_name="containerd.events.ContainerCreate.Runtime",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="name",
full_name="containerd.events.ContainerCreate.Runtime.name",
index=0,
number=1,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="options",
full_name="containerd.events.ContainerCreate.Runtime.options",
index=1,
number=2,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=282,
serialized_end=344,
)
_CONTAINERCREATE = _descriptor.Descriptor(
name="ContainerCreate",
full_name="containerd.events.ContainerCreate",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="id",
full_name="containerd.events.ContainerCreate.id",
index=0,
number=1,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="image",
full_name="containerd.events.ContainerCreate.image",
index=1,
number=2,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="runtime",
full_name="containerd.events.ContainerCreate.runtime",
index=2,
number=3,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[
_CONTAINERCREATE_RUNTIME,
],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=175,
serialized_end=344,
)
_CONTAINERUPDATE_LABELSENTRY = _descriptor.Descriptor(
name="LabelsEntry",
full_name="containerd.events.ContainerUpdate.LabelsEntry",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="key",
full_name="containerd.events.ContainerUpdate.LabelsEntry.key",
index=0,
number=1,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="value",
full_name="containerd.events.ContainerUpdate.LabelsEntry.value",
index=1,
number=2,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=b"8\001",
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=479,
serialized_end=524,
)
_CONTAINERUPDATE = _descriptor.Descriptor(
name="ContainerUpdate",
full_name="containerd.events.ContainerUpdate",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="id",
full_name="containerd.events.ContainerUpdate.id",
index=0,
number=1,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="image",
full_name="containerd.events.ContainerUpdate.image",
index=1,
number=2,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="labels",
full_name="containerd.events.ContainerUpdate.labels",
index=2,
number=3,
type=11,
cpp_type=10,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="snapshot_key",
full_name="containerd.events.ContainerUpdate.snapshot_key",
index=3,
number=4,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[
_CONTAINERUPDATE_LABELSENTRY,
],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=347,
serialized_end=524,
)
_CONTAINERDELETE = _descriptor.Descriptor(
name="ContainerDelete",
full_name="containerd.events.ContainerDelete",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="id",
full_name="containerd.events.ContainerDelete.id",
index=0,
number=1,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=526,
serialized_end=555,
)
_CONTAINERCREATE_RUNTIME.fields_by_name[
"options"
].message_type = google_dot_protobuf_dot_any__pb2._ANY
_CONTAINERCREATE_RUNTIME.containing_type = _CONTAINERCREATE
_CONTAINERCREATE.fields_by_name["runtime"].message_type = _CONTAINERCREATE_RUNTIME
_CONTAINERUPDATE_LABELSENTRY.containing_type = _CONTAINERUPDATE
_CONTAINERUPDATE.fields_by_name["labels"].message_type = _CONTAINERUPDATE_LABELSENTRY
DESCRIPTOR.message_types_by_name["ContainerCreate"] = _CONTAINERCREATE
DESCRIPTOR.message_types_by_name["ContainerUpdate"] = _CONTAINERUPDATE
DESCRIPTOR.message_types_by_name["ContainerDelete"] = _CONTAINERDELETE
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
ContainerCreate = _reflection.GeneratedProtocolMessageType(
"ContainerCreate",
(_message.Message,),
{
"Runtime": _reflection.GeneratedProtocolMessageType(
"Runtime",
(_message.Message,),
{
"DESCRIPTOR": _CONTAINERCREATE_RUNTIME,
"__module__": "containerd.events.container_pb2"
# @@protoc_insertion_point(class_scope:containerd.events.ContainerCreate.Runtime)
},
),
"DESCRIPTOR": _CONTAINERCREATE,
"__module__": "containerd.events.container_pb2"
# @@protoc_insertion_point(class_scope:containerd.events.ContainerCreate)
},
)
_sym_db.RegisterMessage(ContainerCreate)
_sym_db.RegisterMessage(ContainerCreate.Runtime)
ContainerUpdate = _reflection.GeneratedProtocolMessageType(
"ContainerUpdate",
(_message.Message,),
{
"LabelsEntry": _reflection.GeneratedProtocolMessageType(
"LabelsEntry",
(_message.Message,),
{
"DESCRIPTOR": _CONTAINERUPDATE_LABELSENTRY,
"__module__": "containerd.events.container_pb2"
# @@protoc_insertion_point(class_scope:containerd.events.ContainerUpdate.LabelsEntry)
},
),
"DESCRIPTOR": _CONTAINERUPDATE,
"__module__": "containerd.events.container_pb2"
# @@protoc_insertion_point(class_scope:containerd.events.ContainerUpdate)
},
)
_sym_db.RegisterMessage(ContainerUpdate)
_sym_db.RegisterMessage(ContainerUpdate.LabelsEntry)
ContainerDelete = _reflection.GeneratedProtocolMessageType(
"ContainerDelete",
(_message.Message,),
{
"DESCRIPTOR": _CONTAINERDELETE,
"__module__": "containerd.events.container_pb2"
# @@protoc_insertion_point(class_scope:containerd.events.ContainerDelete)
},
)
_sym_db.RegisterMessage(ContainerDelete)
DESCRIPTOR._options = None
_CONTAINERUPDATE_LABELSENTRY._options = None
# @@protoc_insertion_point(module_scope)
| 33 | 989 | 0.628991 | 1,467 | 14,784 | 6.006135 | 0.110429 | 0.037226 | 0.05391 | 0.055158 | 0.691181 | 0.629781 | 0.572012 | 0.568153 | 0.545455 | 0.545455 | 0 | 0.030725 | 0.271307 | 14,784 | 447 | 990 | 33.073826 | 0.787153 | 0.039502 | 0 | 0.707434 | 1 | 0.004796 | 0.168335 | 0.134217 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.009592 | 0 | 0.009592 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
326f15af06a70b1d9f37c6b9e7612de96bed89b1 | 254 | py | Python | pymake/utils/azure/__init__.py | nenetto/pymake | 45a64585ceaf2791f602332cec6ee84748b3fe91 | [
"MIT"
] | 5 | 2018-03-15T08:17:16.000Z | 2021-12-02T22:41:58.000Z | pymake/utils/azure/__init__.py | nenetto/pymake | 45a64585ceaf2791f602332cec6ee84748b3fe91 | [
"MIT"
] | 16 | 2018-04-24T07:04:18.000Z | 2018-05-09T06:16:28.000Z | pymake/utils/azure/__init__.py | nenetto/pymake | 45a64585ceaf2791f602332cec6ee84748b3fe91 | [
"MIT"
] | 3 | 2018-03-15T12:31:28.000Z | 2019-12-04T15:23:47.000Z | """
pymake
-------------------------------
- Eugenio Marinetto
- nenetto@gmail.com
-------------------------------
Created 08-08-2019
"""
# __all__ variable
# Fill it in with the packages you want to export in "from project_name import *"
__all__ = [] | 21.166667 | 81 | 0.535433 | 28 | 254 | 4.535714 | 0.892857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036697 | 0.141732 | 254 | 12 | 82 | 21.166667 | 0.545872 | 0.901575 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
328b8958e466e8427bb1f9f7fa1911859e90270e | 1,423 | py | Python | src/booking_web/booking.py | davewalker5/FlightBookingSQL | 16ba845f8678f23766f0571fc9b8b1d6f7843525 | [
"MIT"
] | null | null | null | src/booking_web/booking.py | davewalker5/FlightBookingSQL | 16ba845f8678f23766f0571fc9b8b1d6f7843525 | [
"MIT"
] | null | null | null | src/booking_web/booking.py | davewalker5/FlightBookingSQL | 16ba845f8678f23766f0571fc9b8b1d6f7843525 | [
"MIT"
] | null | null | null | """
This module implements a Flask-based web application based on the functionality provided by the "flight_model"
package.
The site is not responsive but the Bootstrap customizer has been used to generate a cut-down version of bootstrap
to provide button and form element styling.
"""
import os
from flask import Flask, redirect
from booking_web.airports import airports_bp
from booking_web.airlines import airlines_bp
from booking_web.layouts import layouts_bp
from booking_web.passengers import passengers_bp
from booking_web.flights import flights_bp
from booking_web.boarding_cards import boarding_cards_bp
app = Flask("Flight Booking",
static_folder=os.path.join(os.path.dirname(__file__), "static"),
template_folder=os.path.join(os.path.dirname(__file__), "templates"))
app.secret_key = b'some secret key'
app.register_blueprint(airports_bp, url_prefix='/airports')
app.register_blueprint(airlines_bp, url_prefix='/airlines')
app.register_blueprint(layouts_bp, url_prefix='/layouts')
app.register_blueprint(passengers_bp, url_prefix='/passengers')
app.register_blueprint(flights_bp, url_prefix='/flights')
app.register_blueprint(boarding_cards_bp, url_prefix='/boarding_cards')
@app.route("/")
def home():
"""
Serve the home page for the site. This just redirects to the flights list
:return: Redirect to the flights list page
"""
return redirect("/flights/list")
| 35.575 | 113 | 0.784259 | 206 | 1,423 | 5.194175 | 0.378641 | 0.061682 | 0.078505 | 0.074766 | 0.061682 | 0.061682 | 0.061682 | 0.061682 | 0 | 0 | 0 | 0 | 0.126493 | 1,423 | 39 | 114 | 36.487179 | 0.860821 | 0.278285 | 0 | 0 | 0 | 0 | 0.118 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.047619 | false | 0.095238 | 0.380952 | 0 | 0.47619 | 0.285714 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 2 |
32921fa01a088c9080fef647bacbb2bd0abedd1e | 237 | py | Python | reid/models.py | cxh0519/DisplayPlatform | a41dfc8d19f352a45ec9a6c389972d8c1a5abaa5 | [
"MIT"
] | null | null | null | reid/models.py | cxh0519/DisplayPlatform | a41dfc8d19f352a45ec9a6c389972d8c1a5abaa5 | [
"MIT"
] | null | null | null | reid/models.py | cxh0519/DisplayPlatform | a41dfc8d19f352a45ec9a6c389972d8c1a5abaa5 | [
"MIT"
] | null | null | null | from django.db import models
class ReidImage(models.Model):
unicode = models.CharField(max_length=50, primary_key=True)
image = models.ImageField(upload_to='reid', null=True)
def __str__(self):
return self.unicode
| 23.7 | 63 | 0.721519 | 32 | 237 | 5.125 | 0.8125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010204 | 0.172996 | 237 | 9 | 64 | 26.333333 | 0.826531 | 0 | 0 | 0 | 0 | 0 | 0.016878 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0.166667 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
32c74aa4a27f929374a0497d50f44dac34f6d5ea | 729 | py | Python | fraud_backend/core/__init__.py | rsk-mind/rsk-mind-engine | a5c65041c6583516ae44f9a53d8e146b0ed64f5c | [
"MIT"
] | null | null | null | fraud_backend/core/__init__.py | rsk-mind/rsk-mind-engine | a5c65041c6583516ae44f9a53d8e146b0ed64f5c | [
"MIT"
] | null | null | null | fraud_backend/core/__init__.py | rsk-mind/rsk-mind-engine | a5c65041c6583516ae44f9a53d8e146b0ed64f5c | [
"MIT"
] | null | null | null | """Init file of `core` package."""
from .feature import Feature
from .feature_type import FeatureType
from .transaction import Transaction
from .insight import Insight
from .classification_result import ClassificationResult
from .random_generator import RandomGenerator
from .status_type import StatusType
from .transaction_type import TransactionType
from .time_period import TimePeriod
from .geoip_country_wrapper import GeoipCountryWrapper
from ..transformation_engine.transformation import Transformation
__all__ = ('Feature', 'Transaction', 'Insight', 'ClassificationResult',
'FeatureType', 'RandomGenerator', 'StatusType', 'TransactionType',
'TimePeriod', 'GeoipCountryWrapper', 'Transformation', )
| 40.5 | 77 | 0.801097 | 71 | 729 | 8.042254 | 0.43662 | 0.052539 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.119342 | 729 | 17 | 78 | 42.882353 | 0.889408 | 0.038409 | 0 | 0 | 0 | 0 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.785714 | 0 | 0.785714 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
08745d0c543758ecbb8af943e7996107594c4ed7 | 15,346 | py | Python | sodtube1d/solver_porting.py | tai271828/sod-tube | 7224ac84a64908ee48f5a6ea8649d4400da703f7 | [
"BSD-3-Clause"
] | 1 | 2020-11-15T03:41:37.000Z | 2020-11-15T03:41:37.000Z | sodtube1d/solver_porting.py | tai271828/sod-tube | 7224ac84a64908ee48f5a6ea8649d4400da703f7 | [
"BSD-3-Clause"
] | 21 | 2015-05-08T05:38:04.000Z | 2015-05-08T06:16:18.000Z | sodtube1d/solver_porting.py | tai271828/sod-tube | 7224ac84a64908ee48f5a6ea8649d4400da703f7 | [
"BSD-3-Clause"
] | 2 | 2019-07-16T00:40:49.000Z | 2020-11-15T03:41:41.000Z | #
# solver_porting.py
#
# Description:
# Hard code the solution values from the paper
# Sin-Chung Chang,
# "The Method of Space-Time Conservation Element
# and Solution Element - A New Approach for Solving the Navier-Stokes
# and Euler Equations",
# Journal of Computational Physics, Volume 119,
# Issue 2, July 1995, Pages 295-324.
#
# These values are caculated my python program ported from the
# demo example written in fortran in the paper above.
#
# These two functions generated from the same python program
# but one with high precision.
#
def get_specific_solution_for_unit_test():
solution_porting = [
(-0.505000, 1.000000, 0.000000, 1.000000),
(-0.495000, 1.000000, 0.000000, 1.000000),
(-0.485000, 1.000000, 0.000000, 1.000000),
(-0.475000, 1.000000, 0.000000, 1.000000),
(-0.465000, 1.000000, 0.000000, 1.000000),
(-0.455000, 1.000000, 0.000000, 1.000000),
(-0.445000, 1.000000, 0.000000, 1.000000),
(-0.435000, 1.000000, 0.000000, 1.000000),
(-0.425000, 1.000000, 0.000000, 1.000000),
(-0.415000, 1.000000, 0.000000, 1.000000),
(-0.405000, 1.000000, 0.000000, 1.000000),
(-0.395000, 1.000000, 0.000000, 1.000000),
(-0.385000, 1.000000, 0.000000, 1.000000),
(-0.375000, 1.000000, 0.000000, 1.000000),
(-0.365000, 1.000000, 0.000000, 1.000000),
(-0.355000, 1.000000, 0.000000, 1.000000),
(-0.345000, 1.000000, 0.000000, 1.000000),
(-0.335000, 1.000000, 0.000000, 1.000000),
(-0.325000, 1.000000, 0.000000, 1.000000),
(-0.315000, 1.000000, 0.000001, 0.999990),
(-0.305000, 0.999996, 0.000004, 0.999990),
(-0.295000, 0.999976, 0.000028, 0.999960),
(-0.285000, 0.999871, 0.000153, 0.999810),
(-0.275000, 0.999414, 0.000694, 0.999170),
(-0.265000, 0.997818, 0.002584, 0.996940),
(-0.255000, 0.993421, 0.007803, 0.990800),
(-0.245000, 0.983967, 0.019086, 0.977630),
(-0.235000, 0.967934, 0.038418, 0.955410),
(-0.225000, 0.945706, 0.065654, 0.924830),
(-0.215000, 0.919136, 0.098909, 0.888630),
(-0.205000, 0.890232, 0.135996, 0.849670),
(-0.195000, 0.860418, 0.175310, 0.809950),
(-0.185000, 0.830502, 0.215915, 0.770550),
(-0.175000, 0.800906, 0.257311, 0.732020),
(-0.165000, 0.771847, 0.299228, 0.694620),
(-0.155000, 0.743447, 0.341510, 0.658480),
(-0.145000, 0.715776, 0.384050, 0.623660),
(-0.135000, 0.688881, 0.426769, 0.590190),
(-0.125000, 0.662794, 0.469599, 0.558070),
(-0.115000, 0.637537, 0.512474, 0.527300),
(-0.105000, 0.613125, 0.555333, 0.497870),
(-0.095000, 0.589570, 0.598112, 0.469770),
(-0.085000, 0.566880, 0.640745, 0.442980),
(-0.075000, 0.545061, 0.683162, 0.417490),
(-0.065000, 0.524125, 0.725267, 0.393290),
(-0.055000, 0.504121, 0.766883, 0.370400),
(-0.045000, 0.485219, 0.807533, 0.349020),
(-0.035000, 0.467990, 0.845786, 0.329740),
(-0.025000, 0.453912, 0.877936, 0.314190),
(-0.015000, 0.445312, 0.897992, 0.304800),
(-0.005000, 0.442658, 0.904249, 0.301940),
( 0.005000, 0.442772, 0.904002, 0.302070),
( 0.015000, 0.444581, 0.899744, 0.304060),
( 0.025000, 0.446652, 0.894841, 0.306330),
( 0.035000, 0.447224, 0.893443, 0.306970),
( 0.045000, 0.447163, 0.893599, 0.306900),
( 0.055000, 0.446890, 0.894281, 0.306590),
( 0.065000, 0.446835, 0.894505, 0.306480),
( 0.075000, 0.446873, 0.894351, 0.306550),
( 0.085000, 0.446797, 0.894104, 0.306670),
( 0.095000, 0.446632, 0.893997, 0.306740),
( 0.105000, 0.446665, 0.893903, 0.306780),
( 0.115000, 0.447449, 0.893828, 0.306790),
( 0.125000, 0.448803, 0.893843, 0.306710),
( 0.135000, 0.449307, 0.893970, 0.306610),
( 0.145000, 0.446953, 0.894360, 0.306550),
( 0.155000, 0.424999, 0.896761, 0.306480),
( 0.165000, 0.376460, 0.902293, 0.306370),
( 0.175000, 0.323083, 0.908606, 0.306320),
( 0.185000, 0.283863, 0.913549, 0.306240),
( 0.195000, 0.263120, 0.916182, 0.306270),
( 0.205000, 0.255465, 0.916996, 0.306250),
( 0.215000, 0.253829, 0.917267, 0.306240),
( 0.225000, 0.253852, 0.917300, 0.306280),
( 0.235000, 0.254354, 0.917099, 0.306320),
( 0.245000, 0.254848, 0.917298, 0.306330),
( 0.255000, 0.255146, 0.917121, 0.306240),
( 0.265000, 0.255278, 0.916872, 0.306210),
( 0.275000, 0.255309, 0.917358, 0.306380),
( 0.285000, 0.255084, 0.917145, 0.306250),
( 0.295000, 0.255001, 0.916996, 0.306300),
( 0.305000, 0.255013, 0.917194, 0.306380),
( 0.315000, 0.254891, 0.917686, 0.306140),
( 0.325000, 0.254764, 0.917755, 0.306050),
( 0.335000, 0.254647, 0.917552, 0.306570),
( 0.345000, 0.257049, 0.921870, 0.308520),
( 0.355000, 0.246171, 0.878439, 0.292370),
( 0.365000, 0.133610, 0.075640, 0.110350),
( 0.375000, 0.125018, 0.000152, 0.100020),
( 0.385000, 0.125000, 0.000000, 0.100000),
( 0.395000, 0.125000, 0.000000, 0.100000),
( 0.405000, 0.125000, 0.000000, 0.100000),
( 0.415000, 0.125000, 0.000000, 0.100000),
( 0.425000, 0.125000, 0.000000, 0.100000),
( 0.435000, 0.125000, 0.000000, 0.100000),
( 0.445000, 0.125000, 0.000000, 0.100000),
( 0.455000, 0.125000, 0.000000, 0.100000),
( 0.465000, 0.125000, 0.000000, 0.100000),
( 0.475000, 0.125000, 0.000000, 0.100000),
( 0.485000, 0.125000, 0.000000, 0.100000),
( 0.495000, 0.125000, 0.000000, 0.100000),
( 0.505000, 0.125000, 0.000000, 0.100000)
]
return solution_porting
def get_specific_solution_for_unit_test_high_precision():
solution_porting = [
(-0.505, 1.0, 0.0, 1.0),
(-0.495, 1.0, 1.1102230246251565e-16, 0.99999999999999978),
(-0.48499999999999999, 1.0, 1.1102230246251565e-16, 0.99999999999999978),
(-0.47499999999999998, 1.0, 1.1102230246251565e-16, 0.99999999999999978),
(-0.46499999999999997, 1.0, 1.1102230246251565e-16, 0.99999999999999978),
(-0.45499999999999996, 1.0, 1.1102230246251565e-16, 0.99999999999999978),
(-0.44499999999999995, 1.0, 1.1102230246251565e-16, 0.99999999999999978),
(-0.43499999999999994, 1.0, 1.1102230246251565e-16, 0.99999999999999978),
(-0.42499999999999993, 1.0, 1.1102230246251565e-16, 0.99999999999999978),
(-0.41499999999999992, 1.0, 1.1102230246251565e-16, 0.99999999999999978),
(-0.40499999999999992, 1.0, 1.1102230246251565e-16, 0.99999999999999978),
(-0.39499999999999991, 0.99999999999999978, 2.7755575615628918e-16, 0.99999999999999944),
(-0.3849999999999999, 0.99999999999999467, 6.4670491184415716e-15, 0.99999999999999234),
(-0.37499999999999989, 0.99999999999988776, 1.3308798507695558e-13, 0.99999999999984257),
(-0.36499999999999988, 0.99999999999795142, 2.4237278850641443e-12, 0.99999999999713185),
(-0.35499999999999987, 0.99999999996762634, 3.8304831530130371e-11, 0.99999999995467714),
(-0.34499999999999986, 0.9999999995562131, 5.2509580040759933e-10, 0.99999999937869855),
(-0.33499999999999985, 0.99999999472607115, 6.2401971419523565e-09, 0.99999999261649919),
(-0.32499999999999984, 0.99999994577382079, 6.4161282047119177e-08, 0.99999992408334937),
(-0.31499999999999984, 0.99999951928196795, 5.6879332200680462e-07, 0.99999932699485283),
(-0.30499999999999983, 0.99999634481101307, 4.3248824814959905e-06, 0.99999488274087778),
(-0.29499999999999982, 0.99997633737099978, 2.79981985962474e-05, 0.99996687254024597),
(-0.28499999999999981, 0.99987088139365798, 0.00015278136209548727, 0.99981924026677849),
(-0.2749999999999998, 0.99941378043705476, 0.00069375744886315566, 0.99917941692171297),
(-0.26499999999999979, 0.99781788235911262, 0.0025838519965398011, 0.99694667070431586),
(-0.25499999999999978, 0.99342121495457225, 0.0078025845316690946, 0.99080377644372952),
(-0.24499999999999977, 0.98396664008085244, 0.019085577438586857, 0.97763274444798665),
(-0.23499999999999976, 0.96793363368888941, 0.038418196061865424, 0.95541204434804472),
(-0.22499999999999976, 0.94570644798043035, 0.065654265643744547, 0.92483779493022644),
(-0.21499999999999975, 0.91913571997302768, 0.098909427615020667, 0.88863525073537986),
(-0.20499999999999974, 0.89023221601523495, 0.13599566576005953, 0.84967793214624232),
(-0.19499999999999973, 0.86041780219813813, 0.17531012301721785, 0.80995068909265133),
(-0.18499999999999972, 0.8305020195811702, 0.21591521730211277, 0.77055070706890127),
(-0.17499999999999971, 0.8009056282617506, 0.25731095878337934, 0.7320223185641187),
(-0.1649999999999997, 0.77184714843620994, 0.29922837596343643, 0.69462654528961598),
(-0.15499999999999969, 0.74344677036077855, 0.34150984863445688, 0.6584888001930933),
(-0.14499999999999968, 0.71577615716384058, 0.3840502790961422, 0.62366900266734182),
(-0.13499999999999968, 0.68888144418494501, 0.42676943038587994, 0.59019377200083745),
(-0.12499999999999968, 0.6627941455413211, 0.46959860870295073, 0.55807162556304857),
(-0.11499999999999969, 0.63753660526589484, 0.51247390933368231, 0.52730052843980701),
(-0.10499999999999969, 0.61312484769809938, 0.55533265985338043, 0.49787180099864842),
(-0.094999999999999696, 0.58957011850181684, 0.59811153812036699, 0.4697721936664796),
(-0.084999999999999701, 0.56688001778671482, 0.64074509894323095, 0.44298533199781343),
(-0.074999999999999706, 0.54506080995274542, 0.68316169419725314, 0.41749444939192293),
(-0.064999999999999711, 0.52412533713855136, 0.72526708274475149, 0.39329151342581087),
(-0.054999999999999709, 0.50412059320145031, 0.7668829674339982, 0.3704086642557895),
(-0.044999999999999707, 0.48521942621212033, 0.8075325790323119, 0.34902157047542365),
(-0.034999999999999705, 0.46798952801415838, 0.84578618076008127, 0.32974685351833127),
(-0.024999999999999703, 0.4539124843363786, 0.87793571859933139, 0.3141914269987745),
(-0.014999999999999703, 0.4453117097494409, 0.8979921479041113, 0.3048070144768753),
(-0.0049999999999997026, 0.44265849796839962, 0.90424912589460049, 0.30194110396148455),
(0.0050000000000002976, 0.44277152604102954, 0.90400167161754941, 0.30207396109955731),
(0.015000000000000298, 0.44458074109625789, 0.89974424674017883, 0.30406154478259872),
(0.0250000000000003, 0.44665186574379889, 0.89484127842442829, 0.30633620659817651),
(0.035000000000000302, 0.44722415984760716, 0.89344336715923944, 0.3069767246505235),
(0.045000000000000304, 0.44716266478033079, 0.89359856206472299, 0.30690395534340742),
(0.055000000000000306, 0.44689000763788234, 0.89428145391403135, 0.30659011440665951),
(0.065000000000000308, 0.44683455389593113, 0.89450478975743941, 0.30648208370927321),
(0.075000000000000303, 0.44687343951557484, 0.89435080463668515, 0.30655575368395022),
(0.085000000000000298, 0.44679662179222007, 0.89410446777149932, 0.30667701988019136),
(0.095000000000000293, 0.44663194699514586, 0.89399670954746402, 0.3067426275793218),
(0.10500000000000029, 0.44666498067017296, 0.8939032368159131, 0.30678067827130739),
(0.11500000000000028, 0.44744939615633389, 0.8938283386254392, 0.30679034686021484),
(0.12500000000000028, 0.44880262918560282, 0.89384265926379181, 0.30671165608649037),
(0.13500000000000029, 0.44930671664614646, 0.8939701751341157, 0.30661316478296419),
(0.1450000000000003, 0.44695294693653559, 0.89436014525089413, 0.30655123374810866),
(0.1550000000000003, 0.42499884313690589, 0.8967607749926938, 0.30648056991207406),
(0.16500000000000031, 0.37646019200020114, 0.90229316109419666, 0.3063749421769546),
(0.17500000000000032, 0.32308346953859418, 0.9086059712367901, 0.30632068302060489),
(0.18500000000000033, 0.28386306263008648, 0.91354863178497869, 0.30624468303654856),
(0.19500000000000034, 0.26312012485796243, 0.91618236506234674, 0.30627926864421728),
(0.20500000000000035, 0.25546475796037754, 0.91699628286383128, 0.30625564741653527),
(0.21500000000000036, 0.25382887050832692, 0.91726748768940347, 0.30624466686916185),
(0.22500000000000037, 0.25385244118957323, 0.91730025383922331, 0.30628818557740017),
(0.23500000000000038, 0.25435421897952837, 0.91709938305572969, 0.30632175500661168),
(0.24500000000000038, 0.25484785803655347, 0.91729763126993402, 0.30633152306973305),
(0.25500000000000039, 0.25514629256535842, 0.91712073191552634, 0.30624259391310038),
(0.2650000000000004, 0.25527804138560317, 0.91687215887997642, 0.30621371074195036),
(0.27500000000000041, 0.2553086860042269, 0.9173579272884218, 0.306381349096989),
(0.28500000000000042, 0.25508421322101449, 0.91714513017949251, 0.30625145391872971),
(0.29500000000000043, 0.25500112971314676, 0.91699589381745272, 0.30630793033357473),
(0.30500000000000044, 0.25501325412451314, 0.91719423148529511, 0.30637974594764761),
(0.31500000000000045, 0.2548911547607271, 0.91768611502897424, 0.30614465035840854),
(0.32500000000000046, 0.2547644714837658, 0.91775514645688094, 0.30605138955358835),
(0.33500000000000046, 0.2546465556459554, 0.91755181317584589, 0.30657038190930797),
(0.34500000000000047, 0.25704850786977601, 0.92186989259160956, 0.3085287750393364),
(0.35500000000000048, 0.24617054290848731, 0.8784393859773485, 0.29236958085661585),
(0.36500000000000049, 0.13360953118193081, 0.07564047374232051, 0.11035282175804639),
(0.3750000000000005, 0.12501790423176928, 0.00015158938150652916, 0.10002005518613435),
(0.38500000000000051, 0.12500002915548108, 2.4684206810964962e-07, 0.1000000326541411),
(0.39500000000000052, 0.12500000004718731, 3.9950684412222107e-10, 0.10000000005284979),
(0.40500000000000053, 0.12500000000007638, 6.4678817857060536e-13, 0.10000000000008555),
(0.41500000000000054, 0.12500000000000014, 1.0269562977782686e-15, 0.10000000000000016),
(0.42500000000000054, 0.125, 8.3266726846886741e-17, 0.10000000000000002),
(0.43500000000000055, 0.125, 8.3266726846886741e-17, 0.10000000000000002),
(0.44500000000000056, 0.125, 8.3266726846886741e-17, 0.10000000000000002),
(0.45500000000000057, 0.125, 8.3266726846886741e-17, 0.10000000000000002),
(0.46500000000000058, 0.125, 8.3266726846886741e-17, 0.10000000000000002),
(0.47500000000000059, 0.125, 8.3266726846886741e-17, 0.10000000000000002),
(0.4850000000000006, 0.125, 8.3266726846886741e-17, 0.10000000000000002),
(0.49500000000000061, 0.125, 8.3266726846886741e-17, 0.10000000000000002),
(0.50500000000000056, 0.125, 0.0, 0.10000000000000001)]
return solution_porting
| 65.581197 | 97 | 0.681937 | 1,773 | 15,346 | 5.892837 | 0.391427 | 0.034839 | 0.029862 | 0.025459 | 0.14577 | 0.14577 | 0.14376 | 0.072167 | 0 | 0 | 0 | 0.777392 | 0.173335 | 15,346 | 233 | 98 | 65.862661 | 0.046193 | 0.034797 | 0 | 0.018957 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.009479 | false | 0 | 0 | 0 | 0.018957 | 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 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
087b4954752b4181e71bfac1e296772ecaeab3f5 | 3,683 | py | Python | backend/hardware/admin.py | berserg2010/hardware_inventory | 4d3b5bf483a5a00eee5be1755f7137087fc24ff2 | [
"Apache-2.0"
] | null | null | null | backend/hardware/admin.py | berserg2010/hardware_inventory | 4d3b5bf483a5a00eee5be1755f7137087fc24ff2 | [
"Apache-2.0"
] | 5 | 2021-03-19T04:48:19.000Z | 2021-09-22T19:11:47.000Z | backend/hardware/admin.py | berserg2010/hardware_inventory | 4d3b5bf483a5a00eee5be1755f7137087fc24ff2 | [
"Apache-2.0"
] | null | null | null | from django.contrib import admin
from utils.utils import (
MotherboardInline,
MicroprocessorInline,
MemoryInline,
StorageInline,
VideoCardInline,
MonitorInline,
PowerSupplyInline,
OpticalDiscDriveInline,
NetworkCardInline,
)
from .models import (
Motherboard,
Microprocessor,
Memory,
Storage,
VideoCard,
Monitor,
PowerSupply,
OpticalDiscDrive,
NetworkCard,
)
class CustomListWorkstationsModelAdmin(admin.ModelAdmin):
list_display_links = ("description",)
list_display = ["get_list_workstations"]
list_filter = ["manufacturer"]
list_select_related = False
preserve_filters = False
save_on_top = True
search_fields = ["inventory_number", "description"]
exclude = ("workstation", )
readonly_fields = ("created", "changed")
def get_list_workstations(self, obj):
instance = obj.workstation_set.filter()
if instance.exists():
return [*instance]
else:
return []
get_list_workstations.short_description = "Рабочая станция"
@admin.register(Motherboard)
class MotherboardAdmin(CustomListWorkstationsModelAdmin):
list_display = (
*Motherboard._list_fields(),
*CustomListWorkstationsModelAdmin.list_display,
)
fields = (*Motherboard._list_fields(), )
inlines = [MotherboardInline, ]
@admin.register(Microprocessor)
class MicroprocessorAdmin(CustomListWorkstationsModelAdmin):
list_display = (
*Microprocessor._list_fields(),
*CustomListWorkstationsModelAdmin.list_display,
)
fields = (*Microprocessor._list_fields(), )
inlines = [MicroprocessorInline, ]
@admin.register(Memory)
class MemoryAdmin(CustomListWorkstationsModelAdmin):
list_display = (
*Memory._list_fields(),
*CustomListWorkstationsModelAdmin.list_display,
)
fields = (*Memory._list_fields(), )
inlines = [MemoryInline, ]
@admin.register(Storage)
class StorageAdmin(CustomListWorkstationsModelAdmin):
list_display = (
*Storage._list_fields(),
*CustomListWorkstationsModelAdmin.list_display,
)
fields = (*Storage._list_fields(), )
inlines = [StorageInline, ]
@admin.register(VideoCard)
class VideoCardAdmin(CustomListWorkstationsModelAdmin):
list_display = (
*VideoCard._list_fields(),
*CustomListWorkstationsModelAdmin.list_display,
)
fields = (*VideoCard._list_fields(), )
inlines = [VideoCardInline, ]
@admin.register(Monitor)
class MonitorAdmin(CustomListWorkstationsModelAdmin):
list_display = (
*Monitor._list_fields(),
*CustomListWorkstationsModelAdmin.list_display,
)
fields = (*Monitor._list_fields(), )
inlines = [MonitorInline, ]
@admin.register(PowerSupply)
class PowerSupplyAdmin(CustomListWorkstationsModelAdmin):
list_display = (
*PowerSupply._list_fields(),
*CustomListWorkstationsModelAdmin.list_display,
)
fields = (*PowerSupply._list_fields(), )
inlines = [PowerSupplyInline, ]
@admin.register(OpticalDiscDrive)
class OpticalDiscDriveAdmin(CustomListWorkstationsModelAdmin):
list_display = (
*OpticalDiscDrive._list_fields(),
*CustomListWorkstationsModelAdmin.list_display,
)
fields = (*OpticalDiscDrive._list_fields(), )
inlines = [OpticalDiscDriveInline, ]
@admin.register(NetworkCard)
class NetworkCardAdmin(CustomListWorkstationsModelAdmin):
list_display = (
*NetworkCard._list_fields(),
*CustomListWorkstationsModelAdmin.list_display,
)
fields = (*NetworkCard._list_fields(), "workstations")
inlines = [NetworkCardInline, ]
| 25.226027 | 63 | 0.705675 | 274 | 3,683 | 9.215328 | 0.281022 | 0.087129 | 0.306535 | 0.16396 | 0.210297 | 0.210297 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195221 | 3,683 | 145 | 64 | 25.4 | 0.851889 | 0 | 0 | 0.160714 | 0 | 0 | 0.033397 | 0.005702 | 0 | 0 | 0 | 0 | 0 | 1 | 0.008929 | false | 0 | 0.026786 | 0 | 0.464286 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
088d7a13690333676b9f326704fabbafc74a9546 | 1,727 | py | Python | bokeh-backend/s3DataViewerPlotServer/apps/image.py | stevievb/s3dataviewer | c96a57c03cfdc15e9808632c465db9f4c2b33bbe | [
"MIT"
] | null | null | null | bokeh-backend/s3DataViewerPlotServer/apps/image.py | stevievb/s3dataviewer | c96a57c03cfdc15e9808632c465db9f4c2b33bbe | [
"MIT"
] | 7 | 2021-03-10T21:48:45.000Z | 2022-02-27T06:29:02.000Z | bokeh-backend/s3DataViewerPlotServer/apps/image.py | stevievb/s3dataviewer | c96a57c03cfdc15e9808632c465db9f4c2b33bbe | [
"MIT"
] | null | null | null | from bokeh.application.handlers import FunctionHandler, DirectoryHandler
from bokeh.application import Application
import numpy as np
import holoviews as hv
import boto3
from PIL import Image
import holoviews.plotting.bokeh # important
from bokeh.io import show, curdoc
from bokeh.layouts import layout
import io
from holoviews.operation.datashader import datashade
from bokeh.models import Slider, Button
from marshmallow import Schema, fields, INCLUDE
renderer = hv.renderer('bokeh').instance(mode='server')
class BokehImageAppArgsSchema(Schema):
bucket = fields.List(fields.String())
key = fields.List(fields.String())
height = fields.List(fields.Integer())
width = fields.List(fields.Integer())
# Define valid function for FunctionHandler
# when deploying as script, simply attach to curdoc
def modify_doc(doc):
args = doc.session_context.request.arguments
args_schema = BokehImageAppArgsSchema()
loaded_args = args_schema.load(args, unknown=INCLUDE)
bucket = loaded_args['bucket'][0]
key = loaded_args['key'][0]
s3 = boto3.resource('s3')
bucket = s3.Bucket(bucket)
object = bucket.Object(key)
file_stream = io.BytesIO()
object.download_fileobj(file_stream)
pil_image = Image.open(file_stream)
hv_img_plot = hv.Image(np.asarray(pil_image)).options(
height=loaded_args['height'][0], width=loaded_args['width'][0])
# Create HoloViews plot and attach the document
hvplot = renderer.get_plot(hv_img_plot, doc)
# Combine the holoviews plot and widgets in a layout
plot = layout([
[hvplot.state]], sizing_mode='fixed')
doc.add_root(plot)
return doc
bokeh_image_app = Application(FunctionHandler(modify_doc))
| 28.783333 | 72 | 0.74117 | 227 | 1,727 | 5.528634 | 0.427313 | 0.035857 | 0.050996 | 0.03506 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006211 | 0.160973 | 1,727 | 59 | 73 | 29.271186 | 0.859903 | 0.11465 | 0 | 0 | 0 | 0 | 0.024951 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.025641 | false | 0 | 0.333333 | 0 | 0.512821 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
0897e6e18e37e705a44326f01694b143349855e7 | 449 | py | Python | glearn/sqlite/base.py | WeiShiwei/tornado_glearn | 5e74bbaaee4d2b8c5abf3b60cffbe54694a3bc6f | [
"Apache-2.0"
] | null | null | null | glearn/sqlite/base.py | WeiShiwei/tornado_glearn | 5e74bbaaee4d2b8c5abf3b60cffbe54694a3bc6f | [
"Apache-2.0"
] | null | null | null | glearn/sqlite/base.py | WeiShiwei/tornado_glearn | 5e74bbaaee4d2b8c5abf3b60cffbe54694a3bc6f | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
u"""
User: xulin
Date: 13-6-6
Time: 上午11:08
"""
import datetime
from sqlalchemy import Column, DateTime, text
from sqlalchemy.ext.declarative import declarative_base
class TBase(object):
created_date = Column(DateTime, default=datetime.datetime.now)
modified_date = Column(DateTime, default=datetime.datetime.now, onupdate=text('current_timestamp'))
Base = declarative_base(cls=TBase)
if __name__ == '__main__':
pass | 21.380952 | 103 | 0.757238 | 60 | 449 | 5.45 | 0.6 | 0.12844 | 0.110092 | 0.152905 | 0.269113 | 0.269113 | 0.269113 | 0 | 0 | 0 | 0 | 0.023018 | 0.129176 | 449 | 21 | 104 | 21.380952 | 0.813299 | 0.115813 | 0 | 0 | 0 | 0 | 0.064103 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.1 | 0.3 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
08a92168ca969ebfdffd7517b27ac23e7689892a | 326 | py | Python | tests/listeners.py | jaynewey/stup | 540012ba18e86d1b26eb1aebd9e3c0ebe16726b4 | [
"MIT"
] | 1 | 2020-06-09T02:30:09.000Z | 2020-06-09T02:30:09.000Z | tests/listeners.py | jaynewey/stup-ecs | 540012ba18e86d1b26eb1aebd9e3c0ebe16726b4 | [
"MIT"
] | 1 | 2020-08-07T12:11:51.000Z | 2020-08-07T12:11:51.000Z | tests/listeners.py | jaynewey/stup | 540012ba18e86d1b26eb1aebd9e3c0ebe16726b4 | [
"MIT"
] | null | null | null | from stup.entity_listener import EntityListener
class EventListener(EntityListener):
event_queue = []
def entity_added(self, entity):
self.event_queue.append(("entity_added", entity))
def entity_removed(self, entity, components):
self.event_queue.append(("entity_removed", entity, components))
| 27.166667 | 71 | 0.730061 | 37 | 326 | 6.216216 | 0.432432 | 0.130435 | 0.121739 | 0.173913 | 0.226087 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.162577 | 326 | 11 | 72 | 29.636364 | 0.842491 | 0 | 0 | 0 | 0 | 0 | 0.079755 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.142857 | 0 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
08d7bd1e4b9e8704653d7065cb961f35603d14e7 | 2,064 | py | Python | src/core/src/tortuga/utility/xmlParserUtility.py | sutasu/tortuga | 48d7cde4fa652346600b217043b4a734fa2ba455 | [
"Apache-2.0"
] | 33 | 2018-03-02T17:07:39.000Z | 2021-05-21T18:02:51.000Z | src/core/src/tortuga/utility/xmlParserUtility.py | sutasu/tortuga | 48d7cde4fa652346600b217043b4a734fa2ba455 | [
"Apache-2.0"
] | 201 | 2018-03-05T14:28:24.000Z | 2020-11-23T19:58:27.000Z | src/core/src/tortuga/utility/xmlParserUtility.py | sutasu/tortuga | 48d7cde4fa652346600b217043b4a734fa2ba455 | [
"Apache-2.0"
] | 23 | 2018-03-02T17:21:59.000Z | 2020-11-18T14:52:38.000Z | # Copyright 2008-2018 Univa Corporation
#
# 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 tortuga.exceptions.invalidXml import InvalidXml
def getRequiredElementList(node, tag):
elements = node.getElementsByTagName(tag)
if not elements:
raise InvalidXml('XML missing required element: %s' % (tag))
return elements
def getRequiredElement(node, tag):
elements = getRequiredElementList(node, tag)
# Try to find direct child first.
for n in elements:
if n.parentNode.nodeName == node.nodeName:
return n
return elements[0]
def getOptionalElementList(node, tag):
elements = node.getElementsByTagName(tag)
return elements
def getOptionalElement(node, tag):
elements = node.getElementsByTagName(tag)
if not elements:
return None
# Try to find direct child first.
for n in elements:
if n.parentNode.nodeName == node.nodeName:
return n
return elements[0]
def getRequiredTextElement(node, tag):
return getRequiredElement(node, tag).firstChild.nodeValue
def getOptionalTextElement(node, tag):
try:
return getRequiredElement(node, tag).firstChild.nodeValue
except Exception:
return ''
def getRequiredAttribute(node, attrName):
if node.hasAttribute(attrName):
return node.getAttribute(attrName)
raise InvalidXml('XML missing required attribute: %s' % (attrName))
def getOptionalAttribute(node, attrName):
try:
return getRequiredAttribute(node, attrName)
except Exception:
return ''
| 28.666667 | 74 | 0.717539 | 247 | 2,064 | 5.995951 | 0.425101 | 0.042539 | 0.040513 | 0.038488 | 0.345712 | 0.301148 | 0.205267 | 0.205267 | 0.205267 | 0.130993 | 0 | 0.008542 | 0.205911 | 2,064 | 71 | 75 | 29.070423 | 0.895058 | 0.301357 | 0 | 0.589744 | 0 | 0 | 0.046283 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.205128 | false | 0 | 0.025641 | 0.025641 | 0.564103 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
08f9d6286887ce231df006f378a019f46b0ba2fc | 19,253 | py | Python | rpsrunner.py | vmonaco/rpscontest | 1c70182fc97c14f30aa41f08f2371347f0f2f743 | [
"BSD-3-Clause"
] | 3 | 2016-07-24T23:01:43.000Z | 2020-11-08T19:21:09.000Z | rpsrunner.py | vmonaco/rpscontest | 1c70182fc97c14f30aa41f08f2371347f0f2f743 | [
"BSD-3-Clause"
] | 1 | 2020-03-18T07:11:38.000Z | 2020-03-21T20:40:26.000Z | rpsrunner.py | vmonaco/rpscontest | 1c70182fc97c14f30aa41f08f2371347f0f2f743 | [
"BSD-3-Clause"
] | 2 | 2015-09-02T03:44:29.000Z | 2020-03-18T07:07:30.000Z | #!/usr/bin/env python
# Rock-Paper-Scissors runner for http://www.rpscontest.com/
# Copyright (c) 2011 Jonathan Burdge
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject
# to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
try:
from multiprocessing import Pool, cpu_count
except:
Pool = None
import getopt
import glob
import os
import random
import sys
import time
import traceback
########
VERSION = "1.0.1"
MATCHES = 10
POOL_SIZE = 1
if Pool is not None:
try:
POOL_SIZE = cpu_count()
except:
pass
WINDOWS = False
try:
sys.getwindowsversion()
except:
WINDOWS = False
else:
WINDOWS = True
########
class Bot:
"""Basic bot class to wrap bot functions"""
def __init__(self, name, code=None):
"""
name should be a unique identifier and must be a readable
filename if code is not specified
"""
self.name = name
if code is None:
self.load_code()
else:
self.code = code
self.reset()
def __eq__(self, other):
return self.name == other.name
def get_move(self, input):
"""Get the next move for the bot given input
input must be "R", "P", "S" or ""
"""
if self._code is None:
self.compile_code()
self.scope["input"] = input
exec self._code in self.scope
self.output = self.scope["output"]
return self.output
def compile_code(self):
self._code = compile(self.code, '<string>', 'exec')
def reset(self):
"""Resets bot for another round. This must be called before trying
to pass the bot between workers, or you may see obscure errors from failures
to pickle the bots scope dictionary."""
self.scope = dict()
# this will hold compiled code, but it apparently can't be
# pickled? so we'll have to do it later. XXX check into this
self._code = None
def load_code(self):
"""Load bot code from the file specified by the name attribute"""
f = open(self.name, "r")
self.code = f.read()
f.close()
# used to evaluate a pair of moves
# scoring[bot1_move][bot2_move]
# 1 = bot1 won, -1 = bot2 won, 0 = tie
# TODO: move into ContestResult?
scoring = {
"R": {
"R": 0,
"P": -1,
"S": 1
},
"P": {
"R": 1,
"P": 0,
"S": -1
},
"S": {
"R": -1,
"P": 1,
"S": 0
}
}
class ContestResult:
"""Used to track and report on the status of a contest. Shared values
are reported from the perspective of bot1. For example, score > 0 indicates
that bot1 won by that many points. score < 0 indicates bot 1 lost by that
many points."""
# TODO bot-specific data should be a seperate object. ContestResult
# should track two of these objects and move most of the bot-specific
# data below into them.
def __init__(self, bot1, bot2):
self.bot1 = bot1
self.bot2 = bot2
self.bot1_disqualified = False
self.bot2_disqualified = False
self.finalized = False
self.errors = False
self.error_string = ""
self.wins1 = 0
self.wins2 = 0
self.ties1 = 0
self.ties2 = 0
self.losses1 = 0
self.losses2 = 0
self.score = 0
self.played = 0
self.history1 = []
self.history2 = []
self.score_history = []
self.start_time = None
self.end_time = None
self.run_time = 0.0
self.winner = None
self.loser = None
def start(self):
self.start_time = time.time()
def score_moves(self, move1, move2):
"""This function is called to score and track each pair of moves
from a contest."""
score = 0
try:
score = scoring[move1][move2]
except KeyError:
# TODO disqualify bot and exit contest
if move1 not in "RPS":
score = -1
elif move2 not in "RPS":
score = 1
else:
raise Exception("Can't score %s and %s?!" % (move1, move2))
if score > 0:
self.wins1 += 1
self.losses2 += 1
elif score < 0:
self.losses1 += 1
self.wins2 += 1
else:
self.ties1 += 1
self.ties2 += 1
self.score += score
self.history1.append(move1)
self.history2.append(move2)
self.score_history.append(score)
self.played += 1
return score
def finalize(self, errors=False, error_string=""):
"""Called once a contest is complete to do some final bookkeeping.
This is REQUIRED if multiprocessing features are in use."""
# the bots must be reset before being passed between workers
# see comments under Bot.reset()
self.bot1.reset()
self.bot2.reset()
self.errors = errors
self.error_string = error_string
self.history1 = "".join(self.history1)
self.history2 = "".join(self.history2)
self.end_time = time.time()
self.run_time = self.end_time - self.start_time
if self.wins1 > self.wins2:
self.winner = self.bot1
self.loser = self.bot2
elif self.wins1 < self.wins2:
self.winner = self.bot2
self.loser = self.bot1
self.finalized = True
def __str__(self):
game = "%s vs %s:" % (self.bot1.name, self.bot2.name)
if self.bot1_disqualified:
return "%s bot 1 disqualified" % game
elif self.bot2_disqualified:
return "%s bot 2 disqualified" % game
elif self.finalized:
return "%s score %d, took %.2f seconds" % \
(game, self.score, self.run_time)
else:
return "%s score %d -- not final" % (game, self.score)
class Contest:
"""Contest object handles running a contest between two sets of bots."""
def __init__(self, bot1, bot2, rounds=1000):
self.bot1 = bot1
self.bot2 = bot2
self.rounds = rounds
self.result = ContestResult(bot1, bot2)
# isolate random number generator
r1 = random.random()
r2 = random.random()
base_rng = random.getstate()
random.seed(r1)
self.bot1_rng = random.getstate()
random.seed(r2)
self.bot2_rng = random.getstate()
random.setstate(base_rng)
def run(self):
"""Runs the configured contest and reports a ContestResult"""
self.result.start()
base_rng = random.getstate()
input1 = input2 = output1 = output2 = ""
errors = False
error_string = ""
for i in xrange(self.rounds):
random.setstate(self.bot1_rng)
try:
output1 = self.bot1.get_move(input1)
except KeyboardInterrupt:
raise
except:
exc_type, exc_value, exc_traceback = sys.exc_info()
exc_string = "".join(traceback.format_exception(exc_type,
exc_value, exc_traceback))
error_string = "Error from %s\n%s" % (self.bot1.name,
exc_string)
errors = True
self.result.bot1_disqualified = True
else:
if output1 not in "RPS":
errors = True
self.result.bot1_disqualified = True
error_string = "bot1 did not make a valid move"
self.bot1_rng = random.getstate()
random.setstate(self.bot2_rng)
try:
output2 = self.bot2.get_move(input2)
except KeyboardInterrupt:
raise
except:
exc_type, exc_value, exc_traceback = sys.exc_info()
exc_string = "".join(traceback.format_exception(exc_type,
exc_value, exc_traceback))
error_string = "Error from %s\n%s" % (self.bot1.name,
exc_string)
errors = True
self.result.bot2_disqualified = True
else:
if output2 not in "RPS":
errors = True
self.result.bot2_disqualified = True
error_string = "bot2 did not make a valid move"
self.bot2_rng = random.getstate()
if errors:
break
self.result.score_moves(output1, output2)
input1 = output2
input2 = output1
# TODO add early bail out like official contest
self.result.finalize(errors=errors, error_string=error_string)
random.setstate(base_rng)
return self.result
### Main program logic
def load_bots(names, desc=None, bot_obj=Bot):
"""Initializes several Bot objects given a list of filenames.
desc is an optional output string."""
bots = []
for name in names:
bots.append(bot_obj(name))
if desc is not None:
print "%s:" % (desc),
print "%d bots loaded" % len(bots)
return bots
def match_maker(bots, bots2=None, matches=1, rounds=1000):
"""generates matches between all the bots in bots or in the union of
bots and bots2. matches specifies the number of matches played for each
pairing. a bot will never play itself."""
if not bots:
raise Exception("Must specify bots")
if not bots2:
for i in xrange(len(bots)):
bot1 = bots[i]
for j in xrange(i+1, len(bots)):
bot2 = bots[j]
if bot1 == bot2:
continue
for k in xrange(matches):
# TODO modify contest to allow for multiple matches?
yield Contest(bot1, bot2, rounds)
else:
for bot1 in bots:
for bot2 in bots2:
if bot1 == bot2:
continue
for i in xrange(matches):
# TODO modify contest to specify multiple matches?
yield Contest(bot1, bot2, rounds)
def report_results(bots, results):
"""Summarizes a list of ContestResults"""
# TODO this is ugly, streamline.
botnames = [i.name for i in bots]
matches_played = dict.fromkeys(botnames, 0)
matches_won = dict.fromkeys(botnames, 0)
scores = dict.fromkeys(botnames, 0)
rounds_won = dict.fromkeys(botnames, 0)
rounds_played = dict.fromkeys(botnames, 0)
bot_results = dict(zip(botnames, [list() for i in botnames]))
for result in results:
if result.errors:
print "errors in contest:", result
print result.error_string
matches_played[ result.bot1.name ] += 1
matches_played[ result.bot2.name ] += 1
if result.winner is not None:
matches_won[ result.winner.name ] += 1
scores[ result.bot1.name ] += result.score
scores[ result.bot2.name ] -= result.score # invert score for bot2
rounds_won[ result.bot1.name ] += result.wins1
rounds_won[ result.bot2.name ] += result.wins2
rounds_played[ result.bot1.name ] += result.played
rounds_played[ result.bot2.name ] += result.played
# sort results for output - sort list by
win_ratio = dict(zip(botnames,
map(lambda x: float(matches_won[x]) / matches_played[x], botnames)))
botnames.sort(lambda x,y: cmp(win_ratio[y], win_ratio[x]))
print
for bot in botnames:
# float casting is necessary below, because we can import division
# from __future__; that causes some of the bots to misbehave who
# are not expecting it.
print "%s: won %.1f%% of matches (%d of %d)\n" \
" won %.1f%% of rounds (%d of %d)\n" \
" avg score %.1f, net score %.1f\n" % \
(bot, float(matches_won[bot]) / matches_played[bot] * 100,
matches_won[bot], matches_played[bot],
float(rounds_won[bot]) / rounds_played[bot] * 100,
rounds_won[bot], rounds_played[bot],
float(scores[bot]) / matches_played[bot],
scores[bot])
def runner(contest):
"""Contest wrapper, needed for multiprocessing implementation"""
try:
result = contest.run()
except KeyboardInterrupt:
# need to raise a non-keyboard interrupt error here to get
# the pool to die cleanly.
# XXX Is there a better way to handle this?
raise Exception("Got Keyboard Interrupt!")
return result
def pool_start(threads):
"""Starts a worker pool and returns that pool"""
if Pool is None or threads == 1:
raise Exception("Invalid configuration for worker threads")
return Pool(processes=threads)
def pool_stop(pool):
"""Stops a worker pool."""
pool.close()
pool.join()
def run_contests(contests, threads):
"""Runs through a set of contests, using multiprocessing if available
contests must be iterable return Contest objects."""
# TODO instead of passing contests directly into pool.map, we should
# use a multi process queue of some kind that is fed into by the
# parent process
# TODO process results real time through a callback or something?
print "Running matches in", threads, "threads"
results = []
if Pool is not None and threads != 1:
pool = pool_start(threads)
results = pool.map(runner, contests)
pool_stop(pool)
else:
for contest in contests:
results.append(contest.run())
return results
def low_priority():
"""Sets process (and its children) to have a very low priority."""
if WINDOWS:
import win32api, win32con, win32process
pid = win32api.GetCurrentProcessId()
handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid)
win32process.SetPriorityClass(handle, win32process.IDLE_PRIORITY_CLASS)
else:
os.nice(19)
def usage(msg, exit=0):
print """
Rock-Paper-Scissors Runner v%s (http://www.rpscontest.com/)
rpsrunner.py [options] <POOL1> [POOL2]
rpsrunner.py [options] bot1.py bot2.py bot3.py
Options:
-h|--help Print this usage output
-l|--low Run the process at a lower priority to keep the
system responsive.
-m|--matches <N> How many matches to play for each pairing [def: %d]
-t|--threads <N> How many execution threads to use [def: %d]
The multiprocessing module must be available to use more than one
execution thread. On this host, multiprocessing is: %s
Additional arguments:
Pool format: bot1.py,bot2.py[,bot3.py,...]
or : "bot*.py"
You must specify at least two bot files in one or two pools. If one
pool is specified, all bots in that pool will play against every other
bot for the number of matches specified.
If two pools are specified, all the bots in each pool will play all the
bots in the other pool.
Example:
rpsrunner.py -t 4 -m 100 mybot.py 'rpsbots/*.py'
rpsrunner.py mybot1.py,mybot2.py 'rpsbots/*.py'
NOTE: Bots run through this script have full access to the Python
interpreter, so they could use it to do all sorts of nasty things to your
computer. You must review the code for any bot you want to run, and if
you're not sure what the bot does, then you shouldn't run it.""" % \
(VERSION, MATCHES, POOL_SIZE,
Pool is not None and "AVAILABLE" or "UNAVAILABLE")
if msg:
print "\n\n%s" % msg
return exit
def main(prog_args):
# defaults
matches = MATCHES
threads = POOL_SIZE
set_low_priority = False
try:
opts, args = getopt.getopt(prog_args, "ht:m:l",
["help", "threads", "matches", "low"])
except getopt.GetoptError, e:
return usage(str(e), exit=2)
for o, a in opts:
if o in ("-t", "--threads"):
try:
threads = int(a)
except:
return usage("Threads must be a positive integer")
if threads < 1:
return usage("Threads must be a positive integer")
elif threads > 1 and Pool is None:
return usage("Thread count must be 1 if multiprocessing is " \
"unavailable.", exit=1)
elif o in ("-l", "--low"):
set_low_priority = True
elif o in ("-m", "--matches"):
try:
matches = int(a)
except:
return usage("Matches must be a positive integer")
if matches < 1:
return usage("Matches must be a positive integer")
elif o in ("-h", "--help"):
return usage("", exit=0)
else:
return usage("Unknown option: %s" % o)
if len(args) == 0:
return usage("Must specify at least two bots.")
if len(args) > 2:
return usage("Must only specify two bot pools.")
if set_low_priority:
print "Setting low priority"
low_priority()
# load bot data
bots1_files = []
bots2_files = []
if "*" in args[0]:
bots1_files = glob.glob(args[0])
else:
bots1_files = args[0].split(",")
if len(args) > 1:
if "*" in args[1]:
bots2_files = glob.glob(args[1])
else:
bots2_files = args[1].split(",")
# unique the bot list and ensure there are at least two (or match_maker
# will misbehave.)
checkbots = dict.fromkeys(bots1_files + bots2_files)
if len(checkbots.keys()) < 2:
return usage("Must specify at least two distinct bots.")
bots1 = load_bots(bots1_files, "Pool 1")
bots2 = []
if bots2_files:
bots2 = load_bots(bots2_files, "Pool 2")
# run contests
print "Playing %d matches per pairing." % matches
start_time = time.time()
contests = match_maker(bots1, bots2, matches=matches)
results = run_contests(contests, threads)
end_time = time.time()
print "%d matches run" % len(results)
print "total run time: %.2f seconds" % (end_time - start_time)
report_results(bots1+bots2, results)
return 0
if __name__ == "__main__":
sys.exit( main(sys.argv[1:]))
| 32.467116 | 79 | 0.591908 | 2,499 | 19,253 | 4.486194 | 0.216487 | 0.011417 | 0.009098 | 0.009366 | 0.157881 | 0.115422 | 0.095977 | 0.049773 | 0.035501 | 0.035501 | 0 | 0.02133 | 0.313302 | 19,253 | 592 | 80 | 32.521959 | 0.826639 | 0.13307 | 0 | 0.186441 | 0 | 0.002421 | 0.165292 | 0.001945 | 0 | 0 | 0 | 0.010135 | 0 | 0 | null | null | 0.002421 | 0.021792 | null | null | 0.031477 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3e9c78eecd2b5b00b15b636c02c284a5be92c5c6 | 568 | py | Python | scrapy_rotated_proxy/extensions/default_settings.py | AlekseiMalkov/scrapy-rotated-proxy | 62f72661af6f6477a1372a043edfd74d25251c4d | [
"BSD-3-Clause"
] | 20 | 2017-09-26T09:19:46.000Z | 2021-06-19T23:12:37.000Z | scrapy_rotated_proxy/extensions/default_settings.py | AlekseiMalkov/scrapy-rotated-proxy | 62f72661af6f6477a1372a043edfd74d25251c4d | [
"BSD-3-Clause"
] | 1 | 2018-03-12T09:42:49.000Z | 2018-03-12T09:42:49.000Z | scrapy_rotated_proxy/extensions/default_settings.py | xiaowangwindow/scrapy-rotated-proxy | 62f72661af6f6477a1372a043edfd74d25251c4d | [
"BSD-3-Clause"
] | 3 | 2018-02-16T06:49:22.000Z | 2021-03-19T15:30:53.000Z | ROTATED_PROXY_ENABLED = True
PROXY_STORAGE = 'scrapy_rotated_proxy.extensions.file_storage.FileProxyStorage'
PROXY_FILE_PATH = ''
# PROXY_STORAGE = 'scrapy_rotated_proxy.extensions.mongodb_storage.MongoDBProxyStorage'
PROXY_MONGODB_HOST = '127.0.0.1'
PROXY_MONGODB_PORT = 27017
PROXY_MONGODB_USERNAME = None
PROXY_MONGODB_PASSWORD = None
PROXY_MONGODB_AUTH_DB = 'admin'
PROXY_MONGODB_DB = 'proxy_management'
PROXY_MONGODB_COLL = 'proxy'
PROXY_MONGODB_COLL_INDEX = []
PROXY_SLEEP_INTERVAL = 60*60*24
PROXY_SPIDER_CLOSE_WHEN_NO_PROXY = True
PROXY_RELOAD_ENABLED = False
| 35.5 | 87 | 0.84331 | 79 | 568 | 5.556962 | 0.468354 | 0.218679 | 0.082005 | 0.113895 | 0.182232 | 0.182232 | 0 | 0 | 0 | 0 | 0 | 0.032567 | 0.080986 | 568 | 15 | 88 | 37.866667 | 0.808429 | 0.149648 | 0 | 0 | 0 | 0 | 0.199584 | 0.126819 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.071429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
3ea653b655fb5552a0b8f2dbebef42efa8dbf2a7 | 2,335 | py | Python | src/euler_python_package/euler_python/easiest/p014.py | wilsonify/euler | 5214b776175e6d76a7c6d8915d0e062d189d9b79 | [
"MIT"
] | null | null | null | src/euler_python_package/euler_python/easiest/p014.py | wilsonify/euler | 5214b776175e6d76a7c6d8915d0e062d189d9b79 | [
"MIT"
] | null | null | null | src/euler_python_package/euler_python/easiest/p014.py | wilsonify/euler | 5214b776175e6d76a7c6d8915d0e062d189d9b79 | [
"MIT"
] | null | null | null | """
Problem 14
The following iterative sequence is defined for the set of positive integers:
n → n/2 (n is even)
n → 3n + 1 (n is odd)
Using the rule above and starting with 13, we generate the following
sequence:
13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1
It can be seen that this sequence (starting at 13 and finishing at 1)
contains 10 terms. Although it has not been proved yet (Collatz Problem),
it is thought that all starting numbers finish at 1.
NOTE: Once the chain starts the terms are allowed to go above one million.
We compute the Collatz chain length for every integer in the range according to the iteration rule.
Also, we cache the Collatz value for all integer arguments to speed up the computation.
"""
import sys
from euler_python.utils import eulerlib
@eulerlib.Memoize
def collatz_chain_length(input_x):
"""
The following iterative sequence is defined for the set of positive integers:
n → n/2 (n is even)
n → 3n + 1 (n is odd)
:param input_x:
:return:
"""
if input_x == 1:
return 1
if input_x % 2 == 0:
intermediate_y = input_x // 2
else:
intermediate_y = input_x * 3 + 1
return collatz_chain_length(intermediate_y) + 1
def start_collatz_chain(largest_start=1000000):
"""
Using the rule above and starting with 13, we generate the following
sequence:
13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1
It can be seen that this sequence (starting at 13 and finishing at 1)
contains 10 terms. Although it has not been proved yet (Collatz Problem),
it is thought that all starting numbers finish at 1.
We compute the Collatz chain length for every integer in the range according to the iteration rule.
Also, we cache the Collatz value for all integer arguments (memoization)
"""
sys.setrecursionlimit(3000)
ans = max(range(1, largest_start), key=collatz_chain_length)
return ans
def problem014():
"""
Which starting number, under one million, produces the longest chain?
NOTE: Once the chain starts the terms are allowed to go above one million.
:return:
"""
return start_collatz_chain(largest_start=1000000)
if __name__ == "__main__":
print(problem014())
| 29.1875 | 106 | 0.667666 | 375 | 2,335 | 4.133333 | 0.317333 | 0.054194 | 0.058065 | 0.037419 | 0.714839 | 0.714839 | 0.668387 | 0.668387 | 0.668387 | 0.668387 | 0 | 0.050877 | 0.267666 | 2,335 | 79 | 107 | 29.556962 | 0.84269 | 0.679229 | 0 | 0 | 0 | 0 | 0.012945 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.157895 | false | 0 | 0.105263 | 0 | 0.473684 | 0.052632 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3eb469e1342001348e995e07700217923d5aedcc | 535 | py | Python | src/software/parse/internal/__init__.py | intel/RAAD | 9cca9e72ff61658191e30756bb260173d5600102 | [
"Intel",
"Apache-2.0"
] | null | null | null | src/software/parse/internal/__init__.py | intel/RAAD | 9cca9e72ff61658191e30756bb260173d5600102 | [
"Intel",
"Apache-2.0"
] | null | null | null | src/software/parse/internal/__init__.py | intel/RAAD | 9cca9e72ff61658191e30756bb260173d5600102 | [
"Intel",
"Apache-2.0"
] | null | null | null | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# *****************************************************************************/
# * Authors: Joseph Tarango
# *****************************************************************************/
import os, sys
importPath = os.path.abspath(os.getcwd())
sys.path.insert(1, importPath)
"""
Package system
"""
# Folders
# Files
# from . import disectTelemetryLogV2
# from . import drive_utility
# from . import getTelemetry
# from . import testallsata
# from . import twidlDictGen
| 26.75 | 81 | 0.471028 | 43 | 535 | 5.837209 | 0.674419 | 0.199203 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008715 | 0.142056 | 535 | 19 | 82 | 28.157895 | 0.538126 | 0.71028 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
3ebfa61f13cd67733d73d712812958c777af109f | 97 | py | Python | ABC_A/ABC126_A.py | ryosuke0825/atcoder_python | 185cdbe7db44ecca1aaf357858d16d31ce515ddb | [
"MIT"
] | null | null | null | ABC_A/ABC126_A.py | ryosuke0825/atcoder_python | 185cdbe7db44ecca1aaf357858d16d31ce515ddb | [
"MIT"
] | null | null | null | ABC_A/ABC126_A.py | ryosuke0825/atcoder_python | 185cdbe7db44ecca1aaf357858d16d31ce515ddb | [
"MIT"
] | null | null | null | N, K = map(int, input().split())
S = list(input())
S[K-1] = S[K-1].swapcase()
print("".join(S))
| 16.166667 | 32 | 0.536082 | 19 | 97 | 2.736842 | 0.631579 | 0.076923 | 0.115385 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02381 | 0.134021 | 97 | 5 | 33 | 19.4 | 0.595238 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3ebfe856f386e8cb44997a37a0aa8d7ca906534d | 868 | py | Python | mmdet/datasets/__init__.py | wolfstefan/fastaer-det | e8dd7ebc825e59d0402bf19704a261fa6a168aff | [
"Apache-2.0"
] | null | null | null | mmdet/datasets/__init__.py | wolfstefan/fastaer-det | e8dd7ebc825e59d0402bf19704a261fa6a168aff | [
"Apache-2.0"
] | null | null | null | mmdet/datasets/__init__.py | wolfstefan/fastaer-det | e8dd7ebc825e59d0402bf19704a261fa6a168aff | [
"Apache-2.0"
] | 2 | 2021-10-05T17:04:07.000Z | 2022-02-02T06:38:57.000Z | from .builder import build_dataset
from .cityscapes import CityscapesDataset
from .coco import CocoDataset
from .custom import CustomDataset
from .dataset_wrappers import (ClassBalancedDataset, ConcatDataset,
RepeatDataset)
from .loader import DistributedGroupSampler, GroupSampler, build_dataloader
from .registry import DATASETS
from .voc import VOCDataset
from .wider_face import WIDERFaceDataset
from .xml_style import XMLDataset
from .isaid import ISaidDataset
from .isaid_coco import ISaidDatasetCoco
from .isaid_oriented import ISaidDatasetOriented
__all__ = [
'CustomDataset', 'XMLDataset', 'CocoDataset', 'VOCDataset',
'CityscapesDataset', 'GroupSampler', 'DistributedGroupSampler',
'build_dataloader', 'ConcatDataset', 'RepeatDataset', 'ClassBalancedDataset',
'WIDERFaceDataset', 'DATASETS', 'build_dataset'
]
| 39.454545 | 81 | 0.786866 | 80 | 868 | 8.375 | 0.4375 | 0.040299 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140553 | 868 | 21 | 82 | 41.333333 | 0.898123 | 0 | 0 | 0 | 0 | 0 | 0.224654 | 0.026498 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.65 | 0 | 0.65 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
3ede65e3b959fe3e8a8c154b5475ec6bee7f0e11 | 122 | py | Python | morango/urls.py | jredrejo/morango | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 | [
"MIT"
] | null | null | null | morango/urls.py | jredrejo/morango | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 | [
"MIT"
] | 6 | 2020-05-13T07:50:37.000Z | 2020-06-04T18:23:03.000Z | morango/urls.py | jredrejo/morango | c3ec2554b026f65ac5f0fc5c9d439277fbac14f9 | [
"MIT"
] | null | null | null | from django.conf.urls import include, url
urlpatterns = [
url(r'^api/morango/v1/', include('morango.api.urls')),
]
| 15.25 | 58 | 0.672131 | 17 | 122 | 4.823529 | 0.705882 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009615 | 0.147541 | 122 | 7 | 59 | 17.428571 | 0.778846 | 0 | 0 | 0 | 0 | 0 | 0.262295 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3eeb9e72338019838d1e551ed1fe79737d9ed792 | 274 | py | Python | exercises/structures/src/treasure_map.py | bmazey/summer2020 | 0e943c356677f1d0ec55da5fe4b30a54b37507cd | [
"MIT"
] | null | null | null | exercises/structures/src/treasure_map.py | bmazey/summer2020 | 0e943c356677f1d0ec55da5fe4b30a54b37507cd | [
"MIT"
] | null | null | null | exercises/structures/src/treasure_map.py | bmazey/summer2020 | 0e943c356677f1d0ec55da5fe4b30a54b37507cd | [
"MIT"
] | null | null | null | class TreasureMap:
def __init__(self):
self.map = {}
def populate_map(self):
self.map['beach'] = 'sandy shore'
self.map['coast'] = 'ocean reef'
self.map['volcano'] = 'hot lava'
self.map['x'] = 'marks the spot'
return
| 24.909091 | 41 | 0.536496 | 33 | 274 | 4.30303 | 0.636364 | 0.246479 | 0.15493 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.306569 | 274 | 10 | 42 | 27.4 | 0.747368 | 0 | 0 | 0 | 0 | 0 | 0.222628 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0 | 0 | 0.444444 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3efd04438c85e2dd63ff7568c67616e0e7bb9d43 | 123 | py | Python | 16.11.2019/challenge_2.py | KruZZy/coderdojo-python | 0f9920de24c0ff8733badb81daed1e590825662c | [
"MIT"
] | null | null | null | 16.11.2019/challenge_2.py | KruZZy/coderdojo-python | 0f9920de24c0ff8733badb81daed1e590825662c | [
"MIT"
] | null | null | null | 16.11.2019/challenge_2.py | KruZZy/coderdojo-python | 0f9920de24c0ff8733badb81daed1e590825662c | [
"MIT"
] | null | null | null | def sum(n):
a = 0
for b in range(1,n+1,4):
a+=b*b # b ** 2
return a
n = int(input('n='))
print(sum(n))
| 15.375 | 28 | 0.447154 | 27 | 123 | 2.037037 | 0.592593 | 0.145455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.060241 | 0.325203 | 123 | 7 | 29 | 17.571429 | 0.60241 | 0.04878 | 0 | 0 | 0 | 0 | 0.017391 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0 | 0.285714 | 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 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4106be0a40982d3dbdf75c18f28bd75b3b30827b | 351 | py | Python | phoenix/storage/__init__.py | TeriForey/fawkes | 1b51430d2f952d9802f13fa1f2d0f68df706c43e | [
"Apache-2.0"
] | 7 | 2015-06-12T14:20:34.000Z | 2022-01-25T07:59:47.000Z | phoenix/storage/__init__.py | TeriForey/fawkes | 1b51430d2f952d9802f13fa1f2d0f68df706c43e | [
"Apache-2.0"
] | 177 | 2015-02-12T14:30:27.000Z | 2020-12-02T11:30:34.000Z | phoenix/storage/__init__.py | cedadev/pyramid-phoenix | 8f0b163d0c6718d2c7a8f9a9ad14b6dbee9cb1e3 | [
"Apache-2.0"
] | 17 | 2015-04-17T13:15:31.000Z | 2020-04-30T20:46:44.000Z | import os
import uuid
import logging
LOGGER = logging.getLogger(__name__)
def includeme(config):
# settings = config.registry.settings
config.include('pyramid_storage')
config.add_route('download_storage', 'download/storage/{filename:.*}')
config.add_route('upload', 'upload')
config.add_route('upload_delete', 'upload/{uuid}')
| 25.071429 | 74 | 0.729345 | 41 | 351 | 6 | 0.512195 | 0.109756 | 0.170732 | 0.162602 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128205 | 351 | 13 | 75 | 27 | 0.803922 | 0.099715 | 0 | 0 | 0 | 0 | 0.315287 | 0.095541 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0 | 0.444444 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
410cb3cef8af90890a6f3809305525a5a7a10ac1 | 1,020 | py | Python | cliauto/bin/testscripts/splunk_configconf_tester.py | Trek333/CLI-Auto-for-Splunk | f79f74dc95bda651a2892efa879605bf313a190a | [
"MIT"
] | 1 | 2022-01-10T19:46:24.000Z | 2022-01-10T19:46:24.000Z | cliauto/bin/testscripts/splunk_configconf_tester.py | Trek333/CLI-Auto-for-Splunk | f79f74dc95bda651a2892efa879605bf313a190a | [
"MIT"
] | null | null | null | cliauto/bin/testscripts/splunk_configconf_tester.py | Trek333/CLI-Auto-for-Splunk | f79f74dc95bda651a2892efa879605bf313a190a | [
"MIT"
] | null | null | null | import os
import sys
import json
import logging
import time
import errno
import pdb
pdb.set_trace()
# Setup logging
os.environ['SPLUNK_HOME'] = '/opt/splunk'
os.environ['PYTHONHTTPSVERIFY'] = '0'
logfile = os.sep.join([os.environ['SPLUNK_HOME'], 'var', 'log', 'splunk', 'cliauto.log'])
logging.basicConfig(format='%(asctime)s %(message)s', filename=logfile,level=logging.DEBUG)
# Append directory of this file to the Python path to be able to import cliauto libs
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
# Import cliauto and Splunk SDK libs
from cliautolib.cliauto_configconf import configconf
fargs = {'tpw': '', u'spw': u'spw2', u'cmdtype': u'CLI', u'cmd': u'uptime', 'tuser': '', u'suser': u'tu2', u'nodelist': u'nl3.csv'}
sargs = {u'user': u'admin', u'authtoken': u'LyEqIbn7VEZ2lL4eIYW^gYMI46_NYM5dM^SD^fkB_1Rmn5b7zToIBGO3Po25wTKYQonELW058iU2uCePDWm7d4YPXGeAGPoogEBXP9U046UdrH2JET0GSEmGkhOTkJVn^Hg'}
cc = configconf(fargs, sargs, os.getpid())
print str(cc)
gc = cc.getconfig()
print str(gc)
| 35.172414 | 177 | 0.745098 | 146 | 1,020 | 5.136986 | 0.561644 | 0.036 | 0.04 | 0.050667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030501 | 0.1 | 1,020 | 28 | 178 | 36.428571 | 0.786492 | 0.128431 | 0 | 0 | 0 | 0 | 0.34276 | 0.14819 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.4 | null | null | 0.1 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
4121ac9547bc987c590b8e130d920ee1029da25b | 16,100 | py | Python | storops/vnx/nas_client.py | tunaruraul/storops | 7092c516c55b4c2f00c7c22383e1ad46ecfec091 | [
"Apache-2.0"
] | 60 | 2016-04-18T23:42:10.000Z | 2022-03-23T02:26:03.000Z | storops/vnx/nas_client.py | tunaruraul/storops | 7092c516c55b4c2f00c7c22383e1ad46ecfec091 | [
"Apache-2.0"
] | 317 | 2016-05-25T06:45:37.000Z | 2022-03-25T13:22:38.000Z | storops/vnx/nas_client.py | tunaruraul/storops | 7092c516c55b4c2f00c7c22383e1ad46ecfec091 | [
"Apache-2.0"
] | 34 | 2016-03-18T02:39:12.000Z | 2022-01-07T12:54:14.000Z | # coding=utf-8
# Copyright (c) 2015 EMC Corporation.
# All Rights Reserved.
#
# 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 unicode_literals
import functools
import logging
import re
import six
from retryz import retry
from storops.connection import connector
from storops.exception import VNXBackendError, VNXLockRequiredException, \
VNXNasObjectNotFound, VNXInvalidMoverID, VNXException, \
get_xmlapi_exception, VNXFileCredentialError
from storops.lib.common import Enum, check_int
from storops.lib.converter import to_int, to_hex
from storops.vnx.nas_cmd import NasCommand
from storops.vnx.resource.cifs_share import CifsAccessControl
from storops.vnx.xmlapi import NasXmlBuilder
from storops.vnx.xmlapi_parser import XMLAPIParser
__author__ = 'Jay Xu'
log = logging.getLogger(__name__)
class VNXNasConnections(object):
retry_patterns = [(r'unable to acquire lock\(s\)',
VNXLockRequiredException())]
def __init__(self, host, username, password, ssh_port=22):
self.host = host
self.username = username
self.password = password
self.ssh_port = ssh_port
self._ssh_timeout = None
self._ssh = None
self._xml_connector = None
self._xml_parser = None
@property
def ssh(self):
if self._ssh is None:
self._ssh = self._ssh = connector.SSHConnector(
self.host, self.username, self.password, self.ssh_port)
return self._ssh
def set_ssh_timeout(self, value):
self._ssh_timeout = check_int(value)
@property
def xml_connector(self):
if self._xml_connector is None:
self._xml_connector = connector.XMLAPIConnector(
self.host, self.username, self.password)
return self._xml_connector
@property
def xml_parser(self):
if self._xml_parser is None:
self._xml_parser = XMLAPIParser()
return self._xml_parser
@classmethod
def _get_req_xml(cls, req):
base = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>{}'
return base.format(req)
@retry(on_error=VNXLockRequiredException)
def _request(self, req, retry_patterns=None):
req_xml = self._get_req_xml(req)
log.debug('request: \n{}'.format(req_xml))
rsp_xml = self.xml_connector.post(req_xml)
if isinstance(rsp_xml, tuple):
rsp_xml = rsp_xml[1]
log.debug('response: \n{}'.format(rsp_xml))
response = NasXmlResponse(self.xml_parser.parse(rsp_xml))
if not retry_patterns:
retry_patterns = self.retry_patterns
if response.is_error():
for pattern in retry_patterns:
messages = response.problem_messages
to_match, to_raise = pattern
if re.search(to_match, messages):
raise to_raise
return response
def request(self, req, check_object=False, check_invalid_data_mover=False,
error_desc=None, retry_patterns=None):
response = self._request(req, retry_patterns)
if check_object:
response.raise_if_no_object(error_desc)
if check_invalid_data_mover:
response.check_invalid_data_mover()
return response
def ssh_execute(self, commands, check_exit_code=True):
out, _ = self.ssh.execute(commands, self._ssh_timeout, check_exit_code)
return out
def xml_request(check_object=False, check_invalid_data_mover=False):
""" indicate the return value is a xml api request
:param check_invalid_data_mover:
:param check_object:
:return: the response of this request
"""
def decorator(f):
@functools.wraps(f)
def func_wrapper(self, *argv, **kwargs):
request = f(self, *argv, **kwargs)
return self.request(
request, check_object=check_object,
check_invalid_data_mover=check_invalid_data_mover)
return func_wrapper
return decorator
xml_get_request = xml_request()
xml_set_request = xml_request(check_invalid_data_mover=True)
def nas_command(f):
""" indicate it's a command of nas command run with ssh
:param f: function that returns the command in list
:return: command execution result
"""
@functools.wraps(f)
def func_wrapper(self, *argv, **kwargs):
commands = f(self, *argv, **kwargs)
return self.ssh_execute(['env', 'NAS_DB=/nas'] + commands)
return func_wrapper
class VNXNasClient(VNXNasConnections):
@xml_get_request
def get_filesystem(self, name=None, fs_id=None):
return NasXmlBuilder.get_filesystem(name, fs_id=fs_id)
@xml_set_request
def create_filesystem(self, name, size, pool_id,
mover_id, is_vdm=False):
return NasXmlBuilder.create_filesystem(
name, size, pool_id, mover_id, is_vdm)
@xml_set_request
def delete_filesystem(self, fs_id):
return NasXmlBuilder.delete_filesystem(fs_id)
@xml_set_request
def extend_fs(self, fs_id, delta_size, pool_id):
return NasXmlBuilder.extend_filesystem(fs_id, delta_size, pool_id)
@xml_get_request
def get_nas_pool(self):
return NasXmlBuilder.get_nas_pool()
@xml_get_request
def get_mover(self, mover_id=None, full=True):
return NasXmlBuilder.get_mover(mover_id, full)
@xml_set_request
def create_dns_domain(self, mover_id, domain_name, servers,
protocol='udp'):
return NasXmlBuilder.create_dns_domain(
mover_id, domain_name, servers, protocol)
@xml_set_request
def delete_dns_domain(self, mover_id, domain_name):
return NasXmlBuilder.delete_dns_domain(mover_id, domain_name)
@xml_get_request
def get_fs_snap(self, name=None, snap_id=None):
return NasXmlBuilder.get_fs_snap(name, snap_id)
@xml_set_request
def create_snap(self, name, fs_id, pool_id, size=None):
return NasXmlBuilder.create_snap(name, fs_id, pool_id, size)
@xml_set_request
def delete_snap(self, snap_id, force=False):
return NasXmlBuilder.delete_snap(snap_id, force)
@xml_get_request
def get_cifs_server(self, name=None, mover_id=None, is_vdm=False):
return NasXmlBuilder.get_cifs_server(name, mover_id, is_vdm)
@xml_set_request
def create_cifs_server(self, name,
mover_id, is_vdm=False,
workgroup=None, domain=None,
ip_list=None,
alias_name=None,
local_admin_password=None):
return NasXmlBuilder.create_cifs_server(
name=name, mover_id=mover_id, is_vdm=is_vdm,
workgroup=workgroup, domain=domain,
ip_list=ip_list, alias_name=alias_name,
local_admin_password=local_admin_password)
@xml_get_request
def modify_domain_cifs_server(self, name, mover_id, is_vdm=False,
join_domain=None, username=None,
password=None):
return NasXmlBuilder.modify_domain_cifs_server(
name, mover_id, is_vdm, join_domain, username, password)
@xml_set_request
def delete_cifs_server(self, name, mover_id=None, is_vdm=False):
return NasXmlBuilder.delete_cifs_server(name, mover_id, is_vdm)
@xml_get_request
def get_fs_mp(self, path=None, mover_id=None, is_vdm=False):
return NasXmlBuilder.get_fs_mp(path, mover_id, is_vdm)
@xml_set_request
def create_fs_mp(self, path, fs_id, mover_id, is_vdm=False):
return NasXmlBuilder.create_fs_mp(path, fs_id, mover_id, is_vdm)
@xml_set_request
def delete_fs_mp(self, path, mover_id, is_vdm=False):
return NasXmlBuilder.delete_fs_mp(path, mover_id, is_vdm)
@xml_get_request
def get_mover_host(self, mover_host_id=None):
return NasXmlBuilder.get_mover_host(mover_host_id)
@xml_set_request
def create_mover_interface(self, mover_id, device, ip, net_mask,
vlan_id=0, name=None):
return NasXmlBuilder.create_mover_interface(
mover_id, device, ip, net_mask, vlan_id, name)
@xml_set_request
def delete_mover_interface(self, mover_id, ip):
return NasXmlBuilder.delete_mover_interface(mover_id, ip)
@nas_command
def get_mover_interconnect_id_list(self):
return NasCommand.nas_cel_list()
@xml_get_request
def get_vdm(self, vdm_id=None):
return NasXmlBuilder.get_vdm(vdm_id)
@xml_set_request
def create_vdm(self, mover_id, name, pool_id=None):
return NasXmlBuilder.create_vdm(mover_id, name, pool_id)
@xml_set_request
def delete_vdm(self, vdm_id):
return NasXmlBuilder.delete_vdm(vdm_id)
@nas_command
def get_dm_interfaces(self, name=None, is_vdm=True):
return NasCommand.get_dm_interfaces(name, is_vdm)
@nas_command
def attach_nfs_interface(self, if_name, vdm_name=None):
return NasCommand.attach_nfs_interface(if_name=if_name,
vdm_name=vdm_name)
@nas_command
def detach_nfs_interface(self, if_name, vdm_name=None):
return NasCommand.detach_nfs_interface(if_name=if_name,
vdm_name=vdm_name)
@xml_get_request
def get_nfs_export(self, mover_id=None, path=None):
return NasXmlBuilder.get_nfs_export(mover_id, path)
@xml_set_request
def create_nfs_export(self, mover_id, path, ro=False, host_config=None):
return NasXmlBuilder.create_nfs_export(mover_id, path, ro,
host_config)
@xml_set_request
def delete_nfs_export(self, mover_id, path):
return NasXmlBuilder.delete_nfs_export(mover_id, path)
@xml_set_request
def modify_nfs_export(self, mover_id, path, ro=None, host_config=None):
return NasXmlBuilder.modify_nfs_export(mover_id, path, ro,
host_config)
@xml_get_request
def get_cifs_share(self, server_name=None, share_name=None,
mover_id=None, is_vdm=False):
return NasXmlBuilder.get_cifs_share(
server_name, share_name, mover_id, is_vdm)
@xml_set_request
def create_cifs_share(self, name, server_name, mover_id,
is_vdm=False, path=None):
return NasXmlBuilder.create_cifs_share(name, server_name, mover_id,
is_vdm, path)
@xml_set_request
def delete_cifs_share(self, name, mover_id, server_names, is_vdm=False):
return NasXmlBuilder.delete_cifs_share(
name=name, mover_id=mover_id, server_names=server_names,
is_vdm=is_vdm)
@nas_command
def disable_cifs_share_access(self, share_name, mover_name):
return NasCommand.disable_cifs_share_access(share_name, mover_name)
@nas_command
def allow_cifs_share_access(self, share_name, mover_name, user_name,
domain, access=CifsAccessControl.FULL):
return NasCommand.allow_cifs_share_access(
share_name, mover_name, user_name, domain, access)
@nas_command
def deny_cifs_share_access(self, share_name, mover_name, user_name,
domain, access=CifsAccessControl.FULL):
return NasCommand.deny_cifs_share_access(
share_name, mover_name, user_name, domain, access)
class XmlStatus(Enum):
OK = 'ok'
INFO = 'info'
DEBUG = 'debug'
WARNING = 'warning'
ERROR = 'error'
class NasXmlResponse(object):
def __init__(self, resp, parser=None):
self._check_credential_error(resp)
resp = self._parse_resp(parser, resp)
self._dict = resp
@staticmethod
def _check_credential_error(resp):
if 'Session timeout. Relogin and try this operation again.' in resp:
raise VNXFileCredentialError()
@staticmethod
def _parse_resp(parser, resp):
if parser is None:
parser = XMLAPIParser()
if isinstance(resp, six.string_types):
resp = parser.parse(resp)
return resp
@property
def status(self):
return XmlStatus.parse(self._dict['maxSeverity'])
@status.setter
def status(self, value):
self._dict['maxSeverity'] = value
@property
def problems(self):
return self._dict['problems']
@property
def objects(self):
return self._dict['objects']
def filter_object(self, **kwargs):
objects = self.objects
for k, v in kwargs.items():
if v is not None:
v = str(v)
objects = list(filter(lambda obj: obj[k] == v, objects))
self._dict['objects'] = objects
@property
def first_object(self):
if len(self.objects) < 1:
raise ValueError('not a single object available.')
return self.objects[0]
@property
def problem_message_codes(self):
return set(map(int, self._get_problem_props('messageCode')))
@property
def hex_problem_message_codes(self):
ret = self.problem_message_codes
return set(map(to_hex, ret))
@property
def problem_messages(self):
return '\n'.join(set(self._get_problem_props('message')))
@property
def problem_diagnostics(self):
return '\n'.join(set(self._get_problem_props('Diagnostics')))
def _get_problem_props(self, key):
return [problem[key] for problem in self.problems
if key in problem]
def get_status_msg(self, desc=None):
msg = ('status: {}.\n'
'problem details: \n'
'{}'
.format(self.status,
self.get_problems_string(' ' * 4)))
if desc is not None:
msg = ' '.join([desc, msg])
return msg
def get_problems_string(self, prefix=''):
msgs = []
for i, v in enumerate(self.problems, 1):
msgs.append('{p}({i}) code: {mc}\n'
'{p} message: {msg}\n'
'{p} diagnostics: {d}\n'
.format(p=prefix, i=i,
mc=v['messageCode'],
msg=v['message'],
d=v.get('Diagnostics', 'N/A')))
return ''.join(msgs)
def check_invalid_data_mover(self):
if not self.is_ok():
try:
self.raise_if_err()
except VNXInvalidMoverID:
raise
except VNXException:
# pass to upper level for further process
pass
def raise_if_err(self, desc=None):
if not self.is_ok():
msg = self.get_status_msg(desc)
exception_clz = get_xmlapi_exception(
self.problem_message_codes, default=VNXBackendError)
raise exception_clz(message=msg)
def raise_if_no_object(self, desc=None):
if not self.objects:
msg = self.get_status_msg(desc)
raise VNXNasObjectNotFound(err=msg)
def is_ok(self):
return self.status in (XmlStatus.DEBUG, XmlStatus.INFO, XmlStatus.OK)
def is_error(self):
return self.status == XmlStatus.ERROR
def has_error_code(self, code):
return to_int(code) in self.problem_message_codes
| 33.333333 | 79 | 0.643727 | 2,046 | 16,100 | 4.768817 | 0.15347 | 0.031567 | 0.02798 | 0.032797 | 0.339654 | 0.272727 | 0.197397 | 0.16501 | 0.13662 | 0.080045 | 0 | 0.001703 | 0.270435 | 16,100 | 482 | 80 | 33.40249 | 0.828963 | 0.058323 | 0 | 0.201133 | 0 | 0 | 0.030193 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.209632 | false | 0.025496 | 0.03966 | 0.135977 | 0.461756 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
f5ba70ef2bbf81e8a9c8dc36bb6ee94db75db41b | 449 | py | Python | sq_sum.py | mahendra1904/pythod-programs | d4d75dac65e9795ea5728f75d90aa0b39296b25e | [
"bzip2-1.0.6"
] | null | null | null | sq_sum.py | mahendra1904/pythod-programs | d4d75dac65e9795ea5728f75d90aa0b39296b25e | [
"bzip2-1.0.6"
] | null | null | null | sq_sum.py | mahendra1904/pythod-programs | d4d75dac65e9795ea5728f75d90aa0b39296b25e | [
"bzip2-1.0.6"
] | null | null | null | #Enquiry Form
name=input('Enter your First Name ')
Class=int(input('Enter your class '))
school=input('Enter your school name ')
address=input('Enter your Address ')
number=int(input('Enter your phone number '))
#print("Name- ",name,"Class- ",Class,"School- ",school,"Address- ",address,"Phone Number- ",number,sep='\n')
print("Name- ",name)
print("Class- ",Class)
print("School- ",school)
print("Address- ",address)
print("Phone number- ",number)
| 32.071429 | 108 | 0.697105 | 62 | 449 | 5.048387 | 0.258065 | 0.159744 | 0.223642 | 0.108626 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097996 | 449 | 13 | 109 | 34.538462 | 0.77284 | 0.265033 | 0 | 0 | 0 | 0 | 0.454268 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
f5ce4ae5937fa2833d1a1d40323b9fdbb94cb81d | 1,562 | py | Python | api/orders/views.py | gpiechnik2/orderManagement | 792a8f178c1702d7d2a37b6779b0d400c72030f2 | [
"Apache-2.0"
] | null | null | null | api/orders/views.py | gpiechnik2/orderManagement | 792a8f178c1702d7d2a37b6779b0d400c72030f2 | [
"Apache-2.0"
] | null | null | null | api/orders/views.py | gpiechnik2/orderManagement | 792a8f178c1702d7d2a37b6779b0d400c72030f2 | [
"Apache-2.0"
] | null | null | null | from rest_framework import viewsets, status, filters
from rest_framework.response import Response
from rest_framework.decorators import action
from django.http import Http404, HttpResponse
from django.core import serializers
import django_filters.rest_framework
from .serializers import OrderSerializer, OrderSpecifiedNIPSerializer
from .models import Order, Contractor
import json
class OrderViewSet(viewsets.ModelViewSet):
"""
A viewset for viewing and editing order instances.
"""
queryset = Order.objects.all()
serializer_class = OrderSerializer
http_method_names = ['get', 'post', 'delete', 'patch', 'head']
filter_backends = [django_filters.rest_framework.DjangoFilterBackend, filters.OrderingFilter]
filterset_fields = ['contractor_id', 'implementation_date', 'data_of_placing_the_order', 'order_value', 'status']
ordering_fields = ['implementation_date', 'data_of_placing_the_order', 'order_value']
class OrderSpecifiedNIPViewSet(viewsets.ViewSet):
"""
A viewset for creating seo analysis.
"""
@action(detail = False, methods = ['post'])
def create(self, request, *args, **kwargs):
serializer = OrderSpecifiedNIPSerializer(data = request.data)
serializer.is_valid(raise_exception = True)
nip = serializer.validated_data['nip']
orders = Order.objects.filter(contractor_id__nip = nip)
if not orders:
raise Http404
data = serializers.serialize('json', orders)
return HttpResponse(data, content_type="application/json")
| 32.541667 | 117 | 0.736236 | 170 | 1,562 | 6.570588 | 0.505882 | 0.058192 | 0.045658 | 0.046553 | 0.087735 | 0.087735 | 0.087735 | 0.087735 | 0.087735 | 0 | 0 | 0.004626 | 0.169654 | 1,562 | 47 | 118 | 33.234043 | 0.856592 | 0.055698 | 0 | 0 | 0 | 0 | 0.123269 | 0.034626 | 0 | 0 | 0 | 0 | 0 | 1 | 0.037037 | false | 0 | 0.333333 | 0 | 0.703704 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
f5d7ea63a8a9e5ebe518494698f62c2390a49bc4 | 2,957 | py | Python | exercises/crypto1.py | mbolli/python-scripts | 56047ff3612e8268779bdd152cd668ea66110bd5 | [
"BSD-2-Clause"
] | null | null | null | exercises/crypto1.py | mbolli/python-scripts | 56047ff3612e8268779bdd152cd668ea66110bd5 | [
"BSD-2-Clause"
] | null | null | null | exercises/crypto1.py | mbolli/python-scripts | 56047ff3612e8268779bdd152cd668ea66110bd5 | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Some small exercises for playing around with crypto stuff.
# DON'T USE FOR ANY SERIOUS CRYPTOGRAPHIC PURPOSES!
#
# Copyright (C) 2016, Michael Bolli <http://bolli.us>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from random import randint
def diffiehellman(p, g):
print "Exercise 1: Diffie-Hellman key-exchange"
print "---------------------------------------"
a = randint(0,p-1)
A = (g**a)%p
b = randint(0,p-1)
B = (g**b)%p
kA = (B**a)%p
kB = (A**b)%p
print "Alice picks random a: " + str(a)
print "Alice computes A: " + str(A)
print "Alice sends A = " + str(A) + " to Bob"
print "Bob picks random b: " + str(b)
print "Bob computes B: " + str(B)
print "Bob sends B = " + str(B) + " to Alice"
print "Alice computes k = " + str(kA)
print "Bob computes k = " + str(kB)
print "\n"
diffiehellman(11, 2)
def breakdiffiehellman(p, g, A, B):
print "Exercise 2: Brute-force attempt to break Diffie-Hellman"
print "-------------------------------------------------------"
print "p: " + str(p) + " g: " + str(g) + " A: " + str(A) + " B: " + str(B)
for num in range(0,p-1):
if (g**num)%p == B:
key = str((A**num)%p)
print "FOUND! " + str(g) + "^" + str(num) + "%" + str(p) + " = " + str(A) + " -- the key is " + key + "\n"
return
else:
print "NOPE: " + str(g) + "^" + str(num) + "%" + str(p) + " != " + str(A)
print "Brute-force attempt failed."
breakdiffiehellman(11, 6, 7, 5)
# primitive roots modulo n exist for n=2, n=4, n=p**k and n=2p**k, where p>2 is prime and k >= 1
def primitiveroots(p, maxX, maxY):
print "Exercise 3: Find primitive roots in output"
print "------------------------------------------"
for x in range(0,maxX+1):
if(x != 0):
print str(x),
print "\t⧫",
digits = []
for y in range(0,maxY+1):
if(x == 0):
print str(y),
else:
out = (x**y)%p
digits.append(out)
print out,
# EOL
if(y == maxY):
if(set(digits) == set(range(1,maxX+1))):
print " ← primitive root!",
print ""
else: print "\t|",
primitiveroots(11,10,9) | 33.988506 | 118 | 0.530267 | 424 | 2,957 | 3.70283 | 0.379717 | 0.017834 | 0.012739 | 0.036306 | 0.127389 | 0.075159 | 0.02293 | 0.02293 | 0 | 0 | 0 | 0.019358 | 0.283734 | 2,957 | 87 | 119 | 33.988506 | 0.720963 | 0.308421 | 0 | 0.037037 | 0 | 0 | 0.266304 | 0.067194 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.018519 | null | null | 0.481481 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
f5df50663d6c6aac3421860124d4e91d2985f842 | 3,058 | py | Python | scripts/policy_test_input.py | rombie/contrail-test | a68c71d6f282142501a7e2e889bbb232fdd82dc3 | [
"Apache-2.0"
] | null | null | null | scripts/policy_test_input.py | rombie/contrail-test | a68c71d6f282142501a7e2e889bbb232fdd82dc3 | [
"Apache-2.0"
] | null | null | null | scripts/policy_test_input.py | rombie/contrail-test | a68c71d6f282142501a7e2e889bbb232fdd82dc3 | [
"Apache-2.0"
] | null | null | null | '''
Generate Policy test scenarios based on user input.
Policy test cases can be built based on this topology.
'''
import copy
from random import choice
class PolicyTestBasicConfig_1():
def __init__(self):
self.vmc_list = []
self.vnet_list = []
self.policy_list = []
self.vn_subnets = {}
self.vn_policy = {}
self.vn_of_cn = {}
self.vm_of_cn = {}
self.vn_of_vm = {}
begin_oct = 10
base_net = '.1.1.0/24'
numEntity = 1
numRules = 4
# For a given no., generate n policies, VN & VM's, attach policies to VN's
# & launch VM instances in the VN's.
for type in ['policy', 'vnet', 'vmc']:
for i in range(numEntity):
net = str(begin_oct) + base_net
name = type + str(i)
policy_list_name = 'policy_list_' + name
vnet_list_name = 'vnet_list_' + name
policy_list_name = []
vnet_list_name = []
if type == 'policy':
self.policy_list.append(name)
elif type == 'vnet':
self.vnet_list.append(name)
vnet_list_name.append(net)
self.vn_subnets[name] = vnet_list_name
begin_oct += 1
policy_list_name.append(self.policy_list[i])
self.vn_policy[name] = policy_list_name
elif type == 'vmc':
self.vmc_list.append(name)
self.vn_of_vm[name] = self.vnet_list[i]
print self.policy_list, self.vmc_list, self.vnet_list, self.vn_subnets, \
self.vn_policy, self.vn_of_vm
# Generate m different rules for each policy
self.rules = {}
for j in range(len(self.policy_list)):
proto_opts = [6, 17, 1, 'any']
proto = choice(proto_opts)
self.rules['policy' + str(j)] = []
for i in range(numRules):
rule_base = {'direction': '>', 'protocol': proto,
'source_network': self.vnet_list[j],
'src_ports': [i, i], 'dest_network': self.vnet_list[j],
'dst_ports': 'any', 'simple_action': 'deny'}
self.rules['policy' + str(j)].append(rule_base)
# There can be multple policies for a VN, build the list of policies by
# VN
self.policy_vn = {}
for policy in self.policy_list:
self.policy_vn[policy] = []
for vn in self.vnet_list:
if policy in self.vn_policy[vn]:
self.policy_vn[policy].append(vn)
# print "added vn %s to list for policy %s" %(vn, policy)
# print "completed parsing vn %s policy list" %(vn)
# print "completed building vn list for policy %s, list is %s" %(policy, self.policy_vn[policy])
# end __init__
# end class
if __name__ == '__main__':
PolicyTestBasicConfig_1()
| 40.236842 | 108 | 0.52518 | 377 | 3,058 | 4.023873 | 0.262599 | 0.063283 | 0.055372 | 0.052736 | 0.177983 | 0.123929 | 0.123929 | 0.093606 | 0.04878 | 0.04878 | 0 | 0.008277 | 0.367888 | 3,058 | 75 | 109 | 40.773333 | 0.776513 | 0.146174 | 0 | 0 | 1 | 0 | 0.065191 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.035088 | null | null | 0.017544 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f5e490bd407c16acf58594aca3769091304ac5f9 | 534 | py | Python | Semana06Atividade02/Sem06_Atv02_Q05.py | Marvingms7/IFPI | 0f6d50e4a7e1016e58cd227b477b3ce08e19c61a | [
"MIT"
] | null | null | null | Semana06Atividade02/Sem06_Atv02_Q05.py | Marvingms7/IFPI | 0f6d50e4a7e1016e58cd227b477b3ce08e19c61a | [
"MIT"
] | null | null | null | Semana06Atividade02/Sem06_Atv02_Q05.py | Marvingms7/IFPI | 0f6d50e4a7e1016e58cd227b477b3ce08e19c61a | [
"MIT"
] | null | null | null | nota = float(input('Digite sua nota, Valor entre "0 e 10": '))
while True:
if nota >= 8.5 and nota <= 10:
print('Nota igual a A')
elif nota >= 7.0 and nota <= 8.4:
print('Nota igual a B')
elif nota >= 5.0 and nota <= 6.9:
print('Nota igual a C')
elif nota >= 4.0 and nota <= 4.9:
print('Nota igual a D')
elif nota >= 0 and nota <= 3.9:
print('Nota igual a E')
else:
print('Nota invalida')
nota = float(input('Digite sua nota, Valor entre "0 e 10": '))
| 24.272727 | 66 | 0.531835 | 91 | 534 | 3.120879 | 0.32967 | 0.190141 | 0.246479 | 0.264085 | 0.457746 | 0.288732 | 0.288732 | 0.288732 | 0.288732 | 0.288732 | 0 | 0.068493 | 0.316479 | 534 | 21 | 67 | 25.428571 | 0.709589 | 0 | 0 | 0.133333 | 0 | 0 | 0.304924 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.4 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f5f59d13aa9cc5eed06bdb26d35b9fd7c4e6ed10 | 400 | py | Python | tests/test_envs.py | mmcenta/2048gym | a820e76acce24ed117f593497e4cc4779bf6343c | [
"MIT"
] | 2 | 2020-03-26T18:57:23.000Z | 2020-04-19T17:07:32.000Z | tests/test_envs.py | mmcenta/2048gym | a820e76acce24ed117f593497e4cc4779bf6343c | [
"MIT"
] | null | null | null | tests/test_envs.py | mmcenta/2048gym | a820e76acce24ed117f593497e4cc4779bf6343c | [
"MIT"
] | 1 | 2021-07-17T06:55:20.000Z | 2021-07-17T06:55:20.000Z | from stable_baselines.common.env_checker import check_env
from gym_text2048.envs import Text2048Env, Text2048CappedEnv, Text2048WithHeuristicEnv, Text2048CappedWithHeuristicEnv
if __name__ == "__main__":
envs = [
Text2048Env(),
Text2048CappedEnv(),
Text2048WithHeuristicEnv(),
Text2048CappedWithHeuristicEnv(),
]
for env in envs:
check_env(env)
| 26.666667 | 118 | 0.72 | 33 | 400 | 8.333333 | 0.606061 | 0.058182 | 0.378182 | 0.596364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113565 | 0.2075 | 400 | 14 | 119 | 28.571429 | 0.753943 | 0 | 0 | 0 | 0 | 0 | 0.02 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.181818 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
eb07cc665f9f57413182a80d03c6e9e9b18b05c3 | 378 | py | Python | tests/test_A004086.py | TimothyDJones/oeis | d9d608bc32ee31c73c139e1b68e4eb6315205e8d | [
"MIT"
] | 21 | 2020-03-21T17:50:13.000Z | 2022-01-18T01:52:47.000Z | tests/test_A004086.py | TimothyDJones/oeis | d9d608bc32ee31c73c139e1b68e4eb6315205e8d | [
"MIT"
] | 296 | 2019-11-18T14:04:36.000Z | 2022-03-27T21:59:24.000Z | tests/test_A004086.py | TimothyDJones/oeis | d9d608bc32ee31c73c139e1b68e4eb6315205e8d | [
"MIT"
] | 29 | 2019-11-18T11:56:22.000Z | 2022-03-26T22:31:57.000Z | from oeis import A004086
from hypothesis import given
from hypothesis.strategies import integers
@given(integers(min_value=1, max_value=10000))
def test_sequence(n):
assert A004086[A004086[n]] == int(str(n).rstrip("0"))
@given(integers(min_value=100000000, max_value=999999999))
def test_sequence_other_values(n):
assert A004086[n] == int("".join(reversed(str(n))))
| 27 | 58 | 0.753968 | 56 | 378 | 4.946429 | 0.5 | 0.101083 | 0.115523 | 0.151625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.14497 | 0.10582 | 378 | 13 | 59 | 29.076923 | 0.674556 | 0 | 0 | 0 | 0 | 0 | 0.002646 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 1 | 0.222222 | false | 0 | 0.333333 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
eb1b73a7a979f640be93c87ca3b3b49767d1895d | 1,211 | py | Python | generator/errors.py | JunguangJiang/TinyCCompiler | fe612e12f294e0c29b46e6dbf2be314ab56f7309 | [
"MIT"
] | 7 | 2019-11-12T05:51:41.000Z | 2021-05-12T02:09:22.000Z | generator/errors.py | JunguangJiang/TinyCCompiler | fe612e12f294e0c29b46e6dbf2be314ab56f7309 | [
"MIT"
] | null | null | null | generator/errors.py | JunguangJiang/TinyCCompiler | fe612e12f294e0c29b46e6dbf2be314ab56f7309 | [
"MIT"
] | 3 | 2020-04-28T06:54:57.000Z | 2021-12-17T03:41:26.000Z | from antlr4.error.ErrorListener import ErrorListener
class SemanticError(Exception):
"""语义错误基类"""
def __init__(self, msg, ctx=None):
super().__init__()
if ctx:
self.line = ctx.start.line #错误出现位置
self.column = ctx.start.column
else:
self.line = 0
self.column = 0
self.msg = msg
def __str__(self):
return "SemanticError: " + str(self.line) + ":" + str(self.column) + " " + self.msg
class TinyCErrorListener(ErrorListener):
"""错误监听器"""
def __init__(self):
super().__init__()
self.errors = []
def syntaxError(self, recognizer, offendingSymbol, line, column, msg, e):
"""进行语法分析时,若出现语法错误自动调用该函数"""
exception = "Syntax Error: " + str(line) + ":" + str(column) + " " + msg
self.errors.append(exception)
def register_semantic_error(self, error):
"""在进行语义分析时,在结束语义错误异常时,需手动调用该函数,error是错误异常类"""
self.errors.append(str(error))
def print_errors(self):
"""打印错误"""
for err in self.errors:
print(err)
print(len(self.errors), "errors generated.")
# TODO 8错误报告打印的美化?使得打印出的错误类似于gcc的错误报告(彩色、有错误位置箭头等)
| 28.833333 | 91 | 0.58877 | 126 | 1,211 | 5.47619 | 0.428571 | 0.072464 | 0.031884 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004545 | 0.273328 | 1,211 | 41 | 92 | 29.536585 | 0.779545 | 0.11313 | 0 | 0.076923 | 0 | 0 | 0.047801 | 0 | 0 | 0 | 0 | 0.02439 | 0 | 1 | 0.230769 | false | 0 | 0.038462 | 0.038462 | 0.384615 | 0.115385 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
eb34657cc105c966192d34d5b9b54042f8efd19e | 1,970 | py | Python | redrobin/roundrobin.py | gsakkis/redrobin | 3e37e278b7a7be54d7adc7c8010857c5897a3257 | [
"MIT"
] | null | null | null | redrobin/roundrobin.py | gsakkis/redrobin | 3e37e278b7a7be54d7adc7c8010857c5897a3257 | [
"MIT"
] | null | null | null | redrobin/roundrobin.py | gsakkis/redrobin | 3e37e278b7a7be54d7adc7c8010857c5897a3257 | [
"MIT"
] | null | null | null | import json
import itertools as it
import redis_collections
class RoundRobinScheduler(redis_collections.RedisCollection):
# queue is stored in reverse element order, i.e. items are added with lpush
# and removed with rpop
redis_queue_format = 'redrobin:{name}:items'
def __init__(self, keys=None, connection=None, name='default'):
queue_key = self.redis_queue_format.format(name=name)
super(RoundRobinScheduler, self).__init__(data=keys, redis=connection,
key=queue_key, pickler=json)
def __len__(self):
return self.redis.llen(self.key)
def __iter__(self):
return self._data()
def __contains__(self, elem):
return self.redis.lismember(self.key, self._pickle(elem))
def add(self, *items):
self.redis.lpush(self.key, *map(self._pickle, items))
def remove(self, item, count=0):
removed_count = self.discard(item, count)
if not removed_count:
raise KeyError(item)
return removed_count
def discard(self, item, count=0):
# negate count because list is stored in reverse
return self.redis.lrem(self.key, -count, self._pickle(item))
def pop(self):
value = self.redis.rpop(self.key)
if value is None:
raise KeyError
return self._unpickle(value)
def next(self):
item = self.redis.rpoplpush(self.key, self.key)
if item is None:
raise StopIteration
return self._unpickle(item)
def _data(self, pipe=None):
pipe = pipe if pipe is not None else self.redis
# reverse and unpickle list items
return it.imap(self._unpickle, reversed(pipe.lrange(self.key, 0, -1)))
def _update(self, data, pipe=None):
super(RoundRobinScheduler, self)._update(data, pipe)
pipe = pipe if pipe is not None else self.redis
pipe.lpush(self.key, *map(self._pickle, data))
| 32.833333 | 79 | 0.64264 | 258 | 1,970 | 4.744186 | 0.29845 | 0.066176 | 0.036765 | 0.027778 | 0.099673 | 0.099673 | 0.058824 | 0.058824 | 0.058824 | 0.058824 | 0 | 0.002736 | 0.257868 | 1,970 | 59 | 80 | 33.389831 | 0.834473 | 0.088325 | 0 | 0.04878 | 0 | 0 | 0.015634 | 0.011725 | 0 | 0 | 0 | 0 | 0 | 1 | 0.268293 | false | 0 | 0.073171 | 0.097561 | 0.585366 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
de1eb03618037135b0e00317372646b9e3ff2355 | 113 | py | Python | lang/Python/hello-world-graphical-6.py | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | 5 | 2021-01-29T20:08:05.000Z | 2022-03-22T06:16:05.000Z | lang/Python/hello-world-graphical-6.py | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | null | null | null | lang/Python/hello-world-graphical-6.py | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | 1 | 2021-04-13T04:19:31.000Z | 2021-04-13T04:19:31.000Z | import wx
app = wx.App(False)
frame = wx.Frame(None, wx.ID_ANY, "Hello, World")
frame.Show(True)
app.MainLoop()
| 16.142857 | 49 | 0.699115 | 20 | 113 | 3.9 | 0.65 | 0.128205 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.123894 | 113 | 6 | 50 | 18.833333 | 0.787879 | 0 | 0 | 0 | 0 | 0 | 0.106195 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
de1fb85c38ce6d6bf82df2864926c3ba2e512b2e | 293 | py | Python | pijupy/my_matplotlib.py | Who8MyLunch/PiJuPyPrefs | 9275a921ee66246de1300f2299366950b3de1931 | [
"MIT"
] | null | null | null | pijupy/my_matplotlib.py | Who8MyLunch/PiJuPyPrefs | 9275a921ee66246de1300f2299366950b3de1931 | [
"MIT"
] | null | null | null | pijupy/my_matplotlib.py | Who8MyLunch/PiJuPyPrefs | 9275a921ee66246de1300f2299366950b3de1931 | [
"MIT"
] | null | null | null |
import matplotlib.pyplot as plt
def apply():
"""Apply all MPL settings
"""
# print(plt.style.available)
# plt.style.use('seaborn-paper')
plt.style.use('seaborn-notebook')
plt.rcParams['figure.max_open_warning'] = 1000
plt.rcParams['figure.figsize'] = (12, 6)
| 18.3125 | 50 | 0.645051 | 38 | 293 | 4.921053 | 0.684211 | 0.128342 | 0.117647 | 0.192513 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029661 | 0.194539 | 293 | 15 | 51 | 19.533333 | 0.762712 | 0.293515 | 0 | 0 | 0 | 0 | 0.266332 | 0.115578 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | true | 0 | 0.2 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
de2ca834aee880397483939d7145bd7c748d91ce | 308 | py | Python | randomImageGenerator.py | niteshkv/pythonUtils | 00dd462ae1808fa61a01c2d8d0ced1d62c7bc7d8 | [
"MIT"
] | null | null | null | randomImageGenerator.py | niteshkv/pythonUtils | 00dd462ae1808fa61a01c2d8d0ced1d62c7bc7d8 | [
"MIT"
] | null | null | null | randomImageGenerator.py | niteshkv/pythonUtils | 00dd462ae1808fa61a01c2d8d0ced1d62c7bc7d8 | [
"MIT"
] | null | null | null | from PIL import Image
import random
newImage = []
width=200
height=200
for i in range(0,width,1):
for j in range(0,height,1):
newImage.append((random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)))
newIm = Image.new('RGB', (width, height))
newIm.putdata(newImage)
newIm.show()
| 23.692308 | 97 | 0.691558 | 50 | 308 | 4.26 | 0.48 | 0.183099 | 0.197183 | 0.239437 | 0.239437 | 0.239437 | 0.239437 | 0.239437 | 0 | 0 | 0 | 0.08365 | 0.146104 | 308 | 12 | 98 | 25.666667 | 0.726236 | 0 | 0 | 0 | 0 | 0 | 0.00974 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.181818 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
de2d632fea41e65c2f347fafc78e538f5fb25823 | 381 | py | Python | submission/SimpleModel.py | fahim5466/IDAO_2021_Final_Stage | 81c839b94eb400bb1827230b8e2613535a5173c6 | [
"BSD-3-Clause"
] | null | null | null | submission/SimpleModel.py | fahim5466/IDAO_2021_Final_Stage | 81c839b94eb400bb1827230b8e2613535a5173c6 | [
"BSD-3-Clause"
] | null | null | null | submission/SimpleModel.py | fahim5466/IDAO_2021_Final_Stage | 81c839b94eb400bb1827230b8e2613535a5173c6 | [
"BSD-3-Clause"
] | null | null | null | from xgboost import XGBClassifier
class SimpleModel():
def __init__(self):
self.model = XGBClassifier()
def fit(self, x, y, val_x, val_y):
eval_set = [(val_x,val_y)]
self.model.fit(x, y, early_stopping_rounds=10, eval_metric="logloss", eval_set=eval_set, verbose=True)
def predict(self, x):
return self.model.predict(x)
| 25.4 | 110 | 0.637795 | 54 | 381 | 4.240741 | 0.481481 | 0.117904 | 0.061135 | 0.069869 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00692 | 0.24147 | 381 | 14 | 111 | 27.214286 | 0.785467 | 0 | 0 | 0 | 0 | 0 | 0.018373 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.111111 | 0.111111 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
de397e9efd40c6ff679c621814a49ee8f0bd95e6 | 734 | py | Python | sunpy/__init__.py | liftTacos/sunpy | a10456f2f916f76c91278d270966b556780a4280 | [
"BSD-2-Clause"
] | null | null | null | sunpy/__init__.py | liftTacos/sunpy | a10456f2f916f76c91278d270966b556780a4280 | [
"BSD-2-Clause"
] | null | null | null | sunpy/__init__.py | liftTacos/sunpy | a10456f2f916f76c91278d270966b556780a4280 | [
"BSD-2-Clause"
] | null | null | null | """
SunPy
=====
An open-source Python library for Solar Physics data analysis.
Web Links
---------
Homepage: http://sunpy.org
Documentation: http://docs.sunpy.org/en/stable/
"""
from __future__ import absolute_import
try:
from .version import version as __version__
except ImportError:
__version__ = ''
try:
from .version import githash as __githash__
except ImportError:
__githash__ = ''
import os
from sunpy.util.config import load_config, print_config
from sunpy.util import system_info
from sunpy.tests.runner import SunPyTestRunner
self_test = SunPyTestRunner.make_test_runner_in(os.path.dirname(__file__))
# Load user configuration
config = load_config()
__all__ = ['config', 'self_test', 'system_info']
| 20.971429 | 74 | 0.756131 | 95 | 734 | 5.431579 | 0.526316 | 0.052326 | 0.054264 | 0.077519 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138965 | 734 | 34 | 75 | 21.588235 | 0.816456 | 0.26703 | 0 | 0.25 | 0 | 0 | 0.049057 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5625 | 0 | 0.5625 | 0.0625 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
de400956059c1860f0226b1229cf22c56fdfeab6 | 1,901 | py | Python | work/Clashes/Old work/read_pdb_date.py | youdar/work | d5f32015e7be1d58ede255eeadbd1d12acb3f270 | [
"MIT"
] | null | null | null | work/Clashes/Old work/read_pdb_date.py | youdar/work | d5f32015e7be1d58ede255eeadbd1d12acb3f270 | [
"MIT"
] | null | null | null | work/Clashes/Old work/read_pdb_date.py | youdar/work | d5f32015e7be1d58ede255eeadbd1d12acb3f270 | [
"MIT"
] | null | null | null | from __future__ import division
import cPickle as pickle
from libtbx import smart_open
import os,sys
import datetime
def run():
data_file_path = '/net/cci/youval/Work/work/Clashes/Data'
file_to_year_dict = {}
# find the file in LBL pdb mirror folder
#pdb_dir = os.environ["PDB_MIRROR_PDB"]
#pdb_files = open(os.path.join(pdb_dir, "INDEX"), "r").read().splitlines()
#for p in pdb_files:
#file_name = p[-11:-7]
#file_name_with_path = os.path.join(pdb_dir,p)
#file_lines = smart_open.for_reading(
#file_name = file_name_with_path).read().splitlines()
#year = get_year(file_lines)
#file_to_year_dict[file_name] = year
#print len(file_to_year_dict)
# collect year for files that are not in INDEX
os.chdir('/net/cci/youval/Work/work/Clashes/junk')
from iotbx.pdb import fetch
class null_out(object):
"""Pseudo-filehandle for suppressing printed output."""
def isatty(self): return False
def close(self): pass
def flush(self): pass
def write(self, str): pass
def writelines(self, sequence): pass
missing_files = pickle.load(open(os.path.join(data_file_path,'missing_files'),'r'))
for f in missing_files:
file_name = fetch.get_pdb (f,'pdb',mirror='rcsb',log=null_out())
file_lines = smart_open.for_reading(
file_name = file_name).read().splitlines()
year = get_year(file_lines)
file_to_year_dict[f] = year
print len(file_to_year_dict)
os.remove(file_name)
#pickle.dump(file_to_year_dict, open(os.path.join(data_file_path, "file_to_year_dict"),'w'))
print len(file_to_year_dict)
print 'Done...'
def get_year(file_lines):
for line in file_lines:
if line.startswith('HEADER'):
year = line[57:59]
if year > '30':
year = '19' + year
else:
year = '20' + year
return year
break
return ''
if (__name__ == "__main__"):
run() | 29.703125 | 94 | 0.679116 | 295 | 1,901 | 4.098305 | 0.342373 | 0.059553 | 0.06617 | 0.092639 | 0.327543 | 0.301075 | 0.238213 | 0.152192 | 0.152192 | 0.152192 | 0 | 0.008475 | 0.193056 | 1,901 | 64 | 95 | 29.703125 | 0.779661 | 0.288269 | 0 | 0.05 | 0 | 0 | 0.096498 | 0.059144 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.1 | 0.15 | null | null | 0.075 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
de442be48e02cb820626ab0e6d27ec35e8ad7e70 | 484 | py | Python | examples/hubert/simple_kmeans/kmeans_label.py | chenxie95/fairseq | a8da5470b16bcbd4dcd5fc31168c287e3328687f | [
"MIT"
] | null | null | null | examples/hubert/simple_kmeans/kmeans_label.py | chenxie95/fairseq | a8da5470b16bcbd4dcd5fc31168c287e3328687f | [
"MIT"
] | null | null | null | examples/hubert/simple_kmeans/kmeans_label.py | chenxie95/fairseq | a8da5470b16bcbd4dcd5fc31168c287e3328687f | [
"MIT"
] | null | null | null | from mpi4py import MPI
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--split', default='train')
args = parser.parse_args()
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
command = "python dump_km_label.py librispeech960h_feature_mfcc_local {} librispeech960h_feature_mfcc_kmeans {} {} librispeech960h_feature_mfcc_kmeans_label".format(args.split, size, rank)
print ("Running command: {}".format(command))
os.system(command)
| 30.25 | 188 | 0.78719 | 65 | 484 | 5.6 | 0.538462 | 0.181319 | 0.214286 | 0.175824 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022779 | 0.092975 | 484 | 15 | 189 | 32.266667 | 0.806378 | 0 | 0 | 0 | 0 | 0 | 0.363636 | 0.227273 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.083333 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
de4500e22323c74077eaacddc491060d3f9175e1 | 1,598 | py | Python | scripts/checklinks.py | rayvnekieron/regionator | ed32f43c315465402b7e18c9f374e22dd89db64e | [
"Apache-2.0"
] | null | null | null | scripts/checklinks.py | rayvnekieron/regionator | ed32f43c315465402b7e18c9f374e22dd89db64e | [
"Apache-2.0"
] | null | null | null | scripts/checklinks.py | rayvnekieron/regionator | ed32f43c315465402b7e18c9f374e22dd89db64e | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
"""
Copyright (C) 2007 Google Inc.
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.
"""
"""
$URL$
$Revision$
$Date$
"""
# Check all link targets in a KML file/hierarchy.
import os
import sys
import kml.checklinks
if len(sys.argv) < 2:
print 'usage: %s [-k] [-h] [-a] [-r] [-v] [-s] [-c] [-d depth] [-e encoding] -u url.kml' \
% os.path.basename(sys.argv[0])
print ' -k: check KML hrefs'
print ' -h: check HTML hrefs'
print ' -a: check absolute URLs'
print ' -r: check relative URLs'
print ' -c: compute checksum'
print ' -v: verbose'
print ' -s: print summary only'
print ' -n: do not actually fetch anything'
print ' -d maxdepth: limit hierarchy walk'
print ' -e encoding: override xml encoding'
print ' -u url.kml: KML/KMZ file or hierarchy to check'
print ' -u dir: root of directory hierarchy of KML/KMZ files'
print ' -u archive.tgz: a tar archive of KML/KMZ files'
sys.exit(1)
status = kml.checklinks.CheckLinks(sys.argv[1:])
if status == -1:
print 'KML arg bad'
sys.exit(status)
| 28.535714 | 92 | 0.665207 | 246 | 1,598 | 4.321138 | 0.53252 | 0.056444 | 0.024459 | 0.030103 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010467 | 0.222778 | 1,598 | 55 | 93 | 29.054545 | 0.845411 | 0.042553 | 0 | 0 | 0 | 0.041667 | 0.549839 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.125 | null | null | 0.625 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
de4bf25232110b0b9c5cfb1cf03fc96b0aadfbff | 34,819 | py | Python | django/docs/ref/models/instances.txt.py | roshanba/mangal | f7b428811dc07214009cc33f0beb665ead402038 | [
"bzip2-1.0.6",
"MIT"
] | null | null | null | django/docs/ref/models/instances.txt.py | roshanba/mangal | f7b428811dc07214009cc33f0beb665ead402038 | [
"bzip2-1.0.6",
"MIT"
] | null | null | null | django/docs/ref/models/instances.txt.py | roshanba/mangal | f7b428811dc07214009cc33f0beb665ead402038 | [
"bzip2-1.0.6",
"MIT"
] | null | null | null | XXXXXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXX XXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXX
XX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
XXXX XXXXXXXX XXXXXXXXX XXX XXXXXXX XX XXX XXXXXXXXX XXXX XX XXXXXX XX XXX
XXXXXXXX XXXXXXXXX XX XXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXX XXXXXXX XX XXXXXX XXXXXXXX XXXX XX XXXX XXX
XXXXXXXXXX XXXXX XXXXXXXXX XXXXXX XXXXXXX XXXX XXXX
XXXXXXXXXX XXXX XXXXXXXXX XXXXX XXX XXX XXXXXXXXXXXXX XXXXXX XXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XX XXX XXXXXXXXXXXXXX XXXXX XXXXX
XXXXXXXXXXXXXXXXXXXXXX
XXXXXXXX XXXXXXX
XXXXXXXXXXXXXXXX
XX XXXXXX X XXX XXXXXXXX XX X XXXXXX XXXXXXXXXXX XX XXXX XXX XXXXX XXXXXX
XXXXXX
XX XXXXXXX XXXXXXXXXXXXXXX
XXX XXXXXXX XXXXXXXXX XXX XXX XXXXX XX XXX XXXXXX XXXXXX XXXXXXX XX XXXX XXXXXX
XXXX XXXX XXXXXXXXXXXXX X XXXXX XX XX XXX XXXXXXX XXXX XXXXXXXXX XXX XXXXX XXX
XXXX XX XXXXXXXXXXXXXXXXXXXXXX
XX XXXXXX
XXX XXX XX XXXXXXX XX XXXXXXXXX XXX XXXXX XX XXXXXXXXXX XXX XXXXXXXXXXXX
XXXXXXX XX XXX XX XXX XXXXXXXX XXXX XXXX XXX XX XXXXXX XXX XXXXXXX
XXXXXXXXX XX XXX XXXXXX XXX XXXXXXX XXX XXXXX XXXXXXXX XXXX XXXXX XXXXXX
XXXXXX XXXX XXXXXXXXXX XXXXXXXXXXXXX XXX XXXXX XXX XX XXXXX XXXXXXXXXXX
XX XXX X XXXXXXXXXXX XX XXX XXXXX XXXXXXX
XXXX XXXXXXXXX XXXXXX XXXXXX
XXXXX XXXXXXXXXXXXXXXXXXX
XXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXX
XXX XXXXXXXXXXX XXXXXXX
XXXX X XXXXXXXXXXXXXXXX
X XX XXXXXXXXX XXXX XXX XXXX
XXXXXX XXXX
XXXX X XXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXX
XX XXX X XXXXXX XX X XXXXXX XXXXXXX XXXXXXXX XXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX XXXXXXXXXXXXXXXXX XXXXXXX
XXXX X XXXXXXXXXXXXXXXXXXXXXXXX
X XX XXXXXXXXX XXXX XXX XXXX
XXXXXX XXXX
XXXXX XXXXXXXXXXXXXXXXXXX
XXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXX X XXXXXXXXXXXXX
XXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXX
XXXXXXXXXXX XXXXX XXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXX
XXX XXXXXXXXXXXXX XXXXXX XXX XX XXXX XX XXXXXXXXX XXXXX XXXXXXXX XXXXXXXX
XXXX XXXXXXX XXXX XXX XXXXXXXXX
XXX XXXXXX XXXXXXXX XXXXXXXX XXX XXXXXXXX XXXXX XXX XXX XXXXXXXX XXX XXXXX
XX XXXXXX XXXXX XXXXXXXXXXXXXXX XXXXXXXX XXX XXXXX XX XXX XXXXXX XXXXXXX XXX
XXXXXXXXXX XXXXXXXX XXX XXXXXX XXXXXX XXX XXXX XXXXX XX XXXXXXXXXXXXXXXX XXX
XXXXXXXXXXXXXXX XXX XX XXX XXXX XXXXX XX XXX XXXXXXXXXXX XX XXX XX XXX XXXXXXX
XXXXXX XXX XXXXXXXX XXXX XXXXXXXXXX XXX XXXXXXXXXX XX XX XX XXX XXXXX
XXXXXXXXXXXXXX XXXXXXX XXXXX XXXX XXX XXX XXXXXXXX XXX XX XXXXXXX XX
XXXXXXXXXXXXXXXXX XX XXX XXXXXX XXX XXXXXXXXX XXXX XXXXX XXXXXX XX
XXXXXXXXXXXXXXXX XX XXXX XXXXX XXXXXX X XXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XXXX XX XXX XXXXXXX XXXXXXX
XX XXXXXXXX XX XXXXXXXX XXX XXX XXXXXX XXX XXXXXXXXXXXXX XXXXXX XXXX XXX XXX
XXXXXXXXXX XXX XXXXXX XXXXX XX XXX XXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX
XXXXX XX XX XXXXXXX XXXXXXX XXX XX XXXXXX XXX XXXXXXX XXXXXX XX XXXXXX XXXX
XXX XXXXXX XXXX XXX XXXXXXXXXX
XXXX XXXXXXXXXXXXXXXX XXXXXX XXXXXXXX
XXXXXXXXXXXX
XXX XXXXXXXXXXXX XXX XXXXXXXXXXXX XXXXXXXX
X XXXXXXX XXXXXXXXXXXXXX XX XXXXXXXXX XXXXXXXX XX XXXXXX XXX XXXXX
X XX XXXXXXXX XXXX XXXXXXXXX
XX XXXXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX X XXXXXXXXXXXX
XXXXXXXXXXXXXXXX
XXXXXX X X
XXXXXXXXXXXX XX XXXXXXXXX XX XXXXXXXXXXX XXXX XXXXXXXX
XXX X XX XXXXXXXXXXXXXXXXXXXXXXXXX
X
XXXXXXXX X XXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXX X XXXXX
XXXXXXXXXXXXXXXXXX X XX
X XXXXXXXXXXXXX XX XXXXX XXX XXXXXXXX XXXXX XXXXXX XX XXX XXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXX X XXXXXXXXXXXXXXXXXXXXX XXXXXXXX
XXXXXX XXXXXXXX
XXX XXXXXXXXXX XXXXXX XXXXXXXXXX
X XXXXX XXX XXX XXXXXXX XXXXXX XXXXXX XXXX XXXXXXXXXXXXXXXX XXX XXXXXXXX
X XXXXXXX XXXXXXXX XXX XXXXXXXXXX XX XXX XXXXXX XXXXX XXXXXXX XXXXXXX
X XXXXXXX XXXXX XXXXX XXXXXXXXXXXX XX XXXXXXXXXX
XX XXX XXXXXXXXXXXXXXXXXX XXX X
XXXXXXXXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXX XXX XXXXX XX XXXXXXX XXXXX XXXXXXXXX
XXXXXXXXXXXXXXXXXXX XXXXXXXXX
XXX XXXXXXX XXXXX XXXXX X XXXX XXXXXXXXXXXXX XXXXXXXXXXXXXX XX XXXXXXX XXX XXXX
XX XXXXX XX XXXX XXXX XX XXXXX XX XXXXXXXX XX XXX X XXXXXXXXXXX XXXX XX XXX
XXXXXXXXXXXXX XXXXXXX
XXXXXXXXXX XXXXXXX XXXX XXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XXX XXXXXX X XXXXX XXXX X XXXXX XXXXXXXXX XXXXXXXXX XX XXXXX XXXXXXX XXX
XXXXX XXXX XXX XXXXXXXXXX
XXX XXX X XXXXXXXXXXXXXXXXXXXXXXX
XXX XXX XXXXXXXXX
XXX XXXXXXXXX X XXXXX XXX XXXXX XXXX XXX XXXXXXXX
XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXX
XX XXX XXXX XX XXXXXX X XXXXXXX XXXXXX XXXX XXX XXXXXXXXX XXX XXX XXX XXX
XXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXX XXXX XXXXXX XX XXXXXX XXXXXXX XXXXXXXXX XXX
XXXXXXXXX XX XXXXX
XX XXX XXXXXXXXXXXX XXXXXX XX XXX XXXXX XXX XXXXXXX XX XXX XXXXXX XXXXXXXXX
XXXXXXX XX XXX XXXXXXXXX
XX XXX XXXXXX XXXXXXXXX XXX XXXXXXX XXXX XXX XXXXXXXX XXXXXXXXX
XXXX XXXXXX XX XXX XXXXX XXX XXXXXXXX XXXX XXX XXXXXXXXX XXXXX
XXXXXXXXXXXXXXXXXX XXXXXX XXXX XX XXXXXXXXXXX XXXXXX XXXXXXXXX XXX
XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX
XXXXXX XXXXXXX XXXXXXX
XXX XXXXXXXXX XXXXXXX XXXX XXX XXXXXXXX XXX XXXXXXXX XXX XXXXXX XXXXX XX XXXX
XXX XXXXXXX XXXXXXXX XX XXX XXXXXXXX XXXXXX XXXXXX XXXX XXX XXXXXXXXX XXX
XXXXXXXXX XXXXXXXX XXX XX XXXX XX XXXXX XXX XXXXXXXX XXXX XXX XXXXXXXXXX
XX XX XXXXXXXX XX XXXXX XXX XXX XX XXXXXX XX XX XXXXXX XX XXXXX XXX XXXXXXXXXX
XXXXXXXXX
XXX XXXXXXXX XX XXXX XXXX XX XXXXXXXXXXXX XXXX XXXXXXXX XX XXX XXXXXXXX
XXXXXXX XXX XXXXX XXXXX X XXXX XXXXXXX XX XXXXXX
XXX XXXXXXXXXXXXXXXXXXXXXXXXX
XXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X XX
X XX XXXX XXXXX XXXXXXX XX XXXXX XX XXX XXX XXXXX XX XXX XXXXXXXX
X XXX XXXXXXX XX XX XXX XXXXXXXX XXXXXXX XXXXX XXXXX XX XX XXXXXXXX
X XXXX XXX XXXXXXXXX
XXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX XX
XXXX XXXX XXXX XXXXXXXX XXXXXX XXX XXXXXXXXX XXX XXXXXXX XX XXX XXXXXXXX
XXXXXXX XXXXX XXXXXXX XXXXXXX XXXX XXXXXXX XXXX XX XX XXXXXXXX XX XXXXXXXXX
XXX XXX XXXXXXXX XXXXXXX XXXXXXXX XXX XXXXXXX XXXXX XXXXX XXX XXX XXX XXXXXX
XXX XX XXX XXXXXXXXXX XXXXXX XXXX X XXXXXXXX XXXXX XX XXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX XXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXX
X XXXXXX XXXXXXXX XXX XXXX XX XXX XXXXXXXX XXXXX XX XX
X XXXXXXX
XX XXXXXX XX XXX XXXXX
XXXXXX X XXXXXXXXXXX
XXXXXXXXXXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXX
X XX XXX XXXXXXXX XXXXX XX XXXXX XX XX XXXXXX
XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X XXXX XXXX XXX XX XXXX
XXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXXXXXXX
XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX
X XXXXXX XXXXXX XXXX XXXXXXX X XXX XXXXXXXXXX XXX XXXXXXXXX XXXXX XX XXX XXXXX
XXXXXX XXXX XXX XXXXXXXXX XXXXXXXX XXX XXXX XXXXXX
XX XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXX
XXXXXXXXXXXXXXXXXX
XXXXX XXX XXXXX XXXXX XXXXXXXX XX XXXXXXXXXX X XXXXXX
XX XXXXXXXX XXX XXXXX XXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XXXXXXXX XXX XXXXX XX X XXXXX X XXXXXXXXXXXXXXXXXXXXX
XX XXXXXXXX XXX XXXXX XXXXXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX XXXXX XXXXX XXX XXXXXXXXX XXXX XXX XXXX X XXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX
XXXX XXX XXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXX XX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXXXXXX XXXXX XXXXXXXXXX XXXXX XXX
XXX XXX XXXXXX XXXX XXX XXXXXXXX XX XXX XXXXX XXX XXX XXXXXXXXXXXXXXX
XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXX XXXXXXXXXXXX XXX XXXXXX XXXX
XXXX XX XXXX X XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XX XXX XXXX XX XXXXXX
XXXXXXXXXX XXXXXX XXXXXXXXX XX XX XXX XXXX XXXXXXXX XXXXXX XXXX XXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXXXXXX XXXXXXXXXXX
XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX
XXXX XXXXXX XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX XXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXX XX XXXXXXXXXX XX XXXX
XXXXX XXX XXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXX X
XXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXXXXX XXXXXX XXXX XXX XXXXX XXXXXXX
XXX XXXXXXXX XXXXXXXXXXX XXXXXXXX XXX XX XXXX XX XXXXXXX X XXXX XX XXXXX XXXXX
XXXX XXX XX XXXXXXXX XXXX XXXXXXXXXX XXX XXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXXX XXXXXXXX XX XXXXXXX XXXXXX XXXX
XXXXXX XXXXXXX XX XXXX XXXX XXXX XXXXX XXXXXXXXX XXXXX XXX XXXXXX XXXXXX XXXXX
XXX XX XXXXXXXXX XX XXX XXXXX
XXXX XXXX XXXXXXXXXXXXXXXX XXXX XXXXX XX XXXXXX XXXXXXXXXXXXX XXXX XXX XXXX
XXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXXXX XXXX XX XXXX XX XXXXXXXX
XXXX XXX XXXX XX XXX XXXXXXXX XXXXX XXXXXXXXXX XXX XXXX XXX XXXXXXXX XXXXXXX
XXXXXXX XXX XXXXXXXXX
XXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXX
XXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXX XX XX
X XX XXXXXXXXX XXXXX XX XXX XXXXXX XXXXXXXXX XX XXXXXXXXXXXXXXX
X XXXXXXX XXXX XX X XXXXX XX XXXXXX XXXX XXXXXXXXXXXXXXXXX
XXXX
XXX XXXXX XXXX XXXXXXXXXXXXXXXX XXXXXXXX XX XX XXXXX XXXX XXXXXXXXXX XXXXXX
XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXX XXXXXX XXXX XXXXXXXX XXX XXXXXX XX XXXX XXXXXX XXX XXXXXXXX XXXXXXXXXXX
XXXXXXXX XXXX XXX XXXXXXX X XXXX XX XXXXX XXXXX XX XXXXXXX XXXX XXXXXXXXXXX XX
XXXX XXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXX XXXXXX XXXX
XXXXXXXXXXX
XXX XXXXXX XXXX XXXXXXXXXXXXXXXX XXXXXXXX XX XX XXXX XXXXXXXXXXXXXXXXXXXXXX
XXXX XXXXXX XXXXXX XX XXXXXXXXXX XX XXXXXXX XXXXXX XXXXXXXXXX XX XXXX XXXXXX
XX XXXXXXXX XXXXXXXXXXXXX
XXXX XXXXXX XXXXXX XX XXXX XX XXXXXXX XXXXXX XXXXX XXXXXXXXXXX XXX XX XXXXXX
XXXXXXXXXX XX XXXX XXXXX XX XXXXXXXX XXX XXXXXXXXX XXX XXXXX XXX XX XX
XXXXXXXXXXXXX XXXXXXX X XXXXX XXX X XXXXXX XX XX XX XXXXXXXXXX XXXX XXXXXXXX
XXXXXX XX XXXX XXXX X XXXXXX XXXXXXX
XXXXXX XXXXXXXX
XXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXX
XXXX XXXXXXXXX XXXXXX XXXXXX
XXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXXXXXXXXX XX X
XXXXX XXXXXXXXXXXXXXXXXXXXXX
XXX
XXX XXXXXXXXXXXX
X XXXXX XXXXX XXXXX XXXXXXX XX XXXX X XXXXXXXXX
XX XXXXXXXXXXX XX XXXXXXX XXX XXXXXXXXXXXXX XX XXX XXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXX XXX XXXX X XXXXXXXXXXX XXXXXXXX
X XXX XXX XXXXXXXX XXX XXXXXXXXX XXXXX XX XX XXXXXX XXXX XXX XXXXXXXX
XX XXXXXXXXXXX XX XXXXXXXXXXX XXX XXXXXXXXXXXXX XX XXXXX
XXXXXXXXXXXXX X XXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXX XXXX XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX X XXXXXXX XXXXXXXXXXX
XXXXXX XX XXX XXXXXXX XXXX XXX XXXX XXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXX XXXXXXX
XX XXX XXXXX XXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXX XXXXXX XX XXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXX XXXX X XXXXXXX XX XX
XXXX XX XXXXXX XX X XXXXXXX XXXXX XXXXXXXXXX XXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXX XX XXXX XXX XXXXXX
XXXX XXX XXXX XX XXX XXXXXX XXXXX XXXXXXX XX XX X XXXXXXXX XXXXXXX
XXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX
XXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXX XX XX
XXXXXXXXXXXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XXXXXX XXXXXXXXXX XX X XXXXXXXX XXXXXX XXXXXXXXXXX XXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX X XXXXXXXXXXX XXXXX XXX
XXXX XXX XXX XXXXX XXXXXX XX XXXXX XXXXXX XXX XXXXXXXX XXXXXXX XX XXXXXX XXX
XXXXX XX XXX XXXXXXXXXXXX XXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXX
XXX
XXX XXXXXXXXXXXX
X XXXXX XXXXX XXXXX XXXXXXX XX XXXX X XXXXXXXXX
XX XXXXXXXXXXX XX XXXXXXX XXX XXXXXXXXXXXXX XX XXX XXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXX XXXXXXX XXX XXX XXXX X XXXXXXXXXXX XXXXXXXXX
XXX
XX XXX XXXXXX XXXXXX XX XXXXXXXX XXXXXX XXXXXX XXXXXXXXXXXXXXXXXX XXX XXX XXXX
XXXX X XXXXXXXXXX XXXXXXX XXXXX XXXXX XX XXXXXXXX
XXXXX XXXXXXXXXXXXXXXXX
XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXXXXXXXXXXXX
XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXX XXXXXXXXXXXXXXXX
XX
XXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXX XXX XXXXXX XXXXXXXXXXX XX XXXX XXXXXX
XX XXXXXXXXXXXX XXX XX XXXXX XXXXXXXXXXXXXX XXXXXXXXXX XXXXXX XX XXXXX XXXXXX XXXXX XXXXXX XX X XXXXXXXXXXXXX
XXX XXXXX XXXXX XXXXXXXXXX XXXXXX XX XXXXXXXXXXXXXXXXX XXX XXXXXX XXXX
XXXXX XXXXXX XX X XXXXX XXXX XX XXXX XXX XXXXX XXX XXXXXX XXXXX
XXXXXXXXXXXXXXX XX XXXXXXXXXXXXXXXXXX XXXXX XX XXXX XXXXX X XXXXXXXXXXXXXX
XXXXXXX XXX XXXXXXXXXX XXXXX XXXXX XX XXXX XX XX XXXXXXXXXX XXXX XXX
XXXXXXXX XXXXXX
XX XXXX XXXXXX XXXX XXXXXXXX XXXXXXX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XX XXXXXXXX XXX XXXX XX XXXXXX
XXXX XXX XXXXXXXX XXXX XXXXXXXXXXX XXX XXXXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXX
XXX
XXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XXXXXXXXXXX XX XXXXXXX XXX XXXXXXXXXXXXX XX XXX XXXXX
XX XXXXXXX XXX XXXXXXXX XX XXXXXXXX
XXXXX XXXXXXXXXXXXXXXX
XXXXXXXX XXXXXXX XXX XXX XXXX X XXXXXXXXXXX XXXXXXX
X
XXXXX
XXXXX XXXXXXXXXXXXXXXXX
XXXXXXXXX XX
XXXX XXXXXX XX XXXXX XX XXXXX XX XXX X X
XXXXXXXXXXXX XXXXXX
XX
XX
XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXX XXXXXX XX XXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXX XXX
XXXXXXXXXX XXXXXXXXXXX XX XXXX XXXXX XXXXXXX XX XXXXXXXXXX XXXXX XXXXXXX XXX
XXXXXXXX XXXXXXXXXXX XXXXXXXX XXXXXX XXX XX XXXXXXX X XXXX XX XXXXX XXXXX XX
XXXXXXX XXXX XXXXXXXXXXX XX XXXX XXXXX X
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXX XXXXXX XXXX XXXXXXXXXXX
XXXX XXXX XX XXX XXXXXXX XX XXXXXXXXXXX XXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXX XXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXX XXX XX
XXX XXXXXX XXX XXXXXXXX XXXX XXX XX XXXXXXXX
XXXXXX XXXXXXX
XXXXXXXXXXXXXX
XX XXXX XX XXXXXX XXXX XX XXX XXXXXXXXX XXXX XXXXXXXXXXX
XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
XX XXX XXXX XXXXXXXXXX XXXXXX XXXXXXXXX XXX XXX XXXXXXXX XXXX XXXXXXXXXX
XXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXX XXXXXXXX
XXX XXXXX XXXX XXXXXXX XXXX XXX XXXX XXXXXXXXXXX XXX XXX XXXXXXXX XXXXXX
XXXXXXXXXXXXXXXXX XXXXXXX XXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX X XXXXX XXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X XX XXXXXXXXXXXXXXXXX
XXXXXXX XXX X XXXX XXXX XXXXXXXXXXXXXXXX XXXXX XXXX XX XXXXXXXXXX XXX XXXXX XX
XX XXXXXXXXX XX XXXX XXXXXX XXX XXXXX XXXX XXX XXXX XXXXXXXXXXXX
XXX XX X XXXXXXXXXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXXX XX XXXXXXXXX
XXX XXXXX X XXXXXXX XXXXX XXXXXXX XX XXXXXXX XXXX XX XX XXXX
XXX XXXXXXXXX
XXX XXXXX X XXXXXXX XXX XX XX XXXX XXX XXXXXXX
XXXXXXX XX XXX XX XXXX XXXX XXX XXXXX XX XX XX XXXX XX XXXXXX XXX XXXX
XXXXXXXXXXX XXXXXXX XXXX XXXXX XX XXXXXXXXXX XX XXXX XXXXXXXXX XXX XX XXXXXXX
XXX XXXXXXXXXXXX XXXX XXXXX XXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXX
XXXXXX XX XXXXXXX XXXXXX XXX XXXXXXXXXX XXXXXXX XXXXXXXXXXXXXXXXXXXX XX X XXXXX
XX XXXX XXXXXX XXX XXX XXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX XXXX XXXXXXXX
XXX XXXXXX XXXXXXXX
XXXXXXXXXXXXXXXXXXX
XX XXXXXXXXXXX XXXXXXXX
XXXXXXXXXX XX XXXXXXX XXX XXXXXX X XXXXXXX XXX XXXXX XXXXXXXXX XX XXX XXXXXX
XXXXXX XXX XXX XXXX XXXX XXXXX XXXX XXXX X XXXXXXXX XXXXXX XXXXXXX XX XXXXXXX
XXXX X XXXXXX XXXXXXXXX XX XXX XXXXXX XXX XX XXXXXXXX XX XXXXX XXX XXXXXXXXX
XXXXXXXXX XX XXX XXXXXXX XXX XXXXX XXX XXX XXXXXX XXX XXX XXXX XXX XXX XXXX
XXXXXX XXXX XX XXX XXXXX XXX XXX XXXXX XXXXXXXXXX XXX XX XXXX XXXXXX XXX
XXXXXXX XXXXX XX XXX XXXXXX
XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX X XXXXX XXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXX XXXX XX XXXXXX X
XXX XXXXXXXX XX XXXXXXXXXX XXXX XXXXXXX XXXXXX XX XXXXXXXXXX XXXXXX XXXXXXX
XXXXXX XXXX XXXXXXX XX XXX XXXXXXXXXXXXXXX XX XXX XXXX
XXX XX X XXXXXXXXXX XXXXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXXX XX XXXXXXXXX
XXX XXXXX X XXXXXXX XX
XXX XXXXXXXXX
XXX XXXXX X XXXXXXX XX
XX XXX XXXXXX XXXXXXXXXXXXXXXX XXXXXX XXXXXXXXX XXXX XXXX XXX XX XXX XX
XXXXXXXXXXXXXXXX XXXXXXXXXXX XXXXXX XX XXX XXXXXX X XXX XXXXXX XXXX XX XXXXXXXX
XXXXXXXXXXX XXXXX XXXX XXXXXXX XXXXXX XX XXX XXXXXXXXX XXXXXX XXXX XXXXXX XXXXXX
XXXXXXXX XXX XXXXXXXX XXXXXX XXXXXX XXXX XXXXXXXX X XXX XXXX
XXXXX XXX XXXXX XXXXXXXXXX XXXXXXX XXXX XXXXXXXX XXXX XXXXXXX XXXXX XXXXXXXX XXX
XXXXXXXX XXXXXX XX XXX XXXXXXXXXX
XX X XXXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXXXXXXXXXX XXX XXXXXXXXX
XXXXXXXXX X XXXXXXXXX XXX XXXXXXXX XXXX XXXX XXXXX
XXX XXXX XXXXXX XXXXX XX XXXXXX XXX XXXXXXXXX XXXXXX XXX XXX XXXXXX XXXX
XXXXXXXX
XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXX XX XXXXXX XXXXXX XXX XXXXXXXXXXX
XXXXXXXX XXXX XXXXXX XXXXXXXXX XXX XXXXX XXXX XXXXXXXXXXX XXXXXXXXXX
XX XXXXXX XXXXX XXXXXXXXXXX XXX XXXXXXXX XXXXXXXXXX XXXX XXX XXXXXXX XXX XXXXX
XXXX XX XX XXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXX XXXXXXX XXXX XXX XXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXX XXX XXXX XX XXXXXXX XXXXXX XXXXXXXX XXX XXXXXXXXX XXXXXX
XX XXXXXX X XXXXXXXX XXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX XX XXXXX XXXXXXXX XXX XXXXXXXXX XXXXXXXXX XXX XXXX XXXXXX XX XX
XXXXXXXXXX
XX XXXXXXXXXXXX XXX XXXXXXX XXXX XXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XX XXXXXX XX XXXXXXX XXX
XXXXXXXXX XXXX XXXXXXXXXXXX XXXXXX XXXXXXX XXX XXXXXXXX XXX XXXXXXXXX XXXXXX
XXXXXXXX XXXXXXXXXXXXXX XX XXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XXXXXXXXX XXX XXXX XXX XXX XXXXXXXXXXX XXXX XXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XX XXXXX XX XXXXXXX
XXX XXXXXXX XXXXX XX X XXXX XXXX XXXX XXX XX XXXXXXX XX XXX XXXXXXXXX
XXXX XXXXXX XXXXX XXXXXXX XXXX XXXXXXXXXXXX XXXXXX XXXX XXXXXX XXXX XX
XXXXXXXX XXX XXXXXXXX XXX XXXXXX XX XXXXXX XX X XXXXXX XXXXXXX XXXXXXXX XXXX
XXXXXXX XXXX XXXXX XXXXX XXXXXXX XXXX XXXXXXXXXXXXX
XXX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXX X XXXXXX
XXXXXXXXXXXX XXXXXX XX XXXXX XXXXX XXXXXXXXX XXXXX XXXXX XXXXXXXXXXXX
XXXXXXXX XX XXX XXXXX XXXXX XXXX XX XXXXXXXXX XXXX XX XXXXXXXXXXXXX XXXX
XXXXXX XXX XXXXXXXXX XXXX XXX XXXXXXXXX
XX XXXXXXXX XXX XXXX XXXX XXX XXXXXXXXXXX XXX XXXXXXXXXXXXX XXXXXXXX XXXX XX
XXXXXXXX XXXX XX XXX XXXXXXXXX XXX XXXXXXXXX XXXX XXX XXXXXXXXX
XX XXXXXX X XXXXXXXXX XXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX XX XXXXX XXXXXXXX XXX XXXXXXXXX XXXXXXXXX XXX XXXX XXXXXX XX XX
XXXXXXXXXX
XXX XXXXXX XXXXX XX XXXXXX XXX XXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX XXX XXXX XXXXXXX XXXXXX XXXXXXXX XXXXXXX XXX XXX XXXX XXXXXXXXXX XXXXXX
XXX XXXXXXXX XXX XXXXXXXX XXXXXXXX XXXXXX XXXXXXXXX XXX XXXX XX XXX XXXXXXXXXX
XX XXXXXXXXXX XXX XXXXXXXXXXX XXXXXXXXXXXXX XXXX XXX XXXX XXXXXXXXXX XXX XXX
XXXXXXXX XXXXXXX XXX XXXXXXXXX XXXX XXXXXXX XXXXXX X
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXXXX XXXX XXXXXXXXXX
X XX XXX XXXXXXXX XXXXXXX XXX XXXXXXXXX XX XXX XX X XXXXX XXXX XXXXXXXXX XX
XXXXXXXX XXXXXX X XXXXX XXXXX XXXX XXXXXXXX XX XXX XXXXX XXXXXXXX XXXXXX
XXXXXXXX XX XXXXXXXXXXX
X XX XXX XXXXXXXX XXXXXXX XXX XXXXXXXXX XX XXXXX XXX XX XX XXX XXXXXXXXXX
XXXXXX XXXXXX XXXXXXXX XXXXX XX XXXXXXX XXX XX XXX XX X XXXXX XXXX XXXXXXX
XXXXX XX XXX XXXXXXXXXX XXXXXX XXXXXXXX XX XXXXXXXXXXX
XX XXX XXXXXXXX XXXXXXX XXX XXXXXXXXX XXXXXXX X
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXXXXX XXXXXXXX XX XXXXXXXXXX XX
XX XX XX XXXXXXXX XXXXX XXXXXXXX XXX XXXXXXX XXX XX XXX XX X XXXXX XXXX XXXXXX
XX XXX XXXXXXXXX XXXXXXXXXX XXXXXX XXXXXXXX XX XXXXXXXXXXX
XXX XXX XXXXXX XXXX XX XXXX XXX XXXXXX XX XXXXXXX XXX XX XXXXXXX X XXXXXXXXXXX
XXXXX XXXXXXXXXX XXXX XXXXXX XXX XXXXXXXX XX XXX XXXXXX XXXXXXXXX XXX
XXXXXXXXXXX XXXXX XX XXXXXXX XXX XXXX XX XXXX XXXXXXX XXX XXXXXXXXXXX XXXXXXXXXX
XXXXXXXXXXXXXXXX XXXXXXXX XXXXX XXX XXXXXXXX XX XXXXXX XX XXXXXXXX XXXXXX
XX XXXXXX XXX XXX XXXXXXXX XXXXXX XXX X XXXXXXXXXX XXXX XXX XXXXXXX XXX
XXXXXXXXX XXX XXXX XX XXX XXXXXXXXXX XXXXX X XXXX XXXX XXXXXX XXX XX XXXXXXXXXXX
XXXXXXXXX XX XXX XX XXXXXXXXXXX XXX XXX XXXXXXXXX XXXXXXX XX XXX XXXX XXXXX XX
XXX XXXXXXXXXX XXXXX XXXXX XXX XXXX XXXX XXXXX XXXXX XXX XXXXXXXX XXXXXXX
XXXXXX XXXX X XXX XXX XXXXXXX XXXX XX XXX XXXXXXXX XXXXXXXX X XXX XXX XXX
XXXXXXXX XXXXXXX XXX XXXXXX XX XXXXXXX XX XXX XXXXXXXXXX XXXX XXXXXXXX XXXXXXX
XXXXX XXXXXXX XXXXXXXXX XX XXXX XXXXX XX XX XXXXXXXX XX XXXXXX XX XXX XXX
XXXXXXXXX XX XXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX XX XXXXXXXXX
XX XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXX XX XXXXXX XX XXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XXXX XXXX XXXXXXXXXXXXXX XXXX XXXXXXXXX XX XX XXXX XX XXXXX XXX
XXXXXXXXXXXXXXXXXXXXX XXXXXX XX XXXXXXX XX XXX XXXXXXXXXX XXX XXX XXXX XXXX XX
XXXXX XX XXXXXXXXXXX XX XXXXXXXXXXX XXXXXXX XX XXXXXXXXX XXX XXX XXXXXX X XXX
XXXX XX XXXXX XXXXX XXX XXX XXXX XXX XXXXXXXXXXXXXXXXXXXXX XX
XXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XX XXX XXXXXXXXXXXXXXXXXXXXX XXXXXXX
XXXXXXX XXXX XXXXXXXXXX XX XX XXXXXX XXX XXXXXX XXXX XXXXXX XXXXX XXXXXX XX XXX
XXXX XXXXX
XX XXXXXX XX XXXX XXXX XXXX XXXXXX XXXX XX XXX XXXXX XXXXXXXXXXX XXXXXX XXXX
XXXXXX XXXXXX XX XXX XXXXX XXXXX XXX XXXXXX XX XXXXXXXX XXXX XXXX XXXX XX
XXXXXX XXXX XXX XXXXXXXXX XX XXXXX XXXXX XXXX XXXXXXX XX XXX XXXXXXXX XXX
XXXXX
XXXXX XXXXXXXXXXXXXXXXX XXXX XXXXX XX XXXXXX XXXXXXXXX XX XXXXXXXXXXXXXXXXX
XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXX XXXXXXXXXX XXXXX XX XXXXXXXX XXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXX XXXXXX XXXX XX XXXXXXX X XXXXXX XXXXXXXXXX XXXX XX X XXXXXX XXXX
XX XXXXXXXXXXXX XX XXXXXXXXXXXX XXX XXXXXXX XXXXXX XXX XXX XX XXXXXXXXX XXXX XX
XXXXX XXX XXXXXXXXXX XX XXXXXX XXXXXX
XXX XXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXXXXX
XXX XXXXXXXXXXXXXXXXXXX XX X
XXX XXXXXXXXXXXXXX
XX XXX XXX XXXXXXXXXXXXXXX XXXXX XXXXXXXXX XXXX XXX XXXXXXXX XXX XXX XXXX
XXX XXXXX XX XX XXXX XX XXXXXXX XXXX XX XXX XXXXXXXXX
XXX XXXXXXX XXX XX XXXX XXXXXXX XXXXXXXXXXXXXX X XXXX XXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXX XX XXXXXXXX XXXXXX XX XXXXXXXXXX
XXX XXXXXX XXXXXXXX XX XXX XXXXXXXX XXXXX XXXXXX XXXXXX XXXX XX XX XXXXXXXX
XXXXXXXXXX XX X XXX XXXXXX XXXXXX XXXXXXXX XXXXXXXXX XXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXX XXXX XXXX XX XXXXXXXX XXXXXXX XXXXX
XXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXX XXXXXXX XX XXXXXXXXX
XXXX
XXX XXXX XXXXXXXXXXXXXXXX XXXXXX X
XXX XXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXXXXX
XXX XXXXXXXXXXXXXXXXXXX X XXXXXXXXXXXXXXXX X X
XXX XXXXXXXXXXXXXX
XXX XXXX XXXXXXXX XXX XXX XXXXXXXXXXXXX XX XXXXXXXXX XXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXX XXX XXXXX XXXXXXXXX XX XXXXXX XXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXX XXXXXX XX XXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XXXXXXXXXX XX XXXXXX X XXXX XX XXXXX XXXXX XX XXXXXXX XXXXXXXX
XXXXXXXXXXXXXXXXXX XXXX XXX XXXXXX XXXXX XX XXXX XXXX XXXX XX XXXXXXXX
XXXX XXX XX XXXXXXXXX XX XXX XXXX XX XXXXXX XXXX XXX XX X XXX XXXXXX XX
XX XXXXXXX XXXXX XXXX XX X XXXXXX XXXXXXXXXXX XXXXXXX XXXX XXXXXXXXXX
XXX XX XXX XXXXX XXXXXX XXXX XXXXX XXXXXXX XX XXX XXXXXXXXX XXX XXXXXXXXX
XXXXXXXXXXXX X XXXXX XXXXXXX XXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX XXXXXXXXXXXXXXXXX XXXXXXXX XXX XX XXX XXXXXXXX XXXXXXXXXX XXXXXXXX XX
XXXXX XXXXXXXXXXXXXXXXX XXXXXXXX XXXX XXXX XXX XXXXX X XXXXX XX XXXX XXXX
XXXXXXX XX XXXXXX XX XXX XXXXXXX
XXXXXXXXXX XXXXXXXXXXXXXXXXX XXXX XXXXX XX XXXXXXX
XXXX XXXXXX X XXXXX XXXXXXX XXXXXXX XXXXXXXX XXXXX XXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXX XXXXXX XXXXXX
XXXX XXX XX XXXX XXX XXXXXXXX XX XXXXXX XXXXX XX XX XXXXXXXXX
XXXXXXXXXXXXXXXXX XX XXXX XXXXX XX XXX XXXXXX XX XXXXXX XXX XXXXXXXX XXXXX
XXXXXX XXX XXXXX XXXX XX XXXXX XX XXX XXXXXXX XXXXXXX
XXXXXXXX XXXXXXX
XXXXXXXXXXXXXXXX
XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
XXXXXX XX XXX XXXXXXXXXX XXX XXX XXXXXXX XXXX XXXX XXXXXXX XXX XXXXXX XX XXX
XXXXXXXXX XXX XXXXXX XXXXXXXX XXXX XXXXX XXXXX XXX XXXX XXXXX XXXX XXXX XX
XXX XXXXXXX XXXX XXXXXX XXXXXXX XXX XXXXXX XX XXXXXXX XXXXXXX XXX X XXXXXXXXXX
XXXX XXX XXXXXX XX XXXXXXXXX XXX XXXXXX XXXXX
XXX XXXX XXXXXXXX XXXXXXXXX XXX XX XXXXXX XXXXXXX XX XXXXX XXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XXX XXXX XXXXXXXXXX XXXXXXXX XXXXXXXXX XXX XXX XXXXXXXX XXX XXXXXXXXXXXX
XXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXX XXXXXXXX
XXXXXXXXX XXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXX
XXXX XX XXXXXX XXXX X XXXXX XXXXXXX XXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX XXXX
XXXX XXX XXXXXX XXXXXXX XXXXX
XXXXXXXX XXXXXXX
XXXXXXXXXXXXXXXX
XXXX XXX XXXXXXXXXXXXX X XXXXXX XXX XXXXXXX XXXXX XX XXXXXXXX XXXX XXX XXXXXXXX
XXX XXXXX XXXXXXX XXX XXXXX XXXXXXXX XX XXX XXXXXX XX XXX XXXXXXXX XXXXXX XXXX
XXX XXXX XXXXXX XXXXXXXXX XX XXX XXXXXXXXX
XX XXXXXXXXXXXX XXX XXXXX XXXXX XXXXXXX XXXXXXX XXXXXXXX
XXXXXXX XX XXXXXX XXX XXXX XXXXX XXX XXX XXXXXXX XX XXXXXX XXXX
XXX XXXX XX XXXXXXXX XXXXX XX XXX XXXXXXXX X XXXXXX XXXXX XXXXXX
XXXXXXX XX XXXXX XX XX XXXXXXXXX XXXX XXXXXX XXXX XX XXXXXXXX XXXX
XXXXXX XXXXXXX XXXX XXXXXXX XXXXXX XXX XX XXXX XX XXXX XX X XXXXXXXXX
XXXXXXXX XXXXXXXXX
XXXXX XXXXXX XXXXXXXXXXXXX XXXXXX XXX XX XXXXXXXXX XX XXXXXXXXX XXXX XX
XXXXXXXX XXXXXXXXX XXXXXXXX X XXXXXXXXXXXXXXXXXX XX XXXXXX XXXX XXX XXX XX
XXXXXXXX X XXXXX XX X XXXXXX XXXXXXX XXXX XX XXXXXXXXX XXXX XXX XXX XX
XXXXX XX XXX XXXXXXXX
XX XXXXXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXX XXXXXXXX XXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXX
X XXX XXXXXX XXXXXXX XXXX XXXXXXX XXXXXXXXX
XXXXXXXXXXXXX
XXXXXXXXXXXXX
XX XXXXXXXX XXXXXXXXXXXXXXX
XXX XXXXXXXXXXXXX XXXXXX XX XXXXXX XXXXXXXX XXX XXXX XXXXXXXXX XX XX XXXXXXX
XXXXXX XXXX XXXXXXXXXXXX XX X XXXXXX XX XXXXXXX XXXX XXXXXXXX XX XXXXXXX XX
XXXXXX XX XXX XXXXXX XXXXX XXXX XXX XX XXX XXXXX XXXXXXXX XXXX X XXXXXXXX XXXX
XX XXXXXXXX XX XXXXXXX XXXXX XXX XXXXXX XXXXXX XXXXXX X XXXXX XXXXXXXXXXXXXX
XXXXXXXXXXXXXX XX XXX XXXXX XXXX XXX XXXXXXXXXXXXX XXXXXXX
XXX XXXXXXXXX
XXXX XXXXXXXXX XXXXXX XXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX XXXXXXXXXXXXXX
XXXXXX XXX XXX X XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XX XXXXXXXX XXXXXXXXXXXXXX
XXX XXXXXXXX XXXXXX XX XXXXXXX XXXX XXXX XXXXXXXXX XXXX XXX XXXX XXXXXXX
XXX XXXXX XXX XXX XXXX XXXXXXXX XXXXX XXX XXXXXXXXXX XXXXXX XXXXXX XXXX
XXXXXXXXX XXXX X XXXXXXX XXX XXXXX XX XXXXXXXX XXXXXX XXXXX XX XXXXXXXX XXXXXX
XXXXXXXXXXX XXX XXXXX XXXXXXX XXXXXXXX XXXXX XX XXXXXXX XX XXX XXXXXXX XXXXX
XXXXXXXXX XXXXXXX XXX XXX XXXXX XXXXXX XXXX XXXXXX XXX XXXXXXX XXXXXX
XXX XXXXXXXXX
XXXX XXXXXXXXX XXXXXX XXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXX
XX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXX
XXXXX X XXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXX
X XXXXXXX XXXX XXXXXXXX
XXXXXXXXXXXXX XX XXXXXXXXXXXXX
XXXXXXXXXXXXX XX XXXXXXXXXXXXX
X XXXXXXX XXXX XXX XXXX
XXXXXXXXXXXXXXXX XX XXXXXXXXXXXXXXXX
X XXXX XXXXXXXX
XXXXXXXX X XXXXXXXXXXXXXXXX
XXXXXXXX XX XXXXXXXX
X XXXXX XXXXX
XXXXXXXXXXXXX XX XXXXXXXXXXXXXXXXXX
X XXXXXXXXXXX XXXXXXXXXXX
XXXXXXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXX
XXXXXXXXXXXXXX
XX XXXXXXXX XXXXXXXXXXXXXXXX
XXX XXXXXXXXXXXXXX XXXXXX XX XXXXX XX XXX XXXXXXXXXX XXXXXXX XXX XXXXXX XX
XX XXXXXXXXXXX XXXXXXXXXXXXXXXXX XX XXX XXXXXXXX XXXXXXX XXXX X XXXXXXX XXX
XXXXX XXXX X XXXXXXXXXXXXX XXXX XX XXXXXX XXXXXXXXXX XXX XXXXXXXXXXXXXX
XXXXXX XXXXX XXXXXX XXXXXXXXX XXXXXX XXXXXX XXX XXXXX XXX XXXXXXXX XX
XXXXXX XXX XXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXX XX XX XXXXXXXX XX
XXXXXXXXX XX XXXXXXX
XXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXX
XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX X XXXXXXXXXXXXXXXXXXXXXX XXXXXX XX XXXX XXXXXX XXX XX XXXXXXXXX XXX
XXXXXXXXX XXX XXX XX XXXXXXX XX XXXXXXXX XXXX XXXXXX XXXXXX XXXXXX XX XXXXXX X
XXXXXX XXXX XXX XX XXXX XX XXXXX XX XXX XXXXXX XXXX XXXXX
XXX XXXXXXXXX
XXX XXXXXXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXX X XXXXXXX
XXXXX XXXX XXXX XX XXXXXXX XXX XXXXXXX XX XXX XXX XX XXX XXXX XXXXXXXX XXX XX
XX XXXXX XXXX XXXX XX XXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXX XX
XXXXXXX XXX XXXX XXXXXXXXX
XXX XXXXXXXXX
XXX XXXXXXXXXXXXXXXXXXXXXXX
XXXX XXXXXXXXXXX XXXXXX XXXXXXX
XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX
XXX XXXXX XXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXX XX XX XXX XXXXX XXXX XX XX XXXXXX
XXXXXXX XXXX XXXXXXX XXX XXXXXXXXXXXXXX XXXX XXXX XXXX X XXXXX XX XXXXX XXXX
XXXX XXXX XXXX XXX XXXXXXXX XX XXX XXXXXXXX XXXXXX XXXXX XX XXXXX XX
XXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX X XXXXXX XX XXXXX XXXX XX XXXXXXX XXXX XX XXX XXXXXXXXXXXXXXXXX XXXX
XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXX XXXX XX XX
XXXXXXXX XX XX XXXXX XXXXX XXX XXXX XXXXXXX XXXXXXXXX XX XXXX XXXX X XXXXXX
XXXX XXX XXXXXX XXXXXX XXXXXXXXXXXXXXXXXXXXXXX
XX XXXXXXXXX
XXX XXXXXX XXXXX XXXXXXXX XXX XXX XXXX XXXXXXXXXXX XXXX XXXXXX XX XXXXX XX
XXXXXX XXXXXXXXXXXXX XX XXXX XX XXXXXXXX XXXXXXXXXXX
XXX XXXXXXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXX X XXXXXXXXX
XX XXXXXXXXXXXXX XX XXXXXXXXXXXXXXXXXX XXXX XXXXXXX XXXXXXXXXXXXXXXXXXXX
XXXXXX XX XXXXX XX X XXXXX XXXXXX XXXXXXXX XXX XXX XXX XXX XXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXX
XXXX XXXX XXXXXXXX XX XXX XXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXX XXXXXXX XX
XXXXXXXXXXX XXXX XXXXXXXX XXXXX XXX XXXXXXXX XXXX XXXXXXXX XXXX XX XXXX
XX XXXXXXXXXXXX XXXXXXXXXXX
XXXX XXX XXXXXXXX XXXXX XXXXXX XXX
XX XXXXXXXXXXXXXXXXXXXXX
XXXX XXXXXXXX XXXX XX XXXX XXXXXXX
XX XXXXXXXXXXXX XXXXXXXXXXX
XX XXXXXXXXXXXX
XXX XXXXX XXXX XX XXXX XX XXX XXXXXX XXX XXX XXXXXXXXX XX XXXX XXXXXXXX XXXX
XXX XXXXXXXXX XXXXX XXXX XXXXXXXXXX X XXXXXXXX XXXXXX XXX XXXXX XXXX XX XXXX XX
XXXXX XXXX XXXXX XXXXX XXXX XXX XXX XXXXX XX XXXXXXXX XXXXXXX XX XXXXX XX
XXXXXXXXXXXXXXXXXXXXXX XXX XXXX XXX XXXX XXXXX XXXX XXXX XXXX XXX XXXXXX
XX XXXXXX
XXX XXXXXX XXX XXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXX XXXXXXX XXXX
XXXXX XXXXXXXXXX XXXXXXXXX XX XXX XXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX
XXX XX XXXXXXXXXXXX XX XXXXXXXXXX
XXXX XXX XXXXXXXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXX XX XXXX XX XXX XXX
XXXXXX XXXXXXXX XXXXXXX XXX XXXXXXX XXXXXXXXXXX XXX XXX XXXX XX XXX XXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXX XX XXXX XXXX XXXX XX XXX
XXX XXXXX XXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXX XXX XXXXX XXXXXX
XXXXX XXXXXXXX XXXXXXX
XXXXXXXXXXXXXXXXXXXXXX
XX XXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX X XXXXX XXXXXX
XXXXX XXXX XXXX XX XXX XXXXXXXXX XXXXXXXX
XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
XXX XXXXX XXXXX XXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXX
XXXXXX XXXX XXXX X XXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXXX XXXXXXX XX XXX XXXX XX
XXX XXXXXX XXXX XXXXXX XXXXXXX XXX XXXXXXXXXXXXXXXX XXXXX XX XXX XXXXXX
XXX XXXXXXXXX
XXXX XXXXXXXXX XXXXXX XXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXX X X
XXXXX XXXXXXXXX
XXXXX XXXXXXXXXX
XXXXX XXXXXXXXX
X
XXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX
XX
XXX X X XXXXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXX
XXX XXXXXXXX
XXX XXXXXXXXXXXX
XXX
XXX XXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXX
XX XXXXXXXXXXXXXXXX XXX
XXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXX
XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXXX XXX XXXX XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXX XXXX XXXX XXXXXXXXXXXXXXXXXXXXX XXX
XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXX XXXXX XXXXXXX XX XXX XXXX XX XXX XXXXXX XXXX
XXXXXXX XXX XXXX XXX XXXXXXXX XXXXXX XXXX XXXXXXX XX XXX XXXX XXXXXX XXXXXXX
X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXX XXXXXXXXXXXX
XXXX XX XXXXX XXXXXXX XXXX XXXXXXX XXXXX XXXXXXX XXXXX XXX XXXXXXX
XXXXXXX XXX XXX XXXXXX XX XXX XXXX XX XXXXXXX XXXXXXXXX XXXX XX X
XXXXXX XXXXXXXX XX XXXX XX XXXXXXX XXXXXXX XXXXXX XXXXXXXXXX XXXX
XXXXXXX XXXX XXXXXX XXXXXXXX XXXXXXX XXXXXXXXXX XXXXX XXXXXX XX XX XXX
XXXXXX XXXXXXXXX XX XXXXXXXXXXX XXXXXXX XXXXXXXXXXXXXXXXX
XXXX XXXX XX XXX XXXX XX XXXXXXXXX XXXX XXXXXXX XXXXX XXXXXXX XXXX XXX XXX
XXXXXXX XXX XX X XXXXXXXXXXXX XXXX XXXXXXXXXX XXXX XX XXXXXXX XXX XXXXXXX XX
XXXXXXXXXXX XXXX XXXX XXXXX XXX XXXXXX XXX XXXXX XXXXXXX XX XXXXXXX XXXXXXXX
XX XXXXXXXXXXXX XXXXXXXXXX XXXXX XXXXXXXX XXXXXXX
XX XXXX XXXXX XXXXXXXXXX XX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXX XX
XXXXXXXXX XXXXX XXXX XXX XXXXX XX XXX XXXXXXXXX XXXXXXXX XX XX XXX
XXXXXXXXX XX XXXXXXX XXX XXX XXXXXXXX XXXXXXXXXXX XXXXXXXXXXX XX XXXX
XXXXXXX XXXXX XXX XXXXXX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXX
XXX XXXXXXX XXX XXXXX
XXXXX XXXXXXXXXX
XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXX
XX XXXXXXXXXXX XXXXXXXXXXXXXXXXXX
XXXX XXXXXXXXX XX XXXXXX XX XXX XXX XX X XXXXXX XXXXXXX XXX XXXXXXX XX
XXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XX XXXXXX
XX XXX XXXXX XXX XXX XXXXX XXXXX XXXXXXXXXXX
XXXXXX XXXXXXXX X XXXXXXXXXXXXXXXX XXXXXXXXX XX XX XXXXXXXXX XX XXXX XXXXX
XXXXX XX XXXXXXXX XXX XXXXX XX XXXXXX XXXX XXXXX XXX XX XXXXX XXX XX XXXXX
XXX XX XXXXX X XXXXXXXXXX XXXXX XXXXX XXXX XXXXXXXXXXXXXXX XXX XXXXXXXXX XX
X XXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
| 40.676402 | 109 | 0.808093 | 4,477 | 34,819 | 6.284789 | 0.010945 | 0.02861 | 0.011337 | 0.003412 | 0.234389 | 0.10488 | 0.06479 | 0.050894 | 0.02829 | 0.024025 | 0 | 0 | 0.191907 | 34,819 | 855 | 110 | 40.723977 | 1 | 0 | 0 | 0.985959 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
de61c475ac75b3f7938de17b5bc87e11170efb21 | 1,257 | py | Python | db/migrations/0001_initial.py | abdulaziz-mirzaeev/health-cosmetics-bot | e14ee602279d2d46d6737fbeae770c9ce0f3a0fd | [
"MIT",
"Unlicense"
] | null | null | null | db/migrations/0001_initial.py | abdulaziz-mirzaeev/health-cosmetics-bot | e14ee602279d2d46d6737fbeae770c9ce0f3a0fd | [
"MIT",
"Unlicense"
] | null | null | null | db/migrations/0001_initial.py | abdulaziz-mirzaeev/health-cosmetics-bot | e14ee602279d2d46d6737fbeae770c9ce0f3a0fd | [
"MIT",
"Unlicense"
] | null | null | null | # Generated by Django 3.2.4 on 2022-01-03 15:31
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Person',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('full_name', models.CharField(max_length=256)),
('phone_number', models.CharField(max_length=64)),
('product', models.CharField(max_length=256)),
('user_id', models.PositiveIntegerField()),
('created_at', models.DateTimeField(default=django.utils.timezone.now)),
],
),
migrations.CreateModel(
name='Product',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=256)),
('description_uz', models.TextField()),
('description_ru', models.TextField()),
('img_url', models.CharField(max_length=256)),
],
),
]
| 33.972973 | 114 | 0.568019 | 122 | 1,257 | 5.704918 | 0.491803 | 0.107759 | 0.12931 | 0.172414 | 0.382184 | 0.227011 | 0.227011 | 0.227011 | 0.227011 | 0.227011 | 0 | 0.032768 | 0.295943 | 1,257 | 36 | 115 | 34.916667 | 0.753672 | 0.0358 | 0 | 0.344828 | 1 | 0 | 0.087603 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.068966 | 0 | 0.206897 | 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 | 0 | 0 | 0 | 0 | 0 | 2 |
de8a9f894d52134d266e44732a3b67f29b218aa9 | 1,151 | py | Python | server/yafa/models.py | mrmonkington/yafa | d15ba1fdaaa046e3bc07a7a44fb61213d686bb7d | [
"MIT"
] | null | null | null | server/yafa/models.py | mrmonkington/yafa | d15ba1fdaaa046e3bc07a7a44fb61213d686bb7d | [
"MIT"
] | 13 | 2016-08-10T19:22:35.000Z | 2021-06-10T18:53:01.000Z | server/yafa/models.py | mrmonkington/yafa | d15ba1fdaaa046e3bc07a7a44fb61213d686bb7d | [
"MIT"
] | 2 | 2016-06-23T09:02:20.000Z | 2021-03-22T11:39:20.000Z | from django.db import models
from taggit.models import TagBase, ItemBase, GenericTaggedItemBase
from taggit.managers import TaggableManager
from treebeard.mp_tree import MP_Node
class Site(models.Model):
slug = models.SlugField(max_length=250, unique=True)
url = models.CharField(max_length=2083)
def __str__(self):
return self.slug
class Zone(models.Model):
slug = models.SlugField(max_length=250, unique=True)
def __str__(self):
return self.slug
class HierarchicalTag (TagBase, MP_Node):
node_order_by = [ 'name' ]
class TaggedAdvert (GenericTaggedItemBase):
tag = models.ForeignKey('HierarchicalTag', related_name='items')
class Advert(models.Model):
name = models.CharField(max_length=250)
image = models.CharField(max_length=2083)
click = models.CharField(max_length=2083)
start_date = models.DateTimeField()
end_date = models.DateTimeField()
active = models.BooleanField(default=True)
site = models.ForeignKey(Site)
zone = models.ForeignKey(Zone)
tags = TaggableManager(through=TaggedAdvert, blank=True)
def __str__(self):
return self.name
| 26.767442 | 68 | 0.731538 | 140 | 1,151 | 5.828571 | 0.392857 | 0.066176 | 0.088235 | 0.117647 | 0.330882 | 0.227941 | 0.198529 | 0.127451 | 0.127451 | 0.127451 | 0 | 0.02199 | 0.170287 | 1,151 | 42 | 69 | 27.404762 | 0.832461 | 0 | 0 | 0.241379 | 0 | 0 | 0.02087 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.103448 | false | 0 | 0.137931 | 0.103448 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
de8c11b8192a86e33e46d72472d047fe6163e81a | 17,523 | py | Python | elemenpy/sm/boson.py | roadnarrows-robotics/elemenpy | bc7d065a1071ce0b3b89b22ce1cb1a6f4b028d20 | [
"MIT"
] | null | null | null | elemenpy/sm/boson.py | roadnarrows-robotics/elemenpy | bc7d065a1071ce0b3b89b22ce1cb1a6f4b028d20 | [
"MIT"
] | null | null | null | elemenpy/sm/boson.py | roadnarrows-robotics/elemenpy | bc7d065a1071ce0b3b89b22ce1cb1a6f4b028d20 | [
"MIT"
] | null | null | null | """
Bosons.
Package:
RoadNarrows elemenpy package.
File:
boson.py
Link:
https://github.com/roadnarrows-robotics/
Copyright:
(c) 2019. RoadNarrows LLC
http://www.roadnarrows.com
All Rights Reserved
License:
MIT
"""
from copy import copy
from enum import Enum
from elemenpy.core.common import (isderivedclass)
from elemenpy.core.format import (Format, default_encoder)
from elemenpy.core.prettyprint import (print2cols)
from elemenpy.sm.standardmodel import (StandardModel as sm, SubatomicParticle)
from elemenpy.sm.spin import (SpinQuantumNumber)
from elemenpy.sm.electriccharge import (ElectricCharge)
from elemenpy.sm.colorcharge import (ColorCharge)
# -----------------------------------------------------------------------------
# Boson Base Class
# -----------------------------------------------------------------------------
class Boson(SubatomicParticle):
""" Boson base class. """
class BosonSubfamily(Enum):
""" Boson subfamily enumeration. """
UNKNOWN = 0
SCALAR = 1 # scalar
VECTOR = 2 # vector
Classification = sm.Classification.BOSON
Family = sm.Family.BOSON
Statistics = sm.Statistics.BOSONIC
Name = 'boson'
Symbol = 'boson'
Subfamily = BosonSubfamily.UNKNOWN
# registered boson subclasses by the @Boson.subclass decorator
Subclasses = {}
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# Class Methods
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@classmethod
def subclass(klass):
"""
Boson subclass decorator to add a subclass to an internal list.
"""
def wrap(D):
"""
Store derived subclass.
Parameters:
D Prospective derived class.
"""
if isderivedclass(D, klass):
klass.Subclasses[D.__name__] = D
return D
return wrap
@classmethod
def finalize_boson_family(klass):
"""
Finalize all registered boson subclass attributes.
Bosons are interdependent.
"""
for qname, qklass in klass.Subclasses.items():
qklass.finalize_boson()
@classmethod
def boson_family(klass):
"""
Get the dictionary of all registered boson subclasses.
Returns:
{qname: qclass, ...}
"""
return klass.Subclasses
@classmethod
def boson_class(klass, qname):
"""
Get the boson subclass.
Parameters:
qname Boson subclass name.
Returns:
qclass
"""
return klass.Subclasses[qname]
@classmethod
def subfamily(klass):
""" Return boson subfamily. """
return klass.Subfamily
@classmethod
def print_boson_properties(klass, indent=0, **print_kwargs):
"""
Print fixed meson particle properties to output stream.
Parameters:
indent Line indentation.
print_kwargs Print control keyword arguments.
"""
klass.print_subatomic_properties(indent=indent, **print_kwargs)
#print(f"{'':<{indent+2}}Boson", **print_kwargs)
print2cols([
('Subfamily', klass.Subfamily.name),],
c1width=16, indent=indent, **print_kwargs)
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# Class Instance Methods
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
def __init__(self):
""" Boson initializer. """
SubatomicParticle.__init__(self)
def __repr__(self):
return f"{self.__module__}.{self.__class__.__name__}"\
f"()"
def __str__(self):
return self.name
@property
def subfamily(self):
""" Return boson subfamily. """
return self.Subfamily
def print_state(self, indent=0, **print_kwargs):
"""
Print boson state to output stream using default encoder.
Parameters:
indent Line indentation.
print_kwargs Print control keyword arguments.
"""
SubatomicParticle.print_state(self, indent=indent, **print_kwargs)
# -----------------------------------------------------------------------------
# Photon Class
# -----------------------------------------------------------------------------
@Boson.subclass()
class Photon(Boson):
""" Photon class. """
#
# Class Fixed Properties
#
Pid = sm.ParticleId.PHOTON
Name = "photon"
Symbol = default_encoder('$sm(gamma)')
RestMass = 0.0
ElecCharge = ElectricCharge(0)
QSpin = SpinQuantumNumber(1) # intrinsic spin number
Subfamily = Boson.BosonSubfamily.VECTOR
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# Class Methods
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@classmethod
def finalize_boson(klass):
"""
Finalize boson's class attibutes.
Finalization can only proceed when all boson classes have been
defined due to interdependencies.
"""
klass.AntiParticle = klass.boson_class('Photon')
@classmethod
def print_properties(klass, indent=0, **print_kwargs):
klass.print_boson_properties(indent=indent, **print_kwargs)
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# Class Instance Methods
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
def __init__(self):
""" Photon initializer. """
Boson.__init__(self)
def __repr__(self):
return f"{self.__module__}.{self.__class__.__name__}"\
f"()"
def __str__(self):
return self.Name
def print_state(self, indent=0, **print_kwargs):
"""
Print photon state to output stream using default encoder.
Parameters:
indent Line indentation.
print_kwargs Print control keyword arguments.
"""
Boson.print_state(self, indent=indent, **print_kwargs)
# -----------------------------------------------------------------------------
# WBosonN Class
# -----------------------------------------------------------------------------
@Boson.subclass()
class WBosonN(Boson):
""" WBosonN class. """
#
# Class Fixed Properties
#
Pid = sm.ParticleId.W_BOSON_N
Name = "W-boson-"
Symbol = default_encoder('$sm(W-)')
RestMass = 80.385e3
ElecCharge = ElectricCharge(-1)
QSpin = SpinQuantumNumber(1) # intrinsic spin number
Subfamily = Boson.BosonSubfamily.VECTOR
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# Class Methods
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@classmethod
def finalize_boson(klass):
"""
Finalize boson's class attibutes.
Finalization can only proceed when all boson classes have been
defined due to interdependencies.
"""
klass.AntiParticle = klass.boson_class('WBosonP')
@classmethod
def print_properties(klass, indent=0, **print_kwargs):
klass.print_boson_properties(indent=indent, **print_kwargs)
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# Class Instance Methods
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
def __init__(self):
""" W- boson initializer. """
Boson.__init__(self)
def __repr__(self):
return f"{self.__module__}.{self.__class__.__name__}"\
f"()"
def __str__(self):
return self.Name
def print_state(self, indent=0, **print_kwargs):
"""
Print W- boson state to output stream using default encoder.
Parameters:
indent Line indentation.
print_kwargs Print control keyword arguments.
"""
Boson.print_state(self, indent=indent, **print_kwargs)
# -----------------------------------------------------------------------------
# WBosonP Class
# -----------------------------------------------------------------------------
@Boson.subclass()
class WBosonP(Boson):
""" WBosonP class. """
#
# Class Fixed Properties
#
Pid = sm.ParticleId.W_BOSON_P
Name = "W-boson+"
Symbol = default_encoder('$sm(W+)')
RestMass = 80.385e3
ElecCharge = ElectricCharge(1)
QSpin = SpinQuantumNumber(1) # intrinsic spin number
Subfamily = Boson.BosonSubfamily.VECTOR
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# Class Methods
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@classmethod
def finalize_boson(klass):
"""
Finalize boson's class attibutes.
Finalization can only proceed when all boson classes have been
defined due to interdependencies.
"""
klass.AntiParticle = klass.boson_class('WBosonN')
@classmethod
def print_properties(klass, indent=0, **print_kwargs):
klass.print_boson_properties(indent=indent, **print_kwargs)
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# Class Instance Methods
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
def __init__(self):
""" W+ boson initializer. """
Boson.__init__(self)
def __repr__(self):
return f"{self.__module__}.{self.__class__.__name__}"\
f"()"
def __str__(self):
return self.Name
def print_state(self, indent=0, **print_kwargs):
"""
Print W+ boson state to output stream using default encoder.
Parameters:
indent Line indentation.
print_kwargs Print control keyword arguments.
"""
Boson.print_state(self, indent=indent, **print_kwargs)
# -----------------------------------------------------------------------------
# ZBoson Class
# -----------------------------------------------------------------------------
@Boson.subclass()
class ZBoson(Boson):
""" ZBoson class. """
#
# Class Fixed Properties
#
Pid = sm.ParticleId.Z_BOSON
Name = "Z-boson"
Symbol = default_encoder('$sm(Z)')
RestMass = 91.1875e3
ElecCharge = ElectricCharge(0)
QSpin = SpinQuantumNumber(1) # intrinsic spin number
Subfamily = Boson.BosonSubfamily.VECTOR
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# Class Methods
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@classmethod
def finalize_boson(klass):
"""
Finalize boson's class attibutes.
Finalization can only proceed when all boson classes have been
defined due to interdependencies.
"""
klass.AntiParticle = klass.boson_class('ZBoson')
@classmethod
def print_properties(klass, indent=0, **print_kwargs):
klass.print_boson_properties(indent=indent, **print_kwargs)
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# Class Instance Methods
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
def __init__(self):
""" Z boson initializer. """
Boson.__init__(self)
def __repr__(self):
return f"{self.__module__}.{self.__class__.__name__}"\
f"()"
def __str__(self):
return self.Name
def print_state(self, indent=0, **print_kwargs):
"""
Print Z boson state to output stream using default encoder.
Parameters:
indent Line indentation.
print_kwargs Print control keyword arguments.
"""
Boson.print_state(self, indent=indent, **print_kwargs)
# -----------------------------------------------------------------------------
# Gluon Class
# -----------------------------------------------------------------------------
@Boson.subclass()
class Gluon(Boson):
""" Gluon class. """
#
# Class Fixed Properties
#
Pid = sm.ParticleId.GLUON
Name = "gluon"
Symbol = default_encoder('$sm(g)')
RestMass = 0.0
ElecCharge = ElectricCharge(0)
QSpin = SpinQuantumNumber(1) # intrinsic spin number
Subfamily = Boson.BosonSubfamily.VECTOR
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# Class Methods
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@classmethod
def finalize_boson(klass):
"""
Finalize boson's class attibutes.
Finalization can only proceed when all boson classes have been
defined due to interdependencies.
"""
klass.AntiParticle = klass.boson_class('Gluon')
@classmethod
def print_properties(klass, indent=0, **print_kwargs):
klass.print_boson_properties(indent=indent, **print_kwargs)
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# Class Instance Methods
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
def __init__(self, color, anticolor):
"""
Gluon initializer.
Parameters:
color Primary color charge.
anticolor Anticolor charge.
"""
Boson.__init__(self)
self._color_charge = ColorCharge(color)
self._anticolor_charge = ColorCharge(anticolor)
if not self.color_charge.is_primary_color():
raise ValueError(
f"{self.name} '{self.color_charge.name}' is not a primary color")
if not self.anticolor_charge.is_anticolor():
raise ValueError(
f"{self.name} '{self.anticolor_charge.name}' is not an anticolor")
if self.color_charge == self.anticolor_charge.complement:
raise ValueError(f"{self.name} " +
f"'{self.color_charge.name}-{self.anticolor_charge.name}' " +
"defines a meson")
def __repr__(self):
return f"{self.__module__}.{self.__class__.__name__}"\
f"{self.color_charge!r}, {self.anticolor_charge!r})"
def __str__(self):
return self.fqname
def __eq__(self, gluon):
"""
Equal to. self == gluon.
Two gluons are considered equal if they are of the same kind.
That is, gluons with the same color charges.
"""
return self.color_charge == gluon.color_charge and \
self.anticolor_charge == gluon.anticolor_charge
def __ne__(self, gluon):
"""
Not equal to. self != gluon.
Two gluons are considered not equal if they are not of the same kind.
That is, gluons that do not have the same color charges.
"""
return self.color_charge != gluon.color_charge or \
self.anticolor_charge != gluon.anticolor_charge
@property
def fqname(self):
return f"{self.color_charge.name}-{self.anticolor_charge.name} {self.name}"
@property
def color_charge(self):
""" Return primary color charge. """
return self._color_charge
@property
def anticolor_charge(self):
""" Return anticolor charge. """
return self._anticolor_charge
def print_state(self, indent=0, **print_kwargs):
"""
Print gluon state to output stream using default encoder.
Parameters:
indent Line indentation.
print_kwargs Print control keyword arguments.
"""
Boson.print_state(self, indent=indent, **print_kwargs)
print2cols([
('FQ Name', self.fqname),
('Color Charge',
f"{self.color_charge.symbol} {self.color_charge.name}"),
('Anticolor Charge',
f"{self.anticolor_charge.symbol} {self.anticolor_charge.name}"),],
indent=indent, **print_kwargs)
# -----------------------------------------------------------------------------
# HiggsBoson Class
# -----------------------------------------------------------------------------
@Boson.subclass()
class HiggsBoson(Boson):
""" HiggsBoson class. """
#
# Class Fixed Properties
#
Pid = sm.ParticleId.HIGGS_BOSON
Name = "higgs-boson"
Symbol = default_encoder('$sm(H0)')
RestMass = 125.09e3
ElecCharge = ElectricCharge(0)
QSpin = SpinQuantumNumber(0)
Subfamily = Boson.BosonSubfamily.SCALAR
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# Class Methods
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@classmethod
def finalize_boson(klass):
"""
Finalize boson's class attibutes.
Finalization can only proceed when all boson classes have been
defined due to interdependencies.
"""
klass.AntiParticle = klass.boson_class('HiggsBoson')
@classmethod
def print_properties(klass, indent=0, **print_kwargs):
klass.print_boson_properties(indent=indent, **print_kwargs)
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# Class Instance Methods
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
def __init__(self):
""" Higgs boson initializer. """
Boson.__init__(self)
def __repr__(self):
return f"{self.__module__}.{self.__class__.__name__}"\
f"()"
def __str__(self):
return self.Name
def print_state(self, indent=0, **print_kwargs):
"""
Print Higgs boson state to output stream using default encoder.
Parameters:
indent Line indentation.
print_kwargs Print control keyword arguments.
"""
Boson.print_state(self, indent=indent, **print_kwargs)
# -----------------------------------------------------------------------------
# On module load execution
# -----------------------------------------------------------------------------
Boson.finalize_boson_family()
# -----------------------------------------------------------------------------
# Unit tests
# -----------------------------------------------------------------------------
if __name__ == "__main__":
import sys
import tests.utboson as ut
sys.exit(ut.utmain())
| 29.011589 | 79 | 0.523997 | 1,579 | 17,523 | 5.58708 | 0.130462 | 0.048628 | 0.030832 | 0.041714 | 0.628769 | 0.604171 | 0.585241 | 0.557243 | 0.548628 | 0.519383 | 0 | 0.005326 | 0.250014 | 17,523 | 603 | 80 | 29.059701 | 0.665956 | 0.441077 | 0 | 0.516529 | 0 | 0 | 0.103353 | 0.068717 | 0 | 0 | 0 | 0 | 0 | 1 | 0.219008 | false | 0 | 0.045455 | 0.061983 | 0.603306 | 0.136364 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
de8efc4f3d40f7524f3c86bcb0019e3882724167 | 1,074 | py | Python | learnPythonTheHardWay/src/ex_05.py | pparacch/PlayingWithPython | 9fe75551cae6aeac8730b922a06ff0be85634f4d | [
"MIT"
] | null | null | null | learnPythonTheHardWay/src/ex_05.py | pparacch/PlayingWithPython | 9fe75551cae6aeac8730b922a06ff0be85634f4d | [
"MIT"
] | null | null | null | learnPythonTheHardWay/src/ex_05.py | pparacch/PlayingWithPython | 9fe75551cae6aeac8730b922a06ff0be85634f4d | [
"MIT"
] | null | null | null | #Still playing with Variables & Printing
#Python version 2.7.4
#Introducing a "format string"
#How to make string that have variables embedded in them.
# "This is a string with %d %s" % (3, "words")
# These are formatters
# %d - integer
# %s - string
# %r - whatever in raw format
my_name = "Pier Lorenzo Paracchini"
my_age = 43
my_height = 168 #cm
my_weight = 70 #kg
my_eyes = "Brown & Green"
my_teeth = "White"
my_hair = "Brown"
print "Let's tals about %s." % my_name
print "He is %d cm tall." % my_height
print "He is %d kg heavy." % my_weight
print "Actually that's not too heavy."
print "He has got %s eyes and %s hair." % (my_eyes, my_hair)
print "His teeth are usually %s depending on the coffee." % my_teeth
#this line is tricky, watch out!
print "If I add %d, %d, and %d I get %d." % (my_age, my_height, my_weight, my_age + my_height + my_weight)
print "In the next line we will use just %r to enter the variables using a 'format string'"
print "%r, if I add %r, %r, and %r I get %r." % (my_name, my_age, my_height, my_weight, my_age + my_height + my_weight)
| 32.545455 | 119 | 0.689944 | 200 | 1,074 | 3.575 | 0.44 | 0.067133 | 0.039161 | 0.072727 | 0.117483 | 0.117483 | 0.117483 | 0.117483 | 0.117483 | 0.117483 | 0 | 0.012658 | 0.190875 | 1,074 | 32 | 120 | 33.5625 | 0.810127 | 0.277467 | 0 | 0 | 0 | 0 | 0.477064 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.5625 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
dea4c30178e007ad230ee90b20fdca42068382f0 | 122 | py | Python | supplier/apps.py | 96tm/warehouse-management-test | 61b134a05d5a37d6bfbec061d7673eebaeeb9676 | [
"MIT"
] | 1 | 2022-02-19T03:21:39.000Z | 2022-02-19T03:21:39.000Z | supplier/apps.py | 96tm/warehouse-management-test | 61b134a05d5a37d6bfbec061d7673eebaeeb9676 | [
"MIT"
] | 22 | 2020-01-30T12:45:23.000Z | 2022-03-12T00:42:00.000Z | supplier/apps.py | 96tm/warehouse-management-test | 61b134a05d5a37d6bfbec061d7673eebaeeb9676 | [
"MIT"
] | 12 | 2020-01-23T06:48:18.000Z | 2020-03-06T07:09:16.000Z | from django.apps import AppConfig
class SupplierConfig(AppConfig):
name = 'supplier'
verbose_name = 'Поставщик'
| 17.428571 | 33 | 0.737705 | 13 | 122 | 6.846154 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.180328 | 122 | 6 | 34 | 20.333333 | 0.89 | 0 | 0 | 0 | 0 | 0 | 0.139344 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
dec63eab4430ad79d3ca1a971022ecc17121348f | 3,764 | py | Python | backend/src/routers/auth.py | Workata/photo-album | 48f6d22b0af940168eb0145d0a77294c082cd661 | [
"MIT"
] | null | null | null | backend/src/routers/auth.py | Workata/photo-album | 48f6d22b0af940168eb0145d0a77294c082cd661 | [
"MIT"
] | 18 | 2022-02-28T15:08:09.000Z | 2022-03-26T19:53:11.000Z | backend/src/routers/auth.py | Workata/photo-album | 48f6d22b0af940168eb0145d0a77294c082cd661 | [
"MIT"
] | null | null | null | """
TODO docstring
"""
import os
from datetime import timedelta, datetime
from typing import Optional
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
from fastapi import APIRouter, Depends, HTTPException, status
from tinydb import TinyDB, where
from passlib.hash import bcrypt
from jose import JWTError, jwt
from dotenv import load_dotenv
import requests
load_dotenv()
USERS_DB_PATH = "./data/DB/users.json"
USERS_DB = TinyDB(USERS_DB_PATH)
# ! using HS256 the secret key should be
# ! at least 32 chars but the longer the better (base64url-encode)
SECRET_KEY = os.getenv('SECRET_KEY_LOGIN_TOKEN')
ALGORITHM = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES = 1440 # 60x24 = 1day ,30
router = APIRouter(prefix="/api/auth", tags=["auth"])
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/api/auth/login")
async def get_current_user(token: str = Depends(oauth2_scheme)):
"""
TODO function docstring
"""
credentials_exception = HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Could not validate credentials",
headers={"WWW-Authenticate": "Bearer"},
)
try:
payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
username = payload.get("username")
if username is None:
raise credentials_exception
except JWTError as jwt_error:
raise credentials_exception from jwt_error
users = USERS_DB.search(where('username') == username)
if not users:
raise credentials_exception
return users[0]
def create_access_token(data: dict, expires_delta: Optional[timedelta] = None):
"""
TODO function docstring
"""
to_encode = data.copy()
if expires_delta:
expire = datetime.utcnow() + expires_delta
else:
expire = datetime.utcnow() + timedelta(minutes=15)
to_encode.update({"exp": expire})
encoded_jwt = jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM)
return encoded_jwt
def validate_human(recaptcha_value: str):
"""
TODO function docstring
"""
secret_recaptcha_token = os.getenv('SECRET_KEY_GOOGLE_RECAPTCHA')
response = requests.post("https://www.google.com/recaptcha/api/" +
f"siteverify?secret={secret_recaptcha_token}&response={recaptcha_value}")
data = response.json()
return data["success"]
@router.post("/login")
async def generate_token(form_data: OAuth2PasswordRequestForm = Depends()):
"""
TODO function docstring
"""
# * validate ReCaptcha
if not validate_human(form_data.scopes[0]):
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="BOT",
headers={"WWW-Authenticate": "Bearer"},
)
users_list = USERS_DB.search(where('username') == form_data.username)
if not users_list:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Incorrect username or password!",
headers={"WWW-Authenticate": "Bearer"},
)
user_dict = users_list[0] # should be only one user with this username
if not bcrypt.verify(form_data.password, user_dict['hashed_password']):
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Incorrect username or password!",
headers={"WWW-Authenticate": "Bearer"},
)
access_token_expires = timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES)
access_token = create_access_token(
data={"username": user_dict["username"]}, expires_delta=access_token_expires
)
return {"access_token": access_token, "token_type": "bearer"}
| 33.90991 | 85 | 0.67508 | 426 | 3,764 | 5.760563 | 0.333333 | 0.040342 | 0.03423 | 0.04727 | 0.160147 | 0.138957 | 0.138957 | 0.138957 | 0.116952 | 0.09291 | 0 | 0.015084 | 0.225027 | 3,764 | 110 | 86 | 34.218182 | 0.826191 | 0.065887 | 0 | 0.194805 | 0 | 0 | 0.149299 | 0.035954 | 0 | 0 | 0 | 0.045455 | 0 | 1 | 0.025974 | false | 0.090909 | 0.12987 | 0 | 0.207792 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
ded1c686d27be38d4e7e8fc39f4f1c3ecbf40573 | 186 | py | Python | py/codewars/pile_of_cubes.py | takemyoxygen/playground | 7ce8928dd2c22d4ff8ce315e77a5fb43cd7ef2e6 | [
"MIT"
] | null | null | null | py/codewars/pile_of_cubes.py | takemyoxygen/playground | 7ce8928dd2c22d4ff8ce315e77a5fb43cd7ef2e6 | [
"MIT"
] | 12 | 2020-07-17T11:11:11.000Z | 2022-02-27T14:43:42.000Z | py/codewars/pile_of_cubes.py | takemyoxygen/playground | 7ce8928dd2c22d4ff8ce315e77a5fb43cd7ef2e6 | [
"MIT"
] | null | null | null | import itertools
def find_nb(m):
sum = 0
for i in itertools.count(1):
sum += i ** 3
if sum == m:
return i
elif sum > m:
return -1 | 18.6 | 32 | 0.451613 | 27 | 186 | 3.074074 | 0.62963 | 0.096386 | 0.240964 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039216 | 0.451613 | 186 | 10 | 33 | 18.6 | 0.77451 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.111111 | 0 | 0.444444 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ded8ac96c91f6f13a2c652945efb44f9784b8298 | 4,686 | py | Python | TygerCaddy/proxies/views.py | jlesage/TygerCaddy | 7db12c6525fba261110a0da0315bac731bbfc121 | [
"MIT"
] | 2 | 2022-01-07T23:06:34.000Z | 2022-01-27T18:20:05.000Z | TygerCaddy/proxies/views.py | jlesage/TygerCaddy | 7db12c6525fba261110a0da0315bac731bbfc121 | [
"MIT"
] | null | null | null | TygerCaddy/proxies/views.py | jlesage/TygerCaddy | 7db12c6525fba261110a0da0315bac731bbfc121 | [
"MIT"
] | null | null | null | from django.views.generic import CreateView, ListView, UpdateView, DeleteView, DetailView
from django.shortcuts import redirect
from django.http import HttpResponseRedirect
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from hosts.caddyfile import generate_caddyfile
from .models import Proxy, Header
class CreateProxy(LoginRequiredMixin, CreateView):
template_name = 'proxies/add_proxy.html'
model = Proxy
success_url = '/proxies/list'
fields = ['name',
'proxy_from',
'proxy_to',
'load_policy',
'fail_timeout',
'max_fails',
'max_conns',
'try_duration',
'try_interval',
'health_check',
'health_check_port',
'health_check_interval',
'health_check_timeout',
'keep_alive',
'timeout',
'without',
'exceptions',
'insecure_skip_verify',
'websocket',
'transparent']
def form_valid(self, form):
form.save()
generate_caddyfile()
return redirect(reverse_lazy('all-proxies'))
class ListProxies(LoginRequiredMixin, ListView):
template_name = 'proxies/all_proxies.html'
context_object_name = 'proxies'
queryset = Proxy.objects.order_by('id')
paginate_by = 10
title = 'All Proxies'
class DetailProxy(LoginRequiredMixin, DetailView):
template_name = 'proxies/proxy_detail.html'
title = 'Proxy Detail'
model = Proxy
class UpdateProxy(LoginRequiredMixin, UpdateView):
model = Proxy
fields = ['name',
'proxy_from',
'proxy_to',
'load_policy',
'fail_timeout',
'max_fails',
'max_conns',
'try_duration',
'try_interval',
'health_check',
'health_check_port',
'health_check_interval',
'health_check_timeout',
'keep_alive',
'timeout',
'without',
'exceptions',
'insecure_skip_verify',
'websocket',
'transparent']
slug_field = 'name'
success_url = reverse_lazy('all-proxies')
def form_valid(self, form):
form.save()
generate_caddyfile()
return redirect(reverse_lazy('all-proxies'))
class DeleteProxy(LoginRequiredMixin, DeleteView):
model = Proxy
title = "Delete Proxy"
success_url = reverse_lazy('all-proxies')
def delete(self, request, *args, **kwargs):
"""
Calls the delete() method on the fetched object and then
redirects to the success URL.
"""
self.object = self.get_object()
self.object.delete()
generate_caddyfile()
return HttpResponseRedirect(self.get_success_url())
class CreateHeader(LoginRequiredMixin, CreateView):
template_name = 'proxies/headers/add_header.html'
model = Header
success_url = '/proxies/headers/list'
fields = ['header',
'upstream',
'downstream',
'value',
'proxy']
def form_valid(self, form):
form.save()
generate_caddyfile()
return redirect(reverse_lazy('all-headers'))
class ListHeaders(LoginRequiredMixin, ListView):
template_name = 'proxies/headers/all_headers.html'
context_object_name = 'headers'
queryset = Header.objects.order_by('id')
paginate_by = 10
title = 'All Headers'
class DetailHeader(LoginRequiredMixin, DetailView):
template_name = 'proxies/headers/header_detail.html'
title = 'Header Detail'
model = Proxy
class UpdateHeader(LoginRequiredMixin, UpdateView):
model = Header
fields = ['header',
'upstream',
'downstream',
'value',
'proxy']
slug_field = 'header'
success_url = reverse_lazy('all-headers')
def form_valid(self, form):
form.save()
return redirect(reverse_lazy('all-headers'))
class DeleteHeader(LoginRequiredMixin, DeleteView):
model = Header
title = "Delete Header"
template_name = 'proxies/headers/header_confirm_delete.html'
success_url = reverse_lazy('all-headers')
def delete(self, request, *args, **kwargs):
"""
Calls the delete() method on the fetched object and then
redirects to the success URL.
"""
self.object = self.get_object()
self.object.delete()
generate_caddyfile()
return HttpResponseRedirect(self.get_success_url())
| 28.05988 | 89 | 0.603286 | 452 | 4,686 | 6.050885 | 0.24115 | 0.036563 | 0.040951 | 0.0234 | 0.642048 | 0.523949 | 0.494698 | 0.42011 | 0.42011 | 0.393784 | 0 | 0.001213 | 0.296201 | 4,686 | 166 | 90 | 28.228916 | 0.828078 | 0.036918 | 0 | 0.700787 | 0 | 0 | 0.21618 | 0.061348 | 0 | 0 | 0 | 0 | 0 | 1 | 0.047244 | false | 0 | 0.055118 | 0 | 0.535433 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
deef1063572f97f31fdf99a00d70750f8f121930 | 608 | py | Python | Python Exercises/Mundo1/exercicio29.py | joaopblume/Curso-em-video-exercicios | d554c0c07c8d65b3a219d76fc487a78c11eaf874 | [
"MIT"
] | null | null | null | Python Exercises/Mundo1/exercicio29.py | joaopblume/Curso-em-video-exercicios | d554c0c07c8d65b3a219d76fc487a78c11eaf874 | [
"MIT"
] | null | null | null | Python Exercises/Mundo1/exercicio29.py | joaopblume/Curso-em-video-exercicios | d554c0c07c8d65b3a219d76fc487a78c11eaf874 | [
"MIT"
] | null | null | null | # Escreva um programa que leia a velocidade de um carro.
# Se ele ultrapassar 80km/h, mostre uma mensagem dizendo que ele foi multado.
# A multa vai custar R$7,00 para cada km acima do limite.
radar = 'Radar eletrônico!'
print('-' * len(radar))
print(radar)
print('-' * len(radar))
velocidade = int(input('Velocidade do carro: '))
if velocidade > 80:
multa = float((velocidade - 80) * 7)
print(f'Velocidade = {velocidade}km/h.')
print(f'Você ultrapassou o limite de 80km/h, sua multa será de R${multa:.2f}!')
else:
print(f'Velocidade = {velocidade}km/h.')
print(f'Faça uma boa viagem!')
| 35.764706 | 83 | 0.684211 | 96 | 608 | 4.333333 | 0.541667 | 0.057692 | 0.0625 | 0.125 | 0.168269 | 0.168269 | 0.168269 | 0.168269 | 0 | 0 | 0 | 0.025948 | 0.175987 | 608 | 16 | 84 | 38 | 0.804391 | 0.305921 | 0 | 0.333333 | 0 | 0 | 0.452153 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.083333 | 0 | 0 | 0 | 0.583333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 2 |
720ea58cbcbd6d4e1eb702cbe25bd84a05ce1bb0 | 2,347 | py | Python | sentiment analysis/polarity.py | Jicol95/Sentiment-Analysis | adf5e5bce840a47e175b0513b703901b3c66ba8f | [
"MIT"
] | null | null | null | sentiment analysis/polarity.py | Jicol95/Sentiment-Analysis | adf5e5bce840a47e175b0513b703901b3c66ba8f | [
"MIT"
] | null | null | null | sentiment analysis/polarity.py | Jicol95/Sentiment-Analysis | adf5e5bce840a47e175b0513b703901b3c66ba8f | [
"MIT"
] | null | null | null | from textblob import TextBlob
def polarity(phrases, basal_sentiment_dictionary, basal_determiner_bank):
frazes = []
# For each phrase in the parsed text
phrase_counter = 0
for j in range(0,len(phrases)):
phrase = phrases[j]
phrase_counter +=1
words_to_symbols = []
words_to_symbols.append(phrase[0])
Effect = False
# Iterate through the words in a phrase
for i in range(1,len(phrase)):
# If our knowledge base has the word's sentiment
word = phrase[i]
if word in basal_sentiment_dictionary and len(word) > 1:
# Print the sentiment
if basal_sentiment_dictionary[word] == 'N':
word = 0
elif basal_sentiment_dictionary[word] == '+':
word = 1
elif basal_sentiment_dictionary[word] == '-':
word = -1
# If the the phrase is a known determiner
elif word in basal_determiner_bank:
word = 0
# print('N')
# Neutralize everything before but
elif word == 'but¬':
word = 0
for k in range(0, j):
for l in range(1, len(frazes[k])):
frazes[k][l] = 0
elif '¬' == word[-1] and word[:-1] in basal_sentiment_dictionary and len(word) > 1:
if basal_sentiment_dictionary[word[:-1]] == 'N':
word = 0
elif basal_sentiment_dictionary[word[:-1]] == '+':
word = 1
elif basal_sentiment_dictionary[word[:-1]] == '-':
word = -1
elif '<¬>' in word and word[:-4] in basal_sentiment_dictionary:
if basal_sentiment_dictionary[word.replace(' <¬>', '').strip()] == 'N':
word = 0
elif basal_sentiment_dictionary[word.replace(' <¬>', '').strip()] == '+':
word = -1
elif basal_sentiment_dictionary[word.replace(' <¬>', '').strip()] == '-':
word = 1
else:
word = 0
words_to_symbols.append(word)
frazes.append(words_to_symbols)
# print([word])
phrase_counter += 1
return frazes
| 36.107692 | 95 | 0.494674 | 257 | 2,347 | 4.381323 | 0.233463 | 0.161634 | 0.277087 | 0.223801 | 0.399645 | 0.343694 | 0.343694 | 0.269982 | 0.159858 | 0.08881 | 0 | 0.020466 | 0.396251 | 2,347 | 64 | 96 | 36.671875 | 0.769936 | 0.10098 | 0 | 0.304348 | 0 | 0 | 0.013803 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.021739 | false | 0 | 0.021739 | 0 | 0.065217 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
7211c25a1ab6d92b110ca01a7fde57352b752eb7 | 185 | py | Python | ex111/teste111.py | LucasIdalino/Exerc-cios-do-Curso | 4ca4610d1acfe4672c20114f891b6aabae816049 | [
"MIT"
] | null | null | null | ex111/teste111.py | LucasIdalino/Exerc-cios-do-Curso | 4ca4610d1acfe4672c20114f891b6aabae816049 | [
"MIT"
] | null | null | null | ex111/teste111.py | LucasIdalino/Exerc-cios-do-Curso | 4ca4610d1acfe4672c20114f891b6aabae816049 | [
"MIT"
] | null | null | null | from Pythonexercicios.ex111.UtilidadesCeV import moeda
p = float(input('Digite um valor: '))
moeda.resumo(p, taxa=int(input('Aumento: ')),
taxar=int(input('Redução: ')))
| 26.428571 | 54 | 0.67027 | 23 | 185 | 5.391304 | 0.782609 | 0.129032 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019355 | 0.162162 | 185 | 6 | 55 | 30.833333 | 0.780645 | 0 | 0 | 0 | 0 | 0 | 0.189189 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
7212cb9b1a30b5351614f525b939e06663c708a8 | 108 | py | Python | python_little_things/entrada.py | nachom12/my_portfolio | 7e4ebc240bfcfa1207f8efb9c88840eeed99ef4c | [
"MIT"
] | null | null | null | python_little_things/entrada.py | nachom12/my_portfolio | 7e4ebc240bfcfa1207f8efb9c88840eeed99ef4c | [
"MIT"
] | null | null | null | python_little_things/entrada.py | nachom12/my_portfolio | 7e4ebc240bfcfa1207f8efb9c88840eeed99ef4c | [
"MIT"
] | null | null | null | minombre = "NaCho"
minombre = minombre.lower()
print (minombre)
for i in range(100):
print(i)
break
| 15.428571 | 27 | 0.666667 | 15 | 108 | 4.8 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034884 | 0.203704 | 108 | 6 | 28 | 18 | 0.802326 | 0 | 0 | 0 | 0 | 0 | 0.046296 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
721a24e207050ad23d985faff25ae57bc5c70cb8 | 689 | py | Python | challenges/towers-of-hanoi/test_towers_of_hanoi.py | katcosgrove/data-structures-and-algorithms | 8683268183e79c6abeeb58187101cb140c65568d | [
"MIT"
] | 1 | 2021-04-02T12:12:20.000Z | 2021-04-02T12:12:20.000Z | challenges/towers-of-hanoi/test_towers_of_hanoi.py | katcosgrove/data-structures-and-algorithms | 8683268183e79c6abeeb58187101cb140c65568d | [
"MIT"
] | 2 | 2018-03-21T17:34:34.000Z | 2018-03-26T16:46:07.000Z | challenges/towers-of-hanoi/test_towers_of_hanoi.py | katcosgrove/data-structures-and-algorithms | 8683268183e79c6abeeb58187101cb140c65568d | [
"MIT"
] | 2 | 2018-08-29T18:59:59.000Z | 2019-04-12T21:16:14.000Z | import towers_of_hanoi as towers
import pytest
def test_tower_exception_type():
"""Test TypeError in tower function."""
with pytest.raises(TypeError):
towers.towers_of_hanoi('n')
def test_tower_return_three():
"""Test tower of hanoi function returns correct last move with three."""
temp = towers.towers_of_hanoi(3)
assert temp == ['move disk from A to C']
def test_tower_return_two():
"""Test tower of hanoi function returns correct last move with two."""
temp = towers.towers_of_hanoi(2)
assert temp == ['move disk from A to C']
def test_tower_with_zero():
temp = towers.towers_of_hanoi(1)
assert temp == ['move disk from A to C']
| 26.5 | 76 | 0.698113 | 106 | 689 | 4.330189 | 0.330189 | 0.106754 | 0.141612 | 0.165577 | 0.590414 | 0.440087 | 0.440087 | 0.440087 | 0.383442 | 0.383442 | 0 | 0.005425 | 0.197388 | 689 | 25 | 77 | 27.56 | 0.824593 | 0.239478 | 0 | 0.214286 | 0 | 0 | 0.125984 | 0 | 0 | 0 | 0 | 0 | 0.214286 | 1 | 0.285714 | false | 0 | 0.142857 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
722641694a9270052545edd87c8dff5c36fd9128 | 96 | py | Python | libdev/__init__.py | kosyachniy/lib | 4174eb7b91b2c5908b47b353cc55cc617b74799f | [
"MIT"
] | null | null | null | libdev/__init__.py | kosyachniy/lib | 4174eb7b91b2c5908b47b353cc55cc617b74799f | [
"MIT"
] | null | null | null | libdev/__init__.py | kosyachniy/lib | 4174eb7b91b2c5908b47b353cc55cc617b74799f | [
"MIT"
] | null | null | null | """
Initializing the Python package
"""
__version__ = '0.31'
__all__ = (
'__version__',
)
| 9.6 | 31 | 0.625 | 9 | 96 | 5.333333 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039474 | 0.208333 | 96 | 9 | 32 | 10.666667 | 0.592105 | 0.322917 | 0 | 0 | 0 | 0 | 0.263158 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
72334bd85749154e3539f483cc30d6e3095ace44 | 328 | py | Python | src/sima/riflex/stiffnesstype.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | src/sima/riflex/stiffnesstype.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | src/sima/riflex/stiffnesstype.py | SINTEF/simapy | 650b8c2f15503dad98e2bfc0d0788509593822c7 | [
"MIT"
] | null | null | null | # Generated with StiffnessType
#
from enum import Enum
from enum import auto
class StiffnessType(Enum):
""""""
LINEAR = auto()
NON_LINEAR = auto()
def label(self):
if self == StiffnessType.LINEAR:
return "Linear"
if self == StiffnessType.NON_LINEAR:
return "Non linear" | 21.866667 | 44 | 0.612805 | 36 | 328 | 5.527778 | 0.416667 | 0.135678 | 0.140704 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.289634 | 328 | 15 | 45 | 21.866667 | 0.854077 | 0.085366 | 0 | 0 | 1 | 0 | 0.054983 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.2 | 0 | 0.8 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
72498d8fb5a6b0a0736edc10c05021df389dc42a | 1,065 | py | Python | output/models/ms_data/particles/particles_fa002_xsd/particles_fa002.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/ms_data/particles/particles_fa002_xsd/particles_fa002.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/ms_data/particles/particles_fa002_xsd/particles_fa002.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from dataclasses import dataclass, field
from typing import Optional
__NAMESPACE__ = "http://xsdtesting"
@dataclass
class A:
a: Optional[object] = field(
default=None,
metadata={
"type": "Element",
"namespace": "http://xsdtesting",
}
)
@dataclass
class B:
b: Optional[object] = field(
default=None,
metadata={
"type": "Element",
"namespace": "http://xsdtesting",
}
)
@dataclass
class Base:
"""
documentation documentation.
"""
class Meta:
name = "base"
e1: Optional[A] = field(
default=None,
metadata={
"type": "Element",
"namespace": "http://xsdtesting",
"required": True,
}
)
e2: Optional[object] = field(
default=None,
metadata={
"type": "Element",
"namespace": "http://xsdtesting",
}
)
@dataclass
class Doc(Base):
class Meta:
name = "doc"
namespace = "http://xsdtesting"
| 18.050847 | 45 | 0.505164 | 88 | 1,065 | 6.068182 | 0.318182 | 0.146067 | 0.258427 | 0.2397 | 0.661049 | 0.59176 | 0.59176 | 0.59176 | 0.59176 | 0.483146 | 0 | 0.002924 | 0.357746 | 1,065 | 58 | 46 | 18.362069 | 0.777778 | 0.026291 | 0 | 0.488889 | 0 | 0 | 0.192948 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.044444 | 0 | 0.266667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
724a62bf065e3a35f03462c5e0c423957afcfe36 | 360 | py | Python | app/admin.py | marcmelchor/crawl-google-playsotre-reviews | a4db1acd6d552583592d0eb640c4dd17cc8eb4ef | [
"Apache-2.0"
] | null | null | null | app/admin.py | marcmelchor/crawl-google-playsotre-reviews | a4db1acd6d552583592d0eb640c4dd17cc8eb4ef | [
"Apache-2.0"
] | null | null | null | app/admin.py | marcmelchor/crawl-google-playsotre-reviews | a4db1acd6d552583592d0eb640c4dd17cc8eb4ef | [
"Apache-2.0"
] | null | null | null | from django.contrib import admin
from .models import App, Review
class AppAdmin(admin.ModelAdmin):
list_display = ('id', 'app_id')
search_fields = ('app_id',)
class ReviewAdmin(admin.ModelAdmin):
list_display = ('id', 'review_id')
search_fields = ('review_id',)
admin.site.register(App, AppAdmin)
admin.site.register(Review, ReviewAdmin)
| 21.176471 | 40 | 0.716667 | 46 | 360 | 5.434783 | 0.413043 | 0.104 | 0.152 | 0.208 | 0.224 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147222 | 360 | 16 | 41 | 22.5 | 0.814332 | 0 | 0 | 0 | 0 | 0 | 0.094444 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
724de2306e9f3b0d255bc8add7ff2ef183c638cc | 1,731 | py | Python | test/test_pythoscope_generator_code_string.py | h4ck3rm1k3/pythoscope | 0cefb34b86e2e81e29c0b93d27e3d4657db79912 | [
"MIT"
] | null | null | null | test/test_pythoscope_generator_code_string.py | h4ck3rm1k3/pythoscope | 0cefb34b86e2e81e29c0b93d27e3d4657db79912 | [
"MIT"
] | null | null | null | test/test_pythoscope_generator_code_string.py | h4ck3rm1k3/pythoscope | 0cefb34b86e2e81e29c0b93d27e3d4657db79912 | [
"MIT"
] | null | null | null | import unittest
class TestCodeString(unittest.TestCase):
def test___new__(self):
# code_string = CodeString(string, uncomplete, imports)
assert False # TODO: implement your test here
class TestCombineTwoCodeStrings(unittest.TestCase):
def test_combine_two_code_strings(self):
# self.assertEqual(expected, combine_two_code_strings(template, cs1, cs2))
assert False # TODO: implement your test here
class TestCombineStringAndCodeString(unittest.TestCase):
def test_combine_string_and_code_string(self):
# self.assertEqual(expected, combine_string_and_code_string(template, s, cs))
assert False # TODO: implement your test here
class TestCombineCodeStringAndString(unittest.TestCase):
def test_combine_code_string_and_string(self):
# self.assertEqual(expected, combine_code_string_and_string(template, cs, s))
assert False # TODO: implement your test here
class TestCombine(unittest.TestCase):
def test_combine(self):
# self.assertEqual(expected, combine(cs1, cs2, template))
assert False # TODO: implement your test here
class TestJoin(unittest.TestCase):
def test_join(self):
# self.assertEqual(expected, join(char, code_strings))
assert False # TODO: implement your test here
class TestPutinto(unittest.TestCase):
def test_putinto(self):
# self.assertEqual(expected, putinto(cs, template, imports))
assert False # TODO: implement your test here
class TestAddimport(unittest.TestCase):
def test_addimport(self):
# self.assertEqual(expected, addimport(cs, imp))
assert False # TODO: implement your test here
if __name__ == '__main__':
unittest.main()
| 37.630435 | 85 | 0.727903 | 203 | 1,731 | 5.990148 | 0.226601 | 0.105263 | 0.125 | 0.151316 | 0.550164 | 0.342928 | 0.277138 | 0.247533 | 0.078947 | 0 | 0 | 0.002843 | 0.187175 | 1,731 | 45 | 86 | 38.466667 | 0.861407 | 0.428076 | 0 | 0.296296 | 0 | 0 | 0.008222 | 0 | 0 | 0 | 0 | 0.022222 | 0.296296 | 1 | 0.296296 | false | 0 | 0.111111 | 0 | 0.703704 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
a0e5f9ab43bdeee35a5440fa4846358808ee0d5e | 25,756 | py | Python | module/scripts/appleseed_maya/renderer.py | haggi/appleseed-maya | 4cceee1980c4b86c857f6e5039b57b59216afd0f | [
"MIT"
] | 1 | 2018-03-13T10:16:20.000Z | 2018-03-13T10:16:20.000Z | module/scripts/appleseed_maya/renderer.py | haggi/appleseed-maya | 4cceee1980c4b86c857f6e5039b57b59216afd0f | [
"MIT"
] | null | null | null | module/scripts/appleseed_maya/renderer.py | haggi/appleseed-maya | 4cceee1980c4b86c857f6e5039b57b59216afd0f | [
"MIT"
] | 1 | 2019-11-26T17:59:16.000Z | 2019-11-26T17:59:16.000Z |
#
# This source file is part of appleseed.
# Visit http://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2016 Haggi Krey, The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
import commonglobals as commonGlobals
import path
import uiutils as uiUtils
import pymel.core as pm
import logging
import os
import sys
log = logging.getLogger("renderLogger")
class MayaToRenderer(object):
def __init__(self, rendererName, moduleName):
self.rendererName = rendererName
self.moduleName = moduleName
self.pluginName = "mayato" + self.rendererName.lower()
self.renderGlobalsNodeName = self.rendererName.lower() + "Globals"
self.renderGlobalsNode = None
# self.baseRenderMelCommand = "import {0} as rcall; reload(rcall); rcall.theRenderer().".format(self.moduleName)
self.baseRenderMelCommand = "import {0} as rcall; rcall.theRenderer().".format(self.moduleName)
self.imageFormats = []
self.ipr_isrunning = False
self.imageFormatCtrl = None
self.openMayaCommonGlobals = None
self.useRendererTabPrefix = True
def addRenderGlobalsUIElement(self, attName=None, uiType=None, displayName=None, default=None, data=None, uiDict=None, callback=None, anno=None):
uiUtils.addRenderGlobalsUIElement(self.renderGlobalsNodeName, attName, uiType, displayName, default, data, uiDict, callback, anno)
# the render callback is called with arguments like this
# renderCmd 640 480 1 1 perspShape " -layer defaultRenderLayer"
# if the renderCmd is replaced with a python call it may not get all informations so we
# can think about an alternative call like this
# renderMelCmd pythonCmd 640 480 1 1 perspShape " -layer defaultRenderLayer"
# this can result in a pythonCmd(640, 480, 1, 1, perspShape, " -layer defaultRenderLayer") call
def renderCallback(self, procedureName):
cmd = "python(\"{0}{1}()\");\n".format(self.baseRenderMelCommand, procedureName)
return cmd
def makeMelPythonCmdStringFromPythonCmd(self, pythonCmdObj, argSet):
pCmd = "\"{0}{1}(".format(self.baseRenderMelCommand, pythonCmdObj.__name__)
argList = []
for dtype, value in argSet:
if dtype == 'string':
argList.append(value + "=" + r"""'"+$%s+"'""" % value)
else:
argList.append(value + "=\" + $" + value + " + \"")
pCmd += ",".join(argList)
pCmd += ")\""
return pCmd
def makeMelProcFromPythonCmd(self, pythonCmdObj, argSet):
cmd = pythonCmdObj.__name__
melProcName = "RenderProc_" + cmd
melCmd = "global proc %s (" % melProcName
argList = []
for arg in argSet:
argList.append(" $".join(arg))
melCmd += ",".join(argList) + ")\n{\n"
melCmd += " string $cmdString = " + self.makeMelPythonCmdStringFromPythonCmd(pythonCmdObj, argSet) + ";\n"
melCmd += " python($cmdString);\n"
melCmd += "};\n";
pm.mel.eval(melCmd)
return melProcName
def batchRenderProcedure(self, options):
self.preRenderProcedure()
self.renderProcedure(-1, -1, True, True, None, options)
def renderOptionsProcedure(self):
self.preRenderProcedure()
def commandRenderProcedure(self, width, height, doShadows, doGlow, camera, options):
self.preRenderProcedure()
self.renderProcedure()
def renderProcedure(self, width, height, doShadows, doGlowPass, camera, options):
pass
def batchRenderOptionsProcedure(self):
self.preRenderProcedure()
def batchRenderOptionsStringProcedure(self):
self.preRenderProcedure()
def cancelBatchRenderProcedure(self):
self.preRenderProcedure()
def showBatchRenderProcedure(self):
self.preRenderProcedure()
def showRenderLogProcedure(self):
self.preRenderProcedure()
def showBatchRenderLogProcedure(self):
self.preRenderProcedure()
def renderRegionProcedure(self):
self.preRenderProcedure()
def textureBakingProcedure(self):
self.preRenderProcedure()
def renderingEditorsSubMenuProcedure(self, *args):
log.debug("renderingEditorsSubMenuProcedure")
def OpenMayaCommonGlobalsCreateTab(self):
self.createGlobalsNode()
if self.openMayaCommonGlobals is None:
self.openMayaCommonGlobals = commonGlobals.OpenMayaCommonGlobals(self.renderGlobalsNode)
self.openMayaCommonGlobals.renderNode = self.renderGlobalsNode
self.openMayaCommonGlobals.OpenMayaCommonGlobalsCreateTab()
def OpenMayaCommonGlobalsUpdateTab(self):
self.createGlobalsNode()
if self.openMayaCommonGlobals is None:
self.openMayaCommonGlobals = commonGlobals.OpenMayaCommonGlobals(self.renderGlobalsNode)
self.openMayaCommonGlobals.renderNode = self.renderGlobalsNode
self.openMayaCommonGlobals.OpenMayaCommonGlobalsUpdateTab()
# render tab creation. Renderer tabs need a mel globals procedure.
# a mel procedure is called for create and update tab
# here I create a fake mel procedure to call my own python command
# per default, the inheriting class will implement the procedures:
# {Name}RendererCreateTab() and the {Name}RendererUpdateTab()
# {Name}TranslatorCreateTab() and the {Name}TranslatorUpdateTab()
def renderTabMelProcedure(self, tabName):
createTabCmd = "{0}{1}CreateTab".format(self.rendererName, tabName)
updateTabCmd = "{0}{1}UpdateTab".format(self.rendererName, tabName)
tabLabel = "{0}".format(tabName)
createPyCmd = "python(\"{0}{1}()\");".format(self.baseRenderMelCommand, createTabCmd)
updatePyCmd = "python(\"{0}{1}()\");".format(self.baseRenderMelCommand, updateTabCmd)
melCreateCmd = "global proc {0}()\n{{\t{1}\n}}\n".format(createTabCmd, createPyCmd)
melUpdateCmd = "global proc {0}()\n{{\t{1}\n}}\n".format(updateTabCmd, updatePyCmd)
pm.mel.eval(melCreateCmd)
pm.mel.eval(melUpdateCmd)
return (tabLabel, createTabCmd, updateTabCmd)
def createImageFormats(self):
pass
def checkNamingConvention(self):
#check file naming convention. We use only name.ext and name.nr.ext
defaultGlobals = pm.SCENE.defaultRenderGlobals
defaultGlobals.periodInExt.set(1)
defaultGlobals.putFrameBeforeExt.set(1)
def preRenderProcedure(self):
self.checkNamingConvention()
self.createGlobalsNode()
drg = pm.PyNode("defaultRenderGlobals")
if self.renderGlobalsNode.threads.get() == 0:
# TODO this is windows only, search for another solution...
numThreads = int(os.environ['NUMBER_OF_PROCESSORS'])
self.renderGlobalsNode.threads.set(numThreads)
def postRenderProcedure(self):
drg = pm.PyNode("defaultRenderGlobals")
def preFrameProcedure(self):
pass
def postFrameProcedure(self):
pass
def overwriteUpdateMayaImageFormatControl(self):
cmd = """
global proc string createMayaImageFormatControl()
{
return "imageMenuMayaSW";
}
"""
pm.mel.eval(cmd)
cmd = """
global proc updateMayaImageFormatControl()
{}
"""
pm.mel.eval(cmd)
return
def unDoOverwriteUpdateMayaImageFormatControl(self):
pm.mel.eval("source createMayaSoftwareCommonGlobalsTab")
def createGlobalsNode(self):
selection = pm.ls(sl=True)
if not self.renderGlobalsNode:
# maybe the node has been replaced by replaced by a new loaded node, check this
if len(pm.ls(self.renderGlobalsNodeName)) > 0:
self.renderGlobalsNode = pm.ls(self.renderGlobalsNodeName)[0]
log.debug("Globals node replaced.")
self.afterGlobalsNodeReplacement()
self.renderGlobalsNode.setLocked(True)
else:
self.renderGlobalsNode = pm.createNode(self.renderGlobalsNodeName)
self.renderGlobalsNode.rename(self.renderGlobalsNodeName)
log.debug("Created node " + str(self.renderGlobalsNode))
optimizedPath = pm.workspace.path+"/optimizedTextures"
if pm.workspace.fileRules.has_key('renderData'):
optimizedPath = pm.workspace.path / pm.workspace.fileRules['renderData'] / "optimizedTextures"
if not os.path.exists(optimizedPath):
optimizedPath.makedirs()
self.renderGlobalsNode.optimizedTexturePath.set(str(optimizedPath))
self.afterGlobalsNodeReplacement()
self.renderGlobalsNode.setLocked(True)
pm.select(selection)
def registerNodeExtensions(self):
pass
def hyperShadePanelBuildCreateMenuCallback(self):
pm.menuItem(label=self.rendererName)
pm.menuItem(divider=True)
def hyperShadePanelBuildCreateSubMenuCallback(self):
return "shader/surface"
def buildRenderNodeTreeListerContentCallback(self, tl, postCommand, filterString):
melCmd = 'addToRenderNodeTreeLister( "{0}", "{1}", "{2}", "{3}", "{4}", "{5}");'.format(tl, postCommand, self.rendererName + "/Materials", self.rendererName.lower() + "/material", "-asShader", "")
log.debug("Treelister cmd " + melCmd)
pm.mel.eval(melCmd)
melCmd = 'addToRenderNodeTreeLister( "{0}", "{1}", "{2}", "{3}", "{4}", "{5}");'.format(tl, postCommand, self.rendererName + "/Textures", self.rendererName.lower() + "/texture", "-asUtility", "")
pm.mel.eval(melCmd)
def aeTemplateCallback(self, nodeName):
pass
def registerAETemplateCallbacks(self):
pm.callbacks(addCallback=self.aeTemplateCallback, hook='AETemplateCustomContent', owner=self.pluginName)
pm.callbacks(addCallback=self.hyperShadePanelBuildCreateMenuCallback, hook='hyperShadePanelBuildCreateMenu', owner=self.pluginName)
pm.callbacks(addCallback=self.hyperShadePanelBuildCreateSubMenuCallback, hook='hyperShadePanelBuildCreateSubMenu', owner=self.pluginName)
pm.callbacks(addCallback=self.buildRenderNodeTreeListerContentCallback, hook='buildRenderNodeTreeListerContent', owner=self.pluginName)
pm.callbacks(addCallback=self.createRenderNodeCallback, hook='createRenderNodeCommand', owner=self.pluginName)
pm.callbacks(addCallback=self.connectNodeToNodeOverrideCallback, hook='connectNodeToNodeOverrideCallback', owner=self.pluginName)
aeTemplateName = "AE{0}NodeTemplate".format(self.rendererName.lower())
aeTemplateImportName = aeTemplateName
def createRenderNodeCallback(self, postCommand, nodeType):
for c in pm.getClassification(nodeType):
if self.rendererName.lower() in c.lower():
buildNodeCmd = "import {0} as rcall; rcall.theRenderer().createRenderNode(nodeType=\\\"{1}\\\", postCommand='{2}')".format(self.moduleName, nodeType, postCommand)
buildNodeCmd = "string $cmd = \"{0}\"; python($cmd);".format(buildNodeCmd)
return buildNodeCmd
def connectNodeToNodeOverrideCallback(self, srcNode, destNode):
return 1
def registerRenderer(self):
self.unRegisterRenderer()
self.registerNodeExtensions()
self.registerAETemplateCallbacks()
pm.renderer(self.rendererName, rendererUIName=self.rendererName)
pm.renderer(self.rendererName, edit=True, renderProcedure=self.makeMelProcFromPythonCmd(self.renderProcedure, [('int', 'width'),
('int', 'height'),
('int', 'doShadows'),
('int', 'doGlow'),
('string', 'camera'),
('string', 'options')]))
pm.renderer(self.rendererName, edit=True, batchRenderProcedure=self.makeMelProcFromPythonCmd(self.batchRenderProcedure, [('string', 'options')]))
pm.renderer(self.rendererName, edit=True, commandRenderProcedure=self.makeMelProcFromPythonCmd(self.batchRenderProcedure, [('string', 'options')]))
pm.renderer(self.rendererName, edit=True, batchRenderOptionsProcedure=self.renderCallback("batchRenderOptionsProcedure"))
pm.renderer(self.rendererName, edit=True, batchRenderOptionsStringProcedure=self.renderCallback("batchRenderOptionsStringProcedure"))
pm.renderer(self.rendererName, edit=True, addGlobalsNode="defaultRenderGlobals")
pm.renderer(self.rendererName, edit=True, addGlobalsNode="defaultResolution")
pm.renderer(self.rendererName, edit=True, addGlobalsNode=self.renderGlobalsNodeName)
pm.renderer(self.rendererName, edit=True, startIprRenderProcedure=self.makeMelProcFromPythonCmd(self.startIprRenderProcedure, [('string', 'editor'),
('int', 'resolutionX'),
('int', 'resolutionY'),
('string', 'camera')]))
pm.renderer(self.rendererName, edit=True, stopIprRenderProcedure=self.makeMelProcFromPythonCmd(self.stopIprRenderProcedure, []))
pm.renderer(self.rendererName, edit=True, pauseIprRenderProcedure=self.makeMelProcFromPythonCmd(self.pauseIprRenderProcedure, [('string', 'editor'), ('int', 'pause')]))
pm.renderer(self.rendererName, edit=True, changeIprRegionProcedure=self.makeMelProcFromPythonCmd(self.changeIprRegionProcedure, [('string', 'editor')]))
pm.renderer(self.rendererName, edit=True, iprRenderProcedure=self.renderCallback("iprRenderProcedure"))
pm.renderer(self.rendererName, edit=True, isRunningIprProcedure=self.renderCallback("isRunningIprProcedure"))
pm.renderer(self.rendererName, edit=True, refreshIprRenderProcedure=self.renderCallback("refreshIprRenderProcedure"))
pm.renderer(self.rendererName, edit=True, logoImageName=self.rendererName + ".png")
pm.renderer(self.rendererName, edit=True, renderDiagnosticsProcedure=self.renderCallback("renderDiagnosticsProcedure"))
pm.renderer(self.rendererName, edit=True, renderOptionsProcedure=self.renderCallback("renderOptionsProcedure"))
pm.renderer(self.rendererName, edit=True, cancelBatchRenderProcedure=self.renderCallback("cancelBatchRenderProcedure"))
pm.renderer(self.rendererName, edit=True, showBatchRenderProcedure=self.renderCallback("showBatchRenderProcedure"))
pm.renderer(self.rendererName, edit=True, showRenderLogProcedure=self.renderCallback("showRenderLogProcedure"))
pm.renderer(self.rendererName, edit=True, showBatchRenderLogProcedure=self.renderCallback("showBatchRenderLogProcedure"))
pm.renderer(self.rendererName, edit=True, textureBakingProcedure=self.renderCallback("textureBakingProcedure"))
pm.renderer(self.rendererName, edit=True, renderRegionProcedure="mayaRenderRegion")
scriptDir = path.path(__file__).dirname().parent
pm.mel.eval('global string $gImageFormatData[]; $gImageFormatData = {};')
pm.mel.eval('global string $gPLEImageFormatData[]; $gPLEImageFormatData = {};')
pm.mel.eval('global string $gPLEImageFormatData_Mental[]; $gPLEImageFormatData_Mental = {};')
pm.mel.source('createMayaSoftwareCommonGlobalsTab')
pm.mel.source("unifiedRenderGlobalsWindow")
self.defineCommonMelProcedures()
pm.evalDeferred(self.addTabs)
def defineCommonMelProcedures(self):
melCmd = """global proc updateMayaSoftwareImageFormatControl(){
python("{0}");
}""".replace("{0}", self.baseRenderMelCommand + "updateMayaSoftwareImageFormatControl()")
pm.mel.eval(melCmd)
melCmd = """global proc updateMultiCameraBufferNamingMenu(){
python("{0}");
}""".replace("{0}", self.baseRenderMelCommand + "updateMultiCameraBufferNamingMenu()")
pm.mel.eval(melCmd)
melCmd = """global proc addOneTabToGlobalsWindow(string $renderer, string $tabLabel, string $createProc){
python("{0}");
}""".replace("{0}", self.baseRenderMelCommand + "addOneTabToGlobalsWindow(\\\"\" + $renderer + \"\\\", \\\"\" + $tabLabel + \"\\\", \\\"\" + $createProc + \"\\\")")
pm.mel.eval(melCmd)
def addOneTabToGlobalsWindow(self, renderer, tabLabel, createProc):
# no windows no need to call
if not pm.window('unifiedRenderGlobalsWindow', exists=True):
return
displayAllTabs = pm.mel.isDisplayingAllRendererTabs()
if not displayAllTabs and pm.SCENE.defaultRenderGlobals.currentRenderer.get() != renderer:
return
# Set the correct tabLayout parent.
if displayAllTabs:
tabLayoutName = pm.mel.getRendererTabLayout(pm.melGlobals['gMasterLayerRendererName'])
else:
tabLayoutName = pm.mel.getRendererTabLayout(renderer)
# Hide the tabForm while updating.
tabFormManagedStatus = pm.formLayout('tabForm', q=True, manage=True)
pm.formLayout('tabForm', edit=True, manage=False)
pm.setParent('tabForm')
if displayAllTabs:
tabLayoutName = pm.mel.getRendererTabLayout(pm.melGlobals['gMasterLayerRendererName'])
else:
tabLayoutName = pm.mel.getRendererTabLayout(renderer)
pm.setParent(tabLayoutName)
tabName = pm.mel.rendererTabName(renderer, tabLabel)
commonTabNames = {
'Common' : "m_unifiedRenderGlobalsWindow.kCommon",
'Passes' : "m_unifiedRenderGlobalsWindow.kPassesTab",
'Maya Software' : "m_unifiedRenderGlobalsWindow.kMayaSoftware",
'Maya Hardware' : "m_unifiedRenderGlobalsWindow.kMayaHardware",
'Maya Vector' : "m_unifiedRenderGlobalsWindow.kMayaVector",
'Features' : "m_unifiedRenderGlobalsWindow.kFeatures",
'Quality' : "m_unifiedRenderGlobalsWindow.kQuality",
'Indirect Lighting' : "m_unifiedRenderGlobalsWindow.kIndirectLighting",
'Options' : "m_unifiedRenderGlobalsWindow.kOptions"
}
if commonTabNames.has_key(tabLabel):
tabLabel = pm.mel.uiRes(commonTabNames[tabLabel])
if not pm.layout(tabName, exists=True):
pm.setUITemplate('renderGlobalsTemplate', pushTemplate=True)
pm.setUITemplate('attributeEditorTemplate', pushTemplate=True)
pm.formLayout(tabName)
createProcs = ['createMayaSoftwareCommonGlobalsTab', 'createMayaSoftwareGlobalsTab']
try:
createProcs.extend(pm.renderer(renderer, q=True, globalsTabCreateProcNames=True))
except:
pass
if createProc in createProcs:
pm.mel.eval(createProc)
pm.setParent('..')
pm.setUITemplate(popTemplate=True)
pm.setUITemplate(popTemplate=True)
pm.tabLayout(tabLayoutName, edit=True, tabLabel=(tabName, tabLabel))
pm.formLayout('tabForm', edit=True, manage=tabFormManagedStatus)
def updateMultiCameraBufferNamingMenu(self):
pass
def updateMayaSoftwareImageFormatControl(self):
pass
def addTabs(self):
pm.renderer(self.rendererName, edit=True, addGlobalsTab=self.renderTabMelProcedure("CommonGlobals"))
pm.renderer(self.rendererName, edit=True, addGlobalsTab=self.renderTabMelProcedure("Renderer"))
pm.renderer(self.rendererName, edit=True, addGlobalsTab=self.renderTabMelProcedure("Environment"))
pm.renderer(self.rendererName, edit=True, addGlobalsTab=self.renderTabMelProcedure("Translator"))
def createImageFormatControls(self):
self.createGlobalsNode()
self.createImageFormats()
if pm.optionMenuGrp("openMayaImageFormats", q=True, exists=True):
pm.deleteUI("openMayaImageFormats")
self.imageFormatCtrl = pm.optionMenuGrp("openMayaImageFormats", label="Image Formats", cc=pm.Callback(self.imageFormatCallback))
for pr in self.imageFormats:
log.debug("adding image format: " + pr)
pm.menuItem(pr)
return self.imageFormatCtrl
def updateImageFormatControls(self):
self.createGlobalsNode()
selectedItem = self.renderGlobalsNode.imageFormat.get()
enums = self.renderGlobalsNode.imageFormat.getEnums()
selectedValue = "---"
for key in enums.keys():
if enums[key] == selectedItem:
selectedValue = key
self.imageFormatCtrl.setValue(selectedValue)
def imageFormatCallback(self):
selectedItem = self.imageFormatCtrl.getSelect()
selectedValue = self.imageFormatCtrl.getValue()
id = self.renderGlobalsNode.imageFormat.getEnums()[selectedValue]
selectedFormat = self.imageFormats[id]
self.renderGlobalsNode.imageFormat.set(id)
def addUserTabs(self):
pass
def unRegisterRenderer(self):
if pm.renderer(self.rendererName, q=True, exists=True):
pm.renderer(self.rendererName, unregisterRenderer=True)
pm.mel.source('createMayaSoftwareCommonGlobalsTab')
pm.mel.source("unifiedRenderGlobalsWindow")
def globalsTabCreateProcNames(self):
pass
def globalsTabLabels(self):
pass
def globalsTabUpdateProcNames(self):
pass
def changeIprRegionProcedure(self, editor=None):
pass
def iprOptionsProcedure(self):
print "AppleseediprOptionsProcedure"
def iprOptionsMenuLabel(self):
print "AppleseedIPROptionsMenuLabel"
return "AppleseedIPROptionsMenuLabel"
def iprRenderProcedure(self):
pass
def iprRenderSubMenuProcedure(self):
print "iprRenderSubMenuProcedure"
def isRunningIprProcedure(self):
return self.ipr_isrunning
def pauseIprRenderProcedure(self, editor, pause):
pass
def refreshIprRenderProcedure(self):
pass
def stopIprRenderProcedure(self):
self.ipr_isrunning = False
def startIprRenderProcedure(self, editor, resolutionX, resolutionY, camera):
self.ipr_isrunning = True
def logoCallbackProcedure(self):
pass
def logoImageName(self):
return self.rendererName + ".png"
def renderDiagnosticsProcedure(self):
pass
def renderGlobalsProcedure(self):
pass
def uiCallback(self, *args):
pass
def setImageName(self):
self.renderGlobalsNode.basePath.set(pm.workspace.path)
try:
self.renderGlobalsNode.imagePath.set(pm.workspace.path + pm.workspace.fileRules['images'])
except:
self.renderGlobalsNode.imagePath.set(pm.workspace.path + 'images')
sceneName = ".".join(pm.sceneName().basename().split(".")[:-1])
# get rid of the number extension which is created by maya if we start a batchrendering from the UI
numberPart = sceneName.split("__")[-1]
try:
number = int(numberPart)
if number > 999:
sceneName = sceneName.replace("__" + numberPart, "")
except:
pass
imageName = sceneName
prefix = pm.SCENE.defaultRenderGlobals.imageFilePrefix.get()
if prefix:
if len(prefix) > 0:
settings = pm.api.MCommonRenderSettingsData()
pm.api.MRenderUtil.getCommonRenderSettings(settings)
cams = [cam for cam in pm.ls(type='camera') if cam.renderable.get()]
if len(cams) < 1:
log.error("No renderable camera.")
prefix = ""
prefix = prefix.replace("<Camera>", cams[0].name())
prefix = prefix.replace("<Scene>", sceneName)
imageName = prefix
self.renderGlobalsNode.imageName.set(imageName)
| 48.142056 | 204 | 0.658254 | 2,226 | 25,756 | 7.598383 | 0.245283 | 0.04446 | 0.025659 | 0.047653 | 0.239801 | 0.212487 | 0.139589 | 0.100686 | 0.082299 | 0.06267 | 0 | 0.00438 | 0.237653 | 25,756 | 534 | 205 | 48.23221 | 0.857041 | 0.098385 | 0 | 0.234414 | 0 | 0.0399 | 0.150686 | 0.075516 | 0 | 0 | 0 | 0.001873 | 0 | 0 | null | null | 0.05985 | 0.024938 | null | null | 0.007481 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
a0fd6effaca4f95ca0d6c926fb902c6fa8abc8d8 | 1,886 | py | Python | examples/pytorch-mnist-membership-inference/task-plugins/securingai_custom/pytorch_mi/import_pytorch.py | usnistgov/dioptra | 08a08e96c27787915bafc75a483431333e2c70ca | [
"CC-BY-4.0"
] | 14 | 2021-06-17T15:16:12.000Z | 2021-11-08T10:25:37.000Z | examples/pytorch-mnist-membership-inference/task-plugins/securingai_custom/pytorch_mi/import_pytorch.py | usnistgov/dioptra | 08a08e96c27787915bafc75a483431333e2c70ca | [
"CC-BY-4.0"
] | 7 | 2021-09-20T20:20:26.000Z | 2022-03-30T13:17:43.000Z | examples/pytorch-mnist-membership-inference/task-plugins/securingai_custom/pytorch_mi/import_pytorch.py | usnistgov/dioptra | 08a08e96c27787915bafc75a483431333e2c70ca | [
"CC-BY-4.0"
] | 4 | 2021-06-29T16:52:42.000Z | 2022-01-21T16:56:45.000Z | # This Software (Dioptra) is being made available as a public service by the
# National Institute of Standards and Technology (NIST), an Agency of the United
# States Department of Commerce. This software was developed in part by employees of
# NIST and in part by NIST contractors. Copyright in portions of this software that
# were developed by NIST contractors has been licensed or assigned to NIST. Pursuant
# to Title 17 United States Code Section 105, works of NIST employees are not
# subject to copyright protection in the United States. However, NIST may hold
# international copyright in software created by its employees and domestic
# copyright (or licensing rights) in portions of software that were assigned or
# licensed to NIST. To the extent that NIST holds copyright in this software, it is
# being made available under the Creative Commons Attribution 4.0 International
# license (CC BY 4.0). The disclaimers of the CC BY 4.0 license apply to all parts
# of the software developed or licensed by NIST.
from __future__ import annotations
import importlib
from types import FunctionType, ModuleType
from typing import Union
import structlog
from structlog.stdlib import BoundLogger
from mitre.securingai.sdk.exceptions import TensorflowDependencyError
from mitre.securingai.sdk.utilities.decorators import require_package
LOGGER: BoundLogger = structlog.stdlib.get_logger()
try:
from torch.optim import Optimizer
except ImportError: # pragma: nocover
LOGGER.warn(
"Unable to import one or more optional packages, functionality may be reduced",
package="torch",
)
PYTORCH_OPTIMIZERS: str = "torch.optim"
def get_optimizer(optimizer_name: str) -> Optimizer:
pytorch_optimizers: ModuleType = importlib.import_module(PYTORCH_OPTIMIZERS)
optimizer: Optimizer = getattr(pytorch_optimizers, optimizer_name)
return optimizer
| 41 | 87 | 0.792153 | 264 | 1,886 | 5.606061 | 0.477273 | 0.032432 | 0.014865 | 0.027027 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006958 | 0.161718 | 1,886 | 45 | 88 | 41.911111 | 0.929159 | 0.535525 | 0 | 0 | 0 | 0 | 0.107101 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.047619 | false | 0 | 0.571429 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
9d192cf6b398b78f0ba14a1a5e0c0a2d852161f6 | 266 | py | Python | thirdauth/views.py | kinnevo/kic_alone | 7b0964b4438d35ac5caa9bf6d716abead91e3aea | [
"MIT"
] | null | null | null | thirdauth/views.py | kinnevo/kic_alone | 7b0964b4438d35ac5caa9bf6d716abead91e3aea | [
"MIT"
] | null | null | null | thirdauth/views.py | kinnevo/kic_alone | 7b0964b4438d35ac5caa9bf6d716abead91e3aea | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django.template.context import RequestContext
def home(request):
print request
context = ( {'request': request, 'user': request.user})
return render(request, 'facebook.html', context, content_type='text/html') | 26.6 | 78 | 0.736842 | 32 | 266 | 6.09375 | 0.59375 | 0.102564 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146617 | 266 | 10 | 78 | 26.6 | 0.859031 | 0 | 0 | 0 | 0 | 0 | 0.123596 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.333333 | null | null | 0.166667 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
9d1ab7a4460f51cce12d12827ba614f61180cfa2 | 1,767 | py | Python | cizzo_practice/app/models.py | chadorem/cizpractice | 3f3a57e17f3f96de233a81a9e1a475e742e0b59b | [
"MIT"
] | null | null | null | cizzo_practice/app/models.py | chadorem/cizpractice | 3f3a57e17f3f96de233a81a9e1a475e742e0b59b | [
"MIT"
] | null | null | null | cizzo_practice/app/models.py | chadorem/cizpractice | 3f3a57e17f3f96de233a81a9e1a475e742e0b59b | [
"MIT"
] | null | null | null | from app import db
class GenLoc(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
sublocs = db.relationship('SubLoc', backref='general_location', lazy='dynamic')
events = db.relationship('Event', backref='general_location', lazy='dynamic')
def __repr__(self):
return '<General location %r>' % (self.name)
class SubLoc(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
gen_loc = db.Column(db.Integer, db.ForeignKey('gen_loc.id'))
events = db.relationship('Event', backref='sublocation', lazy='dynamic')
def __repr__(self):
return '<Sublocation %r>' % (self.name)
class EventType(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
subtypes = db.relationship('EventSubtype', backref='general_event_type', lazy='dynamic')
events = db.relationship('Event', backref='event_type', lazy='dynamic')
def __repr__(self):
return '<Event type %r>' % (self.name)
class EventSubtype(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
gen_type = db.Column(db.Integer, db.ForeignKey('event_type.id'))
events = db.relationship('Event', backref='event_specifics', lazy='dynamic')
def __repr__(self):
return '<Event subtype %r>' % (self.name)
class Event(db.Model):
id = db.Column(db.Integer, primary_key=True)
gen_loc = db.Column(db.Integer, db.ForeignKey('gen_loc.id'))
gen_type = db.Column(db.Integer, db.ForeignKey('event_type.id'))
subtype = db.Column(db.Integer, db.ForeignKey('event_subtype.id'))
subloc = db.Column(db.Integer, db.ForeignKey('sub_loc.id'))
synopsis = db.Column(db.String(500))
timestamp = db.Column(db.DateTime)
def __repr__(self):
return '<Event %r>' % (self.id)
| 35.34 | 89 | 0.714771 | 260 | 1,767 | 4.7 | 0.176923 | 0.111293 | 0.139116 | 0.153028 | 0.713584 | 0.665303 | 0.535188 | 0.382979 | 0.382979 | 0.382979 | 0 | 0.006989 | 0.109225 | 1,767 | 49 | 90 | 36.061224 | 0.769377 | 0 | 0 | 0.461538 | 0 | 0 | 0.179966 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.128205 | false | 0 | 0.025641 | 0.128205 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
9d4fcd85f1bc7f09421756ac4c92ed7e4a0b90b6 | 213 | py | Python | cfgov/paying_for_college/urls.py | thephillipsequation/cfgov-refresh | 1412dd4215fce5597c0ec704b0d480cf00aeb82c | [
"CC0-1.0"
] | 1 | 2019-11-26T20:18:22.000Z | 2019-11-26T20:18:22.000Z | cfgov/paying_for_college/urls.py | thephillipsequation/cfgov-refresh | 1412dd4215fce5597c0ec704b0d480cf00aeb82c | [
"CC0-1.0"
] | null | null | null | cfgov/paying_for_college/urls.py | thephillipsequation/cfgov-refresh | 1412dd4215fce5597c0ec704b0d480cf00aeb82c | [
"CC0-1.0"
] | 1 | 2019-12-28T14:04:07.000Z | 2019-12-28T14:04:07.000Z | from django.conf.urls import include, url
urlpatterns = [
url(r'^understanding-your-financial-aid-offer/',
include('paying_for_college.disclosures.urls',
namespace='disclosures')),
]
| 23.666667 | 54 | 0.671362 | 23 | 213 | 6.130435 | 0.826087 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.197183 | 213 | 8 | 55 | 26.625 | 0.824561 | 0 | 0 | 0 | 0 | 0 | 0.403756 | 0.352113 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
9d5ed1c0aa30301838633866b710b0976d320ef1 | 211 | py | Python | basics/dicttype.py | mxinburritos/Python-Core-And-Advanced | 2aa2cf97e3feff071b0acffba2a489b40fa82860 | [
"MIT"
] | null | null | null | basics/dicttype.py | mxinburritos/Python-Core-And-Advanced | 2aa2cf97e3feff071b0acffba2a489b40fa82860 | [
"MIT"
] | null | null | null | basics/dicttype.py | mxinburritos/Python-Core-And-Advanced | 2aa2cf97e3feff071b0acffba2a489b40fa82860 | [
"MIT"
] | null | null | null | dict1={1:"John",2:"Bob",3:"Bill"}
print(dict1)
print(dict1.items())
k=dict1.keys()
for key in k:
print(key)
v=dict1.values()
for value in v:
print(value)
print(dict1[3])
del dict1[2]
print(dict1) | 10.55 | 33 | 0.635071 | 38 | 211 | 3.526316 | 0.473684 | 0.298507 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.073446 | 0.161137 | 211 | 20 | 34 | 10.55 | 0.683616 | 0 | 0 | 0.166667 | 0 | 0 | 0.051887 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
19b678be91ac021e05fdfda3981b872b4afc9e37 | 1,220 | py | Python | src/environment.py | jdbartee/crafting_interpreters | fdacd8bc0229bb702874c8577d5fe4c6e1bc967c | [
"MIT"
] | null | null | null | src/environment.py | jdbartee/crafting_interpreters | fdacd8bc0229bb702874c8577d5fe4c6e1bc967c | [
"MIT"
] | null | null | null | src/environment.py | jdbartee/crafting_interpreters | fdacd8bc0229bb702874c8577d5fe4c6e1bc967c | [
"MIT"
] | null | null | null | from errors import LoxRuntimeError
class Environment:
def __init__(self, parent=None):
self.parent: Environment = parent
self.values = {}
def ancestor(self, distance):
e = self
for i in range(0, distance):
e = e.parent
return e
def define(self, name, value):
self.values[name.lexeme] = value
def get(self, name, fallback=True):
if name.lexeme in self.values:
return self.values[name.lexeme]
if fallback and self.parent is not None:
return self.parent.get(name)
raise LoxRuntimeError(name, f"Undefined Variable '{name.lexeme}'.")
def get_at(self, distance, name):
return self.ancestor(distance).get(name, fallback=False)
def assign(self, name, value, fallback=True):
if name.lexeme in self.values:
self.values[name.lexeme] = value
return value
if fallback and self.parent is not None:
return self.parent.assign(name, value)
raise LoxRuntimeError(name, f"Undefined Variable '{name.lexeme}'.")
def assign_at(self, distance, name, value):
self.ancestor(distance).assign(name, value, fallback=False)
| 28.372093 | 75 | 0.62541 | 153 | 1,220 | 4.947712 | 0.254902 | 0.09247 | 0.055482 | 0.07926 | 0.433289 | 0.367239 | 0.367239 | 0.367239 | 0.272127 | 0.126816 | 0 | 0.001126 | 0.272131 | 1,220 | 42 | 76 | 29.047619 | 0.851351 | 0 | 0 | 0.275862 | 0 | 0 | 0.057377 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.241379 | false | 0 | 0.034483 | 0.034483 | 0.517241 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
19c95a099fbeaf62cd90dd06fb6ef9ec5fbcd9c7 | 4,376 | py | Python | office365/directory/applications/application.py | rikeshtailor/Office365-REST-Python-Client | ca7bfa1b22212137bb4e984c0457632163e89a43 | [
"MIT"
] | null | null | null | office365/directory/applications/application.py | rikeshtailor/Office365-REST-Python-Client | ca7bfa1b22212137bb4e984c0457632163e89a43 | [
"MIT"
] | null | null | null | office365/directory/applications/application.py | rikeshtailor/Office365-REST-Python-Client | ca7bfa1b22212137bb4e984c0457632163e89a43 | [
"MIT"
] | null | null | null | from office365.directory.directory_object_collection import DirectoryObjectCollection
from office365.directory.directory_object import DirectoryObject
from office365.directory.extensions.extension_property import ExtensionProperty
from office365.directory.key_credential import KeyCredential
from office365.directory.password_credential import PasswordCredential
from office365.entity_collection import EntityCollection
from office365.runtime.client_result import ClientResult
from office365.runtime.client_value_collection import ClientValueCollection
from office365.runtime.queries.service_operation_query import ServiceOperationQuery
from office365.runtime.resource_path import ResourcePath
class Application(DirectoryObject):
"""
Represents an application. Any application that outsources authentication to Azure Active Directory (Azure AD)
must be registered in a directory. Application registration involves telling Azure AD about your application,
including the URL where it's located, the URL to send replies after authentication,
the URI to identify your application, and more. For more information, see Basics of Registering
an Application in Azure AD
"""
def add_password(self, display_name):
"""Adds a strong password to an application.
:param str display_name: App display name
"""
params = PasswordCredential(displayName=display_name)
result = ClientResult(self.context, params)
qry = ServiceOperationQuery(self, "addPassword", None, params, None, result)
self.context.add_query(qry)
return result
def remove_password(self, key_id):
"""Remove a password from an application."""
qry = ServiceOperationQuery(self, "removePassword", None, {"keyId": key_id})
self.context.add_query(qry)
return self
def delete_object(self, permanent_delete=False):
"""
:param permanent_delete: Permanently deletes the application from directory
:type permanent_delete: bool
"""
super(Application, self).delete_object()
if permanent_delete:
deleted_item = self.context.directory.deleted_applications[self.id]
deleted_item.delete_object()
return self
@property
def key_credentials(self):
"""The collection of key credentials associated with the application. Not nullable.
"""
return self.properties.get('keyCredentials', ClientValueCollection(KeyCredential))
@property
def display_name(self):
"""
The display name for the application.
Supports $filter (eq, ne, NOT, ge, le, in, startsWith), $search, and $orderBy.
:rtype: str or None
"""
return self.properties.get('displayName', None)
@property
def identifier_uris(self):
"""
The URIs that identify the application within its Azure AD tenant, or within a verified custom domain
if the application is multi-tenant. For more information see Application Objects and Service Principal Objects.
The any operator is required for filter expressions on multi-valued properties.
"""
return self.properties.get('identifierUris', ClientValueCollection(str))
@property
def signin_audience(self):
"""
Specifies the Microsoft accounts that are supported for the current application.
Supported values are: AzureADMyOrg, AzureADMultipleOrgs, AzureADandPersonalMicrosoftAccount,
PersonalMicrosoftAccount
:rtype: str or None
"""
return self.properties.get('signInAudience', None)
@property
def owners(self):
"""Directory objects that are owners of the application. Read-only.
:rtype: DirectoryObjectCollection
"""
return self.get_property('owners',
DirectoryObjectCollection(self.context, ResourcePath("owners", self.resource_path)))
@property
def extension_properties(self):
"""List extension properties on an application object.
:rtype: EntityCollection
"""
return self.get_property('extensionProperties',
EntityCollection(self.context, ExtensionProperty,
ResourcePath("extensionProperties", self.resource_path)))
| 42.076923 | 119 | 0.704753 | 458 | 4,376 | 6.644105 | 0.358079 | 0.042721 | 0.036149 | 0.030233 | 0.067039 | 0.042721 | 0.024318 | 0.024318 | 0 | 0 | 0 | 0.00886 | 0.226234 | 4,376 | 103 | 120 | 42.485437 | 0.889841 | 0.359918 | 0 | 0.208333 | 0 | 0 | 0.052445 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1875 | false | 0.125 | 0.208333 | 0 | 0.604167 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
19cb98cdf048f603e0c9db9bfb093a08f42aec4b | 465 | py | Python | src/package_controller/library/utils/python/find_init_module.py | alexseitsinger/package_controller | 0ee896986cfa17a96bf9fb6afff35dd97f0b1211 | [
"BSD-2-Clause"
] | 2 | 2020-11-24T14:16:38.000Z | 2021-03-16T19:29:45.000Z | src/package_controller/library/utils/python/find_init_module.py | alexseitsinger/package_controller | 0ee896986cfa17a96bf9fb6afff35dd97f0b1211 | [
"BSD-2-Clause"
] | 2 | 2020-11-25T01:00:45.000Z | 2020-11-25T01:59:58.000Z | src/package_controller/library/utils/python/find_init_module.py | alexseitsinger/package_controller | 0ee896986cfa17a96bf9fb6afff35dd97f0b1211 | [
"BSD-2-Clause"
] | null | null | null | import os
from ..find_file import find_file
from .get_python_package_dir import get_python_package_dir
def find_init_module():
# In the package source root, find the init module.
package_dir = get_python_package_dir()
init_module = os.path.join(package_dir, "__init__.py")
if not os.path.exists(init_module):
raise FileNotFoundError(
"The init module does not exist. ({})".format(init_module)
)
return init_module
| 29.0625 | 70 | 0.713978 | 67 | 465 | 4.61194 | 0.41791 | 0.226537 | 0.15534 | 0.184466 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.204301 | 465 | 15 | 71 | 31 | 0.835135 | 0.105376 | 0 | 0 | 0 | 0 | 0.113527 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.272727 | 0 | 0.454545 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
19cddae347486500648563fb9bac1c7b74ac080a | 321 | py | Python | dado.py | hlruffo/exercicios_Python | 614c5dbaaf553b7295af554c6f98b169758db645 | [
"MIT"
] | 1 | 2021-06-18T01:32:18.000Z | 2021-06-18T01:32:18.000Z | dado.py | hlruffo/exercicios_Python | 614c5dbaaf553b7295af554c6f98b169758db645 | [
"MIT"
] | null | null | null | dado.py | hlruffo/exercicios_Python | 614c5dbaaf553b7295af554c6f98b169758db645 | [
"MIT"
] | null | null | null | from random import randint
print("Digite 'S' para lançar o dado ou 'N' para sair: ")
ordem = input()
while(ordem != 'N'):
if ordem == 'S':
print(randint(1, 6))
else:
print('Comando inválido')
print ("Digite 'S' para lançar o dado ou 'N' para sair: ")
ordem = input()
print("Fim") | 29.181818 | 63 | 0.573209 | 46 | 321 | 4 | 0.521739 | 0.119565 | 0.130435 | 0.173913 | 0.521739 | 0.521739 | 0.521739 | 0.521739 | 0.521739 | 0.521739 | 0 | 0.008547 | 0.271028 | 321 | 11 | 64 | 29.181818 | 0.777778 | 0 | 0 | 0.363636 | 0 | 0 | 0.375 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.090909 | 0 | 0.090909 | 0.454545 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.