MCPcopy Index your code
hub / github.com/RustPython/RustPython / OutputString

Method OutputString

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

Source from the content-addressed store, hash-verified

388 """ % (self.OutputString(attrs).replace('"', r'\"'))
389
390 def OutputString(self, attrs=None):
391 # Build up our result
392 #
393 result = []
394 append = result.append
395
396 # First, the key=value pair
397 append("%s=%s" % (self.key, self.coded_value))
398
399 # Now add any defined attributes
400 if attrs is None:
401 attrs = self._reserved
402 items = sorted(self.items())
403 for key, value in items:
404 if value == "":
405 continue
406 if key not in attrs:
407 continue
408 if key == "expires" and isinstance(value, int):
409 append("%s=%s" % (self._reserved[key], _getdate(value)))
410 elif key == "max-age" and isinstance(value, int):
411 append("%s=%d" % (self._reserved[key], value))
412 elif key == "comment" and isinstance(value, str):
413 append("%s=%s" % (self._reserved[key], _quote(value)))
414 elif key in self._flags:
415 if value:
416 append(str(self._reserved[key]))
417 else:
418 append("%s=%s" % (self._reserved[key], value))
419
420 # Return the result
421 return _semispacejoin(result)
422
423 __class_getitem__ = classmethod(types.GenericAlias)
424

Callers 3

outputMethod · 0.95
__repr__Method · 0.95
js_outputMethod · 0.95

Calls 6

sortedFunction · 0.85
isinstanceFunction · 0.85
_getdateFunction · 0.85
_quoteFunction · 0.85
strFunction · 0.85
itemsMethod · 0.45

Tested by

no test coverage detected