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
215079a9c7eadfd3e8a78a41c34289c25ac04f75
5,403
py
Python
tests/test_datetime.py
mamh-mixed/loguru
22396695b9d8be9a46eca371279df7c427b27f61
[ "MIT" ]
null
null
null
tests/test_datetime.py
mamh-mixed/loguru
22396695b9d8be9a46eca371279df7c427b27f61
[ "MIT" ]
null
null
null
tests/test_datetime.py
mamh-mixed/loguru
22396695b9d8be9a46eca371279df7c427b27f61
[ "MIT" ]
null
null
null
import datetime import re import sys import freezegun import pytest from loguru import logger if sys.version_info < (3, 6): UTC_NAME = "UTC+00:00" else: UTC_NAME = "UTC" @pytest.mark.parametrize( "time_format, date, timezone, expected", [ ( "%Y-%m-%d %H-%M-%S %f %Z %z", "2018-06-09 01:02:03.000045", ("UTC", 0), "2018-06-09 01-02-03 000045 UTC +0000", ), ( "YYYY-MM-DD HH-mm-ss SSSSSS zz ZZ", "2018-06-09 01:02:03.000045", ("UTC", 0), "2018-06-09 01-02-03 000045 UTC +0000", ), ( "%Y-%m-%d %H-%M-%S %f %Z %z", "2018-06-09 01:02:03.000045", ("EST", -18000), "2018-06-09 01-02-03 000045 EST -0500", ), ( "YYYY-MM-DD HH-mm-ss SSSSSS zz ZZ", "2018-06-09 01:02:03.000045", ("EST", -18000), "2018-06-09 01-02-03 000045 EST -0500", ), ( "%Y-%m-%d %H-%M-%S %f %Z!UTC", "2018-06-09 01:02:03.000045", ("UTC", 0), "2018-06-09 01-02-03 000045 %s" % UTC_NAME, ), ( "YYYY-MM-DD HH-mm-ss SSSSSS zz!UTC", "2018-06-09 01:02:03.000045", ("UTC", 0), "2018-06-09 01-02-03 000045 %s" % UTC_NAME, ), ( "%Y-%m-%d %H-%M-%S %f %Z %z!UTC", "2018-06-09 01:02:03.000045", ("EST", -18000), "2018-06-09 06-02-03 000045 %s +0000" % UTC_NAME, ), ( "YYYY-MM-DD HH-mm-ss SSSSSS zz ZZ!UTC", "2018-06-09 01:02:03.000045", ("UTC", -18000), "2018-06-09 06-02-03 000045 %s +0000" % UTC_NAME, ), ( "YY-M-D H-m-s SSS Z", "2005-04-07 09:03:08.002320", ("A", 3600), "05-4-7 9-3-8 002 +01:00", ), ( "Q_DDDD_DDD d_E h_hh A SS ZZ", "2000-01-01 14:00:00.9", ("B", -1800), "1_001_1 5_6 2_02 PM 90 -0030", ), ("hh A", "2018-01-01 00:01:02.000003", ("UTC", 0), "12 AM"), ("hh A", "2018-01-01 12:00:00.0", ("UTC", 0), "12 PM"), ("hh A", "2018-01-01 23:00:00.0", ("UTC", 0), "11 PM"), ("[YYYY] MM [DD]", "2018-02-03 11:09:00.000002", ("UTC", 0), "YYYY 02 DD"), ("[YYYY MM DD]", "2018-01-03 11:03:04.000002", ("UTC", 0), "[2018 01 03]"), ("[[YY]]", "2018-01-03 11:03:04.000002", ("UTC", 0), "[YY]"), ("[]", "2018-01-03 11:03:04.000002", ("UTC", 0), "[]"), ("[HHmmss", "2018-01-03 11:03:04.000002", ("UTC", 0), "[110304"), ("HHmmss]", "2018-01-03 11:03:04.000002", ("UTC", 0), "110304]"), ("HH:mm:ss!UTC", "2018-01-01 11:30:00.0", ("A", 7200), "09:30:00"), ("UTC! HH:mm:ss", "2018-01-01 11:30:00.0", ("A", 7200), "UTC! 11:30:00"), ("!UTC HH:mm:ss", "2018-01-01 11:30:00.0", ("A", 7200), "!UTC 11:30:00"), ( "hh:mm:ss A - Z ZZ !UTC", "2018-01-01 12:30:00.0", ("A", 5400), "11:00:00 AM - +00:00 +0000 ", ), ( "YYYY-MM-DD HH:mm:ss[Z]!UTC", "2018-01-03 11:03:04.2", ("XYZ", -7200), "2018-01-03 13:03:04Z", ), ("HH:mm:ss[!UTC]", "2018-01-01 11:30:00.0", ("A", 7200), "11:30:00!UTC"), ("", "2018-02-03 11:09:00.000002", ("Z", 1800), "2018-02-03T11:09:00.000002+0030"), ("!UTC", "2018-02-03 11:09:00.000002", ("Z", 1800), "2018-02-03T10:39:00.000002+0000"), ], ) def test_formatting(writer, freeze_time, time_format, date, timezone, expected): with freeze_time(date, timezone): logger.add(writer, format="{time:%s}" % time_format) logger.debug("X") result = writer.read() assert result == expected + "\n" def test_locale_formatting(writer, freeze_time): dt = datetime.datetime(2011, 1, 1, 22, 22, 22, 0) with freeze_time(dt): logger.add(writer, format="{time:MMMM MMM dddd ddd}") logger.debug("Test") assert writer.read() == dt.strftime("%B %b %A %a\n") def test_stdout_formatting(freeze_time, capsys): with freeze_time("2015-12-25 19:13:18", ("A", 5400)): logger.add(sys.stdout, format="{time:YYYY [MM] DD HHmmss Z} {message}") logger.debug("Y") out, err = capsys.readouterr() assert out == "2015 MM 25 191318 +01:30 Y\n" assert err == "" def test_file_formatting(freeze_time, tmp_path): with freeze_time("2015-12-25 19:13:18", ("A", -5400)): logger.add(tmp_path / "{time:YYYY [MM] DD HHmmss ZZ}.log") logger.debug("Z") assert list(tmp_path.iterdir()) == [tmp_path / "2015 MM 25 191318 -0130.log"] def test_missing_struct_time_fields(writer, freeze_time): with freeze_time("2011-01-02 03:04:05.6", include_tm_zone=False): logger.add(writer, format="{time:YYYY MM DD HH mm ss SSSSSS ZZ zz}") logger.debug("X") result = writer.read() assert re.fullmatch(r"2011 01 02 03 04 05 600000 [+-]\d{4} .*\n", result) def test_freezegun_mocking(writer): logger.add(writer, format="[{time:YYYY MM DD HH:mm:ss}] {message}") with freezegun.freeze_time("2000-01-01 18:00:05"): logger.info("Frozen") assert writer.read() == "[2000 01 01 18:00:05] Frozen\n"
34.634615
95
0.489728
844
5,403
3.078199
0.175355
0.032333
0.049269
0.053888
0.572363
0.492302
0.465358
0.424557
0.421863
0.403772
0
0.280317
0.299463
5,403
155
96
34.858065
0.406077
0
0
0.313869
0
0
0.401814
0.011475
0
0
0
0
0.051095
1
0.043796
false
0
0.043796
0
0.087591
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
2157f3814f7d8209f817a39c3187e97678374518
829
py
Python
pysatSeasons/__init__.py
pysat/pysatSeasons
b6f8b51908c6ac882bd3e04d7b378aea7e9a29e0
[ "BSD-3-Clause" ]
1
2022-01-20T16:54:14.000Z
2022-01-20T16:54:14.000Z
pysatSeasons/__init__.py
pysat/pysatSeasons
b6f8b51908c6ac882bd3e04d7b378aea7e9a29e0
[ "BSD-3-Clause" ]
20
2019-09-18T18:36:17.000Z
2022-03-25T15:20:45.000Z
pysatSeasons/__init__.py
pysat/pysatSeasons
b6f8b51908c6ac882bd3e04d7b378aea7e9a29e0
[ "BSD-3-Clause" ]
1
2021-08-19T21:23:25.000Z
2021-08-19T21:23:25.000Z
""" pysatSeasons is a pysat module that provides the interface to perform seasonal analysis on data managed by pysat. These analysis methods are independent of instrument type. Main Features ------------- - Seasonal averaging routine for 1D and 2D data. - Occurrence probability routines, daily or by orbit. - Scatterplot of data_label(s) as functions of labelx,y over a season. """ import os # Import key modules and skip F401 testing in flake8 from pysatSeasons import occur_prob # noqa: F401 from pysatSeasons import avg # noqa: F401 from pysatSeasons import plot # noqa: F401 from pysatSeasons._core import computational_form # noqa: F401 # set version here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, 'version.txt')) as version_file: __version__ = version_file.read().strip()
29.607143
63
0.758745
120
829
5.125
0.65
0.104065
0.107317
0.117073
0.097561
0
0
0
0
0
0
0.025788
0.158022
829
27
64
30.703704
0.855301
0.588661
0
0
0
0
0.033639
0
0
0
0
0
0
1
0
false
0
0.625
0
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
215ddbe5f26e8bb8a19212d071a47be6b9e84f1f
552
py
Python
Practise/Python/Collections/collections.Counter().py
FurkhanShaikh/HackerRank-My-Solutions
3498d15f5cb218200d9f0548cfe938a0aaab9b27
[ "MIT" ]
null
null
null
Practise/Python/Collections/collections.Counter().py
FurkhanShaikh/HackerRank-My-Solutions
3498d15f5cb218200d9f0548cfe938a0aaab9b27
[ "MIT" ]
null
null
null
Practise/Python/Collections/collections.Counter().py
FurkhanShaikh/HackerRank-My-Solutions
3498d15f5cb218200d9f0548cfe938a0aaab9b27
[ "MIT" ]
null
null
null
#problem link : https://www.hackerrank.com/challenges/collections-counter/problem # Enter your code here. Read input from STDIN. Print output to STDOUT from collections import Counter X = int(raw_input()) sizes = map(int,raw_input().split()) cust = int(raw_input()) desired =[] for i in range(cust): temp = map(int,raw_input().split()) desired.append(temp) count = Counter(sizes) money = 0 for dlist in desired: if(dlist[0] in sizes): if(count[dlist[0]]!=0): count[dlist[0]]-=1 money+=dlist[1] print money
26.285714
81
0.666667
83
552
4.385542
0.506024
0.065934
0.120879
0.076923
0.104396
0
0
0
0
0
0
0.015625
0.188406
552
20
82
27.6
0.796875
0.268116
0
0
0
0
0
0
0
0
0
0.05
0
0
null
null
0
0.0625
null
null
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
1
0
1
0
0
0
0
0
0
0
0
2
2165794335ca95279cca6df02ac540918b551bc8
1,096
py
Python
event_loop/cancel_task.py
lishulongVI/Ilhabela
12e97ad2c239038bca0aaecc037beba7f7d3715a
[ "MIT" ]
null
null
null
event_loop/cancel_task.py
lishulongVI/Ilhabela
12e97ad2c239038bca0aaecc037beba7f7d3715a
[ "MIT" ]
null
null
null
event_loop/cancel_task.py
lishulongVI/Ilhabela
12e97ad2c239038bca0aaecc037beba7f7d3715a
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ @contact: lishulong.never@gmail.com @time: 2019/3/25 下午9:43 """ import asyncio async def consume(): print('start consume...') await asyncio.sleep(10) print('end consume...') if __name__ == '__main__': tasks = [consume() for i in range(10)] loop = asyncio.get_event_loop() try: loop.run_until_complete(asyncio.wait(tasks)) except KeyboardInterrupt as e: all = asyncio.Task.all_tasks() for t in all: print('cancel task') print(t.cancel()) loop.stop() loop.run_forever() finally: loop.close() """ lishulongdeMBP:event_loop lishulong$ python cancel_task.py start consume... start consume... start consume... start consume... start consume... start consume... start consume... start consume... start consume... start consume... ^Ccancel task True cancel task True cancel task True cancel task True cancel task True cancel task True cancel task True cancel task True cancel task True cancel task True cancel task True lishulongdeMBP:event_loop lishulong$ """
15.884058
59
0.663321
144
1,096
4.930556
0.402778
0.169014
0.197183
0.253521
0.377465
0.377465
0.377465
0.377465
0.377465
0.377465
0
0.017381
0.212591
1,096
68
60
16.117647
0.80533
0.074818
0
0
0
0
0.090573
0
0
0
0
0
0
1
0
false
0
0.052632
0
0.052632
0.210526
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
2169433be713fc577361a94f5719a5780017349f
1,238
py
Python
Study/interesting_program/test.py
pynickle/awesome-python-tools
e405fb8d9a1127ae7cd5bcbd6481da78f6f1fb07
[ "BSD-2-Clause" ]
21
2019-06-02T01:55:14.000Z
2022-01-08T22:35:31.000Z
Study/interesting_program/test.py
code-nick-python/awesome-daily-tools
e405fb8d9a1127ae7cd5bcbd6481da78f6f1fb07
[ "BSD-2-Clause" ]
3
2019-06-02T01:55:17.000Z
2019-06-14T12:32:06.000Z
Study/interesting_program/test.py
code-nick-python/awesome-daily-tools
e405fb8d9a1127ae7cd5bcbd6481da78f6f1fb07
[ "BSD-2-Clause" ]
16
2019-06-23T13:00:04.000Z
2021-09-18T06:09:58.000Z
""" Copyright: Copyright (c) 2019 License : WTFPL License owner : pynickle title : amazing-python study projects description : projects for studying python """ import sys import io import unittest import importlib def stub_stdin(testcase_inst, inputs): stdin = sys.stdin def cleanup(): sys.stdin = stdin testcase_inst.addCleanup(cleanup) sys.stdin = io.StringIO(inputs) def stub_stdout(testcase_inst): stderr = sys.stderr stdout = sys.stdout def cleanup(): sys.stderr = stderr sys.stdout = stdout testcase_inst.addCleanup(cleanup) sys.stderr = io.StringIO() sys.stdout = io.StringIO() def test_import(slf, file, result, input_value = None, original = None): if input is not None: stub_stdin(slf, input_value) stub_stdout(slf) exec("import " + file) slf.assertEqual(str(sys.stdout.getvalue()), result) class Test(unittest.TestCase): def test(self): test_import(self, "fibonacci", "1\n1\n2\n3\n5\n8\n13\n21\n34\n55\n") test_import(self, "lcm", "120\n", "24\n30\n") test_import(self, "mcd", "6\n", "24\n30\n") test_import(self, "leap_year", "True\n", "2000\n") test_import(self, "calculator", ">>>4.5-3.5*2.0 = -2.5\n", "4.5-3.5*2\n") unittest.main()
24.76
75
0.679321
185
1,238
4.454054
0.416216
0.072816
0.084951
0.072816
0.140777
0.050971
0.050971
0
0
0
0
0.04572
0.169628
1,238
49
76
25.265306
0.755837
0.121971
0
0.121212
0
0.030303
0.134384
0.031511
0
0
0
0
0.030303
1
0.181818
false
0
0.333333
0
0.545455
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
216c3e584bf0ccf79b7676172b319c96938d2937
189
py
Python
pythontutorials/Udacity/CS101/Lesson 02 - Problem Set/Q6-Bodacious Udacity.py
JoseALermaIII/python-tutorials
9d6cb78beec0bb55e27c49da1217317ba4d5f4fc
[ "MIT" ]
2
2017-04-20T02:57:19.000Z
2018-10-12T20:15:47.000Z
pythontutorials/Udacity/CS101/Lesson 02 - Problem Set/Q6-Bodacious Udacity.py
JoseALermaIII/python-tutorials
9d6cb78beec0bb55e27c49da1217317ba4d5f4fc
[ "MIT" ]
8
2021-03-18T21:50:16.000Z
2022-03-11T23:38:01.000Z
pythontutorials/Udacity/CS101/Lesson 02 - Problem Set/Q6-Bodacious Udacity.py
JoseALermaIII/python-tutorials
9d6cb78beec0bb55e27c49da1217317ba4d5f4fc
[ "MIT" ]
3
2018-08-30T20:30:50.000Z
2022-01-18T13:40:51.000Z
# Given the variables s and t defined as: s = 'udacity' t = 'bodacious' # write Python code that prints out udacious # without using any quote characters in # your code. print s[0] + t[2:]
23.625
44
0.708995
32
189
4.1875
0.84375
0
0
0
0
0
0
0
0
0
0
0.013158
0.195767
189
7
45
27
0.868421
0.693122
0
0
0
0
0.301887
0
0
0
0
0
0
0
null
null
0
0
null
null
0.333333
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
dcd4fad7ef29868c6597c0320970ff225d173cc6
602
py
Python
ver_colores.py
maltenzo/surrendeador
a3a0acbcaafa1ddec451cfaa6a75d850904a01e4
[ "MIT" ]
null
null
null
ver_colores.py
maltenzo/surrendeador
a3a0acbcaafa1ddec451cfaa6a75d850904a01e4
[ "MIT" ]
null
null
null
ver_colores.py
maltenzo/surrendeador
a3a0acbcaafa1ddec451cfaa6a75d850904a01e4
[ "MIT" ]
null
null
null
import mouse import keyboard from PIL import Image import pyscreenshot from time import sleep import os def ver(): while True: img = pyscreenshot.grab() width, height = img.size pixel_values = list(img.getdata()) print (pixel_values[width*mouse.get_position()[1]+mouse.get_position()[0]]) def dame_colores(): img = pyscreenshot.grab() width, height = img.size pixel_values = list(img.getdata()) return (pixel_values[width*mouse.get_position()[1]+mouse.get_position()[0]]) while True: # print(mouse.get_position()) print( dame_colores())
25.083333
81
0.679402
80
602
4.975
0.3875
0.100503
0.201005
0.120603
0.562814
0.562814
0.562814
0.562814
0.562814
0.562814
0
0.008247
0.194352
602
23
82
26.173913
0.812371
0.044851
0
0.421053
0
0
0
0
0
0
0
0
0
1
0.105263
false
0
0.315789
0
0.473684
0.105263
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
dce816b69b0582baaf4d9c46666864b3035d5fab
931
py
Python
lib/west_tools/westpa/reweight/__init__.py
ajoshpratt/westpa
545a42a5ae4cfa77de0e125a38a5b1ec2b9ab218
[ "MIT" ]
1
2019-12-21T09:11:54.000Z
2019-12-21T09:11:54.000Z
lib/west_tools/westpa/reweight/__init__.py
astatide/westpa
545a42a5ae4cfa77de0e125a38a5b1ec2b9ab218
[ "MIT" ]
1
2020-04-14T20:49:38.000Z
2020-04-14T20:49:38.000Z
lib/west_tools/westpa/reweight/__init__.py
ajoshpratt/westpa
545a42a5ae4cfa77de0e125a38a5b1ec2b9ab218
[ "MIT" ]
1
2020-04-14T20:42:11.000Z
2020-04-14T20:42:11.000Z
# Copyright (C) 2017 Matthew C. Zwier and Lillian T. Chong # # This file is part of WESTPA. # # WESTPA 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. # # WESTPA 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 WESTPA. If not, see <http://www.gnu.org/licenses/>. ''' Function(s) for the postanalysis toolkit ''' import logging log = logging.getLogger(__name__) import _reweight from _reweight import (stats_process, reweight_for_c) #@UnresolvedImport from matrix import FluxMatrix
33.25
72
0.765843
144
931
4.888889
0.631944
0.021307
0.055398
0.080966
0.116477
0.079545
0
0
0
0
0
0.00646
0.168636
931
27
73
34.481481
0.903101
0.790548
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.8
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
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
0d0ada3c223ce67e0153b8f576b9926c738f9141
21,631
py
Python
pysnmp/CISCO-EMBEDDED-EVENT-MGR-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
11
2021-02-02T16:27:16.000Z
2021-08-31T06:22:49.000Z
pysnmp/CISCO-EMBEDDED-EVENT-MGR-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
75
2021-02-24T17:30:31.000Z
2021-12-08T00:01:18.000Z
pysnmp/CISCO-EMBEDDED-EVENT-MGR-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 CISCO-EMBEDDED-EVENT-MGR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-EMBEDDED-EVENT-MGR-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:39:13 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") ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint") ciscoExperiment, = mibBuilder.importSymbols("CISCO-SMI", "ciscoExperiment") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") iso, Counter64, Unsigned32, Counter32, ModuleIdentity, Bits, IpAddress, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, Integer32, TimeTicks, Gauge32, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "Counter64", "Unsigned32", "Counter32", "ModuleIdentity", "Bits", "IpAddress", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "Integer32", "TimeTicks", "Gauge32", "MibIdentifier") TruthValue, TextualConvention, DisplayString, DateAndTime = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "TextualConvention", "DisplayString", "DateAndTime") cEventMgrMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 10, 134)) cEventMgrMIB.setRevisions(('2006-11-07 00:00', '2003-04-16 00:00',)) if mibBuilder.loadTexts: cEventMgrMIB.setLastUpdated('200611070000Z') if mibBuilder.loadTexts: cEventMgrMIB.setOrganization('Cisco Systems, Inc.') cEventMgrMIBNotif = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 0)) cEventMgrMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 1)) cEventMgrConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 3)) ceemEventMap = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1)) ceemHistory = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2)) ceemRegisteredPolicy = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3)) class NotifySource(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("server", 1), ("policy", 2)) ceemEventMapTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1, 1), ) if mibBuilder.loadTexts: ceemEventMapTable.setStatus('current') ceemEventMapEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1, 1, 1), ).setIndexNames((0, "CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemEventIndex")) if mibBuilder.loadTexts: ceemEventMapEntry.setStatus('current') ceemEventIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1, 1, 1, 1), Unsigned32()) if mibBuilder.loadTexts: ceemEventIndex.setStatus('current') ceemEventName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1, 1, 1, 2), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(1, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemEventName.setStatus('current') ceemEventDescrText = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1, 1, 1, 3), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemEventDescrText.setStatus('current') ceemHistoryMaxEventEntries = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 50)).clone(10)).setMaxAccess("readwrite") if mibBuilder.loadTexts: ceemHistoryMaxEventEntries.setStatus('current') ceemHistoryLastEventEntry = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryLastEventEntry.setStatus('current') ceemHistoryEventTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3), ) if mibBuilder.loadTexts: ceemHistoryEventTable.setStatus('current') ceemHistoryEventEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1), ).setIndexNames((0, "CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventIndex")) if mibBuilder.loadTexts: ceemHistoryEventEntry.setStatus('current') ceemHistoryEventIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))) if mibBuilder.loadTexts: ceemHistoryEventIndex.setStatus('current') ceemHistoryEventType1 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 2), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryEventType1.setStatus('current') ceemHistoryEventType2 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 3), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryEventType2.setStatus('current') ceemHistoryEventType3 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 4), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryEventType3.setStatus('current') ceemHistoryEventType4 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 5), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryEventType4.setStatus('current') ceemHistoryPolicyPath = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 6), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryPolicyPath.setStatus('current') ceemHistoryPolicyName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 7), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryPolicyName.setStatus('current') ceemHistoryPolicyExitStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-2147483648, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryPolicyExitStatus.setStatus('current') ceemHistoryPolicyIntData1 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-2147483648, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryPolicyIntData1.setStatus('current') ceemHistoryPolicyIntData2 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-2147483648, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryPolicyIntData2.setStatus('current') ceemHistoryPolicyStrData = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 11), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryPolicyStrData.setStatus('current') ceemHistoryNotifyType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 12), NotifySource()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryNotifyType.setStatus('current') ceemHistoryEventType5 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 13), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryEventType5.setStatus('current') ceemHistoryEventType6 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 14), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryEventType6.setStatus('current') ceemHistoryEventType7 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 15), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryEventType7.setStatus('current') ceemHistoryEventType8 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 16), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemHistoryEventType8.setStatus('current') ceemRegisteredPolicyTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1), ) if mibBuilder.loadTexts: ceemRegisteredPolicyTable.setStatus('current') ceemRegisteredPolicyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1), ).setIndexNames((0, "CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyIndex")) if mibBuilder.loadTexts: ceemRegisteredPolicyEntry.setStatus('current') ceemRegisteredPolicyIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 1), Unsigned32()) if mibBuilder.loadTexts: ceemRegisteredPolicyIndex.setStatus('current') ceemRegisteredPolicyName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 2), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyName.setStatus('current') ceemRegisteredPolicyEventType1 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 3), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyEventType1.setStatus('current') ceemRegisteredPolicyEventType2 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 4), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyEventType2.setStatus('current') ceemRegisteredPolicyEventType3 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 5), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyEventType3.setStatus('current') ceemRegisteredPolicyEventType4 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 6), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyEventType4.setStatus('current') ceemRegisteredPolicyStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyStatus.setStatus('current') ceemRegisteredPolicyType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("user", 1), ("system", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyType.setStatus('current') ceemRegisteredPolicyNotifFlag = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 9), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyNotifFlag.setStatus('current') ceemRegisteredPolicyRegTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 10), DateAndTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyRegTime.setStatus('current') ceemRegisteredPolicyEnabledTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 11), DateAndTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyEnabledTime.setStatus('current') ceemRegisteredPolicyRunTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 12), DateAndTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyRunTime.setStatus('current') ceemRegisteredPolicyRunCount = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyRunCount.setStatus('current') ceemRegisteredPolicyEventType5 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 14), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyEventType5.setStatus('current') ceemRegisteredPolicyEventType6 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 15), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyEventType6.setStatus('current') ceemRegisteredPolicyEventType7 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 16), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyEventType7.setStatus('current') ceemRegisteredPolicyEventType8 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 17), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ceemRegisteredPolicyEventType8.setStatus('current') cEventMgrServerEvent = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 134, 0, 1)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType1"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType2"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType3"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType4"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyPath"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyName"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyExitStatus")) if mibBuilder.loadTexts: cEventMgrServerEvent.setStatus('current') cEventMgrPolicyEvent = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 134, 0, 2)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType1"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType2"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType3"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType4"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyPath"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyName"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyIntData1"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyIntData2"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyStrData")) if mibBuilder.loadTexts: cEventMgrPolicyEvent.setStatus('current') cEventMgrCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 1)) cEventMgrGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2)) cEventMgrCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 1, 1)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrDescrGroup"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrNotificationsGroup"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrRegisteredPolicyGroup"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrHistoryGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cEventMgrCompliance = cEventMgrCompliance.setStatus('deprecated') cEventMgrComplianceRev1 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 1, 2)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrDescrGroup"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrNotificationsGroup"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrRegisteredPolicyGroup"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrRegisteredPolicyGroupSup1"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrHistoryGroup"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrHistoryGroupSup1")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cEventMgrComplianceRev1 = cEventMgrComplianceRev1.setStatus('current') cEventMgrDescrGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 1)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemEventName"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemEventDescrText")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cEventMgrDescrGroup = cEventMgrDescrGroup.setStatus('current') cEventMgrHistoryGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 2)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryMaxEventEntries"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryLastEventEntry"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType1"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType2"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType3"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType4"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyPath"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyName"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyExitStatus"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyIntData1"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyIntData2"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyStrData"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryNotifyType")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cEventMgrHistoryGroup = cEventMgrHistoryGroup.setStatus('current') cEventMgrNotificationsGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 3)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrServerEvent"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrPolicyEvent")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cEventMgrNotificationsGroup = cEventMgrNotificationsGroup.setStatus('current') cEventMgrRegisteredPolicyGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 4)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyName"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType1"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType2"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType3"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType4"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyStatus"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyType"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyNotifFlag"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyRegTime"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEnabledTime"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyRunTime"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyRunCount")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cEventMgrRegisteredPolicyGroup = cEventMgrRegisteredPolicyGroup.setStatus('current') cEventMgrHistoryGroupSup1 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 5)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType5"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType6"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType7"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType8")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cEventMgrHistoryGroupSup1 = cEventMgrHistoryGroupSup1.setStatus('current') cEventMgrRegisteredPolicyGroupSup1 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 6)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType5"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType6"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType7"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType8")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cEventMgrRegisteredPolicyGroupSup1 = cEventMgrRegisteredPolicyGroupSup1.setStatus('current') mibBuilder.exportSymbols("CISCO-EMBEDDED-EVENT-MGR-MIB", ceemEventDescrText=ceemEventDescrText, ceemHistoryEventType5=ceemHistoryEventType5, ceemRegisteredPolicyEventType4=ceemRegisteredPolicyEventType4, ceemEventName=ceemEventName, ceemHistoryPolicyIntData1=ceemHistoryPolicyIntData1, ceemRegisteredPolicyEntry=ceemRegisteredPolicyEntry, ceemHistoryPolicyExitStatus=ceemHistoryPolicyExitStatus, ceemRegisteredPolicyRunTime=ceemRegisteredPolicyRunTime, cEventMgrDescrGroup=cEventMgrDescrGroup, ceemHistory=ceemHistory, cEventMgrNotificationsGroup=cEventMgrNotificationsGroup, cEventMgrRegisteredPolicyGroup=cEventMgrRegisteredPolicyGroup, ceemRegisteredPolicyEventType3=ceemRegisteredPolicyEventType3, ceemRegisteredPolicyStatus=ceemRegisteredPolicyStatus, ceemEventIndex=ceemEventIndex, cEventMgrConformance=cEventMgrConformance, ceemRegisteredPolicyEventType6=ceemRegisteredPolicyEventType6, cEventMgrServerEvent=cEventMgrServerEvent, cEventMgrHistoryGroup=cEventMgrHistoryGroup, ceemHistoryPolicyStrData=ceemHistoryPolicyStrData, NotifySource=NotifySource, cEventMgrPolicyEvent=cEventMgrPolicyEvent, ceemRegisteredPolicyEventType8=ceemRegisteredPolicyEventType8, cEventMgrMIBNotif=cEventMgrMIBNotif, ceemHistoryEventType2=ceemHistoryEventType2, ceemEventMap=ceemEventMap, cEventMgrGroups=cEventMgrGroups, ceemHistoryEventType6=ceemHistoryEventType6, PYSNMP_MODULE_ID=cEventMgrMIB, ceemRegisteredPolicyRegTime=ceemRegisteredPolicyRegTime, cEventMgrRegisteredPolicyGroupSup1=cEventMgrRegisteredPolicyGroupSup1, cEventMgrMIB=cEventMgrMIB, ceemHistoryPolicyIntData2=ceemHistoryPolicyIntData2, ceemRegisteredPolicyEventType7=ceemRegisteredPolicyEventType7, ceemHistoryEventEntry=ceemHistoryEventEntry, ceemHistoryEventTable=ceemHistoryEventTable, cEventMgrMIBObjects=cEventMgrMIBObjects, ceemEventMapEntry=ceemEventMapEntry, ceemRegisteredPolicyName=ceemRegisteredPolicyName, ceemRegisteredPolicy=ceemRegisteredPolicy, ceemHistoryEventType3=ceemHistoryEventType3, ceemHistoryEventType8=ceemHistoryEventType8, ceemHistoryEventIndex=ceemHistoryEventIndex, cEventMgrCompliance=cEventMgrCompliance, ceemRegisteredPolicyNotifFlag=ceemRegisteredPolicyNotifFlag, ceemRegisteredPolicyRunCount=ceemRegisteredPolicyRunCount, ceemRegisteredPolicyEventType1=ceemRegisteredPolicyEventType1, ceemRegisteredPolicyIndex=ceemRegisteredPolicyIndex, ceemHistoryEventType1=ceemHistoryEventType1, ceemHistoryPolicyName=ceemHistoryPolicyName, ceemHistoryNotifyType=ceemHistoryNotifyType, ceemRegisteredPolicyEventType5=ceemRegisteredPolicyEventType5, ceemRegisteredPolicyType=ceemRegisteredPolicyType, ceemHistoryMaxEventEntries=ceemHistoryMaxEventEntries, ceemEventMapTable=ceemEventMapTable, ceemHistoryPolicyPath=ceemHistoryPolicyPath, cEventMgrHistoryGroupSup1=cEventMgrHistoryGroupSup1, ceemRegisteredPolicyEventType2=ceemRegisteredPolicyEventType2, ceemHistoryEventType4=ceemHistoryEventType4, ceemRegisteredPolicyTable=ceemRegisteredPolicyTable, ceemHistoryLastEventEntry=ceemHistoryLastEventEntry, cEventMgrCompliances=cEventMgrCompliances, ceemRegisteredPolicyEnabledTime=ceemRegisteredPolicyEnabledTime, ceemHistoryEventType7=ceemHistoryEventType7, cEventMgrComplianceRev1=cEventMgrComplianceRev1)
142.309211
3,183
0.773473
2,287
21,631
7.314823
0.092261
0.010282
0.074242
0.086616
0.458366
0.392552
0.339231
0.327754
0.287824
0.282563
0
0.073487
0.075863
21,631
151
3,184
143.251656
0.763382
0.01618
0
0.056738
0
0
0.225978
0.158565
0
0
0
0
0
1
0
false
0
0.056738
0
0.085106
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
0d0b5671587550eca8af9d7486e1e9c27446306c
277
py
Python
src/util_walk_sftp.py
Chrisebell24/walk_sftp
65dcb4e4231fabe8f8d9f2a6b595371c31ddc0d6
[ "MIT" ]
null
null
null
src/util_walk_sftp.py
Chrisebell24/walk_sftp
65dcb4e4231fabe8f8d9f2a6b595371c31ddc0d6
[ "MIT" ]
null
null
null
src/util_walk_sftp.py
Chrisebell24/walk_sftp
65dcb4e4231fabe8f8d9f2a6b595371c31ddc0d6
[ "MIT" ]
null
null
null
import paramiko class _FastTransport(paramiko.Transport): def __init__(self, sock): super(_FastTransport, self).__init__(sock) self.window_size = 2147483647 self.packetizer.REKEY_BYTES = pow(2, 40) self.packetizer.REKEY_PACKETS = pow(2, 40)
34.625
50
0.696751
33
277
5.454545
0.606061
0.155556
0.211111
0
0
0
0
0
0
0
0
0.072398
0.202166
277
8
51
34.625
0.742081
0
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0
0.428571
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0d246003e8c49782d663db0652fc20c6c7b5ad5f
426
py
Python
orders/urls.py
techonerd/kobbyshop
e79f009f75f576fdc2e8ac037781f5817a2e255f
[ "MIT" ]
4
2021-11-25T15:45:31.000Z
2022-01-11T21:31:56.000Z
orders/urls.py
KwabenaYeboah/kobbyshop
850a04b24fafa8aa538fdbf039a0e8fafc3ebfc2
[ "MIT" ]
1
2021-12-30T08:18:28.000Z
2021-12-30T08:18:28.000Z
orders/urls.py
techonerd/kobbyshop
e79f009f75f576fdc2e8ac037781f5817a2e255f
[ "MIT" ]
2
2021-12-26T05:11:00.000Z
2021-12-30T08:18:13.000Z
from django.urls import path from django.utils.translation import gettext_lazy as _ from .views import create_order_view, order_detail_view, generate_order_pdf_view urlpatterns = [ path('admin/order/<int:order_id>/', order_detail_view, name='admin_order_detail'), path('admin/order/<int:order_id>/pdf/', generate_order_pdf_view, name='generate_order_pdf'), path(_(''), create_order_view, name='create_order'), ]
38.727273
96
0.7723
62
426
4.919355
0.354839
0.108197
0.157377
0.131148
0.157377
0.157377
0
0
0
0
0
0
0.100939
426
10
97
42.6
0.796345
0
0
0
1
0
0.248826
0.13615
0
0
0
0
0
1
0
false
0
0.375
0
0.375
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
b48fbff20842d5dc1be80ae2543317f479252cd3
99
py
Python
args.py
NiranjanVRam/spotify-downloader
f20580dbb6fa6ebc00e7935f233f5a87e9762d18
[ "MIT" ]
7
2020-12-27T13:38:38.000Z
2022-03-06T16:34:18.000Z
args.py
NiranjanVRam/spotify-downloader
f20580dbb6fa6ebc00e7935f233f5a87e9762d18
[ "MIT" ]
2
2021-10-03T10:56:12.000Z
2021-10-10T23:43:14.000Z
args.py
NiranjanVRam/spotify-downloader
f20580dbb6fa6ebc00e7935f233f5a87e9762d18
[ "MIT" ]
5
2021-03-31T11:38:59.000Z
2021-12-30T02:36:40.000Z
clientId = 'CLIENT_ID' clientSecret = 'CLIENT_SECRET' geniusToken = 'GENIUS_TOKEN' bitrate = '320'
19.8
30
0.757576
11
99
6.545455
0.909091
0
0
0
0
0
0
0
0
0
0
0.034483
0.121212
99
5
31
19.8
0.793103
0
0
0
0
0
0.37
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
b49f409da0defa952f5265984dc68c10a3ae4ba5
1,811
py
Python
rlkit/envs/non_mujoco_half_cheetah_vel.py
hammer-wang/FOCAL-ICLR
4d19149f86acc1d6b987c93cdd3a9d957535c5e3
[ "MIT" ]
24
2021-03-24T07:14:52.000Z
2022-03-17T08:15:44.000Z
rlkit/envs/non_mujoco_half_cheetah_vel.py
hammer-wang/FOCAL-ICLR
4d19149f86acc1d6b987c93cdd3a9d957535c5e3
[ "MIT" ]
4
2021-06-18T16:38:38.000Z
2022-03-18T11:04:45.000Z
rlkit/envs/non_mujoco_half_cheetah_vel.py
hammer-wang/FOCAL-ICLR
4d19149f86acc1d6b987c93cdd3a9d957535c5e3
[ "MIT" ]
6
2021-04-12T18:49:47.000Z
2021-09-07T05:33:22.000Z
import numpy as np from gym import spaces from gym import Env #from rlkit.envs.mujoco.half_cheetah import HalfCheetahEnv from rlkit.envs import register_env @register_env('cheetah-vel') class HalfCheetahVelEnv(Env): def __init__(self, task={}, n_tasks=2, randomize_tasks=True, max_episode_steps=200): self._task = task self.tasks = self.sample_tasks(n_tasks) self._goal_vel = self.tasks[0].get('velocity', 0.0) self._goal = self._goal_vel self.observation_space = spaces.Box(low=-np.inf, high=np.inf, shape=(20,)) self.action_space = spaces.Box(low=-1, high=1, shape=(6,)) self._max_episode_steps = max_episode_steps self._step = 0 def step(self, action): print("placeholder! no env no step") pass def sample_tasks(self, num_tasks): np.random.seed(1337) velocities = np.random.uniform(0.0, 3.0, size=(num_tasks,)) tasks = [{'velocity': velocity} for velocity in velocities] return tasks def get_all_task_idx(self): return range(len(self.tasks)) def reset(self): return self.reset_model() def reset_model(self): # reset to a random location on the unit square self._state = np.random.uniform(-1., 1., size=(20,)) self._step = 0 return self._get_obs() def _get_obs(self): return np.copy(self._state) def reset_task(self, idx): self._goal_idx = idx self._task = self.tasks[idx] self._goal_vel = self._task['velocity'] self._goal = self._goal_vel self.reset() def viewer_setup(self): print('no viewer') pass def render(self): print('no render') pass
28.746032
89
0.605191
245
1,811
4.257143
0.334694
0.053691
0.042186
0.057526
0.044104
0.044104
0
0
0
0
0
0.02
0.282165
1,811
62
90
29.209677
0.782308
0.056875
0
0.155556
0
0
0.048662
0
0
0
0
0
0
1
0.222222
false
0.066667
0.088889
0.066667
0.444444
0.066667
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
b4b539761e3c4833580192978074b62223577348
393
py
Python
tests/sdk/test_util.py
unparalleled-js/py42
8c6b054ddd8c2bfea92bf77b0d648af76f1efcf1
[ "MIT" ]
1
2020-08-18T22:00:22.000Z
2020-08-18T22:00:22.000Z
tests/sdk/test_util.py
unparalleled-js/py42
8c6b054ddd8c2bfea92bf77b0d648af76f1efcf1
[ "MIT" ]
null
null
null
tests/sdk/test_util.py
unparalleled-js/py42
8c6b054ddd8c2bfea92bf77b0d648af76f1efcf1
[ "MIT" ]
1
2021-05-10T23:33:34.000Z
2021-05-10T23:33:34.000Z
from datetime import datetime import py42.util as util def test_convert_timestamp_to_str_returns_expected_str(): assert util.convert_timestamp_to_str(235123656) == "1977-06-14T08:07:36.000Z" def test_convert_datetime_to_timestamp_str_returns_expected_str(): d = datetime(2020, 4, 19, 13, 3, 2, 3) assert util.convert_datetime_to_timestamp_str(d) == "2020-04-19T13:03:02.000Z"
30.230769
82
0.78117
64
393
4.453125
0.515625
0.098246
0.098246
0.147368
0.203509
0
0
0
0
0
0
0.164265
0.117048
393
12
83
32.75
0.657061
0
0
0
0
0
0.122137
0.122137
0
0
0
0
0.285714
1
0.285714
false
0
0.285714
0
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
b4c44cb204c3826e5c1e00d10a308dfe64d24ddf
386
py
Python
_solved/_solutions/visualization_02_seaborn14.py
jorisvandenbossche/ICES-python-data
63864947657f37cb26cb4e2dcd67ff106dffe9cd
[ "BSD-3-Clause" ]
1
2022-03-02T17:41:46.000Z
2022-03-02T17:41:46.000Z
notebooks/_solutions/visualization_02_seaborn14.py
jorisvandenbossche/ICES-python-data
63864947657f37cb26cb4e2dcd67ff106dffe9cd
[ "BSD-3-Clause" ]
1
2022-03-14T15:15:53.000Z
2022-03-14T15:15:53.000Z
notebooks/_solutions/visualization_02_seaborn14.py
jorisvandenbossche/ICES-python-data
63864947657f37cb26cb4e2dcd67ff106dffe9cd
[ "BSD-3-Clause" ]
null
null
null
# Optional solution with tidy data representation (providing x and y) monthly_victim_counts_melt = monthly_victim_counts.reset_index().melt( id_vars="datetime", var_name="victim_type", value_name="count" ) sns.relplot( data=monthly_victim_counts_melt, x="datetime", y="count", hue="victim_type", kind="line", palette="colorblind", height=3, aspect=4, )
27.571429
70
0.712435
52
386
5.019231
0.673077
0.149425
0.218391
0.176245
0
0
0
0
0
0
0
0.006154
0.158031
386
14
71
27.571429
0.796923
0.173575
0
0
0
0
0.194969
0
0
0
0
0
0
1
0
false
0
0
0
0
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
b4cc52d37e832307c2b993281014ae5693bca403
281
py
Python
recipes/transabyss/setup.py
ieguinoa/bioconda-recipes
da8a66ec30d36273a8cdf8783a26604f23c45534
[ "MIT" ]
null
null
null
recipes/transabyss/setup.py
ieguinoa/bioconda-recipes
da8a66ec30d36273a8cdf8783a26604f23c45534
[ "MIT" ]
null
null
null
recipes/transabyss/setup.py
ieguinoa/bioconda-recipes
da8a66ec30d36273a8cdf8783a26604f23c45534
[ "MIT" ]
null
null
null
import subprocess from setuptools import setup, find_packages, Extension setup( name='transabyss', version='1.54', author='transabyss', license='Free Software License', packages=['transabyss'], scripts=['scripts/transabyss', 'scripts/transabyss-merge'], )
23.416667
63
0.704626
29
281
6.793103
0.655172
0.172589
0
0
0
0
0
0
0
0
0
0.012658
0.156584
281
11
64
25.545455
0.818565
0
0
0
0
0
0.345196
0.085409
0
0
0
0
0
1
0
true
0
0.2
0
0.2
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
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
b4d5ab68cc4a4cd64dc0ee44aa2eb3eb7b21a324
1,195
py
Python
pykeyset/core/font/font.py
staticintlucas/pykeyset
8581252c85dfceebe22926af4640164a0895e7a0
[ "Apache-2.0", "MIT" ]
1
2021-07-06T16:43:25.000Z
2021-07-06T16:43:25.000Z
pykeyset/core/font/font.py
staticintlucas/pykeyset
8581252c85dfceebe22926af4640164a0895e7a0
[ "Apache-2.0", "MIT" ]
null
null
null
pykeyset/core/font/font.py
staticintlucas/pykeyset
8581252c85dfceebe22926af4640164a0895e7a0
[ "Apache-2.0", "MIT" ]
null
null
null
from typing import Optional from .glyph import Glyph class Font: def __init__( self, name: str, em_size: float, cap_height: float, x_height: float, line_height: float, slope: float, char_spacing: float, ): raise NotImplementedError def __len__(self) -> int: """Returns the number of glyphs in the font""" raise NotImplementedError def glyph(self, char: str, size: float) -> Optional[Glyph]: """Returns a copy of the glyph for the chosen character scaled to the given size, or None if the Glyph does not exist in the font""" raise NotImplementedError def line_spacing(self, size: float) -> float: raise NotImplementedError def add_glyph(self, glyph: Glyph) -> None: """Adds a glyph to the font. The glyph should have the same metrics as set when creating the Font object""" raise NotImplementedError def replacement(self, size: float) -> Glyph: """Returns a copy of this font's replacement character (or the default if none exists) scaled to the given size""" raise NotImplementedError
25.978261
97
0.632636
151
1,195
4.907285
0.410596
0.194332
0.182186
0.08637
0.202429
0.097166
0
0
0
0
0
0
0.295397
1,195
45
98
26.555556
0.880048
0.316318
0
0.25
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.083333
0
0.375
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
b4db052ea80413d8736cb6f07460bcb08f08dc7f
540
py
Python
Calibration/EcalAlCaRecoProducers/python/alcastreamEcalPhiSym_cff.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
852
2015-01-11T21:03:51.000Z
2022-03-25T21:14:00.000Z
Calibration/EcalAlCaRecoProducers/python/alcastreamEcalPhiSym_cff.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
30,371
2015-01-02T00:14:40.000Z
2022-03-31T23:26:05.000Z
Calibration/EcalAlCaRecoProducers/python/alcastreamEcalPhiSym_cff.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
3,240
2015-01-02T05:53:18.000Z
2022-03-31T17:24:21.000Z
# The following comments couldn't be translated into the new config version: #------------------------------------------------ #AlCaReco filtering for phi symmetry calibration: #------------------------------------------------ # # Passes events that are coming from the online phi-symmetry stream # # import FWCore.ParameterSet.Config as cms import HLTrigger.HLTfilters.hltHighLevel_cfi ecalphiSymHLT = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone( HLTPaths = ['AlCa_EcalPhiSym*'], andOr = True, throw = False )
24.545455
76
0.633333
54
540
6.277778
0.796296
0.064897
0.182891
0.20059
0
0
0
0
0
0
0
0
0.127778
540
21
77
25.714286
0.719745
0.525926
0
0
0
0
0.066116
0
0
0
0
0
0
1
0
false
0
0.285714
0
0.285714
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
b4e36d17dc528299318c8cd10e36c599f350d3dc
1,172
py
Python
annofabcli/filesystem/subcommand_filesystem.py
kurusugawa-computer/annofab-cli
8edad492d439bc8fe64e9471464f545d07aba8b7
[ "MIT" ]
9
2019-07-22T23:54:05.000Z
2020-11-05T06:26:04.000Z
annofabcli/filesystem/subcommand_filesystem.py
kurusugawa-computer/annofab-cli
8edad492d439bc8fe64e9471464f545d07aba8b7
[ "MIT" ]
389
2019-07-03T04:39:11.000Z
2022-03-28T14:06:11.000Z
annofabcli/filesystem/subcommand_filesystem.py
kurusugawa-computer/annofab-cli
8edad492d439bc8fe64e9471464f545d07aba8b7
[ "MIT" ]
1
2021-08-30T14:22:04.000Z
2021-08-30T14:22:04.000Z
import argparse from typing import Optional import annofabcli import annofabcli.common.cli import annofabcli.filesystem.draw_annotation import annofabcli.filesystem.filter_annotation import annofabcli.filesystem.mask_user_info import annofabcli.filesystem.merge_annotation import annofabcli.filesystem.write_annotation_image def parse_args(parser: argparse.ArgumentParser): subparsers = parser.add_subparsers() # サブコマンドの定義 annofabcli.filesystem.draw_annotation.add_parser(subparsers) annofabcli.filesystem.filter_annotation.add_parser(subparsers) annofabcli.filesystem.mask_user_info.add_parser(subparsers) annofabcli.filesystem.merge_annotation.add_parser(subparsers) annofabcli.filesystem.write_annotation_image.add_parser(subparsers) def add_parser(subparsers: Optional[argparse._SubParsersAction] = None): subcommand_name = "filesystem" subcommand_help = "ファイル操作関係(Web APIにアクセスしない)のサブコマンド" description = "ファイル操作関係(Web APIにアクセスしない)のサブコマンド" parser = annofabcli.common.cli.add_parser( subparsers, subcommand_name, subcommand_help, description, is_subcommand=False ) parse_args(parser) return parser
33.485714
86
0.817406
129
1,172
7.193798
0.302326
0.215517
0.143319
0.125
0.3125
0.158405
0
0
0
0
0
0
0.113481
1,172
34
87
34.470588
0.893167
0.007679
0
0
0
0
0.063738
0
0
0
0
0
0
1
0.08
false
0
0.36
0
0.48
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
b4e6b497acf3eb5e2c7697b0aabc3286bf901091
2,557
py
Python
craedl/errors.py
AnotherGroupChat/craedl-sdk-python
57eec7ad4013e693740ad40190d5817984721fde
[ "Apache-2.0" ]
null
null
null
craedl/errors.py
AnotherGroupChat/craedl-sdk-python
57eec7ad4013e693740ad40190d5817984721fde
[ "Apache-2.0" ]
null
null
null
craedl/errors.py
AnotherGroupChat/craedl-sdk-python
57eec7ad4013e693740ad40190d5817984721fde
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 The Johns Hopkins University # # 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. import json class CraedlException(Exception): """Base exception that all other exceptions should inherit from.""" def __init__(self): self.message = "Craedl Error." def __str__(self): return self.message class Connection_Refused_Error(CraedlException): def __init__(self): self.message = 'Failed to establish a connection to https://api.craedl.org.' class Invalid_Token_Error(CraedlException): def __init__(self): self.message = 'Your configured authentication token is invalid.\n' self.message += ' Use `python -m craedl` to configure your authentication token.' class Missing_Token_Error(CraedlException): def __init__(self): self.message = 'You have not configured an authentication token.\n' self.message += ' Use `python -m craedl` to configure your authentication token.' class Not_Found_Error(CraedlException): def __init__(self): self.message = 'The requested resource was not found.' class Other_Error(CraedlException): def __init__(self): self.message = 'New error encountered. Determine the response error code and create a new error class.' class Parse_Error(CraedlException): def __init__(self, details=None): self.message = 'Your request included invalid parameters.' self.details = details def __str__(self): return self.message + ' ' + self.details class File_Error(CraedlException): def __init__(self, details=None): self.message = 'Cannot upload an empty file.' self.details = details def __str__(self): return self.message + ' file: ' + self.details class Server_Error(CraedlException): def __init__(self, details=None): self.message = 'The server at https://api.craedl.org has encountered an error.' class Unauthorized_Error(CraedlException): def __init__(self): self.message = 'You are not authorized to access the requested resource.'
36.528571
111
0.717247
330
2,557
5.360606
0.384848
0.093273
0.062182
0.137366
0.395704
0.383267
0.368005
0.296778
0.216507
0.075749
0
0.003899
0.197497
2,557
69
112
37.057971
0.858187
0.2456
0
0.414634
0
0
0.323391
0
0
0
0
0
0
1
0.317073
false
0
0.02439
0.073171
0.658537
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
b4f29d97ffa1af1c0c768796e62188143ad7c066
461
py
Python
datamanager/interfaces/abstract_resource_resolver.py
alghimo/data-manager
98c54934cb704c4e980acdfcc2206d740dd1ec03
[ "Apache-2.0" ]
1
2021-05-22T08:37:17.000Z
2021-05-22T08:37:17.000Z
datamanager/interfaces/abstract_resource_resolver.py
alghimo/data-manager
98c54934cb704c4e980acdfcc2206d740dd1ec03
[ "Apache-2.0" ]
null
null
null
datamanager/interfaces/abstract_resource_resolver.py
alghimo/data-manager
98c54934cb704c4e980acdfcc2206d740dd1ec03
[ "Apache-2.0" ]
null
null
null
from abc import ABC, abstractmethod from typing import TypeVar, Generic T = TypeVar("T") class AbstractResourceResolver(Generic[T], ABC): """ The resolver takes care of creating fully qualified names from resource keys. For instance, when working with files this would be the file path, when working with databases it will be the fully qualified table name, etc.. """ @abstractmethod def resolve(self, key: str) -> T: pass
30.733333
83
0.709328
63
461
5.190476
0.698413
0.04893
0.091743
0
0
0
0
0
0
0
0
0
0.219089
461
15
84
30.733333
0.908333
0.479393
0
0
0
0
0.004608
0
0
0
0
0
0
1
0.142857
false
0.142857
0.285714
0
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
b4f450aa99093525879013746d82ec4c365abcd8
3,409
py
Python
synergy/db/model/job.py
eggsandbeer/scheduler
18ad32bd7b824ca334e2c5a1bbd10f599dfc2c82
[ "BSD-3-Clause" ]
null
null
null
synergy/db/model/job.py
eggsandbeer/scheduler
18ad32bd7b824ca334e2c5a1bbd10f599dfc2c82
[ "BSD-3-Clause" ]
null
null
null
synergy/db/model/job.py
eggsandbeer/scheduler
18ad32bd7b824ca334e2c5a1bbd10f599dfc2c82
[ "BSD-3-Clause" ]
null
null
null
__author__ = 'Bohdan Mushkevych' from odm.document import BaseDocument from odm.fields import StringField, ObjectIdField, ListField, IntegerField MAX_NUMBER_OF_LOG_ENTRIES = 32 TIMEPERIOD = 'timeperiod' PROCESS_NAME = 'process_name' START_OBJ_ID = 'start_obj_id' END_OBJ_ID = 'end_obj_id' STATE = 'state' RELATED_UNIT_OF_WORK = 'related_unit_of_work' NUMBER_OF_FAILURES = 'number_of_failures' # contains list of MAX_NUMBER_OF_LOG_ENTRIES last log messages HISTORIC_LOG = 'historic_log' # given Job was _not_ processed by aggregator because of multiple errors/missing data # this state allows to mute current Job abd allow other timeperiods/Jobs to be processed # only manual "re-processing" can re-run the skipped Job STATE_SKIPPED = 'state_skipped' # given Job was successfully processed by an aggregator # no further processing for this Job is performed STATE_PROCESSED = 'state_processed' # no processing was performed for this Job # no further processing for this Job is performed STATE_NOOP = 'state_noop' # Scheduler assumes that all timeperiod data is in the database, and asks an aggregator to run a "final" aggregation # Job will be marked as STATE_PROCESSED afterwards if the processing succeed STATE_FINAL_RUN = 'state_final_run' # Aggregator is asked to perform a routine aggregation. # Further state of the Job depends on the governing state machine: # it could be either STATE_PROCESSED, STATE_IN_PROGRESS, STATE_NOOP, STATE_FINAL_RUN or STATE_SKIPPED STATE_IN_PROGRESS = 'state_in_progress' # Given timetable record serves as place-holder in the Tree # TimeRecord can move to STATE_IN_PROGRESS STATE_EMBRYO = 'state_embryo' class Job(BaseDocument): """ class presents status for the time-period, and indicates whether data was process by particular process""" db_id = ObjectIdField('_id', null=True) process_name = StringField(PROCESS_NAME) timeperiod = StringField(TIMEPERIOD) start_id = ObjectIdField(START_OBJ_ID) end_id = ObjectIdField(END_OBJ_ID) state = StringField(STATE, choices=[STATE_IN_PROGRESS, STATE_PROCESSED, STATE_FINAL_RUN, STATE_EMBRYO, STATE_SKIPPED, STATE_NOOP]) related_unit_of_work = ObjectIdField(RELATED_UNIT_OF_WORK) log = ListField(HISTORIC_LOG) number_of_failures = IntegerField(NUMBER_OF_FAILURES, default=0) @BaseDocument.key.getter def key(self): return self.process_name, self.timeperiod @key.setter def key(self, value): """ :param value: tuple (name of the process, timeperiod as string in Synergy Data format) """ self.process_name = value[0] self.timeperiod = value[1] @property def is_active(self): return self.state in [STATE_FINAL_RUN, STATE_IN_PROGRESS, STATE_EMBRYO] @property def is_finished(self): return self.state in [STATE_PROCESSED, STATE_SKIPPED, STATE_NOOP] @property def is_processed(self): return self.state == STATE_PROCESSED @property def is_noop(self): return self.state == STATE_NOOP @property def is_skipped(self): return self.state == STATE_SKIPPED @property def is_embryo(self): return self.state == STATE_EMBRYO @property def is_in_progress(self): return self.state == STATE_IN_PROGRESS @property def is_final_run(self): return self.state == STATE_FINAL_RUN
34.09
116
0.7445
474
3,409
5.103376
0.301688
0.026044
0.052088
0.062836
0.195122
0.058702
0.037205
0.037205
0.037205
0
0
0.001808
0.188618
3,409
99
117
34.434343
0.87274
0.345556
0
0.133333
0
0
0.091198
0
0
0
0
0
0
1
0.166667
false
0
0.033333
0.15
0.516667
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
b4f93b9450eed02e00244a8c824d6cbeda2da9f1
1,432
py
Python
simtbx/diffBragg/attr_list.py
dperl-sol/cctbx_project
b9e390221a2bc4fd00b9122e97c3b79c632c6664
[ "BSD-3-Clause-LBNL" ]
155
2016-11-23T12:52:16.000Z
2022-03-31T15:35:44.000Z
simtbx/diffBragg/attr_list.py
dperl-sol/cctbx_project
b9e390221a2bc4fd00b9122e97c3b79c632c6664
[ "BSD-3-Clause-LBNL" ]
590
2016-12-10T11:31:18.000Z
2022-03-30T23:10:09.000Z
simtbx/diffBragg/attr_list.py
dperl-sol/cctbx_project
b9e390221a2bc4fd00b9122e97c3b79c632c6664
[ "BSD-3-Clause-LBNL" ]
115
2016-11-15T08:17:28.000Z
2022-02-09T15:30:14.000Z
from __future__ import division """ critical properties of diffBragg objects which should be logged for reproducibility """ # TODO : implement a savestate and getstate for these objects # attrs of diffBragg() instances DIFFBRAGG_ATTRS = [ 'Amatrix', 'Bmatrix', 'Ncells_abc', 'Ncells_abc_aniso', 'Ncells_def', 'Npix_to_allocate', 'Omatrix', 'Umatrix', 'beamsize_mm', 'compute_curvatures', 'default_F', 'detector_thick_mm', 'detector_thickstep_mm', 'detector_thicksteps', 'detector_twotheta_deg', 'device_Id', 'diffuse_gamma', 'diffuse_sigma', 'exposure_s', 'fluence', 'flux', 'has_anisotropic_mosaic_spread', 'interpolate', 'isotropic_ncells', 'lambda_coefficients', 'mosaic_domains', 'mosaic_spread_deg', 'no_Nabc_scale', 'nopolar', 'only_diffuse', 'only_save_omega_kahn', 'oversample', 'oversample_omega', 'phi_deg', 'phistep_deg', 'phisteps', 'point_pixel', 'polar_vector', 'polarization', 'spindle_axis', 'spot_scale', 'twotheta_axis', 'unit_cell_Adeg', 'unit_cell_tuple', 'use_diffuse', 'use_lambda_coefficients'] # properties of nanoBragg_crystal.NBcryst instances NB_CRYST_ATTRS = [ 'anisotropic_mos_spread_deg', 'isotropic_ncells', 'miller_is_complex', 'mos_spread_deg', 'n_mos_domains', 'symbol', 'xtal_shape'] # properties of nanoBragg_beam.NBbeam instances NB_BEAM_ATTRS = [ 'divergence', 'polarization_fraction', 'size_mm', 'number_of_sources', 'unit_s0']
18.842105
83
0.74162
171
1,432
5.766082
0.649123
0.036511
0.042596
0
0
0
0
0
0
0
0
0.000796
0.122207
1,432
75
84
19.093333
0.783612
0.130587
0
0.032258
0
0
0.660574
0.122715
0
0
0
0.013333
0
1
0
false
0
0.016129
0
0.016129
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
2
3712e528ebc57eaa9774a8a00d9c212c77e54ca6
4,627
py
Python
ENCODN/TOOLS/CRYPTOGRAPHY/OTHER/ROZIERCYPHER/ROZIER.py
chrisyo99/ENCODN
578a5eb87b68e4ba5ebb1c87808ad04aa160df5e
[ "MIT" ]
6
2020-10-07T13:09:38.000Z
2021-01-16T17:16:51.000Z
ENCODN/TOOLS/CRYPTOGRAPHY/OTHER/ROZIERCYPHER/ROZIER.py
chrisyo99/ENCODN
578a5eb87b68e4ba5ebb1c87808ad04aa160df5e
[ "MIT" ]
27
2020-10-09T09:14:23.000Z
2021-01-22T07:16:43.000Z
ENCODN/TOOLS/CRYPTOGRAPHY/OTHER/ROZIERCYPHER/ROZIER.py
chrisyo99/ENCODN
578a5eb87b68e4ba5ebb1c87808ad04aa160df5e
[ "MIT" ]
14
2020-10-07T14:25:59.000Z
2021-02-21T16:54:37.000Z
""" Information on the Rozier Cipher can be found at: https://www.dcode.fr/rozier-cipher ROZIER.py Written by: MrLukeKR Updated: 16/10/2020 """ # The Rozier cipher needs a string based key, which can be constant for ease # or changed for each message, for better security constant_key = "DCODE" def encrypt(plaintext: str, key: str=constant_key): """ Encrypts a plaintext string using the Rozier cipher and a constant key. Optionally, the function can accept a different key as a parameter. """ # Convert plaintext to upper case plaintext = plaintext.upper() # Initialise the ciphertext string to the empty string ciphertext = "" # Iterate over every letter in the plaintext string for index, letter in enumerate(plaintext): # Get the first and second letters of the key at index of letter, # using modulus to allow for a key to be repeated first_key = key[index % len(key)] second_key = key[(index + 1) % len(key)] # Get the position in the alphabet of the current plaintext letter. # Negating the ASCII value of capital A allows us to convert from # an ASCII code to alphabet position. letter_position = ord(letter) - ord('A') # Convert the first and second key values to ASCII codes first_key_value = ord(first_key) second_key_value = ord(second_key) # Use the first and second key ASCII codes to determine the distance # between the two letters. Negative values indicate that the ciphertext # letter moves to the right of the current letter and positive values # indicate a move to the left key_distance = second_key_value - first_key_value # Calculate the ciphertext letter by adding the original plaintext # letter to the key distance derived from the two letters from the key. # Modulus is applied to this to keep the letter within the bounds of # the alphabet (numbers and special characters are not supported). # This is added to the ASCII code for capital A to convert from # alphabet space back into an ASCII code cipher_letter_value = ord('A') + ((letter_position + key_distance) % 26) # Convert the ASCII code to a character cipher_letter = chr(cipher_letter_value) # Add the character to the total ciphertext string ciphertext += cipher_letter return ciphertext def decrypt(ciphertext: str, key: str=constant_key): """ Decrypts a ciphertext string using the Rozier cipher and a constant key. Optionally, the function can accept a different key as a parameter. """ # Convert ciphertext to upper case ciphertext = ciphertext.upper() # Initialise the plaintext string to the empty string plaintext = "" # Iterate over every letter in the ciphertext string for index, letter in enumerate(ciphertext): # Get the first and second letters of the key at index of letter, using # modulus to allow for a key to be repeated first_key = key[index % len(key)] second_key = key[(index + 1) % len(key)] # Get the position in the alphabet of the current ciphertext letter. # Negating the ASCII value of capital A allows us to convert from # an ASCII code to alphabet position. letter_position = ord(letter) - ord('A') # Convert the first and second key values to ASCII codes first_key_value = ord(first_key) second_key_value = ord(second_key) # Use the first and second key ASCII codes to determine the distance # between the two letters. Negative values indicate that the plaintext # letter moves to the right of the current letter and positive values # indicate a move to the left key_distance = second_key_value - first_key_value # Calculate the plaintext letter by subtracting the key distance derived # from the two letters from the key, from the original ciphertext letter # position. # Modulus is applied to this to keep the letter within the bounds of # the alphabet (numbers and special characters are not supported). # This is added to the ASCII code for capital A to convert from # alphabet space back into an ASCII code plain_letter_value = ord('A') + ((letter_position - key_distance) % 26) # Convert the ASCII code to a character plain_letter = chr(plain_letter_value) # Add the character to the total plaintext string plaintext += plain_letter return plaintext
40.234783
80
0.685758
656
4,627
4.765244
0.199695
0.034549
0.021113
0.03263
0.743442
0.716571
0.679463
0.679463
0.65643
0.65643
0
0.004107
0.263238
4,627
114
81
40.587719
0.912878
0.620488
0
0.413793
0
0
0.005402
0
0
0
0
0
0
1
0.068966
false
0
0
0
0.137931
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
37142a2768a71aca4c786f5f03f214574e278dfd
3,324
py
Python
tests/highlevel/simpler-deepcell.py
sjdv1982/seamless
1b814341e74a56333c163f10e6f6ceab508b7df9
[ "MIT" ]
15
2017-06-07T12:49:12.000Z
2020-07-25T18:06:04.000Z
tests/highlevel/simpler-deepcell.py
sjdv1982/seamless
1b814341e74a56333c163f10e6f6ceab508b7df9
[ "MIT" ]
110
2016-06-21T23:20:44.000Z
2022-02-24T16:15:22.000Z
tests/highlevel/simpler-deepcell.py
sjdv1982/seamless
1b814341e74a56333c163f10e6f6ceab508b7df9
[ "MIT" ]
6
2016-06-21T11:19:22.000Z
2019-01-21T13:45:39.000Z
from seamless.highlevel import Context from pprint import pprint ctx = Context() ctx.a = 12 ctx.compute() print(ctx.a.value) print(ctx.a.schema) # None def triple_it(a): return 3 * a def triple_it_b(a, b): print("RUN!") return 3 * a + b ctx.transform = triple_it ctx.transform.debug.direct_print = True ctx.transform.hash_pattern = {"*": "#"} ctx.transform.debug.direct_print = True ctx.transform.a = 1 print("START") ctx.compute() print(ctx.transform.inp.value, ctx.transform.result.value) ctx.transform.a = ctx.a ctx.transform.example.a = 99 ctx.compute() print(ctx.a.value, ctx.transform.inp.value) print(ctx.transform.inp.schema) ctx.myresult = ctx.transform ctx.compute() print(ctx.a.value, ctx.transform.inp.value) print(ctx.transform.result.value) ctx.tfcode = ctx.transform.code.pull() ctx.compute() print(ctx.transform.result.value, ctx.myresult.value) ctx.tfcode = triple_it_b ''' #or: ctx.transform = triple_it_b ctx.transform.a = ctx.a ctx.myresult = ctx.transform ''' ctx.compute() print(ctx.transform.inp.value) print("NO RESULT", ctx.transform.result.value, ctx.myresult.value) print("TRANSFORMER EXCEPTION", ctx.transform.exception) ctx.transform.b = 100 ctx.compute() print(ctx.transform.inp.value) print("RESULT", ctx.transform.result.value, ctx.myresult.value) print("START") ctx.a = 13 ctx.compute() print(ctx.a.value) print(ctx.transform.inp.value) print("RESULT", ctx.transform.result.value, ctx.myresult.value) ctx.transform.example.b = "test" # modification of schema => .inp exception ctx.translate() print("TRANSFORMER INPUT EXCEPTION", ctx.transform.inp.exception) # None print(ctx.transform.inp.value) ctx.compute() print("TRANSFORMER INPUT EXCEPTION", ctx.transform.inp.exception) # jsonschema.exceptions.ValidationError: 100 is not of type 'string' ###print("TF STATUS", ctx.transform.status) ###ctx.translate(force=True); ctx.compute() ### ERROR print(ctx.transform.inp.schema) ###print("INPUT EXCEPTION", ctx.transform.inp.exception) print(ctx.transform.inp.value) # None print(ctx.transform._get_tf().inp.auth.value) # As of Seamless 0.2, this gives {'a': 1, 'b': 100} # The a=1 is not cleared when the connection is broken! print("TRANSFORMER STATUS", ctx.transform.status) print("START!") ctx.transform.b = "testing" ctx.compute() print(ctx.transform._get_tf().inp.auth.value) # {'a': 1, 'b': "testing"} print(ctx.transform._get_tf().inp.buffer.value) # {'a': 13, 'b': "testing"} print(ctx.transform.inp.value) # {'a': 13, 'b': 'testing'} print(ctx.myresult.value) # None print("TRANSFORMER INPUT EXCEPTION", ctx.transform.inp.exception) # None print("TRANSFORMER STATUS", ctx.transform.status) print("TRANSFORMER EXCEPTION", ctx.transform.exception) print("START2") ctx.translate(force=True); ctx.compute() print(ctx.myresult.value) # None print("TRANSFORMER INPUT EXCEPTION", ctx.transform.inp.exception) # None print("TRANSFORMER STATUS", ctx.transform.status) print("TRANSFORMER EXCEPTION", ctx.transform.exception) print("START3") ctx.tfcode = triple_it del ctx.transform.pins.b ctx.compute() print(ctx.myresult.value) print("TRANSFORMER INPUT STATUS", ctx.transform.inp.status) print("TRANSFORMER STATUS", ctx.transform.status) print(ctx.transform.inp.schema) print(ctx.transform.inp.data)
30.777778
134
0.73225
483
3,324
5.00207
0.161491
0.258278
0.117964
0.081954
0.726821
0.681291
0.542219
0.473924
0.305464
0.282699
0
0.009774
0.107401
3,324
107
135
31.065421
0.804516
0.140193
0
0.560976
0
0
0.121622
0
0
0
0
0
0
1
0.02439
false
0
0.02439
0.012195
0.073171
0.585366
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
371f8ef580118827f3f0d0fba4c653c6f27eaf69
740
py
Python
setup.py
Mattjez914/Blackjack_Microchallenge
c4f60b62a3ada14663eb30ce72563af994e1eda4
[ "Apache-2.0" ]
null
null
null
setup.py
Mattjez914/Blackjack_Microchallenge
c4f60b62a3ada14663eb30ce72563af994e1eda4
[ "Apache-2.0" ]
null
null
null
setup.py
Mattjez914/Blackjack_Microchallenge
c4f60b62a3ada14663eb30ce72563af994e1eda4
[ "Apache-2.0" ]
1
2019-04-17T06:12:23.000Z
2019-04-17T06:12:23.000Z
import learntools from setuptools import setup from setuptools import find_packages setup(name='learntools', version=learntools.__version__, description='Utilities for Kaggle Learn exercises', url='http://github.com/kaggle/learntools', author='Dan Becker', author_email='dan@kaggle.com', license='Apache 2.0', packages=find_packages(), zip_safe=True) # SETUP. You don't need to worry for now about what this code does or how it works. # If you're curious about the code, it's available under an open source license at https://github.com/Kaggle/learntools/ from learntools.core import binder; binder.bind(globals()) from learntools.python.ex3 import q7 as blackjack print('Setup complete.')
38.947368
120
0.737838
105
740
5.12381
0.657143
0.052045
0.074349
0.092937
0
0
0
0
0
0
0
0.006472
0.164865
740
19
121
38.947368
0.864078
0.271622
0
0
0
0
0.242086
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0.066667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
2
372e7aa4b02b743d5cd7b6c3f4b391ee437c82f6
256
py
Python
earth_engine/apps.py
ecsnavarretemit/sarai-satellite-analysis-backend
73de6c4cac37889efff49b9be085f3c733e27702
[ "MIT" ]
null
null
null
earth_engine/apps.py
ecsnavarretemit/sarai-satellite-analysis-backend
73de6c4cac37889efff49b9be085f3c733e27702
[ "MIT" ]
null
null
null
earth_engine/apps.py
ecsnavarretemit/sarai-satellite-analysis-backend
73de6c4cac37889efff49b9be085f3c733e27702
[ "MIT" ]
null
null
null
# admin.py # # Copyright(c) Exequiel Ceasar Navarrete <esnavarrete1@up.edu.ph> # Licensed under MIT # Version 0.0.0 from __future__ import unicode_literals from django.apps import AppConfig class EarthEngineConfig(AppConfig): name = 'earth_engine'
18.285714
65
0.769531
34
256
5.617647
0.852941
0.020942
0
0
0
0
0
0
0
0
0
0.018265
0.144531
256
13
66
19.692308
0.853881
0.410156
0
0
0
0
0.083916
0
0
0
0
0
0
1
0
false
0
0.5
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
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
37324e5514d40a1e4f6fc7ae82b9119d2c9de22e
2,249
py
Python
templates/fastApiService/zarubaServiceName/main.py
state-alchemists/zaruba
2c689c920df3589168ec81664b92110021892464
[ "Apache-2.0" ]
39
2020-03-13T19:41:11.000Z
2022-02-14T02:01:00.000Z
templates/fastApiService/zarubaServiceName/main.py
state-alchemists/zaruba
2c689c920df3589168ec81664b92110021892464
[ "Apache-2.0" ]
5
2020-08-01T08:55:48.000Z
2022-02-10T00:55:39.000Z
templates/fastApiService/zarubaServiceName/main.py
state-alchemists/zaruba
2c689c920df3589168ec81664b92110021892464
[ "Apache-2.0" ]
4
2020-11-10T20:45:12.000Z
2021-03-18T06:18:55.000Z
from fastapi import FastAPI from fastapi.staticfiles import StaticFiles from sqlalchemy import create_engine from helpers.transport import RMQEventMap, KafkaEventMap, get_rmq_connection_parameters, get_kafka_connection_parameters from configs.helper import get_abs_static_dir, create_message_bus, create_rpc import os db_url = os.getenv('ZARUBA_SERVICE_NAME_SQLALCHEMY_DATABASE_URL', 'sqlite://') rmq_connection_parameters = get_rmq_connection_parameters( host = os.getenv('ZARUBA_SERVICE_NAME_RABBITMQ_HOST', 'localhost'), user = os.getenv('ZARUBA_SERVICE_NAME_RABBITMQ_USER', 'root'), password = os.getenv('ZARUBA_SERVICE_NAME_RABBITMQ_PASS', 'toor'), virtual_host = os.getenv('ZARUBA_SERVICE_NAME_RABBITMQ_VHOST', '/'), heartbeat=30 ) rmq_event_map = RMQEventMap({}) kafka_connection_parameters = get_kafka_connection_parameters( bootstrap_servers = os.getenv('ZARUBA_SERVICE_NAME_KAFKA_BOOTSTRAP_SERVERS', 'localhost:9093'), sasl_mechanism=os.getenv('ZARUBA_SERVICE_NAME_KAFKA_SASL_MECHANISM', 'PLAIN'), sasl_plain_username=os.getenv('ZARUBA_SERVICE_NAME_KAFKA_SASL_PLAIN_USERNAME', ''), sasl_plain_password=os.getenv('ZARUBA_SERVICE_NAME_KAFKA_SASL_PLAIN_PASSWORD', '') ) kafka_event_map = KafkaEventMap({}) mb_type = os.getenv('ZARUBA_SERVICE_NAME_MESSAGE_BUS_TYPE', 'local') rpc_type = os.getenv('ZARUBA_SERVICE_NAME_RPC_TYPE', 'local') enable_http_handler = os.getenv('ZARUBA_SERVICE_NAME_ENABLE_HTTP_HANDLER', '1') != '0' enable_event_handler = os.getenv('ZARUBA_SERVICE_NAME_ENABLE_EVENT_HANDLER', '1') != '0' enable_rpc_handler = os.getenv('ZARUBA_SERVICE_NAME_ENABLE_RPC_HANDLER', '1') != '0' static_url = os.getenv('ZARUBA_SERVICE_NAME_STATIC_URL', '/static') static_dir = get_abs_static_dir(os.getenv('ZARUBA_SERVICE_NAME_STATIC_DIR', '')) engine = create_engine(db_url, echo=True) app = FastAPI(title='zarubaServiceName') mb = create_message_bus(mb_type, rmq_connection_parameters, rmq_event_map, kafka_connection_parameters, kafka_event_map) rpc = create_rpc(rpc_type, rmq_connection_parameters, rmq_event_map) @app.on_event('shutdown') def on_shutdown(): mb.shutdown() rpc.shutdown() if static_dir != '': app.mount(static_url, StaticFiles(directory=static_dir), name='static')
48.891304
120
0.803468
308
2,249
5.38961
0.237013
0.077108
0.13494
0.20241
0.442771
0.442771
0.226506
0.046988
0
0
0
0.005834
0.085371
2,249
46
121
48.891304
0.801167
0
0
0
0
0
0.306667
0.262222
0
0
0
0
0
1
0.025641
false
0.051282
0.153846
0
0.179487
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
1
0
0
0
0
0
2
2ea653e279e69de83e480c6b72197a40442f52f8
435
py
Python
scripts/classtest.py
alandegenhart/neuropy
a9f7b735da78a5296f648cb3bb94c1c31843c668
[ "MIT" ]
1
2020-09-03T19:33:48.000Z
2020-09-03T19:33:48.000Z
scripts/classtest.py
alandegenhart/neuropy
a9f7b735da78a5296f648cb3bb94c1c31843c668
[ "MIT" ]
null
null
null
scripts/classtest.py
alandegenhart/neuropy
a9f7b735da78a5296f648cb3bb94c1c31843c668
[ "MIT" ]
null
null
null
"""Class static method test""" class TestClass(): """Test class""" def __init__(self, a=1, b=2): self.a = a self.b = b def add(self): return self.a + self.b @staticmethod def static_add(a, b): return 2 * a + 2 * b def add2(self): return self.static_add(self.a, self.b) if __name__ == '__main__': C = TestClass(a=1, b=2) print(C.add()) print(C.add2())
16.730769
46
0.528736
66
435
3.272727
0.318182
0.092593
0.083333
0.037037
0
0
0
0
0
0
0
0.026667
0.310345
435
25
47
17.4
0.693333
0.08046
0
0
0
0
0.020566
0
0
0
0
0
0
1
0.266667
false
0
0
0.2
0.533333
0.133333
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
2ea9eb3263cf5ab011a34c951f427040e1522b17
29,789
py
Python
q_dic.py
1ahmedg/quote-script
852d7bb88d5edc282080a9f86387df67eab270ed
[ "MIT" ]
null
null
null
q_dic.py
1ahmedg/quote-script
852d7bb88d5edc282080a9f86387df67eab270ed
[ "MIT" ]
null
null
null
q_dic.py
1ahmedg/quote-script
852d7bb88d5edc282080a9f86387df67eab270ed
[ "MIT" ]
null
null
null
# Quotes from: https://www.notion.so/Quotes-by-Naval-Ravikant-3edaf88cfc914b06a98b58b62b6dc222 dic = [\ "Read what you love until you love to read.",\ "True Wisdom Comes From Understanding, Not Memorization.",\ "Meditation is the art of doing nothing. You cannot do meditation. By definition, if you’re doing something, you’re not in meditation. Meditation is a state you’re in when you’re not doing anything – physically, mentally, or consciously. You’re just making no effort. You’re literally being completely still, physically and mentally, inside and out.",\ "You’re actually in deep meditation all the time. It’s just covered up by all the noise and all the thoughts and all the emotional things that are running through you. It’s always there underneath.",\ "Every psychedelic state that people encounter using so-called plant medicines can be arrived at just through pure meditation.",\ "You can meditate 24/7. Meditation is not a sit-down and close your eyes activity. Meditation is basically watching your own thoughts like you would watch anything else in the outside world and saying, ‘Why am I having that thought? Does that serve me anymore? Is this just conditioning from when I was 10 years?’",\ "Most smart people, over time, realize that possessions don’t make them happy.",\ "Anything you wanted in your life – whether it was a car, whether it was a girl, or whether it was money – when you got it, a year later, you were back to zero. Your brain had hedonically adapted to it, and you were looking for the next thing.",\ "If you’re smart, you should be able to figure out how to be happy. Otherwise, you’re not that smart.",\ "Just like fitness can be a choice, health can be a choice, nutrition can be a choice, and working hard and making money can be a choice, happiness can be a choice as well.",\ "Reality is neutral. Reality has no judgments. To a tree, there’s no concept of right or wrong or good or bad. You’re born, you have a whole set of sensory experiences… and then you die. How you choose to interpret that is up to you. And you do have that choice.",\ "In every moment, in everything that happens, you can look on the bright side of something… There are two ways of seeing almost everything.",\ "Desire to me is a contract that you make with yourself to be unhappy until you get what you want.",\ "Pick your one overwhelming desire – it’s okay to suffer over that one. But on all the other desires, let them go so you can be calm and peaceful and relaxed.",\ "Desire is suffering… every desire you have is an axis where you will suffer. So just don’t focus on more than one desire at a time. The universe is rigged in such a way that if you just want one thing, and you focus on that, you’ll get it, but everything else you gotta let go.",\ "In today’s day and age, many people think you get peace by resolving all your external problems, but there are unlimited external problems. The only way to actually get peace on the inside is by giving up the idea of having problems.",\ "To me, peace is happiness at rest, and happiness is peace in motion. You can convert peace to happiness anytime you want.",\ "A clear mind leads to better judgment and better outcomes. A happy, calm, and peaceful person will make better decisions. So if you want to operate at peak performance, you have to learn how to tame your mind.",\ "Look at your own experiences; your bliss from success never lasts, nor does your misery from failure." "The way to survive in modern society is to be an ascetic; it is to retreat from society." "You have society in your phone, society in your pocket, society in your ears… It’s socializing you and programming everyone. The only solution is to turn it off.",\ "In a first-world society, success and failure is much more about how you control, manage, and break addictions than it is about going out and doing something.",\ "A lot of what creates unhappiness in modern society is the struggle between what society wants and what the individual wants… Guilt is just society’s voice talking in your head.",\ "You’re better off following your genuine intellectual curiosity than chasing whatever’s hot right now.",\ "Retirement is when you stop sacrificing today for some imaginary tomorrow.",\ "Your real resume is just a cataloging of all your suffering." "When you do things for their own sake, that’s when you create your best work. That’s when it’s art.",\ "The smaller the company you work for, the happier you’ll be." "I value freedom above anything else. Freedom to do what I want, freedom from not doing what I don’t want to do, and freedom from my own reactions and emotions…things that may disturb my peace.",\ "I don’t care how rich you are. I don’t care whether you’re a top Wall Street banker. If somebody has to tell you when to be at work, what to wear and how to behave, you’re not a free person. You’re not actually rich.",\ "If you have to wear a tie to work, you’re not really free. If you have to be at your desk at a certain time, you’re not free.",\ "What you do, who you do it with, and how you do it is WAY more important than how hard you work." "8 hours of input does not equate to the same output for every single person (your output is based on the quality of work you put in)." "You HAVE to know how to learn anything you want to learn. There should be no book in the library that scares you." "When you’re reading a book, and you’re not understanding a lot of what it’s saying, and there’s a lot of confusion in your mind about it, that confusion is similar to the burn you get in the gym when you’re working out, except you’re building mental, instead of physical, muscles.",\ "If you’re a perpetual learning machine, you will never be out of options on how to make money.",\ "Today in society, you get rewarded for creative work, for creating something brand new that society didn’t even know that it wanted that it doesn’t yet know how to get, other than through you.",\ "No matter how high your bar is, raise your bar… You can never be working with other people who are great enough. If there’s someone greater out there to work with, you should go work with them.",\ "Worry about working hard only AFTER you’ve picked the right thing to work on and the right people to work with." "Specific knowledge is the stuff that feels like play to you but looks like work to others. It’s found by pursuing your innate talents, your genuine curiosity, and your passion." "If you’re not 100% into it, then someone else who is 100% into it will outperform you.",\ "No one can compete with you on being you.",\ "Embrace accountability and take business risks under your own name." "Busy is the death of productivity.",\ "You have to get bored before you can get creative… You can’t be creative on schedule.",\ "I need 4-5 hours of time by myself every day doing NOTHING. Because if I don’t have that time, I won’t be able to do ANYTHING.",\ "I believe everybody can be wealthy. It’s not a zero-sum game; it’s a positive-sum game.",\ "People who are living far below their means enjoy a freedom that people busy upgrading their lifestyle just can’t fathom." "All the benefits in life come from compound interest, whether in relationships, life, your career, health, or learning." "You’re not going to get rich renting out your time. Aim to have a job, career, or profession where your inputs don’t match your output." "Successful people have a strong action bias." "Productize yourself." "Aim to become so good at something, that luck eventually finds you. Over time, it isn’t luck; it’s destiny." "The 5 most important skills are reading, writing, arithmetic, persuasion, and computer programming." "The number of iterations drives the learning curve." "If you’re good with computers, if you’re good at basic math, if you’re good at writing, if you’re good at speaking, and if you like reading, you’re set for life.",\ "Get comfortable with frequent, small failures." "If you’re willing to bleed a little bit every day, but in exchange, you win big later, you’ll be better off." "Become the best in the world at what you do. Keep redefining what you do until this is true." "Reject most advice but remember you have to listen to/read enough of it to know what to reject and what to accept." "In entrepreneurship, you just have to be right ONCE. The good news is you can take as many shots on goal as you want." "Know that your physical health, mental health, and your relationships will bring you more peace and happiness than any amount of money ever will." "It’s good for everybody to realize that at this point in human history, you are basically no longer a citizen of your nation. Wherever you live, whoever you are, you have one foot in the internet. The internet is the real country.",\ "If all of your beliefs line up into one political party, you’re not a clear thinker. If all your beliefs are the same as your neighbors and your friends, you’re not a clear thinker; your beliefs are taken from other people. If you want to be a clear thinker, you cannot pay attention to politics; it will destroy your ability to think.",\ "Fair doesn’t exist in the world. If you’re going to obsess over fair, you’ll never get anywhere in life. You basically just have to do the best you can, with the cards you’re dealt.",\ "Pick three hobbies: One that makes you money, one that makes you fit, and one that keeps you creative.",\ "A lot of wisdom is just realizing the long-term consequences of your actions. The longer-term you’re willing to look, the wiser you’re going to seem to everybody around you.",\ # """llusion #1: The illusion of meaning # We’re all going to die, and everything will turn to dust – how can anything have meaning?""",\ "IMHO the three big ones in life are wealth, health, and happiness. We pursue them in that order but their importance is in the reverse." "You can have the mind or you can have the moment.",\ "Ego is false confidence, self-respect is true confidence." "No one can compete with you on being you. Most of life is a search for who and what needs you the most." "A rational person can find peace by cultivating indifference to things outside of their control.",\ "Success is the enemy of learning. It can deprive you of the time and the incentive to start over. Beginner’s mind also needs beginner’s time." "Escape competition through authenticity.",\ "The heart decides, the head rationalizes." "The fundamental delusion — there is something out there that will make you happy and fulfilled forever.",\ "All the benefits in life come from compound interest — money, relationships, habits — anything of importance.",\ "The compound interest from many quick small iterations is greater than the compound interest from a few slow big iterations. Compound interest operates in most intellectual and social domains." "Relax. You’ll live longer *and* perform better." "Twitter is television for intellectuals." "If you can't decide, the answer is No." "You don’t get rich by spending your time to save money. You get rich by saving your time to make money." "Trade money for time, not time for money. You’re going to run out of time first." "Seek wealth, not money or status. Wealth is having assets that earn while you sleep. Money is how we transfer time and wealth. Status is your place in the social hierarchy." "Work as hard as you can. Even though who you work with and what you work on are more important than how hard you work.",\ "It is the mark of a charalatan to explain a simple concept in a complex way.",\ "Self-image is the prison. Other people are the guards." "The greatest superpower is the ability to change yourself." "We say 'peace of mind', but really what we want is peace from mind." "A fit body, a calm mind, a house full of love. These things cannot be bought — they must be earned.",\ "Founders run every sprint as if they’re about to lose, but grind out the long race knowing that victory is inevitable." "It's never been easier to start a company. It's never been harder to build one." "An early exit for your startup is a mirage in the desert. If you thirst for it, it disappears.",\ "Read what you love until you love to read." "Wealth creation is an evolutionarily recent positive-sum game. Status is an old zero-sum game. Those attacking wealth creation are often just seeking status." "The reality is life is a single-player game. You’re born alone. You’re going to die alone. All of your interpretations are alone. All your memories are alone. You’re gone in three generations and nobody cares. Before you showed up, nobody cared. It’s all single-player." "Become the best in the world at what you do. Keep redefining what you do until this is true." "In an age of infinite leverage, judgement is the most important skill." "Leverage is a force multiplier for your judgement." "Once you’ve truly controlled your own fate, for better or for worse, you’ll never let anyone else tell you what to do." "You will get rich by giving society what it wants but does not yet know how to get. At scale." "People who try to look smart by pointing out obvious exceptions actually signal the opposite.",\ "The selfish reason to be ethical is that it attracts the other ethical people in the network.",\ "There are no get rich quick schemes. That’s just someone else getting rich off you.",\ "Specific knowledge is found by pursuing your genuine curiosity and passion rather than whatever is hot right now." "Better to find a new audience than to write for the audience." "Learn to sell. Learn to build. If you can do both, you will be unstoppable." "A taste of freedom can make you unemployable." "Your closest friends are the ones you can have a relationship with about nothing." " 'Consensus' is just another way of saying 'average'." "Morality and ethics automatically emerge when we realize the long term consequences of our actions.",\ "The best jobs are neither decreed nor degreed. They are creative expressions of continuous learners in free markets." "The skills you really want can’t be taught, but they can be learned." "Building technology means you don’t have to choose between practicing science, commerce, and art." "Twitter is a much better resumé than LinkedIn." "It is the mark of a charlatan to explain a simple concept in a complex way.",\ "Free education is abundant, all over the internet. It’s the desire to learn that’s scarce.",\ "The internet is the best school ever created. The best peers are on the Internet. The best books are on the Internet. The best teachers are on the Internet. The tools for learning are abundant. It’s the desire to learn that’s scarce." "Teaching is more a way for the teacher to learn than for the student to learn." "A busy mind accelerates the passage of subjective time." "All the value in life, including in relationships, comes from compound interest." "The first rule of handling conflict is don't hang around with people who are constantly engaging in conflict." "If you want to be successful, surround yourself with people who are more successful than you are, but if you want to be happy, surround yourself with people who are less successful than you are." "Pick an industry where you can play long term games with long term people." "The most important trick to be happy is to realize that happiness is a choice that you make and a skill set that you develop. You choose to be happy, and then you work at it. It's just like building muscles." "Don’t do things that you know are morally wrong. Not because someone is watching, but because you are. Self-esteem is just the reputation that you have with yourself. You’ll always know." "If you create intersections, you’re going to have collisions." "The right to debate should not be up for debate." "Knowledge is discovered by all of us, each adding to the whole. Wisdom is rediscovered by each of us, one at a time." "My 1 repeated learning in life: 'There Are No Adults' Everyone's making it up as they go along. Figure it out yourself, and do it." "Making money through an early lucky trade is the worst way to win. The bad habits that it reinforces will lead to a lifetime of losses." "Forty hour workweeks are a relic of the Industrial Age. Knowledge workers function like athletes — train and sprint, then rest and reassess.",\ "Information is everywhere but its meaning is created by the observer that interprets it. Meaning is relative and there is no objective, over-arching meaning.",\ "If you’re more passionate about founding a business than the business itself, you can fall into a ten year trap. Better to stay emotionally unattached and select the best opportunity that arises. Applies to relationships too.",\ "Smart money is just dumb money that’s been through a crash.",\ "The secret to public speaking is to speak as if you were alone.",\ "Notifications are just alarm clocks that someone else is setting for you." "The best way, perhaps the only way, to change others is to become an example." "Sophisticated foods are bittersweet (wine, beer, coffee, chocolate). Addictive relationships are cooperative and competitive. Work becomes flow at the limits of ability. The flavor of life is on the edge.",\ "I think the best way to prepare for the future 20 years is find something you love to do, to have a shot at being one of the best people in the world at it. Build an independent brand around it, with your name." "Technology is not only the thing that moves the human race forward, but it’s the only thing that ever has. Without technology, we’re just monkeys playing in the dirt.",\ "Success is the enemy of learning. It can deprive you of the time and the incentive to start over. Beginner’s mind also needs beginner’s time.",\ "Don’t debate people in the media when you can debate them in the marketplace.",\ "Twitter is a way to broadcast messages to hundreds of millions of people to find the few dozen that you actually want to talk to." "A contrarian isn’t one who always objects — that’s a confirmist of a different sort. A contrarian reasons independently, from the ground up, and resists pressure to conform.",\ "The real struggle isn’t proletariat vs bourgeois. It’s between high-status elites and wealthy elites. When their cooperation breaks, revolution.",\ "Branding requires accountability. To build a great personal brand (an eponymous one), you must take on the risk of being publicly wrong.",\ "If you're going to pick 3 cards in the hand you're dealt, take intelligence, drive, and most importantly, emotional self-discipline." "Before you can lie to another, you must first lie to yourself.",\ "The tools for learning are abundant. It’s the desire to learn that’s scarce.",\ "This is such a short and precious life that it’s really important that you don’t spend it being unhappy.",\ "You make your own luck if you stay at it long enough.",\ "The power to make and break habits and learning how to do that is really important.",\ "Happiness is a choice and a skill and you can dedicate yourself to learning that skill and making that choice.",\ "We’re not really here for that long and we don’t really matter that much. And nothing that we do lasts. So eventually you will fade. Your works will fade. Your children will fade. Your thoughts will fade. This planet will fade. The sun will fade. It will all be gone.",\ "The first rule of handling conflict is don’t hang around people who are constantly engaging in conflict.",\ "The problem happens when we have multiple desires. When we have fuzzy desires. When we want to do ten different things and we’re not clear about which is the one we care about.",\ "People spend too much time doing and not enough time thinking about what they should be doing.",\ "The people who succeed are irrationally passionate about something.",\ "I don’t plan. I’m not a planner. I prefer to live in the moment and be free and to flow and to be happy.",\ "If you see a get rich quick scheme, that’s someone else trying to get rich off of you.",\ "If you try to micromanage yourself all you’re going to do is make yourself miserable.",\ "Social media has degenerated into a deafening cacophony of groups signaling and repeating their shared myths.",\ "If it entertains you now but will bore you someday, it’s a distraction. Keep looking.",\ "If the primary purpose of school was education, the Internet should obsolete it. But school is mainly about credentialing.",\ "Desire is a contract that you make with yourself to be unhappy until you get what you want.",\ "Technology is applied science. Science is the study of nature. Mathematics is the language of nature. Philosophy is the root of mathematics. All tightly interrelated.",\ "Be present above all else.",\ "Who you do business with is just as important as what you choose to do.",\ "If you can’t see yourself working with someone for life, don’t work with them for a day.",\ "Time is the ultimate currency and I should have been more tight fisted with it." "Impatience is a virtue. Self-discipline is another form of self conflict. Find things that excite you." "Earn with your mind, not your time.",\ "Humans are basically habit machines… I think learning how to break habits is actually a very important meta skill and can serve you in life almost better than anything else.",\ "The older the problem, the older the solution.",\ "Humans aren’t evolved to worry about everything happening outside of their immediate environment." "It’s the mark of a charlatan to try and explain simple things in complex ways and it’s the mark of a genius to explain complicated things in simple ways.",\ "The Efficient Markets Hypothesis fails because humans are herd animals, not independent rational actors. Thus the best investors tend to be antisocial and contrarian.",\ "You’re never going to get rich renting out your time.",\ "Lots of literacy in modern society, but not enough numeracy.",\ "Above 'product-market fit', is 'founder-product-market fit'.",\ "Good copy is a poor substitute for good UI. Good marketing is a poor substitute for a good product." "Software is gnawing on Venture Capital." "Society has had multiple stores of value, as none is perfectly secure. Gold, oil, dollars, real estate, (some) bonds & equities. Crypto is the first that’s decentralized *and* digital.",\ "Crypto is a bet against the modern macroeconomic dogma, which is passed off as science, but is really a branch of politics — with rulers, winners, and losers.",\ "The overeducated are worse off than the undereducated, having traded common sense for the illusion of knowledge." "Trade money for time, not time for money. You’re going to run out of time first." "School, politics, sports, and games train us to compete against others. True rewards - wealth, knowledge, love, fitness, and equanimity - come from ignoring others and improving ourselves." "If you eat, invest, and think according to what the ‘news’ advocates, you’ll end up nutritionally, financially and morally bankrupt.",\ "If you’re more passionate about founding a business than the business itself, you can fall into a ten year trap. Better to stay emotionally unattached and select the best opportunity that arises." "Making money through an early lucky trade is the worst way to win. The bad habits that it reinforces will lead to a lifetime of losses." "Your goal in life is to find out the people who need you the most, to find out the business that needs you the most, to find the project and the art that needs you the most. There is something out there just for you.",\ "Yoga cultivates Peace of Body. Meditation cultivates Peace of Mind." "Judgement requires experience, but can be built faster by learning foundational skills." "Tell your friends that you're a happy person. Then you'll be forced to conform to it. You'll have a consistency bias. You have to live up to it. Your friends will expect you to be a happy person." "Clear thinkers appeal to their own authority.",\ "Think clearly from the ground up. Understand and explain from first principles. Ignore society and politics. Acknowledge what you have. Control your emotions.",\ "Cynicism is easy. Mimicry is easy. Optimistic contrarians are the rarest breed.",\ "If they can train you to do it, then eventually they will train a computer to do it.",\ "A great goal in life would be to not have to be in a given place at a given time... Being accountable for your output rather than your input. I would love to be paid purely for my judgment.",\ "If you’re desensitized to the fact that you’re going to die, consider it a different way. As far as you’re concerned, this world is going to end. Now what?",\ "Following your genuine intellectual curiosity is a better foundation for a career than following whatever is making money right now.",\ "Objectively, the world is improving. To the elites, it’s falling apart as their long-lived institutions are flattened by the Internet.",\ "One of the most damaging and widespread social beliefs is the idea that most adults are incapable of learning new skills.",\ "A personal metric: how much of the day is spent doing things out of obligation rather than out of interest?",\ "Caught in a funk? Use meditation, music, and exercise to reset your mood. Then choose a new path to commit emotional energy for rest of day.",\ "To be honest, speak without identity.",\ "A rational person can find peace by cultivating indifference to things outside of their control.",\ "Politics is sports writ large — pick a side, rally the tribe, exchange stories confirming bias, hurl insults and threats at the other side.",\ "People who live far below their means enjoy a freedom that people busy upgrading their lifestyles can’t fathom.",\ "We feel guilt when we no longer want to associate with old friends and colleagues who haven’t changed. The price, and marker, of growth.",\ "The most important trick to be happy is to realize that happiness is a choice that you make and a skill that you develop. You choose to be happy, and then you work at it. It’s just like building muscles.",\ "Don’t do things that you know are morally wrong. Not because someone is watching, but because you are. Self-esteem is just the reputation that you have with yourself.",\ "Anger is a hot coal that you hold in your hand while waiting to throw it at someone else. (Buddhist saying)", "All the real benefits of life come from compound interest.",\ "Total honesty at all times. It’s almost always possible to be honest & positive.",\ "Truth is that which has predictive power.",\ "Watch every thought. Always ask, why am I having this thought?",\ "All greatness comes from suffering.",\ "Love is given, not received.",\ "Enlightenment is the space between your thoughts.",\ "Mathematics is the language of nature.",\ "Every moment has to be complete in and of itself.",\ "So I have no time for short-term things: dinners with people I won’t see again, tedious ceremonies to please tedious people, traveling to places that I wouldn’t go to on vacation.",\ "You can change it, you can accept it, or you can leave it. What is not a good option is to sit around wishing you would change it but not changing it, wishing you would leave it but not leaving it, and not accepting it. It’s that struggle, that aversion, that is responsible for most of our misery. The phrase that I use the most to myself in my head is one word: accept.",\ "I don’t have time is just saying it’s not a priority.",\ "Happiness is a state where nothing is missing.",\ "If you don’t love yourself who will?",\ "If being ethical were profitable everybody would do it.",\ "Someone who is using a lot of fancy words and big concepts probably doesn’t know what they’re talking about. The smartest people can explain things to a child; if you can’t do that, you don’t understand the concept.",\ "School, politics, sports, and games train us to compete against others. True rewards — wealth, knowledge, love, fitness, and equanimity — come from ignoring others and improving ourselves.",\ "Signaling virtue is a vice.",\ "Investing favors the dispassionate. Markets efficiently separate emotional investors from their money.",\ "Reality is neutral. Our reactions reflect back and create our world. Judge, and feel separate and lonely. Anger, and lose peace of mind. Cling, and live in anxiety. Fantasize, and miss the present. Desire, and suffer until you have it. Heaven and hell are right here, right now.",\ "Knowledge is a skyscraper. You can take a shortcut with a fragile foundation of memorization, or build slowly upon a steel frame of understanding.",\ "A busy mind accelerates the perceived passage of time. Buy more time by cultivating peace of mind.",\ "Politics is the exercise of power without merit.",\ "Politics and merit are opposite ends of a spectrum. More political organizations are less productive, have less inequality, and top performers opt out. More merit based organizations have higher productivity, more inequality, and higher odds of internal fracture.",\ # "Doctors won’t make you healthy.\nNutritionists won’t make you slim.\nTeachers won’t make you smart.\nGurus won’t make you calm.\nMentors won’t make you rich.\nTrainers won’t make you fit.\nUltimately, you have to take responsibility. Save yourself.",\ "You have to surrender, at least a little bit, to be the best version of yourself possible.",\ ]
61.168378
376
0.757629
5,200
29,789
4.348269
0.233269
0.011278
0.004334
0.004776
0.171952
0.148246
0.131971
0.121888
0.119057
0.104905
0
0.001563
0.183658
29,789
487
377
61.168378
0.926515
0.016046
0
0.033195
0
0.543568
0.948679
0.000785
0
0
0
0
0
1
0
false
0.037344
0.053942
0
0.053942
0.008299
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2ebc95c774511889dc90b69ea08be7978a3d36fc
2,147
py
Python
example/infer.py
johnson7788/OpenNRE
dedf56d30b1ba8fa4d7fac2791fb89d6b8af4ba0
[ "MIT" ]
5
2021-05-20T02:29:34.000Z
2021-12-21T13:37:39.000Z
example/infer.py
johnson7788/OpenNRE
dedf56d30b1ba8fa4d7fac2791fb89d6b8af4ba0
[ "MIT" ]
null
null
null
example/infer.py
johnson7788/OpenNRE
dedf56d30b1ba8fa4d7fac2791fb89d6b8af4ba0
[ "MIT" ]
4
2021-06-09T07:40:52.000Z
2022-03-11T01:16:08.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2021/3/15 10:40 上午 # @File : infer.py # @Author: johnson # @Contact : github: johnson7788 # @Desc : 推理模型 import opennre def infer_wiki80_cnn_softmax(): model = opennre.get_model('wiki80_cnn_softmax') result = model.infer({ 'text': 'He was the son of Máel Dúin mac Máele Fithrich, and grandson of the high king Áed Uaridnach (died 612).', 'h': {'pos': (18, 46)}, 't': {'pos': (78, 91)}}) print(result) def infer_wiki80_bert_softmax(): """ 有一些错误 :return: """ model = opennre.get_model('wiki80_bert_softmax') result = model.infer({ 'text': 'He was the son of Máel Dúin mac Máele Fithrich, and grandson of the high king Áed Uaridnach (died 612).', 'h': {'pos': (18, 46)}, 't': {'pos': (78, 91)}}) print(result) def infer_wiki80_bertentity_softmax(): model = opennre.get_model('wiki80_bertentity_softmax') result = model.infer({ 'text': 'He was the son of Máel Dúin mac Máele Fithrich, and grandson of the high king Áed Uaridnach (died 612).', 'h': {'pos': (18, 46)}, 't': {'pos': (78, 91)}}) print(result) def infer_tacred_bertentity_softmax(): model = opennre.get_model('tacred_bertentity_softmax') result = model.infer({ 'text': 'He was the son of Máel Dúin mac Máele Fithrich, and grandson of the high king Áed Uaridnach (died 612).', 'h': {'pos': (18, 46)}, 't': {'pos': (78, 91)}}) print(result) def infer_tacred_bert_softmax(): model = opennre.get_model('tacred_bert_softmax') result = model.infer({ 'text': 'He was the son of Máel Dúin mac Máele Fithrich, and grandson of the high king Áed Uaridnach (died 612).', 'h': {'pos': (18, 46)}, 't': {'pos': (78, 91)}}) print(result) if __name__ == '__main__': infer_wiki80_bert_softmax() # infer_tacred_bertentity_softmax() # infer_tacred_bert_softmax()
38.339286
143
0.567303
273
2,147
4.289377
0.249084
0.056362
0.064048
0.085397
0.795901
0.773698
0.643894
0.643894
0.643894
0.643894
0
0.055811
0.290638
2,147
56
144
38.339286
0.713066
0.105729
0
0.606061
0
0.151515
0.363973
0.026413
0
0
0
0
0
1
0.151515
false
0
0.030303
0
0.181818
0.151515
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
2ec96efd7987b372b655db0ecf660d386e3c6beb
6,736
py
Python
nova/virt/libvirt/storage/dmcrypt.py
bopopescu/nova-token
ec98f69dea7b3e2b9013b27fd55a2c1a1ac6bfb2
[ "Apache-2.0" ]
null
null
null
nova/virt/libvirt/storage/dmcrypt.py
bopopescu/nova-token
ec98f69dea7b3e2b9013b27fd55a2c1a1ac6bfb2
[ "Apache-2.0" ]
null
null
null
nova/virt/libvirt/storage/dmcrypt.py
bopopescu/nova-token
ec98f69dea7b3e2b9013b27fd55a2c1a1ac6bfb2
[ "Apache-2.0" ]
2
2017-07-20T17:31:34.000Z
2020-07-24T02:42:19.000Z
begin_unit comment|'# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory' nl|'\n' comment|'# All Rights Reserved' nl|'\n' comment|'#' nl|'\n' comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may' nl|'\n' comment|'# not use this file except in compliance with the License. You may obtain' nl|'\n' comment|'# a copy of the License at' nl|'\n' comment|'#' nl|'\n' comment|'# http://www.apache.org/licenses/LICENSE-2.0' nl|'\n' comment|'#' nl|'\n' comment|'# Unless required by applicable law or agreed to in writing, software' nl|'\n' comment|'# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT' nl|'\n' comment|'# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the' nl|'\n' comment|'# License for the specific language governing permissions and limitations' nl|'\n' comment|'# under the License.' nl|'\n' nl|'\n' name|'import' name|'os' newline|'\n' nl|'\n' name|'from' name|'oslo_concurrency' name|'import' name|'processutils' newline|'\n' name|'from' name|'oslo_log' name|'import' name|'log' name|'as' name|'logging' newline|'\n' name|'from' name|'oslo_utils' name|'import' name|'excutils' newline|'\n' nl|'\n' name|'from' name|'nova' op|'.' name|'i18n' name|'import' name|'_LE' newline|'\n' name|'from' name|'nova' op|'.' name|'virt' op|'.' name|'libvirt' name|'import' name|'utils' newline|'\n' nl|'\n' nl|'\n' DECL|variable|LOG name|'LOG' op|'=' name|'logging' op|'.' name|'getLogger' op|'(' name|'__name__' op|')' newline|'\n' nl|'\n' DECL|variable|_dmcrypt_suffix name|'_dmcrypt_suffix' op|'=' string|"'-dmcrypt'" newline|'\n' nl|'\n' nl|'\n' DECL|function|volume_name name|'def' name|'volume_name' op|'(' name|'base' op|')' op|':' newline|'\n' indent|' ' string|'"""Returns the suffixed dmcrypt volume name.\n\n This is to avoid collisions with similarly named device mapper names for\n LVM volumes\n """' newline|'\n' name|'return' name|'base' op|'+' name|'_dmcrypt_suffix' newline|'\n' nl|'\n' nl|'\n' DECL|function|is_encrypted dedent|'' name|'def' name|'is_encrypted' op|'(' name|'path' op|')' op|':' newline|'\n' indent|' ' string|'"""Returns true if the path corresponds to an encrypted disk."""' newline|'\n' name|'if' name|'path' op|'.' name|'startswith' op|'(' string|"'/dev/mapper'" op|')' op|':' newline|'\n' indent|' ' name|'return' name|'path' op|'.' name|'rpartition' op|'(' string|"'/'" op|')' op|'[' number|'2' op|']' op|'.' name|'endswith' op|'(' name|'_dmcrypt_suffix' op|')' newline|'\n' dedent|'' name|'else' op|':' newline|'\n' indent|' ' name|'return' name|'False' newline|'\n' nl|'\n' nl|'\n' DECL|function|create_volume dedent|'' dedent|'' name|'def' name|'create_volume' op|'(' name|'target' op|',' name|'device' op|',' name|'cipher' op|',' name|'key_size' op|',' name|'key' op|')' op|':' newline|'\n' indent|' ' string|'"""Sets up a dmcrypt mapping\n\n :param target: device mapper logical device name\n :param device: underlying block device\n :param cipher: encryption cipher string digestible by cryptsetup\n :param key_size: encryption key size\n :param key: encryption key as an array of unsigned bytes\n """' newline|'\n' name|'cmd' op|'=' op|'(' string|"'cryptsetup'" op|',' nl|'\n' string|"'create'" op|',' nl|'\n' name|'target' op|',' nl|'\n' name|'device' op|',' nl|'\n' string|"'--cipher='" op|'+' name|'cipher' op|',' nl|'\n' string|"'--key-size='" op|'+' name|'str' op|'(' name|'key_size' op|')' op|',' nl|'\n' string|"'--key-file=-'" op|')' newline|'\n' name|'key' op|'=' string|"''" op|'.' name|'join' op|'(' name|'map' op|'(' name|'lambda' name|'byte' op|':' string|'"%02x"' op|'%' name|'byte' op|',' name|'key' op|')' op|')' newline|'\n' name|'try' op|':' newline|'\n' indent|' ' name|'utils' op|'.' name|'execute' op|'(' op|'*' name|'cmd' op|',' name|'process_input' op|'=' name|'key' op|',' name|'run_as_root' op|'=' name|'True' op|')' newline|'\n' dedent|'' name|'except' name|'processutils' op|'.' name|'ProcessExecutionError' name|'as' name|'e' op|':' newline|'\n' indent|' ' name|'with' name|'excutils' op|'.' name|'save_and_reraise_exception' op|'(' op|')' op|':' newline|'\n' indent|' ' name|'LOG' op|'.' name|'error' op|'(' name|'_LE' op|'(' string|'"Could not start encryption for disk %(device)s: "' nl|'\n' string|'"%(exception)s"' op|')' op|',' op|'{' string|"'device'" op|':' name|'device' op|',' string|"'exception'" op|':' name|'e' op|'}' op|')' newline|'\n' nl|'\n' nl|'\n' DECL|function|delete_volume dedent|'' dedent|'' dedent|'' name|'def' name|'delete_volume' op|'(' name|'target' op|')' op|':' newline|'\n' indent|' ' string|'"""Deletes a dmcrypt mapping\n\n :param target: name of the mapped logical device\n """' newline|'\n' name|'try' op|':' newline|'\n' indent|' ' name|'utils' op|'.' name|'execute' op|'(' string|"'cryptsetup'" op|',' string|"'remove'" op|',' name|'target' op|',' name|'run_as_root' op|'=' name|'True' op|')' newline|'\n' dedent|'' name|'except' name|'processutils' op|'.' name|'ProcessExecutionError' name|'as' name|'e' op|':' newline|'\n' comment|'# cryptsetup returns 4 when attempting to destroy a non-existent' nl|'\n' comment|'# dm-crypt device. It indicates that the device is invalid, which' nl|'\n' comment|'# means that the device is invalid (i.e., it has already been' nl|'\n' comment|'# destroyed).' nl|'\n' indent|' ' name|'if' name|'e' op|'.' name|'exit_code' op|'==' number|'4' op|':' newline|'\n' indent|' ' name|'LOG' op|'.' name|'debug' op|'(' string|'"Ignoring exit code 4, volume already destroyed"' op|')' newline|'\n' dedent|'' name|'else' op|':' newline|'\n' indent|' ' name|'with' name|'excutils' op|'.' name|'save_and_reraise_exception' op|'(' op|')' op|':' newline|'\n' indent|' ' name|'LOG' op|'.' name|'error' op|'(' name|'_LE' op|'(' string|'"Could not disconnect encrypted volume "' nl|'\n' string|'"%(volume)s. If dm-crypt device is still active "' nl|'\n' string|'"it will have to be destroyed manually for "' nl|'\n' string|'"cleanup to succeed."' op|')' op|',' op|'{' string|"'volume'" op|':' name|'target' op|'}' op|')' newline|'\n' nl|'\n' nl|'\n' DECL|function|list_volumes dedent|'' dedent|'' dedent|'' dedent|'' name|'def' name|'list_volumes' op|'(' op|')' op|':' newline|'\n' indent|' ' string|'"""Function enumerates encrypted volumes."""' newline|'\n' name|'return' op|'[' name|'dmdev' name|'for' name|'dmdev' name|'in' name|'os' op|'.' name|'listdir' op|'(' string|"'/dev/mapper'" op|')' nl|'\n' name|'if' name|'dmdev' op|'.' name|'endswith' op|'(' string|"'-dmcrypt'" op|')' op|']' newline|'\n' dedent|'' endmarker|'' end_unit
15.556582
320
0.621734
992
6,736
4.176411
0.214718
0.076756
0.060343
0.054067
0.389331
0.331644
0.279025
0.209269
0.171856
0.171856
0
0.002722
0.127227
6,736
432
321
15.592593
0.70199
0
0
0.814815
0
0.006944
0.474169
0.013955
0
0
0
0
0
1
0
true
0
0.013889
0
0.013889
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
1
0
0
0
0
0
0
2
2ee1f5707dc3b138efdc660027411aa4640b57d7
801
py
Python
cdchanger/urls.py
mnosinov/cdchanger
7dc4db3849e135c813d4a46287bdb7cb8b1547d6
[ "MIT" ]
null
null
null
cdchanger/urls.py
mnosinov/cdchanger
7dc4db3849e135c813d4a46287bdb7cb8b1547d6
[ "MIT" ]
null
null
null
cdchanger/urls.py
mnosinov/cdchanger
7dc4db3849e135c813d4a46287bdb7cb8b1547d6
[ "MIT" ]
null
null
null
from django.urls import path from django.views.generic import TemplateView from .views import CdchangerListView, CdchangerWizard urlpatterns = [ path('', TemplateView.as_view(template_name='cdchanger/index.html'), name='index'), path('cdchangers', CdchangerListView.as_view(), name='cdchangers'), path('cdchangers/', CdchangerListView.as_view(), name='cdchangers'), path('cdchangers/create', CdchangerWizard.as_view(CdchangerWizard.FORMS), name='cdchanger-create-wizard'), # TODO # path('cdchangers/<int:pk>/view', CdchangerDetailView.as_view(), name='cdchanger-detail-view'), # path('cdchangers/<int:pk>/update', CdchangerUpdateView.as_view(), name='cdchanger-update'), # path('cdchangers/<int:pk>/delete', CdchangerDeleteView.as_view(), name='cdchanger-delete'), ]
50.0625
110
0.739076
89
801
6.561798
0.348315
0.071918
0.085616
0.097603
0.19863
0.19863
0.19863
0.19863
0.19863
0
0
0
0.09613
801
15
111
53.4
0.80663
0.353308
0
0
0
0
0.206628
0.044834
0
0
0
0.066667
0
1
0
false
0
0.333333
0
0.333333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
1
0
0
0
0
2
2ee7856345c9fb44d682f93c6f98e331db8127ea
270
py
Python
app/questionnaire_state/state_section.py
qateam123/eq
704757952323647d659c49a71975c56406ff4047
[ "MIT" ]
null
null
null
app/questionnaire_state/state_section.py
qateam123/eq
704757952323647d659c49a71975c56406ff4047
[ "MIT" ]
8
2020-03-24T15:24:18.000Z
2022-03-02T04:32:56.000Z
app/questionnaire_state/state_section.py
qateam123/eq
704757952323647d659c49a71975c56406ff4047
[ "MIT" ]
null
null
null
from app.questionnaire_state.state_item import StateItem class StateSection(StateItem): def __init__(self, item_id, schema_item): super().__init__(item_id=item_id, schema_item=schema_item) self.questions = [] self.children = self.questions
30
66
0.72963
34
270
5.323529
0.5
0.099448
0.132597
0.176796
0
0
0
0
0
0
0
0
0.177778
270
8
67
33.75
0.815315
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.166667
0
0.5
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2ee93559b4c44d3a539288935e7f1d8e903dfc6a
14,221
py
Python
electrical_simulation/miasole_module_two.py
architecture-building-systems/bipv-tool
3ae73a541754e5215dfd39ef837d72f4b80ef967
[ "MIT" ]
4
2019-02-18T14:10:49.000Z
2021-04-23T09:03:13.000Z
electrical_simulation/miasole_module_two.py
architecture-building-systems/bipv-tool
3ae73a541754e5215dfd39ef837d72f4b80ef967
[ "MIT" ]
1
2018-08-16T13:27:15.000Z
2018-08-16T13:27:16.000Z
electrical_simulation/miasole_module_two.py
architecture-building-systems/bipv-tool
3ae73a541754e5215dfd39ef837d72f4b80ef967
[ "MIT" ]
null
null
null
import numpy as np import pvlib.pvsystem as pvsyst import interconnection as connect import matplotlib.pyplot as plt def calculate_reverse_scaling_factor(voltages, breakdown_voltage, miller_exponent): """ :param voltages: numpy array of voltages :param breakdown_voltage: the minimum voltage before the avelanche breakdown happens :param miller_exponent: --> google :return: numpy array of according factors """ reverse_scaling_factor = np.reciprocal(1. - np.power((np.absolute(voltages) / -breakdown_voltage), miller_exponent)) return reverse_scaling_factor def calculate_sub_cell_characteristics(irrad_on_subcells, evaluated_cell_voltages, num_subcells, reverse_scaling_factor, irrad_temp_lookup_np, t_ambient, irrad_noct, t_noct, t_a_noct, alpha_short_current, module_params, egap_ev, round_irrad_to_ten): """ :param irrad_on_subcells: :param evaluated_voltages: :param numcells: :param irrad_temp_lookup_df: :param irrad_noct: :param t_noct: :param t_a_noct: :param alpha_short_current: :param module_params: :param egap_ev: :return: subcell_v_values: List of np arrays where a list of v-values is stored for every cell subcell_i_values,:List of np arrays where a list of v-values is stored for every cell """ subcell_i_values = np.empty((len(irrad_on_subcells), len( evaluated_cell_voltages))) # List of lists where a list of i-values is stored for every subcell subcell_v_values = np.empty((len(irrad_on_subcells), len( evaluated_cell_voltages))) # List of lists where a list of v-values is stored for every cell, basically the same as for cells irrad_on_subcells_np = np.array(irrad_on_subcells) # Take this out of the function sub_cell_irrad_np = np.rint(irrad_on_subcells_np).astype(int) # Take this out of the function t_ambient = int(t_ambient) # Take this out of the function temperature_row = irrad_temp_lookup_np[t_ambient + 25] # +25 because row on is at -25Celsius for position, irradiance_value in np.ndenumerate(sub_cell_irrad_np): if round_irrad_to_ten == True: irradiance_value_lookup=irradiance_value/10 else: irradiance_value_lookup = irradiance_value if not (temperature_row[irradiance_value_lookup,0,0] != temperature_row[irradiance_value_lookup,0,0]): # Checks for NaNs subcell_i_values[position] = temperature_row[irradiance_value_lookup][0] # should collect a numpy array subcell_v_values[position] = temperature_row[irradiance_value_lookup][1] # should collect a numpy array else: if irradiance_value == 0: irradiance_value = 1 t_cell = float(t_ambient) + float(irradiance_value) / irrad_noct * (t_noct - t_a_noct) # t_cell in deg C desoto_values = pvsyst.calcparams_desoto(irradiance_value, t_cell, alpha_short_current, module_params, egap_ev, 0.0001, 1, 1000, 25) # calcparams_desoto takes the temperature in degrees Celsius! photocurrent = desoto_values[0] # [A] sat_current = desoto_values[1] # [A] series_resistance = desoto_values[2] # [Ohm] shunt_resistance = desoto_values[3] # [Ohm] nnsvth = desoto_values[4] evaluated_module_voltages = evaluated_cell_voltages*56 # Basic assumption here: Module IV-curve can be converted to a cell IV-curve by dividing the module voltage # by the number of cells further the subcell current is calculated by dividing currents by the number of # subcells. evaluated_currents = pvsyst.i_from_v(shunt_resistance, series_resistance, nnsvth, evaluated_module_voltages, sat_current, photocurrent) subcell_v_values[position] = evaluated_cell_voltages # Save for later use # calculate the subcell forward and reverse characteristc subcell_current = np.multiply(evaluated_currents, reverse_scaling_factor) / num_subcells # Numpy array subcell_i_values[position] = subcell_current # Save for later use irrad_temp_lookup_np[t_ambient + 25][irradiance_value_lookup] = [subcell_current, evaluated_cell_voltages] # plt.plot(subcell_v_values[position],subcell_i_values[position]) # plt.show() return subcell_i_values, subcell_v_values def sub_cells_2_cells(subcell_i_values, num_subcells): """ :param subcell_i_values: numpy array :param num_subcells: :return: cell_i_values, numpy array simple reshaping can be used, because the subcell v values all have the same basis """ cell_i_values = subcell_i_values.reshape((-1, num_subcells, len(subcell_i_values[0]))).sum(axis=1) return cell_i_values def cells2substrings(cell_v_values_np, cell_i_values_np, cells_per_substring, number_of_substrings, max_i_module, min_i_module, interpolation_resolution_submodules): """ :param cell_v_values_np: numpy array of cell voltage values [[cell1values][cell2values] etc] :param cell_i_values_np: numpy array of cell current values [[cell1values][cell2values] etc] :param cells_per_substring: int, this value represents how many cells are in a substring = number of cells per bypass diode :param number_of_substrings: int, here equal to number of bypass diodes :param max_i_module: this is the maximum expected current in the module. Setting a value close above Isc prevents having huge unnecessary interpolations when connecting the cells. :param min_i_module: zero can be used as long as cells are not connected in parallel to other cells :return: returns numpy dtype object array with i and v values for each substring/submodule """ i_connected_np = np.empty(number_of_substrings, dtype=object) v_connected_np = np.empty(number_of_substrings, dtype=object) for substring in range(number_of_substrings): # iterate through all the substrings by number substring_v_values_np = cell_v_values_np[substring * cells_per_substring:(substring + 1) * cells_per_substring] substring_i_values_np = cell_i_values_np[substring * cells_per_substring:(substring + 1) * cells_per_substring] i_connected_np[substring], v_connected_np[substring] = connect.series_connect_multiple(substring_i_values_np, substring_v_values_np, max_i_module, min_i_module, interpolation_resolution_submodules) return i_connected_np, v_connected_np def bypass_diodes_on_substrings(substring_i_values_np, substring_v_values_np, number_of_substrings, diode_saturation_current=1.0e-7, n_x_Vt=1.7e-2, numerical_diode_threshold=-1): """ :param substring_i_values: numpy array dtype object :param substring_v_values: numpy array dtype object :param number_of_substrings: int, here equal to number of bypass diodes :param diode_saturation_current: float, the saturation current of the modelled diode :param n_x_Vt: float, thermal voltage multiplied by the diode ideality factor :param numerical_diode_threshold: this is a value to speed up the calculation by not taking any values into account below this voltage and thereby not causing any overflow errors. :return: returns the parallel addition of the bypass diodes and the substring currents """ diode_current = np.empty(number_of_substrings, dtype=object) # List of np ndarrays for the current of each diode for substring in range(number_of_substrings): # Do diode calculations diode_current = 1.e-7*np.exp(-voltage_selected/1.7e-2) Where from?? # diode_steps = np.empty(len(substring_v_values[substring])) substring_v_values_np[substring][substring_v_values_np[substring] < numerical_diode_threshold] = numerical_diode_threshold diode_steps = diode_saturation_current * np.exp(-substring_v_values_np[substring] / n_x_Vt) diode_current[substring]=diode_steps for substring in range(number_of_substrings): substring_i_values_np[substring] = np.add(substring_i_values_np[substring], diode_current[substring]) return substring_i_values_np def partial_shading(irrad_on_subcells, temperature=25, irrad_temp_lookup_np=None, breakdown_voltage=-6.10, evaluated_module_voltages=None, simulation_parameters=None, module_params=None): """ This function returns the module IV curve of a module under any partial shading conditions or unequal irradiance. :param irrad_on_subcells: list, list of all irradiance values on the specific module (for one specific hour) make sure that the dimensions of this list equals the number of cells or subcells that are used for the module. E.G number of cells = 56, num_subcells=4 --> list length = 274 :param temperature: float, Ambient temperature value for the given hour :param irrad_temp_lookup_df: :param module_df: :param module_name: :param numcells: :param n_bypass_diodes: :param num_subcells: :param vmax: :param v_threshold: :param breakdown_voltage: :return: """ # Definition of constants, these are defined in hardcode because they are fixed: t_a_noct = 20 # [a,NOCT] irrad_noct = 800 # [W/m2] egap_ev = 1.12 # Band gap energy [eV] miller_exponent = 3 # This is set #For now here, change to parameters: max_i_module = module_params["max_module_current"] # [A] min_i_module = module_params["min_module_current"] # [A], min value of interpolation in series connect n_bypass_diodes = module_params["number_of_bypass_diodes"] numcells = module_params["number_of_cells"] num_subcells = module_params["number_of_subcells"] alpha_short_current = module_params['alpha_short_current'] t_noct = module_params['t_noct'] interpolation_resolution_submodules = simulation_parameters["interpolation_resolution_submodules"] # [A] interpolation_resolution_module = simulation_parameters["interpolation_resolution_module"] # [A] final_module_iv_resolution = simulation_parameters["final_module_iv_resolution"] # [A] or [V] counts for both dimensions round_irrad_to_ten = simulation_parameters["round_irradiance_to_ten"] if n_bypass_diodes > 0: cells_per_substring = numcells / n_bypass_diodes else: cells_per_substring = numcells if cells_per_substring % 1 != 0: print "WARNING: Number of bypass diodes or number of cells is wrong." else: pass # Rearrange irrad_on_subcells irrad_on_subcells = connect.rearrange_shading_pattern_miasole(irrad_on_subcells, num_subcells) evaluated_cell_voltages = evaluated_module_voltages / numcells # Only divide by the number of cells reverse_scaling_factor = calculate_reverse_scaling_factor(evaluated_cell_voltages, breakdown_voltage, miller_exponent) t_ambient = temperature # degC, if measured, use data here # Calculate sub_cell characteristic subcell_i_values, subcell_v_values = calculate_sub_cell_characteristics(irrad_on_subcells=irrad_on_subcells, evaluated_cell_voltages=evaluated_cell_voltages, num_subcells=num_subcells, reverse_scaling_factor=reverse_scaling_factor, irrad_temp_lookup_np=irrad_temp_lookup_np, t_ambient=t_ambient, irrad_noct=irrad_noct, t_noct=t_noct, t_a_noct=t_a_noct, alpha_short_current=alpha_short_current, module_params=module_params, egap_ev=egap_ev, round_irrad_to_ten=round_irrad_to_ten) # Calculate cell characteristics cell_i_values_np = sub_cells_2_cells(subcell_i_values, num_subcells) cell_v_values_np = np.tile(evaluated_cell_voltages, (numcells, 1)) # Calculate basic substring characteristics i_connected_np, v_connected_np = cells2substrings(cell_v_values_np, cell_i_values_np, cells_per_substring, n_bypass_diodes, max_i_module, min_i_module, interpolation_resolution_submodules) # add bypass diode to sub_strings i_connected_np = bypass_diodes_on_substrings(substring_i_values_np=i_connected_np, substring_v_values_np=v_connected_np, number_of_substrings=n_bypass_diodes) # add sub_module voltages: i_module, v_module = connect.series_connect_multiple(i_connected_np, v_connected_np, max_i_module, min_i_module, interpolation_resolution_module) i_module, v_module = connect.clean_curve([i_module, v_module], final_module_iv_resolution) # print len(v_module) # plt.plot(v_module, i_module) # plt.show() return i_module, v_module, irrad_temp_lookup_np
52.283088
134
0.664932
1,778
14,221
4.974691
0.172103
0.022951
0.023742
0.013454
0.361108
0.282872
0.212889
0.135105
0.119729
0.076993
0
0.008562
0.277266
14,221
271
135
52.476015
0.852014
0.118557
0
0.08871
0
0
0.031563
0.014866
0
0
0
0
0
0
null
null
0.072581
0.032258
null
null
0.008065
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
2eebbacb5df6c83ca0a014890b1d4f2d50ccc8e9
228
py
Python
tools/intogen/runtime/pyenv/lib/python2.7/site-packages/numpy/version.py
globusgenomics/galaxy
7caf74d9700057587b3e3434c64e82c5b16540f1
[ "CC-BY-3.0" ]
1
2021-02-05T13:19:58.000Z
2021-02-05T13:19:58.000Z
tools/intogen/runtime/pyenv/lib/python2.7/site-packages/numpy/version.py
globusgenomics/galaxy
7caf74d9700057587b3e3434c64e82c5b16540f1
[ "CC-BY-3.0" ]
null
null
null
tools/intogen/runtime/pyenv/lib/python2.7/site-packages/numpy/version.py
globusgenomics/galaxy
7caf74d9700057587b3e3434c64e82c5b16540f1
[ "CC-BY-3.0" ]
null
null
null
# THIS FILE IS GENERATED FROM NUMPY SETUP.PY short_version = '1.9.0' version = '1.9.0' full_version = '1.9.0' git_revision = '07601a64cdfeb1c0247bde1294ad6380413cab66' release = True if not release: version = full_version
20.727273
57
0.745614
33
228
5.030303
0.636364
0.144578
0.162651
0.180723
0
0
0
0
0
0
0
0.176166
0.153509
228
10
58
22.8
0.683938
0.184211
0
0
1
0
0.300546
0.218579
0
0
0
0
0
1
0
false
0
0
0
0
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
2efec4d7645754973922248e12f2e9e6fd0b48f4
746
py
Python
demo/examples/radio/application.py
haizzus/FPGA-radio
7b7811091bafb2865bccb8aef9f4a53f7b43089e
[ "MIT" ]
53
2016-10-15T17:13:19.000Z
2022-03-27T02:24:50.000Z
demo/examples/radio/application.py
dawsonjon/FPGA-radio
7b7811091bafb2865bccb8aef9f4a53f7b43089e
[ "MIT" ]
null
null
null
demo/examples/radio/application.py
dawsonjon/FPGA-radio
7b7811091bafb2865bccb8aef9f4a53f7b43089e
[ "MIT" ]
10
2017-03-17T11:16:01.000Z
2022-03-30T05:00:05.000Z
from demo.components.server import server from chips.api.api import * def application(chip): eth = Component("application.c") eth( chip, inputs = { "eth_in" : chip.inputs["input_eth_rx"], "am_in" : chip.inputs["input_radio_am"], "fm_in" : chip.inputs["input_radio_fm"], "rs232_rx":chip.inputs["input_rs232_rx"], }, outputs = { "eth_out" : chip.outputs["output_eth_tx"], "audio_out" : chip.outputs["output_audio"], "frequency_out" : chip.outputs["output_radio_frequency"], "samples_out" : chip.outputs["output_radio_average_samples"], "rs232_tx":chip.outputs["output_rs232_tx"], }, )
32.434783
73
0.576408
85
746
4.741176
0.341176
0.124069
0.210918
0.198511
0.233251
0
0
0
0
0
0
0.022388
0.281501
746
22
74
33.909091
0.729478
0
0
0
0
0
0.306971
0.067024
0
0
0
0
0
1
0.05
false
0
0.1
0
0.15
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
2eff7f3dafd4df68788f8af91c9f219b3565485e
227
py
Python
Xiecheng/__init__.py
scottyyf/MultiWorker
4abd361c3053140be6453d6e6e30f5c31a189e79
[ "Apache-2.0" ]
2
2021-12-14T10:46:14.000Z
2021-12-14T10:47:00.000Z
Xiecheng/__init__.py
scottyyf/MultiWorker
4abd361c3053140be6453d6e6e30f5c31a189e79
[ "Apache-2.0" ]
9
2021-12-06T06:16:15.000Z
2021-12-20T06:39:50.000Z
Xiecheng/__init__.py
scottyyf/MultiWorker
4abd361c3053140be6453d6e6e30f5c31a189e79
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File: __init__.py.py Author: Scott Yang(Scott) Email: yangyingfa@skybility.com Copyright: Copyright (c) 2021, Skybility Software Co.,Ltd. All rights reserved. Description: """
20.636364
79
0.709251
31
227
5.064516
0.870968
0
0
0
0
0
0
0
0
0
0
0.025126
0.123348
227
10
80
22.7
0.763819
0.942731
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
2c09a4a2e41ca60c7d6287eab58dfe9fe3c0167c
680
py
Python
gatewayconfig/bluetooth/descriptors/utf8_format_descriptor.py
AndriiIevdoshenko/hm-config
f513d72dd8c67c040310d78071d8ac2de418d0d6
[ "MIT" ]
7
2021-07-09T16:54:39.000Z
2022-02-18T09:07:54.000Z
gatewayconfig/bluetooth/descriptors/utf8_format_descriptor.py
AndriiIevdoshenko/hm-config
f513d72dd8c67c040310d78071d8ac2de418d0d6
[ "MIT" ]
137
2021-02-05T21:53:35.000Z
2022-03-31T23:31:54.000Z
gatewayconfig/bluetooth/descriptors/utf8_format_descriptor.py
AndriiIevdoshenko/hm-config
f513d72dd8c67c040310d78071d8ac2de418d0d6
[ "MIT" ]
16
2021-02-15T11:25:37.000Z
2022-01-17T07:53:38.000Z
import dbus from lib.cputemp.service import Descriptor import gatewayconfig.constants as constants class UTF8FormatDescriptor(Descriptor): def __init__(self, characteristic): Descriptor.__init__( self, constants.PRESENTATION_FORMAT_DESCRIPTOR_UUID, ["read"], characteristic) def ReadValue(self, options): value = [] value.append(dbus.Byte(0x19)) value.append(dbus.Byte(0x00)) value.append(dbus.Byte(0x00)) value.append(dbus.Byte(0x00)) value.append(dbus.Byte(0x01)) value.append(dbus.Byte(0x00)) value.append(dbus.Byte(0x00)) return value
27.2
68
0.638235
72
680
5.875
0.402778
0.182033
0.248227
0.314421
0.316785
0.316785
0.316785
0.316785
0.316785
0.316785
0
0.043651
0.258824
680
24
69
28.333333
0.795635
0
0
0.263158
0
0
0.005882
0
0
0
0.041176
0
0
1
0.105263
false
0
0.157895
0
0.368421
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
2c1069139cd713638cf5bbb933fb4bfc312c6f46
2,225
py
Python
e_fun_calls.py
panamantis/gretnet_api
7b30e3ca07992c52478de90cca94e18c1a1fa9f3
[ "MIT" ]
null
null
null
e_fun_calls.py
panamantis/gretnet_api
7b30e3ca07992c52478de90cca94e18c1a1fa9f3
[ "MIT" ]
null
null
null
e_fun_calls.py
panamantis/gretnet_api
7b30e3ca07992c52478de90cca94e18c1a1fa9f3
[ "MIT" ]
null
null
null
import sys,os import time import datetime import random import re import json import requests from flask import Flask, jsonify from flasgger import Swagger # pip install flasgger from flasgger import swag_from from flask import request from api_helper import GretNet_API_Helper LOCAL_PATH = os.path.abspath(os.path.dirname(__file__))+"/" sys.path.insert(0,LOCAL_PATH) sys.path.insert(0,LOCAL_PATH+"../") #0v1# JC Apr 8, 2021 Base setup #Helper=GretNet_API_Helper() ## OpenAPI # #/crawl_domain def handle_crawl_domain_request(): #*args,**kwargs): """Submit a domain to crawl --- post: summary: Handle submit domain to crawl requests consumes: - application/json parameters: - in: body name: meta description: Domain to crawl schema: type: object properties: url: type: string responses: 200: description: Post accepted and processed. """ try: the_json=request.json except: the_json={} if the_json: Helper.cache_request('crawl_domain',the_json, id='') try: print (str(request.json)) except: pass result={} result['status_code']=200 return jsonify(result) #TBD: add node or relation, standard search def dev1(): return if __name__=='__main__': branches=['dev1'] for b in branches: globals()[b]() """ """ """ """
11.410256
60
0.412135
179
2,225
4.944134
0.513966
0.031638
0.044068
0.031638
0.051977
0.051977
0
0
0
0
0
0.015903
0.519551
2,225
194
61
11.469072
0.811974
0.265169
0
0
0
0
0.025457
0
0
0
0
0
0
1
0.0625
false
0.03125
0.375
0.03125
0.5
0.03125
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
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
2c2e48e936899f7a8f86e2d400517f71ba883959
941
py
Python
models.py
jarbaugh5/laundry_stats
39e79854728e1c8012b2876bb3e3f93f48b42e04
[ "Apache-2.0" ]
null
null
null
models.py
jarbaugh5/laundry_stats
39e79854728e1c8012b2876bb3e3f93f48b42e04
[ "Apache-2.0" ]
null
null
null
models.py
jarbaugh5/laundry_stats
39e79854728e1c8012b2876bb3e3f93f48b42e04
[ "Apache-2.0" ]
null
null
null
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String, ForeignKey from sqlalchemy.types import DateTime Base = declarative_base() class Building(Base): __tablename__ = "buildings" id = Column(Integer, primary_key=True) name = Column(String) class MachineType(Base): __tablename__ = "machinetypes" id = Column(Integer, primary_key=True) name = Column(String) class Machine(Base): __tablename__ = "machines" id = Column(Integer, primary_key=True) tufts_id = Column(Integer) room = Column(Integer, ForeignKey("buildings.id")) type = Column(Integer, ForeignKey("machinetypes.id")) class UsageRecord(Base): __tablename__ = "usagerecords" id = Column(Integer, primary_key=True) machine = Column(Integer, ForeignKey("machines.id")) available = Column(Integer) time_remaining = Column(Integer) timestamp = Column(DateTime)
26.885714
58
0.724761
104
941
6.326923
0.326923
0.217325
0.113982
0.133739
0.240122
0.240122
0.151976
0.151976
0.151976
0.151976
0
0
0.171095
941
35
59
26.885714
0.84359
0
0
0.24
0
0
0.083864
0
0
0
0
0
0
1
0
false
0
0.12
0
0.96
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
2c2f9b90ebf5604014575bad5dad0fa9a8c11c47
857
py
Python
dsvfile/Models/FactorySystem/AssemblerComponent.py
phoenixx-666/dsvread
8a073c12343b2f0d34f9b728282dfefe10999f24
[ "MIT" ]
2
2021-03-01T19:57:20.000Z
2021-08-02T20:54:48.000Z
dsvfile/Models/FactorySystem/AssemblerComponent.py
phoenixx-666/dsvread
8a073c12343b2f0d34f9b728282dfefe10999f24
[ "MIT" ]
null
null
null
dsvfile/Models/FactorySystem/AssemblerComponent.py
phoenixx-666/dsvread
8a073c12343b2f0d34f9b728282dfefe10999f24
[ "MIT" ]
null
null
null
from ...Fields import BoolField, ConditionalBlockStart from ...Fields.Enums import ERecipe, ERecipeType from ...Func import g from . import Model, Int32Field, ArrayField class AssemblerComponent(Model): version = Int32Field() id = Int32Field() entityId = Int32Field() pcId = Int32Field() replicating = BoolField() outputing = BoolField() speed = Int32Field() time = Int32Field() recipeId = ERecipe() recipeIdChecker = ConditionalBlockStart(arg_fields='recipeId', condition_func=g(0)) recipeType = ERecipeType() timeSpend = Int32Field() requires = ArrayField(Int32Field) requireCounts = ArrayField(Int32Field) served = ArrayField(Int32Field) needs = ArrayField(Int32Field) products = ArrayField(Int32Field) productCounts = ArrayField(Int32Field) produced = ArrayField(Int32Field)
31.740741
87
0.719953
75
857
8.2
0.493333
0.227642
0
0
0
0
0
0
0
0
0
0.044349
0.184364
857
26
88
32.961538
0.835479
0
0
0
0
0
0.009335
0
0
0
0
0
0
1
0
false
0
0.166667
0
1
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
2581eb1b55c042ee77c302c7a30814d99058fc85
2,901
py
Python
chaospy/distributions/collection/gamma.py
lblonk/chaospy
1759a4307c6134b74ce63ff44973195f1e185f94
[ "MIT" ]
1
2020-04-29T20:53:25.000Z
2020-04-29T20:53:25.000Z
chaospy/distributions/collection/gamma.py
agonzs11/Polinomio-del-caos
5a415ece07e6535488174bac69a6c0fcc2ca272d
[ "MIT" ]
null
null
null
chaospy/distributions/collection/gamma.py
agonzs11/Polinomio-del-caos
5a415ece07e6535488174bac69a6c0fcc2ca272d
[ "MIT" ]
null
null
null
"""Gamma distribution.""" import numpy from scipy import special from ..baseclass import Dist from ..operators.addition import Add class gamma(Dist): def __init__(self, a=1): Dist.__init__(self, a=a) def _pdf(self, x, a): return x**(a-1)*numpy.e**(-x) / special.gamma(a) def _cdf(self, x, a): return special.gammainc(a, x) def _ppf(self, q, a): return special.gammaincinv(a, q) def _mom(self, k, a): return special.gamma(a+k)/special.gamma(a) def _ttr(self, n, a): return 2.*n+a, n*n+n*(a-1) def _lower(self, a): return 0. def _upper(self, a): return 40+2*a class Gamma(Add): """ Gamma distribution. Also an Erlang distribution when shape=k and scale=1./lamb. Args: shape (float, Dist): Shape parameter. a>0. scale (float, Dist): Scale parameter. scale!=0 shift (float, Dist): Location of the lower bound. Examples: >>> distribution = chaospy.Gamma(1, 1, 1) >>> distribution Gamma(scale=1, shape=1, shift=1) >>> q = numpy.linspace(0,1,6)[1:-1] >>> distribution.inv(q).round(4) array([1.2231, 1.5108, 1.9163, 2.6094]) >>> distribution.fwd(distribution.inv(q)).round(4) array([0.2, 0.4, 0.6, 0.8]) >>> distribution.pdf(distribution.inv(q)).round(4) array([0.8, 0.6, 0.4, 0.2]) >>> distribution.sample(4).round(4) array([2.0601, 1.1222, 4.0014, 1.6581]) >>> distribution.mom(1) array(2.) >>> distribution.ttr([1, 2, 3]).round(4) array([[4., 6., 8.], [1., 4., 9.]]) """ def __init__(self, shape=1, scale=1, shift=0): self._repr = {"shape": shape, "scale": scale, "shift": shift} Add.__init__(self, left=gamma(shape)*scale, right=shift) class Exponential(Add): R""" Exponential Probability Distribution Args: scale (float, Dist): Scale parameter. scale!=0 shift (float, Dist): Location of the lower bound. Examples;: >>> distribution = chaospy.Exponential(2, 3) >>> distribution Exponential(scale=2, shift=3) >>> q = numpy.linspace(0,1,6)[1:-1] >>> distribution.inv(q).round(4) array([3.4463, 4.0217, 4.8326, 6.2189]) >>> distribution.fwd(distribution.inv(q)).round(4) array([0.2, 0.4, 0.6, 0.8]) >>> distribution.sample(4).round(4) array([5.1203, 3.2444, 9.0028, 4.3163]) >>> distribution.mom(1).round(4) 5.0 >>> distribution.ttr([1, 2, 3]).round(4) array([[ 9., 13., 17.], [ 4., 16., 36.]]) """ def __init__(self, scale=1, shift=0): self._repr = {"scale": scale, "shift": shift} Add.__init__(self, left=gamma(1)*scale, right=shift)
27.367925
69
0.536711
403
2,901
3.781638
0.228288
0.03937
0.064961
0.068898
0.437008
0.437008
0.379265
0.360892
0.322835
0.270341
0
0.087229
0.284729
2,901
105
70
27.628571
0.647229
0.563599
0
0
0
0
0.023992
0
0
0
0
0
0
1
0.333333
false
0
0.133333
0.233333
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
0
0
0
1
0
0
0
1
0
0
0
2
25873fb3ea0c2524e1adfd5dff21649fc4c13e56
9,844
py
Python
mrobpy/examples/vis_utils.py
miloserdova-l/mrob
48bef772ba3158d2122991069196d6efd4a39f8c
[ "Apache-2.0" ]
12
2020-09-22T15:33:48.000Z
2022-03-02T17:27:39.000Z
mrobpy/examples/vis_utils.py
MobileRoboticsSkoltech/mrob
7668a3ee35345c4878aa86fff082cc017992d205
[ "Apache-2.0" ]
46
2020-09-22T15:47:08.000Z
2022-01-22T10:56:44.000Z
mrobpy/examples/vis_utils.py
MobileRoboticsSkoltech/mrob
7668a3ee35345c4878aa86fff082cc017992d205
[ "Apache-2.0" ]
9
2020-09-22T15:59:33.000Z
2021-12-20T20:15:16.000Z
import numpy as np import pandas as pd import mrob from test_utils import get_mc from sys import platform import matplotlib if platform == "darwin": matplotlib.use('PS') import matplotlib.pyplot as plt # Here the Cholesky decomposition for singular covariance matrix is implemented def cholesky(sigma): # obtaining map M between original and truncated matrix condition =~ (np.all(sigma == 0, axis=1) & (np.all(sigma == 0, axis=0))) m = [int(x) for x in condition] counter = 0 res = [] for el in m: if el > 0: res.append(counter) counter +=1 else: res.append(None) M = [] for i in range(6): tmp = [] for j in range(6): tmp.append([res[i],res[j]]) M.append(tmp) M = np.array(M) # obtaining matrix that is obtained by removing zero columns and rows block = (sigma[condition,:])[:,condition] # applying regular cholesky decomposition L = np.linalg.cholesky(block) # mapping block decomposition into original matrix LL = np.zeros_like(sigma) for i in range(LL.shape[0]): for j in range(LL.shape[1]): if all(M[i,j] != None): k = M[i,j][0] l = M[i,j][1] LL[i,j] = L[k,l] # returning resulting factor return LL def get_axis_points(T, sigma, N, K = 1, index = -1, A = None): if A is None: A = cholesky(sigma) points = np.zeros((N,6)) points[:,index] = np.linspace(-K, K, num = N) points_img = (A@points.T).T propagated = [] for i in range(len(points_img)): tmp = mrob.geometry.SE3(T) tmp.update_lhs(points_img[i]) propagated.append(tmp) pts = np.array([x.t() for x in propagated]) pts = pts.reshape((-1,3)) pts = np.vstack((pts,np.array([np.nan,np.nan,np.nan]).reshape(-1,3))) return pts def get_circumference(T,sigma,N,K=1, index_1=-1, index_2=-1, A=None): if A is None: A = cholesky(sigma) points = np.zeros((N,6)) points[:,index_1] = K*np.cos(np.linspace(0,2*np.pi, num = N)) points[:,index_2] = K*np.sin(np.linspace(0,2*np.pi, num = N)) points_img = (A@points.T).T propagated = [] for i in range(len(points_img)): tmp = mrob.geometry.SE3(T) tmp.update_lhs(points_img[i]) propagated.append(tmp) pts = np.array([x.t() for x in propagated]) pts = pts.reshape((-1,3)) pts = np.vstack((pts,np.array([np.nan,np.nan,np.nan]).reshape(-1,3))) return pts def sigma_visualize_3d(T, sigma, N=100, K=1): N = 100 colors = list(matplotlib.colors.CSS4_COLORS.keys()) A = cholesky(sigma) axes = { 'yaw': get_axis_points(T,sigma,N,K,0,A), 'pitch': get_axis_points(T,sigma,N,K,1,A), 'roll': get_axis_points(T,sigma,N,K,2,A), 'x': get_axis_points(T,sigma,N,K,3,A), 'y': get_axis_points(T,sigma,N,K,4,A), 'z': get_axis_points(T,sigma,N,K,5,A) } circumferences = { 'yaw vs pitch' : get_circumference(T,sigma,N,K,0,1,A), 'yaw vs roll' : get_circumference(T,sigma,N,K,0,2,A), 'yaw vs x' : get_circumference(T,sigma,N,K,0,3,A), 'yaw vs y' : get_circumference(T,sigma,N,K,0,4,A), 'yaw vs z' : get_circumference(T,sigma,N,K,0,5,A), 'pitch vs roll' : get_circumference(T,sigma,N,K,1,2,A), 'pitch vs x' : get_circumference(T,sigma,N,K,1,3,A), 'pitch vs y' : get_circumference(T,sigma,N,K,1,4,A), 'pitch vs z' : get_circumference(T,sigma,N,K,1,5,A), 'roll vs x' : get_circumference(T,sigma,N,K,2,3,A), 'roll vs y' : get_circumference(T,sigma,N,K,2,4,A), 'roll vs z' : get_circumference(T,sigma,N,K,2,5,A), 'x vs y' : get_circumference(T,sigma,N,K,3,4,A), 'x vs z' : get_circumference(T,sigma,N,K,3,5,A), 'y vs z' : get_circumference(T,sigma,N,K,4,5,A), } return axes, circumferences def sigma_visualize(T, sigma, N=100, K=[1,1], label="", color=None, ax = None): N = 100 colors = list(matplotlib.colors.CSS4_COLORS.keys()) if color is None: color = colors[np.random.randint(0, len(colors))] if ax is None: ax = matplotlib.pyplot ax.plot(T.t()[0], T.t()[1],'x',color=color) ax.annotate(label, (T.t()[0], T.t()[1])) A = cholesky(sigma) for k in set(K): # plotting yaw & x plane labels = ['+yaw','-yaw','+x','-x'] points = [] points.append([0,0,k,0,0,0]) points.append([0,0,-k,0,0,0]) points.append([0,0,0,k,0,0]) points.append([0,0,0,-k,0,0]) for i in range(N+1): points.append([0,0,k*np.cos(2*np.pi/N*i), k*np.sin(2*np.pi/N*i),0,0]) points = np.array(points) points_img = np.dot(A,points.transpose()).transpose() propagated = [] for i in range(len(points_img)): tmp = mrob.geometry.SE3(T) tmp.update_lhs(points_img[i]) propagated.append(tmp) poses = np.array([x.t() for x in propagated]) poses = poses.reshape((-1,3)) ax.plot(poses[4:,0],poses[4:,1], label="{}-sigma yaw & x".format(k), color=color) for i in range(len(labels)): # ax.annotate(labels[i],xy = (poses[i,0],poses[i,1]), xytext = (poses[i,0]+0.01,poses[i,1]+0.01)) ax.plot(poses[i,0],poses[i,1],'x',color=color) # plotting x & y plane labels = ['+x','-x','+y','-y'] points = [] points.append([0,0,0,k,0,0]) points.append([0,0,0,-k,0,0]) points.append([0,0,0,0,k,0]) points.append([0,0,0,0,-k,0]) for i in range(N+1): points.append([0,0,0,k*np.cos(2*np.pi/N*i), k*np.sin(2*np.pi/N*i),0]) points = np.array(points) points_img = np.dot(A,points.transpose()).transpose() propagated = [] for i in range(len(points_img)): tmp = mrob.geometry.SE3(T) tmp.update_lhs(points_img[i]) propagated.append(tmp) poses = np.array([x.t() for x in propagated]) poses = poses.reshape((-1,3)) ax.plot(poses[4:,0],poses[4:,1], label="{}-sigma x & y".format(k), color=color) for i in range(len(labels)): # ax.annotate(labels[i],xy = (poses[i,0],poses[i,1]), xytext = (poses[i,0]+0.01,poses[i,1]+0.01)) ax.plot(poses[i,0],poses[i,1],'x',color=color) # plotting yaw & y plane labels = ['+yaw','-yaw','+y','-y'] points = [] points.append([0,0,k,0,0,0]) points.append([0,0,-k,0,0,0]) points.append([0,0,0,0,k,0]) points.append([0,0,0,0,k,0]) for i in range(N+1): points.append([0,0,k*np.cos(2*np.pi/N*i),0, k*np.sin(2*np.pi/N*i),0]) points = np.array(points) points_img = np.dot(A,points.transpose()).transpose() propagated = [] for i in range(len(points_img)): tmp = mrob.geometry.SE3(T) tmp.update_lhs(points_img[i]) propagated.append(tmp) poses = np.array([x.t() for x in propagated]) poses = poses.reshape((-1,3)) ax.plot(poses[4:,0],poses[4:,1], label="{}-sigma yaw & y".format(k),color=color) for i in range(len(labels)): # ax.annotate(labels[i],xy = (poses[i,0],poses[i,1]), xytext = (poses[i,0]+0.01,poses[i,1]+0.01)) ax.plot(poses[i,0],poses[i,1],'x',color=color) # plotting yaw axis of ellipsoid points = [] for i in range(N+1): points.append([0,0,k - i*(2*k)/N, 0,0,0]) points = np.array(points) points_img = np.dot(A,points.transpose()).transpose() propagated = [] for i in range(len(points_img)): tmp = mrob.geometry.SE3(T) tmp.update_lhs(points_img[i]) propagated.append(tmp) poses = np.array([x.t() for x in propagated]) poses = poses.reshape((-1,3)) ax.plot(poses[:,0],poses[:,1],color=color) # plotting x axis points = [] for i in range(N+1): points.append([0,0,0,k - i*(2*k)/N,0,0]) points = np.array(points) points_img = np.dot(A,points.transpose()).transpose() propagated = [] for i in range(len(points_img)): tmp = mrob.geometry.SE3(T) tmp.update_lhs(points_img[i]) propagated.append(tmp) poses = np.array([x.t() for x in propagated]) poses = poses.reshape((-1,3)) ax.plot(poses[:,0],poses[:,1],color=color) # plotting y axis points = [] for i in range(N+1): points.append([0,0,0,0,k - i*(2*k)/N, 0]) points = np.array(points) points_img = np.dot(A,points.transpose()).transpose() propagated = [] for i in range(len(points_img)): tmp = mrob.geometry.SE3(T) tmp.update_lhs(points_img[i]) propagated.append(tmp) poses = np.array([x.t() for x in propagated]) poses = poses.reshape((-1,3)) ax.plot(poses[:,0],poses[:,1],color=color) def ellipsoid_wireframe_df(T,sigma,N = 100, K = 1): axes, circumferences = sigma_visualize_3d(T=T,sigma=sigma,N = N, K = K) df = pd.DataFrame(columns=['x','y','z']) for key,val in axes.items(): tmp = pd.DataFrame(val,columns=['x','y','z']) tmp['label'] = key df = pd.concat([df,tmp]) for key,val in circumferences.items(): tmp = pd.DataFrame(val,columns=['x','y','z']) tmp['label'] = key df = pd.concat([df,tmp]) return df def mc_pointcloud_df(T, sigma, mean=np.zeros(6),N=100): poses, xi = get_mc(T=T, sigma=sigma, mean=mean,N=N) particles = pd.DataFrame(poses, columns=['x','y','z']) return particles
29.650602
109
0.548151
1,604
9,844
3.313591
0.096633
0.019944
0.034243
0.034619
0.718532
0.711947
0.702728
0.667168
0.586642
0.55936
0
0.038813
0.267168
9,844
331
110
29.740181
0.697948
0.078119
0
0.553571
0
0
0.028922
0
0
0
0
0
0
1
0.03125
false
0
0.03125
0
0.089286
0
0
0
0
null
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2589eb77b53e81f30f42249e4a59f220a70d8f3e
573
py
Python
api/tf_auth/migrations/0009_populate_username.py
prattl/teamfinder-web
85ded666879c2ee4b51cb59ffdedc2dedbfd9c7e
[ "Apache-2.0" ]
9
2017-04-10T09:40:01.000Z
2020-01-31T17:15:41.000Z
api/tf_auth/migrations/0009_populate_username.py
prattl/teamfinder-web
85ded666879c2ee4b51cb59ffdedc2dedbfd9c7e
[ "Apache-2.0" ]
19
2017-02-22T16:26:02.000Z
2020-02-04T16:08:16.000Z
api/tf_auth/migrations/0009_populate_username.py
prattl/teamfinder-web
85ded666879c2ee4b51cb59ffdedc2dedbfd9c7e
[ "Apache-2.0" ]
3
2017-04-17T06:37:58.000Z
2021-04-09T18:16:28.000Z
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2017-04-17 00:30 from __future__ import unicode_literals from django.db import migrations def forwards(apps, schema_editor): TFUser = apps.get_model('tf_auth.TFUser') for user in TFUser.objects.all(): try: user.username = user.player.username except: pass class Migration(migrations.Migration): dependencies = [ ('tf_auth', '0008_auto_20170417_0012'), ] operations = [ migrations.RunPython(forwards, migrations.RunPython.noop) ]
21.222222
65
0.649215
69
573
5.217391
0.73913
0.033333
0
0
0
0
0
0
0
0
0
0.076037
0.242583
573
26
66
22.038462
0.753456
0.118674
0
0
1
0
0.087649
0.045817
0
0
0
0
0
1
0.0625
false
0.0625
0.125
0
0.375
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
25976939b96e834c2bfbe96de1759d0543a5294c
254
py
Python
server/src/models/embedded_models/method_step_embedded_model.py
minhman727/miao-nutrition-assistant
c0f999756ae1a03371975be03ec7b7470f4b39e2
[ "MIT" ]
null
null
null
server/src/models/embedded_models/method_step_embedded_model.py
minhman727/miao-nutrition-assistant
c0f999756ae1a03371975be03ec7b7470f4b39e2
[ "MIT" ]
null
null
null
server/src/models/embedded_models/method_step_embedded_model.py
minhman727/miao-nutrition-assistant
c0f999756ae1a03371975be03ec7b7470f4b39e2
[ "MIT" ]
null
null
null
from mongoengine import * class MethodStep(EmbeddedDocument): description = StringField(require=True) images = ListField(ImageField(db_alias="miao"), null=True) meta = { "db_alias": "miao", "collection": "method_steps" }
25.4
62
0.661417
25
254
6.6
0.84
0.084848
0.133333
0
0
0
0
0
0
0
0
0
0.212598
254
10
63
25.4
0.825
0
0
0
0
0
0.14902
0
0
0
0
0
0
1
0
false
0
0.125
0
0.625
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
259fbbdca0af61061f255ad37e3048c4085965f8
307
py
Python
src/briefcase/apps/spreadsheet/events.py
Briefcase/Briefcase
34403c69c19cee1e682293a2c3c3f17c631b9246
[ "BSD-2-Clause" ]
2
2017-10-19T15:39:31.000Z
2022-02-09T02:59:27.000Z
src/briefcase/apps/spreadsheet/events.py
Briefcase/Briefcase
34403c69c19cee1e682293a2c3c3f17c631b9246
[ "BSD-2-Clause" ]
2
2021-06-16T02:08:42.000Z
2021-12-06T07:43:32.000Z
src/briefcase/apps/spreadsheet/events.py
Briefcase/Briefcase
34403c69c19cee1e682293a2c3c3f17c631b9246
[ "BSD-2-Clause" ]
2
2016-05-25T07:28:13.000Z
2021-04-02T03:55:08.000Z
def onMessage(request, message, socket): print "ON MESSAGE! :" + message socket.sendToMe("Hello Back!") pass def onConnect(requestData): #socket.sendToAll("Test All") #socket.sendToAllButMe("Test Not Me") #socket.sendToMe("Test Me") return True def onDisconnect(): pass
23.615385
41
0.661238
35
307
5.8
0.628571
0.128079
0
0
0
0
0
0
0
0
0
0
0.208469
307
13
42
23.615385
0.835391
0.29316
0
0.25
0
0
0.111628
0
0
0
0
0
0
0
null
null
0.25
0
null
null
0.125
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
25a41d20123f1a8a57294e429d62e5549539156f
518
py
Python
utils/sqlite.py
ztytotoro/python-scripts
a337abd6c2705483d3167f611d671a2b7ee517f7
[ "MIT" ]
null
null
null
utils/sqlite.py
ztytotoro/python-scripts
a337abd6c2705483d3167f611d671a2b7ee517f7
[ "MIT" ]
null
null
null
utils/sqlite.py
ztytotoro/python-scripts
a337abd6c2705483d3167f611d671a2b7ee517f7
[ "MIT" ]
null
null
null
# 导入: from sqlalchemy import Column, String, create_engine from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base # 创建对象的基类: Base = declarative_base() # 定义Project对象: class Project(Base): # 表的名字: __tablename__ = 'project' # 表的结构: id = Column(String(20), primary_key=True) name = Column(String(20)) # 初始化数据库连接: engine = create_engine( 'mysql+mysqlconnector://root:password@localhost:3306/test') # 创建DBSession类型: DBSession = sessionmaker(bind=engine)
21.583333
63
0.737452
59
518
6.322034
0.627119
0.112601
0.075067
0
0
0
0
0
0
0
0
0.018223
0.15251
518
24
64
21.583333
0.831435
0.119691
0
0
0
0
0.140312
0.124722
0
0
0
0
0
1
0
false
0.090909
0.272727
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
1
0
0
1
0
0
2
25c1cb3bad57e1815eb464351a2379c671232a0c
334
py
Python
en_fila/apps/management/migrations/0004_remove_employee_employee_passcode.py
puertoricanDev/En_fila
cf2551190be61f6a6ce705cccf35734edc682eef
[ "MIT" ]
null
null
null
en_fila/apps/management/migrations/0004_remove_employee_employee_passcode.py
puertoricanDev/En_fila
cf2551190be61f6a6ce705cccf35734edc682eef
[ "MIT" ]
null
null
null
en_fila/apps/management/migrations/0004_remove_employee_employee_passcode.py
puertoricanDev/En_fila
cf2551190be61f6a6ce705cccf35734edc682eef
[ "MIT" ]
null
null
null
# Generated by Django 3.2.6 on 2021-11-16 20:36 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('management', '0003_employee'), ] operations = [ migrations.RemoveField( model_name='employee', name='employee_passcode', ), ]
18.555556
47
0.598802
34
334
5.794118
0.794118
0.121827
0
0
0
0
0
0
0
0
0
0.080169
0.290419
334
17
48
19.647059
0.751055
0.134731
0
0
1
0
0.167247
0
0
0
0
0
0
1
0
false
0.090909
0.090909
0
0.363636
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
1
0
0
0
0
0
2
25c4fd8ace573f044a14fdb19367fd2f41c3ec1f
8,229
py
Python
install/app_store/tk-nuke-writenode/v1.2.0/app.py
JoanAzpeitia/lp_sg
e0ee79555e419dd2ae3a5f31e5515b3f40b22a62
[ "MIT" ]
null
null
null
install/app_store/tk-nuke-writenode/v1.2.0/app.py
JoanAzpeitia/lp_sg
e0ee79555e419dd2ae3a5f31e5515b3f40b22a62
[ "MIT" ]
null
null
null
install/app_store/tk-nuke-writenode/v1.2.0/app.py
JoanAzpeitia/lp_sg
e0ee79555e419dd2ae3a5f31e5515b3f40b22a62
[ "MIT" ]
1
2020-02-15T10:42:56.000Z
2020-02-15T10:42:56.000Z
# Copyright (c) 2013 Shotgun Software Inc. # # CONFIDENTIAL AND PROPRIETARY # # This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit # Source Code License included in this distribution package. See LICENSE. # By accessing, using, copying or modifying this work you indicate your # agreement to the Shotgun Pipeline Toolkit Source Code License. All rights # not expressly granted therein are reserved by Shotgun Software Inc. """ Tank Write Node for Nuke """ import os import nuke import tank from tank import TankError class NukeWriteNode(tank.platform.Application): def init_app(self): """ Called as the application is being initialized """ # import module and create handler tk_nuke_writenode = self.import_module("tk_nuke_writenode") self.__write_node_handler = tk_nuke_writenode.TankWriteNodeHandler(self) # patch handler onto nuke module for access in WriteNode knobs nuke._shotgun_write_node_handler = self.__write_node_handler # and for backwards compatibility! nuke._tank_write_node_handler = self.__write_node_handler # add WriteNodes to nuke menu self.__add_write_node_commands() # add callbacks: self.__write_node_handler.add_callbacks() @property def context_change_allowed(self): """ Specifies that context changes are allowed. """ return True def destroy_app(self): """ Called when the app is unloaded/destroyed """ self.log_debug("Destroying tk-nuke-writenode app") # remove any callbacks that were registered by the handler: self.__write_node_handler.remove_callbacks() # clean up the nuke module: if hasattr(nuke, "_shotgun_write_node_handler"): del nuke._shotgun_write_node_handler if hasattr(nuke, "_tank_write_node_handler"): del nuke._tank_write_node_handler def post_context_change(self, old_context, new_context): """ Handles refreshing the render paths of all Shotgun write nodes after a context change has been completed. :param old_context: The sgtk.context.Context being switched from. :param new_context: The sgtk.context.Context being switched to. """ for node in self.get_write_nodes(): self.reset_node_render_path(node) self.__write_node_handler.populate_profiles_from_settings() self.__write_node_handler.populate_script_template() self.__add_write_node_commands(new_context) def process_placeholder_nodes(self): """ Convert any placeholder nodes to TK Write Nodes """ self.__write_node_handler.process_placeholder_nodes() # interface for other apps to query write node info: # # access general information: def get_write_nodes(self): """ Return list of all write nodes """ return self.__write_node_handler.get_nodes() def get_node_name(self, node): """ Return the name for the specified node """ return self.__write_node_handler.get_node_name(node) def get_node_profile_name(self, node): """ Return the name of the profile the specified node is using """ return self.__write_node_handler.get_node_profile_name(node) def get_node_tank_type(self, node): """ Return the tank type for the specified node Note: Legacy version with old 'Tank Type' name - use get_node_published_file_type instead! """ return self.__write_node_handler.get_node_tank_type(node) def get_node_published_file_type(self, node): """ Return the published file type for the specified node """ return self.__write_node_handler.get_node_tank_type(node) def is_node_render_path_locked(self, node): """ Determine if the render path for the specified node is locked. The path will become locked if the cached version of the path no longer matches the computed path (using the appropriate render template). This can happen if the file is moved on disk or if the template is changed. """ return self.__write_node_handler.render_path_is_locked(node) # access full-res render information: def get_node_render_path(self, node): """ Return the render path for the specified node """ return self.__write_node_handler.compute_render_path(node) def get_node_render_files(self, node): """ Return the list of rendered files for the node """ return self.__write_node_handler.get_files_on_disk(node) def get_node_render_template(self, node): """ Return the render template for the specified node """ return self.__write_node_handler.get_render_template(node) def get_node_publish_template(self, node): """ Return the publish template for the specified node """ return self.__write_node_handler.get_publish_template(node) # access proxy-res render information: def get_node_proxy_render_path(self, node): """ Return the render path for the specified node """ return self.__write_node_handler.compute_proxy_path(node) def get_node_proxy_render_files(self, node): """ Return the list of rendered files for the node """ return self.__write_node_handler.get_proxy_files_on_disk(node) def get_node_proxy_render_template(self, node): """ Return the render template for the specified node """ return self.__write_node_handler.get_proxy_render_template(node) def get_node_proxy_publish_template(self, node): """ Return the publish template for the specified node """ return self.__write_node_handler.get_proxy_publish_template(node) # useful utility functions: def generate_node_thumbnail(self, node): """ Generate a thumnail for the specified node """ return self.__write_node_handler.generate_thumbnail(node) def reset_node_render_path(self, node): """ Reset the render path of the specified node. This will force the render path to be updated based on the current script path and configuraton. Note, this should really never be needed now that the path is reset automatically when the user changes something. """ self.__write_node_handler.reset_render_path(node) def convert_to_write_nodes(self): """ Convert all Shotgun write nodes found in the current Script to regular Nuke Write nodes. Additional toolkit information will be stored on additional user knobs named 'tk_*' """ self.__write_node_handler.convert_sg_to_nuke_write_nodes() def convert_from_write_nodes(self): """ Convert all regular Nuke Write nodes that have previously been converted from Shotgun Write nodes, back into Shotgun Write nodes. """ self.__write_node_handler.convert_nuke_to_sg_write_nodes() # Private methods # def __add_write_node_commands(self, context=None): """ Creates write node menu entries for all write node configurations """ context = context or self.context write_node_icon = os.path.join(self.disk_location, "resources", "tk2_write.png") for profile_name in self.__write_node_handler.profile_names: # add to toolbar menu cb_fn = lambda pn=profile_name: self.__write_node_handler.create_new_node(pn) self.engine.register_command( "%s [Shotgun]" % profile_name, cb_fn, dict( type="node", icon=write_node_icon, context=context, ) )
34.004132
89
0.652813
1,023
8,229
4.946237
0.226784
0.076482
0.10751
0.110672
0.431621
0.314032
0.258893
0.205731
0.187352
0.178459
0
0.000849
0.28436
8,229
241
90
34.145228
0.85838
0.36505
0
0.025
0
0
0.03081
0.011386
0
0
0
0
0
1
0.3
false
0
0.0625
0
0.575
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
25d3f23269643ac6a6edc73c74d7612fd5227b4e
6,741
py
Python
ooobuild/lo/ucb/x_simple_file_access.py
Amourspirit/ooo_uno_tmpl
64e0c86fd68f24794acc22d63d8d32ae05dd12b8
[ "Apache-2.0" ]
null
null
null
ooobuild/lo/ucb/x_simple_file_access.py
Amourspirit/ooo_uno_tmpl
64e0c86fd68f24794acc22d63d8d32ae05dd12b8
[ "Apache-2.0" ]
null
null
null
ooobuild/lo/ucb/x_simple_file_access.py
Amourspirit/ooo_uno_tmpl
64e0c86fd68f24794acc22d63d8d32ae05dd12b8
[ "Apache-2.0" ]
null
null
null
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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. # # Interface Class # this is a auto generated file generated by Cheetah # Libre Office Version: 7.3 # Namespace: com.sun.star.ucb import typing from abc import abstractmethod from ..uno.x_interface import XInterface as XInterface_8f010a43 if typing.TYPE_CHECKING: from ..io.x_input_stream import XInputStream as XInputStream_98d40ab4 from ..io.x_output_stream import XOutputStream as XOutputStream_a4e00b35 from ..io.x_stream import XStream as XStream_678908a4 from ..task.x_interaction_handler import XInteractionHandler as XInteractionHandler_bf80e51 from ..util.date_time import DateTime as DateTime_84de09d3 class XSimpleFileAccess(XInterface_8f010a43): """ This is the basic interface to read data from a stream. See Also: `API XSimpleFileAccess <https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1ucb_1_1XSimpleFileAccess.html>`_ """ __ooo_ns__: str = 'com.sun.star.ucb' __ooo_full_ns__: str = 'com.sun.star.ucb.XSimpleFileAccess' __ooo_type_name__: str = 'interface' __pyunointerface__: str = 'com.sun.star.ucb.XSimpleFileAccess' @abstractmethod def copy(self, SourceURL: str, DestURL: str) -> None: """ Copies a file. Raises: com.sun.star.ucb.CommandAbortedException: ``CommandAbortedException`` com.sun.star.uno.Exception: ``Exception`` """ @abstractmethod def createFolder(self, NewFolderURL: str) -> None: """ Creates a new Folder. Raises: com.sun.star.ucb.CommandAbortedException: ``CommandAbortedException`` com.sun.star.uno.Exception: ``Exception`` """ @abstractmethod def exists(self, FileURL: str) -> bool: """ Checks if a file exists. Raises: com.sun.star.ucb.CommandAbortedException: ``CommandAbortedException`` com.sun.star.uno.Exception: ``Exception`` """ @abstractmethod def getContentType(self, FileURL: str) -> str: """ Returns the content type of a file. Raises: com.sun.star.ucb.CommandAbortedException: ``CommandAbortedException`` com.sun.star.uno.Exception: ``Exception`` """ @abstractmethod def getDateTimeModified(self, FileURL: str) -> 'DateTime_84de09d3': """ Returns the last modified date for the file. Raises: com.sun.star.ucb.CommandAbortedException: ``CommandAbortedException`` com.sun.star.uno.Exception: ``Exception`` """ @abstractmethod def getFolderContents(self, FolderURL: str, bIncludeFolders: bool) -> 'typing.Tuple[str, ...]': """ Returns the contents of a folder. Raises: com.sun.star.ucb.CommandAbortedException: ``CommandAbortedException`` com.sun.star.uno.Exception: ``Exception`` """ @abstractmethod def getSize(self, FileURL: str) -> int: """ Returns the size of a file. Raises: com.sun.star.ucb.CommandAbortedException: ``CommandAbortedException`` com.sun.star.uno.Exception: ``Exception`` """ @abstractmethod def isFolder(self, FileURL: str) -> bool: """ Checks if a URL represents a folder. Raises: com.sun.star.ucb.CommandAbortedException: ``CommandAbortedException`` com.sun.star.uno.Exception: ``Exception`` """ @abstractmethod def isReadOnly(self, FileURL: str) -> bool: """ Checks if a file is \"read only\". Raises: com.sun.star.ucb.CommandAbortedException: ``CommandAbortedException`` com.sun.star.uno.Exception: ``Exception`` """ @abstractmethod def kill(self, FileURL: str) -> None: """ Removes a file. If the URL represents a folder, the folder will be removed, even if it's not empty. Raises: com.sun.star.ucb.CommandAbortedException: ``CommandAbortedException`` com.sun.star.uno.Exception: ``Exception`` """ @abstractmethod def move(self, SourceURL: str, DestURL: str) -> None: """ Moves a file. Raises: com.sun.star.ucb.CommandAbortedException: ``CommandAbortedException`` com.sun.star.uno.Exception: ``Exception`` """ @abstractmethod def openFileRead(self, FileURL: str) -> 'XInputStream_98d40ab4': """ Opens file to read. Raises: com.sun.star.ucb.CommandAbortedException: ``CommandAbortedException`` com.sun.star.uno.Exception: ``Exception`` """ @abstractmethod def openFileReadWrite(self, FileURL: str) -> 'XStream_678908a4': """ Opens file to read and write. Raises: com.sun.star.ucb.CommandAbortedException: ``CommandAbortedException`` com.sun.star.uno.Exception: ``Exception`` """ @abstractmethod def openFileWrite(self, FileURL: str) -> 'XOutputStream_a4e00b35': """ Opens file to write. Raises: com.sun.star.ucb.CommandAbortedException: ``CommandAbortedException`` com.sun.star.uno.Exception: ``Exception`` """ @abstractmethod def setInteractionHandler(self, Handler: 'XInteractionHandler_bf80e51') -> None: """ Sets an interaction handler to be used for further operations. A default interaction handler is available as service com.sun.star.task.InteractionHandler. The documentation of this service also contains further information about the interaction handler concept. """ @abstractmethod def setReadOnly(self, FileURL: str, bReadOnly: bool) -> None: """ Sets the \"read only\" of a file according to the boolean parameter, if the actual process has the right to do so. Raises: com.sun.star.ucb.CommandAbortedException: ``CommandAbortedException`` com.sun.star.uno.Exception: ``Exception`` """ __all__ = ['XSimpleFileAccess']
35.478947
206
0.645305
720
6,741
5.963889
0.301389
0.048905
0.081509
0.057522
0.459013
0.459013
0.425012
0.418724
0.404285
0.404285
0
0.016426
0.250408
6,741
189
207
35.666667
0.833366
0.54443
0
0.340426
0
0
0.103844
0.060981
0
0
0
0
0
1
0.340426
false
0
0.170213
0
0.617021
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
25e918b72fd4f7774d359e037858b76d4d02a0ff
4,891
py
Python
manifest-build-tools/application/generate_manifest.py
dalebremner/on-tools
18b826bca2a3608c5b50116ec710bbeb630a586e
[ "Apache-2.0" ]
4
2015-12-08T20:02:53.000Z
2019-03-08T07:42:24.000Z
manifest-build-tools/application/generate_manifest.py
dalebremner/on-tools
18b826bca2a3608c5b50116ec710bbeb630a586e
[ "Apache-2.0" ]
48
2016-01-28T23:50:38.000Z
2017-10-20T13:38:03.000Z
manifest-build-tools/application/generate_manifest.py
dalebremner/on-tools
18b826bca2a3608c5b50116ec710bbeb630a586e
[ "Apache-2.0" ]
38
2015-11-02T23:49:37.000Z
2021-05-27T01:24:03.000Z
#!/usr/bin/env python # Copyright 2016, DELLEMC, Inc. """ The script generate a new manifest for a new branch according to another manifest. For example, new branch: release/branch-1.2.3 date: 2016-12-15 00:00:00 The generated new manifest: branch-1.2.3-20161215 usage: ./on-tools/manifest-build-tools/HWIMO-BUILD on-tools/manifest-build-tools/application/generate_manifest.py \ --branch master \ --date "$date" \ --timezone "+0800" \ --builddir b \ --force \ --git-credential https://github.com,GITHUB \ --jobs 8 The required parameters: branch: The branch name of each repository in manifest file. date: The commit of each repository are last commit before the date. The valid date: current (the commit of each repository are the lastest commit") yesterday (the commit of each repository are the last commit of yesterday") date string, such as: 2016-12-01 00:00:00 (the commit of each repository are the last commit before the date") timezone: The Time Zone for the date, such as: +0800, -0800, -0500 git-credential: Git credentials for CI services. builddir: The directory for checked repositories. The optional parameters: force: If true, overwrite the destination manifest file even it already exists. jobs: number of parallel jobs to run. The number is related to the compute architecture, multi-core processors... """ import os import sys import argparse from dateutil.parser import parse from datetime import datetime,timedelta try: import common from ManifestGenerator import * except ImportError as import_err: print import_err sys.exit(1) def parse_command_line(args): """ Parse script arguments. :return: Parsed args for assignment """ parser = argparse.ArgumentParser() parser.add_argument("--branch", required=True, help="The branch of repositories in new manifest", action="store") parser.add_argument("--date", default="current", required=True, help="Generate a new manifest with commit before the date, such as: current, yesterday, 2016-12-13 00:00:00", action="store") parser.add_argument("--timezone", default="+0800", required=True, help="The time zone for parameter date", action="store") parser.add_argument("--builddir", required=True, help="destination for checked out repositories", action="store") parser.add_argument("--git-credential", required=True, help="Git credential for CI services", action="append") parser.add_argument("--force", help="use destination manifest file, even if it exists", action="store_true") parser.add_argument("--jobs", default=1, help="Number of parallel jobs to run", type=int) parsed_args = parser.parse_args(args) return parsed_args def convert_date(date_str): try: if date_str == "yesterday": utc_now = datetime.utcnow() utc_yesterday = utc_now + timedelta(days=-1) date = utc_yesterday.strftime('%Y%m%d 23:59:59') dt = parse(date) return dt else: dt = parse(date_str) return dt except Exception, e: raise ValueError(e) def main(): try: # parse arguments args = parse_command_line(sys.argv[1:]) slice_branch = args.branch.split("/")[-1] if args.date == "current": utc_now = datetime.utcnow() day_str = utc_now.strftime("%Y%m%d") dest_manifest = "{branch}-{day}".format(branch=slice_branch, day=day_str) generator = ManifestGenerator(dest_manifest, args.branch, args.builddir, args.git_credential, jobs=args.jobs, force=args.force) else: dt = convert_date(args.date) day_str = dt.strftime("%Y%m%d") dest_manifest = "{branch}-{day}".format(branch=slice_branch, day=day_str) date_str = "{0} {1}".format(dt.strftime("%Y-%m-%d %H:%M:%S"), args.timezone) generator = SpecifyDayManifestGenerator(dest_manifest, args.branch, date_str, args.builddir, args.git_credential, jobs=args.jobs, force=args.force) generator.update_manifest() generator.generate_manifest() except Exception, e: print "Failed to generate new manifest for {0} due to \n{1}\nExiting now".format(args.branch, e) sys.exit(1) if __name__ == "__main__": main() sys.exit(0)
36.774436
159
0.605193
598
4,891
4.859532
0.29097
0.021679
0.04095
0.020647
0.220922
0.147626
0.120785
0.110117
0.110117
0.0819
0
0.028283
0.291556
4,891
132
160
37.05303
0.81039
0.013494
0
0.3
1
0.0125
0.176471
0
0
0
0
0
0
0
null
null
0
0.1125
null
null
0.025
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
25f57628f67d79914ee5503f127fa52f25876ffe
424
py
Python
utils/logger.py
FFTYYY/RoR_relation_extraction
a099e98f3708a39debeed4dc522ff57c4f6b960d
[ "MIT" ]
25
2020-06-09T01:25:14.000Z
2021-12-22T10:47:18.000Z
utils/logger.py
FFTYYY/RoR_relation_extraction
a099e98f3708a39debeed4dc522ff57c4f6b960d
[ "MIT" ]
7
2020-06-21T08:32:26.000Z
2021-08-04T08:39:10.000Z
utils/logger.py
FFTYYY/RoR_relation_extraction
a099e98f3708a39debeed4dc522ff57c4f6b960d
[ "MIT" ]
3
2020-06-18T16:47:31.000Z
2021-08-10T01:04:16.000Z
from .watch_time import time_str import fitlog class Logger: def __init__(self , fil_path = None): self.log_fil = open(fil_path , "w" , encoding = "utf-8") def nolog(self , cont = ""): pass def log_print(self , cont = ""): self.log_fil.write(cont + "\n") self.log_fil.flush() print (cont) fitlog.add_to_line(cont) def log_print_w_time(self , cont = ""): self.log_print(str(cont) + " | " + time_str())
21.2
58
0.650943
67
424
3.835821
0.447761
0.108949
0.116732
0.116732
0
0
0
0
0
0
0
0.002899
0.186321
424
19
59
22.315789
0.742029
0
0
0
0
0
0.025943
0
0
0
0
0
0
1
0.285714
false
0.071429
0.142857
0
0.5
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
1
0
1
0
0
0
0
0
2
25fb9da113f8ffe313c22811acf787eb03963979
2,233
py
Python
openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/share/nslcd-utils/users.py
sotaoverride/backup
ca53a10b72295387ef4948a9289cb78ab70bc449
[ "Apache-2.0" ]
null
null
null
openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/share/nslcd-utils/users.py
sotaoverride/backup
ca53a10b72295387ef4948a9289cb78ab70bc449
[ "Apache-2.0" ]
null
null
null
openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/share/nslcd-utils/users.py
sotaoverride/backup
ca53a10b72295387ef4948a9289cb78ab70bc449
[ "Apache-2.0" ]
null
null
null
# coding: utf-8 # users.py - functions for validating the user to change information for # # Copyright (C) 2013 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library 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 # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA import getpass import os import pwd import sys class User(object): def __init__(self, username): self.myuid = os.getuid() if username: userinfo = pwd.getpwnam(username) else: self.asroot = False userinfo = pwd.getpwuid(self.myuid) (self.username, self.password, self.uid, self.gid, self.gecos, self.homedir, self.shell) = userinfo # if we are trying to modify another user we should be root self.asroot = self.myuid != self.uid def check(self): """Check if the user we want to modify is an LDAP user and whether we may modify the user information.""" if self.asroot and self.myuid != 0: print("%s: you may not modify user '%s'.\n" % (sys.argv[0], self.username)) sys.exit(1) # FIXME: check if the user is an LDAP user def get_passwd(self): """Ask and return a password that is required to change the user.""" # FIXME: only ask the password if we require it # (e.g. when root and nslcd has userpwmoddn we don't need to) return getpass.getpass( 'LDAP administrator password: ' if self.asroot else 'LDAP password for %s: ' % self.username ) # FIXME: check if the provided password is valid
36.606557
76
0.652485
324
2,233
4.481481
0.475309
0.024105
0.024793
0.039256
0.068871
0.068871
0.046832
0
0
0
0
0.012939
0.273175
2,233
60
77
37.216667
0.881701
0.55262
0
0
0
0
0.089864
0
0
0
0
0.016667
0
1
0.115385
false
0.230769
0.153846
0
0.346154
0.038462
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
25ffe35e8c78cb6840c07e1ba30975649c994db9
1,077
py
Python
python_to_you/models/profile.py
jacksonsr45/python_to_you
f0016e0450f3f2a4ba1f592baff8a9c28ffeaec7
[ "MIT" ]
1
2021-05-11T12:09:00.000Z
2021-05-11T12:09:00.000Z
python_to_you/models/profile.py
jacksonsr45/python_to_you
f0016e0450f3f2a4ba1f592baff8a9c28ffeaec7
[ "MIT" ]
null
null
null
python_to_you/models/profile.py
jacksonsr45/python_to_you
f0016e0450f3f2a4ba1f592baff8a9c28ffeaec7
[ "MIT" ]
null
null
null
import datetime from python_to_you.extensions.database import db from sqlalchemy_serializer import SerializerMixin class Profile(db.Model, SerializerMixin): __tablename__ = 'profiles' id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.ForeignKey('users.id', ondelete="CASCADE")) addresses_id = db.Column(db.ForeignKey('addresses.id', ondelete="CASCADE")) name = db.Column(db.String(255)) last_name = db.Column(db.String(255)) phone = db.Column(db.String(255)) social_media = db.Column(db.String(255)) created_at = db.Column(db.DateTime(), default=datetime.datetime.utcnow) updated_at = db.Column(db.DateTime()) class ProfilePicture(db.Model, SerializerMixin): __tablename__ = 'profiles_images' id = db.Column(db.Integer, primary_key=True) profile_id = db.Column(db.ForeignKey('profiles.id', ondelete="CASCADE")) title = db.Column(db.String(255)) path = db.Column(db.String(255)) created_at = db.Column(db.DateTime(), default=datetime.datetime.utcnow) updated_at = db.Column(db.DateTime())
41.423077
79
0.724234
146
1,077
5.184932
0.308219
0.15852
0.198151
0.126816
0.65786
0.417437
0.356671
0.356671
0.269485
0.269485
0
0.019313
0.134633
1,077
26
80
41.423077
0.792918
0
0
0.272727
0
0
0.069573
0
0
0
0
0
0
1
0
false
0
0.136364
0
1
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
d303609067dd385ae7d7e794011ee33a46b6f186
861
py
Python
boofuzz/boofuzz/primitives/simple.py
mrTavas/owasp-fstm-auto
6e9ff36e46d885701c7419db3eca15f12063a7f3
[ "CC0-1.0" ]
2
2021-05-05T12:03:01.000Z
2021-06-04T14:27:15.000Z
boofuzz/boofuzz/primitives/simple.py
mrTavas/owasp-fstm-auto
6e9ff36e46d885701c7419db3eca15f12063a7f3
[ "CC0-1.0" ]
null
null
null
boofuzz/boofuzz/primitives/simple.py
mrTavas/owasp-fstm-auto
6e9ff36e46d885701c7419db3eca15f12063a7f3
[ "CC0-1.0" ]
2
2021-05-05T12:03:09.000Z
2021-06-04T14:27:21.000Z
from ..fuzzable import Fuzzable class Simple(Fuzzable): """Simple bytes value with manually specified fuzz values only. :type name: str, optional :param name: Name, for referencing later. Names should always be provided, but if not, a default name will be given, defaults to None :type default_value: Raw, optional :param default_value: Raw static data :type fuzz_values: list, optional :param fuzz_values: List of fuzz values, defaults to None. If empty, Simple is equivalent to Static. :type fuzzable: bool, optional :param fuzzable: Enable/disable fuzzing of this primitive, defaults to true """ def __init__(self, name=None, default_value=None, fuzz_values=None, *args, **kwargs): super(Simple, self).__init__(name=name, default_value=default_value, fuzz_values=fuzz_values, *args, **kwargs)
43.05
120
0.724739
120
861
5.05
0.475
0.115512
0.046205
0
0
0
0
0
0
0
0
0
0.190476
861
19
121
45.315789
0.86944
0.628339
0
0
0
0
0
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
d32efdf87fa01cecf781b9df68da523858dc7395
446
py
Python
github/joeynmt/vizseq/__init__.py
shania3322/joeynmt
5afe9d00930f19949b2078141771bf4621f6e9ae
[ "Apache-2.0" ]
null
null
null
github/joeynmt/vizseq/__init__.py
shania3322/joeynmt
5afe9d00930f19949b2078141771bf4621f6e9ae
[ "Apache-2.0" ]
null
null
null
github/joeynmt/vizseq/__init__.py
shania3322/joeynmt
5afe9d00930f19949b2078141771bf4621f6e9ae
[ "Apache-2.0" ]
null
null
null
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import os.path as op from pathlib import Path FILE_ROOT = Path(__file__).parent with open(op.join(FILE_ROOT, 'VERSION')) as f: __version__ = f.read() from vizseq.ipynb import * from vizseq.ipynb import fairseq_viz as fairseq
26.235294
62
0.724215
69
446
4.521739
0.623188
0.064103
0.096154
0.134615
0
0
0
0
0
0
0
0
0.199552
446
16
63
27.875
0.87395
0.414798
0
0
0
0
0.029412
0
0
0
0
0
0
1
0
false
0
0.571429
0
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
d32f5b9d04aa58bad6be7d58f09474c29bae63fc
428
py
Python
invest_app/investlib/yfhelper.py
bdastur/builder
e05c013d01c4e82340879289940b3029fc6de266
[ "Apache-2.0" ]
null
null
null
invest_app/investlib/yfhelper.py
bdastur/builder
e05c013d01c4e82340879289940b3029fc6de266
[ "Apache-2.0" ]
null
null
null
invest_app/investlib/yfhelper.py
bdastur/builder
e05c013d01c4e82340879289940b3029fc6de266
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- import yahoofinancials def get_historical_price_data(ticker_symbol, start_date, end_date, frequency='weekly'): ''' The API returns historical price data. ''' yf = yahoofinancials.YahooFinancials(ticker_symbol) data = yf.get_historical_price_data(start_date, end_date, frequency) return data
22.526316
72
0.619159
46
428
5.5
0.565217
0.177866
0.225296
0.173913
0.197628
0
0
0
0
0
0
0.003279
0.287383
428
18
73
23.777778
0.82623
0.189252
0
0
0
0
0.018293
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0
0.428571
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
d33381d94db212c012354ecf16f4b8a33084a29c
301
py
Python
SchoolManagement/ServerRestAPI/admin.py
amiremohamadi/django-restful-api
13dd5de4f16b5529556118a3469680c42e6e8c42
[ "MIT" ]
4
2019-05-26T18:08:44.000Z
2019-07-05T10:45:24.000Z
SchoolManagement/ServerRestAPI/admin.py
amiremohamadi/django-restful-api
13dd5de4f16b5529556118a3469680c42e6e8c42
[ "MIT" ]
null
null
null
SchoolManagement/ServerRestAPI/admin.py
amiremohamadi/django-restful-api
13dd5de4f16b5529556118a3469680c42e6e8c42
[ "MIT" ]
2
2020-05-31T20:38:59.000Z
2020-10-07T11:16:52.000Z
from django.contrib import admin from ServerRestAPI.models import ( Student, Teacher, StudentLecture, TeacherLecture, Lecture ) admin.site.register(Student) admin.site.register(Teacher) admin.site.register(StudentLecture) admin.site.register(TeacherLecture) admin.site.register(Lecture)
25.083333
38
0.797342
34
301
7.058824
0.411765
0.1875
0.354167
0
0
0
0
0
0
0
0
0
0.109635
301
12
39
25.083333
0.895522
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.2
0
0.2
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
d33e1e636ee5da0369711e6dc257901496e19cc2
486
py
Python
julie/physics/velocity.py
MarcelloBB/julieutils
cffba53a1561d05660c2274ce0a9485bf9e0ddcf
[ "MIT" ]
2
2021-08-23T15:16:43.000Z
2021-11-01T15:29:02.000Z
julie/physics/velocity.py
MarcelloBB/julieutils
cffba53a1561d05660c2274ce0a9485bf9e0ddcf
[ "MIT" ]
null
null
null
julie/physics/velocity.py
MarcelloBB/julieutils
cffba53a1561d05660c2274ce0a9485bf9e0ddcf
[ "MIT" ]
null
null
null
def average_speed(s1 : float, s0 : float, t1 : float, t0 : float) -> float: """ [FUNC] average_speed: Returns the average speed. Where: Delta Space = (space1[s1] - space0[s0]) Delta Time = (time1[t1] - time0[t0]) """ return ((s1-s0)/(t1-t0)); def average_acceleration(v1 : float, v0 : float, t1 : float, t0 : float) -> float: """ [FUNC] average_acceleration: Returns the average_acceleration """ return ((v1-v0)/(t1-t0));
22.090909
82
0.576132
61
486
4.508197
0.377049
0.130909
0.087273
0.101818
0.254545
0.254545
0.254545
0.254545
0
0
0
0.066667
0.259259
486
22
83
22.090909
0.697222
0.407407
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
d3531e57298807b91066e04d1ce5acf961f78599
4,566
py
Python
src/zope/app/publisher/interfaces/ftp.py
zopefoundation/zope.app.publisher
7c7aea272a8c4cd10ef97264f8f48766368ceefb
[ "ZPL-2.1" ]
1
2019-12-04T12:52:44.000Z
2019-12-04T12:52:44.000Z
src/zope/app/publisher/interfaces/ftp.py
zopefoundation/zope.app.publisher
7c7aea272a8c4cd10ef97264f8f48766368ceefb
[ "ZPL-2.1" ]
6
2017-05-05T11:53:40.000Z
2020-06-08T13:49:42.000Z
src/zope/app/publisher/interfaces/ftp.py
zopefoundation/zope.app.publisher
7c7aea272a8c4cd10ef97264f8f48766368ceefb
[ "ZPL-2.1" ]
2
2015-04-03T08:00:16.000Z
2020-06-09T10:06:15.000Z
############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Virtual File System interfaces for the publisher. $Id$ """ from zope.publisher.interfaces.ftp import IFTPPublisher, IFTPView class IFTPDirectoryPublisher(IFTPPublisher, IFTPView): def type(name): """Return the file type at the given name The return valie is 'd', for a directory, 'f', for a file, and None if there is no file at the path. """ def names(filter=None): """Return a sequence of the names in a directory If the filter is not None, include only those names for which the filter returns a true value. """ def ls(filter=None): """Return a sequence of information objects Return item info objects (see lsinfo) for the files in a directory. If the filter is not None, include only those names for which the filter returns a true value. """ def readfile(name, outstream, start=0, end=None): """Outputs the file at name to a stream. Data are copied starting from start. If end is not None, data are copied up to end. """ def lsinfo(name): """Return information for a unix-style ls listing for the path Data are returned as a dictionary containing the following keys: type The path type, either 'd' or 'f'. owner_name Defaults to "na". Must not include spaces. owner_readable defaults to True owner_writable defaults to True owner_executable defaults to True for directories and false otherwise. group_name Defaults to "na". Must not include spaces. group_readable defaults to True group_writable defaults to True group_executable defaults to True for directories and false otherwise. other_readable defaults to False other_writable defaults to False other_executable defaults to True for directories and false otherwise. mtime Optional time, as a datetime. nlinks The number of links. Defaults to 1. size The file size. Defaults to 0. name The file name. """ def mtime(name): """Return the modification time for the file Return None if it is unknown. """ def size(name): """Return the size of the file at path """ def mkdir(name): """Create a directory. """ def remove(name): """Remove a file. Same as unlink. """ def rmdir(name): """Remove a directory. """ def rename(old, new): """Rename a file or directory. """ def writefile(name, instream, start=None, end=None, append=False): """Write data to a file. If start or end is not None, then only part of the file is written. The remainder of the file is unchanged. If start or end are specified, they must ne non-negative. If end is None, then the file is truncated after the data are written. If end is not None, parts of the file after end, if any, are unchanged. If end is not None and there isn't enough data in instream to fill out the file, then the missing data are undefined. If neither start nor end are specified, then the file contents are overwritten. If start is specified and the file doesn't exist or is shorter than start, the file will contain undefined data before start. If append is true, start and end are ignored. """ def writable(name): """Return boolean indicating whether a file at path is writable Note that a true value should be returned if the file doesn't exist but it's directory is writable. """
25.50838
78
0.597678
599
4,566
4.537563
0.323873
0.038631
0.036056
0.01766
0.201987
0.173289
0.153422
0.153422
0.126932
0.066225
0
0.004136
0.311651
4,566
178
79
25.651685
0.860643
0.689444
0
0
0
0
0
0
0
0
0
0
0
1
0.866667
false
0
0.066667
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
d3891e3d0186411e4c72b16b384e7e13ef7cce0a
395
py
Python
tests/test_msal.py
narongdejsrn/django-rest-framework-msal
0e969aadf7a681b24b630c008f05be1d339d0df4
[ "MIT" ]
3
2020-04-22T01:56:41.000Z
2021-06-22T15:21:57.000Z
tests/test_msal.py
narongdejsrn/django-rest-framework-msal
0e969aadf7a681b24b630c008f05be1d339d0df4
[ "MIT" ]
2
2021-01-08T09:04:16.000Z
2021-07-20T19:43:15.000Z
tests/test_msal.py
narongdejsrn/django-rest-framework-msal
0e969aadf7a681b24b630c008f05be1d339d0df4
[ "MIT" ]
4
2020-05-25T07:34:37.000Z
2021-06-11T07:37:59.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test-msal ------------ Tests for MSAL Connection """ from django.test import TestCase from drf_msal_jwt.utils import build_auth_url class TestMSAL(TestCase): def setUp(self): pass def test_login_url(self): login_url = build_auth_url() self.assertIsNotNone(login_url) def tearDown(self): pass
14.62963
45
0.637975
52
395
4.653846
0.596154
0.099174
0.099174
0
0
0
0
0
0
0
0
0.003279
0.227848
395
26
46
15.192308
0.790164
0.232911
0
0.2
0
0
0
0
0
0
0
0
0.1
1
0.3
false
0.2
0.2
0
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
d391cc09726af2cc48341fbff68008cd2eedea8a
8,451
py
Python
test/testfiles.py
mvz/vb2py
6ea046f6fc202527a1b3fcd3ef5a67b969dea715
[ "BSD-3-Clause" ]
2
2015-12-01T10:52:36.000Z
2021-04-20T05:15:01.000Z
test/testfiles.py
mvz/vb2py
6ea046f6fc202527a1b3fcd3ef5a67b969dea715
[ "BSD-3-Clause" ]
4
2016-07-18T18:28:24.000Z
2016-07-19T08:30:14.000Z
test/testfiles.py
mvz/vb2py
6ea046f6fc202527a1b3fcd3ef5a67b969dea715
[ "BSD-3-Clause" ]
3
2015-07-15T21:08:19.000Z
2021-02-25T09:39:12.000Z
from testframework import * import os import vb2py.utils PATH = vb2py.utils.rootPath() # << File tests >> (1 of 14) # Open with Input tests.append((r""" Open "%s" For Input As #3 Input #3, a Input #3, b Input #3, c, d, e Input #3, f, g Close #3 """ % vb2py.utils.relativePath("test/testread.txt"), {'a' : 'Can you hear me now?', 'b' : 'Can you still hear me now?', 'c' : 10, 'd' : 20, 'e' : 30, 'f' : 5, 'g' : "hello", })) # Open with Line Input tests.append((r""" Open "%s/test/testread.txt" For Input As #3 Line Input #3, a Line Input #3, b Line Input #3, c Line Input #3, d Close #3 """ % PATH, {'a' : 'Can you hear me now?', 'b' : 'Can you still hear me now?', 'c' : '10, 20, 30', 'd' : '5, "hello"', })) # Open and using Input() to get numbers of characters tests.append((r""" Open "%s/test/testread.txt" For Input As #3 a = Input(3, #3) b = Input(1, #3) c = Input(3, #3) Close #3 """ % PATH, {'a' : 'Can', 'b' : ' ', 'c' : 'you', })) # Bug #810964 Input with indexed variable fails tests.append((r""" Open "%s/test/testread.txt" For Input As #3 Dim _a(3) As String Input #3, _a(1), _a(2), _a(3) Close #3 a = _a(1) b = _a(2) c = _a(3) """ % PATH, {'a' : 'Can you hear me now?', 'b' : 'Can you still hear me now?', 'c' : 10, })) # Open with Random access tests.append((r""" Open "%s" For Random As #3 Len = 2 ' !!!!Dont expect this to work!!!! Input #3, a Input #3, b Input #3, c, d, e Input #3, f, g Close #3 """ % vb2py.utils.relativePath("test/testread.txt"), {'a' : 'This wont work!!!!'})) # << File tests >> (2 of 14) # Open with print tests.append((r""" Open "%s/test/testwrite.txt" For Output As #3 Print #3, 10 Print #3, 20, 30 Print #3, 40, 50 Print #3, "hello" Close #3 Open "%s/test/testwrite.txt" For Input As #3 Input #3, a, b, c, d, f Line Input #3, e """ % (PATH, PATH), {'a' : 10, 'b' : 20, 'c' : 30, 'd' : 40, 'e' : 'hello', 'f' : 50, })) # Open with print but no cr tests.append((r""" Open "%s/test/testwrite.txt" For Output As #3 Print #3, 10; Print #3, 20, 30; Print #3, 40, "hello", 50; Close #3 Open "%s/test/testwrite.txt" For Input As #3 Line Input #3, a """ % (PATH, PATH), {'a' : "1020\t3040\thello\t50"} )) # Bare print with no channel number (Bug #805866 - used to fail during render) tests.append(("Print 10", {})) # << File tests >> (3 of 14) # Open with Input tests.append((r""" Close _a = FreeFile Open "%s" For Input As FreeFile Open "%s" For Output As FreeFile _b = FreeFile Close _c = FreeFile a = _a = _b b = _a = _c c = _b = _c d = CStr(_a) & CStr(_b) & CStr(_c) """ % (vb2py.utils.relativePath("test/testread.txt"), vb2py.utils.relativePath("test/testwrite.txt")), {'a':0, 'b':1, 'c':0, 'd': '131', })) # Using Reset instead of Close tests.append((r""" Reset _a = FreeFile Open "%s" For Input As FreeFile Open "%s" For Output As FreeFile _b = FreeFile Reset _c = FreeFile a = _a = _b b = _a = _c c = _b = _c d = CStr(_a) & CStr(_b) & CStr(_c) """ % (vb2py.utils.relativePath("test/testread.txt"), vb2py.utils.relativePath("test/testwrite.txt")), {'a':0, 'b':1, 'c':0, 'd': '131', })) # Bug #810968 Close #1, #2 ' fails to parse tests.append((r""" Open "%s" For Input As #3 Open "%s" For Output As #4 Close #3, #4 Input #3, a """ % (vb2py.utils.relativePath("test/testread.txt"), vb2py.utils.relativePath("test/testwrite.txt")), {'FAIL' : 'yes', })) # << File tests >> (4 of 14) # Seek as a way of moving around in a file tests.append((r""" Open "%s" For Input As #3 Input #3, a Seek #3, 1 Input #3, b Seek #3, 5 Input #3, c """ % vb2py.utils.relativePath("test/testread.txt"), { 'a' : 'Can you hear me now?', 'b' : 'Can you hear me now?', 'c' : 'you hear me now?', })) # Seek as a property of the file tests.append((r""" Open "%s" For Input As #3 a = Seek(3) Input #3, _a b = Seek(3) Seek #3, 5 c = Seek(3) """ % vb2py.utils.relativePath("test/testread.txt"), { 'a' : 1, 'b' : 23, 'c' : 5, })) # << File tests >> (5 of 14) # Dir tests.append((r""" a = Dir("test/test*.txt") b = Dir() c = Dir() """, { 'a' : 'testread.txt', 'b' : 'testwrite.txt', 'c' : '', })) # Dir$ tests.append((r""" a = Dir$("test/test*.txt") b = Dir$() c = Dir$() """, { 'a' : 'testread.txt', 'b' : 'testwrite.txt', 'c' : '', })) # Dir no parenthesis tests.append((r""" a = Dir("test/test*.txt") b = Dir c = Dir """, { 'a' : 'testread.txt', 'b' : 'testwrite.txt', 'c' : '', })) # Dir$ no parenthesis tests.append((r""" a = Dir$("test/test*.txt") b = Dir$ c = Dir$ """, { 'a' : 'testread.txt', 'b' : 'testwrite.txt', 'c' : '', })) # << File tests >> (6 of 14) # Dir tests.append((r""" _a = FreeFile Open "__f1.txt" For Output As #_a _b = FreeFile Open "__f2.txt" For Output As #_b Close #_b _c = FreeFile Close #_a _d = FreeFile da = _b-_a db = _c-_a dd = _d-_a """, { 'da' : 1, 'db' : 1, 'dd' : 0, })) # << File tests >> (7 of 14) # Dir tests.append((r""" ChDir "%s" Open "_test1.txt" For Output As #3 Print #3, "in testdir" Close #3 ChDir "%s" Open "_test1.txt" For Output As #3 Print #3, "not in testdir" Close #3 ChDir "%s" Open "_test1.txt" For Input As #3 Input #3, a Close #3 ChDir "%s" Open "_test1.txt" For Input As #3 Input #3, b Close #3 """ % (vb2py.utils.relativePath("test/testdir"), vb2py.utils.relativePath("test"), vb2py.utils.relativePath("test/testdir"), vb2py.utils.relativePath("test")), { 'a' : 'in testdir', 'b' : 'not in testdir', })) # << File tests >> (8 of 14) # Dir tests.append((r""" Open "_test1.txt" For Output As #3 Print #3, "made file" Close #3 Kill "_test1.txt" a = Dir("_test1.txt") """, { 'a' : '', })) # << File tests >> (9 of 14) try: for name in os.listdir(vb2py.utils.relativePath("test/mytest2")): os.remove(os.path.join(vb2py.utils.relativePath("test/mytest2"), name)) except OSError: pass try: os.rmdir(vb2py.utils.relativePath("test/mytest2")) except OSError, err: pass # Dir tests.append((r""" MkDir "%s" Open "%s\test1.txt" For Output As #3 Print #3, "made file" Close #3 a = 1 """ % (vb2py.utils.relativePath("test/mytest2"), vb2py.utils.relativePath("test/mytest2")), { 'a' : 1, })) # << File tests >> (10 of 14) try: for name in os.listdir(vb2py.utils.relativePath("test/mytestdir")): os.remove(os.path.join(vb2py.utils.relativePath("test/mytestdir"), name)) except OSError: pass try: os.rmdir(vb2py.utils.relativePath("test/mytestdir")) except OSError: pass # Dir tests.append((r""" MkDir "%s" RmDir "%s" a = 0 """ % (vb2py.utils.relativePath("test/mytestdir"), vb2py.utils.relativePath("test/mytestdir")), { 'a' : os.path.isdir(vb2py.utils.relativePath("test/mytestdir")), })) # << File tests >> (11 of 14) try: os.remove(os.path.join(vb2py.utils.relativePath("test"), "knewname.txt")) except OSError: pass # Dir tests.append((r""" _path = "%s" Open _path & "\origname.txt" For Output As #3 Close #3 a = Dir(_path & "\origname.txt") Name _path & "\origname.txt" As _path & "\knewname.txt" b = Dir(_path & "\origname.txt") c = Dir(_path & "\knewname.txt") """ % (vb2py.utils.relativePath("test")), { 'a' : "origname.txt", 'b' : "", 'c' : "knewname.txt", })) # << File tests >> (12 of 14) try: os.remove(os.path.join(vb2py.utils.relativePath("test"), "finalcopy.txt")) except OSError: pass # Dir tests.append((r""" _path = "%s" Open _path & "\origcopy.txt" For Output As #3 Print #3, "original" Close #3 a = Dir(_path & "\origcopy.txt") b = Dir(_path & "\finalcopy.txt") FileCopy _path & "\origcopy.txt", _path & "\finalcopy.txt" c = Dir(_path & "\origcopy.txt") d = Dir(_path & "\finalcopy.txt") """ % (vb2py.utils.relativePath("test")), { 'a' : "origcopy.txt", 'b' : "", 'c' : "origcopy.txt", 'd' : "finalcopy.txt", })) # << File tests >> (13 of 14) # Input as a function to get a certain number of characters tests.append((r""" Open "%s" For Input As #3 a = Input(3, #3) b = Input(4, #3) Close #3 """ % vb2py.utils.relativePath("test/testread.txt"), { 'a' : 'Can', 'b' : ' you', })) # << File tests >> (14 of 14) # Input as a function to get a certain number of characters tests.append((r""" Open "%s" For Input As #3 While Not EOF(#3) Input #3, a End While Close #3 """ % vb2py.utils.relativePath("test/testread.txt"), { 'a' : 'hello', })) # -- end -- << File tests >> #< < Small File tests >> import vb2py.vbparser vb2py.vbparser.log.setLevel(0) # Don't print all logging stuff TestClass = addTestsTo(BasicTest, tests) if __name__ == "__main__": main()
20.121429
83
0.595196
1,370
8,451
3.613139
0.120438
0.066667
0.137778
0.162828
0.682828
0.618788
0.592727
0.568283
0.549495
0.488081
0
0.04427
0.187433
8,451
419
84
20.169451
0.676569
0.128506
0
0.578035
0
0
0.56561
0.036222
0
0
0
0
0
0
null
null
0.017341
0.011561
null
null
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
1
0
0
0
0
0
0
0
0
2
d396697591d214281a9fa0a4c6107036bc957349
964
py
Python
tests/test_cron.py
acuros/noopy
aa128466068bfcdcd4be3aa16c1bdd48fd9e5a23
[ "MIT" ]
11
2016-01-16T06:00:39.000Z
2016-05-24T02:25:58.000Z
tests/test_cron.py
acuros/noopy
aa128466068bfcdcd4be3aa16c1bdd48fd9e5a23
[ "MIT" ]
4
2016-01-23T07:00:47.000Z
2016-05-09T02:49:26.000Z
tests/test_cron.py
acuros/noopy
aa128466068bfcdcd4be3aa16c1bdd48fd9e5a23
[ "MIT" ]
null
null
null
import pytest from noopy.cron.rule import RateEventRule, BaseEventRule, TimeEventRule from noopy.decorators import cron @pytest.fixture def rate_5_mins_rule(): return RateEventRule('5MinsRateRule', value=5) @pytest.fixture def time_5pm_rule(): return TimeEventRule('5pmRule', '* 17 * * * *') @pytest.fixture def cronjob(): return lambda event, context: dict(foo='bar') def test_rate_rule(rate_5_mins_rule): assert len(BaseEventRule.rules) == 0 assert rate_5_mins_rule.expression == 'rate(5 minutes)' def test_time_rule(time_5pm_rule): assert len(BaseEventRule.rules) == 0 assert time_5pm_rule.expression == 'cron(* 17 * * * *)' def test_cron_decorator(cronjob): rule = RateEventRule("RateCron", 1, RateEventRule.UNIT_HOURS) cron(rule)(cronjob) assert len(BaseEventRule.rules) == 1 assert len(BaseEventRule.rules.values()[0].functions) == 1 assert BaseEventRule.rules.values()[0].functions[0] == cronjob
25.368421
71
0.724066
125
964
5.408
0.344
0.133136
0.130178
0.159763
0.213018
0.112426
0.112426
0
0
0
0
0.026829
0.149378
964
37
72
26.054054
0.797561
0
0
0.208333
0
0
0.078838
0
0
0
0
0
0.291667
1
0.25
false
0
0.125
0.125
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
0
0
1
0
0
0
2
d3a5d6c9ee0959d8b6a152abcf1fe990458d7e86
1,519
py
Python
src/box.py
ertugrullKara/GarbageDetector
68e267e4036ef05c603c1193462b5230b6751857
[ "MIT" ]
1
2019-05-21T01:06:42.000Z
2019-05-21T01:06:42.000Z
src/box.py
ertugrullKara/GarbageDetector
68e267e4036ef05c603c1193462b5230b6751857
[ "MIT" ]
8
2020-01-28T21:41:58.000Z
2022-03-11T23:17:50.000Z
src/box.py
ertugrullKara/GarbageDetector
68e267e4036ef05c603c1193462b5230b6751857
[ "MIT" ]
null
null
null
import numpy as np class BoundBox: """ Adopted from https://github.com/thtrieu/darkflow/blob/master/darkflow/utils/box.py """ def __init__(self, obj_prob, probs=None, box_coord=[float() for i in range(4)]): self.x, self.y = float(box_coord[0]), float(box_coord[1]) self.w, self.h = float(box_coord[2]), float(box_coord[3]) self.c = 0. self.obj_prob = obj_prob self.class_probs = None if probs is None else np.array(probs) def get_score(self): return max(self.class_probs) def get_classindex(self): return np.argmax(self.class_probs) # class_index = np.argmax(box.classes) def get_coordinates(self): return self.x, self.y, self.w, self.h def overlap(x1, w1, x2, w2): l1 = x1 - w1 / 2. l2 = x2 - w2 / 2. left = max(l1, l2) r1 = x1 + w1 / 2. r2 = x2 + w2 / 2. right = min(r1, r2) return right - left def box_intersection(a, b): w = overlap(a.x, a.w, b.x, b.w) h = overlap(a.y, a.h, b.y, b.h) if w < 0 or h < 0: return 0; area = w * h return area def box_union(a, b): i = box_intersection(a, b) u = a.w * a.h + b.w * b.h - i return u def box_iou(a, b): # Box intersect over union. return box_intersection(a, b) / box_union(a, b) def prob_compare(box): return box.probs[box.class_num] def prob_compare2(boxa, boxb): if (boxa.pi < boxb.pi): return 1 elif (boxa.pi == boxb.pi): return 0 else: return -1
23.015152
90
0.581962
259
1,519
3.305019
0.320463
0.014019
0.060748
0.059579
0.042056
0
0
0
0
0
0
0.033667
0.276498
1,519
65
91
23.369231
0.745223
0.096116
0
0
0
0
0
0
0
0
0
0
0
1
0.232558
false
0
0.023256
0.116279
0.534884
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
d3a9236251a872a4b147f5fa34a60d6f71d1589b
667
py
Python
unit_workaround.py
ltfish/nose2
e47363dad10056cf906daf387613c21d74f37e56
[ "BSD-2-Clause" ]
null
null
null
unit_workaround.py
ltfish/nose2
e47363dad10056cf906daf387613c21d74f37e56
[ "BSD-2-Clause" ]
null
null
null
unit_workaround.py
ltfish/nose2
e47363dad10056cf906daf387613c21d74f37e56
[ "BSD-2-Clause" ]
null
null
null
""" Python 2.7 Multiprocessing Unittest workaround. ===================================================================== Due the manner in which multiprocessing is handled on windows and the fact that __main__.py are actually called __main__ This workaround bypasses the fact that the calling unittest script is called __main__ http://bugs.python.org/issue10845 This should be fine for python 3.2+, however, 2.7 and before will not likely see a fix. This only affects the unittests called by tox. """ import unittest from unittest.main import main, TestProgram, USAGE_AS_MAIN TestProgram.USAGE = USAGE_AS_MAIN if __name__ == "__main__": main(module=None)
29
69
0.704648
93
667
4.795699
0.623656
0.008969
0.049327
0
0
0
0
0
0
0
0
0.019164
0.13943
667
22
70
30.318182
0.75784
0.745127
0
0
0
0
0.049689
0
0
0
0
0
0
1
0
true
0
0.4
0
0.4
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
2
6c921bf76ccad8c233e5e7ae6b187fed9a3a6457
1,500
py
Python
src/negotiating_agent/venv/lib/python3.8/site-packages/geniusweb/bidspace/AllBidsList.py
HahaBill/CollaborativeAI
f771cd2f34774c74c58e49a7e983d6244ea35eff
[ "MIT" ]
1
2022-02-17T19:14:46.000Z
2022-02-17T19:14:46.000Z
src/negotiating_agent/venv/lib/python3.8/site-packages/geniusweb/bidspace/AllBidsList.py
HahaBill/CollaborativeAI
f771cd2f34774c74c58e49a7e983d6244ea35eff
[ "MIT" ]
null
null
null
src/negotiating_agent/venv/lib/python3.8/site-packages/geniusweb/bidspace/AllBidsList.py
HahaBill/CollaborativeAI
f771cd2f34774c74c58e49a7e983d6244ea35eff
[ "MIT" ]
null
null
null
from typing import Dict, List from tudelft.utilities.immutablelist.AbstractImmutableList import AbstractImmutableList from tudelft.utilities.immutablelist.ImmutableList import ImmutableList from tudelft.utilities.immutablelist.Outer import Outer from geniusweb.issuevalue.Bid import Bid from geniusweb.issuevalue.Domain import Domain from geniusweb.issuevalue.Value import Value class AllBidsList (AbstractImmutableList[Bid]): ''' A list containing all complete bids in the space. This is an {@link ImmutableList} so it can contain all bids without pre-computing them. ''' def __init__(self, domain:Domain): ''' This object contains s list containing all bids in the space. This is an ImmutableList so it can contain all bids without pre-computing them. @param domain the {@link Domain} ''' if domain == None: raise ValueError("domain=null"); self._issues = list(domain.getIssues()) values:List[ImmutableList[Value]] = [domain.getValues(issue) for issue in self._issues] self._allValuePermutations = Outer[Value](values) def get(self, index:int) -> Bid: nextValues = self._allValuePermutations.get(index); issueValues:Dict[str, Value] = {} for n in range(len(self._issues)): issueValues[self._issues[n]] = nextValues.get(n) return Bid(issueValues); def size(self) ->int: return self._allValuePermutations.size();
34.090909
95
0.696
176
1,500
5.869318
0.380682
0.038722
0.058083
0.095837
0.152953
0.152953
0.152953
0.110358
0.110358
0.110358
0
0
0.215333
1,500
43
96
34.883721
0.877655
0.208667
0
0
0
0
0.00983
0
0
0
0
0
0
1
0.136364
false
0
0.318182
0.045455
0.590909
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
6c9355764a56246685f8f050d7a2762e9242d568
18,061
py
Python
broker/jobs/tests/handover.py
yiu31802/ave
e46fc357f9464d5beaf42568a74bb95e6b1b8037
[ "BSD-3-Clause" ]
17
2016-11-16T08:09:49.000Z
2021-08-12T06:38:09.000Z
broker/jobs/tests/handover.py
yiu31802/ave
e46fc357f9464d5beaf42568a74bb95e6b1b8037
[ "BSD-3-Clause" ]
null
null
null
broker/jobs/tests/handover.py
yiu31802/ave
e46fc357f9464d5beaf42568a74bb95e6b1b8037
[ "BSD-3-Clause" ]
12
2016-11-20T15:34:03.000Z
2020-08-04T00:26:11.000Z
# Copyright (C) 2013 Sony Mobile Communications AB. # All rights, including trade secret rights, reserved. import json import time import traceback from ave.network.process import Process from ave.network.exceptions import * from ave.broker._broker import validate_serialized, RemoteBroker, Broker from ave.broker.session import RemoteSession from ave.broker.exceptions import * import setup # check that a broker with trivial allocations can have its state serialized @setup.brokers([],'master',[],False,False) def t1(HOME, master): pretty = '%s t1' % __file__ print(pretty) try: s = master.serialize() except Exception, e: print('FAIL %s: trivial serialization failed: %s' % (pretty, str(e))) return False try: validate_serialized(s) except Exception, e: print('FAIL %s: could not validate adoption: %s' % (pretty, str(e))) return False return True # like t1 but with some allocations @setup.brokers([],'master',[],False,False) def t2(HOME, master): pretty = '%s t2' % __file__ print(pretty) c1 = RemoteBroker(master.address, authkey=master.authkey, home=HOME.path) c1.get_resources({'type':'handset'}, {'type':'workspace'}) c2 = RemoteBroker(master.address, authkey=master.authkey, home=HOME.path) c2.get_resources({'type':'handset'}, {'type':'relay'}) try: s = master.serialize() except Exception, e: print('FAIL %s: trivial serialization failed: %s' % (pretty, str(e))) return False try: validate_serialized(s) except Exception, e: print('FAIL %s: could not validate adoption: %s' % (pretty, str(e))) return False return True # trivial handover between two brokers: no allocations. more or less just check # that the takeover can be started on the same port as the handover and that # configuration data is the same @setup.factory() def t3(factory): pretty = '%s t3' % __file__ print(pretty) handover = factory.make_master('master') adoption,config,fdtx_path = handover.begin_handover() # stops listening try: takeover = factory.make_takeover('master', adoption, config, fdtx_path) except Exception, e: print('FAIL %s: could not start takeover: %s' % (pretty, str(e))) return False try: handover.end_handover(1) except ConnectionClosed: pass except Exception, e: print('FAIL %s: unexpected error: %s' % (pretty, str(e))) return False # compare the config and serialization of the two c = takeover.get_config() if c != config: print('FAIL %s: configuration mismatch: %s != %s' % (pretty, c, config)) return False return True # make a few allocations, then handover. check that both brokers show the same # availability of equipment @setup.factory() def t4(factory): pretty = '%s t4' % __file__ print(pretty) handover = factory.make_master('master') avail_1 = handover.list_available() # make some allocations c1 = RemoteBroker(handover.address, home=factory.HOME.path) h1,w1 = c1.get_resources({'type':'handset'}, {'type':'workspace'}) avail_2 = handover.list_available() c2 = RemoteBroker(handover.address, home=factory.HOME.path) h2,r2 = c2.get_resources({'type':'handset'}, {'type':'relay'}) avail_3 = handover.list_available() # hand over adoption,config,fdtx_path = handover.begin_handover() takeover = factory.make_takeover('master', adoption, config, fdtx_path) handover.end_handover(1) # check that availability is correct. stop the sessions started against the # handover and check that the resources become availabe in the takeover result = takeover.list_available() if len(result) != len(avail_3): print('FAIL %s: wrong avail 3: %s != %s' % (pretty, result, avail_3)) return False ok = False del(c2) for i in range(10): # allow some time for brokers to detect session death result = takeover.list_available() if len(result) == len(avail_2): ok = True break time.sleep(0.3) if not ok: print('FAIL %s: wrong avail 2: %s != %s' % (pretty, result, avail_2)) return False ok = False del(c1) for i in range(10): # allow some time for brokers to detect session death result = takeover.list_available() if len(result) == len(avail_1): ok = True break time.sleep(0.3) if not ok: print('FAIL %s: wrong avail 1: %s != %s' % (pretty, result, avail_2)) return False return True # kill off one of the original sessions during the handover and check that the # associated resources become available in the takeover @setup.factory() def t5(factory): pretty = '%s t5' % __file__ print(pretty) handover = factory.make_master('master') avail_1 = handover.list_available() # make some allocations c1 = RemoteBroker(handover.address, home=factory.HOME.path) h1,w1 = c1.get_resources({'type':'handset'}, {'type':'workspace'}) avail_2 = handover.list_available() c2 = RemoteBroker(handover.address, home=factory.HOME.path) h2,r2 = c2.get_resources({'type':'handset'}, {'type':'relay'}) avail_3 = handover.list_available() adoption,config,fdtx_path = handover.begin_handover() session = RemoteSession(h2.address, h2.authkey) try: session.crash() # kill the second session during the handover except ConnectionClosed: pass takeover = factory.make_takeover('master', adoption, config, fdtx_path) handover.end_handover(1) result = takeover.list_available() if len(result) != len(avail_2): print('FAIL %s: wrong avail: %s != %s' % (pretty, result, avail_2)) return False return True # make sure one of the sessions is super busy during the handover so that it # cannot engage in communication with the takeover during session adoption @setup.factory() def t6(factory): pretty = '%s t6' % __file__ print(pretty) handover = factory.make_master('master') avail = handover.list_available() def oob_client(address): r = RemoteBroker(address, home=factory.HOME.path) h,w = r.get_resources({'type':'handset'}, {'type':'workspace'}) w.run('sleep 3') # right, extremely busy, but it prevents other action while True: time.sleep(1) # don't let client die and loose all resources p = Process(target=oob_client, args=(handover.address,)) p.start() # make sure the oob client has gotten its resources ok = False for i in range(10): if len(handover.list_available()) != len(avail): ok = True break time.sleep(0.3) if not ok: print('FAIL %s: catastrophic' % pretty) adoption,config,fdtx_path = handover.begin_handover() takeover = factory.make_takeover('master', adoption, config, fdtx_path) handover.end_handover(1) result = True if len(takeover.list_available()) == len(avail): print('FAIL %s: wrong avail: %s' % (pretty, avail)) result = False p.terminate() p.join() return result # check that resources of super busy sessions are reclaimed when the session # finally dies @setup.factory() def t7(factory): pretty = '%s t7' % __file__ print(pretty) handover = factory.make_master('master') avail = handover.list_available() def oob_client(address): r = RemoteBroker(address, home=factory.HOME.path) h,w = r.get_resources({'type':'handset'}, {'type':'workspace'}) w.run('sleep 2') # right, extremely busy, but it prevents other action p = Process(target=oob_client, args=(handover.address,)) p.start() # make sure the oob client has gotten its resources ok = False for i in range(10): if len(handover.list_available()) != len(avail): ok = True break time.sleep(0.1) if not ok: print('FAIL %s: catastrophic' % pretty) p.terminate() p.join() return False adoption,config,fdtx_path = handover.begin_handover() takeover = factory.make_takeover('master', adoption, config, fdtx_path) handover.end_handover(1) # now wait for the client to die, so that its session dies, so that # the takeover detects this, so that the associated resouces can be reclaimed, # so that the takeover's availability is the same as when we started ok = False for i in range(10): if len(takeover.list_available()) == len(avail): ok = True break time.sleep(0.3) if not ok: print('FAIL %s: super busy session not tracked correctly' % pretty) p.terminate() p.join() return ok # check that sessions survive multiple broker restarts @setup.factory() def t8(factory): pretty = '%s t8' % __file__ print(pretty) original = factory.make_master('master') avail = original.list_available() def oob_client(address): r = RemoteBroker(address, home=factory.HOME.path) h,w = r.get_resources({'type':'handset'}, {'type':'workspace'}) while True: time.sleep(1) p = Process(target=oob_client, args=(original.address,)) p.start() # make sure the oob client has gotten its resources ok = False for i in range(10): if len(original.list_available()) != len(avail): ok = True break time.sleep(0.1) if not ok: print('FAIL %s: catastrophic' % pretty) p.terminate() p.join() return False # do two handovers in a row adoption,config,fdtx_path = original.begin_handover() interim = factory.make_takeover('master', adoption, config, fdtx_path) original.end_handover(1) adoption,config,fdtx_path = interim.begin_handover() final = factory.make_takeover('master', adoption, config, fdtx_path) interim.end_handover(1) # check that all brokers have the same availability a1 = original.list_available() a2 = interim.list_available() a3 = final.list_available() if len(a1) != len(a2) != len(a3): print( 'FAIL %s: a handover failed somewhere: %s != %s != %s' % (pretty, a1, a2, a3) ) p.terminate() p.join() return False # kill the client so that the brokers reclaim the equipment p.terminate() p.join() ok = False for i in range(10): a3 = final.list_available() if len(a3) == len(avail): ok = True break if not ok: print( 'FAIL %s: wrong availability: %d %d %d %d' % (pretty, len(a1), len(a2), len(a3), len(avail)) ) return False # check that the original and interim brokers have terminated now that they # don't have any sessions with allocations try: original.ping() # ping except Exit, e: pass # good except Exception, e: print('FAIL %s: wrong exception: %s' % (pretty, e)) return False try: interim.ping() # ping except Exit, e: pass # good except Exception, e: print('FAIL %s: wrong exception: %s' % (pretty, e)) return False return True # check that clients still attached to the handover get Restarting exceptions # when they try to allocate after the handover has been done. this *can* be # fixed so that clients migrate automatically, but it is difficult and I would # prefer to not implement it unless there a strong case can be made for it @setup.factory() def t9(factory): pretty = '%s t9' % __file__ print(pretty) handover = factory.make_master('master') client = RemoteBroker(handover.address, home=factory.HOME.path) # make first allocation h,w = client.get_resources({'type':'handset'}, {'type':'workspace'}) # hand over adoption,config,fdtx_path = handover.begin_handover() takeover = factory.make_takeover('master', adoption, config, fdtx_path) handover.end_handover(1) # make seconc allocation try: client.get({'type':'handset'}) print('FAIL %s: second allocation did not fail' % pretty) return False except Restarting: pass # good except Exception, e: print('FAIL %s: wrong exception: %s' % (pretty, e)) return False return True # check that a restarted share shows up again in its master @setup.factory() def t10(factory): pretty = '%s t10' % __file__ print(pretty) master = factory.make_master('master') share = factory.make_share(master, 'share') share.start_sharing() time.sleep(1) client = RemoteBroker(address=master.address, home=factory.HOME.path) h = client.get_resources({'type':'handset', 'serial':'share-1'}) a1 = master.list_available() # restart the share adoption,config,fdtx_path = share.begin_handover() takeover = factory.make_takeover('share', adoption, config, fdtx_path) a2 = master.list_available() if len(a1) == len(a2): print('FAIL %s: shared resources still visible: %s' % (pretty, a2)) return False # finish the handover so that takeover can start accepting RPC's. then # check that the master sees all equipment except the one allocated share.end_handover(1) ok = False for i in range(10): a3 = master.list_available() if len(a3) == len(a1): ok = True break time.sleep(0.3) if not ok: print('FAIL %s: wrong availability: %s' % (pretty, a3)) return False for profile in a3: if 'serial' in profile and profile['serial'] == 'share-1': print('FAIL %s: busy equipment shared' % pretty) return False # finally check that the resource can still be manipulated try: p = h.get_profile() if p['serial'] != 'share-1': print('FAIL %s: wrong profile: %s' % (pretty, p)) return False except Exception, e: print('FAIL %s: unexpected error: %s' % (pretty, e)) return False return True # check that shares reconnect to a restarted master @setup.factory() def t11(factory): pretty = '%s t11' % __file__ print(pretty) master = factory.make_master('master') share = factory.make_share(master, 'share') share.start_sharing() time.sleep(1) client = RemoteBroker(address=master.address, home=factory.HOME.path) h1 = client.get_resources({'type':'handset', 'serial':'share-1'}) h2 = client.get_resources({'type':'handset', 'serial':'master-1'}) a1 = master.list_available() # restart the master adoption,config,fdtx_path = master.begin_handover() takeover = factory.make_takeover('master', adoption, config, fdtx_path) master.end_handover(1) # connect to the new master and check the availability again master = RemoteBroker(address=master.address, home=factory.HOME.path) ok = False for i in range(10): a2 = master.list_available() if len(a2) == len(a1): ok = True break time.sleep(0.3) if not ok: print('FAIL %s: wrong availability: %s' % (pretty, a2)) return False for profile in a2: if 'serial' in profile and profile['serial'] == 'share-1': print('FAIL %s: busy equipment shared' % pretty) return False return True # check that .end_handover() doesn't time out even if the takeover did not get # any sessions to adopt. regression test @setup.factory() def t12(factory): pretty = '%s t12' % __file__ print(pretty) master = factory.make_master('master') adoption,config,fdtx_path = master.begin_handover() takeover = factory.make_takeover('master', adoption, config, fdtx_path) try: master.end_handover(1) except ConnectionClosed: pass except Exception, e: print('FAIL %s: unexpected error: %s' % (pretty, e)) return False return True # check that the handover exits when the last session terminates @setup.factory() def t13(factory): pretty = '%s t13' % __file__ print(pretty) handover = factory.make_master('master') # make some sessions c1 = RemoteBroker(handover.address, home=factory.HOME.path) h1,w1 = c1.get_resources({'type':'handset'}, {'type':'workspace'}) avail_2 = handover.list_available() c2 = RemoteBroker(handover.address, home=factory.HOME.path) h2,r2 = c2.get_resources({'type':'handset'}, {'type':'relay'}) avail_3 = handover.list_available() adoption,config,fdtx_path = handover.begin_handover() takeover = factory.make_takeover('master', adoption, config, fdtx_path) handover.end_handover(1) # crash the sessions session = RemoteSession(h1.address, h1.authkey) try: session.crash() except ConnectionClosed: pass session = RemoteSession(h2.address, h2.authkey) try: session.crash() except ConnectionClosed: pass for i in range(10): # wait until only one session remains, then close it authkeys = handover.get_session_authkeys() if len(authkeys) == 1: break time.sleep(0.3) # check that the handover sends its exit message when the last session is # closed try: handover.close_session(authkeys[0]) except Exit, e: if str(e) != 'broker restarted. please reconnect': print('FAIL %s: wrong exit message: %s' % (pretty, str(e))) return False except Exception, e: print('FAIL %s: wrong exception: %s' % (pretty, e)) return False try: handover.ping() # ping except ConnectionClosed: pass # good except Exception, e: print('FAIL %s: wrong exception: %s' % (pretty, e)) return False return True
31.410435
82
0.634406
2,335
18,061
4.820128
0.130621
0.026388
0.02932
0.046912
0.670369
0.627277
0.580098
0.543403
0.481919
0.451177
0
0.014058
0.251703
18,061
574
83
31.465157
0.81872
0.178229
0
0.729412
0
0
0.119491
0
0
0
0
0
0
0
null
null
0.021176
0.021176
null
null
0.108235
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
6c9b0dde5a35f728bc75ac22cfb8000971c95236
487
py
Python
gehomesdk/erd/converters/advantium/erd_advantium_cook_time_remaining_converter.py
warrenrees/gehome
6a40f15cfd0738aa7e2ac74b2d8d87780fc07ec8
[ "MIT" ]
null
null
null
gehomesdk/erd/converters/advantium/erd_advantium_cook_time_remaining_converter.py
warrenrees/gehome
6a40f15cfd0738aa7e2ac74b2d8d87780fc07ec8
[ "MIT" ]
null
null
null
gehomesdk/erd/converters/advantium/erd_advantium_cook_time_remaining_converter.py
warrenrees/gehome
6a40f15cfd0738aa7e2ac74b2d8d87780fc07ec8
[ "MIT" ]
null
null
null
from datetime import timedelta from typing import Optional from ..abstract import ErdReadOnlyConverter from ..primitives import * from gehomesdk.erd.values.advantium import ErdAdvantiumCookTimeMinMax class ErdAdvantiumCookTimeRemainingConverter(ErdReadOnlyConverter[Optional[timedelta]]): def erd_decode(self, value: str) -> Optional[timedelta]: """ Decodes the cook time as a time span, 65535 is treated as None. """ return erd_decode_timespan_seconds(value[2:6])
40.583333
88
0.786448
56
487
6.767857
0.660714
0.08971
0
0
0
0
0
0
0
0
0
0.016667
0.137577
487
11
89
44.272727
0.885714
0.129363
0
0
0
0
0
0
0
0
0
0
0
1
0.125
false
0
0.625
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
6c9bda41584725dcd1301c29489ba97f22a43be2
973
py
Python
tools/telemetry/telemetry/value/trace_unittest.py
sunjc53yy/chromium
049b380040949089c2a6e447b0cd0ac3c4ece38e
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
tools/telemetry/telemetry/value/trace_unittest.py
sunjc53yy/chromium
049b380040949089c2a6e447b0cd0ac3c4ece38e
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
tools/telemetry/telemetry/value/trace_unittest.py
sunjc53yy/chromium
049b380040949089c2a6e447b0cd0ac3c4ece38e
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import unittest from telemetry.page import page_set from telemetry.timeline import tracing_timeline_data from telemetry.value import trace class TestBase(unittest.TestCase): def setUp(self): self.page_set = page_set.PageSet(file_path=os.path.dirname(__file__)) self.page_set.AddPageWithDefaultRunNavigate("http://www.bar.com/") self.page_set.AddPageWithDefaultRunNavigate("http://www.baz.com/") self.page_set.AddPageWithDefaultRunNavigate("http://www.foo.com/") @property def pages(self): return self.page_set.pages class ValueTest(TestBase): def testAsDict(self): v = trace.TraceValue( None, tracing_timeline_data.TracingTimelineData({'test' : 1})) fh_id = v.GetAssociatedFileHandle().id d = v.AsDict() self.assertEqual(d['file_id'], fh_id)
30.40625
73
0.749229
133
973
5.338346
0.533835
0.069014
0.077465
0.169014
0.207042
0.207042
0.140845
0
0
0
0
0.005995
0.142857
973
31
74
31.387097
0.845324
0.159301
0
0
0
0
0.083538
0
0
0
0
0
0.047619
1
0.142857
false
0
0.238095
0.047619
0.52381
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
6ca2d2810d7b2ee27e8d82d4f639f5656c914f18
358
py
Python
garbage/reddit_Prog_Chal.py
wolfdale/Spaghetti-code
9e395345e1420b9db021b21131601191a869db1d
[ "MIT" ]
1
2018-05-18T16:07:11.000Z
2018-05-18T16:07:11.000Z
garbage/reddit_Prog_Chal.py
wolfdale/Spaghetti-code
9e395345e1420b9db021b21131601191a869db1d
[ "MIT" ]
5
2015-12-03T16:12:38.000Z
2020-05-05T14:07:00.000Z
garbage/reddit_Prog_Chal.py
wolfdale/Spaghetti-code
9e395345e1420b9db021b21131601191a869db1d
[ "MIT" ]
null
null
null
#[2015-10-26] Challenge #238 [Easy] Consonants and Vowels v=['a','e','i','o','u'] c=['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z'] import random string = raw_input() word=[] for i in range (len(string)): if string[i] == 'v': word.append(random.choice(v)) else: word.append(random.choice(c)) print ''.join(word)
23.866667
87
0.544693
67
358
2.895522
0.761194
0.103093
0.164948
0.226804
0
0
0
0
0
0
0
0.034268
0.103352
358
14
88
25.571429
0.570093
0.153631
0
0
0
0
0.09
0
0
0
0
0
0
0
null
null
0
0.090909
null
null
0.090909
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
6ca602af912019bb59f184594f1a127acfb73000
222
py
Python
fund/items.py
suddi/fundscraper
8cd1962c643abe3a2bd3a5540550003550ed7201
[ "Apache-2.0" ]
1
2021-10-30T16:09:34.000Z
2021-10-30T16:09:34.000Z
fund/items.py
suddi/fundscraper
8cd1962c643abe3a2bd3a5540550003550ed7201
[ "Apache-2.0" ]
1
2022-03-02T14:55:09.000Z
2022-03-02T14:55:09.000Z
fund/items.py
suddi/fundscraper
8cd1962c643abe3a2bd3a5540550003550ed7201
[ "Apache-2.0" ]
2
2019-02-25T02:47:07.000Z
2019-09-17T19:20:07.000Z
from scrapy.item import Field, Item # pylint: disable-msg=too-many-ancestors class FundItem(Item): code = Field() name = Field() tier = Field() start_date = Field() date = Field() price = Field()
18.5
40
0.626126
28
222
4.928571
0.678571
0.130435
0
0
0
0
0
0
0
0
0
0
0.243243
222
11
41
20.181818
0.821429
0.171171
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.125
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
6cbfc8dcd6d97cc1be61ed0f0e63d726c3f60f59
111
py
Python
exercicios/ex110/teste.py
Matheus1199/python
c87859d4bf63ba0edea43d864fcbce4915da7e6a
[ "MIT" ]
null
null
null
exercicios/ex110/teste.py
Matheus1199/python
c87859d4bf63ba0edea43d864fcbce4915da7e6a
[ "MIT" ]
null
null
null
exercicios/ex110/teste.py
Matheus1199/python
c87859d4bf63ba0edea43d864fcbce4915da7e6a
[ "MIT" ]
null
null
null
import moeda p = float(input('Digite o preço: ')) t = int(input('Qual o valor da taxa? ')) moeda.resumo(p, t)
18.5
40
0.648649
20
111
3.6
0.75
0
0
0
0
0
0
0
0
0
0
0
0.171171
111
5
41
22.2
0.782609
0
0
0
0
0
0.342342
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
6cd9738ccb60421cba8abd71ab88a5dfd1c7df96
303
py
Python
django_country/middleware.py
ColorGenomics/django-country
1d272a196d998e21bb8d407e2657b88211f35232
[ "Apache-2.0" ]
4
2015-08-23T16:52:13.000Z
2016-07-16T21:39:59.000Z
django_country/middleware.py
ColorGenomics/django-country
1d272a196d998e21bb8d407e2657b88211f35232
[ "Apache-2.0" ]
2
2016-02-04T15:58:06.000Z
2016-02-04T16:29:18.000Z
django_country/middleware.py
color/django-country
1d272a196d998e21bb8d407e2657b88211f35232
[ "Apache-2.0" ]
2
2018-05-15T09:10:03.000Z
2019-03-08T14:49:44.000Z
# -*- coding: utf-8 -*- from . import geo class CountryMiddleware(object): """ This is a middleware that parses a request and decides which country the request came from. """ def process_request(self, request): request.COUNTRY_CODE = geo.get_country_from_request(request)
23.307692
68
0.686469
39
303
5.205128
0.692308
0.137931
0
0
0
0
0
0
0
0
0
0.004219
0.217822
303
12
69
25.25
0.852321
0.376238
0
0
0
0
0
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
6cdc218d274321607edc4aee95141af773ac7b6c
681
py
Python
electionleaflets/apps/constituencies/templatetags/constituency_tags.py
electionleaflets/electionleaflets
4110e96a3035c32d0b6ff3c9f832c5e003728170
[ "MIT" ]
null
null
null
electionleaflets/apps/constituencies/templatetags/constituency_tags.py
electionleaflets/electionleaflets
4110e96a3035c32d0b6ff3c9f832c5e003728170
[ "MIT" ]
23
2015-02-19T14:02:23.000Z
2015-04-30T11:14:01.000Z
electionleaflets/apps/constituencies/templatetags/constituency_tags.py
electionleaflets/electionleaflets
4110e96a3035c32d0b6ff3c9f832c5e003728170
[ "MIT" ]
2
2015-02-02T19:39:54.000Z
2017-02-08T09:19:53.000Z
from django import template from django.conf import settings from leaflets.models import Leaflet from constituencies.models import Constituency register = template.Library() @register.inclusion_tag('constituencies/ordered_list.html') def constituency_list_by_count(): constituencies = Constituency.objects.all().order_by('-count')[0:10] return { 'MEDIA_URL': settings.MEDIA_URL, 'constituencies': constituencies } @register.inclusion_tag('constituencies/zero_entry_list.html') def constituency_list_with_none(): constituencies = Constituency.objects.filter(count=0).all()[0:10] return { 'MEDIA_URL': settings.MEDIA_URL, 'constituencies': constituencies }
42.5625
84
0.785609
81
681
6.407407
0.419753
0.061657
0.077071
0.131021
0.339114
0.235067
0.235067
0.235067
0.235067
0.235067
0
0.011475
0.104258
681
16
84
42.5625
0.839344
0
0
0.153846
0
0
0.174487
0.09824
0
0
0
0
0
1
0.153846
false
0
0.307692
0
0.615385
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
6ce68ade0975f3498a289cd7d8896318aa38df5e
1,027
py
Python
Curso em Video/Desafio_023.py
tonmarcondes/UNIVESP
a66a623d4811e8f3f9e2999f09e38a4470035ae2
[ "MIT" ]
null
null
null
Curso em Video/Desafio_023.py
tonmarcondes/UNIVESP
a66a623d4811e8f3f9e2999f09e38a4470035ae2
[ "MIT" ]
null
null
null
Curso em Video/Desafio_023.py
tonmarcondes/UNIVESP
a66a623d4811e8f3f9e2999f09e38a4470035ae2
[ "MIT" ]
null
null
null
numero = input('\nInsira um numero de 0 a 9999: \n') if not numero.isnumeric(): print('Condição inválida, insira apenas números\n') elif len(numero) == 1: print('\nA unidade do número {} é {}\n'.format(numero, numero[-1])) elif len(numero) == 2: print('\nA unidade do número {} é {}'.format(numero, numero[-1])) print('A dezena do número {} é {}\n'.format(numero, numero[-2])) elif len(numero) == 3: print('\nA unidade do número {} é {}'.format(numero, numero[-1])) print('A dezena do número {} é {}'.format(numero, numero[-2])) print('A centena do número {} é {}\n'.format(numero, numero[-3])) elif len(numero) == 4: print('\nA unidade do número {} é {}'.format(numero, numero[-1])) print('A dezena do número {} é {}'.format(numero, numero[-2])) print('A centena do número {} é {}'.format(numero, numero[-3])) print('A milhar do número {} é {}\n'.format(numero, numero[-4])) else: print('O valor {} não está de acordo com o permitido\n'.format(numero))
48.904762
76
0.605648
155
1,027
4.012903
0.264516
0.212219
0.144695
0.144695
0.638264
0.638264
0.586817
0.435691
0.435691
0.435691
0
0.022919
0.192795
1,027
20
77
51.35
0.727382
0
0
0.263158
0
0
0.406157
0
0
0
0
0
0
1
0
false
0
0
0
0
0.631579
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
6ced9767f09be94c059293ba0ec574ce1794fa54
215
py
Python
30.strings/16.replace.py
robinson-1985/python-zero-dnc
df510d67e453611fcd320df1397cdb9ca47fecb8
[ "MIT" ]
null
null
null
30.strings/16.replace.py
robinson-1985/python-zero-dnc
df510d67e453611fcd320df1397cdb9ca47fecb8
[ "MIT" ]
null
null
null
30.strings/16.replace.py
robinson-1985/python-zero-dnc
df510d67e453611fcd320df1397cdb9ca47fecb8
[ "MIT" ]
null
null
null
# 15. replace() -> Altera determinado valor de uma string por outro. Troca uma string por outra. texto = 'vou Treinar todo Dia Python' print(texto.replace('vou','Vamos')) print(texto.replace('Python','Algoritmos'))
43
96
0.734884
31
215
5.096774
0.677419
0.113924
0.151899
0
0
0
0
0
0
0
0
0.010582
0.12093
215
5
97
43
0.825397
0.437209
0
0
0
0
0.425
0
0
0
0
0
0
1
0
false
0
0
0
0
0.666667
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
0
0
1
0
2
6cf05f1a7f8d9e9c0505d52939240080210e4ca9
3,877
py
Python
tools/collect_bot_info.py
Dalanar/DotA2DraftBot
6ff222782a6c40d99004eeee101ca912e6e8dd11
[ "MIT" ]
1
2017-01-12T07:13:28.000Z
2017-01-12T07:13:28.000Z
tools/collect_bot_info.py
Dalanar/DotA2DraftBot
6ff222782a6c40d99004eeee101ca912e6e8dd11
[ "MIT" ]
2
2017-01-02T08:55:13.000Z
2017-01-10T14:48:56.000Z
tools/collect_bot_info.py
Dalanar/DotA2DraftBot
6ff222782a6c40d99004eeee101ca912e6e8dd11
[ "MIT" ]
1
2019-07-04T20:03:22.000Z
2019-07-04T20:03:22.000Z
import vdf implemented_bots = set([ 'npc_dota_hero_axe', 'npc_dota_hero_bane', 'npc_dota_hero_bounty_hunter', 'npc_dota_hero_bloodseeker', 'npc_dota_hero_bristleback', 'npc_dota_hero_chaos_knight', 'npc_dota_hero_crystal_maiden', 'npc_dota_hero_dazzle', 'npc_dota_hero_death_prophet', 'npc_dota_hero_dragon_knight', 'npc_dota_hero_drow_ranger', 'npc_dota_hero_earthshaker', 'npc_dota_hero_jakiro', 'npc_dota_hero_juggernaut', 'npc_dota_hero_kunkka', 'npc_dota_hero_lich', 'npc_dota_hero_lina', 'npc_dota_hero_lion', 'npc_dota_hero_luna', 'npc_dota_hero_necrolyte', 'npc_dota_hero_omniknight', 'npc_dota_hero_oracle', 'npc_dota_hero_phantom_assassin', 'npc_dota_hero_pudge', 'npc_dota_hero_razor', 'npc_dota_hero_sand_king', 'npc_dota_hero_nevermore', 'npc_dota_hero_skywrath_mage', 'npc_dota_hero_sniper', 'npc_dota_hero_sven', 'npc_dota_hero_tidehunter', 'npc_dota_hero_tiny', 'npc_dota_hero_vengefulspirit', 'npc_dota_hero_viper', 'npc_dota_hero_warlock', 'npc_dota_hero_windrunner', 'npc_dota_hero_witch_doctor', 'npc_dota_hero_skeleton_king', 'npc_dota_hero_zuus', ]) heroes = vdf.load(open(r'D:\games\steamapps\common\dota 2 beta\game\dota\scripts\npc\npc_heroes.txt')) with open('hero_bot_data.lua', 'w') as output: # Write module exporting stuff #1 output.write('_G._savedEnv = getfenv()\n') output.write('module("hero_bot_data", package.seeall)\n') output.write('\n') # Collect all hero types hero_types = set() hero_type_ids = {} for name, data in heroes['DOTAHeroes'].iteritems(): if isinstance(data, dict) and 'Bot' in data: this_hero_type = data['Bot']['HeroType'].split('|') for hero_type in this_hero_type: hero_types.add(hero_type.strip()) idx = 1 for hero_type in hero_types: hero_type_ids[hero_type] = idx output.write('%s = %d\n' % (hero_type, idx)) idx *= 2 output.write('\n') # Fill LaningInfo and HeroType output.write('heroes = {\n') supported_list = [] not_supported_list = [] for name, data in heroes['DOTAHeroes'].iteritems(): if isinstance(data, dict) and data.get('CMEnabled', '0') == '1': human_name = data['url'].replace('_', ' ') if 'Bot' not in data: not_supported_list.append(human_name) continue laning_info = [] try: for key, value in data['Bot']['LaningInfo'].iteritems(): laning_info.append('[\'%s\'] = %s' % (key, value)) this_hero_type = 0 this_hero_type_raw = data['Bot']['HeroType'].split('|') for hero_type in this_hero_type_raw: this_hero_type |= hero_type_ids[hero_type.strip()] if ('Loadout' not in data['Bot']) or (name not in implemented_bots): not_supported_list.append(human_name) else: output.write(' [\'%s\'] = {[\'HeroType\'] = %s, [\'LaningInfo\'] = {%s}},\n' % (name, this_hero_type, ', '.join(laning_info))) supported_list.append(human_name) except KeyError as ex: not_supported_list.append(human_name) output.write('}\n\n') # Write module exporting stuff #2 output.write('for k,v in pairs(hero_bot_data) do _G._savedEnv[k] = v end\n') supported_list.sort() print 'Fully operational:' for hero in supported_list: print ' - %s' % hero not_supported_list.sort() print '\nNot supported:' for hero in not_supported_list: print ' - %s' % hero
37.640777
150
0.605107
494
3,877
4.348178
0.291498
0.127095
0.199721
0.044693
0.194134
0.141993
0.098696
0.098696
0.098696
0.098696
0
0.002826
0.269796
3,877
102
151
38.009804
0.755917
0.029146
0
0.095745
0
0.021277
0.356772
0.178659
0
0
0
0
0
0
null
null
0
0.010638
null
null
0.042553
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
1
0
0
0
0
0
0
0
0
2
9f0096648e2874f2a1dd4b98ee0c9a0e98ee7fdb
2,006
py
Python
sleepcounter/hardware_a/mocks.py
daveshed/sleepcounter-hardware-a
8f8729b9e29b37d3f12b156dfd5b2cb277b1524d
[ "MIT" ]
null
null
null
sleepcounter/hardware_a/mocks.py
daveshed/sleepcounter-hardware-a
8f8729b9e29b37d3f12b156dfd5b2cb277b1524d
[ "MIT" ]
null
null
null
sleepcounter/hardware_a/mocks.py
daveshed/sleepcounter-hardware-a
8f8729b9e29b37d3f12b156dfd5b2cb277b1524d
[ "MIT" ]
null
null
null
"""Mock hardware implementation""" import logging from stage import exceptions from unittest.mock import Mock LOGGER = logging.getLogger("mock") class MockStage: """A mock implemenation of a stepper motor driven linear stage""" MAX_POS = 100 MIN_POS = 0 def __init__(self): self._position = __class__.MIN_POS self.home() def home(self): """Move to home position""" LOGGER.info("Homing stage") self._position = __class__.MIN_POS def end(self): """Move to end position""" LOGGER.info("Moving to home position") self._position = self.max @property def max(self): """Return the maximum position index""" return __class__.MAX_POS @property def position(self): """Return the current position index""" return self._position @position.setter def position(self, request): LOGGER.info("Setting position to %s", request) too_large = request > __class__.MAX_POS too_small = request < __class__.MIN_POS if too_large or too_small: raise exceptions.OutOfRangeError( "Cannot go to position {}".format(request)) self._position = request class Matrix: """ A mock for an led matrix device """ _width = 32 _height = 8 _mode = "1" def __init__(self): _LOGGER.info("Created mock led matrix device %r", self) self.display = Mock() @property def width(self): """ Width of the display in pixels """ return Matrix._width @property def height(self): """ Height of the display in pixels """ return Matrix._height @property def mode(self): """ Returns mode which is needed for image drawing reasons """ return Matrix._mode def clear(self): """ Clear the display """ _LOGGER.info("Clearing device %r", self)
23.057471
69
0.589232
231
2,006
4.891775
0.350649
0.053097
0.029204
0.035398
0.097345
0.056637
0.056637
0
0
0
0
0.005814
0.314058
2,006
86
70
23.325581
0.815407
0.182951
0
0.183673
0
0
0.091272
0
0
0
0
0
0
1
0.22449
false
0
0.061224
0
0.530612
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
9f02894ebc954a270f5715baabf264b3e5cc54c2
7,513
py
Python
app.py
gborn/Generating-Multiple-Choice-Questions-From-Any-Text
521c9297d3115a89e3ff8a74230d3b8390aa57d8
[ "MIT" ]
1
2022-01-29T04:26:41.000Z
2022-01-29T04:26:41.000Z
app.py
gborn/Generating-Multiple-Choice-Questions-From-Any-Text
521c9297d3115a89e3ff8a74230d3b8390aa57d8
[ "MIT" ]
null
null
null
app.py
gborn/Generating-Multiple-Choice-Questions-From-Any-Text
521c9297d3115a89e3ff8a74230d3b8390aa57d8
[ "MIT" ]
null
null
null
from src.answerkey import AnswerKey from src.model import Model, unmasker import streamlit as st PAGE_CONFIG = {"page_title":"MCQ-App by Glad Nayak","page_icon":":white_check_mark:"} st.set_page_config(**PAGE_CONFIG) def render_input(): """ Renders text area for input, and button """ # source of default text: https://www.fresherslive.com/online-test/reading-comprehension-test-questions-and-answers text = """The Dust Bowl, considered one of the greatest man-made ecological disasters, was a period of severe dust storms that lasted nearly a decade, starting 1931, and engulfed large parts of the US. The dust storms originated in the Great Plains-from states like Texas, Oklahoma, New Mexico, Colorado and Kansas. They were so severe that they choked everything and blocked out the sun for days. Sometimes, the storms travelled thousands of kilometres and blotted out monuments such as the Statue of Liberty. Citizens developed “dust pneumonia” and experienced chest pain and difficulty in breathing. The storms damaged the soil in around 100 million acres of land, leading to the greatest short-time migration in the American history, with approximately 3.5 million people abandoning their farms and fields. Dust storms are an annual weather pattern in the northern region of India comprising Delhi, Haryana, Punjab, Uttar Pradesh and Rajasthan and Punjab, as also in the Sindh region of Pakistan. But, they are normally low in intensity and accompanied by rains. In fact, people welcome dust storms as they bring down temperatures and herald the arrival of the monsoons. But, the dust storms that have hit India since February this year have been quantitatively and qualitatively different from those in the past. They are high-powered storms travelling long distances and destroying properties and agricultural fields. Since February, they have affected as many as 16 states and killed more than 500 people. Cities like Delhi were choked in dust for days, with air quality level reaching the “severe” category on most days. The Dust Bowl areas of the Great Plains are largely arid and semi-arid and prone to extended periods of drought. The US federal government encouraged settlement and development of large-scale agriculture by giving large parcels of grasslands to settlers. Waves of European settlers arrived at the beginning of the 20th century and converted grasslands into agricultural fields. At the same time, technological improvements allowed rapid mechanization of farm equipment, especially tractors and combined harvesters, which made it possible to operate larger parcels of land. For the next two decades, agricultural land grew manifold and farmers undertook extensive deep ploughing of the topsoil with the help of tractors to plant crops like wheat. This displaced the native, deep-rooted grasses that trapped soil and moisture even during dry periods and high winds. Then, the drought struck. Successive waves of drought, which started in 1930 and ended in 1939, turned the Great Plains into bone-dry land. As the soil was already loose due to extensive ploughing, high winds turned them to dust and blew them away in huge clouds. Does this sound familiar? The dust storm regions of India and Pakistan too are largely arid and semi-arid. But they are at a lower altitude and hence less windy compared to the Great Plains. Over the last 50 years, chemical- and water-intensive agriculture has replaced the traditional low-input agriculture. Canal irrigation has been overtaken by the groundwater irrigation. In addition, mechanized agriculture has led to deeper ploughing, loosening more and more topsoil. The result has been devastating for the soil and groundwater. In most of these areas, the soil has been depleted and groundwater levels have fallen precipitously. On top of the man-made ecological destruction, the natural climatic cycle along with climate change is affecting the weather pattern of this region. First, this area too is prone to prolonged drought. In fact, large parts of Haryana, Punjab, Delhi and western UP have experienced mildly dry to extremely dry conditions in the last six years. The Standardized Precipitation Index (SPI), which specifies the level of dryness or excess rains in an area, of large parts of Haryana, Punjab and Delhi has been negative since 2012. Rajasthan, on the other hand shows a positive SPI or excess rainfall. Second, this area is experiencing increasing temperatures. In fact, there seems to be a strong correlation between the dust storms and the rapid increase in temperature. Maximum temperatures across northern and western India have been far higher than normal since April this year. Last, climate change is affecting the pattern of Western Disturbances (WDs), leading to stronger winds and stronger storms. WDs are storms originating in the Mediterranean region that bring winter rain to northwestern India. But because of the warming of the Arctic and the Tibetan Plateau, indications are that the WDs are becoming unseasonal, frequent and stronger. The Dust Bowl led the US government to initiate a large-scale land-management and soil-conservation programme. Large-scale shelterbelt plantations, contour ploughing, conservation agriculture and establishment of conservation areas to keep millions of acres as grassland, helped halt wind erosion and dust storms. It is time India too recognizes its own Dust Bowl and initiates a large-scale ecological restoration programme to halt it. Else, we will see more intense dust storms, and a choked Delhi would be a permanent feature. """ st.sidebar.subheader('Enter Text:') text = st.sidebar.text_area('', text.strip(), height = 275) ngram_range = st.sidebar.slider('answer ngram range:', value=[1, 2], min_value=1, max_value=3, step=1) num_questions = st.sidebar.slider("number of questions:", value=10, min_value=10, max_value=20, step=1) question_type_str = st.sidebar.radio('question type:', ('declarative (fill in the blanks)', 'imperative')) question_type = question_type_str == 'declarative (fill in the blanks)' button = st.sidebar.button('Generate') if button: return (text, ngram_range, num_questions, question_type) def main(): # Render input text area inputs = render_input() if not inputs: st.title('Generate Multiple Choice Questions(MCQs) from Text Automatically') st.subheader('Enter Text, select how long a single answer should be(ngram_range), and number of questions to get started.') else: with st.spinner('Loading questions and distractors using BERT model'): st.subheader("") st.title("") text, ngram_range, num_questions, question_type = inputs # Load model answerkeys = AnswerKey(text) keyword_to_sentence = answerkeys.get_answers(ngram_range, num_questions) model = Model() quizzes = model.get_questions(keyword_to_sentence, unmasker, k=num_questions, declarative=question_type) st.subheader('Questions') for id, quiz in enumerate(quizzes): question, options, answer = quiz st.write(question) for option in options[:3]: st.checkbox(option, key=id) ans_button = st.checkbox(answer, key=id, value=True) st.balloons() st.button('Save') if __name__ == '__main__': main()
98.855263
1,344
0.763077
1,117
7,513
5.089526
0.433303
0.007916
0.00985
0.01161
0.049604
0.022164
0.013369
0
0
0
0
0.007515
0.185279
7,513
76
1,345
98.855263
0.921255
0.025023
0
0
0
0.148936
0.770905
0
0
0
0
0
0
1
0.042553
false
0
0.06383
0
0.12766
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
9f11ad86c1a7f6d1888aeabc2cabec9e7fdb4c14
842
py
Python
tests.py
fredrikaverpil/python-rust
06bedd1b3bea93af3eaafb0154447a18aba56118
[ "MIT" ]
1
2021-09-23T19:30:04.000Z
2021-09-23T19:30:04.000Z
tests.py
fredrikaverpil/python-rust
06bedd1b3bea93af3eaafb0154447a18aba56118
[ "MIT" ]
null
null
null
tests.py
fredrikaverpil/python-rust
06bedd1b3bea93af3eaafb0154447a18aba56118
[ "MIT" ]
null
null
null
import re import string import random import mylib # Python ZIP version def count_doubles(val): total = 0 # there is an improved version later on this post for c1, c2 in zip(val, val[1:]): if c1 == c2: total += 1 return total # Python REGEXP version double_re = re.compile(r'(?=(.)\1)') def count_doubles_regex(val): return len(double_re.findall(val)) # Benchmark it # generate 1M of random letters to test it val = ''.join(random.choice(string.ascii_letters) for i in range(1000000)) def test_pure_python(benchmark): benchmark(count_doubles, val) def test_regex(benchmark): benchmark(count_doubles_regex, val) def test_rust(benchmark): benchmark(mylib.count_doubles, val) def test_get_result(): data = "Hello world" assert mylib.get_result(data) == f"Rust says: {data}"
21.05
74
0.693587
126
842
4.5
0.47619
0.10582
0.079365
0.070547
0.077601
0
0
0
0
0
0
0.023704
0.198337
842
39
75
21.589744
0.816296
0.168646
0
0
0
0
0.053314
0
0
0
0
0
0.043478
1
0.26087
false
0
0.173913
0.043478
0.521739
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
9f14982bbe3f83710d22b85ba6beb2a13fe3b1e7
329
py
Python
feapder/network/user_pool/__init__.py
ibryang/feapder
14b1c1e9bd0953ea8af102d6d220fed4b79d0a5c
[ "MIT" ]
876
2021-02-09T11:08:04.000Z
2022-03-31T21:14:11.000Z
feapder/network/user_pool/__init__.py
ibryang/feapder
14b1c1e9bd0953ea8af102d6d220fed4b79d0a5c
[ "MIT" ]
94
2021-02-20T07:59:28.000Z
2022-03-28T09:54:53.000Z
feapder/network/user_pool/__init__.py
ibryang/feapder
14b1c1e9bd0953ea8af102d6d220fed4b79d0a5c
[ "MIT" ]
172
2021-02-22T08:24:44.000Z
2022-03-29T08:15:27.000Z
__all__ = [ "GuestUserPool", "GuestUser", "NormalUserPool", "NormalUser", "GoldUserPool", "GoldUser", "GoldUserStatus", ] from .gold_user_pool import GoldUserPool, GoldUser, GoldUserStatus from .guest_user_pool import GuestUserPool, GuestUser from .normal_user_pool import NormalUserPool, NormalUser
23.5
66
0.735562
30
329
7.733333
0.5
0.103448
0.181034
0.327586
0
0
0
0
0
0
0
0
0.170213
329
13
67
25.307692
0.849817
0
0
0
0
0
0.243161
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
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
9f16b7604472b4df4adc8e900195443eaeab2e23
1,235
py
Python
lib/sxc/actuator.py
GoogleCloudPlatform/SourceXCloud
c1397e5b9a6989fc4adf54d7957f73a95c5bcdc8
[ "Apache-2.0" ]
3
2017-11-29T16:15:21.000Z
2021-10-09T18:32:16.000Z
lib/sxc/actuator.py
GoogleCloudPlatform/SourceXCloud
c1397e5b9a6989fc4adf54d7957f73a95c5bcdc8
[ "Apache-2.0" ]
null
null
null
lib/sxc/actuator.py
GoogleCloudPlatform/SourceXCloud
c1397e5b9a6989fc4adf54d7957f73a95c5bcdc8
[ "Apache-2.0" ]
3
2016-07-12T02:10:35.000Z
2021-03-21T10:24:19.000Z
# Copyright 2015 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. """The actuator interface and implementations. """ import json import os class Actuator(object): def push(self, core, image, args): """Push an image to a target.""" raise NotImplementedError() class ActuatorExtension(Actuator): """Actuator extension consisting of hook programs.""" def __init__(self, actuator_root_dir): self.root = actuator_root_dir self.name = os.path.basename(actuator_root_dir) def push(self, core, image, args): result = core.get_utils().run_hook( self.root, 'push', core.get_source_directory(), *args, input=json.dumps(image)) return result
30.875
74
0.704453
170
1,235
5.035294
0.588235
0.070093
0.05257
0.037383
0.056075
0.056075
0
0
0
0
0
0.008138
0.204049
1,235
39
75
31.666667
0.862665
0.540891
0
0.142857
0
0
0.007435
0
0
0
0
0
0
1
0.214286
false
0
0.142857
0
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
9f1c2546b04d443c1ae8a04369e0722359f68afc
728
py
Python
app/main/forms.py
Ag-nes/Blog
3c8c3f50b2eb6dffe19392179b4c2fda1718e926
[ "MIT" ]
null
null
null
app/main/forms.py
Ag-nes/Blog
3c8c3f50b2eb6dffe19392179b4c2fda1718e926
[ "MIT" ]
null
null
null
app/main/forms.py
Ag-nes/Blog
3c8c3f50b2eb6dffe19392179b4c2fda1718e926
[ "MIT" ]
null
null
null
from flask_wtf import FlaskForm from wtforms import StringField, TextAreaField, SelectField ,SubmitField from wtforms.validators import input_required class EditProfile(FlaskForm): about = TextAreaField('Tell us about yourself.',validators = [input_required()]) submit = SubmitField('Update') class UpdatePost(FlaskForm): text = TextAreaField('Edit post here',validators = [input_required()]) submit = SubmitField('Update') class PostForm(FlaskForm): post_text = TextAreaField('New Post', validators=[input_required()]) submit = SubmitField('Post') class CommentForm(FlaskForm): post_comment = TextAreaField('Make a comment', validators=[input_required()]) submit = SubmitField('Submit')
31.652174
84
0.75
76
728
7.078947
0.421053
0.120818
0.171004
0.215613
0.33829
0.189591
0.189591
0
0
0
0
0
0.138736
728
23
85
31.652174
0.858054
0
0
0.133333
0
0
0.111111
0
0
0
0
0
0
1
0
false
0
0.2
0
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
9f1edfe99b6308d3d2554579aa4a79c439a3f872
199
py
Python
abc130/b/b.py
KeiNishikawa218/atcoder
0af5e091f8b1fd64d5ca7b46b06b9356eacfe601
[ "MIT" ]
null
null
null
abc130/b/b.py
KeiNishikawa218/atcoder
0af5e091f8b1fd64d5ca7b46b06b9356eacfe601
[ "MIT" ]
null
null
null
abc130/b/b.py
KeiNishikawa218/atcoder
0af5e091f8b1fd64d5ca7b46b06b9356eacfe601
[ "MIT" ]
null
null
null
n, x = map(int, input().split()) ll = list(map(int, input().split())) ans = 1 d_p = 0 d_c = 0 for i in range(n): d_c = d_p + ll[i] if d_c <= x: ans += 1 d_p = d_c print(ans)
13.266667
37
0.487437
43
199
2.093023
0.465116
0.088889
0.244444
0.355556
0
0
0
0
0
0
0
0.029412
0.316583
199
15
38
13.266667
0.632353
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.090909
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
9f2a3bd086cb47aeb604a357b7d551f9109fd29b
3,362
py
Python
examples/crankd/sample-of-events/generate-event-plist.py
timgates42/pymacadmin
d4913a45497aebbcf9ba5c28c7b064d6442e0a2e
[ "Apache-2.0" ]
112
2015-05-21T11:28:06.000Z
2021-11-24T02:21:14.000Z
examples/crankd/sample-of-events/generate-event-plist.py
timgates42/pymacadmin
d4913a45497aebbcf9ba5c28c7b064d6442e0a2e
[ "Apache-2.0" ]
14
2015-05-20T16:41:42.000Z
2019-08-31T13:06:18.000Z
examples/crankd/sample-of-events/generate-event-plist.py
timgates42/pymacadmin
d4913a45497aebbcf9ba5c28c7b064d6442e0a2e
[ "Apache-2.0" ]
17
2015-06-03T20:51:49.000Z
2021-12-22T22:58:25.000Z
#!/usr/bin/env python """ Generates a list of OS X system events into a plist for crankd. This is designed to create a large (but probably not comprehensive) sample of the events generated by Mac OS X that crankd can tap into. The generated file will call the 'tunnel.sh' as the command for each event; said fail can be easily edited to redirect the output to wherever you would like it to go. """ OUTPUT_FILE = "crankd-config.plist" from SystemConfiguration import SCDynamicStoreCopyKeyList, SCDynamicStoreCreate # Each event has a general event type, and a specific event # The category is the key, and the value is a list of specific events event_dict = {} def AddEvent(event_category, specific_event): """Adds an event to the event dictionary""" if event_category not in event_dict: event_dict[event_category] = [] event_dict[event_category].append(specific_event) def AddCategoryOfEvents(event_category, events): """Adds a list of events that all belong to the same category""" for specific_event in events: AddEvent(event_category, specific_event) def AddKnownEvents(): """Here we add all the events that we know of to the dictionary""" # Add a bunch of dynamic events store = SCDynamicStoreCreate(None, "generate_event_plist", None, None) AddCategoryOfEvents(u"SystemConfiguration", SCDynamicStoreCopyKeyList(store, ".*")) # Add some standard NSWorkspace events AddCategoryOfEvents(u"NSWorkspace", u''' NSWorkspaceDidLaunchApplicationNotification NSWorkspaceDidMountNotification NSWorkspaceDidPerformFileOperationNotification NSWorkspaceDidTerminateApplicationNotification NSWorkspaceDidUnmountNotification NSWorkspaceDidWakeNotification NSWorkspaceSessionDidBecomeActiveNotification NSWorkspaceSessionDidResignActiveNotification NSWorkspaceWillLaunchApplicationNotification NSWorkspaceWillPowerOffNotification NSWorkspaceWillSleepNotification NSWorkspaceWillUnmountNotification '''.split()) def PrintEvents(): """Prints all the events, for debugging purposes""" for category in sorted(event_dict): print category for event in sorted(event_dict[category]): print "\t" + event def OutputEvents(): """Outputs all the events to a file""" # print the header for the file plist = open(OUTPUT_FILE, 'w') print >>plist, '''<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict>''' for category in sorted(event_dict): # print out the category print >>plist, " <key>%s</key>\n <dict>" % category for event in sorted(event_dict[category]): print >>plist, """ <key>%s</key> <dict> <key>command</key> <string>%s '%s' '%s'</string> </dict>""" % ( event, 'tunnel.sh', category, event ) # end the category print >>plist, " </dict>" # end the plist file print >>plist, '</dict>' print >>plist, '</plist>' plist.close() def main(): """Runs the program""" AddKnownEvents() #PrintEvents() OutputEvents() main()
31.12963
102
0.674004
376
3,362
5.968085
0.393617
0.032086
0.023173
0.030303
0.117201
0.086898
0.07041
0.040998
0.040998
0
0
0.003478
0.23022
3,362
107
103
31.420561
0.863601
0.093694
0
0.090909
1
0.022727
0.241808
0
0
0
0
0
0
0
null
null
0
0.022727
null
null
0.181818
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
9f385adb32c54c2cf674753727414734f8446d67
2,150
py
Python
www/wotd/models.py
nullsym/sachiye
f08d890697b7da502e329d40dbf774c4c8af187d
[ "MIT" ]
null
null
null
www/wotd/models.py
nullsym/sachiye
f08d890697b7da502e329d40dbf774c4c8af187d
[ "MIT" ]
null
null
null
www/wotd/models.py
nullsym/sachiye
f08d890697b7da502e329d40dbf774c4c8af187d
[ "MIT" ]
null
null
null
# Imports from our app from wotd import db, app # Flask-Login works via the LoginManager class: Thus, we need # to start things off by telling LoginManager about our Flask app from flask_login import LoginManager login_manager = LoginManager(app) login_manager.init_app(app) # Password hashing from werkzeug.security import generate_password_hash, check_password_hash from flask_login import UserMixin # Get date in a specific timezone from datetime import datetime from pytz import timezone # Use the timezone of the person adding the WOTD def get_date(): fmt = "%Y-%m-%d" naive = datetime.now(timezone('America/Los_Angeles')) return naive.strftime(fmt) ############### # Our classes # ############### class User(UserMixin, db.Model): username = db.Column(db.String(80), nullable=False, primary_key=True) password = db.Column(db.String(120)) def __repr__(self): return '<user %r:%r>' % (self.username, self.password) def set_password(self, password): self.password = generate_password_hash(password) def check_password(self, password): return check_password_hash(self.password, password) def get_id(self): return self.username class Wotd(db.Model): uid = db.Column(db.Integer(), primary_key=True, unique=True) date = db.Column(db.String(), nullable=False, default=get_date()) # JP word, its romanji, and its definition. All required. wotd = db.Column(db.String(), nullable=False, unique=True) romaji = db.Column(db.String(), nullable=False) defn = db.Column(db.String(), nullable=False) # Not required, but nice to have example = db.Column(db.Text()) classification = db.Column(db.String(20)) def __repr__(self): return '<WOTD: %r:%r:%r>' % (self.uid, self.date, self.wotd) # Given a user ID, return the associated user object # It should take unicode ID of a user and returns the corresponding user object # Should return None if the ID is not valid @login_manager.user_loader def user_loader(email): # Returns true if the user does not # exist, otherwise it returns the user object return User.query.get(email)
35.245902
79
0.709767
313
2,150
4.773163
0.373802
0.048193
0.060241
0.074967
0.077644
0.077644
0
0
0
0
0
0.003948
0.175349
2,150
61
80
35.245902
0.838691
0.273953
0
0.055556
0
0
0.03628
0
0
0
0
0
0
1
0.194444
false
0.194444
0.166667
0.138889
0.833333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
1
0
0
0
2
9f400427c659e5c8d5c0f656dfde230a04071a6b
9,932
py
Python
Yuanjunling1/boss-xiadan.py
yuanjunling/PycharmProjects
087b1a30818bbe2bf3972c9340f61ca4b792eb7d
[ "bzip2-1.0.6" ]
null
null
null
Yuanjunling1/boss-xiadan.py
yuanjunling/PycharmProjects
087b1a30818bbe2bf3972c9340f61ca4b792eb7d
[ "bzip2-1.0.6" ]
null
null
null
Yuanjunling1/boss-xiadan.py
yuanjunling/PycharmProjects
087b1a30818bbe2bf3972c9340f61ca4b792eb7d
[ "bzip2-1.0.6" ]
null
null
null
# -*- coding: utf-8 -*- from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoAlertPresentException import unittest, time, re, os class BossXiadan(unittest.TestCase): def setUp(self): chrome_driver=os.path.abspath(r'C:\Python27\chromedriver.exe') os.environ['webdriver.chrome.driver']=chrome_driver self.driver=webdriver.Chrome() self.driver.get("https://cas.qa.great-tao.com:8443/cas-server/login?service=http://boss.qa.great-tao.com/cas") self.verificationErrors = [] self.accept_next_alert = True def test_boss_xiadan(self): driver = self.driver driver.get("https://cas.qa.great-tao.com:8443/cas-server/login?service=http://boss.qa.great-tao.com/cas") driver.find_element_by_id("username").clear() driver.find_element_by_id("username").send_keys("dingni") driver.find_element_by_id("password").clear() driver.find_element_by_id("password").send_keys("1234") driver.find_element_by_id("captcha").clear() driver.find_element_by_id("captcha").send_keys("greattao0818") driver.find_element_by_name("submit").click() driver.find_element_by_link_text(u"BOSS系统").click() time.sleep(3) driver.find_element_by_link_text(u"销售线索").click() time.sleep(2) driver.find_element_by_link_text(u"添加线索").click() time.sleep(2) driver.switch_to.frame(driver.find_element_by_xpath("//iframe[contains(@src,'http://boss.qa.great-tao.com/boss-leads-web/leads/add')]")) #切换frame driver.find_element_by_id("sourceRemark").clear() driver.find_element_by_id("sourceRemark").send_keys("test") driver.find_element_by_id("company").clear() driver.find_element_by_id("company").send_keys("dntest") xiansuo_style1=driver.find_element_by_id("type") Select(xiansuo_style1).select_by_value('3')#下拉框选择 xiansuo_source=driver.find_element_by_id("source") Select(xiansuo_source).select_by_value('3') driver.find_element_by_id("contact").clear() driver.find_element_by_id("contact").send_keys("dn") driver.find_element_by_id("tel").clear() driver.find_element_by_id("tel").send_keys("15987598758") driver.find_element_by_id("email").clear() driver.find_element_by_id("email").send_keys("156848@126.com") driver.find_element_by_id("content").clear() driver.find_element_by_id("content").send_keys("dntest") driver.find_element_by_id("submit").click() driver.switch_to.default_content()#换回主frame driver.find_element_by_link_text(u"线索分配").click() driver.switch_to.frame(driver.find_element_by_xpath("//iframe[contains(@src,'http://boss.qa.great-tao.com/boss-leads-web/leads/director/list')]")) #切换frame xiansuo_style2=driver.find_element_by_id("type") Select(xiansuo_style2).select_by_value('3') xiansuo_status2=driver.find_element_by_id("status") Select(xiansuo_status2).select_by_value('1') driver.find_element_by_id("btn_query").click() driver.maximize_window() time.sleep(1) driver.find_element_by_xpath("//*[@id='table']/tbody/tr[1]/td[10]/a[2]").click() time.sleep(2) driver.switch_to.frame(driver.find_element_by_id("layui-layer-iframe1"))#切换frame div_fenpei=driver.find_element_by_class_name("col-xs-6").find_element_by_id("receiver") Select(div_fenpei).select_by_value('53') driver.find_element_by_id("confirm").click() driver.switch_to.default_content()#换回主frame driver.switch_to.frame(driver.find_element_by_xpath("//iframe[contains(@src,'http://boss.qa.great-tao.com/boss-leads-web/leads/director/list')]")) Select(xiansuo_status2).select_by_value('7') time.sleep(1) driver.find_element_by_id("btn_query").click() time.sleep(3) driver.find_element_by_xpath("//*[@id='table']/tbody/tr[1]/td[10]/a[1]").click() time.sleep(1) driver.find_element_by_link_text(u"关联").click() time.sleep(3) driver.switch_to.frame(driver.find_element_by_id("layui-layer-iframe1"))#切换frame driver.find_element_by_xpath("//*[@id='table']/tbody/tr[1]").click() driver.find_element_by_id("confirm").click() driver.switch_to.default_content()#换回主frame driver.switch_to.frame(driver.find_element_by_xpath("//iframe[contains(@src,'http://boss.qa.great-tao.com/boss-leads-web/leads/director/list')]")) driver.find_element_by_link_text(u"跟进").click() time.sleep(1) driver.switch_to.default_content()#换回主frame driver.switch_to.frame(driver.find_element_by_xpath("//iframe[contains(@src,'http://boss.qa.great-tao.com/boss-leads-web/leads/director/list')]")) driver.switch_to.frame(driver.find_element_by_id("layui-layer-iframe1"))#切换frame time.sleep(1) driver.find_element_by_id("followupRemark").clear() driver.find_element_by_id("followupRemark").send_keys("test dn") driver.find_element_by_id("followupDate").click() driver.find_element_by_xpath("/html/body/div[2]/div[3]/table/tbody/tr[4]/td[3]").click() driver.find_element_by_id("confirm").click() driver.switch_to.default_content()#换回主frame driver.switch_to.frame(driver.find_element_by_xpath("//iframe[contains(@src,'http://boss.qa.great-tao.com/boss-leads-web/leads/director/list')]")) driver.find_element_by_link_text(u"下单").click() driver.find_element_by_id("selectServiceProvider").click() driver.find_element_by_id("popup").click() driver.find_element_by_xpath("(//input[@name='btSelectItem'])[35]").click() driver.find_element_by_id("queryService").click() driver.find_element_by_name("orderAddressList[0].name").clear() driver.find_element_by_name("orderAddressList[0].name").send_keys("testdn001") driver.find_element_by_name("orderAddressList[0].address").clear() driver.find_element_by_name("orderAddressList[0].address").send_keys("testdn001") driver.find_element_by_name("orderAddressList[1].name").clear() driver.find_element_by_name("orderAddressList[1].name").send_keys("testdn0001") driver.find_element_by_name("orderAddressList[2].name").clear() driver.find_element_by_name("orderAddressList[2].name").send_keys("testdn00001") driver.find_element_by_name("goodsList[0].goodsName").clear() driver.find_element_by_name("goodsList[0].goodsName").send_keys("testdn0001") driver.find_element_by_name("goodsList[0].num").clear() driver.find_element_by_name("goodsList[0].num").send_keys("1") Select(driver.find_element_by_name("goodsList[0].unit")).select_by_visible_text("CTNS") driver.find_element_by_name("goodsList[0].grossWeight").clear() driver.find_element_by_name("goodsList[0].grossWeight").send_keys("1") driver.find_element_by_name("goodsList[0].measurement").clear() driver.find_element_by_name("goodsList[0].measurement").send_keys("1") driver.find_element_by_xpath("(//input[@name='orderExpand.containerMark'])[2]").click() driver.find_element_by_xpath("//div[@id='sizzle-1489114881098']/div[3]/table/tbody/tr/td[5]").click() driver.find_element_by_xpath("//div[@id='sizzle-1489114881098']/div[3]/table/tbody/tr[3]/td[6]").click() driver.find_element_by_id("select2-orderportOfShipment-qa-container").click() driver.find_element_by_css_selector("span.select2-selection__placeholder").click() Select(driver.find_element_by_name("orderExpand.typeOfShipping")).select_by_visible_text(u"海运") Select(driver.find_element_by_name("order.freightPayableat")).select_by_visible_text(u"运费预付") driver.find_element_by_name("selectService").click() driver.find_element_by_name("orderExpand.entrustName").clear() driver.find_element_by_name("orderExpand.entrustName").send_keys("11") driver.find_element_by_name("orderExpand.entrustTel").clear() driver.find_element_by_name("orderExpand.entrustTel").send_keys("11") Select(driver.find_element_by_id("haha")).select_by_visible_text(u"海运费") driver.find_element_by_name("logisticsCosts[3].price").clear() driver.find_element_by_name("logisticsCosts[3].price").send_keys("11") Select(driver.find_element_by_id("store-name")).select_by_visible_text(u"吊机费") driver.find_element_by_name("logisticsCosts[4].price").clear() driver.find_element_by_name("logisticsCosts[4].price").send_keys("11") driver.find_element_by_name("logisticsCosts[1].price").clear() driver.find_element_by_name("logisticsCosts[1].price").send_keys("11") driver.find_element_by_id("saveService").click() def is_element_present(self, how, what): try: self.driver.find_element(by=how, value=what) except NoSuchElementException as e: return False return True def is_alert_present(self): try: self.driver.switch_to_alert() except NoAlertPresentException as e: return False return True def close_alert_and_get_its_text(self): try: alert = self.driver.switch_to_alert() alert_text = alert.text if self.accept_next_alert: alert.accept() else: alert.dismiss() return alert_text finally: self.accept_next_alert = True '''def tearDown(self): self.driver.quit() self.assertEqual([], self.verificationErrors)''' if __name__ == "__main__": unittest.main()
58.423529
154
0.700665
1,346
9,932
4.86107
0.160475
0.163075
0.192725
0.278771
0.756228
0.693871
0.545468
0.473483
0.283968
0.244842
0
0.020355
0.149215
9,932
169
155
58.769231
0.753965
0.010169
0
0.198718
0
0.070513
0.251339
0.115733
0
0
0
0
0
1
0.032051
false
0.012821
0.044872
0
0.102564
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
9f43ce6631e7319b1bcdc1a179c864fd23965ec3
1,367
gyp
Python
binding.gyp
jacobsologub/gif2webp
15e006074557f12863a7ac295ea8d2a9e771dd9a
[ "MIT" ]
11
2015-09-23T08:47:00.000Z
2022-01-11T09:47:57.000Z
binding.gyp
jacobsologub/gif2webp
15e006074557f12863a7ac295ea8d2a9e771dd9a
[ "MIT" ]
2
2015-04-23T06:28:00.000Z
2017-05-09T16:46:45.000Z
binding.gyp
jacobsologub/gif2webp
15e006074557f12863a7ac295ea8d2a9e771dd9a
[ "MIT" ]
3
2015-12-01T23:12:21.000Z
2019-03-01T01:51:22.000Z
{ "variables": { "HEROKU%": '<!(echo $HEROKU)' }, "targets": [ { "target_name": "gif2webp", "defines": [ ], "sources": [ "src/gif2webp.cpp", "src/webp/example_util.cpp", "src/webp/gif2webp_util.cpp", "src/webp/gif2webpMain.cpp" ], "conditions": [ [ 'OS=="mac"', { "include_dirs": [ "/usr/local/include", "src/webp" ], "libraries": [ "-lwebp", "-lwebpmux", "-lgif" ] } ], [ 'OS=="linux"', { "include_dirs": [ "/usr/local/include", "src/webp" ], "libraries": [ "-lwebp", "-lwebpmux", "-lgif" ] } ] ] } ] }
26.288462
49
0.21068
54
1,367
5.240741
0.5
0.123675
0.106007
0.09894
0.416961
0.416961
0.416961
0.416961
0.416961
0.416961
0
0.009009
0.675201
1,367
52
50
26.288462
0.628378
0
0
0.395833
0
0
0.239766
0.055556
0
0
0
0
0
1
0
true
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
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
9f4848fb1e1f8c151bf749c7d7992e896b000b74
344
py
Python
settings.py
nopogo/twitchplaysturtle
247ce20be55082b6675aebea56c4a264493c0218
[ "MIT" ]
null
null
null
settings.py
nopogo/twitchplaysturtle
247ce20be55082b6675aebea56c4a264493c0218
[ "MIT" ]
null
null
null
settings.py
nopogo/twitchplaysturtle
247ce20be55082b6675aebea56c4a264493c0218
[ "MIT" ]
null
null
null
import secrets channel_name = "nopogo_tv" server_ip = "0.0.0.0" server_port = 8000 channel_id = 28092036 ws_host = "wss://pubsub-edge.twitch.tv" ws_local = secrets.local_ip topics = [ "channel-bits-events-v2.{}".format(channel_id), "channel-points-channel-v1.{}".format(channel_id), "channel-subscribe-events-v1.{}".format(channel_id) ]
21.5
52
0.726744
52
344
4.596154
0.538462
0.150628
0.188285
0.1841
0
0
0
0
0
0
0
0.06129
0.098837
344
15
53
22.933333
0.709677
0
0
0
0
0
0.367347
0.3207
0
0
0
0
0
1
0
false
0
0.083333
0
0.083333
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
9f57dc161a4c2f57109ec9b96b98cf65e6091f2e
6,203
py
Python
tests/binding/test_binders_errors.py
jimcarreer/dinao
ab9514d81ffff2d3e8717f26403c3b73f388739d
[ "MIT" ]
1
2021-01-27T08:09:31.000Z
2021-01-27T08:09:31.000Z
tests/binding/test_binders_errors.py
jimcarreer/dinao
ab9514d81ffff2d3e8717f26403c3b73f388739d
[ "MIT" ]
34
2020-12-18T19:40:26.000Z
2022-03-05T13:06:37.000Z
tests/binding/test_binders_errors.py
jimcarreer/dinao
ab9514d81ffff2d3e8717f26403c3b73f388739d
[ "MIT" ]
1
2021-01-27T08:12:15.000Z
2021-01-27T08:12:15.000Z
"""Tests various errors that can be thrown by binding.""" from typing import Generator, List, Tuple, Union from dinao.backend import Connection from dinao.binding import FunctionBinder from dinao.binding.binders import BoundedGeneratingQuery from dinao.binding.errors import ( BadReturnTypeError, CannotInferMappingError, FunctionAlreadyBoundError, MissingTemplateArgumentError, MultipleConnectionArgumentError, NoPoolSetError, PoolAlreadySetError, TemplateError, ) from dinao.binding.templating import Template import pytest from tests.binding.mocks import MockConnection, MockConnectionPool def test_cannot_infer_generic(binder_and_pool: Tuple[FunctionBinder, MockConnectionPool]): """Tests that binding a function to typed generics raises an error.""" binder, _ = binder_and_pool with pytest.raises(CannotInferMappingError, match="Unable to determine mapper for typing.Union"): @binder.query("SELECT * FROM table") def raises_cannot_infer() -> Union[str, int]: pass # pragma: no cover def test_cannot_infer_nested_generic(binder_and_pool: Tuple[FunctionBinder, MockConnectionPool]): """Tests that binding a function to typed generics as row types raises.""" binder, _ = binder_and_pool with pytest.raises(CannotInferMappingError, match="Unable to determine row mapper for typing.List\\[str\\]"): @binder.query("SELECT * FROM table") def raises_cannot_infer_row_type() -> List[List[str]]: pass # pragma: no cover def test_binding_generator_throws(binder_and_pool: Tuple[FunctionBinder, MockConnectionPool]): """Tests that binding a function to generate when send type and return type are specified.""" binder, pool = binder_and_pool with pytest.raises(CannotInferMappingError, match="Only yield_type"): @binder.query("SELECT some_num FROM table LIMIT 3") def generating_query_bad() -> Generator[int, int, int]: pass # pragma: no cover def test_bounded_generating_query_throws(binder_and_pool: Tuple[FunctionBinder, MockConnectionPool]): """Tests that BoundedGeneratingQuery raises if not bound to a generator.""" binder, pool = binder_and_pool def not_a_generator() -> int: pass # pragma: no cover with pytest.raises(BadReturnTypeError, match="Expected results type to be Generator"): BoundedGeneratingQuery(binder, Template("SELECT * FROM table"), not_a_generator) def test_binder_execute_bad_type(binder_and_pool: Tuple[FunctionBinder, MockConnectionPool]): """Tests that binding a function specifying an invalid return type for execution raises an exception.""" binder, _ = binder_and_pool with pytest.raises(BadReturnTypeError, match="can only return None or int"): @binder.execute("INSERT INTO TABLE (#{arg1})") def should_raise(arg1: str) -> List: pass # pragma: no cover def test_binder_raises_for_template(binder_and_pool: Tuple[FunctionBinder, MockConnectionPool]): """Tests that a bad template causes an error at binding time.""" binder, _ = binder_and_pool with pytest.raises(TemplateError, match="#{arg1"): @binder.execute("INSERT INTO table #{arg1") def should_raise_0(arg1: str) -> int: pass # pragma: no cover def test_double_binding_raises(binder_and_pool: Tuple[FunctionBinder, MockConnectionPool]): """Tests that binding a function more than once results in an error.""" binder, _ = binder_and_pool match = "has already been bounded by" with pytest.raises(FunctionAlreadyBoundError, match=match): @binder.execute("UPDATE table SET col = #{arg1}") @binder.execute("INSERT INTO TABLE (#{arg1})") def should_raise_1(arg1: str): pass # pragma: no cover with pytest.raises(FunctionAlreadyBoundError, match=match): @binder.execute("UPDATE table SET col = #{arg1}") @binder.query("SELECT * FROM table WHERE col = #{arg1})") def should_raise_2(arg1: str): pass # pragma: no cover with pytest.raises(FunctionAlreadyBoundError, match=match): @binder.execute("UPDATE table SET col = #{arg1}") @binder.transaction() def should_raise_3(arg1: str): pass # pragma: no cover def test_args_mismatch_raises(binder_and_pool: Tuple[FunctionBinder, MockConnectionPool]): """Tests an error is raised if a template is bound to a function without a matching argument.""" binder, _ = binder_and_pool with pytest.raises(MissingTemplateArgumentError, match="specified in template but is not an argument of"): @binder.execute("INSERT INTO table (#{arg})") def should_raise_4(some_arg: str): pass # pragma: no cover def test_binder_raises_for_no_pool(): """Tests an error is raised when a bind has no pool but an operation requiring one is performed.""" binder = FunctionBinder() @binder.execute("INSERT INTO table (#{arg})") def test_bound_execute(arg: str): pass # pragma: no cover with pytest.raises(NoPoolSetError, match="No connection pool"): test_bound_execute("testing") with pytest.raises(NoPoolSetError, match="No connection pool"): with binder.connection() as cnx: # noqa: F841 pass # pragma: no cover def test_binder_raises_for_pool_set_twice(binder_and_pool: Tuple[FunctionBinder, MockConnectionPool]): """Tests an error is raised when a binder has its pool set twice.""" binder, _ = binder_and_pool pool = MockConnectionPool([]) with pytest.raises(PoolAlreadySetError, match="only be set once"): binder.pool = pool def test_binder_raises_for_double_connection_arg(binder_and_pool: Tuple[FunctionBinder, MockConnectionPool]): """Tests an error is raised when a bound function specifies it would like more than one connection.""" binder, _ = binder_and_pool with pytest.raises(MultipleConnectionArgumentError, match="Connection argument specified multiple times for"): @binder.transaction() def should_raise_5(cnx1: Connection, cnx2: MockConnection): pass # pragma: no cover
38.055215
114
0.715138
758
6,203
5.687335
0.204485
0.041754
0.060311
0.051264
0.561587
0.519833
0.509859
0.428671
0.356762
0.281141
0
0.004998
0.193616
6,203
162
115
38.290123
0.856857
0.184588
0
0.397959
0
0
0.143459
0
0
0
0
0
0
1
0.234694
false
0.132653
0.081633
0
0.316327
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
9f58b4292a34cd1938789d7e2e28f7021f2ddc09
80
py
Python
nfbackend/env_vars.py
neuralfoo/neuralfoo
d40388cd506d612ceee9ae10d92985c794249c65
[ "MIT" ]
2
2022-01-06T08:18:29.000Z
2022-01-06T08:19:09.000Z
nfbackend/env_vars.py
neuralfoo/neuralfoo
d40388cd506d612ceee9ae10d92985c794249c65
[ "MIT" ]
null
null
null
nfbackend/env_vars.py
neuralfoo/neuralfoo
d40388cd506d612ceee9ae10d92985c794249c65
[ "MIT" ]
null
null
null
seaweedfs_master = "http://localhost:9333" #do not add slash to end (after port)
80
80
0.75
13
80
4.538462
1
0
0
0
0
0
0
0
0
0
0
0.057143
0.125
80
1
80
80
0.785714
0.45
0
0
0
0
0.477273
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
9f5af16633fdf3d87fecf487badb15528c65c1ec
5,018
py
Python
tests/oleform/test_basic.py
tirkarthi/oletools
8b97e45bffe22f18363fd58431bbae4613296103
[ "BSD-2-Clause" ]
1
2020-12-05T10:30:06.000Z
2020-12-05T10:30:06.000Z
tests/oleform/test_basic.py
tirkarthi/oletools
8b97e45bffe22f18363fd58431bbae4613296103
[ "BSD-2-Clause" ]
null
null
null
tests/oleform/test_basic.py
tirkarthi/oletools
8b97e45bffe22f18363fd58431bbae4613296103
[ "BSD-2-Clause" ]
null
null
null
""" Test oleform basic functionality """ import unittest from os.path import join import sys # Directory with test data, independent of current working directory from tests.test_utils import DATA_BASE_DIR if sys.version_info[0] <= 2: from oletools.olevba import VBA_Parser else: from oletools.olevba3 import VBA_Parser SAMPLES = [('oleform-PR314.docm', [('word/vbaProject.bin', u'UserFormTEST1', {'caption': 'Label1-test', 'control_tip_text': None, 'name': 'Label1', 'value': None, 'tag': 'l\x18sdf', 'ClsidCacheIndex': 21, 'id': 1, 'tabindex': 0}), ('word/vbaProject.bin', u'UserFormTEST1', {'caption': None, 'control_tip_text': None, 'name': 'TextBox1', 'value': 'heyhey', 'tag': '', 'ClsidCacheIndex': 23, 'id': 2, 'tabindex': 1}), ('word/vbaProject.bin', u'UserFormTEST1', {'caption': None, 'control_tip_text': None, 'name': 'ComboBox1', 'value': 'none dd', 'tag': '', 'ClsidCacheIndex': 25, 'id': 3, 'tabindex': 2}), ('word/vbaProject.bin', u'UserFormTEST1', {'caption': None, 'control_tip_text': None, 'name': 'CheckBox1', 'value': '1', 'tag': '', 'ClsidCacheIndex': 26, 'id': 5, 'tabindex': 4}), ('word/vbaProject.bin', u'UserFormTEST1', {'caption': None, 'control_tip_text': None, 'name': 'OptionButton1', 'value': '0', 'tag': '', 'ClsidCacheIndex': 27, 'id': 6, 'tabindex': 5}), ('word/vbaProject.bin', u'UserFormTEST1', {'caption': None, 'control_tip_text': None, 'name': 'ToggleButton1', 'value': '0', 'tag': '', 'ClsidCacheIndex': 28, 'id': 7, 'tabindex': 6}), ('word/vbaProject.bin', u'UserFormTEST1', {'caption': None, 'control_tip_text': None, 'name': 'Frame1', 'value': None, 'tag': '', 'ClsidCacheIndex': 14, 'id': 8, 'tabindex': 7}), ('word/vbaProject.bin', u'UserFormTEST1', {'caption': None, 'control_tip_text': None, 'name': 'TabStrip1', 'value': None, 'tag': '', 'ClsidCacheIndex': 18, 'id': 10, 'tabindex': 8}), ('word/vbaProject.bin', u'UserFormTEST1', {'caption': None, 'control_tip_text': None, 'name': 'CommandButton1', 'value': None, 'tag': '', 'ClsidCacheIndex': 17, 'id': 9, 'tabindex': 9}), ('word/vbaProject.bin', u'UserFormTEST1', {'caption': None, 'control_tip_text': None, 'name': 'MultiPage1', 'value': None, 'tag': '', 'ClsidCacheIndex': 57, 'id': 12, 'tabindex': 10}), ('word/vbaProject.bin', u'UserFormTEST1', {'caption': None, 'control_tip_text': None, 'name': 'ScrollBar1', 'value': None, 'tag': '', 'ClsidCacheIndex': 47, 'id': 16, 'tabindex': 11}), ('word/vbaProject.bin', u'UserFormTEST1', {'caption': None, 'control_tip_text': None, 'name': 'SpinButton1', 'value': None, 'tag': '', 'ClsidCacheIndex': 16, 'id': 17, 'tabindex': 12}), ('word/vbaProject.bin', u'UserFormTEST1', {'caption': None, 'control_tip_text': None, 'name': 'Image1', 'value': None, 'tag': '', 'ClsidCacheIndex': 12, 'id': 18, 'tabindex': 13}), ('word/vbaProject.bin', u'UserFormTEST1', {'caption': None, 'control_tip_text': None, 'name': 'ListBox1', 'value': '', 'tag': '', 'ClsidCacheIndex': 24, 'id': 4, 'tabindex': 3}), ('word/vbaProject.bin', u'UserFormTEST1/i08', {'caption': None, 'control_tip_text': None, 'name': 'TextBox2', 'value': 'abcd', 'tag': '', 'ClsidCacheIndex': 23, 'id': 20, 'tabindex': 0}), ('word/vbaProject.bin', u'UserFormTEST1/i12', {'caption': None, 'control_tip_text': None, 'name': '', 'value': None, 'tag': '', 'ClsidCacheIndex': 18, 'id': 13, 'tabindex': 2}), ('word/vbaProject.bin', u'UserFormTEST1/i12', {'caption': None, 'control_tip_text': None, 'name': 'Page1', 'value': None, 'tag': '', 'ClsidCacheIndex': 7, 'id': 14, 'tabindex': 0}), ('word/vbaProject.bin', u'UserFormTEST1/i12', {'caption': None, 'control_tip_text': None, 'name': 'Page2', 'value': None, 'tag': '', 'ClsidCacheIndex': 7, 'id': 15, 'tabindex': 1}), ('word/vbaProject.bin', u'UserFormTEST1/i12/i14', {'caption': None, 'control_tip_text': None, 'name': 'TextBox3', 'value': 'last one', 'tag': '', 'ClsidCacheIndex': 23, 'id': 24, 'tabindex': 0}), ('word/vbaProject.bin', u'UserFormTest2', {'caption': 'Label1', 'control_tip_text': None, 'name': 'Label1', 'value': None, 'tag': '', 'ClsidCacheIndex': 21, 'id': 1, 'tabindex': 0}), ('word/vbaProject.bin', u'UserFormTest2', {'caption': 'Label2', 'control_tip_text': None, 'name': 'Label2', 'value': None, 'tag': '', 'ClsidCacheIndex': 21, 'id': 2, 'tabindex': 1}), ('word/vbaProject.bin', u'UserFormTest2', {'caption': None, 'control_tip_text': None, 'name': 'TextBox1', 'value': '&\xe9"\'', 'tag': '', 'ClsidCacheIndex': 23, 'id': 3, 'tabindex': 2})])] class TestOleForm(unittest.TestCase): def test_samples(self): if sys.version_info[0] > 2: # Unfortunately, olevba3 doesn't have extract_form_strings_extended return for sample, expected_result in SAMPLES: full_name = join(DATA_BASE_DIR, 'oleform', sample) parser = VBA_Parser(full_name) variables = list(parser.extract_form_strings_extended()) self.assertEqual(variables, expected_result) # just in case somebody calls this file as a script if __name__ == '__main__': unittest.main()
147.588235
4,099
0.646273
616
5,018
5.146104
0.232143
0.097161
0.117981
0.124921
0.565615
0.548896
0.472871
0.433754
0.399369
0.355521
0
0.039211
0.120765
5,018
33
4,100
152.060606
0.679284
0.043244
0
0
0
0
0.482989
0.004383
0
0
0
0
0.05
1
0.05
false
0
0.3
0
0.45
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
9f64787f57a24c0791b4e390dd80153d89d86f8d
12,181
py
Python
geonet/region.py
bbengfort/geonet
05b96f44834bdb39444ad73d7a6c863f3d55326f
[ "MIT" ]
1
2018-03-28T15:12:28.000Z
2018-03-28T15:12:28.000Z
geonet/region.py
bbengfort/geonet
05b96f44834bdb39444ad73d7a6c863f3d55326f
[ "MIT" ]
1
2018-01-26T15:21:13.000Z
2018-02-02T22:04:59.000Z
geonet/region.py
bbengfort/geonet
05b96f44834bdb39444ad73d7a6c863f3d55326f
[ "MIT" ]
null
null
null
# geonet.region # Interface for managing region objects # # Author: Benjamin Bengfort <benjamin@bengfort.com> # Created: Wed Jan 17 06:49:35 2018 -0500 # # ID: region.py [] benjamin@bengfort.com $ """ Interface for managing region objects """ ########################################################################## ## Imports ########################################################################## import os import json from geonet.ec2 import connect from geonet.config import settings from geonet.config import USERDATA from geonet.utils.async import wait from geonet.utils.serialize import Encoder from geonet.base import Collection, Resource from geonet.utils.timez import utcnow, parse_datetime from geonet.ec2 import KeyPairs, SecurityGroups, Images from geonet.ec2 import Instances, Volumes, LaunchTemplates from geonet.ec2 import PlacementGroups from geonet.zone import AvailabilityZones from operator import itemgetter REGIONDATA = os.path.join(USERDATA, "regions.json") ########################################################################## ## Helper Function ########################################################################## def parse_region(region, lookup=True): """ Parses the region from the given input. Parameters ---------- region : object Parses a region according to the input type as follows: - basestring: returns a region from name - Region: pass-through so that region classes are returned - dict: instantiates a new region with the data lookup : bool, default=True If the region is a basestring or a Region class, all other information about the region is populated from disk. Returns ------- region : Region The region object, either fully or sparsely populated raises : TypeError If an unknown region type is passed in """ if isinstance(region, Region): if lookup: return Region.from_name(str(region)) return region if isinstance(region, basestring): if lookup: return Region.from_name(region) return Region({"RegionName": region}) if isinstance(region, dict): return Region(region) raise TypeError("unparseable region type: {}".format(type(region))) ########################################################################## ## Region object and collection ########################################################################## class Region(Resource): """ A description of a region with extra information stored in config. Expects to be initialized from JSON data, an element of a boto response or data loaded from disk. This element should be a dictionary only. """ REQUIRED_KEYS = ('RegionName',) EXTRA_KEYS = ('LocaleName',) @staticmethod def from_name(name): """ Load a region from a region name by loading all the region fixtures and finding the one that matches the RegionName or LocaleName keys. Raises a LookupError if the region could not be found. """ regions = Regions.load() region = regions.find(name) if region is None: raise LookupError("no region named '{}' found".format(name)) return region def __init__(self, *args, **kwargs): self._conn = kwargs.pop('conn', None) super(Region, self).__init__(*args, **kwargs) def __repr__(self): return "Region {} ({})".format(self, self.locale) def __str__(self): return self["RegionName"] def __hash__(self): return hash(str(self)) @property def name(self): if 'LocaleName' in self and self['LocaleName']: return self['LocaleName'] return str(self) @property def locale(self): """ Returns the locale name of the region """ if 'LocaleName' in self and self['LocaleName']: return self['LocaleName'] # Make it up parts = self['RegionName'].split('-') parts[0] = parts[0].upper() parts[1] = parts[1].title() return " ".join(parts) @property def conn(self): if self._conn is None: for tries in range(4): try: self._conn = connect(self) break except: if tries >= 3: raise self._conn = None return self._conn def is_configured(self): """ Returns true if the region is configured in the settings """ return self["RegionName"] in settings.regions def zones(self, **kwargs): """ Describe the availability zones in the region and their state """ resp = self.conn.describe_availability_zones(**kwargs) return AvailabilityZones(resp['AvailabilityZones'], region=self) def instances(self, **kwargs): """ Returns all instances associated with the region """ # TODO: validate response resp = self.conn.describe_instances(**kwargs) instances = [] for reservation in resp['Reservations']: for instance in reservation['Instances']: instance['ReservationId'] = reservation['ReservationId'] instances.append(instance) return Instances(instances, region=self) def volumes(self, **kwargs): """ Returns all volumes associated with the region """ # TODO: validate response resp = self.conn.describe_volumes(**kwargs) return Volumes(resp['Volumes'], region=self) def key_pairs(self, **kwargs): """ Returns the keys associated with the region. """ # TODO: validate response resp = self.conn.describe_key_pairs(**kwargs) return KeyPairs(resp['KeyPairs'], region=self) def launch_templates(self, **kwargs): """ Returns the launch templates associated with the region. """ # TODO: validate response resp = self.conn.describe_launch_templates(**kwargs) return LaunchTemplates(resp['LaunchTemplates'], region=self) def images(self, **kwargs): """ Returns the images associated with the region. By default this filters the images that belong to the owner id set in the configuration file, otherwise this will take a really long time and return many results. """ if 'Filters' not in kwargs and settings.aws.aws_owner_id: kwargs['Filters'] = [{ 'Name': 'owner-id', 'Values': [settings.aws.aws_owner_id] }] # TODO: validate response resp = self.conn.describe_images(**kwargs) return Images(resp['Images'], region=self) def security_groups(self, **kwargs): """ Returns the security groups associated with the region. """ # TODO: validate repsonse resp = self.conn.describe_security_groups(**kwargs) return SecurityGroups(resp['SecurityGroups'], region=self) def placement_groups(self, **kwargs): """ REtursn the placement groups associated with the region. """ resp = self.conn.describe_placement_groups(**kwargs) return PlacementGroups(resp["PlacementGroups"], region=self) class Regions(Collection): """ A collection of region objects with extra information stored in config. Expects to be initialized from JSON data, either a response from boto describe_regions or loading the data from disk in a saved location. """ RESOURCE = Region @classmethod def load(klass, path=REGIONDATA): """ Load the region data from a path on disk. """ # Return list of configured regions if not os.path.exists(path): return klass([ {'RegionName': region} for region in settings.regions ]) with open(path, 'r') as f: data = json.load(f) updated = parse_datetime(data["updated"]) return klass(data["regions"], updated=updated) @classmethod def load_active(klass, **kwargs): """ Loads regions and filters active ones. """ return klass([ region for region in klass.load(**kwargs) if region.is_configured() ]) @classmethod def fetch(klass, conn): """ Fetch the region data from EC2 with the given connection """ # TODO: validate response resp = conn.describe_regions() return klass(resp["Regions"]) def dump(self, path=REGIONDATA): """ Dump the regions to the specified path on disk """ data = { "updated": utcnow(), "regions": list(self), } with open(path, 'w') as f: json.dump(data, f, cls=Encoder, indent=2) def sortby(self, key, reverse=False): """ Sort the region by the specified key """ self.items.sort(key=itemgetter(key), reverse=reverse) def find(self, name): """ Find a region by RegionName or by LocaleName. Returns None if no key with the specified name could be found. Is case sensitive. """ for region in self: if name == region["RegionName"] or name == region.locale: return region return None def zones(self, **kwargs): """ Returns a collection ofa vailability zones across all regions. """ return AvailabilityZones.collect( wait((region.zones for region in self), kwargs=kwargs) ) def instances(self, status=False, **kwargs): """ Returns a collection of instances across all regions. If status is True then the status for all instances are also collected. """ instances = wait((region.instances for region in self), kwargs=kwargs) if status: wait((instance.update_statuses for instance in instances)) return Instances.collect(instances) def volumes(self, **kwargs): """ Returns a collection of volumes across all regions. """ return Volumes.collect( wait((region.volumes for region in self), kwargs=kwargs) ) def key_pairs(self, **kwargs): """ Returns the keys associated with the region. """ return KeyPairs.collect( wait((region.key_pairs for region in self), kwargs=kwargs) ) def launch_templates(self, **kwargs): """ Returns the launch templates associated with the region. """ return LaunchTemplates.collect( wait((region.launch_templates for region in self), kwargs=kwargs) ) def images(self, **kwargs): """ Returns the images associated with the region. By default this filters the images that belong to the owner id set in the configuration file, otherwise this will take a really long time and return many results. """ return Images.collect( wait((region.images for region in self), kwargs=kwargs) ) def security_groups(self, **kwargs): """ Returns the security groups associated with the region. """ return SecurityGroups.collect( wait((region.security_groups for region in self), kwargs=kwargs) ) def placement_groups(self, **kwargs): """ Returns the placement groups associated with the region. """ return PlacementGroups.collect( wait((region.placement_groups for region in self), kwargs=kwargs) ) if __name__ == '__main__': from geonet.utils.serialize import to_json regions = Regions.load() region = regions[settings.aws.aws_region] # print(to_json(region.key_pairs(), indent=2)) print(to_json(region.instances(), indent=2)) # print(to_json(region.images(), indent=2)) # print(to_json(region.security_groups(), indent=2))
31.233333
78
0.588868
1,345
12,181
5.270632
0.194052
0.03047
0.031175
0.038934
0.312738
0.248272
0.22683
0.176047
0.176047
0.176047
0
0.003667
0.283638
12,181
389
79
31.313625
0.808733
0.04819
0
0.194444
0
0
0.058165
0
0
0
0
0.017995
0
0
null
null
0
0.083333
null
null
0.005556
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
9f93b5cf954b2bbc0f4e0034fb5c50850b8a9553
1,539
py
Python
DLmodules/usermessage.py
egg0001/telegram-e-hentaiDL-bot
83200df4c9d35abaf308fc27b2f83d6452f86555
[ "WTFPL" ]
7
2019-04-07T06:42:09.000Z
2021-01-11T15:58:28.000Z
DLmodules/usermessage.py
egg0001/telegram-e-hentaiDL-bot
83200df4c9d35abaf308fc27b2f83d6452f86555
[ "WTFPL" ]
1
2020-02-24T09:16:54.000Z
2020-03-07T20:37:15.000Z
DLmodules/usermessage.py
egg0001/telegram-e-hentaiDL-bot
83200df4c9d35abaf308fc27b2f83d6452f86555
[ "WTFPL" ]
2
2020-02-03T14:16:55.000Z
2020-07-09T04:49:01.000Z
#!/usr/bin/python3 #-----------------bot session------------------- UserCancel = 'You have cancel the process.' welcomeMessage = ('User identity conformed, please input gallery urls ' + 'and use space to separate them' ) denyMessage = 'You are not the admin of this bot, conversation end.' urlComform = ('Received {0} gallery url(s). \nNow begin to download the content. ' + 'Once the download completed, you will receive a report.' ) magnetLinkConform = ('Received a magnetLink. Now send it to bittorrent client') magnetResultMessage = ('Torrent {0} has been added bittorrent client.') urlNotFound = 'Could not find any gallery url, please check and re-input.' gidError = 'Encountered an error gid: {0}' #------------------magnet download session--------------------- emptyFileListError = ('Could not retrive file list for this link, maybe still '+ 'downloading meta data.') #-----------------dloptgenerate session--------------------- userCookiesFormError = 'userCookies form error, please check the config file.' #-----------------managgessiongen session------------------- usercookiesEXHError = 'This cookies could not access EXH' #-----------------ehlogin session--------------------------- ehloginError = 'username or password error, please check.' exhError = 'This username could not access exhentai.' #------------------download session------------------------ galleryError = 'Gallery does not contain any page, maybe deleted.'
34.2
84
0.59974
157
1,539
5.878981
0.66879
0.03467
0.03467
0
0
0
0
0
0
0
0
0.00317
0.179987
1,539
44
85
34.977273
0.728209
0.234568
0
0
0
0
0.650726
0
0
0
0
0
0
1
0
false
0.052632
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
9f94cec9c4b9cf4433cbe35153ebec1175aa197a
1,964
py
Python
tests/ec2/test_ec2_clients.py
paulhutchings/beartype-boto3-example
d69298d9444d578799e2a17cb63de11474b2278a
[ "MIT" ]
3
2021-11-16T06:21:11.000Z
2021-11-22T08:59:11.000Z
tests/ec2/test_ec2_clients.py
paulhutchings/beartype-boto3-example
d69298d9444d578799e2a17cb63de11474b2278a
[ "MIT" ]
9
2021-11-19T03:29:00.000Z
2021-12-30T23:54:47.000Z
tests/ec2/test_ec2_clients.py
paulhutchings/beartype-boto3-example
d69298d9444d578799e2a17cb63de11474b2278a
[ "MIT" ]
null
null
null
import pytest from bearboto3.ec2 import ( EC2Client, EC2ServiceResource, ) from beartype import beartype from beartype.roar import ( BeartypeCallHintPepParamException, BeartypeCallHintPepReturnException, BeartypeDecorHintPep484585Exception, ) # ============================ # EC2Client # ============================ def test_ec2_client_arg_pass(gen_ec2_client): @beartype def func(param: EC2Client): pass func(gen_ec2_client) def test_ec2_client_arg_fail(gen_s3_client): with pytest.raises(BeartypeCallHintPepParamException): @beartype def func(param: EC2Client): pass func(gen_s3_client) def test_ec2_client_return_pass(gen_ec2_client): @beartype def func() -> EC2Client: return gen_ec2_client func() def test_ec2_client_return_fail(gen_s3_client): with pytest.raises( (BeartypeCallHintPepReturnException, BeartypeDecorHintPep484585Exception) ): @beartype def func() -> EC2Client: return gen_s3_client func() # ============================ # EC2ServiceResource # ============================ def test_ec2_resource_arg_pass(gen_ec2_resource): @beartype def func(param: EC2ServiceResource): pass func(gen_ec2_resource) def test_ec2_resource_arg_fail(gen_s3_resource): with pytest.raises(BeartypeCallHintPepParamException): @beartype def func(param: EC2ServiceResource): pass func(gen_s3_resource) def test_ec2_resource_return_pass(gen_ec2_resource): @beartype def func() -> EC2ServiceResource: return gen_ec2_resource func() def test_ec2_resource_return_fail(gen_s3_resource): with pytest.raises( (BeartypeCallHintPepReturnException, BeartypeDecorHintPep484585Exception) ): @beartype def func() -> EC2ServiceResource: return gen_s3_resource func()
20.040816
81
0.658859
187
1,964
6.57754
0.139037
0.045528
0.065041
0.052033
0.754472
0.59187
0.518699
0.386992
0
0
0
0.036625
0.221487
1,964
97
82
20.247423
0.767822
0.07332
0
0.542373
0
0
0
0
0
0
0
0
0
1
0.271186
false
0.135593
0.067797
0.067797
0.40678
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
9f952aae828334e0efd2771e093d18d52c4ad4a7
230
py
Python
solutions/130_solution_05.py
UFResearchComputing/py4ai
db7f80614f26274ec18556d56ea9f549c463165a
[ "CC-BY-4.0" ]
null
null
null
solutions/130_solution_05.py
UFResearchComputing/py4ai
db7f80614f26274ec18556d56ea9f549c463165a
[ "CC-BY-4.0" ]
null
null
null
solutions/130_solution_05.py
UFResearchComputing/py4ai
db7f80614f26274ec18556d56ea9f549c463165a
[ "CC-BY-4.0" ]
1
2021-04-27T09:50:54.000Z
2021-04-27T09:50:54.000Z
def first_negative(values): for v in values: if v<0: return v # If an empty list is passed to this function, it returns `None`: my_list = [] print(first_negative(my_list)
23
66
0.552174
32
230
3.84375
0.71875
0.211382
0
0
0
0
0
0
0
0
0
0.006944
0.373913
230
10
67
23
0.847222
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0.166667
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
1
0
0
0
0
0
0
0
0
2
9f95821914a38c9e5fa3635e4ff975b40a81a782
680
py
Python
.config/qtile/modules/core/screens.py
jx11r/dotfiles
fcc925dd184892198deae60e4113c215fccfa7a9
[ "MIT" ]
7
2021-09-11T00:27:23.000Z
2022-01-26T12:50:31.000Z
.config/qtile/modules/core/screens.py
jx11r/dotfiles
fcc925dd184892198deae60e4113c215fccfa7a9
[ "MIT" ]
null
null
null
.config/qtile/modules/core/screens.py
jx11r/dotfiles
fcc925dd184892198deae60e4113c215fccfa7a9
[ "MIT" ]
2
2022-01-09T16:51:41.000Z
2022-01-26T21:35:05.000Z
# --==[ Screens ]==-- from libqtile import bar from libqtile.config import Screen from ..utils.settings import wallpaper from ..extras.widgets import widgets screens = [ Screen( wallpaper = wallpaper, wallpaper_mode = 'fill', top = bar.Bar( # Source in widgets.py widgets, # Bar Size 20, # Background Color background = "#00000000", # Margin margin = [9, 15, 0, 15], # Transparency opacity = 1, ), ), Screen( wallpaper = wallpaper, wallpaper_mode = 'fill', # top = bar.Bar() ), ]
18.378378
38
0.489706
60
680
5.516667
0.5
0.217523
0.145015
0.199396
0.302115
0.302115
0.302115
0.302115
0.302115
0
0
0.042079
0.405882
680
36
39
18.888889
0.777228
0.15
0
0.428571
0
0
0.029825
0
0
0
0
0
0
1
0
false
0
0.190476
0
0.190476
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
9f97eda032d59779e4adc2cc5c75750de6d24a2c
723
py
Python
intermol/forces/torsion_torsion_CMAP.py
jpthompson17/InterMol
9289ea770bc2d069482bf5fa74dceea4c14d0e4b
[ "MIT" ]
null
null
null
intermol/forces/torsion_torsion_CMAP.py
jpthompson17/InterMol
9289ea770bc2d069482bf5fa74dceea4c14d0e4b
[ "MIT" ]
null
null
null
intermol/forces/torsion_torsion_CMAP.py
jpthompson17/InterMol
9289ea770bc2d069482bf5fa74dceea4c14d0e4b
[ "MIT" ]
null
null
null
from intermol.decorators import * class TorsionTorsionCMAP(object): @accepts_compatible_units(None, None, None, None, None, None, None, None, None, None) def __init__(self, atom1, atom2, atom3, atom4, atom5, atom6, atom7, atom8, type, chart): """ """ self.type = type self.atom1 = atom1 self.atom2 = atom2 self.atom3 = atom3 self.atom4 = atom4 self.atom5 = atom5 self.atom6 = atom6 self.atom7 = atom7 self.atom8 = atom8 self.chart = chart def getparameters(self): return (self.atom1, self.atom2, self.atom3, self.atom4, self.atom5, self.atom6, self.atom7, self.atom8, self.type, self.chart)
30.125
134
0.605809
87
723
4.965517
0.298851
0.166667
0.222222
0.259259
0.092593
0.092593
0.092593
0.092593
0.092593
0
0
0.061776
0.283541
723
23
135
31.434783
0.772201
0
0
0
0
0
0
0
0
0
0
0
0
1
0.117647
false
0
0.058824
0.058824
0.294118
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
9fa75ad8fd9d506ae24046c05570702c53d633a2
11,695
py
Python
preprocess.py
sdc17/NaivePinYin
30301de4289d022160e121338c1b9e337f6ed5af
[ "MIT" ]
null
null
null
preprocess.py
sdc17/NaivePinYin
30301de4289d022160e121338c1b9e337f6ed5af
[ "MIT" ]
null
null
null
preprocess.py
sdc17/NaivePinYin
30301de4289d022160e121338c1b9e337f6ed5af
[ "MIT" ]
null
null
null
#-*- coding : utf-8-*- import os import json import yaml import glob import jieba import pickle import datetime import argparse from collections import Counter from concurrent.futures import ProcessPoolExecutor, Executor, as_completed def task_one_gram(news): gram1 = {} with open('./training/pinyin_table/一二级汉字表.txt', encoding='gbk') as f: keys = list(f.read().replace('\n', '')) for key in keys: gram1[key] = 0 for line in open(news, 'r', encoding='gbk', errors='ignore'): try: content = json.loads(line) except: continue info = content['html'] + content['title'] word_dict = Counter(info) for key, value in word_dict.items(): if gram1.get(key) != None: gram1[key] += value return gram1 def one_gram(): news = glob.glob('./training/sina_news_gbk/*.txt') gram1 = {} with ProcessPoolExecutor() as executor: for results in executor.map(task_one_gram, news): for key, value in results.items(): gram1[key] = gram1.get(key, 0) + value with open('./data/1gram.pkl', 'wb') as f: pickle.dump(gram1, f) # with open('./data/1gram.yaml', 'w', encoding='utf-8') as f: # yaml.dump(gram1, f, default_flow_style=False, allow_unicode=True) def task_two_gram(news): gram1 = {} gram2 = {} cnt_s = 0 cnt_t = 0 with open('./data/1gram.pkl','rb') as f: gram1 = pickle.load(f) for line in open(news, 'r', encoding='gbk', errors='ignore'): try: content = json.loads(line) except: continue info = content['html'] + content['title'] info_len = len(info) for i in range(info_len - 1): key = None if i == 0 and gram1.get(info[0]): key = ''.join(['s', info[0]]) cnt_s += 1 elif i > 0 and gram1.get(info[i]) and not gram1.get(info[i - 1]): key = ''.join(['s', info[i]]) cnt_s += 1 elif gram1.get(info[i]) and not gram1.get(info[i + 1]): key = ''.join([info[i], 't']) cnt_t += 1 elif i == info_len - 2 and gram1.get(info[i + 1]): key = ''.join([info[i + 1], 't']) cnt_t += 1 if key: gram2[key] = gram2.get(key, 0) + 1 if gram1.get(info[i]) and gram1.get(info[i + 1]): key = ''.join([info[i], info[i + 1]]) gram2[key] = gram2.get(key, 0) + 1 return (gram2, cnt_s, cnt_t) def two_gram(): news = glob.glob('./training/sina_news_gbk/*.txt') gram1 = {} gram2 = {} cnt_s = 0 cnt_t = 0 with ProcessPoolExecutor() as executor: for results in executor.map(task_two_gram, news): for key, value in results[0].items(): gram2[key] = gram2.get(key, 0) + value cnt_s += results[1] cnt_t += results[2] with open('./data/1gram.pkl','rb') as f: gram1 = pickle.load(f) gram1['s'] = cnt_s gram1['t'] = cnt_t with open('./data/1gram.pkl', 'wb') as f: pickle.dump(gram1, f) # with open('./data/1gram.yaml', 'w', encoding='utf-8') as f: # yaml.dump(gram1, f, default_flow_style=False, allow_unicode=True) with open('./data/2gram.pkl', 'wb') as f: pickle.dump(gram2, f) # with open('./data/2gram.yaml', 'w', encoding='utf-8') as f: # yaml.dump(gram2, f, default_flow_style=False, allow_unicode=True) def task_three_gram(news): gram1 = {} gram3 = {} cnt_s = 0 cnt_t = 0 with open('./data/1gram.pkl','rb') as f: gram1 = pickle.load(f) for line in open(news, 'r', encoding='gbk', errors='ignore'): try: content = json.loads(line) except: continue info = content['html'] + content['title'] info_len = len(info) for i in range(info_len - 2): key = '' if i == 0 and gram1.get(info[0]) and gram1.get(info[1]): key = ''.join(['s', info[0], info[1]]) cnt_s += 1 elif i > 1 and gram1.get(info[i]) and gram1.get(info[i - 1]) and not gram1.get(info[i - 2]): key = ''.join(['s', info[i - 1], info[i]]) cnt_s += 1 elif gram1.get(info[i]) and gram1.get(info[i + 1]) and not gram1.get(info[i + 2]): key = ''.join([info[i], info[i + 1], 't']) cnt_t += 1 elif i == info_len - 3 and gram1.get(info[i + 1]) and gram1.get(info[i + 2]): key = ''.join([info[i + 1], info[i + 2], 't']) cnt_t += 1 if key: gram3[key] = gram3.get(key, 0) + 1 if gram1.get(info[i]) and gram1.get(info[i + 1]) and gram1.get(info[i + 2]): key = ''.join([info[i], info[i + 1], info[i + 2]]) gram3[key] = gram3.get(key, 0) + 1 return (gram3, cnt_s, cnt_t) def three_gram(rank): news = glob.glob('./training/sina_news_gbk/*.txt') gram1 = {} gram3 = {} cnt_s = 0 cnt_t = 0 with ProcessPoolExecutor() as executor: for results in executor.map(task_three_gram, news): for key, value in results[0].items(): gram3[key] = gram3.get(key, 0) + value cnt_s += results[1] cnt_t += results[2] with open('./data/1gram.pkl','rb') as f: gram1 = pickle.load(f) gram1['s'] = cnt_s gram1['t'] = cnt_t with open('./data/1gram.pkl', 'wb') as f: pickle.dump(gram1, f) # with open('./data/1gram.yaml', 'w', encoding='utf-8') as f: # yaml.dump(gram1, f, default_flow_style=False, allow_unicode=True) # Select top rank% features for valid features gram3 = dict(sorted(gram3.items(), key = lambda x: x[1], reverse = True)[:int(len(gram3)*rank)]) if rank == 1.0: with open('./data/3gram_whole.pkl', 'wb') as f: pickle.dump(gram3, f) # with open('./data/3gram_whole.yaml', 'w', encoding='utf-8') as f: # yaml.dump(gram3, f, default_flow_style=False, allow_unicode=True) else: with open('./data/3gram.pkl', 'wb') as f: pickle.dump(gram3, f) # with open('./data/3gram.yaml', 'w', encoding='utf-8') as f: # yaml.dump(gram3, f, default_flow_style=False, allow_unicode=True) def task_one_word(news): word1 = {} gram1 = {} with open('./data/1gram.pkl','rb') as f: gram1 = pickle.load(f) for line in open(news, 'r', encoding='gbk', errors='ignore'): try: content = json.loads(line) except: continue info = content['html'] + content['title'] seg = jieba.lcut(info, cut_all=False, HMM=True) word_dict = Counter(seg) for key, value in word_dict.items(): valid = True for i in key: if not gram1.get(i) or i == 's' or i == 't': valid = False break if valid: word1[key] = word1.get(key, 0) + value return word1 def one_word(): news = glob.glob('./training/sina_news_gbk/*.txt') word1 = {} with ProcessPoolExecutor() as executor: for results in executor.map(task_one_word, news): for key, value in results.items(): word1[key] = word1.get(key, 0) + value with open('./data/1word.pkl', 'wb') as f: pickle.dump(word1, f) # with open('./data/1word.yaml', 'w', encoding='utf-8') as f: # yaml.dump(word1, f, default_flow_style=False, allow_unicode=True) def task_two_word(news): word1 = {} word2 = {} cnt_s = 0 cnt_t = 0 with open('./data/1word.pkl','rb') as f: word1 = pickle.load(f) for line in open(news, 'r', encoding='gbk', errors='ignore'): try: content = json.loads(line) except: continue info = content['html'] + content['title'] info_len = len(info) seg = jieba.lcut(info, cut_all=False, HMM=True) # seg = [x for x in _seg if word1.get(x)] seg_len = len(seg) for i in range(seg_len - 1): key = None if i == 0 and word1.get(seg[0]): key = ''.join(['s_', seg[0]]) cnt_s += 1 elif i > 0 and word1.get(seg[i]) and not word1.get(seg[i - 1]): key = ''.join(['s_', seg[i]]) cnt_s += 1 elif word1.get(seg[i]) and not word1.get(seg[i + 1]): key = ''.join([seg[i], '_t']) cnt_t += 1 elif i == seg_len - 2 and word1.get(seg[i + 1]): key = ''.join([seg[i + 1], '_t']) cnt_t += 1 if key: word2[key] = word2.get(key, 0) + 1 if word1.get(seg[i]) and word1.get(seg[i + 1]): key = ''.join([seg[i], '_', seg[i + 1]]) word2[key] = word2.get(key, 0) + 1 return (word2, cnt_s, cnt_t) def two_word(rank): news = glob.glob('./training/sina_news_gbk/*.txt') word1 = {} word2 = {} cnt_s = 0 cnt_t = 0 with ProcessPoolExecutor() as executor: for results in executor.map(task_two_word, news): for key, value in results[0].items(): word2[key] = word2.get(key, 0) + value cnt_s += results[1] cnt_t += results[2] with open('./data/1word.pkl','rb') as f: word1 = pickle.load(f) word1['s'] = cnt_s word1['t'] = cnt_t with open('./data/1word.pkl', 'wb') as f: pickle.dump(word1, f) # with open('./data/1word.yaml', 'w', encoding='utf-8') as f: # yaml.dump(word1, f, default_flow_style=False, allow_unicode=True) # Select top rank% features for valid features word2 = dict(sorted(word2.items(), key = lambda x: x[1], reverse = True)[:int(len(word2)*rank)]) if rank == 1.0: with open('./data/2word_whole.pkl', 'wb') as f: pickle.dump(word2, f) # with open('./data/2word_whole.yaml', 'w', encoding='utf-8') as f: # yaml.dump(word2, f, default_flow_style=False, allow_unicode=True) else: with open('./data/2word.pkl', 'wb') as f: pickle.dump(word2, f) # with open('./data/2word.yaml', 'w', encoding='utf-8') as f: # yaml.dump(word2, f, default_flow_style=False, allow_unicode=True) if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("--model_type", default='3c', type=str, choices=['2c', '3c', '2w'], help="Available models") parser.add_argument("--rank_3c", default=0.2, type=float, help="Select rank percent of chars data for predicting") parser.add_argument("--rank_2w", default=0.25, type=float, help="Select rank percent of words data for predicting") args = parser.parse_args() print('===> Preprocessing') start = datetime.datetime.now() if args.model_type == '2c': print("Model type: binary char") one_gram() two_gram() elif args.model_type == '3c': print("Model type: ternary char") one_gram() three_gram(rank=args.rank_3c) elif args.model_type == '2w': print("Model type: binary word") jieba.enable_parallel() # one_word() two_word(rank=args.rank_2w) end = datetime.datetime.now() print('Time cost: {}'.format(end -start)) print('===> Completed!') print('-' * 20)
33.319088
119
0.524583
1,635
11,695
3.653211
0.100917
0.026787
0.054244
0.039176
0.77415
0.753725
0.732798
0.667504
0.628327
0.569228
0
0.034758
0.313638
11,695
350
120
33.414286
0.709356
0.126037
0
0.566038
0
0
0.089055
0.022362
0
0
0
0
0
1
0.037736
false
0
0.037736
0
0.09434
0.026415
0
0
0
null
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2