Skip to content

Commit

Permalink
Adjust ordering function to allow multicharacter strings as keys to K…
Browse files Browse the repository at this point in the history
…eyValuePairs
  • Loading branch information
xnx committed Jul 4, 2022
1 parent d862165 commit 8f26cc2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*.swo
.DS_Store
res/
activate

# PyCharm
.idea
Expand Down
7 changes: 5 additions & 2 deletions src/pyvalem/states/key_value_pair.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,8 @@ def __repr__(self):
@property
def ordering(self):
if self.key == "n":
return 0
return ord(self.key)
# Move up n to the first position for ordering by replacing it with
# a space (ASCII 32, the first printable character and not a real valid
# key.
return " "
return self.key

0 comments on commit 8f26cc2

Please sign in to comment.