Skip to content

Commit

Permalink
1603_1.py (#29): --quaero-numerordinatio implemented; --in-ordinem dr…
Browse files Browse the repository at this point in the history
…afted
  • Loading branch information
fititnt committed Apr 17, 2022
1 parent 133f908 commit e471c1b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 15 deletions.
62 changes: 51 additions & 11 deletions officinam/999999999/0/1603_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
Union,
List
)
import random

from copy import copy
import re
import fnmatch
Expand Down Expand Up @@ -2998,8 +3000,9 @@ def ex_codice(self):
usus_linguae = len(self.codex.usus_linguae)
usus_ix_qcc = len(self.codex.usus_ix_qcc)

time_expected = datetime.datetime.now()
tempus_opus = datetime.datetime.now()
# time_expected = datetime.datetime.now().replace(microsecond=0)
# tempus_opus = datetime.datetime.now()
tempus_opus = datetime.datetime.now().replace(microsecond=0)

resultatum = {
'annotationes_internalibus': self.codex.n1603ia,
Expand All @@ -3024,9 +3027,6 @@ def ex_codice(self):
}
}
}
# time_expected = datetime.datetime.now()
# time_actual = datetime.datetime.fromisoformat(time_expected.isoformat())
# assert time_actual == time_expected

return resultatum

Expand Down Expand Up @@ -4518,6 +4518,7 @@ class OpusTemporibus:
opus: list = []
in_limitem: int = 0
in_ordinem: str = None
quaero_numerordinatio: list = []

def __init__(
self,
Expand All @@ -4526,6 +4527,7 @@ def __init__(
quaero_ix_n1603ia: str = '',
in_limitem: Union[str, int] = '',
in_ordinem: str = None,
quaero_numerordinatio: Union[list, str] = None,
):
self.ex_opere_temporibus = ex_opere_temporibus
# self.ex_librario = ex_librario
Expand All @@ -4535,7 +4537,15 @@ def __init__(
self.in_limitem = int(in_limitem)

if in_ordinem:
self.in_ordinem = int(in_ordinem)
self.in_ordinem = in_ordinem

if quaero_numerordinatio and len(quaero_numerordinatio) > 0:
if not isinstance(quaero_numerordinatio, list):
quaero_numerordinatio = quaero_numerordinatio.split(',')

for item in quaero_numerordinatio:
self.quaero_numerordinatio.append(
numerordinatio_neo_separatum(item, '_'))

self.initiari()
# self.dictionaria_codex = dictionaria_codex
Expand Down Expand Up @@ -4594,6 +4604,18 @@ def imprimere(self):
# resultatum.extend(self.codex_opus)
resultatum.extend(self.opus)

if self.in_ordinem == 'chaos':
random.shuffle(resultatum)

# print('oi', self.quaero_numerordinatio)

if len(self.quaero_numerordinatio) > 0:
_resultatum = []
for item in resultatum:
if item[0] in self.quaero_numerordinatio:
_resultatum.append(item)
resultatum = _resultatum

if self.in_limitem > 0 and len(resultatum) > self.in_limitem:
resultatum = resultatum[:self.in_limitem]

Expand Down Expand Up @@ -4855,6 +4877,20 @@ def make_args(self, hxl_output=True):
# action='store_true',
nargs='?'
)
opus_temporibus.add_argument(
'--quaero-numerordinatio',
help='Query Numerordĭnātĭo. Additional filter list for focused '
' base of dictionaries. Ideal to check if some groups meet '
'other filters. '
'Example: if result return empty and other queries are to check '
'if need to fetch again from Wikidata Q, then you assume no '
'new fetch is necessary',
# metavar='',
dest='quaero_numerordinatio',
# const='',
# action='store_true',
nargs='?'
)

# in (+ ablative), in (+ accusative);;
# (+ accusative) toward, towards, against, at
Expand All @@ -4869,13 +4905,16 @@ def make_args(self, hxl_output=True):
)

# https://en.wiktionary.org/wiki/ordo#Latin
# https://en.wiktionary.org/wiki/chaos#Latin
opus_temporibus.add_argument(
'--in-ordinem',
help='/Against arrangement (ordering) of/. Sort result list to '
'this rule ',
'this rule. Options: '
'numerordinatio=natural order; chaos=random order',
dest='in_ordinem',
nargs='?',
choices=['rock', 'paper', 'scissors']
choices=['numerordinatio', 'chaos'],
default='numerordinatio'
)

# # --agendum-linguam is a draft. Not 100% implemented
Expand Down Expand Up @@ -4950,12 +4989,13 @@ def execute_cli(self, pyargs, stdin=STDIN, stdout=sys.stdout,
if self.pyargs.ex_opere_temporibus and \
len(self.pyargs.ex_opere_temporibus) > 0:

# print(self.pyargs.quaero_ix_n1603ia)
# print(self.pyargs.quaero_numerordinatio)
opus_temporibus = OpusTemporibus(
self.pyargs.ex_opere_temporibus,
self.pyargs.quaero_ix_n1603ia,
in_limitem = self.pyargs.in_limitem,
in_ordinem = self.pyargs.in_ordinem,
in_limitem=self.pyargs.in_limitem,
in_ordinem=self.pyargs.in_ordinem,
quaero_numerordinatio=self.pyargs.quaero_numerordinatio,
)
return self.output(opus_temporibus.imprimere())

Expand Down
11 changes: 7 additions & 4 deletions officinam/999999999/999999999.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2059,21 +2059,24 @@ fi
#######################################
opus_temporibus_cdn() {
# ...
echo "TODO..."
# echo "TODO..."
blue=$(tput setaf 4)
normal=$(tput sgr0)
printf "%40s\n" "${blue}${FUNCNAME[0]}${normal}"

opus_temporibus_temporarium="${ROOTDIR}/999999/0/1603.cdn.statum.tsv"

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

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

# actiones_completis_publicis "${line[0]}"
actiones_completis_publicis "${line[0]}"
# echo "${line[1]}"
# echo "${line[2]}"
done <"${opus_temporibus_temporarium}"
Expand Down

0 comments on commit e471c1b

Please sign in to comment.