instance_id stringlengths 10 57 | file_changes listlengths 1 15 | repo stringlengths 7 53 | base_commit stringlengths 40 40 | problem_statement stringlengths 11 52.5k | patch stringlengths 251 7.06M |
|---|---|---|---|---|---|
haddocking__arctic3d-342 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"src/arctic3d/cli.py:main"
],
"edited_modules": [
"src/arctic3d/cli.py:main"
]
},
"file": "src/arctic3d/cli.py"
},
{
"changes": {
"added_entities": null,
... | haddocking/arctic3d | 0803e508d036561edc7c098e631941fe5ba12aaa | allow users to modify the interface coverage cutoff
70% default interface coverage cutoff is quite arbitrary, we should leave it as a free parameter | diff --git a/src/arctic3d/cli.py b/src/arctic3d/cli.py
index 3a7b3d9..01b5060 100644
--- a/src/arctic3d/cli.py
+++ b/src/arctic3d/cli.py
@@ -121,6 +121,14 @@ argument_parser.add_argument(
default=0,
)
+argument_parser.add_argument(
+ "--int_cov_cutoff",
+ help="Interface coverage cutoff (%)",
+ type=fl... |
haddocking__arctic3d-99 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"src/arctic3d/cli.py:main"
],
"edited_modules": [
"src/arctic3d/cli.py:main"
]
},
"file": "src/arctic3d/cli.py"
},
{
"changes": {
"added_entities": [
... | haddocking/arctic3d | e8cdbd1d00dec74c19874c319d9097028332261f | include probability in the output
when several interfaces are clustered together, the list of clustered residues can be quite long.
An example is can be found by running
`arctic3d example/1ppe_E.fasta --db db/swissprot`
48 interfaces can be found. 46 of them are clustered together. They are indeed similar, altho... | diff --git a/src/arctic3d/cli.py b/src/arctic3d/cli.py
index da52d4c..9612f52 100644
--- a/src/arctic3d/cli.py
+++ b/src/arctic3d/cli.py
@@ -12,7 +12,7 @@ from arctic3d.modules.input import Input
from arctic3d.modules.interface import get_interface_residues, read_interface_residues
# from arctic3d.modules.output im... |
haginara__ssh_config-25 | [
{
"changes": {
"added_entities": [
"ssh_config/client.py:Host.persist_attributes"
],
"added_modules": null,
"edited_entities": [
"ssh_config/client.py:Host.__init__",
"ssh_config/client.py:SSHConfig.write"
],
"edited_modules": [
"ssh_config/cli... | haginara/ssh_config | be893bc61387f75d56467e0cb50cd38aa7478d6f | Fix "KeyError: 'No'" for "No" values
It is better to change the line at
https://github.com/haginara/ssh_config/blob/be893bc61387f75d56467e0cb50cd38aa7478d6f/ssh_config/keywords.py#L19
to the following. Otherwise, "No" values would run into `KeyError: 'No'` errors.
```python
convert[value.lower()]
```
I su... | diff --git a/ssh_config/client.py b/ssh_config/client.py
index 5084e87..0032a17 100644
--- a/ssh_config/client.py
+++ b/ssh_config/client.py
@@ -114,9 +114,10 @@ class Host:
self.set_name(name)
self.__attrs = {}
attrs = {key.upper(): value for key, value in attrs.items()}
- for attr, a... |
halcy__Mastodon.py-162 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"mastodon/Mastodon.py:Mastodon.__api_request"
],
"edited_modules": [
"mastodon/Mastodon.py:Mastodon"
]
},
"file": "mastodon/Mastodon.py"
}
] | halcy/Mastodon.py | 8b8626978752baf14347498640b2319db832145e | "string indices must be integers" when handling an error
```
TypeError('string indices must be integers',)
Traceback (most recent call last):
...
File "/home/codl/forget/libforget/mastodon.py", line 165, in refresh_posts
status = api.status(post.mastodon_id)
File "</home/codl/.local/share/virtualenvs/... | diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index fc585ba..37e35b7 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -2214,9 +2214,12 @@ class Mastodon:
if not response_object.ok:
try:
response = response_object.json(object_hook=self.__json_h... |
halcy__Mastodon.py-233 | [
{
"changes": {
"added_entities": [
"mastodon/Mastodon.py:AttribAccessList.__getattr__",
"mastodon/Mastodon.py:AttribAccessList.__setattr__"
],
"added_modules": [
"mastodon/Mastodon.py:AttribAccessList"
],
"edited_entities": [
"mastodon/Mastodon.py:Ma... | halcy/Mastodon.py | 002c6511a7c6a340efdaee15849a31afa38871fc | Call to domain_blocks is broken, because returning "rel"="pref" does not work
I've a blocked domain in my account and a call to
~~~python
mastodon.domain_blocks()
~~~
runs in an error:
~~~
Traceback (most recent call last):
File "C:\Users\aritt\AppData\Roaming\JetBrains\IdeaIC2021.3\plugins\python-ce\he... | diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 8b0afb3..0922a6f 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -120,10 +120,27 @@ class AttribAccessDict(dict):
raise AttributeError("Attribute-style access is read only")
super(AttribAccessDict, self).__setattr__(att... |
hamcrest__PyHamcrest-129 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"src/hamcrest/core/core/raises.py:Raises.__init__",
"src/hamcrest/core/core/raises.py:Raises._call_function",
"src/hamcrest/core/core/raises.py:Raises.describe_mismatch",
"src/ham... | hamcrest/PyHamcrest | eb746246a13c4abd6141c6ab45724ec1c4a2efbe | How to match exception properties?
I have a webapp with helper methods that raises `bottle.HTTPError` and I want to ensure that a raised exception has a `status_code` property, but it seems the calling/raises pair cannot directly assert this? E.g. something like
```
assert_that(
calling(helper).with_args(broken_... | diff --git a/src/hamcrest/core/core/raises.py b/src/hamcrest/core/core/raises.py
index efe9e6c..67ec46c 100644
--- a/src/hamcrest/core/core/raises.py
+++ b/src/hamcrest/core/core/raises.py
@@ -13,8 +13,11 @@ __license__ = "BSD, see License.txt"
class Raises(BaseMatcher[Callable[..., Any]]):
- def __init__(self,... |
hamnis__maven-artifact-18 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "src/maven_artifact/__init__.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"src/m... | hamnis/maven-artifact | d3afad866539de23e9700af8c1c6b148309b0091 | Add initial unit tests and configure with GitHub Actions
Create a MWE with:
- [ ] Unit tests
- [ ] GitHub Actions | diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml
index 413c1ef..ea5587a 100644
--- a/.github/workflows/linting.yml
+++ b/.github/workflows/linting.yml
@@ -18,3 +18,6 @@ jobs:
run: hatch run lint:black --check --verbose src tests
- name: Run flake8 linter
run: hatch run... |
happyleavesaoc__python-snapcast-55 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"snapcast/control/group.py:Snapgroup.friendly_name"
],
"edited_modules": [
"snapcast/control/group.py:Snapgroup"
]
},
"file": "snapcast/control/group.py"
}
] | happyleavesaoc/python-snapcast | f362e4abfe6ab71bb87ca427d687d87ead1f44b2 | [discussion] Group friendly name
At the moment the friendly name of a group is either the name (if manually set) or the stream name: `return self.name if self.name != '' else self.stream`
By default there are no names set and multiple groups could have the same stream, thus showing the same friendly name. In my opinio... | diff --git a/snapcast/control/group.py b/snapcast/control/group.py
index 47999ea..1000a69 100644
--- a/snapcast/control/group.py
+++ b/snapcast/control/group.py
@@ -105,7 +105,8 @@ class Snapgroup():
@property
def friendly_name(self):
"""Get friendly name."""
- return self.name if self.name !=... |
happyleavesaoc__python-snapcast-64 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"snapcast/control/group.py:Snapgroup.friendly_name"
],
"edited_modules": [
"snapcast/control/group.py:Snapgroup"
]
},
"file": "snapcast/control/group.py"
},
{
"c... | happyleavesaoc/python-snapcast | 9c8f97cea23015ab2414e9eee43926eca5878634 | Exceptions thrown when debug logging is enabled
When logging is configured for DEBUG the following exceptions are thrown upon connecting to my Snapcast server.
```
DEBUG:snapcast.control.server:connected to snapserver on wyseguy:1705
DEBUG:snapcast.control.server:stream found: Snapstream (UPnP)
DEBUG:snapcast.con... | diff --git a/snapcast/control/group.py b/snapcast/control/group.py
index 7935b2f..3b9a8be 100644
--- a/snapcast/control/group.py
+++ b/snapcast/control/group.py
@@ -105,8 +105,10 @@ class Snapgroup():
@property
def friendly_name(self):
"""Get friendly name."""
- return self.name if self.name !... |
happyleavesaoc__python-snapcast-67 | [
{
"changes": {
"added_entities": [
"snapcast/control/server.py:Snapserver.stream_add_stream",
"snapcast/control/server.py:Snapserver.stream_remove_stream"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"snapcast/control/server.py:Snap... | happyleavesaoc/python-snapcast | 837b3e24e5e3658cde00e5ab0de2116897e75f0f | Snapcast 0.16.x features
Hi, I just wanted to document that there's some new features in snapcast 0.16.0 that would be great to integrate into this project. See https://github.com/badaix/snapcast/blob/master/changelog.md#version-0160
Notable changes:
* Streams can be added and removed
* Group names can be changed... | diff --git a/snapcast/control/server.py b/snapcast/control/server.py
index 80bfdfe..0bfc537 100644
--- a/snapcast/control/server.py
+++ b/snapcast/control/server.py
@@ -44,6 +44,8 @@ STREAM_CONTROL = 'Stream.Control' # not yet implemented
STREAM_SETMETA = 'Stream.SetMeta' # deprecated
STREAM_ONUPDATE = 'Stream.OnUp... |
harlowja__fasteners-23 | [
{
"changes": {
"added_entities": [
"fasteners/process_lock.py:_InterProcessLock._trylock",
"fasteners/process_lock.py:_InterProcessLock._unlock",
"fasteners/process_lock.py:_WindowsLock._trylock",
"fasteners/process_lock.py:_WindowsLock._unlock",
"fasteners/process_... | harlowja/fasteners | 8b63aafd5a9cde3e506810b5df52174d016edd2d | Process Lock tests assume POSIX
The `test_process_lock` module assumes we're on a POSIX system.
It *looks* like it can be fixed pretty easily, but I really don't know much about the details of locking on various platforms.
Here we import `fcntl`: https://github.com/harlowja/fasteners/blob/master/fasteners/tests/t... | diff --git a/fasteners/process_lock.py b/fasteners/process_lock.py
index b5b7405..72e4f4d 100644
--- a/fasteners/process_lock.py
+++ b/fasteners/process_lock.py
@@ -214,30 +214,44 @@ class _InterProcessLock(object):
return os.path.exists(self.path)
def trylock(self):
- raise NotImplementedError()... |
has2k1__mizani-18 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"mizani/breaks.py:_log_sub_breaks.__call__"
],
"edited_modules": [
"mizani/breaks.py:_log_sub_breaks"
]
},
"file": "mizani/breaks.py"
}
] | has2k1/mizani | f98cd6f4e8c452096f489bece84586fdbb041365 | breaks.log_breaks errors for narrow range if base=2
The following code:
```{python}
x = [
1.768712, 1.7549, 1.836442, 1.79616, 1.57543, 1.519078, 1.861349, 1.905086,
1.86907, 1.818797, 0.588072, 0.723217, 0.636356, 0.707729, 0.681214, 0.79747,
0.961983, 0.985598, 1.027589, 1.102333
]
limits = min... | diff --git a/mizani/breaks.py b/mizani/breaks.py
index ecb7e4d..624b6d7 100644
--- a/mizani/breaks.py
+++ b/mizani/breaks.py
@@ -221,7 +221,7 @@ class _log_sub_breaks:
return np.min(np.diff(log_arr))
if self.base == 2:
- return base ** np.arange(_min, _max+1)
+ return base ... |
hasgeek__coaster-178 | [
{
"changes": {
"added_entities": [
"coaster/sqlalchemy/statemanager.py:AbortTransition.__init__"
],
"added_modules": [
"coaster/sqlalchemy/statemanager.py:AbortTransition"
],
"edited_entities": [
"coaster/sqlalchemy/statemanager.py:StateTransition.__set_name... | hasgeek/coaster | 8864fb07e070b40886eecf1ed29b683ca538c16d | StateManager needs an AbortTransition exception
If a transition does `raise AbortTransition(result)`, the state should not change, and the `result` should be returned to the caller as the return value of the transition method.
The anticipated use case is that callers will use something like `success = obj.transition... | diff --git a/.gitignore b/.gitignore
index 5e6c4a0..f1aea8c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,4 @@ error.log
__pycache__
.pytest_cache
.cache
+.vscode
diff --git a/coaster/sqlalchemy/statemanager.py b/coaster/sqlalchemy/statemanager.py
index de2f75e..a2a5f0e 100644
--- a/coaster/sqlalchemy/statem... |
hasgeek__coaster-198 | [
{
"changes": {
"added_entities": [
"coaster/sqlalchemy/mixins.py:UuidMixin.huuid"
],
"added_modules": null,
"edited_entities": [
"coaster/sqlalchemy/mixins.py:UuidMixin.url_id",
"coaster/sqlalchemy/mixins.py:BaseIdNameMixin.url_id_name",
"coaster/sqlalchem... | hasgeek/coaster | 837b984370ed0a06511dd7a3b31f61e340d7cb4d | UuidMixin conflicts with BaseScopedIdMixin and BaseScopedIdNameMixin
The conflict derives from conflicting uses of the `url_id` attribute. Both mixins provide it, but one provides a column while the other provides a rendering of a UUID.
In the migration from Talkfunnel.com to HasGeek.com, we want to use both simulta... | diff --git a/CHANGES.rst b/CHANGES.rst
index 601d3d4..f29b756 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -24,6 +24,7 @@
* New: ``coaster.utils.classmethodproperty``: like a property, but for class
methods
* New: ``coaster.views.endpoint_for``: discover an endpoint given a URL
+* Changed: ``UuidMixin`` no longer... |
hasgeek__coaster-200 | [
{
"changes": {
"added_entities": [
"coaster/sqlalchemy/mixins.py:UrlForMixin.absolute_url"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"coaster/sqlalchemy/mixins.py:UrlForMixin"
]
},
"file": "coaster/sqlalchemy/mixins.py"
}... | hasgeek/coaster | 02a76cd93fc2e777d5ada4244618fbdcdfdfbb30 | url property for models
Any REST API we build will require a `url` property for all the entity types. Coaster can provide it as a mixin. The `url` property will essentially return `self.url_for(_external=True)`. | diff --git a/CHANGES.rst b/CHANGES.rst
index f29b756..37a6299 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -25,6 +25,8 @@
methods
* New: ``coaster.views.endpoint_for``: discover an endpoint given a URL
* Changed: ``UuidMixin`` no longer provides ``url_id``
+* New: ``coaster.sqlalchemy.UrlForMixin`` now provides a... |
hasgeek__coaster-203 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"coaster/sqlalchemy/mixins.py:UrlForMixin.url_for",
"coaster/sqlalchemy/mixins.py:UrlForMixin.is_url_for"
],
"edited_modules": [
"coaster/sqlalchemy/mixins.py:UrlForMixin"
... | hasgeek/coaster | bf25849ad2123e8fd4166f263ce3eac49f72f57d | UrlForMixin should register views on a pre-app basis
In Funnel we have two apps with different URL structures. `UrlForMixin`'s `url_for` should know which app it is building URLs for and what attributes go into it. | diff --git a/CHANGES.rst b/CHANGES.rst
index 37a6299..c8cd133 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -27,6 +27,8 @@
* Changed: ``UuidMixin`` no longer provides ``url_id``
* New: ``coaster.sqlalchemy.UrlForMixin`` now provides an ``absolute_url``
property
+* Changed: ``coaster.sqlalchemy.UrlForMixin`` now re... |
hasgeek__coaster-204 | [
{
"changes": {
"added_entities": [
"coaster/sqlalchemy/mixins.py:__make_name",
"coaster/sqlalchemy/mixins.py:__make_scoped_name",
"coaster/sqlalchemy/mixins.py:__make_scoped_id"
],
"added_modules": [
"coaster/sqlalchemy/mixins.py:__make_name",
"coaster/s... | hasgeek/coaster | 9fb39e57ea1e0db1dc97e423ab57efd62adb74bf | In BaseNameMixin, make_name should be called automatically if required
`BaseNameMixin` and related mixins currently require `make_name` to be explicitly called to set the name. Names are not automatically generated when the title is set to avoid breaking existing URLs.
However, this case does not apply for new objec... | diff --git a/coaster/sqlalchemy/mixins.py b/coaster/sqlalchemy/mixins.py
index 98809d5..03a30ae 100644
--- a/coaster/sqlalchemy/mixins.py
+++ b/coaster/sqlalchemy/mixins.py
@@ -162,24 +162,6 @@ class UuidMixin(object):
suuid = with_roles(suuid, read={'all'})
-# Setup listeners for UUID-based subclasses
-def __... |
hasgeek__coaster-209 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"coaster/sqlalchemy/mixins.py:UrlForMixin.url_for"
],
"edited_modules": [
"coaster/sqlalchemy/mixins.py:UrlForMixin"
]
},
"file": "coaster/sqlalchemy/mixins.py"
},
{... | hasgeek/coaster | 78aa13a0789c57fbd5c8d1230a5b35908588f189 | MultiModelView required
In a URL structure like `/<parent>/<child>`, ModelView is designed to load the child joined with the parent. However, sometimes we have the relationship inverted in the model design. Funnel's `Commentset`, for instance, has no parent relationship. This means in a URL like `/path/to/<proposal>/co... | diff --git a/coaster/sqlalchemy/mixins.py b/coaster/sqlalchemy/mixins.py
index bd2edb3..df9a7a2 100644
--- a/coaster/sqlalchemy/mixins.py
+++ b/coaster/sqlalchemy/mixins.py
@@ -201,7 +201,7 @@ class UrlForMixin(object):
"""
Provides a :meth:`url_for` method used by BaseMixin-derived classes
"""
- #: M... |
hasgeek__coaster-238 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"coaster/sqlalchemy/roles.py:RoleAccessProxy.__init__",
"coaster/sqlalchemy/roles.py:RoleAccessProxy.__get_processed_attr",
"coaster/sqlalchemy/roles.py:RoleAccessProxy.__len__",
... | hasgeek/coaster | 132ccc8b6ebce79f6b28846cb57af69ad6a9ec12 | Data export profiles
`RoleMixin` and `RoleAccessProxy` from #220 were introduced for GraphQL as a replacement for the request-level permission system. They have a secondary use in templates where it is too easy to leak data the user is not supposed to have access to.
Since GraphQL is JSON-based, `RoleAccessProxy` al... | diff --git a/CHANGES.rst b/CHANGES.rst
index f7bc1d6..5689092 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -42,6 +42,8 @@
* Added lazy role grant evaluation and declarative role grants
* New: ``nary_op`` decorator to turn a binary operator into a chained n-ary
operator
+* Added datasets for limited enumeration in... |
hasgeek__coaster-248 | [
{
"changes": {
"added_entities": [
"coaster/sqlalchemy/mixins.py:UrlDictStub.__get__",
"coaster/sqlalchemy/mixins.py:UrlDict.__init__",
"coaster/sqlalchemy/mixins.py:UrlDict.__getitem__",
"coaster/sqlalchemy/mixins.py:UrlDict.__len__",
"coaster/sqlalchemy/mixins.py:... | hasgeek/coaster | 5b2770b457d9d26093ab0d255265a9889adddc06 | Turn url_for from a callable to a dynamic dictionary
It should be possible to get URLs in all these ways:
1. [x] `obj.url_for()` / `obj.url_for('edit')` (current)
2. [x] ~`obj.url_for['view']`~ `obj.urls['view']` (new)
3. [x] ~`dict(obj.url_for)`~ `dict(obj.urls)` to get all URLs
4. [x] ~`obj.current_access()['ur... | diff --git a/coaster/sqlalchemy/mixins.py b/coaster/sqlalchemy/mixins.py
index d2858c7..cfcbae8 100644
--- a/coaster/sqlalchemy/mixins.py
+++ b/coaster/sqlalchemy/mixins.py
@@ -22,7 +22,9 @@ Mixin classes must always appear *before* ``db.Model`` in your model's base clas
from __future__ import absolute_import
impor... |
hasgeek__coaster-263 | [
{
"changes": {
"added_entities": [
"coaster/sqlalchemy/registry.py:Registry.__call__",
"coaster/sqlalchemy/registry.py:RegistryMixin.features"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"coaster/sqlalchemy/registry.py:RegistryMixi... | hasgeek/coaster | ec7ddbfe23f3e915a2feecdbf720d8800b58c817 | Feature flag framework
To check for the availability of a feature in UI, we do this:
```jinja2
{% if obj.view_for('action').is_available() %}
```
These work when the block contains a link to the feature page, but sometimes the entire feature is contained in the template, and the tests get too complex. Sample fr... | diff --git a/coaster/sqlalchemy/registry.py b/coaster/sqlalchemy/registry.py
index 8fb5441..75b700a 100644
--- a/coaster/sqlalchemy/registry.py
+++ b/coaster/sqlalchemy/registry.py
@@ -51,6 +51,18 @@ class Registry(object):
else:
return InstanceRegistry(self, obj)
+ def __call__(self, name=No... |
hauntsaninja__pyp-30 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyp.py:PypTransform.build_input"
],
"edited_modules": [
"pyp.py:PypTransform"
]
},
"file": "pyp.py"
}
] | hauntsaninja/pyp | 5cd78d547cd185677ad5cd8d7f2add3454491900 | `AssertionError: The command doesn't process input, but input is present` on `sys.stdin` usage
I was trying to read bytes instead of string from stdin for #27, but got this:
```shell
$ echo pyp | pyp "sys.stdin"
error: Code raised the following exception, consider using --explain to investigate:
Possible recons... | diff --git a/pyp.py b/pyp.py
index b1e1614..b97cb25 100644
--- a/pyp.py
+++ b/pyp.py
@@ -512,7 +512,8 @@ class PypTransform:
else:
no_pipe_assertion = ast.parse(
"assert sys.stdin.isatty() or not sys.stdin.read(), "
- '''"The command doesn't process input, but input... |
havok2063__fuzzy_types-4 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "docs/sphinx/conf.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"fuzzy_types/conf... | havok2063/fuzzy_types | d5d84ad8c13e033a03d54b9beef16c5013c1edd0 | improve custom override of fuzzy mapper and choices attributes
Currently the `mapper` attribute is set to default return `str(item)` and the `choices` property only iterates over string entries. This fails for lists of objects where you want to fuzzy match on a string attribute of the object. This should be improved... | diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 98ca4c7..1eaa744 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -4,6 +4,8 @@
Change Log
==========
+* :release:`0.1.3 <unreleased>`
+* :feature:`3` updating FuzzyList to allow for a list of objects
* :release:`0.1.2 <2021-06-26>`
* :feature:`1` switch core libra... |
hazelcast__hazelcast-python-client-257 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"hazelcast/serialization/input.py:_ObjectDataInput.skip_bytes"
],
"edited_modules": [
"hazelcast/serialization/input.py:_ObjectDataInput"
]
},
"file": "hazelcast/seriali... | hazelcast/hazelcast-python-client | 766c61257c44094cd61efe057697fa45e8c64487 | Implement ObjectDataInput#skip_bytes
It seems that we didn't implement `skip_bytes` method yet. We should do that similar to the Java client.
https://github.com/hazelcast/hazelcast/blob/master/hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/ByteArrayObjectDataInput.java#L598 | diff --git a/hazelcast/serialization/input.py b/hazelcast/serialization/input.py
index dcc68ca..cc6c387 100644
--- a/hazelcast/serialization/input.py
+++ b/hazelcast/serialization/input.py
@@ -36,7 +36,14 @@ class _ObjectDataInput(ObjectDataInput):
self._pos += _len
def skip_bytes(self, count):
- ... |
hazelcast__hazelcast-python-client-273 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"hazelcast/config.py:BitmapIndexOptions.unique_key",
"hazelcast/config.py:BitmapIndexOptions.unique_key_transformation",
"hazelcast/config.py:IndexConfig.type",
"hazelcast/config.... | hazelcast/hazelcast-python-client | f526367015b88f82aac42c8f18122ade2e555d45 | Allow using literals for enum-like configs
For example, to configure the reconnect mode, one has to do the following.
```python
import hazelcast
from hazelcast.config import ReconnectMode
client = hazelcast.HazelcastClient(
reconnect_mode=ReconnectMode.OFF,
)
```
We can get rid of the import and e... | diff --git a/docs/client_connection_strategy.rst b/docs/client_connection_strategy.rst
index 2b3815c..58df752 100644
--- a/docs/client_connection_strategy.rst
+++ b/docs/client_connection_strategy.rst
@@ -38,6 +38,8 @@ starting and reconnecting modes.
client = hazelcast.HazelcastClient(
async_start=Fals... |
hazelcast__hazelcast-python-client-346 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"hazelcast/client.py:HazelcastClient._get_connection_timeout"
],
"edited_modules": [
"hazelcast/client.py:HazelcastClient"
]
},
"file": "hazelcast/client.py"
},
{
... | hazelcast/hazelcast-python-client | f36567ca0477d3240f7041fe0b764d0b983eb6a5 | [TRACKING ISSUE] Increase default cluster timeout to 2 minutes
The tracking issue for the Java side PR.
**Increase default cluster timeout to 2 minutes**
See https://github.com/hazelcast/hazelcast/pull/18019 for details.
---
The old default tiemout was 20 seconds.
The change is done for environments like Kubernete... | diff --git a/docs/client_connection_strategy.rst b/docs/client_connection_strategy.rst
index 1365a66..e268cc7 100644
--- a/docs/client_connection_strategy.rst
+++ b/docs/client_connection_strategy.rst
@@ -46,10 +46,9 @@ starting and reconnecting modes.
Configuring Client Connection Retry
-----------------------------... |
hazelcast__hazelcast-python-client-380 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"hazelcast/cp.py:_without_default_group_name"
],
"edited_modules": [
"hazelcast/cp.py:_without_default_group_name"
]
},
"file": "hazelcast/cp.py"
}
] | hazelcast/hazelcast-python-client | ea1058ec914e6861ec8d09e4f632c64eb2d6b1e1 | Do not allow using METADATA as the group name on the CP data structures
`METADATA` is a special group name dedicated to the internal CP group that is used for maintaining CP groups and members. As of now, when you try to create a CP data structure with the `METADATA` as the group name, you receive an error from the ser... | diff --git a/hazelcast/cp.py b/hazelcast/cp.py
index b131c7b..d1dd2c0 100644
--- a/hazelcast/cp.py
+++ b/hazelcast/cp.py
@@ -155,6 +155,7 @@ class CPSubsystem(object):
_DEFAULT_GROUP_NAME = "default"
+_METADATA_CP_GROUP_NAME = "metadata"
def _without_default_group_name(name):
@@ -165,7 +166,11 @@ def _without... |
hazelcast__hazelcast-python-client-381 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"hazelcast/cp.py:_without_default_group_name"
],
"edited_modules": [
"hazelcast/cp.py:_without_default_group_name"
]
},
"file": "hazelcast/cp.py"
},
{
"changes":... | hazelcast/hazelcast-python-client | ea1058ec914e6861ec8d09e4f632c64eb2d6b1e1 | [TRACKING ISSUE] add test for ClientNonStopNearCache scenario
The tracking issue for the Java side PR.
**add test for ClientNonStopNearCache scenario**
See https://github.com/hazelcast/hazelcast/pull/16717 for details.
---
| diff --git a/hazelcast/cp.py b/hazelcast/cp.py
index b131c7b..d1dd2c0 100644
--- a/hazelcast/cp.py
+++ b/hazelcast/cp.py
@@ -155,6 +155,7 @@ class CPSubsystem(object):
_DEFAULT_GROUP_NAME = "default"
+_METADATA_CP_GROUP_NAME = "metadata"
def _without_default_group_name(name):
@@ -165,7 +166,11 @@ def _without... |
hazelcast__hazelcast-python-client-385 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"hazelcast/cp.py:_without_default_group_name"
],
"edited_modules": [
"hazelcast/cp.py:_without_default_group_name"
]
},
"file": "hazelcast/cp.py"
},
{
"changes":... | hazelcast/hazelcast-python-client | ea1058ec914e6861ec8d09e4f632c64eb2d6b1e1 | Deprecation warning: util.py:4
I'm getting this warning:
```
$ import hazelcast
/home/jara/.local/lib/python3.8/site-packages/hazelcast/util.py:4: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
fr... | diff --git a/hazelcast/cp.py b/hazelcast/cp.py
index b131c7b..d1dd2c0 100644
--- a/hazelcast/cp.py
+++ b/hazelcast/cp.py
@@ -155,6 +155,7 @@ class CPSubsystem(object):
_DEFAULT_GROUP_NAME = "default"
+_METADATA_CP_GROUP_NAME = "metadata"
def _without_default_group_name(name):
@@ -165,7 +166,11 @@ def _without... |
hazelcast__hazelcast-python-client-387 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"hazelcast/serialization/portable/classdef.py:ClassDefinitionBuilder.__init__",
"hazelcast/serialization/portable/classdef.py:ClassDefinitionBuilder.add_field_def",
"hazelcast/serializati... | hazelcast/hazelcast-python-client | d63e83d3379633bf310e52ae3c0bc8b226460b22 | [TRACKING ISSUE] Check duplicate fields when building class definition
The tracking issue for the Java side PR.
**Check duplicate fields when building class definition**
See https://github.com/hazelcast/hazelcast/pull/17682 for details.
---
ClassDefinitionBuider.addX methods checks if a field
is already added with... | diff --git a/hazelcast/serialization/portable/classdef.py b/hazelcast/serialization/portable/classdef.py
index a043eda..3b74583 100644
--- a/hazelcast/serialization/portable/classdef.py
+++ b/hazelcast/serialization/portable/classdef.py
@@ -132,6 +132,16 @@ class ClassDefinition(object):
class ClassDefinitionBuild... |
hazelcast__hazelcast-python-client-388 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"hazelcast/client.py:HazelcastClient.__init__",
"hazelcast/client.py:HazelcastClient._start"
],
"edited_modules": [
"hazelcast/client.py:HazelcastClient"
]
},
"f... | hazelcast/hazelcast-python-client | d63e83d3379633bf310e52ae3c0bc8b226460b22 | [TRACKING ISSUE] Prevent client ending up with two addresses to same node when node is behind a private network
The tracking issue for the Java side PR.
**Prevent client ending up with two addresses to same node when node is behind a private network**
See https://github.com/hazelcast/hazelcast/pull/17844 for details.... | diff --git a/hazelcast/client.py b/hazelcast/client.py
index d41ecfb..c57daed 100644
--- a/hazelcast/client.py
+++ b/hazelcast/client.py
@@ -371,6 +371,9 @@ class HazelcastClient(object):
self._invocation_service,
)
self._shutdown_lock = threading.RLock()
+ self._invocation_service... |
hazelcast__hazelcast-python-client-475 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"hazelcast/future.py:combine_futures"
],
"edited_modules": [
"hazelcast/future.py:combine_futures"
]
},
"file": "hazelcast/future.py"
},
{
"changes": {
"ad... | hazelcast/hazelcast-python-client | cbacc79cdd1b32b6ba13ee66bed968dbad906daf | [TRACKING ISSUE] Remove listeners sync with the calling thread
The tracking issue for the Java side PR.
See https://github.com/hazelcast/hazelcast/pull/19289 for details.
---
It turns out that there are some services relying on the removal
of a listener on the member when listener is removed from the client.
Examp... | diff --git a/hazelcast/future.py b/hazelcast/future.py
index 740f934..fcf31f5 100644
--- a/hazelcast/future.py
+++ b/hazelcast/future.py
@@ -254,31 +254,56 @@ class ImmediateExceptionFuture(Future):
def combine_futures(futures):
"""Combines set of Futures.
+ It waits for the completion of the all input Futur... |
hdmf-dev__hdmf-194 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"src/hdmf/build/builders.py:GroupBuilder.add_dataset"
],
"edited_modules": [
"src/hdmf/build/builders.py:GroupBuilder"
]
},
"file": "src/hdmf/build/builders.py"
},
{... | hdmf-dev/hdmf | 9f9edf89ebae063fd27e0c8e2da42b0e46adcc2a | Extra/duplicate args allowed in docval
1. If docval specifies three arguments and the user provides four positional arguments, docval should throw an error.
2. In Python, the below code throws an error:
```python
>>> def fn(a, b):
... print(a, b)
...
>>> fn(1, 2, a=3)
Traceback (most recent call last):
Fi... | diff --git a/src/hdmf/build/builders.py b/src/hdmf/build/builders.py
index e92e481..8bc6631 100644
--- a/src/hdmf/build/builders.py
+++ b/src/hdmf/build/builders.py
@@ -272,9 +272,9 @@ class GroupBuilder(BaseBuilder):
returns='the DatasetBuilder object for the dataset', rtype='DatasetBuilder')
def add... |
hdmf-dev__hdmf-202 | [
{
"changes": {
"added_entities": [
"src/hdmf/container.py:Data.shape"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"src/hdmf/container.py:Data"
]
},
"file": "src/hdmf/container.py"
}
] | hdmf-dev/hdmf | 8ea04165c21e9020646203532a487b5db11529fb | Add shape attribute on base classes of DynamicTableRegion
In https://github.com/hdmf-dev/hdmf/pull/191 we added the ``shape`` property to ``DynamicTableRegion`` For consistency we should add the ``shape`` property to the parent classes as well. This should require only adding ``shape`` to ``container.Data``. This sho... | diff --git a/src/hdmf/container.py b/src/hdmf/container.py
index 2831aa8..2932f1e 100644
--- a/src/hdmf/container.py
+++ b/src/hdmf/container.py
@@ -3,7 +3,7 @@ from abc import abstractmethod
from uuid import uuid4
from six import with_metaclass
from .utils import docval, get_docval, call_docval_func, getargs, Exten... |
hdmf-dev__hdmf-203 | [
{
"changes": {
"added_entities": [
"src/hdmf/utils.py:__is_bool"
],
"added_modules": [
"src/hdmf/utils.py:__is_bool"
],
"edited_entities": [
"src/hdmf/utils.py:__type_okay"
],
"edited_modules": [
"src/hdmf/utils.py:__type_okay"
]
... | hdmf-dev/hdmf | 42026c5d7b30b7d176f75af7570b5e54c8ebadcd | Getting TypeError: incorrect type for 'bool' attribute in extension
I’m having a problem creating an [extension](https://github.com/ben-dichter-consulting/ndx-labmetadata-giocomo), more specifically, to create an attribute of type `bool`.
On the list of valid primary dtypes, I get:
{'isodatetime', 'datetime64', 're... | diff --git a/src/hdmf/utils.py b/src/hdmf/utils.py
index 289c182..fd800c8 100644
--- a/src/hdmf/utils.py
+++ b/src/hdmf/utils.py
@@ -51,6 +51,8 @@ def __type_okay(value, argtype, allow_none=False):
return __is_int(value)
elif argtype == 'float':
return __is_float(value)
+ elif ... |
heavenshell__py-doq-84 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"doq/outputter.py:StringOutptter.detect_insert_point"
],
"edited_modules": [
"doq/outputter.py:StringOutptter"
]
},
"file": "doq/outputter.py"
}
] | heavenshell/py-doq | 30c9cd9837b9a3564fdd2793c8caff6131704b75 | methods with multi-line arguments
Similar of #51, but here the multi-line arguments cannot be processed.

| diff --git a/doq/outputter.py b/doq/outputter.py
index 8fe6de7..a676c42 100644
--- a/doq/outputter.py
+++ b/doq/outputter.py
@@ -17,9 +17,9 @@ class StringOutptter(BaseOutputter):
if line.endswith('):'):
# Found end of signature without type
return start + i + ... |
heavenshell__py-doq-85 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"doq/cli.py:generate_def_docstrings",
"doq/cli.py:generate_docstrings",
"doq/cli.py:run",
"doq/cli.py:parse_options"
],
"edited_modules": [
"doq/cli.py:generat... | heavenshell/py-doq | af4340101df64d1e8254782103c5d846b0c94e89 | constructor (__init__) in a class
The docstring is added into `__init__`. But per [style guide of numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html),
> Use the same sections as outlined above (all except Returns are applicable). The constructor (__init__) should also be documented here, the Parameters ... | diff --git a/README.rst b/README.rst
index ac2a2c5..19963e8 100644
--- a/README.rst
+++ b/README.rst
@@ -89,6 +89,7 @@ Usage
usage: doq [-h] [-f FILE] [--start START] [--end END] [-t TEMPLATE_PATH]
[-s STYLE] [--formatter FORMATTER] [--indent INDENT] [--omit OMIT]
[-r] [-d DIRECTORY] [-w] [-v... |
heavenshell__py-sqlalchemy_seed-88 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"sqlalchemy_seed/__init__.py:load_fixture_files"
],
"edited_modules": [
"sqlalchemy_seed/__init__.py:load_fixture_files"
]
},
"file": "sqlalchemy_seed/__init__.py"
}
] | heavenshell/py-sqlalchemy_seed | 1bb3190884c0b82faf4a5c12993313b73a64cd5b | Support for json fixture?
Does it support a json file as fixture? Because in django to load a fixture you can do the following command.
```
python manage.py loaddata fixtures.json
```
| diff --git a/sqlalchemy_seed/__init__.py b/sqlalchemy_seed/__init__.py
index 9dd3aae..763f420 100644
--- a/sqlalchemy_seed/__init__.py
+++ b/sqlalchemy_seed/__init__.py
@@ -65,7 +65,7 @@ def load_fixture_files(paths, files):
if file.endswith('.yaml') or file.endswith('.yml'):
data ... |
hetznercloud__hcloud-python-134 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"hcloud/firewalls/client.py:FirewallsClient.create"
],
"edited_modules": [
"hcloud/firewalls/client.py:FirewallsClient"
]
},
"file": "hcloud/firewalls/client.py"
},
... | hetznercloud/hcloud-python | 2b1c72e60bbddae19d677785d6c6beedcb943184 | `FirewallRequest.create` add argument `apply_to`
## Feature Request
**Is your feature request related to a problem? Please describe.**
The [REST documentation](https://docs.hetzner.cloud/#firewalls-create-a-firewall) and the [Go client](https://github.com/hetznercloud/hcloud-go/blob/4cf75f4cdc3e6885eaf0bd4316fa544e... | diff --git a/hcloud/firewalls/client.py b/hcloud/firewalls/client.py
index b0a1b23..a1bd86a 100644
--- a/hcloud/firewalls/client.py
+++ b/hcloud/firewalls/client.py
@@ -238,6 +238,7 @@ class FirewallsClient(ClientEntityBase, GetEntityByNameMixin):
name, # type: str
rules=None, # type: ... |
hetznercloud__hcloud-python-135 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"hcloud/hcloud.py:Client.__init__",
"hcloud/hcloud.py:Client.request"
],
"edited_modules": [
"hcloud/hcloud.py:Client"
]
},
"file": "hcloud/hcloud.py"
}
] | hetznercloud/hcloud-python | 256d4fdcaf64f56ea96ae39c93d85c60d22572b4 | Lack of persistent HTTP connections for API requests, high HTTPS connection overhead
## Feature Request
The `hcloud.Client` should use a [requests Session object](https://requests.readthedocs.io/en/latest/user/advanced/#session-objects) for persistent HTTPS connections, avoiding a great deal of HTTPS connection late... | diff --git a/hcloud/hcloud.py b/hcloud/hcloud.py
index c6b86ea..dd669ef 100644
--- a/hcloud/hcloud.py
+++ b/hcloud/hcloud.py
@@ -59,6 +59,7 @@ class Client(object):
self._api_endpoint = api_endpoint
self._application_name = application_name
self._application_version = application_version
+ ... |
hetznercloud__hcloud-python-276 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"hcloud/servers/client.py:BoundServer.rebuild",
"hcloud/servers/client.py:ServersClient.rebuild"
],
"edited_modules": [
"hcloud/servers/client.py:BoundServer",
"hcloud... | hetznercloud/hcloud-python | 213b661d897cdd327f478b52aeb79844826694d8 | Rebuild does not return root_password
## Bug Report
**Current Behavior**
'Rebuild' returns the BoundAction but does not return the "root_password"
**Input Code**
```
server = self.client.servers.get_by_name(name='server')
res = server.rebuild(Image(id='image_id'))
print(res)
```
**Expected behavior/co... | diff --git a/hcloud/servers/client.py b/hcloud/servers/client.py
index ea72851..b6da0d3 100644
--- a/hcloud/servers/client.py
+++ b/hcloud/servers/client.py
@@ -1,5 +1,6 @@
from __future__ import annotations
+import warnings
from typing import TYPE_CHECKING, Any, NamedTuple
from ..actions import ActionsPageResul... |
hetznercloud__hcloud-python-9 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"hcloud/hcloud.py:HcloudClient.__init__",
"hcloud/hcloud.py:HcloudClient._get_user_agent",
"hcloud/hcloud.py:HcloudClient.request"
],
"edited_modules": [
"hcloud/hclou... | hetznercloud/hcloud-python | 0b1c03afe6ccc4cf50ccfa1aad1fb3367c4d6041 | Allow Endpoint to be set
We should support the same Client Configuration as the hcloud-go.
So we should also allow the user to customize the endpoint, instead of hardcoding it.
| diff --git a/.travis.yml b/.travis.yml
index 3524174..eb82890 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,6 @@
language: python
python:
- "2.7"
- - "3.4"
- "3.5"
- "3.6"
matrix:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index be90790..1c5a58d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.m... |
hgrecco__pint-1000 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/context.py:Context.from_lines"
],
"edited_modules": [
"pint/context.py:Context"
]
},
"file": "pint/context.py"
},
{
"changes": {
"added_entities": nu... | hgrecco/pint | 92dc58e7b1de6a7ad0aaaad48f63490a80e1d82d | Decimal Parsing Issue
In version 0.9 the following code doesn't work with python 3.7.5.
```python
import decimal
import pint
registry = pint.UnitRegistry()
mps = decimal.Decimal('65000.0') * registry('m/s')
```
I get the following exception:
```
Traceback (most recent call last):
File "<console>", l... | diff --git a/CHANGES b/CHANGES
index 0e52d79..b897f29 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,7 +4,12 @@ Pint Changelog
0.12 (unreleased)
-----------------
-- Nothing changed yet.
+- Add full support for Decimal and Fraction at the registry level.
+ **BREAKING CHANGE**:
+ `use_decimal` is deprecated. Use `non_i... |
hgrecco__pint-1039 | [
{
"changes": {
"added_entities": [
"pint/util.py:UnitsContainer.__getstate__",
"pint/util.py:UnitsContainer.__setstate__",
"pint/util.py:ParserHelper.__getstate__",
"pint/util.py:ParserHelper.__setstate__"
],
"added_modules": null,
"edited_entities": null,... | hgrecco/pint | 3aba60ec0195f552328a6030f673d309ce5978fc | __slots__ without __getstate__
Hi, I'm trying to pickle a df with hdf5.
That fails with the below error because `__getstate__` has vanished from class `UnitsContainer`
```python
File "/Users/csxds/workspaces/venvs/dimpact_test/lib/python3.7/site-packages/tables/attributeset.py", line 494, in __setattr__
... | diff --git a/.travis.yml b/.travis.yml
index ec164c3..efea2b1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -31,7 +31,7 @@ env:
- PKGS="python=3.6 numpy uncertainties"
- PKGS="python=3.7 numpy uncertainties"
- PKGS="python=3.8 numpy uncertainties"
- - PKGS="python xarray netCDF4"
+ - PKGS="python=3.8 numpy u... |
hgrecco__pint-1055 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/numpy_func.py:_is_sequence_with_quantity_elements",
"pint/numpy_func.py:_get_first_input_units",
"pint/numpy_func.py:convert_arg",
"pint/numpy_func.py:_add_subtract_handle_n... | hgrecco/pint | d8bd0d04be9544d8e7bdd6a5d74485330f5f8e01 | numpy.concatenate Quantities and non-pint zeroes
This correctly crashes:
```python
>>> pint.Quantity(1, "kg") + 1
pint.errors.DimensionalityError: Cannot convert from 'kilogram' to 'dimensionless'
```
While this, also correctly, graciously detects that RHS is full of zeroes:
```python
>>> pint.Quantity([1, 2], "... | diff --git a/CHANGES b/CHANGES
index ced7663..a49059d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -12,8 +12,12 @@ Pint Changelog
end_values (Issue #1026)
- Reinstated support for pickle protocol 0 and 1, which is required by pytables
(Issue #1036, Thanks Guido Imperiale)
-- NaN is now treated the same as zero in addit... |
hgrecco__pint-1056 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/quantity.py:reduce_dimensions",
"pint/quantity.py:ireduce_dimensions"
],
"edited_modules": [
"pint/quantity.py:reduce_dimensions",
"pint/quantity.py:ireduce_dime... | hgrecco/pint | 957453c6adefccbb8ed741dbb9d0ba656273cb71 | Multiplication of quantity by dictionary-like object
I want to multiply a `quantity` by a `dict`-like object which has its own multiply defined. I would like for `pint` to return a `NotImplemented` when it tries to multiply a `quantity` by an object of my type, forcing the multiply to be done using my object's multiply... | diff --git a/CHANGES b/CHANGES
index b21be59..27a6c38 100644
--- a/CHANGES
+++ b/CHANGES
@@ -12,6 +12,7 @@ Pint Changelog
end_values (Issue #1026)
- Reinstated support for pickle protocol 0 and 1, which is required by pytables
(Issue #1036, Thanks Guido Imperiale)
+- Fixed bug with multiplication of Quantity by ... |
hgrecco__pint-1064 | [
{
"changes": {
"added_entities": [
"pint/quantity.py:Quantity._get_unit_definition"
],
"added_modules": null,
"edited_entities": [
"pint/quantity.py:Quantity._is_multiplicative",
"pint/quantity.py:Quantity._get_non_multiplicative_units",
"pint/quantity.py:... | hgrecco/pint | 54c53e3635d272340b555ac0157dd640ead537e0 | unit redefinition in a context breaks transform in another context
```python
ureg = pint.UnitRegistry()
for i in range(2):
print(f"run {i}")
ctx = pint.Context.from_lines(["@context _", "cal = 4 J"])
with ureg.context("sp", ctx):
u = ureg.Unit("nm")
q = ureg.Quantity(1, u)
q.... | diff --git a/.gitignore b/.gitignore
index d3e751f..d2fddea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@ dist/
MANIFEST
*pytest_cache*
.eggs
+.mypy_cache
# WebDAV file system cache files
.DAV/
diff --git a/CHANGES b/CHANGES
index 39f8248..b21be59 100644
--- a/CHANGES
+++ b/CHANGES
@@ -20,6 +20,8 @@... |
hgrecco__pint-1074 | [
{
"changes": {
"added_entities": [
"pint/registry.py:BaseRegistry.__iter__"
],
"added_modules": null,
"edited_entities": [
"pint/registry.py:BaseRegistry.__dir__"
],
"edited_modules": [
"pint/registry.py:BaseRegistry"
]
},
"file": "pint/r... | hgrecco/pint | 0abd7868a0e043ca26ec0f3ba3fa6aa124b1e5a6 | dir() mixes units with methods - implement __iter__ instead?
If I explore the directory the `UnitRegistry` with `dir(unit_registry)`, the result displays methods and attributes mixed in with actual choices of units - for example `parse_units` appears right next to `parsec`.
`__dir__` is conventionally used for metho... | diff --git a/AUTHORS b/AUTHORS
index db3229e..2f51bae 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -43,6 +43,7 @@ Other contributors, listed alphabetically, are:
* Sundar Raman <cybertoast@gmail.com>
* Tiago Coutinho <coutinho@esrf.fr>
* Thomas Kluyver <takowl@gmail.com>
+* Tom Nicholas <tomnicholas1@gmail.com>
* Tom Ritc... |
hgrecco__pint-1077 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "pint/formatting.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/measurement.... | hgrecco/pint | cec445158a599bd729ef9eb2955dddba09c4fc2a | Problem with Setuptools
Hello guys, I have found a problem with setuptools.
In File quantity.py I needed to replace:
`from pkg_resources.extern.packaging import version`
with
`# from packaging import version`
I think pkg_resources.extern is no longer provided by setuptools.
This is the first time I am writi... | diff --git a/AUTHORS b/AUTHORS
index 2f51bae..db3229e 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -43,7 +43,6 @@ Other contributors, listed alphabetically, are:
* Sundar Raman <cybertoast@gmail.com>
* Tiago Coutinho <coutinho@esrf.fr>
* Thomas Kluyver <takowl@gmail.com>
-* Tom Nicholas <tomnicholas1@gmail.com>
* Tom Ritc... |
hgrecco__pint-1087 | [
{
"changes": {
"added_entities": [
"pint/numpy_func.py:_prod"
],
"added_modules": [
"pint/numpy_func.py:_prod"
],
"edited_entities": null,
"edited_modules": null
},
"file": "pint/numpy_func.py"
}
] | hgrecco/pint | 878f81e75dc61f7fe58e64c927fe2da939aca0dd | Quantity.prod() result unit is incorrect with axis or where argument
Right now, the `.prod()` method assumes the full size of the input is collapsed in the result. This gives incorrect results when the `axis` or `where` arguments are supplied, as seen below:
```python
import pint
ureg = pint.UnitRegistry()
q ... | diff --git a/pint/numpy_func.py b/pint/numpy_func.py
index 8501a7e..7188071 100644
--- a/pint/numpy_func.py
+++ b/pint/numpy_func.py
@@ -670,6 +670,28 @@ def _all(a, *args, **kwargs):
raise ValueError("Boolean value of Quantity with offset unit is ambiguous.")
+@implements("prod", "function")
+def _prod(a,... |
hgrecco__pint-1098 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/measurement.py:Measurement.__new__"
],
"edited_modules": [
"pint/measurement.py:Measurement"
]
},
"file": "pint/measurement.py"
},
{
"changes": {
"ad... | hgrecco/pint | e350d2174896d903f7c6c548398969850a1cc02f | unit redefinition in a context breaks transform in another context (again)
Reopen of #1062, which I thought I had fixed it in #1064.
I just realised that my PR only moved the problem further: before #1064 the POC was failing at the second iteration; now it fails on the third one.
```python
ureg = pint.UnitRegistry... | diff --git a/CHANGES b/CHANGES
index d304263..f2229b0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -22,7 +22,8 @@ Pint Changelog
- Fixed issue where quantities with a very large magnitude would throw an IndexError
when using to_compact()
- Fixed crash when a Unit with prefix is declared for the first time while a Contex... |
hgrecco__pint-1111 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/registry.py:ContextRegistry._switch_context_cache_and_units"
],
"edited_modules": [
"pint/registry.py:ContextRegistry"
]
},
"file": "pint/registry.py"
}
] | hgrecco/pint | af723faccff4d4778dd21cafc71de78b015b91c3 | Context redefinitions can't be overlayed
When multiple contexts are active and more than one redefines the same unit, pint incorrectly picks up the first redefinition instead of the latest:
```python
ureg = pint.UnitRegistry()
c1 = pint.Context.from_lines(["@context a", "lb = 0.5 kg"])
c2 = pint.Context.from_line... | diff --git a/CHANGES b/CHANGES
index 8b4b3aa..6e67ea0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -32,6 +32,8 @@ Pint Changelog
- Fix typo in docs for wraps example with optional arguments. (Issue #1088)
- Add momentum as a dimension
- Fixed a bug where unit exponents were only partially superscripted in HTML format
+- Mu... |
hgrecco__pint-1113 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/context.py:ContextChain.defaults"
],
"edited_modules": [
"pint/context.py:ContextChain"
]
},
"file": "pint/context.py"
}
] | hgrecco/pint | 583b2979f67452f0c5d29399ace07dd98808278e | enable_contexts: RuntimeError: generator raised StopIteration
No clue what's going on - investigating.
Very slight changes to this POC make the issue disappear.
```python
import pint
ureg = pint.UnitRegistry()
ureg.load_definitions(
"""
@context c1
[time]->[length] : value * 10 m/s
@end
... | diff --git a/CHANGES b/CHANGES
index 6e67ea0..eabdfd0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -34,6 +34,8 @@ Pint Changelog
- Fixed a bug where unit exponents were only partially superscripted in HTML format
- Multiple contexts containing the same redefinition can now be stacked
(Issue #1108, Thanks Guido Imperiale)... |
hgrecco__pint-1119 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "pint/numpy_func.py"
},
{
"changes": {
"added_entities": [
"pint/quantity.py:method_wraps",
"pint/quantity.py:Quantity.prod"
... | hgrecco/pint | 23bb974664f624b8f7aa3b9f325a21cb6d049fdc | synchronize Quantity.prod with np.prod(q)
Continuing from #867: #1087 fixed the calculated units for `prod` when the `axis` or `where` (not both) parameters are passed, but only for the ufunc and not for the method (also, right now this will calculate the units using input and output sizes, but instead we could just us... | diff --git a/pint/numpy_func.py b/pint/numpy_func.py
index 5994461..aa03e18 100644
--- a/pint/numpy_func.py
+++ b/pint/numpy_func.py
@@ -416,7 +416,6 @@ matching_input_copy_units_output_ufuncs = [
copy_units_output_ufuncs = ["ldexp", "fmod", "mod", "remainder"]
op_units_output_ufuncs = {
"var": "square",
- "p... |
hgrecco__pint-1120 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/numpy_func.py:_prod"
],
"edited_modules": [
"pint/numpy_func.py:_prod"
]
},
"file": "pint/numpy_func.py"
}
] | hgrecco/pint | 23bb974664f624b8f7aa3b9f325a21cb6d049fdc | Quantity.prod() result unit is incorrect with axis or where argument
Right now, the `.prod()` method assumes the full size of the input is collapsed in the result. This gives incorrect results when the `axis` or `where` arguments are supplied, as seen below:
```python
import pint
ureg = pint.UnitRegistry()
q ... | diff --git a/pint/numpy_func.py b/pint/numpy_func.py
index 5994461..c671338 100644
--- a/pint/numpy_func.py
+++ b/pint/numpy_func.py
@@ -677,21 +677,27 @@ def _prod(a, *args, **kwargs):
axis = all_kwargs.get("axis", None)
where = all_kwargs.get("where", None)
- if axis is not None and where is not None:
... |
hgrecco__pint-1133 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/formatting.py:format_unit"
],
"edited_modules": [
"pint/formatting.py:format_unit"
]
},
"file": "pint/formatting.py"
},
{
"changes": {
"added_entitie... | hgrecco/pint | 3d99581a808f8c0b5445bb43820a2b82815425d1 | Turn off latex rendering in jupyter notebooks
I have been wrapping some pretty large numpy arrays with pint lately. Unfortunately, viewing these arrays with mathjax rendering ends up crashing my web browser. I searched the docs for a way to turn off the default rendering, but I could not find anything. Is there an easy... | diff --git a/.gitignore b/.gitignore
index d2fddea..610ed68 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,6 @@ test/
# test csv which should be user generated
notebooks/pandas_test.csv
+
+# dask stuff
+dask-worker-space
diff --git a/CHANGES b/CHANGES
index 9922eda..13947da 100644
--- a/CHANGES
+++ b/CHANGES... |
hgrecco__pint-1147 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/registry.py:BaseRegistry.__init__",
"pint/registry.py:BaseRegistry.get_name",
"pint/registry.py:BaseRegistry.get_symbol",
"pint/registry.py:BaseRegistry.parse_unit_name",
... | hgrecco/pint | dea623a7a135670ffb0c725ccbac64a65645b315 | Add case (in)senstive option to registry and extend to Unit and Quantity parsing
[In our quest to handle CF compliant/UDUNITS style units in MetPy](https://github.com/Unidata/MetPy/issues/1362), we have come across a couple issues regarding case sensitivity. For example, we need to be able to parse `Meter` as `meter` a... | diff --git a/CHANGES b/CHANGES
index 13947da..076b3fc 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,8 @@ Pint Changelog
- Change `Quantity` and `Unit` HTML (i.e., Jupyter notebook) repr away from LaTeX to a
simpler, more performant pretty-text and table based repr inspired by Sparse and Dask.
(Issue #654)
+- Add... |
hgrecco__pint-1176 | [
{
"changes": {
"added_entities": [
"pint/__init__.py:_unpickle_quantity",
"pint/__init__.py:_unpickle_unit",
"pint/__init__.py:_unpickle_measurement"
],
"added_modules": [
"pint/__init__.py:_unpickle_quantity",
"pint/__init__.py:_unpickle_unit",
... | hgrecco/pint | ffc05dcf92347b217e14adbf96c36160f6128627 | pickle Quantity
If I pickle a Quantity:
```python
import pint
import pickle
foo = pint.get_application_registry().Quantity(1, 's')
with open("file.pkl", 'bw') as f:
pickle.dump(foo, f)
```
And the unpickle it (using the `application_registry` so it should work with pickle):
```python
import pint
import p... | diff --git a/CHANGES b/CHANGES
index a3faeee..72853c2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,8 +4,8 @@ Pint Changelog
0.17 (unreleased)
--------------
-- Nothing changed yet.
-
+- Fix unpickling, now it is using the APP_REGISTRY as expected.
+ (Issue #1175)
0.16 (2020-09-13)
-----------------
diff --git a/pi... |
hgrecco__pint-1186 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/quantity.py:Quantity.__ipow__",
"pint/quantity.py:Quantity.__pow__"
],
"edited_modules": [
"pint/quantity.py:Quantity"
]
},
"file": "pint/quantity.py"
}
... | hgrecco/pint | 59b8b0a19385a710f41ff16253a37371b19a5647 | Wrong handling of reducable units by Quantity.__pow__
Reducable units (like inch / millimeter) are dropped when performing certain basic operations with a numpy array. This is applicable to `Quantity**array` but not `array**Quantity`. I will review the code and make a PR with any other related bugs I find.
```
impo... | diff --git a/CHANGES b/CHANGES
index cf50d1e..e3ef610 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,8 @@ Pint Changelog
0.17 (unreleased)
-----------------
+- Fix issue with reducable dimensionless units when using power (Quantity**ndarray)
+ (Issue #1185)
- Fix comparisons between Quantities and Measurements.
... |
hgrecco__pint-1196 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/quantity.py:Quantity.tolist"
],
"edited_modules": [
"pint/quantity.py:Quantity"
]
},
"file": "pint/quantity.py"
}
] | hgrecco/pint | 5e59f373ea237a95f22960a2b169c3a756a264c9 | `Quantity.tolist()` method fails for zero-dimenional arrays
# Description
As I understand, `Quantity.tolist()` is meant to mirror numpy's `ndarray.tolist()` method; it does this successfully with arrays of at least dimensionality 1, but throws an exception for 0-dimensional arrays (i.e., scalar ndarrays).
*Pint ver... | diff --git a/CHANGES b/CHANGES
index b444cb3..e7b85d2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,7 +4,7 @@ Pint Changelog
0.17 (unreleased)
-----------------
-- Nothing changed yet.
+- Fix tolist function with scalar ndarray. (Issue #1195)
0.16.1 (2020-09-22)
diff --git a/pint/quantity.py b/pint/quantity.py
inde... |
hgrecco__pint-1248 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/numpy_func.py:get_op_output_unit",
"pint/numpy_func.py:implement_func"
],
"edited_modules": [
"pint/numpy_func.py:get_op_output_unit",
"pint/numpy_func.py:implem... | hgrecco/pint | 397022713184adb0acd9eedf15d1df236db39a7a | numpy.linalg.solve returns wrong units
`numpy.linalg.solve` returns units that are inverted with respect to what is expected. E.g.
```python
A = np.random.rand(5, 5)*ureg.m
b = np.random.rand(5)*ureg.s
np.linalg.solve(A, b)
```
returns `<Unit('meter / second')>` for `x`, whereas `<Unit('second / meter')>` is ... | diff --git a/CHANGES b/CHANGES
index b93b83b..cf50d1e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -12,6 +12,7 @@ Pint Changelog
- UnitsContainer returns false if other is str and cannnot be parsed
(Issue #1179, thanks rfrowe)
- Add Github Actions CI. (Issue #1236)
+- Fix numpy.linalg.solve unit output. (Issue #1246)
... |
hgrecco__pint-1347 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "benchmarks/util.py"
}
] | hgrecco/pint | 37a61ede6fbd628c7dc160eb36278cf41c96484c | micro prefix incompatibility with babel
The mu prefix returned by babel cannot be interpreted by pint.
```python
import pint
import unicodedata
ureg = pint.UnitRegistry()
# symbol used internally by pint, this works
ureg(unicodedata.lookup('MICRO SIGN'))
# symbol returned by babel, fails
ureg(unicodeda... | diff --git a/CHANGES b/CHANGES
index 72a2c95..41a0bbd 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,7 +7,8 @@ Pint Changelog
- Reorganized code into facets.
Each facet encapsulate a Pint functionality.
(See #1466, #1479)
-
+- Parse both Greek mu and micro Unicode points without error.
+ (Issue #1030, #574)
0.19.2... |
hgrecco__pint-1361 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/util.py:string_preprocessor"
],
"edited_modules": [
"pint/util.py:string_preprocessor"
]
},
"file": "pint/util.py"
}
] | hgrecco/pint | 1d566538f8ee47fbf7c9127e0385fec8de0d9b78 | Cannot parse units with pretty form & same exponent (both negative & positive)
Just encountered this, we can not parse strings like `'kg²·s⁻²'`.
String processing is replacing all `²` with `**2` resulting in `kg**2*s-**2` which fails.
https://github.com/hgrecco/pint/blob/e591f8c42e7b451c02d30cc7a4f9ac03fa66f840/p... | diff --git a/CHANGES b/CHANGES
index c9c2541..477aa09 100644
--- a/CHANGES
+++ b/CHANGES
@@ -15,6 +15,7 @@ Pint Changelog
(Issue #1244)
- Fix string formatting of numpy array scalars
- Fix default format for Measurement class (Issue #1300)
+- Fix parsing of pretty units with same exponents but different sign. (Iss... |
hgrecco__pint-1409 | [
{
"changes": {
"added_entities": [
"pint/registry.py:NonMultiplicativeRegistry._add_ref_of_log_or_offset_unit"
],
"added_modules": null,
"edited_entities": [
"pint/registry.py:NonMultiplicativeRegistry._add_ref_of_log_unit",
"pint/registry.py:NonMultiplicativeRegi... | hgrecco/pint | f1dc122abc48eae80d88bc3adeb99081e46e6f29 | Absolute vs. Relative pressure
Dear all,
I could not find a differentiation between absolute and relative pressures in the list of units proposed by pint. Is this feature already implemented? If not, I think it would make sense to have it, as it is very common to differentiate between these two pressures. One could ... | diff --git a/CHANGES b/CHANGES
index aa5443d..4ef06b7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,8 @@ Pint Changelog
0.19 (unreleased)
-----------------
+- Fix a bug for offset units of higher dimension, e.g. gauge pressure.
+ (Issue #1066, thanks dalito)
- Fix type hints of function wrapper (Issue #1431)
- U... |
hgrecco__pint-1419 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/formatting.py:extract_custom_flags",
"pint/formatting.py:remove_custom_flags"
],
"edited_modules": [
"pint/formatting.py:extract_custom_flags",
"pint/formatting.... | hgrecco/pint | 5403f46ecf636d0749cf54cddf725d177d60af61 | pint 0.18 does not allow to explicitly override "~" modifier in default_format
Hi, I see a change in the behavior from pint 0.17 to 0.18 which I think it might be a bug.
Consider the following code:
```python
from pint import UnitRegistry
ureg = UnitRegistry()
q = ureg.Quantity("1m")
print(f"implicit (bef... | diff --git a/CHANGES b/CHANGES
index 2de0a4e..7a2f80b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,7 @@ Pint Changelog
0.19 (unreleased)
-----------------
+- Deprecate the old format defaulting behavior and prepare for the new one (Issue #1407)
- Fix a bug for offset units of higher dimension, e.g. gauge pressure... |
hgrecco__pint-1426 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/quantity.py:Quantity.is_compatible_with"
],
"edited_modules": [
"pint/quantity.py:Quantity"
]
},
"file": "pint/quantity.py"
},
{
"changes": {
"added_... | hgrecco/pint | 5bdf0109576b423823fd67fd5eaabe0ce4d02fc6 | `is_compatible_with` ignores active contexts
While working on #1421 I noticed that `is_compatible_with` allows working with contexts, but they have to be passed explicitly: contexts that were activated using `ureg.context` (both when used as a function and as a context manager) will be ignored:
```python
In [6]: ureg... | diff --git a/CHANGES b/CHANGES
index ac7bfe2..7405124 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,7 @@ Pint Changelog
- Upgrade min version of uncertainties to 3.1.4
- Fix setting options of the application registry (Issue #1403).
+- Fix Quantity & Unit `is_compatible_with` with registry active contexts (Issue #1... |
hgrecco__pint-1435 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/registry.py:BaseRegistry._eval_token"
],
"edited_modules": [
"pint/registry.py:BaseRegistry"
]
},
"file": "pint/registry.py"
}
] | hgrecco/pint | 4d0f842d8cd15e6d1763a63a2d1b4a8150847a45 | Handle infinity while parsing Quantity strings
As `str(some_quantity)` can produce strings like `"inf nm"`, would it be possible to go the other way such that `Quantity("inf nm") == Quantity(float("inf"), "nm")`, rather than erroring? `"nan"` is another possibility, although given that NaNs do not equal each other and ... | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 4b183a3..dfe7f24 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,10 +1,10 @@
repos:
- repo: https://github.com/psf/black
- rev: 21.9b0
+ rev: 21.11b1
hooks:
- id: black
- repo: https://github.com/pycqa/i... |
hgrecco__pint-1463 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/quantity.py:Quantity.to_compact"
],
"edited_modules": [
"pint/quantity.py:Quantity"
]
},
"file": "pint/quantity.py"
},
{
"changes": {
"added_entities... | hgrecco/pint | 5403f46ecf636d0749cf54cddf725d177d60af61 | `infer_base_unit` and `to_compact` break with `non_int_type=Decimal` and Decimal Quantity, dependent on prior actions.
When using `non_int_type=Decimal`, some unit conversions fail, some don't fail, and some unit conversions that fail initially start working after certain others are made.
Whether conversions fail ap... | diff --git a/CHANGES b/CHANGES
index 2de0a4e..ba0397c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -16,6 +16,7 @@ Pint Changelog
- Use default numpy `np.printoptions` available since numpy 1.15.
- Implement `numpy.nanprod` (Issue #1369)
- Fix default_format ignored for measurement (Issue #1456)
+- Fix `to_compact` and `inf... |
hgrecco__pint-1471 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "pint/pint_eval.py"
}
] | hgrecco/pint | 46a98fbf9b33d5b4743a68c060233b7522391a64 | Modulo & floor div are not handled properly in pint_eval
### Currently:
```python
>>> from pint import UnitRegistry
>>>
>>> ureg = UnitRegistry()
>>> parse = ureg.parse_expression
>>> parse("(5 % 2) m")
<Quantity(10, 'meter')>
>>> parse("(5 // 2) m")
<Quantity(10, 'meter')>
```
### Expected:
```pytho... | diff --git a/CHANGES b/CHANGES
index ba0397c..d31e20a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -16,6 +16,7 @@ Pint Changelog
- Use default numpy `np.printoptions` available since numpy 1.15.
- Implement `numpy.nanprod` (Issue #1369)
- Fix default_format ignored for measurement (Issue #1456)
+- Fix handling modulo & flo... |
hgrecco__pint-1476 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/registry.py:BaseRegistry._parse_units"
],
"edited_modules": [
"pint/registry.py:BaseRegistry"
]
},
"file": "pint/registry.py"
}
] | hgrecco/pint | 47bbe5b25215ec0bb2ce00bd24122743f9b9a4df | Unit object gives wrong unit when mixing aliases
When creating a unit object with mixed aliases (`ureg.Unit('hour/hr')`), it returns a wrong unit. It seems like part of it gets ignored. This does not happen when creating a quantity as `ureg.Quantity('1 hour/hr')`.
Replicating code:
```
import pint
ureg = pint.Uni... | diff --git a/CHANGES b/CHANGES
index 720de50..8f6d985 100644
--- a/CHANGES
+++ b/CHANGES
@@ -26,6 +26,7 @@ Pint Changelog
- Add `pint.testing` with functions to compare pint objects in tests (Issue #1421).
- Fix handling modulo & floordiv operator in pint_eval (Issue #1470)
- Fix `to_compact` and `infer_base_unit` f... |
hgrecco__pint-1503 | [
{
"changes": {
"added_entities": [
"pint/formatting.py:split_format"
],
"added_modules": [
"pint/formatting.py:split_format"
],
"edited_entities": null,
"edited_modules": null
},
"file": "pint/formatting.py"
},
{
"changes": {
"added_entit... | hgrecco/pint | 3b99ee6c02786a2aa31660e67ed8d2ebde23ebd2 | numeric formatting overriding `default_format ` in `0.19`
I noticed that the unit string formatting changed slightly with the new `0.19` release
specifically, when setting a custom `default_format` on the `UnitRegistry` the setting is now lost when printing with additional numeric formatting options (e.g. `.2f`) (se... | diff --git a/CHANGES b/CHANGES
index c04aea8..30bf597 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,7 +4,7 @@ Pint Changelog
0.20 (unreleased)
-----------------
-- Nothing changed yet.
+- Add the ``separate_format_defaults`` registry setting (Issue #1501, PR #1503)
0.19.1 (2022-04-06)
diff --git a/docs/formatting.r... |
hgrecco__pint-1600 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/facets/plain/registry.py:PlainRegistry._eval_token"
],
"edited_modules": [
"pint/facets/plain/registry.py:PlainRegistry"
]
},
"file": "pint/facets/plain/registry.p... | hgrecco/pint | f2fc47994b104a39409f573278598420bc325124 | UnitRegistry with non-float non_int_type creates float NaN magnitudes.
When using a UnitRegistry with a non_int_type other than float, normal values are created correctly, but NaN values are not:
```python
import pint
from decimal import Decimal
ureg = pint.UnitRegistry(non_int_type=Decimal)
a = ureg("5.0 m")
t... | diff --git a/CHANGES b/CHANGES
index f3a85a3..6cccf06 100644
--- a/CHANGES
+++ b/CHANGES
@@ -14,6 +14,7 @@ Pint Changelog
- Fix a recursion error that would be raised when passing quantities to `cond` and `x`.
(Issue #1510, #1530)
- Update test_non_int tests for pytest.
+- Create NaN-value quantities of appropriat... |
hgrecco__pint-1615 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/compat.py:tokenizer",
"pint/compat.py:_to_magnitude",
"pint/compat.py:isnan"
],
"edited_modules": [
"pint/compat.py:tokenizer",
"pint/compat.py:_to_magni... | hgrecco/pint | 2852f36db9aab916dbaaa68232ef45efccac3426 | Pint + uncertainties in 2022
Pint, Pandas, and Pint-Pandas have all made such great strides in the past year. With just a little more work, I believe we can support uncertainties in Pint in a clean way using PintPandas (see https://github.com/hgrecco/pint-pandas/issues/139). Alas, Pint trips itself when passing notes... | diff --git a/.readthedocs.yaml b/.readthedocs.yaml
index d180754..7d72db2 100644
--- a/.readthedocs.yaml
+++ b/.readthedocs.yaml
@@ -11,4 +11,3 @@ python:
- requirements: requirements_docs.txt
- method: pip
path: .
- system_packages: false
diff --git a/CHANGES b/CHANGES
index ccc97f1..a2f17c3 1006... |
hgrecco__pint-1625 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/util.py:ParserHelper.from_word"
],
"edited_modules": [
"pint/util.py:ParserHelper"
]
},
"file": "pint/util.py"
}
] | hgrecco/pint | e0a8c221bfe7c83f5d6fcbe2e847724a41cf61a6 | Unit conversion with `Decimal` sometimes introduces trailing zeros
The following example shows somewhat unexpected behavior:
```python
import pint
from decimal import Decimal
ureg = pint.UnitRegistry(non_int_type=Decimal)
a = ureg.Quantity("5.0 mV/m")
b = a.to_base_units()
print(a)
print(b)
print(a.magnitude... | diff --git a/CHANGES b/CHANGES
index d0a4b1d..e1084b4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -15,11 +15,14 @@ Pint Changelog
(PR #1663)
- Changed frequency to angular frequency in the docs.
(PR #1668)
+- Avoid addition of spurious trailing zeros when converting units and non-int-type is
+ Decimal (PR #1625).
- ... |
hgrecco__pint-1661 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/facets/plain/registry.py:PlainRegistry.__init__"
],
"edited_modules": [
"pint/facets/plain/registry.py:PlainRegistry"
]
},
"file": "pint/facets/plain/registry.py"
... | hgrecco/pint | 81519be219953e521127c7db711b3e61b06b7e83 | Suggestion: Add unitless dimensions
Not sure if this would be difficult to implement internally, but one common thing I do with units is convert between various unitless representations (i.e. I want to convert a percent to ppm).
Suggested additional dimensionless units:
- percent
- ppthousand
- ppm
- ppb
- ppt
... | diff --git a/CHANGES b/CHANGES
index 1416ada..1cc6b51 100644
--- a/CHANGES
+++ b/CHANGES
@@ -13,6 +13,10 @@ Pint Changelog
- Changed frequency to angular frequency in the docs.
(PR #1668)
+### Breaking Changes
+
+- Support percent and ppm units. Support the `%` symbol.
+ (Issue #1277)
0.20.1 (2022-10-27)
---... |
hgrecco__pint-2089 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/facets/plain/quantity.py:PlainQuantity.__round__"
],
"edited_modules": [
"pint/facets/plain/quantity.py:PlainQuantity"
]
},
"file": "pint/facets/plain/quantity.py"... | hgrecco/pint | c70c0765f5c81c54a680045f872efe50a5c83425 | `round` doesn't convert the magnitude of a quantity to `int`
```py
>>> import pint; U = pint.UnitRegistry()
>>> round(1.1), type(round(1.1))
(1, <class 'int'>)
>>> round(1.1 * U.kg), type(round(1.1 * U.kg).magnitude)
(<Quantity(1.0, 'kilogram')>, <class 'float'>)
```
I'm not sure if this is a bug, but it certa... | diff --git a/CHANGES b/CHANGES
index 07328fb..e592ac1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,7 @@ Pint Changelog
-------------------
- Add docs to the functions in ``pint.testing`` (PR #2070)
+- Fix round function returning float instead of int (#2081)
0.24.4 (2024-11-07)
diff --git a/pint/facets/plain/... |
hgrecco__pint-630 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/quantity.py:_Quantity.__ipow__",
"pint/quantity.py:_Quantity.__eq__",
"pint/quantity.py:_Quantity.compare"
],
"edited_modules": [
"pint/quantity.py:_Quantity"
... | hgrecco/pint | 90174a33c00a1364fcf2af9c59adf7859b0706b2 | Unit tests fails with numpy 1.13.1
Refs: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=876921
Thanks for fixing.
```
S.S................................................./usr/lib/python2.7/unittest/case.py:340: RuntimeWarning: TestResult has no addExpectedFailure method, reporting as passes
RuntimeWarning)... | diff --git a/.travis.yml b/.travis.yml
index 800263e..fd6781b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,6 @@
language: python
env:
- - UNCERTAINTIES="N" PYTHON="2.7" NUMPY_VERSION=1.11.2
- UNCERTAINTIES="N" PYTHON="3.3" NUMPY_VERSION=1.9.2
- UNCERTAINTIES="N" PYTHON="3.4" NUMPY_VERSION=1.11.2
... |
hgrecco__pint-652 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/registry_helpers.py:wraps"
],
"edited_modules": [
"pint/registry_helpers.py:wraps"
]
},
"file": "pint/registry_helpers.py"
},
{
"changes": {
"added_e... | hgrecco/pint | 0c4a9503b9fe00a62a90c33cb49cb047784766d3 | Wraps crashes when using the same unit for different inputvalues
When I have this function:
```
@ureg.wraps(ureg.M, (ureg.degC, ureg.M, ureg.M))
def hco3_eq_from_tillmans_phreeqc(temperature, CO2, NaCl_conc=__NaCl_conc):
pass
```
And call it as:
```
temp = ureg.Quantity(12, ureg.degC)
print(mdl.hco3_eq... | diff --git a/docs/wrapping.rst b/docs/wrapping.rst
index a4913b3..dd9a39f 100644
--- a/docs/wrapping.rst
+++ b/docs/wrapping.rst
@@ -148,6 +148,37 @@ airmass::
def solar_position(lat, lon, press, tamb, timestamp):
return zenith, azimuth, airmass
+Optional arguments
+------------------
+
+For a function ... |
hgrecco__pint-658 | [
{
"changes": {
"added_entities": [
"pint/quantity.py:_Quantity.check"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"pint/quantity.py:_Quantity"
]
},
"file": "pint/quantity.py"
},
{
"changes": {
"added_entities": ... | hgrecco/pint | ba5cc0e76243c3e1e2b82999a71425ce3c6f3c1e | A check function that's not a decorator
Is there a way we could implement a check function for stand-alone use, not just for wrapping functions?
```python
>>> from pint import _DEFAULT_REGISTRY
>>> ureg = _DEFAULT_REGISTRY
>>> Q_ = ureg.Quantity
>>> distance = Q_('1 meter')
>>> time = Q_('1 second')
>>> ureg.c... | diff --git a/docs/wrapping.rst b/docs/wrapping.rst
index dd9a39f..6ce6411 100644
--- a/docs/wrapping.rst
+++ b/docs/wrapping.rst
@@ -246,3 +246,12 @@ In the decorator format:
... def pendulum_period(length):
... return 2*math.pi*math.sqrt(length/G)
+If you just want to check the dimensionality of a quan... |
hgrecco__pint-784 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/quantity.py:check_implemented"
],
"edited_modules": [
"pint/quantity.py:check_implemented"
]
},
"file": "pint/quantity.py"
}
] | hgrecco/pint | 55920e356eb3b3060d3349bc3d9c80a3c84b0549 | Comparing Quantity to list yields unhandled IndexError: list index out of range
To replicate run
```
import pint
ureg = pint.UnitRegistry()
ureg('g') == []
```
results in
```
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/alexbhandari-young/miniconda3/envs/django/lib... | diff --git a/pint/quantity.py b/pint/quantity.py
index a5b40d7..3373552 100644
--- a/pint/quantity.py
+++ b/pint/quantity.py
@@ -71,7 +71,7 @@ def check_implemented(f):
return NotImplemented
# pandas often gets to arrays of quantities [ Q_(1,"m"), Q_(2,"m")]
# and expects Quantity * array... |
hgrecco__pint-809 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/definitions.py:Definition.from_string"
],
"edited_modules": [
"pint/definitions.py:Definition"
]
},
"file": "pint/definitions.py"
},
{
"changes": {
"... | hgrecco/pint | fffc07105b379b51414932f3794d9de19e37293a | Define unit without symbol
Is it currently possible to define a unit without symbol (but with aliases) in a text file? Currently we have behavior such as:
```
>>> print('{:}'.format(ureg['1 millenium']))
1 millenium
>>> print('{:~}'.format(ureg['1 millenium']))
1 millenia
```
Surely no one intended "millenia... | diff --git a/pint/constants_en.txt b/pint/constants_en.txt
index 19616a0..dba75ae 100644
--- a/pint/constants_en.txt
+++ b/pint/constants_en.txt
@@ -10,7 +10,7 @@ speed_of_light = 299792458 * meter / second = c
standard_gravity = 9.806650 * meter / second ** 2 = g_0 = g_n = gravity
vacuum_permeability = 4 * pi * 1e-7... |
hgrecco__pint-864 | [
{
"changes": {
"added_entities": [
"pint/registry.py:BaseRegistry._init_dynamic_classes",
"pint/registry.py:BaseRegistry.__deepcopy__",
"pint/registry.py:SystemRegistry._init_dynamic_classes"
],
"added_modules": null,
"edited_entities": [
"pint/registry.py... | hgrecco/pint | 55058bc88fe783693680be2344110592406a0722 | deepcopy(ureg) broken
As of pint 0.9:
```python
import pint
import copy
ureg = pint.UnitRegistry()
copy.deepcopy(ureg)
```
Output:
```
lib/python3.7/copy.py in _deepcopy_dict(x, memo, deepcopy)
238 memo[id(x)] = y
239 for key, value in x.items():
--> 240 y[deepcopy(key, memo)] = deep... | diff --git a/pint/registry.py b/pint/registry.py
index 0129ba5..71e45a8 100644
--- a/pint/registry.py
+++ b/pint/registry.py
@@ -32,6 +32,7 @@
from __future__ import division, unicode_literals, print_function, absolute_import
+import copy
import os
import re
import math
@@ -47,7 +48,8 @@ from tokenize import NU... |
hgrecco__pint-877 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/util.py:UnitsContainer.__eq__",
"pint/util.py:ParserHelper.__eq__"
],
"edited_modules": [
"pint/util.py:UnitsContainer",
"pint/util.py:ParserHelper"
]
... | hgrecco/pint | d655f3251c259eea52beb74cbb16e694eda197ed | Bug in compound unit dimensionality/unit reduction after caching?
I came across a bizarre bug that popped up on the master branch recently:
```python
import pint
ureg = pint.UnitRegistry()
print(ureg('joule').to_base_units())
print(ureg('joule * second ** 2 / kilogram / meter').to_base_units())
```
gives the... | diff --git a/pint/util.py b/pint/util.py
index 587517a..d89b957 100644
--- a/pint/util.py
+++ b/pint/util.py
@@ -327,9 +327,16 @@ class UnitsContainer(Mapping):
def __eq__(self, other):
if isinstance(other, UnitsContainer):
- # Not the same as hash(self); see ParserHelper.__hash__ and __eq__
... |
hgrecco__pint-911 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/registry.py:BaseRegistry.__init__",
"pint/registry.py:BaseRegistry.parse_units",
"pint/registry.py:BaseRegistry.parse_expression",
"pint/registry.py:UnitRegistry.__init__"
... | hgrecco/pint | 5f89246c3376be6a0088ebbb83dec0640f6883c8 | How to use sign %?
## Define Sign %
I define:
`from pint import UnitRegistry`
`ureg=UnitRegistry()`
`ureg.define('percent = 1 = %')`
`x = 20 * u('1 %')`
`print('x: {0}'.format(x))`
`print('x: {:L}'.format(x))`
and the output is:
`x: 20`
ValueError: Unknown format code 'L' for object of type 'int'
I need:
`x: 20%`
`x... | diff --git a/pint/registry.py b/pint/registry.py
index 4324c7d..23b1108 100644
--- a/pint/registry.py
+++ b/pint/registry.py
@@ -101,6 +101,8 @@ class BaseRegistry(meta.with_metaclass(_Meta)):
'warn', 'raise', 'ignore'
:type on_redefinition: str
:param auto_reduce_dimensions: If T... |
hgrecco__pint-915 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "pint/__init__.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/context.py:Con... | hgrecco/pint | a9831b0faa6b60d9eb65f6ad803f4616b28a7ee4 | Unit.__lt__ makes pprint crash
The vast majority of the implementations of (dis)equality methods in Python (``__lt__`` etc.) raise TypeError when a comparison doesn't make sense. Although this isn't explicitly mandated by the data model, it is a de facto standard.
pint, however, can raise DimensionalityError, which ... | diff --git a/CHANGES b/CHANGES
index 6e56d90..16cc515 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,7 +4,75 @@ Pint Changelog
0.10 (unreleased)
-----------------
-- Nothing changed yet.
+- **BREAKING CHANGE**:
+ Fix crash when applying pprint to large sets of Units.
+ DefinitionSyntaxError is now a subclass of SyntaxE... |
hgrecco__pint-920 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/quantity.py:Quantity.ito_reduced_units"
],
"edited_modules": [
"pint/quantity.py:Quantity"
]
},
"file": "pint/quantity.py"
},
{
"changes": {
"added_e... | hgrecco/pint | 3936c36badcb27f12cad5d25072035613e7a35b0 | DimensionalityError with auto_reduce_dimensions=True
I have encountered the following situation: a division between two quantities gives an error depending on the operand's order:
```
>>> from pint import UnitRegistry
>>> ureg = UnitRegistry(auto_reduce_dimensions=True)
>>> velocity = 1 *ureg.m/ureg.s
>>> cross_se... | diff --git a/pint/quantity.py b/pint/quantity.py
index 627e3f2..b83a053 100644
--- a/pint/quantity.py
+++ b/pint/quantity.py
@@ -559,7 +559,7 @@ class Quantity(PrettyIPython, SharedRegistryObject):
if unit1 != unit2:
power = self._REGISTRY._get_dimensionality_ratio(unit1, unit2)
... |
hgrecco__pint-928 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/formatting.py:format_unit"
],
"edited_modules": [
"pint/formatting.py:format_unit"
]
},
"file": "pint/formatting.py"
}
] | hgrecco/pint | 5109e05fe89e18258a5cc88f444d80cfb7d18cce | Bad Jupyter rendering of underscores with numpy quantities
default_en.txt makes extensive use of snake_case for all unit names that are made of multiple words.
Such units render poorly in Jupyter Notebook when associated with a numpy magnitude:
 | diff --git a/CHANGES b/CHANGES
index b4694ec..0909b1d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,8 @@ Pint Changelog
0.10 (unreleased)
-----------------
+- Fix HTML (Jupyter Notebook) and LateX representation of some units
+ (Issue #927, Thanks Guido Imperiale)
- **BREAKING CHANGE**:
Implement NEP-18 <https... |
hgrecco__pint-940 | [
{
"changes": {
"added_entities": [
"pint/numpy_func.py:implement_single_dimensionless_argument_func"
],
"added_modules": [
"pint/numpy_func.py:implement_single_dimensionless_argument_func"
],
"edited_entities": [
"pint/numpy_func.py:implement_func"
],
... | hgrecco/pint | 4c3114c72bdae1e3c5c9f839659169eeb06071cd | array function implementation for np.cumprod / np.nancumprod fails with axis
Passing a `axis` argument to `cumprod` / `nancumprod` will make them fail. I tracked it down to https://github.com/hgrecco/pint/blob/4c3114c72bdae1e3c5c9f839659169eeb06071cd/pint/numpy_func.py#L62 where `pre_calc_units` can be a string (`"dime... | diff --git a/pint/numpy_func.py b/pint/numpy_func.py
index 75a4de6..24bb8d5 100644
--- a/pint/numpy_func.py
+++ b/pint/numpy_func.py
@@ -51,7 +51,8 @@ def _get_first_input_units(args, kwargs={}):
def convert_arg(arg, pre_calc_units):
"""Convert quantities and sequences of quantities to pre_calc_units and strip un... |
hgrecco__pint-948 | [
{
"changes": {
"added_entities": [
"pint/definitions.py:_NotNumeric.__init__",
"pint/definitions.py:numeric_parse"
],
"added_modules": [
"pint/definitions.py:_NotNumeric",
"pint/definitions.py:numeric_parse"
],
"edited_entities": [
"pint/defi... | hgrecco/pint | d662fd2580acfbdb3cbae6c57969c2b67408ce96 | [SECURITY] Arbitrary code execution from definitions
# Critical security vulnerability
A user who is allowed to upload a definitions file can run arbitrary code as the user running pint, thanks to two calls to eval() in definitions.py,
here
https://github.com/hgrecco/pint/blob/23c44ee335797c051feea0103e28c6a7221... | diff --git a/CHANGES b/CHANGES
index 19f7d7f..f1bc247 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,8 @@ Pint Changelog
0.10 (unreleased)
-----------------
+- Removed eval usage when creating UnitDefinition and PrefixDefinition from string.
+ (Issue #942)
- Added `fmt_locale` argument to registry.
(Issue #904)... |
hgrecco__pint-953 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/compat.py:_to_magnitude"
],
"edited_modules": [
"pint/compat.py:_to_magnitude"
]
},
"file": "pint/compat.py"
},
{
"changes": {
"added_entities": [
... | hgrecco/pint | 92fc293ed7754952b4f4d2a55b0e56d86bbe95cc | Proper handling of `__array_*__` attributes/methods
After #905 is merged, the following NumPy array protocol attributes/methods will be explicitly handed by Pint Quantities:
- `__array_priority__`
- `__array_ufunc__`
- `__array_function__`
All others (any starting with `__array_`) are implicitly handled by
1... | diff --git a/CHANGES b/CHANGES
index 3f028ea..617d9a4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,7 +5,12 @@ Pint Changelog
-----------------
- Switched test configuration to pytest and added tests of Pint's matplotlib support.
- (Issue #954)
+ (Issue #954, Thanks Jon Thielen)
+- Deprecate array protocol fallback ex... |
hgrecco__pint-959 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/compat.py:is_upcast_type"
],
"edited_modules": [
"pint/compat.py:is_upcast_type"
]
},
"file": "pint/compat.py"
},
{
"changes": {
"added_entities": nu... | hgrecco/pint | 38d597940f7ed795872efe5a47bd6d618a6895f1 | Preserve `ndarray`-like magnitudes or reject them from the start
I am trying to use a [`xarray.DataArray`](http://xarray.pydata.org/en/latest/api.html#dataarray) magnitude with a `pint` quantity. It appears to work, but doesn't really, because [`Quantity.__getattr__` forces it to convert to `numpy.ndarray`](https://gi... | diff --git a/.travis.yml b/.travis.yml
index 4f8613f..a6cf799 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -29,6 +29,7 @@ env:
- PKGS="python=3.6 numpy uncertainties"
- PKGS="python=3.7 numpy uncertainties"
- PKGS="python=3.8 numpy uncertainties"
+ - PKGS="python xarray netCDF4"
# TODO: pandas tests
... |
hgrecco__pint-962 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint/registry.py:ContextRegistry.enable_contexts"
],
"edited_modules": [
"pint/registry.py:ContextRegistry"
]
},
"file": "pint/registry.py"
},
{
"changes": {
... | hgrecco/pint | 68a3e9132597d8ffc55beb306c692e20c9c8a93e | Proposal: Allow ureg.wraps to convert string arguments
Hi! I really like pint, and I'm designing a package that uses it for scientific computations.
I'd like to propose an extension that I would find useful. This extension would automatically convert strings to Quantities on wrapping functions. Example code is below.... | diff --git a/CHANGES b/CHANGES
index 8a2ba2d..0395b7f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,13 @@ Pint Changelog
0.10 (unreleased)
-----------------
+- Improvements to wraps and check:
+ - fail upon decoration (not execution) by checking wrapped function signature against
+ wraps/check arguments.
+ (... |
hgrecco__pint-965 | [
{
"changes": {
"added_entities": [
"pint/numpy_func.py:_any",
"pint/numpy_func.py:_all"
],
"added_modules": [
"pint/numpy_func.py:_any",
"pint/numpy_func.py:_all"
],
"edited_entities": [
"pint/numpy_func.py:get_op_output_unit",
"pint/... | hgrecco/pint | 0d09f54a08a3bbd536184137cbb01da5949f5dba | Monkeypatch np.linalg.solve
Such that `np.linalg.solve(A, x).units = x.units / A.units`
| diff --git a/CHANGES b/CHANGES
index 1f0a953..78c4fa1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,10 @@ Pint Changelog
0.10 (unreleased)
-----------------
+- **BREAKING CHANGE**:
+ Boolean value of Quantities with offsets units is ambiguous, and so, now a ValueError
+ is raised when attempting to cast such a Qu... |
hgrecco__pint-pandas-103 | [
{
"changes": {
"added_entities": [
"pint_pandas/pint_array.py:PintArray.__getstate__",
"pint_pandas/pint_array.py:PintArray.__setstate__"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"pint_pandas/pint_array.py:PintArray"
]
... | hgrecco/pint-pandas | dae75d9ed387a1792bf7dc4c3866395352ad008d | PintArray fails to fit into a pickle jar
I am wondering if anyone has a quick workaround for pickling of `PintArray`. I am getting an error running following snippet (Python 3.8, pint-pandas 0.2):
```python
import pickle, pint_pandas
pickle.dumps(pint_pandas.PintArray([1.], dtype="m"))
# AttributeError: Can't p... | diff --git a/CHANGES b/CHANGES
index 746db0f..02d0c86 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,7 +7,7 @@ pint-pandas Changelog
- Fixed a bug which caused the creation of PintArray (and even more so all binary mathematical operations)
to convert input arrays to lists of Quantity, thereby causing a huge slowdown. #80... |
hgrecco__pint-pandas-104 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint_pandas/pint_array.py:PintArray.__init__"
],
"edited_modules": [
"pint_pandas/pint_array.py:PintArray"
]
},
"file": "pint_pandas/pint_array.py"
}
] | hgrecco/pint-pandas | 4c892b77aaf7fafb42d6c4d9cefb98e7e44dcdd1 | `PintArray` should accept Quantity arrays directly
Given a Quantity array `q`, the correct way to create a `PintArrray` currently is to call `PintArray(q.magnitude, q.units)`.
One may be tempted to instead call `PintArray(q, q.units)` instead, which gives the correct result, but causes a `UnitsStrippedWarning` to be r... | diff --git a/CHANGES b/CHANGES
index 02d0c86..c53f686 100644
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,8 @@ pint-pandas Changelog
to convert input arrays to lists of Quantity, thereby causing a huge slowdown. #80
- Fixed a bug where listlike operands in binary operations were not correctly converted to Quantity arrays... |
hgrecco__pint-pandas-132 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint_pandas/pint_array.py:PintDataFrameAccessor.quantify",
"pint_pandas/pint_array.py:PintDataFrameAccessor.dequantify",
"pint_pandas/pint_array.py:PintDataFrameAccessor.to_base_units"
... | hgrecco/pint-pandas | e42e95fc6235f54ef2fea7e926b7197387de87ce | dequantify with dataframes of mixed types
I have a dataframe where I have a couple of columns of PintArray types and a couple of boolean columns.
I need to be able to dequantify the columns so I can save everything to a csv, but the .pint.dequantify()
causes an error.
```
File "..\lib\site-packages\pint_panda... | diff --git a/CHANGES b/CHANGES
index cabd7c0..f681a9d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -13,6 +13,7 @@ pint-pandas Changelog
- Fixed a bug where `.astype("string[pyarrow]")` would not create pyarrow-backed arrays. #101
- Fixed bug preventing adding to empty slices of PintArrays #69
- Notebook updated to show plo... |
hgrecco__pint-pandas-204 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint_pandas/pint_array.py:PintArray.astype"
],
"edited_modules": [
"pint_pandas/pint_array.py:PintArray"
]
},
"file": "pint_pandas/pint_array.py"
}
] | hgrecco/pint-pandas | ef8a1209699d4533299303b800982578e8322242 | series.astype(float) not returning series of floats
# Start: series with dimensionless values
```python
import pandas as pd
import pint
import pint_pandas
s0 = pd.Series([1.0, 2.5])
s1 = s0.astype('pint[dimensionless]')
s1
# 0 1.0
# 1 2.5
# dtype: pint[]
```
# Issue: conversion back to floats
... | diff --git a/CHANGES b/CHANGES
index 4ce6b16..f896b8e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,7 +4,7 @@ pint-pandas Changelog
0.6 (unreleased)
----------------
-- Nothing changed yet.
+- Fix astype issue #196
0.5 (2023-09-07)
diff --git a/pint_pandas/pint_array.py b/pint_pandas/pint_array.py
index 7154be5..fc... |
hgrecco__pint-pandas-207 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint_pandas/pint_array.py:PintDataFrameAccessor.dequantify"
],
"edited_modules": [
"pint_pandas/pint_array.py:PintDataFrameAccessor"
]
},
"file": "pint_pandas/pint_arra... | hgrecco/pint-pandas | 2e087e625cdc666540e8c06e26b31956911c1ead | pint.dequantify() fails for duplicate column names
`df.pint.dequantify()` breaks unexpectedly (and error msg is cryptic) if column names contain duplicates.
```python
df = pd.DataFrame()
df['test']= pd.Series([1,2,3], dtype='pint[kN]')
df.insert(0,'test',df['test'],allow_duplicates=True)
```
`df`:
> <htm... | diff --git a/CHANGES b/CHANGES
index f896b8e..7bfcbf9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,7 @@ pint-pandas Changelog
0.6 (unreleased)
----------------
+- Fix dequantify duplicate column failure #202
- Fix astype issue #196
diff --git a/pint_pandas/pint_array.py b/pint_pandas/pint_array.py
index fcbfe... |
hgrecco__pint-pandas-263 | [
{
"changes": {
"added_entities": [
"pint_pandas/pint_array.py:PintArray.__array_function__"
],
"added_modules": null,
"edited_entities": [
"pint_pandas/pint_array.py:PintArray._convert_np_result",
"pint_pandas/pint_array.py:PintSeriesAccessor._validate"
],
... | hgrecco/pint-pandas | d1eb38d9a1737b022f5541075ad91de67260e245 | `clip` fails on `NA`/`nan` values
The following code fails in the last line with `TypeError: boolean value of NA is ambiguous`:
```python
import numpy as np
import pandas as pd
import pint
import pint_pandas
print(f"{pd.__version__=}")
print(f"{pint.__version__=}")
print(f"{pint_pandas.__version__=}")
u = ... | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index c52d210..75bfa62 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,23 +1,21 @@
exclude: '^pint/_vendor'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.4.0
+ rev: v4.5.0
hooks:
- id... |
hgrecco__pint-pandas-264 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pint_pandas/pint_array.py:PintArray._convert_np_result"
],
"edited_modules": [
"pint_pandas/pint_array.py:PintArray"
]
},
"file": "pint_pandas/pint_array.py"
}
] | hgrecco/pint-pandas | 974cb2f35a4ca959f6110a98a33584a5513f76bf | `numpy.allclose` not working for `PintArray`
# Issue
```python
import pandas as pd
import numpy as np
from pint_pandas import PintArray
>>> pa1 = pa2 = PintArray([1, 45, -4.5], 'm')
>>> np.allclose(pa1, pa2)
# ---------------------------------------------------------------------------
# TypeError ... | diff --git a/pint_pandas/pint_array.py b/pint_pandas/pint_array.py
index df5ed65..082071e 100644
--- a/pint_pandas/pint_array.py
+++ b/pint_pandas/pint_array.py
@@ -350,6 +350,8 @@ class PintArray(ExtensionArray, ExtensionScalarOpsMixin):
return self._convert_np_result(result)
def _convert_np_result(sel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.