Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.stsci.edu/spst/UnixTransition/doc/proposal_util.html
Дата изменения: Fri Apr 8 12:46:15 2016
Дата индексирования: Mon Apr 11 02:47:45 2016
Кодировка:
Python: module proposal_util
 
 
proposal_util (version 14.10.01)
index
proposal_util.py

PURPOSE --
A module for dealing with proposals
 
DEVELOPER --
Don Chance
 
MODIFICATION HISTORY --
Initial implementation 12/1/99
Beefed up the proposal object constructor 5/11/00 DRC
Added program_id and proposal_ttl fields to relation and conversion 
   dictionaries.  Added methods to retrieve PC, CS, and PI.  10/12/00 DPJ 
Modified to support a no-database environment. 8/8/03 DRC
Updated for LRP use; modified to use new style objects. 8/05/04 DRC
fix bug. 3/14/05 drc
modified to minimize trips to db. 5/9/05 drc
added get_proposals_by_cycle function. 5/20/05 drc
fix for non-integer prop_id 3/7/06 drc
use get_by_cycle from visit_util for  get_proposals_by_cycle.  7/11/06 drc
add missing import visit_util.  10/29/07 drc
add get_visits method. 8/05/08
add get_contacts method. 8/3/11
update get_pi method. 11/28/12
update for two types of ToOs. 7/12/13 drc
updates for metrics reports. 8/15/13 drc
more updates for metric reports 8/27/13 drc
more updates for metric reports 9/18/13 drc
make proposal id upper case in prop_id_to_proposal_id drc 9/12/14
fix bug in is_target_of_opp drc 10/1/14

 
Modules
       
re
spss_sys_util
stpydb
types

 
Classes
       
__builtin__.dict(__builtin__.object)
proposal

 
class proposal(__builtin__.dict)
    A class for proposals.
 
 
Method resolution order:
proposal
__builtin__.dict
__builtin__.object

Methods defined here:
__cmp__(self, other)
Compare a proposal object to 'other'
 
If 'other' is a string, assume it is a proposal id, otherwise
'other' must be a proposal object.  A 'TypeError' will be
raised if 'other' is neither of these.
__getattr__(self, name)
__init__(self, data={})
The constructor for a proposal object.
 
If the input parameter is a string or integer, it is assumed to be the proposal
id.
 
If the input parameter is a dictionary, then it should have either proposal_id or prop_id
as a key.
__repr__(self)
The string representation of a proposal object is the proposal_id
get(self, field, failobj=None)
Returns the value of 'field'.
 
The value of 'field' will be retrieved from the PMDB if necessary.
If 'field' is not already in the internal dictionary and is not
found in a relation in the db, 'failobj' will be returned.
get_configs(self)
Return a list of all configs used in this proposal.
get_contacts(self)
Use the new ASSIST column 'is_contact' from the investigator table to
retrieve all Co-I's that should be emailed when a visit is scheduled.
 
Returns a list of email addresses.
get_pc_and_cs(self)
Get info about proposal's Program Coordinator and Contact Scientist.
RETURNS:  2-element list:
             list[0] is the PC
             list[1] is the CS
             Each element consists of a 2-tuple:
                tuple[0] is the last name of the person
                tuple[1] is the e-mail address of the person
          If any tuple element is not found in the database, it is
          set to a null string ("").
get_pi(self)
Get information about the proposal's Primary Investigator.
RETURNS: a 3-tuple:
            tuple[0] is the PI's last name
            tuple[1] is the PI's e-mail address
            tuple[2] formerly the Contact Person's e-mail address.  Now always a null string.
            Use get_contacts function to get contacts.
          If any tuple element is not found in the database, it is
          set to a null string ("").
get_sis(self)
Return a list of all SIs used in this proposal.
get_visits(self)
Return a list containing the visits in this proposal.
has_field(self, field)
Check the object for the existence of 'field' in its internal dictionary.
 
Returns TRUE if it is there, FALSE otherwise.
has_key(self, field)
is_snap(self)
Check to see if this is a SNAP proposal.
Returns TRUE if it is, FALSE otherwise.
is_target_of_opp(self)
Check to see if this is a Target of Opportunity proposal.
Returns TRUE if it is, FALSE otherwise.
set(self, field, value)
Set a 'field' to a 'value'.

Static methods defined here:
__new__(cls, data={})
Return a proposal object.
 
If the input proposal already exists in PROPOSALS_DICT, return the already existing
object.  Otherwise, create a new object and store it in PROPOSALS_DICT.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
PROPOSALS_DICT = {}
conversion = {'cont_id': None, 'cycle': None, 'pc': None, 'program_id': None, 'prop_category': None, 'prop_id': None, 'proposal_ttl': None, 'proposal_typ': None, 'resource_type': None, 'scientist': None, ...}
conversion_imports = []
relation = {'allocation': 'limited_resource_track', 'cont_id': 'prop_track', 'cycle': 'prop_track', 'pc': 'prop_track', 'program_id': 'qpdescrip', 'prop_category': 'qpdescrip', 'prop_id': 'prop_track', 'proposal_ttl': 'qpdescrip', 'proposal_typ': 'qpdescrip', 'resource_type': 'limited_resource_track', ...}
relation_db = {'addressv': 'assist', 'coverpage': 'assist', 'limited_resource_track': 'assist', 'prop_track': 'assist', 'qpdescrip': 'spss'}

Methods inherited from __builtin__.dict:
__contains__(...)
D.__contains__(k) -> True if D has a key k, else False
__delitem__(...)
x.__delitem__(y) <==> del x[y]
__eq__(...)
x.__eq__(y) <==> x==y
__ge__(...)
x.__ge__(y) <==> x>=y
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__gt__(...)
x.__gt__(y) <==> x>y
__iter__(...)
x.__iter__() <==> iter(x)
__le__(...)
x.__le__(y) <==> x<=y
__len__(...)
x.__len__() <==> len(x)
__lt__(...)
x.__lt__(y) <==> x<y
__ne__(...)
x.__ne__(y) <==> x!=y
__setitem__(...)
x.__setitem__(i, y) <==> x[i]=y
__sizeof__(...)
D.__sizeof__() -> size of D in memory, in bytes
clear(...)
D.clear() -> None.  Remove all items from D.
copy(...)
D.copy() -> a shallow copy of D
fromkeys(...)
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
v defaults to None.
items(...)
D.items() -> list of D's (key, value) pairs, as 2-tuples
iteritems(...)
D.iteritems() -> an iterator over the (key, value) items of D
iterkeys(...)
D.iterkeys() -> an iterator over the keys of D
itervalues(...)
D.itervalues() -> an iterator over the values of D
keys(...)
D.keys() -> list of D's keys
pop(...)
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised
popitem(...)
D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty.
setdefault(...)
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
update(...)
D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
values(...)
D.values() -> list of D's values
viewitems(...)
D.viewitems() -> a set-like object providing a view on D's items
viewkeys(...)
D.viewkeys() -> a set-like object providing a view on D's keys
viewvalues(...)
D.viewvalues() -> an object providing a view on D's values

Data and other attributes inherited from __builtin__.dict:
__hash__ = None

 
Functions
       
get_proposals_by_cycle(cycle, cp_types=('GO%', 'GTO%', 'CAL%', 'ENG%'), pt_status=('pi', 'implementation', 'scheduling'), excluded_lrps=())
Return a list of proposal objects for the given cycle.
get_too_proposals(cycle)
Return a list of Target of Opportunity proposals for a given cycle.
prop_id_to_proposal_id(Prop_id)
Convert a prop_id (int or string) to a proposal_id (string).
which_db(field)

 
Data
        __version__ = '14.10.01'
assist_db = 'assist'
spss_db = 'spss'