Skip to content

stickler comments v3 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pvlib/iotools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
from pvlib.iotools.sodapro import get_cams # noqa: F401
from pvlib.iotools.sodapro import read_cams # noqa: F401
from pvlib.iotools.sodapro import parse_cams # noqa: F401
from pvlib.iotools.panond import read_panond, parse_panond
from pvlib.iotools.panond import read_panond, parse_panond # noqa: F401
17 changes: 9 additions & 8 deletions pvlib/iotools/panond.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

import io

def num_type(value):


# Determine if a value is float, int or leave as string
def num_type(value):
"""
Determine if a value is float, int or a string
"""
if '.' in value:
try: # Detect float
value_out = float(value)
Expand All @@ -26,11 +27,12 @@ def num_type(value):
except ValueError: # Otherwise leave as string
value_out = value
return value_out


def element_type(element):
# Determine if an element is a list then pass to num_type()

"""
Determine if an element is a list then pass to num_type()
"""
if ',' in element: # Detect a list
values = element.split(',')
element_out = []
Expand Down Expand Up @@ -86,11 +88,10 @@ def parse_panond(fbuf):
indent_lvl_2 = (len(lines[i + 1]) - len(lines[i + 1].lstrip(' '))) // 2
line_data = lines[i].split('=')
key = line_data[0].strip()
# value = element_type(line_data[1].strip()) if len(line_data) > 1 else None
if len(line_data) > 1:
value = element_type(line_data[1].strip())
else:
value = element_type = None
value = None
# add a level to the dict. The key here will be ignored.
# Not vital to file function.
if indent_lvl_2 > indent_lvl_1:
Expand Down