Skip to content

Commit

Permalink
Add some hive API docstrings. (#1285)
Browse files Browse the repository at this point in the history
* Add some hive API docstrings.

* Fix osx CI coverage support
  • Loading branch information
vEpiphyte authored Jun 21, 2019
1 parent 7690ce4 commit 2e811bf
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ commands:
circleci tests glob synapse/tests/test_*.py | circleci tests split --split-by=timings | xargs python3 -m pytest -v -s -rs --durations 6 --maxfail 6 -p no:logging --junitxml=test-reports/junit.xml ${COVERAGE_ARGS}
- codecov/upload:
file: /home/circleci/repo/coverage.xml
file: /Users/distiller/repo/coverage.xml

- store_test_results:
path: test-reports
Expand Down Expand Up @@ -282,7 +282,7 @@ jobs:
COVERAGE_ARGS: --cov synapse --no-cov-on-fail --cov-report=xml
PYVERS: 3.7

working_directory: ~/repo
working_directory: /Users/distiller/repo

steps:
- test_steps_osx
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Synapse Changelog
*****************

v0.1.14 - TBD
v0.1.14 - 2019-06-21
====================

Features and Enhancements
Expand All @@ -19,6 +19,7 @@ Improved Documentation
----------------------

- Add additional logging for ReadTheDocs documentation builds. (`#1284 <https://github.com/vertexproject/synapse/pull/1284>`_)
- Add additional Hive API docstrings. (`#1285 <https://github.com/vertexproject/synapse/pull/1285>`_)


v0.1.13 - 2019-06-18
Expand Down
33 changes: 33 additions & 0 deletions synapse/lib/hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ async def fini():
self.editsbypath[path].add(func)

async def get(self, full):
'''
Get the value of a node at a given path.
Args:
full (tuple): A full path tuple.
Returns:
Arbitrary node value.
'''

node = self.nodes.get(full)
if node is None:
Expand All @@ -152,6 +161,18 @@ async def get(self, full):
return node.valu

def dir(self, full):
'''
List subnodes of the given Hive path.
Args:
full (tuple): A full path tuple.
Notes:
This returns None if there is not a node at the path.
Returns:
list: A list of tuples. Each tuple contains the name, node value, and the number of children nodes.
'''
node = self.nodes.get(full)
if node is None:
return None
Expand All @@ -161,6 +182,12 @@ def dir(self, full):
async def dict(self, full):
'''
Open a HiveDict at the given full path.
Args:
full (tuple): A full path tuple.
Returns:
HiveDict: A HiveDict for the full path.
'''
node = await self.open(full)
return await HiveDict.anit(self, node)
Expand Down Expand Up @@ -199,6 +226,12 @@ async def _loadNodeValu(self, full, valu):
async def open(self, full):
'''
Open and return a hive Node().
Args:
full (tuple): A full path tuple.
Returns:
Node: A Hive node.
'''
return await self._getHiveNode(full)

Expand Down

0 comments on commit 2e811bf

Please sign in to comment.