Skip to content

False Positive E1102: time.time is not callable (not-callable) #10874

@jamesquilty

Description

@jamesquilty

Bug description

I have a module in my source tree src/util/time.py which defines some utility functions

import time

def somefunc():
    ...

in src/main.py I have

import time
from util.time import somefunc
...
def main():
    ...
    current_time = time.time()

and pylint is complaining about every occurrence of time.time().

I'm not entirely happy with this code and I'd like to refactor src/util/time.py to

from time import *

def somefunc():
    ...

which avoids pylint throwing spurious E1102 errors, but it seems to me that pylint shouldn't be emitting E1102 in this circumstance in the first place.

Configuration

Command used

pylint src

Pylint output

************* Module main
src/main.py:368:59: E1102: time.time is not callable (not-callable)
src/main.py:453:34: E1102: time.time is not callable (not-callable)
src/main.py:499:19: E1102: time.time is not callable (not-callable)
src/main.py:508:34: E1102: time.time is not callable (not-callable)

Expected behaviour

The error is not emitted.

Pylint version

pylint 4.0.5
astroid 4.0.4
Python 3.11.9 (main, May 11 2024, 12:27:00) [Clang 15.0.0 (clang-1500.3.9.4)]

OS / Environment

macOS 15.7.4

Additional dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs triage 📥Just created, needs acknowledgment, triage, and proper labelling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions