Skip to content

Commit c6f7375

Browse files
Li Xucp2boston
authored andcommitted
No-Jira: try to clean up and close socket (#67)
* No-Jira: try to clean up and close socket so that garbage collection doesn't complain * No-Jira: move warning to constructor
1 parent 82dac03 commit c6f7375

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

rosette/api.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,12 @@ def validate(cls, value, name):
112112

113113
class MorphologyOutput(_PseudoEnum):
114114
""" Class to provide Morphology sub-endpoints """
115-
warnings.warn('MorphologyOutput to be removed in version 1.9.0. '
116-
'Please use API.morphology_output',
117-
DeprecationWarning)
115+
116+
def __init__(self):
117+
warnings.warn('MorphologyOutput to be removed in version 1.9.0. '
118+
'Please use API.morphology_output',
119+
DeprecationWarning)
120+
118121
LEMMAS = "lemmas"
119122
PARTS_OF_SPEECH = "parts-of-speech"
120123
COMPOUND_COMPONENTS = "compound-components"
@@ -605,6 +608,9 @@ def __init__(
605608
'TRANSLITERATION': 'transliteration'
606609
}
607610

611+
def __del__(self):
612+
self.session.close()
613+
608614
def _set_pool_size(self):
609615
adapter = requests.adapters.HTTPAdapter(
610616
pool_maxsize=self.max_pool_size)

0 commit comments

Comments
 (0)