mirror of
https://github.com/Instagram/LibCST.git
synced 2025-12-23 10:35:53 +00:00
parent
a1b1ae45d5
commit
a5de9e40a0
5 changed files with 12 additions and 10 deletions
|
|
@ -590,7 +590,7 @@ def parallel_exec_transform_with_prettyprint( # noqa: C901
|
|||
progress = Progress(enabled=not hide_progress, total=total)
|
||||
|
||||
# Grab number of cores if we need to
|
||||
jobs: int = jobs or cpu_count()
|
||||
jobs: int = jobs if jobs is not None else cpu_count()
|
||||
|
||||
if jobs < 1:
|
||||
raise Exception("Must have at least one job to process!")
|
||||
|
|
@ -598,7 +598,7 @@ def parallel_exec_transform_with_prettyprint( # noqa: C901
|
|||
if total == 0:
|
||||
return ParallelTransformResult(successes=0, failures=0, skips=0, warnings=0)
|
||||
|
||||
if repo_root:
|
||||
if repo_root is not None:
|
||||
# Make sure if there is a root that we have the absolute path to it.
|
||||
repo_root = os.path.abspath(repo_root)
|
||||
# Spin up a full repo metadata manager so that we can provide metadata
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ class ConvertFormatStringCommand(VisitorBasedCodemodCommand):
|
|||
spec_format_spec,
|
||||
spec_conversion,
|
||||
) in format_spec_tokens:
|
||||
if spec_format_spec:
|
||||
if spec_format_spec is not None:
|
||||
# This shouldn't be possible, we don't allow it in the spec!
|
||||
raise Exception("Logic error!")
|
||||
if spec_literal_text:
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ def _get_import_alias_names(import_aliases: Sequence[cst.ImportAlias]) -> Set[st
|
|||
import_names = set()
|
||||
for imported_name in import_aliases:
|
||||
asname = imported_name.asname
|
||||
if asname:
|
||||
if asname is not None:
|
||||
import_names.add(get_full_name_for_node(asname.name))
|
||||
else:
|
||||
import_names.add(get_full_name_for_node(imported_name.name))
|
||||
|
|
@ -242,7 +242,9 @@ class ApplyTypeAnnotationsVisitor(ContextAwareTransformer):
|
|||
super().__init__(context)
|
||||
# Qualifier for storing the canonical name of the current function.
|
||||
self.qualifier: List[str] = []
|
||||
self.annotations: Annotations = annotations or Annotations()
|
||||
self.annotations: Annotations = (
|
||||
Annotations() if annotations is None else annotations
|
||||
)
|
||||
self.toplevel_annotations: Dict[str, cst.Annotation] = {}
|
||||
self.visited_classes: Set[str] = set()
|
||||
self.overwrite_existing_annotations = overwrite_existing_annotations
|
||||
|
|
@ -297,7 +299,7 @@ class ApplyTypeAnnotationsVisitor(ContextAwareTransformer):
|
|||
context_contents = self.context.scratch.get(
|
||||
ApplyTypeAnnotationsVisitor.CONTEXT_KEY
|
||||
)
|
||||
if context_contents:
|
||||
if context_contents is not None:
|
||||
stub, overwrite_existing_annotations = context_contents
|
||||
self.overwrite_existing_annotations = (
|
||||
self.overwrite_existing_annotations or overwrite_existing_annotations
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ def get_absolute_module_for_import(
|
|||
return None
|
||||
base_module = ".".join(modules[:-num_dots])
|
||||
# Finally, if the module name was supplied, append it to the end.
|
||||
if module_name:
|
||||
if module_name is not None:
|
||||
# If we went all the way to the top, the base module should be empty, so we
|
||||
# should return the relative bit as absolute. Otherwise, combine the base
|
||||
# module and module name using a dot separator.
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
black>=19.10b0
|
||||
black==20.8b1
|
||||
codecov>=2.1.4
|
||||
coverage>=4.5.4
|
||||
fixit>=0.1.0
|
||||
fixit==0.1.1
|
||||
flake8>=3.7.8
|
||||
hypothesis>=4.36.0
|
||||
hypothesmith>=0.0.4
|
||||
git+https://github.com/jimmylai/sphinx.git@slots_type_annotation
|
||||
isort>=4.3.20
|
||||
isort==5.5.3
|
||||
jupyter>=1.0.0
|
||||
nbsphinx>=0.4.2
|
||||
pyre-check==0.0.41
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue