Skip to content

Commit

Permalink
Merge pull request astropy#539 from bsipocz/MAINT_astropy6.1_indent_dep
Browse files Browse the repository at this point in the history
MAINT: removing usage of deprecated astropy.utils.misc.indent
  • Loading branch information
bsipocz authored Apr 17, 2024
2 parents 93ce0c1 + 2d3f380 commit 7e93d18
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
33 changes: 18 additions & 15 deletions pyvo/io/vosi/tapregext.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy.utils.collections import HomogeneousList
from astropy.utils.misc import indent
from textwrap import indent

from astropy.io.votable.exceptions import vo_raise, warn_or_raise

Expand All @@ -17,6 +17,9 @@
"TimeLimits", "DataLimits", "DataLimit"]


INDENT = 4 * " "


######################################################################
# ELEMENT CLASSES
class DataModelType(ContentMixin, Element):
Expand All @@ -37,7 +40,7 @@ def describe(self):
Prints out a human readable description
"""
print("Datamodel {}".format(self.content))
print(indent(self.ivo_id))
print(indent(self.ivo_id, INDENT))
print()

@xmlattribute(name='ivo-id')
Expand Down Expand Up @@ -71,8 +74,8 @@ def describe(self):
print('Output format {}'.format(self.mime))

if self.aliases:
print(indent('Also available as {}'.format(
', '.join(self.aliases))))
print(indent('Also available as {}'.format(', '.join(self.aliases)),
INDENT))

print()

Expand Down Expand Up @@ -104,7 +107,7 @@ def describe(self):
Prints out a human readable description
"""
print("Upload method supported")
print(indent(self.ivo_id))
print(indent(self.ivo_id, INDENT))
print()

@xmlattribute(name='ivo-id')
Expand Down Expand Up @@ -238,13 +241,13 @@ def describe(self):
print("Language {}".format(self.name))

for languagefeaturelist in self.languagefeaturelists:
print(indent(languagefeaturelist.type))
print(indent(languagefeaturelist.type, INDENT))

for feature in languagefeaturelist:
print(indent(feature.form, shift=2))
print(indent(feature.form, 2 * INDENT))

if feature.description:
print(indent(feature.description, shift=3))
print(indent(feature.description, 3 * INDENT))

print()

Expand Down Expand Up @@ -467,34 +470,34 @@ def describe(self):

if self.retentionperiod:
print("Time a job is kept (in seconds)")
print(indent("Default {}".format(self.retentionperiod.default)))
print(indent("Default {}".format(self.retentionperiod.default), INDENT))
if self.retentionperiod.hard:
print(indent("Maximum {}".format(self.retentionperiod.hard)))
print(indent("Maximum {}".format(self.retentionperiod.hard), INDENT))
print()

if self.executionduration:
print("Maximal run time of a job")
print(indent("Default {}".format(self.executionduration.default)))
print(indent("Default {}".format(self.executionduration.default), INDENT))
if self.executionduration.hard:
print(indent("Maximum {}".format(self.executionduration.hard)))
print(indent("Maximum {}".format(self.executionduration.hard), INDENT))
print()

if self.outputlimit:
print("Maximum size of resultsets")
print(indent("Default {} {}".format(
self.outputlimit.default.content,
self.outputlimit.default.unit))
self.outputlimit.default.unit), INDENT)
)
if self.outputlimit.hard:
print(indent("Maximum {} {}".format(
self.outputlimit.hard.content, self.outputlimit.hard.unit))
self.outputlimit.hard.content, self.outputlimit.hard.unit), INDENT)
)
print()

if self.uploadlimit:
print("Maximal size of uploads")
print(indent("Maximum {} {}".format(
self.uploadlimit.hard.content, self.uploadlimit.hard.unit)))
self.uploadlimit.hard.content, self.uploadlimit.hard.unit), INDENT))
print()

def get_adql(self):
Expand Down
4 changes: 2 additions & 2 deletions pyvo/io/vosi/vodataservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from astropy.utils import deprecated
from astropy.utils.collections import HomogeneousList
from astropy.utils.misc import indent
from textwrap import indent
from astropy.utils.xml import check as xml_check
from astropy.io.votable.exceptions import vo_raise, vo_warn, warn_or_raise

Expand Down Expand Up @@ -318,7 +318,7 @@ def __repr__(self):
def describe(self):
print(self.name)
if self.description is not None:
print(indent(self.description))
print(indent(self.description, 4 * " "))
else:
print('No description')

Expand Down
4 changes: 2 additions & 2 deletions pyvo/io/vosi/voresource.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
defining a ``value`` property.
"""
from astropy.utils.collections import HomogeneousList
from astropy.utils.misc import indent
from textwrap import indent

from ...utils.xml.elements import (
Element, ElementWithXSIType, ContentMixin, xmlattribute, xmlelement)
Expand Down Expand Up @@ -244,7 +244,7 @@ def describe(self):
accessurls = '\n'.join(
accessurl.content for accessurl in self.accessurls)

print(indent(accessurls))
print(indent(accessurls, 4 * " "))

print()

Expand Down

0 comments on commit 7e93d18

Please sign in to comment.