Skip to content

Commit

Permalink
fixing deprecation warnings with argh
Browse files Browse the repository at this point in the history
When I run watchmedo, it throws a whole load of deprecation warnings.

Just added the relevant decorator changes to make those go away.
  • Loading branch information
tommorris committed May 21, 2014
1 parent 266fecd commit 5e7bd7d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/watchdog/watchmedo.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
except ImportError:
from io import StringIO

from argh import arg, alias, ArghParser
from argh import arg, aliases, ArghParser, expects_obj
from watchdog.version import VERSION_STRING
from watchdog.utils import load_class
from pathtools.path import absolute_path, parent_dir_path
Expand Down Expand Up @@ -152,7 +152,7 @@ def schedule_tricks(observer, tricks, pathname, recursive):
observer.schedule(handler, trick_pathname, recursive)


@alias('tricks')
@aliases('tricks')
@arg('files',
nargs='*',
help='perform tricks from given file')
Expand All @@ -167,6 +167,7 @@ def schedule_tricks(observer, tricks, pathname, recursive):
@arg('--recursive',
default=True,
help='recursively monitor paths')
@expects_obj
def tricks_from(args):
"""
Subcommand to execute tricks from a tricks configuration file.
Expand Down Expand Up @@ -211,7 +212,7 @@ def tricks_from(args):
o.join()


@alias('generate-tricks-yaml')
@aliases('generate-tricks-yaml')
@arg('trick_paths',
nargs='*',
help='Dotted paths for all the tricks you want to generate')
Expand All @@ -228,6 +229,7 @@ def tricks_from(args):
default=False,
help='if --append-to-file is not specified, produces output for \
appending instead of a complete tricks yaml file.')
@expects_obj
def tricks_generate_yaml(args):
"""
Subcommand to generate Yaml configuration for tricks named on the command
Expand Down Expand Up @@ -314,6 +316,7 @@ def tricks_generate_yaml(args):
@arg('--debug-force-inotify',
default=False,
help='[debug] forces Linux inotify(7)')
@expects_obj
def log(args):
"""
Subcommand to log file system events to the console.
Expand Down Expand Up @@ -418,6 +421,7 @@ def log(args):
default=False,
help="Ignore events that occur while command is still being executed " \
"to avoid multiple simultaneous instances")
@expects_obj
def shell_command(args):
"""
Subcommand to execute shell commands in response to file system events.
Expand Down Expand Up @@ -497,6 +501,7 @@ def shell_command(args):
default=10.0,
help='when stopping, kill the subprocess after the specified timeout '
'(default 10)')
@expects_obj
def auto_restart(args):
"""
Subcommand to start a long-running subprocess and restart it
Expand Down

0 comments on commit 5e7bd7d

Please sign in to comment.