Skip to content

Commit

Permalink
Strip out redundant __new__ to enable object pickling (geopython#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjf authored Nov 9, 2024
1 parent f3584aa commit 94fb57c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 126 deletions.
42 changes: 0 additions & 42 deletions owslib/feature/wfs100.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,48 +73,6 @@ class WebFeatureService_1_0_0(object):
Implements IWebFeatureService.
"""

def __new__(
self,
url,
version,
xml,
parse_remote_metadata=False,
timeout=30,
headers=None,
username=None,
password=None,
auth=None,
):
""" overridden __new__ method
@type url: string
@param url: url of WFS capabilities document
@type xml: string
@param xml: elementtree object
@type parse_remote_metadata: boolean
@param parse_remote_metadata: whether to fully process MetadataURL elements
@param headers: HTTP headers to send with requests
@param timeout: time (in seconds) after which requests should timeout
@param username: service authentication username
@param password: service authentication password
@param auth: instance of owslib.util.Authentication
@return: initialized WebFeatureService_1_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()):
Expand Down
42 changes: 0 additions & 42 deletions owslib/feature/wfs110.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,48 +56,6 @@ class WebFeatureService_1_1_0(WebFeatureService_):
Implements IWebFeatureService.
"""

def __new__(
self,
url,
version,
xml,
parse_remote_metadata=False,
timeout=30,
headers=None,
username=None,
password=None,
auth=None,
):
""" overridden __new__ method
@type url: string
@param url: url of WFS capabilities document
@type xml: string
@param xml: elementtree object
@type parse_remote_metadata: boolean
@param parse_remote_metadata: whether to fully process MetadataURL elements
@param headers: HTTP headers to send with requests
@param timeout: time (in seconds) after which requests should timeout
@param username: service authentication username
@param password: service authentication password
@param auth: instance of owslib.util.Authentication
@return: initialized WebFeatureService_1_1_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()):
Expand Down
42 changes: 0 additions & 42 deletions owslib/feature/wfs200.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,48 +45,6 @@ class WebFeatureService_2_0_0(WebFeatureService_):
Implements IWebFeatureService.
"""

def __new__(
self,
url,
version,
xml,
parse_remote_metadata=False,
timeout=30,
headers=None,
username=None,
password=None,
auth=None,
):
""" overridden __new__ method
@type url: string
@param url: url of WFS capabilities document
@type xml: string
@param xml: elementtree object
@type parse_remote_metadata: boolean
@param parse_remote_metadata: whether to fully process MetadataURL elements
@param headers: HTTP headers to send with requests
@param timeout: time (in seconds) after which requests should timeout
@param username: service authentication username
@param password: service authentication password
@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()):
Expand Down

0 comments on commit 94fb57c

Please sign in to comment.