Skip to content

Commit 5e61fc5

Browse files
committed
Fix some linter warnings
1 parent e7ae637 commit 5e61fc5

4 files changed

Lines changed: 7 additions & 16 deletions

File tree

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# ruff: noqa: E402
12
#
23
# Nameparser documentation build configuration file, created by
34
# sphinx-quickstart on Fri May 16 01:29:58 2014.

nameparser/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
from nameparser.parser import HumanName as HumanName
2+
3+
14
VERSION = (1, 1, 3)
25
__version__ = '.'.join(map(str, VERSION))
36
__author__ = "Derek Gulbranson"
47
__author_email__ = 'derek73@gmail.com'
58
__license__ = "LGPL"
69
__url__ = "https://github.com/derek73/python-nameparser"
7-
8-
9-
from nameparser.parser import HumanName

nameparser/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def __process_initial__(self, name_part: str, firstname: bool = False) -> str:
233233
initials = []
234234
if len(parts) and isinstance(parts, list):
235235
for part in parts:
236-
if not (self.is_prefix(part) or self.is_conjunction(part)) or firstname == True:
236+
if not (self.is_prefix(part) or self.is_conjunction(part)) or firstname:
237237
initials.append(part[0])
238238
if len(initials) > 0:
239239
return " ".join(initials)
@@ -574,7 +574,7 @@ def handle_firstnames(self) -> None:
574574
"""
575575
if self.title \
576576
and len(self) == 2 \
577-
and not lc(self.title) in self.C.first_name_titles:
577+
and lc(self.title) not in self.C.first_name_titles:
578578
self.last, self.first = self.first, self.last
579579

580580
def parse_full_name(self) -> None:

tests.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# ruff: noqa: E402
12
import unittest
23
"""
34
Run this file to run the tests.
@@ -57,9 +58,6 @@ def test_utf8(self) -> None:
5758
self.m(hn.first, "Jüan", hn)
5859
self.m(hn.last, "de la Véña", hn)
5960

60-
def test_string_output(self) -> None:
61-
hn = HumanName("de la Véña, Jüan")
62-
6361
def test_escaped_utf8_bytes(self) -> None:
6462
hn = HumanName(b'B\xc3\xb6ck, Gerald')
6563
self.m(hn.first, "Gerald", hn)
@@ -2575,14 +2573,6 @@ def test_variations_of_TEST_NAMES(self) -> None:
25752573
hn = HumanName("{title} {first} {middle} {last} {suffix}".format(**hn.as_dict()).split(',')[0])
25762574
hn.C.empty_attribute_default = '' # format strings below require empty string
25772575
hn_dict = hn.as_dict()
2578-
attrs = [
2579-
'title',
2580-
'first',
2581-
'middle',
2582-
'last',
2583-
'suffix',
2584-
'nickname',
2585-
]
25862576
nocomma = HumanName("{title} {first} {middle} {last} {suffix}".format(**hn_dict))
25872577
lastnamecomma = HumanName("{last}, {title} {first} {middle} {suffix}".format(**hn_dict))
25882578
if hn.suffix:

0 commit comments

Comments
 (0)