Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"It takes all sorts of in & out-door schooling to get adapted to my kind of fooling" -- R. Frost


devel / comp.lang.python / Detect naming typos (AttributeError) in function names

SubjectAuthor
o Detect naming typos (AttributeError) in function namesc.buhtz

1
Detect naming typos (AttributeError) in function names

<mailman.169.1699282824.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28783&group=comp.lang.python#28783

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: c.buhtz@posteo.jp
Newsgroups: comp.lang.python
Subject: Detect naming typos (AttributeError) in function names
Date: Mon, 06 Nov 2023 12:47:57 +0000
Lines: 27
Message-ID: <mailman.169.1699282824.3828.python-list@python.org>
References: <5e41dd577da656946398652a83acb0be@posteo.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de X1IifXiXYg8IxtwPckxHQQnrB/YZczB2HSrV8af9+vGg==
Cancel-Lock: sha1:LudP4yI15y+ekE1jVW8Kb+M86/4= sha256:PJsRmO8B9qyo28FnIzoJwrL7uvFx4HZsYZtDaNkye/w=
Return-Path: <c.buhtz@posteo.jp>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=posteo.jp header.i=@posteo.jp header.b=k93D7NC8;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.151
X-Spam-Level: *
X-Spam-Evidence: '*H*': 0.71; '*S*': 0.01; '(e.g.': 0.05; 'cases.':
0.09; 'module.': 0.09; 'import': 0.15; 'that.': 0.15; 'python':
0.16; 'to:addr:python-list': 0.20; 'code': 0.23; 'run': 0.23;
'received:de': 0.23; 'else': 0.27; 'function': 0.27; 'error':
0.29; 'assume': 0.32; 'christian': 0.32; 'but': 0.32; "i'm": 0.33;
'package': 0.34; 'fix': 0.36; 'really': 0.37; 'using': 0.37;
'way': 0.38; 'ide': 0.40; 'something': 0.40; 'hello,': 0.40;
'lower': 0.62; 'involved': 0.63; 'look': 0.65; 'named': 0.65;
'interested': 0.68; 'received:185': 0.71; 'tools': 0.74;
'covered': 0.75; 'unit': 0.81; 'subject:skip:A 10': 0.91; '(all':
0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.jp; s=2017;
t=1699274878; bh=tFyqj4axdca42oKamACXAgQ3Fw+4uQl2XTyoplcg3mI=;
h=MIME-Version:Content-Transfer-Encoding:Date:From:To:Subject:
Message-ID:From;
b=k93D7NC8t6ybcWZPLPD++t/mymzzKGUepf0jOjH9nebm5qFHrl27rUhx+HQnMEw5i
xXS/8ks0i38P3arcFrAf06s8vorOlU7F30+Mv+VtCJINpSKUKmOrvVFvBrzmIQ73aE
Tk0dlWHV2JiyTTpUWRCOj7T3wdikQTLRr/omzPoX96JpXwlx8va555681BPkT2DirZ
Hr1JYGNtfo/yl1ISuZnXPDti45b2duIuBpLNKesWMVgsBPAFoQgT5G7nUJR/9P1/qT
xgx/FnWJxuIY2qOSq83SG3LMUPhh4Pv0dStL7vH25qxgg97R1RfSLWmB28whb3dwrc
bIegMV1D77y5Q==
Mail-Followup-To: python-list@python.org
X-Mailman-Approved-At: Mon, 06 Nov 2023 10:00:23 -0500
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <5e41dd577da656946398652a83acb0be@posteo.de>
 by: c.buhtz@posteo.jp - Mon, 6 Nov 2023 12:47 UTC

Hello,

I would like to know how to detect (e.g. via a linter) typos in function
names imported from another module.

Let's assume this given Python code snippet.

import foo
foo.baR()

The package "foo" do contain a function named "bar()" (all lower case
letters). The function "baR()" does not exist in "foo". This cause an
AttributeError when run with a Python interpreter.

The described error is not detected in my IDE (Emacs with eglot, pylsp
and flake8) and not by flake8 on the shell. Because the involved tools
do not look inside the "foo" package if "baR()" really exist.

Can I fix this somehow?

I am aware that this would get detected by a unit test. That is the way
I do prefer in most cases. But sometimes not all code segments are
covered by tests. I'm more interested in using a linter or something
else for that.

Kind
Christian


devel / comp.lang.python / Detect naming typos (AttributeError) in function names

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor