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 |
|---|---|---|---|---|---|---|---|---|---|
98a9c9241287e98abba4b79841baeb4ad80a2049060b3434e12b7ae7e9289eb1 | def message_to_primitive(self):
'\n Convert the current DIMSE Message object to a DIMSE service parameters \n primitive\n \n Returns\n -------\n primitive : pynetdicom.DIMSEparameters DIMSE service primitive\n The primitive generated from the current DIMSE Messag... | Convert the current DIMSE Message object to a DIMSE service parameters
primitive
Returns
-------
primitive : pynetdicom.DIMSEparameters DIMSE service primitive
The primitive generated from the current DIMSE Message | pynetdicom/DIMSEmessages.py | message_to_primitive | scaramallion/pynetdicom_legacy | 0 | python | def message_to_primitive(self):
'\n Convert the current DIMSE Message object to a DIMSE service parameters \n primitive\n \n Returns\n -------\n primitive : pynetdicom.DIMSEparameters DIMSE service primitive\n The primitive generated from the current DIMSE Messag... | def message_to_primitive(self):
'\n Convert the current DIMSE Message object to a DIMSE service parameters \n primitive\n \n Returns\n -------\n primitive : pynetdicom.DIMSEparameters DIMSE service primitive\n The primitive generated from the current DIMSE Messag... |
c82f2febfa8deb3b1622c8414500ad240911f9e5e1987280571d257c4224d7dd | def test_relu_9():
'\n api: paddle.relu\n op version: 9\n '
op = Net()
op.eval()
obj = APIOnnx(op, 'relu', [9])
obj.set_input_data('input_data', paddle.to_tensor(randtool('float', (- 1), 1, [3, 3, 3]).astype('float32')))
obj.run() | api: paddle.relu
op version: 9 | tests/test_relu.py | test_relu_9 | Zeref996/Paddle2ONNX | 252 | python | def test_relu_9():
'\n api: paddle.relu\n op version: 9\n '
op = Net()
op.eval()
obj = APIOnnx(op, 'relu', [9])
obj.set_input_data('input_data', paddle.to_tensor(randtool('float', (- 1), 1, [3, 3, 3]).astype('float32')))
obj.run() | def test_relu_9():
'\n api: paddle.relu\n op version: 9\n '
op = Net()
op.eval()
obj = APIOnnx(op, 'relu', [9])
obj.set_input_data('input_data', paddle.to_tensor(randtool('float', (- 1), 1, [3, 3, 3]).astype('float32')))
obj.run()<|docstring|>api: paddle.relu
op version: 9<|endoftext|> |
f3a18cbbd4cf2cf9e8e4065ef5be0fddd5ab4e9aa4f6904c157c7509a637ef69 | def test_relu_10():
'\n api: paddle.relu\n op version: 10\n '
op = Net()
op.eval()
obj = APIOnnx(op, 'relu', [10])
obj.set_input_data('input_data', paddle.to_tensor(randtool('float', (- 1), 1, [3, 3, 3]).astype('float32')))
obj.run() | api: paddle.relu
op version: 10 | tests/test_relu.py | test_relu_10 | Zeref996/Paddle2ONNX | 252 | python | def test_relu_10():
'\n api: paddle.relu\n op version: 10\n '
op = Net()
op.eval()
obj = APIOnnx(op, 'relu', [10])
obj.set_input_data('input_data', paddle.to_tensor(randtool('float', (- 1), 1, [3, 3, 3]).astype('float32')))
obj.run() | def test_relu_10():
'\n api: paddle.relu\n op version: 10\n '
op = Net()
op.eval()
obj = APIOnnx(op, 'relu', [10])
obj.set_input_data('input_data', paddle.to_tensor(randtool('float', (- 1), 1, [3, 3, 3]).astype('float32')))
obj.run()<|docstring|>api: paddle.relu
op version: 10<|endoftex... |
8f583682e2cc163438afd5f9a0ab7b8a40c526f22144f2da26bab73b0172f436 | def test_relu_11():
'\n api: paddle.relu\n op version: 11\n '
op = Net()
op.eval()
obj = APIOnnx(op, 'relu', [11])
obj.set_input_data('input_data', paddle.to_tensor(randtool('float', (- 1), 1, [3, 3, 3]).astype('float32')))
obj.run() | api: paddle.relu
op version: 11 | tests/test_relu.py | test_relu_11 | Zeref996/Paddle2ONNX | 252 | python | def test_relu_11():
'\n api: paddle.relu\n op version: 11\n '
op = Net()
op.eval()
obj = APIOnnx(op, 'relu', [11])
obj.set_input_data('input_data', paddle.to_tensor(randtool('float', (- 1), 1, [3, 3, 3]).astype('float32')))
obj.run() | def test_relu_11():
'\n api: paddle.relu\n op version: 11\n '
op = Net()
op.eval()
obj = APIOnnx(op, 'relu', [11])
obj.set_input_data('input_data', paddle.to_tensor(randtool('float', (- 1), 1, [3, 3, 3]).astype('float32')))
obj.run()<|docstring|>api: paddle.relu
op version: 11<|endoftex... |
c81e11f8a862baa5f5cbfe0c5b32d8281df7d39ed4a3806833a8cc49d306fe74 | def test_relu_12():
'\n api: paddle.relu\n op version: 12\n '
op = Net()
op.eval()
obj = APIOnnx(op, 'relu', [12])
obj.set_input_data('input_data', paddle.to_tensor(randtool('float', (- 1), 1, [3, 3, 3]).astype('float32')))
obj.run() | api: paddle.relu
op version: 12 | tests/test_relu.py | test_relu_12 | Zeref996/Paddle2ONNX | 252 | python | def test_relu_12():
'\n api: paddle.relu\n op version: 12\n '
op = Net()
op.eval()
obj = APIOnnx(op, 'relu', [12])
obj.set_input_data('input_data', paddle.to_tensor(randtool('float', (- 1), 1, [3, 3, 3]).astype('float32')))
obj.run() | def test_relu_12():
'\n api: paddle.relu\n op version: 12\n '
op = Net()
op.eval()
obj = APIOnnx(op, 'relu', [12])
obj.set_input_data('input_data', paddle.to_tensor(randtool('float', (- 1), 1, [3, 3, 3]).astype('float32')))
obj.run()<|docstring|>api: paddle.relu
op version: 12<|endoftex... |
1fdee1eb00ce5b1914c7d5fb3c00079c14653b75eef29e48107555f1a43b1529 | def forward(self, inputs):
'\n forward\n '
x = paddle.nn.functional.relu(inputs)
return x | forward | tests/test_relu.py | forward | Zeref996/Paddle2ONNX | 252 | python | def (self, inputs):
'\n \n '
x = paddle.nn.functional.relu(inputs)
return x | def (self, inputs):
'\n \n '
x = paddle.nn.functional.relu(inputs)
return x<|docstring|>forward<|endoftext|> |
a6529b9cec5b18562a472aef93681293791b10728e32dd5f609a95e102a2a906 | def _create_initial_multiqueue(self):
'\n Every output has a multiqueue on the the source (mixer) pipeline.\n tee -> multiqueue -> intervideosink (or audio) -> intervideosrc (or audio)\n '
self.multiqueue = self.source.add_element('multiqueue', self)
MAX_SIZE_IN_SECONDS = 3
self.mul... | Every output has a multiqueue on the the source (mixer) pipeline.
tee -> multiqueue -> intervideosink (or audio) -> intervideosrc (or audio) | brave/outputs/output.py | _create_initial_multiqueue | flavioribeiro/brave | 1 | python | def _create_initial_multiqueue(self):
'\n Every output has a multiqueue on the the source (mixer) pipeline.\n tee -> multiqueue -> intervideosink (or audio) -> intervideosrc (or audio)\n '
self.multiqueue = self.source.add_element('multiqueue', self)
MAX_SIZE_IN_SECONDS = 3
self.mul... | def _create_initial_multiqueue(self):
'\n Every output has a multiqueue on the the source (mixer) pipeline.\n tee -> multiqueue -> intervideosink (or audio) -> intervideosrc (or audio)\n '
self.multiqueue = self.source.add_element('multiqueue', self)
MAX_SIZE_IN_SECONDS = 3
self.mul... |
c75c2f8effa246de12042803a2af53fa0da8461c26aed2d284fc7f8020bc173f | def link_from_source(self):
'\n Link this output so that it is receiving AV from the source (mixer).\n '
if self.has_video():
self._connect_tee_to_element(self.source.final_video_tee, 'video')
if self.has_audio():
self._connect_tee_to_element(self.source.final_audio_tee, 'audio... | Link this output so that it is receiving AV from the source (mixer). | brave/outputs/output.py | link_from_source | flavioribeiro/brave | 1 | python | def link_from_source(self):
'\n \n '
if self.has_video():
self._connect_tee_to_element(self.source.final_video_tee, 'video')
if self.has_audio():
self._connect_tee_to_element(self.source.final_audio_tee, 'audio') | def link_from_source(self):
'\n \n '
if self.has_video():
self._connect_tee_to_element(self.source.final_video_tee, 'video')
if self.has_audio():
self._connect_tee_to_element(self.source.final_audio_tee, 'audio')<|docstring|>Link this output so that it is receiving AV from the ... |
6d1c382df28251bbcb44d7f619b7f9358e87983a7b5686445c1b271fe66be1c8 | def unlink_from_source(self):
'\n Stop taking AV from the connected source (mixer).\n '
for video_or_audio in ['video', 'audio']:
if (video_or_audio in self.tee_src_pads):
tee_src_pad = self.tee_src_pads[video_or_audio]
pad_tee_is_connected_to = tee_src_pad.get_peer... | Stop taking AV from the connected source (mixer). | brave/outputs/output.py | unlink_from_source | flavioribeiro/brave | 1 | python | def unlink_from_source(self):
'\n \n '
for video_or_audio in ['video', 'audio']:
if (video_or_audio in self.tee_src_pads):
tee_src_pad = self.tee_src_pads[video_or_audio]
pad_tee_is_connected_to = tee_src_pad.get_peer()
if pad_tee_is_connected_to:
... | def unlink_from_source(self):
'\n \n '
for video_or_audio in ['video', 'audio']:
if (video_or_audio in self.tee_src_pads):
tee_src_pad = self.tee_src_pads[video_or_audio]
pad_tee_is_connected_to = tee_src_pad.get_peer()
if pad_tee_is_connected_to:
... |
3e832ad7f5477ade6f724318ce5f7e8ef575f86cbe46ba0edad41de95045dd6c | def _sync_elements_on_source_pipeline(self):
"\n Make sure the elements on the source (mixer) are matching what the source's state is.\n It's important this happens _after_ after this pipeline has been initialised (i.e. left NULL state),\n so that the caps are correctly discovered.\n "
... | Make sure the elements on the source (mixer) are matching what the source's state is.
It's important this happens _after_ after this pipeline has been initialised (i.e. left NULL state),
so that the caps are correctly discovered. | brave/outputs/output.py | _sync_elements_on_source_pipeline | flavioribeiro/brave | 1 | python | def _sync_elements_on_source_pipeline(self):
"\n Make sure the elements on the source (mixer) are matching what the source's state is.\n It's important this happens _after_ after this pipeline has been initialised (i.e. left NULL state),\n so that the caps are correctly discovered.\n "
... | def _sync_elements_on_source_pipeline(self):
"\n Make sure the elements on the source (mixer) are matching what the source's state is.\n It's important this happens _after_ after this pipeline has been initialised (i.e. left NULL state),\n so that the caps are correctly discovered.\n "
... |
d46e29fab44bbee7df5b98de5cd883a7569307a9d9e64601b6ab0016b977f7cc | def create_intervideosink_and_connections(self):
'\n intervideosink/intervidesrc are used to connect the master pipeline\n with the local pipeline for this output.\n '
self.intervideosink = self.source.add_element('intervideosink', self)
self.video_element_multiqueue_should_connect_to =... | intervideosink/intervidesrc are used to connect the master pipeline
with the local pipeline for this output. | brave/outputs/output.py | create_intervideosink_and_connections | flavioribeiro/brave | 1 | python | def create_intervideosink_and_connections(self):
'\n intervideosink/intervidesrc are used to connect the master pipeline\n with the local pipeline for this output.\n '
self.intervideosink = self.source.add_element('intervideosink', self)
self.video_element_multiqueue_should_connect_to =... | def create_intervideosink_and_connections(self):
'\n intervideosink/intervidesrc are used to connect the master pipeline\n with the local pipeline for this output.\n '
self.intervideosink = self.source.add_element('intervideosink', self)
self.video_element_multiqueue_should_connect_to =... |
6cb59069531f3ceb79963ac7ebe6eba447b438bb9baa30993ef3443020a416e4 | def create_interaudiosink_and_connections(self):
'\n interaudiosink/interaudiosrc are used to connect the master pipeline\n with the local pipeline for this output.\n '
self.interaudiosink = self.source.add_element('interaudiosink', self)
self.audio_element_multiqueue_should_connect_to ... | interaudiosink/interaudiosrc are used to connect the master pipeline
with the local pipeline for this output. | brave/outputs/output.py | create_interaudiosink_and_connections | flavioribeiro/brave | 1 | python | def create_interaudiosink_and_connections(self):
'\n interaudiosink/interaudiosrc are used to connect the master pipeline\n with the local pipeline for this output.\n '
self.interaudiosink = self.source.add_element('interaudiosink', self)
self.audio_element_multiqueue_should_connect_to ... | def create_interaudiosink_and_connections(self):
'\n interaudiosink/interaudiosrc are used to connect the master pipeline\n with the local pipeline for this output.\n '
self.interaudiosink = self.source.add_element('interaudiosink', self)
self.audio_element_multiqueue_should_connect_to ... |
421f20f55e6792be6b21a436688224e8b179e24d3bda6f0d86959a2bcabbc19e | def create_caps_string(self):
'\n Returns the preferred caps (a string defining things such as width, height and framerate)\n '
caps = 'video/x-raw'
width = (self.props['width'] if ('width' in self.props) else None)
height = (self.props['height'] if ('height' in self.props) else None)
... | Returns the preferred caps (a string defining things such as width, height and framerate) | brave/outputs/output.py | create_caps_string | flavioribeiro/brave | 1 | python | def create_caps_string(self):
'\n \n '
caps = 'video/x-raw'
width = (self.props['width'] if ('width' in self.props) else None)
height = (self.props['height'] if ('height' in self.props) else None)
(mix_width, mix_height) = self.source.get_dimensions()
if (mix_width and mix_height):... | def create_caps_string(self):
'\n \n '
caps = 'video/x-raw'
width = (self.props['width'] if ('width' in self.props) else None)
height = (self.props['height'] if ('height' in self.props) else None)
(mix_width, mix_height) = self.source.get_dimensions()
if (mix_width and mix_height):... |
84872dd74ada430f0df7fbb1c30d9393726f57cf2d1d628fe27be60f75d7d262 | def on_pipeline_start(self):
'\n Called when the stream starts\n '
if (self.source.get_state() in [Gst.State.PLAYING, Gst.State.PAUSED]):
self.unblock_intervideosrc_src_pad()
self.unblock_interaudiosrc_src_pad() | Called when the stream starts | brave/outputs/output.py | on_pipeline_start | flavioribeiro/brave | 1 | python | def on_pipeline_start(self):
'\n \n '
if (self.source.get_state() in [Gst.State.PLAYING, Gst.State.PAUSED]):
self.unblock_intervideosrc_src_pad()
self.unblock_interaudiosrc_src_pad() | def on_pipeline_start(self):
'\n \n '
if (self.source.get_state() in [Gst.State.PLAYING, Gst.State.PAUSED]):
self.unblock_intervideosrc_src_pad()
self.unblock_interaudiosrc_src_pad()<|docstring|>Called when the stream starts<|endoftext|> |
dc548aec63c813c6f5ea4500ae1a68e1f587cd7641a63200f71ec93aecd823dc | def _multiqueue_pad_added(self, element, pad):
'\n Called when the multiqueue gets a pad added.\n The job of this is to handle the src (output) pad and connect it to the next thing.\n '
if (pad.get_direction() != Gst.PadDirection.SRC):
return
if pad.is_linked():
return
... | Called when the multiqueue gets a pad added.
The job of this is to handle the src (output) pad and connect it to the next thing. | brave/outputs/output.py | _multiqueue_pad_added | flavioribeiro/brave | 1 | python | def _multiqueue_pad_added(self, element, pad):
'\n Called when the multiqueue gets a pad added.\n The job of this is to handle the src (output) pad and connect it to the next thing.\n '
if (pad.get_direction() != Gst.PadDirection.SRC):
return
if pad.is_linked():
return
... | def _multiqueue_pad_added(self, element, pad):
'\n Called when the multiqueue gets a pad added.\n The job of this is to handle the src (output) pad and connect it to the next thing.\n '
if (pad.get_direction() != Gst.PadDirection.SRC):
return
if pad.is_linked():
return
... |
75fed0e469abacd78085f4daa52e65bb05314aec0cada35c39126a1b7539a137 | def _connect_tee_to_element(self, tee, video_or_audio):
"\n Called when it's time to connect an input (via a mixer/tee) to this output\n "
tee_src_pad_template = tee.get_pad_template('src_%u')
tee_src_pad = tee.request_pad(tee_src_pad_template, None, None)
self.logger.debug((f'Connecting {... | Called when it's time to connect an input (via a mixer/tee) to this output | brave/outputs/output.py | _connect_tee_to_element | flavioribeiro/brave | 1 | python | def _connect_tee_to_element(self, tee, video_or_audio):
"\n \n "
tee_src_pad_template = tee.get_pad_template('src_%u')
tee_src_pad = tee.request_pad(tee_src_pad_template, None, None)
self.logger.debug((f'Connecting {tee.get_name()} request pad ' + f'{tee_src_pad.get_name()} to {video_or_au... | def _connect_tee_to_element(self, tee, video_or_audio):
"\n \n "
tee_src_pad_template = tee.get_pad_template('src_%u')
tee_src_pad = tee.request_pad(tee_src_pad_template, None, None)
self.logger.debug((f'Connecting {tee.get_name()} request pad ' + f'{tee_src_pad.get_name()} to {video_or_au... |
07ba68edccd2d5033f663d623a4949aa220a61d2bcb871119da2d7627586b740 | def search(text, n):
'Searches for text, and retrieves n words either side of the text, which are returned seperately'
word = '\\W*([\\w]+)'
groups = re.search('{}\\W*{}{}'.format((word * n), 'place', (word * n)), text).groups()
return (groups[:n], groups[n:]) | Searches for text, and retrieves n words either side of the text, which are returned seperately | JT_more_excel_cleanup.py | search | maverickhntr/excel_cleanups | 0 | python | def search(text, n):
word = '\\W*([\\w]+)'
groups = re.search('{}\\W*{}{}'.format((word * n), 'place', (word * n)), text).groups()
return (groups[:n], groups[n:]) | def search(text, n):
word = '\\W*([\\w]+)'
groups = re.search('{}\\W*{}{}'.format((word * n), 'place', (word * n)), text).groups()
return (groups[:n], groups[n:])<|docstring|>Searches for text, and retrieves n words either side of the text, which are returned seperately<|endoftext|> |
7ac3e9d5ce1c7390fecfd877bc8ee5e7d15304e4184f124a3e25b2a4eb6e428f | def focal_loss(labels, logits, alpha, gamma):
'Compute the focal loss between `logits` and the ground truth `labels`.\n Focal loss = -alpha_t * (1-pt)^gamma * log(pt)\n where pt is the probability of being classified to the true class.\n pt = p (if true class), otherwise pt = 1 - p. p = sigmoid(logit).\n ... | Compute the focal loss between `logits` and the ground truth `labels`.
Focal loss = -alpha_t * (1-pt)^gamma * log(pt)
where pt is the probability of being classified to the true class.
pt = p (if true class), otherwise pt = 1 - p. p = sigmoid(logit).
Args:
labels: A float tensor of size [batch, num_classes].
logits... | cb_loss.py | focal_loss | gersys/Imbalanced-tutorial | 0 | python | def focal_loss(labels, logits, alpha, gamma):
'Compute the focal loss between `logits` and the ground truth `labels`.\n Focal loss = -alpha_t * (1-pt)^gamma * log(pt)\n where pt is the probability of being classified to the true class.\n pt = p (if true class), otherwise pt = 1 - p. p = sigmoid(logit).\n ... | def focal_loss(labels, logits, alpha, gamma):
'Compute the focal loss between `logits` and the ground truth `labels`.\n Focal loss = -alpha_t * (1-pt)^gamma * log(pt)\n where pt is the probability of being classified to the true class.\n pt = p (if true class), otherwise pt = 1 - p. p = sigmoid(logit).\n ... |
7e0e9ee48a2974c5438631f0fe0ec0e88b48c258cd1dfe3526ffe1ae9e9440b2 | def CB_loss(labels=None, logits=None, T=1.0, flood=0.0, samples_per_cls=None, no_of_classes=2, loss_type='softmax', beta=0.9, gamma=2.0):
'Compute the Class Balanced Loss between `logits` and the ground truth `labels`.\n Class Balanced Loss: ((1-beta)/(1-beta^n))*Loss(labels, logits)\n where Loss is one of th... | Compute the Class Balanced Loss between `logits` and the ground truth `labels`.
Class Balanced Loss: ((1-beta)/(1-beta^n))*Loss(labels, logits)
where Loss is one of the standard losses used for Neural Networks.
Args:
labels: A int tensor of size [batch].
logits: A float tensor of size [batch, no_of_classes].
samp... | cb_loss.py | CB_loss | gersys/Imbalanced-tutorial | 0 | python | def CB_loss(labels=None, logits=None, T=1.0, flood=0.0, samples_per_cls=None, no_of_classes=2, loss_type='softmax', beta=0.9, gamma=2.0):
'Compute the Class Balanced Loss between `logits` and the ground truth `labels`.\n Class Balanced Loss: ((1-beta)/(1-beta^n))*Loss(labels, logits)\n where Loss is one of th... | def CB_loss(labels=None, logits=None, T=1.0, flood=0.0, samples_per_cls=None, no_of_classes=2, loss_type='softmax', beta=0.9, gamma=2.0):
'Compute the Class Balanced Loss between `logits` and the ground truth `labels`.\n Class Balanced Loss: ((1-beta)/(1-beta^n))*Loss(labels, logits)\n where Loss is one of th... |
8339ef5565aa3d076c574e2891d370478bfd20055697cd439718def21cbd9160 | def download_file(url, path):
'\n Download a file from an URL into the file at path.\n \n @param url: URL to download\n @type url: L{str}\n @param path: path to write to\n @type path: L{str}\n '
r = requests.get(url, stream=True)
r.raise_for_status()
with open(path, 'wb') as fout:
... | Download a file from an URL into the file at path.
@param url: URL to download
@type url: L{str}
@param path: path to write to
@type path: L{str} | ff2zim/fileutils.py | download_file | IMayBeABitShy/ff2zim | 0 | python | def download_file(url, path):
'\n Download a file from an URL into the file at path.\n \n @param url: URL to download\n @type url: L{str}\n @param path: path to write to\n @type path: L{str}\n '
r = requests.get(url, stream=True)
r.raise_for_status()
with open(path, 'wb') as fout:
... | def download_file(url, path):
'\n Download a file from an URL into the file at path.\n \n @param url: URL to download\n @type url: L{str}\n @param path: path to write to\n @type path: L{str}\n '
r = requests.get(url, stream=True)
r.raise_for_status()
with open(path, 'wb') as fout:
... |
212da9b11d3718491065f7d54a700b9d721b229139dc9914709301e450ffcc9d | def create_file_with_content(path, content, replace=False):
'\n Create a file with the specified content.\n \n @param path: path to write to\n @type path: L{str}\n @param content: content to write\n @type content: L{str}\n @param replace: if not True, raise an exception if file already exists.\... | Create a file with the specified content.
@param path: path to write to
@type path: L{str}
@param content: content to write
@type content: L{str}
@param replace: if not True, raise an exception if file already exists.
@type replace: L{bool} | ff2zim/fileutils.py | create_file_with_content | IMayBeABitShy/ff2zim | 0 | python | def create_file_with_content(path, content, replace=False):
'\n Create a file with the specified content.\n \n @param path: path to write to\n @type path: L{str}\n @param content: content to write\n @type content: L{str}\n @param replace: if not True, raise an exception if file already exists.\... | def create_file_with_content(path, content, replace=False):
'\n Create a file with the specified content.\n \n @param path: path to write to\n @type path: L{str}\n @param content: content to write\n @type content: L{str}\n @param replace: if not True, raise an exception if file already exists.\... |
1439d7681f4fd2553517a7ce9a4ee7ec8be804ce768a08a49fb0770bf2aaf1b8 | def append_to_file(path, content):
'\n Append the specified content to the specified path.\n \n @param path: path to append to\n @type path: L{str}\n @param content: content to append\n @type content: L{str}\n '
with open(path, 'a') as fout:
fout.write(content) | Append the specified content to the specified path.
@param path: path to append to
@type path: L{str}
@param content: content to append
@type content: L{str} | ff2zim/fileutils.py | append_to_file | IMayBeABitShy/ff2zim | 0 | python | def append_to_file(path, content):
'\n Append the specified content to the specified path.\n \n @param path: path to append to\n @type path: L{str}\n @param content: content to append\n @type content: L{str}\n '
with open(path, 'a') as fout:
fout.write(content) | def append_to_file(path, content):
'\n Append the specified content to the specified path.\n \n @param path: path to append to\n @type path: L{str}\n @param content: content to append\n @type content: L{str}\n '
with open(path, 'a') as fout:
fout.write(content)<|docstring|>Append th... |
1689da7b0c56cf3987bb74bb0680dadd2f732959b351882f4bff2b6006b27658 | def copy_resource_file(name, dest):
"\n Copy a resource file from the 'resource' subdirectory of the package to the specified path.\n\n @param name: name of the resource file to copy\n @type name: L{str}\n @param dest: path to copy to\n @type dest: L{str}\n "
p = os.path.join(os.path.dirname(_... | Copy a resource file from the 'resource' subdirectory of the package to the specified path.
@param name: name of the resource file to copy
@type name: L{str}
@param dest: path to copy to
@type dest: L{str} | ff2zim/fileutils.py | copy_resource_file | IMayBeABitShy/ff2zim | 0 | python | def copy_resource_file(name, dest):
"\n Copy a resource file from the 'resource' subdirectory of the package to the specified path.\n\n @param name: name of the resource file to copy\n @type name: L{str}\n @param dest: path to copy to\n @type dest: L{str}\n "
p = os.path.join(os.path.dirname(_... | def copy_resource_file(name, dest):
"\n Copy a resource file from the 'resource' subdirectory of the package to the specified path.\n\n @param name: name of the resource file to copy\n @type name: L{str}\n @param dest: path to copy to\n @type dest: L{str}\n "
p = os.path.join(os.path.dirname(_... |
52c9813bdf0be870a1b1d7310a48619c90af48a53bb04b921f6000f09aa7f6dc | def format_size(nbytes):
'\n Format the given byte count into a human readable format.\n \n @param nbytes: size in bytes\n @type nbytes: L{int}\n @return: a human readable string describing the size\n @rtype: L{str}\n '
for fmt in ('B', 'KiB', 'MiB', 'GiB', 'TiB'):
if (nbytes < 1024... | Format the given byte count into a human readable format.
@param nbytes: size in bytes
@type nbytes: L{int}
@return: a human readable string describing the size
@rtype: L{str} | ff2zim/fileutils.py | format_size | IMayBeABitShy/ff2zim | 0 | python | def format_size(nbytes):
'\n Format the given byte count into a human readable format.\n \n @param nbytes: size in bytes\n @type nbytes: L{int}\n @return: a human readable string describing the size\n @rtype: L{str}\n '
for fmt in ('B', 'KiB', 'MiB', 'GiB', 'TiB'):
if (nbytes < 1024... | def format_size(nbytes):
'\n Format the given byte count into a human readable format.\n \n @param nbytes: size in bytes\n @type nbytes: L{int}\n @return: a human readable string describing the size\n @rtype: L{str}\n '
for fmt in ('B', 'KiB', 'MiB', 'GiB', 'TiB'):
if (nbytes < 1024... |
17248cbec196d54b95031390832fd5d6e4582aa3fcd65f2f7c3590193651b9f8 | def get_size_of(path, extensions=None):
'\n Get the size of a specified path in bytes.\n \n If path points to a directory, the size will be recursively calculated.\n \n @param path: path to get size of\n @type path: L{str}\n @param extensions: if specified, only files with these extensions will... | Get the size of a specified path in bytes.
If path points to a directory, the size will be recursively calculated.
@param path: path to get size of
@type path: L{str}
@param extensions: if specified, only files with these extensions will be taken into account
@return: the size of the path in bytes
@rtype: L{str} | ff2zim/fileutils.py | get_size_of | IMayBeABitShy/ff2zim | 0 | python | def get_size_of(path, extensions=None):
'\n Get the size of a specified path in bytes.\n \n If path points to a directory, the size will be recursively calculated.\n \n @param path: path to get size of\n @type path: L{str}\n @param extensions: if specified, only files with these extensions will... | def get_size_of(path, extensions=None):
'\n Get the size of a specified path in bytes.\n \n If path points to a directory, the size will be recursively calculated.\n \n @param path: path to get size of\n @type path: L{str}\n @param extensions: if specified, only files with these extensions will... |
14e626572a4f6a0d3e3720c5824c565557883b0cd7ac85454fdc590ce4bc6942 | @plugin(category='trimesh', requires=['Rhino'])
def trimesh_slice(mesh, planes):
'Slice a mesh by a list of planes.\n\n Parameters\n ----------\n mesh : tuple of vertices and faces\n The mesh to slice.\n planes : list of (point, normal) tuples or compas.geometry.Plane\n The slicing planes.... | Slice a mesh by a list of planes.
Parameters
----------
mesh : tuple of vertices and faces
The mesh to slice.
planes : list of (point, normal) tuples or compas.geometry.Plane
The slicing planes.
Returns
-------
list of arrays
The points defining the slice polylines.
Examples
--------
>>> from compas.geom... | src/compas_rhino/geometry/trimesh/slice.py | trimesh_slice | tkmmark/compas | 235 | python | @plugin(category='trimesh', requires=['Rhino'])
def trimesh_slice(mesh, planes):
'Slice a mesh by a list of planes.\n\n Parameters\n ----------\n mesh : tuple of vertices and faces\n The mesh to slice.\n planes : list of (point, normal) tuples or compas.geometry.Plane\n The slicing planes.... | @plugin(category='trimesh', requires=['Rhino'])
def trimesh_slice(mesh, planes):
'Slice a mesh by a list of planes.\n\n Parameters\n ----------\n mesh : tuple of vertices and faces\n The mesh to slice.\n planes : list of (point, normal) tuples or compas.geometry.Plane\n The slicing planes.... |
fd0c9c0c91c21dab091daaa02b8ac5ab62298f7437618773aad0ea5686dbcb84 | def add_to_stream_buffer(self, stream_data):
'\n Kick back data to the stream_buffer\n\n If it is not possible to process received stream data (for example, the database is restarting, so its not\n possible to save the data), you can return the data back into the stream_buffer. After a few seco... | Kick back data to the stream_buffer
If it is not possible to process received stream data (for example, the database is restarting, so its not
possible to save the data), you can return the data back into the stream_buffer. After a few seconds you stopped
writing data back to the stream_buffer, the BinanceWebSocketApi... | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | add_to_stream_buffer | johnjdailey/unicorn-binance-websocket-api | 1 | python | def add_to_stream_buffer(self, stream_data):
'\n Kick back data to the stream_buffer\n\n If it is not possible to process received stream data (for example, the database is restarting, so its not\n possible to save the data), you can return the data back into the stream_buffer. After a few seco... | def add_to_stream_buffer(self, stream_data):
'\n Kick back data to the stream_buffer\n\n If it is not possible to process received stream data (for example, the database is restarting, so its not\n possible to save the data), you can return the data back into the stream_buffer. After a few seco... |
19ef57f5cf6a26ca968f10cc0d57e8da799118f2720ad1c180c09f73c22afdbc | def create_stream(self, channels, markets):
'\n Create a websocket stream\n\n :param channels: provide the channels you wish to stream\n :type channels: str, tuple, list, set\n\n :param markets: provide the markets you wish to stream\n :type markets: str, tuple, list, set\n\n ... | Create a websocket stream
:param channels: provide the channels you wish to stream
:type channels: str, tuple, list, set
:param markets: provide the markets you wish to stream
:type markets: str, tuple, list, set
:return: stream_id or False | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | create_stream | johnjdailey/unicorn-binance-websocket-api | 1 | python | def create_stream(self, channels, markets):
'\n Create a websocket stream\n\n :param channels: provide the channels you wish to stream\n :type channels: str, tuple, list, set\n\n :param markets: provide the markets you wish to stream\n :type markets: str, tuple, list, set\n\n ... | def create_stream(self, channels, markets):
'\n Create a websocket stream\n\n :param channels: provide the channels you wish to stream\n :type channels: str, tuple, list, set\n\n :param markets: provide the markets you wish to stream\n :type markets: str, tuple, list, set\n\n ... |
9cd88145da9e5569e2f5b2f1752c1dc15ac796417bce5637934d3caf0c58e36b | def create_websocket_uri(self, channels, markets, stream_id=False, api_key=False, api_secret=False):
'\n Create a websocket URI\n\n :param channels: provide the channels to create the URI\n :type channels: str, tuple, list, set\n\n :param markets: provide the markets to create the URI\n ... | Create a websocket URI
:param channels: provide the channels to create the URI
:type channels: str, tuple, list, set
:param markets: provide the markets to create the URI
:type markets: str, tuple, list, set
:param stream_id: provide a stream_id (only needed for userData Streams (acquiring a listenKey)
:type stream_... | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | create_websocket_uri | johnjdailey/unicorn-binance-websocket-api | 1 | python | def create_websocket_uri(self, channels, markets, stream_id=False, api_key=False, api_secret=False):
'\n Create a websocket URI\n\n :param channels: provide the channels to create the URI\n :type channels: str, tuple, list, set\n\n :param markets: provide the markets to create the URI\n ... | def create_websocket_uri(self, channels, markets, stream_id=False, api_key=False, api_secret=False):
'\n Create a websocket URI\n\n :param channels: provide the channels to create the URI\n :type channels: str, tuple, list, set\n\n :param markets: provide the markets to create the URI\n ... |
93466860398d50ed8d9e36c9b8b50ddbf6d6a3a287ca0e9fa5d47fec72f80909 | def delete_listen_key_by_stream_id(self, stream_id):
'\n Delete a binance listen_key from a specific !userData stream\n\n :param stream_id: id of a !userData stream\n :type stream_id: uuid\n '
if (self.stream_list[stream_id]['listen_key'] is not False):
logging.info((('Binanc... | Delete a binance listen_key from a specific !userData stream
:param stream_id: id of a !userData stream
:type stream_id: uuid | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | delete_listen_key_by_stream_id | johnjdailey/unicorn-binance-websocket-api | 1 | python | def delete_listen_key_by_stream_id(self, stream_id):
'\n Delete a binance listen_key from a specific !userData stream\n\n :param stream_id: id of a !userData stream\n :type stream_id: uuid\n '
if (self.stream_list[stream_id]['listen_key'] is not False):
logging.info((('Binanc... | def delete_listen_key_by_stream_id(self, stream_id):
'\n Delete a binance listen_key from a specific !userData stream\n\n :param stream_id: id of a !userData stream\n :type stream_id: uuid\n '
if (self.stream_list[stream_id]['listen_key'] is not False):
logging.info((('Binanc... |
b82eca7b1f7bbfa6244c854738131f246a78b803fc20a0d107fb32065101d275 | def delete_stream_from_stream_list(self, stream_id):
'\n Delete a stream from the stream_list\n\n Even if a stream crashes or get stopped, its data remains in the BinanceWebSocketApiManager till you stop the\n BinanceWebSocketApiManager itself. If you want to tidy up the stream_list you can use... | Delete a stream from the stream_list
Even if a stream crashes or get stopped, its data remains in the BinanceWebSocketApiManager till you stop the
BinanceWebSocketApiManager itself. If you want to tidy up the stream_list you can use this method.
:param stream_id: id of a stream
:type stream_id: uuid
:return: bool | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | delete_stream_from_stream_list | johnjdailey/unicorn-binance-websocket-api | 1 | python | def delete_stream_from_stream_list(self, stream_id):
'\n Delete a stream from the stream_list\n\n Even if a stream crashes or get stopped, its data remains in the BinanceWebSocketApiManager till you stop the\n BinanceWebSocketApiManager itself. If you want to tidy up the stream_list you can use... | def delete_stream_from_stream_list(self, stream_id):
'\n Delete a stream from the stream_list\n\n Even if a stream crashes or get stopped, its data remains in the BinanceWebSocketApiManager till you stop the\n BinanceWebSocketApiManager itself. If you want to tidy up the stream_list you can use... |
3f60c07fbee863c37d7867bdb9d422ab451f104b300e80c831ee5134fb6fc38c | def get_active_stream_list(self):
'\n Get a list of all active streams\n\n :return: set\n '
stream_list_with_active_streams = {}
for stream_id in self.stream_list:
if (self.stream_list[stream_id]['status'] == 'running'):
stream_list_with_active_streams[stream_id] = s... | Get a list of all active streams
:return: set | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_active_stream_list | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_active_stream_list(self):
'\n Get a list of all active streams\n\n :return: set\n '
stream_list_with_active_streams = {}
for stream_id in self.stream_list:
if (self.stream_list[stream_id]['status'] == 'running'):
stream_list_with_active_streams[stream_id] = s... | def get_active_stream_list(self):
'\n Get a list of all active streams\n\n :return: set\n '
stream_list_with_active_streams = {}
for stream_id in self.stream_list:
if (self.stream_list[stream_id]['status'] == 'running'):
stream_list_with_active_streams[stream_id] = s... |
9405c64c429ba88f88d4c1793ba5be8dc356157129b583676e1dce31f3e61920 | def get_all_receives_last_second(self):
'\n Get the number of all receives of the last second\n\n :return: int\n '
all_receives_last_second = 0
last_second_timestamp = (int(time.time()) - 1)
for stream_id in self.stream_list:
try:
all_receives_last_second += self... | Get the number of all receives of the last second
:return: int | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_all_receives_last_second | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_all_receives_last_second(self):
'\n Get the number of all receives of the last second\n\n :return: int\n '
all_receives_last_second = 0
last_second_timestamp = (int(time.time()) - 1)
for stream_id in self.stream_list:
try:
all_receives_last_second += self... | def get_all_receives_last_second(self):
'\n Get the number of all receives of the last second\n\n :return: int\n '
all_receives_last_second = 0
last_second_timestamp = (int(time.time()) - 1)
for stream_id in self.stream_list:
try:
all_receives_last_second += self... |
dd84ca8c8993a6e492db96676d61794aea08137bbd88ad8ab4bc2e06958345cb | def get_binance_api_status(self):
'\n Get used_weight, last status_code and the timestamp of the last status update\n\n :return: dict\n '
return self.binance_api_status | Get used_weight, last status_code and the timestamp of the last status update
:return: dict | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_binance_api_status | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_binance_api_status(self):
'\n Get used_weight, last status_code and the timestamp of the last status update\n\n :return: dict\n '
return self.binance_api_status | def get_binance_api_status(self):
'\n Get used_weight, last status_code and the timestamp of the last status update\n\n :return: dict\n '
return self.binance_api_status<|docstring|>Get used_weight, last status_code and the timestamp of the last status update
:return: dict<|endoftext|> |
d1266cc8ee267277b70d99a0b3a8f1b61b70840d86cb5a9ed7f422ae1da54db8 | def get_current_receiving_speed(self, stream_id):
'\n Get the receiving speed of the last second in Bytes\n\n :return: int\n '
current_timestamp = int(time.time())
last_timestamp = (current_timestamp - 1)
try:
if (self.stream_list[stream_id]['transfer_rate_per_second']['byte... | Get the receiving speed of the last second in Bytes
:return: int | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_current_receiving_speed | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_current_receiving_speed(self, stream_id):
'\n Get the receiving speed of the last second in Bytes\n\n :return: int\n '
current_timestamp = int(time.time())
last_timestamp = (current_timestamp - 1)
try:
if (self.stream_list[stream_id]['transfer_rate_per_second']['byte... | def get_current_receiving_speed(self, stream_id):
'\n Get the receiving speed of the last second in Bytes\n\n :return: int\n '
current_timestamp = int(time.time())
last_timestamp = (current_timestamp - 1)
try:
if (self.stream_list[stream_id]['transfer_rate_per_second']['byte... |
10273092c17c03ea0708b5256dde658240ac1517a7f40f1b51f84c2fdb2ea981 | def get_exchange(self):
'\n Get the name of the used exchange like "binance.com" or "binance.org-testnet"\n\n :return: str\n '
return self.exchange | Get the name of the used exchange like "binance.com" or "binance.org-testnet"
:return: str | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_exchange | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_exchange(self):
'\n Get the name of the used exchange like "binance.com" or "binance.org-testnet"\n\n :return: str\n '
return self.exchange | def get_exchange(self):
'\n Get the name of the used exchange like "binance.com" or "binance.org-testnet"\n\n :return: str\n '
return self.exchange<|docstring|>Get the name of the used exchange like "binance.com" or "binance.org-testnet"
:return: str<|endoftext|> |
f1cb08105fcd259c9fdd7db42bc4ffdaaf611ad4cf3d6e252eb1ea0ca93ec158 | def get_latest_release_info(self):
'\n Get infos about the latest available release\n\n :return: dict or False\n '
try:
respond = requests.get('https://api.github.com/repos/oliver-zehentleitner/unicorn-binance-websocket-api/releases/latest')
latest_release_info = respond.jso... | Get infos about the latest available release
:return: dict or False | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_latest_release_info | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_latest_release_info(self):
'\n Get infos about the latest available release\n\n :return: dict or False\n '
try:
respond = requests.get('https://api.github.com/repos/oliver-zehentleitner/unicorn-binance-websocket-api/releases/latest')
latest_release_info = respond.jso... | def get_latest_release_info(self):
'\n Get infos about the latest available release\n\n :return: dict or False\n '
try:
respond = requests.get('https://api.github.com/repos/oliver-zehentleitner/unicorn-binance-websocket-api/releases/latest')
latest_release_info = respond.jso... |
7261b6ef61876907fa677bcafc912c7cc1c8a3eda85f1b18c5380c1a45c1d799 | def get_latest_release_info_check_command(self):
'\n Get infos about the latest available `check_unicorn_monitoring_api` release\n \n :return: dict or False\n '
try:
respond = requests.get('https://api.github.com/repos/oliver-zehentleitner/check_unicorn_monitoring_api/release... | Get infos about the latest available `check_unicorn_monitoring_api` release
:return: dict or False | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_latest_release_info_check_command | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_latest_release_info_check_command(self):
'\n Get infos about the latest available `check_unicorn_monitoring_api` release\n \n :return: dict or False\n '
try:
respond = requests.get('https://api.github.com/repos/oliver-zehentleitner/check_unicorn_monitoring_api/release... | def get_latest_release_info_check_command(self):
'\n Get infos about the latest available `check_unicorn_monitoring_api` release\n \n :return: dict or False\n '
try:
respond = requests.get('https://api.github.com/repos/oliver-zehentleitner/check_unicorn_monitoring_api/release... |
7f29c7385053ecdf7e1f26829a5c70ef0e5600d845a540513ff3a2660e52b324 | def get_latest_version(self):
'\n Get the version of the latest available release (cache time 1 hour)\n\n :return: str or False\n '
if ((self.last_update_check_github['status'] is None) or ((self.last_update_check_github['timestamp'] + (60 * 60)) < time.time())):
self.last_update_ch... | Get the version of the latest available release (cache time 1 hour)
:return: str or False | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_latest_version | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_latest_version(self):
'\n Get the version of the latest available release (cache time 1 hour)\n\n :return: str or False\n '
if ((self.last_update_check_github['status'] is None) or ((self.last_update_check_github['timestamp'] + (60 * 60)) < time.time())):
self.last_update_ch... | def get_latest_version(self):
'\n Get the version of the latest available release (cache time 1 hour)\n\n :return: str or False\n '
if ((self.last_update_check_github['status'] is None) or ((self.last_update_check_github['timestamp'] + (60 * 60)) < time.time())):
self.last_update_ch... |
a7cb136772d2b26df8fef327f2ef6ec9b06f4ef8b2e149dcc3667da7ff1b8aa2 | def get_latest_version_check_command(self):
'\n Get the version of the latest available `check_unicorn_monitoring_api` release (cache time 1 hour)\n \n :return: str or False\n '
if ((self.last_update_check_github_check_command['status'] is None) or ((self.last_update_check_github_che... | Get the version of the latest available `check_unicorn_monitoring_api` release (cache time 1 hour)
:return: str or False | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_latest_version_check_command | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_latest_version_check_command(self):
'\n Get the version of the latest available `check_unicorn_monitoring_api` release (cache time 1 hour)\n \n :return: str or False\n '
if ((self.last_update_check_github_check_command['status'] is None) or ((self.last_update_check_github_che... | def get_latest_version_check_command(self):
'\n Get the version of the latest available `check_unicorn_monitoring_api` release (cache time 1 hour)\n \n :return: str or False\n '
if ((self.last_update_check_github_check_command['status'] is None) or ((self.last_update_check_github_che... |
bb38087b6feb695760451926b3efe7e98754f4a155262ec3673def521256b0b8 | def get_listen_key_from_restclient(self, stream_id, api_key, api_secret):
'\n Get a new or cached (<30m) listen_key\n\n :param stream_id: provide a stream_id\n :type stream_id: uuid\n\n :param api_key: provide a valid Binance API key\n :type api_key: str\n\n :param api_secr... | Get a new or cached (<30m) listen_key
:param stream_id: provide a stream_id
:type stream_id: uuid
:param api_key: provide a valid Binance API key
:type api_key: str
:param api_secret: provide a valid Binance API secret
:type api_secret: str
:return: str or False | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_listen_key_from_restclient | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_listen_key_from_restclient(self, stream_id, api_key, api_secret):
'\n Get a new or cached (<30m) listen_key\n\n :param stream_id: provide a stream_id\n :type stream_id: uuid\n\n :param api_key: provide a valid Binance API key\n :type api_key: str\n\n :param api_secr... | def get_listen_key_from_restclient(self, stream_id, api_key, api_secret):
'\n Get a new or cached (<30m) listen_key\n\n :param stream_id: provide a stream_id\n :type stream_id: uuid\n\n :param api_key: provide a valid Binance API key\n :type api_key: str\n\n :param api_secr... |
d7ca60f20fd3e15d54f763a6dcba43791f85f14b7bd1048adaad99e134710237 | def get_most_receives_per_second(self):
'\n Get the highest total receives per second value\n\n :return: int\n '
return self.most_receives_per_second | Get the highest total receives per second value
:return: int | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_most_receives_per_second | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_most_receives_per_second(self):
'\n Get the highest total receives per second value\n\n :return: int\n '
return self.most_receives_per_second | def get_most_receives_per_second(self):
'\n Get the highest total receives per second value\n\n :return: int\n '
return self.most_receives_per_second<|docstring|>Get the highest total receives per second value
:return: int<|endoftext|> |
ab926c0e6eef0acb3a1c4079847ec9ccaa308249d78cd0fbb0dc5c77b901ab32 | def get_number_of_streams_in_stream_list(self):
'\n Get the number of streams that are stored in the stream_list\n\n :return: int\n '
return len(self.stream_list) | Get the number of streams that are stored in the stream_list
:return: int | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_number_of_streams_in_stream_list | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_number_of_streams_in_stream_list(self):
'\n Get the number of streams that are stored in the stream_list\n\n :return: int\n '
return len(self.stream_list) | def get_number_of_streams_in_stream_list(self):
'\n Get the number of streams that are stored in the stream_list\n\n :return: int\n '
return len(self.stream_list)<|docstring|>Get the number of streams that are stored in the stream_list
:return: int<|endoftext|> |
89eb8123bf3f8c18b3064081f2c4816fa832992adad7277180b8a8f1a49b06d9 | def get_keep_max_received_last_second_entries(self):
'\n Get the number of how much received_last_second entries are stored till they get deleted\n\n :return: int\n '
return self.keep_max_received_last_second_entries | Get the number of how much received_last_second entries are stored till they get deleted
:return: int | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_keep_max_received_last_second_entries | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_keep_max_received_last_second_entries(self):
'\n Get the number of how much received_last_second entries are stored till they get deleted\n\n :return: int\n '
return self.keep_max_received_last_second_entries | def get_keep_max_received_last_second_entries(self):
'\n Get the number of how much received_last_second entries are stored till they get deleted\n\n :return: int\n '
return self.keep_max_received_last_second_entries<|docstring|>Get the number of how much received_last_second entries are st... |
13e9db5bf2528155320b944feda803d22f412f045cac083154cdb203e3ace80e | def get_monitoring_status_icinga(self, check_command_version=False, warn_on_update=True):
'\n Get status and perfdata to monitor and collect metrics with ICINGA/Nagios\n\n :param check_command_version: is the version of the calling check_command (https://github.com/oliver-zehentleitner/check_unicorn_m... | Get status and perfdata to monitor and collect metrics with ICINGA/Nagios
:param check_command_version: is the version of the calling check_command (https://github.com/oliver-zehentleitner/check_unicorn_monitoring_api)
:type check_command_version: str
:param warn_on_update: set to `False` to disable the update warnin... | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_monitoring_status_icinga | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_monitoring_status_icinga(self, check_command_version=False, warn_on_update=True):
'\n Get status and perfdata to monitor and collect metrics with ICINGA/Nagios\n\n :param check_command_version: is the version of the calling check_command (https://github.com/oliver-zehentleitner/check_unicorn_m... | def get_monitoring_status_icinga(self, check_command_version=False, warn_on_update=True):
'\n Get status and perfdata to monitor and collect metrics with ICINGA/Nagios\n\n :param check_command_version: is the version of the calling check_command (https://github.com/oliver-zehentleitner/check_unicorn_m... |
6ea5caf0a97762d15c4a314be471c090f47bda6ac74c1491e71fbb6b8e0b8676 | def get_monitoring_status_plain(self, check_command_version=False, warn_on_update=True):
'\n Get plain monitoring status data:\n active_streams, crashed_streams, restarting_streams, stopped_streams, return_code, status_text,\n timestamp, update_msg, average_receives_per_second, average_speed_pe... | Get plain monitoring status data:
active_streams, crashed_streams, restarting_streams, stopped_streams, return_code, status_text,
timestamp, update_msg, average_receives_per_second, average_speed_per_second, total_received_mb,
stream_buffer_items, stream_buffer_mb, reconnects, uptime
:param check_command_version: is t... | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_monitoring_status_plain | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_monitoring_status_plain(self, check_command_version=False, warn_on_update=True):
'\n Get plain monitoring status data:\n active_streams, crashed_streams, restarting_streams, stopped_streams, return_code, status_text,\n timestamp, update_msg, average_receives_per_second, average_speed_pe... | def get_monitoring_status_plain(self, check_command_version=False, warn_on_update=True):
'\n Get plain monitoring status data:\n active_streams, crashed_streams, restarting_streams, stopped_streams, return_code, status_text,\n timestamp, update_msg, average_receives_per_second, average_speed_pe... |
0559f5b50ebc35fe7e5baa1e996e03c680d3b389c795920ddfbc8231f83b1ab2 | def get_reconnects(self):
'\n Get the number of total reconnects\n\n :return: int\n '
return self.reconnects | Get the number of total reconnects
:return: int | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_reconnects | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_reconnects(self):
'\n Get the number of total reconnects\n\n :return: int\n '
return self.reconnects | def get_reconnects(self):
'\n Get the number of total reconnects\n\n :return: int\n '
return self.reconnects<|docstring|>Get the number of total reconnects
:return: int<|endoftext|> |
4af314060f25e01db0508e25f4f2dad5ae9cf265fa5d89bf80ef6ac668d841f4 | def get_start_time(self):
'\n Get the start_time of the BinanceWebSocketApiManager instance\n\n :return: timestamp\n '
return self.start_time | Get the start_time of the BinanceWebSocketApiManager instance
:return: timestamp | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_start_time | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_start_time(self):
'\n Get the start_time of the BinanceWebSocketApiManager instance\n\n :return: timestamp\n '
return self.start_time | def get_start_time(self):
'\n Get the start_time of the BinanceWebSocketApiManager instance\n\n :return: timestamp\n '
return self.start_time<|docstring|>Get the start_time of the BinanceWebSocketApiManager instance
:return: timestamp<|endoftext|> |
05f4ed59a9884f21e9353dae26ef99e38ee4492262e2da1102a020023e1138c1 | def get_stream_buffer_byte_size(self):
'\n Get the current byte size of the stream_buffer\n\n :return: int\n '
return sys.getsizeof(self.stream_buffer) | Get the current byte size of the stream_buffer
:return: int | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_stream_buffer_byte_size | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_stream_buffer_byte_size(self):
'\n Get the current byte size of the stream_buffer\n\n :return: int\n '
return sys.getsizeof(self.stream_buffer) | def get_stream_buffer_byte_size(self):
'\n Get the current byte size of the stream_buffer\n\n :return: int\n '
return sys.getsizeof(self.stream_buffer)<|docstring|>Get the current byte size of the stream_buffer
:return: int<|endoftext|> |
e062a8dcc30f484df9108e28427a6e97c93ab9786e7547746eb479fe60a3420c | def get_stream_buffer_length(self):
'\n Get the current number of items in the stream_buffer\n\n :return: int\n '
return len(self.stream_buffer) | Get the current number of items in the stream_buffer
:return: int | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_stream_buffer_length | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_stream_buffer_length(self):
'\n Get the current number of items in the stream_buffer\n\n :return: int\n '
return len(self.stream_buffer) | def get_stream_buffer_length(self):
'\n Get the current number of items in the stream_buffer\n\n :return: int\n '
return len(self.stream_buffer)<|docstring|>Get the current number of items in the stream_buffer
:return: int<|endoftext|> |
0a21935b074d99fcc211ffb32bf9fa68cabbf9fa83a2878e25e69edf4b7cbf3c | def get_stream_info(self, stream_id):
'\n Get infos about a specific stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n :return: set\n '
current_timestamp = time.time()
try:
temp_stream_list = copy.deepcopy(self.stream_list)
except RuntimeErr... | Get infos about a specific stream
:param stream_id: id of a stream
:type stream_id: uuid
:return: set | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_stream_info | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_stream_info(self, stream_id):
'\n Get infos about a specific stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n :return: set\n '
current_timestamp = time.time()
try:
temp_stream_list = copy.deepcopy(self.stream_list)
except RuntimeErr... | def get_stream_info(self, stream_id):
'\n Get infos about a specific stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n :return: set\n '
current_timestamp = time.time()
try:
temp_stream_list = copy.deepcopy(self.stream_list)
except RuntimeErr... |
20dc599b3cf568f681a55cea0cc78d251d1bfdf50552faa0a8412a42a378715c | def get_stream_list(self):
'\n Get a list of all streams\n\n :return: set\n '
temp_stream_list = {}
for stream_id in self.stream_list:
temp_stream_list[stream_id] = self.get_stream_info(stream_id)
return temp_stream_list | Get a list of all streams
:return: set | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_stream_list | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_stream_list(self):
'\n Get a list of all streams\n\n :return: set\n '
temp_stream_list = {}
for stream_id in self.stream_list:
temp_stream_list[stream_id] = self.get_stream_info(stream_id)
return temp_stream_list | def get_stream_list(self):
'\n Get a list of all streams\n\n :return: set\n '
temp_stream_list = {}
for stream_id in self.stream_list:
temp_stream_list[stream_id] = self.get_stream_info(stream_id)
return temp_stream_list<|docstring|>Get a list of all streams
:return: set<|e... |
05f468644fb22fc8c8571fadd409e4a70e184b0ef1eb3645aa883770603aa88d | def get_stream_receives_last_second(self, stream_id):
'\n Get the number of receives of specific stream from the last seconds\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n :return: int\n '
last_second_timestamp = (int(time.time()) - 1)
try:
return ... | Get the number of receives of specific stream from the last seconds
:param stream_id: id of a stream
:type stream_id: uuid
:return: int | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_stream_receives_last_second | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_stream_receives_last_second(self, stream_id):
'\n Get the number of receives of specific stream from the last seconds\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n :return: int\n '
last_second_timestamp = (int(time.time()) - 1)
try:
return ... | def get_stream_receives_last_second(self, stream_id):
'\n Get the number of receives of specific stream from the last seconds\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n :return: int\n '
last_second_timestamp = (int(time.time()) - 1)
try:
return ... |
1fa393a1c985ae4e8c231cf43773231373437fa71b6062d58fec54b172ba8955 | def get_stream_statistic(self, stream_id):
'\n Get the statistic of a specific stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n :return: set\n '
stream_statistic = {'stream_receives_per_second': 0, 'stream_receives_per_minute': 0, 'stream_receives_per_hour... | Get the statistic of a specific stream
:param stream_id: id of a stream
:type stream_id: uuid
:return: set | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_stream_statistic | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_stream_statistic(self, stream_id):
'\n Get the statistic of a specific stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n :return: set\n '
stream_statistic = {'stream_receives_per_second': 0, 'stream_receives_per_minute': 0, 'stream_receives_per_hour... | def get_stream_statistic(self, stream_id):
'\n Get the statistic of a specific stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n :return: set\n '
stream_statistic = {'stream_receives_per_second': 0, 'stream_receives_per_minute': 0, 'stream_receives_per_hour... |
18366876993e1fa5f4f1980e0c6f395a5e98e896515185343e0622ddbbb8cb5a | def get_total_received_bytes(self):
'\n Get number of total received bytes\n\n :return: int\n '
return self.total_received_bytes | Get number of total received bytes
:return: int | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_total_received_bytes | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_total_received_bytes(self):
'\n Get number of total received bytes\n\n :return: int\n '
return self.total_received_bytes | def get_total_received_bytes(self):
'\n Get number of total received bytes\n\n :return: int\n '
return self.total_received_bytes<|docstring|>Get number of total received bytes
:return: int<|endoftext|> |
a8289fb452c94e4b29ea2862672bc2bc947e05c5c6d2a1bd64ae7e6ea1c8efa5 | def get_total_receives(self):
'\n Get the number of total receives\n\n :return: int\n '
return self.total_receives | Get the number of total receives
:return: int | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_total_receives | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_total_receives(self):
'\n Get the number of total receives\n\n :return: int\n '
return self.total_receives | def get_total_receives(self):
'\n Get the number of total receives\n\n :return: int\n '
return self.total_receives<|docstring|>Get the number of total receives
:return: int<|endoftext|> |
e8ac174052dd4556cd6531833cc87efd4f4c4bda7b2a7e2a50893d8793c6911f | def get_version(self):
'\n Get the package/module version\n\n :return: str\n '
return self.version | Get the package/module version
:return: str | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_version | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_version(self):
'\n Get the package/module version\n\n :return: str\n '
return self.version | def get_version(self):
'\n Get the package/module version\n\n :return: str\n '
return self.version<|docstring|>Get the package/module version
:return: str<|endoftext|> |
acf0ae890bba378d112aa56a471e1f4594509873826c7076b32327408ee20bdd | def get_websocket_uri_length(self, channels, markets):
'\n Get the length of the generated websocket URI\n\n :param channels: provide the channels to create the URI\n :type channels: str, tuple, list, set\n\n :param markets: provide the markets to create the URI\n :type markets: s... | Get the length of the generated websocket URI
:param channels: provide the channels to create the URI
:type channels: str, tuple, list, set
:param markets: provide the markets to create the URI
:type markets: str, tuple, list, set
:return: int | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | get_websocket_uri_length | johnjdailey/unicorn-binance-websocket-api | 1 | python | def get_websocket_uri_length(self, channels, markets):
'\n Get the length of the generated websocket URI\n\n :param channels: provide the channels to create the URI\n :type channels: str, tuple, list, set\n\n :param markets: provide the markets to create the URI\n :type markets: s... | def get_websocket_uri_length(self, channels, markets):
'\n Get the length of the generated websocket URI\n\n :param channels: provide the channels to create the URI\n :type channels: str, tuple, list, set\n\n :param markets: provide the markets to create the URI\n :type markets: s... |
27b151fdd402a8666a9ed7f5b935063c36e5c1b2cfe5a0c2c425c440ffb861d5 | def is_manager_stopping(self):
"\n Returns `True` if the manager has a stop request, 'False' if not.\n\n :return: bool\n "
if (self.stop_manager_request is None):
return False
else:
return True | Returns `True` if the manager has a stop request, 'False' if not.
:return: bool | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | is_manager_stopping | johnjdailey/unicorn-binance-websocket-api | 1 | python | def is_manager_stopping(self):
"\n Returns `True` if the manager has a stop request, 'False' if not.\n\n :return: bool\n "
if (self.stop_manager_request is None):
return False
else:
return True | def is_manager_stopping(self):
"\n Returns `True` if the manager has a stop request, 'False' if not.\n\n :return: bool\n "
if (self.stop_manager_request is None):
return False
else:
return True<|docstring|>Returns `True` if the manager has a stop request, 'False' if not.... |
e14de21cd50eb9df35a67efb7b2316b29bfe90b3d0c6a90ff334dbec2cddc97e | def is_stop_request(self, stream_id):
'\n Has a specific stream a stop_request?\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n :return: bool\n '
logging.debug((('BinanceWebSocketApiManager->is_stop_request(' + str(stream_id)) + ')'))
if (self.stream_list[st... | Has a specific stream a stop_request?
:param stream_id: id of a stream
:type stream_id: uuid
:return: bool | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | is_stop_request | johnjdailey/unicorn-binance-websocket-api | 1 | python | def is_stop_request(self, stream_id):
'\n Has a specific stream a stop_request?\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n :return: bool\n '
logging.debug((('BinanceWebSocketApiManager->is_stop_request(' + str(stream_id)) + ')'))
if (self.stream_list[st... | def is_stop_request(self, stream_id):
'\n Has a specific stream a stop_request?\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n :return: bool\n '
logging.debug((('BinanceWebSocketApiManager->is_stop_request(' + str(stream_id)) + ')'))
if (self.stream_list[st... |
d4267f8b91dcf1513222427ad0c51857d74cf1d7d0cd2b239bbfb97ed2f3191d | def is_update_availabe(self):
'\n Is a new release of this package available?\n\n :return: bool\n '
installed_version = self.get_version()
if ('.dev' in installed_version):
installed_version = installed_version[:(- 4)]
if (self.get_latest_version() == installed_version):
... | Is a new release of this package available?
:return: bool | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | is_update_availabe | johnjdailey/unicorn-binance-websocket-api | 1 | python | def is_update_availabe(self):
'\n Is a new release of this package available?\n\n :return: bool\n '
installed_version = self.get_version()
if ('.dev' in installed_version):
installed_version = installed_version[:(- 4)]
if (self.get_latest_version() == installed_version):
... | def is_update_availabe(self):
'\n Is a new release of this package available?\n\n :return: bool\n '
installed_version = self.get_version()
if ('.dev' in installed_version):
installed_version = installed_version[:(- 4)]
if (self.get_latest_version() == installed_version):
... |
23fe2803bf2eb2ba73fbfb59c3c8e73e7e8b0d0eca6f21fb5e9b016fcca3d955 | def is_update_availabe_check_command(self, check_command_version=False):
'\n Is a new release of `check_unicorn_monitoring_api` available?\n\n :return: bool\n '
installed_version = check_command_version
latest_version = self.get_latest_version_check_command()
if ('.dev' in installed... | Is a new release of `check_unicorn_monitoring_api` available?
:return: bool | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | is_update_availabe_check_command | johnjdailey/unicorn-binance-websocket-api | 1 | python | def is_update_availabe_check_command(self, check_command_version=False):
'\n Is a new release of `check_unicorn_monitoring_api` available?\n\n :return: bool\n '
installed_version = check_command_version
latest_version = self.get_latest_version_check_command()
if ('.dev' in installed... | def is_update_availabe_check_command(self, check_command_version=False):
'\n Is a new release of `check_unicorn_monitoring_api` available?\n\n :return: bool\n '
installed_version = check_command_version
latest_version = self.get_latest_version_check_command()
if ('.dev' in installed... |
e9caf8e85b78d7844de8f110c28c84d88d477a8e603f1ecce9a04a8d01c9dbec | def is_websocket_uri_length_valid(self, channels, markets):
'\n Is the websocket URI length valid?\n\n Binance DEX is using the subscribe methods, so this function must not get used with them and will always return!\n `False`\n\n A test with https://github.com/oliver-zehentleitner/unicor... | Is the websocket URI length valid?
Binance DEX is using the subscribe methods, so this function must not get used with them and will always return!
`False`
A test with https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/blob/master/tools/test_max_websocket_uri_length.py
indicates that the allowed ma... | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | is_websocket_uri_length_valid | johnjdailey/unicorn-binance-websocket-api | 1 | python | def is_websocket_uri_length_valid(self, channels, markets):
'\n Is the websocket URI length valid?\n\n Binance DEX is using the subscribe methods, so this function must not get used with them and will always return!\n `False`\n\n A test with https://github.com/oliver-zehentleitner/unicor... | def is_websocket_uri_length_valid(self, channels, markets):
'\n Is the websocket URI length valid?\n\n Binance DEX is using the subscribe methods, so this function must not get used with them and will always return!\n `False`\n\n A test with https://github.com/oliver-zehentleitner/unicor... |
d71f14740f8f22c603cdf49353b18b06c2777f24ad8a77a59d8efec107fb7e71 | def pop_stream_data_from_stream_buffer(self):
'\n Get oldest entry from stream_buffer and remove from stack (FIFO stack)\n\n :return: raw_stream_data (set) or False\n '
try:
stream_data = self.stream_buffer.pop(0)
return stream_data
except IndexError:
return Fals... | Get oldest entry from stream_buffer and remove from stack (FIFO stack)
:return: raw_stream_data (set) or False | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | pop_stream_data_from_stream_buffer | johnjdailey/unicorn-binance-websocket-api | 1 | python | def pop_stream_data_from_stream_buffer(self):
'\n Get oldest entry from stream_buffer and remove from stack (FIFO stack)\n\n :return: raw_stream_data (set) or False\n '
try:
stream_data = self.stream_buffer.pop(0)
return stream_data
except IndexError:
return Fals... | def pop_stream_data_from_stream_buffer(self):
'\n Get oldest entry from stream_buffer and remove from stack (FIFO stack)\n\n :return: raw_stream_data (set) or False\n '
try:
stream_data = self.stream_buffer.pop(0)
return stream_data
except IndexError:
return Fals... |
abd20177a2b31d40a1c7c9a10d36b638109f91f868b4ed31883925e1d1a08fdc | def print_stream_info(self, stream_id, add_string=''):
'\n Print all infos about a specific stream, helps debugging :)\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n :param add_string: text to add to the output\n :type add_string: str\n :return: bool\n ... | Print all infos about a specific stream, helps debugging :)
:param stream_id: id of a stream
:type stream_id: uuid
:param add_string: text to add to the output
:type add_string: str
:return: bool | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | print_stream_info | johnjdailey/unicorn-binance-websocket-api | 1 | python | def print_stream_info(self, stream_id, add_string=):
'\n Print all infos about a specific stream, helps debugging :)\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n :param add_string: text to add to the output\n :type add_string: str\n :return: bool\n ... | def print_stream_info(self, stream_id, add_string=):
'\n Print all infos about a specific stream, helps debugging :)\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n :param add_string: text to add to the output\n :type add_string: str\n :return: bool\n ... |
ae643439a313f58fb079e823295784a225619dfdb08660456d7e64282d43001e | def print_summary(self, add_string=''):
'\n Print an overview of all streams\n \n :param add_string: text to add to the output\n :type add_string: str\n '
streams = len(self.stream_list)
active_streams = 0
crashed_streams = 0
restarting_streams = 0
stopped_stre... | Print an overview of all streams
:param add_string: text to add to the output
:type add_string: str | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | print_summary | johnjdailey/unicorn-binance-websocket-api | 1 | python | def print_summary(self, add_string=):
'\n Print an overview of all streams\n \n :param add_string: text to add to the output\n :type add_string: str\n '
streams = len(self.stream_list)
active_streams = 0
crashed_streams = 0
restarting_streams = 0
stopped_stream... | def print_summary(self, add_string=):
'\n Print an overview of all streams\n \n :param add_string: text to add to the output\n :type add_string: str\n '
streams = len(self.stream_list)
active_streams = 0
crashed_streams = 0
restarting_streams = 0
stopped_stream... |
051680e6a4778f3ea191ef83f4f076894a133d00eab9dd0361a11313993ddf67 | def replace_stream(self, stream_id, new_channels, new_markets):
'\n Replace a stream\n\n If you want to start a stream with a new config, its recommended, to first start a new stream with the new\n settings and close the old stream not before the new stream received its first data. So your data... | Replace a stream
If you want to start a stream with a new config, its recommended, to first start a new stream with the new
settings and close the old stream not before the new stream received its first data. So your data will stay
consistent.
:param stream_id: id of the old stream
:type stream_id: uuid
:param new_c... | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | replace_stream | johnjdailey/unicorn-binance-websocket-api | 1 | python | def replace_stream(self, stream_id, new_channels, new_markets):
'\n Replace a stream\n\n If you want to start a stream with a new config, its recommended, to first start a new stream with the new\n settings and close the old stream not before the new stream received its first data. So your data... | def replace_stream(self, stream_id, new_channels, new_markets):
'\n Replace a stream\n\n If you want to start a stream with a new config, its recommended, to first start a new stream with the new\n settings and close the old stream not before the new stream received its first data. So your data... |
2c8c460ec43c7ee3098a15383a5e8e69940947b88728ede5d04508dbf4a07c6d | def restart_stream(self, stream_id):
'\n Restart a specific stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :return: stream_id\n '
logging.info((((('BinanceWebSocketApiManager->restart_stream(' + str(self.stream_list[stream_id]['channels'])) + ', ') + s... | Restart a specific stream
:param stream_id: id of a stream
:type stream_id: uuid
:return: stream_id | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | restart_stream | johnjdailey/unicorn-binance-websocket-api | 1 | python | def restart_stream(self, stream_id):
'\n Restart a specific stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :return: stream_id\n '
logging.info((((('BinanceWebSocketApiManager->restart_stream(' + str(self.stream_list[stream_id]['channels'])) + ', ') + s... | def restart_stream(self, stream_id):
'\n Restart a specific stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :return: stream_id\n '
logging.info((((('BinanceWebSocketApiManager->restart_stream(' + str(self.stream_list[stream_id]['channels'])) + ', ') + s... |
448ea8a7635ed7e1788270ba2b5a03f62857c33ae10b57d0bb22ef9958a72a45 | def set_private_api_config(self, binance_api_key, binance_api_secret):
'\n Set binance_api_key and binance_api_secret\n\n This settings are needed to acquire a listenKey from Binance to establish a userData stream\n\n :param binance_api_key: The Binance API key\n :type binance_api_key: s... | Set binance_api_key and binance_api_secret
This settings are needed to acquire a listenKey from Binance to establish a userData stream
:param binance_api_key: The Binance API key
:type binance_api_key: str
:param binance_api_secret: The Binance API secret
:type binance_api_secret: str | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | set_private_api_config | johnjdailey/unicorn-binance-websocket-api | 1 | python | def set_private_api_config(self, binance_api_key, binance_api_secret):
'\n Set binance_api_key and binance_api_secret\n\n This settings are needed to acquire a listenKey from Binance to establish a userData stream\n\n :param binance_api_key: The Binance API key\n :type binance_api_key: s... | def set_private_api_config(self, binance_api_key, binance_api_secret):
'\n Set binance_api_key and binance_api_secret\n\n This settings are needed to acquire a listenKey from Binance to establish a userData stream\n\n :param binance_api_key: The Binance API key\n :type binance_api_key: s... |
b16161d360205fa44032f11db787234ff93b70dce1606efae4e88e40efc079e8 | def set_private_dex_config(self, binance_dex_user_address):
'\n Set binance_dex_user_address\n\n Is going to be the default user_address, once the websocket is created with this default value, its not possible\n to change it. If you plan to use different user_address its recommended to not use ... | Set binance_dex_user_address
Is going to be the default user_address, once the websocket is created with this default value, its not possible
to change it. If you plan to use different user_address its recommended to not use this method! Just provide the
user_address with create_stream() in the market parameter. | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | set_private_dex_config | johnjdailey/unicorn-binance-websocket-api | 1 | python | def set_private_dex_config(self, binance_dex_user_address):
'\n Set binance_dex_user_address\n\n Is going to be the default user_address, once the websocket is created with this default value, its not possible\n to change it. If you plan to use different user_address its recommended to not use ... | def set_private_dex_config(self, binance_dex_user_address):
'\n Set binance_dex_user_address\n\n Is going to be the default user_address, once the websocket is created with this default value, its not possible\n to change it. If you plan to use different user_address its recommended to not use ... |
cc8434484515916eff9285fbaec0f4ca583de6523513aa57a73108f402436a27 | def start_monitoring_api(self, host='127.0.0.1', port=64201, warn_on_update=True):
'\n Start the monitoring API server\n\n :param host: listening ip address, use 0.0.0.0 or a specific address (default: 127.0.0.1)\n :type host: str\n\n :param port: listening port number (default: 64201)\n... | Start the monitoring API server
:param host: listening ip address, use 0.0.0.0 or a specific address (default: 127.0.0.1)
:type host: str
:param port: listening port number (default: 64201)
:type port: int
:param warn_on_update: set to `False` to disable the update warning
:type warn_on_update: bool | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | start_monitoring_api | johnjdailey/unicorn-binance-websocket-api | 1 | python | def start_monitoring_api(self, host='127.0.0.1', port=64201, warn_on_update=True):
'\n Start the monitoring API server\n\n :param host: listening ip address, use 0.0.0.0 or a specific address (default: 127.0.0.1)\n :type host: str\n\n :param port: listening port number (default: 64201)\n... | def start_monitoring_api(self, host='127.0.0.1', port=64201, warn_on_update=True):
'\n Start the monitoring API server\n\n :param host: listening ip address, use 0.0.0.0 or a specific address (default: 127.0.0.1)\n :type host: str\n\n :param port: listening port number (default: 64201)\n... |
3fa76664356cb00c59e7d6ca0085b4a985e300c028576e2dfa82e59ed7067eba | def stop_manager_with_all_streams(self):
'\n Stop the BinanceWebSocketApiManager with all streams and management threads\n '
self.stop_manager_request = True
for stream_id in self.stream_list:
self.stop_stream(stream_id)
self.stop_monitoring_api() | Stop the BinanceWebSocketApiManager with all streams and management threads | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | stop_manager_with_all_streams | johnjdailey/unicorn-binance-websocket-api | 1 | python | def stop_manager_with_all_streams(self):
'\n \n '
self.stop_manager_request = True
for stream_id in self.stream_list:
self.stop_stream(stream_id)
self.stop_monitoring_api() | def stop_manager_with_all_streams(self):
'\n \n '
self.stop_manager_request = True
for stream_id in self.stream_list:
self.stop_stream(stream_id)
self.stop_monitoring_api()<|docstring|>Stop the BinanceWebSocketApiManager with all streams and management threads<|endoftext|> |
bf3e8d66d971a23c75862d62602aae800307b1553cbf52c46c9bbdac84d11bd3 | def stop_monitoring_api(self):
'\n Stop the monitoring API service\n '
try:
self.monitoring_api_server.stop()
except AttributeError as error_msg:
logging.debug(('can not execute self.monitoring_api_server.stop() - info: ' + str(error_msg))) | Stop the monitoring API service | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | stop_monitoring_api | johnjdailey/unicorn-binance-websocket-api | 1 | python | def stop_monitoring_api(self):
'\n \n '
try:
self.monitoring_api_server.stop()
except AttributeError as error_msg:
logging.debug(('can not execute self.monitoring_api_server.stop() - info: ' + str(error_msg))) | def stop_monitoring_api(self):
'\n \n '
try:
self.monitoring_api_server.stop()
except AttributeError as error_msg:
logging.debug(('can not execute self.monitoring_api_server.stop() - info: ' + str(error_msg)))<|docstring|>Stop the monitoring API service<|endoftext|> |
f15340b8156890bbd9be0f689564facc1b6c809e8c093940d3a26f3d566009be | def stop_stream(self, stream_id):
'\n Stop a specific stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :return: bool\n '
logging.info((('BinanceWebSocketApiManager->stop_stream(' + str(stream_id)) + ')'))
try:
del self.restart_requests[stream... | Stop a specific stream
:param stream_id: id of a stream
:type stream_id: uuid
:return: bool | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | stop_stream | johnjdailey/unicorn-binance-websocket-api | 1 | python | def stop_stream(self, stream_id):
'\n Stop a specific stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :return: bool\n '
logging.info((('BinanceWebSocketApiManager->stop_stream(' + str(stream_id)) + ')'))
try:
del self.restart_requests[stream... | def stop_stream(self, stream_id):
'\n Stop a specific stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :return: bool\n '
logging.info((('BinanceWebSocketApiManager->stop_stream(' + str(stream_id)) + ')'))
try:
del self.restart_requests[stream... |
5ccbd262547d14cfe547f82c75bcc04a45040118dc94704207387187ed9928c3 | def subscribe_to_stream(self, stream_id, channels=[], markets=[]):
'\n Notice: This method only works with DEX!\n\n Subscribe channels, markets or an array of them to an exisiting DEX stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :param channels: provide ... | Notice: This method only works with DEX!
Subscribe channels, markets or an array of them to an exisiting DEX stream
:param stream_id: id of a stream
:type stream_id: uuid
:param channels: provide the channels you wish to stream
:type channels: str, tuple, list, set
:param markets: provide the markets you wish to st... | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | subscribe_to_stream | johnjdailey/unicorn-binance-websocket-api | 1 | python | def subscribe_to_stream(self, stream_id, channels=[], markets=[]):
'\n Notice: This method only works with DEX!\n\n Subscribe channels, markets or an array of them to an exisiting DEX stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :param channels: provide ... | def subscribe_to_stream(self, stream_id, channels=[], markets=[]):
'\n Notice: This method only works with DEX!\n\n Subscribe channels, markets or an array of them to an exisiting DEX stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :param channels: provide ... |
cdfe3f15e966a28f843b2f869e2cc933918a80f3a6a83272d0aeb596b864a9b3 | def unsubscribe_from_stream(self, stream_id, channels, markets):
'\n Notice: This method only works with DEX!\n\n Unsubscribe channels, markets or an array of them from an exisiting DEX stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :param channels: provid... | Notice: This method only works with DEX!
Unsubscribe channels, markets or an array of them from an exisiting DEX stream
:param stream_id: id of a stream
:type stream_id: uuid
:param channels: provide the channels you wish to stream
:type channels: str, tuple, list, set
:param markets: provide the markets you wish t... | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | unsubscribe_from_stream | johnjdailey/unicorn-binance-websocket-api | 1 | python | def unsubscribe_from_stream(self, stream_id, channels, markets):
'\n Notice: This method only works with DEX!\n\n Unsubscribe channels, markets or an array of them from an exisiting DEX stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :param channels: provid... | def unsubscribe_from_stream(self, stream_id, channels, markets):
'\n Notice: This method only works with DEX!\n\n Unsubscribe channels, markets or an array of them from an exisiting DEX stream\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :param channels: provid... |
eae2cdaba1e93b272563b3a348ae0c390533c518fc5928c3f4c7e61372354871 | def wait_till_stream_has_started(self, stream_id):
'\n Returns `True` as soon a specific stream has started\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :return: True\n '
while (self.stream_list[stream_id]['last_heartbeat'] is None):
time.sleep(0.2)... | Returns `True` as soon a specific stream has started
:param stream_id: id of a stream
:type stream_id: uuid
:return: True | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | wait_till_stream_has_started | johnjdailey/unicorn-binance-websocket-api | 1 | python | def wait_till_stream_has_started(self, stream_id):
'\n Returns `True` as soon a specific stream has started\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :return: True\n '
while (self.stream_list[stream_id]['last_heartbeat'] is None):
time.sleep(0.2)... | def wait_till_stream_has_started(self, stream_id):
'\n Returns `True` as soon a specific stream has started\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :return: True\n '
while (self.stream_list[stream_id]['last_heartbeat'] is None):
time.sleep(0.2)... |
4b8a9761cc6c3fd814958500d89552d8e85ebb4f0b923e88c80e00294035aa13 | def wait_till_stream_has_stopped(self, stream_id):
'\n Returns `True` as soon a specific stream has stopped itself\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :return: True\n '
while (self.stream_list[stream_id]['has_stopped'] is False):
time.sleep... | Returns `True` as soon a specific stream has stopped itself
:param stream_id: id of a stream
:type stream_id: uuid
:return: True | unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py | wait_till_stream_has_stopped | johnjdailey/unicorn-binance-websocket-api | 1 | python | def wait_till_stream_has_stopped(self, stream_id):
'\n Returns `True` as soon a specific stream has stopped itself\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :return: True\n '
while (self.stream_list[stream_id]['has_stopped'] is False):
time.sleep... | def wait_till_stream_has_stopped(self, stream_id):
'\n Returns `True` as soon a specific stream has stopped itself\n\n :param stream_id: id of a stream\n :type stream_id: uuid\n\n :return: True\n '
while (self.stream_list[stream_id]['has_stopped'] is False):
time.sleep... |
47eb5b52afe47a620066bd4ccf199a1102d1b9cad6fd2cf50c7f3330edc422d6 | def db_for_read(self, model, **hints):
'\n Attempts to read auth and contenttypes models go to auth_db.\n '
if (model._meta.app_label in self.route_app_labels):
return EXODUS_DB_NAME
return None | Attempts to read auth and contenttypes models go to auth_db. | exodus/utils/db.py | db_for_read | MinchinWeb/exodus | 0 | python | def db_for_read(self, model, **hints):
'\n \n '
if (model._meta.app_label in self.route_app_labels):
return EXODUS_DB_NAME
return None | def db_for_read(self, model, **hints):
'\n \n '
if (model._meta.app_label in self.route_app_labels):
return EXODUS_DB_NAME
return None<|docstring|>Attempts to read auth and contenttypes models go to auth_db.<|endoftext|> |
73817caf49e918289e8e37840bb3dcc309d500672f547f5bb71e6dbf65bcb191 | def db_for_write(self, model, **hints):
'\n Attempts to write auth and contenttypes models go to auth_db.\n '
if (model._meta.app_label in self.route_app_labels):
return EXODUS_DB_NAME
return None | Attempts to write auth and contenttypes models go to auth_db. | exodus/utils/db.py | db_for_write | MinchinWeb/exodus | 0 | python | def db_for_write(self, model, **hints):
'\n \n '
if (model._meta.app_label in self.route_app_labels):
return EXODUS_DB_NAME
return None | def db_for_write(self, model, **hints):
'\n \n '
if (model._meta.app_label in self.route_app_labels):
return EXODUS_DB_NAME
return None<|docstring|>Attempts to write auth and contenttypes models go to auth_db.<|endoftext|> |
87088e824e02ae4051dc5445dbb37ee94699e9d873c5ad0ca11022b5da516fff | def allow_relation(self, obj1, obj2, **hints):
'\n Allow relations if a model in the auth or contenttypes apps is\n involved.\n '
if ((obj1._meta.app_label in self.route_app_labels) or (obj2._meta.app_label in self.route_app_labels)):
return True
return None | Allow relations if a model in the auth or contenttypes apps is
involved. | exodus/utils/db.py | allow_relation | MinchinWeb/exodus | 0 | python | def allow_relation(self, obj1, obj2, **hints):
'\n Allow relations if a model in the auth or contenttypes apps is\n involved.\n '
if ((obj1._meta.app_label in self.route_app_labels) or (obj2._meta.app_label in self.route_app_labels)):
return True
return None | def allow_relation(self, obj1, obj2, **hints):
'\n Allow relations if a model in the auth or contenttypes apps is\n involved.\n '
if ((obj1._meta.app_label in self.route_app_labels) or (obj2._meta.app_label in self.route_app_labels)):
return True
return None<|docstring|>Allow re... |
b88049766f5711e8bf0e0534d58a4fe8b324eb269d59208556042b78c46411b3 | def allow_migrate(self, db, app_label, model_name=None, **hints):
"\n Make sure the auth and contenttypes apps only appear in the\n 'auth_db' database.\n "
if (app_label in self.route_app_labels):
return (db == EXODUS_DB_NAME)
return None | Make sure the auth and contenttypes apps only appear in the
'auth_db' database. | exodus/utils/db.py | allow_migrate | MinchinWeb/exodus | 0 | python | def allow_migrate(self, db, app_label, model_name=None, **hints):
"\n Make sure the auth and contenttypes apps only appear in the\n 'auth_db' database.\n "
if (app_label in self.route_app_labels):
return (db == EXODUS_DB_NAME)
return None | def allow_migrate(self, db, app_label, model_name=None, **hints):
"\n Make sure the auth and contenttypes apps only appear in the\n 'auth_db' database.\n "
if (app_label in self.route_app_labels):
return (db == EXODUS_DB_NAME)
return None<|docstring|>Make sure the auth and conte... |
e25a1cdae1b7a6cdf3c56e144ef76f13b8e9868e4449da4ac7900e55d0ccc7a0 | def currentframe():
"Return the frame object for the caller's stack frame."
try:
raise Exception
except Exception:
return sys.exc_info()[2].tb_frame.f_back | Return the frame object for the caller's stack frame. | hummingbot/logger/logger.py | currentframe | shiva3593/hummingbot | 3,027 | python | def currentframe():
try:
raise Exception
except Exception:
return sys.exc_info()[2].tb_frame.f_back | def currentframe():
try:
raise Exception
except Exception:
return sys.exc_info()[2].tb_frame.f_back<|docstring|>Return the frame object for the caller's stack frame.<|endoftext|> |
14c18782c63585e6ec68213b4fac9993fd7bc4dfad72001d31d30d3329332f73 | def findCaller(self, stack_info=False, stacklevel=1):
'\n Find the stack frame of the caller so that we can note the source\n file name, line number and function name.\n '
f = currentframe()
if (f is not None):
f = f.f_back
orig_f = f
while (f and (stacklevel > 1)):
... | Find the stack frame of the caller so that we can note the source
file name, line number and function name. | hummingbot/logger/logger.py | findCaller | shiva3593/hummingbot | 3,027 | python | def findCaller(self, stack_info=False, stacklevel=1):
'\n Find the stack frame of the caller so that we can note the source\n file name, line number and function name.\n '
f = currentframe()
if (f is not None):
f = f.f_back
orig_f = f
while (f and (stacklevel > 1)):
... | def findCaller(self, stack_info=False, stacklevel=1):
'\n Find the stack frame of the caller so that we can note the source\n file name, line number and function name.\n '
f = currentframe()
if (f is not None):
f = f.f_back
orig_f = f
while (f and (stacklevel > 1)):
... |
a1fdb7080674397d07c8f1cb4920eb0fa5be031882da67c7c3614372f8235a42 | def image_upload_url(movie_id):
'Return URL for movie image upload\n '
return reverse('movie:movie-upload-image', args=[movie_id]) | Return URL for movie image upload | backend/movie/tests/test_movie_api.py | image_upload_url | BAXTOR95/movie-rental-api | 0 | python | def image_upload_url(movie_id):
'\n '
return reverse('movie:movie-upload-image', args=[movie_id]) | def image_upload_url(movie_id):
'\n '
return reverse('movie:movie-upload-image', args=[movie_id])<|docstring|>Return URL for movie image upload<|endoftext|> |
ced503e832e195157b4126793b7b1e12694f3296dfd6641f8a29f1692e5139c4 | def detail_url(movie_id):
'Return movie detail URL\n '
return reverse('movie:movie-detail', args=[movie_id]) | Return movie detail URL | backend/movie/tests/test_movie_api.py | detail_url | BAXTOR95/movie-rental-api | 0 | python | def detail_url(movie_id):
'\n '
return reverse('movie:movie-detail', args=[movie_id]) | def detail_url(movie_id):
'\n '
return reverse('movie:movie-detail', args=[movie_id])<|docstring|>Return movie detail URL<|endoftext|> |
1572478faeef56cf406fc7a979ba36bbb0bf813745dda6b4f360134997533d5d | def sample_genre(user, name='Sample Genre'):
'Create and return a sample genre\n '
return Genre.objects.create(user=user, name=name) | Create and return a sample genre | backend/movie/tests/test_movie_api.py | sample_genre | BAXTOR95/movie-rental-api | 0 | python | def sample_genre(user, name='Sample Genre'):
'\n '
return Genre.objects.create(user=user, name=name) | def sample_genre(user, name='Sample Genre'):
'\n '
return Genre.objects.create(user=user, name=name)<|docstring|>Create and return a sample genre<|endoftext|> |
329932b2d7166e3a980c690abaaf2447b88e97b4738bb867b8d0f02e1343fd1f | def sample_movie(user, **params):
'Create and return a sample movie\n '
defaults = {'title': 'Sample movie', 'description': 'Sample description', 'stock': 100, 'rental_price': 2.5, 'sale_price': 10.0, 'availability': True}
defaults.update(params)
return Movie.objects.create(user=user, **defaults) | Create and return a sample movie | backend/movie/tests/test_movie_api.py | sample_movie | BAXTOR95/movie-rental-api | 0 | python | def sample_movie(user, **params):
'\n '
defaults = {'title': 'Sample movie', 'description': 'Sample description', 'stock': 100, 'rental_price': 2.5, 'sale_price': 10.0, 'availability': True}
defaults.update(params)
return Movie.objects.create(user=user, **defaults) | def sample_movie(user, **params):
'\n '
defaults = {'title': 'Sample movie', 'description': 'Sample description', 'stock': 100, 'rental_price': 2.5, 'sale_price': 10.0, 'availability': True}
defaults.update(params)
return Movie.objects.create(user=user, **defaults)<|docstring|>Create and return a sam... |
0283a416468410f7bfa52effd98bb5ede2e9b7ae9d20fedd4630b35fd930b534 | def test_auth_required(self):
'Test that no authentication is required to view the movies\n '
res = self.client.get(MOVIES_URL)
self.assertEqual(res.status_code, status.HTTP_200_OK) | Test that no authentication is required to view the movies | backend/movie/tests/test_movie_api.py | test_auth_required | BAXTOR95/movie-rental-api | 0 | python | def test_auth_required(self):
'\n '
res = self.client.get(MOVIES_URL)
self.assertEqual(res.status_code, status.HTTP_200_OK) | def test_auth_required(self):
'\n '
res = self.client.get(MOVIES_URL)
self.assertEqual(res.status_code, status.HTTP_200_OK)<|docstring|>Test that no authentication is required to view the movies<|endoftext|> |
f2693d0352073c73ffbb9feba93e11db17d46adf050a9edb7eff574b5fecc9c2 | def test_retrieve_movies(self):
'Test retrieving a list of movies\n '
sample_movie(user=self.user)
sample_movie(user=self.user)
res = self.client.get(MOVIES_URL)
movies = Movie.objects.all()
serializer = MovieSerializer(movies, many=True)
self.assertEqual(res.status_code, status.HTTP_... | Test retrieving a list of movies | backend/movie/tests/test_movie_api.py | test_retrieve_movies | BAXTOR95/movie-rental-api | 0 | python | def test_retrieve_movies(self):
'\n '
sample_movie(user=self.user)
sample_movie(user=self.user)
res = self.client.get(MOVIES_URL)
movies = Movie.objects.all()
serializer = MovieSerializer(movies, many=True)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(res... | def test_retrieve_movies(self):
'\n '
sample_movie(user=self.user)
sample_movie(user=self.user)
res = self.client.get(MOVIES_URL)
movies = Movie.objects.all()
serializer = MovieSerializer(movies, many=True)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(res... |
a37bd0ec4e28044666819fa1cf7a0b7530674275f24a981a96aa97c660c1ff5e | def test_retrieve_movies_nonadmin(self):
'Test retrieving a list of movies as non admin user\n '
movie1 = sample_movie(user=self.user)
movie2 = sample_movie(user=self.user, stock=0, availability=False)
res = self.client_nonadmin.get(MOVIES_URL)
serializer1 = MovieSerializer(movie1)
serial... | Test retrieving a list of movies as non admin user | backend/movie/tests/test_movie_api.py | test_retrieve_movies_nonadmin | BAXTOR95/movie-rental-api | 0 | python | def test_retrieve_movies_nonadmin(self):
'\n '
movie1 = sample_movie(user=self.user)
movie2 = sample_movie(user=self.user, stock=0, availability=False)
res = self.client_nonadmin.get(MOVIES_URL)
serializer1 = MovieSerializer(movie1)
serializer2 = MovieSerializer(movie2)
self.assertIn(... | def test_retrieve_movies_nonadmin(self):
'\n '
movie1 = sample_movie(user=self.user)
movie2 = sample_movie(user=self.user, stock=0, availability=False)
res = self.client_nonadmin.get(MOVIES_URL)
serializer1 = MovieSerializer(movie1)
serializer2 = MovieSerializer(movie2)
self.assertIn(... |
2107f5fa74380387643c311ecbc7e817fbe575082c317f09e4ec4dce5f809150 | def test_movies_not_limited_to_user(self):
'Retrieving movies for all users\n '
user2 = get_user_model().objects.create_superuser('example@example.com', 'Admin User', 'password123')
sample_movie(user=user2)
sample_movie(user=self.user)
res = self.client.get(MOVIES_URL)
movies = Movie.obje... | Retrieving movies for all users | backend/movie/tests/test_movie_api.py | test_movies_not_limited_to_user | BAXTOR95/movie-rental-api | 0 | python | def test_movies_not_limited_to_user(self):
'\n '
user2 = get_user_model().objects.create_superuser('example@example.com', 'Admin User', 'password123')
sample_movie(user=user2)
sample_movie(user=self.user)
res = self.client.get(MOVIES_URL)
movies = Movie.objects.all()
serializer = Movi... | def test_movies_not_limited_to_user(self):
'\n '
user2 = get_user_model().objects.create_superuser('example@example.com', 'Admin User', 'password123')
sample_movie(user=user2)
sample_movie(user=self.user)
res = self.client.get(MOVIES_URL)
movies = Movie.objects.all()
serializer = Movi... |
7da8f3a4b17a94b97d4e1ac2666c2ccd4a776ff297daeb0cf74fabe5135c1d17 | def test_view_movie_detail(self):
'Test viewing a movie detail\n '
movie = sample_movie(user=self.user)
movie.genre.add(sample_genre(user=self.user))
url = detail_url(movie.id)
res = self.client.get(url)
serializer = MovieDetailSerializer(movie)
self.assertEqual(res.data, serializer.d... | Test viewing a movie detail | backend/movie/tests/test_movie_api.py | test_view_movie_detail | BAXTOR95/movie-rental-api | 0 | python | def test_view_movie_detail(self):
'\n '
movie = sample_movie(user=self.user)
movie.genre.add(sample_genre(user=self.user))
url = detail_url(movie.id)
res = self.client.get(url)
serializer = MovieDetailSerializer(movie)
self.assertEqual(res.data, serializer.data) | def test_view_movie_detail(self):
'\n '
movie = sample_movie(user=self.user)
movie.genre.add(sample_genre(user=self.user))
url = detail_url(movie.id)
res = self.client.get(url)
serializer = MovieDetailSerializer(movie)
self.assertEqual(res.data, serializer.data)<|docstring|>Test viewi... |
eef15f912f2fbdd5418c2aa1e3eb0ed8a1440b318bcb9b5b13ce2b7dfb332be9 | def test_create_basic_movie(self):
'Test creating movie\n '
payload = {'title': 'Interstellar', 'description': 'A movie that will blow your mind', 'stock': 100, 'rental_price': 2.5, 'sale_price': 10.0, 'availability': True}
res = self.client.post(MOVIES_URL, payload)
self.assertEqual(res.status_c... | Test creating movie | backend/movie/tests/test_movie_api.py | test_create_basic_movie | BAXTOR95/movie-rental-api | 0 | python | def test_create_basic_movie(self):
'\n '
payload = {'title': 'Interstellar', 'description': 'A movie that will blow your mind', 'stock': 100, 'rental_price': 2.5, 'sale_price': 10.0, 'availability': True}
res = self.client.post(MOVIES_URL, payload)
self.assertEqual(res.status_code, status.HTTP_20... | def test_create_basic_movie(self):
'\n '
payload = {'title': 'Interstellar', 'description': 'A movie that will blow your mind', 'stock': 100, 'rental_price': 2.5, 'sale_price': 10.0, 'availability': True}
res = self.client.post(MOVIES_URL, payload)
self.assertEqual(res.status_code, status.HTTP_20... |
47483f2925a3f44cae5adf724d8daeff1c07049eb220351f1854aa80856f9119 | def test_create_basic_movie_no_admin(self):
'Test creating movie with a non admin user\n '
payload = {'title': 'Interstellar', 'description': 'A movie that will blow your mind', 'stock': 100, 'rental_price': 2.5, 'sale_price': 10.0, 'availability': True}
res = self.client_nonadmin.post(MOVIES_URL, pa... | Test creating movie with a non admin user | backend/movie/tests/test_movie_api.py | test_create_basic_movie_no_admin | BAXTOR95/movie-rental-api | 0 | python | def test_create_basic_movie_no_admin(self):
'\n '
payload = {'title': 'Interstellar', 'description': 'A movie that will blow your mind', 'stock': 100, 'rental_price': 2.5, 'sale_price': 10.0, 'availability': True}
res = self.client_nonadmin.post(MOVIES_URL, payload)
self.assertEqual(res.status_co... | def test_create_basic_movie_no_admin(self):
'\n '
payload = {'title': 'Interstellar', 'description': 'A movie that will blow your mind', 'stock': 100, 'rental_price': 2.5, 'sale_price': 10.0, 'availability': True}
res = self.client_nonadmin.post(MOVIES_URL, payload)
self.assertEqual(res.status_co... |
36d7650ffe4af6e7e286a61502f7ae46c4744448f05c385544b799404e0309e9 | def test_create_movie_with_genre(self):
'Test creating a movie with genre\n '
genre1 = sample_genre(user=self.user, name='Sci-fy')
genre2 = sample_genre(user=self.user, name='Suspense')
payload = {'title': 'Interstellar', 'description': 'A movie that will blow your mind', 'genre': [genre1.id, gen... | Test creating a movie with genre | backend/movie/tests/test_movie_api.py | test_create_movie_with_genre | BAXTOR95/movie-rental-api | 0 | python | def test_create_movie_with_genre(self):
'\n '
genre1 = sample_genre(user=self.user, name='Sci-fy')
genre2 = sample_genre(user=self.user, name='Suspense')
payload = {'title': 'Interstellar', 'description': 'A movie that will blow your mind', 'genre': [genre1.id, genre2.id], 'stock': 100, 'rental_p... | def test_create_movie_with_genre(self):
'\n '
genre1 = sample_genre(user=self.user, name='Sci-fy')
genre2 = sample_genre(user=self.user, name='Suspense')
payload = {'title': 'Interstellar', 'description': 'A movie that will blow your mind', 'genre': [genre1.id, genre2.id], 'stock': 100, 'rental_p... |
0be8650c80045464947b3d0fade42c75fa66e37fc1905b3b7cfb2b6cdc8657f6 | def test_partial_update_movie(self):
'Test updating a movie with patch\n '
movie = sample_movie(user=self.user)
movie.genre.add(sample_genre(user=self.user))
new_genre = sample_genre(user=self.user, name='Action')
payload = {'title': 'Avengers: Infinity War', 'genre': [new_genre.id], 'stock':... | Test updating a movie with patch | backend/movie/tests/test_movie_api.py | test_partial_update_movie | BAXTOR95/movie-rental-api | 0 | python | def test_partial_update_movie(self):
'\n '
movie = sample_movie(user=self.user)
movie.genre.add(sample_genre(user=self.user))
new_genre = sample_genre(user=self.user, name='Action')
payload = {'title': 'Avengers: Infinity War', 'genre': [new_genre.id], 'stock': 0, 'availability': False, 'link... | def test_partial_update_movie(self):
'\n '
movie = sample_movie(user=self.user)
movie.genre.add(sample_genre(user=self.user))
new_genre = sample_genre(user=self.user, name='Action')
payload = {'title': 'Avengers: Infinity War', 'genre': [new_genre.id], 'stock': 0, 'availability': False, 'link... |
086a282fe1b279d464e96574ccf525fa742d17f74243becf062029257c064014 | def test_full_update_movie(self):
'Test updating a recipe with put\n '
movie = sample_movie(user=self.user)
movie.genre.add(sample_genre(user=self.user))
payload = {'title': 'Interstellar', 'description': 'A movie that will blow your mind', 'stock': 0, 'rental_price': 3.5, 'sale_price': 12.0, 'av... | Test updating a recipe with put | backend/movie/tests/test_movie_api.py | test_full_update_movie | BAXTOR95/movie-rental-api | 0 | python | def test_full_update_movie(self):
'\n '
movie = sample_movie(user=self.user)
movie.genre.add(sample_genre(user=self.user))
payload = {'title': 'Interstellar', 'description': 'A movie that will blow your mind', 'stock': 0, 'rental_price': 3.5, 'sale_price': 12.0, 'availability': False}
url = d... | def test_full_update_movie(self):
'\n '
movie = sample_movie(user=self.user)
movie.genre.add(sample_genre(user=self.user))
payload = {'title': 'Interstellar', 'description': 'A movie that will blow your mind', 'stock': 0, 'rental_price': 3.5, 'sale_price': 12.0, 'availability': False}
url = d... |
3750e638bcefcc40f79b7b5655b18f3c2be306386fb195ffc6a4aa2eb914dafd | def test_filter_movies_by_genre(self):
'Test returning movies with specific genre\n '
movie1 = sample_movie(user=self.user, title='Interstellar')
movie2 = sample_movie(user=self.user, title='The Great Gatsby')
genre1 = sample_genre(user=self.user, name='Sci-fy')
genre2 = sample_genre(user=sel... | Test returning movies with specific genre | backend/movie/tests/test_movie_api.py | test_filter_movies_by_genre | BAXTOR95/movie-rental-api | 0 | python | def test_filter_movies_by_genre(self):
'\n '
movie1 = sample_movie(user=self.user, title='Interstellar')
movie2 = sample_movie(user=self.user, title='The Great Gatsby')
genre1 = sample_genre(user=self.user, name='Sci-fy')
genre2 = sample_genre(user=self.user, name='Suspense')
movie1.genre... | def test_filter_movies_by_genre(self):
'\n '
movie1 = sample_movie(user=self.user, title='Interstellar')
movie2 = sample_movie(user=self.user, title='The Great Gatsby')
genre1 = sample_genre(user=self.user, name='Sci-fy')
genre2 = sample_genre(user=self.user, name='Suspense')
movie1.genre... |
26d72f7d287e28bbebe8175aa3d535dfe3cfc4cfef3acc4491f109e72f515faf | def test_filter_movies_by_availability(self):
'Test returning movies with specific Availability\n '
movie1 = sample_movie(user=self.user, title='Interstellar')
movie2 = sample_movie(user=self.user, title='The Great Gatsby')
movie3 = sample_movie(user=self.user, title='Avengers: Infinity War', sto... | Test returning movies with specific Availability | backend/movie/tests/test_movie_api.py | test_filter_movies_by_availability | BAXTOR95/movie-rental-api | 0 | python | def test_filter_movies_by_availability(self):
'\n '
movie1 = sample_movie(user=self.user, title='Interstellar')
movie2 = sample_movie(user=self.user, title='The Great Gatsby')
movie3 = sample_movie(user=self.user, title='Avengers: Infinity War', stock=0, availability=False)
res = self.client.... | def test_filter_movies_by_availability(self):
'\n '
movie1 = sample_movie(user=self.user, title='Interstellar')
movie2 = sample_movie(user=self.user, title='The Great Gatsby')
movie3 = sample_movie(user=self.user, title='Avengers: Infinity War', stock=0, availability=False)
res = self.client.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.