GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — New Alias System: Add the private _to_string function by seisman · Pull Request #3986 · GenericMappingTools/pygmt Conversation
|
| match mapping: | ||
| case False: | ||
| pass | ||
| case True: | ||
| value = value[0] | ||
| case Mapping(): | ||
| if value not in mapping and value not in mapping.values(): | ||
| raise GMTValueError( | ||
| value, | ||
| description="value for parameter {name!r}" if name else "value", | ||
| choices=mapping.keys(), | ||
| ) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
mapping=True means using the first letter of a long-form argument as its short-form argument. For example, resolution="high" will be mapped to resolution="h". If we don't support mapping=True, lines 112-123 can be simplified to a few lines:
if value not in mapping and value not in mapping.values(): raise GMTValueError( value, description="value for parameter {name!r}" if name else "value", choices=mapping.keys(), )
but without mapping=True, we need to write something like
mapping={"full": "f", "high": "h", "intermediate": "i", "low": "l", "crude": "c"}
when calling the _to_string function.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think better to be explicit (use the full mapping {"key": "value"} dict), and just have one way to parse things. We can use the first letter for resolution, but for others like interpolation/-n, where the mapping is {"b-spline": "b", "bicubic": "c", "bilinear": "l", ...}, it doesn't work.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I've removed mapping=True in commit c499aab.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This looks ok to me, was there anything else you wanted to add?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Need to wait for #3985 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.