Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@cachedprop
def _real_bases(self):
self._revision_map
return self._real_bases
@cachedprop
def error_handler(self):
return (
self._debug_handler if self.app.debug else self.exception_handler)
@cachedprop
def now(self):
return pendulum.instance(self._scope['emt.now'])
@cachedprop
def _revision_map(self):
rmap = {}
heads = OrderedSet()
_real_heads = OrderedSet()
self.bases = ()
self._real_bases = ()
#has_branch_labels = set()
#has_depends_on = set()
for revision in self._generator():
if revision.revision in rmap:
self.app.log.warn(
"Revision %s is present more than once" % revision.revision
)
@cachedprop
def sourcelines(self):
try:
with open(self.filename, 'rb') as file:
source = file.read().decode('utf8')
except IOError:
source = ''
return source.splitlines()
@cachedprop
def query_params(self):
rv = sdict()
for key, values in parse_qs(
self._scope['query_string'].decode('ascii'), keep_blank_values=True
).items():
if len(values) == 1:
rv[key] = values[0]
continue
rv[key] = values
return rv
@cachedprop
def language(self):
return self.websocket.accept_language.best_match(
list(_translator_instance._t.all_languages))
@cachedprop
def now_local(self):
return self.now.in_timezone(pendulum.local_timezone())
@cachedprop
def content_length(self):
return self.headers.get('content_length', 0, cast=int)
@cachedprop
def render_locals(self):
rv = dict()
for k, v in self.locals.items():
try:
rv[k] = str(v)
except Exception:
rv[k] = ''
return rv