Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
schematics~=2.1.1
pyyaml~=6.0.2
fuzzywuzzy~=0.18.0
thefuzz~=0.22.1
pluralizer~=1.2.0
lxml>=5.0.0
flask~=3.0.3
Expand All @@ -12,6 +12,5 @@ MarkupSafe>=2.1.5
jsonschema~=4.23.0
click~=8.1.2
setuptools>=78.1.1
python-Levenshtein
azure-mgmt-core
azdev
6 changes: 4 additions & 2 deletions src/aaz_dev/swagger/model/specs/_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
import re

from fuzzywuzzy import fuzz
from thefuzz import fuzz

from command.model.configuration import CMDResource
from ._utils import map_path_2_repo
Expand Down Expand Up @@ -62,9 +62,11 @@ def get_operation_group_name(self):
if len(operation_groups) == 1:
return operation_groups.pop()

# use the name which is closest to resource_id. resource_id is lower case, so compare
# case-insensitively, and break ties by length then name so the choice is deterministic.
op_group_name = sorted(
operation_groups,
key=lambda nm: fuzz.partial_ratio(self.id, nm), # use the name which is closest to resource_id
key=lambda nm: (fuzz.partial_ratio(self.id, nm.lower()), len(nm), nm),
reverse=True
)[0]
setattr(self, "_op_group_name", op_group_name)
Expand Down
Loading