Skip to content

Commit 021be14

Browse files
authored
Merge pull request #10422 from gem/info_sources
Improved `oq info sources`
2 parents 517c734 + 7e2169f commit 021be14

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

openquake/commands/info.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,11 @@ def main(what, report=False):
316316
col.append(' ' * maxlen)
317317
print(''.join(col))
318318
elif what == 'sources':
319-
for cls in gen_subclasses(BaseSeismicSource):
320-
print(cls.__name__)
319+
pairs = sorted((cls.__name__, cls.code)
320+
for cls in gen_subclasses(BaseSeismicSource)
321+
if hasattr(cls, 'code'))
322+
for i, (name, code) in enumerate(pairs, 1):
323+
print('%02d' % i, code.decode('ascii'), name)
321324
elif what == 'disagg':
322325
for out in pmf_map:
323326
print(out)

0 commit comments

Comments
 (0)