Skip to content

Commit

Permalink
1603_1.py (#37): --data-apothecae-ex-archivo, read working dictionari…
Browse files Browse the repository at this point in the history
…es from file
  • Loading branch information
fititnt committed Apr 30, 2022
1 parent 415da23 commit bbb1364
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 30 deletions.
2 changes: 2 additions & 0 deletions officinam/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ node_modules
*.mobi
*.ttf
*.otf
*.db
*.sqlite

# These files generate by software start from 30mb and up.
# Not need to be commited on repository.
Expand Down
77 changes: 58 additions & 19 deletions officinam/999999999/0/1603_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4461,7 +4461,7 @@ def praeparatio_datapackage(
archivum.write(lineam)
else:
_path_archivum = NUMERORDINATIO_BASIM + '/' + self.data_apothecae_ad
self.resultatum.append('TODO praeparatio_datapackage')
# self.resultatum.append('TODO praeparatio_datapackage')
self.resultatum.append(_path_archivum)

with open(_path_archivum, 'w') as archivum:
Expand Down Expand Up @@ -5831,6 +5831,19 @@ def make_args(self, hxl_output=True):
nargs='?'
)

commune = parser.add_argument_group(
"Commūne",
"Generic options reused by more than one operation mode.")

commune.add_argument(
'--codex-de',
help='Generate documentation of dictionaries',
# metavar='',
dest='codex_de',
# const=True,
nargs='?'
)

archivum = parser.add_argument_group(
"Archivum",
"(DEFAULT USE) Use archive as source (directory not ready yet)")
Expand Down Expand Up @@ -5869,6 +5882,13 @@ def make_args(self, hxl_output=True):
type=lambda x: x.split(',')
)

data_apothecae.add_argument(
'--data-apothecae-ex-archivo',
help='Path to file with list (one item per line) of dictionaries '
'to initialize',
dest='data_apothecae_ex_archivo',
)

# fōrmātō, s, n, Dativus, https://en.wiktionary.org/wiki/formatus#Latin
data_apothecae.add_argument(
'--data-apothecae-formato',
Expand Down Expand Up @@ -5899,16 +5919,16 @@ def make_args(self, hxl_output=True):
# https://en.wiktionary.org/wiki/codex#Latin
codex = parser.add_argument_group(
"Codex",
"Book/manual creation")
"Book/manual creation. Requires --codex-de=1603_NN_NN")

codex.add_argument(
'--codex-de',
help='Generate documentation of dictionaries',
# metavar='',
dest='codex_de',
# const=True,
nargs='?'
)
# codex.add_argument(
# '--codex-de',
# help='Generate documentation of dictionaries',
# # metavar='',
# dest='codex_de',
# # const=True,
# nargs='?'
# )

codex.add_argument(
'--objectivum-linguam',
Expand Down Expand Up @@ -5962,7 +5982,8 @@ def make_args(self, hxl_output=True):
status_quo = parser.add_argument_group(
"Status quō",
"Calculate current situation. Used to take other actions. "
"Requires --codex-de 1603_NN_NN"
"Requires --codex-de 1603_NN_NN (focused Codex). "
"Works with --quaero-ix_n1603ia."
)

status_quo.add_argument(
Expand All @@ -5988,7 +6009,8 @@ def make_args(self, hxl_output=True):
status_quo.add_argument(
'--status-in-datapackage',
help='Return status in frictionless datapackage.json. '
'With --ex-librario returns profile data-package-catalog.',
'With --ex-librario returns profile data-package-catalog. '
' (low level of details)',
# metavar='',
dest='status_in_datapackage',
# const=True,
Expand Down Expand Up @@ -6146,17 +6168,34 @@ def execute_cli(self, pyargs, stdin=STDIN, stdout=sys.stdout,
a1603z1.est_resultatum_separato(args.resultatum_separato)
a1603z1.est_fontem_separato(args.fontem_separato)

if self.pyargs.data_apothecae_ex and \
len(self.pyargs.data_apothecae_ex) > 0:
# codex = Codex('1603_1_1')
# libraria = LibrariaStatusQuo(
# codex,
# 'locale')
if (self.pyargs.data_apothecae_ex and
len(self.pyargs.data_apothecae_ex) > 0) or \
(self.pyargs.data_apothecae_ex_archivo and
len(self.pyargs.data_apothecae_ex_archivo)):

if self.pyargs.data_apothecae_ex:
data_apothecae_ex = self.pyargs.data_apothecae_ex
else:
# f = open(self.pyargs.data_apothecae_ex_archivo, "r")
# data_apothecae_ex = list(f.readlines())
data_apothecae_ex = []
# print(f.readlines())
with open(
self.pyargs.data_apothecae_ex_archivo, "r") as archivum:
for _lineam in archivum:
if _lineam.startswith('#') or len(_lineam.strip()) == 0:
continue
lineam = _lineam.rstrip('\n')
if lineam.find(',') > -1:
lineam = lineam.split(',')[0]
data_apothecae_ex.append(lineam)
# print(data_apothecae_ex)

# libraria.imprimere_in_datapackage_sqlite()

data_apothecae = DataApothecae(
self.pyargs.data_apothecae_ex,
# self.pyargs.data_apothecae_ex,
data_apothecae_ex,
data_apothecae_ad=self.pyargs.data_apothecae_ad,
data_apothecae_formato=self.pyargs.data_apothecae_formato,
)
Expand Down
16 changes: 8 additions & 8 deletions officinam/999999999/999999999.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2240,20 +2240,20 @@ opus_temporibus_cdn() {
# --in-limitem=2 \
# >"$opus_temporibus_temporarium"

# "${ROOTDIR}/999999999/0/1603_1.py" \
# --ex-opere-temporibus='cdn' \
# --quaero-ix_n1603ia='({publicum}>=1)' \
# --in-ordinem=chaos \
# --in-limitem=10 \
# >"$opus_temporibus_temporarium"

"${ROOTDIR}/999999999/0/1603_1.py" \
--ex-opere-temporibus='cdn' \
--quaero-ix_n1603ia='({publicum}>=1)' \
--in-ordinem=chaos \
--in-limitem=25 \
--in-limitem=3 \
>"$opus_temporibus_temporarium"

# "${ROOTDIR}/999999999/0/1603_1.py" \
# --ex-opere-temporibus='cdn' \
# --quaero-ix_n1603ia='({publicum}>=1)' \
# --in-ordinem=chaos \
# --in-limitem=25 \
# >"$opus_temporibus_temporarium"

while IFS=$'\t' read -r -a line; do
# echo "${line[0]}"

Expand Down
12 changes: 9 additions & 3 deletions officinam/999999999/999999_17.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ ROOTDIR="$(pwd)"
#### Manual action, TEST locally, one per time, START --------------------------
# Download entire XLSX to local temp
file_download_1603_xlsx "1"
actiones_completis_locali "1603_1_1"
# actiones_completis_locali "1603_1_1"
# actiones_completis_locali "1603_1_7"
# actiones_completis_locali "1603_1_51"
# actiones_completis_locali "1603_1_99"
Expand All @@ -87,8 +87,8 @@ actiones_completis_locali "1603_1_1"
# deploy_0_9_markdown

## Full drill (remote, randon publish few at time)
# opus_temporibus_cdn
# deploy_0_9_markdown
opus_temporibus_cdn
deploy_0_9_markdown

# @TODO: maybe check ssdiff (diff spreadsheets) to our uses.

Expand All @@ -105,3 +105,9 @@ actiones_completis_locali "1603_1_1"
# cow_tool convert 1603/63/101/1603_63_101.no11.tm.hxl.csv

# https://github.com/cldf/csvw

# ./999999999/0/1603_1.py --data-apothecae-ex='1603_45_1,1603_45_31' --data-apothecae-ad='apothecae.datapackage.json'
# ./999999999/0/1603_1.py --data-apothecae-ex='1603_45_1,1603_45_31' --data-apothecae-ad='apothecae.sqlite'

# printf "1603_45_1\n1603_45_31" > 999999/0/apothecae-list.txt
# ./999999999/0/1603_1.py --data-apothecae-ex-archivo='999999/0/apothecae-list.txt' --data-apothecae-ad='apothecae.datapackage.json'

0 comments on commit bbb1364

Please sign in to comment.