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
c2eaae72eed717131734f7785522a0d1feadcb2a
45
py
Python
api/web/__init__.py
matheus-mileski/schoolMonitor
d22bcbac1785d77f6c1de5a6919648c6f8469f82
[ "MIT" ]
2
2018-11-01T19:36:55.000Z
2019-08-19T05:45:48.000Z
api/web/__init__.py
matheus-mileski/schoolMonitor
d22bcbac1785d77f6c1de5a6919648c6f8469f82
[ "MIT" ]
13
2020-12-07T13:32:29.000Z
2022-02-10T09:35:46.000Z
api/web/__init__.py
matheus-mileski/schoolMonitor
d22bcbac1785d77f6c1de5a6919648c6f8469f82
[ "MIT" ]
1
2019-03-01T12:02:08.000Z
2019-03-01T12:02:08.000Z
from . import mqtt mqtt.client.loop_start()
11.25
24
0.755556
7
45
4.714286
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.133333
45
3
25
15
0.846154
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
6c0fdb01d2cc85a8da879946113775db2e918584
3,365
py
Python
tests/test_run_sp.py
srianbury/pyodbc-helpers
83e000f927e9e9bc3723a9aeead5bf7916118f20
[ "MIT" ]
null
null
null
tests/test_run_sp.py
srianbury/pyodbc-helpers
83e000f927e9e9bc3723a9aeead5bf7916118f20
[ "MIT" ]
null
null
null
tests/test_run_sp.py
srianbury/pyodbc-helpers
83e000f927e9e9bc3723a9aeead5bf7916118f20
[ "MIT" ]
null
null
null
from unittest import TestCase, skipIf import os from dotenv import load_dotenv import pyodbc from pyodbch import run_sp from pyodbch.run_sp import get_query, StoredProcedureError class RunSp(TestCase): def setUp(self): load_dotenv() self.sp_name = 'USP_MY_STORED_PROCEDURE' self.list_params = [1, 'bob', 3.4] self.real_sp_name = 'USP_UNITTEST_PASS' self.fail_sp = 'USP_UNITTEST_FAIL' def test_get_query_without_params(self): sql_expected = 'SET NOCOUNT ON; DECLARE @RET int; EXEC @RET = ?; SELECT @RET;' param_expected = [self.sp_name] sql_actual, param_actual = get_query(self.sp_name) self.assertEqual(sql_expected, sql_actual) self.assertEqual(param_expected, param_actual) def test_get_query_with_params(self): sql_expected = 'SET NOCOUNT ON; DECLARE @RET int; EXEC @RET = ? ?, ?, ?; SELECT @RET;' param_expected = [self.sp_name] + self.list_params sql_actual, param_actual = get_query(self.sp_name, self.list_params) self.assertEqual(sql_expected, sql_actual) self.assertEqual(param_expected, param_actual) @skipIf(not os.getenv('HAS_DB_ACCESS'), 'No database access.') def test_run_without_params_should_pass(self): with pyodbc.connect(os.getenv('CNXN_STRING')) as cnxn: with cnxn.cursor() as cursor: try: run_sp(cursor, self.real_sp_name) except Exception: self.fail('run_sp() failed.') # make sure one record exists in the table sql = 'SELECT * FROM UNITTEST_PYODBC_RUN_SP;' cursor.execute(sql) results = cursor.fetchall() self.assertEqual(1, len(results)) # make sure the data is correct result = results[0] actual = (result.ID, result.NAME, result.NUMBER) expected = (1, 'BOB', 3.4) self.assertEqual(expected, actual) @skipIf(not os.getenv('HAS_DB_ACCESS'), 'No database access.') def test_run_with_params_should_pass(self): PARAM_ID = 7 PARAM_NAME = 'STEVE' with pyodbc.connect(os.getenv('CNXN_STRING')) as cnxn: with cnxn.cursor() as cursor: try: run_sp(cursor, self.real_sp_name, [PARAM_ID, PARAM_NAME]) except Exception: self.fail('run_sp() failed.') # make sure one record exists in the table sql = 'SELECT * FROM UNITTEST_PYODBC_RUN_SP;' cursor.execute(sql) results = cursor.fetchall() self.assertEqual(1, len(results)) # make sure the data is correct result = results[0] actual = (result.ID, result.NAME, result.NUMBER) expected = (PARAM_ID, PARAM_NAME, 3.4) self.assertEqual(expected, actual) @skipIf(not os.getenv('HAS_DB_ACCESS'), 'No database access.') def test_run_should_raise_stored_procedure_error(self): with pyodbc.connect(os.getenv('CNXN_STRING')) as cnxn: with cnxn.cursor() as cursor: with self.assertRaises(StoredProcedureError): run_sp(cursor, self.fail_sp)
41.54321
94
0.598811
409
3,365
4.691932
0.222494
0.02345
0.026055
0.021886
0.732152
0.724857
0.71235
0.71235
0.71235
0.71235
0
0.005575
0.306984
3,365
80
95
42.0625
0.817324
0.041902
0
0.507692
0
0.015385
0.134514
0.021435
0
0
0
0
0.138462
1
0.092308
false
0.046154
0.092308
0
0.2
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
6c23969851183b76fdabba3d79af1386b4a8cec2
294
py
Python
core/core/exceptions.py
dotHashemi/qeshm-employment
3f7bd2b50b8cae0df74c1abbb5befe1f46546dc9
[ "MIT" ]
2
2021-01-12T07:22:14.000Z
2021-01-12T15:47:00.000Z
core/core/exceptions.py
dotHashemi/qeshm-employment
3f7bd2b50b8cae0df74c1abbb5befe1f46546dc9
[ "MIT" ]
null
null
null
core/core/exceptions.py
dotHashemi/qeshm-employment
3f7bd2b50b8cae0df74c1abbb5befe1f46546dc9
[ "MIT" ]
null
null
null
from rest_framework.response import Response from core.helpers import Error class DoesNotVerify(Exception): pass class DoesNotMatch(Exception): pass class ModelExist(Exception): pass class InputDoesNotValid(Exception): pass class TimeDoesNotValid(Exception): pass
12.782609
44
0.761905
31
294
7.193548
0.516129
0.29148
0.32287
0
0
0
0
0
0
0
0
0
0.180272
294
22
45
13.363636
0.925311
0
0
0.416667
0
0
0
0
0
0
0
0
0
1
0
true
0.416667
0.166667
0
0.583333
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
1
0
0
5
6c317b07a8f7be047b3a3addf6a8513cc6b5eb68
77
py
Python
src/UQpy/sampling/stratified_sampling/strata/baseclass/__init__.py
SURGroup/UncertaintyQuantification
a94c8db47d07134ea2b3b0a3ca53ca818532c3e6
[ "MIT" ]
null
null
null
src/UQpy/sampling/stratified_sampling/strata/baseclass/__init__.py
SURGroup/UncertaintyQuantification
a94c8db47d07134ea2b3b0a3ca53ca818532c3e6
[ "MIT" ]
null
null
null
src/UQpy/sampling/stratified_sampling/strata/baseclass/__init__.py
SURGroup/UncertaintyQuantification
a94c8db47d07134ea2b3b0a3ca53ca818532c3e6
[ "MIT" ]
null
null
null
from UQpy.sampling.stratified_sampling.strata.baseclass.Strata import Strata
38.5
76
0.883117
10
77
6.7
0.7
0
0
0
0
0
0
0
0
0
0
0
0.051948
77
1
77
77
0.917808
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
6c3c221a6c545e7477b7508efcb814cecb115325
1,145
py
Python
OpenGLCffi/GL/EXT/ARB/window_pos.py
cydenix/OpenGLCffi
c78f51ae5e6b655eb2ea98f072771cf69e2197f3
[ "MIT" ]
null
null
null
OpenGLCffi/GL/EXT/ARB/window_pos.py
cydenix/OpenGLCffi
c78f51ae5e6b655eb2ea98f072771cf69e2197f3
[ "MIT" ]
null
null
null
OpenGLCffi/GL/EXT/ARB/window_pos.py
cydenix/OpenGLCffi
c78f51ae5e6b655eb2ea98f072771cf69e2197f3
[ "MIT" ]
null
null
null
from OpenGLCffi.GL import params @params(api='gl', prms=['x', 'y']) def glWindowPos2dARB(x, y): pass @params(api='gl', prms=['v']) def glWindowPos2dvARB(v): pass @params(api='gl', prms=['x', 'y']) def glWindowPos2fARB(x, y): pass @params(api='gl', prms=['v']) def glWindowPos2fvARB(v): pass @params(api='gl', prms=['x', 'y']) def glWindowPos2iARB(x, y): pass @params(api='gl', prms=['v']) def glWindowPos2ivARB(v): pass @params(api='gl', prms=['x', 'y']) def glWindowPos2sARB(x, y): pass @params(api='gl', prms=['v']) def glWindowPos2svARB(v): pass @params(api='gl', prms=['x', 'y', 'z']) def glWindowPos3dARB(x, y, z): pass @params(api='gl', prms=['v']) def glWindowPos3dvARB(v): pass @params(api='gl', prms=['x', 'y', 'z']) def glWindowPos3fARB(x, y, z): pass @params(api='gl', prms=['v']) def glWindowPos3fvARB(v): pass @params(api='gl', prms=['x', 'y', 'z']) def glWindowPos3iARB(x, y, z): pass @params(api='gl', prms=['v']) def glWindowPos3ivARB(v): pass @params(api='gl', prms=['x', 'y', 'z']) def glWindowPos3sARB(x, y, z): pass @params(api='gl', prms=['v']) def glWindowPos3svARB(v): pass
13.963415
39
0.611354
173
1,145
4.046243
0.16763
0.205714
0.251429
0.342857
0.575714
0.575714
0.575714
0.547143
0.547143
0.297143
0
0.016178
0.136245
1,145
81
40
14.135802
0.691608
0
0
0.653061
0
0
0.052493
0
0
0
0
0
0
1
0.326531
false
0.326531
0.020408
0
0.346939
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
5
6c4de6a3b8092873538031e65bf5f1d703edec73
12
py
Python
test/parse/t01.py
timmartin/skulpt
2e3a3fbbaccc12baa29094a717ceec491a8a6750
[ "MIT" ]
2,671
2015-01-03T08:23:25.000Z
2022-03-31T06:15:48.000Z
test/parse/t01.py
csev/skulpt
9aa25b7dbf29f23ee8d3140d01a6f4353d12e66f
[ "MIT" ]
972
2015-01-05T08:11:00.000Z
2022-03-29T13:47:15.000Z
test/parse/t01.py
csev/skulpt
9aa25b7dbf29f23ee8d3140d01a6f4353d12e66f
[ "MIT" ]
845
2015-01-03T19:53:36.000Z
2022-03-29T18:34:22.000Z
print x+2*3
6
11
0.666667
4
12
2
1
0
0
0
0
0
0
0
0
0
0
0.2
0.166667
12
1
12
12
0.6
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
1
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
5
6c4e17b4fe88ca5115a624a8ad9712eb6f03876d
69
py
Python
model/__init__.py
ASTC-Kekeyuan/Lilm
1aac271b91d2d701d088006b800991001f96921b
[ "MIT" ]
null
null
null
model/__init__.py
ASTC-Kekeyuan/Lilm
1aac271b91d2d701d088006b800991001f96921b
[ "MIT" ]
null
null
null
model/__init__.py
ASTC-Kekeyuan/Lilm
1aac271b91d2d701d088006b800991001f96921b
[ "MIT" ]
null
null
null
from .booklist import * from .details import * from .rating import *
17.25
23
0.73913
9
69
5.666667
0.555556
0.392157
0
0
0
0
0
0
0
0
0
0
0.173913
69
3
24
23
0.894737
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
666146de4372af213aac415d71d76291c45fcf3f
120
py
Python
lotto/admin.py
b14cknc0d3/lotto_api
6bb6a9c23076428816aa8544b0212304ebcaedf0
[ "MIT" ]
null
null
null
lotto/admin.py
b14cknc0d3/lotto_api
6bb6a9c23076428816aa8544b0212304ebcaedf0
[ "MIT" ]
null
null
null
lotto/admin.py
b14cknc0d3/lotto_api
6bb6a9c23076428816aa8544b0212304ebcaedf0
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import Saledata # Register your models here. admin.site.register(Saledata)
30
32
0.825
17
120
5.823529
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.108333
120
4
33
30
0.925234
0.216667
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
66b6750f01578307d5497924360c1c20332b7e32
2,374
py
Python
Firefly/automation/event_automation/metadata.py
Firefly-Automation/Firefly
fccf40b8f6e015ef34c292264184090eb8d860b7
[ "Apache-2.0" ]
20
2017-03-24T08:25:50.000Z
2020-07-07T16:09:34.000Z
Firefly/automation/event_automation/metadata.py
Firefly-Automation/Firefly
fccf40b8f6e015ef34c292264184090eb8d860b7
[ "Apache-2.0" ]
1
2017-11-02T17:46:48.000Z
2017-11-02T17:46:48.000Z
Firefly/automation/event_automation/metadata.py
Firefly-Automation/Firefly
fccf40b8f6e015ef34c292264184090eb8d860b7
[ "Apache-2.0" ]
5
2017-04-11T02:27:38.000Z
2020-12-11T07:44:00.000Z
AUTHOR = 'Zachary Priddy. (me@zpriddy.com)' TITLE = 'Event Automation' METADATA = { 'title': TITLE, 'author': AUTHOR, 'commands': ['execute'], 'interface': { 'trigger_types': { 'index_1': { 'context': 'and / or' }, 'index_3': { 'context': 'and / or' }, 'index_2': { 'context': 'and / or' } }, 'trigger_devices': { "index_1": { 'context': 'device_list_1', 'type': 'deviceList', 'filter': {} }, "index_2": { 'context': 'device_list_2', 'type': 'deviceList', 'filter': {} }, "index_3": { 'context': 'device_list_2', 'type': 'deviceList', 'filter': {} } }, 'action_devices': { "index_1": { 'context': 'device_list_1', 'type': 'deviceList', 'filter': {} }, "index_2": { 'context': 'device_list_2', 'type': 'deviceList', 'filter': {} }, "index_3": { 'context': 'device_list_2', 'type': 'deviceList', 'filter': {} } }, 'trigger_actions': { 'index_1': { 'context': '' }, 'index_2': { 'context': '' }, 'index_3': { 'context': '' } }, 'commands_actions': { 'index_1': { 'context': '' }, 'index_2': { 'context': '' }, 'index_3': { 'context': '' } }, 'messages': { "index_1": { 'context': 'Message to send when alert is started.', 'type': 'string' }, "index_2": { 'context': 'Message to send when alert is stopped.', 'type': 'string' }, "index_3": { 'context': 'Message to send when alert is stopped.', 'type': 'string' } }, 'delays': { 'index_1': { 'context': 'Time to delay after door opens before triggering alert. (seconds)', 'type': 'number' }, 'index_2': { 'context': 'Time to delay after door opens before triggering alert. (seconds)', 'type': 'number' }, 'index_3': { 'context': 'Time to delay after door opens before triggering alert. (seconds)', 'type': 'number' } } } }
22.609524
87
0.425864
197
2,374
4.939086
0.253807
0.043165
0.093525
0.102775
0.736896
0.736896
0.736896
0.705036
0.705036
0.705036
0
0.018828
0.395956
2,374
104
88
22.826923
0.659693
0
0
0.567308
0
0
0.444398
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
dd195b76685014605b481bb9b57f6dc063ec9c11
10,462
py
Python
modules/dbnd/src/dbnd/cli/cmd_airflow_sync.py
dmytrostriletskyi/dbnd
d4a5f5167523e80439c9d64182cdc87b40cbc48f
[ "Apache-2.0" ]
null
null
null
modules/dbnd/src/dbnd/cli/cmd_airflow_sync.py
dmytrostriletskyi/dbnd
d4a5f5167523e80439c9d64182cdc87b40cbc48f
[ "Apache-2.0" ]
null
null
null
modules/dbnd/src/dbnd/cli/cmd_airflow_sync.py
dmytrostriletskyi/dbnd
d4a5f5167523e80439c9d64182cdc87b40cbc48f
[ "Apache-2.0" ]
null
null
null
import json import logging from dbnd._core.constants import AirflowEnvironment from dbnd._core.errors.base import DatabandApiError from dbnd._core.utils.basics.text_banner import TextBanner, safe_tabulate from dbnd._vendor import click from dbnd.api.airflow_sync import ( archive_airflow_instance, create_airflow_instance, edit_airflow_instance, list_synced_airflow_instances, unarchive_airflow_instance, ) BYTES_IN_KB = 1024 logger = logging.getLogger(__name__) @click.group() @click.pass_context def airflow_sync(ctx): """Manage synced Airflow instances""" pass @airflow_sync.command("list") def list_airflow_instances(): try: instances = list_synced_airflow_instances() except (LookupError, DatabandApiError) as e: logger.warning(e) else: print_table("Synced Airflow instances", instances) def print_table(header, instances_list): banner = TextBanner(header) banner.write(build_instances_table(instances_list)) logger.info(banner.get_banner_str()) def build_instances_table(instances_data): extract_keys = ( "name", "is_sync_enabled", "tracking_source_uid", "base_url", "external_url", "api_mode", ) headers = ( "Name", "Active", "Tracking source UID", "Base url", "External url", "Api Mode", "Instance Type", ) table_data = [] for server_info in instances_data: instance_row = [getattr(server_info, key, "") for key in extract_keys] instance_row.append( "Airflow" if getattr(server_info, "fetcher") == "web" else "GC Composer" ) table_data.append(instance_row) return safe_tabulate(table_data, headers) @airflow_sync.command() @click.option( "--url", "-u", help="base url for instance", type=click.STRING, required=True ) @click.option( "--external-url", "-e", help="External url for instance", type=click.STRING, default=None, ) @click.option( "--fetcher", "-f", help="Fetcher to use for data (web, db)", type=click.Choice(["web", "db"], case_sensitive=False), default="db", ) @click.option( "--airflow-mode", "-t", help="Airflow mode", type=click.Choice(AirflowEnvironment.all_values()), default=AirflowEnvironment.ON_PREM.value, ) @click.option( "--env", help="Environment", type=click.STRING, default=None, ) @click.option( "--include-sources", help="Monitor source code for tasks", type=click.BOOL, is_flag=True, ) @click.option( "--dag-ids", help="List of specific dag ids (separated with comma) that monitor will fetch only from them", type=click.STRING, default=None, ) @click.option( "--last-seen-dag-run-id", help="Id of the last dag run seen in the Airflow database", type=click.STRING, default=None, ) @click.option( "--last-seen-log-id", help="Id of the last log seen in the Airflow database", type=click.STRING, default=None, ) @click.option( "--name", help="Name for the syncer", type=click.STRING, default=None, ) @click.option( "--generate-token", help="Generate access token for the syncer, value is token lifespan (in seconds)", type=click.INT, default=None, ) @click.option( "--config-file-output", help="Store syncer config json to file", type=click.File("w"), default="-", ) @click.option( "--with-auto-alerts", help="Create syncer with auto alerts config", type=click.BOOL, is_flag=True, ) @click.option( "--include-logs-bytes-from-head", help="Include the number of bytes from the head of the log file", type=click.IntRange(min=0, max=8096), default=0, ) @click.option( "--include-logs-bytes-from-end", help="Include the number of bytes from the end of the log file", type=click.IntRange(min=0, max=8096), default=0, ) @click.option( "--dag-run-bulk-size", help="DAG run bulk size for the syncer", type=click.INT, default=None, ) @click.option( "--start-time-window", help="Start time window for the syncer (in days)", type=click.INT, default=None, ) def add( url, external_url, fetcher, airflow_mode, env, include_sources, dag_ids, last_seen_dag_run_id, last_seen_log_id, name, generate_token, config_file_output, with_auto_alerts, include_logs_bytes_from_head, include_logs_bytes_from_end, dag_run_bulk_size, start_time_window, ): try: if not env: env = name system_alert_definitions = { "failed_state": bool(with_auto_alerts), "ml_run_duration": bool(with_auto_alerts), "run_schema_change": bool(with_auto_alerts), } monitor_config = { "include_sources": bool(include_sources), "log_bytes_from_end": include_logs_bytes_from_end * BYTES_IN_KB, "log_bytes_from_head": include_logs_bytes_from_head * BYTES_IN_KB, } if dag_run_bulk_size: monitor_config["dag_run_bulk_size"] = dag_run_bulk_size if start_time_window: monitor_config["start_time_window"] = start_time_window config_json = create_airflow_instance( url, external_url, fetcher, airflow_mode, env, dag_ids, last_seen_dag_run_id, last_seen_log_id, name, generate_token, system_alert_definitions, monitor_config, ) if config_file_output: json.dump(config_json, config_file_output, indent=4) except DatabandApiError as e: logger.warning("failed with - {}".format(e.response)) else: logger.info("Successfully added %s", url) @airflow_sync.command() @click.option( "--tracking-source-uid", "-u", help='Tracking source uid of the edited airflow syncer. (you can get this with the "list" command)', type=click.STRING, required=True, ) @click.option( "--url", "-u", help="base url for instance", type=click.STRING, required=True ) @click.option( "--external-url", "-e", help="External url for instance", type=click.STRING, default=None, ) @click.option( "--fetcher", "-f", help="Fetcher to use for data (web, db)", type=click.Choice(["web", "db"], case_sensitive=False), default="db", ) @click.option( "--airflow-mode", "-t", help="Airflow mode", type=click.Choice(AirflowEnvironment.all_values()), default=AirflowEnvironment.ON_PREM.value, ) @click.option( "--env", help="Environment", type=click.STRING, default=None, ) @click.option( "--include-sources", help="Don't monitor source code for tasks", type=click.BOOL, is_flag=True, ) @click.option( "--dag-ids", help="List of specific dag ids (separated with comma) that monitor will fetch only from them", type=click.STRING, default=None, ) @click.option( "--last-seen-dag-run-id", help="Id of the last dag run seen in the Airflow database", type=click.STRING, default=None, ) @click.option( "--last-seen-log-id", help="Id of the last log seen in the Airflow database", type=click.STRING, default=None, ) @click.option( "--name", help="Name for the syncer", type=click.STRING, default=None, ) @click.option( "--with-auto-alerts", help="Create syncer with auto alerts config", type=click.BOOL, is_flag=True, ) @click.option( "--include-logs-bytes-from-head", help="Include the number of bytes from the head of the log file", type=click.IntRange(min=0, max=8096), default=0, ) @click.option( "--include-logs-bytes-from-end", help="Include the number of bytes from the end of the log file", type=click.IntRange(min=0, max=8096), default=0, ) @click.option( "--dag-run-bulk-size", help="DAG run bulk size for the syncer", type=click.INT, default=None, ) @click.option( "--start-time-window", help="Start time window for the syncer (in days)", type=click.INT, default=None, ) def edit( tracking_source_uid, url, external_url, fetcher, airflow_mode, env, include_sources, dag_ids, last_seen_dag_run_id, last_seen_log_id, name, with_auto_alerts, include_logs_bytes_from_head, include_logs_bytes_from_end, dag_run_bulk_size, start_time_window, ): try: system_alert_definitions = { "failed_state": bool(with_auto_alerts), "ml_run_duration": bool(with_auto_alerts), "run_schema_change": bool(with_auto_alerts), } monitor_config = { "include_sources": bool(include_sources), "log_bytes_from_end": include_logs_bytes_from_end * BYTES_IN_KB, "log_bytes_from_head": include_logs_bytes_from_head * BYTES_IN_KB, } if dag_run_bulk_size: monitor_config["dag_run_bulk_size"] = dag_run_bulk_size if start_time_window: monitor_config["start_time_window"] = start_time_window edit_airflow_instance( tracking_source_uid, url, external_url, fetcher, airflow_mode, env, dag_ids, last_seen_dag_run_id, last_seen_log_id, name, system_alert_definitions, monitor_config, ) except DatabandApiError as e: logger.warning("failed with - {}".format(e.response)) else: logger.info("Successfully edited %s", url) @airflow_sync.command() @click.option( "--url", "-u", help="base url of an instance to archive", type=click.STRING, required=True, ) def archive(url): try: archive_airflow_instance(url) except DatabandApiError as e: logger.warning("failed with - {}".format(e.response)) else: logger.info("Archived instance %s", url) @airflow_sync.command() @click.option( "--url", "-u", help="base url of an instance to unarchive", type=click.STRING, required=True, ) def unarchive(url): try: unarchive_airflow_instance(url) except DatabandApiError as e: logger.warning("failed with - {}".format(e.response)) else: logger.info("Unarchived instance %s", url)
25.331719
104
0.636972
1,334
10,462
4.786357
0.143928
0.060298
0.039937
0.051684
0.760689
0.744714
0.735317
0.720595
0.720595
0.707439
0
0.00365
0.240585
10,462
412
105
25.393204
0.8
0.002963
0
0.673629
0
0.002611
0.245947
0.017554
0
0
0
0
0
1
0.020888
false
0.005222
0.018277
0
0.041775
0.005222
0
0
0
null
0
0
0
0
1
1
1
1
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
5
dd42a089dadab539b94d6cc325db0c0b2655c22a
89
py
Python
results/__init__.py
bmorris3/stsp_osg_results
655ccf972193941ef148b62f861cbe5e58650f6b
[ "MIT" ]
null
null
null
results/__init__.py
bmorris3/stsp_osg_results
655ccf972193941ef148b62f861cbe5e58650f6b
[ "MIT" ]
null
null
null
results/__init__.py
bmorris3/stsp_osg_results
655ccf972193941ef148b62f861cbe5e58650f6b
[ "MIT" ]
null
null
null
from __future__ import absolute_import from .results import * from .lightcurve import *
17.8
38
0.808989
11
89
6.090909
0.545455
0.298507
0
0
0
0
0
0
0
0
0
0
0.146067
89
4
39
22.25
0.881579
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
dd7c248d67d6cb3c3c59b85a57d4039fdce79ae1
45
py
Python
Mr.Statapython/statapython/stataspoon/__init__.py
Lydwen/Mr.Statamutation
2e8da0c84e65c58960dbb02286c67fd79895e4fa
[ "MIT" ]
1
2016-02-05T07:35:51.000Z
2016-02-05T07:35:51.000Z
Mr.Statapython/statapython/stataspoon/__init__.py
Lydwen/Mr.Statamutation
2e8da0c84e65c58960dbb02286c67fd79895e4fa
[ "MIT" ]
null
null
null
Mr.Statapython/statapython/stataspoon/__init__.py
Lydwen/Mr.Statamutation
2e8da0c84e65c58960dbb02286c67fd79895e4fa
[ "MIT" ]
null
null
null
from .mutationstester import MutationsTester
22.5
44
0.888889
4
45
10
0.75
0
0
0
0
0
0
0
0
0
0
0
0.088889
45
1
45
45
0.97561
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
dd931826ebc34fd4b714250a5db0a4f95695868d
89
py
Python
backend/medicos/admin.py
diego-feitosa/desafio
c4aecb9b612a2d9e8b346b8aaecd92208252378a
[ "MIT" ]
null
null
null
backend/medicos/admin.py
diego-feitosa/desafio
c4aecb9b612a2d9e8b346b8aaecd92208252378a
[ "MIT" ]
null
null
null
backend/medicos/admin.py
diego-feitosa/desafio
c4aecb9b612a2d9e8b346b8aaecd92208252378a
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import Medico admin.site.register(Medico)
17.8
32
0.820225
13
89
5.615385
0.692308
0
0
0
0
0
0
0
0
0
0
0
0.11236
89
4
33
22.25
0.924051
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
dd953416191668d3e8bc418decf6385e6dd51be3
81
py
Python
addition_module/DMUE/utils/__init__.py
subin4420/doitagain
264a1f8a548aa7d5e2034bfe1432b8816445a445
[ "Apache-2.0" ]
null
null
null
addition_module/DMUE/utils/__init__.py
subin4420/doitagain
264a1f8a548aa7d5e2034bfe1432b8816445a445
[ "Apache-2.0" ]
null
null
null
addition_module/DMUE/utils/__init__.py
subin4420/doitagain
264a1f8a548aa7d5e2034bfe1432b8816445a445
[ "Apache-2.0" ]
null
null
null
from .easylog import write_config_into_log from .ramp import ramp_up, ramp_down
20.25
42
0.839506
14
81
4.5
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.123457
81
3
43
27
0.887324
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
06fc8dd0da89732e2d63916d2bc7ed2bfbb61241
92
py
Python
pyhybro/OptimizationResult/__init__.py
pyHYBRO-dev/pyHYBRO
1d33bb1d07d0ab78b096faedddca5fd3989d9bb4
[ "BSD-3-Clause" ]
1
2020-12-13T18:51:22.000Z
2020-12-13T18:51:22.000Z
pyhybro/OptimizationResult/__init__.py
HYBRO-dev/HYBRO
1d33bb1d07d0ab78b096faedddca5fd3989d9bb4
[ "BSD-3-Clause" ]
4
2020-12-14T20:52:12.000Z
2021-01-21T16:40:09.000Z
pyhybro/OptimizationResult/__init__.py
pyHYBRO-dev/pyHYBRO
1d33bb1d07d0ab78b096faedddca5fd3989d9bb4
[ "BSD-3-Clause" ]
null
null
null
from .reference_set import ReferenceSet from .optimization_result import OptimizationResult
30.666667
51
0.891304
10
92
8
0.8
0
0
0
0
0
0
0
0
0
0
0
0.086957
92
2
52
46
0.952381
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
06ffa3aef7ef0e35182d0c0731fe764a95e1eaf7
136
py
Python
animatplot/__init__.py
eric-erki/animatplot
38a24c3301fbb82a237758fc42f6f4d59275721f
[ "MIT" ]
null
null
null
animatplot/__init__.py
eric-erki/animatplot
38a24c3301fbb82a237758fc42f6f4d59275721f
[ "MIT" ]
null
null
null
animatplot/__init__.py
eric-erki/animatplot
38a24c3301fbb82a237758fc42f6f4d59275721f
[ "MIT" ]
null
null
null
from ._version import __version__ from .timeline import Timeline from .animations.animation import Animation from . import blocks, util
27.2
43
0.830882
17
136
6.352941
0.470588
0
0
0
0
0
0
0
0
0
0
0
0.125
136
4
44
34
0.907563
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
6600527dc786cdfa43a128907c06ad487fa014af
174
py
Python
tweet_analyse/tweet_analyse/env_settings.py
rahulz/tweet-analyse-api
1c3031691e91093cabac8066619bf2ccd5c0e8c9
[ "Apache-2.0" ]
null
null
null
tweet_analyse/tweet_analyse/env_settings.py
rahulz/tweet-analyse-api
1c3031691e91093cabac8066619bf2ccd5c0e8c9
[ "Apache-2.0" ]
null
null
null
tweet_analyse/tweet_analyse/env_settings.py
rahulz/tweet-analyse-api
1c3031691e91093cabac8066619bf2ccd5c0e8c9
[ "Apache-2.0" ]
null
null
null
SOCIAL_AUTH_TWITTER_KEY = 'LXgJdyaJRF0PeGlKakqg1HRF9' SOCIAL_AUTH_TWITTER_SECRET = 'rjGbkkELyUhGt3GiEUUIW2A2S2yFtyB2GXmf23nDrgcqoQPZ5R' SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/'
34.8
81
0.885057
15
174
9.6
0.666667
0.208333
0.236111
0
0
0
0
0
0
0
0
0.067073
0.057471
174
4
82
43.5
0.810976
0
0
0
0
0
0.439306
0.433526
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
6629bbef038b947ad9adf13e4dd1d8e3d2bd203b
76
py
Python
Chapter 02/ch2_32.py
bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE
f6a4194684515495d00aa38347a725dd08f39a0c
[ "MIT" ]
null
null
null
Chapter 02/ch2_32.py
bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE
f6a4194684515495d00aa38347a725dd08f39a0c
[ "MIT" ]
null
null
null
Chapter 02/ch2_32.py
bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE
f6a4194684515495d00aa38347a725dd08f39a0c
[ "MIT" ]
null
null
null
import math print(math.log10(1300)) # using print() to print the result
19
36
0.710526
12
76
4.5
0.75
0
0
0
0
0
0
0
0
0
0
0.096774
0.184211
76
4
36
19
0.774194
0.434211
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
1
0
5
663847fc931c00eda13876dc03d71e573f9b64fe
87
py
Python
src/parish_scraper/__init__.py
hgdyeo/parish_scraper
ab59867a102392bc7dfd7b36bd5d4da6f238ee8d
[ "MIT" ]
null
null
null
src/parish_scraper/__init__.py
hgdyeo/parish_scraper
ab59867a102392bc7dfd7b36bd5d4da6f238ee8d
[ "MIT" ]
null
null
null
src/parish_scraper/__init__.py
hgdyeo/parish_scraper
ab59867a102392bc7dfd7b36bd5d4da6f238ee8d
[ "MIT" ]
null
null
null
from .ancestry import AncestryScraper from .family_search import FamilySearchScraper
29
47
0.862069
9
87
8.222222
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.114943
87
2
48
43.5
0.961039
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
b0f0f001b77fff351c956d1e2d89c4c5e5644557
2,364
py
Python
Algo and DSA/LeetCode-Solutions-master/Python/distribute-candies-to-people.py
Sourav692/FAANG-Interview-Preparation
f523e5c94d582328b3edc449ea16ac6ab28cdc81
[ "Unlicense" ]
3,269
2018-10-12T01:29:40.000Z
2022-03-31T17:58:41.000Z
Algo and DSA/LeetCode-Solutions-master/Python/distribute-candies-to-people.py
Sourav692/FAANG-Interview-Preparation
f523e5c94d582328b3edc449ea16ac6ab28cdc81
[ "Unlicense" ]
53
2018-12-16T22:54:20.000Z
2022-02-25T08:31:20.000Z
Algo and DSA/LeetCode-Solutions-master/Python/distribute-candies-to-people.py
Sourav692/FAANG-Interview-Preparation
f523e5c94d582328b3edc449ea16ac6ab28cdc81
[ "Unlicense" ]
1,236
2018-10-12T02:51:40.000Z
2022-03-30T13:30:37.000Z
# Time: O(n + logc), c is the number of candies # Space: O(1) class Solution(object): def distributeCandies(self, candies, num_people): """ :type candies: int :type num_people: int :rtype: List[int] """ # find max integer p s.t. sum(1 + 2 + ... + p) <= C # => remaining : 0 <= C-(1+p)*p/2 < p+1 # => -2p-2 < p^2+p-2C <= 0 # => 2C+1/4 < (p+3/2)^2 and (p+1/2)^2 <= 2C+1/4 # => sqrt(2C+1/4)-3/2 < p <= sqrt(2C+1/4)-1/2 # => p = floor(sqrt(2C+1/4)-1/2) p = int((2*candies + 0.25)**0.5 - 0.5) remaining = candies - (p+1)*p//2 rows, cols = divmod(p, num_people) result = [0]*num_people for i in xrange(num_people): result[i] = (i+1)*(rows+1) + (rows*(rows+1)//2)*num_people if i < cols else \ (i+1)*rows + ((rows-1)*rows//2)*num_people result[cols] += remaining return result # Time: O(n + logc), c is the number of candies # Space: O(1) class Solution2(object): def distributeCandies(self, candies, num_people): """ :type candies: int :type num_people: int :rtype: List[int] """ # find max integer p s.t. sum(1 + 2 + ... + p) <= C left, right = 1, candies while left <= right: mid = left + (right-left)//2 if not ((mid <= candies*2 // (mid+1))): right = mid-1 else: left = mid+1 p = right remaining = candies - (p+1)*p//2 rows, cols = divmod(p, num_people) result = [0]*num_people for i in xrange(num_people): result[i] = (i+1)*(rows+1) + (rows*(rows+1)//2)*num_people if i < cols else \ (i+1)*rows + ((rows-1)*rows//2)*num_people result[cols] += remaining return result # Time: O(sqrt(c)), c is the number of candies # Space: O(1) class Solution3(object): def distributeCandies(self, candies, num_people): """ :type candies: int :type num_people: int :rtype: List[int] """ result = [0]*num_people i = 0 while candies != 0: result[i % num_people] += min(candies, i+1) candies -= min(candies, i+1) i += 1 return result
31.945946
89
0.480118
338
2,364
3.304734
0.183432
0.145031
0.080573
0.03581
0.734109
0.734109
0.734109
0.714414
0.714414
0.714414
0
0.055811
0.355753
2,364
73
90
32.383562
0.67761
0.269459
0
0.552632
0
0
0
0
0
0
0
0
0
1
0.078947
false
0
0
0
0.236842
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
9fddb2fea9ab674bfa9b9f4c0e75ca16bf82cc6a
279
py
Python
tests/test_converters.py
ostrokach/protein-adjacency-net
fd3ad0b9034eb61b0187752c1f38f7eed1a8f1dc
[ "MIT" ]
1
2022-01-16T12:06:13.000Z
2022-01-16T12:06:13.000Z
tests/test_converters.py
ostrokach/protein-adjacency-net
fd3ad0b9034eb61b0187752c1f38f7eed1a8f1dc
[ "MIT" ]
null
null
null
tests/test_converters.py
ostrokach/protein-adjacency-net
fd3ad0b9034eb61b0187752c1f38f7eed1a8f1dc
[ "MIT" ]
null
null
null
import pytest from pagnn.utils.converters import str_to_seconds @pytest.mark.parametrize("time_str, time_seconds", [("1d,2h,21m,1s", 94861), ("1-02:21:01", 94861)]) def test_str_to_seconds(time_str: str, time_seconds: int): assert str_to_seconds(time_str) == time_seconds
31
100
0.756272
46
279
4.304348
0.543478
0.075758
0.181818
0.181818
0.191919
0
0
0
0
0
0
0.087649
0.100358
279
8
101
34.875
0.701195
0
0
0
0
0
0.157706
0
0
0
0
0
0.2
1
0.2
false
0
0.4
0
0.6
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
9ff57895d3282f8fe9d1edc77f6a9c59ac9edf29
87
py
Python
halfling/builders/__init__.py
aloebs29/halfling
b8b21b8167a9e77dcad4c1f46ab89fbb758587e4
[ "MIT" ]
null
null
null
halfling/builders/__init__.py
aloebs29/halfling
b8b21b8167a9e77dcad4c1f46ab89fbb758587e4
[ "MIT" ]
null
null
null
halfling/builders/__init__.py
aloebs29/halfling
b8b21b8167a9e77dcad4c1f46ab89fbb758587e4
[ "MIT" ]
null
null
null
from .common import Builder, BuildOptions from .cxx import CxxBuilder, CxxBuildOptions
29
44
0.83908
10
87
7.3
0.8
0
0
0
0
0
0
0
0
0
0
0
0.114943
87
2
45
43.5
0.948052
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
b00e11e2c186cf2a0f578aa5e2b7f7ee58a214f7
239
py
Python
FAI02_old/utils/torch_utils.py
WNoxchi/Kawkasos
42c5070a8fa4a5e2d6386dc19d385e82a1d73fb2
[ "MIT" ]
7
2017-07-28T06:17:29.000Z
2021-03-19T08:43:07.000Z
FAI02_old/utils/torch_utils.py
WNoxchi/Kawkasos
42c5070a8fa4a5e2d6386dc19d385e82a1d73fb2
[ "MIT" ]
null
null
null
FAI02_old/utils/torch_utils.py
WNoxchi/Kawkasos
42c5070a8fa4a5e2d6386dc19d385e82a1d73fb2
[ "MIT" ]
1
2018-06-17T12:08:25.000Z
2018-06-17T12:08:25.000Z
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data from torch import optim from torch.backends import cudnn from torchvision import datasets, transforms, utils as vutils from torch.autograd import Variable
26.555556
61
0.83682
37
239
5.405405
0.459459
0.22
0.13
0
0
0
0
0
0
0
0
0
0.125523
239
8
62
29.875
0.956938
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
b01bd6629cc62dfac1611028f4903e107ce54e10
1,500
py
Python
tests/test_xor.py
kgwinnup/neural-network-py
7d72624a9e2cab3444aac9ae016441a93058e169
[ "BSD-2-Clause" ]
null
null
null
tests/test_xor.py
kgwinnup/neural-network-py
7d72624a9e2cab3444aac9ae016441a93058e169
[ "BSD-2-Clause" ]
null
null
null
tests/test_xor.py
kgwinnup/neural-network-py
7d72624a9e2cab3444aac9ae016441a93058e169
[ "BSD-2-Clause" ]
null
null
null
from kneuralnet.nn import NeuralNet import pytest import numpy as np data = np.array([[0,0,0], [0,1,1], [1,0,1], [1,1,0]]) X = np.array(data[:,0:-1]) Y = np.array([data[:,-1]]).T nand = np.array([[0,0,1], [0,1,1], [1,0,1], [1,1,0]]) nX = np.array(nand[:,0:-1]) nY = np.array([nand[:,-1]]).T def test_xor_11(): nn = NeuralNet(Y, X, layers=[4,1]) nn.learn() res = nn.predict(np.array([1,1])) assert(round(res['yhat'][0]) == 0.0) def test_xor_00(): nn = NeuralNet(Y, X, layers=[4,1]) nn.learn() res = nn.predict(np.array([0,0])) assert(round(res['yhat'][0]) == 0.0) def test_xor_10(): nn = NeuralNet(Y, X, layers=[4,1]) nn.learn() res = nn.predict(np.array([1,0])) assert(round(res['yhat'][0]) == 1.0) def test_xor_01(): nn = NeuralNet(Y, X, layers=[4,1]) nn.learn() res = nn.predict(np.array([0,1])) assert(round(res['yhat'][0]) == 1.0) def test_xor_01_b1(): nn = NeuralNet(Y, X, layers=[4,1], bias=1) nn.learn() res = nn.predict(np.array([0,1])) assert(round(res['yhat'][0]) == 1.0) def test_nand_01(): nn = NeuralNet(nY, nX, layers=[3,1], bias=1) nn.learn() res = nn.predict(np.array([0,1])) assert(round(res['yhat'][0]) == 1.0) def test_nand_11(): nn = NeuralNet(nY, nX, layers=[3,1], bias=1) nn.learn() res = nn.predict(np.array([1,1])) assert(round(res['yhat'][0]) == 0.0)
24.590164
48
0.516
261
1,500
2.908046
0.141762
0.036891
0.073781
0.101449
0.782609
0.782609
0.778656
0.752306
0.752306
0.72859
0
0.085013
0.239333
1,500
60
49
25
0.580193
0
0
0.62
0
0
0.018679
0
0
0
0
0
0.14
1
0.14
false
0
0.06
0
0.2
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
b0357ca350bae7a08babbeb229e8feaa23e2cc72
38
py
Python
crowdstrike_cre/__init__.py
sahil2303/ta_cloud_exchange_plugins
931299ed317ea12968ce53edd7bf4318d23c1e3e
[ "BSD-3-Clause" ]
1
2022-02-22T13:52:27.000Z
2022-02-22T13:52:27.000Z
crowdstrike_cre/__init__.py
sahil2303/ta_cloud_exchange_plugins
931299ed317ea12968ce53edd7bf4318d23c1e3e
[ "BSD-3-Clause" ]
1
2022-03-31T10:25:57.000Z
2022-03-31T10:25:57.000Z
crowdstrike_cre/__init__.py
sahil2303/ta_cloud_exchange_plugins
931299ed317ea12968ce53edd7bf4318d23c1e3e
[ "BSD-3-Clause" ]
4
2022-01-31T05:32:14.000Z
2022-02-07T10:07:42.000Z
"""CrowdStrike cre Plugin Package."""
19
37
0.710526
4
38
6.75
1
0
0
0
0
0
0
0
0
0
0
0
0.105263
38
1
38
38
0.794118
0.815789
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
c66efd9e6b782b8c3c2a788eb1f4961aa8e4005f
359
py
Python
tweet/twitterspidertest/cookielogin.py
Octoberr/swm0920
8f05a6b91fc205960edd57f9076facec04f49a1a
[ "Apache-2.0" ]
2
2019-05-19T11:54:26.000Z
2019-05-19T12:03:49.000Z
tweet/twitterspidertest/cookielogin.py
Octoberr/swm0920
8f05a6b91fc205960edd57f9076facec04f49a1a
[ "Apache-2.0" ]
1
2020-11-27T07:55:15.000Z
2020-11-27T07:55:15.000Z
tweet/twitterspidertest/cookielogin.py
Octoberr/swm0920
8f05a6b91fc205960edd57f9076facec04f49a1a
[ "Apache-2.0" ]
2
2019-01-17T15:01:28.000Z
2019-09-20T09:32:17.000Z
""" 验证twitter的登陆是否有效 """ import requests url = '''https://api.twitter.com/1.1/followers/list.json?include_profile_interstitial_type=1&include_blocking=1&include_blocked_by=1&include_followed_by=1&include_want_retweets=1&include_mute_edge=1&include_can_dm=1&include_can_media_tag=1&skip_status=1&cursor=-1&user_id=988458200&count=20''' res = requests.get(url)
51.285714
293
0.824513
60
359
4.616667
0.633333
0.202166
0.072202
0
0
0
0
0
0
0
0
0.066092
0.030641
359
6
294
59.833333
0.729885
0.044568
0
0
0
0.333333
0.838806
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
c67f05842a57e3864c7314912f2c03851b8c69ee
117
py
Python
backend/home/admin.py
crowdbotics-apps/learning-trial-28958
3150f157efb955ff6ee34bf2129673008422b12e
[ "FTL", "AML", "RSA-MD" ]
null
null
null
backend/home/admin.py
crowdbotics-apps/learning-trial-28958
3150f157efb955ff6ee34bf2129673008422b12e
[ "FTL", "AML", "RSA-MD" ]
null
null
null
backend/home/admin.py
crowdbotics-apps/learning-trial-28958
3150f157efb955ff6ee34bf2129673008422b12e
[ "FTL", "AML", "RSA-MD" ]
null
null
null
from django.contrib import admin from .models import Input admin.site.register(Input) # Register your models here.
16.714286
32
0.794872
17
117
5.470588
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.136752
117
6
33
19.5
0.920792
0.222222
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
c68cba9eb0c9d9506df1e7bdc7fe653d19067ff5
479
py
Python
src/helpers/navigation.py
feiphoon/ner-pipeline
1c343eea458e9c546bb8b53adcd22118d171aa63
[ "MIT" ]
null
null
null
src/helpers/navigation.py
feiphoon/ner-pipeline
1c343eea458e9c546bb8b53adcd22118d171aa63
[ "MIT" ]
null
null
null
src/helpers/navigation.py
feiphoon/ner-pipeline
1c343eea458e9c546bb8b53adcd22118d171aa63
[ "MIT" ]
null
null
null
import os from pathlib import Path from typing import List def get_directories(directory: str = ".") -> List: return [ Path(os.path.join(directory, obj)) for obj in os.listdir(directory) if os.path.isdir(os.path.join(directory, obj)) ] def get_files(directory: str = ".") -> List: return [ Path(os.path.join(directory, obj)) for obj in os.listdir(directory) if not os.path.isdir(os.path.join(directory, obj)) ]
23.95
58
0.626305
67
479
4.447761
0.328358
0.120805
0.134228
0.255034
0.731544
0.731544
0.731544
0.731544
0.510067
0.510067
0
0
0.244259
479
19
59
25.210526
0.823204
0
0
0.4
0
0
0.004175
0
0
0
0
0
0
1
0.133333
false
0
0.2
0.133333
0.466667
0
0
0
0
null
0
0
1
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
5
c6a7ae3a44709505a5690ea4ae7c95e7575a306b
190
py
Python
festoon/__init__.py
notmatthancock/festoon
7c60ec3fa0fe0b193d4d2d8876a647f34e7110c2
[ "MIT" ]
null
null
null
festoon/__init__.py
notmatthancock/festoon
7c60ec3fa0fe0b193d4d2d8876a647f34e7110c2
[ "MIT" ]
null
null
null
festoon/__init__.py
notmatthancock/festoon
7c60ec3fa0fe0b193d4d2d8876a647f34e7110c2
[ "MIT" ]
null
null
null
# flake8: noqa __version__ = "0.0.1" from .docstring_tools import docfill from .exception_tools import retry from .logging_tools import logit, timeit from .environment_tools import fromenv
23.75
40
0.810526
27
190
5.407407
0.62963
0.30137
0
0
0
0
0
0
0
0
0
0.024096
0.126316
190
7
41
27.142857
0.855422
0.063158
0
0
0
0
0.028409
0
0
0
0
0
0
1
0
false
0
0.8
0
0.8
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
c6e7c30060c5ecbba0ada3dfcd21d19d5b52c2c4
217
py
Python
test.py
simvalue/PythonCanalyzer
7f5920e5d61197d94f3498a3b86da1ca89a03867
[ "MIT" ]
5
2020-01-10T13:29:15.000Z
2021-06-17T00:58:48.000Z
test.py
simvalue/PythonCanalyzer
7f5920e5d61197d94f3498a3b86da1ca89a03867
[ "MIT" ]
1
2021-09-09T00:42:33.000Z
2021-09-09T00:42:33.000Z
test.py
simvalue/PythonCanalyzer
7f5920e5d61197d94f3498a3b86da1ca89a03867
[ "MIT" ]
3
2020-01-30T10:43:24.000Z
2021-09-30T12:29:54.000Z
from python_canalyzer import PythonCanalyzer canalyzer = PythonCanalyzer(r"E:\proj3115_vector_auto_test\Config\Canalyzer\j1939.cfg", capl_path = r"E:\proj3115_vector_auto_test\Config\Canalyzer\J1939sendmsg.can") pass
54.25
166
0.852535
30
217
5.9
0.633333
0.022599
0.112994
0.180791
0.440678
0.440678
0.440678
0.440678
0
0
0
0.07767
0.050691
217
4
167
54.25
0.781553
0
0
0
0
0
0.536697
0.536697
0
0
0
0
0
1
0
false
0.333333
0.333333
0
0.333333
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
1
null
0
0
0
0
0
0
0
1
1
0
0
0
0
5
c6e894bd73996d6a676a9e718bb20b7b0c0761bb
54
py
Python
arknights_mower/utils/device/__init__.py
YuiTH/arknights-mower
01e65569ee13a470dde09911d2237331a8ed5b3d
[ "MIT" ]
null
null
null
arknights_mower/utils/device/__init__.py
YuiTH/arknights-mower
01e65569ee13a470dde09911d2237331a8ed5b3d
[ "MIT" ]
null
null
null
arknights_mower/utils/device/__init__.py
YuiTH/arknights-mower
01e65569ee13a470dde09911d2237331a8ed5b3d
[ "MIT" ]
null
null
null
from .device import Device from .utils import KeyCode
18
26
0.814815
8
54
5.5
0.625
0
0
0
0
0
0
0
0
0
0
0
0.148148
54
2
27
27
0.956522
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
05a6d1580c350930bdc1bfeb7ae8e039cf1c9d68
38
py
Python
moff/parser/end_line.py
Tikubonn/moff
1c363f60959138311068177fca177d0f0dc97380
[ "MIT" ]
null
null
null
moff/parser/end_line.py
Tikubonn/moff
1c363f60959138311068177fca177d0f0dc97380
[ "MIT" ]
null
null
null
moff/parser/end_line.py
Tikubonn/moff
1c363f60959138311068177fca177d0f0dc97380
[ "MIT" ]
null
null
null
class EndLine (Exception): pass
7.6
26
0.657895
4
38
6.25
1
0
0
0
0
0
0
0
0
0
0
0
0.263158
38
4
27
9.5
0.892857
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
05ac1066ff4a73ab9ec0ce82256565e4d6bf9bd7
259,885
py
Python
dist/aeon3odt-L-0.6.2/aeon3odt/cnvaeon.py
peter88213/aeon3odt
f20572177e1e10e2dcc6a130cf3b2b05ed11eed9
[ "MIT" ]
null
null
null
dist/aeon3odt-L-0.6.2/aeon3odt/cnvaeon.py
peter88213/aeon3odt
f20572177e1e10e2dcc6a130cf3b2b05ed11eed9
[ "MIT" ]
1
2021-10-14T16:00:11.000Z
2021-12-22T11:51:05.000Z
dist/aeon3odt-L-0.6.2/aeon3odt/cnvaeon.py
peter88213/aeon3odt
f20572177e1e10e2dcc6a130cf3b2b05ed11eed9
[ "MIT" ]
null
null
null
"""Convert Aeon Timeline project data to odt. Version 0.6.2 Requires Python 3.6+ Copyright (c) 2022 Peter Triesberger For further information see https://github.com/peter88213/aeon3odt Published under the MIT License (https://opensource.org/licenses/mit-license.php) """ import uno from com.sun.star.awt.MessageBoxType import MESSAGEBOX, INFOBOX, WARNINGBOX, ERRORBOX, QUERYBOX from com.sun.star.beans import PropertyValue import os from configparser import ConfigParser from pathlib import Path from configparser import ConfigParser class Configuration: """Application configuration, representing an INI file. INI file sections: <self._sLabel> - Strings <self._oLabel> - Boolean values Public methods: set(settings={}, options={}) -- set the entire configuration without writing the INI file. read(iniFile) -- read a configuration file. write(iniFile) -- save the configuration to iniFile. Public instance variables: settings - dictionary of strings options - dictionary of boolean values """ def __init__(self, settings={}, options={}): """Initalize attribute variables. Optional arguments: settings -- default settings (dictionary of strings) options -- default options (dictionary of boolean values) """ self.settings = None self.options = None self._sLabel = 'SETTINGS' self._oLabel = 'OPTIONS' self.set(settings, options) def set(self, settings=None, options=None): """Set the entire configuration without writing the INI file. Optional arguments: settings -- new settings (dictionary of strings) options -- new options (dictionary of boolean values) """ if settings is not None: self.settings = settings.copy() if options is not None: self.options = options.copy() def read(self, iniFile): """Read a configuration file. Positional arguments: iniFile -- str: path configuration file path. Settings and options that can not be read in, remain unchanged. """ config = ConfigParser() config.read(iniFile, encoding='utf-8') if config.has_section(self._sLabel): section = config[self._sLabel] for setting in self.settings: fallback = self.settings[setting] self.settings[setting] = section.get(setting, fallback) if config.has_section(self._oLabel): section = config[self._oLabel] for option in self.options: fallback = self.options[option] self.options[option] = section.getboolean(option, fallback) def write(self, iniFile): """Save the configuration to iniFile. Positional arguments: iniFile -- str: path configuration file path. """ config = ConfigParser() if self.settings: config.add_section(self._sLabel) for settingId in self.settings: config.set(self._sLabel, settingId, str(self.settings[settingId])) if self.options: config.add_section(self._oLabel) for settingId in self.options: if self.options[settingId]: config.set(self._oLabel, settingId, 'Yes') else: config.set(self._oLabel, settingId, 'No') with open(iniFile, 'w', encoding='utf-8') as f: config.write(f) from com.sun.star.awt.MessageBoxType import MESSAGEBOX, INFOBOX, WARNINGBOX, ERRORBOX, QUERYBOX from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK, BUTTONS_OK_CANCEL, BUTTONS_YES_NO, BUTTONS_YES_NO_CANCEL, BUTTONS_RETRY_CANCEL, BUTTONS_ABORT_IGNORE_RETRY CTX = uno.getComponentContext() SM = CTX.getServiceManager() def create_instance(name, with_context=False): if with_context: instance = SM.createInstanceWithContext(name, CTX) else: instance = SM.createInstance(name) return instance def msgbox(message, title='yWriter import/export', buttons=BUTTONS_OK, type_msg=INFOBOX): """ Create message box type_msg: MESSAGEBOX, INFOBOX, WARNINGBOX, ERRORBOX, QUERYBOX MSG_BUTTONS: BUTTONS_OK, BUTTONS_OK_CANCEL, BUTTONS_YES_NO, BUTTONS_YES_NO_CANCEL, BUTTONS_RETRY_CANCEL, BUTTONS_ABORT_IGNORE_RETRY MSG_RESULTS: OK, YES, NO, CANCEL http://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1awt_1_1XMessageBoxFactory.html """ toolkit = create_instance('com.sun.star.awt.Toolkit') parent = toolkit.getDesktopWindow() mb = toolkit.createMessageBox( parent, type_msg, buttons, title, str(message)) return mb.execute() class Stub(): def dummy(self): pass def FilePicker(path=None, mode=0): """ Read file: `mode in (0, 6, 7, 8, 9)` Write file: `mode in (1, 2, 3, 4, 5, 10)` see: (http://api.libreoffice.org/docs/idl/ref/ namespacecom_1_1sun_1_1star_1_1ui_1_1 dialogs_1_1TemplateDescription.html) See: https://stackoverflow.com/questions/30840736/libreoffice-how-to-create-a-file-dialog-via-python-macro """ # shortcut: createUnoService = ( XSCRIPTCONTEXT .getComponentContext() .getServiceManager() .createInstance ) filepicker = createUnoService("com.sun.star.ui.dialogs.OfficeFilePicker") if path: filepicker.setDisplayDirectory(path) filepicker.initialize((mode,)) filepicker.appendFilter("Aeon Timeline 3 Files", "*.aeon") filepicker.appendFilter("CSV Files", "*.csv") if filepicker.execute(): return filepicker.getFiles()[0] ERROR = '!' import sys import webbrowser class Ui: """Base class for UI facades, implementing a 'silent mode'. Public methods: ask_yes_no(text) -- return True or False. set_info_what(message) -- show what the converter is going to do. set_info_how(message) -- show how the converter is doing. start() -- launch the GUI, if any. Public instance variables: infoWhatText -- buffer for general messages. infoHowText -- buffer for error/success messages. """ def __init__(self, title): """Initialize text buffers for messaging. Positional arguments: title -- application title. """ self.infoWhatText = '' self.infoHowText = '' def ask_yes_no(self, text): """Return True or False. Positional arguments: text -- question to be asked. This is a stub used for "silent mode". The application may use a subclass for confirmation requests. """ return True def set_info_what(self, message): """Show what the converter is going to do. Positional arguments: message -- message to be buffered. """ self.infoWhatText = message def set_info_how(self, message): """Show how the converter is doing. Positional arguments: message -- message to be buffered. Print the message to stderr, replacing the error marker, if any. """ if message.startswith(ERROR): message = f'FAIL: {message.split(ERROR, maxsplit=1)[1].strip()}' sys.stderr.write(message) self.infoHowText = message def start(self): """Launch the GUI, if any. To be overridden by subclasses requiring special action to launch the user interaction. """ class YwCnv: """Base class for Novel file conversion. Public methods: convert(sourceFile, targetFile) -- Convert sourceFile into targetFile. """ def convert(self, source, target): """Convert source into target and return a message. Positional arguments: source, target -- Novel subclass instances. Operation: 1. Make the source object read the source file. 2. Make the target object merge the source object's instance variables. 3. Make the target object write the target file. Return a message beginning with the ERROR constant in case of error. Error handling: - Check if source and target are correctly initialized. - Ask for permission to overwrite target. - Pass the error messages of the called methods of source and target. - The success message comes from target.write(), if called. """ if source.filePath is None: return f'{ERROR}Source "{os.path.normpath(source.filePath)}" is not of the supported type.' if not os.path.isfile(source.filePath): return f'{ERROR}"{os.path.normpath(source.filePath)}" not found.' if target.filePath is None: return f'{ERROR}Target "{os.path.normpath(target.filePath)}" is not of the supported type.' if os.path.isfile(target.filePath) and not self._confirm_overwrite(target.filePath): return f'{ERROR}Action canceled by user.' message = source.read() if message.startswith(ERROR): return message message = target.merge(source) if message.startswith(ERROR): return message return target.write() def _confirm_overwrite(self, fileName): """Return boolean permission to overwrite the target file. Positional argument: fileName -- path to the target file. This is a stub to be overridden by subclass methods. """ return True class YwCnvUi(YwCnv): """Base class for Novel file conversion with user interface. Public methods: export_from_yw(sourceFile, targetFile) -- Convert from yWriter project to other file format. create_yw(sourceFile, targetFile) -- Create target from source. import_to_yw(sourceFile, targetFile) -- Convert from any file format to yWriter project. Instance variables: ui -- Ui (can be overridden e.g. by subclasses). newFile -- str: path to the target file in case of success. """ def __init__(self): """Define instance variables.""" self.ui = Ui('') # Per default, 'silent mode' is active. self.newFile = None # Also indicates successful conversion. def export_from_yw(self, source, target): """Convert from yWriter project to other file format. Positional arguments: source -- YwFile subclass instance. target -- Any Novel subclass instance. Operation: 1. Send specific information about the conversion to the UI. 2. Convert source into target. 3. Pass the message to the UI. 4. Save the new file pathname. Error handling: - If the conversion fails, newFile is set to None. """ self.ui.set_info_what( f'Input: {source.DESCRIPTION} "{os.path.normpath(source.filePath)}"\nOutput: {target.DESCRIPTION} "{os.path.normpath(target.filePath)}"') message = self.convert(source, target) self.ui.set_info_how(message) if message.startswith(ERROR): self.newFile = None else: self.newFile = target.filePath def create_yw7(self, source, target): """Create target from source. Positional arguments: source -- Any Novel subclass instance. target -- YwFile subclass instance. Operation: 1. Send specific information about the conversion to the UI. 2. Convert source into target. 3. Pass the message to the UI. 4. Save the new file pathname. Error handling: - Tf target already exists as a file, the conversion is cancelled, an error message is sent to the UI. - If the conversion fails, newFile is set to None. """ self.ui.set_info_what( f'Create a yWriter project file from {source.DESCRIPTION}\nNew project: "{os.path.normpath(target.filePath)}"') if os.path.isfile(target.filePath): self.ui.set_info_how(f'{ERROR}"{os.path.normpath(target.filePath)}" already exists.') else: message = self.convert(source, target) self.ui.set_info_how(message) if message.startswith(ERROR): self.newFile = None else: self.newFile = target.filePath def import_to_yw(self, source, target): """Convert from any file format to yWriter project. Positional arguments: source -- Any Novel subclass instance. target -- YwFile subclass instance. Operation: 1. Send specific information about the conversion to the UI. 2. Convert source into target. 3. Pass the message to the UI. 4. Delete the temporay file, if exists. 5. Save the new file pathname. Error handling: - If the conversion fails, newFile is set to None. """ self.ui.set_info_what( f'Input: {source.DESCRIPTION} "{os.path.normpath(source.filePath)}"\nOutput: {target.DESCRIPTION} "{os.path.normpath(target.filePath)}"') message = self.convert(source, target) self.ui.set_info_how(message) self._delete_tempfile(source.filePath) if message.startswith(ERROR): self.newFile = None else: self.newFile = target.filePath def _confirm_overwrite(self, filePath): """Return boolean permission to overwrite the target file. Positional arguments: fileName -- path to the target file. Overrides the superclass method. """ return self.ui.ask_yes_no(f'Overwrite existing file "{os.path.normpath(filePath)}"?') def _delete_tempfile(self, filePath): """Delete filePath if it is a temporary file no longer needed.""" if filePath.endswith('.html'): # Might it be a temporary text document? if os.path.isfile(filePath.replace('.html', '.odt')): # Does a corresponding Office document exist? try: os.remove(filePath) except: pass elif filePath.endswith('.csv'): # Might it be a temporary spreadsheet document? if os.path.isfile(filePath.replace('.csv', '.ods')): # Does a corresponding Office document exist? try: os.remove(filePath) except: pass def _open_newFile(self): """Open the converted file for editing and exit the converter script.""" webbrowser.open(self.newFile) sys.exit(0) class FileFactory: """Base class for conversion object factory classes. """ def __init__(self, fileClasses=[]): """Write the parameter to a "private" instance variable. Optional arguments: _fileClasses -- list of classes from which an instance can be returned. """ self._fileClasses = fileClasses class ExportSourceFactory(FileFactory): """A factory class that instantiates a yWriter object to read. Public methods: make_file_objects(self, sourcePath, **kwargs) -- return conversion objects. """ def make_file_objects(self, sourcePath, **kwargs): """Instantiate a source object for conversion from a yWriter project. Positional arguments: sourcePath -- str: path to the source file to convert. Return a tuple with three elements: - A message beginning with the ERROR constant in case of error - sourceFile: a YwFile subclass instance, or None in case of error - targetFile: None """ __, fileExtension = os.path.splitext(sourcePath) for fileClass in self._fileClasses: if fileClass.EXTENSION == fileExtension: sourceFile = fileClass(sourcePath, **kwargs) return 'Source object created.', sourceFile, None return f'{ERROR}File type of "{os.path.normpath(sourcePath)}" not supported.', None, None class ExportTargetFactory(FileFactory): """A factory class that instantiates a document object to write. Public methods: make_file_objects(self, sourcePath, **kwargs) -- return conversion objects. """ def make_file_objects(self, sourcePath, **kwargs): """Instantiate a target object for conversion from a yWriter project. Positional arguments: sourcePath -- str: path to the source file to convert. Optional arguments: suffix -- str: an indicator for the target file type. Required keyword arguments: suffix -- str: target file name suffix. Return a tuple with three elements: - A message beginning with the ERROR constant in case of error - sourceFile: None - targetFile: a FileExport subclass instance, or None in case of error """ fileName, __ = os.path.splitext(sourcePath) suffix = kwargs['suffix'] for fileClass in self._fileClasses: if fileClass.SUFFIX == suffix: if suffix is None: suffix = '' targetFile = fileClass(f'{fileName}{suffix}{fileClass.EXTENSION}', **kwargs) return 'Target object created.', None, targetFile return f'{ERROR}File type of "{os.path.normpath(sourcePath)}" not supported.', None, None class ImportSourceFactory(FileFactory): """A factory class that instantiates a documente object to read. Public methods: make_file_objects(self, sourcePath, **kwargs) -- return conversion objects. """ def make_file_objects(self, sourcePath, **kwargs): """Instantiate a source object for conversion to a yWriter project. Positional arguments: sourcePath -- str: path to the source file to convert. Return a tuple with three elements: - A message beginning with the ERROR constant in case of error - sourceFile: a Novel subclass instance, or None in case of error - targetFile: None """ for fileClass in self._fileClasses: if fileClass.SUFFIX is not None: if sourcePath.endswith(f'{fileClass.SUFFIX }{fileClass.EXTENSION}'): sourceFile = fileClass(sourcePath, **kwargs) return 'Source object created.', sourceFile, None return f'{ERROR}This document is not meant to be written back.', None, None class ImportTargetFactory(FileFactory): """A factory class that instantiates a yWriter object to write. Public methods: make_file_objects(self, sourcePath, **kwargs) -- return conversion objects. """ def make_file_objects(self, sourcePath, **kwargs): """Instantiate a target object for conversion to a yWriter project. Positional arguments: sourcePath -- str: path to the source file to convert. Optional arguments: suffix -- str: an indicator for the source file type. Required keyword arguments: suffix -- str: target file name suffix. Return a tuple with three elements: - A message beginning with the ERROR constant in case of error - sourceFile: None - targetFile: a YwFile subclass instance, or None in case of error """ fileName, __ = os.path.splitext(sourcePath) sourceSuffix = kwargs['suffix'] if sourceSuffix: ywPathBasis = fileName.split(sourceSuffix)[0] else: ywPathBasis = fileName # Look for an existing yWriter project to rewrite. for fileClass in self._fileClasses: if os.path.isfile(f'{ywPathBasis}{fileClass.EXTENSION}'): targetFile = fileClass(f'{ywPathBasis}{fileClass.EXTENSION}', **kwargs) return 'Target object created.', None, targetFile return f'{ERROR}No yWriter project to write.', None, None class YwCnvFf(YwCnvUi): """Class for Novel file conversion using factory methods to create target and source classes. Public methods: run(sourcePath, **kwargs) -- create source and target objects and run conversion. Class constants: EXPORT_SOURCE_CLASSES -- list of YwFile subclasses from which can be exported. EXPORT_TARGET_CLASSES -- list of FileExport subclasses to which export is possible. IMPORT_SOURCE_CLASSES -- list of Novel subclasses from which can be imported. IMPORT_TARGET_CLASSES -- list of YwFile subclasses to which import is possible. All lists are empty and meant to be overridden by subclasses. Instance variables: exportSourceFactory -- ExportSourceFactory. exportTargetFactory -- ExportTargetFactory. importSourceFactory -- ImportSourceFactory. importTargetFactory -- ImportTargetFactory. newProjectFactory -- FileFactory (a stub to be overridden by subclasses). """ EXPORT_SOURCE_CLASSES = [] EXPORT_TARGET_CLASSES = [] IMPORT_SOURCE_CLASSES = [] IMPORT_TARGET_CLASSES = [] def __init__(self): """Create strategy class instances. Extends the superclass constructor. """ super().__init__() self.exportSourceFactory = ExportSourceFactory(self.EXPORT_SOURCE_CLASSES) self.exportTargetFactory = ExportTargetFactory(self.EXPORT_TARGET_CLASSES) self.importSourceFactory = ImportSourceFactory(self.IMPORT_SOURCE_CLASSES) self.importTargetFactory = ImportTargetFactory(self.IMPORT_TARGET_CLASSES) self.newProjectFactory = FileFactory() def run(self, sourcePath, **kwargs): """Create source and target objects and run conversion. Positional arguments: sourcePath -- str: the source file path. Required keyword arguments: suffix -- str: target file name suffix. This is a template method that calls superclass methods as primitive operations by case. """ self.newFile = None if not os.path.isfile(sourcePath): self.ui.set_info_how(f'{ERROR}File "{os.path.normpath(sourcePath)}" not found.') return message, source, __ = self.exportSourceFactory.make_file_objects(sourcePath, **kwargs) if message.startswith(ERROR): # The source file is not a yWriter project. message, source, __ = self.importSourceFactory.make_file_objects(sourcePath, **kwargs) if message.startswith(ERROR): # A new yWriter project might be required. message, source, target = self.newProjectFactory.make_file_objects(sourcePath, **kwargs) if message.startswith(ERROR): self.ui.set_info_how(message) else: self.create_yw7(source, target) else: # Try to update an existing yWriter project. kwargs['suffix'] = source.SUFFIX message, __, target = self.importTargetFactory.make_file_objects(sourcePath, **kwargs) if message.startswith(ERROR): self.ui.set_info_how(message) else: self.import_to_yw(source, target) else: # The source file is a yWriter project. message, __, target = self.exportTargetFactory.make_file_objects(sourcePath, **kwargs) if message.startswith(ERROR): self.ui.set_info_how(message) else: self.export_from_yw(source, target) import csv from datetime import datetime from urllib.parse import quote class Novel: """Abstract yWriter project file representation. This class represents a file containing a novel with additional attributes and structural information (a full set or a subset of the information included in an yWriter project file). Public methods: read() -- parse the file and get the instance variables. merge(source) -- update instance variables from a source instance. write() -- write instance variables to the file. Public instance variables: title -- str: title. desc -- str: description in a single string. authorName -- str: author's name. author bio -- str: information about the author. fieldTitle1 -- str: scene rating field title 1. fieldTitle2 -- str: scene rating field title 2. fieldTitle3 -- str: scene rating field title 3. fieldTitle4 -- str: scene rating field title 4. chapters -- dict: (key: ID; value: chapter instance). scenes -- dict: (key: ID, value: scene instance). srtChapters -- list: the novel's sorted chapter IDs. locations -- dict: (key: ID, value: WorldElement instance). srtLocations -- list: the novel's sorted location IDs. items -- dict: (key: ID, value: WorldElement instance). srtItems -- list: the novel's sorted item IDs. characters -- dict: (key: ID, value: character instance). srtCharacters -- list: the novel's sorted character IDs. filePath -- str: path to the file (property with getter and setter). """ DESCRIPTION = 'Novel' EXTENSION = None SUFFIX = None # To be extended by subclass methods. def __init__(self, filePath, **kwargs): """Initialize instance variables. Positional arguments: filePath -- str: path to the file represented by the Novel instance. Optional arguments: kwargs -- keyword arguments to be used by subclasses. """ self.title = None # str # xml: <PROJECT><Title> self.desc = None # str # xml: <PROJECT><Desc> self.authorName = None # str # xml: <PROJECT><AuthorName> self.authorBio = None # str # xml: <PROJECT><Bio> self.fieldTitle1 = None # str # xml: <PROJECT><FieldTitle1> self.fieldTitle2 = None # str # xml: <PROJECT><FieldTitle2> self.fieldTitle3 = None # str # xml: <PROJECT><FieldTitle3> self.fieldTitle4 = None # str # xml: <PROJECT><FieldTitle4> self.chapters = {} # dict # xml: <CHAPTERS><CHAPTER><ID> # key = chapter ID, value = Chapter instance. # The order of the elements does not matter (the novel's order of the chapters is defined by srtChapters) self.scenes = {} # dict # xml: <SCENES><SCENE><ID> # key = scene ID, value = Scene instance. # The order of the elements does not matter (the novel's order of the scenes is defined by # the order of the chapters and the order of the scenes within the chapters) self.srtChapters = [] # list of str # The novel's chapter IDs. The order of its elements corresponds to the novel's order of the chapters. self.locations = {} # dict # xml: <LOCATIONS> # key = location ID, value = WorldElement instance. # The order of the elements does not matter. self.srtLocations = [] # list of str # The novel's location IDs. The order of its elements # corresponds to the XML project file. self.items = {} # dict # xml: <ITEMS> # key = item ID, value = WorldElement instance. # The order of the elements does not matter. self.srtItems = [] # list of str # The novel's item IDs. The order of its elements corresponds to the XML project file. self.characters = {} # dict # xml: <CHARACTERS> # key = character ID, value = Character instance. # The order of the elements does not matter. self.srtCharacters = [] # list of str # The novel's character IDs. The order of its elements corresponds to the XML project file. self._filePath = None # str # Path to the file. The setter only accepts files of a supported type as specified by EXTENSION. self._projectName = None # str # URL-coded file name without suffix and extension. self._projectPath = None # str # URL-coded path to the project directory. self.filePath = filePath @property def filePath(self): return self._filePath @filePath.setter def filePath(self, filePath): """Setter for the filePath instance variable. - Format the path string according to Python's requirements. - Accept only filenames with the right suffix and extension. """ if self.SUFFIX is not None: suffix = self.SUFFIX else: suffix = '' if filePath.lower().endswith(f'{suffix}{self.EXTENSION}'.lower()): self._filePath = filePath head, tail = os.path.split(os.path.realpath(filePath)) self.projectPath = quote(head.replace('\\', '/'), '/:') self.projectName = quote(tail.replace(f'{suffix}{self.EXTENSION}', '')) def read(self): """Parse the file and get the instance variables. Return a message beginning with the ERROR constant in case of error. This is a stub to be overridden by subclass methods. """ return f'{ERROR}Read method is not implemented.' def merge(self, source): """Update instance variables from a source instance. Positional arguments: source -- Novel subclass instance to merge. Return a message beginning with the ERROR constant in case of error. This is a stub to be overridden by subclass methods. """ return f'{ERROR}Merge method is not implemented.' def write(self): """Write instance variables to the file. Return a message beginning with the ERROR constant in case of error. This is a stub to be overridden by subclass methods. """ return f'{ERROR}Write method is not implemented.' def _convert_to_yw(self, text): """Return text, converted from source format to yw7 markup. Positional arguments: text -- string to convert. This is a stub to be overridden by subclass methods. """ return text def _convert_from_yw(self, text, quick=False): """Return text, converted from yw7 markup to target format. Positional arguments: text -- string to convert. Optional arguments: quick -- bool: if True, apply a conversion mode for one-liners without formatting. This is a stub to be overridden by subclass methods. """ return text import re class Scene: """yWriter scene representation. Public instance variables: title -- str: scene title. desc -- str: scene description in a single string. sceneContent -- str: scene content (property with getter and setter). rtfFile -- str: RTF file name (yWriter 5). wordCount - int: word count (derived; updated by the sceneContent setter). letterCount - int: letter count (derived; updated by the sceneContent setter). isUnused -- bool: True if the scene is marked "Unused". isNotesScene -- bool: True if the scene type is "Notes". isTodoScene -- bool: True if the scene type is "Todo". doNotExport -- bool: True if the scene is not to be exported to RTF. status -- int: scene status (Outline/Draft/1st Edit/2nd Edit/Done). sceneNotes -- str: scene notes in a single string. tags -- list of scene tags. field1 -- int: scene ratings field 1. field2 -- int: scene ratings field 2. field3 -- int: scene ratings field 3. field4 -- int: scene ratings field 4. appendToPrev -- bool: if True, append the scene without a divider to the previous scene. isReactionScene -- bool: if True, the scene is "reaction". Otherwise, it's "action". isSubPlot -- bool: if True, the scene belongs to a sub-plot. Otherwise it's main plot. goal -- str: the main actor's scene goal. conflict -- str: what hinders the main actor to achieve his goal. outcome -- str: what comes out at the end of the scene. characters -- list of character IDs related to this scene. locations -- list of location IDs related to this scene. items -- list of item IDs related to this scene. date -- str: specific start date in ISO format (yyyy-mm-dd). time -- str: specific start time in ISO format (hh:mm). minute -- str: unspecific start time: minutes. hour -- str: unspecific start time: hour. day -- str: unspecific start time: day. lastsMinutes -- str: scene duration: minutes. lastsHours -- str: scene duration: hours. lastsDays -- str: scene duration: days. image -- str: path to an image related to the scene. """ STATUS = (None, 'Outline', 'Draft', '1st Edit', '2nd Edit', 'Done') # Emulate an enumeration for the scene status # Since the items are used to replace text, # they may contain spaces. This is why Enum cannot be used here. ACTION_MARKER = 'A' REACTION_MARKER = 'R' NULL_DATE = '0001-01-01' NULL_TIME = '00:00:00' def __init__(self): """Initialize instance variables.""" self.title = None # str # xml: <Title> self.desc = None # str # xml: <Desc> self._sceneContent = None # str # xml: <SceneContent> # Scene text with yW7 raw markup. self.rtfFile = None # str # xml: <RTFFile> # Name of the file containing the scene in yWriter 5. self.wordCount = 0 # int # xml: <WordCount> # To be updated by the sceneContent setter self.letterCount = 0 # int # xml: <LetterCount> # To be updated by the sceneContent setter self.isUnused = None # bool # xml: <Unused> -1 self.isNotesScene = None # bool # xml: <Fields><Field_SceneType> 1 self.isTodoScene = None # bool # xml: <Fields><Field_SceneType> 2 self.doNotExport = None # bool # xml: <ExportCondSpecific><ExportWhenRTF> self.status = None # int # xml: <Status> # 1 - Outline # 2 - Draft # 3 - 1st Edit # 4 - 2nd Edit # 5 - Done # See also the STATUS list for conversion. self.sceneNotes = None # str # xml: <Notes> self.tags = None # list of str # xml: <Tags> self.field1 = None # str # xml: <Field1> self.field2 = None # str # xml: <Field2> self.field3 = None # str # xml: <Field3> self.field4 = None # str # xml: <Field4> self.appendToPrev = None # bool # xml: <AppendToPrev> -1 self.isReactionScene = None # bool # xml: <ReactionScene> -1 self.isSubPlot = None # bool # xml: <SubPlot> -1 self.goal = None # str # xml: <Goal> self.conflict = None # str # xml: <Conflict> self.outcome = None # str # xml: <Outcome> self.characters = None # list of str # xml: <Characters><CharID> self.locations = None # list of str # xml: <Locations><LocID> self.items = None # list of str # xml: <Items><ItemID> self.date = None # str # xml: <SpecificDateMode>-1 # xml: <SpecificDateTime>1900-06-01 20:38:00 self.time = None # str # xml: <SpecificDateMode>-1 # xml: <SpecificDateTime>1900-06-01 20:38:00 self.minute = None # str # xml: <Minute> self.hour = None # str # xml: <Hour> self.day = None # str # xml: <Day> self.lastsMinutes = None # str # xml: <LastsMinutes> self.lastsHours = None # str # xml: <LastsHours> self.lastsDays = None # str # xml: <LastsDays> self.image = None # str # xml: <ImageFile> @property def sceneContent(self): return self._sceneContent @sceneContent.setter def sceneContent(self, text): """Set sceneContent updating word count and letter count.""" self._sceneContent = text text = re.sub('\[.+?\]|\.|\,| -', '', self._sceneContent) # Remove yWriter raw markup for word count wordList = text.split() self.wordCount = len(wordList) text = re.sub('\[.+?\]', '', self._sceneContent) # Remove yWriter raw markup for letter count text = text.replace('\n', '') text = text.replace('\r', '') self.letterCount = len(text) class Chapter: """yWriter chapter representation. Public instance variables: title -- str: chapter title (may be the heading). desc -- str: chapter description in a single string. chLevel -- int: chapter level (part/chapter). oldType -- int: chapter type (Chapter/Other). chType -- int: chapter type yWriter 7.0.7.2+ (Normal/Notes/Todo). isUnused -- bool: True, if the chapter is marked "Unused". suppressChapterTitle -- bool: uppress chapter title when exporting. isTrash -- bool: True, if the chapter is the project's trash bin. suppressChapterBreak -- bool: Suppress chapter break when exporting. srtScenes -- list of str: the chapter's sorted scene IDs. """ def __init__(self): """Initialize instance variables.""" self.title = None # str # xml: <Title> self.desc = None # str # xml: <Desc> self.chLevel = None # int # xml: <SectionStart> # 0 = chapter level # 1 = section level ("this chapter begins a section") self.oldType = None # int # xml: <Type> # 0 = chapter type (marked "Chapter") # 1 = other type (marked "Other") # Applies to projects created by a yWriter version prior to 7.0.7.2. self.chType = None # int # xml: <ChapterType> # 0 = Normal # 1 = Notes # 2 = Todo # Applies to projects created by yWriter version 7.0.7.2+. self.isUnused = None # bool # xml: <Unused> -1 self.suppressChapterTitle = None # bool # xml: <Fields><Field_SuppressChapterTitle> 1 # True: Chapter heading not to be displayed in written document. # False: Chapter heading to be displayed in written document. self.isTrash = None # bool # xml: <Fields><Field_IsTrash> 1 # True: This chapter is the yw7 project's "trash bin". # False: This chapter is not a "trash bin". self.suppressChapterBreak = None # bool # xml: <Fields><Field_SuppressChapterBreak> 0 self.srtScenes = [] # list of str # xml: <Scenes><ScID> # The chapter's scene IDs. The order of its elements # corresponds to the chapter's order of the scenes. class WorldElement: """Story world element representation (may be location or item). Public instance variables: title -- str: title (name). image -- str: image file path. desc -- str: description. tags -- list of tags. aka -- str: alternate name. """ def __init__(self): """Initialize instance variables.""" self.title = None # str # xml: <Title> self.image = None # str # xml: <ImageFile> self.desc = None # str # xml: <Desc> self.tags = None # list of str # xml: <Tags> self.aka = None # str # xml: <AKA> class Character(WorldElement): """yWriter character representation. Public instance variables: notes -- str: character notes. bio -- str: character biography. goals -- str: character's goals in the story. fullName -- str: full name (the title inherited may be a short name). isMajor -- bool: True, if it's a major character. """ MAJOR_MARKER = 'Major' MINOR_MARKER = 'Minor' def __init__(self): """Extends the superclass constructor by adding instance variables.""" super().__init__() self.notes = None # str # xml: <Notes> self.bio = None # str # xml: <Bio> self.goals = None # str # xml: <Goals> self.fullName = None # str # xml: <FullName> self.isMajor = None # bool # xml: <Major> def fix_iso_dt(dateTimeStr): """Return a date/time string with a four-number year. Positional arguments: dateTimeStr -- str: date/time as read in from Aeon3 csv export. This is required for comparing date/time strings, and by the datetime.fromisoformat() method. Substitute missing time by "00:00:00". Substitute missing month by '01'. Substitute missing day by '01'. If the date is empty or out of yWriter's range, return None. """ if not dateTimeStr: return None if dateTimeStr.startswith('BC'): return None dt = dateTimeStr.split(' ') if len(dt) == 1: dt.append('00:00:00') date = dt[0].split('-') while len(date) < 3: date.append('01') if int(date[0]) < 100: return None if int(date[0]) > 9999: return None date[0] = date[0].zfill(4) dt[0] = ('-').join(date) dateTimeStr = (' ').join(dt) return dateTimeStr class CsvTimeline3(Novel): """File representation of a csv file exported by Aeon Timeline 3. Public methods: read() -- parse the file and get the instance variables. Represents a csv file with a record per scene. - Records are separated by line breaks. - Data fields are delimited by commas. """ EXTENSION = '.csv' DESCRIPTION = 'Aeon Timeline CSV export' SUFFIX = '' _SEPARATOR = ',' # Aeon 3 csv export structure (fix part) # Types _TYPE_EVENT = 'Event' _TYPE_NARRATIVE = 'Narrative Folder' # Field names _LABEL_FIELD = 'Label' _TYPE_FIELD = 'Type' _SCENE_FIELD = 'Narrative Position' _START_DATE_TIME_FIELD = 'Start Date' _END_DATE_TIME_FIELD = 'End Date' # Narrative position markers _PART_MARKER = 'Part' _CHAPTER_MARKER = 'Chapter' _SCENE_MARKER = 'Scene' # Events assigned to the "narrative" become # regular scenes, the others become Notes scenes. def __init__(self, filePath, **kwargs): """Initialize instance variables. Positional arguments: filePath -- str: path to the file represented by the Novel instance. Required keyword arguments: part_number_prefix -- str: prefix to the part number in the part's heading. chapter_number_prefix -- str: prefix to the chapter number in the chapter's heading. type_location -- str: label of the "Location" item type representing locations. type_item -- str: label of the "Item" item type representing items. type_character -- str: label of the "Character" item type representing characters. part_desc_label -- str: label of the csv field for the part's description. chapter_desc_label -- str: label of the csv field for the chapter's description. scene_desc_label -- str: label of the csv field for the scene's description. scene_title_label -- str: label of the csv field for the scene's title. notes_label -- str: label of the "Notes" property of events and characters. tag_label -- str: label of the csv field for the scene's tags. item_label -- str: label of the "Item" role type. character_label -- str: label of the "Participant" role type. viewpoint_label -- str: label of the "Viewpoint" property of events. location_label -- str: label of the "Location" role type. character_desc_label1 -- str: label of the character property imported as 1st part of the description. character_desc_label2 -- str: label of the character property imported as 2nd part of the description. character_desc_label3 -- str: label of the character property imported as 3rd part of the description. character_bio_label -- str: character_aka_label -- str: label of the "Nickname" property of characters. Extends the superclass constructor. """ super().__init__(filePath, **kwargs) self.labels = [] self.partNrPrefix = kwargs['part_number_prefix'] if self.partNrPrefix: self.partNrPrefix += ' ' self.chapterNrPrefix = kwargs['chapter_number_prefix'] if self.chapterNrPrefix: self.chapterNrPrefix += ' ' self.typeLocation = kwargs['type_location'] self.typeItem = kwargs['type_item'] self.typeCharacter = kwargs['type_character'] self.partDescField = kwargs['part_desc_label'] self.chapterDescField = kwargs['chapter_desc_label'] self.sceneDescField = kwargs['scene_desc_label'] self.sceneTitleField = kwargs['scene_title_label'] self.notesField = kwargs['notes_label'] self.tagField = kwargs['tag_label'] self.itemField = kwargs['item_label'] self.characterField = kwargs['character_label'] self.viewpointField = kwargs['viewpoint_label'] self.locationField = kwargs['location_label'] self.characterDescField1 = kwargs['character_desc_label1'] self.characterDescField2 = kwargs['character_desc_label2'] self.characterDescField3 = kwargs['character_desc_label3'] self.characterBioField = kwargs['character_bio_label'] self.characterAkaField = kwargs['character_aka_label'] self.locationDescField = kwargs['location_desc_label'] def read(self): """Parse the file and get the instance variables. Build a yWriter novel structure from an Aeon3 csv export. Return a message beginning with the ERROR constant in case of error. Overrides the superclass method. """ def get_lcIds(lcTitles): """Return a list of location IDs; Add new location to the project.""" lcIds = [] for lcTitle in lcTitles: if lcTitle in self.locIdsByTitle: lcIds.append(self.locIdsByTitle[lcTitle]) else: return None return lcIds def get_itIds(itTitles): """Return a list of item IDs; Add new item to the project.""" itIds = [] for itTitle in itTitles: if itTitle in self.itmIdsByTitle: itIds.append(self.itmIdsByTitle[itTitle]) else: return None return itIds def get_crIds(crTitles): """Return a list of character IDs; Add new characters to the project.""" crIds = [] for crTitle in crTitles: if crTitle in self.chrIdsByTitle: crIds.append(self.chrIdsByTitle[crTitle]) else: return None return crIds #--- Read the csv file. internalDelimiter = ',' try: with open(self.filePath, newline='', encoding='utf-8') as f: reader = csv.DictReader(f, delimiter=self._SEPARATOR) for label in reader.fieldnames: self.labels.append(label) eventsAndFolders = [] characterCount = 0 self.chrIdsByTitle = {} # key = character title # value = character ID locationCount = 0 self.locIdsByTitle = {} # key = location title # value = location ID itemCount = 0 self.itmIdsByTitle = {} # key = item title # value = item ID for row in reader: aeonEntity = {} for label in row: aeonEntity[label] = row[label] if self._TYPE_EVENT == aeonEntity[self._TYPE_FIELD]: eventsAndFolders.append(aeonEntity) elif self._TYPE_NARRATIVE == aeonEntity[self._TYPE_FIELD]: eventsAndFolders.append(aeonEntity) elif self.typeCharacter == aeonEntity[self._TYPE_FIELD]: characterCount += 1 crId = str(characterCount) self.chrIdsByTitle[aeonEntity[self._LABEL_FIELD]] = crId self.characters[crId] = Character() self.characters[crId].title = aeonEntity[self._LABEL_FIELD] charDesc = [] if self.characterDescField1 in aeonEntity: charDesc.append(aeonEntity[self.characterDescField1]) if self.characterDescField2 and self.characterDescField2 in aeonEntity: charDesc.append(aeonEntity[self.characterDescField2]) if self.characterDescField3 and self.characterDescField3 in aeonEntity: charDesc.append(aeonEntity[self.characterDescField3]) self.characters[crId].desc = ('\n').join(charDesc) if self.characterBioField in aeonEntity: self.characters[crId].bio = aeonEntity[self.characterBioField] if self.characterAkaField in aeonEntity: self.characters[crId].aka = aeonEntity[self.characterAkaField] if self.tagField in aeonEntity and aeonEntity[self.tagField]: self.characters[crId].tags = aeonEntity[self.tagField].split(internalDelimiter) if self.notesField in aeonEntity: self.characters[crId].notes = aeonEntity[self.notesField] self.srtCharacters.append(crId) elif self.typeLocation == aeonEntity[self._TYPE_FIELD]: locationCount += 1 lcId = str(locationCount) self.locIdsByTitle[aeonEntity[self._LABEL_FIELD]] = lcId self.locations[lcId] = WorldElement() self.locations[lcId].title = aeonEntity[self._LABEL_FIELD] self.srtLocations.append(lcId) if self.locationDescField in aeonEntity: self.locations[lcId].desc = aeonEntity[self.locationDescField] if self.tagField in aeonEntity: self.locations[lcId].tags = aeonEntity[self.tagField].split(internalDelimiter) elif self.typeItem == aeonEntity[self._TYPE_FIELD]: itemCount += 1 itId = str(itemCount) self.itmIdsByTitle[aeonEntity[self._LABEL_FIELD]] = itId self.items[itId] = WorldElement() self.items[itId].title = aeonEntity[self._LABEL_FIELD] self.srtItems.append(itId) except(FileNotFoundError): return f'{ERROR}"{os.path.normpath(self.filePath)}" not found.' except: return f'{ERROR}Can not parse csv file "{os.path.normpath(self.filePath)}".' try: for label in [self._SCENE_FIELD, self.sceneTitleField, self._START_DATE_TIME_FIELD, self._END_DATE_TIME_FIELD]: if not label in self.labels: return f'{ERROR}Label "{label}" is missing.' scIdsByStruc = {} chIdsByStruc = {} otherEvents = [] eventCount = 0 chapterCount = 0 for aeonEntity in eventsAndFolders: if aeonEntity[self._SCENE_FIELD]: narrativeType, narrativePosition = aeonEntity[self._SCENE_FIELD].split(' ') # Make the narrative position a sortable string. numbers = narrativePosition.split('.') for i in range(len(numbers)): numbers[i] = numbers[i].zfill(4) narrativePosition = ('.').join(numbers) else: narrativeType = '' narrativePosition = '' if aeonEntity[self._TYPE_FIELD] == self._TYPE_NARRATIVE: if narrativeType == self._CHAPTER_MARKER: chapterCount += 1 chId = str(chapterCount) chIdsByStruc[narrativePosition] = chId self.chapters[chId] = Chapter() self.chapters[chId].chLevel = 0 if self.chapterDescField: self.chapters[chId].desc = aeonEntity[self.chapterDescField] elif narrativeType == self._PART_MARKER: chapterCount += 1 chId = str(chapterCount) chIdsByStruc[narrativePosition] = chId self.chapters[chId] = Chapter() self.chapters[chId].chLevel = 1 narrativePosition += '.0000' if self.partDescField: self.chapters[chId].desc = aeonEntity[self.partDescField] continue elif aeonEntity[self._TYPE_FIELD] != self._TYPE_EVENT: continue eventCount += 1 scId = str(eventCount) self.scenes[scId] = Scene() if narrativeType == self._SCENE_MARKER: self.scenes[scId].isNotesScene = False scIdsByStruc[narrativePosition] = scId else: self.scenes[scId].isNotesScene = True otherEvents.append(scId) self.scenes[scId].title = aeonEntity[self.sceneTitleField] startDateTimeStr = fix_iso_dt(aeonEntity[self._START_DATE_TIME_FIELD]) if startDateTimeStr is not None: startDateTime = startDateTimeStr.split(' ') self.scenes[scId].date = startDateTime[0] self.scenes[scId].time = startDateTime[1] endDateTimeStr = fix_iso_dt(aeonEntity[self._END_DATE_TIME_FIELD]) if endDateTimeStr is not None: # Calculate duration of scenes that begin after 99-12-31. sceneStart = datetime.fromisoformat(startDateTimeStr) sceneEnd = datetime.fromisoformat(endDateTimeStr) sceneDuration = sceneEnd - sceneStart lastsHours = sceneDuration.seconds // 3600 lastsMinutes = (sceneDuration.seconds % 3600) // 60 self.scenes[scId].lastsDays = str(sceneDuration.days) self.scenes[scId].lastsHours = str(lastsHours) self.scenes[scId].lastsMinutes = str(lastsMinutes) else: self.scenes[scId].date = Scene.NULL_DATE self.scenes[scId].time = Scene.NULL_TIME if self.sceneDescField in aeonEntity: self.scenes[scId].desc = aeonEntity[self.sceneDescField] if self.notesField in aeonEntity: self.scenes[scId].sceneNotes = aeonEntity[self.notesField] if self.tagField in aeonEntity and aeonEntity[self.tagField]: self.scenes[scId].tags = aeonEntity[self.tagField].split(internalDelimiter) if self.locationField in aeonEntity: self.scenes[scId].locations = get_lcIds(aeonEntity[self.locationField].split(internalDelimiter)) if self.characterField in aeonEntity: self.scenes[scId].characters = get_crIds(aeonEntity[self.characterField].split(internalDelimiter)) if self.viewpointField in aeonEntity: vpIds = get_crIds([aeonEntity[self.viewpointField]]) if vpIds is not None: vpId = vpIds[0] if self.scenes[scId].characters is None: self.scenes[scId].characters = [] elif vpId in self.scenes[scId].characters: self.scenes[scId].characters.remove[vpId] self.scenes[scId].characters.insert(0, vpId) if self.itemField in aeonEntity: self.scenes[scId].items = get_itIds(aeonEntity[self.itemField].split(internalDelimiter)) self.scenes[scId].status = 1 # Set scene status = "Outline". except(FileNotFoundError): return f'{ERROR}"{os.path.normpath(self.filePath)}" not found.' except(KeyError): return f'{ERROR}Wrong csv structure.' except(ValueError): return f'{ERROR}Wrong date/time format.' except: return f'{ERROR}Can not parse "{os.path.normpath(self.filePath)}".' # Build the chapter structure as defined with Aeon v3. srtChpDict = sorted(chIdsByStruc.items()) srtScnDict = sorted(scIdsByStruc.items()) partNr = 0 chapterNr = 0 for ch in srtChpDict: self.srtChapters.append(ch[1]) if self.chapters[ch[1]].chLevel == 0: chapterNr += 1 self.chapters[ch[1]].title = self.chapterNrPrefix + str(chapterNr) for sc in srtScnDict: if sc[0].startswith(ch[0]): self.chapters[ch[1]].srtScenes.append(sc[1]) else: partNr += 1 self.chapters[ch[1]].title = self.partNrPrefix + str(partNr) # Create a chapter for the non-narrative events. chapterNr += 1 chId = str(chapterCount + 1) self.chapters[chId] = Chapter() self.chapters[chId].title = 'Other events' self.chapters[chId].desc = 'Scenes generated from events that ar not assigned to the narrative structure.' self.chapters[chId].chType = 1 self.chapters[chId].srtScenes = otherEvents self.srtChapters.append(chId) return 'Timeline data converted to novel structure.' import json from datetime import datetime from datetime import timedelta import codecs def scan_file(filePath): """Read and scan the project file. Positional arguments: filePath -- str: Path to the Aeon 3 project file. Return a string containing either the JSON part or an error message. """ try: with open(filePath, 'rb') as f: binInput = f.read() except(FileNotFoundError): return f'{ERROR}"{os.path.normpath(filePath)}" not found.' except: return f'{ERROR}Cannot read "{os.path.normpath(filePath)}".' # JSON part: all characters between the first and last curly bracket. chrData = [] opening = ord('{') closing = ord('}') level = 0 for c in binInput: if c == opening: level += 1 if level > 0: chrData.append(c) if c == closing: level -= 1 if level == 0: break if level != 0: return f'{ERROR}Corrupted data.' try: jsonStr = codecs.decode(bytes(chrData), encoding='utf-8') except: return f'{ERROR}Cannot decode "{os.path.normpath(filePath)}".' return jsonStr class JsonTimeline3(Novel): """File representation of an Aeon Timeline 3 project. Public methods: read() -- parse the file and get the instance variables. Represents the JSON part of the project file. """ EXTENSION = '.aeon' DESCRIPTION = 'Aeon Timeline 3 project' SUFFIX = '' DATE_LIMIT = (datetime(100, 1, 1) - datetime.min).total_seconds() # Dates before 100-01-01 can not be displayed properly in yWriter def __init__(self, filePath, **kwargs): """Initialize instance variables. Positional arguments: filePath -- str: path to the file represented by the Novel instance. Required keyword arguments: type_event -- str: label of the "Event" item type representing scenes. type_character -- str: label of the "Character" item type representing characters. type_location -- str: label of the "Location" item type representing locations. type_item -- str: label of the "Item" item type representing items. notes_label -- str: label of the "Notes" property of events and characters. character_desc_label1 -- str: label of the character property imported as 1st part of the description. character_desc_label2 -- str: label of the character property imported as 2nd part of the description. character_desc_label3 -- str: label of the character property imported as 3rd part of the description. character_aka_label -- str: label of the "Nickname" property of characters. viewpoint_label -- str: label of the "Viewpoint" property of events. character_label -- str: label of the "Participant" role type. location_label -- str: label of the "Location" role type. item_label -- str: label of the "Item" role type. part_number_prefix -- str: prefix to the part number in the part's heading. chapter_number_prefix -- str: prefix to the chapter number in the chapter's heading. Extends the superclass constructor. """ super().__init__(filePath, **kwargs) # JSON[definitions][types][byId] self._labelEventType = kwargs['type_event'] self._labelCharacterType = kwargs['type_character'] self._labelLocationType = kwargs['type_location'] self._labelItemType = kwargs['type_item'] # JSON[definitions][properties][byId] self._labelNotesProperty = kwargs['notes_label'] self._labelChrDesc1Property = kwargs['character_desc_label1'] self._labelChrDesc2Property = kwargs['character_desc_label2'] self._labelChrDesc3Property = kwargs['character_desc_label3'] self._labelAkaProperty = kwargs['character_aka_label'] self._labelViewpointProperty = kwargs['viewpoint_label'] # JSON[definitions][references][byId] self._labelParticipantRef = kwargs['character_label'] self._labelLocationRef = kwargs['location_label'] self._labelItemRef = kwargs['item_label'] # Misc. self._partHdPrefix = kwargs['part_number_prefix'] self._chapterHdPrefix = kwargs['chapter_number_prefix'] def read(self): """Parse the file and get the instance variables. Extract the JSON part of the Aeon Timeline 3 file located at filePath and build a yWriter novel structure. Return a message beginning with the ERROR constant in case of error. Overrides the superclass method. """ jsonPart = scan_file(self.filePath) if not jsonPart: return f'{ERROR}No JSON part found.' elif jsonPart.startswith(ERROR): return jsonPart try: jsonData = json.loads(jsonPart) except('JSONDecodeError'): return f'{ERROR}Invalid JSON data.' #--- Find types. typeEventUid = None typeCharacterUid = None typeLocationUid = None typeItemUid = None NarrativeFolderTypes = [] for uid in jsonData['definitions']['types']['byId']: if jsonData['definitions']['types']['byId'][uid]['isNarrativeFolder']: NarrativeFolderTypes.append(uid) elif jsonData['definitions']['types']['byId'][uid]['label'] == self._labelEventType: typeEventUid = uid elif jsonData['definitions']['types']['byId'][uid]['label'] == self._labelCharacterType: typeCharacterUid = uid elif jsonData['definitions']['types']['byId'][uid]['label'] == self._labelLocationType: typeLocationUid = uid elif jsonData['definitions']['types']['byId'][uid]['label'] == self._labelItemType: typeItemUid = uid #--- Find properties. propNotesUid = None propChrDesc1Uid = None propChrDesc2Uid = None propChrDesc3Uid = None propAkaUid = None propViewpointUid = None for uid in jsonData['definitions']['properties']['byId']: if jsonData['definitions']['properties']['byId'][uid]['label'] == self._labelNotesProperty: typeNotesUid = uid elif jsonData['definitions']['properties']['byId'][uid]['label'] == self._labelChrDesc1Property: propChrDesc1Uid = uid elif jsonData['definitions']['properties']['byId'][uid]['label'] == self._labelChrDesc2Property: propChrDesc2Uid = uid elif jsonData['definitions']['properties']['byId'][uid]['label'] == self._labelChrDesc3Property: propChrDesc3Uid = uid elif jsonData['definitions']['properties']['byId'][uid]['label'] == self._labelAkaProperty: propAkaUid = uid elif jsonData['definitions']['properties']['byId'][uid]['label'] == self._labelViewpointProperty: propViewpointUid = uid #--- Find references. refParticipant = None refLocation = None for uid in jsonData['definitions']['references']['byId']: if jsonData['definitions']['references']['byId'][uid]['label'] == self._labelParticipantRef: refParticipant = uid elif jsonData['definitions']['references']['byId'][uid]['label'] == self._labelLocationRef: refLocation = uid #--- Read items. crIdsByGuid = {} lcIdsByGuid = {} itIdsByGuid = {} scIdsByGuid = {} chIdsByGuid = {} characterCount = 0 locationCount = 0 itemCount = 0 eventCount = 0 chapterCount = 0 vpGuidByScId = {} for uid in jsonData['data']['items']['byId']: dataItem = jsonData['data']['items']['byId'][uid] if dataItem['type'] == typeEventUid: #--- Create scenes. eventCount += 1 scId = str(eventCount) scIdsByGuid[uid] = scId self.scenes[scId] = Scene() self.scenes[scId].status = 1 # Set scene status = "Outline" self.scenes[scId].isNotesScene = True # Will be set to False later if it is part of the narrative. self.scenes[scId].title = dataItem['label'] self.scenes[scId].desc = dataItem['summary'] timestamp = dataItem['startDate']['timestamp'] #--- Get scene tags. for tagId in dataItem['tags']: if self.scenes[scId].tags is None: self.scenes[scId].tags = [] self.scenes[scId].tags.append(jsonData['data']['tags'][tagId]) #--- Get scene properties. for propId in dataItem['propertyValues']: if propId == propNotesUid: self.scenes[scId].sceneNotes = dataItem['propertyValues'][propId] elif propId == propViewpointUid: vpGuidByScId[scId] = dataItem['propertyValues'][propId] #--- Get scene date, time, and duration. if timestamp is not None and timestamp >= self.DATE_LIMIT: # Restrict date/time calculation to dates within yWriter's range sceneStart = datetime.min + timedelta(seconds=timestamp) startDateTime = sceneStart.isoformat().split('T') self.scenes[scId].date = startDateTime[0] self.scenes[scId].time = startDateTime[1] # Calculate duration. if dataItem['duration']['years'] > 0 or dataItem['duration']['months'] > 0: endYear = sceneStart.year + dataItem['duration']['years'] endMonth = sceneStart.month if dataItem['duration']['months'] > 0: endMonth += dataItem['duration']['months'] while endMonth > 12: endMonth -= 12 endYear += 1 sceneDuration = datetime(endYear, endMonth, sceneStart.day) - \ datetime(sceneStart.year, sceneStart.month, sceneStart.day) lastsDays = sceneDuration.days lastsHours = sceneDuration.seconds // 3600 lastsMinutes = (sceneDuration.seconds % 3600) // 60 else: lastsDays = 0 lastsHours = 0 lastsMinutes = 0 lastsDays += dataItem['duration']['weeks'] * 7 lastsDays += dataItem['duration']['days'] lastsDays += dataItem['duration']['hours'] // 24 lastsHours += dataItem['duration']['hours'] % 24 lastsHours += dataItem['duration']['minutes'] // 60 lastsMinutes += dataItem['duration']['minutes'] % 60 lastsMinutes += dataItem['duration']['seconds'] // 60 lastsHours += lastsMinutes // 60 lastsMinutes %= 60 lastsDays += lastsHours // 24 lastsHours %= 24 self.scenes[scId].lastsDays = str(lastsDays) self.scenes[scId].lastsHours = str(lastsHours) self.scenes[scId].lastsMinutes = str(lastsMinutes) elif dataItem['type'] in NarrativeFolderTypes: #--- Create chapters. chapterCount += 1 chId = str(chapterCount) chIdsByGuid[uid] = chId self.chapters[chId] = Chapter() self.chapters[chId].desc = dataItem['label'] elif dataItem['type'] == typeCharacterUid: #--- Create characters. characterCount += 1 crId = str(characterCount) crIdsByGuid[uid] = crId self.characters[crId] = Character() if dataItem['shortLabel']: self.characters[crId].title = dataItem['shortLabel'] else: self.characters[crId].title = dataItem['label'] self.characters[crId].fullName = dataItem['label'] self.characters[crId].bio = dataItem['summary'] self.srtCharacters.append(crId) #--- Get character tags. for tagId in dataItem['tags']: if self.characters[crId].tags is None: self.characters[crId].tags = [] self.characters[crId].tags.append(jsonData['data']['tags'][tagId]) #--- Get character properties. charDesc = [] for propId in dataItem['propertyValues']: if propId == propNotesUid: self.characters[crId].notes = dataItem['propertyValues'][propId] elif propId == propAkaUid: self.characters[crId].aka = dataItem['propertyValues'][propId] elif propId == propChrDesc1Uid: charDesc.append(dataItem['propertyValues'][propId]) elif propId == propChrDesc2Uid: charDesc.append(dataItem['propertyValues'][propId]) elif propId == propChrDesc3Uid: charDesc.append(dataItem['propertyValues'][propId]) self.characters[crId].desc = ('\n').join(charDesc) elif dataItem['type'] == typeLocationUid: #--- Create locations. locationCount += 1 lcId = str(locationCount) lcIdsByGuid[uid] = lcId self.locations[lcId] = WorldElement() self.locations[lcId].title = dataItem['label'] self.locations[lcId].desc = dataItem['summary'] self.srtLocations.append(lcId) #--- Get location tags. for tagId in dataItem['tags']: if self.locations[lcId].tags is None: self.locations[lcId].tags = [] self.locations[lcId].tags.append(jsonData['data']['tags'][tagId]) elif dataItem['type'] == typeItemUid: #--- Create items. itemCount += 1 itId = str(itemCount) itIdsByGuid[uid] = itId self.items[itId] = WorldElement() self.items[itId].title = dataItem['label'] self.items[itId].desc = dataItem['summary'] self.srtItems.append(itId) #--- Get item tags. for tagId in dataItem['tags']: if self.items[itId].tags is None: self.items[itId].tags = [] self.items[itId].tags.append(jsonData['data']['tags'][tagId]) #--- Read relationships. for uid in jsonData['data']['relationships']['byId']: if jsonData['data']['relationships']['byId'][uid]['reference'] == refParticipant: #--- Assign characters. try: scId = scIdsByGuid[jsonData['data']['relationships']['byId'][uid]['subject']] crId = crIdsByGuid[jsonData['data']['relationships']['byId'][uid]['object']] if self.scenes[scId].characters is None: self.scenes[scId].characters = [] if not crId in self.scenes[scId].characters: self.scenes[scId].characters.append(crId) except: pass elif jsonData['data']['relationships']['byId'][uid]['reference'] == refLocation: #--- Assign locations. try: scId = scIdsByGuid[jsonData['data']['relationships']['byId'][uid]['subject']] lcId = lcIdsByGuid[jsonData['data']['relationships']['byId'][uid]['object']] if self.scenes[scId].locations is None: self.scenes[scId].locations = [] if not lcId in self.scenes[scId].locations: self.scenes[scId].locations.append(lcId) except: pass #--- Set scene viewpoints. for scId in vpGuidByScId: if vpGuidByScId[scId] in crIdsByGuid: vpId = crIdsByGuid[vpGuidByScId[scId]] if self.scenes[scId].characters is None: self.scenes[scId].characters = [] elif vpId in self.scenes[scId].characters: self.scenes[scId].characters.remove[vpId] self.scenes[scId].characters.insert(0, vpId) #--- Build a narrative structure with 2 or 3 levels. for narrative0 in jsonData['data']['narrative']['children']: if narrative0['id'] in chIdsByGuid: self.srtChapters.append(chIdsByGuid[narrative0['id']]) for narrative1 in narrative0['children']: if narrative1['id'] in chIdsByGuid: self.srtChapters.append(chIdsByGuid[narrative1['id']]) self.chapters[chIdsByGuid[narrative0['id']]].chLevel = 1 for narrative2 in narrative1['children']: if narrative2['id'] in scIdsByGuid: self.chapters[chIdsByGuid[narrative1['id']]].srtScenes.append( scIdsByGuid[narrative2['id']]) self.scenes[scIdsByGuid[narrative2['id']]].isNotesScene = False self.chapters[chIdsByGuid[narrative1['id']]].chLevel = 0 elif narrative1['id'] in scIdsByGuid: self.chapters[chIdsByGuid[narrative0['id']]].srtScenes.append(scIdsByGuid[narrative1['id']]) self.scenes[scIdsByGuid[narrative1['id']]].isNotesScene = False self.chapters[chIdsByGuid[narrative0['id']]].chLevel = 0 #--- Auto-number untitled chapters. partCount = 0 chapterCount = 0 for chId in self.srtChapters: if self.chapters[chId].chLevel == 1: partCount += 1 if not self.chapters[chId].title: self.chapters[chId].title = f'{self._partHdPrefix} {partCount}' else: chapterCount += 1 if not self.chapters[chId].title: self.chapters[chId].title = f'{self._chapterHdPrefix} {chapterCount}' #--- Create a "Notes" chapter for non-narrative scenes. chId = str(partCount + chapterCount + 1) self.chapters[chId] = Chapter() self.chapters[chId].title = 'Other events' self.chapters[chId].desc = 'Scenes generated from events that ar not assigned to the narrative structure.' self.chapters[chId].chType = 1 self.srtChapters.append(chId) for scId in self.scenes: if self.scenes[scId].isNotesScene: self.chapters[chId].srtScenes.append(scId) return 'Timeline data converted to novel structure.' import zipfile import locale import tempfile from shutil import rmtree from datetime import datetime from string import Template from string import Template class Filter: """Filter an entity (chapter/scene/character/location/item) by filter criteria. Public methods: accept(source, eId) -- check whether an entity matches the filter criteria. Strategy class, implementing filtering criteria for template-based export. This is a stub with no filter criteria specified. """ def accept(self, source, eId): """Check whether an entity matches the filter criteria. Positional arguments: source -- Novel instance holding the entity to check. eId -- ID of the entity to check. Return True if the entity is not to be filtered out. This is a stub to be overridden by subclass methods implementing filters. """ return True class FileExport(Novel): """Abstract yWriter project file exporter representation. Public methods: merge(source) -- update instance variables from a source instance. write() -- write instance variables to the export file. This class is generic and contains no conversion algorithm and no templates. """ SUFFIX = '' _fileHeader = '' _partTemplate = '' _chapterTemplate = '' _notesChapterTemplate = '' _todoChapterTemplate = '' _unusedChapterTemplate = '' _notExportedChapterTemplate = '' _sceneTemplate = '' _firstSceneTemplate = '' _appendedSceneTemplate = '' _notesSceneTemplate = '' _todoSceneTemplate = '' _unusedSceneTemplate = '' _notExportedSceneTemplate = '' _sceneDivider = '' _chapterEndTemplate = '' _unusedChapterEndTemplate = '' _notExportedChapterEndTemplate = '' _notesChapterEndTemplate = '' _todoChapterEndTemplate = '' _characterSectionHeading = '' _characterTemplate = '' _locationSectionHeading = '' _locationTemplate = '' _itemSectionHeading = '' _itemTemplate = '' _fileFooter = '' def __init__(self, filePath, **kwargs): """Initialize filter strategy class instances. Positional arguments: filePath -- str: path to the file represented by the Novel instance. Optional arguments: kwargs -- keyword arguments to be used by subclasses. Extends the superclass constructor. """ super().__init__(filePath, **kwargs) self._sceneFilter = Filter() self._chapterFilter = Filter() self._characterFilter = Filter() self._locationFilter = Filter() self._itemFilter = Filter() def merge(self, source): """Update instance variables from a source instance. Positional arguments: source -- Novel subclass instance to merge. Return a message beginning with the ERROR constant in case of error. Overrides the superclass method. """ if source.title is not None: self.title = source.title else: self.title = '' if source.desc is not None: self.desc = source.desc else: self.desc = '' if source.authorName is not None: self.authorName = source.authorName else: self.authorName = '' if source.authorBio is not None: self.authorBio = source.authorBio else: self.authorBio = '' if source.fieldTitle1 is not None: self.fieldTitle1 = source.fieldTitle1 else: self.fieldTitle1 = 'Field 1' if source.fieldTitle2 is not None: self.fieldTitle2 = source.fieldTitle2 else: self.fieldTitle2 = 'Field 2' if source.fieldTitle3 is not None: self.fieldTitle3 = source.fieldTitle3 else: self.fieldTitle3 = 'Field 3' if source.fieldTitle4 is not None: self.fieldTitle4 = source.fieldTitle4 else: self.fieldTitle4 = 'Field 4' if source.srtChapters: self.srtChapters = source.srtChapters if source.scenes is not None: self.scenes = source.scenes if source.chapters is not None: self.chapters = source.chapters if source.srtCharacters: self.srtCharacters = source.srtCharacters self.characters = source.characters if source.srtLocations: self.srtLocations = source.srtLocations self.locations = source.locations if source.srtItems: self.srtItems = source.srtItems self.items = source.items return 'Export data updated from novel.' def _get_fileHeaderMapping(self): """Return a mapping dictionary for the project section. This is a template method that can be extended or overridden by subclasses. """ projectTemplateMapping = dict( Title=self._convert_from_yw(self.title, True), Desc=self._convert_from_yw(self.desc), AuthorName=self._convert_from_yw(self.authorName, True), AuthorBio=self._convert_from_yw(self.authorBio, True), FieldTitle1=self._convert_from_yw(self.fieldTitle1, True), FieldTitle2=self._convert_from_yw(self.fieldTitle2, True), FieldTitle3=self._convert_from_yw(self.fieldTitle3, True), FieldTitle4=self._convert_from_yw(self.fieldTitle4, True), ) return projectTemplateMapping def _get_chapterMapping(self, chId, chapterNumber): """Return a mapping dictionary for a chapter section. Positional arguments: chId -- str: chapter ID. chapterNumber -- int: chapter number. This is a template method that can be extended or overridden by subclasses. """ if chapterNumber == 0: chapterNumber = '' chapterMapping = dict( ID=chId, ChapterNumber=chapterNumber, Title=self._convert_from_yw(self.chapters[chId].title, True), Desc=self._convert_from_yw(self.chapters[chId].desc), ProjectName=self._convert_from_yw(self.projectName, True), ProjectPath=self.projectPath, ) return chapterMapping def _get_sceneMapping(self, scId, sceneNumber, wordsTotal, lettersTotal): """Return a mapping dictionary for a scene section. Positional arguments: scId -- str: scene ID. sceneNumber -- int: scene number to be displayed. wordsTotal -- int: accumulated wordcount. lettersTotal -- int: accumulated lettercount. This is a template method that can be extended or overridden by subclasses. """ #--- Create a comma separated tag list. if sceneNumber == 0: sceneNumber = '' if self.scenes[scId].tags is not None: tags = self._get_string(self.scenes[scId].tags) else: tags = '' #--- Create a comma separated character list. try: # Note: Due to a bug, yWriter scenes might hold invalid # viepoint characters sChList = [] for chId in self.scenes[scId].characters: sChList.append(self.characters[chId].title) sceneChars = self._get_string(sChList) viewpointChar = sChList[0] except: sceneChars = '' viewpointChar = '' #--- Create a comma separated location list. if self.scenes[scId].locations is not None: sLcList = [] for lcId in self.scenes[scId].locations: sLcList.append(self.locations[lcId].title) sceneLocs = self._get_string(sLcList) else: sceneLocs = '' #--- Create a comma separated item list. if self.scenes[scId].items is not None: sItList = [] for itId in self.scenes[scId].items: sItList.append(self.items[itId].title) sceneItems = self._get_string(sItList) else: sceneItems = '' #--- Create A/R marker string. if self.scenes[scId].isReactionScene: reactionScene = Scene.REACTION_MARKER else: reactionScene = Scene.ACTION_MARKER #--- Create a combined scDate information. if self.scenes[scId].date is not None and self.scenes[scId].date != Scene.NULL_DATE: scDay = '' scDate = self.scenes[scId].date cmbDate = self.scenes[scId].date else: scDate = '' if self.scenes[scId].day is not None: scDay = self.scenes[scId].day cmbDate = f'Day {self.scenes[scId].day}' else: scDay = '' cmbDate = '' #--- Create a combined time information. if self.scenes[scId].time is not None and self.scenes[scId].date != Scene.NULL_DATE: scHour = '' scMinute = '' scTime = self.scenes[scId].time cmbTime = self.scenes[scId].time.rsplit(':', 1)[0] else: scTime = '' if self.scenes[scId].hour or self.scenes[scId].minute: if self.scenes[scId].hour: scHour = self.scenes[scId].hour else: scHour = '00' if self.scenes[scId].minute: scMinute = self.scenes[scId].minute else: scMinute = '00' cmbTime = f'{scHour.zfill(2)}:{scMinute.zfill(2)}' else: scHour = '' scMinute = '' cmbTime = '' #--- Create a combined duration information. if self.scenes[scId].lastsDays is not None and self.scenes[scId].lastsDays != '0': lastsDays = self.scenes[scId].lastsDays days = f'{self.scenes[scId].lastsDays}d ' else: lastsDays = '' days = '' if self.scenes[scId].lastsHours is not None and self.scenes[scId].lastsHours != '0': lastsHours = self.scenes[scId].lastsHours hours = f'{self.scenes[scId].lastsHours}h ' else: lastsHours = '' hours = '' if self.scenes[scId].lastsMinutes is not None and self.scenes[scId].lastsMinutes != '0': lastsMinutes = self.scenes[scId].lastsMinutes minutes = f'{self.scenes[scId].lastsMinutes}min' else: lastsMinutes = '' minutes = '' duration = f'{days}{hours}{minutes}' sceneMapping = dict( ID=scId, SceneNumber=sceneNumber, Title=self._convert_from_yw(self.scenes[scId].title, True), Desc=self._convert_from_yw(self.scenes[scId].desc), WordCount=str(self.scenes[scId].wordCount), WordsTotal=wordsTotal, LetterCount=str(self.scenes[scId].letterCount), LettersTotal=lettersTotal, Status=Scene.STATUS[self.scenes[scId].status], SceneContent=self._convert_from_yw(self.scenes[scId].sceneContent), FieldTitle1=self._convert_from_yw(self.fieldTitle1, True), FieldTitle2=self._convert_from_yw(self.fieldTitle2, True), FieldTitle3=self._convert_from_yw(self.fieldTitle3, True), FieldTitle4=self._convert_from_yw(self.fieldTitle4, True), Field1=self.scenes[scId].field1, Field2=self.scenes[scId].field2, Field3=self.scenes[scId].field3, Field4=self.scenes[scId].field4, Date=scDate, Time=scTime, Day=scDay, Hour=scHour, Minute=scMinute, ScDate=cmbDate, ScTime=cmbTime, LastsDays=lastsDays, LastsHours=lastsHours, LastsMinutes=lastsMinutes, Duration=duration, ReactionScene=reactionScene, Goal=self._convert_from_yw(self.scenes[scId].goal), Conflict=self._convert_from_yw(self.scenes[scId].conflict), Outcome=self._convert_from_yw(self.scenes[scId].outcome), Tags=self._convert_from_yw(tags, True), Image=self.scenes[scId].image, Characters=sceneChars, Viewpoint=viewpointChar, Locations=sceneLocs, Items=sceneItems, Notes=self._convert_from_yw(self.scenes[scId].sceneNotes), ProjectName=self._convert_from_yw(self.projectName, True), ProjectPath=self.projectPath, ) return sceneMapping def _get_characterMapping(self, crId): """Return a mapping dictionary for a character section. Positional arguments: crId -- str: character ID. This is a template method that can be extended or overridden by subclasses. """ if self.characters[crId].tags is not None: tags = self._get_string(self.characters[crId].tags) else: tags = '' if self.characters[crId].isMajor: characterStatus = Character.MAJOR_MARKER else: characterStatus = Character.MINOR_MARKER characterMapping = dict( ID=crId, Title=self._convert_from_yw(self.characters[crId].title, True), Desc=self._convert_from_yw(self.characters[crId].desc), Tags=self._convert_from_yw(tags), Image=self.characters[crId].image, AKA=self._convert_from_yw(self.characters[crId].aka, True), Notes=self._convert_from_yw(self.characters[crId].notes), Bio=self._convert_from_yw(self.characters[crId].bio), Goals=self._convert_from_yw(self.characters[crId].goals), FullName=self._convert_from_yw(self.characters[crId].fullName, True), Status=characterStatus, ProjectName=self._convert_from_yw(self.projectName), ProjectPath=self.projectPath, ) return characterMapping def _get_locationMapping(self, lcId): """Return a mapping dictionary for a location section. Positional arguments: lcId -- str: location ID. This is a template method that can be extended or overridden by subclasses. """ if self.locations[lcId].tags is not None: tags = self._get_string(self.locations[lcId].tags) else: tags = '' locationMapping = dict( ID=lcId, Title=self._convert_from_yw(self.locations[lcId].title, True), Desc=self._convert_from_yw(self.locations[lcId].desc), Tags=self._convert_from_yw(tags, True), Image=self.locations[lcId].image, AKA=self._convert_from_yw(self.locations[lcId].aka, True), ProjectName=self._convert_from_yw(self.projectName, True), ProjectPath=self.projectPath, ) return locationMapping def _get_itemMapping(self, itId): """Return a mapping dictionary for an item section. Positional arguments: itId -- str: item ID. This is a template method that can be extended or overridden by subclasses. """ if self.items[itId].tags is not None: tags = self._get_string(self.items[itId].tags) else: tags = '' itemMapping = dict( ID=itId, Title=self._convert_from_yw(self.items[itId].title, True), Desc=self._convert_from_yw(self.items[itId].desc), Tags=self._convert_from_yw(tags, True), Image=self.items[itId].image, AKA=self._convert_from_yw(self.items[itId].aka, True), ProjectName=self._convert_from_yw(self.projectName, True), ProjectPath=self.projectPath, ) return itemMapping def _get_fileHeader(self): """Process the file header. Apply the file header template, substituting placeholders according to the file header mapping dictionary. Return a list of strings. This is a template method that can be extended or overridden by subclasses. """ lines = [] template = Template(self._fileHeader) lines.append(template.safe_substitute(self._get_fileHeaderMapping())) return lines def _get_scenes(self, chId, sceneNumber, wordsTotal, lettersTotal, doNotExport): """Process the scenes. Positional arguments: chId -- str: chapter ID. sceneNumber -- int: number of previously processed scenes. wordsTotal -- int: accumulated wordcount of the previous scenes. lettersTotal -- int: accumulated lettercount of the previous scenes. doNotExport -- bool: scene belongs to a chapter that is not to be exported. Iterate through a sorted scene list and apply the templates, substituting placeholders according to the scene mapping dictionary. Skip scenes not accepted by the scene filter. Return a tuple: lines -- list of strings: the lines of the processed scene. sceneNumber -- int: number of all processed scenes. wordsTotal -- int: accumulated wordcount of all processed scenes. lettersTotal -- int: accumulated lettercount of all processed scenes. This is a template method that can be extended or overridden by subclasses. """ lines = [] firstSceneInChapter = True for scId in self.chapters[chId].srtScenes: dispNumber = 0 if not self._sceneFilter.accept(self, scId): continue # The order counts; be aware that "Todo" and "Notes" scenes are # always unused. if self.scenes[scId].isTodoScene: if self._todoSceneTemplate: template = Template(self._todoSceneTemplate) else: continue elif self.scenes[scId].isNotesScene: # Scene is "Notes" type. if self._notesSceneTemplate: template = Template(self._notesSceneTemplate) else: continue elif self.scenes[scId].isUnused or self.chapters[chId].isUnused: if self._unusedSceneTemplate: template = Template(self._unusedSceneTemplate) else: continue elif self.chapters[chId].oldType == 1: # Scene is "Info" type (old file format). if self._notesSceneTemplate: template = Template(self._notesSceneTemplate) else: continue elif self.scenes[scId].doNotExport or doNotExport: if self._notExportedSceneTemplate: template = Template(self._notExportedSceneTemplate) else: continue else: sceneNumber += 1 dispNumber = sceneNumber wordsTotal += self.scenes[scId].wordCount lettersTotal += self.scenes[scId].letterCount template = Template(self._sceneTemplate) if not firstSceneInChapter and self.scenes[scId].appendToPrev and self._appendedSceneTemplate: template = Template(self._appendedSceneTemplate) if not (firstSceneInChapter or self.scenes[scId].appendToPrev): lines.append(self._sceneDivider) if firstSceneInChapter and self._firstSceneTemplate: template = Template(self._firstSceneTemplate) lines.append(template.safe_substitute(self._get_sceneMapping( scId, dispNumber, wordsTotal, lettersTotal))) firstSceneInChapter = False return lines, sceneNumber, wordsTotal, lettersTotal def _get_chapters(self): """Process the chapters and nested scenes. Iterate through the sorted chapter list and apply the templates, substituting placeholders according to the chapter mapping dictionary. For each chapter call the processing of its included scenes. Skip chapters not accepted by the chapter filter. Return a list of strings. This is a template method that can be extended or overridden by subclasses. """ lines = [] chapterNumber = 0 sceneNumber = 0 wordsTotal = 0 lettersTotal = 0 for chId in self.srtChapters: dispNumber = 0 if not self._chapterFilter.accept(self, chId): continue # The order counts; be aware that "Todo" and "Notes" chapters are # always unused. # Has the chapter only scenes not to be exported? sceneCount = 0 notExportCount = 0 doNotExport = False template = None for scId in self.chapters[chId].srtScenes: sceneCount += 1 if self.scenes[scId].doNotExport: notExportCount += 1 if sceneCount > 0 and notExportCount == sceneCount: doNotExport = True if self.chapters[chId].chType == 2: # Chapter is "ToDo" type (implies "unused"). if self._todoChapterTemplate: template = Template(self._todoChapterTemplate) elif self.chapters[chId].chType == 1: # Chapter is "Notes" type (implies "unused"). if self._notesChapterTemplate: template = Template(self._notesChapterTemplate) elif self.chapters[chId].isUnused: # Chapter is "really" unused. if self._unusedChapterTemplate: template = Template(self._unusedChapterTemplate) elif self.chapters[chId].oldType == 1: # Chapter is "Info" type (old file format). if self._notesChapterTemplate: template = Template(self._notesChapterTemplate) elif doNotExport: if self._notExportedChapterTemplate: template = Template(self._notExportedChapterTemplate) elif self.chapters[chId].chLevel == 1 and self._partTemplate: template = Template(self._partTemplate) else: template = Template(self._chapterTemplate) chapterNumber += 1 dispNumber = chapterNumber if template is not None: lines.append(template.safe_substitute(self._get_chapterMapping(chId, dispNumber))) #--- Process scenes. sceneLines, sceneNumber, wordsTotal, lettersTotal = self._get_scenes( chId, sceneNumber, wordsTotal, lettersTotal, doNotExport) lines.extend(sceneLines) #--- Process chapter ending. template = None if self.chapters[chId].chType == 2: if self._todoChapterEndTemplate: template = Template(self._todoChapterEndTemplate) elif self.chapters[chId].chType == 1: if self._notesChapterEndTemplate: template = Template(self._notesChapterEndTemplate) elif self.chapters[chId].isUnused: if self._unusedChapterEndTemplate: template = Template(self._unusedChapterEndTemplate) elif self.chapters[chId].oldType == 1: if self._notesChapterEndTemplate: template = Template(self._notesChapterEndTemplate) elif doNotExport: if self._notExportedChapterEndTemplate: template = Template(self._notExportedChapterEndTemplate) elif self._chapterEndTemplate: template = Template(self._chapterEndTemplate) if template is not None: lines.append(template.safe_substitute(self._get_chapterMapping(chId, dispNumber))) return lines def _get_characters(self): """Process the characters. Iterate through the sorted character list and apply the template, substituting placeholders according to the character mapping dictionary. Skip characters not accepted by the character filter. Return a list of strings. This is a template method that can be extended or overridden by subclasses. """ if self._characterSectionHeading: lines = [self._characterSectionHeading] else: lines = [] template = Template(self._characterTemplate) for crId in self.srtCharacters: if self._characterFilter.accept(self, crId): lines.append(template.safe_substitute(self._get_characterMapping(crId))) return lines def _get_locations(self): """Process the locations. Iterate through the sorted location list and apply the template, substituting placeholders according to the location mapping dictionary. Skip locations not accepted by the location filter. Return a list of strings. This is a template method that can be extended or overridden by subclasses. """ if self._locationSectionHeading: lines = [self._locationSectionHeading] else: lines = [] template = Template(self._locationTemplate) for lcId in self.srtLocations: if self._locationFilter.accept(self, lcId): lines.append(template.safe_substitute(self._get_locationMapping(lcId))) return lines def _get_items(self): """Process the items. Iterate through the sorted item list and apply the template, substituting placeholders according to the item mapping dictionary. Skip items not accepted by the item filter. Return a list of strings. This is a template method that can be extended or overridden by subclasses. """ if self._itemSectionHeading: lines = [self._itemSectionHeading] else: lines = [] template = Template(self._itemTemplate) for itId in self.srtItems: if self._itemFilter.accept(self, itId): lines.append(template.safe_substitute(self._get_itemMapping(itId))) return lines def _get_text(self): """Call all processing methods. Return a string to be written to the output file. This is a template method that can be extended or overridden by subclasses. """ lines = self._get_fileHeader() lines.extend(self._get_chapters()) lines.extend(self._get_characters()) lines.extend(self._get_locations()) lines.extend(self._get_items()) lines.append(self._fileFooter) return ''.join(lines) def write(self): """Write instance variables to the export file. Create a template-based output file. Return a message beginning with the ERROR constant in case of error. """ text = self._get_text() backedUp = False if os.path.isfile(self.filePath): try: os.replace(self.filePath, f'{self.filePath}.bak') backedUp = True except: return f'{ERROR}Cannot overwrite "{os.path.normpath(self.filePath)}".' try: with open(self.filePath, 'w', encoding='utf-8') as f: f.write(text) except: if backedUp: os.replace(f'{self.filePath}.bak', self.filePath) return f'{ERROR}Cannot write "{os.path.normpath(self.filePath)}".' return f'"{os.path.normpath(self.filePath)}" written.' def _get_string(self, elements): """Join strings from a list. Return a string which is the concatenation of the members of the list of strings "elements", separated by a comma plus a space. The space allows word wrap in spreadsheet cells. """ text = (', ').join(elements) return text def _convert_from_yw(self, text, quick=False): """Return text, converted from yw7 markup to target format. Positional arguments: text -- string to convert. Optional arguments: quick -- bool: if True, apply a conversion mode for one-liners without formatting. Overrides the superclass method. """ if text is None: text = '' return(text) class OdfFile(FileExport): """Generic OpenDocument xml file representation. Public methods: write() -- write instance variables to the export file. """ _ODF_COMPONENTS = [] _MIMETYPE = '' _SETTINGS_XML = '' _MANIFEST_XML = '' _STYLES_XML = '' _META_XML = '' def __init__(self, filePath, **kwargs): """Create a temporary directory for zipfile generation. Positional arguments: filePath -- str: path to the file represented by the Novel instance. Optional arguments: kwargs -- keyword arguments to be used by subclasses. Extends the superclass constructor, """ super().__init__(filePath, **kwargs) self._tempDir = tempfile.mkdtemp(suffix='.tmp', prefix='odf_') self._originalPath = self._filePath def __del__(self): """Make sure to delete the temporary directory, in case write() has not been called.""" self._tear_down() def _tear_down(self): """Delete the temporary directory containing the unpacked ODF directory structure.""" try: rmtree(self._tempDir) except: pass def _set_up(self): """Helper method for ZIP file generation. Prepare the temporary directory containing the internal structure of an ODF file except 'content.xml'. Return a message beginning with the ERROR constant in case of error. """ #--- Create and open a temporary directory for the files to zip. try: self._tear_down() os.mkdir(self._tempDir) os.mkdir(f'{self._tempDir}/META-INF') except: return f'{ERROR}Cannot create "{os.path.normpath(self._tempDir)}".' #--- Generate mimetype. try: with open(f'{self._tempDir}/mimetype', 'w', encoding='utf-8') as f: f.write(self._MIMETYPE) except: return f'{ERROR}Cannot write "mimetype"' #--- Generate settings.xml. try: with open(f'{self._tempDir}/settings.xml', 'w', encoding='utf-8') as f: f.write(self._SETTINGS_XML) except: return f'{ERROR}Cannot write "settings.xml"' #--- Generate META-INF\manifest.xml. try: with open(f'{self._tempDir}/META-INF/manifest.xml', 'w', encoding='utf-8') as f: f.write(self._MANIFEST_XML) except: return f'{ERROR}Cannot write "manifest.xml"' #--- Generate styles.xml with system language set as document language. lng, ctr = locale.getdefaultlocale()[0].split('_') localeMapping = dict( Language=lng, Country=ctr, ) template = Template(self._STYLES_XML) text = template.safe_substitute(localeMapping) try: with open(f'{self._tempDir}/styles.xml', 'w', encoding='utf-8') as f: f.write(text) except: return f'{ERROR}Cannot write "styles.xml"' #--- Generate meta.xml with actual document metadata. metaMapping = dict( Author=self.authorName, Title=self.title, Summary=f'<![CDATA[{self.desc}]]>', Datetime=datetime.today().replace(microsecond=0).isoformat(), ) template = Template(self._META_XML) text = template.safe_substitute(metaMapping) try: with open(f'{self._tempDir}/meta.xml', 'w', encoding='utf-8') as f: f.write(text) except: return f'{ERROR}Cannot write "meta.xml".' return 'ODF structure generated.' def write(self): """Write instance variables to the export file. Create a template-based output file. Return a message beginning with the ERROR constant in case of error. Extends the super class method, adding ZIP file operations. """ #--- Create a temporary directory # containing the internal structure of an ODS file except "content.xml". message = self._set_up() if message.startswith(ERROR): return message #--- Add "content.xml" to the temporary directory. self._originalPath = self._filePath self._filePath = f'{self._tempDir}/content.xml' message = super().write() self._filePath = self._originalPath if message.startswith(ERROR): return message #--- Pack the contents of the temporary directory into the ODF file. workdir = os.getcwd() backedUp = False if os.path.isfile(self.filePath): try: os.replace(self.filePath, f'{self.filePath}.bak') backedUp = True except: return f'{ERROR}Cannot overwrite "{os.path.normpath(self.filePath)}".' try: with zipfile.ZipFile(self.filePath, 'w') as odfTarget: os.chdir(self._tempDir) for file in self._ODF_COMPONENTS: odfTarget.write(file, compress_type=zipfile.ZIP_DEFLATED) except: if backedUp: os.replace(f'{self.filePath}.bak', self.filePath) os.chdir(workdir) return f'{ERROR}Cannot generate "{os.path.normpath(self.filePath)}".' #--- Remove temporary data. os.chdir(workdir) self._tear_down() return f'"{os.path.normpath(self.filePath)}" written.' class OdtFile(OdfFile): """Generic OpenDocument text document representation.""" EXTENSION = '.odt' # overwrites Novel.EXTENSION _ODF_COMPONENTS = ['manifest.rdf', 'META-INF', 'content.xml', 'meta.xml', 'mimetype', 'settings.xml', 'styles.xml', 'META-INF/manifest.xml'] _CONTENT_XML_HEADER = '''<?xml version="1.0" encoding="UTF-8"?> <office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" office:version="1.2"> <office:scripts/> <office:font-face-decls> <style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" style:font-charset="x-symbol"/> <style:font-face style:name="Courier New" svg:font-family="&apos;Courier New&apos;" style:font-adornments="Standard" style:font-family-generic="modern" style:font-pitch="fixed"/> </office:font-face-decls> <office:automatic-styles/> <office:body> <office:text text:use-soft-page-breaks="true"> ''' _CONTENT_XML_FOOTER = ''' </office:text> </office:body> </office:document-content> ''' _META_XML = '''<?xml version="1.0" encoding="utf-8"?> <office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:grddl="http://www.w3.org/2003/g/data-view#" office:version="1.2"> <office:meta> <meta:generator>PyWriter</meta:generator> <dc:title>$Title</dc:title> <dc:description>$Summary</dc:description> <dc:subject></dc:subject> <meta:keyword></meta:keyword> <meta:initial-creator>$Author</meta:initial-creator> <dc:creator></dc:creator> <meta:creation-date>${Datetime}Z</meta:creation-date> <dc:date></dc:date> </office:meta> </office:document-meta> ''' _MANIFEST_XML = '''<?xml version="1.0" encoding="utf-8"?> <manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2"> <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.text" manifest:full-path="/" /> <manifest:file-entry manifest:media-type="application/xml" manifest:full-path="content.xml" manifest:version="1.2" /> <manifest:file-entry manifest:media-type="application/rdf+xml" manifest:full-path="manifest.rdf" manifest:version="1.2" /> <manifest:file-entry manifest:media-type="application/xml" manifest:full-path="styles.xml" manifest:version="1.2" /> <manifest:file-entry manifest:media-type="application/xml" manifest:full-path="meta.xml" manifest:version="1.2" /> <manifest:file-entry manifest:media-type="application/xml" manifest:full-path="settings.xml" manifest:version="1.2" /> </manifest:manifest> ''' _MANIFEST_RDF = '''<?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="styles.xml"> <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/odf#StylesFile"/> </rdf:Description> <rdf:Description rdf:about=""> <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="styles.xml"/> </rdf:Description> <rdf:Description rdf:about="content.xml"> <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/odf#ContentFile"/> </rdf:Description> <rdf:Description rdf:about=""> <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="content.xml"/> </rdf:Description> <rdf:Description rdf:about=""> <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#Document"/> </rdf:Description> </rdf:RDF> ''' _SETTINGS_XML = '''<?xml version="1.0" encoding="UTF-8"?> <office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.2"> <office:settings> <config:config-item-set config:name="ooo:view-settings"> <config:config-item config:name="ViewAreaTop" config:type="int">0</config:config-item> <config:config-item config:name="ViewAreaLeft" config:type="int">0</config:config-item> <config:config-item config:name="ViewAreaWidth" config:type="int">30508</config:config-item> <config:config-item config:name="ViewAreaHeight" config:type="int">27783</config:config-item> <config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item> <config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item> <config:config-item-map-indexed config:name="Views"> <config:config-item-map-entry> <config:config-item config:name="ViewId" config:type="string">view2</config:config-item> <config:config-item config:name="ViewLeft" config:type="int">8079</config:config-item> <config:config-item config:name="ViewTop" config:type="int">3501</config:config-item> <config:config-item config:name="VisibleLeft" config:type="int">0</config:config-item> <config:config-item config:name="VisibleTop" config:type="int">0</config:config-item> <config:config-item config:name="VisibleRight" config:type="int">30506</config:config-item> <config:config-item config:name="VisibleBottom" config:type="int">27781</config:config-item> <config:config-item config:name="ZoomType" config:type="short">0</config:config-item> <config:config-item config:name="ViewLayoutColumns" config:type="short">0</config:config-item> <config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item> <config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item> <config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item> </config:config-item-map-entry> </config:config-item-map-indexed> </config:config-item-set> <config:config-item-set config:name="ooo:configuration-settings"> <config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item> <config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item> <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item> <config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item> <config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item> <config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">false</config:config-item> <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item> <config:config-item config:name="PrintEmptyPages" config:type="boolean">true</config:config-item> <config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item> <config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item> <config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item> <config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item> <config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item> <config:config-item config:name="ProtectForm" config:type="boolean">false</config:config-item> <config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item> <config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item> <config:config-item config:name="PrinterSetup" config:type="base64Binary">8gT+/0hQIExhc2VySmV0IFAyMDE0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASFAgTGFzZXJKZXQgUDIwMTQAAAAAAAAAAAAAAAAAAAAWAAEAGAQAAAAAAAAEAAhSAAAEdAAAM1ROVwIACABIAFAAIABMAGEAcwBlAHIASgBlAHQAIABQADIAMAAxADQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQQDANwANAMPnwAAAQAJAJoLNAgAAAEABwBYAgEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU0RETQAGAAAABgAASFAgTGFzZXJKZXQgUDIwMTQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAAAAAABAAAAAQAAABoEAAAAAAAAAAAAAAAAAAAPAAAALQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAgICAAP8AAAD//wAAAP8AAAD//wAAAP8A/wD/AAAAAAAAAAAAAAAAAAAAAAAoAAAAZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADeAwAA3gMAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABrjvBgNAMAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAQ09NUEFUX0RVUExFWF9NT0RFCgBEVVBMRVhfT0ZG</config:config-item> <config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/> <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item> <config:config-item config:name="CurrentDatabaseCommand" config:type="string"/> <config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item> <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item> <config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item> <config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item> <config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item> <config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item> <config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">false</config:config-item> <config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item> <config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item> <config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">false</config:config-item> <config:config-item config:name="TableRowKeep" config:type="boolean">false</config:config-item> <config:config-item config:name="PrinterName" config:type="string">HP LaserJet P2014</config:config-item> <config:config-item config:name="PrintFaxName" config:type="string"/> <config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">false</config:config-item> <config:config-item config:name="PrintTextPlaceholder" config:type="boolean">false</config:config-item> <config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item> <config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item> <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item> <config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item> <config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item> <config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item> <config:config-item config:name="PrintHiddenText" config:type="boolean">false</config:config-item> <config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item> <config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item> <config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item> <config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">false</config:config-item> <config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item> <config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item> <config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item> <config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item> <config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item> <config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item> <config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item> <config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/> <config:config-item config:name="MathBaselineAlignment" config:type="boolean">false</config:config-item> <config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item> <config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item> <config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item> <config:config-item config:name="PrinterIndependentLayout" config:type="string">disabled</config:config-item> <config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">false</config:config-item> <config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item> <config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item> </config:config-item-set> </office:settings> </office:document-settings> ''' _STYLES_XML = '''<?xml version="1.0" encoding="UTF-8"?> <office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"> <office:font-face-decls> <style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" style:font-charset="x-symbol"/> <style:font-face style:name="Segoe UI" svg:font-family="&apos;Segoe UI&apos;"/> <style:font-face style:name="Courier New" svg:font-family="&apos;Courier New&apos;" style:font-adornments="Standard" style:font-family-generic="modern" style:font-pitch="fixed"/> </office:font-face-decls> <office:styles> <style:default-style style:family="graphic"> <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="true"/> <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false"> <style:tab-stops/> </style:paragraph-properties> <style:text-properties fo:color="#000000" fo:font-size="10pt" fo:language="$Language" fo:country="$Country" style:font-size-asian="10pt" style:language-asian="zxx" style:country-asian="none" style:font-size-complex="1pt" style:language-complex="zxx" style:country-complex="none"/> </style:default-style> <style:default-style style:family="paragraph"> <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="lr-tb"/> <style:text-properties fo:color="#000000" style:font-name="Segoe UI" fo:font-size="10pt" fo:language="$Language" fo:country="$Country" style:font-name-asian="Segoe UI" style:font-size-asian="10pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Segoe UI" style:font-size-complex="1pt" style:language-complex="zxx" style:country-complex="none" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/> </style:default-style> <style:style style:name="Standard" style:family="paragraph" style:class="text" style:master-page-name=""> <style:paragraph-properties fo:line-height="0.73cm" style:page-number="auto"/> <style:text-properties style:font-name="Courier New" fo:font-size="12pt" fo:font-weight="normal"/> </style:style> <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="First_20_line_20_indent" style:class="text" style:master-page-name=""> <style:paragraph-properties style:page-number="auto"> <style:tab-stops/> </style:paragraph-properties> </style:style> <style:style style:name="First_20_line_20_indent" style:display-name="First line indent" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="text" style:master-page-name=""> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0.499cm" style:auto-text-indent="false" style:page-number="auto"/> </style:style> <style:style style:name="Hanging_20_indent" style:display-name="Hanging indent" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="text"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="0cm"/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Text_20_body_20_indent" style:display-name="Text body indent" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="text"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text" style:master-page-name=""> <style:paragraph-properties fo:line-height="0.73cm" fo:text-align="center" style:justify-single-word="false" style:page-number="auto" fo:keep-with-next="always"> <style:tab-stops/> </style:paragraph-properties> </style:style> <style:style style:name="Heading_20_1" style:display-name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="1" style:list-style-name="" style:class="text" style:master-page-name=""> <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="1.461cm" fo:margin-bottom="0.73cm" style:page-number="auto"> <style:tab-stops/> </style:paragraph-properties> <style:text-properties fo:text-transform="uppercase" fo:font-weight="bold"/> </style:style> <style:style style:name="Heading_20_2" style:display-name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="2" style:list-style-name="" style:class="text" style:master-page-name=""> <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="1.461cm" fo:margin-bottom="0.73cm" style:page-number="auto"/> <style:text-properties fo:font-weight="bold"/> </style:style> <style:style style:name="Heading_20_3" style:display-name="Heading 3" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="3" style:list-style-name="" style:class="text" style:master-page-name=""> <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="0.73cm" fo:margin-bottom="0.73cm" style:page-number="auto"/> <style:text-properties fo:font-style="italic"/> </style:style> <style:style style:name="Heading_20_4" style:display-name="Heading 4" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="" style:list-style-name="" style:class="text" style:master-page-name=""> <style:paragraph-properties fo:margin-top="0.73cm" fo:margin-bottom="0.73cm" style:page-number="auto"/> </style:style> <style:style style:name="Heading_20_5" style:display-name="Heading 5" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="" style:list-style-name="" style:class="text" style:master-page-name=""> <style:paragraph-properties style:page-number="auto"/> </style:style> <style:style style:name="Heading_20_6" style:display-name="Heading 6" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="" style:list-style-name="" style:class="text"/> <style:style style:name="Heading_20_7" style:display-name="Heading 7" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="" style:list-style-name="" style:class="text"/> <style:style style:name="Heading_20_8" style:display-name="Heading 8" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="" style:list-style-name="" style:class="text"/> <style:style style:name="Heading_20_9" style:display-name="Heading 9" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="" style:list-style-name="" style:class="text"/> <style:style style:name="Heading_20_10" style:display-name="Heading 10" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="10" style:list-style-name="" style:class="text"> <style:text-properties fo:font-size="75%" fo:font-weight="bold"/> </style:style> <style:style style:name="Header_20_and_20_Footer" style:display-name="Header and Footer" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> <style:paragraph-properties text:number-lines="false" text:line-number="0"> <style:tab-stops> <style:tab-stop style:position="8.5cm" style:type="center"/> <style:tab-stop style:position="17cm" style:type="right"/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Header" style:family="paragraph" style:parent-style-name="Standard" style:class="extra" style:master-page-name=""> <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" style:page-number="auto" fo:padding="0.049cm" fo:border-left="none" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.002cm solid #000000" style:shadow="none"> <style:tab-stops> <style:tab-stop style:position="8.5cm" style:type="center"/> <style:tab-stop style:position="17.002cm" style:type="right"/> </style:tab-stops> </style:paragraph-properties> <style:text-properties fo:font-variant="normal" fo:text-transform="none" fo:font-style="italic"/> </style:style> <style:style style:name="Header_20_left" style:display-name="Header left" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> <style:paragraph-properties> <style:tab-stops> <style:tab-stop style:position="8.5cm" style:type="center"/> <style:tab-stop style:position="17.002cm" style:type="right"/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Header_20_right" style:display-name="Header right" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> <style:paragraph-properties> <style:tab-stops> <style:tab-stop style:position="8.5cm" style:type="center"/> <style:tab-stop style:position="17.002cm" style:type="right"/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Footer" style:family="paragraph" style:parent-style-name="Standard" style:class="extra" style:master-page-name=""> <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" style:page-number="auto" text:number-lines="false" text:line-number="0"> <style:tab-stops> <style:tab-stop style:position="8.5cm" style:type="center"/> <style:tab-stop style:position="17.002cm" style:type="right"/> </style:tab-stops> </style:paragraph-properties> <style:text-properties fo:font-size="11pt"/> </style:style> <style:style style:name="Footer_20_left" style:display-name="Footer left" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> <style:paragraph-properties> <style:tab-stops> <style:tab-stop style:position="8.5cm" style:type="center"/> <style:tab-stop style:position="17.002cm" style:type="right"/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Footer_20_right" style:display-name="Footer right" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> <style:paragraph-properties> <style:tab-stops> <style:tab-stop style:position="8.5cm" style:type="center"/> <style:tab-stop style:position="17.002cm" style:type="right"/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Title" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Subtitle" style:class="chapter" style:master-page-name=""> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.000cm" fo:margin-bottom="0cm" fo:line-height="200%" fo:text-align="center" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false" style:page-number="auto" fo:background-color="transparent" fo:padding="0cm" fo:border="none" text:number-lines="false" text:line-number="0"> <style:tab-stops/> <style:background-image/> </style:paragraph-properties> <style:text-properties fo:text-transform="uppercase" fo:font-weight="normal" style:letter-kerning="false"/> </style:style> <style:style style:name="Subtitle" style:family="paragraph" style:parent-style-name="Title" style:class="chapter" style:master-page-name=""> <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="0cm" fo:margin-bottom="0cm" style:page-number="auto"/> <style:text-properties fo:font-variant="normal" fo:text-transform="none" fo:letter-spacing="normal" fo:font-style="italic" fo:font-weight="normal"/> </style:style> <style:style style:name="yWriter_20_mark" style:display-name="yWriter mark" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Standard" style:class="text"> <style:text-properties fo:color="#008000" fo:font-size="10pt"/> </style:style> <style:style style:name="yWriter_20_mark_20_unused" style:display-name="yWriter mark unused" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Standard" style:class="text"> <style:text-properties fo:color="#808080" fo:font-size="10pt"/> </style:style> <style:style style:name="yWriter_20_mark_20_notes" style:display-name="yWriter mark notes" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Standard" style:class="text"> <style:text-properties fo:color="#0000FF" fo:font-size="10pt"/> </style:style> <style:style style:name="yWriter_20_mark_20_todo" style:display-name="yWriter mark todo" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Standard" style:class="text"> <style:text-properties fo:color="#B22222" fo:font-size="10pt"/> </style:style> <style:style style:name="Emphasis" style:family="text"> <style:text-properties fo:font-style="italic" fo:background-color="transparent"/> </style:style> <style:style style:name="Strong_20_Emphasis" style:display-name="Strong Emphasis" style:family="text"> <style:text-properties fo:text-transform="uppercase"/> </style:style> </office:styles> <office:automatic-styles> <style:page-layout style:name="Mpm1"> <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:paper-tray-name="[From printer settings]" style:print-orientation="portrait" fo:margin-top="3.2cm" fo:margin-bottom="2.499cm" fo:margin-left="2.701cm" fo:margin-right="3cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm"> <style:columns fo:column-count="1" fo:column-gap="0cm"/> <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> </style:page-layout-properties> <style:header-style/> <style:footer-style> <style:header-footer-properties fo:min-height="1.699cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="1.199cm" style:shadow="none" style:dynamic-spacing="false"/> </style:footer-style> </style:page-layout> </office:automatic-styles> <office:master-styles> <style:master-page style:name="Standard" style:page-layout-name="Mpm1"> <style:footer> <text:p text:style-name="Footer"><text:page-number text:select-page="current"/></text:p> </style:footer> </style:master-page> </office:master-styles> </office:document-styles> ''' _MIMETYPE = 'application/vnd.oasis.opendocument.text' def _set_up(self): """Helper method for ZIP file generation. Add rdf manifest to the temporary directory containing the internal structure of an ODF file. Return a message beginning with the ERROR constant in case of error. Extends the superclass method. """ # Generate the common ODF components. message = super()._set_up() if message.startswith(ERROR): return message # Generate manifest.rdf try: with open(f'{self._tempDir}/manifest.rdf', 'w', encoding='utf-8') as f: f.write(self._MANIFEST_RDF) except: return f'{ERROR}Cannot write "manifest.rdf"' return 'ODT structure generated.' def _convert_from_yw(self, text, quick=False): """Return text, converted from yw7 markup to target format. Positional arguments: text -- string to convert. Optional arguments: quick -- bool: if True, apply a conversion mode for one-liners without formatting. Overrides the superclass method. """ if quick: # Just clean up a one-liner without sophisticated formatting. try: return text.replace('&', '&amp;').replace('>', '&gt;').replace('<', '&lt;') except AttributeError: return '' ODT_REPLACEMENTS = [ ('&', '&amp;'), ('>', '&gt;'), ('<', '&lt;'), ('\n\n', '</text:p>\r<text:p text:style-name="First_20_line_20_indent" />\r<text:p text:style-name="Text_20_body">'), ('\n', '</text:p>\r<text:p text:style-name="First_20_line_20_indent">'), ('\r', '\n'), ('[i]', '<text:span text:style-name="Emphasis">'), ('[/i]', '</text:span>'), ('[b]', '<text:span text:style-name="Strong_20_Emphasis">'), ('[/b]', '</text:span>'), ('/*', f'<office:annotation><dc:creator>{self.authorName}</dc:creator><text:p>'), ('*/', '</text:p></office:annotation>'), ] try: # process italics and bold markup reaching across linebreaks italics = False bold = False newlines = [] lines = text.split('\n') for line in lines: if italics: line = f'[i]{line}' italics = False while line.count('[i]') > line.count('[/i]'): line = f'{line}[/i]' italics = True while line.count('[/i]') > line.count('[i]'): line = f'[i]{line}' line = line.replace('[i][/i]', '') if bold: line = f'[b]{line}' bold = False while line.count('[b]') > line.count('[/b]'): line = f'{line}[/b]' bold = True while line.count('[/b]') > line.count('[b]'): line = f'[b]{line}' line = line.replace('[b][/b]', '') newlines.append(line) text = '\n'.join(newlines).rstrip() for yw, od in ODT_REPLACEMENTS: text = text.replace(yw, od) # Remove highlighting, alignment, # strikethrough, and underline tags. text = re.sub('\[\/*[h|c|r|s|u]\d*\]', '', text) except AttributeError: text = '' return text class OdtAeon(OdtFile): """ODT Aeon Timeline import file representation. """ _STYLES_XML = '''<?xml version="1.0" encoding="UTF-8"?> <office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"> <office:font-face-decls> <style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" style:font-charset="x-symbol"/> <style:font-face style:name="Segoe UI" svg:font-family="&apos;Segoe UI&apos;"/> <style:font-face style:name="Courier New" svg:font-family="&apos;Courier New&apos;" style:font-adornments="Standard" style:font-family-generic="modern" style:font-pitch="fixed"/> <style:font-face style:name="DejaVu Sans" svg:font-family="&apos;DejaVu Sans&apos;" style:font-adornments="Book" style:font-family-generic="swiss" style:font-pitch="variable"/> <style:font-face style:name="DejaVu Sans Condensed" svg:font-family="&apos;DejaVu Sans Condensed&apos;" style:font-adornments="Book" style:font-family-generic="swiss" style:font-pitch="variable"/> <style:font-face style:name="DejaVu Sans Condensed1" svg:font-family="&apos;DejaVu Sans Condensed&apos;" style:font-adornments="Fett" style:font-family-generic="swiss" style:font-pitch="variable"/> </office:font-face-decls> <office:styles> <style:default-style style:family="graphic"> <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="true"/> <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false"> <style:tab-stops/> </style:paragraph-properties> <style:text-properties fo:color="#000000" fo:font-size="10pt" fo:language="de" fo:country="DE" style:font-size-asian="10pt" style:language-asian="zxx" style:country-asian="none" style:font-size-complex="1pt" style:language-complex="zxx" style:country-complex="none"/> </style:default-style> <style:default-style style:family="paragraph"> <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="lr-tb"/> <style:text-properties fo:color="#000000" style:font-name="Segoe UI" fo:font-size="10pt" fo:language="de" fo:country="DE" style:font-name-asian="Segoe UI" style:font-size-asian="10pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Segoe UI" style:font-size-complex="1pt" style:language-complex="zxx" style:country-complex="none" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/> </style:default-style> <style:default-style style:family="table"> <style:table-properties table:border-model="separating"/> </style:default-style> <style:default-style style:family="table-row"> <style:table-row-properties fo:keep-together="always"/> </style:default-style> <style:style style:name="Standard" style:family="paragraph" style:class="text" style:master-page-name=""> <style:paragraph-properties fo:line-height="150%" style:page-number="auto"/> <style:text-properties style:font-name="DejaVu Sans" fo:font-size="11pt" fo:font-weight="normal"/> </style:style> <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="First_20_line_20_indent" style:class="text" style:master-page-name=""> <style:paragraph-properties style:page-number="auto"> <style:tab-stops/> </style:paragraph-properties> </style:style> <style:style style:name="First_20_line_20_indent" style:display-name="First line indent" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="text" style:master-page-name=""> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.499cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false" style:page-number="auto"/> </style:style> <style:style style:name="Hanging_20_indent" style:display-name="Hanging indent" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="text"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="0cm"/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Text_20_body_20_indent" style:display-name="Text body indent" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="text"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"/> <style:text-properties style:font-name="DejaVu Sans Condensed" fo:font-size="10pt" fo:font-style="italic"/> </style:style> <style:style style:name="Salutation" style:family="paragraph" style:parent-style-name="Standard" style:class="text"/> <style:style style:name="Signature" style:family="paragraph" style:parent-style-name="Standard" style:class="text"/> <style:style style:name="List_20_Indent" style:display-name="List Indent" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="text"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="5.001cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="-4.5cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="0cm"/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Marginalia" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="text"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="4.001cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text" style:master-page-name=""> <style:paragraph-properties fo:line-height="0.73cm" style:page-number="auto" fo:keep-with-next="always"> <style:tab-stops/> </style:paragraph-properties> <style:text-properties style:font-name="DejaVu Sans Condensed1" fo:font-weight="bold"/> </style:style> <style:style style:name="Heading_20_1" style:display-name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="1" style:list-style-name="" style:class="text" style:master-page-name=""> <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="1.461cm" fo:margin-bottom="0.73cm" style:page-number="auto"> <style:tab-stops/> </style:paragraph-properties> <style:text-properties fo:text-transform="uppercase" fo:font-size="16pt"/> </style:style> <style:style style:name="Heading_20_2" style:display-name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="2" style:list-style-name="" style:class="text" style:master-page-name=""> <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="1.461cm" fo:margin-bottom="0.73cm" style:page-number="auto"/> <style:text-properties fo:font-size="13pt"/> </style:style> <style:style style:name="Heading_20_3" style:display-name="Heading 3" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="3" style:list-style-name="" style:class="text" style:master-page-name=""> <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="0.73cm" fo:margin-bottom="0.73cm" style:page-number="auto"/> </style:style> <style:style style:name="Heading_20_4" style:display-name="Heading 4" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="" style:list-style-name="" style:class="text" style:master-page-name=""> <style:paragraph-properties fo:margin-top="0.73cm" fo:margin-bottom="0.73cm" style:page-number="auto"/> </style:style> <style:style style:name="Heading_20_5" style:display-name="Heading 5" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="" style:list-style-name="" style:class="text" style:master-page-name=""> <style:paragraph-properties style:page-number="auto"/> </style:style> <style:style style:name="Heading_20_6" style:display-name="Heading 6" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="" style:list-style-name="" style:class="text"/> <style:style style:name="Heading_20_7" style:display-name="Heading 7" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="" style:list-style-name="" style:class="text"/> <style:style style:name="Heading_20_8" style:display-name="Heading 8" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="" style:list-style-name="" style:class="text"/> <style:style style:name="Heading_20_9" style:display-name="Heading 9" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="" style:list-style-name="" style:class="text"/> <style:style style:name="Heading_20_10" style:display-name="Heading 10" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="10" style:list-style-name="" style:class="text"> <style:text-properties fo:font-size="75%" fo:font-weight="bold"/> </style:style> <style:style style:name="List" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="list"/> <style:style style:name="Numbering_20_1_20_Start" style:display-name="Numbering 1 Start" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_1" style:display-name="Numbering 1" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_1_20_End" style:display-name="Numbering 1 End" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.423cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_1_20_Cont." style:display-name="Numbering 1 Cont." style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_2_20_Start" style:display-name="Numbering 2 Start" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.998cm" fo:margin-right="0cm" fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_2" style:display-name="Numbering 2" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.998cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_2_20_End" style:display-name="Numbering 2 End" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.998cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.423cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_2_20_Cont." style:display-name="Numbering 2 Cont." style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.998cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_3_20_Start" style:display-name="Numbering 3 Start" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.498cm" fo:margin-right="0cm" fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_3" style:display-name="Numbering 3" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.498cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_3_20_End" style:display-name="Numbering 3 End" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.498cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.423cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_3_20_Cont." style:display-name="Numbering 3 Cont." style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.498cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_4_20_Start" style:display-name="Numbering 4 Start" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.997cm" fo:margin-right="0cm" fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_4" style:display-name="Numbering 4" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.997cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_4_20_End" style:display-name="Numbering 4 End" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.997cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.423cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_4_20_Cont." style:display-name="Numbering 4 Cont." style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.997cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_5_20_Start" style:display-name="Numbering 5 Start" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="2.496cm" fo:margin-right="0cm" fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_5" style:display-name="Numbering 5" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="2.496cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_5_20_End" style:display-name="Numbering 5 End" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="2.496cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.423cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Numbering_20_5_20_Cont." style:display-name="Numbering 5 Cont." style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="2.496cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_1_20_Start" style:display-name="List 1 Start" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_1" style:display-name="List 1" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_1_20_End" style:display-name="List 1 End" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.423cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_1_20_Cont." style:display-name="List 1 Cont." style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_2_20_Start" style:display-name="List 2 Start" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.998cm" fo:margin-right="0cm" fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_2" style:display-name="List 2" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.998cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_2_20_End" style:display-name="List 2 End" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.998cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.423cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_2_20_Cont." style:display-name="List 2 Cont." style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.998cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_3_20_Start" style:display-name="List 3 Start" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.498cm" fo:margin-right="0cm" fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_3" style:display-name="List 3" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.498cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_3_20_End" style:display-name="List 3 End" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.498cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.423cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_3_20_Cont." style:display-name="List 3 Cont." style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.498cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_4_20_Start" style:display-name="List 4 Start" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.997cm" fo:margin-right="0cm" fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_4" style:display-name="List 4" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.997cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_4_20_End" style:display-name="List 4 End" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.997cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.423cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_4_20_Cont." style:display-name="List 4 Cont." style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.997cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_5_20_Start" style:display-name="List 5 Start" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="2.496cm" fo:margin-right="0cm" fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_5" style:display-name="List 5" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="2.496cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_5_20_End" style:display-name="List 5 End" style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="2.496cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.423cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_5_20_Cont." style:display-name="List 5 Cont." style:family="paragraph" style:parent-style-name="List" style:class="list"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="2.496cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.212cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Header_20_and_20_Footer" style:display-name="Header and Footer" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> <style:paragraph-properties text:number-lines="false" text:line-number="0"> <style:tab-stops> <style:tab-stop style:position="8.5cm" style:type="center"/> <style:tab-stop style:position="17cm" style:type="right"/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Header" style:family="paragraph" style:parent-style-name="Standard" style:class="extra" style:master-page-name=""> <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" style:page-number="auto" fo:padding="0.049cm" fo:border-left="none" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.002cm solid #000000" style:shadow="none"> <style:tab-stops> <style:tab-stop style:position="8.5cm" style:type="center"/> <style:tab-stop style:position="17.002cm" style:type="right"/> </style:tab-stops> </style:paragraph-properties> <style:text-properties fo:font-variant="normal" fo:text-transform="none" fo:font-style="italic"/> </style:style> <style:style style:name="Header_20_left" style:display-name="Header left" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> <style:paragraph-properties> <style:tab-stops> <style:tab-stop style:position="8.5cm" style:type="center"/> <style:tab-stop style:position="17.002cm" style:type="right"/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Header_20_right" style:display-name="Header right" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> <style:paragraph-properties> <style:tab-stops> <style:tab-stop style:position="8.5cm" style:type="center"/> <style:tab-stop style:position="17.002cm" style:type="right"/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Footer" style:family="paragraph" style:parent-style-name="Standard" style:class="extra" style:master-page-name=""> <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" style:page-number="auto" text:number-lines="false" text:line-number="0"> <style:tab-stops> <style:tab-stop style:position="8.5cm" style:type="center"/> <style:tab-stop style:position="17.002cm" style:type="right"/> </style:tab-stops> </style:paragraph-properties> <style:text-properties fo:font-size="11pt"/> </style:style> <style:style style:name="Footer_20_left" style:display-name="Footer left" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> <style:paragraph-properties> <style:tab-stops> <style:tab-stop style:position="8.5cm" style:type="center"/> <style:tab-stop style:position="17.002cm" style:type="right"/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Footer_20_right" style:display-name="Footer right" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> <style:paragraph-properties> <style:tab-stops> <style:tab-stop style:position="8.5cm" style:type="center"/> <style:tab-stop style:position="17.002cm" style:type="right"/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Table_20_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="extra"/> <style:style style:name="Table_20_Heading" style:display-name="Table Heading" style:family="paragraph" style:parent-style-name="Table_20_Contents" style:class="extra"> <style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/> <style:text-properties fo:font-style="italic" fo:font-weight="bold"/> </style:style> <style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="0.212cm" fo:margin-bottom="0.212cm"/> </style:style> <style:style style:name="Illustration" style:family="paragraph" style:parent-style-name="Caption" style:class="extra"/> <style:style style:name="Table" style:family="paragraph" style:parent-style-name="Caption" style:class="extra"/> <style:style style:name="Text" style:family="paragraph" style:parent-style-name="Caption" style:class="extra" style:master-page-name=""> <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="0.21cm" fo:margin-bottom="0.21cm" style:page-number="auto"/> </style:style> <style:style style:name="Frame_20_contents" style:display-name="Frame contents" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="extra"/> <style:style style:name="Footnote" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="-0.499cm" style:auto-text-indent="false"/> <style:text-properties fo:font-size="10pt"/> </style:style> <style:style style:name="Addressee" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="0cm" fo:margin-bottom="0.106cm"/> </style:style> <style:style style:name="Sender" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="0cm" fo:margin-bottom="0.106cm" fo:line-height="100%" text:number-lines="false" text:line-number="0"/> </style:style> <style:style style:name="Endnote" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="-0.499cm" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/> <style:text-properties fo:font-size="10pt"/> </style:style> <style:style style:name="Drawing" style:family="paragraph" style:parent-style-name="Caption" style:class="extra"/> <style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index"/> <style:style style:name="Index_20_Heading" style:display-name="Index Heading" style:family="paragraph" style:parent-style-name="Heading" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"/> <style:text-properties fo:font-size="16pt" fo:font-weight="bold"/> </style:style> <style:style style:name="Index_20_1" style:display-name="Index 1" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Index_20_2" style:display-name="Index 2" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Index_20_3" style:display-name="Index 3" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Index_20_Separator" style:display-name="Index Separator" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="Contents_20_Heading" style:display-name="Contents Heading" style:family="paragraph" style:parent-style-name="Heading" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"/> <style:text-properties fo:font-size="16pt" fo:font-weight="bold"/> </style:style> <style:style style:name="Contents_20_1" style:display-name="Contents 1" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="17.002cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Contents_20_2" style:display-name="Contents 2" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="16.503cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Contents_20_3" style:display-name="Contents 3" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.998cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="16.004cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Contents_20_4" style:display-name="Contents 4" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.498cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="15.505cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Contents_20_5" style:display-name="Contents 5" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.997cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="15.005cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="User_20_Index_20_Heading" style:display-name="User Index Heading" style:family="paragraph" style:parent-style-name="Heading" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"/> <style:text-properties fo:font-size="16pt" fo:font-weight="bold"/> </style:style> <style:style style:name="User_20_Index_20_1" style:display-name="User Index 1" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="17.002cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="User_20_Index_20_2" style:display-name="User Index 2" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="16.503cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="User_20_Index_20_3" style:display-name="User Index 3" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.998cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="16.004cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="User_20_Index_20_4" style:display-name="User Index 4" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.498cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="15.505cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="User_20_Index_20_5" style:display-name="User Index 5" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1.997cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="15.005cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Contents_20_6" style:display-name="Contents 6" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="2.496cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="11.105cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Contents_20_7" style:display-name="Contents 7" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="2.995cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="10.606cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Contents_20_8" style:display-name="Contents 8" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="3.494cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="10.107cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Contents_20_9" style:display-name="Contents 9" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="3.993cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="9.608cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Contents_20_10" style:display-name="Contents 10" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="4.493cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="9.109cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Illustration_20_Index_20_Heading" style:display-name="Illustration Index Heading" style:family="paragraph" style:parent-style-name="Heading" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/> <style:text-properties fo:font-size="16pt" fo:font-weight="bold"/> </style:style> <style:style style:name="Illustration_20_Index_20_1" style:display-name="Illustration Index 1" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="13.601cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Object_20_index_20_heading" style:display-name="Object index heading" style:family="paragraph" style:parent-style-name="Heading" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/> <style:text-properties fo:font-size="16pt" fo:font-weight="bold"/> </style:style> <style:style style:name="Object_20_index_20_1" style:display-name="Object index 1" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="13.601cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Table_20_index_20_heading" style:display-name="Table index heading" style:family="paragraph" style:parent-style-name="Heading" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/> <style:text-properties fo:font-size="16pt" fo:font-weight="bold"/> </style:style> <style:style style:name="Table_20_index_20_1" style:display-name="Table index 1" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="13.601cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Bibliography_20_Heading" style:display-name="Bibliography Heading" style:family="paragraph" style:parent-style-name="Heading" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/> <style:text-properties fo:font-size="16pt" fo:font-weight="bold"/> </style:style> <style:style style:name="Bibliography_20_1" style:display-name="Bibliography 1" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="13.601cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="User_20_Index_20_6" style:display-name="User Index 6" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="2.496cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="11.105cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="User_20_Index_20_7" style:display-name="User Index 7" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="2.995cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="10.606cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="User_20_Index_20_8" style:display-name="User Index 8" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="3.494cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="10.107cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="User_20_Index_20_9" style:display-name="User Index 9" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="3.993cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="9.608cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="User_20_Index_20_10" style:display-name="User Index 10" style:family="paragraph" style:parent-style-name="Index" style:class="index"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="4.493cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"> <style:tab-stops> <style:tab-stop style:position="9.109cm" style:type="right" style:leader-style="dotted" style:leader-text="."/> </style:tab-stops> </style:paragraph-properties> </style:style> <style:style style:name="Title" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Subtitle" style:class="chapter" style:master-page-name=""> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="200%" fo:text-align="center" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false" style:page-number="auto" fo:background-color="transparent" fo:padding="0cm" fo:border="none" text:number-lines="false" text:line-number="0"> <style:tab-stops/> <style:background-image/> </style:paragraph-properties> <style:text-properties fo:text-transform="uppercase" fo:font-weight="normal" style:letter-kerning="false"/> </style:style> <style:style style:name="Subtitle" style:family="paragraph" style:parent-style-name="Title" style:class="chapter" style:master-page-name=""> <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="0cm" fo:margin-bottom="0cm" style:page-number="auto"/> <style:text-properties fo:font-variant="normal" fo:text-transform="none" fo:letter-spacing="normal" fo:font-style="italic" fo:font-weight="normal"/> </style:style> <style:style style:name="Quotations" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="html" style:master-page-name=""> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0.499cm" fo:margin-right="0.499cm" fo:margin-top="0cm" fo:margin-bottom="0.499cm" fo:text-indent="0cm" style:auto-text-indent="false" style:page-number="auto"/> </style:style> <style:style style:name="Preformatted_20_Text" style:display-name="Preformatted Text" style:family="paragraph" style:parent-style-name="Standard" style:class="html"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="0cm" fo:margin-bottom="0cm"/> </style:style> <style:style style:name="Horizontal_20_Line" style:display-name="Horizontal Line" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="html"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin-top="0cm" fo:margin-bottom="0.499cm" style:border-line-width-bottom="0.002cm 0.035cm 0.002cm" fo:padding="0cm" fo:border-left="none" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.039cm double #808080" text:number-lines="false" text:line-number="0"/> <style:text-properties fo:font-size="6pt"/> </style:style> <style:style style:name="List_20_Contents" style:display-name="List Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="html"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="1cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="List_20_Heading" style:display-name="List Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="List_20_Contents" style:class="html"> <style:paragraph-properties loext:contextual-spacing="false" fo:margin="100%" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:text-indent="0cm" style:auto-text-indent="false"/> </style:style> <style:style style:name="yWriter_20_mark" style:display-name="yWriter mark" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Standard" style:class="text"> <style:text-properties fo:color="#008000" fo:font-size="10pt"/> </style:style> <style:style style:name="yWriter_20_mark_20_unused" style:display-name="yWriter mark unused" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Standard" style:class="text"> <style:text-properties fo:color="#808080" fo:font-size="10pt"/> </style:style> <style:style style:name="yWriter_20_mark_20_notes" style:display-name="yWriter mark notes" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Standard" style:class="text"> <style:text-properties fo:color="#0000ff" fo:font-size="10pt"/> </style:style> <style:style style:name="yWriter_20_mark_20_todo" style:display-name="yWriter mark todo" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Standard" style:class="text"> <style:text-properties fo:color="#b22222" fo:font-size="10pt"/> </style:style> <style:style style:name="Footnote_20_Symbol" style:display-name="Footnote Symbol" style:family="text"/> <style:style style:name="Page_20_Number" style:display-name="Page Number" style:family="text"> <style:text-properties fo:font-size="7pt" fo:letter-spacing="0.071cm" fo:font-weight="bold"/> </style:style> <style:style style:name="Caption_20_characters" style:display-name="Caption characters" style:family="text"/> <style:style style:name="Drop_20_Caps" style:display-name="Drop Caps" style:family="text"/> <style:style style:name="Numbering_20_Symbols" style:display-name="Numbering Symbols" style:family="text"/> <style:style style:name="Bullet_20_Symbols" style:display-name="Bullet Symbols" style:family="text"> <style:text-properties style:font-name="StarSymbol" fo:font-size="9pt"/> </style:style> <style:style style:name="Internet_20_link" style:display-name="Internet link" style:family="text"> <style:text-properties fo:color="#000080" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color"/> </style:style> <style:style style:name="Visited_20_Internet_20_Link" style:display-name="Visited Internet Link" style:family="text"> <style:text-properties fo:color="#800000" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color"/> </style:style> <style:style style:name="Placeholder" style:family="text"> <style:text-properties fo:font-variant="small-caps" fo:color="#008080" style:text-underline-style="dotted" style:text-underline-width="auto" style:text-underline-color="font-color"/> </style:style> <style:style style:name="Index_20_Link" style:display-name="Index Link" style:family="text"/> <style:style style:name="Endnote_20_Symbol" style:display-name="Endnote Symbol" style:family="text"/> <style:style style:name="Line_20_numbering" style:display-name="Line numbering" style:family="text"> <style:text-properties style:font-name="Courier New" fo:font-size="8pt"/> </style:style> <style:style style:name="Main_20_index_20_entry" style:display-name="Main index entry" style:family="text"> <style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/> </style:style> <style:style style:name="Footnote_20_anchor" style:display-name="Footnote anchor" style:family="text"> <style:text-properties style:text-position="super 58%"/> </style:style> <style:style style:name="Endnote_20_anchor" style:display-name="Endnote anchor" style:family="text"> <style:text-properties style:text-position="super 58%"/> </style:style> <style:style style:name="Rubies" style:family="text"> <style:text-properties fo:font-size="6pt" style:font-size-asian="6pt" style:font-size-complex="6pt"/> </style:style> <style:style style:name="Emphasis" style:family="text"> <style:text-properties fo:font-style="italic" fo:background-color="transparent"/> </style:style> <style:style style:name="Citation" style:family="text"> <style:text-properties fo:font-style="italic"/> </style:style> <style:style style:name="Strong_20_Emphasis" style:display-name="Strong Emphasis" style:family="text"> <style:text-properties fo:font-variant="normal" fo:text-transform="none" fo:font-weight="bold"/> </style:style> <style:style style:name="Source_20_Text" style:display-name="Source Text" style:family="text"/> <style:style style:name="Example" style:family="text"/> <style:style style:name="User_20_Entry" style:display-name="User Entry" style:family="text"/> <style:style style:name="Variable" style:family="text"> <style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/> </style:style> <style:style style:name="Definition" style:family="text"/> <style:style style:name="Teletype" style:family="text"/> <style:style style:name="Frame" style:family="graphic"> <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="parallel" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph-content" style:horizontal-pos="center" style:horizontal-rel="paragraph-content"/> </style:style> <style:style style:name="Graphics" style:family="graphic"> <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="none" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph"/> </style:style> <style:style style:name="OLE" style:family="graphic"> <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="none" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph"/> </style:style> <style:style style:name="Formula" style:family="graphic"> <style:graphic-properties text:anchor-type="as-char" svg:y="0cm" style:vertical-pos="top" style:vertical-rel="baseline"/> </style:style> <style:style style:name="Labels" style:family="graphic" style:auto-update="true"> <style:graphic-properties text:anchor-type="as-char" svg:y="0cm" fo:margin-left="0.201cm" fo:margin-right="0.201cm" style:protect="size position" style:vertical-pos="top" style:vertical-rel="baseline"/> </style:style> <text:outline-style style:name="Outline"> <text:outline-level-style text:level="1" style:num-format=""> <style:list-level-properties text:min-label-distance="0.381cm"/> </text:outline-level-style> <text:outline-level-style text:level="2" style:num-format=""> <style:list-level-properties text:min-label-distance="0.381cm"/> </text:outline-level-style> <text:outline-level-style text:level="3" text:style-name="Zeichenformat" style:num-format=""> <style:list-level-properties/> </text:outline-level-style> <text:outline-level-style text:level="4" style:num-format=""> <style:list-level-properties text:min-label-distance="0.381cm"/> </text:outline-level-style> <text:outline-level-style text:level="5" style:num-format=""> <style:list-level-properties text:min-label-distance="0.381cm"/> </text:outline-level-style> <text:outline-level-style text:level="6" style:num-format=""> <style:list-level-properties text:min-label-distance="0.381cm"/> </text:outline-level-style> <text:outline-level-style text:level="7" style:num-format=""> <style:list-level-properties text:min-label-distance="0.381cm"/> </text:outline-level-style> <text:outline-level-style text:level="8" style:num-format=""> <style:list-level-properties text:min-label-distance="0.381cm"/> </text:outline-level-style> <text:outline-level-style text:level="9" style:num-format=""> <style:list-level-properties text:min-label-distance="0.381cm"/> </text:outline-level-style> <text:outline-level-style text:level="10" style:num-format=""> <style:list-level-properties text:min-label-distance="0.381cm"/> </text:outline-level-style> </text:outline-style> <text:list-style style:name="Numbering_20_1" style:display-name="Numbering 1"> <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"> <style:list-level-properties text:min-label-width="0.499cm"/> </text:list-level-style-number> <text:list-level-style-number text:level="2" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"> <style:list-level-properties text:space-before="0.499cm" text:min-label-width="0.499cm"/> </text:list-level-style-number> <text:list-level-style-number text:level="3" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"> <style:list-level-properties text:space-before="0.999cm" text:min-label-width="0.499cm"/> </text:list-level-style-number> <text:list-level-style-number text:level="4" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"> <style:list-level-properties text:space-before="1.498cm" text:min-label-width="0.499cm"/> </text:list-level-style-number> <text:list-level-style-number text:level="5" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"> <style:list-level-properties text:space-before="1.997cm" text:min-label-width="0.499cm"/> </text:list-level-style-number> <text:list-level-style-number text:level="6" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"> <style:list-level-properties text:space-before="2.496cm" text:min-label-width="0.499cm"/> </text:list-level-style-number> <text:list-level-style-number text:level="7" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"> <style:list-level-properties text:space-before="2.995cm" text:min-label-width="0.499cm"/> </text:list-level-style-number> <text:list-level-style-number text:level="8" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"> <style:list-level-properties text:space-before="3.494cm" text:min-label-width="0.499cm"/> </text:list-level-style-number> <text:list-level-style-number text:level="9" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"> <style:list-level-properties text:space-before="3.994cm" text:min-label-width="0.499cm"/> </text:list-level-style-number> <text:list-level-style-number text:level="10" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"> <style:list-level-properties text:space-before="4.493cm" text:min-label-width="0.499cm"/> </text:list-level-style-number> </text:list-style> <text:list-style style:name="List_20_1" style:display-name="List 1"> <text:list-level-style-bullet text:level="1" text:style-name="Numbering_20_Symbols" text:bullet-char="•"> <style:list-level-properties text:min-label-width="0.395cm"/> <style:text-properties style:font-name="StarSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="2" text:style-name="Numbering_20_Symbols" text:bullet-char="•"> <style:list-level-properties text:space-before="0.395cm" text:min-label-width="0.395cm"/> <style:text-properties style:font-name="StarSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="3" text:style-name="Numbering_20_Symbols" text:bullet-char="•"> <style:list-level-properties text:space-before="0.79cm" text:min-label-width="0.395cm"/> <style:text-properties style:font-name="StarSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="4" text:style-name="Numbering_20_Symbols" text:bullet-char="•"> <style:list-level-properties text:space-before="1.185cm" text:min-label-width="0.395cm"/> <style:text-properties style:font-name="StarSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="5" text:style-name="Numbering_20_Symbols" text:bullet-char="•"> <style:list-level-properties text:space-before="1.581cm" text:min-label-width="0.395cm"/> <style:text-properties style:font-name="StarSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="6" text:style-name="Numbering_20_Symbols" text:bullet-char="•"> <style:list-level-properties text:space-before="1.976cm" text:min-label-width="0.395cm"/> <style:text-properties style:font-name="StarSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="7" text:style-name="Numbering_20_Symbols" text:bullet-char="•"> <style:list-level-properties text:space-before="2.371cm" text:min-label-width="0.395cm"/> <style:text-properties style:font-name="StarSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="8" text:style-name="Numbering_20_Symbols" text:bullet-char="•"> <style:list-level-properties text:space-before="2.766cm" text:min-label-width="0.395cm"/> <style:text-properties style:font-name="StarSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="9" text:style-name="Numbering_20_Symbols" text:bullet-char="•"> <style:list-level-properties text:space-before="3.161cm" text:min-label-width="0.395cm"/> <style:text-properties style:font-name="StarSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="10" text:style-name="Numbering_20_Symbols" text:bullet-char="•"> <style:list-level-properties text:space-before="3.556cm" text:min-label-width="0.395cm"/> <style:text-properties style:font-name="StarSymbol"/> </text:list-level-style-bullet> </text:list-style> <text:list-style style:name="List_20_2" style:display-name="List 2"> <text:list-level-style-bullet text:level="1" text:style-name="Numbering_20_Symbols" text:bullet-char="–"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.3cm" fo:text-indent="-0.3cm" fo:margin-left="0.3cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="2" text:style-name="Numbering_20_Symbols" text:bullet-char="–"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.6cm" fo:text-indent="-0.3cm" fo:margin-left="0.6cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="3" text:style-name="Numbering_20_Symbols" text:bullet-char="–"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.9cm" fo:text-indent="-0.3cm" fo:margin-left="0.9cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="4" text:style-name="Numbering_20_Symbols" text:bullet-char="–"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.199cm" fo:text-indent="-0.3cm" fo:margin-left="1.199cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="5" text:style-name="Numbering_20_Symbols" text:bullet-char="–"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.499cm" fo:text-indent="-0.3cm" fo:margin-left="1.499cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="6" text:style-name="Numbering_20_Symbols" text:bullet-char="–"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.799cm" fo:text-indent="-0.3cm" fo:margin-left="1.799cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="7" text:style-name="Numbering_20_Symbols" text:bullet-char="–"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.101cm" fo:text-indent="-0.3cm" fo:margin-left="2.101cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="8" text:style-name="Numbering_20_Symbols" text:bullet-char="–"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.401cm" fo:text-indent="-0.3cm" fo:margin-left="2.401cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="9" text:style-name="Numbering_20_Symbols" text:bullet-char="–"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.701cm" fo:text-indent="-0.3cm" fo:margin-left="2.701cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="10" text:style-name="Numbering_20_Symbols" text:bullet-char="–"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="3cm" fo:text-indent="-0.3cm" fo:margin-left="3cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> </text:list-style> <text:list-style style:name="List_20_3" style:display-name="List 3"> <text:list-level-style-bullet text:level="1" text:style-name="Numbering_20_Symbols" text:bullet-char="☑"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.395cm" fo:text-indent="-0.395cm" fo:margin-left="0.395cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="2" text:style-name="Numbering_20_Symbols" text:bullet-char="□"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.79cm" fo:text-indent="-0.395cm" fo:margin-left="0.79cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="3" text:style-name="Numbering_20_Symbols" text:bullet-char="☑"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.395cm" fo:text-indent="-0.395cm" fo:margin-left="0.395cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="4" text:style-name="Numbering_20_Symbols" text:bullet-char="□"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.79cm" fo:text-indent="-0.395cm" fo:margin-left="0.79cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="5" text:style-name="Numbering_20_Symbols" text:bullet-char="☑"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.395cm" fo:text-indent="-0.395cm" fo:margin-left="0.395cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="6" text:style-name="Numbering_20_Symbols" text:bullet-char="□"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.79cm" fo:text-indent="-0.395cm" fo:margin-left="0.79cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="7" text:style-name="Numbering_20_Symbols" text:bullet-char="☑"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.395cm" fo:text-indent="-0.395cm" fo:margin-left="0.395cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="8" text:style-name="Numbering_20_Symbols" text:bullet-char="□"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.79cm" fo:text-indent="-0.395cm" fo:margin-left="0.79cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="9" text:style-name="Numbering_20_Symbols" text:bullet-char="☑"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.395cm" fo:text-indent="-0.395cm" fo:margin-left="0.395cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> <text:list-level-style-bullet text:level="10" text:style-name="Numbering_20_Symbols" text:bullet-char="□"> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.79cm" fo:text-indent="-0.395cm" fo:margin-left="0.79cm"/> </style:list-level-properties> <style:text-properties fo:font-family="OpenSymbol"/> </text:list-level-style-bullet> </text:list-style> <text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_20_Symbol" text:citation-body-style-name="Footnote_20_anchor" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="page"/> <text:notes-configuration text:note-class="endnote" text:citation-style-name="Endnote_20_Symbol" text:citation-body-style-name="Endnote_20_anchor" text:master-page-name="Endnote" style:num-format="1" text:start-value="0"/> <text:linenumbering-configuration text:style-name="Line_20_numbering" text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/> </office:styles> <office:automatic-styles> <style:page-layout style:name="Mpm1"> <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:paper-tray-name="[From printer settings]" style:print-orientation="portrait" fo:margin-top="3.2cm" fo:margin-bottom="2.499cm" fo:margin-left="2.701cm" fo:margin-right="3cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm"> <style:columns fo:column-count="1" fo:column-gap="0cm"/> <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> </style:page-layout-properties> <style:header-style/> <style:footer-style> <style:header-footer-properties fo:min-height="1.699cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="1.199cm" style:shadow="none" style:dynamic-spacing="false"/> </style:footer-style> </style:page-layout> <style:page-layout style:name="Mpm2"> <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2.499cm" fo:margin-right="2.499cm" style:shadow="none" fo:background-color="transparent" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm"> <style:background-image/> <style:columns fo:column-count="1" fo:column-gap="0cm"/> <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> </style:page-layout-properties> <style:header-style/> <style:footer-style/> </style:page-layout> <style:page-layout style:name="Mpm3" style:page-usage="left"> <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="1cm" fo:margin-left="2.499cm" fo:margin-right="4.5cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm"> <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> </style:page-layout-properties> <style:header-style/> <style:footer-style/> </style:page-layout> <style:page-layout style:name="Mpm4" style:page-usage="right"> <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="1cm" fo:margin-left="2.499cm" fo:margin-right="4.5cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm"> <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> </style:page-layout-properties> <style:header-style/> <style:footer-style/> </style:page-layout> <style:page-layout style:name="Mpm5"> <style:page-layout-properties fo:page-width="22.721cm" fo:page-height="11.4cm" style:num-format="1" style:print-orientation="landscape" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:margin-left="0cm" fo:margin-right="0cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm"> <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> </style:page-layout-properties> <style:header-style/> <style:footer-style/> </style:page-layout> <style:page-layout style:name="Mpm6"> <style:page-layout-properties fo:page-width="14.801cm" fo:page-height="21.001cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm"> <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> </style:page-layout-properties> <style:header-style/> <style:footer-style/> </style:page-layout> <style:page-layout style:name="Mpm7"> <style:page-layout-properties fo:page-width="20.999cm" fo:page-height="29.699cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm"> <style:footnote-sep style:adjustment="left" style:rel-width="25%" style:color="#000000"/> </style:page-layout-properties> <style:header-style/> <style:footer-style/> </style:page-layout> </office:automatic-styles> <office:master-styles> <style:master-page style:name="Standard" style:page-layout-name="Mpm1"> <style:footer> <text:p text:style-name="Footer"><text:page-number text:select-page="current">1</text:page-number></text:p> </style:footer> </style:master-page> <style:master-page style:name="First_20_Page" style:display-name="First Page" style:page-layout-name="Mpm2" style:next-style-name="Standard"/> <style:master-page style:name="Left_20_Page" style:display-name="Left Page" style:page-layout-name="Mpm3"/> <style:master-page style:name="Right_20_Page" style:display-name="Right Page" style:page-layout-name="Mpm4"/> <style:master-page style:name="Envelope" style:page-layout-name="Mpm5"/> <style:master-page style:name="Index" style:page-layout-name="Mpm6" style:next-style-name="Standard"/> <style:master-page style:name="Endnote" style:page-layout-name="Mpm7"/> </office:master-styles> </office:document-styles> ''' _fileHeader = OdtFile._CONTENT_XML_HEADER _fileFooter = OdtFile._CONTENT_XML_FOOTER def _get_characterMapping(self, crId): """Return a mapping dictionary for a character section. Positional arguments: crId -- str: character ID. Extends the superclass method. """ characterMapping = super()._get_characterMapping(crId) if self.characters[crId].aka: characterMapping['AKA'] = f' ("{self.characters[crId].aka}")' if self.characters[crId].fullName: characterMapping['FullName'] = f'/{self.characters[crId].fullName}' return characterMapping def _get_locationMapping(self, lcId): """Return a mapping dictionary for a location section. Positional arguments: lcId -- str: location ID. Extends the superclass method. """ locationMapping = super().get_locationMapping(lcId) if self.locations[lcId].aka: locationMapping['AKA'] = f' ("{self.locations[lcId].aka}")' return locationMapping class OdtFullSynopsis(OdtAeon): """ODT scene summaries file representation. Export a full synopsis. """ DESCRIPTION = 'Full synopsis' SUFFIX = '_full_synopsis' _partTemplate = '''<text:h text:style-name="Heading_20_1" text:outline-level="1">$Title</text:h> ''' _chapterTemplate = '''<text:h text:style-name="Heading_20_2" text:outline-level="2">$Title</text:h> ''' _sceneTemplate = '''<text:p text:style-name="Text_20_body"><office:annotation> <dc:creator>scene title</dc:creator> <text:p>~ ${Title} ~</text:p> <text:p/> </office:annotation>$Desc</text:p> ''' _sceneDivider = '''<text:p text:style-name="Heading_20_4">* * *</text:p> ''' class OdtBriefSynopsis(OdtAeon): """ODT chapter summaries snf scene titles file representation. Export a brief synopsis. """ DESCRIPTION = 'Brief synopsis' SUFFIX = '_brief_synopsis' _partTemplate = '''<text:h text:style-name="Heading_20_1" text:outline-level="1">$Desc</text:h> ''' _chapterTemplate = '''<text:h text:style-name="Heading_20_2" text:outline-level="2">$Desc</text:h> ''' _sceneTemplate = '''<text:p text:style-name="Text_20_body">$Title</text:p> ''' class OdtChapterOverview(OdtAeon): """ODT part and chapter summaries file representation. Export a very brief synopsis. """ DESCRIPTION = 'Chapter overview' SUFFIX = '_chapter_overview' _partTemplate = '''<text:h text:style-name="Heading_20_1" text:outline-level="1">$Desc</text:h> ''' _chapterTemplate = '''<text:p text:style-name="Text_20_body">$Desc</text:p> ''' class OdtCharacterSheets(OdtAeon): """ODT character descriptions file representation. Export a character sheet. """ DESCRIPTION = 'Character sheets' SUFFIX = '_character_sheets' _characterTemplate = '''<text:h text:style-name="Heading_20_2" text:outline-level="2">$Title$FullName$AKA</text:h> <text:p text:style-name="Text_20_body"><text:span text:style-name="Emphasis">$Tags</text:span></text:p> <text:p text:style-name="Text_20_body" /> <text:p text:style-name="Text_20_body">$Bio</text:p> <text:p text:style-name="Text_20_body" /> <text:p text:style-name="Text_20_body">$Goals</text:p> <text:p text:style-name="Text_20_body" /> <text:p text:style-name="Text_20_body">$Desc</text:p> <text:p text:style-name="Text_20_body" /> <text:p text:style-name="Text_20_body">$Notes</text:p> ''' class OdtLocationSheets(OdtAeon): """ODT location descriptions file representation. Export a location sheet. """ DESCRIPTION = 'Location sheets' SUFFIX = '_location_sheets' _locationTemplate = '''<text:h text:style-name="Heading_20_2" text:outline-level="2">$Title$AKA</text:h> <text:p text:style-name="Text_20_body"><text:span text:style-name="Emphasis">$Tags</text:span></text:p> <text:p text:style-name="Text_20_body" /> <text:p text:style-name="Text_20_body">$Desc</text:p> ''' class OdtReport(OdtAeon): """ODT scene summaries file representation. Export a full synopsis. """ DESCRIPTION = 'Project report' SUFFIX = '_report' _partTemplate = '''<text:h text:style-name="Heading_20_1" text:outline-level="1">$Title – $Desc</text:h> ''' _chapterTemplate = '''<text:h text:style-name="Heading_20_2" text:outline-level="2">$Title – $Desc</text:h> ''' _sceneTemplate = '''<text:h text:style-name="Heading_20_3" text:outline-level="3">Scene $SceneNumber – ${Title}</text:h> <text:p text:style-name="Text_20_body_20_indent"><text:span text:style-name="Strong_20_Emphasis">Tags: </text:span>$Tags</text:p> <text:p text:style-name="Text_20_body_20_indent"><text:span text:style-name="Strong_20_Emphasis">Location: </text:span>$Locations</text:p> <text:p text:style-name="Text_20_body_20_indent"><text:span text:style-name="Strong_20_Emphasis">Date/Time/Duration: </text:span>$ScDate $ScTime $Duration</text:p> <text:p text:style-name="Text_20_body_20_indent"><text:span text:style-name="Strong_20_Emphasis">Participants: </text:span>$Characters</text:p> <text:p text:style-name="Text_20_body">$Desc</text:p> <text:p text:style-name="Text_20_body_20_indent"><text:span text:style-name="Strong_20_Emphasis">Notes:</text:span>$Notes</text:p> ''' _characterSectionHeading = '''<text:h text:style-name="Heading_20_1" text:outline-level="1">Characters</text:h> ''' _characterTemplate = '''<text:h text:style-name="Heading_20_2" text:outline-level="2">$Title$FullName$AKA</text:h> <text:p text:style-name="Text_20_body_20_indent"><text:span text:style-name="Strong_20_Emphasis">Tags: </text:span>$Tags</text:p> <text:p text:style-name="Text_20_body">$Bio</text:p> <text:p text:style-name="Text_20_body">$Goals</text:p> <text:p text:style-name="Text_20_body">$Desc</text:p> <text:p text:style-name="Text_20_body_20_indent"><text:span text:style-name="Strong_20_Emphasis">Notes: </text:span>$Notes</text:p> ''' _locationSectionHeading = '''<text:h text:style-name="Heading_20_1" text:outline-level="1">Locations</text:h> ''' _locationTemplate = '''<text:h text:style-name="Heading_20_2" text:outline-level="2">$Title$AKA</text:h> <text:p text:style-name="Text_20_body_20_indent"><text:span text:style-name="Strong_20_Emphasis">Tags: </text:span>$Tags</text:p> <text:p text:style-name="Text_20_body">$Desc</text:p> ''' class Aeon3odtConverter(YwCnvFf): """A converter for universal export from a yWriter 7 project. Overrides the superclass constants EXPORT_SOURCE_CLASSES, EXPORT_TARGET_CLASSES. """ EXPORT_SOURCE_CLASSES = [CsvTimeline3, JsonTimeline3] EXPORT_TARGET_CLASSES = [OdtFullSynopsis, OdtBriefSynopsis, OdtChapterOverview, OdtCharacterSheets, OdtLocationSheets, OdtReport, ] class Aeon3odtCnvUno(Aeon3odtConverter): """A converter for universal import and export. Public methods: export_from_yw(sourceFile, targetFile) -- Convert from yWriter project to other file format. Support yWriter 7 projects and most of the Novel subclasses that can be read or written by OpenOffice/LibreOffice. - No message in case of success when converting from yWriter. """ def export_from_yw(self, source, target): """Convert from yWriter project to other file format. Positional arguments: source -- YwFile subclass instance. target -- Any Novel subclass instance. Show only error messages. Overrides the superclass method. """ message = self.convert(source, target) if message.startswith(ERROR): self.ui.set_info_how(message) else: self.newFile = target.filePath from com.sun.star.awt.MessageBoxResults import OK, YES, NO, CANCEL from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK, BUTTONS_OK_CANCEL, BUTTONS_YES_NO, BUTTONS_YES_NO_CANCEL, BUTTONS_RETRY_CANCEL, BUTTONS_ABORT_IGNORE_RETRY from com.sun.star.awt.MessageBoxType import MESSAGEBOX, INFOBOX, WARNINGBOX, ERRORBOX, QUERYBOX class UiUno(Ui): """UI subclass implementing a LibreOffice UNO facade.""" def ask_yes_no(self, text): result = msgbox(text, buttons=BUTTONS_YES_NO, type_msg=WARNINGBOX) return result == YES def set_info_how(self, message): """How's the converter doing?""" self.infoHowText = message if message.startswith(ERROR): message = message.split(ERROR, maxsplit=1)[1].strip() msgbox(message, type_msg=ERRORBOX) else: msgbox(message, type_msg=INFOBOX) INI_FILE = 'openyw.ini' CONFIG_PROJECT = 'aeon3yw' # cnvaeon uses the aeon3yw configuration file, if any. SETTINGS = dict( part_number_prefix='Part', chapter_number_prefix='Chapter', type_event='Event', type_character='Character', type_location='Location', type_item='Item', character_label='Participant', location_label='Location', item_label='Item', part_desc_label='Label', chapter_desc_label='Label', scene_desc_label='Summary', scene_title_label='Label', notes_label='Notes', tag_label='Tags', viewpoint_label='Viewpoint', character_bio_label='Summary', character_aka_label='Nickname', character_desc_label1='Characteristics', character_desc_label2='Traits', character_desc_label3='', location_desc_label='Summary', ) def open_src(suffix, newExt): """Open a yWriter project, create a new document and load it. Positional arguments: suffix -- str: filename suffix of the document to create. newExt -- str: file extension of the document to create. """ # Set last opened Aeon project as default (if existing). scriptLocation = os.path.dirname(__file__) inifile = uno.fileUrlToSystemPath(f'{scriptLocation}/{INI_FILE}') defaultFile = None config = ConfigParser() try: config.read(inifile) srcLastOpen = config.get('FILES', 'src_last_open') if os.path.isfile(srcLastOpen): defaultFile = uno.systemPathToFileUrl(srcLastOpen) except: pass # Ask for source file to open: srcFile = FilePicker(path=defaultFile) if srcFile is None: return sourcePath = uno.fileUrlToSystemPath(srcFile) __, aeonExt = os.path.splitext(sourcePath) converter = Aeon3odtCnvUno() extensions = [] for srcClass in converter.EXPORT_SOURCE_CLASSES: extensions.append(srcClass.EXTENSION) if not aeonExt in extensions: msgbox('Please choose a csv file exported by Aeon Timeline 3, or an .aeon file.', 'Import from Aeon timeline', type_msg=ERRORBOX) return # Store selected yWriter project as "last opened". newFile = srcFile.replace(aeonExt, f'{suffix}{newExt}') dirName, fileName = os.path.split(newFile) thisDir = uno.fileUrlToSystemPath(f'{dirName}/') lockFile = f'{thisDir}.~lock.{fileName}#' if not config.has_section('FILES'): config.add_section('FILES') config.set('FILES', 'src_last_open', uno.fileUrlToSystemPath(srcFile)) with open(inifile, 'w') as f: config.write(f) # Check whether the import file is already open in LibreOffice: if os.path.isfile(lockFile): msgbox(f'Please close "{fileName}" first.', 'Import from Aeon Timeline', type_msg=ERRORBOX) return workdir = os.path.dirname(sourcePath) # Read the aeon3yw configuration. iniFileName = f'{CONFIG_PROJECT}.ini' iniFiles = [] try: homeDir = str(Path.home()).replace('\\', '/') globalConfiguration = f'{homeDir}/.pyWriter/{CONFIG_PROJECT}/config/{iniFileName}' iniFiles.append(globalConfiguration) except: pass if not workdir: localConfiguration = f'./{iniFileName}' else: localConfiguration = f'{workdir}/{iniFileName}' iniFiles.append(localConfiguration) configuration = Configuration(SETTINGS) for iniFile in iniFiles: configuration.read(iniFile) # Open yWriter project and convert data. os.chdir(workdir) converter.ui = UiUno('Import from Aeon Timeline') kwargs = {'suffix': suffix} kwargs.update(configuration.settings) converter.run(sourcePath, **kwargs) if converter.newFile: desktop = XSCRIPTCONTEXT.getDesktop() desktop.loadComponentFromURL(newFile, "_blank", 0, ()) def get_chapteroverview(): '''Import a chapter overview from Aeon Timeline to a Writer document. ''' open_src(OdtChapterOverview.SUFFIX, OdtChapterOverview.EXTENSION) def get_briefsynopsis(): '''Import a brief synopsis from Aeon Timeline to a Writer document. ''' open_src(OdtBriefSynopsis.SUFFIX, OdtBriefSynopsis.EXTENSION) def get_fullsynopsis(): '''Import a full synopsis from Aeon Timeline to a Writer document. ''' open_src(OdtFullSynopsis.SUFFIX, OdtFullSynopsis.EXTENSION) def get_charactersheets(): '''Import character sheets from Aeon Timeline to a Writer document. ''' open_src(OdtCharacterSheets.SUFFIX, OdtCharacterSheets.EXTENSION) def get_locationsheets(): '''Import location sheets from Aeon Timeline to a Writer document. ''' open_src(OdtLocationSheets.SUFFIX, OdtLocationSheets.EXTENSION) def get_report(): '''Import a full report of the narrative from Aeon Timeline to a Writer document. ''' open_src(OdtReport.SUFFIX, OdtReport.EXTENSION)
55.259409
1,787
0.652827
32,263
259,885
5.202802
0.051142
0.04343
0.045217
0.037889
0.717624
0.679044
0.652164
0.623771
0.60435
0.582516
0
0.022676
0.208727
259,885
4,702
1,788
55.271161
0.793435
0.149451
0
0.454282
0
0.204443
0.634943
0.444956
0
1
0
0.001063
0
1
0.028976
false
0.002576
0.013844
0.000644
0.121056
0.002576
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
1
1
1
null
1
0
0
0
0
0
0
0
0
0
0
0
0
5
05c13706e1fb8a4712122a216a048f70c703da0c
87
py
Python
sample/data/models/__init__.py
bluemner/sample-api-with-sqlalchemy
2601dedb6a5fd1b4825913e9165d86180b118ca6
[ "Unlicense" ]
1
2020-07-10T12:18:27.000Z
2020-07-10T12:18:27.000Z
sample/data/models/__init__.py
bluemner/sample-api-with-sqlalchemy
2601dedb6a5fd1b4825913e9165d86180b118ca6
[ "Unlicense" ]
null
null
null
sample/data/models/__init__.py
bluemner/sample-api-with-sqlalchemy
2601dedb6a5fd1b4825913e9165d86180b118ca6
[ "Unlicense" ]
1
2020-08-09T03:55:45.000Z
2020-08-09T03:55:45.000Z
""" Modles of data """ from .model import Model, AuditModel from .person import Person
17.4
36
0.735632
12
87
5.333333
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.16092
87
4
37
21.75
0.876712
0.16092
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
05daea90ea1d16d5b11c66db45219a39a4fb7e13
57
py
Python
je_auto_control/windows/screen/__init__.py
JE-Chen/Python_JEAutoControl
477bf9612e28e9ab6d0a8e269db2f699e50a3744
[ "MIT" ]
9
2020-10-12T06:33:36.000Z
2021-09-13T07:07:36.000Z
je_auto_control/windows/screen/__init__.py
JE-Chen/Python_JEAutoControl
477bf9612e28e9ab6d0a8e269db2f699e50a3744
[ "MIT" ]
null
null
null
je_auto_control/windows/screen/__init__.py
JE-Chen/Python_JEAutoControl
477bf9612e28e9ab6d0a8e269db2f699e50a3744
[ "MIT" ]
null
null
null
from je_auto_control.windows.screen.win32_screen import *
57
57
0.877193
9
57
5.222222
0.888889
0
0
0
0
0
0
0
0
0
0
0.037037
0.052632
57
1
57
57
0.833333
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
05dbe4fce380e3dbba81aeef016c96b669d1e041
19,740
py
Python
mmtbx/suitename/unit-test/UnitTest.py
dperl-sol/cctbx_project
b9e390221a2bc4fd00b9122e97c3b79c632c6664
[ "BSD-3-Clause-LBNL" ]
155
2016-11-23T12:52:16.000Z
2022-03-31T15:35:44.000Z
mmtbx/suitename/unit-test/UnitTest.py
dperl-sol/cctbx_project
b9e390221a2bc4fd00b9122e97c3b79c632c6664
[ "BSD-3-Clause-LBNL" ]
590
2016-12-10T11:31:18.000Z
2022-03-30T23:10:09.000Z
mmtbx/suitename/unit-test/UnitTest.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 nested_scopes, generators, division, absolute_import from __future__ import with_statement, print_function import os, sys, inspect from io import StringIO currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path.insert(0, parentdir) # here, before importing suitename, is an opportunity to set command line # options and to redirect output. # sys.argv.extend(["--noinc", "--chart", "--causes"]) # sys.stdout = open("output.txt", "w") import suitename, suites, regression # The test data: # # The first portion is to test membership in every cluster. # The second portion is to test triage by out of bounds angle # for each dihedral angle. The unnecessary part of each residue is damaged so # the extra suite generated will be incomplete and will vanish. input1=u''' :1a: : : : : Z: 9999.000: 9999.000: 9999.000: 81.495: 212.250: 288.831: 180.000 :1a: : : : : Z: 294.967: 173.990: 53.550: 81.035: 9999.000: 9999.000: 180.000 :1m: : : : : Z: 9999.000: 9999.000: 9999.000: 83.513: 218.120: 291.593: 180.000 :1m: : : : : Z: 292.247: 222.300: 58.067: 86.093: 9999.000: 9999.000: 180.000 :1L: : : : : Z: 9999.000: 9999.000: 9999.000: 85.664: 245.014: 268.257: 180.000 :1L: : : : : Z: 303.879: 138.164: 61.950: 79.457: 9999.000: 9999.000: 180.000 :&a: : : : : Z: 9999.000: 9999.000: 9999.000: 82.112: 190.682: 264.945: 180.000 :&a: : : : : Z: 295.967: 181.839: 51.455: 81.512: 9999.000: 9999.000: 180.000 :7a: : : : : Z: 9999.000: 9999.000: 9999.000: 83.414: 217.400: 222.006: 180.000 :7a: : : : : Z: 302.856: 160.719: 49.097: 82.444: 9999.000: 9999.000: 180.000 :3a: : : : : Z: 9999.000: 9999.000: 9999.000: 85.072: 216.324: 173.276: 180.000 :3a: : : : : Z: 289.320: 164.132: 45.876: 84.956: 9999.000: 9999.000: 180.000 :9a: : : : : Z: 9999.000: 9999.000: 9999.000: 83.179: 210.347: 121.474: 180.000 :9a: : : : : Z: 288.568: 157.268: 49.347: 81.047: 9999.000: 9999.000: 180.000 :1g: : : : : Z: 9999.000: 9999.000: 9999.000: 80.888: 218.636: 290.735: 180.000 :1g: : : : : Z: 167.447: 159.565: 51.326: 85.213: 9999.000: 9999.000: 180.000 :7d: : : : : Z: 9999.000: 9999.000: 9999.000: 83.856: 238.750: 256.875: 180.000 :7d: : : : : Z: 69.562: 170.200: 52.800: 85.287: 9999.000: 9999.000: 180.000 :3d: : : : : Z: 9999.000: 9999.000: 9999.000: 85.295: 244.085: 203.815: 180.000 :3d: : : : : Z: 65.880: 181.130: 54.680: 86.035: 9999.000: 9999.000: 180.000 :5d: : : : : Z: 9999.000: 9999.000: 9999.000: 79.671: 202.471: 63.064: 180.000 :5d: : : : : Z: 68.164: 143.450: 49.664: 82.757: 9999.000: 9999.000: 180.000 :3g: : : : : Z: 9999.000: 9999.000: 9999.000: 84.000: 195.000: 146.000: 180.000 :3g: : : : : Z: 170.000: 170.000: 52.000: 84.000: 9999.000: 9999.000: 180.000 :1e: : : : : Z: 9999.000: 9999.000: 9999.000: 80.514: 200.545: 280.510: 180.000 :1e: : : : : Z: 249.314: 82.662: 167.890: 85.507: 9999.000: 9999.000: 180.000 :1c: : : : : Z: 9999.000: 9999.000: 9999.000: 80.223: 196.591: 291.299: 180.000 :1c: : : : : Z: 153.060: 194.379: 179.061: 83.648: 9999.000: 9999.000: 180.000 :1f: : : : : Z: 9999.000: 9999.000: 9999.000: 81.395: 203.030: 294.445: 180.000 :1f: : : : : Z: 172.195: 138.540: 175.565: 84.470: 9999.000: 9999.000: 180.000 :5j: : : : : Z: 9999.000: 9999.000: 9999.000: 87.417: 223.558: 80.175: 180.000 :5j: : : : : Z: 66.667: 109.150: 176.475: 83.833: 9999.000: 9999.000: 180.000 :5n: : : : : Z: 9999.000: 9999.000: 9999.000: 86.055: 246.502: 100.392: 180.000 :5n: : : : : Z: 73.595: 213.752: 183.395: 85.483: 9999.000: 9999.000: 180.000 :!!: : : : : Z: 9999.000: 9999.000: 9999.000: 0.000: 0.000: 0.000: 0.000 :!!: : : : : Z: 0.000: 0.000: 0.000: 0.000: 9999.000: 9999.000: 0.000 :1b: : : : : Z: 9999.000: 9999.000: 9999.000: 84.215: 215.014: 288.672: 180.000 :1b: : : : : Z: 300.420: 177.476: 58.307: 144.841: 9999.000: 9999.000: 180.000 :1[: : : : : Z: 9999.000: 9999.000: 9999.000: 82.731: 220.463: 288.665: 180.000 :1[: : : : : Z: 296.983: 221.654: 54.213: 143.771: 9999.000: 9999.000: 180.000 :3b: : : : : Z: 9999.000: 9999.000: 9999.000: 84.700: 226.400: 168.336: 180.000 :3b: : : : : Z: 292.771: 177.629: 48.629: 147.950: 9999.000: 9999.000: 180.000 :1z: : : : : Z: 9999.000: 9999.000: 9999.000: 83.358: 206.042: 277.567: 180.000 :1z: : : : : Z: 195.700: 161.600: 50.750: 145.258: 9999.000: 9999.000: 180.000 :5z: : : : : Z: 9999.000: 9999.000: 9999.000: 82.614: 206.440: 52.524: 180.000 :5z: : : : : Z: 163.669: 148.421: 50.176: 147.590: 9999.000: 9999.000: 180.000 :7p: : : : : Z: 9999.000: 9999.000: 9999.000: 84.285: 236.600: 220.400: 180.000 :7p: : : : : Z: 68.300: 200.122: 53.693: 145.730: 9999.000: 9999.000: 180.000 :5p: : : : : Z: 9999.000: 9999.000: 9999.000: 84.457: 213.286: 69.086: 180.000 :5p: : : : : Z: 75.500: 156.671: 57.486: 147.686: 9999.000: 9999.000: 180.000 :1t: : : : : Z: 9999.000: 9999.000: 9999.000: 81.200: 199.243: 288.986: 180.000 :1t: : : : : Z: 180.286: 194.743: 178.200: 147.386: 9999.000: 9999.000: 180.000 :5q: : : : : Z: 9999.000: 9999.000: 9999.000: 82.133: 204.933: 69.483: 180.000 :5q: : : : : Z: 63.417: 115.233: 176.283: 145.733: 9999.000: 9999.000: 180.000 :1o: : : : : Z: 9999.000: 9999.000: 9999.000: 83.977: 216.508: 287.192: 180.000 :1o: : : : : Z: 297.254: 225.154: 293.738: 150.677: 9999.000: 9999.000: 180.000 :7r: : : : : Z: 9999.000: 9999.000: 9999.000: 84.606: 232.856: 248.125: 180.000 :7r: : : : : Z: 63.269: 181.975: 295.744: 149.744: 9999.000: 9999.000: 180.000 :5r: : : : : Z: 9999.000: 9999.000: 9999.000: 83.000: 196.900: 65.350: 180.000 :5r: : : : : Z: 60.150: 138.425: 292.550: 154.275: 9999.000: 9999.000: 180.000 :2a: : : : : Z: 9999.000: 9999.000: 9999.000: 145.399: 260.339: 288.756: 180.000 :2a: : : : : Z: 288.444: 192.733: 53.097: 84.067: 9999.000: 9999.000: 180.000 :4a: : : : : Z: 9999.000: 9999.000: 9999.000: 146.275: 259.783: 169.958: 180.000 :4a: : : : : Z: 298.450: 169.583: 50.908: 83.967: 9999.000: 9999.000: 180.000 :0a: : : : : Z: 9999.000: 9999.000: 9999.000: 149.286: 223.159: 139.421: 180.000 :0a: : : : : Z: 284.559: 158.107: 47.900: 84.424: 9999.000: 9999.000: 180.000 :#a: : : : : Z: 9999.000: 9999.000: 9999.000: 148.006: 191.944: 146.231: 180.000 :#a: : : : : Z: 289.288: 150.781: 42.419: 84.956: 9999.000: 9999.000: 180.000 :4g: : : : : Z: 9999.000: 9999.000: 9999.000: 148.028: 256.922: 165.194: 180.000 :4g: : : : : Z: 204.961: 165.194: 49.383: 82.983: 9999.000: 9999.000: 180.000 :6g: : : : : Z: 9999.000: 9999.000: 9999.000: 145.337: 262.869: 79.588: 180.000 :6g: : : : : Z: 203.863: 189.688: 58.000: 84.900: 9999.000: 9999.000: 180.000 :8d: : : : : Z: 9999.000: 9999.000: 9999.000: 148.992: 270.596: 240.892: 180.000 :8d: : : : : Z: 62.225: 176.271: 53.600: 87.262: 9999.000: 9999.000: 180.000 :4d: : : : : Z: 9999.000: 9999.000: 9999.000: 149.822: 249.956: 187.678: 180.000 :4d: : : : : Z: 80.433: 198.133: 61.000: 89.378: 9999.000: 9999.000: 180.000 :6d: : : : : Z: 9999.000: 9999.000: 9999.000: 146.922: 241.222: 88.894: 180.000 :6d: : : : : Z: 59.344: 160.683: 52.333: 83.417: 9999.000: 9999.000: 180.000 :2g: : : : : Z: 9999.000: 9999.000: 9999.000: 141.900: 258.383: 286.517: 180.000 :2g: : : : : Z: 178.267: 165.217: 48.350: 84.783: 9999.000: 9999.000: 180.000 :2h: : : : : Z: 9999.000: 9999.000: 9999.000: 147.782: 260.712: 290.424: 180.000 :2h: : : : : Z: 296.200: 177.282: 175.594: 86.565: 9999.000: 9999.000: 180.000 :4n: : : : : Z: 9999.000: 9999.000: 9999.000: 143.722: 227.256: 203.789: 180.000 :4n: : : : : Z: 73.856: 216.733: 194.444: 80.911: 9999.000: 9999.000: 180.000 :0i: : : : : Z: 9999.000: 9999.000: 9999.000: 148.717: 274.683: 100.283: 180.000 :0i: : : : : Z: 80.600: 248.133: 181.817: 82.600: 9999.000: 9999.000: 180.000 :6n: : : : : Z: 9999.000: 9999.000: 9999.000: 150.311: 268.383: 84.972: 180.000 :6n: : : : : Z: 63.811: 191.483: 176.644: 85.600: 9999.000: 9999.000: 180.000 :6j: : : : : Z: 9999.000: 9999.000: 9999.000: 141.633: 244.100: 66.056: 180.000 :6j: : : : : Z: 71.667: 122.167: 182.200: 83.622: 9999.000: 9999.000: 180.000 :0k: : : : : Z: 9999.000: 9999.000: 9999.000: 149.070: 249.780: 111.520: 180.000 :0k: : : : : Z: 278.370: 207.780: 287.820: 86.650: 9999.000: 9999.000: 180.000 :2[: : : : : Z: 9999.000: 9999.000: 9999.000: 146.383: 259.402: 291.275: 180.000 :2[: : : : : Z: 291.982: 210.048: 54.412: 147.760: 9999.000: 9999.000: 180.000 :4b: : : : : Z: 9999.000: 9999.000: 9999.000: 145.256: 244.622: 162.822: 180.000 :4b: : : : : Z: 294.159: 171.630: 45.900: 145.804: 9999.000: 9999.000: 180.000 :0b: : : : : Z: 9999.000: 9999.000: 9999.000: 147.593: 248.421: 112.086: 180.000 :0b: : : : : Z: 274.943: 164.764: 56.843: 146.264: 9999.000: 9999.000: 180.000 :4p: : : : : Z: 9999.000: 9999.000: 9999.000: 150.077: 260.246: 213.785: 180.000 :4p: : : : : Z: 71.900: 207.638: 56.715: 148.131: 9999.000: 9999.000: 180.000 :6p: : : : : Z: 9999.000: 9999.000: 9999.000: 146.415: 257.831: 89.597: 180.000 :6p: : : : : Z: 67.923: 173.051: 55.513: 147.623: 9999.000: 9999.000: 180.000 :2z: : : : : Z: 9999.000: 9999.000: 9999.000: 142.900: 236.550: 268.800: 180.000 :2z: : : : : Z: 180.783: 185.133: 54.467: 143.350: 9999.000: 9999.000: 180.000 :4s: : : : : Z: 9999.000: 9999.000: 9999.000: 149.863: 247.562: 170.488: 180.000 :4s: : : : : Z: 277.938: 84.425: 176.413: 148.087: 9999.000: 9999.000: 180.000 :2u: : : : : Z: 9999.000: 9999.000: 9999.000: 143.940: 258.200: 298.240: 180.000 :2u: : : : : Z: 279.640: 183.680: 183.080: 145.120: 9999.000: 9999.000: 180.000 :2o: : : : : Z: 9999.000: 9999.000: 9999.000: 147.342: 256.475: 295.508: 180.000 :2o: : : : : Z: 287.408: 194.525: 293.725: 150.458: 9999.000: 9999.000: 180.000 :epsilon: : : : : Z: 294.967: 173.990: 53.550: 81.495: 154.000: 288.831: 180.000 :epsilon: : : : : Z: 294.967: 173.990: 53.550: 81.495: 212.250: 288.831: 180.000 :alpha: : : : : Z: 294.967: 173.990: 53.550: 81.495: 212.250: 288.831: 180.000 :alpha: : : : : Z: 24.000: 173.990: 53.550: 81.495: 212.250: 288.831: 180.000 :beta: : : : : Z: 294.967: 173.990: 53.550: 81.495: 212.250: 288.831: 180.000 :beta: : : : : Z: 294.967: 49.000: 53.550: 81.495: 212.250: 288.831: 180.000 :zeta: : : : : Z: 294.967: 173.990: 53.550: 81.495: 212.250: 24.000: 180.000 :zeta: : : : : Z: 294.967: 173.990: 53.550: 81.495: 212.250: 288.831: 180.000 :delta-1: : : : : Z: 294.967: 173.990: 53.550: 59.000: 212.250: 288.831: 180.000 :delta-1: : : : : Z: 294.967: 173.990: 53.550: 81.495: 212.250: 288.831: 180.000 :gamma: : : : : Z: 294.967: 173.990: 53.550: 81.495: 212.250: 288.831: 180.000 :gamma: : : : : Z: 294.967: 173.990: 139.000: 81.495: 212.250: 288.831: 180.000 :delta: : : : : Z: 294.967: 173.990: 53.550: 81.495: 212.250: 288.831: 180.000 :delta: : : : : Z: 294.967: 173.990: 53.550: 59.000: 212.250: 288.831: 180.000 ''' # A manually selected group of test cases from real files # designed to test each code path through membership(). The first residue from # each pair has intentionally been damaged so that it will not produce separate # output from a report. We use the causes option to illustrate what code path # is being used. input2 = u'''2xLk:1: C: 11: : : G:__?__:__?__:__?__:81.132:-127.583:-70.677 2xLk:1: C: 12: : : U:169.008:153.891:51.391:80.277:-135.347:-70.614 3cgp:1: B: 19: : : U:__?__:__?__:__?__:82.839:-147.528:-179.087 3cgp:1: B: 20: : : A:139.983:-154.445:63.134:88.055:-145.599:70.874 4pco:1: B: 3: : : U:__?__:__?__:__?__:77.659:-165.227:-68.525 4pco:1: B: 4: : : G:151.914:-179.903:176.058:83.039:-148.171:-66.728 5b2q:1: B: 62: : : G:__?__:__?__:__?__:83.537:-131.816:-116.417 5b2q:1: B: 63: : : U:-69.320:-146.615:47.107:147.038:-148.815:45.665 6gc5:1: F: 2: : : U:__?__:__?__:__?__:144.610:-116.227:152.694 6gc5:1: F: 3: : : U:-66.167:162.580:41.697:145.644:-122.673:127.881 3bns:1: A: 21: : : C:__?__:__?__:__?__:76.224:-166.174:-73.594 3bns:1: A: 22: : : G:150.784:-158.788:175.706:87.605:-146.172:-63.516 3gm7:1: H: 5: : : U:__?__:__?__:__?__:68.910:-153.989:-56.381 3gm7:1: H: 6: : : G:-105.747:164.057:92.120:74.597:-150.523:-79.724 6qit:1: A: 2: : : C:__?__:__?__:__?__:82.169:-138.695:-63.417 6qit:1: A: 3: : : A:-71.504:-131.618:54.061:144.409:-95.827:-140.754 3rer:1: K: 7: : : U:__?__:__?__:__?__:87.510:-99.276:-118.108 3rer:1: K: 8: : : A:-66.924:-158.118:48.287:81.250:__?__:__?__ 3diL:1: A: 59: : : C:__?__:__?__:__?__:80.668:-145.667:-36.026 3diL:1: A: 60: : : G:-143.441:115.188:149.951:86.379:-141.567:-69.901 5ho4:1: B: 3: : : G:__?__:__?__:__?__:160.213:-123.685:-174.677 5ho4:1: B: 4: : : G:-107.676:163.883:39.081:85.911:-157.392:-71.638 4mcf:1: E: 4: : : U:__?__:__?__:__?__:78.239:-156.881:-70.399 4mcf:1: E: 5: : : G:-91.794:163.594:87.552:70.675:-141.886:-72.556 3pdr:1: A: 59: : : C:__?__:__?__:__?__:80.441:-149.674:-76.690 3pdr:1: A: 60: : : A:-62.415:171.383:47.537:79.461:-145.680:-71.359 3gm7:1: G: 1: : : C:__?__:__?__:__?__:84.065:-128.784:-61.905 3gm7:1: G: 2: : : U:-76.914:-166.398:55.279:74.218:-157.766:-64.720 6h0r:1: B: 15: : : U:__?__:__?__:__?__:83.971:-122.349:-103.636 6h0r:1: B: 16: : : U:-30.804:145.657:33.314:81.109:-141.719:-75.527 2zko:1: C: 13: : : G:__?__:__?__:__?__:76.629:-150.027:-67.298 2zko:1: C: 14: : : C:-70.016:164.567:71.735:76.499:-160.106:-73.474 3pdr:1: X: 138: : : U:__?__:__?__:__?__:77.324:-177.192:-105.412 3pdr:1: X: 139: : : A:-46.950:179.570:49.599:71.442:-143.233:-61.461 4jah:1: B: 10: : : U:__?__:__?__:__?__:85.890:-164.804:-95.055 4jah:1: B: 11: : : G:-64.134:178.767:49.773:77.067:-152.496:-70.128 3diL:1: A: 13: : : C:__?__:__?__:__?__:135.303:-125.074:-69.725 3diL:1: A: 14: : : G:75.452:147.741:32.719:83.048:-146.012:-75.223 3pdr:1: X: 132: : : U:__?__:__?__:__?__:77.469:-157.795:-115.458 3pdr:1: X: 133: : : U:47.309:136.943:-25.259:83.460:-150.210:-61.763 ''' output1=''' :1a: : : : : Z 33 p 1a 1.000 :1m: : : : : Z 33 p 1m 1.000 :1L: : : : : Z 33 p 1L 1.000 :&a: : : : : Z 33 p &a 1.000 :7a: : : : : Z 33 p 7a 1.000 :3a: : : : : Z 33 p 3a 1.000 :9a: : : : : Z 33 p 9a 1.000 :1g: : : : : Z 33 p 1g 1.000 :7d: : : : : Z 33 p 7d 1.000 :3d: : : : : Z 33 p 3d 1.000 :5d: : : : : Z 33 p 5d 1.000 :3g: : : : : Z 33 p 3g 1.000 wannabe :1e: : : : : Z 33 t 1e 1.000 :1c: : : : : Z 33 t 1c 1.000 :1f: : : : : Z 33 t 1f 1.000 :5j: : : : : Z 33 t 5j 1.000 :5n: : : : : Z 33 t 5n 1.000 wannabe :!!: : : : : Z trig !! 0.000 epsilon-1 :1b: : : : : Z 32 p 1b 1.000 :1[: : : : : Z 32 p 1[ 1.000 :3b: : : : : Z 32 p 3b 1.000 :1z: : : : : Z 32 p 1z 1.000 :5z: : : : : Z 32 p 5z 1.000 :7p: : : : : Z 32 p 7p 1.000 :5p: : : : : Z 32 p 5p 1.000 wannabe :1t: : : : : Z 32 t 1t 1.000 :5q: : : : : Z 32 t 5q 1.000 :1o: : : : : Z 32 m 1o 1.000 :7r: : : : : Z 32 m 7r 1.000 :5r: : : : : Z 32 m 5r 1.000 wannabe :2a: : : : : Z 23 p 2a 1.000 :4a: : : : : Z 23 p 4a 1.000 :0a: : : : : Z 23 p 0a 1.000 :#a: : : : : Z 23 p #a 1.000 :4g: : : : : Z 23 p 4g 1.000 :6g: : : : : Z 23 p 6g 1.000 :8d: : : : : Z 23 p 8d 1.000 :4d: : : : : Z 23 p 4d 1.000 :6d: : : : : Z 23 p 6d 1.000 :2g: : : : : Z 23 p 2g 1.000 wannabe :2h: : : : : Z 23 t 2h 1.000 :4n: : : : : Z 23 t 4n 1.000 :0i: : : : : Z 23 t 0i 1.000 :6n: : : : : Z 23 t 6n 1.000 :6j: : : : : Z 23 t 6j 1.000 :0k: : : : : Z 23 m 0k 1.000 wannabe :2[: : : : : Z 22 p 2[ 1.000 :4b: : : : : Z 22 p 4b 1.000 :0b: : : : : Z 22 p 0b 1.000 :4p: : : : : Z 22 p 4p 1.000 :6p: : : : : Z 22 p 6p 1.000 :2z: : : : : Z 22 p 2z 1.000 wannabe :4s: : : : : Z 22 t 4s 1.000 :2u: : : : : Z 22 t 2u 1.000 wannabe :2o: : : : : Z 22 m 2o 1.000 :epsilon: : : : : Z trig !! 0.000 epsilon-1 :alpha: : : : : Z 33 p 1a 0.999 :alpha: : : : : Z trig !! 0.000 alpha :beta: : : : : Z 33 p 1a 0.999 :beta: : : : : Z trig !! 0.000 beta :zeta: : : : : Z 33 p 1a 0.999 :zeta: : : : : Z trig !! 0.000 zeta-1 :delta-1: : : : : Z trig !! 0.000 delta :delta-1: : : : : Z trig !! 0.000 delta-1 :gamma: : : : : Z 33 p 1a 0.999 :gamma: : : : : Z trig !! 0.000 gamma :delta: : : : : Z 33 p 1a 0.999 :delta: : : : : Z trig !! 0.000 delta ''' output2 = '''2xLk:1: C: 12: : : U 33 p 1g 0.839 1-only-one 3cgp:1: B: 20: : : A 33 p 3g 0.040 1-only-one wannabe 4pco:1: B: 4: : : G 33 t 1c 0.890 2-BETWEEN-dom-sat( 0.22| 0.913) 5b2q:1: B: 63: : : U 32 p 1[ 0.072 2-BETWEEN-dom-sat( 0.941| 0.829) 6gc5:1: F: 3: : : U 22 p 4b 0.889 2-None-dom 3bns:1: A: 22: : : G 33 t 1c 0.901 2-OUTSIDE-dom 3gm7:1: H: 6: : : G 33 p !! 0.000 7D dist 1a 6qit:1: A: 3: : : A 32 p 1[ 0.899 2-OUTSIDE-sat 3rer:1: K: 8: : : A 33 p 7a 0.047 2-None-dom 3diL:1: A: 60: : : G 33 t !! 0.000 7D dist 1e 5ho4:1: B: 4: : : G 23 p !! 0.000 7D dist 4a 4mcf:1: E: 5: : : G 33 p !! 0.000 7D dist 1a 3pdr:1: A: 60: : : A 33 p 1a 0.916 4-BETWEEN-dom-sat( 0.1| 1.2) 3gm7:1: G: 2: : : U 33 p 1a 0.589 4-BETWEEN-dom-sat( 0.428| 0.904) 6h0r:1: B: 16: : : U 33 p 1L 0.033 4-BETWEEN-dom-sat( 0.862| 0.655) 2zko:1: C: 14: : : C 33 p 1a 0.444 4-OUTSIDE-dom 3pdr:1: X: 139: : : A 33 p &a 0.555 4-OUTSIDE-sat 4jah:1: B: 11: : : G 33 p &a 0.912 5-BETWEEN-dom-sat( 0.442| 0.226) 3diL:1: A: 14: : : G 23 p !! 0.000 outlier distance 1.01 3pdr:1: X: 133: : : U 33 m !! 0.000 vacant bin ''' def test(input, canonicalOutput, options, identity): opt = suites.parseOptions(options) stream = StringIO(input) outFile=StringIO() suitename.clearStats() suitename.main(stream, outFile=outFile, optionsIn=opt) suitename.clearStats() output = outFile.getvalue() assert output.strip() == canonicalOutput.strip(), identity def testAll(): test(input1, output1, "chart=true noinc=true", "cluster and triage test") test(input2, output2, "chart=true noinc=true causes=true", "code paths test") test(regression.in_1ehz, regression.out_1ehz, "", "1ehz regression test") # Not normally used, but useful for diagnosing failures def testVerbose(input, canonicalOutput, options, identity): opt = suites.parseOptions(options) stream = StringIO(input) outFile=StringIO("") suitename.clearStats() suitename.main(stream, outFile=outFile, optionsIn=opt) output = outFile.getvalue() if output.strip() == canonicalOutput.strip(): result = True sys.stderr.write("Success\n") else: result = False sys.stderr.write("Failed\n") sys.stderr.write("========================================\n") sys.stderr.write(canonicalOutput.strip()) sys.stderr.write("\n\n=========================================\n") sys.stderr.write(output.strip()) out2 = open("UnitTest-output.txt", "w") out2.write(output.strip()) out2.close() return result testAll()
59.279279
98
0.5423
3,648
19,740
2.862664
0.221217
0.184334
0.159916
0.221201
0.394427
0.346739
0.251173
0.226276
0.100929
0.098152
0
0.485299
0.233283
19,740
332
99
59.457831
0.204691
0.041489
0
0.049834
0
0.594684
0.916526
0.101883
0
0
0
0
0.003322
1
0.009967
false
0
0.016611
0
0.0299
0.003322
0
0
0
null
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
05ede0a9a22fa15754e9389ce8c3b7fd2fcffc54
55
py
Python
data_check/checks/pipeline_check/__init__.py
andrjas/data_check
12ba740fcf54261bed15f909290649e8350474da
[ "MIT" ]
1
2020-12-26T23:59:42.000Z
2020-12-26T23:59:42.000Z
data_check/checks/pipeline_check/__init__.py
andrjas/data_check
12ba740fcf54261bed15f909290649e8350474da
[ "MIT" ]
null
null
null
data_check/checks/pipeline_check/__init__.py
andrjas/data_check
12ba740fcf54261bed15f909290649e8350474da
[ "MIT" ]
null
null
null
from .pipeline_check import PipelineCheck # noqa E402
27.5
54
0.818182
7
55
6.285714
1
0
0
0
0
0
0
0
0
0
0
0.06383
0.145455
55
1
55
55
0.87234
0.163636
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
af096791941fefe152ca1cb2379e4cf814fbe7c5
154
py
Python
helpline_telegraph/telegram_bot/__init__.py
kolayne/helpline_telegraph
d791607d857c3a4267b62625108c72a5094e4cbf
[ "MIT" ]
2
2021-05-27T20:22:27.000Z
2021-05-31T19:15:51.000Z
helpline_telegraph/telegram_bot/__init__.py
kolayne/anonymous_helpline_chatbot
d791607d857c3a4267b62625108c72a5094e4cbf
[ "MIT" ]
31
2020-11-03T20:20:36.000Z
2021-06-17T17:51:22.000Z
helpline_telegraph/telegram_bot/__init__.py
kolayne/helpline_telegraph
d791607d857c3a4267b62625108c72a5094e4cbf
[ "MIT" ]
2
2020-11-03T20:25:39.000Z
2020-11-03T20:28:42.000Z
from ._init_objects import bot # Create `bot` handlers from . import tg_message_handlers as _ from . import tg_callback_handlers as _ __all__ = ["bot"]
19.25
39
0.766234
22
154
4.818182
0.545455
0.188679
0.226415
0
0
0
0
0
0
0
0
0
0.162338
154
7
40
22
0.821705
0.136364
0
0
0
0
0.022901
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
af3bbc0d1b4e441857059c459e20357f4b22d268
96
py
Python
venv/lib/python3.8/site-packages/jedi/inference/cache.py
GiulianaPola/select_repeats
17a0d053d4f874e42cf654dd142168c2ec8fbd11
[ "MIT" ]
2
2022-03-13T01:58:52.000Z
2022-03-31T06:07:54.000Z
venv/lib/python3.8/site-packages/jedi/inference/cache.py
DesmoSearch/Desmobot
b70b45df3485351f471080deb5c785c4bc5c4beb
[ "MIT" ]
19
2021-11-20T04:09:18.000Z
2022-03-23T15:05:55.000Z
venv/lib/python3.8/site-packages/jedi/inference/cache.py
DesmoSearch/Desmobot
b70b45df3485351f471080deb5c785c4bc5c4beb
[ "MIT" ]
null
null
null
/home/runner/.cache/pip/pool/b0/77/d8/d970e0ccaca87abfb837c0e459be11f03586fec84f4dc4a94eb3b76f0a
96
96
0.895833
9
96
9.555556
1
0
0
0
0
0
0
0
0
0
0
0.354167
0
96
1
96
96
0.541667
0
0
0
0
0
0
0
0
1
0
0
0
0
null
null
0
0
null
null
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
null
1
0
0
0
1
0
0
0
0
0
0
0
0
5
afa13ece4b3fa48f6d9bd07f52a9cfe3789c0b31
120
py
Python
shebang/account/admin.py
KNU-shebang/Shebang
117d6d55344442d76def5c7682ab826ea2521d15
[ "MIT" ]
2
2017-03-18T07:43:58.000Z
2017-05-02T16:21:42.000Z
shebang/account/admin.py
KNU-shebang/Shebang
117d6d55344442d76def5c7682ab826ea2521d15
[ "MIT" ]
2
2017-03-24T09:24:35.000Z
2017-05-02T14:48:21.000Z
shebang/account/admin.py
KNU-shebang/Shebang
117d6d55344442d76def5c7682ab826ea2521d15
[ "MIT" ]
1
2020-10-18T18:38:14.000Z
2020-10-18T18:38:14.000Z
from django.contrib import admin from account.models import User # Register your models here. admin.site.register(User)
24
32
0.816667
18
120
5.444444
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.116667
120
5
33
24
0.924528
0.216667
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
afb5001f5e516147887b296d1e2ba6e6795740fb
1,633
py
Python
tests/river/unit/transformer/conftest.py
arkhn/fhir-river
a12179c34fad131d16dedc20c61297ed83d805e6
[ "Apache-2.0" ]
42
2020-03-25T16:47:30.000Z
2022-01-31T21:26:38.000Z
tests/river/unit/transformer/conftest.py
arkhn/fhir-river
a12179c34fad131d16dedc20c61297ed83d805e6
[ "Apache-2.0" ]
367
2020-04-08T12:46:34.000Z
2022-02-16T01:15:32.000Z
tests/river/unit/transformer/conftest.py
arkhn/fhir-river
a12179c34fad131d16dedc20c61297ed83d805e6
[ "Apache-2.0" ]
3
2020-05-14T08:24:46.000Z
2021-08-04T05:00:16.000Z
import pytest @pytest.fixture def identifier(): return { "system": "http://terminology.arkhn.org/mimic_id/3fd9abb2-c4dc-4dc7-a2f8-888d5714aac4", "value": "123", } @pytest.fixture def patient(): return { "id": "pat1", "resourceType": "Patient", "identifier": [ { "value": "111", "system": "http://terminology.arkhn.org/mimic_id/8758b68b-8743-4cad-97c3-a1182e0085bb", "assigner": { "type": "Organization", "identifier": { "system": "http://terminology.arkhn.org/mimic_id/14d524bd-42c9-4457-a66b-3d439a90d5d4", "value": "456", }, }, } ], "generalPractitioner": [ { "type": "Practitioner", "identifier": { "system": "http://terminology.arkhn.org/mimic_id/3fd9abb2-c4dc-4dc7-a2f8-888d5714aac4", "value": "123", }, }, { "type": "Practitioner", "identifier": { "system": "http://terminology.arkhn.org/mimic_id/3fd9abb2-c4dc-4dc7-a2f8-888d5714aac4", "value": "321", }, }, ], "managingOrganization": { "type": "Organization", "identifier": { "system": "http://terminology.arkhn.org/mimic_id/14d524bd-42c9-4457-a66b-3d439a90d5d4", "value": "789", }, }, }
30.240741
111
0.441519
116
1,633
6.163793
0.37069
0.083916
0.176224
0.218182
0.714685
0.714685
0.714685
0.664336
0.664336
0.664336
0
0.137824
0.409063
1,633
53
112
30.811321
0.603109
0
0
0.428571
0
0
0.437232
0
0
0
0
0
0
1
0.040816
true
0
0.020408
0.040816
0.102041
0
0
0
0
null
0
0
1
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
bb8a19b98f1f173d213e889cbae76ea16ba2cc3a
158
py
Python
hata/discord/embed/__init__.py
ToxicKidz/hata
f834c3cee3920d3095254815582325c5232022d7
[ "0BSD" ]
173
2019-06-14T20:25:00.000Z
2022-03-21T19:36:10.000Z
hata/discord/embed/__init__.py
Tari-dev/hata
a5c3199c845858f997af3b0b2c18770fdc691897
[ "0BSD" ]
52
2020-01-03T17:05:14.000Z
2022-03-31T11:39:50.000Z
hata/discord/embed/__init__.py
Tari-dev/hata
a5c3199c845858f997af3b0b2c18770fdc691897
[ "0BSD" ]
47
2019-11-09T08:46:45.000Z
2022-03-31T14:33:34.000Z
from .embed import * from .embed_base import * from .embed_core import * __all__ = ( *embed.__all__, *embed_base.__all__, *embed_core.__all__, )
15.8
25
0.683544
20
158
4.4
0.3
0.306818
0.340909
0
0
0
0
0
0
0
0
0
0.202532
158
9
26
17.555556
0.698413
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.375
0
0.375
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
bba8cf124a21fd84cb69566aadec880ce063de3d
122
py
Python
noise/noise_quick_action.py
codecat555/codecat555-fidgetingbits_knausj_talon
62f9be0459e6631c99d58eee97054ddd970cc5f3
[ "MIT" ]
1
2020-12-30T00:18:18.000Z
2020-12-30T00:18:18.000Z
noise/noise_quick_action.py
codecat555/codecat555-fidgetingbits_knausj_talon
62f9be0459e6631c99d58eee97054ddd970cc5f3
[ "MIT" ]
null
null
null
noise/noise_quick_action.py
codecat555/codecat555-fidgetingbits_knausj_talon
62f9be0459e6631c99d58eee97054ddd970cc5f3
[ "MIT" ]
null
null
null
from talon import Module mod = Module() mod.tag("noise_quick_actions", desc="A tag for enabling noise quick actions")
17.428571
77
0.745902
19
122
4.684211
0.684211
0.202247
0.382022
0
0
0
0
0
0
0
0
0
0.155738
122
6
78
20.333333
0.864078
0
0
0
0
0
0.471074
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
bbf719397bfb8e436a7338a7b459f6a362747d79
388
py
Python
src/main.py
dpayba/Handwritten-Plagiarism-Scanner
34ca047342eacc07683630af2c0959ed268656fb
[ "MIT" ]
null
null
null
src/main.py
dpayba/Handwritten-Plagiarism-Scanner
34ca047342eacc07683630af2c0959ed268656fb
[ "MIT" ]
null
null
null
src/main.py
dpayba/Handwritten-Plagiarism-Scanner
34ca047342eacc07683630af2c0959ed268656fb
[ "MIT" ]
null
null
null
import os def main(): os.system('python controller.py --img_file ../data/image4.png --output_dir ../text_output/file1.txt') os.system('python controller.py --img_file ../data/line.png --output_dir ../text_output/file2.txt') os.system('python scan_similarity.py --file1_dir ../text_output/file1.txt --file2_dir ../text_output/file2.txt') if __name__ == '__main__': main()
43.111111
116
0.706186
58
388
4.396552
0.413793
0.109804
0.203922
0.188235
0.690196
0.290196
0.290196
0.290196
0
0
0
0.020349
0.113402
388
9
117
43.111111
0.72093
0
0
0
0
0
0.722365
0.246787
0
0
0
0
0
1
0.142857
true
0
0.142857
0
0.285714
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
a530553e3337dfd6eab927d9c14b03ccddbef68a
3,132
py
Python
docs/CS161/StudentShowcase/ChineseFlag.py
DavidJLu/CCUT
755cdeaa36f4eac817d09efe29550843fa5a4fdc
[ "MIT" ]
5
2018-06-04T16:11:56.000Z
2021-02-25T21:59:58.000Z
docs/CS161/StudentShowcase/ChineseFlag.py
DavidJLu/CCUT
755cdeaa36f4eac817d09efe29550843fa5a4fdc
[ "MIT" ]
null
null
null
docs/CS161/StudentShowcase/ChineseFlag.py
DavidJLu/CCUT
755cdeaa36f4eac817d09efe29550843fa5a4fdc
[ "MIT" ]
1
2019-02-21T21:22:55.000Z
2019-02-21T21:22:55.000Z
#ChineseNationalFlag.py import turtle t = turtle.Turtle() turtle.bgcolor('black') t.color('red') width = -350 height =300 t.penup() t.goto(width,height) t.pendown() t.begin_fill() t.fillcolor('red') t.forward(700) t.right(90) t.forward(400) t.right(90) t.forward(700) t.right(90) t.forward(400) t.right(90) t.end_fill() width = -290 height = 225 t.penup() t.goto(width,height) t.pendown() t.color('yellow') t.begin_fill() t.fillcolor('yellow') for i in range(5): t.forward(120) t.right(144) t.end_fill() width = -100 height = 260 t.penup() t.goto(width,height) t.pendown() t.color('yellow') t.begin_fill() t.fillcolor('yellow') t.right(168) for i in range(5): t.forward(40) t.right(144) t.end_fill() width = -100 height = 218 t.penup() t.goto(width,height) t.pendown() t.color('yellow') t.begin_fill() t.fillcolor('yellow') t.right(525) for i in range(5): t.forward(40) t.right(144) t.end_fill() width = -100 height = 167 t.penup() t.goto(width,height) t.pendown() t.color('yellow') t.begin_fill() t.fillcolor('yellow') t.right(27) for i in range(5): t.forward(40) t.right(144) t.end_fill() width = -100 height = 117 t.penup() t.goto(width,height) t.pendown() t.color('yellow') t.begin_fill() t.fillcolor('yellow') t.right(168) for i in range(5): t.forward(40) t.right(144) t.end_fill() width = -420 height = -190 t.penup() t.goto(width,height) t.pendown() t.color('yellow') t.width(10) t.left(78) t.forward(150) width = -270 height = -350 t.penup() t.goto(width,height) t.pendown() def curvemove(): for i in range(200): t.right(1) t.forward(1) t.color('red') t.width(1) t.begin_fill() t.fillcolor('red') t.left(230) t.forward(111.65) curvemove() t.left(120) curvemove() t.forward(111.65) t.end_fill() width = -10 height = -190 t.penup() t.goto(width,height) t.pendown() t.color('yellow') t.width(10) t.right(40) t.forward(100) t.left(90) t.forward(150) t.left(90) t.forward(100) width = 20 height = -190 t.penup() t.goto(width,height) t.pendown() t.right(90) t.forward(150) width = 20 height = -265 t.penup() t.goto(width,height) t.pendown() t.left(90) t.forward(100) width = 120 height = -190 t.penup() t.goto(width,height) t.pendown() t.right(90) t.forward(150) width = 150 height = -190 t.penup() t.goto(width,height) t.pendown() t.forward(150) width = 180 height = -190 t.penup() t.goto(width,height) t.pendown() t.forward(150) width = 180 height = -190 t.penup() t.goto(width,height) t.pendown() t.left(33.7) t.forward(180) width = 280 height = -190 t.penup() t.goto(width,height) t.pendown() t.right(34) t.forward(150) width = 360 height = -190 t.penup() t.goto(width,height) t.pendown() t.right(18.4) t.forward(158.1) width = 360 height = -190 t.penup() t.goto(width,height) t.pendown() t.left(36.8) t.forward(158.1) width = 335 height = -265 t.penup() t.goto(width,height) t.pendown() t.left(71.6) t.forward(50) turtle.exitonclick()
14.635514
25
0.625479
543
3,132
3.581952
0.139963
0.106941
0.06838
0.107455
0.790231
0.767609
0.767609
0.712596
0.697172
0.665296
0
0.105924
0.186143
3,132
213
26
14.704225
0.65712
0.007024
0
0.8
0
0
0.030732
0
0
0
0
0
0
1
0.005128
false
0
0.005128
0
0.010256
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
a549b7ea786be46058c24da87c85b79a86e2c956
1,497
py
Python
J_Mathematical_Modeling/Section 3/solutionExercise3.py
sylvain2002/CBM101
4d9dc4264ce81cc2af58ceaff96fd0ed7a570af5
[ "MIT" ]
null
null
null
J_Mathematical_Modeling/Section 3/solutionExercise3.py
sylvain2002/CBM101
4d9dc4264ce81cc2af58ceaff96fd0ed7a570af5
[ "MIT" ]
null
null
null
J_Mathematical_Modeling/Section 3/solutionExercise3.py
sylvain2002/CBM101
4d9dc4264ce81cc2af58ceaff96fd0ed7a570af5
[ "MIT" ]
null
null
null
from IPython.display import display, Latex print("The promoter activity is still a random variable, more than even since it is now stochastically influenced both by its intrinsic rate of inactivation k_off, and by the protein-associated inactivation. Since in the state for which we write the CME there are n proteins, and each might inactivate the promoter with a rate k_inact, the total inactivation rate will be k_off+n*k_inact. Importantly, this additional molecular route does not directly affect the number of mRNAs or of proteins, so in terms of the system's states involved in the transition, those are exactly the same as for the intrinsic inactivation k_off. ") print(" Hence, we can simply replace k_off by k_off+n*k_inact and the CMEs become:") print("") display(Latex('$ \partial P_{m,n,0}(t)/\partial t = (k_{off}+n*k_{inact}) * P_{m,n,1}(t)- k_{on} * P_{m,n,0}(t)+\nu_1*m* \displaystyle \Bigg( P_{m,n-1,0}(t)-P_{m,n,0}(t) \Bigg) + d_0* \displaystyle \Bigg( (m+1)*P_{m+1,n,0}(t)-m*P_{m,n,0}(t) \Bigg)+ d_1* \displaystyle \Bigg( (n+1)*P_{m,n+1,0}(t)-n*P_{m,n,0}(t) \Bigg),$')) print("and") display(Latex('$ \partial P_{m,n,1}(t)/\partial t= - (k_{off}+n*k_{inact}) * P_{m,n,1}(t)+ k_{on} * P_{m,n,0}(t)+ \nu_0* \displaystyle \Bigg( P_{m-1,n,1}(t)-P_{m,n,1}(t) \Bigg)+ \nu_1*m* \displaystyle \Bigg( P_{m,n-1,1}(t)-P_{m,n,1}(t) \Bigg) + d_0* \displaystyle \Bigg( (m+1)*P_{m+1,n,1}(t)-m*P_{m,n,1}(t) \Bigg)+ d_1* \displaystyle \Bigg( (n+1)*P_{m,n+1,1}(t)-n*P_{m,n,1}(t) \Bigg)$'))
106.928571
628
0.679359
316
1,497
3.088608
0.294304
0.040984
0.052254
0.045082
0.372951
0.343238
0.267418
0.255123
0.237705
0.190574
0
0.028941
0.122912
1,497
13
629
115.153846
0.714395
0
0
0
0
0.428571
0.915775
0.217914
0
0
0
0
0
1
0
true
0
0.285714
0
0.285714
0.571429
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
3c189e19f0c287cb7e2fdeaf2461c62b77a42440
337
py
Python
app/models/blockchain.py
mohamedmhiri/blockchain-flask-server-side
a8cfc78e220edfae5a26536103ba45d9c6d400d5
[ "MIT" ]
null
null
null
app/models/blockchain.py
mohamedmhiri/blockchain-flask-server-side
a8cfc78e220edfae5a26536103ba45d9c6d400d5
[ "MIT" ]
null
null
null
app/models/blockchain.py
mohamedmhiri/blockchain-flask-server-side
a8cfc78e220edfae5a26536103ba45d9c6d400d5
[ "MIT" ]
null
null
null
""" This is the Blockchain Model class implementation """ class Blockchain: def __init__(self): self.current_transactions = [] self.chain = [] self.nodes = set() def __repr__(self): return '<Blockchain(chain={self.chain!r}, current_transactions={self.current_transactions!r})>'.format(self=self)
25.923077
121
0.661721
38
337
5.578947
0.5
0.268868
0.216981
0
0
0
0
0
0
0
0
0
0.20178
337
13
121
25.923077
0.788104
0.145401
0
0
0
0
0.30605
0.302491
0
0
0
0
0
1
0.285714
false
0
0
0.142857
0.571429
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
3c27996b91fda58696ab000a34f79ab35b9abfbe
27
py
Python
my_script.py
2ndBrigadeWebProgrammer/Backend-Ga-MoNya
d1d0817c7b8206a885d5f99aad20c8cf4d3c76a2
[ "MIT" ]
null
null
null
my_script.py
2ndBrigadeWebProgrammer/Backend-Ga-MoNya
d1d0817c7b8206a885d5f99aad20c8cf4d3c76a2
[ "MIT" ]
null
null
null
my_script.py
2ndBrigadeWebProgrammer/Backend-Ga-MoNya
d1d0817c7b8206a885d5f99aad20c8cf4d3c76a2
[ "MIT" ]
null
null
null
echo 'Hello Python Pages!'
13.5
26
0.740741
4
27
5
1
0
0
0
0
0
0
0
0
0
0
0
0.148148
27
1
27
27
0.869565
0
0
0
0
0
0.703704
0
0
0
0
0
0
0
null
null
0
0
null
null
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
5
b1bf5416d5add7c782960ab5bc46723d7382bee5
451
py
Python
day_04/passphrase.py
ianepreston/advent_2017
28a05752e9adabadc0cc8e5b624ea77edc7e782c
[ "MIT" ]
null
null
null
day_04/passphrase.py
ianepreston/advent_2017
28a05752e9adabadc0cc8e5b624ea77edc7e782c
[ "MIT" ]
null
null
null
day_04/passphrase.py
ianepreston/advent_2017
28a05752e9adabadc0cc8e5b624ea77edc7e782c
[ "MIT" ]
null
null
null
def read_passphrases(): with open("day_04/input.txt", "r") as f: return [line.split() for line in f.readlines()] def part1(): return sum(len(phrase) == len(set(phrase)) for phrase in read_passphrases()) print(part1()) def anagram(passphrase): return len(passphrase) == len(set("".join(sorted(phrase)) for phrase in passphrase)) def part2(): return sum(anagram(phrase) for phrase in read_passphrases()) print(part2())
20.5
88
0.67184
64
451
4.671875
0.453125
0.150502
0.150502
0.170569
0.247492
0.247492
0.247492
0
0
0
0
0.016043
0.170732
451
21
89
21.47619
0.783422
0
0
0
0
0
0.037694
0
0
0
0
0
0
1
0.363636
false
0.454545
0
0.272727
0.727273
0.181818
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
5
59161f5f2e749ec3097a6be8320e8f8f4d8cd95d
125
py
Python
tools/run_hooks.py
robbym/deno
6b49944da1e7b06aeba04b1c0ded8e3fdb3c436b
[ "MIT" ]
null
null
null
tools/run_hooks.py
robbym/deno
6b49944da1e7b06aeba04b1c0ded8e3fdb3c436b
[ "MIT" ]
null
null
null
tools/run_hooks.py
robbym/deno
6b49944da1e7b06aeba04b1c0ded8e3fdb3c436b
[ "MIT" ]
null
null
null
#!/usr/bin/env python import third_party third_party.fix_symlinks() third_party.download_gn() third_party.download_clang()
15.625
28
0.816
19
125
5
0.631579
0.421053
0.378947
0
0
0
0
0
0
0
0
0
0.072
125
7
29
17.857143
0.818966
0.16
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.25
0
0.25
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
59329e1650b79c60ef7de9c64307441b31f0d4ee
66
py
Python
main.py
cramosk/fscal
e419c5507608c15aa9fbaaf10c8af919fe0d2afa
[ "MIT" ]
null
null
null
main.py
cramosk/fscal
e419c5507608c15aa9fbaaf10c8af919fe0d2afa
[ "MIT" ]
null
null
null
main.py
cramosk/fscal
e419c5507608c15aa9fbaaf10c8af919fe0d2afa
[ "MIT" ]
null
null
null
# coding: utf8 #!/usr/bin/python2 def directorymaker(): pass
11
21
0.666667
8
66
5.5
1
0
0
0
0
0
0
0
0
0
0
0.037037
0.181818
66
5
22
13.2
0.777778
0.439394
0
0
0
0
0
0
0
0
0
0
0
1
0.5
true
0.5
0
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
1
0
0
0
0
0
5
594940f79ea0728b77c01c301e56d65e27b2ad3c
18,862
py
Python
test/test_jobrunner.py
kbase/JobRunner
06bf57b9eff7acb66f63fbc3ff94a5784d856450
[ "MIT" ]
null
null
null
test/test_jobrunner.py
kbase/JobRunner
06bf57b9eff7acb66f63fbc3ff94a5784d856450
[ "MIT" ]
29
2019-06-24T23:01:50.000Z
2022-03-25T19:47:26.000Z
test/test_jobrunner.py
kbase/JobRunner
06bf57b9eff7acb66f63fbc3ff94a5784d856450
[ "MIT" ]
6
2019-06-13T20:17:35.000Z
2019-10-07T17:33:32.000Z
# -*- coding: utf-8 -*- import os import unittest from copy import deepcopy from time import time as _time from unittest.mock import patch, MagicMock from nose.plugins.attrib import attr from requests import ConnectionError from JobRunner.JobRunner import JobRunner from .mock_data import ( CATALOG_GET_MODULE_VERSION, EE2_JOB_PARAMS, EE2_LIST_CONFIG, CATALOG_LIST_VOLUME_MOUNTS, AUTH_V2_TOKEN, ) from docker.errors import NotFound from docker.models.containers import Container from JobRunner.exceptions import CantRestartJob class MockLogger(object): def __init__(self): self.lines = [] self.errors = [] self.all = [] def log_lines(self, lines): self.all.extend(lines) def log(self, line): self.lines.append(line) self.all.append([line, 0]) def error(self, line): self.errors.append(line) self.all.append([line, 1]) class MockAuth(object): def __init__(self, data): self.data = data def json(self): return self.data class JobRunnerTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.token = os.environ.get("KB_AUTH_TOKEN", "") cls.admin_token = os.environ.get("KB_ADMIN_AUTH_TOKEN", "bogus") cls.cfg = {} base = "https://ci.kbase.us/services/" if "TEST_URL" in os.environ: base = "http://%s/services/" % (os.environ["TEST_URL"]) cls.ee2_url = base + "ee2" cls.jobid = "1234" cls.workdir = "/tmp/jr/" cls.cfg["token"] = cls.token cls.future = _time() + 3600 cls.config = { "catalog-service-url": base + "catalog", "auth-service-url": base + "auth/api/legacy/KBase/Sessions/Login", "auth2-url": base + "auth/api/V2/token", "workdir": "/tmp/jr", } if not os.path.exists("/tmp/jr"): os.mkdir("/tmp/jr") if "KB_ADMIN_AUTH_TOKEN" not in os.environ: os.environ["KB_ADMIN_AUTH_TOKEN"] = "bogus" def _cleanup(self, job): d = os.path.join(self.workdir, "workdir") if os.path.exists(d): for fn in ["config.properties", "input.json", "output.json", "token"]: if os.path.exists(os.path.join(d, fn)): os.unlink(os.path.join(d, fn)) try: os.rmdir(d) except: pass @attr("offline") @patch("JobRunner.JobRunner.KBaseAuth", autospec=True) @patch("JobRunner.JobRunner.EE2", autospec=True) def test_run_sub(self, mock_ee2, mock_auth): """ This test is expected to run for 50-60 seconds? """ self._cleanup(self.jobid) params = deepcopy(EE2_JOB_PARAMS) params["method"] = "RunTester.run_RunTester" params["params"] = [{"depth": 3, "size": 1000, "parallel": 5}] config = deepcopy(EE2_LIST_CONFIG) config["auth-service-url"] = self.config["auth-service-url"] config["auth.service.url.v2"] = self.config["auth2-url"] jr = JobRunner( self.config, self.ee2_url, self.jobid, self.token, self.admin_token ) rv = deepcopy(CATALOG_GET_MODULE_VERSION) rv["docker_img_name"] = "test/runtester:latest" jr.cc.catalog.get_module_version = MagicMock(return_value=rv) jr.cc.catalog.list_volume_mounts = MagicMock(return_value=[]) jr.cc.catalog.get_secure_config_params = MagicMock(return_value=None) jr.logger.ee2.add_job_logs = MagicMock(return_value=rv) jr._get_cgroup = MagicMock(return_value=None) jr.ee2.get_job_params.return_value = params jr.ee2.list_config.return_value = config jr.ee2.check_job_canceled.return_value = {"finished": False} jr.auth.get_user.return_value = "bogus" jr._get_token_lifetime = MagicMock(return_value=self.future) out = jr.run() self.assertIn("result", out) self.assertNotIn("error", out) @attr("offline") @patch("JobRunner.JobRunner.KBaseAuth", autospec=True) @patch("JobRunner.JobRunner.EE2", autospec=True) def test_run(self, mock_ee2, mock_auth): self._cleanup(self.jobid) params = deepcopy(EE2_JOB_PARAMS) params["method"] = "mock_app.bogus" params["params"] = {"param1": "value1"} config = deepcopy(EE2_LIST_CONFIG) config["auth-service-url"] = self.config["auth-service-url"] config["auth.service.url.v2"] = self.config["auth2-url"] jr = JobRunner( self.config, self.ee2_url, self.jobid, self.token, self.admin_token ) rv = deepcopy(CATALOG_GET_MODULE_VERSION) rv["docker_img_name"] = "mock_app:latest" jr.cc.catalog.get_module_version = MagicMock(return_value=rv) jr.cc.catalog.list_volume_mounts = MagicMock(return_value=[]) jr.cc.catalog.get_secure_config_params = MagicMock(return_value=None) jr.logger.ee2.add_job_logs = MagicMock(return_value=rv) jr._get_cgroup = MagicMock(return_value=None) jr.ee2.get_job_params.return_value = params jr.ee2.list_config.return_value = config jr.ee2.check_job_canceled.return_value = {"finished": False} jr.auth.get_user.return_value = "bogus" jr._get_token_lifetime = MagicMock(return_value=self.future) out = jr.run() self.assertIn("result", out) self.assertNotIn("error", out) @attr("offline") @patch("JobRunner.JobRunner.KBaseAuth", autospec=True) @patch("JobRunner.JobRunner.EE2", autospec=True) def test_run_volume(self, mock_ee2, mock_auth): self._cleanup(self.jobid) params = deepcopy(EE2_JOB_PARAMS) params["method"] = "mock_app.voltest" params["params"] = {"param1": "value1"} jr = JobRunner( self.config, self.ee2_url, self.jobid, self.token, self.admin_token ) rv = deepcopy(CATALOG_GET_MODULE_VERSION) rv["docker_img_name"] = "mock_app:latest" vols = deepcopy(CATALOG_LIST_VOLUME_MOUNTS) jr._get_cgroup = MagicMock(return_value=None) jr.cc.catalog.get_module_version = MagicMock(return_value=rv) jr.cc.catalog.list_volume_mounts = MagicMock(return_value=vols) jr.cc.catalog.get_secure_config_params = MagicMock(return_value=None) jr.logger.ee2.add_job_logs = MagicMock(return_value=rv) jr.ee2.get_job_params.return_value = params jr.ee2.list_config.return_value = EE2_LIST_CONFIG jr.ee2.check_job_canceled.return_value = {"finished": False} jr.auth.get_user.return_value = "bogus" jr._get_token_lifetime = MagicMock(return_value=self.future) if not os.path.exists("/tmp/bogus"): os.mkdir("/tmp/bogus") with open("/tmp/bogus/input.fa", "w") as f: f.write(">contig-50_0 length_64486 read_count_327041\n") f.write("GTCGTGCTGCTGCCGATCGACCGCGCCTATGCGATGTTGCCGGACGGCATCC\n") out = jr.run() self.assertIn("result", out) self.assertNotIn("error", out) @attr("offline") @patch("JobRunner.JobRunner.KBaseAuth", autospec=True) @patch("JobRunner.JobRunner.EE2", autospec=True) def test_cancel(self, mock_ee2, mock_auth): """ This test is expected to run for 30 seconds? """ self._cleanup(self.jobid) params = deepcopy(EE2_JOB_PARAMS) params["method"] = "RunTester.run_RunTester" params["params"] = [{"depth": 3, "size": 1000, "parallel": 4}] jr = JobRunner( self.config, self.ee2_url, self.jobid, self.token, self.admin_token ) rv = deepcopy(CATALOG_GET_MODULE_VERSION) rv["docker_img_name"] = "test/runtester:latest" jr._get_cgroup = MagicMock(return_value='cgroup') jr.cc.catalog.get_module_version = MagicMock(return_value=rv) jr.cc.catalog.list_volume_mounts = MagicMock(return_value=[]) jr.cc.catalog.get_secure_config_params = MagicMock(return_value=None) jr.logger.ee2.add_job_logs = MagicMock(return_value=rv) jr._get_token_lifetime = MagicMock(return_value=self.future) jr.ee2.get_job_params.return_value = params jr.ee2.list_config.return_value = EE2_LIST_CONFIG nf = {"finished": False} jr.ee2.check_job_canceled.side_effect = [nf, nf, nf, nf, nf, {"finished": True}] jr.auth.get_user.return_value = "bogus" out = jr.run() self.assertIsNotNone(out) self.assertEqual({"error": "Canceled or unexpected error"}, out) # Check that all containers are gone for c in jr.mr.containers: # type: Container with self.assertRaises(expected_exception=NotFound): c.reload() @attr("offline") @patch("JobRunner.JobRunner.KBaseAuth", autospec=True) @patch("JobRunner.JobRunner.EE2", autospec=True) def test_max_jobs(self, mock_ee2, mock_auth): self._cleanup(self.jobid) params = deepcopy(EE2_JOB_PARAMS) params["method"] = "RunTester.run_RunTester" params["params"] = [{"depth": 2, "size": 1000, "parallel": 5}] config = deepcopy(self.config) config["max_tasks"] = 2 jr = JobRunner(config, self.ee2_url, self.jobid, self.token, self.admin_token) rv = deepcopy(CATALOG_GET_MODULE_VERSION) rv["docker_img_name"] = "test/runtester:latest" jr.cc.catalog.get_module_version = MagicMock(return_value=rv) jr.cc.catalog.list_volume_mounts = MagicMock(return_value=[]) jr.cc.catalog.get_secure_config_params = MagicMock(return_value=None) jr._get_cgroup = MagicMock(return_value=None) jr.logger.ee2.add_job_logs = MagicMock(return_value=rv) jr._get_token_lifetime = MagicMock(return_value=self.future) jr.ee2.get_job_params.return_value = params jr.ee2.list_config.return_value = EE2_LIST_CONFIG jr.ee2.check_job_canceled.return_value = {"finished": False} jr.auth.get_user.return_value = "bogus" out = jr.run() self.assertIn("error", out) # Check that all containers are gone @attr("online") @patch("JobRunner.JobRunner.EE2", autospec=True) def test_run_online(self, mock_ee2): self._cleanup(self.jobid) params = deepcopy(EE2_JOB_PARAMS) jr = JobRunner( self.config, self.ee2_url, self.jobid, self.token, self.admin_token ) rv = deepcopy(CATALOG_GET_MODULE_VERSION) rv["docker_img_name"] = "mock_app:latest" jr.logger.ee2.add_job_logs = MagicMock(return_value=rv) jr.ee2.check_job_canceled.return_value = {"finished": False} jr.ee2.get_job_params.return_value = params jr._get_cgroup = MagicMock(return_value=None) jr._get_token_lifetime = MagicMock(return_value=self.future) out = jr.run() self.assertIn("result", out) self.assertNotIn("error", out) @patch("JobRunner.JobRunner.EE2", autospec=True) @patch("JobRunner.JobRunner.KBaseAuth", autospec=True) def test_token(self, mock_ee2, mock_auth): self._cleanup(self.jobid) params = deepcopy(EE2_JOB_PARAMS) os.environ["KB_AUTH_TOKEN"] = "bogus" jr = JobRunner( self.config, self.ee2_url, self.jobid, self.token, self.admin_token ) jr.ee2.check_job_canceled.return_value = {"finished": False} jr.ee2.get_job_params.return_value = params jr.auth.get_user.side_effect = OSError() with self.assertRaises(Exception): jr.run() @patch("JobRunner.JobRunner.EE2", autospec=True) @patch("JobRunner.JobRunner.KBaseAuth", autospec=True) def test_canceled_job(self, mock_ee2, mock_auth): self._cleanup(self.jobid) params = deepcopy(EE2_JOB_PARAMS) mlog = MockLogger() os.environ["KB_AUTH_TOKEN"] = "bogus" jr = JobRunner( self.config, self.ee2_url, self.jobid, self.token, self.admin_token ) jr.logger = mlog jr.ee2.check_job_canceled.return_value = {"finished": True} with self.assertRaises(CantRestartJob): jr.run() self.assertEqual(mlog.errors[0], "Job already run or terminated") @patch("JobRunner.JobRunner.EE2", autospec=True) @patch("JobRunner.JobRunner.KBaseAuth", autospec=True) def test_error_update(self, mock_ee2, mock_auth): self._cleanup(self.jobid) mlog = MockLogger() os.environ["KB_AUTH_TOKEN"] = "bogus" jr = JobRunner( self.config, self.ee2_url, self.jobid, self.token, self.admin_token ) jr.logger = mlog jr.ee2.check_job_canceled.return_value = {"finished": False} jr.ee2.start_job.side_effect = ConnectionError() jr.ee2.get_job_params.side_effect = ConnectionError() with self.assertRaises(ConnectionError): jr.run() emsg = "Failed to get job parameters. Exiting." self.assertEquals(mlog.errors[0], emsg) @attr("offline") @patch("JobRunner.JobRunner.EE2", autospec=True) @patch("JobRunner.JobRunner.KBaseAuth", autospec=True) @patch("JobRunner.JobRunner.requests", autospec=True) def test_token_lifetime(self, mock_req, mock_auth, mock_ee2): # Test get token lifetime config = deepcopy(EE2_LIST_CONFIG) resp = AUTH_V2_TOKEN mock_req.get.return_value = MockAuth(resp) jr = JobRunner( self.config, self.ee2_url, self.jobid, self.token, self.admin_token ) mlog = MockLogger() jr.logger = mlog exp = jr._get_token_lifetime(config) self.assertGreater(exp, 0) mock_req.get.side_effect = OSError("bad request") with self.assertRaises(OSError): jr._get_token_lifetime(config) @attr("offline") @patch("JobRunner.JobRunner.EE2", autospec=True) @patch("JobRunner.JobRunner.KBaseAuth", autospec=True) def test_expire_loop(self, mock_auth, mock_ee2): # Check that things exit when the token expires self._cleanup(self.jobid) params = deepcopy(EE2_JOB_PARAMS) params["method"] = "mock_app.bogus" params["params"] = {"param1": "value1"} jr = JobRunner( self.config, self.ee2_url, self.jobid, self.token, self.admin_token ) rv = deepcopy(CATALOG_GET_MODULE_VERSION) rv["docker_img_name"] = "mock_app:latest" jr.cc.catalog.get_module_version = MagicMock(return_value=rv) jr.cc.catalog.list_volume_mounts = MagicMock(return_value=[]) jr.cc.catalog.get_secure_config_params = MagicMock(return_value=None) jr._get_cgroup = MagicMock(return_value=None) jr.logger.ee2.add_job_logs = MagicMock(return_value=rv) jr.ee2.get_job_params.return_value = params jr.ee2.list_config.return_value = EE2_LIST_CONFIG jr.ee2.check_job_canceled.return_value = {"finished": False} jr.auth.get_user.return_value = "bogus" jr._get_token_lifetime = MagicMock(return_value=_time()) out = jr.run() self.assertIn("error", out) self.assertEqual(out["error"], "Token has expired") @patch("JobRunner.JobRunner.KBaseAuth", autospec=True) @patch("JobRunner.JobRunner.EE2", autospec=True) def test_special(self, mock_ee2, mock_auth): jr = JobRunner( self.config, self.ee2_url, self.jobid, self.token, self.admin_token ) jr._get_cgroup = MagicMock(return_value=None) params = deepcopy(EE2_JOB_PARAMS) submitscript = os.path.join(self.workdir, "workdir/tmp", "submit.sl") with open(submitscript, "w") as f: f.write("#!/bin/sh") f.write("echo hello") params["method"] = "special.slurm" params["params"] = [{"submit_script": "submit.sl"}] jr._submit_special(self.config, "1234", params) @attr("offline") @patch("JobRunner.JobRunner.KBaseAuth", autospec=True) @patch("JobRunner.JobRunner.EE2", autospec=True) def test_run_slurm(self, mock_ee2, mock_auth): self._cleanup(self.jobid) params = deepcopy(EE2_JOB_PARAMS) params["method"] = "RunTester.run_RunTester" params["params"] = [{"do_slurm": 1}] config = deepcopy(EE2_LIST_CONFIG) config["auth-service-url"] = self.config["auth-service-url"] config["auth.service.url.v2"] = self.config["auth2-url"] jr = JobRunner( self.config, self.ee2_url, self.jobid, self.token, self.admin_token ) rv = deepcopy(CATALOG_GET_MODULE_VERSION) rv["docker_img_name"] = "test/runtester:latest" jr._get_cgroup = MagicMock(return_value=None) jr.cc.catalog.get_module_version = MagicMock(return_value=rv) jr.cc.catalog.list_volume_mounts = MagicMock(return_value=[]) jr.cc.catalog.get_secure_config_params = MagicMock(return_value=None) jr.logger.ee2.add_job_logs = MagicMock(return_value=rv) jr.ee2.get_job_params.return_value = params jr.ee2.list_config.return_value = config jr.ee2.check_job_canceled.return_value = {"finished": False} jr.auth.get_user.return_value = "bogus" jr._get_token_lifetime = MagicMock(return_value=self.future) out = jr.run() self.assertNotIn("error", out) @attr("offline") @patch("JobRunner.JobRunner.KBaseAuth", autospec=True) @patch("JobRunner.JobRunner.EE2", autospec=True) def test_run_wdl(self, mock_ee2, mock_auth): self._cleanup(self.jobid) params = deepcopy(EE2_JOB_PARAMS) params["method"] = "RunTester.run_RunTester" params["params"] = [{"do_wdl": 1}] config = deepcopy(EE2_LIST_CONFIG) config["auth-service-url"] = self.config["auth-service-url"] config["auth.service.url.v2"] = self.config["auth2-url"] jr = JobRunner( self.config, self.ee2_url, self.jobid, self.token, self.admin_token ) mlog = MockLogger() jr.logger = mlog jr.sr.logger = mlog rv = deepcopy(CATALOG_GET_MODULE_VERSION) rv["docker_img_name"] = "test/runtester:latest" jr._get_cgroup = MagicMock(return_value=None) jr.cc.catalog.get_module_version = MagicMock(return_value=rv) jr.cc.catalog.list_volume_mounts = MagicMock(return_value=[]) jr.cc.catalog.get_secure_config_params = MagicMock(return_value=None) jr.ee2.get_job_params.return_value = params jr.ee2.list_config.return_value = config jr.ee2.check_job_canceled.return_value = {"finished": False} jr.auth.get_user.return_value = "bogus" jr._get_token_lifetime = MagicMock(return_value=self.future) out = jr.run() self.assertNotIn("error", out)
42.102679
88
0.648341
2,395
18,862
4.881002
0.099791
0.083747
0.087254
0.035415
0.785543
0.758939
0.74337
0.737468
0.728315
0.71497
0
0.012611
0.226434
18,862
447
89
42.196868
0.788568
0.014368
0
0.621212
0
0
0.144468
0.055942
0
0
0
0
0.058081
1
0.055556
false
0.002525
0.030303
0.002525
0.09596
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
3ca0b649873abe31fa4354019b0d8735ae552e57
79
py
Python
src/sage/modular/overconvergent/__init__.py
fchapoton/sage
765c5cb3e24dd134708eca97e4c52e0221cd94ba
[ "BSL-1.0" ]
4
2020-07-17T04:49:44.000Z
2020-07-29T06:33:51.000Z
src/sage/modular/overconvergent/__init__.py
Ivo-Maffei/sage
467fbc70a08b552b3de33d9065204ee9cbfb02c7
[ "BSL-1.0" ]
1
2020-04-18T16:30:43.000Z
2020-04-18T16:30:43.000Z
src/sage/modular/overconvergent/__init__.py
dimpase/sage
468f23815ade42a2192b0a9cd378de8fdc594dcd
[ "BSL-1.0" ]
3
2020-03-29T17:13:36.000Z
2021-05-03T18:11:28.000Z
from __future__ import absolute_import from . import all del absolute_import
13.166667
38
0.835443
11
79
5.454545
0.545455
0.466667
0
0
0
0
0
0
0
0
0
0
0.151899
79
5
39
15.8
0.895522
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
3cac55b706d77faba0d326abb94836b49a7bc7d0
1,158
py
Python
grad_conv.py
Jstar-s/Unsupervised-Single-Image-Dehaze-via-Disentangled-Representations-
50a9231deb381e78d136953b4478b7e13f9ef9e1
[ "Apache-2.0" ]
null
null
null
grad_conv.py
Jstar-s/Unsupervised-Single-Image-Dehaze-via-Disentangled-Representations-
50a9231deb381e78d136953b4478b7e13f9ef9e1
[ "Apache-2.0" ]
null
null
null
grad_conv.py
Jstar-s/Unsupervised-Single-Image-Dehaze-via-Disentangled-Representations-
50a9231deb381e78d136953b4478b7e13f9ef9e1
[ "Apache-2.0" ]
null
null
null
import torch import torch.nn as nn from torch.nn import Conv2d import numpy as np # horizontal gradient, the input_channel is default to 3 def grad_conv_hor(): grad = Conv2d(3, 3, (1, 3), stride=1, padding=(0, 1)) weight = np.zeros((3, 3, 1, 3)) for i in range(3): weight[i, i, :, :] = np.array([[-1, 1, 0]]) weight = torch.FloatTensor(weight).cuda() weight = nn.Parameter(weight, requires_grad=False) bias = np.array([0, 0, 0]) bias = torch.FloatTensor(bias).cuda() bias = nn.Parameter(bias, requires_grad=False) grad.weight = weight grad.bias = bias return grad # vertical gradient, the input_channel is default to 3 def grad_conv_vet(): grad = Conv2d(3, 3, (3, 1), stride=1, padding=(1, 0)) weight = np.zeros((3, 3, 3, 1)) for i in range(3): weight[i, i, :, :] = np.array([[-1, 1, 0]]).T weight = torch.FloatTensor(weight).cuda() weight = nn.Parameter(weight, requires_grad=False) bias = np.array([0, 0, 0]) bias = torch.FloatTensor(bias).cuda() bias = nn.Parameter(bias, requires_grad=False) grad.weight = weight grad.bias = bias return grad
28.243902
57
0.624352
181
1,158
3.939227
0.232044
0.01683
0.01683
0.064516
0.782609
0.740533
0.740533
0.740533
0.740533
0.740533
0
0.045455
0.221071
1,158
40
58
28.95
0.745011
0.092401
0
0.6
0
0
0
0
0
0
0
0
0
1
0.066667
false
0
0.133333
0
0.266667
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
a7074f43f8710dc87f73595ff9c2da974f64990f
223
py
Python
invana_bot/transformers/executors.py
subhead/invana-bot
c60883986acd1baf279ccbe74dfe06435680fba9
[ "MIT" ]
23
2019-01-31T08:04:39.000Z
2021-12-20T15:55:27.000Z
invana_bot/transformers/executors.py
subhead/invana-bot
c60883986acd1baf279ccbe74dfe06435680fba9
[ "MIT" ]
12
2019-02-13T04:59:38.000Z
2021-12-13T20:43:07.000Z
invana_bot/transformers/executors.py
subhead/invana-bot
c60883986acd1baf279ccbe74dfe06435680fba9
[ "MIT" ]
5
2019-12-21T16:23:34.000Z
2022-02-22T06:08:03.000Z
from pymongo import MongoClient class Executor: def connect(self): raise NotImplementedError def read(self): raise NotImplementedError def disconnect(self): raise NotImplementedError
17.153846
33
0.695067
21
223
7.380952
0.619048
0.174194
0.541935
0.4
0
0
0
0
0
0
0
0
0.26009
223
12
34
18.583333
0.939394
0
0
0.375
0
0
0
0
0
0
0
0
0
1
0.375
false
0
0.125
0
0.625
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
5
a71d34b5c6a59f93285c60b5df12821ada764b70
217
py
Python
observations/translation.py
mindruion/test
d27ef1caf8f76aead934bc83be7729f79a4be503
[ "MIT" ]
2
2017-04-22T11:07:13.000Z
2018-03-02T12:23:24.000Z
observations/translation.py
mindruion/test
d27ef1caf8f76aead934bc83be7729f79a4be503
[ "MIT" ]
124
2020-04-30T07:06:58.000Z
2022-03-28T12:50:16.000Z
observations/translation.py
mindruion/test
d27ef1caf8f76aead934bc83be7729f79a4be503
[ "MIT" ]
1
2021-08-04T11:44:21.000Z
2021-08-04T11:44:21.000Z
from modeltranslation.translator import register, TranslationOptions from .models import Registration @register(Registration) class RegistrationTranslationOptions(TranslationOptions): fields = ('description',)
24.111111
68
0.829493
17
217
10.588235
0.705882
0
0
0
0
0
0
0
0
0
0
0
0.101382
217
8
69
27.125
0.923077
0
0
0
0
0
0.050691
0
0
0
0
0
0
1
0
false
0
0.4
0
0.8
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
59532007da4a80a9dd3aa805db29555af7c1c93d
41
py
Python
tests/__init__.py
thatboytads/initial_api
69f9fec73a0f2d63ea2f26cf37442965ca5e4961
[ "MIT" ]
null
null
null
tests/__init__.py
thatboytads/initial_api
69f9fec73a0f2d63ea2f26cf37442965ca5e4961
[ "MIT" ]
null
null
null
tests/__init__.py
thatboytads/initial_api
69f9fec73a0f2d63ea2f26cf37442965ca5e4961
[ "MIT" ]
null
null
null
"""Unit test package for initial_api."""
20.5
40
0.707317
6
41
4.666667
1
0
0
0
0
0
0
0
0
0
0
0
0.121951
41
1
41
41
0.777778
0.829268
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
595e906213c9da8ac679f054f5c35a56d6251505
34
py
Python
visitation/organisation.py
patrickmmartin/pytterns
9850b46fe9806f71ee3f8d3e63f7608c9c9bdd0c
[ "Unlicense" ]
null
null
null
visitation/organisation.py
patrickmmartin/pytterns
9850b46fe9806f71ee3f8d3e63f7608c9c9bdd0c
[ "Unlicense" ]
null
null
null
visitation/organisation.py
patrickmmartin/pytterns
9850b46fe9806f71ee3f8d3e63f7608c9c9bdd0c
[ "Unlicense" ]
null
null
null
class Organisation(object): pass
11.333333
32
0.794118
4
34
6.75
1
0
0
0
0
0
0
0
0
0
0
0
0.117647
34
2
33
17
0.9
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
1
0
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
5977eb690b48a8a0f50ee6b737e55df942640d31
76
py
Python
rhea/models/uart/__init__.py
meetps/rhea
f8a9a08fb5e14c5c4488ef68a2dff4d18222c2c0
[ "MIT" ]
1
2022-03-16T23:56:09.000Z
2022-03-16T23:56:09.000Z
rhea/models/uart/__init__.py
meetps/rhea
f8a9a08fb5e14c5c4488ef68a2dff4d18222c2c0
[ "MIT" ]
null
null
null
rhea/models/uart/__init__.py
meetps/rhea
f8a9a08fb5e14c5c4488ef68a2dff4d18222c2c0
[ "MIT" ]
null
null
null
from __future__ import absolute_import from ._uart_model import UARTModel
15.2
38
0.855263
10
76
5.8
0.7
0
0
0
0
0
0
0
0
0
0
0
0.131579
76
4
39
19
0.878788
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
597f83b9a87103657d61b459c766ea01502b87af
131
py
Python
BlenderIKernel/__main__.py
fovtran/BlenderIKernel
5c77c6b9205ecc6e5a2e906600510a82170ab7ca
[ "BSD-3-Clause" ]
null
null
null
BlenderIKernel/__main__.py
fovtran/BlenderIKernel
5c77c6b9205ecc6e5a2e906600510a82170ab7ca
[ "BSD-3-Clause" ]
null
null
null
BlenderIKernel/__main__.py
fovtran/BlenderIKernel
5c77c6b9205ecc6e5a2e906600510a82170ab7ca
[ "BSD-3-Clause" ]
null
null
null
from ipykernel.kernelapp import IPKernelApp from . import BlenderIKernel IPKernelApp.launch_instance(kernel_class=BlenderIKernel)
26.2
56
0.877863
14
131
8.071429
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.076336
131
4
57
32.75
0.933884
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
598927eace11925eb8263ad2f3f688dc1ad561cd
944
py
Python
src/django-nonrel/tests/regressiontests/comment_tests/custom_comments/__init__.py
adamjmcgrath/glancydesign
826ede7c639879d5b79ee730eb5e91422768cb02
[ "BSD-3-Clause" ]
790
2015-01-03T02:13:39.000Z
2020-05-10T19:53:57.000Z
tests/regressiontests/comment_tests/custom_comments/__init__.py
mradziej/django
5d38965743a369981c9a738a298f467f854a2919
[ "BSD-3-Clause" ]
1,361
2015-01-08T23:09:40.000Z
2020-04-14T00:03:04.000Z
tests/regressiontests/comment_tests/custom_comments/__init__.py
mradziej/django
5d38965743a369981c9a738a298f467f854a2919
[ "BSD-3-Clause" ]
155
2015-01-08T22:59:31.000Z
2020-04-08T08:01:53.000Z
from django.core import urlresolvers from regressiontests.comment_tests.custom_comments.models import CustomComment from regressiontests.comment_tests.custom_comments.forms import CustomCommentForm def get_model(): return CustomComment def get_form(): return CustomCommentForm def get_form_target(): return urlresolvers.reverse( "regressiontests.comment_tests.custom_comments.views.custom_submit_comment" ) def get_flag_url(c): return urlresolvers.reverse( "regressiontests.comment_tests.custom_comments.views.custom_flag_comment", args=(c.id,) ) def get_delete_url(c): return urlresolvers.reverse( "regressiontests.comment_tests.custom_comments.views.custom_delete_comment", args=(c.id,) ) def get_approve_url(c): return urlresolvers.reverse( "regressiontests.comment_tests.custom_comments.views.custom_approve_comment", args=(c.id,) )
28.606061
86
0.753178
109
944
6.247706
0.275229
0.193833
0.237885
0.290749
0.660793
0.660793
0.469897
0.469897
0.469897
0.469897
0
0
0.163136
944
32
87
29.5
0.862025
0
0
0.269231
0
0
0.308263
0.308263
0
0
0
0
0
1
0.230769
false
0
0.115385
0.230769
0.576923
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
1
0
0
0
1
1
0
0
5
599053d961d4ebd27f0b697c2af3e0109ef89372
124
py
Python
timetable/admin.py
kangsanChang/mjutt
e8c668d1fc23e1932d6c88d01f4263aac85c7fcb
[ "Apache-2.0" ]
null
null
null
timetable/admin.py
kangsanChang/mjutt
e8c668d1fc23e1932d6c88d01f4263aac85c7fcb
[ "Apache-2.0" ]
null
null
null
timetable/admin.py
kangsanChang/mjutt
e8c668d1fc23e1932d6c88d01f4263aac85c7fcb
[ "Apache-2.0" ]
null
null
null
from django.contrib import admin from .models import Classitem # Register your models here. admin.site.register(Classitem)
20.666667
32
0.814516
17
124
5.941176
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.120968
124
5
33
24.8
0.926606
0.209677
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
599e4e319a18ddc78ccd816a0225a63ad04fa410
42
py
Python
hello.py
smj2mm/cs3240-labdemo
06cdd289d3304f07953bc8157d3e9e8e0ce31a7a
[ "MIT" ]
null
null
null
hello.py
smj2mm/cs3240-labdemo
06cdd289d3304f07953bc8157d3e9e8e0ce31a7a
[ "MIT" ]
null
null
null
hello.py
smj2mm/cs3240-labdemo
06cdd289d3304f07953bc8157d3e9e8e0ce31a7a
[ "MIT" ]
null
null
null
from helper import * greeting("hello")
10.5
20
0.690476
5
42
5.8
1
0
0
0
0
0
0
0
0
0
0
0
0.190476
42
3
21
14
0.852941
0
0
0
0
0
0.119048
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
59b631e08ead68b6f3213d9d85404845171daa00
14,633
py
Python
rvusite/rvu/views.py
craighagan/rvumanager
b313833bd49cdb36806a4ca4a33039f3d4bcf82e
[ "Apache-2.0" ]
null
null
null
rvusite/rvu/views.py
craighagan/rvumanager
b313833bd49cdb36806a4ca4a33039f3d4bcf82e
[ "Apache-2.0" ]
null
null
null
rvusite/rvu/views.py
craighagan/rvumanager
b313833bd49cdb36806a4ca4a33039f3d4bcf82e
[ "Apache-2.0" ]
null
null
null
import logging from django.shortcuts import get_object_or_404, render, redirect from django.http import HttpResponse from django_tables2 import RequestConfig from django.contrib.auth.models import User from django.contrib.auth.decorators import login_required from django.contrib import messages from django.core.exceptions import ValidationError from django.http import HttpResponseRedirect from django.db.models import Count, Min, Sum, Avg from django.utils.timezone import get_current_timezone from django.utils.dateparse import parse_date from django.views.generic import CreateView, UpdateView, DetailView, DeleteView, FormView, ListView from django_tables2 import RequestConfig, SingleTableView, SingleTableMixin from django.contrib.messages.views import SuccessMessageMixin from braces.views import LoginRequiredMixin, RecentLoginRequiredMixin from django.conf import settings from .models import PatientVisit, BillingCode, Provider from .tables import PatientVisitTable, BillingCodesTable, ProviderTable, getSQLTable from .forms import NewPatientVisitForm from .utils import get_fiscal_year_start #database = "mysql" database = settings.DATABASES['default']['ENGINE'].split('.')[-1] MAX_SESSION_TIME = 4 * 60 * 60 # four hours @login_required(login_url='/admin/login/') def index(request): return render(request, "rvu/index.html") #return HttpResponse("Hello, world. You're at the rvu index.") @login_required(login_url='/admin/login/') def monthly_report(request): fiscal_year_start = get_fiscal_year_start() if database == "sqlite3": sql = """ select strftime("%%Y-%%m", rvu_patientvisit.visit_date) as visit_date, auth_user.email as provider, sum(rvu_billingcode.nr_rvus) as total_rvus, sum(rvu_billingcode.nr_rvus)/(rvu_provider.annual_rvu_goal/12)*100 as pct_rvu_goal from rvu_patientvisit, auth_user, rvu_billingcode, rvu_provider where rvu_patientvisit.provider_id = rvu_provider.id and rvu_patientvisit.code_billed_id = rvu_billingcode.id and rvu_provider.user_id = auth_user.id and auth_user.id = :user_id and visit_date >= DATETIME(:fy_start) group by strftime("%%Y-%%m", rvu_patientvisit.visit_date), auth_user.email order by rvu_patientvisit.visit_date desc """ elif database == "mysql": fiscal_year_start = fiscal_year_start.strftime("%Y-%m-%d") sql = """ select DATE_FORMAT(rvu_patientvisit.visit_date, "%%Y-%%m") as visit_date, auth_user.email as provider, sum(rvu_billingcode.nr_rvus) as total_rvus, sum(rvu_billingcode.nr_rvus)/(rvu_provider.annual_rvu_goal/12)*100 as pct_rvu_goal from rvu_patientvisit, auth_user, rvu_billingcode, rvu_provider where rvu_patientvisit.provider_id = rvu_provider.id and rvu_patientvisit.code_billed_id = rvu_billingcode.id and rvu_provider.user_id = auth_user.id and auth_user.id = %(user_id)s and visit_date >= %(fy_start)s group by DATE_FORMAT(rvu_patientvisit.visit_date, "%%Y-%%m"), auth_user.email order by rvu_patientvisit.visit_date desc """ user = request.user provider_email = request.GET.get('provider_email', '') if provider_email: user = get_object_or_404(User, email=provider_email) table = getSQLTable(sql, bind_variables={"user_id": user.id, "fy_start": fiscal_year_start}, column_definitions=["provider", "visit_date", "total_rvus", "pct_rvu_goal"]) RequestConfig(request).configure(table) return render(request, "rvu/render_table.html", {"table": table}) @login_required(login_url='/admin/login/') def weekly_report(request): fiscal_year_start = get_fiscal_year_start() if database == "sqlite3": sql = """ select strftime("%%Y Wk:%%W", rvu_patientvisit.visit_date) as visit_date, auth_user.email as provider, sum(rvu_billingcode.nr_rvus) as total_rvus, sum(rvu_billingcode.nr_rvus)/(rvu_provider.annual_rvu_goal/52)*100 as pct_rvu_goal from rvu_patientvisit, auth_user, rvu_billingcode, rvu_provider where rvu_patientvisit.provider_id = rvu_provider.id and rvu_patientvisit.code_billed_id = rvu_billingcode.id and rvu_provider.user_id = auth_user.id and auth_user.id = :user_id and visit_date >= DATETIME(:fy_start) group by strftime("%%Y Wk:%%W", rvu_patientvisit.visit_date), auth_user.email order by rvu_patientvisit.visit_date desc """ elif database == "mysql": fiscal_year_start = fiscal_year_start.strftime("%Y-%m-%d") sql = """ select DATE_FORMAT(rvu_patientvisit.visit_date, "%%Y Wk:%%U") as visit_date, auth_user.email as provider, sum(rvu_billingcode.nr_rvus) as total_rvus, sum(rvu_billingcode.nr_rvus)/(rvu_provider.annual_rvu_goal/52)*100 as pct_rvu_goal from rvu_patientvisit, auth_user, rvu_billingcode, rvu_provider where rvu_patientvisit.provider_id = rvu_provider.id and rvu_patientvisit.code_billed_id = rvu_billingcode.id and rvu_provider.user_id = auth_user.id and auth_user.id = %(user_id)s and visit_date >= %(fy_start)s group by DATE_FORMAT(rvu_patientvisit.visit_date, "%%Y Wk:%%U"), auth_user.email order by rvu_patientvisit.visit_date desc """ user = request.user provider_email = request.GET.get('provider_email', '') if provider_email: user = get_object_or_404(User, email=provider_email) table = getSQLTable(sql, bind_variables={"user_id": user.id, "fy_start": fiscal_year_start}, column_definitions=["provider", "visit_date", "total_rvus", "pct_rvu_goal"]) RequestConfig(request).configure(table) return render(request, "rvu/render_table.html", {"table": table}) @login_required(login_url='/admin/login/') def daily_report(request): fiscal_year_start = get_fiscal_year_start() if database == "sqlite3": sql = """ select date(rvu_patientvisit.visit_date) as visit_date, auth_user.email as provider, sum(rvu_billingcode.nr_rvus) as total_rvus, sum(rvu_billingcode.nr_rvus)/(rvu_provider.annual_rvu_goal/314)*100 as pct_rvu_goal from rvu_patientvisit, auth_user, rvu_billingcode, rvu_provider where rvu_patientvisit.provider_id = rvu_provider.id and rvu_patientvisit.code_billed_id = rvu_billingcode.id and rvu_provider.user_id = auth_user.id and auth_user.id = :user_id and visit_date >= DATETIME(:fy_start) group by date(rvu_patientvisit.visit_date), auth_user.email order by rvu_patientvisit.visit_date desc """ elif database == "mysql": fiscal_year_start = fiscal_year_start.strftime("%Y-%m-%d") sql = """ select DATE_FORMAT(rvu_patientvisit.visit_date, "%%Y-%%m-%%d") as visit_date, auth_user.email as provider, sum(rvu_billingcode.nr_rvus) as total_rvus, sum(rvu_billingcode.nr_rvus)/(rvu_provider.annual_rvu_goal/314.0)*100 as pct_rvu_goal from rvu_patientvisit, auth_user, rvu_billingcode, rvu_provider where rvu_patientvisit.provider_id = rvu_provider.id and rvu_patientvisit.code_billed_id = rvu_billingcode.id and rvu_provider.user_id = auth_user.id and auth_user.id = %(user_id)s and visit_date >= %(fy_start)s group by DATE_FORMAT(rvu_patientvisit.visit_date, "%%Y-%%m-%%d"), auth_user.email order by rvu_patientvisit.visit_date desc """ user = request.user provider_email = request.GET.get('provider_email', '') if provider_email: user = get_object_or_404(User, email=provider_email) table = getSQLTable(sql, bind_variables={"user_id": user.id, "fy_start": fiscal_year_start}, column_definitions=["provider", "visit_date", "total_rvus", "pct_rvu_goal"]) RequestConfig(request).configure(table) return render(request, "rvu/render_table.html", {"table": table}) class BillingCodeListView(RecentLoginRequiredMixin, SingleTableMixin, ListView): model = BillingCode table_class = BillingCodesTable login_url = '/admin/login/' template_name = "rvu/render_table.html" max_last_login_delta = MAX_SESSION_TIME def get(self, request, *args, **kwargs): provider = get_object_or_404(Provider, user=self.request.user) return super(BillingCodeListView, self).get(request, *args, **kwargs) class ProviderListView(RecentLoginRequiredMixin, SingleTableMixin, ListView): model = Provider table_class = ProviderTable login_url = '/admin/login/' template_name = "rvu/render_table.html" max_last_login_delta = MAX_SESSION_TIME def get(self, request, *args, **kwargs): provider = get_object_or_404(Provider, user=self.request.user) return super(ProviderListView, self).get(request, *args, **kwargs) class CreatePatientVisitView(RecentLoginRequiredMixin, SuccessMessageMixin, CreateView): model = PatientVisit form_class = NewPatientVisitForm login_url = '/admin/login/' success_url = "/rvu" success_message = "Patient visit saved" max_last_login_delta = MAX_SESSION_TIME def form_valid(self, form): form.instance.provider = get_object_or_404(Provider, user=self.request.user) return super(CreatePatientVisitView, self).form_valid(form) def get(self, request, *args, **kwargs): provider = get_object_or_404(Provider, user=self.request.user) return super(CreatePatientVisitView, self).get(request, *args, **kwargs) class PatientVisitDeleteView(RecentLoginRequiredMixin, SuccessMessageMixin, DeleteView): model = PatientVisit form_class = NewPatientVisitForm login_url = '/admin/login/' success_url = "/rvu" success_message = "Patient visit deleted" max_last_login_delta = MAX_SESSION_TIME def form_valid(self, form): form.instance.provider = get_object_or_404(Provider, user=self.request.user) return super(PatientVisitDeleteView, self).form_valid(form) def get(self, request, *args, **kwargs): provider = get_object_or_404(Provider, user=self.request.user) return super(PatientVisitDeleteView, self).get(request, *args, **kwargs) def post(self, request, *args, **kwargs): if "cancel" in request.POST: self.success_message = "cancelled delete" return HttpResponseRedirect(self.success_url) return super(PatientVisitDeleteView, self).post(request, *args, **kwargs) class PatientVisitListView(RecentLoginRequiredMixin, SingleTableMixin, ListView): model = PatientVisit table_class = PatientVisitTable login_url = '/admin/login/' template_name = "rvu/render_table.html" max_last_login_delta = MAX_SESSION_TIME def get(self, request, *args, **kwargs): provider = get_object_or_404(Provider, user=self.request.user) self.order = self.request.GET.get('orderby', '-visit_date') return super(PatientVisitListView, self).get(request, *args, **kwargs) def get_queryset(self): fiscal_year_start = get_fiscal_year_start() visit_date = self.kwargs.get("visit_date", None) logging.warn("visit_date = %s", visit_date) provider = get_object_or_404(Provider, user=self.request.user) if not visit_date: return PatientVisit.objects.filter(provider=provider).order_by(self.order) else: parsed_visit_date = parse_date(visit_date) return PatientVisit.objects.filter(visit_date__year=parsed_visit_date.year, visit_date__month=parsed_visit_date.month, visit_date__day=parsed_visit_date.day, provider=provider).order_by(self.order) class PatientVisitListThisFiscalYearView(PatientVisitListView): def get_queryset(self): fiscal_year_start = get_fiscal_year_start() visit_date = self.kwargs.get("visit_date", None) logging.warn("visit_date = %s", visit_date) provider = get_object_or_404(Provider, user=self.request.user) if not visit_date: return PatientVisit.objects.filter(provider=provider, visit_date__gte=fiscal_year_start).order_by(self.order) else: parsed_visit_date = parse_date(visit_date) return PatientVisit.objects.filter(visit_date__year=parsed_visit_date.year, visit_date__month=parsed_visit_date.month, visit_date__day=parsed_visit_date.day, provider=provider).order_by(self.order) class PatientVisitDetailView(PatientVisitListView): def get_queryset(self): return [get_object_or_404(PatientVisit, pk=self.kwargs['pk'])] class oldPatientVisitDetailView(RecentLoginRequiredMixin, SingleTableMixin, DetailView): model = PatientVisit table_class = PatientVisitTable login_url = '/admin/login/' max_last_login_delta = MAX_SESSION_TIME def get_context_data(self, **kwargs): context = kwargs context_object_name = self.get_context_object_name(self.object) if context_object_name: context[context_object_name] = [self.object] return context def get(self, request, *args, **kwargs): provider = get_object_or_404(Provider, user=self.request.user) return super(PatientVisitDetailView, self).get(request, *args, **kwargs) class PatientVisitUpdateView(RecentLoginRequiredMixin, SuccessMessageMixin, UpdateView): model = PatientVisit form_class = NewPatientVisitForm login_url = '/admin/login/' success_url = "/rvu" success_message = "Patient visit updated" max_last_login_delta = MAX_SESSION_TIME def form_valid(self, form): if form.instance.provider != get_object_or_404(Provider, user=self.request.user): raise ValidationError(_("only change visits belonging to you")) return super(PatientVisitUpdateView, self).form_valid(form) def get(self, request, *args, **kwargs): provider = get_object_or_404(Provider, user=self.request.user) return super(PatientVisitUpdateView, self).get(request, *args, **kwargs)
45.024615
113
0.696508
1,813
14,633
5.332046
0.109211
0.056791
0.032585
0.044688
0.760112
0.737768
0.72132
0.714079
0.713458
0.697838
0
0.00819
0.207271
14,633
324
114
45.16358
0.825172
0.00615
0
0.689286
0
0.010714
0.358302
0.112189
0
0
0
0
0
1
0.067857
false
0
0.075
0.007143
0.385714
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
59bd641834d942b1b6e07ca9060ab51e31b1f8bb
31
py
Python
crash.py
theubermanishere/PythonProjects
89f44ca47478afdaeb671eb2d5f609dbca33c130
[ "MIT" ]
null
null
null
crash.py
theubermanishere/PythonProjects
89f44ca47478afdaeb671eb2d5f609dbca33c130
[ "MIT" ]
null
null
null
crash.py
theubermanishere/PythonProjects
89f44ca47478afdaeb671eb2d5f609dbca33c130
[ "MIT" ]
null
null
null
import requests requests.getS
7.75
15
0.83871
4
31
6.5
0.75
0
0
0
0
0
0
0
0
0
0
0
0.129032
31
3
16
10.333333
0.962963
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
59dc6be9d4e81fbf037b519bbf1e3c0c75f3bcea
226
py
Python
lmt_india_covid19_risk_assessment/__init__.py
istresearch/lmt-india-covid19-risk-assessment
f1d45461975060a63500f5162dcce806ba602c59
[ "MIT" ]
null
null
null
lmt_india_covid19_risk_assessment/__init__.py
istresearch/lmt-india-covid19-risk-assessment
f1d45461975060a63500f5162dcce806ba602c59
[ "MIT" ]
null
null
null
lmt_india_covid19_risk_assessment/__init__.py
istresearch/lmt-india-covid19-risk-assessment
f1d45461975060a63500f5162dcce806ba602c59
[ "MIT" ]
null
null
null
__version__ = "1.0.0" try: from lmt_india_covid19_risk_assessment.response import LmtIndiaCovid19Response from lmt_india_covid19_risk_assessment.survey import LmtIndiaCovid19RiskAssessment except ImportError: pass
32.285714
86
0.840708
26
226
6.846154
0.692308
0.078652
0.134831
0.213483
0.370787
0.370787
0
0
0
0
0
0.055276
0.119469
226
7
87
32.285714
0.839196
0
0
0
0
0
0.022026
0
0
0
0
0
0
1
0
false
0.166667
0.5
0
0.5
0
1
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
1
1
0
0
0
0
5
59e3cfd478f3c71fee384eecab1402f38c2ad6c7
216
py
Python
mushroom_rl/environments/pybullet_envs/air_hockey/__init__.py
jdsalmonson/mushroom-rl
27557269be5415879e035ff862815d2d5d9fb795
[ "MIT" ]
344
2020-01-10T09:45:02.000Z
2022-03-30T09:48:28.000Z
mushroom_rl/environments/pybullet_envs/air_hockey/__init__.py
jdsalmonson/mushroom-rl
27557269be5415879e035ff862815d2d5d9fb795
[ "MIT" ]
44
2020-01-23T03:00:56.000Z
2022-03-25T17:14:22.000Z
mushroom_rl/environments/pybullet_envs/air_hockey/__init__.py
jdsalmonson/mushroom-rl
27557269be5415879e035ff862815d2d5d9fb795
[ "MIT" ]
93
2020-01-10T21:17:58.000Z
2022-03-31T17:58:52.000Z
from mushroom_rl.environments.pybullet_envs.air_hockey.hit import AirHockeyHit from mushroom_rl.environments.pybullet_envs.air_hockey.defend import AirHockeyDefend AirHockeyHit.register() AirHockeyDefend.register()
36
84
0.884259
26
216
7.115385
0.538462
0.12973
0.151351
0.281081
0.508108
0.508108
0.508108
0.508108
0
0
0
0
0.050926
216
5
85
43.2
0.902439
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
aba0239285e5dd084bc0346e11d3234a0f1dab9c
24
py
Python
Reset/__init__.py
howiemac/evoke4
5d7af36c9fb23d94766d54c9c63436343959d3a8
[ "BSD-3-Clause" ]
null
null
null
Reset/__init__.py
howiemac/evoke4
5d7af36c9fb23d94766d54c9c63436343959d3a8
[ "BSD-3-Clause" ]
null
null
null
Reset/__init__.py
howiemac/evoke4
5d7af36c9fb23d94766d54c9c63436343959d3a8
[ "BSD-3-Clause" ]
null
null
null
from Reset import Reset
12
23
0.833333
4
24
5
0.75
0
0
0
0
0
0
0
0
0
0
0
0.166667
24
1
24
24
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
abad4b72127f8fdafc1746d2ca650ca3ac195aae
1,798
py
Python
python_modules/dagstermill/dagstermill/context.py
atsuhiro/dagster
24116a003a12c5a582afba3d4db74b3fa8c8159c
[ "Apache-2.0" ]
null
null
null
python_modules/dagstermill/dagstermill/context.py
atsuhiro/dagster
24116a003a12c5a582afba3d4db74b3fa8c8159c
[ "Apache-2.0" ]
null
null
null
python_modules/dagstermill/dagstermill/context.py
atsuhiro/dagster
24116a003a12c5a582afba3d4db74b3fa8c8159c
[ "Apache-2.0" ]
null
null
null
from dagster import check from dagster.core.execution.context.system import SystemPipelineExecutionContext from dagster.core.execution.context.transform import AbstractComputeExecutionContext class DagstermillInNotebookExecutionContext(AbstractComputeExecutionContext): def __init__(self, pipeline_context, out_of_pipeline=False): check.inst_param(pipeline_context, 'pipeline_context', SystemPipelineExecutionContext) self._pipeline_context = pipeline_context self.out_of_pipeline = out_of_pipeline self._resource_context_stack = [] def has_tag(self, key): return self._pipeline_context.has_tag(key) def get_tag(self, key): return self._pipeline_context.get_tag(key) @property def run_id(self): return self._pipeline_context.run_id @property def environment_dict(self): return self._pipeline_context.environment_dict @property def environment_config(self): return self._pipeline_context.environment_config @property def logging_tags(self): return self._pipeline_context.logging_tags @property def pipeline_def(self): return self._pipeline_context.pipeline_def @property def resources(self): return self._pipeline_context.scoped_resources_builder.build() @property def run_config(self): return self._pipeline_context.run_config @property def log(self): return self._pipeline_context.log @property def solid_def(self): if self.out_of_pipeline: check.failed('Cannot access solid_def in dagstermill exploratory context') @property def solid(self): if self.out_of_pipeline: check.failed('Cannot access solid in dagstermill exploratory context')
29.966667
94
0.731368
205
1,798
6.102439
0.243902
0.179856
0.182254
0.19984
0.404476
0.26219
0.13749
0.081535
0.081535
0.081535
0
0
0.201335
1,798
59
95
30.474576
0.87117
0
0
0.266667
0
0
0.07119
0
0
0
0
0
0
1
0.288889
false
0
0.066667
0.222222
0.6
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
abed63c7443c66e7186d67cc57e5664ca92ee2fd
237
py
Python
Curso de Python 3 - Mundo 1 - Curso em Video/ex012.py
HebertFB/Curso-de-Python-Mundo-1-Curso-em-Video
885e3efe4227dd610a70f13b2260612249b48865
[ "MIT" ]
null
null
null
Curso de Python 3 - Mundo 1 - Curso em Video/ex012.py
HebertFB/Curso-de-Python-Mundo-1-Curso-em-Video
885e3efe4227dd610a70f13b2260612249b48865
[ "MIT" ]
null
null
null
Curso de Python 3 - Mundo 1 - Curso em Video/ex012.py
HebertFB/Curso-de-Python-Mundo-1-Curso-em-Video
885e3efe4227dd610a70f13b2260612249b48865
[ "MIT" ]
null
null
null
"""Faça um algoritmo que leia o preço de um produto e mostre seu novo preço, com 5% de desconto""" preco = float(input('Informe o preço do produto: ')) print(f'O preço do produto com 5% de desconto será de R${preco-(preco*0.05):.2f}')
39.5
98
0.700422
45
237
3.688889
0.622222
0.108434
0.072289
0.168675
0
0
0
0
0
0
0
0.030457
0.168776
237
5
99
47.4
0.812183
0.388186
0
0
0
0.5
0.719424
0.18705
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
5
f9ebf80d05b9d68cf71c88013e7dcd708c2b14d2
52
py
Python
CodeWars/8 Kyu/MakeUpperCase.py
anubhab-code/Competitive-Programming
de28cb7d44044b9e7d8bdb475da61e37c018ac35
[ "MIT" ]
null
null
null
CodeWars/8 Kyu/MakeUpperCase.py
anubhab-code/Competitive-Programming
de28cb7d44044b9e7d8bdb475da61e37c018ac35
[ "MIT" ]
null
null
null
CodeWars/8 Kyu/MakeUpperCase.py
anubhab-code/Competitive-Programming
de28cb7d44044b9e7d8bdb475da61e37c018ac35
[ "MIT" ]
null
null
null
def make_upper_case(strng): return strng.upper()
26
27
0.75
8
52
4.625
0.75
0
0
0
0
0
0
0
0
0
0
0
0.134615
52
2
28
26
0.822222
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0.5
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
f9f18d47ee13b05b3f40c36f9ffd42f723a50511
101
py
Python
lib/metric/__init__.py
khanhptnk/bandit-nmt
f2ef517be2df9cffec6927b1d6a61baead548f8f
[ "MIT" ]
149
2017-07-25T21:14:36.000Z
2022-01-04T02:56:16.000Z
lib/metric/__init__.py
khanhptnk/bandit-nmt
f2ef517be2df9cffec6927b1d6a61baead548f8f
[ "MIT" ]
5
2017-11-13T08:42:21.000Z
2018-04-02T01:50:05.000Z
lib/metric/__init__.py
khanhptnk/bandit-nmt
f2ef517be2df9cffec6927b1d6a61baead548f8f
[ "MIT" ]
32
2017-07-25T23:55:15.000Z
2021-11-04T17:08:55.000Z
from .PertFunction import PertFunction from .Loss import * from .Reward import * from .Bleu import *
20.2
38
0.772277
13
101
6
0.461538
0.25641
0
0
0
0
0
0
0
0
0
0
0.158416
101
4
39
25.25
0.917647
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
e61258b5487132c99466b3721b1af6606c6ccc90
1,181
py
Python
apis/client/transmissions.py
jgodara/pymycloud
606a2f26424e14572ea05d3b74620871f0b275d3
[ "MIT" ]
1
2019-04-24T14:53:43.000Z
2019-04-24T14:53:43.000Z
apis/client/transmissions.py
jgodara/owncloud
606a2f26424e14572ea05d3b74620871f0b275d3
[ "MIT" ]
1
2019-04-24T14:32:22.000Z
2019-04-25T02:05:07.000Z
apis/client/transmissions.py
jgodara/owncloud
606a2f26424e14572ea05d3b74620871f0b275d3
[ "MIT" ]
1
2019-04-24T06:27:51.000Z
2019-04-24T06:27:51.000Z
import owncloud_utils.strings as stru from apis.resource_base import ResourceBase from database.models import Transmissions from database.repositories import TransmissionRepository class ClientTransmissionApi(ResourceBase): def get(self): user = self.get_principal() repo = TransmissionRepository.get_instance() tran = repo.get_by_user_id(user.id) if tran: return {'success': False}, 415 tran = Transmissions() tran.user = user tran.transmission_type = Transmissions.TYPE_GET tran.transmission_key = stru.randstr() repo.create(tran) return {'transmission_key': tran.transmission_key, 'typ': 'GET'} def post(self): user = self.get_principal() repo = TransmissionRepository.get_instance() tran = repo.get_by_user_id(user.id) if tran: return {'success': False}, 415 tran = Transmissions() tran.user = user tran.transmission_type = Transmissions.TYPE_UPLOAD tran.transmission_key = stru.randstr() repo.create(tran) return {'transmission_key': tran.transmission_key, 'typ': 'POST'}
28.119048
73
0.660457
129
1,181
5.875969
0.317829
0.126649
0.100264
0.039578
0.701847
0.701847
0.701847
0.701847
0.701847
0.701847
0
0.006749
0.247248
1,181
41
74
28.804878
0.845894
0
0
0.62069
0
0
0.049958
0
0
0
0
0
0
1
0.068966
false
0
0.137931
0
0.37931
0
0
0
0
null
0
0
0
0
1
1
1
1
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
5
e618b4b61c43887269267c328ead461a0f8eb4f2
69
py
Python
gitcd/bin/kivy.py
pchr-srf/gitcd
8b4f08a8221c6fd09ba83e055c1dddabcde80b01
[ "Apache-2.0" ]
null
null
null
gitcd/bin/kivy.py
pchr-srf/gitcd
8b4f08a8221c6fd09ba83e055c1dddabcde80b01
[ "Apache-2.0" ]
1
2019-03-11T19:44:33.000Z
2019-03-11T19:44:33.000Z
gitcd/bin/kivy.py
pchr-srf/gitcd
8b4f08a8221c6fd09ba83e055c1dddabcde80b01
[ "Apache-2.0" ]
null
null
null
from gitcd.interface.kivy import Kivy def main(): Kivy().run()
11.5
37
0.666667
10
69
4.6
0.8
0
0
0
0
0
0
0
0
0
0
0
0.188406
69
5
38
13.8
0.821429
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
true
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
1
0
0
0
0
5
e618e22bae957afdb5dbbfbc65b36afe5a6ba80d
152
py
Python
vit/formatter/modified_julian.py
kinifwyne/vit
e2cbafce922b1e09c4a66e7dc9592c51fe628e9d
[ "MIT" ]
179
2020-07-28T08:21:51.000Z
2022-03-30T21:39:37.000Z
vit/formatter/modified_julian.py
kinifwyne/vit
e2cbafce922b1e09c4a66e7dc9592c51fe628e9d
[ "MIT" ]
255
2017-02-01T11:49:12.000Z
2020-07-26T22:31:25.000Z
vit/formatter/modified_julian.py
kinifwyne/vit
e2cbafce922b1e09c4a66e7dc9592c51fe628e9d
[ "MIT" ]
26
2017-01-17T20:31:13.000Z
2020-06-17T13:09:01.000Z
from vit.formatter.modified import Modified class ModifiedJulian(Modified): def format(self, modified, task): return self.julian(modified)
25.333333
43
0.75
18
152
6.333333
0.722222
0
0
0
0
0
0
0
0
0
0
0
0.164474
152
5
44
30.4
0.897638
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
e6286e215336ff586a13c4151efb06e1fbd0bd78
151
py
Python
tellurium/__init__.py
stanleygu/tellurium
bfa6898eb4b632b31c4d12c0b0c78ce704a1d898
[ "Apache-2.0" ]
null
null
null
tellurium/__init__.py
stanleygu/tellurium
bfa6898eb4b632b31c4d12c0b0c78ce704a1d898
[ "Apache-2.0" ]
null
null
null
tellurium/__init__.py
stanleygu/tellurium
bfa6898eb4b632b31c4d12c0b0c78ce704a1d898
[ "Apache-2.0" ]
null
null
null
from tellurium import * import ParameterScan import Export import analysis import notebooktools import optimization import visualization import widgets
18.875
23
0.880795
17
151
7.823529
0.588235
0
0
0
0
0
0
0
0
0
0
0
0.112583
151
8
24
18.875
0.992537
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
e645e3a27091d140e0fea725b3ec7eb665765eb9
182
py
Python
Storylines/storyline_runs/run_nyr_suite.py
Komanawa-Solutions-Ltd/SLMACC-2020-CSRA
914b6912c5f5b522107aa9406fb3d823e61c2ebe
[ "Apache-2.0" ]
null
null
null
Storylines/storyline_runs/run_nyr_suite.py
Komanawa-Solutions-Ltd/SLMACC-2020-CSRA
914b6912c5f5b522107aa9406fb3d823e61c2ebe
[ "Apache-2.0" ]
null
null
null
Storylines/storyline_runs/run_nyr_suite.py
Komanawa-Solutions-Ltd/SLMACC-2020-CSRA
914b6912c5f5b522107aa9406fb3d823e61c2ebe
[ "Apache-2.0" ]
null
null
null
""" Author: Matt Hanson Created: 14/04/2021 2:44 PM """ from Storylines.storyline_runs.run_random_suite import create_nyr_suite if __name__ == '__main__': create_nyr_suite(3)
22.75
71
0.752747
28
182
4.357143
0.857143
0.147541
0.229508
0
0
0
0
0
0
0
0
0.076433
0.137363
182
8
72
22.75
0.700637
0.258242
0
0
0
0
0.064
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
0515d8cb8ab9fbf6dee679d22a04e24a780b677b
29,106
py
Python
src/ui/GuideTabUI.py
BeTeK/EliteDB
a6ff655f6f78b227bebaaf48d7aa7c8742871011
[ "BSD-3-Clause" ]
7
2015-06-04T19:46:50.000Z
2015-07-13T14:15:27.000Z
src/ui/GuideTabUI.py
BeTeK/EliteDB
a6ff655f6f78b227bebaaf48d7aa7c8742871011
[ "BSD-3-Clause" ]
3
2015-06-05T13:08:59.000Z
2015-07-16T21:39:00.000Z
src/ui/GuideTabUI.py
BeTeK/EliteDB
a6ff655f6f78b227bebaaf48d7aa7c8742871011
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'src\ui\GuideTab.ui' # # Created by: PyQt5 UI code generator 5.4.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(983, 989) self.gridLayout_3 = QtWidgets.QGridLayout(Dialog) self.gridLayout_3.setObjectName("gridLayout_3") self.textBrowser = QtWidgets.QTextBrowser(Dialog) self.textBrowser.setOpenExternalLinks(True) self.textBrowser.setObjectName("textBrowser") self.gridLayout_3.addWidget(self.textBrowser, 0, 0, 1, 1) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog) def retranslateUi(self, Dialog): _translate = QtCore.QCoreApplication.translate Dialog.setWindowTitle(_translate("Dialog", "Dialog")) self.textBrowser.setHtml(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\"-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"> <img src=\"data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAAYFBMVEVNVESjh1rbuXcaKS01QzyId1P//q7//7ObgVevr3t+cFCvkF7nwXsRICXw7KEIFyBrZkshMjMlNjWWmpNgYU2DgXDPyJjw8fBsdl5BS0BYWkc6Rz4gMTJzfWAsPDl3bE5oDgZOAAAG8UlEQVR4XsTOWRXAMAwDweUgH0lP/iz7/FMKGgSD0kbV3eQbLvcMyDgwiaWaANuFUFkDmyVnYOANnM/1Bz5izG7XbRAIwj5ZLFXEyAa5FzEr5/3fsuEfB3PKctx07qP5AjujNZp9UDoAKAgAelcSPyW562F4A2AKxOcErASQYv6/AGjAPiWpt20oAQDfBJmunYHHNpwBSJVLvuR/YKQuFDsHQLVnihS4P6z7fp3YcHoFuLOgjAHV/Yn+d1dJnwNIpp0Sg1JS3adFBnd9jR5NJ2AvAPE+TQsqdekJVAGckjkAfE23aQW0Q/ivZwCyALgQCuP/AhAAiNclYa+kAFzeYgMIIYz/bdpmWhfIv0jVeuDQP8L5OwAhKpXUh9IAEPw9AK2nMakHALLz7wOAZE8DkLb5HILzTwAE72BNrmJQtvskhvxlAKT7D+b0KjayIYz+Xw6AaB/daVWMO/MEgN6fjyEFpClAVMGdVMWhAgGC/2YBvjjnI03MHgGxikG6Ckz+6zraGNCl7XJBrWLfv8l/MQBdYra726tYp51QiOT/Apj6AHbhMlOv4hJgFoX/TwBibFqKSGsGDiD3N3qOVPH7dATAJoDdAeT+ZK1W2xuAlASAOH+j+fNEBYwIYMzbqlhrZgGSv3fnVkQKC8AA0LjXY1gAzPPBn9OUSAMAyvoeqSsA0d/ZU6fPKABoVMq5V6u4BMjPnw7ADwAM5DdlfA4Q8ufGj/focAVoEJpnQEGWv04En4U8BepUBmAoAH45gKcvgGeXQgxTD1SruEzB+GOCQw84glPJc4DZnsEUCD4P8GOC9yakAwhPwHtn4AhQ7+ISQLsqjgTRn3MqgY9hCEHbRmQBDHPIAqcHMSCkKq5vxroCICUGgjHYk4OQqtibN23FmlkAlRG4GPCOheR2BCh1BuA/zxGPt7D0L6XfNbGuARh/yLOw8H6AmIH2tdxJiNQHazfA+1ZcxLAEOCNYn7furfjYRE2f51AQbAZgWlDtRJWPFU0A+E6wLAZgmF8SJEFJ0ACA4XUsEWRfx0AXWjXPAPgnupCF8oECKYJFgcTo3fxAsRsI1wcRwI30H1bNRtlNEArCTTGiYzGBuc0k1fj+j9lw4Gbxh59D7r7AfiGHFRd5RaEWfU87Eeb5rpjkWxIQvIpKPFhKZYzo5YvAhC1vpqDQS9ATa6xBDYAhANnj9aSBEg1J+CfQHHgAHDAzGEHZq3rZyv59KkhEMYbQmWMQicB3xcUzoP1esgAvArU6mqSjWJPQFhMBDSFvDwjSxQI4gs2bsknmAClMJAJgSykLQATvmjN7aUWEe4LPAEKCPMAhQQ2AAkBIUHxtt5qE0/WjFcAc+ClIRDFyJAQxDS+CnRzAOLpJxFZATZe7tAKI9iT8XSDHwROEx3R6OX1Er+1IGxIb7VZK5Etj5XRxAB0I9DsSpxjAXt/+868nU/f7jQDOIYFDiAHM0XDVWj0lX60FAAFSuXnQCESGEAru8F4ALV8EAILv+tYsAIjfnq9j+XInAMnV2IEAqWymY4BdnYGZdgAjW7fuiEA3L4CJDyD7c8fWlgAAUy3A5wS6ses/JWYAshR7gBNPFgEEDoDSJrULkIQWQTkAeLMFghgAohjyENptQ9l7+4GrFYEQBgCHUQx5CKMDgKFOIYGOAezk/UOAoRoABPNi3Q/+gkPREACgDuFkhUkEQGYIfRQLDOGJVGVPeeBPKA0AEtvQZ8EmByo3Ael8I//2eQwQP12oVQ7U2ZO/JP8vMVUD1BFs/NUyPeoBSB/5X4QFmEpngBh+YgXgPy+lUewwEMVn2DMV+COKi3MAUVy9C97+tgky08MR5JMQUVz3ON76XxU1qBPOA2XPAiMI4PabrWHjrzUdSnEiKnsauhVoJVvt0Fnh97vbvLJTsXfHs6BGp9X8Z0/F0SORutcCnMP9b0X9QOGpWL+z6PKUbHkA+CshcCxnAojm+sXSqwQi4+7Af+auwOwaD656Atj7W4B/hTMADMGQIhHAGMwfOooYgIk3f1gNZkMC/1VBESkqE8KSZOUpHYD3X9eV0a44paVQeJUgAPJXszePf0uGKN6LD0EEBAB/9MWpD5sjWljCCmD9sfyEEO2KkzJFQnj2cjd/S6YrLjEonUIaQu+/6boTXXFCzKqQANb5gwskLgCfwQEgf+DPAeArIKAZiPjnu+J6BSSqv+9vCkjprvhzeRTzECvXkmu7n9XWF/6sKK7X0kS+YPjfrB3jMBDCQBQdybQUaxOMIeH+x4wQRYRCkWKF8y4wv3Ll7SVkIg7tRp+9nx6bW2cOdq+5tYP6FTDgmLm/BgD1nF2A4awlwMXfBMgr+QZkKXAN0CwJ1nyEi6CapVhnFxdF6CjAk3xEegPhifUZMhxnlQAAAABJRU5ErkJggg==\" /><br /></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:28pt;\"> Elite Merchant<br /></span></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Release thread:</p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><a href=\"http://www.reddit.com/r/EliteDangerous/comments/38k4ss/elite_merchant_trade_route_calculator/\n" "\"><span style=\" font-size:8pt; text-decoration: underline; color:#0000ff;\">http://www.reddit.com/r/EliteDangerous/comments/38k4ss/elite_merchant_trade_route_calculator/</span></a></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Source:</p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><a href=\"https://github.com/BeTeK/EliteMerchant\n" "\"><span style=\" font-size:8pt; text-decoration: underline; color:#0000ff;\">https://github.com/BeTeK/EliteMerchant</span></a></p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\'Elite Merchant\' is a trade route calculator for Elite: Dangerous.</p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Developed by <span style=\" font-size:8pt;\">Paavo Happonen and Pasi Luostarinen.</span></p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:8pt;\">The prominent features of this tool, in contrast to others are: </span></p>\n" "<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;\"><li style=\" font-size:8pt;\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Black market smuggling as a type of trade route</span></li>\n" "<li style=\" font-size:8pt; font-weight:600;\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Route profitability calculation as function of distance and time. <span style=\" font-weight:400;\"><br />This means the tool takes your estimated travel time from system to system<br />into account, as well as travel time from the target star to the station.<br />This replaces traditional needs to blacklist low value items or set station distance<br />requirements. Estimated travel time is displayed and search results sorted by<br />estimated profit per hour.</span></li>\n" "<li style=\" font-size:8pt;\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">PowerPlay filters and bonuses.</span></li>\n" "<li style=\" font-size:8pt;\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Multiple searches in tabs.</span></li>\n" "<li style=\" font-size:8pt;\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Fast, high profit routes for all searches with unlimited trade hops.</span></li>\n" "<li style=\" font-size:8pt;\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Automatic station exports search. </span><br />Upon entering a station, search tabs with \'exports from current station\' are<br />automatically triggered with their current settings. This saves you from<br />alt+tabbing to the tool on a second monitor to do this basic task. This also<br />works on a secondary computer, if you share Elite\'s Log folder over the network.</li>\n" "<li style=\" font-size:8pt;\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Long distance multi-hop optimal route profit search. </span><br />Want to feel like a trucker and don\'t like dead ends or low profit routes?</li>\n" "<li style=\" font-size:8pt;\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Multi-hop optimal loop search. </span><br />Find profitable loops of arbitrary length</li>\n" "<li style=\" font-size:8pt;\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">From-To trade route search. </span><br />Want to get from point A to B and do some trading on the way?</li>\n" "<li style=\" font-size:8pt;\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Optional EDCE support to read station market data. </span><br />Upon entering a station, the EDCE client is triggered to gather the data into the<br />local database. Optional uploading to EDDN is also supported.<br />Note that EDCE is in conflict with Frontier Developments wishes on the use of<br />their mobile API. Thus this feature is entirely optional and on everyone\'s personal<br />judgement to utilize, or not.<br />As the ED log no longer gives current station, EDCE use is recommended for full<br />functionality.</li></ul>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The tool utilizes the database provided by EDDB. ( <a href=\"http://eddb.io/api\"><span style=\" font-size:8pt; text-decoration: underline; color:#0000ff;\">http://eddb.io/api</span></a> )</p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\"> OVERLY DETAILED DESCRIPTION OF UI FUNCTIONS:</span></p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600;\"><br /></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\"> Options window:</span></p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600;\"><br /></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">You can open the options screen from the top \'edit/options\' menu of the main window.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Market expire days</span><br />This sets a hard limit for when to consider market data as invalid.<br />Commodity prices on searches are colored according to this scale,<br />where <span style=\" background-color:#88ff88;\">0 days is green</span> and <span style=\" background-color:#ff8888;\">red is this many days old</span>.<br />No trades older than this are accepted for trade routes.<br />This value is ignored for current system export, target system imports and direct<br />system to system sales.<br />If values from these searches exceed the age set here, the price is colored<br /><span style=\" color:#ffff00; background-color:#ff0000;\">bright red with yellow text</span> to denote that it is heavily outdated.<br /><span style=\" font-weight:600;\">Always </span>check the age of data colored like this.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-size:8pt; font-weight:600;\">Elite product path</span><span style=\" font-size:8pt;\"><br />Find your ED installation product path.<br />This is used to find the Elite travel log and to detect current location.<br /></span>The tool does function without access to ED, but connecting to it is recommended.<br />Click &quot;...&quot; to browse for your ED installation path.<br />This refers to the PRODUCT path and not the LAUNCHER path.<br />This would look something like:<br /> <span style=\" font-weight:600;\">[elite install path]/Products/FORC-FDEV-D-10xx/</span> ( where <span style=\" font-weight:600;\">xx</span> varies )</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">EDCE path, Elite username, Elite password<br /></span>These fields are ONLY used to interface with EDCE and are not required for other use.<br />Once you enter your details, press \'Test EDCE connection\' and confirm your account.</p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\"> Main Window:</span></p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The bottom of the window has the log which shows progress of search and other actions.</p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">At the top left you see your current location, as captured from your ED Log and EDCE.</p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Your global ship settings:</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Jump range</span><br />This is REQUIRED, and will directly influence profit per hour calculation and<br />thus route profitability</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Pad size</span><br />Optional, but frankly you should set this to match<br />Coming to a station with pads too small for your ship is embarrassing<br />Also speeds up searches quite a bit</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Cargo space</span><br />This setting is entirely optional and does not influence calculation in any way<br />It is purely for convenience of showing final profits of a trip (in tooltip on<br /> profit column)</p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\"> The SEARCH tab:</span></p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600;\"><br /></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">This tool has 6 distinct types of trade route searches:</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Exports from current station</span><br />This attempts to find an outgoing trade route from the current station.<br />This is triggered by automatic searches as your location updates.<br />If you write a different system to the &quot;starting system&quot; field, exports from<br />this system are shown instead.<br />If you are getting 0 results, try reducing min/max hops to 1 and lowering <br />minimum profit. But it is also possible you are at a dead-end.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Exports from current system</span><br />Same as current station, but shows all stations in the system.<br />This is triggered by automatic searches as your location updates.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Loop route</span><br />This finds trade routes which end up in the starting station.<br />The loops are ordered by profit/h.<br />For more variety, add a few minimum hops.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Long route</span><br />This finds connecting trade routes and arranges them by profit/h.<br />Setting minimum hops to a bigger value gives you a grand tour of the galaxy<br />with no repeated stations.<br />The end of the route may be a deadend or a route the optimization algorithm<br />deems unprofitable. Using \'Exports from current system\' is a recommended<br />action after finishing a long route.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Single trades</span><br />This is the traditional min-max single one direction trade search available<br />everywhere. For the sake of nostalgia.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Long route on way to target</span><br />With this you can pick a target system and calculate a high profit series of<br />trade hops between the starting system and your target.<br />It is essentially \'long route\' search, with the additional criteria that<br />each hop must be closer to your target.<br />Note that a profitable route to target is not guaranteed and the route may<br />end somewhere near the target. Also the route is not direct and might wander<br />quite a bit on the way, spiraling down toward your target as dictated by<br />profit/h.<br />The result is sorted first by profit and then by lowest number of hops, so<br />scroll down a bit for variety.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Direct current to target trades</span><br />Find all trades between these two locations without trades in between</p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\"> The SEARCH input fields:</span></p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Starting system / station</span><br />This can be written manually or applied automagically from ED log, if<br />configured. The \'get current\' button on the right side of this area does this.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Target system / station</span><br />Only used for &quot;route on way to target&quot; and &quot;direct trade&quot; searches.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Min profit</span><br />This is a hard limit for basic single trade exchange. Its primary function<br />is to limit the number of possibilities and speed up searching. 1000 is a good<br />fast value for most trading, but might give low or no results if you\'re<br />desperate or in a short range vessel.<br />WARNING! DATA DROWNING HAZARD!<br />Lowering this will flood the tool with more trade data and the search may<br />take a long time.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Smuggling</span><br />Black market trades, or Smuggling is a fun and efficient way to make money<br />in 1.3, especially with the faction bonuses.Black market trades are marked<br />with a skull and a black background in search results.<br />NOTE! Black market prices are unreliable. Prices shown are copied from legal<br />stations in the same system, but actual price may be incorrect.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Max hops</span><br />How many trade stops do we want at most with our search.<br />This value is primarily for optimizing searches with too much data.<br />This may be necessary if you set min profit too low or max distance too high.<br />If you\'re worried about a setting, set this to 1 and give it a go. If it\'s still fast,<br />bump it to 2 and see how it goes. For most use you can confidently set this at<br />99 and no route will ever reach it, due to the route optimization algorithm<br />culling the tail as the average profit/h falls.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Min hops</span><br />Require at least this many trade stops before accepting a trade route.<br />This has some impact on search time, but not to a significant degree.<br />It\'s fun to pick \'long route\' search and set this to a high value for a grand<br />tour.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Max distance</span><br />This is the maximum distance in light years a trade route can be at.<br />This is primarily an optimization parameter, as higher than 50ly is rarely<br />more profitable due to the distance(=time) cost. For smaller vessels with<br />smaller tanks or jump ranges it\'s a good idea to lower this further for<br />performance.<br /> </p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\"> The SEARCH RESULTS table:</span></p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600;\"><br /></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">In multi-hop searches, each profitable commodity trade is shown between the two</p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">stations, to give the player options. Then an empty row, followed by the next</p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">hop. At the end of each route is a grey row with a route summary.</p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Tooltips</span> show more details, such as supply and demand, or station distance to</p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">star and estimated travel times.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">From current system column</span><br />Distance from your starting system to this system</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Commodity, Export Cr, Import Cr</span><br />Name and prices of market commodity.<br />Tooltip shows data age, buy and sell values, as well as profit and galactic<br />average.<br />Market data age is represented in the main results window with color coding.<br /><span style=\" background-color:#88ff88;\">Green</span> background is current, fading through <span style=\" background-color:#8888ff;\">blue</span> to <span style=\" background-color:#ff8888;\">red</span> as it gets older.<br />If values exceed the market expiration age set in the Options window, the<br />price is colored <span style=\" color:#ffff00; background-color:#ff0000;\">bright red with yellow text</span> to denote that it is heavily outdated.<br />Export commodities in short supply (&lt;100) are also colored like this to warn<br />of potential dead ends.<br /><span style=\" font-weight:600;\">Always </span>check the age and supply of data colored like this.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Distance</span><br />Ly from export to import system.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Minutes travel</span><br />Estimated total time on this trade hop. Includes star-to-star travel and<br />star-to-station travel time.</p>\n" "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;\"><span style=\" font-weight:600;\">Profit Cr/h</span><br />Profit value normalized by time taken by it.<br />This column is the primary evaluation for profit, and primary sort column.<br />The value is meant to be used as a route \'goodness\' measure rather than actual<br />expected profit estimate, as you never actually spend an hour on a trip.</p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\"> The COMMODITY tab:</span></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> </p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">You can search for stations that import or export certain commodities.</p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">These are sorted by the distance and value properties.</p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> </p>\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
250.913793
2,788
0.7405
4,551
29,106
4.732367
0.1637
0.071876
0.049496
0.072341
0.483261
0.467475
0.460371
0.458978
0.457352
0.455542
0
0.044318
0.094517
29,106
115
2,789
253.095652
0.77287
0.006459
0
0.145631
1
0.407767
0.473193
0.004739
0
1
0
0
0
1
0.019417
false
0.009709
0.048544
0
0.07767
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
1
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
5
0570d78433fdc5dd298b1db46a065e575acc84d4
127
py
Python
pythonLearning/use_module.py
liusong-cn/python
f67933f0879021a595258e09c4cde5ca1f9f6aed
[ "Apache-2.0" ]
1
2019-11-12T13:38:54.000Z
2019-11-12T13:38:54.000Z
pythonLearning/use_module.py
liusong-cn/python
f67933f0879021a595258e09c4cde5ca1f9f6aed
[ "Apache-2.0" ]
null
null
null
pythonLearning/use_module.py
liusong-cn/python
f67933f0879021a595258e09c4cde5ca1f9f6aed
[ "Apache-2.0" ]
null
null
null
import sys sys.stdout.write('hello world\n') sys.stdout.write(sys.version) #引用模块并使用aliase import random as r print(r.random)
14.111111
33
0.771654
21
127
4.666667
0.619048
0.183673
0.285714
0
0
0
0
0
0
0
0
0
0.102362
127
8
34
15.875
0.859649
0.102362
0
0
0
0
0.115044
0
0
0
0
0
0
1
0
true
0
0.4
0
0.4
0.2
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
0575df3d22869a52f78bf13b36708ba9facce79a
255
py
Python
fastapi_skeleton/ml/__init__.py
pphszx/fastapi-ml-skeleton
f92ce62a64227e71955eeb5caa836bd39f6c5ee3
[ "Apache-2.0" ]
null
null
null
fastapi_skeleton/ml/__init__.py
pphszx/fastapi-ml-skeleton
f92ce62a64227e71955eeb5caa836bd39f6c5ee3
[ "Apache-2.0" ]
null
null
null
fastapi_skeleton/ml/__init__.py
pphszx/fastapi-ml-skeleton
f92ce62a64227e71955eeb5caa836bd39f6c5ee3
[ "Apache-2.0" ]
null
null
null
from fastapi_skeleton.ml.houseprice import HousePriceModel from fastapi_skeleton.ml.iris import IrisModel from fastapi_skeleton.ml.haier import HaierModel dct_model = { "houseprice": HousePriceModel, "iris": IrisModel, "haier": HaierModel, }
25.5
58
0.780392
29
255
6.724138
0.448276
0.169231
0.292308
0.323077
0
0
0
0
0
0
0
0
0.137255
255
9
59
28.333333
0.886364
0
0
0
0
0
0.07451
0
0
0
0
0
0
1
0
false
0
0.375
0
0.375
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
059477097765439281877fcadc8e2f84f9f0ec7e
141
py
Python
testing/slides/examples/test_marks.py
ramosmaria/school2021
3e162a05767bbc8fa6ce3f92c858d1bd639fee16
[ "MIT" ]
252
2021-05-18T11:58:17.000Z
2022-03-12T06:48:52.000Z
testing/slides/examples/test_marks.py
ramosmaria/school2021
3e162a05767bbc8fa6ce3f92c858d1bd639fee16
[ "MIT" ]
44
2021-05-21T14:28:34.000Z
2021-07-12T22:36:06.000Z
testing/slides/examples/test_marks.py
ramosmaria/school2021
3e162a05767bbc8fa6ce3f92c858d1bd639fee16
[ "MIT" ]
128
2021-05-24T18:32:54.000Z
2022-03-26T11:24:16.000Z
import pytest import time @pytest.mark.slow def test_slow(): time.sleep(2) assert 1 + 1 == 2 def test_fast(): assert 1 + 1== 2
12.818182
21
0.624113
24
141
3.583333
0.5
0.162791
0.186047
0.209302
0
0
0
0
0
0
0
0.066038
0.248227
141
10
22
14.1
0.745283
0
0
0.25
0
0
0
0
0
0
0
0
0.25
1
0.25
true
0
0.25
0
0.5
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
0
0
0
0
5
059721ac1e608fbd318e3aed42bf850983479054
44
py
Python
inferno/extensions/initializers/__init__.py
0h-n0/inferno
f466c84ed72ff92f9113891a96ce58e19eeeff1e
[ "Apache-2.0" ]
204
2017-10-10T20:58:52.000Z
2021-12-07T03:01:19.000Z
inferno/extensions/initializers/__init__.py
0h-n0/inferno
f466c84ed72ff92f9113891a96ce58e19eeeff1e
[ "Apache-2.0" ]
86
2017-10-11T11:32:36.000Z
2021-11-15T17:47:25.000Z
inferno/extensions/initializers/__init__.py
0h-n0/inferno
f466c84ed72ff92f9113891a96ce58e19eeeff1e
[ "Apache-2.0" ]
30
2017-11-16T23:21:30.000Z
2021-11-15T15:11:00.000Z
from .base import * from .presets import *
11
22
0.704545
6
44
5.166667
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.204545
44
3
23
14.666667
0.885714
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
55392c45ccf5161678aa27b028830ef529130bc3
44
py
Python
services/__init__.py
iomegak12/pythonpractices-1
eff9b9f926c2ddd0e9d71331bdcba42b3b5367bc
[ "bzip2-1.0.6" ]
1
2019-09-25T08:10:52.000Z
2019-09-25T08:10:52.000Z
services/__init__.py
iomegak12/pythonpractices-1
eff9b9f926c2ddd0e9d71331bdcba42b3b5367bc
[ "bzip2-1.0.6" ]
null
null
null
services/__init__.py
iomegak12/pythonpractices-1
eff9b9f926c2ddd0e9d71331bdcba42b3b5367bc
[ "bzip2-1.0.6" ]
null
null
null
from .customerservice import CustomerService
44
44
0.909091
4
44
10
0.75
0
0
0
0
0
0
0
0
0
0
0
0.068182
44
1
44
44
0.97561
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
556849fec22cb0e797264cdca1fa3abe1d0ed518
86
py
Python
enthought/enable/text_field.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
3
2016-12-09T06:05:18.000Z
2018-03-01T13:00:29.000Z
enthought/enable/text_field.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
1
2020-12-02T00:51:32.000Z
2020-12-02T08:48:55.000Z
enthought/enable/text_field.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
null
null
null
# proxy module from __future__ import absolute_import from enable.text_field import *
21.5
38
0.837209
12
86
5.5
0.75
0
0
0
0
0
0
0
0
0
0
0
0.127907
86
3
39
28.666667
0.88
0.139535
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
55923860d0903c3ab22b789795eac9e89e6775f5
154
py
Python
tests/conftest.py
volodymyrss/oda-experiments
6cbbb5fd2b95b456cc3dea0d90df1b0de0b08ecd
[ "CC0-1.0" ]
null
null
null
tests/conftest.py
volodymyrss/oda-experiments
6cbbb5fd2b95b456cc3dea0d90df1b0de0b08ecd
[ "CC0-1.0" ]
1
2021-08-16T15:53:07.000Z
2021-08-16T15:53:07.000Z
tests/conftest.py
volodymyrss/oda-experiments
6cbbb5fd2b95b456cc3dea0d90df1b0de0b08ecd
[ "CC0-1.0" ]
null
null
null
import pytest import odatestsapp @pytest.fixture def app(): app = odatestsapp.app #create_app() #app = odatestsapp.create_app() return app
15.4
39
0.701299
19
154
5.578947
0.421053
0.113208
0.320755
0
0
0
0
0
0
0
0
0
0.201299
154
9
40
17.111111
0.861789
0.272727
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.666667
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
55b3d28c5d938933351cedf9f3fc80975807fe45
9,895
py
Python
tests/api/crud/test_trigger_instance.py
bossjones/ultron8
45db73d32542a844570d44bc83defa935e15803f
[ "Apache-2.0", "MIT" ]
null
null
null
tests/api/crud/test_trigger_instance.py
bossjones/ultron8
45db73d32542a844570d44bc83defa935e15803f
[ "Apache-2.0", "MIT" ]
43
2019-06-01T23:08:32.000Z
2022-02-07T22:24:53.000Z
tests/api/crud/test_trigger_instance.py
bossjones/ultron8
45db73d32542a844570d44bc83defa935e15803f
[ "Apache-2.0", "MIT" ]
null
null
null
from fastapi.encoders import jsonable_encoder from freezegun import freeze_time import pytest from sqlalchemy.orm import Session from ultron8.api import crud from ultron8.api.db_models.trigger import TriggerInstanceDB from ultron8.api.models.packs import PacksCreate from ultron8.api.models.trigger import ( TriggerBaseDB, TriggerBaseInDB, TriggerCreate, TriggerInstanceBaseDB, TriggerInstanceBaseInDB, TriggerInstanceCreate, TriggerInstanceUpdate, TriggerTagsBase, TriggerTagsBaseInDB, TriggerTagsCreate, TriggerTagsUpdate, TriggerTypeBase, TriggerTypeBaseInDB, TriggerTypeCreate, TriggerTypeUpdate, TriggerUpdate, ) from tests.utils.packs import create_random_packs from tests.utils.trigger import create_random_trigger from tests.utils.trigger_instance import create_random_trigger_instance_name from tests.utils.trigger_type import create_random_trigger_type from tests.utils.utils import random_lower_string @freeze_time("2019-07-25 01:11:00.740428") @pytest.mark.triggerinstanceonly @pytest.mark.unittest def test_create_trigger_instance(db: Session) -> None: # Step 1 - create pack packs = create_random_packs(db) # Step 2 - create trigger_type trigger_type = create_random_trigger_type(db, packs=packs) # Step 3 - create trigger trigger = create_random_trigger(db, packs=packs, trigger_type=trigger_type) # Step 4 - trigger_instance arguments trigger_instance_payload = {"foo": "bar", "name": "Joe"} trigger_instance_trigger = "{pack_name}.{trigger_name}".format( pack_name=packs.name, trigger_name=trigger.name ) trigger_instance_status = "processed" # Step 5 - create trigger_instance trigger_instance_in = TriggerInstanceCreate( trigger=trigger_instance_trigger, payload=trigger_instance_payload, status=trigger_instance_status, ) trigger_instance = crud.trigger_instance.create( db, trigger_instance_in=trigger_instance_in ) # Step 6 - validate trigger_instance values in DB assert trigger_instance.trigger == trigger_instance_trigger assert trigger_instance.payload == trigger_instance_payload assert trigger_instance.occurrence_time == "2019-07-25 01:11:00.740428" assert trigger_instance.status == trigger_instance_status @freeze_time("2019-07-25 01:11:00.740428") @pytest.mark.triggerinstanceonly @pytest.mark.unittest def test_get_trigger_instance(db: Session) -> None: # Step 1 - create pack packs = create_random_packs(db) # Step 2 - create trigger_type trigger_type = create_random_trigger_type(db, packs=packs) # Step 3 - create trigger trigger = create_random_trigger(db, packs=packs, trigger_type=trigger_type) # Step 4 - trigger_instance arguments trigger_instance_payload = {"foo": "bar", "name": "Joe"} trigger_instance_trigger = "{pack_name}.{trigger_name}".format( pack_name=packs.name, trigger_name=trigger.name ) trigger_instance_status = "processed" # Step 5 - create trigger_instance trigger_instance_in = TriggerInstanceCreate( trigger=trigger_instance_trigger, payload=trigger_instance_payload, status=trigger_instance_status, ) trigger_instance = crud.trigger_instance.create( db, trigger_instance_in=trigger_instance_in ) trigger_instance_2 = crud.trigger_instance.get( db, trigger_instance_id=trigger_instance.id ) assert jsonable_encoder(trigger_instance) == jsonable_encoder(trigger_instance_2) @freeze_time("2019-07-25 01:11:00.740428") @pytest.mark.triggerinstanceonly @pytest.mark.unittest def test_get_by_trigger_trigger_instance(db: Session) -> None: # Step 1 - create pack packs = create_random_packs(db) # Step 2 - create trigger_type trigger_type = create_random_trigger_type(db, packs=packs) # Step 3 - create trigger trigger = create_random_trigger(db, packs=packs, trigger_type=trigger_type) # Step 4 - trigger_instance arguments trigger_instance_payload = {"foo": "bar", "name": "Joe"} trigger_instance_trigger = "{pack_name}.{trigger_name}".format( pack_name=packs.name, trigger_name=trigger.name ) trigger_instance_status = "processed" # Step 5 - create trigger_instance trigger_instance_in = TriggerInstanceCreate( trigger=trigger_instance_trigger, payload=trigger_instance_payload, status=trigger_instance_status, ) trigger_instance = crud.trigger_instance.create( db, trigger_instance_in=trigger_instance_in ) trigger_instance_2 = crud.trigger_instance.get_by_trigger( db, trigger_instance_trigger=trigger_instance.trigger ) assert jsonable_encoder(trigger_instance) == jsonable_encoder(trigger_instance_2) @freeze_time("2019-07-25 01:11:00.740428") @pytest.mark.triggerinstanceonly @pytest.mark.unittest def test_get_multi_trigger_instance(db: Session) -> None: # Step 1 - create pack packs = create_random_packs(db) # Step 2 - create trigger_type trigger_type = create_random_trigger_type(db, packs=packs) # Step 3 - create trigger trigger = create_random_trigger(db, packs=packs, trigger_type=trigger_type) # Step 4 - trigger_instance arguments trigger_instance_payload0 = {"foo": "bar", "name": "Joe"} trigger_instance_trigger0 = "{pack_name}.{trigger_name}".format( pack_name=packs.name, trigger_name=trigger.name ) trigger_instance_status0 = "processed" # Step 5 - create trigger_instance trigger_instance_in0 = TriggerInstanceCreate( trigger=trigger_instance_trigger0, payload=trigger_instance_payload0, status=trigger_instance_status0, ) trigger_instance0 = crud.trigger_instance.create( db, trigger_instance_in=trigger_instance_in0 ) # -------------------------------------------- # Step 4 - trigger_instance arguments trigger_instance_payload1 = {"foo": "bar", "name": "Joe"} trigger_instance_trigger1 = "{pack_name}.{trigger_name}".format( pack_name=packs.name, trigger_name=trigger.name ) trigger_instance_status1 = "processed" # Step 5 - create trigger_instance trigger_instance_in1 = TriggerInstanceCreate( trigger=trigger_instance_trigger1, payload=trigger_instance_payload1, status=trigger_instance_status1, ) trigger_instance1 = crud.trigger_instance.create( db, trigger_instance_in=trigger_instance_in1 ) trigger_instance_2 = crud.trigger_instance.get_multi(db) for t in trigger_instance_2: assert type(t) == TriggerInstanceDB @freeze_time("2019-07-25 01:11:00.740428") @pytest.mark.triggerinstanceonly @pytest.mark.unittest def test_update_trigger_instance(db: Session) -> None: # Step 1 - create pack packs = create_random_packs(db) # Step 2 - create trigger_type trigger_type = create_random_trigger_type(db, packs=packs) # Step 3 - create trigger trigger = create_random_trigger(db, packs=packs, trigger_type=trigger_type) # Step 4 - trigger_instance arguments trigger_instance_payload = {"foo": "bar", "name": "Joe"} trigger_instance_trigger = "{pack_name}.{trigger_name}".format( pack_name=packs.name, trigger_name=trigger.name ) trigger_instance_status = "processed" # Step 5 - create trigger_instance trigger_instance_in = TriggerInstanceCreate( trigger=trigger_instance_trigger, payload=trigger_instance_payload, status=trigger_instance_status, ) trigger_instance = crud.trigger_instance.create( db, trigger_instance_in=trigger_instance_in ) trigger_instance_payload2 = {"foo": "bar1", "name": "Joe1"} trigger_instance_update = TriggerInstanceUpdate(payload=trigger_instance_payload2) trigger_instance2 = crud.trigger_instance.update( db_session=db, trigger_instance=trigger_instance, trigger_instance_in=trigger_instance_update, ) assert trigger_instance2.trigger == trigger_instance_trigger assert trigger_instance2.payload == trigger_instance_payload2 assert trigger_instance2.occurrence_time == "2019-07-25 01:11:00.740428" assert trigger_instance2.status == trigger_instance_status @freeze_time("2019-07-25 01:11:00.740428") @pytest.mark.triggerinstanceonly @pytest.mark.unittest def test_delete_trigger_instance(db: Session) -> None: # Step 1 - create pack packs = create_random_packs(db) # Step 2 - create trigger_type trigger_type = create_random_trigger_type(db, packs=packs) # Step 3 - create trigger trigger = create_random_trigger(db, packs=packs, trigger_type=trigger_type) # Step 4 - trigger_instance arguments trigger_instance_payload = {"foo": "bar", "name": "Joe"} trigger_instance_trigger = "{pack_name}.{trigger_name}".format( pack_name=packs.name, trigger_name=trigger.name ) trigger_instance_status = "processed" # Step 5 - create trigger_instance trigger_instance_in = TriggerInstanceCreate( trigger=trigger_instance_trigger, payload=trigger_instance_payload, status=trigger_instance_status, ) trigger_instance = crud.trigger_instance.create( db, trigger_instance_in=trigger_instance_in ) trigger_instance2 = crud.trigger_instance.remove( db_session=db, trigger_instance_id=trigger_instance.id ) trigger_instance3 = crud.trigger_instance.get( db_session=db, trigger_instance_id=trigger_instance.id ) assert trigger_instance3 is None assert trigger_instance2.id == trigger_instance.id assert trigger_instance2.trigger == trigger_instance.trigger assert trigger_instance2.payload == trigger_instance.payload assert trigger_instance2.occurrence_time == trigger_instance.occurrence_time
34.597902
86
0.740576
1,178
9,895
5.894737
0.089983
0.304579
0.079205
0.044355
0.788594
0.758209
0.736463
0.711118
0.690668
0.677707
0
0.029085
0.173017
9,895
285
87
34.719298
0.819504
0.102981
0
0.46
0
0
0.063228
0.020586
0
0
0
0
0.08
1
0.03
false
0
0.065
0
0.095
0
0
0
0
null
1
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
e96926f2025b6f5b8a2c33a3b199dc5e742cc95b
232
py
Python
users/models.py
splinterific/Usercontrollist
3cf7e7d3cf27373afa2f896a10113364f0b88e02
[ "MIT" ]
29
2019-10-01T12:09:06.000Z
2022-03-02T22:09:48.000Z
users/models.py
splinterific/Usercontrollist
3cf7e7d3cf27373afa2f896a10113364f0b88e02
[ "MIT" ]
4
2021-03-19T00:40:40.000Z
2021-09-22T18:41:49.000Z
users/models.py
splinterific/Usercontrollist
3cf7e7d3cf27373afa2f896a10113364f0b88e02
[ "MIT" ]
115
2019-07-23T19:32:08.000Z
2022-03-26T08:22:25.000Z
from django.contrib.auth.models import AbstractUser from django.db import models class Person(AbstractUser): description = models.TextField(blank=True) def __str__(self): return "User(<{}>)".format(self.username)
23.2
51
0.728448
28
232
5.892857
0.75
0.121212
0
0
0
0
0
0
0
0
0
0
0.155172
232
9
52
25.777778
0.841837
0
0
0
0
0
0.043103
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0.166667
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
5
e996cc273dac2301b55276750bb3bc239f808eee
38
py
Python
pg_raxarchive/__main__.py
duilio/pg_raxarchive
d57a4fd4400b3bc97fe7935e6388a2a962776abb
[ "BSD-2-Clause" ]
2
2015-01-29T00:00:38.000Z
2018-05-24T19:06:47.000Z
pg_raxarchive/__main__.py
duilio/pg_raxarchive
d57a4fd4400b3bc97fe7935e6388a2a962776abb
[ "BSD-2-Clause" ]
null
null
null
pg_raxarchive/__main__.py
duilio/pg_raxarchive
d57a4fd4400b3bc97fe7935e6388a2a962776abb
[ "BSD-2-Clause" ]
1
2016-08-18T03:16:10.000Z
2016-08-18T03:16:10.000Z
from pg_raxarchive import main main()
12.666667
30
0.815789
6
38
5
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.131579
38
2
31
19
0.909091
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
e9b5b8b31f41eddbf83dd7b99fdc2c0d5cd8ee62
241
py
Python
django_roles_access/admin.py
django-roles-access/master
066d0d6b99b986eacc736e6973b415cbb9172d46
[ "MIT" ]
5
2019-03-22T08:08:25.000Z
2019-04-11T11:46:52.000Z
django_roles_access/admin.py
django-roles-access/master
066d0d6b99b986eacc736e6973b415cbb9172d46
[ "MIT" ]
5
2019-04-03T21:53:52.000Z
2019-05-22T22:41:34.000Z
django_roles_access/admin.py
django-roles-access/master
066d0d6b99b986eacc736e6973b415cbb9172d46
[ "MIT" ]
null
null
null
# encoding='utf-8' from django.contrib import admin from django_roles_access.models import ViewAccess, TemplateAccess # admin.site.register(ViewAccess, ViewAccessAdmin) admin.site.register(ViewAccess) admin.site.register(TemplateAccess)
21.909091
65
0.825726
29
241
6.793103
0.551724
0.137056
0.258883
0.274112
0
0
0
0
0
0
0
0.004525
0.082988
241
10
66
24.1
0.886878
0.26971
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
e9d0d9a5966a2fecd139a7340aa304cf1fd7d271
170
py
Python
blog/permissions.py
florimondmanca/personal-api
6300f965d3f51d1bf5f10cf1eb15d673bd627631
[ "MIT" ]
4
2018-08-17T08:06:06.000Z
2020-02-20T15:15:56.000Z
blog/permissions.py
florimondmanca/personal-api
6300f965d3f51d1bf5f10cf1eb15d673bd627631
[ "MIT" ]
2
2018-10-08T15:59:58.000Z
2018-10-20T16:50:13.000Z
blog/permissions.py
florimondmanca/personal-api
6300f965d3f51d1bf5f10cf1eb15d673bd627631
[ "MIT" ]
1
2019-09-14T23:15:10.000Z
2019-09-14T23:15:10.000Z
from rest_framework.permissions import IsAuthenticated from rest_framework_api_key.permissions import HasAPIKey HasAPIKeyOrIsAuthenticated = HasAPIKey | IsAuthenticated
34
56
0.894118
17
170
8.705882
0.588235
0.108108
0.22973
0
0
0
0
0
0
0
0
0
0.082353
170
4
57
42.5
0.948718
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
756a280d766daa7e34b8619f0cff454a29a952e2
46
py
Python
exceptions.py
korhanyuzbas/python-articlecrawler
32d8a83d04581eed3494e158ed4764cb08fdb3cc
[ "MIT" ]
1
2019-05-12T12:59:34.000Z
2019-05-12T12:59:34.000Z
exceptions.py
korhanyuzbas/python-articlecrawler
32d8a83d04581eed3494e158ed4764cb08fdb3cc
[ "MIT" ]
4
2021-06-08T19:15:50.000Z
2022-03-11T23:27:51.000Z
exceptions.py
korhanyuzbas/python-articlecrawler
32d8a83d04581eed3494e158ed4764cb08fdb3cc
[ "MIT" ]
null
null
null
class UnknownContentType(Exception): pass
15.333333
36
0.782609
4
46
9
1
0
0
0
0
0
0
0
0
0
0
0
0.152174
46
2
37
23
0.923077
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
75bd668d3e0f5c0cc875362159364f03166470bf
172
py
Python
profiles_api/urls.py
dirias/DjangoRestFramework
b335c9637ea91de70d089d4b0484e0fb67438dcf
[ "MIT" ]
null
null
null
profiles_api/urls.py
dirias/DjangoRestFramework
b335c9637ea91de70d089d4b0484e0fb67438dcf
[ "MIT" ]
null
null
null
profiles_api/urls.py
dirias/DjangoRestFramework
b335c9637ea91de70d089d4b0484e0fb67438dcf
[ "MIT" ]
null
null
null
from django.urls import path, include from django.urls import path from profiles_api import views urlpatterns = [ path('hello/', views.HelloApiView.as_view()), ]
24.571429
50
0.732558
23
172
5.391304
0.608696
0.16129
0.225806
0.322581
0.387097
0
0
0
0
0
0
0
0.168605
172
7
51
24.571429
0.867133
0
0
0
0
0
0.035928
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
75c2d7ae9ab6aa529505752e3bcefd10a83e632c
97
py
Python
events/admin.py
vinaykakkad/DIM
9096e3703b0edda85914e4b25092670dd44e6d99
[ "MIT" ]
2
2021-06-02T03:54:23.000Z
2021-12-17T04:49:08.000Z
events/admin.py
vinaykakkad/DIM
9096e3703b0edda85914e4b25092670dd44e6d99
[ "MIT" ]
2
2021-06-02T03:49:39.000Z
2021-09-22T18:43:45.000Z
events/admin.py
vinaykakkad/DIM
9096e3703b0edda85914e4b25092670dd44e6d99
[ "MIT" ]
1
2021-07-21T16:07:07.000Z
2021-07-21T16:07:07.000Z
from django.contrib import admin from .models import EventPost admin.site.register(EventPost)
13.857143
32
0.814433
13
97
6.076923
0.692308
0
0
0
0
0
0
0
0
0
0
0
0.123711
97
6
33
16.166667
0.929412
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
75cced96899df3edfb95fb634cae87a84f5b7ddc
202
py
Python
accounts/models.py
LeeJoeBarak/IMS-Backend
836f6a34f37595bd923e3c25dce622152d6b3185
[ "MIT" ]
null
null
null
accounts/models.py
LeeJoeBarak/IMS-Backend
836f6a34f37595bd923e3c25dce622152d6b3185
[ "MIT" ]
null
null
null
accounts/models.py
LeeJoeBarak/IMS-Backend
836f6a34f37595bd923e3c25dce622152d6b3185
[ "MIT" ]
null
null
null
from django.db import models # Create your models here. # this is where we build our database and class based objects # and it'll represent the file structure that we're going to have on our database
28.857143
81
0.777228
36
202
4.361111
0.861111
0.140127
0
0
0
0
0
0
0
0
0
0
0.188119
202
6
82
33.666667
0.957317
0.811881
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
f9403a21f8a25bbcd6513d795008752060c5be02
4,323
py
Python
Python/largeFizzBuzz_AsOutput.py
RDxR10/Hacktoberfest-2020-FizzBuzz
c9a8e3a0ac1ff9886c013a6b5628b7f64eb0d342
[ "Unlicense" ]
80
2020-10-01T00:32:34.000Z
2021-01-08T21:56:09.000Z
Python/largeFizzBuzz_AsOutput.py
RDxR10/Hacktoberfest-2020-FizzBuzz
c9a8e3a0ac1ff9886c013a6b5628b7f64eb0d342
[ "Unlicense" ]
672
2020-09-30T22:53:47.000Z
2020-11-01T12:39:59.000Z
Python/largeFizzBuzz_AsOutput.py
RDxR10/Hacktoberfest-2020-FizzBuzz
c9a8e3a0ac1ff9886c013a6b5628b7f64eb0d342
[ "Unlicense" ]
618
2020-09-30T22:21:12.000Z
2020-10-31T21:28:06.000Z
'''A large FizzBuzz as an output using small FizzBuzz numbers.(FizzBuzz=FizBuz for better alignment and make sure your output terminal covers the entire length of the screen to avoid automatic newlines)''' # Author: @AmanMatrix def iCheck(i): if i%15==0: i='FizBuz' elif i%3==0: i='Fizz' elif i%5==0: i='Buzz' else:i=i return i for i in range(1,101): if(i==1): print("\n",iCheck(i),end=" ") elif(i<=5): print(iCheck(i),end=" ") elif(i==6): print(" ",iCheck(i),end=" ") elif(i<=9): print(iCheck(i),end=" ") elif(i==10): print(f"\n {iCheck(i)}",end=" ") elif(i<=12): print(iCheck(i),end="") elif(i==13): print(" ",iCheck(i),end=" ") elif(i==14): print(iCheck(i)) elif(i==15): print(iCheck(i),end=" ") elif(i==16): print(iCheck(i),end=" ") elif(i<=18): print(iCheck(i),end=" ") elif(i==19): print(f"\n {iCheck(i)}",end=" ") elif(i<=21): print(iCheck(i),end=" ") elif(i==22): print(f"\n {iCheck(i)}",end=" ") elif(i<=25): print(iCheck(i),end=" ") elif(i==26): print(" ",iCheck(i),end="") elif(i<=27): print(iCheck(i),end=" ") elif(i==28): print(iCheck(i),end=" ") elif(i<=30): print(iCheck(i),end=" ") elif(i==31): print(" ",iCheck(i),end=" ") elif(i<=33): print(iCheck(i),end=" ") elif(i==34): print(" ",iCheck(i),end=" ") elif(i<=36): print(iCheck(i),end="") elif(i<=37): print(" ",iCheck(i),end="") elif(i<=38): print(" ",iCheck(i),end="") elif(i==39): print(" ",iCheck(i),end=" ") elif(i<=41): print(iCheck(i),end=" ") elif(i==42): print(" ",iCheck(i),end=" ") elif(i<=44): print(iCheck(i),end=" ") elif(i==45): print(f"\n{iCheck(i)}",end=" ") elif(i<=47): print(iCheck(i),end=" ") elif(i<=49): print(" ",iCheck(i),end=" ") elif(i==50): print(" ",iCheck(i),end=" ") elif(i==51): print(" ",iCheck(i),end=" ") elif(i==52): print(iCheck(i),end=" ") elif(i==53): print(iCheck(i),end=" ") elif(i<=55): print(iCheck(i),end=" ") elif(i==56): print(f"\n {iCheck(i)}",end=" ") elif(i<=58): print(iCheck(i),end="") elif(i<=60): print(" ",iCheck(i),end=" ") elif(i<=61): print(" ",iCheck(i),end=" ") elif(i<=62): print(iCheck(i),end=" ") elif(i<=64): print(iCheck(i),end=" ") elif(i<=66): print(iCheck(i),end=" ") elif(i<=67): print(f"\n {iCheck(i)}",end=" ") elif(i<=69): print(iCheck(i),end="") elif(i<=71): print(" ",iCheck(i),end=" ") elif(i<=72): print(" ",iCheck(i),end=" ") elif(i<=73): print(iCheck(i),end=" ") elif(i<=74): print(iCheck(i),end=" ") elif(i<=75): print(iCheck(i),end=" ") elif(i<=76): print(iCheck(i),end=" ") elif(i<=77): print(iCheck(i),end=" ") elif(i<=78): print(f"\n {iCheck(i)}",end=" ") elif(i<=80): print(iCheck(i),end="") elif(i==81): print(" ",iCheck(i),end=" ") elif(i<=83): print("",iCheck(i),end="") elif(i<=84): print(" ",iCheck(i),end=" ") elif(i<=86): print(iCheck(i),end="") elif(i<=87): print(" ",iCheck(i),end=" ") elif(i<=89): print(iCheck(i),end=" ") elif(i<=90): print(" ",iCheck(i),end="") elif(i<=92): print(iCheck(i),end="") elif(i<=93): print(" ",iCheck(i),end="") elif(i<=95): print("",iCheck(i),end="") elif(i<=96): print(" ",iCheck(i),end="") elif(i<=99): print(iCheck(i),end="") else: print(" ",iCheck(i))
29.013423
105
0.405505
553
4,323
3.169982
0.207957
0.275528
0.376497
0.51911
0.74729
0.74729
0.087849
0.087849
0
0
0
0.050683
0.356465
4,323
149
106
29.013423
0.579439
0.051122
0
0.445205
0
0
0.146693
0
0
0
0
0
0
1
0.006849
false
0
0
0
0.013699
0.465753
0
0
0
null
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
5
f9786b035f373047dca9e8a3601bae329fddf8a0
96
py
Python
pvtools/__init__.py
sipv/pvtools
d550a37586df0d08abb737a6d4eae24ee1b4199b
[ "MIT" ]
null
null
null
pvtools/__init__.py
sipv/pvtools
d550a37586df0d08abb737a6d4eae24ee1b4199b
[ "MIT" ]
null
null
null
pvtools/__init__.py
sipv/pvtools
d550a37586df0d08abb737a6d4eae24ee1b4199b
[ "MIT" ]
null
null
null
from interface import PVTOOLS_DIR, dsopen, to_dict, to_json from datasource import DataSource
19.2
59
0.833333
14
96
5.5
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.135417
96
4
60
24
0.927711
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
f978c3103cff27dd20ac86277e8f6b8118572dc0
66
py
Python
app/db/migrations/test.py
zyxyuanxiao/fastapi-1
ddc5273c82468e111bce1fd2c127da3642741a21
[ "MIT" ]
2
2020-03-24T14:14:18.000Z
2021-12-08T02:29:59.000Z
app/db/migrations/test.py
chr1043086360/fastapi-2
ddc5273c82468e111bce1fd2c127da3642741a21
[ "MIT" ]
null
null
null
app/db/migrations/test.py
chr1043086360/fastapi-2
ddc5273c82468e111bce1fd2c127da3642741a21
[ "MIT" ]
1
2020-03-11T03:22:00.000Z
2020-03-11T03:22:00.000Z
import pathlib print(pathlib.Path(__file__).resolve().parents[3])
22
50
0.787879
9
66
5.333333
0.888889
0
0
0
0
0
0
0
0
0
0
0.015873
0.045455
66
3
50
22
0.746032
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
1
0
5
f982fec3b738b601996638ed00c0f1b4c8ee2fd3
191
py
Python
myweight/errors.py
ted9527/myweight2
51812b7d1031b8bdbda5a92c50dadd079bd467e0
[ "MIT" ]
null
null
null
myweight/errors.py
ted9527/myweight2
51812b7d1031b8bdbda5a92c50dadd079bd467e0
[ "MIT" ]
null
null
null
myweight/errors.py
ted9527/myweight2
51812b7d1031b8bdbda5a92c50dadd079bd467e0
[ "MIT" ]
null
null
null
from flask import render_template from myweight import app @app.errorhandler(404) # 传入要处理的错误代码 def page_not_found(e): # 接受异常对象作为参数 return render_template('404.html'), 404 # 返回模板和状态码\
27.285714
56
0.764398
26
191
5.461538
0.730769
0.197183
0
0
0
0
0
0
0
0
0
0.055215
0.146597
191
7
56
27.285714
0.815951
0.162304
0
0
0
0
0.050955
0
0
0
0
0
0
1
0.2
false
0
0.4
0.2
0.8
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
5
f999e20596015cb31971e2c446ffb10687c41a9e
313
py
Python
__init__.py
Adam5Wu/VersionLint
f5dc6683a00fd1c62e834d12968f4dbe2cb57140
[ "BSD-3-Clause" ]
null
null
null
__init__.py
Adam5Wu/VersionLint
f5dc6683a00fd1c62e834d12968f4dbe2cb57140
[ "BSD-3-Clause" ]
null
null
null
__init__.py
Adam5Wu/VersionLint
f5dc6683a00fd1c62e834d12968f4dbe2cb57140
[ "BSD-3-Clause" ]
null
null
null
#============================================================================= ## Automatic Repository Version Generation Utility ## Author: Zhenyu Wu ## Revision 1: Apr 28. 2016 - Initial Implementation #============================================================================= __all__ = [ 'VersionLint' ]
34.777778
78
0.364217
17
313
6.470588
1
0
0
0
0
0
0
0
0
0
0
0.024561
0.089457
313
8
79
39.125
0.361404
0.86262
0
0
0
0
0.323529
0
0
1
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
1
1
0
0
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
5
f9ad162ef47aa1f731a154e2e6088b2823fc06be
213
py
Python
codility/lessons/2-arrays/test_odd_occurrences.py
phacic/dsa-py
77e07361d502aeec004c7e44b714a53fe7f9cae0
[ "MIT" ]
null
null
null
codility/lessons/2-arrays/test_odd_occurrences.py
phacic/dsa-py
77e07361d502aeec004c7e44b714a53fe7f9cae0
[ "MIT" ]
null
null
null
codility/lessons/2-arrays/test_odd_occurrences.py
phacic/dsa-py
77e07361d502aeec004c7e44b714a53fe7f9cae0
[ "MIT" ]
null
null
null
import pytest from .odd_occurrences import solution @pytest.mark.parametrize("values, expected", [([9, 3, 9, 3, 7, 9], 7), ([9], 9)]) def test_solution(values, expected): assert solution(values) == expected
26.625
81
0.690141
30
213
4.833333
0.533333
0.289655
0.303448
0
0
0
0
0
0
0
0
0.04918
0.140845
213
7
82
30.428571
0.743169
0
0
0
0
0
0.075117
0
0
0
0
0
0.2
1
0.2
false
0
0.4
0
0.6
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5