Closed adl1995 closed 7 years ago
@cdeil - I've made some changes. But, the parse
method still duplicates the code from HipsDescription
. Is there any way I can call the parse
@classmethod
from within HipsTile
?
My understanding is that the HipsSurveyList
created here is a list of
https://hips.readthedocs.io/en/latest/api/hips.HipsDescription.html
and the text file format for HipsSurveyList
is a bunch of text blocks matching the text file format for a single HipsDescription
concatenated, separated by an empty line.
Is this correct or not?
If yes, you should get the text blocks by splitting on empty lines as you do, and then call HipsDescription.parse
on each of these text blocks. OK?
@cdeil - I have renamed the class HipsDescription
and HipsSurveyList
to HipsSurveyList
and HipsSurveyPropertyList
. I've also updated the parse
method to use HipsSurveyList.parse
. Please check.
@cdeil - I have modified the type to List[HipsSurveyProperties]
in the __init__
method, but this gives me an error when running mypy
:
hips/tiles/surveys.py:61: error: Argument 1 to "HipsSurveyPropertiesList" has incompatible type List[OrderedDict[Any, Any]]; expected List[HipsSurveyProperties]
So, I haven't pushed my changes yet. I don't have much experience with mypy
, but I tried changing all the type annotations from HipsSurveyPropertiesList
to List[HipsSurveyProperties]
. This removes all the errors expect for this one:
hips/tiles/surveys.py:61: error: Incompatible return value type (got "HipsSurveyPropertiesList", expected List[HipsSurveyProperties])
hips/tiles/surveys.py:61: error: Argument 1 to "HipsSurveyPropertiesList" has incompatible type List[OrderedDict[Any, Any]]; expected List[HipsSurveyProperties]
@cdeil - I tried response.decode('utf-8')
, but this gives me an error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 83958: invalid start byte
Also, I think you meant to remove the .properties
from HipsSurveyProperties
, this removes the mypy
error, but I'm unable to use Astropy Table
with this.
@cdeil - I added the fetch
classmethod, but also re-based it against master
, so there are also other files changes showing up.
@adl1995 - I think for this PR you also rebased against some old master branch, so now there's a lot of stuff in the diff unrelated to this PR.
Please rebase against latest master and squash all commits into a single one with a good commit message.
@adl1995 - I've added a commit in c12acd9ab7797cd7fd7e08a80f0ee802715e95f3 that fixes HipsSurveyPropertiesList.fetch (conversion to text and parsing was broken) and adds a test for that, adds from .surveys import *
to __init__
so that the class shows up in the docs, as well as a bunch of cleanup. I did rename the data members on the HipsSurveyProperties
and HipsSurveyPropertiesList
classes to just "data", because I found the previous names confusing because those were often the names of the local variable (i.e. survey.survey
or properties.properties
is confusing).
@adl1995 - Will merge soon when travis-ci passes, unless you have any comments.
I added a class for creating a
astropy.table.Table
from a text file. It reads a list ofOrderedDict
and creates a table from it.