-
Notifications
You must be signed in to change notification settings - Fork 82
mypy: fix all assignment #368
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -249,6 +249,7 @@ def getopt(self, args: Sequence[str] | None = None, object=None): # noqa: C901 | |
| raise DistutilsArgError(msg) | ||
|
|
||
| for opt, val in opts: | ||
| value: int | str = val | ||
| if len(opt) == 2 and opt[0] == '-': # it's a short option | ||
| opt = self.short2long[opt[1]] | ||
| else: | ||
|
|
@@ -260,21 +261,21 @@ def getopt(self, args: Sequence[str] | None = None, object=None): # noqa: C901 | |
| opt = alias | ||
|
|
||
| if not self.takes_arg[opt]: # boolean option? | ||
| assert val == '', "boolean option can't have value" | ||
| assert value == '', "boolean option can't have value" | ||
| alias = self.negative_alias.get(opt) | ||
| if alias: | ||
| opt = alias | ||
| val = 0 | ||
| value = 0 | ||
| else: | ||
| val = 1 | ||
| value = 1 | ||
|
|
||
| attr = self.attr_name[opt] | ||
| # The only repeating option at the moment is 'verbose'. | ||
| # It has a negative option -q quiet, which should set verbose = False. | ||
| if val and self.repeat.get(attr) is not None: | ||
| val = getattr(object, attr, 0) + 1 | ||
| setattr(object, attr, val) | ||
| self.option_order.append((opt, val)) | ||
| if value and self.repeat.get(attr) is not None: | ||
| value = getattr(object, attr, 0) + 1 | ||
| setattr(object, attr, value) | ||
| self.option_order.append((opt, value)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See discussion in https://github.com/pypa/distutils/pull/343/files#r2440199822 |
||
|
|
||
| # for opts | ||
| if created_object: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -324,6 +324,16 @@ def customize_compiler(compiler: CCompiler) -> None: | |
| 'AR', | ||
| 'ARFLAGS', | ||
| ) | ||
| assert isinstance(cc, str) | ||
| assert isinstance(cxx, str) | ||
| assert isinstance(cflags, str) | ||
| assert isinstance(ccshared, str) | ||
| assert isinstance(ldshared, str) | ||
| assert isinstance(ldcxxshared, str) | ||
| assert isinstance(shlib_suffix, str) | ||
| assert isinstance(ar_flags, str) | ||
| ar = os.environ.get('AR', ar) | ||
| assert isinstance(ar, str) | ||
|
Comment on lines
+327
to
+336
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| cxxflags = cflags | ||
|
|
||
|
|
@@ -354,8 +364,6 @@ def customize_compiler(compiler: CCompiler) -> None: | |
| ldshared = _add_flags(ldshared, 'CPP') | ||
| ldcxxshared = _add_flags(ldcxxshared, 'CPP') | ||
|
|
||
| ar = os.environ.get('AR', ar) | ||
|
|
||
| archiver = ar + ' ' + os.environ.get('ARFLAGS', ar_flags) | ||
| cc_cmd = cc + ' ' + cflags | ||
| cxx_cmd = cxx + ' ' + cxxflags | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Runtime change: avoid assigning
Nonetoruntime_library_dirs(I didn't fully investigate whether that should even be possible at runtime or just an artefact of code that is too dynamic to be type-safe)