Skip to content

Commit 9e13c21

Browse files
Merge branch 'issue151' of https://github.com/dimitri-yatsenko/datajoint-python into issue151
2 parents ce3e4ab + d1dd910 commit 9e13c21

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

datajoint/utils.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,20 @@ def user_choice(prompt, choices=("yes", "no"), default=None):
3131
return response
3232

3333

34-
def get_master(full_table_name):
34+
def get_master(full_table_name: str) -> str:
3535
"""
3636
If the table name is that of a part table, then return what the master table name would be.
37-
:param full_table_name:
38-
:return: Supposed master full table name or empty string if not a part table name.
39-
4037
This follows DataJoint's table naming convention where a master and a part must be in the
41-
same schema and the part table is prefixed with the mater table name + '__'.
38+
same schema and the part table is prefixed with the master table name + ``__``.
4239
4340
Example:
4441
`ephys`.`session` -- master
4542
`ephys`.`session__recording` -- part
43+
44+
:param full_table_name: Full table name including part.
45+
:type full_table_name: str
46+
:return: Supposed master full table name or empty string if not a part table name.
47+
:rtype: str
4648
"""
4749
match = re.match(r'(?P<master>`\w+`.`\w+)__(?P<part>\w+)`', full_table_name)
4850
return match['master'] + '`' if match else ''

0 commit comments

Comments
 (0)