-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Sequence index is not an int, slice, or instance with __index__ (with scipy.fft) #4083
Comments
Also with: Steps to reproduce
types = ["test type"]
class Example:
def __init__(self, type):
self.type = types[type] Current behavior
pylint --version outputpylint 2.7.2 |
Avoid false positives with 2.7. 2.7.0 https://github.com/fract4d/gnofract4d/runs/1955404235#step:9:15 E1101: Instance of 'OverloadList' has no 'ret' member (no-member) 2.7.2 E1126: Sequence index is not an int, slice, or instance with __index__ (invalid-sequence-index) pylint-dev/pylint#4083
Avoid false positives with 2.7. 2.7.0 E1101: Instance of 'OverloadList' has no 'ret' member (no-member) https://github.com/fract4d/gnofract4d/runs/1955404235#step:9:15 2.7.2 E1126: Sequence index is not an int, slice, or instance with __index__ (invalid-sequence-index) pylint-dev/pylint#4083
Avoid false positives with 2.7. 2.7.0 E1101: Instance of 'OverloadList' has no 'ret' member (no-member) https://github.com/fract4d/gnofract4d/runs/1955404235#step:9:15 2.7.2 E1126: Sequence index is not an int, slice, or instance with __index__ (invalid-sequence-index) pylint-dev/pylint#4083
Ref pylint-dev/pylint#4083. Ref pylint-dev/pylint#4387. When used in a nodes.Subscript, an existing inference_tip was set for Name nodes matching called type. However, when this name was redefined this led to false-positive typecheck errors in pylint such as invalid-sequence-index (see pylint-dev/pylint#4083 and pylint-dev/pylint#4387)
Ref pylint-dev/pylint#4083. Ref pylint-dev/pylint#4387. When used in a nodes.Subscript, an existing inference_tip was set for Name nodes matching called type. However, when this name was redefined this led to false-positive typecheck errors in pylint such as invalid-sequence-index (see pylint-dev/pylint#4083 and pylint-dev/pylint#4387)
Ref pylint-dev/pylint#4083. Ref pylint-dev/pylint#4387. When used in a nodes.Subscript, an existing inference_tip was set for Name nodes matching called type. However, when this name was redefined this led to false-positive typecheck errors in pylint such as invalid-sequence-index due to the argument being inferred as builtins.type and inference_tip preventing any further inference.
Ref pylint-dev/pylint#4083. Ref pylint-dev/pylint#4387. When used in a nodes.Subscript, an existing inference_tip was set for Name nodes matching called type. However, when this name was redefined this led to false-positive typecheck errors in pylint such as invalid-sequence-index due to the argument being inferred as builtins.type and inference_tip preventing any further inference.
Hello, this also happens in gspread, I tried to make a minimal reproducible example, but I'm not sure if I did it right. Steps to reproduce import os
from pathlib import Path
import gspread
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
def get_creds(scopes: list[str], creds_file: Path, token_file: Path):
creds = None
if token_file.is_file():
creds = Credentials.from_authorized_user_file(token_file, scopes)
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
elif creds_file.is_file():
flow = InstalledAppFlow.from_client_secrets_file(
creds_file, scopes)
creds = flow.run_local_server(port=0)
else:
raise FileNotFoundError(creds_file)
with open(token_file, "w", encoding="utf-8") as token:
token.write(creds.to_json())
return creds
GMAIL_CREDS = Path(os.environ["GMAIL_CREDS"]) # client secrets file
GMAIL_TOKEN = Path("token.json")
SHEETS_ID = os.environ["GSPREADSHEET"] # Google spreadsheet key
credentials = get_creds(
['https://www.googleapis.com/auth/gmail.send'], GMAIL_CREDS, GMAIL_TOKEN)
service = gspread.authorize(credentials=credentials)
try:
spreadsheet = service.open_by_key(SHEETS_ID)
except gspread.exceptions.APIError as err:
if err.args[0]['status'] == 'PERMISSION_DENIED': # offending line
raise PermissionError(
f"You don't have access to {SHEETS_ID!r}") from None
raise pylint test.py --errors-only Current behaviour
pylint --version output I tried the following: error_data: dict[str, str] = err.args[0]
if error_data['status'] == 'PERMISSION_DENIED':
... But pylint still sees |
Steps to reproduce
test.py
Current behavior
Expected behavior
No errors.
pylint --version output
pylint 2.6.0
astroid 2.4.2
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0]
The text was updated successfully, but these errors were encountered: