body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
4e8a9afa7ef32acb0699907980af76b1a6c809bfe92e75676d2a7f58041ff226 | def test_idn_send(self):
'\n Regression test for #14301\n '
self.assertTrue(send_mail('Subject', 'Content', 'example@example.com', ['example@example.com']))
message = self.get_the_message()
self.assertEqual(message.get('subject'), 'Subject')
self.assertEqual(message.get('from'), 'examp... | Regression test for #14301 | tests/mail/tests.py | test_idn_send | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_idn_send(self):
'\n \n '
self.assertTrue(send_mail('Subject', 'Content', 'example@example.com', ['example@example.com']))
message = self.get_the_message()
self.assertEqual(message.get('subject'), 'Subject')
self.assertEqual(message.get('from'), 'example@example.com')
self.... | def test_idn_send(self):
'\n \n '
self.assertTrue(send_mail('Subject', 'Content', 'example@example.com', ['example@example.com']))
message = self.get_the_message()
self.assertEqual(message.get('subject'), 'Subject')
self.assertEqual(message.get('from'), 'example@example.com')
self.... |
879afa2be48d4e688aa8537c36a5348372b622a4853ea7648000bd882edafcfa | def test_recipient_without_domain(self):
'\n Regression test for #15042\n '
self.assertTrue(send_mail('Subject', 'Content', 'tester', ['django']))
message = self.get_the_message()
self.assertEqual(message.get('subject'), 'Subject')
self.assertEqual(message.get('from'), 'tester')
se... | Regression test for #15042 | tests/mail/tests.py | test_recipient_without_domain | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_recipient_without_domain(self):
'\n \n '
self.assertTrue(send_mail('Subject', 'Content', 'tester', ['django']))
message = self.get_the_message()
self.assertEqual(message.get('subject'), 'Subject')
self.assertEqual(message.get('from'), 'tester')
self.assertEqual(message.get... | def test_recipient_without_domain(self):
'\n \n '
self.assertTrue(send_mail('Subject', 'Content', 'tester', ['django']))
message = self.get_the_message()
self.assertEqual(message.get('subject'), 'Subject')
self.assertEqual(message.get('from'), 'tester')
self.assertEqual(message.get... |
ffd2cd93e893788e680ec7cd548cef33f5e6da2c0d53f07dd2f5604986f7ab58 | def test_lazy_addresses(self):
'\n Email sending should support lazy email addresses (#24416).\n '
_ = ugettext_lazy
self.assertTrue(send_mail('Subject', 'Content', _('tester'), [_('django')]))
message = self.get_the_message()
self.assertEqual(message.get('from'), 'tester')
self.as... | Email sending should support lazy email addresses (#24416). | tests/mail/tests.py | test_lazy_addresses | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_lazy_addresses(self):
'\n \n '
_ = ugettext_lazy
self.assertTrue(send_mail('Subject', 'Content', _('tester'), [_('django')]))
message = self.get_the_message()
self.assertEqual(message.get('from'), 'tester')
self.assertEqual(message.get('to'), 'django')
self.flush_mailb... | def test_lazy_addresses(self):
'\n \n '
_ = ugettext_lazy
self.assertTrue(send_mail('Subject', 'Content', _('tester'), [_('django')]))
message = self.get_the_message()
self.assertEqual(message.get('from'), 'tester')
self.assertEqual(message.get('to'), 'django')
self.flush_mailb... |
25aca64a90cc8f2cd4e46805d18aed75d5b89a01f41cb898d490d0cac9147c4a | def test_close_connection(self):
'\n Connection can be closed (even when not explicitly opened)\n '
conn = mail.get_connection(username='', password='')
conn.close() | Connection can be closed (even when not explicitly opened) | tests/mail/tests.py | test_close_connection | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_close_connection(self):
'\n \n '
conn = mail.get_connection(username=, password=)
conn.close() | def test_close_connection(self):
'\n \n '
conn = mail.get_connection(username=, password=)
conn.close()<|docstring|>Connection can be closed (even when not explicitly opened)<|endoftext|> |
5d9773bc801ba58919e782bbe4a0988b096d0799f11c7da8c0aba32180855f02 | def test_use_as_contextmanager(self):
'\n The connection can be used as a contextmanager.\n '
opened = [False]
closed = [False]
conn = mail.get_connection(username='', password='')
def open():
opened[0] = True
conn.open = open
def close():
closed[0] = True
... | The connection can be used as a contextmanager. | tests/mail/tests.py | test_use_as_contextmanager | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_use_as_contextmanager(self):
'\n \n '
opened = [False]
closed = [False]
conn = mail.get_connection(username=, password=)
def open():
opened[0] = True
conn.open = open
def close():
closed[0] = True
conn.close = close
with conn as same_conn:
... | def test_use_as_contextmanager(self):
'\n \n '
opened = [False]
closed = [False]
conn = mail.get_connection(username=, password=)
def open():
opened[0] = True
conn.open = open
def close():
closed[0] = True
conn.close = close
with conn as same_conn:
... |
ed1e7f9c8b2eb6b23187e536806bb8f2501eea626591c93d08b2587ec85ef9de | def test_locmem_shared_messages(self):
'\n Make sure that the locmen backend populates the outbox.\n '
connection = locmem.EmailBackend()
connection2 = locmem.EmailBackend()
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example... | Make sure that the locmen backend populates the outbox. | tests/mail/tests.py | test_locmem_shared_messages | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_locmem_shared_messages(self):
'\n \n '
connection = locmem.EmailBackend()
connection2 = locmem.EmailBackend()
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
connection.send_messages([email])
... | def test_locmem_shared_messages(self):
'\n \n '
connection = locmem.EmailBackend()
connection2 = locmem.EmailBackend()
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
connection.send_messages([email])
... |
916a3c6f5ddc1e6e0007feeb865425f905a0aada811a107a95088d9e2f3d4457 | def test_file_sessions(self):
'Make sure opening a connection creates a new file'
msg = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
connection = mail.get_connection()
connection.send_messages([msg])
self.assertEqual(len(... | Make sure opening a connection creates a new file | tests/mail/tests.py | test_file_sessions | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_file_sessions(self):
msg = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
connection = mail.get_connection()
connection.send_messages([msg])
self.assertEqual(len(os.listdir(self.tmp_dir)), 1)
with open(os.path... | def test_file_sessions(self):
msg = EmailMessage('Subject', 'Content', 'example@example.com', ['example@example.com'], headers={'From': 'example@example.com'})
connection = mail.get_connection()
connection.send_messages([msg])
self.assertEqual(len(os.listdir(self.tmp_dir)), 1)
with open(os.path... |
35ba53ee86ce230ac232aba354553f791429878cdd99e4ac883ba24e887b3880 | def test_console_stream_kwarg(self):
'\n The console backend can be pointed at an arbitrary stream.\n '
s = StringIO()
connection = mail.get_connection('django.core.mail.backends.console.EmailBackend', stream=s)
send_mail('Subject', 'Content', 'example@example.com', ['example@example.com']... | The console backend can be pointed at an arbitrary stream. | tests/mail/tests.py | test_console_stream_kwarg | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_console_stream_kwarg(self):
'\n \n '
s = StringIO()
connection = mail.get_connection('django.core.mail.backends.console.EmailBackend', stream=s)
send_mail('Subject', 'Content', 'example@example.com', ['example@example.com'], connection=connection)
message = force_bytes(s.getva... | def test_console_stream_kwarg(self):
'\n \n '
s = StringIO()
connection = mail.get_connection('django.core.mail.backends.console.EmailBackend', stream=s)
send_mail('Subject', 'Content', 'example@example.com', ['example@example.com'], connection=connection)
message = force_bytes(s.getva... |
a4c3cf5539910107fef886d1e1acc0a54fa1d8eb9495f5f14ef58645f8375c4f | def test_auth_attempted(self):
'\n Opening the backend with non empty username/password tries\n to authenticate against the SMTP server.\n '
backend = smtp.EmailBackend(username='not empty username', password='not empty password')
with self.assertRaisesMessage(SMTPException, 'SMTP AUTH ... | Opening the backend with non empty username/password tries
to authenticate against the SMTP server. | tests/mail/tests.py | test_auth_attempted | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_auth_attempted(self):
'\n Opening the backend with non empty username/password tries\n to authenticate against the SMTP server.\n '
backend = smtp.EmailBackend(username='not empty username', password='not empty password')
with self.assertRaisesMessage(SMTPException, 'SMTP AUTH ... | def test_auth_attempted(self):
'\n Opening the backend with non empty username/password tries\n to authenticate against the SMTP server.\n '
backend = smtp.EmailBackend(username='not empty username', password='not empty password')
with self.assertRaisesMessage(SMTPException, 'SMTP AUTH ... |
ce40a27aedecdb99d8f7bdf596343a9fee82df2d8bca79410e3023e57835de10 | def test_server_open(self):
'\n open() returns whether it opened a connection.\n '
backend = smtp.EmailBackend(username='', password='')
self.assertFalse(backend.connection)
opened = backend.open()
backend.close()
self.assertTrue(opened) | open() returns whether it opened a connection. | tests/mail/tests.py | test_server_open | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_server_open(self):
'\n \n '
backend = smtp.EmailBackend(username=, password=)
self.assertFalse(backend.connection)
opened = backend.open()
backend.close()
self.assertTrue(opened) | def test_server_open(self):
'\n \n '
backend = smtp.EmailBackend(username=, password=)
self.assertFalse(backend.connection)
opened = backend.open()
backend.close()
self.assertTrue(opened)<|docstring|>open() returns whether it opened a connection.<|endoftext|> |
ee2434eb35fe44692ec9cb0ef6f6141be3b2a3f23793aa70063300bce8ff5ee7 | def test_server_login(self):
"\n Even if the Python SMTP server doesn't support authentication, the\n login process starts and the appropriate exception is raised.\n "
class CustomEmailBackend(smtp.EmailBackend):
connection_class = FakeAUTHSMTPConnection
backend = CustomEmailBa... | Even if the Python SMTP server doesn't support authentication, the
login process starts and the appropriate exception is raised. | tests/mail/tests.py | test_server_login | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_server_login(self):
"\n Even if the Python SMTP server doesn't support authentication, the\n login process starts and the appropriate exception is raised.\n "
class CustomEmailBackend(smtp.EmailBackend):
connection_class = FakeAUTHSMTPConnection
backend = CustomEmailBa... | def test_server_login(self):
"\n Even if the Python SMTP server doesn't support authentication, the\n login process starts and the appropriate exception is raised.\n "
class CustomEmailBackend(smtp.EmailBackend):
connection_class = FakeAUTHSMTPConnection
backend = CustomEmailBa... |
367e77a26d3b3511a2ec5ed222595b46f2ec53967763812e7fa07c357b5d0f46 | def test_connection_timeout_default(self):
"The connection's timeout value is None by default."
connection = mail.get_connection('django.core.mail.backends.smtp.EmailBackend')
self.assertIsNone(connection.timeout) | The connection's timeout value is None by default. | tests/mail/tests.py | test_connection_timeout_default | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_connection_timeout_default(self):
connection = mail.get_connection('django.core.mail.backends.smtp.EmailBackend')
self.assertIsNone(connection.timeout) | def test_connection_timeout_default(self):
connection = mail.get_connection('django.core.mail.backends.smtp.EmailBackend')
self.assertIsNone(connection.timeout)<|docstring|>The connection's timeout value is None by default.<|endoftext|> |
02c0feb7b8a9af704fbd28ec10e2142bb9db0e127d7c4cebd551c941f65cb4a2 | def test_connection_timeout_custom(self):
'The timeout parameter can be customized.'
class MyEmailBackend(smtp.EmailBackend):
def __init__(self, *args, **kwargs):
kwargs.setdefault('timeout', 42)
super(MyEmailBackend, self).__init__(*args, **kwargs)
myemailbackend = MyEmail... | The timeout parameter can be customized. | tests/mail/tests.py | test_connection_timeout_custom | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_connection_timeout_custom(self):
class MyEmailBackend(smtp.EmailBackend):
def __init__(self, *args, **kwargs):
kwargs.setdefault('timeout', 42)
super(MyEmailBackend, self).__init__(*args, **kwargs)
myemailbackend = MyEmailBackend()
myemailbackend.open()
se... | def test_connection_timeout_custom(self):
class MyEmailBackend(smtp.EmailBackend):
def __init__(self, *args, **kwargs):
kwargs.setdefault('timeout', 42)
super(MyEmailBackend, self).__init__(*args, **kwargs)
myemailbackend = MyEmailBackend()
myemailbackend.open()
se... |
188fc8cbcc1d5537a63a60e04749b42684ddbf750b9e5f3e8b0c7544c0ba5a25 | def test_email_msg_uses_crlf(self):
'#23063 -- RFC-compliant messages are sent over SMTP.'
send = SMTP.send
try:
smtp_messages = []
def mock_send(self, s):
smtp_messages.append(s)
return send(self, s)
SMTP.send = mock_send
email = EmailMessage('Subjec... | #23063 -- RFC-compliant messages are sent over SMTP. | tests/mail/tests.py | test_email_msg_uses_crlf | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_email_msg_uses_crlf(self):
send = SMTP.send
try:
smtp_messages = []
def mock_send(self, s):
smtp_messages.append(s)
return send(self, s)
SMTP.send = mock_send
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@exampl... | def test_email_msg_uses_crlf(self):
send = SMTP.send
try:
smtp_messages = []
def mock_send(self, s):
smtp_messages.append(s)
return send(self, s)
SMTP.send = mock_send
email = EmailMessage('Subject', 'Content', 'example@example.com', ['example@exampl... |
c643f54778f35d13e9a18301d746e06cf1371faa34e91974643c5aabe5f63040 | def test_send_messages_after_open_failed(self):
"\n send_messages() shouldn't try to send messages if open() raises an\n exception after initializing the connection.\n "
backend = smtp.EmailBackend()
backend.connection = True
backend.open = (lambda : None)
email = EmailMessage('... | send_messages() shouldn't try to send messages if open() raises an
exception after initializing the connection. | tests/mail/tests.py | test_send_messages_after_open_failed | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_send_messages_after_open_failed(self):
"\n send_messages() shouldn't try to send messages if open() raises an\n exception after initializing the connection.\n "
backend = smtp.EmailBackend()
backend.connection = True
backend.open = (lambda : None)
email = EmailMessage('... | def test_send_messages_after_open_failed(self):
"\n send_messages() shouldn't try to send messages if open() raises an\n exception after initializing the connection.\n "
backend = smtp.EmailBackend()
backend.connection = True
backend.open = (lambda : None)
email = EmailMessage('... |
601c466676d3151f6ea92fc9546ce96b6ed7459215c13f89075cf4e450ce5b13 | def test_server_stopped(self):
"\n Closing the backend while the SMTP server is stopped doesn't raise an\n exception.\n "
self.backend.close() | Closing the backend while the SMTP server is stopped doesn't raise an
exception. | tests/mail/tests.py | test_server_stopped | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_server_stopped(self):
"\n Closing the backend while the SMTP server is stopped doesn't raise an\n exception.\n "
self.backend.close() | def test_server_stopped(self):
"\n Closing the backend while the SMTP server is stopped doesn't raise an\n exception.\n "
self.backend.close()<|docstring|>Closing the backend while the SMTP server is stopped doesn't raise an
exception.<|endoftext|> |
2b9b726b12104e6eddb67c5cb6aa5814da1c8959c0b7bf65843c3ee44929cff6 | def test_fail_silently_on_connection_error(self):
'\n A socket connection error is silenced with fail_silently=True.\n '
with self.assertRaises(socket.error):
self.backend.open()
self.backend.fail_silently = True
self.backend.open() | A socket connection error is silenced with fail_silently=True. | tests/mail/tests.py | test_fail_silently_on_connection_error | jonashaag/django-1.1-python-3.7 | 5,079 | python | def test_fail_silently_on_connection_error(self):
'\n \n '
with self.assertRaises(socket.error):
self.backend.open()
self.backend.fail_silently = True
self.backend.open() | def test_fail_silently_on_connection_error(self):
'\n \n '
with self.assertRaises(socket.error):
self.backend.open()
self.backend.fail_silently = True
self.backend.open()<|docstring|>A socket connection error is silenced with fail_silently=True.<|endoftext|> |
8f94f3e1ad88e59750c68079185fa42cd335b603be36c33dcd2f6e28242afbc7 | def _bce_loss_with_logits(output, labels, **kwargs):
'\n Wrapper for BCE loss with logits.\n '
return F.binary_cross_entropy_with_logits(output, labels, reduction='none', **kwargs) | Wrapper for BCE loss with logits. | diagan-pkg/diagan/models/topk_models.py | _bce_loss_with_logits | lee-jinhee/self-diagnosing-gan | 16 | python | def _bce_loss_with_logits(output, labels, **kwargs):
'\n \n '
return F.binary_cross_entropy_with_logits(output, labels, reduction='none', **kwargs) | def _bce_loss_with_logits(output, labels, **kwargs):
'\n \n '
return F.binary_cross_entropy_with_logits(output, labels, reduction='none', **kwargs)<|docstring|>Wrapper for BCE loss with logits.<|endoftext|> |
521924d5cfd3f104e35dd82bded5d2b5eafb973cf4e5511d9379fe29cab195c6 | def train_step(self, real_batch, netD, optG, log_data, device=None, global_step=None, scaler=None, **kwargs):
"\n Takes one training step for G.\n\n Args:\n real_batch (Tensor): A batch of real images of shape (N, C, H, W).\n Used for obtaining current batch size.\n ... | Takes one training step for G.
Args:
real_batch (Tensor): A batch of real images of shape (N, C, H, W).
Used for obtaining current batch size.
netD (nn.Module): Discriminator model for obtaining losses.
optG (Optimizer): Optimizer for updating generator's parameters.
log_data (dict): A dict map... | diagan-pkg/diagan/models/topk_models.py | train_step | lee-jinhee/self-diagnosing-gan | 16 | python | def train_step(self, real_batch, netD, optG, log_data, device=None, global_step=None, scaler=None, **kwargs):
"\n Takes one training step for G.\n\n Args:\n real_batch (Tensor): A batch of real images of shape (N, C, H, W).\n Used for obtaining current batch size.\n ... | def train_step(self, real_batch, netD, optG, log_data, device=None, global_step=None, scaler=None, **kwargs):
"\n Takes one training step for G.\n\n Args:\n real_batch (Tensor): A batch of real images of shape (N, C, H, W).\n Used for obtaining current batch size.\n ... |
521924d5cfd3f104e35dd82bded5d2b5eafb973cf4e5511d9379fe29cab195c6 | def train_step(self, real_batch, netD, optG, log_data, device=None, global_step=None, scaler=None, **kwargs):
"\n Takes one training step for G.\n\n Args:\n real_batch (Tensor): A batch of real images of shape (N, C, H, W).\n Used for obtaining current batch size.\n ... | Takes one training step for G.
Args:
real_batch (Tensor): A batch of real images of shape (N, C, H, W).
Used for obtaining current batch size.
netD (nn.Module): Discriminator model for obtaining losses.
optG (Optimizer): Optimizer for updating generator's parameters.
log_data (dict): A dict map... | diagan-pkg/diagan/models/topk_models.py | train_step | lee-jinhee/self-diagnosing-gan | 16 | python | def train_step(self, real_batch, netD, optG, log_data, device=None, global_step=None, scaler=None, **kwargs):
"\n Takes one training step for G.\n\n Args:\n real_batch (Tensor): A batch of real images of shape (N, C, H, W).\n Used for obtaining current batch size.\n ... | def train_step(self, real_batch, netD, optG, log_data, device=None, global_step=None, scaler=None, **kwargs):
"\n Takes one training step for G.\n\n Args:\n real_batch (Tensor): A batch of real images of shape (N, C, H, W).\n Used for obtaining current batch size.\n ... |
7127fa6487643f6fb55004e655adda52cb4380ab1d57de07dfe463395c8ad7da | def train_step(self, real_batch, netD, optG, log_data, device=None, global_step=None, **kwargs):
"\n Takes one training step for G.\n\n Args:\n real_batch (Tensor): A batch of real images of shape (N, C, H, W).\n Used for obtaining current batch size.\n netD (nn.Mo... | Takes one training step for G.
Args:
real_batch (Tensor): A batch of real images of shape (N, C, H, W).
Used for obtaining current batch size.
netD (nn.Module): Discriminator model for obtaining losses.
optG (Optimizer): Optimizer for updating generator's parameters.
log_data (MetricLog): An ob... | diagan-pkg/diagan/models/topk_models.py | train_step | lee-jinhee/self-diagnosing-gan | 16 | python | def train_step(self, real_batch, netD, optG, log_data, device=None, global_step=None, **kwargs):
"\n Takes one training step for G.\n\n Args:\n real_batch (Tensor): A batch of real images of shape (N, C, H, W).\n Used for obtaining current batch size.\n netD (nn.Mo... | def train_step(self, real_batch, netD, optG, log_data, device=None, global_step=None, **kwargs):
"\n Takes one training step for G.\n\n Args:\n real_batch (Tensor): A batch of real images of shape (N, C, H, W).\n Used for obtaining current batch size.\n netD (nn.Mo... |
7127fa6487643f6fb55004e655adda52cb4380ab1d57de07dfe463395c8ad7da | def train_step(self, real_batch, netD, optG, log_data, device=None, global_step=None, **kwargs):
"\n Takes one training step for G.\n\n Args:\n real_batch (Tensor): A batch of real images of shape (N, C, H, W).\n Used for obtaining current batch size.\n netD (nn.Mo... | Takes one training step for G.
Args:
real_batch (Tensor): A batch of real images of shape (N, C, H, W).
Used for obtaining current batch size.
netD (nn.Module): Discriminator model for obtaining losses.
optG (Optimizer): Optimizer for updating generator's parameters.
log_data (MetricLog): An ob... | diagan-pkg/diagan/models/topk_models.py | train_step | lee-jinhee/self-diagnosing-gan | 16 | python | def train_step(self, real_batch, netD, optG, log_data, device=None, global_step=None, **kwargs):
"\n Takes one training step for G.\n\n Args:\n real_batch (Tensor): A batch of real images of shape (N, C, H, W).\n Used for obtaining current batch size.\n netD (nn.Mo... | def train_step(self, real_batch, netD, optG, log_data, device=None, global_step=None, **kwargs):
"\n Takes one training step for G.\n\n Args:\n real_batch (Tensor): A batch of real images of shape (N, C, H, W).\n Used for obtaining current batch size.\n netD (nn.Mo... |
6c15e2fb8340497b70f9a102950bb10e475d6ddad7a8c8ea6f47d029a06c49bb | @rename_keyword(color='rgbcolor')
@options(fontsize=10, rgbcolor=(0, 0, 1), horizontal_alignment='center', vertical_alignment='center', axis_coords=False, clip=False)
def text(string, xy, **options):
'\n Return a 2D text graphics object at the point `(x, y)`.\n\n Type ``text.options`` for a dictionary of opti... | Return a 2D text graphics object at the point `(x, y)`.
Type ``text.options`` for a dictionary of options for 2D text.
2D OPTIONS:
- ``fontsize`` - How big the text is. Either an integer that
specifies the size in points or a string which specifies a size (one of
'xx-small', 'x-small', 'small', 'medium', 'large'... | src/sage/plot/text.py | text | LaisRast/sage | 1,742 | python | @rename_keyword(color='rgbcolor')
@options(fontsize=10, rgbcolor=(0, 0, 1), horizontal_alignment='center', vertical_alignment='center', axis_coords=False, clip=False)
def text(string, xy, **options):
'\n Return a 2D text graphics object at the point `(x, y)`.\n\n Type ``text.options`` for a dictionary of opti... | @rename_keyword(color='rgbcolor')
@options(fontsize=10, rgbcolor=(0, 0, 1), horizontal_alignment='center', vertical_alignment='center', axis_coords=False, clip=False)
def text(string, xy, **options):
'\n Return a 2D text graphics object at the point `(x, y)`.\n\n Type ``text.options`` for a dictionary of opti... |
6915e9772a8db88643fe44afa499c9faa67a2587ff8f4f935b6b64f25e0dbe0b | def __init__(self, string, point, options):
'\n Initialize base class Text.\n\n EXAMPLES::\n\n sage: T = text("I like Fibonacci", (3,5))\n sage: t = T[0]\n sage: t.string\n \'I like Fibonacci\'\n sage: t.x\n 3.0\n sage: t.opt... | Initialize base class Text.
EXAMPLES::
sage: T = text("I like Fibonacci", (3,5))
sage: t = T[0]
sage: t.string
'I like Fibonacci'
sage: t.x
3.0
sage: t.options()['fontsize']
10 | src/sage/plot/text.py | __init__ | LaisRast/sage | 1,742 | python | def __init__(self, string, point, options):
'\n Initialize base class Text.\n\n EXAMPLES::\n\n sage: T = text("I like Fibonacci", (3,5))\n sage: t = T[0]\n sage: t.string\n \'I like Fibonacci\'\n sage: t.x\n 3.0\n sage: t.opt... | def __init__(self, string, point, options):
'\n Initialize base class Text.\n\n EXAMPLES::\n\n sage: T = text("I like Fibonacci", (3,5))\n sage: t = T[0]\n sage: t.string\n \'I like Fibonacci\'\n sage: t.x\n 3.0\n sage: t.opt... |
812178a5a98a14966354104000dbe94a1200133be5fe8f52626fa077a3fee453 | def get_minmax_data(self):
'\n Return a dictionary with the bounding box data. Notice\n that, for text, the box is just the location itself.\n\n EXAMPLES::\n\n sage: T = text("Where am I?",(1,1))\n sage: t=T[0]\n sage: t.get_minmax_data()[\'ymin\']\n ... | Return a dictionary with the bounding box data. Notice
that, for text, the box is just the location itself.
EXAMPLES::
sage: T = text("Where am I?",(1,1))
sage: t=T[0]
sage: t.get_minmax_data()['ymin']
1.0
sage: t.get_minmax_data()['ymax']
1.0 | src/sage/plot/text.py | get_minmax_data | LaisRast/sage | 1,742 | python | def get_minmax_data(self):
'\n Return a dictionary with the bounding box data. Notice\n that, for text, the box is just the location itself.\n\n EXAMPLES::\n\n sage: T = text("Where am I?",(1,1))\n sage: t=T[0]\n sage: t.get_minmax_data()[\'ymin\']\n ... | def get_minmax_data(self):
'\n Return a dictionary with the bounding box data. Notice\n that, for text, the box is just the location itself.\n\n EXAMPLES::\n\n sage: T = text("Where am I?",(1,1))\n sage: t=T[0]\n sage: t.get_minmax_data()[\'ymin\']\n ... |
21a2656dcff9d3cc203f380c615f391b939708103c5570b38c8096d7e86901e0 | def _repr_(self):
'\n String representation of Text primitive.\n\n EXAMPLES::\n\n sage: T = text("I like cool constants", (pi,e))\n sage: t=T[0];t\n Text \'I like cool constants\' at the point (3.1415926535...,2.7182818284...)\n '
return ("Text '%s' at the p... | String representation of Text primitive.
EXAMPLES::
sage: T = text("I like cool constants", (pi,e))
sage: t=T[0];t
Text 'I like cool constants' at the point (3.1415926535...,2.7182818284...) | src/sage/plot/text.py | _repr_ | LaisRast/sage | 1,742 | python | def _repr_(self):
'\n String representation of Text primitive.\n\n EXAMPLES::\n\n sage: T = text("I like cool constants", (pi,e))\n sage: t=T[0];t\n Text \'I like cool constants\' at the point (3.1415926535...,2.7182818284...)\n '
return ("Text '%s' at the p... | def _repr_(self):
'\n String representation of Text primitive.\n\n EXAMPLES::\n\n sage: T = text("I like cool constants", (pi,e))\n sage: t=T[0];t\n Text \'I like cool constants\' at the point (3.1415926535...,2.7182818284...)\n '
return ("Text '%s' at the p... |
5097e322d61f58f2cdedc85f0390a160725ae35c0d19d0971d51458bd315e90b | def _allowed_options(self):
'\n Return the allowed options for the Text class.\n\n EXAMPLES::\n\n sage: T = text("ABC",(1,1),zorder=3)\n sage: T[0]._allowed_options()[\'fontsize\']\n "How big the text is. Either the size in points or a relative size, e.g. \'smaller\', ... | Return the allowed options for the Text class.
EXAMPLES::
sage: T = text("ABC",(1,1),zorder=3)
sage: T[0]._allowed_options()['fontsize']
"How big the text is. Either the size in points or a relative size, e.g. 'smaller', 'x-large', etc"
sage: T[0]._allowed_options()['zorder']
'The layer level in w... | src/sage/plot/text.py | _allowed_options | LaisRast/sage | 1,742 | python | def _allowed_options(self):
'\n Return the allowed options for the Text class.\n\n EXAMPLES::\n\n sage: T = text("ABC",(1,1),zorder=3)\n sage: T[0]._allowed_options()[\'fontsize\']\n "How big the text is. Either the size in points or a relative size, e.g. \'smaller\', ... | def _allowed_options(self):
'\n Return the allowed options for the Text class.\n\n EXAMPLES::\n\n sage: T = text("ABC",(1,1),zorder=3)\n sage: T[0]._allowed_options()[\'fontsize\']\n "How big the text is. Either the size in points or a relative size, e.g. \'smaller\', ... |
5c31477122b5c8996876f4685cf03b7cdd109e4644cfae7e038bf39df762c3b1 | def _plot3d_options(self, options=None):
'\n Translate 2D plot options into 3D plot options.\n\n EXAMPLES::\n\n sage: T = text("ABC",(1,1))\n sage: t = T[0]\n sage: t.options()[\'rgbcolor\']\n (0.0, 0.0, 1.0)\n sage: s=t.plot3d()\n sage... | Translate 2D plot options into 3D plot options.
EXAMPLES::
sage: T = text("ABC",(1,1))
sage: t = T[0]
sage: t.options()['rgbcolor']
(0.0, 0.0, 1.0)
sage: s=t.plot3d()
sage: s.jmol_repr(s.testing_render_params())[0][1]
'color atom [0,0,255]' | src/sage/plot/text.py | _plot3d_options | LaisRast/sage | 1,742 | python | def _plot3d_options(self, options=None):
'\n Translate 2D plot options into 3D plot options.\n\n EXAMPLES::\n\n sage: T = text("ABC",(1,1))\n sage: t = T[0]\n sage: t.options()[\'rgbcolor\']\n (0.0, 0.0, 1.0)\n sage: s=t.plot3d()\n sage... | def _plot3d_options(self, options=None):
'\n Translate 2D plot options into 3D plot options.\n\n EXAMPLES::\n\n sage: T = text("ABC",(1,1))\n sage: t = T[0]\n sage: t.options()[\'rgbcolor\']\n (0.0, 0.0, 1.0)\n sage: s=t.plot3d()\n sage... |
1b11d61c9cd4bfcd4293f79ab9c1af31c7f6d797a9e7a78b23438f52bc89315b | def plot3d(self, **kwds):
'\n Plot 2D text in 3D.\n\n EXAMPLES::\n\n sage: T = text("ABC", (1, 1))\n sage: t = T[0]\n sage: s = t.plot3d()\n sage: s.jmol_repr(s.testing_render_params())[0][2]\n \'label "ABC"\'\n sage: s._trans\n ... | Plot 2D text in 3D.
EXAMPLES::
sage: T = text("ABC", (1, 1))
sage: t = T[0]
sage: s = t.plot3d()
sage: s.jmol_repr(s.testing_render_params())[0][2]
'label "ABC"'
sage: s._trans
(1.0, 1.0, 0) | src/sage/plot/text.py | plot3d | LaisRast/sage | 1,742 | python | def plot3d(self, **kwds):
'\n Plot 2D text in 3D.\n\n EXAMPLES::\n\n sage: T = text("ABC", (1, 1))\n sage: t = T[0]\n sage: s = t.plot3d()\n sage: s.jmol_repr(s.testing_render_params())[0][2]\n \'label "ABC"\'\n sage: s._trans\n ... | def plot3d(self, **kwds):
'\n Plot 2D text in 3D.\n\n EXAMPLES::\n\n sage: T = text("ABC", (1, 1))\n sage: t = T[0]\n sage: s = t.plot3d()\n sage: s.jmol_repr(s.testing_render_params())[0][2]\n \'label "ABC"\'\n sage: s._trans\n ... |
04183e4777861b3c8c09223705a958d0a3d59f5a7bbfa80ff3d86f4c220fca77 | def _render_on_subplot(self, subplot):
'\n TESTS::\n\n sage: t1 = text("Hello",(1,1), vertical_alignment="top", fontsize=30, rgbcolor=\'black\')\n sage: t2 = text("World", (1,1), horizontal_alignment="left", fontsize=20, zorder=-1)\n sage: t1 + t2 # render the sum\n ... | TESTS::
sage: t1 = text("Hello",(1,1), vertical_alignment="top", fontsize=30, rgbcolor='black')
sage: t2 = text("World", (1,1), horizontal_alignment="left", fontsize=20, zorder=-1)
sage: t1 + t2 # render the sum
Graphics object consisting of 2 graphics primitives | src/sage/plot/text.py | _render_on_subplot | LaisRast/sage | 1,742 | python | def _render_on_subplot(self, subplot):
'\n TESTS::\n\n sage: t1 = text("Hello",(1,1), vertical_alignment="top", fontsize=30, rgbcolor=\'black\')\n sage: t2 = text("World", (1,1), horizontal_alignment="left", fontsize=20, zorder=-1)\n sage: t1 + t2 # render the sum\n ... | def _render_on_subplot(self, subplot):
'\n TESTS::\n\n sage: t1 = text("Hello",(1,1), vertical_alignment="top", fontsize=30, rgbcolor=\'black\')\n sage: t2 = text("World", (1,1), horizontal_alignment="left", fontsize=20, zorder=-1)\n sage: t1 + t2 # render the sum\n ... |
13f7f3f765151a975f19f91cd56a833a4e0bd5c6919997a47596333507f04683 | def test_post_with_permission_denied_error(self):
'Testing the POST review-requests/<id>/draft/file-attachments/ API\n with Permission Denied error\n '
review_request = self.create_review_request()
self.assertNotEqual(review_request.submitter, self.user)
f = open(self._getTrophyFilename(),... | Testing the POST review-requests/<id>/draft/file-attachments/ API
with Permission Denied error | reviewboard/webapi/tests/test_file_attachment_draft.py | test_post_with_permission_denied_error | bcskda/reviewboard | 1 | python | def test_post_with_permission_denied_error(self):
'Testing the POST review-requests/<id>/draft/file-attachments/ API\n with Permission Denied error\n '
review_request = self.create_review_request()
self.assertNotEqual(review_request.submitter, self.user)
f = open(self._getTrophyFilename(),... | def test_post_with_permission_denied_error(self):
'Testing the POST review-requests/<id>/draft/file-attachments/ API\n with Permission Denied error\n '
review_request = self.create_review_request()
self.assertNotEqual(review_request.submitter, self.user)
f = open(self._getTrophyFilename(),... |
34840f6c8a81e4ec5a2f28c222505cb4a11f37ac2996f4cce4cbe38a72e3bdcb | def test_delete_file_with_publish(self):
'Testing delete the published DraftFileAttachment'
review_request = self.create_review_request()
self._login_user(admin=True)
file_attachment = self.create_file_attachment(review_request, draft=True)
review_request.get_draft().publish()
self.api_delete(ge... | Testing delete the published DraftFileAttachment | reviewboard/webapi/tests/test_file_attachment_draft.py | test_delete_file_with_publish | bcskda/reviewboard | 1 | python | def test_delete_file_with_publish(self):
review_request = self.create_review_request()
self._login_user(admin=True)
file_attachment = self.create_file_attachment(review_request, draft=True)
review_request.get_draft().publish()
self.api_delete(get_draft_file_attachment_item_url(review_request, f... | def test_delete_file_with_publish(self):
review_request = self.create_review_request()
self._login_user(admin=True)
file_attachment = self.create_file_attachment(review_request, draft=True)
review_request.get_draft().publish()
self.api_delete(get_draft_file_attachment_item_url(review_request, f... |
35e9008ff4e7b36406d64bc41152269c04fcf744a2aefca3b1c876a0b22ec8c3 | def act_state(context):
'Action routine for STATE directive.'
args = context.line.split()
if (len(args) != 1):
raise ExtraToken('STATE', line=context.line_num)
name = args[0].strip()
if (name in context.states.keys()):
raise DuplicateName('STATE', context.line_num)
if (context.fi... | Action routine for STATE directive. | fsm/actions.py | act_state | robertchase/fsm | 0 | python | def act_state(context):
args = context.line.split()
if (len(args) != 1):
raise ExtraToken('STATE', line=context.line_num)
name = args[0].strip()
if (name in context.states.keys()):
raise DuplicateName('STATE', context.line_num)
if (context.first_state is None):
context.f... | def act_state(context):
args = context.line.split()
if (len(args) != 1):
raise ExtraToken('STATE', line=context.line_num)
name = args[0].strip()
if (name in context.states.keys()):
raise DuplicateName('STATE', context.line_num)
if (context.first_state is None):
context.f... |
d719e0667b3dc02e113a7ad817f1db65aaa2035a2adef6565d39cfe7e731c68d | def act_enter(context):
'Action routine for ENTER directive.'
args = context.line.split()
if (len(args) != 1):
raise ExtraToken('ENTER', line=context.line_num)
name = args[0].strip()
if (context.state.enter is not None):
raise DuplicateDirective('ENTER', context.line_num)
context... | Action routine for ENTER directive. | fsm/actions.py | act_enter | robertchase/fsm | 0 | python | def act_enter(context):
args = context.line.split()
if (len(args) != 1):
raise ExtraToken('ENTER', line=context.line_num)
name = args[0].strip()
if (context.state.enter is not None):
raise DuplicateDirective('ENTER', context.line_num)
context.state.enter = name
context.add_a... | def act_enter(context):
args = context.line.split()
if (len(args) != 1):
raise ExtraToken('ENTER', line=context.line_num)
name = args[0].strip()
if (context.state.enter is not None):
raise DuplicateDirective('ENTER', context.line_num)
context.state.enter = name
context.add_a... |
c370c51da8e5e323d875976180fd29b05c08918ecd4cfee01f2727c0937b8c28 | def act_exception(context):
'Action routine for EXCEPTION directive.'
if (len(context.line.split()) != 1):
raise ExtraToken('EXCEPTION', line=context.line_num)
if (context.exception is not None):
raise DuplicateDirective('EXCEPTION', context.line_num)
context.exception = import_by_path(c... | Action routine for EXCEPTION directive. | fsm/actions.py | act_exception | robertchase/fsm | 0 | python | def act_exception(context):
if (len(context.line.split()) != 1):
raise ExtraToken('EXCEPTION', line=context.line_num)
if (context.exception is not None):
raise DuplicateDirective('EXCEPTION', context.line_num)
context.exception = import_by_path(context.line) | def act_exception(context):
if (len(context.line.split()) != 1):
raise ExtraToken('EXCEPTION', line=context.line_num)
if (context.exception is not None):
raise DuplicateDirective('EXCEPTION', context.line_num)
context.exception = import_by_path(context.line)<|docstring|>Action routine f... |
859417a596fcc9363742abd9cc133debd877a58272c169b038c9d8f1af7a0e8c | def act_exit(context):
'Action routine for EXIT directive.'
args = context.line.split()
if (len(args) != 1):
raise ExtraToken('EXIT', line=context.line_num)
name = args[0].strip()
if (context.state.exit is not None):
raise DuplicateDirective('EXIT', context.line_num)
context.stat... | Action routine for EXIT directive. | fsm/actions.py | act_exit | robertchase/fsm | 0 | python | def act_exit(context):
args = context.line.split()
if (len(args) != 1):
raise ExtraToken('EXIT', line=context.line_num)
name = args[0].strip()
if (context.state.exit is not None):
raise DuplicateDirective('EXIT', context.line_num)
context.state.exit = name
context.add_action... | def act_exit(context):
args = context.line.split()
if (len(args) != 1):
raise ExtraToken('EXIT', line=context.line_num)
name = args[0].strip()
if (context.state.exit is not None):
raise DuplicateDirective('EXIT', context.line_num)
context.state.exit = name
context.add_action... |
43df582e6d4e647465b3079a5e765695841f81e9d93c9844aa9c2592bc536c8b | def act_event(context):
'Action routine for EVENT directive.'
args = context.line.split()
if (len(args) == 2):
(name, next_state) = args
elif (len(args) != 1):
raise ExtraToken('EVENT', 'one or two', context.line_num)
else:
name = args[0].strip()
next_state = None
... | Action routine for EVENT directive. | fsm/actions.py | act_event | robertchase/fsm | 0 | python | def act_event(context):
args = context.line.split()
if (len(args) == 2):
(name, next_state) = args
elif (len(args) != 1):
raise ExtraToken('EVENT', 'one or two', context.line_num)
else:
name = args[0].strip()
next_state = None
context.event = Event(name, next_sta... | def act_event(context):
args = context.line.split()
if (len(args) == 2):
(name, next_state) = args
elif (len(args) != 1):
raise ExtraToken('EVENT', 'one or two', context.line_num)
else:
name = args[0].strip()
next_state = None
context.event = Event(name, next_sta... |
f1dfdbdac4e5b17eef7168eb4de3cf2d2c9541ba44cbc9d25e9ed5d2b210b5bf | def act_action(context):
'Action routine for ACTION directive.'
args = context.line.split()
if (len(args) != 1):
raise ExtraToken('ACTION', line=context.line_num)
name = args[0].strip()
if (name in context.event.actions):
raise DuplicateName('ACTION', context.line_num)
context.ev... | Action routine for ACTION directive. | fsm/actions.py | act_action | robertchase/fsm | 0 | python | def act_action(context):
args = context.line.split()
if (len(args) != 1):
raise ExtraToken('ACTION', line=context.line_num)
name = args[0].strip()
if (name in context.event.actions):
raise DuplicateName('ACTION', context.line_num)
context.event.actions.append(name)
context.a... | def act_action(context):
args = context.line.split()
if (len(args) != 1):
raise ExtraToken('ACTION', line=context.line_num)
name = args[0].strip()
if (name in context.event.actions):
raise DuplicateName('ACTION', context.line_num)
context.event.actions.append(name)
context.a... |
b101f78828a04981401e5b21b45026ed020e203b81e3ea2eb23255e6f4adf764 | def act_context(context):
'Action routine for CONTEXT directive.'
if (len(context.line.split()) != 1):
raise ExtraToken('CONTEXT', line=context.line_num)
if context.context:
raise DuplicateName('CONTEXT', context.line_num)
context.context = import_by_path(context.line) | Action routine for CONTEXT directive. | fsm/actions.py | act_context | robertchase/fsm | 0 | python | def act_context(context):
if (len(context.line.split()) != 1):
raise ExtraToken('CONTEXT', line=context.line_num)
if context.context:
raise DuplicateName('CONTEXT', context.line_num)
context.context = import_by_path(context.line) | def act_context(context):
if (len(context.line.split()) != 1):
raise ExtraToken('CONTEXT', line=context.line_num)
if context.context:
raise DuplicateName('CONTEXT', context.line_num)
context.context = import_by_path(context.line)<|docstring|>Action routine for CONTEXT directive.<|endoft... |
69e4ffa074bc98baf0ae1399dedaae6d8c1e8c435acda58e24211cfc9f8b1bbe | def act_handler(context):
'Action routine for HANDLER directive.'
args = context.line.split()
if (len(args) == 1):
raise TooFewTokens('HANDLER', line=context.line_num)
if (len(args) > 2):
raise ExtraToken('HANDLER', line=context.line_num)
(name, path) = args
name = name.strip()
... | Action routine for HANDLER directive. | fsm/actions.py | act_handler | robertchase/fsm | 0 | python | def act_handler(context):
args = context.line.split()
if (len(args) == 1):
raise TooFewTokens('HANDLER', line=context.line_num)
if (len(args) > 2):
raise ExtraToken('HANDLER', line=context.line_num)
(name, path) = args
name = name.strip()
if (name in context.handlers):
... | def act_handler(context):
args = context.line.split()
if (len(args) == 1):
raise TooFewTokens('HANDLER', line=context.line_num)
if (len(args) > 2):
raise ExtraToken('HANDLER', line=context.line_num)
(name, path) = args
name = name.strip()
if (name in context.handlers):
... |
f71d2087557558218ff0c13410dc9a2af74c471f0d9f54a38e68cfc7d4c6c0a5 | def act_default(context):
'Action routine for DEFAULT directive.'
args = context.line.split()
if (len(args) == 2):
(name, next_state) = args
elif (len(args) != 1):
raise ExtraToken('EVENT', 'one or two', context.line_num)
else:
name = args[0].strip()
next_state = None... | Action routine for DEFAULT directive. | fsm/actions.py | act_default | robertchase/fsm | 0 | python | def act_default(context):
args = context.line.split()
if (len(args) == 2):
(name, next_state) = args
elif (len(args) != 1):
raise ExtraToken('EVENT', 'one or two', context.line_num)
else:
name = args[0].strip()
next_state = None
if (DEFAULT not in context.states)... | def act_default(context):
args = context.line.split()
if (len(args) == 2):
(name, next_state) = args
elif (len(args) != 1):
raise ExtraToken('EVENT', 'one or two', context.line_num)
else:
name = args[0].strip()
next_state = None
if (DEFAULT not in context.states)... |
6395de855ef444f0d18aa0893bddb1666be0529cf648bde4ac89786059eb2489 | def add_action(self, action):
'Add an action'
if (action not in self.actions):
self.actions.append(action)
self.actions = sorted(self.actions) | Add an action | fsm/actions.py | add_action | robertchase/fsm | 0 | python | def add_action(self, action):
if (action not in self.actions):
self.actions.append(action)
self.actions = sorted(self.actions) | def add_action(self, action):
if (action not in self.actions):
self.actions.append(action)
self.actions = sorted(self.actions)<|docstring|>Add an action<|endoftext|> |
2fdaaca5347ec6ee331ff87000d37daebc6895b95349b59f85a79881526856bc | @property
def events(self):
'Return a list of event names.'
events = []
for state in self.states.values():
for event in state.events.values():
events.append(event.name)
return list(set(events)) | Return a list of event names. | fsm/actions.py | events | robertchase/fsm | 0 | python | @property
def events(self):
events = []
for state in self.states.values():
for event in state.events.values():
events.append(event.name)
return list(set(events)) | @property
def events(self):
events = []
for state in self.states.values():
for event in state.events.values():
events.append(event.name)
return list(set(events))<|docstring|>Return a list of event names.<|endoftext|> |
bae6744df2b8ad230f4f765a32f9e83436d14284340170d084028f0c346e25c9 | def fft(ts):
'\n Perform a fast-fourier transform on a Trace\n '
t_step = (ts.index[1] - ts.index[0])
oc = (np.abs(np.fft.fftshift(np.fft.fft(ts.values))) / len(ts.values))
t = np.fft.fftshift(np.fft.fftfreq(len(oc), d=t_step))
return Trace(oc, t) | Perform a fast-fourier transform on a Trace | aston/trace/math_traces.py | fft | bovee/Aston | 13 | python | def fft(ts):
'\n \n '
t_step = (ts.index[1] - ts.index[0])
oc = (np.abs(np.fft.fftshift(np.fft.fft(ts.values))) / len(ts.values))
t = np.fft.fftshift(np.fft.fftfreq(len(oc), d=t_step))
return Trace(oc, t) | def fft(ts):
'\n \n '
t_step = (ts.index[1] - ts.index[0])
oc = (np.abs(np.fft.fftshift(np.fft.fft(ts.values))) / len(ts.values))
t = np.fft.fftshift(np.fft.fftfreq(len(oc), d=t_step))
return Trace(oc, t)<|docstring|>Perform a fast-fourier transform on a Trace<|endoftext|> |
2c29954cbac9c08429e8b281ba9e6a99348db46d9fab3e464d486846be0c0af1 | def movingaverage(arr, window):
'\n Calculates the moving average ("rolling mean") of an array\n of a certain window size.\n '
m = (np.ones(int(window)) / int(window))
return scipy.ndimage.convolve1d(arr, m, axis=0, mode='reflect') | Calculates the moving average ("rolling mean") of an array
of a certain window size. | aston/trace/math_traces.py | movingaverage | bovee/Aston | 13 | python | def movingaverage(arr, window):
'\n Calculates the moving average ("rolling mean") of an array\n of a certain window size.\n '
m = (np.ones(int(window)) / int(window))
return scipy.ndimage.convolve1d(arr, m, axis=0, mode='reflect') | def movingaverage(arr, window):
'\n Calculates the moving average ("rolling mean") of an array\n of a certain window size.\n '
m = (np.ones(int(window)) / int(window))
return scipy.ndimage.convolve1d(arr, m, axis=0, mode='reflect')<|docstring|>Calculates the moving average ("rolling mean") of an ar... |
b8c6b342f11e96788d44995ea4a00fce867a7adc74c131784dc2ac72c7e6228f | def loads(ast_str):
'\n Create a Trace from a suitably compressed string.\n '
data = zlib.decompress(ast_str)
li = struct.unpack('<L', data[0:4])[0]
lt = struct.unpack('<L', data[4:8])[0]
n = data[8:(8 + li)].decode('utf-8')
t = np.fromstring(data[(8 + li):((8 + li) + lt)])
d = np.from... | Create a Trace from a suitably compressed string. | aston/trace/math_traces.py | loads | bovee/Aston | 13 | python | def loads(ast_str):
'\n \n '
data = zlib.decompress(ast_str)
li = struct.unpack('<L', data[0:4])[0]
lt = struct.unpack('<L', data[4:8])[0]
n = data[8:(8 + li)].decode('utf-8')
t = np.fromstring(data[(8 + li):((8 + li) + lt)])
d = np.fromstring(data[((8 + li) + lt):])
return Trace(d... | def loads(ast_str):
'\n \n '
data = zlib.decompress(ast_str)
li = struct.unpack('<L', data[0:4])[0]
lt = struct.unpack('<L', data[4:8])[0]
n = data[8:(8 + li)].decode('utf-8')
t = np.fromstring(data[(8 + li):((8 + li) + lt)])
d = np.fromstring(data[((8 + li) + lt):])
return Trace(d... |
e023ab865bace3635fab54bca49a33dddf91d588092c26beee2ad86680d529d4 | def dumps(asts):
'\n Create a compressed string from an Trace.\n '
d = asts.values.tostring()
t = asts.index.values.astype(float).tostring()
lt = struct.pack('<L', len(t))
i = asts.name.encode('utf-8')
li = struct.pack('<L', len(i))
try:
return buffer(zlib.compress(((((li + lt)... | Create a compressed string from an Trace. | aston/trace/math_traces.py | dumps | bovee/Aston | 13 | python | def dumps(asts):
'\n \n '
d = asts.values.tostring()
t = asts.index.values.astype(float).tostring()
lt = struct.pack('<L', len(t))
i = asts.name.encode('utf-8')
li = struct.pack('<L', len(i))
try:
return buffer(zlib.compress(((((li + lt) + i) + t) + d)))
except NameError:
... | def dumps(asts):
'\n \n '
d = asts.values.tostring()
t = asts.index.values.astype(float).tostring()
lt = struct.pack('<L', len(t))
i = asts.name.encode('utf-8')
li = struct.pack('<L', len(i))
try:
return buffer(zlib.compress(((((li + lt) + i) + t) + d)))
except NameError:
... |
1360d2d6a6fc3ff81e773ad72cfb75ce483063a48fdb2743238e8a1185a1550d | def ts_func(f):
'\n This wraps a function that would normally only accept an array\n and allows it to operate on a DataFrame. Useful for applying\n numpy functions to DataFrames.\n '
def wrap_func(df, *args):
return Chromatogram(f(df.values, *args), df.index, df.columns)
return wrap_fun... | This wraps a function that would normally only accept an array
and allows it to operate on a DataFrame. Useful for applying
numpy functions to DataFrames. | aston/trace/math_traces.py | ts_func | bovee/Aston | 13 | python | def ts_func(f):
'\n This wraps a function that would normally only accept an array\n and allows it to operate on a DataFrame. Useful for applying\n numpy functions to DataFrames.\n '
def wrap_func(df, *args):
return Chromatogram(f(df.values, *args), df.index, df.columns)
return wrap_fun... | def ts_func(f):
'\n This wraps a function that would normally only accept an array\n and allows it to operate on a DataFrame. Useful for applying\n numpy functions to DataFrames.\n '
def wrap_func(df, *args):
return Chromatogram(f(df.values, *args), df.index, df.columns)
return wrap_fun... |
a780cb7c38b2e6f22e72d8c2181bdecaa1e088eda4ab1bb700ce5fc502c173ef | def load_features(self, key):
'\n Feature Engineering:apistats to vector by standard.txt\n '
strings = ' '.join(self.binaries.features[key])
try:
self.tfidf_features = self.vectorizer.fit_transform(strings)
except:
raise CuckooDetectionError('The Detection module strings_ng... | Feature Engineering:apistats to vector by standard.txt | modules/detection/apistats.py | load_features | Yuanmessi/Bold-Falcon | 24 | python | def load_features(self, key):
'\n \n '
strings = ' '.join(self.binaries.features[key])
try:
self.tfidf_features = self.vectorizer.fit_transform(strings)
except:
raise CuckooDetectionError('The Detection module strings_ngarm has missing load_features!') | def load_features(self, key):
'\n \n '
strings = ' '.join(self.binaries.features[key])
try:
self.tfidf_features = self.vectorizer.fit_transform(strings)
except:
raise CuckooDetectionError('The Detection module strings_ngarm has missing load_features!')<|docstring|>Feature E... |
9267298fceff9f17d613a18f97d8111ef2f44da2e135d59da69aea182c69c005 | def load_model(self):
'\n load XGBoots Pre training model\n '
try:
vectorizer_pth = os.path.join(CUCKOO_ROOT, 'data', 'models', 'strings_ngram', 'tfidf_model')
self.vectorizer = pickle.load(open(vectorizer_pth, 'rb'))
model_pth = os.path.join(CUCKOO_ROOT, 'data', 'models', ... | load XGBoots Pre training model | modules/detection/apistats.py | load_model | Yuanmessi/Bold-Falcon | 24 | python | def load_model(self):
'\n \n '
try:
vectorizer_pth = os.path.join(CUCKOO_ROOT, 'data', 'models', 'strings_ngram', 'tfidf_model')
self.vectorizer = pickle.load(open(vectorizer_pth, 'rb'))
model_pth = os.path.join(CUCKOO_ROOT, 'data', 'models', 'strings_ngram', 'XGB_model.pkl... | def load_model(self):
'\n \n '
try:
vectorizer_pth = os.path.join(CUCKOO_ROOT, 'data', 'models', 'strings_ngram', 'tfidf_model')
self.vectorizer = pickle.load(open(vectorizer_pth, 'rb'))
model_pth = os.path.join(CUCKOO_ROOT, 'data', 'models', 'strings_ngram', 'XGB_model.pkl... |
d04f96df352ebdb0eb9dd2a7fd0e999246b221cc16e351cf777f881feb8f4c14 | def run(self):
'\n Run model with apistats\n\n :return: predict.\n '
self.key = 'apistats'
self.features_type = 'behavior'
result = None
'\n if self.task["category"] == "file":\n features not in json \n if not os.path.exists(self.file_path):\n ... | Run model with apistats
:return: predict. | modules/detection/apistats.py | run | Yuanmessi/Bold-Falcon | 24 | python | def run(self):
'\n Run model with apistats\n\n :return: predict.\n '
self.key = 'apistats'
self.features_type = 'behavior'
result = None
'\n if self.task["category"] == "file":\n features not in json \n if not os.path.exists(self.file_path):\n ... | def run(self):
'\n Run model with apistats\n\n :return: predict.\n '
self.key = 'apistats'
self.features_type = 'behavior'
result = None
'\n if self.task["category"] == "file":\n features not in json \n if not os.path.exists(self.file_path):\n ... |
faab85105a7b2bd43efb2af66fd6c19a84c9a53187d3959b1469477cb6562432 | def test_rs3_dis_pcc_reconvert(rs3_dir=PCC_RST_DIR):
'rs3->tree->dis->tree->rs3->tree'
temp_dir = mkdtemp()
for rs3_file in glob.glob(os.path.join(rs3_dir, '*.rs3')):
rs3_fname = os.path.basename(rs3_file)
rst_tree1 = rstc.read_rs3tree(rs3_file)
dis_fname = os.path.join(temp_dir, (rs... | rs3->tree->dis->tree->rs3->tree | tests/test_rst_conversion.py | test_rs3_dis_pcc_reconvert | arne-cl/rst-converter-service | 3 | python | def test_rs3_dis_pcc_reconvert(rs3_dir=PCC_RST_DIR):
temp_dir = mkdtemp()
for rs3_file in glob.glob(os.path.join(rs3_dir, '*.rs3')):
rs3_fname = os.path.basename(rs3_file)
rst_tree1 = rstc.read_rs3tree(rs3_file)
dis_fname = os.path.join(temp_dir, (rs3_fname + '.dis'))
rstc.w... | def test_rs3_dis_pcc_reconvert(rs3_dir=PCC_RST_DIR):
temp_dir = mkdtemp()
for rs3_file in glob.glob(os.path.join(rs3_dir, '*.rs3')):
rs3_fname = os.path.basename(rs3_file)
rst_tree1 = rstc.read_rs3tree(rs3_file)
dis_fname = os.path.join(temp_dir, (rs3_fname + '.dis'))
rstc.w... |
b28d7d3770588b64f904b30803aee489e8ccd47e4a104a28c3519015da893ee7 | @action(methods=['post'], detail=False)
def calculate(self, request):
'\n Calculate time series forecast\n '
self.check_permissions(request)
data = request.data.get('data', [])
model = request.data.get('model', MODEL_ADDITIVE)
date_start = request.data.get('date_start', '2018-01-01')
... | Calculate time series forecast | backend/forecast/views.py | calculate | dmryutov/otus-python-0319-final | 0 | python | @action(methods=['post'], detail=False)
def calculate(self, request):
'\n \n '
self.check_permissions(request)
data = request.data.get('data', [])
model = request.data.get('model', MODEL_ADDITIVE)
date_start = request.data.get('date_start', '2018-01-01')
period_type = request.data.... | @action(methods=['post'], detail=False)
def calculate(self, request):
'\n \n '
self.check_permissions(request)
data = request.data.get('data', [])
model = request.data.get('model', MODEL_ADDITIVE)
date_start = request.data.get('date_start', '2018-01-01')
period_type = request.data.... |
f824852a6a2c2095feb5b74ab07e0da3a8d17df9988b1663d38e7390399e691b | def __init__(self, data_sources: List[ReqBodyDataSources]=None, movements_enaction: MovementsEnaction=None):
'ReqBody - a model defined in Swagger\n\n :param data_sources: The data_sources of this ReqBody. # noqa: E501\n :type data_sources: List[ReqBodyDataSources]\n :param movements_enaction:... | ReqBody - a model defined in Swagger
:param data_sources: The data_sources of this ReqBody. # noqa: E501
:type data_sources: List[ReqBodyDataSources]
:param movements_enaction: The movements_enaction of this ReqBody. # noqa: E501
:type movements_enaction: MovementsEnaction | swagger_server/models/req_body.py | __init__ | DITAS-Project/DataMovementEnactor | 0 | python | def __init__(self, data_sources: List[ReqBodyDataSources]=None, movements_enaction: MovementsEnaction=None):
'ReqBody - a model defined in Swagger\n\n :param data_sources: The data_sources of this ReqBody. # noqa: E501\n :type data_sources: List[ReqBodyDataSources]\n :param movements_enaction:... | def __init__(self, data_sources: List[ReqBodyDataSources]=None, movements_enaction: MovementsEnaction=None):
'ReqBody - a model defined in Swagger\n\n :param data_sources: The data_sources of this ReqBody. # noqa: E501\n :type data_sources: List[ReqBodyDataSources]\n :param movements_enaction:... |
cced7cdd0859082b2ef171020bfe1720fc32de82608d5d9e8718a427a6b1ed30 | @classmethod
def from_dict(cls, dikt) -> 'ReqBody':
'Returns the dict as a model\n\n :param dikt: A dict.\n :type: dict\n :return: The ReqBody of this ReqBody. # noqa: E501\n :rtype: ReqBody\n '
return util.deserialize_model(dikt, cls) | Returns the dict as a model
:param dikt: A dict.
:type: dict
:return: The ReqBody of this ReqBody. # noqa: E501
:rtype: ReqBody | swagger_server/models/req_body.py | from_dict | DITAS-Project/DataMovementEnactor | 0 | python | @classmethod
def from_dict(cls, dikt) -> 'ReqBody':
'Returns the dict as a model\n\n :param dikt: A dict.\n :type: dict\n :return: The ReqBody of this ReqBody. # noqa: E501\n :rtype: ReqBody\n '
return util.deserialize_model(dikt, cls) | @classmethod
def from_dict(cls, dikt) -> 'ReqBody':
'Returns the dict as a model\n\n :param dikt: A dict.\n :type: dict\n :return: The ReqBody of this ReqBody. # noqa: E501\n :rtype: ReqBody\n '
return util.deserialize_model(dikt, cls)<|docstring|>Returns the dict as a model
... |
1fbe8a3c0978989d891649f19a7ba3ad6bb16aca3b6730716f03cdc767c6208e | @property
def data_sources(self) -> List[ReqBodyDataSources]:
'Gets the data_sources of this ReqBody.\n\n\n :return: The data_sources of this ReqBody.\n :rtype: List[ReqBodyDataSources]\n '
return self._data_sources | Gets the data_sources of this ReqBody.
:return: The data_sources of this ReqBody.
:rtype: List[ReqBodyDataSources] | swagger_server/models/req_body.py | data_sources | DITAS-Project/DataMovementEnactor | 0 | python | @property
def data_sources(self) -> List[ReqBodyDataSources]:
'Gets the data_sources of this ReqBody.\n\n\n :return: The data_sources of this ReqBody.\n :rtype: List[ReqBodyDataSources]\n '
return self._data_sources | @property
def data_sources(self) -> List[ReqBodyDataSources]:
'Gets the data_sources of this ReqBody.\n\n\n :return: The data_sources of this ReqBody.\n :rtype: List[ReqBodyDataSources]\n '
return self._data_sources<|docstring|>Gets the data_sources of this ReqBody.
:return: The data_sour... |
b8da7df2f204ec684e7a0fed595a91244a2ec9854dc614ecf5538ed7c802990a | @data_sources.setter
def data_sources(self, data_sources: List[ReqBodyDataSources]):
'Sets the data_sources of this ReqBody.\n\n\n :param data_sources: The data_sources of this ReqBody.\n :type data_sources: List[ReqBodyDataSources]\n '
self._data_sources = data_sources | Sets the data_sources of this ReqBody.
:param data_sources: The data_sources of this ReqBody.
:type data_sources: List[ReqBodyDataSources] | swagger_server/models/req_body.py | data_sources | DITAS-Project/DataMovementEnactor | 0 | python | @data_sources.setter
def data_sources(self, data_sources: List[ReqBodyDataSources]):
'Sets the data_sources of this ReqBody.\n\n\n :param data_sources: The data_sources of this ReqBody.\n :type data_sources: List[ReqBodyDataSources]\n '
self._data_sources = data_sources | @data_sources.setter
def data_sources(self, data_sources: List[ReqBodyDataSources]):
'Sets the data_sources of this ReqBody.\n\n\n :param data_sources: The data_sources of this ReqBody.\n :type data_sources: List[ReqBodyDataSources]\n '
self._data_sources = data_sources<|docstring|>Sets the... |
ae2c654766e66883cce36ef6883adb6a7b35bc330713902e178d2753f61cf142 | @property
def movements_enaction(self) -> MovementsEnaction:
'Gets the movements_enaction of this ReqBody.\n\n\n :return: The movements_enaction of this ReqBody.\n :rtype: MovementsEnaction\n '
return self._movements_enaction | Gets the movements_enaction of this ReqBody.
:return: The movements_enaction of this ReqBody.
:rtype: MovementsEnaction | swagger_server/models/req_body.py | movements_enaction | DITAS-Project/DataMovementEnactor | 0 | python | @property
def movements_enaction(self) -> MovementsEnaction:
'Gets the movements_enaction of this ReqBody.\n\n\n :return: The movements_enaction of this ReqBody.\n :rtype: MovementsEnaction\n '
return self._movements_enaction | @property
def movements_enaction(self) -> MovementsEnaction:
'Gets the movements_enaction of this ReqBody.\n\n\n :return: The movements_enaction of this ReqBody.\n :rtype: MovementsEnaction\n '
return self._movements_enaction<|docstring|>Gets the movements_enaction of this ReqBody.
:retur... |
f08e0662f335d28412a6cf8baf43600e9cb4e9374d4f6238eca413d54623e844 | @movements_enaction.setter
def movements_enaction(self, movements_enaction: MovementsEnaction):
'Sets the movements_enaction of this ReqBody.\n\n\n :param movements_enaction: The movements_enaction of this ReqBody.\n :type movements_enaction: MovementsEnaction\n '
self._movements_enaction =... | Sets the movements_enaction of this ReqBody.
:param movements_enaction: The movements_enaction of this ReqBody.
:type movements_enaction: MovementsEnaction | swagger_server/models/req_body.py | movements_enaction | DITAS-Project/DataMovementEnactor | 0 | python | @movements_enaction.setter
def movements_enaction(self, movements_enaction: MovementsEnaction):
'Sets the movements_enaction of this ReqBody.\n\n\n :param movements_enaction: The movements_enaction of this ReqBody.\n :type movements_enaction: MovementsEnaction\n '
self._movements_enaction =... | @movements_enaction.setter
def movements_enaction(self, movements_enaction: MovementsEnaction):
'Sets the movements_enaction of this ReqBody.\n\n\n :param movements_enaction: The movements_enaction of this ReqBody.\n :type movements_enaction: MovementsEnaction\n '
self._movements_enaction =... |
d522b8dc2d27b0551ae47ee8019adc75dc16a6ce2f23dc1516ca63bdd9790e71 | def TicTocGenerator():
'Generator that returns time difference.\n '
init_time = 0
final_time = time.time()
while True:
init_time = final_time
final_time = time.time()
(yield (final_time - init_time)) | Generator that returns time difference. | src/utils/tictoc.py | TicTocGenerator | HighTemplar-wjiang/tensorflow-template | 0 | python | def TicTocGenerator():
'\n '
init_time = 0
final_time = time.time()
while True:
init_time = final_time
final_time = time.time()
(yield (final_time - init_time)) | def TicTocGenerator():
'\n '
init_time = 0
final_time = time.time()
while True:
init_time = final_time
final_time = time.time()
(yield (final_time - init_time))<|docstring|>Generator that returns time difference.<|endoftext|> |
fa63087f9d5bd9949add0bd3255c933481d573a39aa439e3f6c6d3e1d3a2dd4a | def tic():
'Start recording time.'
next(tictoc) | Start recording time. | src/utils/tictoc.py | tic | HighTemplar-wjiang/tensorflow-template | 0 | python | def tic():
next(tictoc) | def tic():
next(tictoc)<|docstring|>Start recording time.<|endoftext|> |
195ce42aaf92c9aac941ed050d03989a0d0079912d5cf6636812a28053f1667c | def toc():
'Record and return time difference in seconds.\n\n Args:\n None.\n\n Returns:\n float: Time difference in seconds.\n '
return next(tictoc) | Record and return time difference in seconds.
Args:
None.
Returns:
float: Time difference in seconds. | src/utils/tictoc.py | toc | HighTemplar-wjiang/tensorflow-template | 0 | python | def toc():
'Record and return time difference in seconds.\n\n Args:\n None.\n\n Returns:\n float: Time difference in seconds.\n '
return next(tictoc) | def toc():
'Record and return time difference in seconds.\n\n Args:\n None.\n\n Returns:\n float: Time difference in seconds.\n '
return next(tictoc)<|docstring|>Record and return time difference in seconds.
Args:
None.
Returns:
float: Time difference in seconds.<|endoftext|> |
95d68f75ca55293c24dd87a7b98f4a81cf29ed76e6cca4ed2c97922f970649fb | def seconds_to_readable(seconds: float):
'Convert seconds to human readable format. E.g., 61.0 --> 0 days 0 hours 1 minutes 1 seconds\n\n Args:\n seconds (float): Seconds to be converted.\n\n Returns:\n str: Human readable time format.\n '
(mins, secs) = divmod(seconds, 60)
(hours, mi... | Convert seconds to human readable format. E.g., 61.0 --> 0 days 0 hours 1 minutes 1 seconds
Args:
seconds (float): Seconds to be converted.
Returns:
str: Human readable time format. | src/utils/tictoc.py | seconds_to_readable | HighTemplar-wjiang/tensorflow-template | 0 | python | def seconds_to_readable(seconds: float):
'Convert seconds to human readable format. E.g., 61.0 --> 0 days 0 hours 1 minutes 1 seconds\n\n Args:\n seconds (float): Seconds to be converted.\n\n Returns:\n str: Human readable time format.\n '
(mins, secs) = divmod(seconds, 60)
(hours, mi... | def seconds_to_readable(seconds: float):
'Convert seconds to human readable format. E.g., 61.0 --> 0 days 0 hours 1 minutes 1 seconds\n\n Args:\n seconds (float): Seconds to be converted.\n\n Returns:\n str: Human readable time format.\n '
(mins, secs) = divmod(seconds, 60)
(hours, mi... |
e4825e024a8a3a3775218dc9948ab4d737f711f7290166c0e5ef9b41b2406c69 | def __init__(self, name=None, *, format_method=None):
'Initialize instance.\n\n Args:\n name (:obj:`str`): Name of this context. Defaults to None.\n format_method (:obj:`function`): format_method for outputting. Defaults to None.\n '
self.name = name
self.format_method = ... | Initialize instance.
Args:
name (:obj:`str`): Name of this context. Defaults to None.
format_method (:obj:`function`): format_method for outputting. Defaults to None. | src/utils/tictoc.py | __init__ | HighTemplar-wjiang/tensorflow-template | 0 | python | def __init__(self, name=None, *, format_method=None):
'Initialize instance.\n\n Args:\n name (:obj:`str`): Name of this context. Defaults to None.\n format_method (:obj:`function`): format_method for outputting. Defaults to None.\n '
self.name = name
self.format_method = ... | def __init__(self, name=None, *, format_method=None):
'Initialize instance.\n\n Args:\n name (:obj:`str`): Name of this context. Defaults to None.\n format_method (:obj:`function`): format_method for outputting. Defaults to None.\n '
self.name = name
self.format_method = ... |
cedd8e60f3357af59eee8340e54562553720c3771b821347d000c2c4a24644a0 | def status_change(self, alert, status, text):
'\n If a silence exists for an open or closed alert we probably want to remove it\n '
if (status in ('open', 'closed')):
silenceId = alert.attributes.get('silenceId', None)
if silenceId:
LOG.debug('Alertmanager: Remove silen... | If a silence exists for an open or closed alert we probably want to remove it | plugins/prometheus/alerta_prometheus.py | status_change | dakotacody/alerta-contrib | 114 | python | def status_change(self, alert, status, text):
'\n \n '
if (status in ('open', 'closed')):
silenceId = alert.attributes.get('silenceId', None)
if silenceId:
LOG.debug('Alertmanager: Remove silence for alertname=%s instance=%s', alert.event, alert.resource)
ba... | def status_change(self, alert, status, text):
'\n \n '
if (status in ('open', 'closed')):
silenceId = alert.attributes.get('silenceId', None)
if silenceId:
LOG.debug('Alertmanager: Remove silence for alertname=%s instance=%s', alert.event, alert.resource)
ba... |
a47f4f44a3ecda3a3ce61966d4cb1b3fb2ac91a513323a67a55e90942ebdece7 | def take_action(self, alert: Alert, action: str, text: str, **kwargs) -> Any:
'\n Set silence in alertmanager.\n '
if (alert.event_type != 'prometheusAlert'):
return alert
base_url = (ALERTMANAGER_API_URL or alert.attributes.get('externalUrl', DEFAULT_ALERTMANAGER_API_URL))
if (act... | Set silence in alertmanager. | plugins/prometheus/alerta_prometheus.py | take_action | dakotacody/alerta-contrib | 114 | python | def take_action(self, alert: Alert, action: str, text: str, **kwargs) -> Any:
'\n \n '
if (alert.event_type != 'prometheusAlert'):
return alert
base_url = (ALERTMANAGER_API_URL or alert.attributes.get('externalUrl', DEFAULT_ALERTMANAGER_API_URL))
if (action == 'close'):
LOG... | def take_action(self, alert: Alert, action: str, text: str, **kwargs) -> Any:
'\n \n '
if (alert.event_type != 'prometheusAlert'):
return alert
base_url = (ALERTMANAGER_API_URL or alert.attributes.get('externalUrl', DEFAULT_ALERTMANAGER_API_URL))
if (action == 'close'):
LOG... |
1b95c69d0b0f7b779ca3bdfe0bf941c8a896d8af9c9b892bc035419204e90c64 | def initialize(token: str=None, token_file: str=None) -> SlackClient:
'Returns SlackClient for given API-Token'
if token:
apitoken = token
elif token_file:
with open(token_file) as f:
apitoken = f.read().strip()
else:
raise ValueError('Specify api-token as argument, o... | Returns SlackClient for given API-Token | slackmover/slackmover.py | initialize | tuxedocat/slack_mover | 0 | python | def initialize(token: str=None, token_file: str=None) -> SlackClient:
if token:
apitoken = token
elif token_file:
with open(token_file) as f:
apitoken = f.read().strip()
else:
raise ValueError('Specify api-token as argument, or path to text file contains api-token')
... | def initialize(token: str=None, token_file: str=None) -> SlackClient:
if token:
apitoken = token
elif token_file:
with open(token_file) as f:
apitoken = f.read().strip()
else:
raise ValueError('Specify api-token as argument, or path to text file contains api-token')
... |
b128c0be7722a953ecc1de76330d165e858b82335dcbdb7ade07983571f9b39b | def _get_channel_id(dic: Dict=None, name: str=None) -> Optional[str]:
'Get id corresponding to channel from given dict\n '
channels = dic.get('channels', dic.get('groups'))
for channel in channels:
if (channel.get('name') == name):
return channel.get('id')
else:
pa... | Get id corresponding to channel from given dict | slackmover/slackmover.py | _get_channel_id | tuxedocat/slack_mover | 0 | python | def _get_channel_id(dic: Dict=None, name: str=None) -> Optional[str]:
'\n '
channels = dic.get('channels', dic.get('groups'))
for channel in channels:
if (channel.get('name') == name):
return channel.get('id')
else:
pass
return None | def _get_channel_id(dic: Dict=None, name: str=None) -> Optional[str]:
'\n '
channels = dic.get('channels', dic.get('groups'))
for channel in channels:
if (channel.get('name') == name):
return channel.get('id')
else:
pass
return None<|docstring|>Get id correspon... |
d4da0b2ece32ca70fb38ddabd8bbead8259123410ff214bcd88499f24648f8fe | def get_channel_id(client: SlackClient=None, name: str=None) -> Tuple[(str, str)]:
"Get channel-id of given chanel name\n\n Returns\n -------\n Tuple[str, str]\n ('channel-id', 'private' or 'public')\n\n "
publics = json.loads(client.api_call('channels.list').decode())
channel_id = _get_c... | Get channel-id of given chanel name
Returns
-------
Tuple[str, str]
('channel-id', 'private' or 'public') | slackmover/slackmover.py | get_channel_id | tuxedocat/slack_mover | 0 | python | def get_channel_id(client: SlackClient=None, name: str=None) -> Tuple[(str, str)]:
"Get channel-id of given chanel name\n\n Returns\n -------\n Tuple[str, str]\n ('channel-id', 'private' or 'public')\n\n "
publics = json.loads(client.api_call('channels.list').decode())
channel_id = _get_c... | def get_channel_id(client: SlackClient=None, name: str=None) -> Tuple[(str, str)]:
"Get channel-id of given chanel name\n\n Returns\n -------\n Tuple[str, str]\n ('channel-id', 'private' or 'public')\n\n "
publics = json.loads(client.api_call('channels.list').decode())
channel_id = _get_c... |
72bb119cdacd44353700bea407fedeb94db71e07d9d820cc7f74392bb377f2d2 | def get_all_messages_from_channel(client: SlackClient=None, channel: str=None, channel_type: str=None, **kwargs) -> List[Dict]:
'Get messages from given channel, returns as list of messages (dict)\n '
if (channel_type == 'public'):
_api_call = 'channels.history'
elif (channel_type == 'private'):
... | Get messages from given channel, returns as list of messages (dict) | slackmover/slackmover.py | get_all_messages_from_channel | tuxedocat/slack_mover | 0 | python | def get_all_messages_from_channel(client: SlackClient=None, channel: str=None, channel_type: str=None, **kwargs) -> List[Dict]:
'\n '
if (channel_type == 'public'):
_api_call = 'channels.history'
elif (channel_type == 'private'):
_api_call = 'groups.history'
else:
raise ValueE... | def get_all_messages_from_channel(client: SlackClient=None, channel: str=None, channel_type: str=None, **kwargs) -> List[Dict]:
'\n '
if (channel_type == 'public'):
_api_call = 'channels.history'
elif (channel_type == 'private'):
_api_call = 'groups.history'
else:
raise ValueE... |
81caee9da772faa05061c1933a4cd5c7f7a109c89bde3865244a2a278c949baa | def save_messages(messages: List[Dict]=None, file: str=None) -> None:
'Save list of message (dict) as a json file\n\n Raises\n ------\n OSError, IOError\n '
with open((file + '.json'), 'w') as f:
json.dump(messages, f) | Save list of message (dict) as a json file
Raises
------
OSError, IOError | slackmover/slackmover.py | save_messages | tuxedocat/slack_mover | 0 | python | def save_messages(messages: List[Dict]=None, file: str=None) -> None:
'Save list of message (dict) as a json file\n\n Raises\n ------\n OSError, IOError\n '
with open((file + '.json'), 'w') as f:
json.dump(messages, f) | def save_messages(messages: List[Dict]=None, file: str=None) -> None:
'Save list of message (dict) as a json file\n\n Raises\n ------\n OSError, IOError\n '
with open((file + '.json'), 'w') as f:
json.dump(messages, f)<|docstring|>Save list of message (dict) as a json file
Raises
------
OSE... |
f2a8867258e8cd8113930453aef4a9855c4a5882fcb9644a8cff2ac11434b803 | def test_annotate_taxa(self):
'Ensure we can update a defunct taxa name.'
query = 'Escherichia coli'
url = (reverse('treeoflife-annotate-taxa') + f'?query={query}')
response = self.client.get(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertIn('Escherichi... | Ensure we can update a defunct taxa name. | pangea/contrib/treeoflife/tests/test_treeoflife.py | test_annotate_taxa | LongTailBio/pangea-django | 0 | python | def test_annotate_taxa(self):
query = 'Escherichia coli'
url = (reverse('treeoflife-annotate-taxa') + f'?query={query}')
response = self.client.get(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertIn('Escherichia coli', response.data)
self.assertEqua... | def test_annotate_taxa(self):
query = 'Escherichia coli'
url = (reverse('treeoflife-annotate-taxa') + f'?query={query}')
response = self.client.get(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertIn('Escherichia coli', response.data)
self.assertEqua... |
e9e1b5daaa45a922ba0cba717fb48dff7b7ceb8d13a2623143ccf7b0c348b07e | def test_get_annotated_descendants(self):
'Ensure we can get descendants.'
query = 'Escherichia'
url = (reverse('treeoflife-get-descendants') + f'?query={query}&annotate=true')
response = self.client.get(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEq... | Ensure we can get descendants. | pangea/contrib/treeoflife/tests/test_treeoflife.py | test_get_annotated_descendants | LongTailBio/pangea-django | 0 | python | def test_get_annotated_descendants(self):
query = 'Escherichia'
url = (reverse('treeoflife-get-descendants') + f'?query={query}&annotate=true')
response = self.client.get(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data['depth'], 1)
... | def test_get_annotated_descendants(self):
query = 'Escherichia'
url = (reverse('treeoflife-get-descendants') + f'?query={query}&annotate=true')
response = self.client.get(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data['depth'], 1)
... |
cdcfa23378640718f2ec39a55fb067d5a91afed56759f5fcb2dff7233158528b | def test_canonicalize_taxa_name(self):
'Ensure we can update a defunct taxa name.'
query = 'Bacillus coli'
url = (reverse('treeoflife-correct-taxa-names') + f'?query={query}')
response = self.client.get(url, format='json')
names = {el['name'] for el in response.data[query]['names']}
self.assertE... | Ensure we can update a defunct taxa name. | pangea/contrib/treeoflife/tests/test_treeoflife.py | test_canonicalize_taxa_name | LongTailBio/pangea-django | 0 | python | def test_canonicalize_taxa_name(self):
query = 'Bacillus coli'
url = (reverse('treeoflife-correct-taxa-names') + f'?query={query}')
response = self.client.get(url, format='json')
names = {el['name'] for el in response.data[query]['names']}
self.assertEqual(response.status_code, status.HTTP_200_... | def test_canonicalize_taxa_name(self):
query = 'Bacillus coli'
url = (reverse('treeoflife-correct-taxa-names') + f'?query={query}')
response = self.client.get(url, format='json')
names = {el['name'] for el in response.data[query]['names']}
self.assertEqual(response.status_code, status.HTTP_200_... |
7a0a34e8ff718252dc2c6a69c9e62df4128aa8ca9d9fb42024879fdd389f3977 | def test_canonicalize_taxa_name_case_insensitive(self):
'Ensure we can update a defunct taxa name.'
query = 'Bacillus coli'.lower()
url = (reverse('treeoflife-correct-taxa-names') + f'?query={query}')
response = self.client.get(url, format='json')
names = {el['name'] for el in response.data[query]['... | Ensure we can update a defunct taxa name. | pangea/contrib/treeoflife/tests/test_treeoflife.py | test_canonicalize_taxa_name_case_insensitive | LongTailBio/pangea-django | 0 | python | def test_canonicalize_taxa_name_case_insensitive(self):
query = 'Bacillus coli'.lower()
url = (reverse('treeoflife-correct-taxa-names') + f'?query={query}')
response = self.client.get(url, format='json')
names = {el['name'] for el in response.data[query]['names']}
self.assertEqual(response.stat... | def test_canonicalize_taxa_name_case_insensitive(self):
query = 'Bacillus coli'.lower()
url = (reverse('treeoflife-correct-taxa-names') + f'?query={query}')
response = self.client.get(url, format='json')
names = {el['name'] for el in response.data[query]['names']}
self.assertEqual(response.stat... |
51d8a43b2873e6ff915512ceeead45e96f3bbe9e2dadb92dc1abffe99c210013 | def test_canonicalize_multiple_taxa_name(self):
'Ensure we can update a defunct taxa name.'
(q1, q2) = ('Bacillus coli', 'Chondromyces aurantiacus')
url = (reverse('treeoflife-correct-taxa-names') + f'?query={q1},{q2}')
response = self.client.get(url, format='json')
names1 = {el['name'] for el in re... | Ensure we can update a defunct taxa name. | pangea/contrib/treeoflife/tests/test_treeoflife.py | test_canonicalize_multiple_taxa_name | LongTailBio/pangea-django | 0 | python | def test_canonicalize_multiple_taxa_name(self):
(q1, q2) = ('Bacillus coli', 'Chondromyces aurantiacus')
url = (reverse('treeoflife-correct-taxa-names') + f'?query={q1},{q2}')
response = self.client.get(url, format='json')
names1 = {el['name'] for el in response.data[q1]['names']}
names2 = {el[... | def test_canonicalize_multiple_taxa_name(self):
(q1, q2) = ('Bacillus coli', 'Chondromyces aurantiacus')
url = (reverse('treeoflife-correct-taxa-names') + f'?query={q1},{q2}')
response = self.client.get(url, format='json')
names1 = {el['name'] for el in response.data[q1]['names']}
names2 = {el[... |
b9559e608d7c6ad98289b3c64ca8ac34134ce955edd0772d9243e3d2bcab0980 | def test_search_taxa_name(self):
'Ensure we can update a defunct taxa name.'
query = 'Escherichia'
url = (reverse('treeoflife-correct-taxa-names') + f'?query={query}')
response = self.client.get(url, format='json')
names = {el['name'] for el in response.data[query]['names']}
self.assertEqual(res... | Ensure we can update a defunct taxa name. | pangea/contrib/treeoflife/tests/test_treeoflife.py | test_search_taxa_name | LongTailBio/pangea-django | 0 | python | def test_search_taxa_name(self):
query = 'Escherichia'
url = (reverse('treeoflife-correct-taxa-names') + f'?query={query}')
response = self.client.get(url, format='json')
names = {el['name'] for el in response.data[query]['names']}
self.assertEqual(response.status_code, status.HTTP_200_OK)
... | def test_search_taxa_name(self):
query = 'Escherichia'
url = (reverse('treeoflife-correct-taxa-names') + f'?query={query}')
response = self.client.get(url, format='json')
names = {el['name'] for el in response.data[query]['names']}
self.assertEqual(response.status_code, status.HTTP_200_OK)
... |
4a7e92c3fa2c0377734525d615a4840454fb1d30e653b93524663aa7c8ad3e42 | def test_search_non_canon_name(self):
'Ensure we can update a defunct taxa name.'
query = 'Escherichia'
url = (reverse('treeoflife-correct-taxa-names') + f'?query={query}&canon=false')
response = self.client.get(url, format='json')
names = {el['name'] for el in response.data[query]['names']}
sel... | Ensure we can update a defunct taxa name. | pangea/contrib/treeoflife/tests/test_treeoflife.py | test_search_non_canon_name | LongTailBio/pangea-django | 0 | python | def test_search_non_canon_name(self):
query = 'Escherichia'
url = (reverse('treeoflife-correct-taxa-names') + f'?query={query}&canon=false')
response = self.client.get(url, format='json')
names = {el['name'] for el in response.data[query]['names']}
self.assertEqual(response.status_code, status.... | def test_search_non_canon_name(self):
query = 'Escherichia'
url = (reverse('treeoflife-correct-taxa-names') + f'?query={query}&canon=false')
response = self.client.get(url, format='json')
names = {el['name'] for el in response.data[query]['names']}
self.assertEqual(response.status_code, status.... |
aa9b77dc4480dde794fc9f60a7e0afe381ca316a895bf0cda7c71910d73134b9 | def test_search_taxa_name_rank_specified(self):
'Ensure we can update a defunct taxa name.'
query = 'Escherichia'
url = (reverse('treeoflife-correct-taxa-names') + f'?query={query}&rank=species')
response = self.client.get(url, format='json')
names = {el['name'] for el in response.data[query]['names... | Ensure we can update a defunct taxa name. | pangea/contrib/treeoflife/tests/test_treeoflife.py | test_search_taxa_name_rank_specified | LongTailBio/pangea-django | 0 | python | def test_search_taxa_name_rank_specified(self):
query = 'Escherichia'
url = (reverse('treeoflife-correct-taxa-names') + f'?query={query}&rank=species')
response = self.client.get(url, format='json')
names = {el['name'] for el in response.data[query]['names']}
self.assertEqual(response.status_co... | def test_search_taxa_name_rank_specified(self):
query = 'Escherichia'
url = (reverse('treeoflife-correct-taxa-names') + f'?query={query}&rank=species')
response = self.client.get(url, format='json')
names = {el['name'] for el in response.data[query]['names']}
self.assertEqual(response.status_co... |
9249068978eebf5964607021aafab8beb85db4d4e1bfb8c084bd410312e80bd4 | def test_get_descendants(self):
'Ensure we can get descendants.'
query = 'Escherichia'
url = (reverse('treeoflife-get-descendants') + f'?query={query}')
response = self.client.get(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data['depth... | Ensure we can get descendants. | pangea/contrib/treeoflife/tests/test_treeoflife.py | test_get_descendants | LongTailBio/pangea-django | 0 | python | def test_get_descendants(self):
query = 'Escherichia'
url = (reverse('treeoflife-get-descendants') + f'?query={query}')
response = self.client.get(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data['depth'], 1)
self.assertTrue((len(... | def test_get_descendants(self):
query = 'Escherichia'
url = (reverse('treeoflife-get-descendants') + f'?query={query}')
response = self.client.get(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data['depth'], 1)
self.assertTrue((len(... |
e02504c35abd3c9c17a9d3484cd857203fa6b9c747960e30d67efbffc491e774 | def phase_and_plot(data, model, a, a_r, label):
'\n Calculate inner orbit radial velocities and residuals for a given dataset and star.\n\n Args:\n data: tuple containing (date, rv, err)\n model: model rvs evaluated at date (with no offset)\n a: primary matplotlib axes\n a_r: resid... | Calculate inner orbit radial velocities and residuals for a given dataset and star.
Args:
data: tuple containing (date, rv, err)
model: model rvs evaluated at date (with no offset)
a: primary matplotlib axes
a_r: residual matplotlib axes
label: instrument that acquired data
Returns:
None | analysis/close/rv_astro_disk_less/plot.py | phase_and_plot | iancze/TWA-3-orbit | 0 | python | def phase_and_plot(data, model, a, a_r, label):
'\n Calculate inner orbit radial velocities and residuals for a given dataset and star.\n\n Args:\n data: tuple containing (date, rv, err)\n model: model rvs evaluated at date (with no offset)\n a: primary matplotlib axes\n a_r: resid... | def phase_and_plot(data, model, a, a_r, label):
'\n Calculate inner orbit radial velocities and residuals for a given dataset and star.\n\n Args:\n data: tuple containing (date, rv, err)\n model: model rvs evaluated at date (with no offset)\n a: primary matplotlib axes\n a_r: resid... |
ab6a3bc61c6995cc8b61647a70ae1d07e796f2da1cc052bdbd0ca3077950d166 | def __init__(self, space, *args):
'NOT_RPYTHON: patches space.threadlocals to use real threadlocals'
from pypy.module.thread import gil
MixedModule.__init__(self, space, *args)
prev = space.threadlocals.getvalue()
space.threadlocals = gil.GILThreadLocals()
space.threadlocals.setvalue(prev) | NOT_RPYTHON: patches space.threadlocals to use real threadlocals | pypy/module/thread/__init__.py | __init__ | camillobruni/pygirl | 12 | python | def __init__(self, space, *args):
from pypy.module.thread import gil
MixedModule.__init__(self, space, *args)
prev = space.threadlocals.getvalue()
space.threadlocals = gil.GILThreadLocals()
space.threadlocals.setvalue(prev) | def __init__(self, space, *args):
from pypy.module.thread import gil
MixedModule.__init__(self, space, *args)
prev = space.threadlocals.getvalue()
space.threadlocals = gil.GILThreadLocals()
space.threadlocals.setvalue(prev)<|docstring|>NOT_RPYTHON: patches space.threadlocals to use real threadl... |
0a5e56189dc93b27873c88eb8545383339f5f201c975932b0bda3722abe967b8 | def __init__(self, target_size: Union[(Tuple[(int, int)], int)]=224, channel_axis: int=(- 1), *args, **kwargs):
'\n\n :param target_size: desired output size. If size is a sequence like (h, w), the output size will be matched to\n this. If size is an int, the output will have the same height and w... | :param target_size: desired output size. If size is a sequence like (h, w), the output size will be matched to
this. If size is an int, the output will have the same height and width as the `target_size`. | crafters/image/CenterImageCropper/__init__.py | __init__ | pgiank28/jina-hub | 1 | python | def __init__(self, target_size: Union[(Tuple[(int, int)], int)]=224, channel_axis: int=(- 1), *args, **kwargs):
'\n\n :param target_size: desired output size. If size is a sequence like (h, w), the output size will be matched to\n this. If size is an int, the output will have the same height and w... | def __init__(self, target_size: Union[(Tuple[(int, int)], int)]=224, channel_axis: int=(- 1), *args, **kwargs):
'\n\n :param target_size: desired output size. If size is a sequence like (h, w), the output size will be matched to\n this. If size is an int, the output will have the same height and w... |
0afaa213da349219ebd58c37a0704ec922ea1601b6c4435e418f32b714ab5255 | def craft(self, blob: 'np.ndarray', *args, **kwargs) -> Dict:
'\n Crop the input image array.\n\n :param blob: the ndarray of the image\n :return: a chunk dict with the cropped image\n '
raw_img = _load_image(blob, self.channel_axis)
(_img, top, left) = _crop_image(raw_img, self.... | Crop the input image array.
:param blob: the ndarray of the image
:return: a chunk dict with the cropped image | crafters/image/CenterImageCropper/__init__.py | craft | pgiank28/jina-hub | 1 | python | def craft(self, blob: 'np.ndarray', *args, **kwargs) -> Dict:
'\n Crop the input image array.\n\n :param blob: the ndarray of the image\n :return: a chunk dict with the cropped image\n '
raw_img = _load_image(blob, self.channel_axis)
(_img, top, left) = _crop_image(raw_img, self.... | def craft(self, blob: 'np.ndarray', *args, **kwargs) -> Dict:
'\n Crop the input image array.\n\n :param blob: the ndarray of the image\n :return: a chunk dict with the cropped image\n '
raw_img = _load_image(blob, self.channel_axis)
(_img, top, left) = _crop_image(raw_img, self.... |
449ba6e2c80002e0aebc42870340a40be3941fd0ace2772670cf95c7906bdba6 | def kill(self):
'\n Kill the main association thread loop, first checking that the DUL has \n been stopped\n '
self._Kill = True
self.is_established = False
while (not self.dul.Stop()):
time.sleep(0.001)
self.ae._cleanup_associations() | Kill the main association thread loop, first checking that the DUL has
been stopped | pynetdicom/association.py | kill | scaramallion/pynetdicom_legacy | 0 | python | def kill(self):
'\n Kill the main association thread loop, first checking that the DUL has \n been stopped\n '
self._Kill = True
self.is_established = False
while (not self.dul.Stop()):
time.sleep(0.001)
self.ae._cleanup_associations() | def kill(self):
'\n Kill the main association thread loop, first checking that the DUL has \n been stopped\n '
self._Kill = True
self.is_established = False
while (not self.dul.Stop()):
time.sleep(0.001)
self.ae._cleanup_associations()<|docstring|>Kill the main associati... |
0bf3aa8e6c6d36e8cd1f269564d30e49411358cc3d3f8bc6820fa82824df8ea2 | def release(self):
'\n Direct the ACSE to issue an A-RELEASE request primitive to the DUL \n provider\n '
response = self.acse.Release()
self.kill()
self.is_released = True | Direct the ACSE to issue an A-RELEASE request primitive to the DUL
provider | pynetdicom/association.py | release | scaramallion/pynetdicom_legacy | 0 | python | def release(self):
'\n Direct the ACSE to issue an A-RELEASE request primitive to the DUL \n provider\n '
response = self.acse.Release()
self.kill()
self.is_released = True | def release(self):
'\n Direct the ACSE to issue an A-RELEASE request primitive to the DUL \n provider\n '
response = self.acse.Release()
self.kill()
self.is_released = True<|docstring|>Direct the ACSE to issue an A-RELEASE request primitive to the DUL
provider<|endoftext|> |
f15d98da8b0735e62c4e03b78ab739710d82d1ddb604d52ce181190233e65ac9 | def abort(self):
'\n Direct the ACSE to issue an A-ABORT request primitive to the DUL\n provider\n \n DUL service user association abort. Always gives the source as the \n DUL service user and sets the abort reason to 0x00 (not significant)\n \n See PS3.8, 7.3-4 and ... | Direct the ACSE to issue an A-ABORT request primitive to the DUL
provider
DUL service user association abort. Always gives the source as the
DUL service user and sets the abort reason to 0x00 (not significant)
See PS3.8, 7.3-4 and 9.3.8. | pynetdicom/association.py | abort | scaramallion/pynetdicom_legacy | 0 | python | def abort(self):
'\n Direct the ACSE to issue an A-ABORT request primitive to the DUL\n provider\n \n DUL service user association abort. Always gives the source as the \n DUL service user and sets the abort reason to 0x00 (not significant)\n \n See PS3.8, 7.3-4 and ... | def abort(self):
'\n Direct the ACSE to issue an A-ABORT request primitive to the DUL\n provider\n \n DUL service user association abort. Always gives the source as the \n DUL service user and sets the abort reason to 0x00 (not significant)\n \n See PS3.8, 7.3-4 and ... |
b8668c2c5c248119a03ee2b62d843f7ea831e6a32b6df7cddab34c066fcb81e1 | def run(self):
'\n The main Association thread\n '
self.acse = ACSEServiceProvider(self, self.dul, self.acse_timeout)
self.dimse = DIMSEServiceProvider(self.dul, self.dimse_timeout)
if (self.mode == 'Acceptor'):
time.sleep(0.1)
assoc_rq = self.dul.Receive(Wait=True)
... | The main Association thread | pynetdicom/association.py | run | scaramallion/pynetdicom_legacy | 0 | python | def run(self):
'\n \n '
self.acse = ACSEServiceProvider(self, self.dul, self.acse_timeout)
self.dimse = DIMSEServiceProvider(self.dul, self.dimse_timeout)
if (self.mode == 'Acceptor'):
time.sleep(0.1)
assoc_rq = self.dul.Receive(Wait=True)
if (assoc_rq is None):
... | def run(self):
'\n \n '
self.acse = ACSEServiceProvider(self, self.dul, self.acse_timeout)
self.dimse = DIMSEServiceProvider(self.dul, self.dimse_timeout)
if (self.mode == 'Acceptor'):
time.sleep(0.1)
assoc_rq = self.dul.Receive(Wait=True)
if (assoc_rq is None):
... |
5c983da6121972369e504acbaf77544cd9bc7359c818acc9868180ab182d236d | def send_c_echo(self, msg_id=1):
'\n Send a C-ECHO message to the peer AE to verify end-to-end communication\n \n Parameters\n ----------\n msg_id - int, optional\n The message ID to use (default: 1)\n\n Returns\n -------\n status : pynetdicom.SOPcl... | Send a C-ECHO message to the peer AE to verify end-to-end communication
Parameters
----------
msg_id - int, optional
The message ID to use (default: 1)
Returns
-------
status : pynetdicom.SOPclass.Status or None
Returns None if no valid presentation context or no response
from the peer, Success (0x0000) o... | pynetdicom/association.py | send_c_echo | scaramallion/pynetdicom_legacy | 0 | python | def send_c_echo(self, msg_id=1):
'\n Send a C-ECHO message to the peer AE to verify end-to-end communication\n \n Parameters\n ----------\n msg_id - int, optional\n The message ID to use (default: 1)\n\n Returns\n -------\n status : pynetdicom.SOPcl... | def send_c_echo(self, msg_id=1):
'\n Send a C-ECHO message to the peer AE to verify end-to-end communication\n \n Parameters\n ----------\n msg_id - int, optional\n The message ID to use (default: 1)\n\n Returns\n -------\n status : pynetdicom.SOPcl... |
74438e3775a7f85b8ec5d6e32da40a5d324d22ca838ba02d0bfcecc16615b8a7 | def send_c_store(self, dataset, msg_id=1, priority=2):
"\n Send a C-STORE request message to the peer AE Storage SCP\n \n PS3.4 Annex B\n \n Service Definition\n ==================\n Two peer DICOM AEs implement a SOP Class of the Storage Service Class\n with one ... | Send a C-STORE request message to the peer AE Storage SCP
PS3.4 Annex B
Service Definition
==================
Two peer DICOM AEs implement a SOP Class of the Storage Service Class
with one serving in the SCU role and one service in the SCP role.
SOP Classes are implemented using the C-STORE DIMSE service. A
successf... | pynetdicom/association.py | send_c_store | scaramallion/pynetdicom_legacy | 0 | python | def send_c_store(self, dataset, msg_id=1, priority=2):
"\n Send a C-STORE request message to the peer AE Storage SCP\n \n PS3.4 Annex B\n \n Service Definition\n ==================\n Two peer DICOM AEs implement a SOP Class of the Storage Service Class\n with one ... | def send_c_store(self, dataset, msg_id=1, priority=2):
"\n Send a C-STORE request message to the peer AE Storage SCP\n \n PS3.4 Annex B\n \n Service Definition\n ==================\n Two peer DICOM AEs implement a SOP Class of the Storage Service Class\n with one ... |
f4d28343c816f2619674f57d7b8b1d4be290e2023f3323aeee64d312a45a7242 | def send_c_find(self, dataset, msg_id=1, priority=2, query_model='W'):
"\n Send a C-FIND request message to the peer AE\n \n See PS3.4 Annex C - Query/Retrieve Service Class\n\n Parameters\n ----------\n dataset : pydicom.Dataset\n The DICOM dataset to containing... | Send a C-FIND request message to the peer AE
See PS3.4 Annex C - Query/Retrieve Service Class
Parameters
----------
dataset : pydicom.Dataset
The DICOM dataset to containing the Key Attributes the peer AE
should perform the match against
msg_id : int, optional
The message ID
priority : int, optional
... | pynetdicom/association.py | send_c_find | scaramallion/pynetdicom_legacy | 0 | python | def send_c_find(self, dataset, msg_id=1, priority=2, query_model='W'):
"\n Send a C-FIND request message to the peer AE\n \n See PS3.4 Annex C - Query/Retrieve Service Class\n\n Parameters\n ----------\n dataset : pydicom.Dataset\n The DICOM dataset to containing... | def send_c_find(self, dataset, msg_id=1, priority=2, query_model='W'):
"\n Send a C-FIND request message to the peer AE\n \n See PS3.4 Annex C - Query/Retrieve Service Class\n\n Parameters\n ----------\n dataset : pydicom.Dataset\n The DICOM dataset to containing... |
e7b324d94c52c77c8de5c463282c7bfff5b13c74546f3ae089d1a6a6089eafc0 | def send_c_cancel_find(self, msg_id, query_model):
'\n See PS3.7 9.3.2.3\n \n Parameters\n ----------\n msg_id : int\n The message ID of the C-FIND operation we want to cancel\n '
if self.is_established:
service_class = QueryRetrieveFindServiceClass()... | See PS3.7 9.3.2.3
Parameters
----------
msg_id : int
The message ID of the C-FIND operation we want to cancel | pynetdicom/association.py | send_c_cancel_find | scaramallion/pynetdicom_legacy | 0 | python | def send_c_cancel_find(self, msg_id, query_model):
'\n See PS3.7 9.3.2.3\n \n Parameters\n ----------\n msg_id : int\n The message ID of the C-FIND operation we want to cancel\n '
if self.is_established:
service_class = QueryRetrieveFindServiceClass()... | def send_c_cancel_find(self, msg_id, query_model):
'\n See PS3.7 9.3.2.3\n \n Parameters\n ----------\n msg_id : int\n The message ID of the C-FIND operation we want to cancel\n '
if self.is_established:
service_class = QueryRetrieveFindServiceClass()... |
7e4283f25a580343bc9ac37baf066fb11cac396efd5550b2c599b0b1adfa1ae8 | def send_c_move(self, dataset, move_aet, msg_id=1, priority=2, query_model='P'):
"\n C-MOVE Service Procedure\n ------------------------\n PS3.7 9.1.4.2\n \n Invoker\n ~~~~~~~\n The invoking DIMSE user requests a performing DIMSE user match an \n Identifier ag... | C-MOVE Service Procedure
------------------------
PS3.7 9.1.4.2
Invoker
~~~~~~~
The invoking DIMSE user requests a performing DIMSE user match an
Identifier against the Attributes of all SOP Instances known to the
performing user and generate a C-STORE sub-operation for each match.
Performer
~~~~~~~~~
For each match... | pynetdicom/association.py | send_c_move | scaramallion/pynetdicom_legacy | 0 | python | def send_c_move(self, dataset, move_aet, msg_id=1, priority=2, query_model='P'):
"\n C-MOVE Service Procedure\n ------------------------\n PS3.7 9.1.4.2\n \n Invoker\n ~~~~~~~\n The invoking DIMSE user requests a performing DIMSE user match an \n Identifier ag... | def send_c_move(self, dataset, move_aet, msg_id=1, priority=2, query_model='P'):
"\n C-MOVE Service Procedure\n ------------------------\n PS3.7 9.1.4.2\n \n Invoker\n ~~~~~~~\n The invoking DIMSE user requests a performing DIMSE user match an \n Identifier ag... |
48735380fb015eca3f7d7829e1fc66395b2b44dd88ccea5853d9c84da1067b06 | def send_c_cancel_move(self, msg_id, query_model):
'\n See PS3.7 9.3.2.3\n \n Parameters\n ----------\n msg_id : int\n The message ID of the C-MOVE operation we want to cancel\n query_model : str\n The query model SOP class to use (needed to identify c... | See PS3.7 9.3.2.3
Parameters
----------
msg_id : int
The message ID of the C-MOVE operation we want to cancel
query_model : str
The query model SOP class to use (needed to identify context ID) | pynetdicom/association.py | send_c_cancel_move | scaramallion/pynetdicom_legacy | 0 | python | def send_c_cancel_move(self, msg_id, query_model):
'\n See PS3.7 9.3.2.3\n \n Parameters\n ----------\n msg_id : int\n The message ID of the C-MOVE operation we want to cancel\n query_model : str\n The query model SOP class to use (needed to identify c... | def send_c_cancel_move(self, msg_id, query_model):
'\n See PS3.7 9.3.2.3\n \n Parameters\n ----------\n msg_id : int\n The message ID of the C-MOVE operation we want to cancel\n query_model : str\n The query model SOP class to use (needed to identify c... |
da87718f9d83424e720bddf4dcabd2a5b28c27583b1ea1c52a256dd61f0b4b36 | def send_c_get(self, dataset, msg_id=1, priority=2, query_model='P'):
"\n Send a C-GET request message to the peer AE\n \n See PS3.4 Annex C - Query/Retrieve Service Class\n\n Parameters\n ----------\n dataset : pydicom.Dataset\n The DICOM dataset to containing t... | Send a C-GET request message to the peer AE
See PS3.4 Annex C - Query/Retrieve Service Class
Parameters
----------
dataset : pydicom.Dataset
The DICOM dataset to containing the Key Attributes the peer AE
should perform the match against
msg_id : int, optional
The message ID
priority : int, optional
T... | pynetdicom/association.py | send_c_get | scaramallion/pynetdicom_legacy | 0 | python | def send_c_get(self, dataset, msg_id=1, priority=2, query_model='P'):
"\n Send a C-GET request message to the peer AE\n \n See PS3.4 Annex C - Query/Retrieve Service Class\n\n Parameters\n ----------\n dataset : pydicom.Dataset\n The DICOM dataset to containing t... | def send_c_get(self, dataset, msg_id=1, priority=2, query_model='P'):
"\n Send a C-GET request message to the peer AE\n \n See PS3.4 Annex C - Query/Retrieve Service Class\n\n Parameters\n ----------\n dataset : pydicom.Dataset\n The DICOM dataset to containing t... |
80bcc4f34a5d1167afb13373f0354adba1eaeae01ead9e70e02b20cf2453a163 | def send_c_cancel_get(self, msg_id, query_model):
'\n See PS3.7 9.3.2.3\n \n Parameters\n ----------\n msg_id : int\n The message ID of the C-GET operation we want to cancel\n '
if self.is_established:
service_class = QueryRetrieveGetServiceClass()
... | See PS3.7 9.3.2.3
Parameters
----------
msg_id : int
The message ID of the C-GET operation we want to cancel | pynetdicom/association.py | send_c_cancel_get | scaramallion/pynetdicom_legacy | 0 | python | def send_c_cancel_get(self, msg_id, query_model):
'\n See PS3.7 9.3.2.3\n \n Parameters\n ----------\n msg_id : int\n The message ID of the C-GET operation we want to cancel\n '
if self.is_established:
service_class = QueryRetrieveGetServiceClass()
... | def send_c_cancel_get(self, msg_id, query_model):
'\n See PS3.7 9.3.2.3\n \n Parameters\n ----------\n msg_id : int\n The message ID of the C-GET operation we want to cancel\n '
if self.is_established:
service_class = QueryRetrieveGetServiceClass()
... |
20bdac339a69f480657b3a15dbfa08352397ba48947c910f3697a926e49fec3a | def debug_association_requested(self, primitive):
'\n Called when an association is reuested by a peer AE, used for \n logging/debugging information\n \n Parameters\n ----------\n assoc_primitive - pynetdicom.DULparameters.A_ASSOCIATE_ServiceParameter\n The A-ASS... | Called when an association is reuested by a peer AE, used for
logging/debugging information
Parameters
----------
assoc_primitive - pynetdicom.DULparameters.A_ASSOCIATE_ServiceParameter
The A-ASSOCIATE-RJ PDU instance received from the peer AE | pynetdicom/association.py | debug_association_requested | scaramallion/pynetdicom_legacy | 0 | python | def debug_association_requested(self, primitive):
'\n Called when an association is reuested by a peer AE, used for \n logging/debugging information\n \n Parameters\n ----------\n assoc_primitive - pynetdicom.DULparameters.A_ASSOCIATE_ServiceParameter\n The A-ASS... | def debug_association_requested(self, primitive):
'\n Called when an association is reuested by a peer AE, used for \n logging/debugging information\n \n Parameters\n ----------\n assoc_primitive - pynetdicom.DULparameters.A_ASSOCIATE_ServiceParameter\n The A-ASS... |
40b6cca933dac708fa828e9a0df07b16ed65df9d9022be367795c4096dad6d2a | def debug_association_accepted(self, assoc):
"\n Called when an association attempt is accepted by a peer AE, used for \n logging/debugging information\n \n Parameters\n ----------\n assoc - pynetdicom.DULparameters.A_ASSOCIATE_ServiceParameter\n The Association ... | Called when an association attempt is accepted by a peer AE, used for
logging/debugging information
Parameters
----------
assoc - pynetdicom.DULparameters.A_ASSOCIATE_ServiceParameter
The Association parameters negotiated between the local and peer AEs
#max_send_pdv = associate_ac_pdu.UserInformationItem[-1].Max... | pynetdicom/association.py | debug_association_accepted | scaramallion/pynetdicom_legacy | 0 | python | def debug_association_accepted(self, assoc):
"\n Called when an association attempt is accepted by a peer AE, used for \n logging/debugging information\n \n Parameters\n ----------\n assoc - pynetdicom.DULparameters.A_ASSOCIATE_ServiceParameter\n The Association ... | def debug_association_accepted(self, assoc):
"\n Called when an association attempt is accepted by a peer AE, used for \n logging/debugging information\n \n Parameters\n ----------\n assoc - pynetdicom.DULparameters.A_ASSOCIATE_ServiceParameter\n The Association ... |
0e63182e083af72b465b72774a1a3d07371aa25487acbdaaa39ba42c39bb8134 | def debug_association_rejected(self, assoc_primitive):
'\n Called when an association attempt is rejected by a peer AE, used for \n logging/debugging information\n \n Parameters\n ----------\n assoc_primitive - pynetdicom.primitives.A_ASSOCIATE\n The A-ASSOCIATE ... | Called when an association attempt is rejected by a peer AE, used for
logging/debugging information
Parameters
----------
assoc_primitive - pynetdicom.primitives.A_ASSOCIATE
The A-ASSOCIATE primitive instance (RJ) received from the peer AE | pynetdicom/association.py | debug_association_rejected | scaramallion/pynetdicom_legacy | 0 | python | def debug_association_rejected(self, assoc_primitive):
'\n Called when an association attempt is rejected by a peer AE, used for \n logging/debugging information\n \n Parameters\n ----------\n assoc_primitive - pynetdicom.primitives.A_ASSOCIATE\n The A-ASSOCIATE ... | def debug_association_rejected(self, assoc_primitive):
'\n Called when an association attempt is rejected by a peer AE, used for \n logging/debugging information\n \n Parameters\n ----------\n assoc_primitive - pynetdicom.primitives.A_ASSOCIATE\n The A-ASSOCIATE ... |
c2cdf9d8905abe95bb5c9e15d266136cd5fea74f7d6edc6d9fc29deef64367d8 | def build_backpressure_events_from_log_jsons(logs: list):
'\n Build a list of BackpressureEvents from the specified logs, using matched "start" and "end" events for a particular\n pod to delimit the duration of the BackpressureEvent.\n\n :param logs: a list of JSON log files, each of which is a list of JSO... | Build a list of BackpressureEvents from the specified logs, using matched "start" and "end" events for a particular
pod to delimit the duration of the BackpressureEvent.
:param logs: a list of JSON log files, each of which is a list of JSON objects each representing a log entry.
:return: a list of BackpressureEvents. | scripts/backpressure_report/backpressure_report/lib/backpressure_event.py | build_backpressure_events_from_log_jsons | BearerPipelineTest/cromwell | 0 | python | def build_backpressure_events_from_log_jsons(logs: list):
'\n Build a list of BackpressureEvents from the specified logs, using matched "start" and "end" events for a particular\n pod to delimit the duration of the BackpressureEvent.\n\n :param logs: a list of JSON log files, each of which is a list of JSO... | def build_backpressure_events_from_log_jsons(logs: list):
'\n Build a list of BackpressureEvents from the specified logs, using matched "start" and "end" events for a particular\n pod to delimit the duration of the BackpressureEvent.\n\n :param logs: a list of JSON log files, each of which is a list of JSO... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.