Skip to content

Commit dd47643

Browse files
committed
Remove all trailing whitespace
Signed-off-by: Stefan Weil <[email protected]>
1 parent cff8dda commit dd47643

File tree

26 files changed

+167
-167
lines changed

26 files changed

+167
-167
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- checkout
1818
- run: HOMEBREW_NO_AUTO_UPDATE=1 brew install imagemagick geos
19-
- run: make install
19+
- run: make install
2020
- run: make deps-test test benchmark
2121

2222
test-python36:

.github/workflows/docker-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ jobs:
3535
run: |
3636
docker push ghcr.io/ocrd/core:latest
3737
docker push ghcr.io/ocrd/core-cuda:latest
38-
38+

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ Added:
10531053
* Workspace validation will check cardinality of images per file is 1, #243, OCR-D/spec#132
10541054

10551055
Changed:
1056-
1056+
10571057
* bashlib will no longer warn about "non-conformant" file group names, #365
10581058
* Invalid `file:/` URL will now raise exceptions, #373
10591059
* image_from_*: increase tolerance for size mismatch after rotation to 2px, #371

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LOG_LEVEL = INFO
77
PYTHONIOENCODING=utf8
88
TESTDIR = tests
99

10-
SPHINX_APIDOC =
10+
SPHINX_APIDOC =
1111

1212
BUILD_ORDER = ocrd_utils ocrd_models ocrd_modelfactory ocrd_validators ocrd
1313

@@ -52,7 +52,7 @@ DOCKER_TAG = ocrd/core
5252
DOCKER_BASE_IMAGE = ubuntu:20.04
5353

5454
# Additional arguments to docker build. Default: '$(DOCKER_ARGS)'
55-
DOCKER_ARGS =
55+
DOCKER_ARGS =
5656

5757
# pip install command. Default: $(PIP_INSTALL)
5858
PIP_INSTALL = $(PIP) install

ocrd/ocrd/lib.bash

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
exit 1
44

55
## ### `ocrd__raise`
6-
##
6+
##
77
## Raise an error and exit.
88
ocrd__raise () {
99
echo >&2 "ERROR: $1"; exit 127
1010
}
1111

1212
## ### `ocrd__log`
13-
##
13+
##
1414
## Delegate logging to `ocrd log`
1515
ocrd__log () {
1616
local log_level="${ocrd__argv[log_level]:-}"
@@ -23,7 +23,7 @@ ocrd__log () {
2323

2424

2525
## ### `ocrd__minversion`
26-
##
26+
##
2727
## Ensure minimum version
2828
# ht https://stackoverflow.com/posts/4025065
2929
ocrd__minversion () {
@@ -53,48 +53,48 @@ ocrd__minversion () {
5353
}
5454

5555
## ### `ocrd__dumpjson`
56-
##
56+
##
5757
## Output ocrd-tool.json.
58-
##
58+
##
5959
## Requires `$OCRD_TOOL_JSON` and `$OCRD_TOOL_NAME` to be set:
60-
##
60+
##
6161
## ```sh
6262
## export OCRD_TOOL_JSON=/path/to/ocrd-tool.json
6363
## export OCRD_TOOL_NAME=ocrd-foo-bar
6464
## ```
65-
##
65+
##
6666
ocrd__dumpjson () {
6767
ocrd ocrd-tool "$OCRD_TOOL_JSON" tool "$OCRD_TOOL_NAME" dump
6868
}
6969

70-
##
70+
##
7171
## Output file resource content.
7272
##
7373
ocrd__show_resource () {
7474
ocrd ocrd-tool "$OCRD_TOOL_JSON" tool "$OCRD_TOOL_NAME" show-resource "$1"
7575
}
7676

77-
##
77+
##
7878
## Output file resources names.
7979
##
8080
ocrd__list_resources () {
8181
ocrd ocrd-tool "$OCRD_TOOL_JSON" tool "$OCRD_TOOL_NAME" list-resources
8282
}
8383

8484
## ### `ocrd__usage`
85-
##
85+
##
8686
## Print usage
87-
##
87+
##
8888
ocrd__usage () {
8989

9090
ocrd ocrd-tool "$OCRD_TOOL_JSON" tool "$OCRD_TOOL_NAME" help
9191

9292
}
9393

9494
## ### `ocrd__parse_argv`
95-
##
95+
##
9696
## Expects an associative array ("hash"/"dict") `ocrd__argv` to be defined:
97-
##
97+
##
9898
## ```sh
9999
## declare -A ocrd__argv=()
100100
## ```

ocrd/ocrd/processor/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Processor():
4343
for run-time data processing. That is, it executes a single workflow step,
4444
or a combination of workflow steps, on the workspace (represented by local METS).
4545
It reads input files for all or requested physical pages of the input fileGrp(s),
46-
and writes output files for them into the output fileGrp(s). It may take
46+
and writes output files for them into the output fileGrp(s). It may take
4747
a number of optional or mandatory parameters.
4848
"""
4949

@@ -163,12 +163,12 @@ def verify(self):
163163

164164
def process(self):
165165
"""
166-
Process the :py:attr:`workspace`
166+
Process the :py:attr:`workspace`
167167
from the given :py:attr:`input_file_grp`
168168
to the given :py:attr:`output_file_grp`
169169
for the given :py:attr:`page_id`
170170
under the given :py:attr:`parameter`.
171-
171+
172172
(This contains the main functionality and needs to be overridden by subclasses.)
173173
"""
174174
raise Exception("Must be implemented")
@@ -279,7 +279,7 @@ def input_files(self):
279279
- Otherwise raise an error (complaining that only PAGE-XML warrants
280280
having multiple images for a single page)
281281
Algorithm <https://github.com/cisocrgroup/ocrd_cis/pull/57#issuecomment-656336593>_
282-
282+
283283
Returns:
284284
A list of :py:class:`ocrd_models.ocrd_file.OcrdFile` objects.
285285
"""

ocrd/ocrd/processor/helpers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ def run_processor(
107107
mem_usage = memory_usage(proc=processor.process,
108108
# only run process once
109109
max_iterations=1,
110-
interval=.1, timeout=None, timestamps=True,
110+
interval=.1, timeout=None, timestamps=True,
111111
# include sub-processes
112-
multiprocess=True, include_children=True,
112+
multiprocess=True, include_children=True,
113113
# get proportional set size instead of RSS
114114
backend=backend)
115115
mem_usage_values = [mem for mem, _ in mem_usage]
@@ -198,7 +198,7 @@ def run_cli(
198198

199199
def generate_processor_help(ocrd_tool, processor_instance=None):
200200
"""Generate a string describing the full CLI of this processor including params.
201-
201+
202202
Args:
203203
ocrd_tool (dict): this processor's ``tools`` section of the module's ``ocrd-tool.json``
204204
processor_instance (object, optional): the processor implementation
@@ -281,7 +281,7 @@ def wrap(s):
281281

282282
# Taken from https://github.com/OCR-D/core/pull/884
283283
@freeze_args
284-
@lru_cache(maxsize=environ.get('OCRD_MAX_PROCESSOR_CACHE', 128))
284+
@lru_cache(maxsize=environ.get('OCRD_MAX_PROCESSOR_CACHE', 128))
285285
def get_cached_processor(parameter: dict, processor_class):
286286
"""
287287
Call this function to get back an instance of a processor.

ocrd/ocrd/resolver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def workspace_from_url(self, mets_url, dst_dir=None, clobber_mets=False, mets_ba
123123
download (boolean, False): Whether to also download all the files referenced by the METS
124124
src_baseurl (string, None): Base URL for resolving relative file locations
125125
126-
Download (clone) :py:attr:`mets_url` to ``mets.xml`` in :py:attr:`dst_dir`, unless
126+
Download (clone) :py:attr:`mets_url` to ``mets.xml`` in :py:attr:`dst_dir`, unless
127127
the former is already local and the latter is ``none`` or already identical to its directory name.
128128
129129
Returns:

ocrd/ocrd/resource_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ def list_installed(self, executable=None):
168168
resdict = resdict_list[0]
169169
elif str(res_filename.parent) == moduledir:
170170
resdict = {
171-
'name': res_name,
172-
'url': str(res_filename),
173-
'description': 'Found at module',
171+
'name': res_name,
172+
'url': str(res_filename),
173+
'description': 'Found at module',
174174
'type': res_type,
175175
'size': res_size
176176
}

ocrd/ocrd/task_sequence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def validate_tasks(tasks, workspace, page_id=None, overwrite=False):
108108
# TODO disable output_file_grps checks once CLI parameter 'overwrite' is implemented
109109
# XXX Thu Jan 16 20:14:17 CET 2020 still not sufficiently clever.
110110
# if len(prev_output_file_grps) != len(set(prev_output_file_grps)):
111-
# report.add_error("Output file group specified multiple times: %s" %
111+
# report.add_error("Output file group specified multiple times: %s" %
112112
# [grp for grp, count in Counter(prev_output_file_grps).items() if count >= 2])
113113
prev_output_file_grps += task.output_file_grps
114114
if not report.is_valid:

ocrd_models/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Let's say you want to add a method `get_FirstTextRegion` on the `pc:Page` elemen
3636

3737
Would add the method `exportChildren` from a file `exportChildren_PageType.py`.
3838

39-
> **Note**:
39+
> **Note**:
4040
> The method name in the file must match the method name passed to
4141
> `_add_method`. This is *not* checked automatically, so double-check manually!
4242

ocrd_models/ocrd_models/ocrd_mets.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def _clear_caches(self):
143143
self._file_cache = None
144144
self._page_cache = None
145145
self._fptr_cache = None
146-
146+
147147
def refresh_caches(self):
148148
if self._cache_flag:
149149
# Cache for the files (mets:file) - two nested dictionaries
@@ -164,11 +164,11 @@ def refresh_caches(self):
164164
# The inner dictionary's Key: 'fptr.FILEID'
165165
# The inner dictionary's Value: a 'fptr' object at some memory location
166166
self._fptr_cache = {}
167-
167+
168168
# Note, if the empty_mets() function is used to instantiate OcrdMets
169169
# Then the cache is empty even after this operation
170170
self._fill_caches()
171-
171+
172172
@property
173173
def unique_identifier(self):
174174
"""
@@ -179,7 +179,7 @@ def unique_identifier(self):
179179
found = self._tree.getroot().find('.//mods:identifier[@type="%s"]' % t, NS)
180180
if found is not None:
181181
return found.text
182-
182+
183183
@unique_identifier.setter
184184
def unique_identifier(self, purl):
185185
"""
@@ -295,7 +295,7 @@ def find_files(self, ID=None, fileGrp=None, pageId=None, mimetype=None, url=None
295295
mimetype = re.compile(mimetype[REGEX_PREFIX_LEN:])
296296
if url and url.startswith(REGEX_PREFIX):
297297
url = re.compile(url[REGEX_PREFIX_LEN:])
298-
298+
299299
candidates = []
300300
if self._cache_flag:
301301
if fileGrp:
@@ -307,7 +307,7 @@ def find_files(self, ID=None, fileGrp=None, pageId=None, mimetype=None, url=None
307307
candidates = [el_file for id_to_file in self._file_cache.values() for el_file in id_to_file.values()]
308308
else:
309309
candidates = self._tree.getroot().xpath('//mets:file', namespaces=NS)
310-
310+
311311
for cand in candidates:
312312
if ID:
313313
if isinstance(ID, str):
@@ -364,11 +364,11 @@ def add_file_group(self, fileGrp):
364364
if el_fileGrp is None:
365365
el_fileGrp = ET.SubElement(el_fileSec, TAG_METS_FILEGRP)
366366
el_fileGrp.set('USE', fileGrp)
367-
367+
368368
if self._cache_flag:
369369
# Assign an empty dictionary that will hold the files of the added fileGrp
370370
self._file_cache[fileGrp] = {}
371-
371+
372372
return el_fileGrp
373373

374374
def rename_file_group(self, old, new):
@@ -379,7 +379,7 @@ def rename_file_group(self, old, new):
379379
if el_fileGrp is None:
380380
raise FileNotFoundError("No such fileGrp '%s'" % old)
381381
el_fileGrp.set('USE', new)
382-
382+
383383
if self._cache_flag:
384384
self._file_cache[new] = self._file_cache.pop(old)
385385

@@ -427,7 +427,7 @@ def remove_file_group(self, USE, recursive=False, force=False):
427427

428428
if self._cache_flag:
429429
# Note: Since the files inside the group are removed
430-
# with the 'remove_one_file' method above,
430+
# with the 'remove_one_file' method above,
431431
# we should not take care of that again.
432432
# We just remove the fileGrp.
433433
del self._file_cache[el_fileGrp.get('USE')]
@@ -566,7 +566,7 @@ def physical_pages(self):
566566
"""
567567
if self._cache_flag:
568568
return list(self._page_cache.keys())
569-
569+
570570
return self._tree.getroot().xpath(
571571
'mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]/mets:div[@TYPE="page"]/@ID',
572572
namespaces=NS)
@@ -579,7 +579,7 @@ def get_physical_pages(self, for_fileIds=None):
579579
if for_fileIds is None:
580580
return self.physical_pages
581581
ret = [None] * len(for_fileIds)
582-
582+
583583
if self._cache_flag:
584584
for pageId in self._fptr_cache.keys():
585585
for fptr in self._fptr_cache[pageId].keys():
@@ -632,14 +632,14 @@ def set_physical_page_for_file(self, pageId, ocrd_file, order=None, orderlabel=N
632632
if el_seqdiv is None:
633633
el_seqdiv = ET.SubElement(el_structmap, TAG_METS_DIV)
634634
el_seqdiv.set('TYPE', 'physSequence')
635-
635+
636636
el_pagediv = None
637637
if self._cache_flag:
638638
if pageId in self._page_cache:
639639
el_pagediv = self._page_cache[pageId]
640640
else:
641641
el_pagediv = el_seqdiv.find('mets:div[@ID="%s"]' % pageId, NS)
642-
642+
643643
if el_pagediv is None:
644644
el_pagediv = ET.SubElement(el_seqdiv, TAG_METS_DIV)
645645
el_pagediv.set('TYPE', 'page')
@@ -651,10 +651,10 @@ def set_physical_page_for_file(self, pageId, ocrd_file, order=None, orderlabel=N
651651
if self._cache_flag:
652652
# Create a new entry in the page cache
653653
self._page_cache[pageId] = el_pagediv
654-
# Create a new entry in the fptr cache and
654+
# Create a new entry in the fptr cache and
655655
# assign an empty dictionary to hold the fileids
656656
self._fptr_cache[pageId] = {}
657-
657+
658658
el_fptr = ET.SubElement(el_pagediv, TAG_METS_FPTR)
659659
el_fptr.set('FILEID', ocrd_file.ID)
660660

@@ -715,7 +715,7 @@ def remove_physical_page_fptr(self, fileId):
715715
if self._cache_flag:
716716
for page_id in self._fptr_cache.keys():
717717
if fileId in self._fptr_cache[page_id].keys():
718-
mets_fptrs.append(self._fptr_cache[page_id][fileId])
718+
mets_fptrs.append(self._fptr_cache[page_id][fileId])
719719
else:
720720
mets_fptrs = self._tree.getroot().xpath(
721721
'mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]/mets:div[@TYPE="page"]/mets:fptr[@FILEID="%s"]' % fileId, namespaces=NS)

0 commit comments

Comments
 (0)