Skip to content
Merged
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
2 changes: 1 addition & 1 deletion khal/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def edit_event(event, collection, locale, allow_quit=False, width=80):
start, end, allday = parse_datetime.guessrangefstr(ansi.sub('', value), locale)
event.update_start_end(start, end)
edited = True
except: # noqa
except Exception:
echo("error parsing range")
elif choice == "repeat":
recur = event.recurobject
Expand Down
2 changes: 1 addition & 1 deletion khal/khalendar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

from .khalendar import CalendarCollection # noqa: F401 # type: ignore
from .khalendar import CalendarCollection as CalendarCollection
2 changes: 1 addition & 1 deletion khal/khalendar/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def fromVEvents(cls,
if ref is None:
ref = 'PROTO' if ref in vevents.keys() else list(vevents.keys())[0]
try:
if type(vevents[ref]['DTSTART'].dt) != type(vevents[ref]['DTEND'].dt): # noqa: E721
if type(vevents[ref]['DTSTART'].dt) is not type(vevents[ref]['DTEND'].dt):
raise ValueError('DTSTART and DTEND should be of the same type (datetime or date)')
except KeyError:
pass
Expand Down
4 changes: 2 additions & 2 deletions khal/khalendar/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

from typing import Optional # noqa
from typing import Optional

from khal.exceptions import Error, FatalError, UnsupportedFeatureError

Expand Down Expand Up @@ -65,7 +65,7 @@ class UpdateFailed(Error):
class DuplicateUid(Error):

"""an event with this UID already exists"""
existing_href = None # type: Optional[str]
existing_href: Optional[str] = None


class NonUniqueUID(Error):
Expand Down
3 changes: 2 additions & 1 deletion khal/khalendar/khalendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
import logging
import os
import os.path
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Union # noqa
from collections.abc import Iterable
from typing import Optional, Union

from khal.custom_types import CalendarConfiguration, EventCreationTypes, LocaleConfiguration
from khal.icalendar import new_vevent
Expand Down
13 changes: 9 additions & 4 deletions khal/settings/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from .exceptions import InvalidSettingsError # noqa # type: ignore
from .exceptions import NoConfigFile # noqa # type: ignore
from .settings import find_configuration_file # noqa # type: ignore
from .settings import get_config # noqa # type: ignore
from .exceptions import InvalidSettingsError, NoConfigFile
from .settings import find_configuration_file, get_config

__all__ = [
"InvalidSettingsError",
"NoConfigFile",
"find_configuration_file",
"get_config",
]
3 changes: 2 additions & 1 deletion khal/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@

from . import colors
from .base import Pane, Window
from .calendarwidget import CalendarWidget
from .editor import EventEditor, ExportDialog
from .widgets import CalendarWidget, CAttrMap, NColumns, NPile, button, linebox
from .widgets import CAttrMap, NColumns, NPile, button, linebox
from .widgets import ExtendedEdit as Edit

logger = logging.getLogger('khal')
Expand Down
2 changes: 1 addition & 1 deletion khal/ui/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

from khal.utils import get_weekday_occurrence, get_wrapped_text

from .calendarwidget import CalendarWidget
from .widgets import (
AlarmsEditor,
CalendarWidget,
CAttrMap,
Choice,
CPadding,
Expand Down
2 changes: 0 additions & 2 deletions khal/ui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@

import urwid

from .calendarwidget import CalendarWidget # noqa


class DateConversionError(Exception):
pass
Expand Down
20 changes: 10 additions & 10 deletions khal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,21 @@ def generate_random_uid() -> str:


def find_last_reset(string: str) -> tuple[int, int, str]:
for match in re.finditer(ansi_reset, string): # noqa B007: this is actually used below.
pass
try:
return match.start(), match.end(), match.group(0)
except UnboundLocalError:
last = None
for m in re.finditer(ansi_reset, string):
last = m
if last is None:
return -2, -1, ''
return last.start(), last.end(), last.group(0)


def find_last_sgr(string: str) -> tuple[int, int, str]:
for match in re.finditer(ansi_sgr, string): # noqa B007: this is actually used below.
pass
try:
return match.start(), match.end(), match.group(0)
except UnboundLocalError:
last = None
for m in re.finditer(ansi_sgr, string):
last = m
if last is None:
return -2, -1, ''
return last.start(), last.end(), last.group(0)


def find_unmatched_sgr(string: str) -> Optional[str]:
Expand Down