Skip to content

Commit

Permalink
clean up code in class WebFeatureService_2_0_0
Browse files Browse the repository at this point in the history
  • Loading branch information
640kb authored and Daniel Wendt committed Oct 11, 2023
1 parent e486851 commit 06b0043
Showing 1 changed file with 10 additions and 37 deletions.
47 changes: 10 additions & 37 deletions owslib/feature/wfs200.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,26 @@ class WebFeatureService_2_0_0(WebFeatureService_):
Implements IWebFeatureService.
"""

def __new__(
def __getitem__(self, name):
""" check contents dictionary to allow dict like access to service layers"""
if name in list(self.__getattribute__("contents").keys()):
return self.__getattribute__("contents")[name]
else:
raise KeyError("No content named %s" % name)

def __init__(
self,
url,
version,
xml,
xml=None,
parse_remote_metadata=False,
timeout=30,
headers=None,
username=None,
password=None,
auth=None,
):
""" overridden __new__ method
"""Initialize.
@type url: string
@param url: url of WFS capabilities document
Expand All @@ -73,40 +80,6 @@ def __new__(
@param auth: instance of owslib.util.Authentication
@return: initialized WebFeatureService_2_0_0 object
"""
obj = object.__new__(self)
obj.__init__(
url,
version,
xml,
parse_remote_metadata,
timeout,
headers=headers,
username=username,
password=password,
auth=auth,
)
return obj

def __getitem__(self, name):
""" check contents dictionary to allow dict like access to service layers"""
if name in list(self.__getattribute__("contents").keys()):
return self.__getattribute__("contents")[name]
else:
raise KeyError("No content named %s" % name)

def __init__(
self,
url,
version,
xml=None,
parse_remote_metadata=False,
timeout=30,
headers=None,
username=None,
password=None,
auth=None,
):
"""Initialize."""
if auth:
if username:
auth.username = username
Expand Down

0 comments on commit 06b0043

Please sign in to comment.