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

Python3.13 compat #809

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
6 changes: 5 additions & 1 deletion rope/base/oi/type_hinting/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import logging
import sys
from typing import TYPE_CHECKING, Optional, Union

import rope.base.utils as base_utils
Expand Down Expand Up @@ -81,7 +82,10 @@ def resolve_type(
"""
Find proper type object from its name.
"""
deprecated_aliases = {"collections": "collections.abc"}
if sys.version_info < (3, 13):
deprecated_aliases = {"collections": "collections.abc"}
else:
deprecated_aliases = {"collections": "_collections_abc"}
ret_type = None
logging.debug("Looking for %s", type_name)
if "." not in type_name:
Expand Down
19 changes: 11 additions & 8 deletions rope/contrib/autoimport/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,14 +569,17 @@ def filter_folders(folder: Path) -> bool:
return list(OrderedDict.fromkeys(folder_paths))

def _safe_iterdir(self, folder: Path):
dirs = folder.iterdir()
while True:
try:
yield next(dirs)
except PermissionError:
pass
except StopIteration:
break
try:
dirs = folder.iterdir()
while True:
try:
yield next(dirs)
except PermissionError:
pass
except StopIteration:
break
except PermissionError:
pass

def _get_available_packages(self) -> List[Package]:
packages: List[Package] = [
Expand Down
Loading