Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Humanize doesn't support "quarter" for granularity #1019

Closed
krisfremen opened this issue Aug 9, 2021 · 5 comments
Closed

Humanize doesn't support "quarter" for granularity #1019

krisfremen opened this issue Aug 9, 2021 · 5 comments
Labels

Comments

@krisfremen
Copy link
Member

krisfremen commented Aug 9, 2021

Issue Description

Humanize doesn't seem to support granularity of "quarter".

But the error raised seems to suggest that it does:

if not granularity:
    raise ValueError(
        "Empty granularity list provided. "
        "Please select one or more from ['second', 'minute', 'hour', 'day', 'week', 'month', 'quarter', 'year']."
    )
>>> arrow.Arrow.utcnow().humanize(granularity=["quarter"])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/krisfremen/projects/arrow/arrow/arrow.py", line 1251, in humanize
    raise ValueError(
ValueError: Invalid level of granularity. Please select between 'second', 'minute', 'hour', 'day', 'week', 'month' or 'year'.
>>> arrow.Arrow.utcnow().humanize(granularity=None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/krisfremen/projects/arrow/arrow/arrow.py", line 1263, in humanize
    raise ValueError(
ValueError: Empty granularity list provided. Please select one or more from ['second', 'minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'].

System Info

  • 🖥 OS name and version: Debian 10.10
  • 🐍 Python version: Python 3.9.1
  • 🏹 Arrow version: 1.1.1 or master
@krisfremen krisfremen added the bug label Aug 9, 2021
@systemcatch
Copy link
Collaborator

I think we could support this if we add a class attribute _SECS_PER_QUARTER on https://github.com/arrow-py/arrow/blob/master/arrow/arrow.py#L134 then integrate that into the humanize method.

@Alig1493
Copy link
Contributor

Quarter as in every three months?
I could take a look at this issue if it's up for grabs

@krisfremen
Copy link
Member Author

Quarter as in every three months? I could take a look at this issue if it's up for grabs

Correct. Sure, go for it!

@Alig1493
Copy link
Contributor

Traceback (most recent call last):
  File "/Users/ali/.cache/pre-commit/repo7bat5wn8/py_env-python3/bin/black", line 5, in <module>
    from black import patched_main
  File "/Users/ali/.cache/pre-commit/repo7bat5wn8/py_env-python3/lib/python3.9/site-packages/black/__init__.py", line 10, in <module>
    import regex as re
  File "/Users/ali/.cache/pre-commit/repo7bat5wn8/py_env-python3/lib/python3.9/site-packages/regex/__init__.py", line 1, in <module>
    from .regex import *
  File "/Users/ali/.cache/pre-commit/repo7bat5wn8/py_env-python3/lib/python3.9/site-packages/regex/regex.py", line 419, in <module>
    import regex._regex_core as _regex_core
  File "/Users/ali/.cache/pre-commit/repo7bat5wn8/py_env-python3/lib/python3.9/site-packages/regex/_regex_core.py", line 21, in <module>
    import regex._regex as _regex
ImportError: dlopen(/Users/ali/.cache/pre-commit/repo7bat5wn8/py_env-python3/lib/python3.9/site-packages/regex/_regex.cpython-39-darwin.so, 2): no suitable image found.  Did find:
	/Users/ali/.cache/pre-commit/repo7bat5wn8/py_env-python3/lib/python3.9/site-packages/regex/_regex.cpython-39-darwin.so: code signature in (/Users/ali/.cache/pre-commit/repo7bat5wn8/py_env-python3/lib/python3.9/site-packages/regex/_regex.cpython-39-darwin.so) not valid for use in process using Library Validation: Trying to load an unsigned library

Getting the following traceback on make lint

@jadchaar
Copy link
Member

Fixed in #1048

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants