Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Dynamic Exposure
rabotnik
rcom
Commits
ab6b094d
Commit
ab6b094d
authored
Apr 30, 2021
by
Felix Delattre
Browse files
Renamed rcli to rcom and prepared for publication
parent
4fd12267
Pipeline
#40519
passed with stage
in 1 minute and 48 seconds
Changes
12
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
ab6b094d
...
...
@@ -19,7 +19,7 @@ test:
coverage
:
script
:
-
pytest --cov=rc
li
/ tests/
-
pytest --cov=rc
om
/ tests/
-
coverage xml
artifacts
:
reports
:
...
...
README.rst
View file @
ab6b094d
===============================
rabotnik command line interface
===============================
====
rcom
====
A command line interface for `rabotnik <https://git.gfz-potsdam.de/dynamicexposure/rabotnik/rabotnik>`__.
Copyright and copyleft
----------------------
...
...
rc
li
/__init__.py
→
rc
om
/__init__.py
View file @
ab6b094d
File moved
rc
li
/argument_base.py
→
rc
om
/argument_base.py
View file @
ab6b094d
File moved
rc
li
/argument_factory.py
→
rc
om
/argument_factory.py
View file @
ab6b094d
File moved
rc
li
/arguments/__init__.py
→
rc
om
/arguments/__init__.py
View file @
ab6b094d
File moved
rc
li
/arguments/building_id.py
→
rc
om
/arguments/building_id.py
View file @
ab6b094d
File moved
rc
li
/arguments/building_ids_file.py
→
rc
om
/arguments/building_ids_file.py
View file @
ab6b094d
File moved
rc
li
/rc
li
.py
→
rc
om
/rc
om
.py
View file @
ab6b094d
...
...
@@ -28,15 +28,15 @@ from .argument_factory import ArgumentFactory
logger
=
logging
.
getLogger
(
__name__
)
class
RC
LI
:
"""The Rabotnik Command-Line Interface (RC
LI
).
class
RC
OM
:
"""The Rabotnik Command-Line Interface (RC
OM
).
Communicate with nodes running within the `rabotnik` ecosystem via the `message_bus`.
Args:
parser: Creates and parses command line arguments.
Attributes:
arguments: The arguments that are made available in the rc
li
.
arguments: The arguments that are made available in the rc
om
.
"""
def
__init__
(
self
,
parser
:
argparse
.
ArgumentParser
):
...
...
@@ -73,7 +73,7 @@ class RCLI:
def
main
(
args
:
list
=
None
,
message_bus
:
MessageBus
=
None
):
"""RC
LI
entry point.
"""RC
OM
entry point.
Args:
args: List of arguments. If not provided, read arguments from commandline
...
...
@@ -88,8 +88,8 @@ def main(args: list = None, message_bus: MessageBus = None):
args
=
args
or
sys
.
argv
[
1
:]
parser
=
argparse
.
ArgumentParser
()
rc
li
=
RC
LI
(
parser
=
parser
)
rc
li
.
setup_parser
()
rc
om
=
RC
OM
(
parser
=
parser
)
rc
om
.
setup_parser
()
group
=
parser
.
add_argument_group
(
"message bus"
)
...
...
@@ -131,9 +131,9 @@ def main(args: list = None, message_bus: MessageBus = None):
)
)
rc
li
.
set_message_bus
(
message_bus
)
rc
om
.
set_message_bus
(
message_bus
)
# Parse `args` to dictionary.
args_dict
=
vars
(
args
)
loop
.
run_until_complete
(
rc
li
.
execute
(
args_dict
))
loop
.
run_until_complete
(
rc
om
.
execute
(
args_dict
))
setup.py
View file @
ab6b094d
#!/usr/bin/python3
#!/usr/bin/
env
python3
from
setuptools
import
setup
,
find_packages
# Copyright (c) 2020-2021
#
# * Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
setuptools
import
setup
,
find_packages
tests_require
=
[
"pytest"
,
...
...
@@ -13,20 +29,19 @@ tests_require = [
linters_require
=
[
"pylint"
,
"pre-commit"
]
setup
(
name
=
"rc
li
"
,
version
=
"0.
1
"
,
description
=
"
Rabotnik
command
-
line interface"
,
name
=
"rc
om
"
,
version
=
"0.
0.3
"
,
description
=
"
A
command
line interface
for rabotnik.
"
,
author
=
"Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ"
,
url
=
"https://git.gfz-potsdam.de/dynamicexposure/rabotnik/rcom"
,
license
=
"AGPLv3+"
,
install_requires
=
[
"rabotnik@https://git.gfz-potsdam.de/dynamicexposure/rabotnik/rabotnik/-/archive/master/rabotnik-master.zip"
# noqa: E501
],
install_requires
=
[
"rabotnik==0.0.3"
],
tests_require
=
tests_require
,
extras_require
=
{
"tests"
:
tests_require
,
"linters"
:
linters_require
,
},
entry_points
=
{
"console_scripts"
:
[
"rc
li
= rc
li
.rc
li
:main"
]},
entry_points
=
{
"console_scripts"
:
[
"rc
om
= rc
om
.rc
om
:main"
]},
packages
=
find_packages
(),
python_requires
=
">=3.6"
,
)
tests/test_arguments.py
View file @
ab6b094d
...
...
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
from
rc
li
.argument_base
import
ArgumentBase
from
rc
om
.argument_base
import
ArgumentBase
def
test_get_format_argument
():
...
...
tests/test_rc
li
.py
→
tests/test_rc
om
.py
View file @
ab6b094d
...
...
@@ -20,7 +20,7 @@ import asyncio
import
pytest
import
argparse
from
rc
li
.rc
li
import
RC
LI
from
rc
om
.rc
om
import
RC
OM
class
MockMessageBus
:
...
...
@@ -34,19 +34,19 @@ class MockMessageBus:
@
pytest
.
mark
.
asyncio
async
def
test_rc
li
():
async
def
test_rc
om
():
message_bus
=
MockMessageBus
()
parser
=
argparse
.
ArgumentParser
()
rc
li
=
RC
LI
(
parser
=
parser
)
rc
li
.
set_message_bus
(
message_bus
)
rc
om
=
RC
OM
(
parser
=
parser
)
rc
om
.
set_message_bus
(
message_bus
)
rc
li
.
setup_parser
()
rc
om
.
setup_parser
()
help_formatted
=
parser
.
format_help
()
assert
help_formatted
.
startswith
(
"usage:"
)
arguments
=
{
"building_id"
:
"1"
}
await
rc
li
.
execute
(
arguments
)
await
rc
om
.
execute
(
arguments
)
assert
message_bus
.
calls
==
[((),
{
"message"
:
"building"
,
"payload"
:
{
"building_id"
:
"1"
}})]
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment