From e7224d1f004adbe5b198bd7eda97e1fbb9a78b51 Mon Sep 17 00:00:00 2001 From: Kevin Wurster Date: Tue, 27 Oct 2015 14:03:16 -0400 Subject: [PATCH] Add deprecation warnings --- ais/compatibility/__init__.py | 7 +++++++ ais/stream/__init__.py | 7 +++++++ bin/aisdecode | 19 ++++++++++++++++--- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/ais/compatibility/__init__.py b/ais/compatibility/__init__.py index e69de29b..dde19604 100644 --- a/ais/compatibility/__init__.py +++ b/ais/compatibility/__init__.py @@ -0,0 +1,7 @@ +import warnings + +warnings.warn( + "The compatability module is deprecated and will be removed in 1.0", + FutureWarning, + stacklevel=2 +) diff --git a/ais/stream/__init__.py b/ais/stream/__init__.py index a2ab4ec3..8a1271f2 100644 --- a/ais/stream/__init__.py +++ b/ais/stream/__init__.py @@ -2,10 +2,17 @@ import sys import traceback +import warnings import ais from ais.stream import checksum +warnings.warn( + "The stream module is deprecated and will be removed in 1.0", + FutureWarning, + stacklevel=2 +) + def ErrorPrinter(e, stats, diff --git a/bin/aisdecode b/bin/aisdecode index 76feff50..d36a19f8 100755 --- a/bin/aisdecode +++ b/bin/aisdecode @@ -1,4 +1,10 @@ -#! /usr/bin/env python +#!/usr/bin/env python + +""" +DEPRECATED: Will be removed in v1.0 +""" + +import warnings import ais import sys @@ -14,6 +20,13 @@ try: except: msgpack = None + +warnings.warn( + "This utility is deprecated and will be removed in 1.0", + FutureWarning, + stacklevel=2) + + args = {"encoding": "json"} files = [] for arg in sys.argv[1:]: @@ -37,7 +50,7 @@ for key in ("uscg", "validate_checksum", "verbose", "allow_unknown", "treat_ab_e args[key] = args[key] == 'True' if "help" in args: - print """Usage: aisdecode [OPTIONS] < INFILE.nmea > OUTFILE.json + print("""Usage: aisdecode [OPTIONS] < INFILE.nmea > OUTFILE.json Available opptions: --gpsd Use gpsd compatible output --copy-tagblock-timestamp=False @@ -57,7 +70,7 @@ Available opptions: --uscg=False --validate_checksum=False -""" +""") sys.exit(0) encoding = args.pop('encoding', 'json')