Skip to content

Commit

Permalink
Convert relative imports to absolute
Browse files Browse the repository at this point in the history
This improves compatibility with Python 2.5 and is generally thought to
be better style.

Signed-off-by: Jim Easterbrook <jim@jim-easterbrook.me.uk>
  • Loading branch information
jim-easterbrook committed Jul 22, 2016
1 parent f1a2790 commit a4d8734
Show file tree
Hide file tree
Showing 27 changed files with 112 additions and 112 deletions.
4 changes: 2 additions & 2 deletions src/pywws/DataStore.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-15 pywws contributors
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -78,7 +78,7 @@
from threading import Lock
import time

from .constants import DAY
from pywws.constants import DAY

def safestrptime(date_string, format=None):
# time.strptime is time consuming (because it's so flexible?) so don't use
Expand Down
6 changes: 3 additions & 3 deletions src/pywws/EWtoPy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-14 Jim Easterbrook jim@jim-easterbrook.me.uk
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -65,8 +65,8 @@
import os
import sys

from . import DataStore
from . import TimeZone
from pywws import DataStore
from pywws import TimeZone

def main(argv=None):
if argv is None:
Expand Down
10 changes: 5 additions & 5 deletions src/pywws/Forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-14 Jim Easterbrook jim@jim-easterbrook.me.uk
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -41,10 +41,10 @@
import getopt
import sys

from . import DataStore
from . import Localisation
from .TimeZone import Local, utc
from . import ZambrettiCore
from pywws import DataStore
from pywws import Localisation
from pywws.TimeZone import Local, utc
from pywws import ZambrettiCore

def ZambrettiCode(params, hourly_data):
north = eval(params.get('Zambretti', 'north', 'True'))
Expand Down
14 changes: 7 additions & 7 deletions src/pywws/Hourly.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-14 Jim Easterbrook jim@jim-easterbrook.me.uk
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -50,12 +50,12 @@
import os
import sys

from . import DataStore
from . import Localisation
from .LogData import DataLogger
from .Logger import ApplicationLogger
from . import Process
from . import Tasks
from pywws import DataStore
from pywws import Localisation
from pywws.LogData import DataLogger
from pywws.Logger import ApplicationLogger
from pywws import Process
from pywws import Tasks

def Hourly(data_dir):
# get file locations
Expand Down
14 changes: 7 additions & 7 deletions src/pywws/LiveLog.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-14 Jim Easterbrook jim@jim-easterbrook.me.uk
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -48,12 +48,12 @@
import sys
import time

from . import DataStore
from . import Localisation
from .LogData import DataLogger
from .Logger import ApplicationLogger
from . import Process
from . import Tasks
from pywws import DataStore
from pywws import Localisation
from pywws.LogData import DataLogger
from pywws.Logger import ApplicationLogger
from pywws import Process
from pywws import Tasks

def LiveLog(data_dir):
logger = logging.getLogger('pywws.LiveLog')
Expand Down
10 changes: 5 additions & 5 deletions src/pywws/LogData.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-15 pywws contributors
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -73,10 +73,10 @@
import sys
import time

from .constants import SECOND, HOUR
from . import DataStore
from .Logger import ApplicationLogger
from .WeatherStation import weather_station
from pywws.constants import SECOND, HOUR
from pywws import DataStore
from pywws.Logger import ApplicationLogger
from pywws.WeatherStation import weather_station

class DataLogger(object):
def __init__(self, params, status, raw_data):
Expand Down
2 changes: 1 addition & 1 deletion src/pywws/Logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import logging.handlers
import sys

from . import __version__, _release, _commit
from pywws import __version__, _release, _commit

def ApplicationLogger(verbose, logfile=None):
logger = logging.getLogger('')
Expand Down
12 changes: 6 additions & 6 deletions src/pywws/Plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,12 +515,12 @@

import pytz

from .constants import HOUR
from .conversions import *
from . import DataStore
from . import Localisation
from .Logger import ApplicationLogger
from .TimeZone import Local, utc
from pywws.constants import HOUR
from pywws.conversions import *
from pywws import DataStore
from pywws import Localisation
from pywws.Logger import ApplicationLogger
from pywws.TimeZone import Local, utc

class GraphNode(object):
def __init__(self, node):
Expand Down
12 changes: 6 additions & 6 deletions src/pywws/Process.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-15 pywws contributors
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -83,11 +83,11 @@
import os
import sys

from .calib import Calib
from .constants import HOUR, DAY, SECOND
from . import DataStore
from .Logger import ApplicationLogger
from .TimeZone import STDOFFSET
from pywws.calib import Calib
from pywws.constants import HOUR, DAY, SECOND
from pywws import DataStore
from pywws.Logger import ApplicationLogger
from pywws.TimeZone import STDOFFSET

TIME_ERR = timedelta(seconds=45)
MINUTEx5 = timedelta(minutes=5)
Expand Down
8 changes: 4 additions & 4 deletions src/pywws/Reprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-14 Jim Easterbrook jim@jim-easterbrook.me.uk
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -53,9 +53,9 @@
import os
import sys

from . import DataStore
from .Logger import ApplicationLogger
from . import Process
from pywws import DataStore
from pywws.Logger import ApplicationLogger
from pywws import Process

def Reprocess(data_dir, update):
logger = logging.getLogger('pywws.Reprocess')
Expand Down
6 changes: 3 additions & 3 deletions src/pywws/SetWeatherStation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-14 Jim Easterbrook jim@jim-easterbrook.me.uk
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -48,8 +48,8 @@
import sys
import time

from .Logger import ApplicationLogger
from . import WeatherStation
from pywws.Logger import ApplicationLogger
from pywws import WeatherStation

def bcd_encode(value):
hi = value // 10
Expand Down
20 changes: 10 additions & 10 deletions src/pywws/Tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-15 pywws contributors
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -29,14 +29,14 @@
import shutil
import threading

from .calib import Calib
from . import Plot
from . import Template
from .TimeZone import STDOFFSET, Local
from .toservice import ToService
from . import Upload
from . import WindRose
from . import YoWindow
from pywws.calib import Calib
from pywws import Plot
from pywws import Template
from pywws.TimeZone import STDOFFSET, Local
from pywws.toservice import ToService
from pywws import Upload
from pywws import WindRose
from pywws import YoWindow

class RegularTasks(object):
def __init__(self, params, status,
Expand Down Expand Up @@ -384,7 +384,7 @@ def _do_service(self, name, live_data):

def do_twitter(self, template, data=None):
if not self.twitter:
from . import ToTwitter
from pywws import ToTwitter
self.twitter = ToTwitter.ToTwitter(self.params)
self.logger.info("Templating %s", template)
input_file = os.path.join(self.template_dir, template)
Expand Down
16 changes: 8 additions & 8 deletions src/pywws/Template.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,14 @@
import shlex
import sys

from .constants import HOUR, SECOND, DAY
from . import conversions
from .conversions import *
from . import DataStore
from .Forecast import Zambretti, ZambrettiCode
from . import Localisation
from .Logger import ApplicationLogger
from .TimeZone import Local, utc
from pywws.constants import HOUR, SECOND, DAY
from pywws import conversions
from pywws.conversions import *
from pywws import DataStore
from pywws.Forecast import Zambretti, ZambrettiCode
from pywws import Localisation
from pywws.Logger import ApplicationLogger
from pywws.TimeZone import Local, utc

class Template(object):
def __init__(self, params, status,
Expand Down
6 changes: 3 additions & 3 deletions src/pywws/TestWeatherStation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-14 Jim Easterbrook jim@jim-easterbrook.me.uk
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -56,8 +56,8 @@
import sys
import time

from .Logger import ApplicationLogger
from . import WeatherStation
from pywws.Logger import ApplicationLogger
from pywws import WeatherStation

def raw_dump(pos, data):
print "%04x" % pos,
Expand Down
8 changes: 4 additions & 4 deletions src/pywws/ToTwitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@
# raise exception on the preferred library
raise ex

from .constants import Twitter as pct
from . import DataStore
from . import Localisation
from .Logger import ApplicationLogger
from pywws.constants import Twitter as pct
from pywws import DataStore
from pywws import Localisation
from pywws.Logger import ApplicationLogger

class TweepyHandler(object):
def __init__(self, key, secret, latitude, longitude):
Expand Down
6 changes: 3 additions & 3 deletions src/pywws/TwitterAuth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-14 Jim Easterbrook jim@jim-easterbrook.me.uk
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -53,8 +53,8 @@
import urlparse
import webbrowser

from .constants import Twitter
from . import DataStore
from pywws.constants import Twitter
from pywws import DataStore

def TwitterAuth(params):
consumer = oauth.Consumer(Twitter.consumer_key, Twitter.consumer_secret)
Expand Down
6 changes: 3 additions & 3 deletions src/pywws/USBQualityTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-14 Jim Easterbrook jim@jim-easterbrook.me.uk
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -68,8 +68,8 @@
import getopt
import sys

from .Logger import ApplicationLogger
from . import WeatherStation
from pywws.Logger import ApplicationLogger
from pywws import WeatherStation

def main(argv=None):
if argv is None:
Expand Down
6 changes: 3 additions & 3 deletions src/pywws/Upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-14 Jim Easterbrook jim@jim-easterbrook.me.uk
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -84,8 +84,8 @@
import shutil
import sys

from . import DataStore
from .Logger import ApplicationLogger
from pywws import DataStore
from pywws.Logger import ApplicationLogger

class _ftp(object):
def __init__(self, logger, site, user, password, directory, port):
Expand Down

0 comments on commit a4d8734

Please sign in to comment.