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 |
|---|---|---|---|---|---|---|---|---|---|
e6dc51b7c0eac25e49ffee0983de262aaf26d68f151a7f3d6d698c6279fb1f13 | def read_unicode_csv_fileobj(fileobj, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL, lineterminator='\n', encoding='utf-8', skiprows=0):
'fileobj can be a StringIO in Py3, but should be a BytesIO in Py2.'
if (sys.version_info[0] >= 3):
csv_reader = csv.reader(fileobj, delimiter=delimiter, quot... | fileobj can be a StringIO in Py3, but should be a BytesIO in Py2. | indra/util/__init__.py | read_unicode_csv_fileobj | pupster90/indra | 0 | python | def read_unicode_csv_fileobj(fileobj, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL, lineterminator='\n', encoding='utf-8', skiprows=0):
if (sys.version_info[0] >= 3):
csv_reader = csv.reader(fileobj, delimiter=delimiter, quotechar=quotechar, quoting=quoting, lineterminator=lineterminator)
... | def read_unicode_csv_fileobj(fileobj, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL, lineterminator='\n', encoding='utf-8', skiprows=0):
if (sys.version_info[0] >= 3):
csv_reader = csv.reader(fileobj, delimiter=delimiter, quotechar=quotechar, quoting=quoting, lineterminator=lineterminator)
... |
b3149d1c76287116ce82ae7c62545b1856d4db0613b3be06406f869f4196b706 | def fast_deepcopy(obj):
'This is a faster implementation of deepcopy via pickle.\n\n It is meant primarily for sets of Statements with complex hierarchies\n but can be used for any object.\n '
with BytesIO() as buf:
pickle.dump(obj, buf)
buf.seek(0)
obj_new = pickle.load(buf)
... | This is a faster implementation of deepcopy via pickle.
It is meant primarily for sets of Statements with complex hierarchies
but can be used for any object. | indra/util/__init__.py | fast_deepcopy | pupster90/indra | 0 | python | def fast_deepcopy(obj):
'This is a faster implementation of deepcopy via pickle.\n\n It is meant primarily for sets of Statements with complex hierarchies\n but can be used for any object.\n '
with BytesIO() as buf:
pickle.dump(obj, buf)
buf.seek(0)
obj_new = pickle.load(buf)
... | def fast_deepcopy(obj):
'This is a faster implementation of deepcopy via pickle.\n\n It is meant primarily for sets of Statements with complex hierarchies\n but can be used for any object.\n '
with BytesIO() as buf:
pickle.dump(obj, buf)
buf.seek(0)
obj_new = pickle.load(buf)
... |
c78a8ea25b310168b46e9bbf1f397d1065e1413b6d9b5f525794abb7bfb4424e | def lmap(f, xs):
'A non-lazy version of map.'
return list(map(f, xs)) | A non-lazy version of map. | indra/util/__init__.py | lmap | pupster90/indra | 0 | python | def lmap(f, xs):
return list(map(f, xs)) | def lmap(f, xs):
return list(map(f, xs))<|docstring|>A non-lazy version of map.<|endoftext|> |
eb6f034f5f37f918633536f64523c73bd1ec6a5b3755fc0d968345680ab5fc59 | def flatten(l):
'Flatten a nested list.'
return (sum(map(flatten, l), []) if (isinstance(l, list) or isinstance(l, tuple)) else [l]) | Flatten a nested list. | indra/util/__init__.py | flatten | pupster90/indra | 0 | python | def flatten(l):
return (sum(map(flatten, l), []) if (isinstance(l, list) or isinstance(l, tuple)) else [l]) | def flatten(l):
return (sum(map(flatten, l), []) if (isinstance(l, list) or isinstance(l, tuple)) else [l])<|docstring|>Flatten a nested list.<|endoftext|> |
0aecee92b413b931514195548bdef79e5aa7588ca0b404c46676b412f4bdbd6a | def flatMap(f, xs):
'Map a function onto an iterable and flatten the result.'
return flatten(lmap(f, xs)) | Map a function onto an iterable and flatten the result. | indra/util/__init__.py | flatMap | pupster90/indra | 0 | python | def flatMap(f, xs):
return flatten(lmap(f, xs)) | def flatMap(f, xs):
return flatten(lmap(f, xs))<|docstring|>Map a function onto an iterable and flatten the result.<|endoftext|> |
5d5c899b4cef6f2714806dd23889f74f192168d1925d881fcfaf526cb7b02b34 | def get_list_arb():
'Run the arb finder\n\n Returns:\n List: List sorted by % of all arb opportunities found.\n '
dict_price_raw = get_raw_price_async()
dict_clean_price = get_clean_price(dict_price_raw)
list_arb_price = compute_arb_opportunities(dict_clean_price)
res = get_output(list_... | Run the arb finder
Returns:
List: List sorted by % of all arb opportunities found. | examples/python/oracle_arb_finder/app.py | get_list_arb | edd34/OrFeed | 0 | python | def get_list_arb():
'Run the arb finder\n\n Returns:\n List: List sorted by % of all arb opportunities found.\n '
dict_price_raw = get_raw_price_async()
dict_clean_price = get_clean_price(dict_price_raw)
list_arb_price = compute_arb_opportunities(dict_clean_price)
res = get_output(list_... | def get_list_arb():
'Run the arb finder\n\n Returns:\n List: List sorted by % of all arb opportunities found.\n '
dict_price_raw = get_raw_price_async()
dict_clean_price = get_clean_price(dict_price_raw)
list_arb_price = compute_arb_opportunities(dict_clean_price)
res = get_output(list_... |
f52a7233349e3aad06943ba481ebfdf9ffb43ca04723a10073e6ae65ebbc1c91 | def knn_purity(data, labels: np.ndarray, n_neighbors=30):
'Computes KNN Purity for ``data`` given the labels.\n Parameters\n ----------\n data:\n Numpy ndarray of data\n labels\n Numpy ndarray of labels\n n_neighbors: int\n Number of nearest neighb... | Computes KNN Purity for ``data`` given the labels.
Parameters
----------
data:
Numpy ndarray of data
labels
Numpy ndarray of labels
n_neighbors: int
Number of nearest neighbors.
Returns
-------
score: float
KNN purity score. A float between 0 and 1. | cpa/_metrics.py | knn_purity | theislab/CPA | 7 | python | def knn_purity(data, labels: np.ndarray, n_neighbors=30):
'Computes KNN Purity for ``data`` given the labels.\n Parameters\n ----------\n data:\n Numpy ndarray of data\n labels\n Numpy ndarray of labels\n n_neighbors: int\n Number of nearest neighb... | def knn_purity(data, labels: np.ndarray, n_neighbors=30):
'Computes KNN Purity for ``data`` given the labels.\n Parameters\n ----------\n data:\n Numpy ndarray of data\n labels\n Numpy ndarray of labels\n n_neighbors: int\n Number of nearest neighb... |
b59e8e0c164d108be9e45d4f226c2c6678a697427b918c1e9b0b38207dc252a2 | def entropy_batch_mixing(data, labels, n_neighbors=50, n_pools=50, n_samples_per_pool=100):
'Computes Entory of Batch mixing metric for ``adata`` given the batch column name.\n Parameters\n ----------\n data\n Numpy ndarray of data\n labels\n Numpy ndarray of labels... | Computes Entory of Batch mixing metric for ``adata`` given the batch column name.
Parameters
----------
data
Numpy ndarray of data
labels
Numpy ndarray of labels
n_neighbors: int
Number of nearest neighbors.
n_pools: int
Number of EBM computation which will be averaged.
n_samples_per_pool: int
Numbe... | cpa/_metrics.py | entropy_batch_mixing | theislab/CPA | 7 | python | def entropy_batch_mixing(data, labels, n_neighbors=50, n_pools=50, n_samples_per_pool=100):
'Computes Entory of Batch mixing metric for ``adata`` given the batch column name.\n Parameters\n ----------\n data\n Numpy ndarray of data\n labels\n Numpy ndarray of labels... | def entropy_batch_mixing(data, labels, n_neighbors=50, n_pools=50, n_samples_per_pool=100):
'Computes Entory of Batch mixing metric for ``adata`` given the batch column name.\n Parameters\n ----------\n data\n Numpy ndarray of data\n labels\n Numpy ndarray of labels... |
003c8d364a7eb5159af24d7b0055d5f3d71da622c5bf163c0a487d59c7305b26 | def __init__(self, parent, inet):
' Initialize Panel class '
self.inet = inet
wx.Panel.__init__(self, parent)
DEFAULT_FONT = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
self.layout_main = wx.BoxSizer(wx.VERTICAL)
self.layout = [wx.BoxSizer(wx.HORIZONTAL) for i i... | Initialize Panel class | src/ltkit/panel/server/questionnaire.py | __init__ | ptr-yudai/ltkit | 1 | python | def __init__(self, parent, inet):
' '
self.inet = inet
wx.Panel.__init__(self, parent)
DEFAULT_FONT = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
self.layout_main = wx.BoxSizer(wx.VERTICAL)
self.layout = [wx.BoxSizer(wx.HORIZONTAL) for i in range(4)]
label ... | def __init__(self, parent, inet):
' '
self.inet = inet
wx.Panel.__init__(self, parent)
DEFAULT_FONT = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
self.layout_main = wx.BoxSizer(wx.VERTICAL)
self.layout = [wx.BoxSizer(wx.HORIZONTAL) for i in range(4)]
label ... |
c7bfb100ddcfe4e67e30978ff2476f2c47cbc48e5f416982cc93d0b34f1e8e97 | def new_choice(self, event):
' Add new choice '
dialog = wx.TextEntryDialog(self, message='Please enter the string of the choice.', caption='New choise')
if (dialog.ShowModal() != wx.ID_OK):
return
self.list_choice.Append(dialog.GetValue())
return | Add new choice | src/ltkit/panel/server/questionnaire.py | new_choice | ptr-yudai/ltkit | 1 | python | def new_choice(self, event):
' '
dialog = wx.TextEntryDialog(self, message='Please enter the string of the choice.', caption='New choise')
if (dialog.ShowModal() != wx.ID_OK):
return
self.list_choice.Append(dialog.GetValue())
return | def new_choice(self, event):
' '
dialog = wx.TextEntryDialog(self, message='Please enter the string of the choice.', caption='New choise')
if (dialog.ShowModal() != wx.ID_OK):
return
self.list_choice.Append(dialog.GetValue())
return<|docstring|>Add new choice<|endoftext|> |
51a90ec6259ecdf0681a86e9411c540799e79e958dd5c21eae57ca6b422fd159 | def delete_choice(self, event):
' Delete the selected choice '
index = self.list_choice.GetSelection()
if (index == wx.NOT_FOUND):
wx.MessageBox(u'Please select an item to remove from the choice.', u'LT Toolkit', style=(wx.OK | wx.ICON_ERROR))
return
self.list_choice.Delete(index)
re... | Delete the selected choice | src/ltkit/panel/server/questionnaire.py | delete_choice | ptr-yudai/ltkit | 1 | python | def delete_choice(self, event):
' '
index = self.list_choice.GetSelection()
if (index == wx.NOT_FOUND):
wx.MessageBox(u'Please select an item to remove from the choice.', u'LT Toolkit', style=(wx.OK | wx.ICON_ERROR))
return
self.list_choice.Delete(index)
return | def delete_choice(self, event):
' '
index = self.list_choice.GetSelection()
if (index == wx.NOT_FOUND):
wx.MessageBox(u'Please select an item to remove from the choice.', u'LT Toolkit', style=(wx.OK | wx.ICON_ERROR))
return
self.list_choice.Delete(index)
return<|docstring|>Delete th... |
cdb0e658a4c531738f999180b2b93d2c6d1c34bc2c97fa32b84ebca418d05c1e | def clear_choice(self, event):
' Clear all the choices '
dialog = wx.MessageDialog(None, 'Are you sure that you want to remove all the choices?', 'LT Toolkit', style=(wx.YES_NO | wx.ICON_QUESTION))
if (dialog.ShowModal() == wx.ID_YES):
self.list_choice.Clear()
return | Clear all the choices | src/ltkit/panel/server/questionnaire.py | clear_choice | ptr-yudai/ltkit | 1 | python | def clear_choice(self, event):
' '
dialog = wx.MessageDialog(None, 'Are you sure that you want to remove all the choices?', 'LT Toolkit', style=(wx.YES_NO | wx.ICON_QUESTION))
if (dialog.ShowModal() == wx.ID_YES):
self.list_choice.Clear()
return | def clear_choice(self, event):
' '
dialog = wx.MessageDialog(None, 'Are you sure that you want to remove all the choices?', 'LT Toolkit', style=(wx.YES_NO | wx.ICON_QUESTION))
if (dialog.ShowModal() == wx.ID_YES):
self.list_choice.Clear()
return<|docstring|>Clear all the choices<|endoftext|> |
2e12f0920869e39a99f32c311de3a38d3ad489f96765205a1f806ea65778ebf6 | def proc_new_answer(self, answer):
' Count up for new answer '
self.label_received.SetLabel('You have received {0} answer{1}.'.format(len(answer), ('s' if (len(answer) > 1) else '')))
self.layout[3].Layout()
self.layout_main.Layout()
return | Count up for new answer | src/ltkit/panel/server/questionnaire.py | proc_new_answer | ptr-yudai/ltkit | 1 | python | def proc_new_answer(self, answer):
' '
self.label_received.SetLabel('You have received {0} answer{1}.'.format(len(answer), ('s' if (len(answer) > 1) else )))
self.layout[3].Layout()
self.layout_main.Layout()
return | def proc_new_answer(self, answer):
' '
self.label_received.SetLabel('You have received {0} answer{1}.'.format(len(answer), ('s' if (len(answer) > 1) else )))
self.layout[3].Layout()
self.layout_main.Layout()
return<|docstring|>Count up for new answer<|endoftext|> |
0592c11cb5c7be69674ebd2804145d8c677ad00d78320a9cb5975ec396f39463 | def parse_line(line):
'parse a sentence with xml markup\n line - string from the file, contains the tab-separated sentence id, source sentence and target with error markup\n '
global cdec_home
line = line[:(- 1)].decode('utf-8')
chunks = line.split('\t')
if (np.size(chunks) != 3):
sys.s... | parse a sentence with xml markup
line - string from the file, contains the tab-separated sentence id, source sentence and target with error markup | marmot/preprocessing/parse_xml.py | parse_line | qe-team/marmot | 19 | python | def parse_line(line):
'parse a sentence with xml markup\n line - string from the file, contains the tab-separated sentence id, source sentence and target with error markup\n '
global cdec_home
line = line[:(- 1)].decode('utf-8')
chunks = line.split('\t')
if (np.size(chunks) != 3):
sys.s... | def parse_line(line):
'parse a sentence with xml markup\n line - string from the file, contains the tab-separated sentence id, source sentence and target with error markup\n '
global cdec_home
line = line[:(- 1)].decode('utf-8')
chunks = line.split('\t')
if (np.size(chunks) != 3):
sys.s... |
c7800ee8bfca49a4b174173e52b3edbbb0373625a5f5f7b589e0e2b8ad315e4a | async def open_connection_buffered(*args, get_buffer: GetBuffer=_get_buffer, loop=None, **kwargs) -> Tuple[(StreamReader, StreamWriter)]:
'\n Open stream using BufferedStreamProtocol.\n '
loop = (loop or asyncio.get_running_loop())
proto = BufferedStreamProtocol(loop, None, get_buffer)
(await loop... | Open stream using BufferedStreamProtocol. | fstream/__init__.py | open_connection_buffered | 33TU/fstream | 0 | python | async def open_connection_buffered(*args, get_buffer: GetBuffer=_get_buffer, loop=None, **kwargs) -> Tuple[(StreamReader, StreamWriter)]:
'\n \n '
loop = (loop or asyncio.get_running_loop())
proto = BufferedStreamProtocol(loop, None, get_buffer)
(await loop.create_connection((lambda : proto), *arg... | async def open_connection_buffered(*args, get_buffer: GetBuffer=_get_buffer, loop=None, **kwargs) -> Tuple[(StreamReader, StreamWriter)]:
'\n \n '
loop = (loop or asyncio.get_running_loop())
proto = BufferedStreamProtocol(loop, None, get_buffer)
(await loop.create_connection((lambda : proto), *arg... |
672c4e4c1841478b70d334385dc18b780a3483c73d9881f49daadbeb8ff9f0cf | async def start_server_buffered(client_connected_cb: ConnectedCb, *args, get_buffer: GetBuffer=_get_buffer, loop=None, **kwargs) -> asyncio.AbstractServer:
'\n Start server which uses BufferedStreamProtocol.\n '
loop = (loop or asyncio.get_running_loop())
return (await loop.create_server((lambda : Buf... | Start server which uses BufferedStreamProtocol. | fstream/__init__.py | start_server_buffered | 33TU/fstream | 0 | python | async def start_server_buffered(client_connected_cb: ConnectedCb, *args, get_buffer: GetBuffer=_get_buffer, loop=None, **kwargs) -> asyncio.AbstractServer:
'\n \n '
loop = (loop or asyncio.get_running_loop())
return (await loop.create_server((lambda : BufferedStreamProtocol(loop, client_connected_cb, ... | async def start_server_buffered(client_connected_cb: ConnectedCb, *args, get_buffer: GetBuffer=_get_buffer, loop=None, **kwargs) -> asyncio.AbstractServer:
'\n \n '
loop = (loop or asyncio.get_running_loop())
return (await loop.create_server((lambda : BufferedStreamProtocol(loop, client_connected_cb, ... |
d192cf8e54b557c834df62a265a204fc75f1d4228b2604ed0cf7631e4e7df8ae | async def open_connection_chunked(*args, loop=None, **kwargs) -> Tuple[(StreamReader, StreamWriter)]:
'\n Open stream using ChunkedProtocol.\n '
loop = (loop or asyncio.get_running_loop())
proto = ChunkedStreamProtocol(loop, None)
(await loop.create_connection((lambda : proto), *args, **kwargs))
... | Open stream using ChunkedProtocol. | fstream/__init__.py | open_connection_chunked | 33TU/fstream | 0 | python | async def open_connection_chunked(*args, loop=None, **kwargs) -> Tuple[(StreamReader, StreamWriter)]:
'\n \n '
loop = (loop or asyncio.get_running_loop())
proto = ChunkedStreamProtocol(loop, None)
(await loop.create_connection((lambda : proto), *args, **kwargs))
return (StreamReader(proto), St... | async def open_connection_chunked(*args, loop=None, **kwargs) -> Tuple[(StreamReader, StreamWriter)]:
'\n \n '
loop = (loop or asyncio.get_running_loop())
proto = ChunkedStreamProtocol(loop, None)
(await loop.create_connection((lambda : proto), *args, **kwargs))
return (StreamReader(proto), St... |
edb8b714d3252470d03259c8b6445dc29c84ffb89d8b32079ac55a5608de130b | async def start_server_chunked(client_connected_cb: ConnectedCb, *args, loop=None, **kwargs) -> asyncio.AbstractServer:
'\n Start server which uses ChunkedStreamProtocol.\n '
loop = (loop or asyncio.get_running_loop())
return (await loop.create_server((lambda : ChunkedStreamProtocol(loop, client_conne... | Start server which uses ChunkedStreamProtocol. | fstream/__init__.py | start_server_chunked | 33TU/fstream | 0 | python | async def start_server_chunked(client_connected_cb: ConnectedCb, *args, loop=None, **kwargs) -> asyncio.AbstractServer:
'\n \n '
loop = (loop or asyncio.get_running_loop())
return (await loop.create_server((lambda : ChunkedStreamProtocol(loop, client_connected_cb)), *args, **kwargs)) | async def start_server_chunked(client_connected_cb: ConnectedCb, *args, loop=None, **kwargs) -> asyncio.AbstractServer:
'\n \n '
loop = (loop or asyncio.get_running_loop())
return (await loop.create_server((lambda : ChunkedStreamProtocol(loop, client_connected_cb)), *args, **kwargs))<|docstring|>Start... |
fdd675e6944ba2af15c7dfcb0611fe9aa6c94a47ae09e52b5d66136acbc1d576 | def get_index_node(self, vx):
' return the meta graph to implement index calculation\n from input @p vx '
raise NotImplementedError | return the meta graph to implement index calculation
from input @p vx | metalibm_core/core/indexing.py | get_index_node | kalray/metalibm | 27 | python | def get_index_node(self, vx):
' return the meta graph to implement index calculation\n from input @p vx '
raise NotImplementedError | def get_index_node(self, vx):
' return the meta graph to implement index calculation\n from input @p vx '
raise NotImplementedError<|docstring|>return the meta graph to implement index calculation
from input @p vx<|endoftext|> |
cd3025c65ad8b38a5915dee73d018646de6550da9e82c6e0472fa54c3bfa77cf | def get_sub_interval(self, index):
' return the sub-interval numbered @p index '
raise NotImplementedError | return the sub-interval numbered @p index | metalibm_core/core/indexing.py | get_sub_interval | kalray/metalibm | 27 | python | def get_sub_interval(self, index):
' '
raise NotImplementedError | def get_sub_interval(self, index):
' '
raise NotImplementedError<|docstring|>return the sub-interval numbered @p index<|endoftext|> |
192859110cc8136d7e32b4f312e138a2c1be500cf0e40b62cb7073c641a79538 | def get_sub_list(self):
' return the list of sub-intervals ordered by index '
raise NotImplementedError | return the list of sub-intervals ordered by index | metalibm_core/core/indexing.py | get_sub_list | kalray/metalibm | 27 | python | def get_sub_list(self):
' '
raise NotImplementedError | def get_sub_list(self):
' '
raise NotImplementedError<|docstring|>return the list of sub-intervals ordered by index<|endoftext|> |
b606a478c8b0ab26e6ccb3717679f999a2101b2ce6a04441c01e16a73fb82d90 | def get_index_node(self, vx):
' generation an operation sub-graph to compute the\n indexing from input vx\n\n :param vx: input operand\n :type vx: ML_Operation\n\n '
assert (vx.precision is self.precision)
int_precision = vx.precision.get_integer_format()
index_si... | generation an operation sub-graph to compute the
indexing from input vx
:param vx: input operand
:type vx: ML_Operation | metalibm_core/core/indexing.py | get_index_node | kalray/metalibm | 27 | python | def get_index_node(self, vx):
' generation an operation sub-graph to compute the\n indexing from input vx\n\n :param vx: input operand\n :type vx: ML_Operation\n\n '
assert (vx.precision is self.precision)
int_precision = vx.precision.get_integer_format()
index_si... | def get_index_node(self, vx):
' generation an operation sub-graph to compute the\n indexing from input vx\n\n :param vx: input operand\n :type vx: ML_Operation\n\n '
assert (vx.precision is self.precision)
int_precision = vx.precision.get_integer_format()
index_si... |
2408a590ff87e4027eb5739eac756cda49bbf0c2cf6c29265b297c77cff18dac | def get_sub_lo_bound(self, index):
' return the lower bound of the sub-interval\n of index @p index '
assert ((index >= 0) and (index < self.split_num))
field_index = (index % (2 ** self.field_bits))
exp_index = int((index / (2 ** self.field_bits)))
exp_value = (exp_index + self.low_exp_v... | return the lower bound of the sub-interval
of index @p index | metalibm_core/core/indexing.py | get_sub_lo_bound | kalray/metalibm | 27 | python | def get_sub_lo_bound(self, index):
' return the lower bound of the sub-interval\n of index @p index '
assert ((index >= 0) and (index < self.split_num))
field_index = (index % (2 ** self.field_bits))
exp_index = int((index / (2 ** self.field_bits)))
exp_value = (exp_index + self.low_exp_v... | def get_sub_lo_bound(self, index):
' return the lower bound of the sub-interval\n of index @p index '
assert ((index >= 0) and (index < self.split_num))
field_index = (index % (2 ** self.field_bits))
exp_index = int((index / (2 ** self.field_bits)))
exp_value = (exp_index + self.low_exp_v... |
cd829d96d9223e59cbe978eb79cc9d29137a43b3f621991d3cb5a67911e296c1 | def get_sub_hi_bound(self, index):
' return the upper bound of the sub-interval\n of index @p index '
assert ((index >= 0) and (index < self.split_num))
field_index = (index % (2 ** self.field_bits))
exp_index = int((index / (2 ** self.field_bits)))
exp_value = (exp_index + self.low_exp_v... | return the upper bound of the sub-interval
of index @p index | metalibm_core/core/indexing.py | get_sub_hi_bound | kalray/metalibm | 27 | python | def get_sub_hi_bound(self, index):
' return the upper bound of the sub-interval\n of index @p index '
assert ((index >= 0) and (index < self.split_num))
field_index = (index % (2 ** self.field_bits))
exp_index = int((index / (2 ** self.field_bits)))
exp_value = (exp_index + self.low_exp_v... | def get_sub_hi_bound(self, index):
' return the upper bound of the sub-interval\n of index @p index '
assert ((index >= 0) and (index < self.split_num))
field_index = (index % (2 ** self.field_bits))
exp_index = int((index / (2 ** self.field_bits)))
exp_value = (exp_index + self.low_exp_v... |
f4e0eedf8eeafed70bca94a8090207a71b382694fbd8cb97c8f308d7f9d7b049 | def get_offseted_sub_interval(self, index):
' return a pair (offset, [0; size]) '
assert ((index >= 0) and (index < self.split_num))
lo_bound = self.get_sub_lo_bound(index)
hi_bound = self.get_sub_hi_bound(index)
return (lo_bound, Interval(0, (hi_bound - lo_bound))) | return a pair (offset, [0; size]) | metalibm_core/core/indexing.py | get_offseted_sub_interval | kalray/metalibm | 27 | python | def get_offseted_sub_interval(self, index):
' '
assert ((index >= 0) and (index < self.split_num))
lo_bound = self.get_sub_lo_bound(index)
hi_bound = self.get_sub_hi_bound(index)
return (lo_bound, Interval(0, (hi_bound - lo_bound))) | def get_offseted_sub_interval(self, index):
' '
assert ((index >= 0) and (index < self.split_num))
lo_bound = self.get_sub_lo_bound(index)
hi_bound = self.get_sub_hi_bound(index)
return (lo_bound, Interval(0, (hi_bound - lo_bound)))<|docstring|>return a pair (offset, [0; size])<|endoftext|> |
bebb3e1b9193184c0116f79aa42dc5f276d266138118168e995c9e61643f7b2c | def get_index_node(self, vx):
' return the meta graph to implement index calculation\n from input @p vx '
precision = vx.get_precision()
bound_low = inf(self.interval)
bound_high = sup(self.interval)
num_intervals = self.split_num
int_prec = precision.get_integer_format()
diff = S... | return the meta graph to implement index calculation
from input @p vx | metalibm_core/core/indexing.py | get_index_node | kalray/metalibm | 27 | python | def get_index_node(self, vx):
' return the meta graph to implement index calculation\n from input @p vx '
precision = vx.get_precision()
bound_low = inf(self.interval)
bound_high = sup(self.interval)
num_intervals = self.split_num
int_prec = precision.get_integer_format()
diff = S... | def get_index_node(self, vx):
' return the meta graph to implement index calculation\n from input @p vx '
precision = vx.get_precision()
bound_low = inf(self.interval)
bound_high = sup(self.interval)
num_intervals = self.split_num
int_prec = precision.get_integer_format()
diff = S... |
f8f5e25b4550cffe7745fc52428f1a578efc86ed360dd1865498ef7367bcff1b | def get_sub_interval(self, index):
' return the sub-interval numbered @p index '
subint_low = (self.bound_low + (i * interval_size))
subint_high = (self.bound_low + ((i + 1) * interval_size))
return Interval(subint_low, subint_high) | return the sub-interval numbered @p index | metalibm_core/core/indexing.py | get_sub_interval | kalray/metalibm | 27 | python | def get_sub_interval(self, index):
' '
subint_low = (self.bound_low + (i * interval_size))
subint_high = (self.bound_low + ((i + 1) * interval_size))
return Interval(subint_low, subint_high) | def get_sub_interval(self, index):
' '
subint_low = (self.bound_low + (i * interval_size))
subint_high = (self.bound_low + ((i + 1) * interval_size))
return Interval(subint_low, subint_high)<|docstring|>return the sub-interval numbered @p index<|endoftext|> |
46e6c1224f04bdfef7fa5f446d3172a83295b4ae0c2213eec106a3651f43cc7e | def create_pending_command(command_id: str='command-id', command_type: str='command-type', params: Optional[BaseModel]=None) -> cmd.Command:
'Given command data, build a pending command model.'
return cast(cmd.Command, cmd.BaseCommand(id=command_id, commandType=command_type, createdAt=datetime(year=2021, month=... | Given command data, build a pending command model. | api/tests/opentrons/protocol_engine/state/command_fixtures.py | create_pending_command | mrod0101/opentrons | 0 | python | def create_pending_command(command_id: str='command-id', command_type: str='command-type', params: Optional[BaseModel]=None) -> cmd.Command:
return cast(cmd.Command, cmd.BaseCommand(id=command_id, commandType=command_type, createdAt=datetime(year=2021, month=1, day=1), status=cmd.CommandStatus.QUEUED, params=(... | def create_pending_command(command_id: str='command-id', command_type: str='command-type', params: Optional[BaseModel]=None) -> cmd.Command:
return cast(cmd.Command, cmd.BaseCommand(id=command_id, commandType=command_type, createdAt=datetime(year=2021, month=1, day=1), status=cmd.CommandStatus.QUEUED, params=(... |
9948daa9a5bb8707603df89d23b7e7f6c11a152b767aae6b4726580b8e70f104 | def create_running_command(command_id: str='command-id', command_type: str='command-type', params: Optional[BaseModel]=None) -> cmd.Command:
'Given command data, build a running command model.'
return cast(cmd.Command, cmd.BaseCommand(id=command_id, createdAt=datetime(year=2021, month=1, day=1), commandType=com... | Given command data, build a running command model. | api/tests/opentrons/protocol_engine/state/command_fixtures.py | create_running_command | mrod0101/opentrons | 0 | python | def create_running_command(command_id: str='command-id', command_type: str='command-type', params: Optional[BaseModel]=None) -> cmd.Command:
return cast(cmd.Command, cmd.BaseCommand(id=command_id, createdAt=datetime(year=2021, month=1, day=1), commandType=command_type, status=cmd.CommandStatus.RUNNING, params=... | def create_running_command(command_id: str='command-id', command_type: str='command-type', params: Optional[BaseModel]=None) -> cmd.Command:
return cast(cmd.Command, cmd.BaseCommand(id=command_id, createdAt=datetime(year=2021, month=1, day=1), commandType=command_type, status=cmd.CommandStatus.RUNNING, params=... |
7491209d24d73526a034f1ccb19ab518664cb77437d56d995624ace458c39c99 | def create_failed_command(command_id: str='command-id', command_type: str='command-type', error_id: str='error-id', completed_at: datetime=datetime(year=2022, month=2, day=2), params: Optional[BaseModel]=None) -> cmd.Command:
'Given command data, build a failed command model.'
return cast(cmd.Command, cmd.BaseC... | Given command data, build a failed command model. | api/tests/opentrons/protocol_engine/state/command_fixtures.py | create_failed_command | mrod0101/opentrons | 0 | python | def create_failed_command(command_id: str='command-id', command_type: str='command-type', error_id: str='error-id', completed_at: datetime=datetime(year=2022, month=2, day=2), params: Optional[BaseModel]=None) -> cmd.Command:
return cast(cmd.Command, cmd.BaseCommand(id=command_id, createdAt=datetime(year=2021,... | def create_failed_command(command_id: str='command-id', command_type: str='command-type', error_id: str='error-id', completed_at: datetime=datetime(year=2022, month=2, day=2), params: Optional[BaseModel]=None) -> cmd.Command:
return cast(cmd.Command, cmd.BaseCommand(id=command_id, createdAt=datetime(year=2021,... |
f975a36930132f666dcdad2e5fd2c5de3da61b575a71c08115785b7cdd8a55fa | def create_completed_command(command_id: str='command-id', command_type: str='command-type', params: Optional[BaseModel]=None, result: Optional[BaseModel]=None) -> cmd.Command:
'Given command data and result, build a completed command model.'
return cast(cmd.Command, cmd.BaseCommand(id=command_id, createdAt=dat... | Given command data and result, build a completed command model. | api/tests/opentrons/protocol_engine/state/command_fixtures.py | create_completed_command | mrod0101/opentrons | 0 | python | def create_completed_command(command_id: str='command-id', command_type: str='command-type', params: Optional[BaseModel]=None, result: Optional[BaseModel]=None) -> cmd.Command:
return cast(cmd.Command, cmd.BaseCommand(id=command_id, createdAt=datetime(year=2021, month=1, day=1), commandType=command_type, statu... | def create_completed_command(command_id: str='command-id', command_type: str='command-type', params: Optional[BaseModel]=None, result: Optional[BaseModel]=None) -> cmd.Command:
return cast(cmd.Command, cmd.BaseCommand(id=command_id, createdAt=datetime(year=2021, month=1, day=1), commandType=command_type, statu... |
1fda68e4d5160e8bdca2d81466a336eee10a0f45ba537890dbdf4f09c4a4fb39 | def create_load_labware_command(labware_id: str, location: LabwareLocation, definition: LabwareDefinition, offset_id: Optional[str]) -> cmd.LoadLabware:
'Create a completed LoadLabware command.'
params = cmd.LoadLabwareParams(loadName=definition.parameters.loadName, namespace=definition.namespace, version=defin... | Create a completed LoadLabware command. | api/tests/opentrons/protocol_engine/state/command_fixtures.py | create_load_labware_command | mrod0101/opentrons | 0 | python | def create_load_labware_command(labware_id: str, location: LabwareLocation, definition: LabwareDefinition, offset_id: Optional[str]) -> cmd.LoadLabware:
params = cmd.LoadLabwareParams(loadName=definition.parameters.loadName, namespace=definition.namespace, version=definition.version, location=location, labware... | def create_load_labware_command(labware_id: str, location: LabwareLocation, definition: LabwareDefinition, offset_id: Optional[str]) -> cmd.LoadLabware:
params = cmd.LoadLabwareParams(loadName=definition.parameters.loadName, namespace=definition.namespace, version=definition.version, location=location, labware... |
e5ce8d3f979f313c288ecd84e0419a26a1e35a3aac558d0d0ce0d83de719ff74 | def create_add_definition_command(definition: LabwareDefinition) -> cmd.AddLabwareDefinition:
'Create a completed AddLabwareDefinition command.'
params = cmd.AddLabwareDefinitionParams(definition=definition)
result = cmd.AddLabwareDefinitionResult(loadName=definition.parameters.loadName, namespace=definitio... | Create a completed AddLabwareDefinition command. | api/tests/opentrons/protocol_engine/state/command_fixtures.py | create_add_definition_command | mrod0101/opentrons | 0 | python | def create_add_definition_command(definition: LabwareDefinition) -> cmd.AddLabwareDefinition:
params = cmd.AddLabwareDefinitionParams(definition=definition)
result = cmd.AddLabwareDefinitionResult(loadName=definition.parameters.loadName, namespace=definition.namespace, version=definition.version)
retur... | def create_add_definition_command(definition: LabwareDefinition) -> cmd.AddLabwareDefinition:
params = cmd.AddLabwareDefinitionParams(definition=definition)
result = cmd.AddLabwareDefinitionResult(loadName=definition.parameters.loadName, namespace=definition.namespace, version=definition.version)
retur... |
73f4a4c60f8380ee5bcf252845d3983f22eef0daaeaffd41c14ba797dfae3dc0 | def create_load_pipette_command(pipette_id: str, pipette_name: PipetteName, mount: MountType) -> cmd.LoadPipette:
'Get a completed LoadPipette command.'
params = cmd.LoadPipetteParams(pipetteName=pipette_name, mount=mount)
result = cmd.LoadPipetteResult(pipetteId=pipette_id)
return cmd.LoadPipette(id='c... | Get a completed LoadPipette command. | api/tests/opentrons/protocol_engine/state/command_fixtures.py | create_load_pipette_command | mrod0101/opentrons | 0 | python | def create_load_pipette_command(pipette_id: str, pipette_name: PipetteName, mount: MountType) -> cmd.LoadPipette:
params = cmd.LoadPipetteParams(pipetteName=pipette_name, mount=mount)
result = cmd.LoadPipetteResult(pipetteId=pipette_id)
return cmd.LoadPipette(id='command-id', status=cmd.CommandStatus.S... | def create_load_pipette_command(pipette_id: str, pipette_name: PipetteName, mount: MountType) -> cmd.LoadPipette:
params = cmd.LoadPipetteParams(pipetteName=pipette_name, mount=mount)
result = cmd.LoadPipetteResult(pipetteId=pipette_id)
return cmd.LoadPipette(id='command-id', status=cmd.CommandStatus.S... |
316cad4c7f09e459e14f2ff038977c77c5c11e805d10476c5915f54d75c2111e | def create_aspirate_command(pipette_id: str, volume: float, labware_id: str='labware-id', well_name: str='A1', well_location: Optional[WellLocation]=None) -> cmd.Aspirate:
'Get a completed Aspirate command.'
params = cmd.AspirateParams(pipetteId=pipette_id, labwareId=labware_id, wellName=well_name, wellLocation... | Get a completed Aspirate command. | api/tests/opentrons/protocol_engine/state/command_fixtures.py | create_aspirate_command | mrod0101/opentrons | 0 | python | def create_aspirate_command(pipette_id: str, volume: float, labware_id: str='labware-id', well_name: str='A1', well_location: Optional[WellLocation]=None) -> cmd.Aspirate:
params = cmd.AspirateParams(pipetteId=pipette_id, labwareId=labware_id, wellName=well_name, wellLocation=(well_location or WellLocation()),... | def create_aspirate_command(pipette_id: str, volume: float, labware_id: str='labware-id', well_name: str='A1', well_location: Optional[WellLocation]=None) -> cmd.Aspirate:
params = cmd.AspirateParams(pipetteId=pipette_id, labwareId=labware_id, wellName=well_name, wellLocation=(well_location or WellLocation()),... |
6836d764672ee50a869725479570a5954a9dc3665843d6cdc5bb277eef98cca6 | def create_dispense_command(pipette_id: str, volume: float, labware_id: str='labware-id', well_name: str='A1', well_location: Optional[WellLocation]=None) -> cmd.Dispense:
'Get a completed Dispense command.'
params = cmd.DispenseParams(pipetteId=pipette_id, labwareId=labware_id, wellName=well_name, wellLocation... | Get a completed Dispense command. | api/tests/opentrons/protocol_engine/state/command_fixtures.py | create_dispense_command | mrod0101/opentrons | 0 | python | def create_dispense_command(pipette_id: str, volume: float, labware_id: str='labware-id', well_name: str='A1', well_location: Optional[WellLocation]=None) -> cmd.Dispense:
params = cmd.DispenseParams(pipetteId=pipette_id, labwareId=labware_id, wellName=well_name, wellLocation=(well_location or WellLocation()),... | def create_dispense_command(pipette_id: str, volume: float, labware_id: str='labware-id', well_name: str='A1', well_location: Optional[WellLocation]=None) -> cmd.Dispense:
params = cmd.DispenseParams(pipetteId=pipette_id, labwareId=labware_id, wellName=well_name, wellLocation=(well_location or WellLocation()),... |
6262bdc75750bda27cc70949ae5e6937b4684caaddba83e095ae8bd823dc33e4 | def create_pick_up_tip_command(pipette_id: str, labware_id: str='labware-id', well_name: str='A1') -> cmd.PickUpTip:
'Get a completed PickUpTip command.'
data = cmd.PickUpTipParams(pipetteId=pipette_id, labwareId=labware_id, wellName=well_name)
result = cmd.PickUpTipResult()
return cmd.PickUpTip(id='com... | Get a completed PickUpTip command. | api/tests/opentrons/protocol_engine/state/command_fixtures.py | create_pick_up_tip_command | mrod0101/opentrons | 0 | python | def create_pick_up_tip_command(pipette_id: str, labware_id: str='labware-id', well_name: str='A1') -> cmd.PickUpTip:
data = cmd.PickUpTipParams(pipetteId=pipette_id, labwareId=labware_id, wellName=well_name)
result = cmd.PickUpTipResult()
return cmd.PickUpTip(id='command-id', status=cmd.CommandStatus.S... | def create_pick_up_tip_command(pipette_id: str, labware_id: str='labware-id', well_name: str='A1') -> cmd.PickUpTip:
data = cmd.PickUpTipParams(pipetteId=pipette_id, labwareId=labware_id, wellName=well_name)
result = cmd.PickUpTipResult()
return cmd.PickUpTip(id='command-id', status=cmd.CommandStatus.S... |
c20cd9818f6c45039d4c4f4eb6c6cfaf91057e7264ed614286ab4a7a12820045 | def create_drop_tip_command(pipette_id: str, labware_id: str='labware-id', well_name: str='A1') -> cmd.DropTip:
'Get a completed DropTip command.'
params = cmd.DropTipParams(pipetteId=pipette_id, labwareId=labware_id, wellName=well_name)
result = cmd.DropTipResult()
return cmd.DropTip(id='command-id', s... | Get a completed DropTip command. | api/tests/opentrons/protocol_engine/state/command_fixtures.py | create_drop_tip_command | mrod0101/opentrons | 0 | python | def create_drop_tip_command(pipette_id: str, labware_id: str='labware-id', well_name: str='A1') -> cmd.DropTip:
params = cmd.DropTipParams(pipetteId=pipette_id, labwareId=labware_id, wellName=well_name)
result = cmd.DropTipResult()
return cmd.DropTip(id='command-id', status=cmd.CommandStatus.SUCCEEDED,... | def create_drop_tip_command(pipette_id: str, labware_id: str='labware-id', well_name: str='A1') -> cmd.DropTip:
params = cmd.DropTipParams(pipetteId=pipette_id, labwareId=labware_id, wellName=well_name)
result = cmd.DropTipResult()
return cmd.DropTip(id='command-id', status=cmd.CommandStatus.SUCCEEDED,... |
5812c0944134aedadd19909b651e162bbdf24a5dd358d1d3fec47c1dd229a1fa | def create_move_to_well_command(pipette_id: str, labware_id: str='labware-id', well_name: str='A1') -> cmd.MoveToWell:
'Get a completed MoveToWell command.'
params = cmd.MoveToWellParams(pipetteId=pipette_id, labwareId=labware_id, wellName=well_name)
result = cmd.MoveToWellResult()
return cmd.MoveToWell... | Get a completed MoveToWell command. | api/tests/opentrons/protocol_engine/state/command_fixtures.py | create_move_to_well_command | mrod0101/opentrons | 0 | python | def create_move_to_well_command(pipette_id: str, labware_id: str='labware-id', well_name: str='A1') -> cmd.MoveToWell:
params = cmd.MoveToWellParams(pipetteId=pipette_id, labwareId=labware_id, wellName=well_name)
result = cmd.MoveToWellResult()
return cmd.MoveToWell(id='command-id', status=cmd.CommandS... | def create_move_to_well_command(pipette_id: str, labware_id: str='labware-id', well_name: str='A1') -> cmd.MoveToWell:
params = cmd.MoveToWellParams(pipetteId=pipette_id, labwareId=labware_id, wellName=well_name)
result = cmd.MoveToWellResult()
return cmd.MoveToWell(id='command-id', status=cmd.CommandS... |
8d76cf9c82e0ab20a833eb6468143f0468f1bd39c5e30159c4b88da47a44be6a | def _get_results(self, hash_output=False):
'Digest info in the statepoint and return as a string.'
sp = openmc.StatePoint(self._sp_name)
self.mgxs_lib.load_from_statepoint(sp)
self.mgxs_lib.build_hdf5_store(directory='.')
with h5py.File('mgxs.h5', 'r') as f:
outstr = ''
for domain in... | Digest info in the statepoint and return as a string. | tests/regression_tests/mgxs_library_hdf5/test.py | _get_results | MC-kit/openmc | 262 | python | def _get_results(self, hash_output=False):
sp = openmc.StatePoint(self._sp_name)
self.mgxs_lib.load_from_statepoint(sp)
self.mgxs_lib.build_hdf5_store(directory='.')
with h5py.File('mgxs.h5', 'r') as f:
outstr =
for domain in self.mgxs_lib.domains:
for mgxs_type in self... | def _get_results(self, hash_output=False):
sp = openmc.StatePoint(self._sp_name)
self.mgxs_lib.load_from_statepoint(sp)
self.mgxs_lib.build_hdf5_store(directory='.')
with h5py.File('mgxs.h5', 'r') as f:
outstr =
for domain in self.mgxs_lib.domains:
for mgxs_type in self... |
da462d22cc3444c0dde0fe31b9bf928cf30c7a09228f1de1b55c40b859e2ba1b | def configure(config):
'\n | name | example | purpose |\n | ---- | ------- | ------- |\n | oblique_instance | https://oblique.sopel.chat/ | The Oblique instance to use when evaluating Python expressions (see <https://github.com/sopel-irc/oblique>) |\n '
config.define_section('py', PySection)
con... | | name | example | purpose |
| ---- | ------- | ------- |
| oblique_instance | https://oblique.sopel.chat/ | The Oblique instance to use when evaluating Python expressions (see <https://github.com/sopel-irc/oblique>) | | sopel/modules/py.py | configure | adamus1red/sopel | 555 | python | def configure(config):
'\n | name | example | purpose |\n | ---- | ------- | ------- |\n | oblique_instance | https://oblique.sopel.chat/ | The Oblique instance to use when evaluating Python expressions (see <https://github.com/sopel-irc/oblique>) |\n '
config.define_section('py', PySection)
con... | def configure(config):
'\n | name | example | purpose |\n | ---- | ------- | ------- |\n | oblique_instance | https://oblique.sopel.chat/ | The Oblique instance to use when evaluating Python expressions (see <https://github.com/sopel-irc/oblique>) |\n '
config.define_section('py', PySection)
con... |
7ca53de1244e781cd2c65d386a9662ef4b114c984256e4afba1b3784c8225a39 | @plugin.command('py')
@plugin.output_prefix('[py] ')
@plugin.example('.py len([1,2,3])', '3', online=True, vcr=True)
def py(bot, trigger):
'Evaluate a Python expression.'
query = trigger.group(2)
if (not query):
bot.reply('What expression do you want me to evaluate?')
return
uri = (bot.c... | Evaluate a Python expression. | sopel/modules/py.py | py | adamus1red/sopel | 555 | python | @plugin.command('py')
@plugin.output_prefix('[py] ')
@plugin.example('.py len([1,2,3])', '3', online=True, vcr=True)
def py(bot, trigger):
query = trigger.group(2)
if (not query):
bot.reply('What expression do you want me to evaluate?')
return
uri = (bot.config.py.oblique_instance + 'py... | @plugin.command('py')
@plugin.output_prefix('[py] ')
@plugin.example('.py len([1,2,3])', '3', online=True, vcr=True)
def py(bot, trigger):
query = trigger.group(2)
if (not query):
bot.reply('What expression do you want me to evaluate?')
return
uri = (bot.config.py.oblique_instance + 'py... |
e3eb378ae172c1c3d1ba9e23330b931a3b60a764e6d0cee5a5de558511fb4e28 | def system_run() -> None:
'os.system ่ฟ่ก'
print('os.system start!')
os.system(bash_cmd) | os.system ่ฟ่ก | python_advance/ๅจpython่ๆฌไธญ่ฟ่ก่ๆฌ็ๅ ็งๆนๆณ/run_bash.py | system_run | Dustyposa/goSpider | 66 | python | def system_run() -> None:
print('os.system start!')
os.system(bash_cmd) | def system_run() -> None:
print('os.system start!')
os.system(bash_cmd)<|docstring|>os.system ่ฟ่ก<|endoftext|> |
b9c1dfcacbf8a071334ee0eba9d0fd0f7d7aba00986109b0a366a6bd670d71ee | def os_popen_run() -> None:
'ไฝฟ็จos.popen ่ฟ่กๅญ่ฟ็จ'
print('Start')
with os.popen(' '.join(python_cmd_list)) as pipe:
for line in pipe.readlines():
print(line, end='')
'\n with os.popen(bash_cmd) as pipe, open("bash_out.txt", "w", encoding="u8") as fp:\n for line in pipe.readline... | ไฝฟ็จos.popen ่ฟ่กๅญ่ฟ็จ | python_advance/ๅจpython่ๆฌไธญ่ฟ่ก่ๆฌ็ๅ ็งๆนๆณ/run_bash.py | os_popen_run | Dustyposa/goSpider | 66 | python | def os_popen_run() -> None:
print('Start')
with os.popen(' '.join(python_cmd_list)) as pipe:
for line in pipe.readlines():
print(line, end=)
'\n with os.popen(bash_cmd) as pipe, open("bash_out.txt", "w", encoding="u8") as fp:\n for line in pipe.readlines():\n pr... | def os_popen_run() -> None:
print('Start')
with os.popen(' '.join(python_cmd_list)) as pipe:
for line in pipe.readlines():
print(line, end=)
'\n with os.popen(bash_cmd) as pipe, open("bash_out.txt", "w", encoding="u8") as fp:\n for line in pipe.readlines():\n pr... |
99065a2a80a967db9a50ec611aa78f428763af1d89b7ae82926599c40ff73af4 | def os_exec_run() -> None:
'ๆฟไปฃๅฝๅ่ฟ็จ็่ฟ่ก'
print('python ๆญฃๅจ่ฟ่ก')
time.sleep(5)
print('python ่ฟ่กๅฎๆฏ๏ผๆง่ก bash ่ๆฌ')
os.execv(zsh_file, bash_cmd_list) | ๆฟไปฃๅฝๅ่ฟ็จ็่ฟ่ก | python_advance/ๅจpython่ๆฌไธญ่ฟ่ก่ๆฌ็ๅ ็งๆนๆณ/run_bash.py | os_exec_run | Dustyposa/goSpider | 66 | python | def os_exec_run() -> None:
print('python ๆญฃๅจ่ฟ่ก')
time.sleep(5)
print('python ่ฟ่กๅฎๆฏ๏ผๆง่ก bash ่ๆฌ')
os.execv(zsh_file, bash_cmd_list) | def os_exec_run() -> None:
print('python ๆญฃๅจ่ฟ่ก')
time.sleep(5)
print('python ่ฟ่กๅฎๆฏ๏ผๆง่ก bash ่ๆฌ')
os.execv(zsh_file, bash_cmd_list)<|docstring|>ๆฟไปฃๅฝๅ่ฟ็จ็่ฟ่ก<|endoftext|> |
c0d56ea2f4a75477710d2db05c6a5822c11a16a2225afd4791f8a63bcd2c1251 | def receive_binary(self, algorithm: str) -> bytes:
'\n Returns a list of 8-bit integer values.\n Each value being one color channel.\n 3 values representing one pixel\n '
self.sock.send(f'''STATE {algorithm}
'''.encode('ASCII'))
response = b''
while ((len(response) == 0) or (... | Returns a list of 8-bit integer values.
Each value being one color channel.
3 values representing one pixel | frontend-python/src/pixelflut_client.py | receive_binary | ftsell/pixelflu | 7 | python | def receive_binary(self, algorithm: str) -> bytes:
'\n Returns a list of 8-bit integer values.\n Each value being one color channel.\n 3 values representing one pixel\n '
self.sock.send(f'STATE {algorithm}
'.encode('ASCII'))
response = b
while ((len(response) == 0) or (respon... | def receive_binary(self, algorithm: str) -> bytes:
'\n Returns a list of 8-bit integer values.\n Each value being one color channel.\n 3 values representing one pixel\n '
self.sock.send(f'STATE {algorithm}
'.encode('ASCII'))
response = b
while ((len(response) == 0) or (respon... |
d285f7e3ea99a00609640404b322005e309abb0b290a5f62b8bb91ff58eb3905 | def __init__(__self__, *, namespace: str, default_action: Optional[str]=None, filter_action: Optional[str]=None, filter_source: Optional[str]=None):
'\n :param str namespace: An AWS custom namespace having custom AWS metrics that you want to sync with SignalFx. See the AWS documentation on publishing metrics... | :param str namespace: An AWS custom namespace having custom AWS metrics that you want to sync with SignalFx. See the AWS documentation on publishing metrics for more information.
:param str default_action: Controls the SignalFx default behavior for processing data from an AWS namespace. If you do specify a filter, use ... | sdk/python/pulumi_signalfx/aws/outputs.py | __init__ | pulumi/pulumi-signalfx | 2 | python | def __init__(__self__, *, namespace: str, default_action: Optional[str]=None, filter_action: Optional[str]=None, filter_source: Optional[str]=None):
'\n :param str namespace: An AWS custom namespace having custom AWS metrics that you want to sync with SignalFx. See the AWS documentation on publishing metrics... | def __init__(__self__, *, namespace: str, default_action: Optional[str]=None, filter_action: Optional[str]=None, filter_source: Optional[str]=None):
'\n :param str namespace: An AWS custom namespace having custom AWS metrics that you want to sync with SignalFx. See the AWS documentation on publishing metrics... |
06be44dbef1c56e4d7999dca4889f5f622779441a0a7ab21f444f10a02036ab0 | @property
@pulumi.getter
def namespace(self) -> str:
'\n An AWS custom namespace having custom AWS metrics that you want to sync with SignalFx. See the AWS documentation on publishing metrics for more information.\n '
return pulumi.get(self, 'namespace') | An AWS custom namespace having custom AWS metrics that you want to sync with SignalFx. See the AWS documentation on publishing metrics for more information. | sdk/python/pulumi_signalfx/aws/outputs.py | namespace | pulumi/pulumi-signalfx | 2 | python | @property
@pulumi.getter
def namespace(self) -> str:
'\n \n '
return pulumi.get(self, 'namespace') | @property
@pulumi.getter
def namespace(self) -> str:
'\n \n '
return pulumi.get(self, 'namespace')<|docstring|>An AWS custom namespace having custom AWS metrics that you want to sync with SignalFx. See the AWS documentation on publishing metrics for more information.<|endoftext|> |
53d8c20776227ce43db617bc59eda02fd579879887c1ff8e67b99778854b64af | @property
@pulumi.getter(name='defaultAction')
def default_action(self) -> Optional[str]:
'\n Controls the SignalFx default behavior for processing data from an AWS namespace. If you do specify a filter, use this property to control how SignalFx treats data that doesn\'t match the filter. The available actio... | Controls the SignalFx default behavior for processing data from an AWS namespace. If you do specify a filter, use this property to control how SignalFx treats data that doesn't match the filter. The available actions are one of `"Include"` or `"Exclude"`. | sdk/python/pulumi_signalfx/aws/outputs.py | default_action | pulumi/pulumi-signalfx | 2 | python | @property
@pulumi.getter(name='defaultAction')
def default_action(self) -> Optional[str]:
'\n Controls the SignalFx default behavior for processing data from an AWS namespace. If you do specify a filter, use this property to control how SignalFx treats data that doesn\'t match the filter. The available actio... | @property
@pulumi.getter(name='defaultAction')
def default_action(self) -> Optional[str]:
'\n Controls the SignalFx default behavior for processing data from an AWS namespace. If you do specify a filter, use this property to control how SignalFx treats data that doesn\'t match the filter. The available actio... |
74c1c268ff3a2abb288da840122c52b189f69fedbdbe838c3cc028763a76c92c | @property
@pulumi.getter(name='filterAction')
def filter_action(self) -> Optional[str]:
'\n Controls how SignalFx processes data from a custom AWS namespace. The available actions are one of `"Include"` or `"Exclude"`.\n '
return pulumi.get(self, 'filter_action') | Controls how SignalFx processes data from a custom AWS namespace. The available actions are one of `"Include"` or `"Exclude"`. | sdk/python/pulumi_signalfx/aws/outputs.py | filter_action | pulumi/pulumi-signalfx | 2 | python | @property
@pulumi.getter(name='filterAction')
def filter_action(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'filter_action') | @property
@pulumi.getter(name='filterAction')
def filter_action(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'filter_action')<|docstring|>Controls how SignalFx processes data from a custom AWS namespace. The available actions are one of `"Include"` or `"Exclude"`.<|endoftext|> |
06d30016a12ec6de0b3cbceffd14427bcc06c941cdda0330927d4295df4194c1 | @property
@pulumi.getter(name='filterSource')
def filter_source(self) -> Optional[str]:
'\n Expression that selects the data that SignalFx should sync for the custom namespace associated with this sync rule. The expression uses the syntax defined for the SignalFlow `filter()` function; it can be any valid Si... | Expression that selects the data that SignalFx should sync for the custom namespace associated with this sync rule. The expression uses the syntax defined for the SignalFlow `filter()` function; it can be any valid SignalFlow filter expression. | sdk/python/pulumi_signalfx/aws/outputs.py | filter_source | pulumi/pulumi-signalfx | 2 | python | @property
@pulumi.getter(name='filterSource')
def filter_source(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'filter_source') | @property
@pulumi.getter(name='filterSource')
def filter_source(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'filter_source')<|docstring|>Expression that selects the data that SignalFx should sync for the custom namespace associated with this sync rule. The expression uses the syntax d... |
d285f7e3ea99a00609640404b322005e309abb0b290a5f62b8bb91ff58eb3905 | def __init__(__self__, *, namespace: str, default_action: Optional[str]=None, filter_action: Optional[str]=None, filter_source: Optional[str]=None):
'\n :param str namespace: An AWS custom namespace having custom AWS metrics that you want to sync with SignalFx. See the AWS documentation on publishing metrics... | :param str namespace: An AWS custom namespace having custom AWS metrics that you want to sync with SignalFx. See the AWS documentation on publishing metrics for more information.
:param str default_action: Controls the SignalFx default behavior for processing data from an AWS namespace. If you do specify a filter, use ... | sdk/python/pulumi_signalfx/aws/outputs.py | __init__ | pulumi/pulumi-signalfx | 2 | python | def __init__(__self__, *, namespace: str, default_action: Optional[str]=None, filter_action: Optional[str]=None, filter_source: Optional[str]=None):
'\n :param str namespace: An AWS custom namespace having custom AWS metrics that you want to sync with SignalFx. See the AWS documentation on publishing metrics... | def __init__(__self__, *, namespace: str, default_action: Optional[str]=None, filter_action: Optional[str]=None, filter_source: Optional[str]=None):
'\n :param str namespace: An AWS custom namespace having custom AWS metrics that you want to sync with SignalFx. See the AWS documentation on publishing metrics... |
06be44dbef1c56e4d7999dca4889f5f622779441a0a7ab21f444f10a02036ab0 | @property
@pulumi.getter
def namespace(self) -> str:
'\n An AWS custom namespace having custom AWS metrics that you want to sync with SignalFx. See the AWS documentation on publishing metrics for more information.\n '
return pulumi.get(self, 'namespace') | An AWS custom namespace having custom AWS metrics that you want to sync with SignalFx. See the AWS documentation on publishing metrics for more information. | sdk/python/pulumi_signalfx/aws/outputs.py | namespace | pulumi/pulumi-signalfx | 2 | python | @property
@pulumi.getter
def namespace(self) -> str:
'\n \n '
return pulumi.get(self, 'namespace') | @property
@pulumi.getter
def namespace(self) -> str:
'\n \n '
return pulumi.get(self, 'namespace')<|docstring|>An AWS custom namespace having custom AWS metrics that you want to sync with SignalFx. See the AWS documentation on publishing metrics for more information.<|endoftext|> |
53d8c20776227ce43db617bc59eda02fd579879887c1ff8e67b99778854b64af | @property
@pulumi.getter(name='defaultAction')
def default_action(self) -> Optional[str]:
'\n Controls the SignalFx default behavior for processing data from an AWS namespace. If you do specify a filter, use this property to control how SignalFx treats data that doesn\'t match the filter. The available actio... | Controls the SignalFx default behavior for processing data from an AWS namespace. If you do specify a filter, use this property to control how SignalFx treats data that doesn't match the filter. The available actions are one of `"Include"` or `"Exclude"`. | sdk/python/pulumi_signalfx/aws/outputs.py | default_action | pulumi/pulumi-signalfx | 2 | python | @property
@pulumi.getter(name='defaultAction')
def default_action(self) -> Optional[str]:
'\n Controls the SignalFx default behavior for processing data from an AWS namespace. If you do specify a filter, use this property to control how SignalFx treats data that doesn\'t match the filter. The available actio... | @property
@pulumi.getter(name='defaultAction')
def default_action(self) -> Optional[str]:
'\n Controls the SignalFx default behavior for processing data from an AWS namespace. If you do specify a filter, use this property to control how SignalFx treats data that doesn\'t match the filter. The available actio... |
74c1c268ff3a2abb288da840122c52b189f69fedbdbe838c3cc028763a76c92c | @property
@pulumi.getter(name='filterAction')
def filter_action(self) -> Optional[str]:
'\n Controls how SignalFx processes data from a custom AWS namespace. The available actions are one of `"Include"` or `"Exclude"`.\n '
return pulumi.get(self, 'filter_action') | Controls how SignalFx processes data from a custom AWS namespace. The available actions are one of `"Include"` or `"Exclude"`. | sdk/python/pulumi_signalfx/aws/outputs.py | filter_action | pulumi/pulumi-signalfx | 2 | python | @property
@pulumi.getter(name='filterAction')
def filter_action(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'filter_action') | @property
@pulumi.getter(name='filterAction')
def filter_action(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'filter_action')<|docstring|>Controls how SignalFx processes data from a custom AWS namespace. The available actions are one of `"Include"` or `"Exclude"`.<|endoftext|> |
06d30016a12ec6de0b3cbceffd14427bcc06c941cdda0330927d4295df4194c1 | @property
@pulumi.getter(name='filterSource')
def filter_source(self) -> Optional[str]:
'\n Expression that selects the data that SignalFx should sync for the custom namespace associated with this sync rule. The expression uses the syntax defined for the SignalFlow `filter()` function; it can be any valid Si... | Expression that selects the data that SignalFx should sync for the custom namespace associated with this sync rule. The expression uses the syntax defined for the SignalFlow `filter()` function; it can be any valid SignalFlow filter expression. | sdk/python/pulumi_signalfx/aws/outputs.py | filter_source | pulumi/pulumi-signalfx | 2 | python | @property
@pulumi.getter(name='filterSource')
def filter_source(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'filter_source') | @property
@pulumi.getter(name='filterSource')
def filter_source(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'filter_source')<|docstring|>Expression that selects the data that SignalFx should sync for the custom namespace associated with this sync rule. The expression uses the syntax d... |
53a59f8bc17acfab8fa3379cda28dbbdd8a55a551483de58d0e8cd43da3cead0 | @abstractmethod
def construct_circuit(self, mode, qubits=None, circuit=None):
"Construct the qft circuit.\n\n Args:\n mode (str): 'vector' or 'circuit'\n qubits (QuantumRegister or qubits): register or qubits to build the qft circuit on.\n circuit (QuantumCircuit): circuit fo... | Construct the qft circuit.
Args:
mode (str): 'vector' or 'circuit'
qubits (QuantumRegister or qubits): register or qubits to build the qft circuit on.
circuit (QuantumCircuit): circuit for construction.
Returns:
The qft circuit. | qiskit/aqua/components/qfts/qft.py | construct_circuit | dpad/qiskit-aqua | 0 | python | @abstractmethod
def construct_circuit(self, mode, qubits=None, circuit=None):
"Construct the qft circuit.\n\n Args:\n mode (str): 'vector' or 'circuit'\n qubits (QuantumRegister or qubits): register or qubits to build the qft circuit on.\n circuit (QuantumCircuit): circuit fo... | @abstractmethod
def construct_circuit(self, mode, qubits=None, circuit=None):
"Construct the qft circuit.\n\n Args:\n mode (str): 'vector' or 'circuit'\n qubits (QuantumRegister or qubits): register or qubits to build the qft circuit on.\n circuit (QuantumCircuit): circuit fo... |
0363bffdeac2734b8288787f3dcd435665475132e8fd92b0698bc13fd7162b9f | def reporthook(count, block_size, total_size):
'\n Function that displays the status and speed of the download\n\n '
global start_time
if (count == 0):
start_time = time.time()
return
duration = (time.time() - start_time)
progress_size = int((count * block_size))
speed = in... | Function that displays the status and speed of the download | codes/util/input_output.py | reporthook | jagar2/Revealing-Ferroelectric-Switching-Character-Using-Deep-Recurrent-Neural-Networks | 20 | python | def reporthook(count, block_size, total_size):
'\n \n\n '
global start_time
if (count == 0):
start_time = time.time()
return
duration = (time.time() - start_time)
progress_size = int((count * block_size))
speed = int((progress_size / (1024 * duration)))
percent = int(((... | def reporthook(count, block_size, total_size):
'\n \n\n '
global start_time
if (count == 0):
start_time = time.time()
return
duration = (time.time() - start_time)
progress_size = int((count * block_size))
speed = int((progress_size / (1024 * duration)))
percent = int(((... |
ff1b6cd2b315906cd6816f8a584fa21960a81b6673d0b3bb42c42b46bbdc9657 | def download_file(url, filename):
'\n Function that downloads the data file from a URL\n\n Parameters\n ----------\n\n url : string\n url where the file to download is located\n filename : string\n location where to save the file\n reporthook : function\n callback to display t... | Function that downloads the data file from a URL
Parameters
----------
url : string
url where the file to download is located
filename : string
location where to save the file
reporthook : function
callback to display the download progress | codes/util/input_output.py | download_file | jagar2/Revealing-Ferroelectric-Switching-Character-Using-Deep-Recurrent-Neural-Networks | 20 | python | def download_file(url, filename):
'\n Function that downloads the data file from a URL\n\n Parameters\n ----------\n\n url : string\n url where the file to download is located\n filename : string\n location where to save the file\n reporthook : function\n callback to display t... | def download_file(url, filename):
'\n Function that downloads the data file from a URL\n\n Parameters\n ----------\n\n url : string\n url where the file to download is located\n filename : string\n location where to save the file\n reporthook : function\n callback to display t... |
34bacfa98f2311f2bd0b840f1515eae85f30d6b6e5030871fe5f1b8df48c975f | def compress_folder(base_name, format, root_dir=None):
'\n Function that zips a folder can save zip and tar\n\n Parameters\n ----------\n\n base_name : string\n base name of the zip file\n format : string\n sets the format of the zip file. Can either be zip or tar\n root_dir : string... | Function that zips a folder can save zip and tar
Parameters
----------
base_name : string
base name of the zip file
format : string
sets the format of the zip file. Can either be zip or tar
root_dir : string (optional)
sets the root directory to save the file | codes/util/input_output.py | compress_folder | jagar2/Revealing-Ferroelectric-Switching-Character-Using-Deep-Recurrent-Neural-Networks | 20 | python | def compress_folder(base_name, format, root_dir=None):
'\n Function that zips a folder can save zip and tar\n\n Parameters\n ----------\n\n base_name : string\n base name of the zip file\n format : string\n sets the format of the zip file. Can either be zip or tar\n root_dir : string... | def compress_folder(base_name, format, root_dir=None):
'\n Function that zips a folder can save zip and tar\n\n Parameters\n ----------\n\n base_name : string\n base name of the zip file\n format : string\n sets the format of the zip file. Can either be zip or tar\n root_dir : string... |
599f37ce817e6f40f03afefccd2517b53cca050b32d8084f16a9cc9c89a0f751 | def unzip(filename, path):
'\n Function that unzips the files\n\n Parameters\n ----------\n\n filename : string\n base name of the zip file\n path : string\n path where the zip file will be saved\n\n '
zip_ref = zipfile.ZipFile(('./' + filename), 'r')
zip_ref.extractall(path)... | Function that unzips the files
Parameters
----------
filename : string
base name of the zip file
path : string
path where the zip file will be saved | codes/util/input_output.py | unzip | jagar2/Revealing-Ferroelectric-Switching-Character-Using-Deep-Recurrent-Neural-Networks | 20 | python | def unzip(filename, path):
'\n Function that unzips the files\n\n Parameters\n ----------\n\n filename : string\n base name of the zip file\n path : string\n path where the zip file will be saved\n\n '
zip_ref = zipfile.ZipFile(('./' + filename), 'r')
zip_ref.extractall(path)... | def unzip(filename, path):
'\n Function that unzips the files\n\n Parameters\n ----------\n\n filename : string\n base name of the zip file\n path : string\n path where the zip file will be saved\n\n '
zip_ref = zipfile.ZipFile(('./' + filename), 'r')
zip_ref.extractall(path)... |
8b8b8347f89a24e63ee8ac44ca3539f091a33f6dba881ba2164cb396ff170d3e | def get_size(start_path='.'):
'\n\n Function that computes the size of a folder\n\n Parameters\n ----------\n\n start_path : string\n Path to compute the size of\n\n Return\n ----------\n\n total_size : float\n Size of the folder\n '
total_size = 0
for (dirpath, dirnames, file... | Function that computes the size of a folder
Parameters
----------
start_path : string
Path to compute the size of
Return
----------
total_size : float
Size of the folder | codes/util/input_output.py | get_size | jagar2/Revealing-Ferroelectric-Switching-Character-Using-Deep-Recurrent-Neural-Networks | 20 | python | def get_size(start_path='.'):
'\n\n Function that computes the size of a folder\n\n Parameters\n ----------\n\n start_path : string\n Path to compute the size of\n\n Return\n ----------\n\n total_size : float\n Size of the folder\n '
total_size = 0
for (dirpath, dirnames, file... | def get_size(start_path='.'):
'\n\n Function that computes the size of a folder\n\n Parameters\n ----------\n\n start_path : string\n Path to compute the size of\n\n Return\n ----------\n\n total_size : float\n Size of the folder\n '
total_size = 0
for (dirpath, dirnames, file... |
6b3e06b0191fb9def6954ee3a31013c0c82f795dd2dcda4c47457e2c6e43bea4 | def download_and_unzip(filename, url, save_path, download_data):
'\n\n Function that computes the size of a folder\n\n Parameters\n ----------\n\n filename : string\n filename to save the zip file\n url : string\n url where the file is located\n save_path :... | Function that computes the size of a folder
Parameters
----------
filename : string
filename to save the zip file
url : string
url where the file is located
save_path : string
place where the data is saved
download_data : bool
sets if to download the data | codes/util/input_output.py | download_and_unzip | jagar2/Revealing-Ferroelectric-Switching-Character-Using-Deep-Recurrent-Neural-Networks | 20 | python | def download_and_unzip(filename, url, save_path, download_data):
'\n\n Function that computes the size of a folder\n\n Parameters\n ----------\n\n filename : string\n filename to save the zip file\n url : string\n url where the file is located\n save_path :... | def download_and_unzip(filename, url, save_path, download_data):
'\n\n Function that computes the size of a folder\n\n Parameters\n ----------\n\n filename : string\n filename to save the zip file\n url : string\n url where the file is located\n save_path :... |
ab3394018c574df266e9ed3a584d8d3b360bb3a19a580ecef3fb1a06f81b36a7 | def __dump_operator(operator: Operator, index: int):
'\n Prints operator in human-readable format.\n :param operator: The operator to dump.\n :param index: The index of the operator.\n '
if (operator.type == OperatorType.INTRINSIC):
readable_operator_name = operator.operand.name
read... | Prints operator in human-readable format.
:param operator: The operator to dump.
:param index: The index of the operator. | src/gofra/systems/dump.py | __dump_operator | GofraLang/core | 5 | python | def __dump_operator(operator: Operator, index: int):
'\n Prints operator in human-readable format.\n :param operator: The operator to dump.\n :param index: The index of the operator.\n '
if (operator.type == OperatorType.INTRINSIC):
readable_operator_name = operator.operand.name
read... | def __dump_operator(operator: Operator, index: int):
'\n Prints operator in human-readable format.\n :param operator: The operator to dump.\n :param index: The index of the operator.\n '
if (operator.type == OperatorType.INTRINSIC):
readable_operator_name = operator.operand.name
read... |
be0122d4f92b135fc90c10851792f9836fefc50bf0cfc31c4052813f91a5f7f6 | def dump(operators: List[Operator]):
'\n Prints all operators from given list in human-readable format.\n :param operators: List of operators.\n '
assert (len(operators) > 0), 'List of operators should be not empty!'
for (index, operator) in enumerate(operators):
__dump_operator(ope... | Prints all operators from given list in human-readable format.
:param operators: List of operators. | src/gofra/systems/dump.py | dump | GofraLang/core | 5 | python | def dump(operators: List[Operator]):
'\n Prints all operators from given list in human-readable format.\n :param operators: List of operators.\n '
assert (len(operators) > 0), 'List of operators should be not empty!'
for (index, operator) in enumerate(operators):
__dump_operator(ope... | def dump(operators: List[Operator]):
'\n Prints all operators from given list in human-readable format.\n :param operators: List of operators.\n '
assert (len(operators) > 0), 'List of operators should be not empty!'
for (index, operator) in enumerate(operators):
__dump_operator(ope... |
30650166082cb41096727c6981cb7e84d0ed9c077321cfec7eca208825297b50 | def connect_to_database(self, module_name: str=None, database: str=None, username: str=None, password: str=None, host: str=None, port: int=None, charset: str=None, config_file: str='db.cfg', autocommit: bool=False):
'Connect to database using DB API 2.0 module.\n\n :param module_name: database module to use\... | Connect to database using DB API 2.0 module.
:param module_name: database module to use
:param database: name of the database
:param username: of the user accessing the database
:param password: of the user accessing the database
:param host: SQL server address
:param port: SQL server port
:param charset: for example,... | packages/main/src/RPA/Database.py | connect_to_database | rooky-c3bo/rpaframework | 518 | python | def connect_to_database(self, module_name: str=None, database: str=None, username: str=None, password: str=None, host: str=None, port: int=None, charset: str=None, config_file: str='db.cfg', autocommit: bool=False):
'Connect to database using DB API 2.0 module.\n\n :param module_name: database module to use\... | def connect_to_database(self, module_name: str=None, database: str=None, username: str=None, password: str=None, host: str=None, port: int=None, charset: str=None, config_file: str='db.cfg', autocommit: bool=False):
'Connect to database using DB API 2.0 module.\n\n :param module_name: database module to use\... |
8e4dbecec712c9cf443fcbb2755fc8723e96fe79f4285e653947eb02ecfc919e | def call_stored_procedure(self, name, params=None, sanstran=False):
'Call stored procedure with name and params.\n\n :param name: procedure name\n :param params: parameters for the procedure as a list, defaults to None\n :param sanstran: run command without an explicit transaction commit or rol... | Call stored procedure with name and params.
:param name: procedure name
:param params: parameters for the procedure as a list, defaults to None
:param sanstran: run command without an explicit transaction commit or rollback,
defaults to False
Example:
.. code-block:: robotframework
@{params} Create List ... | packages/main/src/RPA/Database.py | call_stored_procedure | rooky-c3bo/rpaframework | 518 | python | def call_stored_procedure(self, name, params=None, sanstran=False):
'Call stored procedure with name and params.\n\n :param name: procedure name\n :param params: parameters for the procedure as a list, defaults to None\n :param sanstran: run command without an explicit transaction commit or rol... | def call_stored_procedure(self, name, params=None, sanstran=False):
'Call stored procedure with name and params.\n\n :param name: procedure name\n :param params: parameters for the procedure as a list, defaults to None\n :param sanstran: run command without an explicit transaction commit or rol... |
53f5083045e7a346d78cbc4ad1ee22a3bf24a344fbcbcb45215ab2fb7c7c1305 | def description(self, table):
'Get description of the SQL table\n\n :param table: name of the SQL table\n\n Example:\n\n .. code-block:: robotframework\n\n Connect To Database pymysql mydb user pass 127.0.0.1\n ${db_description} Description mytable\n\n ... | Get description of the SQL table
:param table: name of the SQL table
Example:
.. code-block:: robotframework
Connect To Database pymysql mydb user pass 127.0.0.1
${db_description} Description mytable | packages/main/src/RPA/Database.py | description | rooky-c3bo/rpaframework | 518 | python | def description(self, table):
'Get description of the SQL table\n\n :param table: name of the SQL table\n\n Example:\n\n .. code-block:: robotframework\n\n Connect To Database pymysql mydb user pass 127.0.0.1\n ${db_description} Description mytable\n\n ... | def description(self, table):
'Get description of the SQL table\n\n :param table: name of the SQL table\n\n Example:\n\n .. code-block:: robotframework\n\n Connect To Database pymysql mydb user pass 127.0.0.1\n ${db_description} Description mytable\n\n ... |
e24fdd5359b8656c1443fdb0c45b09c536f327178c29770246f8e79d78327e07 | def disconnect_from_database(self):
'Close connection to SQL database\n\n Example:\n\n .. code-block:: robotframework\n\n Connect To Database pymysql mydb user pass 127.0.0.1\n ${result} Query Select firstname, lastname FROM table\n Disconnect Fro... | Close connection to SQL database
Example:
.. code-block:: robotframework
Connect To Database pymysql mydb user pass 127.0.0.1
${result} Query Select firstname, lastname FROM table
Disconnect From Database | packages/main/src/RPA/Database.py | disconnect_from_database | rooky-c3bo/rpaframework | 518 | python | def disconnect_from_database(self):
'Close connection to SQL database\n\n Example:\n\n .. code-block:: robotframework\n\n Connect To Database pymysql mydb user pass 127.0.0.1\n ${result} Query Select firstname, lastname FROM table\n Disconnect Fro... | def disconnect_from_database(self):
'Close connection to SQL database\n\n Example:\n\n .. code-block:: robotframework\n\n Connect To Database pymysql mydb user pass 127.0.0.1\n ${result} Query Select firstname, lastname FROM table\n Disconnect Fro... |
f618333c73f2752da894d304bddd166ed5862bf2d9e0cd0fd7f0db84cc7dbd2b | def execute_sql_script(self, filename, sanstran=False, encoding='utf-8'):
'Execute content of SQL script as SQL commands.\n\n :param filename: filepath to SQL script to execute\n :param sanstran: run command without an explicit transaction commit or rollback,\n defaults to False\n :para... | Execute content of SQL script as SQL commands.
:param filename: filepath to SQL script to execute
:param sanstran: run command without an explicit transaction commit or rollback,
defaults to False
:param encoding: character encoding of file
Example:
.. code-block:: robotframework
Execute SQL Script script.sq... | packages/main/src/RPA/Database.py | execute_sql_script | rooky-c3bo/rpaframework | 518 | python | def execute_sql_script(self, filename, sanstran=False, encoding='utf-8'):
'Execute content of SQL script as SQL commands.\n\n :param filename: filepath to SQL script to execute\n :param sanstran: run command without an explicit transaction commit or rollback,\n defaults to False\n :para... | def execute_sql_script(self, filename, sanstran=False, encoding='utf-8'):
'Execute content of SQL script as SQL commands.\n\n :param filename: filepath to SQL script to execute\n :param sanstran: run command without an explicit transaction commit or rollback,\n defaults to False\n :para... |
edc1f371ea6d9d821e11062fa8b975917ad73ab2dceafccd219e6389052e66e7 | def query(self, statement: str, assertion: str=None, sanstran: bool=False, as_table: bool=True):
"Make a SQL query.\n\n :param statement: SQL statement to execute\n :param assertion: assert on query result, row_count or columns.\n Works only for SELECT statements Defaults to None.\n :pa... | Make a SQL query.
:param statement: SQL statement to execute
:param assertion: assert on query result, row_count or columns.
Works only for SELECT statements Defaults to None.
:param sanstran: run command without an explicit transaction commit or rollback,
defaults to False
:param as_table: if result should be insta... | packages/main/src/RPA/Database.py | query | rooky-c3bo/rpaframework | 518 | python | def query(self, statement: str, assertion: str=None, sanstran: bool=False, as_table: bool=True):
"Make a SQL query.\n\n :param statement: SQL statement to execute\n :param assertion: assert on query result, row_count or columns.\n Works only for SELECT statements Defaults to None.\n :pa... | def query(self, statement: str, assertion: str=None, sanstran: bool=False, as_table: bool=True):
"Make a SQL query.\n\n :param statement: SQL statement to execute\n :param assertion: assert on query result, row_count or columns.\n Works only for SELECT statements Defaults to None.\n :pa... |
7163ccf3b81e4d56b0e37f828facf448fffc38287bf261517f93dada5bfa425a | def set_auto_commit(self, autocommit=True):
'Set database auto commit mode.\n\n :param autocommit: boolean value for auto commit, defaults to True\n\n Example:\n\n .. code-block:: robotframework\n\n Set Auto Commit # auto commit is set on\n Set Auto Commit Fa... | Set database auto commit mode.
:param autocommit: boolean value for auto commit, defaults to True
Example:
.. code-block:: robotframework
Set Auto Commit # auto commit is set on
Set Auto Commit False # auto commit is turned off | packages/main/src/RPA/Database.py | set_auto_commit | rooky-c3bo/rpaframework | 518 | python | def set_auto_commit(self, autocommit=True):
'Set database auto commit mode.\n\n :param autocommit: boolean value for auto commit, defaults to True\n\n Example:\n\n .. code-block:: robotframework\n\n Set Auto Commit # auto commit is set on\n Set Auto Commit Fa... | def set_auto_commit(self, autocommit=True):
'Set database auto commit mode.\n\n :param autocommit: boolean value for auto commit, defaults to True\n\n Example:\n\n .. code-block:: robotframework\n\n Set Auto Commit # auto commit is set on\n Set Auto Commit Fa... |
fb4c1cfaa93e1e3d6a10be04edac539ea97ffa9469beb17bc4fad2f3dfd11f0f | def get_rows(self, table, columns=None, conditions=None, as_table=True):
"Get rows from table. Columns and conditions can be\n set to filter result.\n\n :param table: name of the SQL table\n :param columns: name of columns to return, defaults to `None`\n means that all columns are retur... | Get rows from table. Columns and conditions can be
set to filter result.
:param table: name of the SQL table
:param columns: name of columns to return, defaults to `None`
means that all columns are returned
:param conditions: limiting result by WHERE clause, defaults to `None`
:param as_table: if result should be ins... | packages/main/src/RPA/Database.py | get_rows | rooky-c3bo/rpaframework | 518 | python | def get_rows(self, table, columns=None, conditions=None, as_table=True):
"Get rows from table. Columns and conditions can be\n set to filter result.\n\n :param table: name of the SQL table\n :param columns: name of columns to return, defaults to `None`\n means that all columns are retur... | def get_rows(self, table, columns=None, conditions=None, as_table=True):
"Get rows from table. Columns and conditions can be\n set to filter result.\n\n :param table: name of the SQL table\n :param columns: name of columns to return, defaults to `None`\n means that all columns are retur... |
2f40fc22651e6025daef967b53799ce2ef04672929f5ef2970c932eb11e73cb1 | def get_number_of_rows(self, table, conditions=None):
"Get number of rows in a table. Conditions can be given\n as arguments for WHERE clause.\n\n :param table: name of the SQL table\n :param conditions: restrictions for selections, defaults to None\n\n Example:\n\n .. code-block:... | Get number of rows in a table. Conditions can be given
as arguments for WHERE clause.
:param table: name of the SQL table
:param conditions: restrictions for selections, defaults to None
Example:
.. code-block:: robotframework
${count} Get Number Of Rows tablename
${count} Get Number Of Rows tablename... | packages/main/src/RPA/Database.py | get_number_of_rows | rooky-c3bo/rpaframework | 518 | python | def get_number_of_rows(self, table, conditions=None):
"Get number of rows in a table. Conditions can be given\n as arguments for WHERE clause.\n\n :param table: name of the SQL table\n :param conditions: restrictions for selections, defaults to None\n\n Example:\n\n .. code-block:... | def get_number_of_rows(self, table, conditions=None):
"Get number of rows in a table. Conditions can be given\n as arguments for WHERE clause.\n\n :param table: name of the SQL table\n :param conditions: restrictions for selections, defaults to None\n\n Example:\n\n .. code-block:... |
5cf0738494cca1d0ded09f6b784e02e65980e7fd8ad81c6ee3541d05f06dd092 | @abstractmethod
def _create_splits(self) -> Dict[(str, Tuple[str])]:
'Create the key splits using keys as the split name (i.e. ``train``) and the\n values as a list of the keys for the corresponding split.\n\n '
pass | Create the key splits using keys as the split name (i.e. ``train``) and the
values as a list of the keys for the corresponding split. | src/python/zensols/dataset/split.py | _create_splits | plandes/deeplearn | 2 | python | @abstractmethod
def _create_splits(self) -> Dict[(str, Tuple[str])]:
'Create the key splits using keys as the split name (i.e. ``train``) and the\n values as a list of the keys for the corresponding split.\n\n '
pass | @abstractmethod
def _create_splits(self) -> Dict[(str, Tuple[str])]:
'Create the key splits using keys as the split name (i.e. ``train``) and the\n values as a list of the keys for the corresponding split.\n\n '
pass<|docstring|>Create the key splits using keys as the split name (i.e. ``train``) a... |
b5b2a842b0171f85d65becf96cf5140f6e5be13282fa759f9f60c5b636b6a014 | def _create_splits_and_write(self):
'Write the keys in order to the file system.\n\n '
self.key_path.mkdir(parents=True, exist_ok=True)
for (name, keys) in self._create_splits().items():
fname = self.pattern.format(**{'name': name})
key_path = (self.key_path / fname)
with open... | Write the keys in order to the file system. | src/python/zensols/dataset/split.py | _create_splits_and_write | plandes/deeplearn | 2 | python | def _create_splits_and_write(self):
'\n\n '
self.key_path.mkdir(parents=True, exist_ok=True)
for (name, keys) in self._create_splits().items():
fname = self.pattern.format(**{'name': name})
key_path = (self.key_path / fname)
with open(key_path, 'w') as f:
for k in ... | def _create_splits_and_write(self):
'\n\n '
self.key_path.mkdir(parents=True, exist_ok=True)
for (name, keys) in self._create_splits().items():
fname = self.pattern.format(**{'name': name})
key_path = (self.key_path / fname)
with open(key_path, 'w') as f:
for k in ... |
5528bb232c32e299f52991a08f865de5a05ccc9837eec409cea359d75b8a260f | def _read_splits(self):
'Read the keys in order from the file system.\n\n '
by_name = {}
for path in self.key_path.iterdir():
p = parse.parse(self.pattern, path.name)
if (p is not None):
p = p.named
if ('name' in p):
with open(path) as f:
... | Read the keys in order from the file system. | src/python/zensols/dataset/split.py | _read_splits | plandes/deeplearn | 2 | python | def _read_splits(self):
'\n\n '
by_name = {}
for path in self.key_path.iterdir():
p = parse.parse(self.pattern, path.name)
if (p is not None):
p = p.named
if ('name' in p):
with open(path) as f:
by_name[p['name']] = tuple(map... | def _read_splits(self):
'\n\n '
by_name = {}
for path in self.key_path.iterdir():
p = parse.parse(self.pattern, path.name)
if (p is not None):
p = p.named
if ('name' in p):
with open(path) as f:
by_name[p['name']] = tuple(map... |
1cfa2340c1ac29fe49c6191dcbd7a71ffc9dd28d109c9e2407cb74275fc9d23a | def explained_variance(ypred, y):
'\n Computes the fraction of variance that ypred explains about y\n ' | Computes the fraction of variance that ypred explains about y | baselines/common/math_util.py | explained_variance | baihuaxie/drl-lib | 0 | python | def explained_variance(ypred, y):
'\n \n ' | def explained_variance(ypred, y):
'\n \n '<|docstring|>Computes the fraction of variance that ypred explains about y<|endoftext|> |
db4d965456ee4587800b1e2af84aa6413e8f949295b0476d4e05987adc6f84d2 | def project_p3d(p: Vector, camera: bpy.types.Object=bpy.context.scene.camera, render: bpy.types.RenderSettings=bpy.context.scene.render) -> Vector:
'Project a point p onto the image plane of a camera. The returned value is\n in normalized device coordiantes. That is, left upper corner is -1,1, right\n bottom ... | Project a point p onto the image plane of a camera. The returned value is
in normalized device coordiantes. That is, left upper corner is -1,1, right
bottom lower corner is 1/-1.
Args:
p (Vector): 3D vector to project to image plane
camera (bpy.types.Object): blender camera to use for projection
render (bp... | src/amira_blender_rendering/math/geometry.py | project_p3d | patrickkesper/amira_blender_rendering | 26 | python | def project_p3d(p: Vector, camera: bpy.types.Object=bpy.context.scene.camera, render: bpy.types.RenderSettings=bpy.context.scene.render) -> Vector:
'Project a point p onto the image plane of a camera. The returned value is\n in normalized device coordiantes. That is, left upper corner is -1,1, right\n bottom ... | def project_p3d(p: Vector, camera: bpy.types.Object=bpy.context.scene.camera, render: bpy.types.RenderSettings=bpy.context.scene.render) -> Vector:
'Project a point p onto the image plane of a camera. The returned value is\n in normalized device coordiantes. That is, left upper corner is -1,1, right\n bottom ... |
b19ad39faba010fdb21bebc63ea77d8b02bd10dbdbcc024cf80e3389c56c2a08 | def p2d_to_pixel_coords(p: Vector, render: bpy.types.RenderSettings=bpy.context.scene.render) -> Vector:
'Take a 2D point in normalized device coordiantes to pixel coordinates\n using specified render settings.\n\n Args:\n p (Vector): 2D vector in normalized device coordinates\n render (bpy.type... | Take a 2D point in normalized device coordiantes to pixel coordinates
using specified render settings.
Args:
p (Vector): 2D vector in normalized device coordinates
render (bpy.types.RenderSettings): blender render settings to use for
pixel calculation
Returns:
2D vector containing screen space (pi... | src/amira_blender_rendering/math/geometry.py | p2d_to_pixel_coords | patrickkesper/amira_blender_rendering | 26 | python | def p2d_to_pixel_coords(p: Vector, render: bpy.types.RenderSettings=bpy.context.scene.render) -> Vector:
'Take a 2D point in normalized device coordiantes to pixel coordinates\n using specified render settings.\n\n Args:\n p (Vector): 2D vector in normalized device coordinates\n render (bpy.type... | def p2d_to_pixel_coords(p: Vector, render: bpy.types.RenderSettings=bpy.context.scene.render) -> Vector:
'Take a 2D point in normalized device coordiantes to pixel coordinates\n using specified render settings.\n\n Args:\n p (Vector): 2D vector in normalized device coordinates\n render (bpy.type... |
ace303e3f89efdcf97e4917d4b4831f04f10063fb58e5830ea88ce68439b06eb | def get_relative_rotation(obj1: bpy.types.Object, obj2: bpy.types.Object=bpy.context.scene.camera) -> Euler:
"Get the relative rotation between two objects in terms of the second\n object's coordinate system. Note that the second object will be default\n initialized to the scene's camera.\n\n Returns:\n ... | Get the relative rotation between two objects in terms of the second
object's coordinate system. Note that the second object will be default
initialized to the scene's camera.
Returns:
Euler angles given in radians | src/amira_blender_rendering/math/geometry.py | get_relative_rotation | patrickkesper/amira_blender_rendering | 26 | python | def get_relative_rotation(obj1: bpy.types.Object, obj2: bpy.types.Object=bpy.context.scene.camera) -> Euler:
"Get the relative rotation between two objects in terms of the second\n object's coordinate system. Note that the second object will be default\n initialized to the scene's camera.\n\n Returns:\n ... | def get_relative_rotation(obj1: bpy.types.Object, obj2: bpy.types.Object=bpy.context.scene.camera) -> Euler:
"Get the relative rotation between two objects in terms of the second\n object's coordinate system. Note that the second object will be default\n initialized to the scene's camera.\n\n Returns:\n ... |
81ef0b072c1eb391762699be2029067d4f810068bee1da1f4b3b11d7d51f2fd2 | def get_relative_rotation_to_cam_deg(obj, cam, zeroing=Vector((90, 0, 0))):
"Get the relative rotation between an object and a camera in the camera's\n frame of reference.\n\n For more details, see get_relative_rotation_to_cam_rad.\n\n Args:\n obj: object to compute relative rotation for\n ca... | Get the relative rotation between an object and a camera in the camera's
frame of reference.
For more details, see get_relative_rotation_to_cam_rad.
Args:
obj: object to compute relative rotation for
cam: camera to used
zeroing: camera zeroing angles (in degrees)
Returns:
Relative rotation between ob... | src/amira_blender_rendering/math/geometry.py | get_relative_rotation_to_cam_deg | patrickkesper/amira_blender_rendering | 26 | python | def get_relative_rotation_to_cam_deg(obj, cam, zeroing=Vector((90, 0, 0))):
"Get the relative rotation between an object and a camera in the camera's\n frame of reference.\n\n For more details, see get_relative_rotation_to_cam_rad.\n\n Args:\n obj: object to compute relative rotation for\n ca... | def get_relative_rotation_to_cam_deg(obj, cam, zeroing=Vector((90, 0, 0))):
"Get the relative rotation between an object and a camera in the camera's\n frame of reference.\n\n For more details, see get_relative_rotation_to_cam_rad.\n\n Args:\n obj: object to compute relative rotation for\n ca... |
f293ef8c2a71d576f121d7dbdf0be746368ad8a1cf1da4e46cca8803e606f964 | def get_relative_rotation_to_cam_rad(obj, cam, zeroing=Vector(((pi / 2), 0, 0))):
"Get the relative rotation between an object and a camera in the camera's\n frame of reference.\n\n This function allows to specify a certain 'zeroing' rotation.\n\n A default camera in blender with 0 rotation applied to its ... | Get the relative rotation between an object and a camera in the camera's
frame of reference.
This function allows to specify a certain 'zeroing' rotation.
A default camera in blender with 0 rotation applied to its transform looks
along the -Z direction. Blender's modelling viewport, however, assumes that
the surface ... | src/amira_blender_rendering/math/geometry.py | get_relative_rotation_to_cam_rad | patrickkesper/amira_blender_rendering | 26 | python | def get_relative_rotation_to_cam_rad(obj, cam, zeroing=Vector(((pi / 2), 0, 0))):
"Get the relative rotation between an object and a camera in the camera's\n frame of reference.\n\n This function allows to specify a certain 'zeroing' rotation.\n\n A default camera in blender with 0 rotation applied to its ... | def get_relative_rotation_to_cam_rad(obj, cam, zeroing=Vector(((pi / 2), 0, 0))):
"Get the relative rotation between an object and a camera in the camera's\n frame of reference.\n\n This function allows to specify a certain 'zeroing' rotation.\n\n A default camera in blender with 0 rotation applied to its ... |
356eefac7204119fd2a094b939927a743ac4cc23af248cb3651e8bbfe5a67798 | def get_relative_translation(obj1: bpy.types.Object, obj2: bpy.types.Object=bpy.context.scene.camera) -> Vector:
"Get the relative translation between two objects in terms of the second\n object's coordinate system. Note that the second object will be default\n initialized to the scene's camera.\n\n Args:\... | Get the relative translation between two objects in terms of the second
object's coordinate system. Note that the second object will be default
initialized to the scene's camera.
Args:
obj1 (bpy.types.Object): first object
obj2 (bpy.types.Object): second object, relative to which the
translation will b... | src/amira_blender_rendering/math/geometry.py | get_relative_translation | patrickkesper/amira_blender_rendering | 26 | python | def get_relative_translation(obj1: bpy.types.Object, obj2: bpy.types.Object=bpy.context.scene.camera) -> Vector:
"Get the relative translation between two objects in terms of the second\n object's coordinate system. Note that the second object will be default\n initialized to the scene's camera.\n\n Args:\... | def get_relative_translation(obj1: bpy.types.Object, obj2: bpy.types.Object=bpy.context.scene.camera) -> Vector:
"Get the relative translation between two objects in terms of the second\n object's coordinate system. Note that the second object will be default\n initialized to the scene's camera.\n\n Args:\... |
34f00b2bf25d5ccea9b8a13e879a6dfe960edae5fa47a3c6fa6159f685065048 | def get_relative_transform(obj1: bpy.types.Object, obj2: bpy.types.Object=bpy.context.scene.camera):
"Get the relative transform between obj1 and obj2 in obj2's coordinate\n frame.\n\n Args:\n obj1 (bpy.types.Object): first object\n obj2 (bpy.types.Object): second object, relative to which the\n... | Get the relative transform between obj1 and obj2 in obj2's coordinate
frame.
Args:
obj1 (bpy.types.Object): first object
obj2 (bpy.types.Object): second object, relative to which the
transform will be computed.
Returns:
tuple containing the translation and rotation between obj1 and obj2
(relat... | src/amira_blender_rendering/math/geometry.py | get_relative_transform | patrickkesper/amira_blender_rendering | 26 | python | def get_relative_transform(obj1: bpy.types.Object, obj2: bpy.types.Object=bpy.context.scene.camera):
"Get the relative transform between obj1 and obj2 in obj2's coordinate\n frame.\n\n Args:\n obj1 (bpy.types.Object): first object\n obj2 (bpy.types.Object): second object, relative to which the\n... | def get_relative_transform(obj1: bpy.types.Object, obj2: bpy.types.Object=bpy.context.scene.camera):
"Get the relative transform between obj1 and obj2 in obj2's coordinate\n frame.\n\n Args:\n obj1 (bpy.types.Object): first object\n obj2 (bpy.types.Object): second object, relative to which the\n... |
cf89d3fc00fe0519bfb8b1b14ec1048341ed878cd967ab192c69c6232897a3f0 | def test_visibility(obj, cam, width, height, require_all=True):
'Test if an object is visible from a camera by projecting the bounding box\n of the object and testing if the vertices are visible from the camera or not.\n\n Note that this does not test for occlusions!\n\n Args:\n obj : Object to test... | Test if an object is visible from a camera by projecting the bounding box
of the object and testing if the vertices are visible from the camera or not.
Note that this does not test for occlusions!
Args:
obj : Object to test visibility for
cam : Camera object
width : Viewport width
height : Viewport he... | src/amira_blender_rendering/math/geometry.py | test_visibility | patrickkesper/amira_blender_rendering | 26 | python | def test_visibility(obj, cam, width, height, require_all=True):
'Test if an object is visible from a camera by projecting the bounding box\n of the object and testing if the vertices are visible from the camera or not.\n\n Note that this does not test for occlusions!\n\n Args:\n obj : Object to test... | def test_visibility(obj, cam, width, height, require_all=True):
'Test if an object is visible from a camera by projecting the bounding box\n of the object and testing if the vertices are visible from the camera or not.\n\n Note that this does not test for occlusions!\n\n Args:\n obj : Object to test... |
8bbc84aea569bd3f20064cd441ad6ca3672c5c285559a900bbf19a9a9da05d09 | def test_occlusion(scene, layer, cam, obj, width, height, require_all=True, origin_offset=0.01):
"Test if an object is visible or occluded by another object by checking its vertices.\n Note that this also tests if an object is visible.\n\n Args:\n scene: the scene for which to test\n layer: view... | Test if an object is visible or occluded by another object by checking its vertices.
Note that this also tests if an object is visible.
Args:
scene: the scene for which to test
layer: view layer to use for ray casting, e.g. scene.view_layers['View Layer']
cam: camera to evaluate
obj: object to evaluate... | src/amira_blender_rendering/math/geometry.py | test_occlusion | patrickkesper/amira_blender_rendering | 26 | python | def test_occlusion(scene, layer, cam, obj, width, height, require_all=True, origin_offset=0.01):
"Test if an object is visible or occluded by another object by checking its vertices.\n Note that this also tests if an object is visible.\n\n Args:\n scene: the scene for which to test\n layer: view... | def test_occlusion(scene, layer, cam, obj, width, height, require_all=True, origin_offset=0.01):
"Test if an object is visible or occluded by another object by checking its vertices.\n Note that this also tests if an object is visible.\n\n Args:\n scene: the scene for which to test\n layer: view... |
4a964143286e1ffde23b8043eaa3868930b52d9f920d5e1098c4e2c1eeb71805 | def _get_bvh(obj):
'Get the BVH for an object\n\n Args:\n obj (variant): object to get the BVH for\n\n Returns:\n BVH for obj\n '
mat = obj.matrix_world
vs = [(mat @ v.co) for v in obj.data.vertices]
ps = [p.vertices for p in obj.data.polygons]
return BVHTree.FromPolygons(vs, ... | Get the BVH for an object
Args:
obj (variant): object to get the BVH for
Returns:
BVH for obj | src/amira_blender_rendering/math/geometry.py | _get_bvh | patrickkesper/amira_blender_rendering | 26 | python | def _get_bvh(obj):
'Get the BVH for an object\n\n Args:\n obj (variant): object to get the BVH for\n\n Returns:\n BVH for obj\n '
mat = obj.matrix_world
vs = [(mat @ v.co) for v in obj.data.vertices]
ps = [p.vertices for p in obj.data.polygons]
return BVHTree.FromPolygons(vs, ... | def _get_bvh(obj):
'Get the BVH for an object\n\n Args:\n obj (variant): object to get the BVH for\n\n Returns:\n BVH for obj\n '
mat = obj.matrix_world
vs = [(mat @ v.co) for v in obj.data.vertices]
ps = [p.vertices for p in obj.data.polygons]
return BVHTree.FromPolygons(vs, ... |
11e771cf578f6dd99f0fcbd7aea13e88497153ebd0d4d2e1e98ec96e37f2f5f5 | def test_intersection(obj1, obj2):
'Test if two objects intersect each other\n\n Returns true if objects intersect, false if not.\n '
bvh1 = _get_bvh(obj1)
bvh2 = _get_bvh(obj2)
if bvh1.overlap(bvh2):
return True
else:
return False | Test if two objects intersect each other
Returns true if objects intersect, false if not. | src/amira_blender_rendering/math/geometry.py | test_intersection | patrickkesper/amira_blender_rendering | 26 | python | def test_intersection(obj1, obj2):
'Test if two objects intersect each other\n\n Returns true if objects intersect, false if not.\n '
bvh1 = _get_bvh(obj1)
bvh2 = _get_bvh(obj2)
if bvh1.overlap(bvh2):
return True
else:
return False | def test_intersection(obj1, obj2):
'Test if two objects intersect each other\n\n Returns true if objects intersect, false if not.\n '
bvh1 = _get_bvh(obj1)
bvh2 = _get_bvh(obj2)
if bvh1.overlap(bvh2):
return True
else:
return False<|docstring|>Test if two objects intersect each... |
d43fe7f349fcf893230c99fac816d45955a17e63ef22e4fc201f6fab0dcbf34f | def get_world_to_object_transform(cam2obj_pose: dict, camera: bpy.types.Object=bpy.context.scene.camera):
"\n Transform a pose {'R', 't'} expressed in camera coordinates to world coordinates\n\n Args:\n cam2obj_pose(dict): {\n 'R'(np.array(3)) : rotation matrix from camera to obj\n ... | Transform a pose {'R', 't'} expressed in camera coordinates to world coordinates
Args:
cam2obj_pose(dict): {
'R'(np.array(3)) : rotation matrix from camera to obj
't'(np.array(3,) : translation vector from camera to obh
}
camera(bpq.types.Object): scene camera
Returns:
{'R','t'} where
... | src/amira_blender_rendering/math/geometry.py | get_world_to_object_transform | patrickkesper/amira_blender_rendering | 26 | python | def get_world_to_object_transform(cam2obj_pose: dict, camera: bpy.types.Object=bpy.context.scene.camera):
"\n Transform a pose {'R', 't'} expressed in camera coordinates to world coordinates\n\n Args:\n cam2obj_pose(dict): {\n 'R'(np.array(3)) : rotation matrix from camera to obj\n ... | def get_world_to_object_transform(cam2obj_pose: dict, camera: bpy.types.Object=bpy.context.scene.camera):
"\n Transform a pose {'R', 't'} expressed in camera coordinates to world coordinates\n\n Args:\n cam2obj_pose(dict): {\n 'R'(np.array(3)) : rotation matrix from camera to obj\n ... |
5f9a8236d2aa27250fb9836244505d55ed15518eb728809c7d226d263cc99258 | def gl2cv(R, t):
'Convert transform from OpenGL to OpenCV\n\n Args:\n R(np.array(3,3): rotation matrix\n t(np.array(3,): translation vector\n Returns:\n R_cv\n t_cv\n '
M_gl = np.eye(4)
M_gl[(:3, :3)] = R
M_gl[(:3, 3)] = t
Ccv_Cgl = np.array([[1, 0, 0, 0], [0, (-... | Convert transform from OpenGL to OpenCV
Args:
R(np.array(3,3): rotation matrix
t(np.array(3,): translation vector
Returns:
R_cv
t_cv | src/amira_blender_rendering/math/geometry.py | gl2cv | patrickkesper/amira_blender_rendering | 26 | python | def gl2cv(R, t):
'Convert transform from OpenGL to OpenCV\n\n Args:\n R(np.array(3,3): rotation matrix\n t(np.array(3,): translation vector\n Returns:\n R_cv\n t_cv\n '
M_gl = np.eye(4)
M_gl[(:3, :3)] = R
M_gl[(:3, 3)] = t
Ccv_Cgl = np.array([[1, 0, 0, 0], [0, (-... | def gl2cv(R, t):
'Convert transform from OpenGL to OpenCV\n\n Args:\n R(np.array(3,3): rotation matrix\n t(np.array(3,): translation vector\n Returns:\n R_cv\n t_cv\n '
M_gl = np.eye(4)
M_gl[(:3, :3)] = R
M_gl[(:3, 3)] = t
Ccv_Cgl = np.array([[1, 0, 0, 0], [0, (-... |
e7ac1f6bb22e772bd0ff10029f438dd3d2c5c855f6ecfc8c9ead6fa00c052cc1 | def euler_x_to_matrix(angle):
'Get rotation matrix from euler angle rotation around X.'
return np.array([[1, 0, 0], [0, np.cos(angle), (- np.sin(angle))], [0, np.sin(angle), np.cos(angle)]]) | Get rotation matrix from euler angle rotation around X. | src/amira_blender_rendering/math/geometry.py | euler_x_to_matrix | patrickkesper/amira_blender_rendering | 26 | python | def euler_x_to_matrix(angle):
return np.array([[1, 0, 0], [0, np.cos(angle), (- np.sin(angle))], [0, np.sin(angle), np.cos(angle)]]) | def euler_x_to_matrix(angle):
return np.array([[1, 0, 0], [0, np.cos(angle), (- np.sin(angle))], [0, np.sin(angle), np.cos(angle)]])<|docstring|>Get rotation matrix from euler angle rotation around X.<|endoftext|> |
370140bf30a73c4c1f035e4db5a09d7c6b2c2cbae28beef21d50aab2b9e34bed | def euler_y_to_matrix(angle):
'Get rotation matrix from euler angle rotation around Y.'
return np.array([[np.cos(angle), 0, np.sin(angle)], [0, 1, 0], [(- np.sin(angle)), 0, np.cos(angle)]]) | Get rotation matrix from euler angle rotation around Y. | src/amira_blender_rendering/math/geometry.py | euler_y_to_matrix | patrickkesper/amira_blender_rendering | 26 | python | def euler_y_to_matrix(angle):
return np.array([[np.cos(angle), 0, np.sin(angle)], [0, 1, 0], [(- np.sin(angle)), 0, np.cos(angle)]]) | def euler_y_to_matrix(angle):
return np.array([[np.cos(angle), 0, np.sin(angle)], [0, 1, 0], [(- np.sin(angle)), 0, np.cos(angle)]])<|docstring|>Get rotation matrix from euler angle rotation around Y.<|endoftext|> |
827d2d0f4a55c4ee05dacb1be556864652620060579fecb142ee7ef5a1d64a4c | def euler_z_to_matrix(angle):
'Get rotation matrix from euler angle rotation around Z.'
return np.array([[np.cos(angle), (- np.sin(angle)), 0], [np.sin(angle), np.cos(angle), 0], [0, 0, 1]]) | Get rotation matrix from euler angle rotation around Z. | src/amira_blender_rendering/math/geometry.py | euler_z_to_matrix | patrickkesper/amira_blender_rendering | 26 | python | def euler_z_to_matrix(angle):
return np.array([[np.cos(angle), (- np.sin(angle)), 0], [np.sin(angle), np.cos(angle), 0], [0, 0, 1]]) | def euler_z_to_matrix(angle):
return np.array([[np.cos(angle), (- np.sin(angle)), 0], [np.sin(angle), np.cos(angle), 0], [0, 0, 1]])<|docstring|>Get rotation matrix from euler angle rotation around Z.<|endoftext|> |
77d4f7f0503691f05efb5c412890ae685a24cc4b6f5dd06e870e97a5f5fa5929 | def rotation_matrix(alpha, axis, homogeneous=False):
'Euler rotation matrices\n\n Args:\n alpha (float): angle in radians\n axis (str): x/y/z\n homogeneous (bool): output homogeneous coordinates\n\n Returns:\n rotation matrix\n\n '
axis = axis.lower()
if (axis == 'x'):
... | Euler rotation matrices
Args:
alpha (float): angle in radians
axis (str): x/y/z
homogeneous (bool): output homogeneous coordinates
Returns:
rotation matrix | src/amira_blender_rendering/math/geometry.py | rotation_matrix | patrickkesper/amira_blender_rendering | 26 | python | def rotation_matrix(alpha, axis, homogeneous=False):
'Euler rotation matrices\n\n Args:\n alpha (float): angle in radians\n axis (str): x/y/z\n homogeneous (bool): output homogeneous coordinates\n\n Returns:\n rotation matrix\n\n '
axis = axis.lower()
if (axis == 'x'):
... | def rotation_matrix(alpha, axis, homogeneous=False):
'Euler rotation matrices\n\n Args:\n alpha (float): angle in radians\n axis (str): x/y/z\n homogeneous (bool): output homogeneous coordinates\n\n Returns:\n rotation matrix\n\n '
axis = axis.lower()
if (axis == 'x'):
... |
e3c16004a969596eb2091db3f83c63374651373a394f0606b3a0d38013c97189 | def rotation_matrix_to_quaternion(rot_mat, isprecise=False):
'\n Computes the quaternion (with convention WXYZ) out of a given rotation matrix\n Inverse funtion of quaternion_to_rotation_matrix\n\n Parameters\n ----------\n :param rot_mat: np.array of shape (3, 3)\n\n Returns\n -------\n :r... | Computes the quaternion (with convention WXYZ) out of a given rotation matrix
Inverse funtion of quaternion_to_rotation_matrix
Parameters
----------
:param rot_mat: np.array of shape (3, 3)
Returns
-------
:return q: np.array of shape (4,), quaternion (WXYZ) corresponding to the rotation matrix rot_mat
NOTE: the im... | src/amira_blender_rendering/math/geometry.py | rotation_matrix_to_quaternion | patrickkesper/amira_blender_rendering | 26 | python | def rotation_matrix_to_quaternion(rot_mat, isprecise=False):
'\n Computes the quaternion (with convention WXYZ) out of a given rotation matrix\n Inverse funtion of quaternion_to_rotation_matrix\n\n Parameters\n ----------\n :param rot_mat: np.array of shape (3, 3)\n\n Returns\n -------\n :r... | def rotation_matrix_to_quaternion(rot_mat, isprecise=False):
'\n Computes the quaternion (with convention WXYZ) out of a given rotation matrix\n Inverse funtion of quaternion_to_rotation_matrix\n\n Parameters\n ----------\n :param rot_mat: np.array of shape (3, 3)\n\n Returns\n -------\n :r... |
3f43b2fbc95fa0bb467130c106484fc01f64b64f6b68c4e0e210f54054625577 | def file(path_or_f):
'\n Verifies that a file exists at a given path and that the file has a\n known extension type.\n\n :Parameters:\n path : `str`\n the path to a dump file\n\n '
if hasattr(path_or_f, 'readline'):
return path_or_f
else:
path = path_or_f
pa... | Verifies that a file exists at a given path and that the file has a
known extension type.
:Parameters:
path : `str`
the path to a dump file | mw/xml_dump/functions.py | file | makoshark/Mediawiki-Utilities | 23 | python | def file(path_or_f):
'\n Verifies that a file exists at a given path and that the file has a\n known extension type.\n\n :Parameters:\n path : `str`\n the path to a dump file\n\n '
if hasattr(path_or_f, 'readline'):
return path_or_f
else:
path = path_or_f
pa... | def file(path_or_f):
'\n Verifies that a file exists at a given path and that the file has a\n known extension type.\n\n :Parameters:\n path : `str`\n the path to a dump file\n\n '
if hasattr(path_or_f, 'readline'):
return path_or_f
else:
path = path_or_f
pa... |
375c3bffc54dffe0a4e7e45ab8246ee19ede06f73d980df9a45a6d4b638fcf94 | def open_file(path_or_f):
'\n Turns a path to a dump file into a file-like object of (decompressed)\n XML data.\n\n :Parameters:\n path : `str`\n the path to the dump file to read\n '
if hasattr(path_or_f, 'read'):
return path_or_f
else:
path = path_or_f
mat... | Turns a path to a dump file into a file-like object of (decompressed)
XML data.
:Parameters:
path : `str`
the path to the dump file to read | mw/xml_dump/functions.py | open_file | makoshark/Mediawiki-Utilities | 23 | python | def open_file(path_or_f):
'\n Turns a path to a dump file into a file-like object of (decompressed)\n XML data.\n\n :Parameters:\n path : `str`\n the path to the dump file to read\n '
if hasattr(path_or_f, 'read'):
return path_or_f
else:
path = path_or_f
mat... | def open_file(path_or_f):
'\n Turns a path to a dump file into a file-like object of (decompressed)\n XML data.\n\n :Parameters:\n path : `str`\n the path to the dump file to read\n '
if hasattr(path_or_f, 'read'):
return path_or_f
else:
path = path_or_f
mat... |
f628b0ad334baf93f540c988d22f34360604b58e1c1bbe3d0bd27877d940f5a6 | def append_new_entries(rsc_src: str, restore_new: dict, vocab_new: Dict[(str, int)]):
'\n ๊ธฐ๋ถ์ ์ฌ์ ๋น๋ ์ค์ ์๋ก ์ถ๊ฐ๊ฐ ํ์ํ ์ฌ์ ์ํธ๋ฆฌ๋ฅผ ํด๋น ์ฌ์ ์ ์ถ๊ฐํ๋ค.\n Args:\n rsc_src: ๋ฆฌ์ค์ ๋๋ ํ ๋ฆฌ\n restore_new: ์ํ๋ณต์ ์ฌ์ ์ ์ถ๊ฐํ ์ํธ๋ฆฌ\n vocab_new: ์ถ๋ ฅ ํ๊ทธ vocabulary์ ์ถ๊ฐํ ์ํธ๋ฆฌ\n '
if restore_new:
with open('{}/res... | ๊ธฐ๋ถ์ ์ฌ์ ๋น๋ ์ค์ ์๋ก ์ถ๊ฐ๊ฐ ํ์ํ ์ฌ์ ์ํธ๋ฆฌ๋ฅผ ํด๋น ์ฌ์ ์ ์ถ๊ฐํ๋ค.
Args:
rsc_src: ๋ฆฌ์ค์ ๋๋ ํ ๋ฆฌ
restore_new: ์ํ๋ณต์ ์ฌ์ ์ ์ถ๊ฐํ ์ํธ๋ฆฌ
vocab_new: ์ถ๋ ฅ ํ๊ทธ vocabulary์ ์ถ๊ฐํ ์ํธ๋ฆฌ | rsc/bin/compile_restore.py | append_new_entries | juntf/khaiii | 1,235 | python | def append_new_entries(rsc_src: str, restore_new: dict, vocab_new: Dict[(str, int)]):
'\n ๊ธฐ๋ถ์ ์ฌ์ ๋น๋ ์ค์ ์๋ก ์ถ๊ฐ๊ฐ ํ์ํ ์ฌ์ ์ํธ๋ฆฌ๋ฅผ ํด๋น ์ฌ์ ์ ์ถ๊ฐํ๋ค.\n Args:\n rsc_src: ๋ฆฌ์ค์ ๋๋ ํ ๋ฆฌ\n restore_new: ์ํ๋ณต์ ์ฌ์ ์ ์ถ๊ฐํ ์ํธ๋ฆฌ\n vocab_new: ์ถ๋ ฅ ํ๊ทธ vocabulary์ ์ถ๊ฐํ ์ํธ๋ฆฌ\n '
if restore_new:
with open('{}/res... | def append_new_entries(rsc_src: str, restore_new: dict, vocab_new: Dict[(str, int)]):
'\n ๊ธฐ๋ถ์ ์ฌ์ ๋น๋ ์ค์ ์๋ก ์ถ๊ฐ๊ฐ ํ์ํ ์ฌ์ ์ํธ๋ฆฌ๋ฅผ ํด๋น ์ฌ์ ์ ์ถ๊ฐํ๋ค.\n Args:\n rsc_src: ๋ฆฌ์ค์ ๋๋ ํ ๋ฆฌ\n restore_new: ์ํ๋ณต์ ์ฌ์ ์ ์ถ๊ฐํ ์ํธ๋ฆฌ\n vocab_new: ์ถ๋ ฅ ํ๊ทธ vocabulary์ ์ถ๊ฐํ ์ํธ๋ฆฌ\n '
if restore_new:
with open('{}/res... |
e4400c32bb930182f1ac87b20616aa231ac3a21208810fba93e337c32a224ed6 | def _make_bin(restore_dic: dict, vocab_out: Dict[(str, int)], vocab_new: Dict[(str, int)]) -> dict:
'\n ๋ ํ
์คํธ ์ฌ์ ์ ์ฝ์ด๋ค์ฌ ๋ฐ์ด๋๋ฆฌ ํํ์ key-value ์ฌ์ ์ ๋ง๋ ๋ค.\n Args:\n restore_dic: ์ํ๋ณต์ ์ฌ์ \n vocab_out: ์ถ๋ ฅ ํ๊ทธ ์ฌ์ \n vocab_new: ์ถ๋ ฅ ํ๊ทธ ์ฌ์ ์ ์ถ๊ฐํ ์๋ก์ด ํ๊ทธ\n Retusns:\n ๋ฐ์ด๋๋ฆฌ ์ฌ์ \n '
bin_dic = ... | ๋ ํ
์คํธ ์ฌ์ ์ ์ฝ์ด๋ค์ฌ ๋ฐ์ด๋๋ฆฌ ํํ์ key-value ์ฌ์ ์ ๋ง๋ ๋ค.
Args:
restore_dic: ์ํ๋ณต์ ์ฌ์
vocab_out: ์ถ๋ ฅ ํ๊ทธ ์ฌ์
vocab_new: ์ถ๋ ฅ ํ๊ทธ ์ฌ์ ์ ์ถ๊ฐํ ์๋ก์ด ํ๊ทธ
Retusns:
๋ฐ์ด๋๋ฆฌ ์ฌ์ | rsc/bin/compile_restore.py | _make_bin | juntf/khaiii | 1,235 | python | def _make_bin(restore_dic: dict, vocab_out: Dict[(str, int)], vocab_new: Dict[(str, int)]) -> dict:
'\n ๋ ํ
์คํธ ์ฌ์ ์ ์ฝ์ด๋ค์ฌ ๋ฐ์ด๋๋ฆฌ ํํ์ key-value ์ฌ์ ์ ๋ง๋ ๋ค.\n Args:\n restore_dic: ์ํ๋ณต์ ์ฌ์ \n vocab_out: ์ถ๋ ฅ ํ๊ทธ ์ฌ์ \n vocab_new: ์ถ๋ ฅ ํ๊ทธ ์ฌ์ ์ ์ถ๊ฐํ ์๋ก์ด ํ๊ทธ\n Retusns:\n ๋ฐ์ด๋๋ฆฌ ์ฌ์ \n '
bin_dic = ... | def _make_bin(restore_dic: dict, vocab_out: Dict[(str, int)], vocab_new: Dict[(str, int)]) -> dict:
'\n ๋ ํ
์คํธ ์ฌ์ ์ ์ฝ์ด๋ค์ฌ ๋ฐ์ด๋๋ฆฌ ํํ์ key-value ์ฌ์ ์ ๋ง๋ ๋ค.\n Args:\n restore_dic: ์ํ๋ณต์ ์ฌ์ \n vocab_out: ์ถ๋ ฅ ํ๊ทธ ์ฌ์ \n vocab_new: ์ถ๋ ฅ ํ๊ทธ ์ฌ์ ์ ์ถ๊ฐํ ์๋ก์ด ํ๊ทธ\n Retusns:\n ๋ฐ์ด๋๋ฆฌ ์ฌ์ \n '
bin_dic = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.