Skip to content

Conversation

@ko1in1u
Copy link
Collaborator

@ko1in1u ko1in1u commented Jun 4, 2025

Built-in function open was called with the wrong arguments [wrong-arg-types]

       Expected: (file: Union[_PathLike, bytes, int, str], ...)
Actually passed: (file: None, ...)
Attributes of protocol _PathLike are not implemented on None: __fspath__

This change is Reviewable

@ko1in1u ko1in1u added this to the Mobly Release 1.13.1 milestone Jun 4, 2025
@ko1in1u ko1in1u requested a review from xpconanfan June 4, 2025 00:19
@ko1in1u ko1in1u self-assigned this Jun 4, 2025
Copy link
Collaborator

@xpconanfan xpconanfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @ko1in1u)


mobly/controllers/android_device_lib/services/logcat.py line 196 at r1 (raw file):

    if not self._adb_logcat_file_obj:
      deadline = time.perf_counter() + CREATE_LOGCAT_FILE_TIMEOUT_SEC
      while not os.path.exists(self.adb_logcat_file_path):

this already make sure adb_logcat_file_path won't be None, no?

@ko1in1u
Copy link
Collaborator Author

ko1in1u commented Jun 4, 2025

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @ko1in1u)

mobly/controllers/android_device_lib/services/logcat.py line 196 at r1 (raw file):

    if not self._adb_logcat_file_obj:
      deadline = time.perf_counter() + CREATE_LOGCAT_FILE_TIMEOUT_SEC
      while not os.path.exists(self.adb_logcat_file_path):

this already make sure adb_logcat_file_path won't be None, no?

Yes, this is the place to assign value to adb_logcat_file_path. However, pytype isn't aware because it performs static analysis and cannot definitively track the runtime assignment of self.adb_logcat_file_path from None to a string based on external conditions.

Copy link
Collaborator

@xpconanfan xpconanfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @ko1in1u)


mobly/controllers/android_device_lib/services/logcat.py line 196 at r1 (raw file):

Previously, ko1in1u (Kolin Lu) wrote…

Yes, this is the place to assign value to adb_logcat_file_path. However, pytype isn't aware because it performs static analysis and cannot definitively track the runtime assignment of self.adb_logcat_file_path from None to a string based on external conditions.

We should not add random checks for linter.

Either tell the linter to ignore this part, or make the assignment logic more explicit so linter stop complaining

@ko1in1u
Copy link
Collaborator Author

ko1in1u commented Jun 4, 2025

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @ko1in1u)

mobly/controllers/android_device_lib/services/logcat.py line 196 at r1 (raw file):

Previously, ko1in1u (Kolin Lu) wrote…
We should not add random checks for linter.

Either tell the linter to ignore this part, or make the assignment logic more explicit so linter stop complaining

Add in-line comment to disable the pytype error.

@ko1in1u ko1in1u requested a review from xpconanfan June 4, 2025 19:42
@xpconanfan xpconanfan merged commit c96f71f into google:master Jun 5, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants