Changeset 5c5fe6d for server


Ignore:
Timestamp:
Dec 17, 2011, 5:52:59 PM (12 years ago)
Author:
Jessica B. Hamrick <jhamrick@…>
Branches:
no-cups
Children:
287d6ec
Parents:
5d24a81
git-author:
Jessica B. Hamrick <jhamrick@…> (12/17/11 17:52:59)
git-committer:
Jessica B. Hamrick <jhamrick@…> (12/17/11 17:52:59)
Message:

Comment formatting standardization

Location:
server/lib/gutenbach
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • server/lib/gutenbach/ipp/attribute.py

    rdf51061 r5c5fe6d  
    88
    99class Attribute(object):
    10     """
    11     In addition to what the RFC reports, an attribute has an
    12     'attribute tag', which specifies what type of attribute it is.
    13     It is 1 bytes long, and comes before the list of values.
     10    """In addition to what the RFC reports, an attribute has an
     11    'attribute tag', which specifies what type of attribute it is.  It
     12    is 1 bytes long, and comes before the list of values.
    1413
    1514    From RFC 2565:
     
    3837    |                     value                   |   w bytes |
    3938    -----------------------------------------------------------
     39
    4040    """
    4141
    4242    def __init__(self, name=None, values=None):
    43         """
    44         Initialize an Attribute.  This function can be called in three
    45         different ways:
     43        """Initialize an Attribute.  This function can be called in
     44        three different ways:
    4645
    4746            Attribute() -- creates an empty Attribute
     
    5756
    5857            values -- a list of Values.  May not be empty.
     58
    5959        """
    6060
     
    7373    @property
    7474    def packed_value(self):
    75         """
    76         Packs the attribute data into binary data.
     75        """Packs the attribute data into binary data.
     76       
    7777        """
    7878
     
    132132    @property
    133133    def packed_value_size(self):
     134        """Gets the total size of the attribute.
     135       
    134136        """
    135         Gets the total size of the attribute.
    136         """
     137
    137138        return len(self.packed_value)
    138139
  • server/lib/gutenbach/ipp/attributegroup.py

    rdf51061 r5c5fe6d  
    88
    99class AttributeGroup(object):
    10     """
    11     An AttributeGroup consists of an attribute-group-tag, followed by
    12     a sequence of Attributes. According to RFC 2565, "Within an
     10    """An AttributeGroup consists of an attribute-group-tag, followed
     11    by a sequence of Attributes. According to RFC 2565, 'Within an
    1312    attribute-sequence, if two attributes have the same name, the
    14     first occurrence MUST be ignored.", so we can effectively treat
     13    first occurrence MUST be ignored.', so we can effectively treat
    1514    this as an ordered dictionary.
     15   
    1616    """
    1717
    1818    def __init__(self, attribute_group_tag=None, attributes=[]):
    19         """
    20         Initialize an AttributeGroup.  An AttributeGroup can be
     19        """Initialize an AttributeGroup.  An AttributeGroup can be
    2120        initialized in three ways:
    2221
     
    3130
    3231            attributes -- a list of attributes
     32
    3333        """
    3434
     
    4343
    4444    def __getitem__(self, name):
    45         """
    46         Returns a list of attributes which have name 'name'.
     45        """Returns a list of attributes which have name 'name'.
     46       
    4747        """
    4848       
     
    6262
    6363    def __setitem__(self, name, attribute):
    64         """
    65         Sets an attribute in the attribute group. Note that the key is
    66         ignored and the attribute is queried for its name.
     64        """Sets an attribute in the attribute group. Note that the key
     65        is ignored and the attribute is queried for its name.
     66       
    6767        """
    6868
     
    7777
    7878    def extend(self, attributes):
    79         """
    80         Sets the attributes for the attribute group.
     79        """Sets the attributes for the attribute group.
     80       
    8181        """
    8282
     
    9393    @property
    9494    def packed_value(self):
    95         """
    96         Convert the AttributeGroup to binary.
     95        """Convert the AttributeGroup to binary.
     96       
    9797        """
    9898
  • server/lib/gutenbach/ipp/constants.py

    rdf51061 r5c5fe6d  
    22
    33class Misc():
    4     """
    5     Miscellaneous config options for the IPP server.
     4    """Miscellaneous config options for the IPP server.
     5   
    66    """
    77   
     
    1212
    1313class JobStates():
    14     """
    15     Job state codes, as defined by RFC 2911, Section 4.3.7
     14    """Job state codes, as defined by RFC 2911, Section 4.3.7
     15   
    1616    """
    1717   
     
    2727
    2828class PrinterStates():
    29     """
    30     Printer state codes, as defined by RFC 2911, Section 4.4.11
     29    """Printer state codes, as defined by RFC 2911, Section 4.4.11
     30   
    3131    """
    3232
     
    3838
    3939class Operations():
    40     """
    41     IPP and CUPS IPP Operations, as defined in various RFCs:
     40    """IPP and CUPS IPP Operations, as defined in various RFCs:
    4241
    4342        0x0002 - 0x0012      RFC 2911 (Section 4.4.15)
     
    4645        0x0022 - 0x0031      RFC 3998 (Section 14.3)
    4746        0x4000 - 0x4027      CUPS IPP Actions
     47       
    4848    """
    4949
     
    120120
    121121class SuccessCodes():
    122     """
    123     Success status codes as defined in RFC 2911, Section 13
     122    """Success status codes as defined in RFC 2911, Section 13
     123   
    124124    """
    125125   
     
    135135
    136136class ClientErrorCodes():
    137     """
    138     Client error codes as defined in RFC 2911, Section 13
     137    """Client error codes as defined in RFC 2911, Section 13
     138   
    139139    """
    140140   
     
    167167
    168168class ServerErrorCodes():
    169     """
    170     Server error codes as defined in RFC 2911, Section 13
     169    """Server error codes as defined in RFC 2911, Section 13
     170   
    171171    """
    172172
     
    189189
    190190class CUPSPrinterType():
    191     """
    192     Printer types as defined by cups_ptype_e in the CUPS API
     191    """Printer types as defined by cups_ptype_e in the CUPS API
    193192    specification:
    194193   
    195194    http://www.cups.org/documentation.php/doc-1.3/api-cups.html#cups_ptype_e
     195   
    196196    """
    197197
     
    232232
    233233class AttributeTags():
    234     """
    235     Contains constants for the attribute IPP tags, as defined by RFC
    236     2565.
     234    """Contains constants for the attribute IPP tags, as defined by
     235    RFC 2565.
     236   
    237237    """
    238238   
     
    249249
    250250class OutOfBandTags():
    251     """
    252     Contains constants for the out-of-band value IPP tags, as defined
    253     by RFC 2565.
     251    """Contains constants for the out-of-band value IPP tags, as
     252    defined by RFC 2565.
     253   
    254254    """
    255255   
     
    265265
    266266class IntegerTags():
    267     """
    268     Contains constants for the integer value IPP tags, as defined by
    269     RFC 2565.
     267    """Contains constants for the integer value IPP tags, as defined
     268    by RFC 2565.
     269   
    270270    """
    271271   
     
    278278
    279279class OctetStringTags():
    280     """
    281     Contains constants for the octetString value IPP tags, as defined
    282     by RFC 2565.
     280    """Contains constants for the octetString value IPP tags, as
     281    defined by RFC 2565.
     282   
    283283    """
    284284   
     
    295295
    296296class CharacterStringTags():
    297     """
    298     Contains constants for the character-string value IPP tags, as
     297    """Contains constants for the character-string value IPP tags, as
    299298    defined by RFC 2565.
     299   
    300300    """
    301301   
  • server/lib/gutenbach/ipp/request.py

    rdf51061 r5c5fe6d  
    1111
    1212class Request():
    13     """
    14     From RFC 2565:
     13    """From RFC 2565:
    1514   
    1615    The encoding for an operation request or response consists of:
     
    3231    |                     data                    |   q bytes  - optional
    3332    -----------------------------------------------
     33
    3434    """
    3535
     
    3939    def __init__(self, version=None, operation_id=None, request_id=None,
    4040                 attribute_groups=[], data=None, request=None, length=sys.maxint):
    41         """
    42         Create a Request.  Takes either the segments of the request
     41        """Create a Request.  Takes either the segments of the request
    4342        separately, or a file handle for the request to parse.  If the
    4443        file handle is passed in, all other arguments are ignored.
     
    6564            request -- a file handle that supports the read()
    6665                       operation
     66
    6767        """
    6868
     
    198198    @property
    199199    def packed_value(self):
    200         """
    201         Packs the value data into binary data.
     200        """Packs the value data into binary data.
     201       
    202202        """
    203203
  • server/lib/gutenbach/ipp/value.py

    rdf51061 r5c5fe6d  
    77logger = logging.getLogger(__name__)
    88
    9 def setter(prop):
    10     def f(func):
    11         return property(prop.fget, func, prop.fdel, prop.__doc__)
    12     return f
    13 
    149class Value(object):
    15     """
    16     An IPP value consists of a tag and a value.
     10    """An IPP value consists of a tag and a value.
    1711
    1812    From RFC 2565:
     
    2620     |                     value                   |   v bytes
    2721     -----------------------------------------------   
     22
    2823    """
    2924
    3025    def __init__(self, value_tag=None, value=None):
    31         """
    32         Initialize a Value.  There are three different ways you can
     26        """Initialize a Value.  There are three different ways you can
    3327        call this method:
    3428
     
    4842            value -- variable size, containing the actual value.
    4943            It should be a string or number.
     44
    5045        """
    5146
     
    6257    @classmethod
    6358    def unpack(cls, value_tag, packed_value):
    64         """Unpack a binary IPP value
    65 
    66         Unpacks a binary string into a Value object.
     59        """Unpack a binary IPP value into a Value object.
    6760
    6861        """
     
    7164    @staticmethod
    7265    def _unpack(value_tag, packed_value):
    73         """
    74         Given self.value_tag and self.packed_value, unpack the binary
    75         value into either a string or number.  These values MUST NOT
    76         be null.
     66        """Given self.value_tag and self.packed_value, unpack the
     67        binary value into either a string or number.  These values
     68        MUST NOT be null.
    7769
    7870        Returns: unpacked value
     
    170162    @property
    171163    def packed_value(self):
    172         """
    173         Given self.value_tag and self.value, pack the value into
     164        """Given self.value_tag and self.value, pack the value into
    174165        binary form.  These values MUST NOT be null.
    175166
     
    270261        return packed_value
    271262
    272     @setter(packed_value)
     263    @packed_value.setter
    273264    def packed_value(self, packed_value):
    274265        """Replace a value using a new packed value
     
    281272    @property
    282273    def packed_value_size(self):
    283         """
    284         Get the size of the value in bytes.
     274        """Get the size of the value in bytes.
     275       
    285276        """
    286277       
     
    289280    @property
    290281    def total_size(self):
    291         """
    292         Get the total size of the IPP value.
     282        """Get the total size of the IPP value.
     283       
    293284        """
    294285
  • server/lib/gutenbach/server/__init__.py

    • Property mode changed from 100755 to 100644
Note: See TracChangeset for help on using the changeset viewer.