Skip to content

Commit

Permalink
Small edits, code formatting and typos (#270)
Browse files Browse the repository at this point in the history
* Small edits, code formatting and typos

* revert meta to MetaData

* fix spelling error

* Update docs/source/quickstart.rst

Co-authored-by: qubixes <44498096+qubixes@users.noreply.github.com>

---------

Co-authored-by: Staiger, Christine <christine.staiger@wur.nl>
Co-authored-by: qubixes <44498096+qubixes@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 8, 2024
1 parent 5743fba commit 2b78696
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ irods-basicGUI/logs/*
irods-iBridgesGui.spec
*DS_Store
docs/source/api/generated
docs/outputdir

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
22 changes: 11 additions & 11 deletions docs/source/data_transfers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ collections, :meth:`IrodsPath.create_collection` can be used.
.. note::
By default, no data will be overwritten. If you want to overwrite data, you
can set :code:`overwrite=True`. Beware that you can also overwrite newer data with older data this way.
If a file and a dataobject are exactly the same, iBridges will silently skip the transfer,
If a file and a dataobject are exactly the same, iBridges will skip the transfer and print a warning,
thereby saving time.

For all operations, iBridges will check that the transfer has been completed without
Expand All @@ -34,7 +34,7 @@ If the transfer concerned a folder, a new collection with the folder name will b
from ibridges import IrodsPath
from pathlib import Path
local_path = Path("/path/to the/data/to/upload")
local_path = Path("/path/to/the/data/to/upload")
irods_path = IrodsPath(session, '~', 'new_coll')
upload(session, local_path, irods_path)
Expand Down Expand Up @@ -114,13 +114,12 @@ With the `python-irodsclient` which `iBridges` is built on, we can open the file
That works without any problems for textual data.

.. code-block:: python
from ibridges import IrodsPath
obj_path = IrodsPath(session, "path", "to", "object")
with obj_path.open('r') as stream:
content = stream.read().decode()
obj_path = IrodsPath(session, "path", "to", "object")
with obj_path.open('r') as stream:
content = stream.read().decode()
Some python libraries allow to be instantiated directly from such a stream. This is supported by e.g. `pandas`, `polars` and `whisper`.
Expand All @@ -129,6 +128,7 @@ Some python libraries allow to be instantiated directly from such a stream. This
import pandas as pd
with obj_path.open('r') as stream:
df = pd.read_csv(stream)
print(df)
with obj_path.open('r') as stream:
df = pd.read_csv(stream)
print(df)
2 changes: 1 addition & 1 deletion docs/source/ipath.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ We strongly recommend using :class:`IrodsPath` over using strings for the follow

- :class:`IrodsPath` is **safer** since it takes care of the correct concatenation of parts of the path.
- :class:`IrodsPath` is **more convenient** since there are many methods and attributes available such as: the name, size and parent of the iRODS path.
- The string representation of the :class:`Irodspath` is available through :code:`str(ipath)`.
- The string representation of the :class:`IrodsPath` is available through :code:`str(ipath)`.

A complete tutorial on iRODS paths can be followed `here <https://github.com/UtrechtUniversity/iBridges/tree/main/tutorials>`__. For an overview of
all functionality connected to the :class:`IrodsPath`, see the :doc:`API documentation <api/generated/ibridges.path.IrodsPath>`.
Expand Down
15 changes: 7 additions & 8 deletions docs/source/irods_search.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ In the example below we search for a data object by its path pattern.
The path is a string:

.. code-block:: python
from ibridges import search_data
search_data(session, path="/", path_pattern="dataobj_name")
from ibridges import search_data
search_data(session, path="/", path_pattern="dataobj_name")
The result is a list of iRODS paths that indicate the locations of the found collections and data objects.

To find all subcollections and dataobjects in a collection use the `%` as wildcard:

.. code-block:: python
search_data(session, path_pattern="subcoll/%")
search_data(session, path_pattern="subcoll/%")
Search data by metadata
Expand All @@ -42,19 +42,18 @@ To search by metadata we need to create a :class:`ibridges.search.MetaSearch` fo
MetaSearch(key="my_key", value="my_value", units="my_units")
The above statement means: find all data objects and collections which is annotated with a key "my_key" where the value is "my_value" and the units is "my_units".
The above statement means: find all data objects and collections which are annotated with a key "my_key" where the value is "my_value" and the units is "my_units".

You can also omit any of the three items which will be interpreted as "anything". E.g.

.. code-block:: python
MetaSearch(value="my_value")
means: find all data which is labeled with any key where the value is "my_value" and the units can also be anything. Here again you can also use wild cards.
This translates to: find all data which are labeled with any key where the value is "my_value" and the units can also be anything. Here again you can also use wild cards.

A query with metadata will look like:


.. code-block:: python
# Search for items with an entry that has key=="key" and any value or units.
Expand Down
6 changes: 3 additions & 3 deletions docs/source/metadata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Metadata
.. currentmodule:: ibridges.meta

iRODS offers metadata as key, value, units triplets. The type of the keys, values and units is always a string.
Below we show how to create a :doc:`Metadata <api/generated/ibridges.meta.MetaData>` object from a dataobject or collection.
Below we show how to create a :doc:`Metadata <api/generated/ibridges.meta.MetaData>` object from a data object or collection.

The Metadata object
--------------------
Expand All @@ -21,7 +21,7 @@ With the object :code:`meta` we can now access and manipulate the metadata of th

Add metadata
------------
To add metadata, you always need to provide a key and a value, the unit is optional and can be left out.
To add metadata, you always need to provide a key and a value, the units are optional and can be left out.

.. code-block:: python
Expand All @@ -32,7 +32,7 @@ To add metadata, you always need to provide a key and a value, the unit is optio
.. note::
You can have several metadata entries with the same key but different values and units,
i.e. metadata keys are not unique in iRODS but the combination of key,
value and unit must be unique.
value and units must be unique.

Set metadata
------------
Expand Down
10 changes: 5 additions & 5 deletions docs/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Python Installation

iBridges requires Python version 3.8 or higher. There are many ways to install Python, also depending on your operating system.
Any of these methods can work, but the path/environment needs to be set correctly so that the commands below work. For users
that are completely unfamiliar with Python and have never installed it, we recommend the installing `Anaconda <https://www.anaconda.com/download/success>`__.
that are completely unfamiliar with Python and have never installed it, we recommend installing `Anaconda <https://www.anaconda.com/download/success>`__.

.. note::
Beware of the difference between the command line prompt and the python console. The command line prompt, which might also be called
Expand All @@ -17,7 +17,7 @@ that are completely unfamiliar with Python and have never installed it, we recom

To check whether your installation works correctly you can execute the following commands on the command line:

.. code::bash
.. code:: bash
python --version
pip --version
Expand Down Expand Up @@ -92,7 +92,7 @@ Please ask your iRODS admin or service provider how to set up the `irods_environ
Connecting to your iRODS server
-------------------------------

To connect to your iRods server, we will create a session. The session is the central object in the iBridges library;
To connect to your iRODS server, we will create a session. The session is the central object in the iBridges library;
almost all functionality is enabled with this connection to your server. Generally you will create a session,
perform your data operations, and then delete/close the session. To create a new session, open Python:

Expand All @@ -115,7 +115,7 @@ You can easily upload your data with the previously created session:
upload(session, "/your/local/path", "/irods/path")
This upload function can upload both directories (collections in iRODS) and files (data objects in iRods).
This upload function can upload both directories (collections in iRODS) and files (data objects in iRODS).


Add metadata
Expand All @@ -131,7 +131,7 @@ Let's add some metadata to a collection or data object:
ipath = IrodsPath(session, "/irods/path")
ipath.meta.add("some_key", "some_value", "some_units")
We have used the :code:`IrodsPath` class here, which is central to the iBridges API. From here we have
We have used the :code:`IrodsPath` class here, which is another central class to the iBridges API. From here we have
access to the metadata as shown above, but additionally there are many more convenient features directly accessible
such as getting the size of a collection or data object. A detailed description of the features is present in
another part of the :doc:`documentation <ipath>`.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/session.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ We will have a closer look at the :class:`Session.home` below.
The Session home
----------------

The :class:`Session.home` denotes your iRODS working path. For any relative paths that are created using an
The :class:`Session.home` denotes your iRODS working path and can be referred to with `~`. For any relative paths that are created using an
:doc:`IrodsPath <ipath>`, the path will be relative to the :class:`Session.home` that you have set.

There are three ways to set the irods_home:
Expand Down

0 comments on commit 2b78696

Please sign in to comment.