def __knotsToMS(knots):
    try:
        knots = float(knots)
        return knots * 0.514444
    except:
        log.debug("Can't convert knots to m/s !")
        return None
def convertWindFrom2mTo10m(wind2):
    try:
        wind2 = float(wind2)
        return wind2 * 1.3370  # reverse Eq. 33
    except:
        log.debug("Can't convert wind %s from 2m to 10m value" % wind2)
        return None
示例#3
0
文件: daemon.py 项目: dacut/rolemaker
def daemon(region, storage_prefix, profile_name, create_queue_name,
           mandatory_policy_arn):    
    logging.basicConfig(
        level=logging.DEBUG, stream=sys.stderr,
        format=("%(asctime)s %(filename)s:%(lineno)s [%(levelname)s]: "
                "%(message)s"))
    logging.getLogger("boto").setLevel(logging.WARNING)

    create = RoleCreationDaemon(region=region, storage_prefix=storage_prefix,
                                profile_name=profile_name,
                                create_queue_name=create_queue_name,
                                mandatory_policy_arn=mandatory_policy_arn)

    log = logging.getLogger("rolemaker.daemon")
    log.debug("Starting creation daemon")
    create.start()

    # Sleep until we get an exit request.
    try:
        while True:
            sleep(1)
    except (KeyboardInterrupt, SystemExit):
        pass
    finally:
        log.info("Exit requested; waiting for daemon to terminate.")
        create.exit_requested = True
        create.join()

    log.info("Daemon terminated after processing %d requests." %
             create.requests_processed)
    return 0
def __fahrenheitToCelsius(temp):
    try:
        temp = float(temp)
        return (temp - 32) * 5.0/9.0
    except:
        log.debug("Can't convert fahrenheit to celsius !")
        return None
def __windFromNmTo2m(windN, height):
    try:
        windN = float(windN)
        return windN * 4.87 / math.log(67.8 * height - 5.42)  # Eq.33
    except:
        log.debug("Can't convert wind from %s to 2m value" % windN)
        return None
def __windFromNmTo2m(windN, height):
    try:
        windN = float(windN)
        return windN * 4.87 / math.log(67.8 * height - 5.42)  # Eq.33
    except:
        log.debug("Can't convert wind from %s to 2m value" % windN)
        return None
def __fahrenheitToCelsius(temp):
    try:
        temp = float(temp)
        return (temp - 32) * 5.0 / 9.0
    except:
        log.debug("Can't convert fahrenheit to celsius !")
        return None
def __inchesToMM(inches):
    try:
        inches = float(inches)
        return inches * 25.4
    except:
        log.debug("Can't convert inches to mm !")
        return None
def __knotsToMS(knots):
    try:
        knots = float(knots)
        return knots * 0.514444
    except:
        log.debug("Can't convert knots to m/s !")
        return None
def convertWindFrom2mTo10m(wind2):
    try:
        wind2 = float(wind2)
        return wind2 * 1.3370  # reverse Eq. 33
    except:
        log.debug("Can't convert wind %s from 2m to 10m value" % wind2)
        return None
def convertRadiationFromWattsToMegaJoules(radiation):
    try:
        radiation = float(radiation)
        return radiation * 0.0864
    except:
        log.debug("Can't convert radiation %s from watts to mjoules" % radiation)
        return None
def __inchesToMM(inches):
    try:
        inches = float(inches)
        return inches * 25.4
    except:
        log.debug("Can't convert inches to mm !")
        return None
def convertRadiationFromWattsToMegaJoules(radiation):
    try:
        radiation = float(radiation)
        return radiation * 0.0864
    except:
        log.debug("Can't convert radiation %s from watts to mjoules" %
                  radiation)
        return None
def __windFrom2mToNm(wind2, height):
    try:
        wind2 = float(wind2)
        height = float(height)
        return wind2 / 4.87 * math.log(67.8 * height - 5.42)  # reverse Eq. 33
    except:
        log.debug("Can't convert wind %s from 2m to %sm value" % (wind2, height))
        return None
def __windFrom2mToNm(wind2, height):
    try:
        wind2 = float(wind2)
        height = float(height)
        return wind2 / 4.87 * math.log(67.8 * height - 5.42)  # reverse Eq. 33
    except:
        log.debug("Can't convert wind %s from 2m to %sm value" %
                  (wind2, height))
        return None
示例#16
0
#!/usr/bin/python3
__version__ = '2.2'
__mod__ = 'hp-uiscan'
__title__ = 'Scan Utility'
__doc__ = "SANE-based scan utility for HPLIP supported all-in-one/mfp devices."

from base import utils, module
#from installer import core_install
import os
from math import log
from base.g import *
import operator
try:
    from importlib import import_module
except ImportError as e:
    log.debug(e)
    from base.utils import dyn_import_mod as import_module

#from scan import sane
#import scanext

#mod = module.Module(__mod__, __title__, __version__, __doc__, None, (INTERACTIVE_MODE,))
mod = module.Module(__mod__, __title__, __version__, __doc__, None,
                    (GUI_MODE, ), (UI_TOOLKIT_QT4, UI_TOOLKIT_QT5))
mod.setUsage(module.USAGE_FLAG_NONE,
             extra_options=None,
             see_also_list=['hp-scan'])

if __name__ == "__main__":

    opts, device_uri, printer_name, mode, ui_toolkit, lang = mod.parseStdOpts()
示例#17
0
文件: utils.py 项目: liu5269/taurus
 def file_replacer(value, key, container):
     if value in samples:
         container[key] = substitutes[samples.index(value)]
         if container[key] != value and log:
             log.debug("Replaced %s with %s", value, container[key])
示例#18
0
文件: uiscan.py 项目: zdohnal/hplip
#!/usr/bin/env python
__version__ = '2.2'
__mod__ = 'hp-uiscan'
__title__ = 'Scan Utility'
__doc__ = "SANE-based scan utility for HPLIP supported all-in-one/mfp devices."

from base import utils, module
#from installer import core_install
import os
from math import log
from base.g import *
import operator
try:
    from importlib import import_module
except ImportError as e:
    log.debug(e)
    from base.utils import dyn_import_mod as import_module


#from scan import sane
#import scanext



mod = module.Module(__mod__, __title__, __version__, __doc__, None, (INTERACTIVE_MODE,))



if __name__ == "__main__":

    opts, device_uri, printer_name, mode, ui_toolkit, lang=mod.parseStdOpts()
示例#19
0
文件: utils.py 项目: keithmork/taurus
 def file_replacer(value, key, container):
     if value in samples:
         container[key] = substitutes[samples.index(value)]
         if container[key] != value and log:
             log.debug("Replaced %s with %s", value, container[key])