code
stringlengths
3
6.57k
os.chdir(d)
os.path.isfile(model_file)
download_model()
print('Model file:', model_file)
time.time()
Punctuator(model_file=model_file)
time.time()
print('Loaded in %s seconds from path.' % td)
StringIO()
p.punctuate(input_text)
print('expect_output_text:', expect_output_text)
print('actual_output_text:', actual_output_text)
self.assertEqual(actual_output_text, expect_output_text)
print('Writing...')
time.time()
p.save(fn)
time.time()
print('Wrote in %s seconds.' % td)
print('Loading...')
time.time()
Punctuator.load(fn)
time.time()
print('Loaded in %s seconds.' % td)
StringIO()
p2.punctuate(input_text)
print('expect_output_text:', expect_output_text)
print('actual_output_text:', actual_output_text)
self.assertEqual(actual_output_text, expect_output_text)
shutil.rmtree(d)
test_punctuate_stream(self)
tempfile.mkdtemp()
os.makedirs(punc.PUNCTUATOR_DATA_DIR, exist_ok=True)
os.path.join(punc.PUNCTUATOR_DATA_DIR, 'Demo-Europarl-EN.pcl')
print('Temp dir:', d)
os.chdir(d)
os.path.isfile(model_file)
download_model()
print('Model file:', model_file)
open(model_file, 'rb')
infile.read()
time.time()
Punctuator(data)
time.time()
print('Loaded in %s seconds as bytes.' % td)
StringIO()
p.punctuate(input_text)
print('expect_output_text:', expect_output_text)
print('actual_output_text:', actual_output_text)
self.assertEqual(actual_output_text, expect_output_text)
print('Writing...')
time.time()
p.save(fn)
time.time()
print('Wrote in %s seconds.' % td)
print('Loading...')
time.time()
Punctuator.load(fn)
time.time()
print('Loaded in %s seconds.' % td)
StringIO()
p2.punctuate(input_text)
print('expect_output_text:', expect_output_text)
print('actual_output_text:', actual_output_text)
self.assertEqual(actual_output_text, expect_output_text)
shutil.rmtree(d)
unittest.main()
Copyright (C)
logging.getLogger(__name__)
FeatureMechanisms(BasePlugin)
set()
plugin_init(self)
self.sasl_callback(set(['username'])
set()
set()
set()
register_stanza_plugin(StreamFeatures, stanza.Mechanisms)
self.xmpp.register_stanza(stanza.Success)
self.xmpp.register_stanza(stanza.Failure)
self.xmpp.register_stanza(stanza.Auth)
self.xmpp.register_stanza(stanza.Challenge)
self.xmpp.register_stanza(stanza.Response)
self.xmpp.register_stanza(stanza.Abort)
MatchXPath(stanza.Success.tag_name()
MatchXPath(stanza.Failure.tag_name()
MatchXPath(stanza.Challenge.tag_name()
_default_credentials(self, required_values, optional_values)
required_values.union(optional_values)
creds.get('username', self.xmpp.requested_jid.user)
creds.get('email', jid)
hasattr(self.xmpp.socket, 'get_channel_binding')
self.xmpp.socket.get_channel_binding()
log.debug("Channel binding not supported.")
creds.get('host', self.xmpp.requested_jid.domain)
creds.get('realm', self.xmpp.requested_jid.domain)
creds.get('service-name', self.xmpp._service_name)
creds.get('service', 'xmpp')
_default_security(self, values)
isinstance(self.xmpp.socket, ssl.SSLSocket)
self.config.get(value, False)
_handle_sasl_auth(self, features)