Skip to content

Commit

Permalink
Merge pull request #332 from msdemlei/jobs_warn
Browse files Browse the repository at this point in the history
Fixing jobs UnknownElement warning
  • Loading branch information
tomdonaldson authored Jun 1, 2022
2 parents fb6a5af + d23ccf0 commit 6a4409a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyvo/io/uws/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
__all__ = ['parse_job', 'parse_job_list', 'JobFile', 'JobList']
__all__ = ['parse_job', 'parse_job_list', 'JobFile']

from .endpoint import *
from .tree import *
10 changes: 5 additions & 5 deletions pyvo/io/uws/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from astropy.io.votable.util import convert_to_writable_filelike

from ...utils.xml.elements import xmlattribute, parse_for_object
from .tree import JobSummary, JobList
from .tree import JobSummary, Jobs

__all__ = ["parse_job", "parse_job_list", "JobFile"]

Expand All @@ -18,7 +18,7 @@ def parse_job_list(
):
"""
Parses a job xml file (or file-like object), and returns a
`~pyvo.io.uws.tree.JobList` object.
`~pyvo.io.uws.tree.Jobs` object.
Parameters
----------
Expand All @@ -39,14 +39,14 @@ def parse_job_list(
Returns
-------
`~pyvo.io.uws.tree.JobList` object
`~pyvo.io.uws.tree.Jobs` object
See also
--------
pyvo.io.vosi.exceptions : The exceptions this function may raise.
"""
return parse_for_object(source, JobList, pedantic, filename,
_debug_python_based_parser)
return parse_for_object(source, Jobs, pedantic, filename,
_debug_python_based_parser).joblist


def parse_job(
Expand Down
14 changes: 12 additions & 2 deletions pyvo/io/uws/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,17 +278,27 @@ def message(self, message):
self._message = message


class JobList(UWSElement, HomogeneousList):
class Jobs(HomogeneousList, UWSElement):
"""A parsed representation of the joblist endpoint.
"""
def __init__(self, config=None, pos=None, _name='jobs', **kwargs):
HomogeneousList.__init__(self, JobSummary)
UWSElement.__init__(self, config, pos, _name, **kwargs)

@uwselement(name='jobref')
@uwselement
def jobs(self):
return self

@jobs.adder
def jobs(self, iterator, tag, data, config, pos):
return

@uwselement(name='jobref')
def joblist(self):
return self

@joblist.adder
def joblist(self, iterator, tag, data, config, pos):
job = JobSummary(config, pos, 'jobref', **data)
job.parse(iterator, config)
self.append(job)
Expand Down

0 comments on commit 6a4409a

Please sign in to comment.