tchar / ulauncher-albert-calculate-anything

A ULauncher/Albert extension that supports currency, units and date time conversion, as well as a calculator that supports complex numbers and functions.
MIT License
103 stars 13 forks source link

Fix fixerio not working with http:// uri. #37

Closed tchar closed 3 months ago

tchar commented 2 years ago

Fixerio was errored out because uri starts with http://, add parameter to get_requirest classmethod to allow for bypassing url check. Update black dependency.

github-actions[bot] commented 2 years ago

Pull Request has been marked as stale due to no activity

Thanatermesis commented 1 year ago

Same issue here, is there a fix?

tchar commented 1 year ago

Same issue here, is there a fix?

This pull is supposed to fix the issue, but the tests do not pass. I feel the problem with tests might be stale dependencies in the cache because on my computer the tests pass. I am somewhat stuck on how to fix this since I am heavily working these days.

Thanatermesis commented 1 year ago

I edited the code manually to see if works but seems like it doesn't, I have this message in terminal:

2022-12-12 15:02:53,039 ℹ  DEBUG Send message <ulauncher.api.shared.Response.Response object at 0x7fa6aa250eb0> Client.send:80
2022-12-12 15:02:53,039 ℹ  DEBUG Sent 281 bytes framer._write_done:161
2022-12-12 15:02:53,141 ℹ  DEBUG Received data of 109 bytes framer._ingest_data:106
2022-12-12 15:02:53,142 ℹ  DEBUG Received message <ulauncher.api.shared.event.InputTriggerEvent object at 0x7fa6aa240af0> framer._ingest_data:124
2022-12-12 15:02:53,142 ℹ  DEBUG Incoming event InputTriggerEvent Client.on_message:54
2022-12-12 15:02:53,151 ⚠  ERROR calculate_anything.query.handlers.multi_handler: Exception in handler: UnitsQueryHandler: 'currency' is not defined in the unit registry multi_handler._handle:60
Traceback (most recent call last):
  File "/home/thana/Data/home_linked/.local/share/ulauncher/extensions/com.github.tchar.ulauncher-albert-calculate-anything/calculate_anything/query/handlers/multi_handler.py", line 55, in _handle
    result = handler.handle(query)
  File "/home/thana/Data/home_linked/.local/share/ulauncher/extensions/com.github.tchar.ulauncher-albert-calculate-anything/calculate_anything/query/handlers/base.py", line 23, in _wrapper
    return func(self, query, *args, **kwargs)
  File "/home/thana/Data/home_linked/.local/share/ulauncher/extensions/com.github.tchar.ulauncher-albert-calculate-anything/calculate_anything/query/handlers/base.py", line 57, in handle
    return self.handle_raw(query, *args, **kwargs)
  File "/home/thana/Data/home_linked/.local/share/ulauncher/extensions/com.github.tchar.ulauncher-albert-calculate-anything/calculate_anything/query/handlers/units.py", line 240, in handle_raw
    with ureg.context('currency'):
  File "/usr/lib/python3.9/contextlib.py", line 117, in __enter__
    return next(self.gen)
  File "/usr/lib/python3/dist-packages/pint/registry.py", line 1747, in context
    self.enable_contexts(*names, **kwargs)
  File "/usr/lib/python3/dist-packages/pint/registry.py", line 1687, in enable_contexts
    self._switch_context_cache_and_units()
  File "/usr/lib/python3/dist-packages/pint/registry.py", line 1596, in _switch_context_cache_and_units
    self._redefine(definition)
  File "/usr/lib/python3/dist-packages/pint/registry.py", line 1621, in _redefine
    dims_old = self._get_dimensionality(basedef.reference)
  File "/usr/lib/python3/dist-packages/pint/registry.py", line 716, in _get_dimensionality
    self._get_dimensionality_recurse(input_units, 1, accumulator)
  File "/usr/lib/python3/dist-packages/pint/registry.py", line 737, in _get_dimensionality_recurse
    reg = self._units[self.get_name(key)]
  File "/usr/lib/python3/dist-packages/pint/registry.py", line 646, in get_name
    raise UndefinedUnitError(name_or_alias)
pint.errors.UndefinedUnitError: 'currency' is not defined in the unit registry
2022-12-12 15:02:53,151 ℹ  DEBUG Send message <ulauncher.api.shared.Response.Response object at 0x7fa6aa1dc040> Client.send:80
2022-12-12 15:02:53,152 ℹ  DEBUG Sent 282 bytes framer._write_done:161
2022-12-12 15:02:53,373 ℹ  DEBUG Received data of 110 bytes framer._ingest_data:106
2022-12-12 15:02:53,373 ℹ  DEBUG Received message <ulauncher.api.shared.event.InputTriggerEvent object at 0x7fa6aa248c70> framer._ingest_data:124
2022-12-12 15:02:53,374 ℹ  DEBUG Incoming event InputTriggerEvent Client.on_message:54
2022-12-12 15:02:53,381 ⚠  ERROR calculate_anything.query.handlers.multi_handler: Exception in handler: UnitsQueryHandler: 'currency' is not defined in the unit registry multi_handler._handle:60
Traceback (most recent call last):
  File "/home/thana/Data/home_linked/.local/share/ulauncher/extensions/com.github.tchar.ulauncher-albert-calculate-anything/calculate_anything/query/handlers/multi_handler.py", line 55, in _handle
    result = handler.handle(query)
  File "/home/thana/Data/home_linked/.local/share/ulauncher/extensions/com.github.tchar.ulauncher-albert-calculate-anything/calculate_anything/query/handlers/base.py", line 23, in _wrapper
    return func(self, query, *args, **kwargs)
  File "/home/thana/Data/home_linked/.local/share/ulauncher/extensions/com.github.tchar.ulauncher-albert-calculate-anything/calculate_anything/query/handlers/base.py", line 57, in handle
    return self.handle_raw(query, *args, **kwargs)
  File "/home/thana/Data/home_linked/.local/share/ulauncher/extensions/com.github.tchar.ulauncher-albert-calculate-anything/calculate_anything/query/handlers/units.py", line 240, in handle_raw
    with ureg.context('currency'):
  File "/usr/lib/python3.9/contextlib.py", line 117, in __enter__
    return next(self.gen)
  File "/usr/lib/python3/dist-packages/pint/registry.py", line 1747, in context
    self.enable_contexts(*names, **kwargs)
  File "/usr/lib/python3/dist-packages/pint/registry.py", line 1687, in enable_contexts
    self._switch_context_cache_and_units()
  File "/usr/lib/python3/dist-packages/pint/registry.py", line 1596, in _switch_context_cache_and_units
    self._redefine(definition)
  File "/usr/lib/python3/dist-packages/pint/registry.py", line 1621, in _redefine
    dims_old = self._get_dimensionality(basedef.reference)
  File "/usr/lib/python3/dist-packages/pint/registry.py", line 716, in _get_dimensionality
    self._get_dimensionality_recurse(input_units, 1, accumulator)
  File "/usr/lib/python3/dist-packages/pint/registry.py", line 737, in _get_dimensionality_recurse
    reg = self._units[self.get_name(key)]
  File "/usr/lib/python3/dist-packages/pint/registry.py", line 646, in get_name
    raise UndefinedUnitError(name_or_alias)
pint.errors.UndefinedUnitError: 'currency' is not defined in the unit registry
github-actions[bot] commented 1 year ago

Pull Request has been marked as stale due to no activity

tchar commented 3 months ago

Fixed by #57