How to use the pywws.__version__ function in pywws

To help you get started, we’ve selected a few pywws examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jim-easterbrook / pywws / src / doc / conf.py View on Github external
master_doc = 'index'

# General information about the project.
project = u'pywws'
copyright = u'2008-20, pywws contributors'

# 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 = 
# The full version, including alpha/beta/rc tags.
#release =
from pywws import __version__, _release
version = __version__
release = __version__ + '.dev' + _release

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
if not on_rtd and 'LANG' in os.environ:
    language = os.environ['LANG'].split('_')[0]

locale_dirs = ['../pywws/lang']

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
github jim-easterbrook / pywws / src / doc / conf.py View on Github external
# General information about the project.
project = u'pywws'
copyright = u'2008-20, pywws contributors'

# 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 = 
# The full version, including alpha/beta/rc tags.
#release =
from pywws import __version__, _release
version = __version__
release = __version__ + '.dev' + _release

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
if not on_rtd and 'LANG' in os.environ:
    language = os.environ['LANG'].split('_')[0]

locale_dirs = ['../pywws/lang']

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
github jim-easterbrook / pywws / src / pywws / version.py View on Github external
return 1
    # process options
    verbose = False
    for o, a in opts:
        if o in ('-h', '--help'):
            print(__doc__.split('\n\n')[0])
            print(usage)
            return 0
        elif o in ('-v', '--verbose'):
            verbose = True
    # check arguments
    if len(args) != 0:
        print('Error: no arguments permitted\n', file=sys.stderr)
        print(usage, file=sys.stderr)
        return 2
    print(__version__)
    if verbose:
        print('build:', _release)
        print('commit:', _commit)
        print('Python:', sys.version)
        try:
            from pywws.weatherstation import USBDevice
            print('USB:   ', USBDevice.__module__)
        except ImportError:
            print('USB:    missing')
        example_dir = resource_filename('pywws', 'examples')
        if os.path.exists(example_dir):
            print('examples:')
            print('  ', example_dir)
        print('docs:')
        print('   http://pywws.readthedocs.io/')
    return 0
github jim-easterbrook / pywws / src / pywws / service / weathercloud.py View on Github external
from pywws.conversions import usaheatindex, wind_mph
import pywws.service

__docformat__ = "restructuredtext en"
service_name = os.path.splitext(os.path.basename(__file__))[0]
logger = logging.getLogger(__name__)


class ToService(pywws.service.LiveDataService):
    config = {
        'deviceid' : ('',      True, 'wid'),
        'devicekey': ('',      True, 'key'),
        'internal' : ('False', True, None),
        }
    fixed_data = {'ver': pywws.__version__, 'type': '481'}
    interval = timedelta(seconds=600)
    logger = logger
    service_name = service_name
    template = """
#live#
#temp_out
    "'temp'     : '%.0f'," "" "scale(x, 10.0)"#
#calc "wind_chill(data['temp_out'], data['wind_ave'])"
    "'chill'    : '%.0f'," "" "scale(x, 10.0)"#
#calc "dew_point(data['temp_out'], data['hum_out'])"
    "'dew'      : '%.0f'," "" "scale(x, 10.0)"#
#calc "usaheatindex(data['temp_out'], data['hum_out'])"
    "'heat'     : '%.0f'," "" "scale(x, 10.0)"#
#hum_out
    "'hum'      : '%.d',"#
#wind_ave
github jim-easterbrook / pywws / src / pywws / service / cwop.py View on Github external
import pywws
import pywws.service

__docformat__ = "restructuredtext en"
service_name = os.path.splitext(os.path.basename(__file__))[0]
logger = logging.getLogger(__name__)


class ToService(pywws.service.LiveDataService):
    config = {
        'designator': ('',   True, 'designator'),
        'passcode'  : ('-1', True, 'passcode'),
        'latitude'  : ('',   True, 'latitude'),
        'longitude' : ('',   True, 'longitude'),
        }
    fixed_data = {'version': pywws.__version__}
    interval = timedelta(seconds=290)
    logger = logger
    service_name = service_name
    template = """
#live#
'idx'          : #idx          "'%d%H%M',"#
'wind_dir'     : #wind_dir     "'%03.0f'," "'...',"   "winddir_degrees(x)"#
'wind_ave'     : #wind_ave     "'%03.0f'," "'...',"   "wind_mph(x)"#
'wind_gust'    : #wind_gust    "'%03.0f'," "'...',"   "wind_mph(x)"#
'temp_out'     : #temp_out     "'%03.0f'," "'...',"   "temp_f(x)"#
'hum_out'      : #hum_out      "'%02d',"   "'..',"    "x % 100"#
'rel_pressure' : #rel_pressure "'%05.0f'," "'.....'," "x * 10.0"#
'rain_hour'    : #calc "100.0*rain_inch(rain_hour(data))" "'%03.0f'," "'...',"#
'rain_24hr'    : #calc "100.0*rain_inch(rain_24hr(data))" "'%03.0f'," "'...',"#
"""
github jim-easterbrook / pywws / src / pywws / service / metoffice.py View on Github external
from pywws.conversions import rain_inch
from pywws.process import get_day_end_hour
import pywws.service
from pywws.timezone import timezone

__docformat__ = "restructuredtext en"
service_name = os.path.splitext(os.path.basename(__file__))[0]
logger = logging.getLogger(__name__)


class ToService(pywws.service.CatchupDataService):
    config = {
        'site id': ('', True, 'siteid'),
        'aws pin': ('', True, 'siteAuthenticationKey'),
        }
    fixed_data = {'softwaretype': 'pywws-' + pywws.__version__}
    interval = timedelta(seconds=300)
    logger = logger
    service_name = service_name
    template = """
#live#
#idx          "'dateutc'     : '%Y-%m-%d %H:%M:%S',"#
#wind_dir     "'winddir'     : '%.0f'," "" "winddir_degrees(x)"#
#wind_ave     "'windspeedmph': '%.2f'," "" "wind_mph(x)"#
#wind_gust    "'windgustmph' : '%.2f'," "" "wind_mph(x)"#
#hum_out      "'humidity'    : '%.d',"#
#temp_out     "'tempf'       : '%.1f'," "" "temp_f(x)"#
#rel_pressure "'baromin'     : '%.4f'," "" "pressure_inhg(x)"#
#calc "rain_inch(self.rain_rate(data))"
              "'rainin'      : '%.4f',"#
#calc "rain_inch(self.rain_day_local(data))"
              "'dailyrainin' : '%.4f',"#
github jim-easterbrook / pywws / src / pywws / logger.py View on Github external
handler = logging.handlers.RotatingFileHandler(
            logfile, maxBytes=128*1024, backupCount=3)
        formatter = logging.Formatter(
            '%(asctime)s:%(name)s:%(message)s', '%Y-%m-%d %H:%M:%S')
    else:
        level = logging.WARNING - (verbose * 10)
        handler = logging.StreamHandler()
        formatter = logging.Formatter(
            '%(asctime)s:%(name)s:%(message)s', '%H:%M:%S')
    level = max(level, 1)
    root_logger.setLevel(level)
    handler.addFilter(FilterURLLib3(level))
    handler.setFormatter(formatter)
    root_logger.addHandler(handler)
    logger.warning(
        'pywws version %s, build %s (%s)', __version__, _release, _commit)
    logger.info('Python version %s', sys.version)
github jim-easterbrook / pywws / src / pywws / toservice.py View on Github external
:return: success status

        :rtype: bool

        """

        login = 'user %s pass %s vers pywws %s\n' % (
            prepared_data['designator'], prepared_data['passcode'], __version__)
        packet = '%s>APRS,TCPIP*:@%sz%s/%s_%s/%sg%st%sr%sP%sb%sh%s.pywws-%s\n' % (
            prepared_data['designator'],   prepared_data['idx'],
            prepared_data['latitude'],     prepared_data['longitude'],
            prepared_data['wind_dir'],     prepared_data['wind_ave'],
            prepared_data['wind_gust'],    prepared_data['temp_out'],
            prepared_data['rain_hour'],    prepared_data['rain_day'],
            prepared_data['rel_pressure'], prepared_data['hum_out'],
            __version__
            )
        logger.debug('%s:packet: "%s"', self.service_name, packet)
        login = login.encode('ASCII')
        packet = packet.encode('ASCII')
        sock = socket.socket()
        try:
            sock.connect(self.server)
            try:
                response = sock.recv(4096)
                logger.debug('%s:server software: %s',
                             self.service_name, response.strip())
                sock.sendall(login)
                response = sock.recv(4096)
                logger.debug('%s:server login ack: %s',
                             self.service_name, response.strip())
                sock.sendall(packet)