MCPcopy Index your code
hub / github.com/python/cpython / OutputString

Method OutputString

Lib/http/cookies.py:406–437  ·  view source on GitHub ↗
(self, attrs=None)

Source from the content-addressed store, hash-verified

404 """ % (output_string.replace('"', r'\"'))
405
406 def OutputString(self, attrs=None):
407 # Build up our result
408 #
409 result = []
410 append = result.append
411
412 # First, the key=value pair
413 append("%s=%s" % (self.key, self.coded_value))
414
415 # Now add any defined attributes
416 if attrs is None:
417 attrs = self._reserved
418 items = sorted(self.items())
419 for key, value in items:
420 if value == "":
421 continue
422 if key not in attrs:
423 continue
424 if key == "expires" and isinstance(value, int):
425 append("%s=%s" % (self._reserved[key], _getdate(value)))
426 elif key == "max-age" and isinstance(value, int):
427 append("%s=%d" % (self._reserved[key], value))
428 elif key == "comment" and isinstance(value, str):
429 append("%s=%s" % (self._reserved[key], _quote(value)))
430 elif key in self._flags:
431 if value:
432 append(str(self._reserved[key]))
433 else:
434 append("%s=%s" % (self._reserved[key], value))
435
436 # Return the result
437 return _semispacejoin(result)
438
439 __class_getitem__ = classmethod(types.GenericAlias)
440

Callers 3

outputMethod · 0.95
__repr__Method · 0.95
js_outputMethod · 0.95

Calls 4

_getdateFunction · 0.85
_quoteFunction · 0.85
strFunction · 0.85
itemsMethod · 0.45

Tested by

no test coverage detected