Skip to content
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

some python 3 language updates #588

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@
master_doc = "index"

# General information about the project.
project = u"schedule"
copyright = u'2020, <a href="https://dbader.org/">Daniel Bader</a>'
author = u'<a href="https://dbader.org/">Daniel Bader</a>'
project = "schedule"
copyright = '2020, <a href="https://dbader.org/">Daniel Bader</a>'
author = '<a href="https://dbader.org/">Daniel Bader</a>'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u"1.2.0"
version = "1.2.0"
# The full version, including alpha/beta/rc tags.
release = u"1.2.0"
release = "1.2.0"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -284,8 +284,8 @@
(
master_doc,
"schedule.tex",
u"schedule Documentation",
u"Daniel Bader",
"schedule Documentation",
"Daniel Bader",
"manual",
),
]
Expand Down Expand Up @@ -327,7 +327,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "schedule", u"schedule Documentation", [author], 1)]
man_pages = [(master_doc, "schedule", "schedule Documentation", [author], 1)]

# If true, show URL addresses after external links.
#
Expand All @@ -343,7 +343,7 @@
(
master_doc,
"schedule",
u"schedule Documentation",
"schedule Documentation",
author,
"schedule",
"One line description of project.",
Expand Down
12 changes: 6 additions & 6 deletions schedule/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
[2] https://github.com/Rykian/clockwork
[3] https://adam.herokuapp.com/past/2010/6/30/replace_cron_with_clockwork/
"""
from collections.abc import Hashable
import datetime
import functools
import logging
import random
import re
import time
from typing import Set, List, Optional, Callable, Union
from collections.abc import Hashable
from typing import Callable, List, Optional, Set, Union

logger = logging.getLogger("schedule")

Expand Down Expand Up @@ -295,7 +295,7 @@ def is_repr(j):

if self.job_func is not None:
args = [repr(x) if is_repr(x) else str(x) for x in self.job_func.args]
kwargs = ["%s=%s" % (k, repr(v)) for k, v in self.job_func.keywords.items()]
kwargs = [f"{k}={repr(v)}" for k, v in self.job_func.keywords.items()]
call_repr = job_func_name + "(" + ", ".join(args + kwargs) + ")"
else:
call_repr = "[None]"
Expand Down Expand Up @@ -545,7 +545,7 @@ def at(self, time_str: str, tz: Optional[str] = None):
second = 0
if self.unit == "days" or self.start_day:
hour = int(hour)
if not (0 <= hour <= 23):
if not 0 <= hour <= 23:
raise ScheduleValueError(
"Invalid number of hours ({} is not between 0 and 23)"
)
Expand Down Expand Up @@ -710,7 +710,7 @@ def _schedule_next_run(self) -> None:
)

if self.latest is not None:
if not (self.latest >= self.interval):
if not self.latest >= self.interval:
raise ScheduleError("`latest` is greater than `interval`")
interval = random.randint(self.interval, self.latest)
else:
Expand All @@ -732,7 +732,7 @@ def _schedule_next_run(self) -> None:
)
if self.start_day not in weekdays:
raise ScheduleValueError(
"Invalid start day (valid start days are {})".format(weekdays)
f"Invalid start day (valid start days are {weekdays})"
)
weekday = weekdays.index(self.start_day)
days_ahead = weekday - self.next_run.weekday()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import codecs
from setuptools import setup

from setuptools import setup

SCHEDULE_VERSION = "1.2.0"
SCHEDULE_DOWNLOAD_URL = "https://github.com/dbader/schedule/tarball/" + SCHEDULE_VERSION
Expand Down
19 changes: 8 additions & 11 deletions test_schedule.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
"""Unit tests for schedule.py"""
import datetime
import functools
import mock
import unittest
import os
import time
import unittest

import mock

import schedule
from schedule import (IntervalError, ScheduleError, ScheduleValueError, every,
repeat)

# Silence "missing docstring", "method could be a function",
# "class already defined", and "too many public methods" messages:
# pylint: disable-msg=R0201,C0111,E0102,R0904,R0901
# pylint: disable-msg=C0111,E0102,R0904,R0901

import schedule
from schedule import (
every,
repeat,
ScheduleError,
ScheduleValueError,
IntervalError,
)

# Set timezone to Europe/Berlin (CEST) to ensure global reproducibility
os.environ["TZ"] = "CET-1CEST,M3.5.0,M10.5.0"
Expand Down