Support for local tables in separated directory from root dir#41
Merged
ywangd merged 1 commit intoywangd:masterfrom Mar 22, 2025
Merged
Support for local tables in separated directory from root dir#41ywangd merged 1 commit intoywangd:masterfrom
ywangd merged 1 commit intoywangd:masterfrom
Conversation
ywangd
reviewed
Mar 22, 2025
Owner
ywangd
left a comment
There was a problem hiding this comment.
Mostly looking good. I have some minor comments that I'd appreciate if they can be addressed. Thanks!
pybufrkit/__init__.py
Outdated
|
|
||
| ap.add_argument('-l', '--tables-local-directory', | ||
| help='The directory to locate local BUFR tables', | ||
| default=None) |
pybufrkit/__init__.py
Outdated
|
|
||
| ap.add_argument('-p', '--tables-local-provider', | ||
| help='The provider for local BUFR tables', | ||
| default=None) |
pybufrkit/__init__.py
Outdated
|
|
||
| ns.tables_local_directory = ns.tables_local_directory or ns.tables_root_directory | ||
| if ns.tables_local_provider: | ||
| ns.tables_local_directory = ns.tables_local_directory + "/" + ns.tables_local_provider |
Owner
There was a problem hiding this comment.
Let's use os.path.join(...) since it handles different path separator on different platforms.
pybufrkit/coder.py
Outdated
|
|
||
| self.section_configurer = SectionConfigurer(definitions_dir=definitions_dir) | ||
| self.tables_root_dir = tables_root_dir or DEFAULT_TABLES_DIR | ||
| self.tables_local_dir = tables_local_dir or tables_root_dir |
Owner
There was a problem hiding this comment.
I think this should be
Suggested change
| self.tables_local_dir = tables_local_dir or tables_root_dir | |
| self.tables_local_dir = tables_local_dir or self.tables_root_dir |
Otherwise it could still be None.
Author
|
I will rebase and do the requested changes later today.
…On Sat, Mar 22, 2025, 02:47 Yang Wang ***@***.***> wrote:
***@***.**** commented on this pull request.
Mostly looking good. I have some minor comments that I'd appreciate if
they can be addressed. Thanks!
------------------------------
In pybufrkit/__init__.py
<#41 (comment)>:
> @@ -62,6 +62,14 @@ def main():
ap.add_argument('-t', '--tables-root-directory',
help='The directory to locate BUFR tables')
+ ap.add_argument('-l', '--tables-local-directory',
+ help='The directory to locate local BUFR tables',
+ default=None)
Nit: default=None is redundant
------------------------------
In pybufrkit/__init__.py
<#41 (comment)>:
> @@ -62,6 +62,14 @@ def main():
ap.add_argument('-t', '--tables-root-directory',
help='The directory to locate BUFR tables')
+ ap.add_argument('-l', '--tables-local-directory',
+ help='The directory to locate local BUFR tables',
+ default=None)
+
+ ap.add_argument('-p', '--tables-local-provider',
+ help='The provider for local BUFR tables',
+ default=None)
Same here
------------------------------
In pybufrkit/__init__.py
<#41 (comment)>:
> @@ -261,6 +269,10 @@ def main():
ns = ap.parse_args()
+ ns.tables_local_directory = ns.tables_local_directory or ns.tables_root_directory
+ if ns.tables_local_provider:
+ ns.tables_local_directory = ns.tables_local_directory + "/" + ns.tables_local_provider
Let's use os.path.join(...) since it handles different path separator on
different platforms.
------------------------------
In pybufrkit/coder.py
<#41 (comment)>:
>
self.section_configurer = SectionConfigurer(definitions_dir=definitions_dir)
self.tables_root_dir = tables_root_dir or DEFAULT_TABLES_DIR
+ self.tables_local_dir = tables_local_dir or tables_root_dir
I think this should be
⬇️ Suggested change
- self.tables_local_dir = tables_local_dir or tables_root_dir
+ self.tables_local_dir = tables_local_dir or self.tables_root_dir
Otherwise it could still be None.
—
Reply to this email directly, view it on GitHub
<#41 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABR6CQTBGGS56JUA5SUL5GT2VS6JZAVCNFSM6AAAAABZFMVF5KVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDOMBXGYZDIMBXGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
47bcd9d to
d269d89
Compare
d269d89 to
c0dd176
Compare
Author
|
I made the changes and force-pushed it to my branch. |
ywangd
approved these changes
Mar 22, 2025
Owner
ywangd
left a comment
There was a problem hiding this comment.
Thanks. Looks good to me. I'll be merging this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Behavior change on command line tool:
New command line switches:
-l -> Path for local tables
-p -> Provider of local table
The user can select a separate path and provider for local tables.
Behavior change on library:
A new parameter was added to Encode and Decode classes:
tables_local_dir: Path to search for local tables. Default is the same value astables_root_dir. Here the path should already contain theproviderof the table.Suggest directory structure: