Python Modules developed by CSCOFE


Module devacc

See Device Access in Python

Module devscr

See devscr

Module getmsg

File:
  /common/usr/cscofe/python/getmsg.py


Description:
  Return message text


Functions:
  * getmsg(<message code>)


Usage:
  >>> from getmsg import getmsg
  >>> print(getmsg(206082121))
  STD-S-OK, Auftrag erfolgreich ausgeführt

Module getnomen

File:
  /common/usr/cscofe/python/getnomen.py


Class:
  GetNomen


Description:
  Provide class GetNomen to read (wildcard) nomenclatures
  from the nameserver.


Standard methods:
  __init__()
    The constructor

  __str__()
    Informal string representation of the object

  __repr__()
    Official string representation of the object

  __getitem__()
    Operator [] to get an item from the list

  __setitem__()
    Operator [] to set an item in the list

  __len__()
    Return length of the list using len(<GetNomen-object>)


Methods:
  get(<wildcard name>)
    Get Nomenclatures known to the nameservice that match
    the given name.

  getall(<wildcard name>)
    Get Nomenclatures known to the nameservice that match
    the given name. If the list of nomenclatures containes
    GuPs, the nomenclatures of all devices of these GuPs
    including ECs are returned.

    Possible duplicate nomenclatures will be removed from
    the list. This is necessary and done only in 'getall()'
    and may result in a new, arbitrary list order. Use the
    'sort()' method in this case.

  sort()
    Sort the list alphabetically.

  len()
    Return the length of the list. This is the count of unique
    nomenclatures returned.


Usage:
  from getnomen import GetNomen    # import module
  noms = GetNomen(True)            # 'True' to be verbose while get()
  noms.get("GT??MU*")              # get nomens
  n = noms[7]                      # get one nomen
  s = len(noms)                    # get count of nomens

  noms.verbose = False             # be quiet while getall()
  noms.getall("KE1CG*")            # get all nomens of GuPs
  noms.sort()                      # sort nomen alphabetically
  s = noms.len()                   # get count of nomens too

Module logger

File:
  /common/usr/cscofe/python/logger.py


Class:
  Logger


Description:
  Provide class Logger for release applications like
  ecload.py or gendevacc.py.

  Creates or opens a file 'yyyy-mm-dd.log' on the given path
  and writes logging information to it.


Usage:
  log = Logger('/my/dir')
  log.addHeader()
  log.add('something to log')
  log.add('something else to log')
  log.addTrailer()
  log.log()

Module strfstamp

File:
  /common/usr/cscofe/python/strfstamp.py


Description:
  Return stringified timestamp, eventstamp, or event number


Functions:
  * strftimestamp(<seconds>, [<microseconds>])
      The timestamp is returned in UTC.
      If parameter <microseconds> is specified, a possible
      fractional part of parameter <seconds> will be ignored.

  * strfeventstamp(<event pattern>, [<BRIEF|NORMAL|FULL>])
      PZ ID and event of the eventstamp may be returned as
      simple values (BRIEF), with PZ and event name (NORMAL)
      or combined (FULL). Default is NORMAL.

  * strfeventnumber(<event number>)
      Return the event name. Valid values are in the
      range 0 <= event-number <= 255.

  * pzvrtevt(<event pattern>)
      Returns PZ, vrtacc and event values extracted from
      the event pattern.


Usage:
  >>> import strfstamp

  # Return timestamp:
  >>> print(strfstamp.timestamp(stamp.time.seconds, stamp.time.microseconds))
  21.Oct.2009  06:05:36 + 517ms UTC

  >>> print(strftimestamp(time.time()))
  30.Aug.2010  11:42:37 + 815ms UTC

  # Return eventstamp:
  >>> print(strfstamp.strfeventstamp(stamp.event))
  PZ = SIS, VrtAcc = 7, Event = END_CYCLE

  >>> print(strfstamp.eventstamp(stamp.event, strfstamp.FULL))
  PZ = SIS (1), VrtAcc = 7, Event = END_CYCLE (55)

  >>> print(strfstamp.eventstamp(stamp.event, strfstamp.BRIEF))
  PZ = 1, VrtAcc = 7, Event = 55

  # Return event name
  >>> print(strfstamp.strfeventnumber(55))
  END_CYCLE

  # Return PZ, vrtacc, and event
  >>> (pz, vrt, evt) = strfstamp.pzvrtevt(stamp.event)

Module svntools

File:
  /common/usr/cscofe/python/svntools.py


Description:
  [tbs]

Module vmetools

File:
  /common/usr/cscofe/python/vmetools.py


Description:
  [tbs]

Module vmetoolsv09

File:
  /common/usr/cscofe/python/vmetoolsv09.py


Description:
  [tbs]

Template devframe.py

File:
  devframe.py in project utiasl


Description:
  Use it as a template to develop new tools that work 
  with devices, ECs, GuPs, and uIOCs. 

  It contains the code to handle the common options and 
  to get the nomenclatures from the nameserver.

  Using this code frame as a base for implementation
  assures that different device access tools provide 
  similar user interfaces.

This topic: Frontend > PPCDevelopments > BelFePythonModules
Topic revision: 03 Aug 2016, LudwigHechler
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback