Skip to content

Commit 5c756c9

Browse files
committed
Introduce Site.colno
1 parent 474aa26 commit 5c756c9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

py/dml/logging.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ def loc(self): pass
274274
def filename(self): pass
275275
@abc.abstractproperty
276276
def lineno(self): pass
277+
@abc.abstractproperty
278+
def colno(self): pass
277279
@abc.abstractmethod
278280
def dml_version(self): pass
279281
@abc.abstractmethod
@@ -301,6 +303,7 @@ def bitorder(self):
301303
def provisional_enabled(self, feature):
302304
return False
303305
lineno = 1
306+
colno = 1
304307

305308
def accumulate(iterable):
306309
'''Like itertools.accumulate from Python 3.2'''
@@ -388,6 +391,10 @@ def filename(self):
388391
def lineno(self):
389392
(line, col) = self.file_info.loc_from_offset(self._offs)
390393
return line
394+
@property
395+
def colno(self):
396+
(line, col) = self.file_info.loc_from_offset(self._offs)
397+
return col
391398
def loc(self):
392399
(line, col) = self.file_info.loc_from_offset(self._offs)
393400
return "%s:%d:%d" % (self.filename(), line, col)
@@ -429,6 +436,8 @@ def filename(self): return self.site.filename()
429436
def bitorder(self): return self.site.bitorder()
430437
@property
431438
def lineno(self): return self.site.lineno
439+
@property
440+
def colno(self): return self.site.colno
432441
def provisional_enabled(self, feature):
433442
return self.site.provisional_enabled(feature)
434443

0 commit comments

Comments
 (0)