Changeset 1904:b4a652aba0d8


Ignore:
Timestamp:
Jan 3, 2020, 1:08:42 PM (2 weeks ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
histedit_source:
632aa66afac21633b6b3e3438642ff99ca0add0b
Message:
Use `year_is_known` instead of `year_is_unknown`

Avoid potentially confusing double negation (`not year_is_unknown`)
and switch the `if`/`else` statement accordingly.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ftputil/stat.py

    r1902 r1904  
    298298            )
    299299        day = self._as_int(day, "day")
    300         year_is_unknown = ":" in year_or_time
    301         if year_is_unknown:
     300        year_is_known = ":" not in year_or_time
     301        if year_is_known:
     302            # `year_or_time` is really a year.
     303            st_mtime_precision = DAY_PRECISION
     304            server_year, hour, minute = self._as_int(year_or_time, "year"), 0, 0
     305        else:
    302306            # `year_or_time` is a time hh:mm.
    303307            st_mtime_precision = MINUTE_PRECISION
     
    312316                datetime.datetime.now() + datetime.timedelta(seconds=time_shift)
    313317            ).year
    314         else:
    315             # `year_or_time` is really a year.
    316             st_mtime_precision = DAY_PRECISION
    317             server_year, hour, minute = self._as_int(year_or_time, "year"), 0, 0
    318318        server_datetime = self._datetime(server_year, month, day, hour, minute, 0)
    319319        # Datetime in the local client time
    320320        client_datetime = server_datetime - datetime.timedelta(seconds=time_shift)
    321         if year_is_unknown:
     321        if not year_is_known:
    322322            # If the client datetime is in the future, the timestamp is actually
    323323            # in the past, from last year. Add the deviation (the `timedelta`
Note: See TracChangeset for help on using the changeset viewer.