This file is indexed.

/usr/lib/python3/dist-packages/postgresql/sys.py is in python3-postgresql 1.1.0-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
##
# .sys
##
"""
py-postgresql system functions and data.

Data
----

 ``libpath``
  The local file system paths that contain query libraries.

Overridable Functions
---------------------

 excformat
  Information that makes up an exception's displayed "body".
  Effectively, the implementation of `postgresql.exception.Error.__str__`

 msghook
  Display a message.
"""
import sys
import os
import traceback
from .python.element import format_element
from .python.string import indent

libpath = ['/usr/share/python3-postgresql/',]

def default_errformat(val):
	"""
	Built-in error formatter. DON'T TOUCH!
	"""
	it = val._e_metas()
	if val.creator is not None:
		# Protect against element traceback failures.
		try:
			after = os.linesep + format_element(val.creator)
		except Exception:
			after = 'Element Traceback of %r caused exception:%s' %(
				type(val.creator).__name__,
				os.linesep
			)
			after += indent(traceback.format_exc())
			after = os.linesep + indent(after).rstrip()
	else:
		after = ''
	return next(it)[1] \
		+ os.linesep + '  ' \
		+ (os.linesep + '  ').join(
			k + ': ' + v for k, v in it
		) + after

def default_msghook(msg, format_message = format_element):
	"""
	Built-in message hook. DON'T TOUCH!
	"""
	if sys.stderr and not sys.stderr.closed:
		try:
			sys.stderr.write(format_message(msg) + os.linesep)
		except Exception:
			try:
				sys.excepthook(*sys.exc_info())
			except Exception:
				# gasp.
				pass

def errformat(*args, **kw):
	"""
	Raised Database Error formatter pointing to default_excformat.

	Override if you like. All postgresql.exceptions.Error's are formatted using
	this function.
	"""
	return default_errformat(*args, **kw)

def msghook(*args, **kw):
	"""
	Message hook pointing to default_msghook.

	Override if you like. All untrapped messages raised by
	driver connections come here to be printed to stderr.
	"""
	return default_msghook(*args, **kw)

def reset_errformat(with_func = errformat):
	'restore the original excformat function'
	global errformat
	errformat = with_func

def reset_msghook(with_func = msghook):
	'restore the original msghook function'
	global msghook
	msghook = with_func