Skip to content

Commit

Permalink
Adding a dict class to pass through keys as values
Browse files Browse the repository at this point in the history
  • Loading branch information
constantinius committed Apr 25, 2024
1 parent 06254fc commit 936578f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pygeofilter/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# THE SOFTWARE.
# ------------------------------------------------------------------------------

from collections.abc import Mapping
import re
from datetime import date, datetime, timedelta

Expand Down Expand Up @@ -141,3 +142,15 @@ def like_pattern_to_re(like, nocase, wildcard, single_char, escape_char):
like_pattern_to_re_pattern(like, wildcard, single_char, escape_char),
flags=flags,
)


class IdempotentDict(Mapping):
"A dict class that always returns the key"
def __getitem__(self, key):
return key

def __iter__(self):
return iter(())

def __len__(self) -> int:
return 0

0 comments on commit 936578f

Please sign in to comment.