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

Generate a hash function when frozen is True #1881

Merged

Commits on Jan 4, 2021

  1. feature: add a frozen parameter to config

    For now, `frozen` is a strict duplication of `allow_mutation` parameter
    i.e. setting `frozen=True` does everything that `allow_mutation=False` does.
    
    NB: this does not change the behavior of `allow_mutation`.
    
    In next commit, setting `frozen=True` will also make the BaseModel hashable
    while the existing behavior of `allow_mutation` will not be updated.
    rhuille committed Jan 4, 2021
    Copy the full SHA
    7df3d9d View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    75d5227 View commit details
    Browse the repository at this point in the history
  3. feature: generate a hash function when frozen is True

    Now, setting `frozen=True` also generate a hash function for the model
    i.e. `__hash__` is not `None`. This makes instances of the model potentially
    hashable if all the attributes are hashable. (default: `False`)
    rhuille committed Jan 4, 2021
    Copy the full SHA
    b4befc5 View commit details
    Browse the repository at this point in the history

Commits on Jan 27, 2021

  1. Copy the full SHA
    12cff48 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    0d6eaec View commit details
    Browse the repository at this point in the history

Commits on Jan 29, 2021

  1. Copy the full SHA
    7397b67 View commit details
    Browse the repository at this point in the history

Commits on Feb 23, 2021

  1. Copy the full SHA
    4815e4c View commit details
    Browse the repository at this point in the history
  2. test: remwork mypy tests in order to catch only frozen related errors

    Before: there were errors about other stuff than frozen behavior
    After: The modification catch only errot related to the frozen behavior
    rhuille committed Feb 23, 2021
    Copy the full SHA
    7c3f4de View commit details
    Browse the repository at this point in the history
  3. test: split test_immutablity in 2 functions

    One function tests the behavior: 'the model is mutable'
    The other tests the behavior:OC 'the model is immutable'
    rhuille committed Feb 23, 2021
    Copy the full SHA
    a6943a8 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    3e98d57 View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    ad82bf0 View commit details
    Browse the repository at this point in the history