Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
Bago Amirbekian committed Jan 26, 2024
1 parent eda133a commit cf83daf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
======================
s======================
Contributing to Rope
======================

Expand Down
1 change: 1 addition & 0 deletions rope/contrib/autoimport/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class Package(NamedTuple):

class Alias(NamedTuple):
"""A module alias to be added to the database."""

alias: str
modname: str

Expand Down
4 changes: 3 additions & 1 deletion rope/contrib/autoimport/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ class Alias(Model):
@classmethod
def create_table(cls, connection):
super().create_table(connection)
connection.execute("CREATE INDEX IF NOT EXISTS aliases_alias_nocase ON aliases(alias COLLATE NOCASE)")
connection.execute(
"CREATE INDEX IF NOT EXISTS aliases_alias_nocase ON aliases(alias COLLATE NOCASE)"
)

modules = Query(
"(SELECT DISTINCT aliases.*, package, source, type FROM aliases INNER JOIN names on aliases.module = names.module)",
Expand Down
5 changes: 3 additions & 2 deletions rope/contrib/autoimport/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ def _search_module(
f"import {module}", module, source, NameType.Module.value
)
for alias, module, source in self._execute(
models.Alias.search_modules_with_alias.select("alias", "module", "source"), (name,)
models.Alias.search_modules_with_alias.select("alias", "module", "source"),
(name,)
):
yield SearchResult(
f"import {module} as {alias}", alias, source, NameType.Module.value
Expand Down Expand Up @@ -604,7 +605,7 @@ def _convert_name(name: Name) -> tuple:
name.source.value,
name.name_type.value,
)

def add_aliases(self, aliases: Iterable[Alias]):
if aliases:
self._executemany(models.Alias.objects.insert_into(), aliases)
Expand Down

0 comments on commit cf83daf

Please sign in to comment.