partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
ProtocolTreeModel.protocol_tree_items
:rtype: dict[int, list of ProtocolTreeItem]
src/urh/models/ProtocolTreeModel.py
def protocol_tree_items(self): """ :rtype: dict[int, list of ProtocolTreeItem] """ result = {} for i, group in enumerate(self.rootItem.children): result[i] = [child for child in group.children] return result
def protocol_tree_items(self): """ :rtype: dict[int, list of ProtocolTreeItem] """ result = {} for i, group in enumerate(self.rootItem.children): result[i] = [child for child in group.children] return result
[ ":", "rtype", ":", "dict", "[", "int", "list", "of", "ProtocolTreeItem", "]" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/models/ProtocolTreeModel.py#L48-L56
[ "def", "protocol_tree_items", "(", "self", ")", ":", "result", "=", "{", "}", "for", "i", ",", "group", "in", "enumerate", "(", "self", ".", "rootItem", ".", "children", ")", ":", "result", "[", "i", "]", "=", "[", "child", "for", "child", "in", "g...
2eb33b125c8407964cd1092843cde5010eb88aae
train
ProtocolTreeModel.move_to_group
:type items: list of ProtocolTreeItem
src/urh/models/ProtocolTreeModel.py
def move_to_group(self, items, new_group_id: int): """ :type items: list of ProtocolTreeItem """ group = self.rootItem.child(new_group_id) for item in items: group.appendChild(item) self.controller.refresh()
def move_to_group(self, items, new_group_id: int): """ :type items: list of ProtocolTreeItem """ group = self.rootItem.child(new_group_id) for item in items: group.appendChild(item) self.controller.refresh()
[ ":", "type", "items", ":", "list", "of", "ProtocolTreeItem" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/models/ProtocolTreeModel.py#L326-L333
[ "def", "move_to_group", "(", "self", ",", "items", ",", "new_group_id", ":", "int", ")", ":", "group", "=", "self", ".", "rootItem", ".", "child", "(", "new_group_id", ")", "for", "item", "in", "items", ":", "group", ".", "appendChild", "(", "item", ")...
2eb33b125c8407964cd1092843cde5010eb88aae
train
ProtocolTreeModel.set_copy_mode
Set all protocols in copy mode. They will return a copy of their protocol. This is used for writable mode in CFC. :param use_copy: :return:
src/urh/models/ProtocolTreeModel.py
def set_copy_mode(self, use_copy: bool): """ Set all protocols in copy mode. They will return a copy of their protocol. This is used for writable mode in CFC. :param use_copy: :return: """ for group in self.rootItem.children: for proto in group.childr...
def set_copy_mode(self, use_copy: bool): """ Set all protocols in copy mode. They will return a copy of their protocol. This is used for writable mode in CFC. :param use_copy: :return: """ for group in self.rootItem.children: for proto in group.childr...
[ "Set", "all", "protocols", "in", "copy", "mode", ".", "They", "will", "return", "a", "copy", "of", "their", "protocol", ".", "This", "is", "used", "for", "writable", "mode", "in", "CFC", "." ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/models/ProtocolTreeModel.py#L341-L351
[ "def", "set_copy_mode", "(", "self", ",", "use_copy", ":", "bool", ")", ":", "for", "group", "in", "self", ".", "rootItem", ".", "children", ":", "for", "proto", "in", "group", ".", "children", ":", "proto", ".", "copy_data", "=", "use_copy" ]
2eb33b125c8407964cd1092843cde5010eb88aae
train
RingBuffer.view_data
Get a representation of the ring buffer for plotting. This is expensive, so it should only be used in frontend :return:
src/urh/util/RingBuffer.py
def view_data(self): """ Get a representation of the ring buffer for plotting. This is expensive, so it should only be used in frontend :return: """ left, right = self.left_index, self.left_index + len(self) if left > right: left, right = right, left ...
def view_data(self): """ Get a representation of the ring buffer for plotting. This is expensive, so it should only be used in frontend :return: """ left, right = self.left_index, self.left_index + len(self) if left > right: left, right = right, left ...
[ "Get", "a", "representation", "of", "the", "ring", "buffer", "for", "plotting", ".", "This", "is", "expensive", "so", "it", "should", "only", "be", "used", "in", "frontend", ":", "return", ":" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/util/RingBuffer.py#L48-L58
[ "def", "view_data", "(", "self", ")", ":", "left", ",", "right", "=", "self", ".", "left_index", ",", "self", ".", "left_index", "+", "len", "(", "self", ")", "if", "left", ">", "right", ":", "left", ",", "right", "=", "right", ",", "left", "data",...
2eb33b125c8407964cd1092843cde5010eb88aae
train
RingBuffer.push
Push values to buffer. If buffer can't store all values a ValueError is raised
src/urh/util/RingBuffer.py
def push(self, values: np.ndarray): """ Push values to buffer. If buffer can't store all values a ValueError is raised """ n = len(values) if len(self) + n > self.size: raise ValueError("Too much data to push to RingBuffer") slide_1 = np.s_[self.right_index:m...
def push(self, values: np.ndarray): """ Push values to buffer. If buffer can't store all values a ValueError is raised """ n = len(values) if len(self) + n > self.size: raise ValueError("Too much data to push to RingBuffer") slide_1 = np.s_[self.right_index:m...
[ "Push", "values", "to", "buffer", ".", "If", "buffer", "can", "t", "store", "all", "values", "a", "ValueError", "is", "raised" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/util/RingBuffer.py#L67-L83
[ "def", "push", "(", "self", ",", "values", ":", "np", ".", "ndarray", ")", ":", "n", "=", "len", "(", "values", ")", "if", "len", "(", "self", ")", "+", "n", ">", "self", ".", "size", ":", "raise", "ValueError", "(", "\"Too much data to push to RingB...
2eb33b125c8407964cd1092843cde5010eb88aae
train
RingBuffer.pop
Pop number of elements. If there are not enough elements, all remaining elements are returned and the buffer is cleared afterwards. If buffer is empty, an empty numpy array is returned. If number is -1 (or any other value below zero) than complete buffer is returned
src/urh/util/RingBuffer.py
def pop(self, number: int, ensure_even_length=False): """ Pop number of elements. If there are not enough elements, all remaining elements are returned and the buffer is cleared afterwards. If buffer is empty, an empty numpy array is returned. If number is -1 (or any other value below z...
def pop(self, number: int, ensure_even_length=False): """ Pop number of elements. If there are not enough elements, all remaining elements are returned and the buffer is cleared afterwards. If buffer is empty, an empty numpy array is returned. If number is -1 (or any other value below z...
[ "Pop", "number", "of", "elements", ".", "If", "there", "are", "not", "enough", "elements", "all", "remaining", "elements", "are", "returned", "and", "the", "buffer", "is", "cleared", "afterwards", ".", "If", "buffer", "is", "empty", "an", "empty", "numpy", ...
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/util/RingBuffer.py#L85-L121
[ "def", "pop", "(", "self", ",", "number", ":", "int", ",", "ensure_even_length", "=", "False", ")", ":", "if", "ensure_even_length", ":", "number", "-=", "number", "%", "2", "if", "len", "(", "self", ")", "==", "0", "or", "number", "==", "0", ":", ...
2eb33b125c8407964cd1092843cde5010eb88aae
train
Encoding.code_data_whitening
XOR Data Whitening :param decoding: :param inpt: :return:
src/urh/signalprocessing/Encoding.py
def code_data_whitening(self, decoding, inpt): """ XOR Data Whitening :param decoding: :param inpt: :return: """ inpt_copy = array.array("B", inpt) return self.apply_data_whitening(decoding, inpt_copy)
def code_data_whitening(self, decoding, inpt): """ XOR Data Whitening :param decoding: :param inpt: :return: """ inpt_copy = array.array("B", inpt) return self.apply_data_whitening(decoding, inpt_copy)
[ "XOR", "Data", "Whitening", ":", "param", "decoding", ":", ":", "param", "inpt", ":", ":", "return", ":" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/Encoding.py#L451-L459
[ "def", "code_data_whitening", "(", "self", ",", "decoding", ",", "inpt", ")", ":", "inpt_copy", "=", "array", ".", "array", "(", "\"B\"", ",", "inpt", ")", "return", "self", ".", "apply_data_whitening", "(", "decoding", ",", "inpt_copy", ")" ]
2eb33b125c8407964cd1092843cde5010eb88aae
train
ZeroHidePlugin.get_action
:type parent: QTableView :type undo_stack: QUndoStack
src/urh/plugins/ZeroHide/ZeroHidePlugin.py
def get_action(self, parent, undo_stack: QUndoStack, sel_range, protocol, view: int): """ :type parent: QTableView :type undo_stack: QUndoStack """ self.command = ZeroHideAction(protocol, self.following_zeros, view, self.zero_hide_offsets) action = QAction(self.command.te...
def get_action(self, parent, undo_stack: QUndoStack, sel_range, protocol, view: int): """ :type parent: QTableView :type undo_stack: QUndoStack """ self.command = ZeroHideAction(protocol, self.following_zeros, view, self.zero_hide_offsets) action = QAction(self.command.te...
[ ":", "type", "parent", ":", "QTableView", ":", "type", "undo_stack", ":", "QUndoStack" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/plugins/ZeroHide/ZeroHidePlugin.py#L24-L33
[ "def", "get_action", "(", "self", ",", "parent", ",", "undo_stack", ":", "QUndoStack", ",", "sel_range", ",", "protocol", ",", "view", ":", "int", ")", ":", "self", ".", "command", "=", "ZeroHideAction", "(", "protocol", ",", "self", ".", "following_zeros"...
2eb33b125c8407964cd1092843cde5010eb88aae
train
SelectableGraphicView.scroll_mouse
Scrolls the mouse if ROI Selection reaches corner of view :param mouse_x: :return:
src/urh/ui/views/SelectableGraphicView.py
def scroll_mouse(self, mouse_x: int): """ Scrolls the mouse if ROI Selection reaches corner of view :param mouse_x: :return: """ scrollbar = self.horizontalScrollBar() if mouse_x - self.view_rect().x() > self.view_rect().width(): scrollbar.setValue(s...
def scroll_mouse(self, mouse_x: int): """ Scrolls the mouse if ROI Selection reaches corner of view :param mouse_x: :return: """ scrollbar = self.horizontalScrollBar() if mouse_x - self.view_rect().x() > self.view_rect().width(): scrollbar.setValue(s...
[ "Scrolls", "the", "mouse", "if", "ROI", "Selection", "reaches", "corner", "of", "view" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ui/views/SelectableGraphicView.py#L207-L220
[ "def", "scroll_mouse", "(", "self", ",", "mouse_x", ":", "int", ")", ":", "scrollbar", "=", "self", ".", "horizontalScrollBar", "(", ")", "if", "mouse_x", "-", "self", ".", "view_rect", "(", ")", ".", "x", "(", ")", ">", "self", ".", "view_rect", "("...
2eb33b125c8407964cd1092843cde5010eb88aae
train
SelectableGraphicView.refresh_selection_area
Refresh selection area in case scene was resized/scaled. This happens e.g. when switching from Signal View to Quad Demod view :return:
src/urh/ui/views/SelectableGraphicView.py
def refresh_selection_area(self): """ Refresh selection area in case scene was resized/scaled. This happens e.g. when switching from Signal View to Quad Demod view :return: """ self.__set_selection_area(x=self.selection_area.x, y=self.selection_area.y, ...
def refresh_selection_area(self): """ Refresh selection area in case scene was resized/scaled. This happens e.g. when switching from Signal View to Quad Demod view :return: """ self.__set_selection_area(x=self.selection_area.x, y=self.selection_area.y, ...
[ "Refresh", "selection", "area", "in", "case", "scene", "was", "resized", "/", "scaled", ".", "This", "happens", "e", ".", "g", ".", "when", "switching", "from", "Signal", "View", "to", "Quad", "Demod", "view", ":", "return", ":" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ui/views/SelectableGraphicView.py#L252-L259
[ "def", "refresh_selection_area", "(", "self", ")", ":", "self", ".", "__set_selection_area", "(", "x", "=", "self", ".", "selection_area", ".", "x", ",", "y", "=", "self", ".", "selection_area", ".", "y", ",", "w", "=", "self", ".", "selection_area", "."...
2eb33b125c8407964cd1092843cde5010eb88aae
train
SelectableGraphicView.view_rect
Return the boundaries of the view in scene coordinates
src/urh/ui/views/SelectableGraphicView.py
def view_rect(self) -> QRectF: """ Return the boundaries of the view in scene coordinates """ top_left = self.mapToScene(0, 0) bottom_right = self.mapToScene(self.viewport().width() - 1, self.viewport().height() - 1) return QRectF(top_left, bottom_right)
def view_rect(self) -> QRectF: """ Return the boundaries of the view in scene coordinates """ top_left = self.mapToScene(0, 0) bottom_right = self.mapToScene(self.viewport().width() - 1, self.viewport().height() - 1) return QRectF(top_left, bottom_right)
[ "Return", "the", "boundaries", "of", "the", "view", "in", "scene", "coordinates" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ui/views/SelectableGraphicView.py#L317-L323
[ "def", "view_rect", "(", "self", ")", "->", "QRectF", ":", "top_left", "=", "self", ".", "mapToScene", "(", "0", ",", "0", ")", "bottom_right", "=", "self", ".", "mapToScene", "(", "self", ".", "viewport", "(", ")", ".", "width", "(", ")", "-", "1"...
2eb33b125c8407964cd1092843cde5010eb88aae
train
SimulatorScene.dropEvent
:type: list of ProtocolTreeItem
src/urh/ui/SimulatorScene.py
def dropEvent(self, event: QDropEvent): items = [item for item in self.items(event.scenePos()) if isinstance(item, GraphicsItem) and item.acceptDrops()] item = None if len(items) == 0 else items[0] if len(event.mimeData().urls()) > 0: self.files_dropped.emit(event.mimeData().urls()) ...
def dropEvent(self, event: QDropEvent): items = [item for item in self.items(event.scenePos()) if isinstance(item, GraphicsItem) and item.acceptDrops()] item = None if len(items) == 0 else items[0] if len(event.mimeData().urls()) > 0: self.files_dropped.emit(event.mimeData().urls()) ...
[ ":", "type", ":", "list", "of", "ProtocolTreeItem" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ui/SimulatorScene.py#L376-L412
[ "def", "dropEvent", "(", "self", ",", "event", ":", "QDropEvent", ")", ":", "items", "=", "[", "item", "for", "item", "in", "self", ".", "items", "(", "event", ".", "scenePos", "(", ")", ")", "if", "isinstance", "(", "item", ",", "GraphicsItem", ")",...
2eb33b125c8407964cd1092843cde5010eb88aae
train
convert_bits_to_string
Convert bit array to string :param endianness: Endianness little or big :param bits: Bit array :param output_view_type: Output view type index 0 = bit, 1=hex, 2=ascii, 3=decimal 4=binary coded decimal (bcd) :param pad_zeros: :param lsb: Least Significant Bit -> Reverse bits first :param ls...
src/urh/util/util.py
def convert_bits_to_string(bits, output_view_type: int, pad_zeros=False, lsb=False, lsd=False, endianness="big"): """ Convert bit array to string :param endianness: Endianness little or big :param bits: Bit array :param output_view_type: Output view type index 0 = bit, 1=hex, 2=ascii, 3=decimal ...
def convert_bits_to_string(bits, output_view_type: int, pad_zeros=False, lsb=False, lsd=False, endianness="big"): """ Convert bit array to string :param endianness: Endianness little or big :param bits: Bit array :param output_view_type: Output view type index 0 = bit, 1=hex, 2=ascii, 3=decimal ...
[ "Convert", "bit", "array", "to", "string", ":", "param", "endianness", ":", "Endianness", "little", "or", "big", ":", "param", "bits", ":", "Bit", "array", ":", "param", "output_view_type", ":", "Output", "view", "type", "index", "0", "=", "bit", "1", "=...
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/util/util.py#L88-L142
[ "def", "convert_bits_to_string", "(", "bits", ",", "output_view_type", ":", "int", ",", "pad_zeros", "=", "False", ",", "lsb", "=", "False", ",", "lsd", "=", "False", ",", "endianness", "=", "\"big\"", ")", ":", "bits_str", "=", "\"\"", ".", "join", "(",...
2eb33b125c8407964cd1092843cde5010eb88aae
train
ProtocolAnalyzer.__ensure_message_length_multiple
In case of ASK modulation, this method tries to use pauses after messages as zero bits so that the bit lengths of messages are divisible by divisor :param bit_data: List of bit arrays :param bit_len: Bit length that was used for demodulation :param pauses: List of pauses :param b...
src/urh/signalprocessing/ProtocolAnalyzer.py
def __ensure_message_length_multiple(bit_data, bit_len: int, pauses, bit_sample_pos, divisor: int): """ In case of ASK modulation, this method tries to use pauses after messages as zero bits so that the bit lengths of messages are divisible by divisor :param bit_data: List of bit arrays ...
def __ensure_message_length_multiple(bit_data, bit_len: int, pauses, bit_sample_pos, divisor: int): """ In case of ASK modulation, this method tries to use pauses after messages as zero bits so that the bit lengths of messages are divisible by divisor :param bit_data: List of bit arrays ...
[ "In", "case", "of", "ASK", "modulation", "this", "method", "tries", "to", "use", "pauses", "after", "messages", "as", "zero", "bits", "so", "that", "the", "bit", "lengths", "of", "messages", "are", "divisible", "by", "divisor", ":", "param", "bit_data", ":...
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/ProtocolAnalyzer.py#L246-L269
[ "def", "__ensure_message_length_multiple", "(", "bit_data", ",", "bit_len", ":", "int", ",", "pauses", ",", "bit_sample_pos", ",", "divisor", ":", "int", ")", ":", "for", "i", "in", "range", "(", "len", "(", "bit_data", ")", ")", ":", "missing_bits", "=", ...
2eb33b125c8407964cd1092843cde5010eb88aae
train
ProtocolAnalyzer.get_samplepos_of_bitseq
Determine on which place (regarding samples) a bit sequence is :rtype: tuple[int,int]
src/urh/signalprocessing/ProtocolAnalyzer.py
def get_samplepos_of_bitseq(self, start_message: int, start_index: int, end_message: int, end_index: int, include_pause: bool): """ Determine on which place (regarding samples) a bit sequence is :rtype: tuple[int,int] """ try: if start_...
def get_samplepos_of_bitseq(self, start_message: int, start_index: int, end_message: int, end_index: int, include_pause: bool): """ Determine on which place (regarding samples) a bit sequence is :rtype: tuple[int,int] """ try: if start_...
[ "Determine", "on", "which", "place", "(", "regarding", "samples", ")", "a", "bit", "sequence", "is", ":", "rtype", ":", "tuple", "[", "int", "int", "]" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/ProtocolAnalyzer.py#L349-L374
[ "def", "get_samplepos_of_bitseq", "(", "self", ",", "start_message", ":", "int", ",", "start_index", ":", "int", ",", "end_message", ":", "int", ",", "end_index", ":", "int", ",", "include_pause", ":", "bool", ")", ":", "try", ":", "if", "start_message", "...
2eb33b125c8407964cd1092843cde5010eb88aae
train
ProtocolAnalyzer.get_bitseq_from_selection
get start and end index of bit sequence from selected samples :rtype: tuple[int,int,int,int] :return: start_message index, start index, end message index, end index
src/urh/signalprocessing/ProtocolAnalyzer.py
def get_bitseq_from_selection(self, selection_start: int, selection_width: int): """ get start and end index of bit sequence from selected samples :rtype: tuple[int,int,int,int] :return: start_message index, start index, end message index, end index """ start_message, st...
def get_bitseq_from_selection(self, selection_start: int, selection_width: int): """ get start and end index of bit sequence from selected samples :rtype: tuple[int,int,int,int] :return: start_message index, start index, end message index, end index """ start_message, st...
[ "get", "start", "and", "end", "index", "of", "bit", "sequence", "from", "selected", "samples" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/ProtocolAnalyzer.py#L376-L414
[ "def", "get_bitseq_from_selection", "(", "self", ",", "selection_start", ":", "int", ",", "selection_width", ":", "int", ")", ":", "start_message", ",", "start_index", ",", "end_message", ",", "end_index", "=", "-", "1", ",", "-", "1", ",", "-", "1", ",", ...
2eb33b125c8407964cd1092843cde5010eb88aae
train
ProtocolAnalyzer.convert_index
Konvertiert einen Index aus der einen Sicht (z.B. Bit) in eine andere (z.B. Hex) :param message_indx: if -1, the message with max length is chosen :return:
src/urh/signalprocessing/ProtocolAnalyzer.py
def convert_index(self, index: int, from_view: int, to_view: int, decoded: bool, message_indx=-1) -> tuple: """ Konvertiert einen Index aus der einen Sicht (z.B. Bit) in eine andere (z.B. Hex) :param message_indx: if -1, the message with max length is chosen :return: """ ...
def convert_index(self, index: int, from_view: int, to_view: int, decoded: bool, message_indx=-1) -> tuple: """ Konvertiert einen Index aus der einen Sicht (z.B. Bit) in eine andere (z.B. Hex) :param message_indx: if -1, the message with max length is chosen :return: """ ...
[ "Konvertiert", "einen", "Index", "aus", "der", "einen", "Sicht", "(", "z", ".", "B", ".", "Bit", ")", "in", "eine", "andere", "(", "z", ".", "B", ".", "Hex", ")" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/ProtocolAnalyzer.py#L439-L455
[ "def", "convert_index", "(", "self", ",", "index", ":", "int", ",", "from_view", ":", "int", ",", "to_view", ":", "int", ",", "decoded", ":", "bool", ",", "message_indx", "=", "-", "1", ")", "->", "tuple", ":", "if", "len", "(", "self", ".", "messa...
2eb33b125c8407964cd1092843cde5010eb88aae
train
ProtocolAnalyzer.estimate_frequency_for_one
Calculates the frequency of at most nbits logical ones and returns the mean of these frequencies :param nbits: :return:
src/urh/signalprocessing/ProtocolAnalyzer.py
def estimate_frequency_for_one(self, sample_rate: float, nbits=42) -> float: """ Calculates the frequency of at most nbits logical ones and returns the mean of these frequencies :param nbits: :return: """ return self.__estimate_frequency_for_bit(True, sample_rate, nbits)
def estimate_frequency_for_one(self, sample_rate: float, nbits=42) -> float: """ Calculates the frequency of at most nbits logical ones and returns the mean of these frequencies :param nbits: :return: """ return self.__estimate_frequency_for_bit(True, sample_rate, nbits)
[ "Calculates", "the", "frequency", "of", "at", "most", "nbits", "logical", "ones", "and", "returns", "the", "mean", "of", "these", "frequencies" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/ProtocolAnalyzer.py#L470-L477
[ "def", "estimate_frequency_for_one", "(", "self", ",", "sample_rate", ":", "float", ",", "nbits", "=", "42", ")", "->", "float", ":", "return", "self", ".", "__estimate_frequency_for_bit", "(", "True", ",", "sample_rate", ",", "nbits", ")" ]
2eb33b125c8407964cd1092843cde5010eb88aae
train
ProtocolAnalyzer.estimate_frequency_for_zero
Calculates the frequency of at most nbits logical zeros and returns the mean of these frequencies :param nbits: :return:
src/urh/signalprocessing/ProtocolAnalyzer.py
def estimate_frequency_for_zero(self, sample_rate: float, nbits=42) -> float: """ Calculates the frequency of at most nbits logical zeros and returns the mean of these frequencies :param nbits: :return: """ return self.__estimate_frequency_for_bit(False, sample_rate, nbi...
def estimate_frequency_for_zero(self, sample_rate: float, nbits=42) -> float: """ Calculates the frequency of at most nbits logical zeros and returns the mean of these frequencies :param nbits: :return: """ return self.__estimate_frequency_for_bit(False, sample_rate, nbi...
[ "Calculates", "the", "frequency", "of", "at", "most", "nbits", "logical", "zeros", "and", "returns", "the", "mean", "of", "these", "frequencies" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/ProtocolAnalyzer.py#L496-L503
[ "def", "estimate_frequency_for_zero", "(", "self", ",", "sample_rate", ":", "float", ",", "nbits", "=", "42", ")", "->", "float", ":", "return", "self", ".", "__estimate_frequency_for_bit", "(", "False", ",", "sample_rate", ",", "nbits", ")" ]
2eb33b125c8407964cd1092843cde5010eb88aae
train
ProtocolAnalyzer.auto_assign_decodings
:type decodings: list of Encoding
src/urh/signalprocessing/ProtocolAnalyzer.py
def auto_assign_decodings(self, decodings): """ :type decodings: list of Encoding """ nrz_decodings = [decoding for decoding in decodings if decoding.is_nrz or decoding.is_nrzi] fallback = nrz_decodings[0] if nrz_decodings else None candidate_decodings = [decoding for dec...
def auto_assign_decodings(self, decodings): """ :type decodings: list of Encoding """ nrz_decodings = [decoding for decoding in decodings if decoding.is_nrz or decoding.is_nrzi] fallback = nrz_decodings[0] if nrz_decodings else None candidate_decodings = [decoding for dec...
[ ":", "type", "decodings", ":", "list", "of", "Encoding" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/ProtocolAnalyzer.py#L718-L737
[ "def", "auto_assign_decodings", "(", "self", ",", "decodings", ")", ":", "nrz_decodings", "=", "[", "decoding", "for", "decoding", "in", "decodings", "if", "decoding", ".", "is_nrz", "or", "decoding", ".", "is_nrzi", "]", "fallback", "=", "nrz_decodings", "[",...
2eb33b125c8407964cd1092843cde5010eb88aae
train
MessageTypeTableView.selection_range
:rtype: int, int
src/urh/ui/views/MessageTypeTableView.py
def selection_range(self): """ :rtype: int, int """ selected = self.selectionModel().selection() """:type: QItemSelection """ if selected.isEmpty(): return -1, -1 min_row = min(rng.top() for rng in selected) max_row = max(rng.bottom() for rng...
def selection_range(self): """ :rtype: int, int """ selected = self.selectionModel().selection() """:type: QItemSelection """ if selected.isEmpty(): return -1, -1 min_row = min(rng.top() for rng in selected) max_row = max(rng.bottom() for rng...
[ ":", "rtype", ":", "int", "int" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ui/views/MessageTypeTableView.py#L33-L46
[ "def", "selection_range", "(", "self", ")", ":", "selected", "=", "self", ".", "selectionModel", "(", ")", ".", "selection", "(", ")", "\"\"\":type: QItemSelection \"\"\"", "if", "selected", ".", "isEmpty", "(", ")", ":", "return", "-", "1", ",", "-", "1",...
2eb33b125c8407964cd1092843cde5010eb88aae
train
cleanup
Remove all cache directories :return:
data/release.py
def cleanup(): """ Remove all cache directories :return: """ script_dir = os.path.dirname(__file__) if not os.path.islink(__file__) else os.path.dirname(os.readlink(__file__)) script_dir = os.path.realpath(os.path.join(script_dir, "..")) shutil.rmtree(os.path.join(script_dir, "dist"), ignore...
def cleanup(): """ Remove all cache directories :return: """ script_dir = os.path.dirname(__file__) if not os.path.islink(__file__) else os.path.dirname(os.readlink(__file__)) script_dir = os.path.realpath(os.path.join(script_dir, "..")) shutil.rmtree(os.path.join(script_dir, "dist"), ignore...
[ "Remove", "all", "cache", "directories", ":", "return", ":" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/data/release.py#L9-L20
[ "def", "cleanup", "(", ")", ":", "script_dir", "=", "os", ".", "path", ".", "dirname", "(", "__file__", ")", "if", "not", "os", ".", "path", ".", "islink", "(", "__file__", ")", "else", "os", ".", "path", ".", "dirname", "(", "os", ".", "readlink",...
2eb33b125c8407964cd1092843cde5010eb88aae
train
TableView.selection_range
:rtype: int, int, int, int
src/urh/ui/views/TableView.py
def selection_range(self): """ :rtype: int, int, int, int """ selected = self.selectionModel().selection() # type: QItemSelection if self.selection_is_empty: return -1, -1, -1, -1 def range_to_tuple(rng): return rng.row(), rng.column() t...
def selection_range(self): """ :rtype: int, int, int, int """ selected = self.selectionModel().selection() # type: QItemSelection if self.selection_is_empty: return -1, -1, -1, -1 def range_to_tuple(rng): return rng.row(), rng.column() t...
[ ":", "rtype", ":", "int", "int", "int", "int" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ui/views/TableView.py#L106-L120
[ "def", "selection_range", "(", "self", ")", ":", "selected", "=", "self", ".", "selectionModel", "(", ")", ".", "selection", "(", ")", "# type: QItemSelection", "if", "self", ".", "selection_is_empty", ":", "return", "-", "1", ",", "-", "1", ",", "-", "1...
2eb33b125c8407964cd1092843cde5010eb88aae
train
get_most_frequent_value
Return the most frequent value in list. If there is no unique one, return the maximum of the most frequent values :param values: :return:
src/urh/ainterpretation/AutoInterpretation.py
def get_most_frequent_value(values: list): """ Return the most frequent value in list. If there is no unique one, return the maximum of the most frequent values :param values: :return: """ if len(values) == 0: return None most_common = Counter(values).most_common() result, ...
def get_most_frequent_value(values: list): """ Return the most frequent value in list. If there is no unique one, return the maximum of the most frequent values :param values: :return: """ if len(values) == 0: return None most_common = Counter(values).most_common() result, ...
[ "Return", "the", "most", "frequent", "value", "in", "list", ".", "If", "there", "is", "no", "unique", "one", "return", "the", "maximum", "of", "the", "most", "frequent", "values" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ainterpretation/AutoInterpretation.py#L28-L47
[ "def", "get_most_frequent_value", "(", "values", ":", "list", ")", ":", "if", "len", "(", "values", ")", "==", "0", ":", "return", "None", "most_common", "=", "Counter", "(", "values", ")", ".", "most_common", "(", ")", "result", ",", "max_count", "=", ...
2eb33b125c8407964cd1092843cde5010eb88aae
train
segment_messages_from_magnitudes
Get the list of start, end indices of messages :param magnitudes: Magnitudes of samples :param noise_threshold: Threshold for noise :return:
src/urh/ainterpretation/AutoInterpretation.py
def segment_messages_from_magnitudes(magnitudes: np.ndarray, noise_threshold: float): """ Get the list of start, end indices of messages :param magnitudes: Magnitudes of samples :param noise_threshold: Threshold for noise :return: """ return c_auto_interpretation.segment_messages_from_magni...
def segment_messages_from_magnitudes(magnitudes: np.ndarray, noise_threshold: float): """ Get the list of start, end indices of messages :param magnitudes: Magnitudes of samples :param noise_threshold: Threshold for noise :return: """ return c_auto_interpretation.segment_messages_from_magni...
[ "Get", "the", "list", "of", "start", "end", "indices", "of", "messages" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ainterpretation/AutoInterpretation.py#L78-L86
[ "def", "segment_messages_from_magnitudes", "(", "magnitudes", ":", "np", ".", "ndarray", ",", "noise_threshold", ":", "float", ")", ":", "return", "c_auto_interpretation", ".", "segment_messages_from_magnitudes", "(", "magnitudes", ",", "noise_threshold", ")" ]
2eb33b125c8407964cd1092843cde5010eb88aae
train
round_plateau_lengths
Round plateau lengths to next divisible number of digit count e.g. 99 -> 100, 293 -> 300 :param plateau_lengths: :return:
src/urh/ainterpretation/AutoInterpretation.py
def round_plateau_lengths(plateau_lengths: list): """ Round plateau lengths to next divisible number of digit count e.g. 99 -> 100, 293 -> 300 :param plateau_lengths: :return: """ # round to n_digits of most common value digit_counts = [len(str(p)) for p in plateau_lengths] n_digits = m...
def round_plateau_lengths(plateau_lengths: list): """ Round plateau lengths to next divisible number of digit count e.g. 99 -> 100, 293 -> 300 :param plateau_lengths: :return: """ # round to n_digits of most common value digit_counts = [len(str(p)) for p in plateau_lengths] n_digits = m...
[ "Round", "plateau", "lengths", "to", "next", "divisible", "number", "of", "digit", "count", "e", ".", "g", ".", "99", "-", ">", "100", "293", "-", ">", "300" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ainterpretation/AutoInterpretation.py#L293-L306
[ "def", "round_plateau_lengths", "(", "plateau_lengths", ":", "list", ")", ":", "# round to n_digits of most common value", "digit_counts", "=", "[", "len", "(", "str", "(", "p", ")", ")", "for", "p", "in", "plateau_lengths", "]", "n_digits", "=", "min", "(", "...
2eb33b125c8407964cd1092843cde5010eb88aae
train
MainController.on_files_dropped_on_group
:param group_id: :type files: list of QtCore.QUrl
src/urh/controller/MainController.py
def on_files_dropped_on_group(self, files, group_id: int): """ :param group_id: :type files: list of QtCore.QUrl """ self.__add_urls_to_group(files, group_id=group_id)
def on_files_dropped_on_group(self, files, group_id: int): """ :param group_id: :type files: list of QtCore.QUrl """ self.__add_urls_to_group(files, group_id=group_id)
[ ":", "param", "group_id", ":", ":", "type", "files", ":", "list", "of", "QtCore", ".", "QUrl" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/controller/MainController.py#L799-L804
[ "def", "on_files_dropped_on_group", "(", "self", ",", "files", ",", "group_id", ":", "int", ")", ":", "self", ".", "__add_urls_to_group", "(", "files", ",", "group_id", "=", "group_id", ")" ]
2eb33b125c8407964cd1092843cde5010eb88aae
train
PluginManager.load_installed_plugins
:rtype: list of Plugin
src/urh/plugins/PluginManager.py
def load_installed_plugins(self): """ :rtype: list of Plugin """ result = [] plugin_dirs = [d for d in os.listdir(self.plugin_path) if os.path.isdir(os.path.join(self.plugin_path, d))] settings = constants.SETTINGS for d in plugin_dirs: if d == "__pycache__": ...
def load_installed_plugins(self): """ :rtype: list of Plugin """ result = [] plugin_dirs = [d for d in os.listdir(self.plugin_path) if os.path.isdir(os.path.join(self.plugin_path, d))] settings = constants.SETTINGS for d in plugin_dirs: if d == "__pycache__": ...
[ ":", "rtype", ":", "list", "of", "Plugin" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/plugins/PluginManager.py#L18-L38
[ "def", "load_installed_plugins", "(", "self", ")", ":", "result", "=", "[", "]", "plugin_dirs", "=", "[", "d", "for", "d", "in", "os", ".", "listdir", "(", "self", ".", "plugin_path", ")", "if", "os", ".", "path", ".", "isdir", "(", "os", ".", "pat...
2eb33b125c8407964cd1092843cde5010eb88aae
train
MessageBreakAction.__get_zero_seq_indexes
:rtype: list[tuple of int]
src/urh/plugins/MessageBreak/MessageBreakAction.py
def __get_zero_seq_indexes(self, message: str, following_zeros: int): """ :rtype: list[tuple of int] """ result = [] if following_zeros > len(message): return result zero_counter = 0 for i in range(0, len(message)): if message[i] == "0": ...
def __get_zero_seq_indexes(self, message: str, following_zeros: int): """ :rtype: list[tuple of int] """ result = [] if following_zeros > len(message): return result zero_counter = 0 for i in range(0, len(message)): if message[i] == "0": ...
[ ":", "rtype", ":", "list", "[", "tuple", "of", "int", "]" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/plugins/MessageBreak/MessageBreakAction.py#L33-L54
[ "def", "__get_zero_seq_indexes", "(", "self", ",", "message", ":", "str", ",", "following_zeros", ":", "int", ")", ":", "result", "=", "[", "]", "if", "following_zeros", ">", "len", "(", "message", ")", ":", "return", "result", "zero_counter", "=", "0", ...
2eb33b125c8407964cd1092843cde5010eb88aae
train
VirtualDevice.read_messages
returns a string of new device messages separated by newlines :return:
src/urh/dev/VirtualDevice.py
def read_messages(self) -> str: """ returns a string of new device messages separated by newlines :return: """ if self.backend == Backends.grc: errors = self.__dev.read_errors() if "FATAL: " in errors: self.fatal_error_occurred.emit(error...
def read_messages(self) -> str: """ returns a string of new device messages separated by newlines :return: """ if self.backend == Backends.grc: errors = self.__dev.read_errors() if "FATAL: " in errors: self.fatal_error_occurred.emit(error...
[ "returns", "a", "string", "of", "new", "device", "messages", "separated", "by", "newlines" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/dev/VirtualDevice.py#L648-L677
[ "def", "read_messages", "(", "self", ")", "->", "str", ":", "if", "self", ".", "backend", "==", "Backends", ".", "grc", ":", "errors", "=", "self", ".", "__dev", ".", "read_errors", "(", ")", "if", "\"FATAL: \"", "in", "errors", ":", "self", ".", "fa...
2eb33b125c8407964cd1092843cde5010eb88aae
train
ProtocolPlugin.get_action
:type parent: QTableView :type undo_stack: QUndoStack :type groups: list of ProtocolGroups
src/urh/plugins/Plugin.py
def get_action(self, parent, undo_stack: QUndoStack, sel_range, groups, view: int) -> QUndoCommand: """ :type parent: QTableView :type undo_stack: QUndoStack :type groups: list of ProtocolGroups """ raise NotImplementedError("Abstract Method.")
def get_action(self, parent, undo_stack: QUndoStack, sel_range, groups, view: int) -> QUndoCommand: """ :type parent: QTableView :type undo_stack: QUndoStack :type groups: list of ProtocolGroups """ raise NotImplementedError("Abstract Method.")
[ ":", "type", "parent", ":", "QTableView", ":", "type", "undo_stack", ":", "QUndoStack", ":", "type", "groups", ":", "list", "of", "ProtocolGroups" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/plugins/Plugin.py#L57-L64
[ "def", "get_action", "(", "self", ",", "parent", ",", "undo_stack", ":", "QUndoStack", ",", "sel_range", ",", "groups", ",", "view", ":", "int", ")", "->", "QUndoCommand", ":", "raise", "NotImplementedError", "(", "\"Abstract Method.\"", ")" ]
2eb33b125c8407964cd1092843cde5010eb88aae
train
WSPChecksum.calculate
Get the checksum for a WSP message. There are three hashes possible: 1) 4 Bit Checksum - For Switch Telegram (RORG=5 or 6 and STATUS = 0x20 or 0x30) 2) 8 Bit Checksum: STATUS bit 2^7 = 0 3) 8 Bit CRC: STATUS bit 2^7 = 1 :param msg: the message without Preamble/SOF and EOF. Message start...
src/urh/util/WSPChecksum.py
def calculate(self, msg: array.array) -> array.array: """ Get the checksum for a WSP message. There are three hashes possible: 1) 4 Bit Checksum - For Switch Telegram (RORG=5 or 6 and STATUS = 0x20 or 0x30) 2) 8 Bit Checksum: STATUS bit 2^7 = 0 3) 8 Bit CRC: STATUS bit 2^7 = 1 ...
def calculate(self, msg: array.array) -> array.array: """ Get the checksum for a WSP message. There are three hashes possible: 1) 4 Bit Checksum - For Switch Telegram (RORG=5 or 6 and STATUS = 0x20 or 0x30) 2) 8 Bit Checksum: STATUS bit 2^7 = 0 3) 8 Bit CRC: STATUS bit 2^7 = 1 ...
[ "Get", "the", "checksum", "for", "a", "WSP", "message", ".", "There", "are", "three", "hashes", "possible", ":", "1", ")", "4", "Bit", "Checksum", "-", "For", "Switch", "Telegram", "(", "RORG", "=", "5", "or", "6", "and", "STATUS", "=", "0x20", "or",...
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/util/WSPChecksum.py#L27-L56
[ "def", "calculate", "(", "self", ",", "msg", ":", "array", ".", "array", ")", "->", "array", ".", "array", ":", "try", ":", "if", "self", ".", "mode", "==", "self", ".", "ChecksumMode", ".", "auto", ":", "if", "msg", "[", "0", ":", "4", "]", "=...
2eb33b125c8407964cd1092843cde5010eb88aae
train
ProtocolTreeItem.child
:type number: int :rtype: ProtocolTreeItem
src/urh/models/ProtocolTreeItem.py
def child(self, number): """ :type number: int :rtype: ProtocolTreeItem """ if number < self.childCount(): return self.__childItems[number] else: return False
def child(self, number): """ :type number: int :rtype: ProtocolTreeItem """ if number < self.childCount(): return self.__childItems[number] else: return False
[ ":", "type", "number", ":", "int", ":", "rtype", ":", "ProtocolTreeItem" ]
jopohl/urh
python
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/models/ProtocolTreeItem.py#L106-L114
[ "def", "child", "(", "self", ",", "number", ")", ":", "if", "number", "<", "self", ".", "childCount", "(", ")", ":", "return", "self", ".", "__childItems", "[", "number", "]", "else", ":", "return", "False" ]
2eb33b125c8407964cd1092843cde5010eb88aae
train
CloudflareScraper.create_scraper
Convenience function for creating a ready-to-go CloudflareScraper object.
cfscrape/__init__.py
def create_scraper(cls, sess=None, **kwargs): """ Convenience function for creating a ready-to-go CloudflareScraper object. """ scraper = cls(**kwargs) if sess: attrs = ["auth", "cert", "cookies", "headers", "hooks", "params", "proxies", "data"] for attr ...
def create_scraper(cls, sess=None, **kwargs): """ Convenience function for creating a ready-to-go CloudflareScraper object. """ scraper = cls(**kwargs) if sess: attrs = ["auth", "cert", "cookies", "headers", "hooks", "params", "proxies", "data"] for attr ...
[ "Convenience", "function", "for", "creating", "a", "ready", "-", "to", "-", "go", "CloudflareScraper", "object", "." ]
Anorov/cloudflare-scrape
python
https://github.com/Anorov/cloudflare-scrape/blob/f35c463a60d175f0252b1e0c8e14a284e9d4daa5/cfscrape/__init__.py#L156-L169
[ "def", "create_scraper", "(", "cls", ",", "sess", "=", "None", ",", "*", "*", "kwargs", ")", ":", "scraper", "=", "cls", "(", "*", "*", "kwargs", ")", "if", "sess", ":", "attrs", "=", "[", "\"auth\"", ",", "\"cert\"", ",", "\"cookies\"", ",", "\"he...
f35c463a60d175f0252b1e0c8e14a284e9d4daa5
train
CloudflareScraper.get_cookie_string
Convenience function for building a Cookie HTTP header value.
cfscrape/__init__.py
def get_cookie_string(cls, url, user_agent=None, **kwargs): """ Convenience function for building a Cookie HTTP header value. """ tokens, user_agent = cls.get_tokens(url, user_agent=user_agent, **kwargs) return "; ".join("=".join(pair) for pair in tokens.items()), user_agent
def get_cookie_string(cls, url, user_agent=None, **kwargs): """ Convenience function for building a Cookie HTTP header value. """ tokens, user_agent = cls.get_tokens(url, user_agent=user_agent, **kwargs) return "; ".join("=".join(pair) for pair in tokens.items()), user_agent
[ "Convenience", "function", "for", "building", "a", "Cookie", "HTTP", "header", "value", "." ]
Anorov/cloudflare-scrape
python
https://github.com/Anorov/cloudflare-scrape/blob/f35c463a60d175f0252b1e0c8e14a284e9d4daa5/cfscrape/__init__.py#L205-L210
[ "def", "get_cookie_string", "(", "cls", ",", "url", ",", "user_agent", "=", "None", ",", "*", "*", "kwargs", ")", ":", "tokens", ",", "user_agent", "=", "cls", ".", "get_tokens", "(", "url", ",", "user_agent", "=", "user_agent", ",", "*", "*", "kwargs"...
f35c463a60d175f0252b1e0c8e14a284e9d4daa5
train
ExtremeErsSSH.save_config
Save Config
netmiko/extreme/extreme_ers_ssh.py
def save_config(self, cmd="save config", confirm=False, confirm_response=""): """Save Config""" return super(ExtremeErsSSH, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
def save_config(self, cmd="save config", confirm=False, confirm_response=""): """Save Config""" return super(ExtremeErsSSH, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
[ "Save", "Config" ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/extreme/extreme_ers_ssh.py#L41-L45
[ "def", "save_config", "(", "self", ",", "cmd", "=", "\"save config\"", ",", "confirm", "=", "False", ",", "confirm_response", "=", "\"\"", ")", ":", "return", "super", "(", "ExtremeErsSSH", ",", "self", ")", ".", "save_config", "(", "cmd", "=", "cmd", ",...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
ExtremeSlxSSH.special_login_handler
Adding a delay after login.
netmiko/extreme/extreme_slx_ssh.py
def special_login_handler(self, delay_factor=1): """Adding a delay after login.""" delay_factor = self.select_delay_factor(delay_factor) self.write_channel(self.RETURN) time.sleep(1 * delay_factor)
def special_login_handler(self, delay_factor=1): """Adding a delay after login.""" delay_factor = self.select_delay_factor(delay_factor) self.write_channel(self.RETURN) time.sleep(1 * delay_factor)
[ "Adding", "a", "delay", "after", "login", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/extreme/extreme_slx_ssh.py#L18-L22
[ "def", "special_login_handler", "(", "self", ",", "delay_factor", "=", "1", ")", ":", "delay_factor", "=", "self", ".", "select_delay_factor", "(", "delay_factor", ")", "self", ".", "write_channel", "(", "self", ".", "RETURN", ")", "time", ".", "sleep", "(",...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
ExtremeSlxSSH.save_config
Save Config for Extreme SLX.
netmiko/extreme/extreme_slx_ssh.py
def save_config( self, cmd="copy running-config startup-config", confirm=True, confirm_response="y", ): """Save Config for Extreme SLX.""" return super(ExtremeSlxSSH, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
def save_config( self, cmd="copy running-config startup-config", confirm=True, confirm_response="y", ): """Save Config for Extreme SLX.""" return super(ExtremeSlxSSH, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
[ "Save", "Config", "for", "Extreme", "SLX", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/extreme/extreme_slx_ssh.py#L24-L33
[ "def", "save_config", "(", "self", ",", "cmd", "=", "\"copy running-config startup-config\"", ",", "confirm", "=", "True", ",", "confirm_response", "=", "\"y\"", ",", ")", ":", "return", "super", "(", "ExtremeSlxSSH", ",", "self", ")", ".", "save_config", "(",...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
show_version
Execute show version command using Netmiko.
examples/use_cases/case16_concurrency/threads_netmiko.py
def show_version(a_device): """Execute show version command using Netmiko.""" remote_conn = ConnectHandler(**a_device) print() print("#" * 80) print(remote_conn.send_command_expect("show version")) print("#" * 80) print()
def show_version(a_device): """Execute show version command using Netmiko.""" remote_conn = ConnectHandler(**a_device) print() print("#" * 80) print(remote_conn.send_command_expect("show version")) print("#" * 80) print()
[ "Execute", "show", "version", "command", "using", "Netmiko", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/examples/use_cases/case16_concurrency/threads_netmiko.py#L8-L15
[ "def", "show_version", "(", "a_device", ")", ":", "remote_conn", "=", "ConnectHandler", "(", "*", "*", "a_device", ")", "print", "(", ")", "print", "(", "\"#\"", "*", "80", ")", "print", "(", "remote_conn", ".", "send_command_expect", "(", "\"show version\""...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
main
Use threads and Netmiko to connect to each of the devices. Execute 'show version' on each device. Record the amount of time required to do this.
examples/use_cases/case16_concurrency/threads_netmiko.py
def main(): """ Use threads and Netmiko to connect to each of the devices. Execute 'show version' on each device. Record the amount of time required to do this. """ start_time = datetime.now() for a_device in devices: my_thread = threading.Thread(target=show_version, args=(a_device,)) ...
def main(): """ Use threads and Netmiko to connect to each of the devices. Execute 'show version' on each device. Record the amount of time required to do this. """ start_time = datetime.now() for a_device in devices: my_thread = threading.Thread(target=show_version, args=(a_device,)) ...
[ "Use", "threads", "and", "Netmiko", "to", "connect", "to", "each", "of", "the", "devices", ".", "Execute", "show", "version", "on", "each", "device", ".", "Record", "the", "amount", "of", "time", "required", "to", "do", "this", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/examples/use_cases/case16_concurrency/threads_netmiko.py#L18-L35
[ "def", "main", "(", ")", ":", "start_time", "=", "datetime", ".", "now", "(", ")", "for", "a_device", "in", "devices", ":", "my_thread", "=", "threading", ".", "Thread", "(", "target", "=", "show_version", ",", "args", "=", "(", "a_device", ",", ")", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
DellForce10SSH.save_config
Saves Config
netmiko/dell/dell_force10_ssh.py
def save_config( self, cmd="copy running-configuration startup-configuration", confirm=False, confirm_response="", ): """Saves Config""" return super(DellForce10SSH, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
def save_config( self, cmd="copy running-configuration startup-configuration", confirm=False, confirm_response="", ): """Saves Config""" return super(DellForce10SSH, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
[ "Saves", "Config" ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/dell/dell_force10_ssh.py#L9-L18
[ "def", "save_config", "(", "self", ",", "cmd", "=", "\"copy running-configuration startup-configuration\"", ",", "confirm", "=", "False", ",", "confirm_response", "=", "\"\"", ",", ")", ":", "return", "super", "(", "DellForce10SSH", ",", "self", ")", ".", "save_...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
NetscalerSSH.session_preparation
Prepare the session after the connection has been established.
netmiko/citrix/netscaler_ssh.py
def session_preparation(self): """Prepare the session after the connection has been established.""" # 0 will defer to the global delay factor delay_factor = self.select_delay_factor(delay_factor=0) self._test_channel_read() self.set_base_prompt() cmd = "{}set cli mode -pa...
def session_preparation(self): """Prepare the session after the connection has been established.""" # 0 will defer to the global delay factor delay_factor = self.select_delay_factor(delay_factor=0) self._test_channel_read() self.set_base_prompt() cmd = "{}set cli mode -pa...
[ "Prepare", "the", "session", "after", "the", "connection", "has", "been", "established", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/citrix/netscaler_ssh.py#L9-L20
[ "def", "session_preparation", "(", "self", ")", ":", "# 0 will defer to the global delay factor", "delay_factor", "=", "self", ".", "select_delay_factor", "(", "delay_factor", "=", "0", ")", "self", ".", "_test_channel_read", "(", ")", "self", ".", "set_base_prompt", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
NetscalerSSH.strip_prompt
Strip 'Done' from command output
netmiko/citrix/netscaler_ssh.py
def strip_prompt(self, a_string): """ Strip 'Done' from command output """ output = super(NetscalerSSH, self).strip_prompt(a_string) lines = output.split(self.RESPONSE_RETURN) if "Done" in lines[-1]: return self.RESPONSE_RETURN.join(lines[:-1]) else: retur...
def strip_prompt(self, a_string): """ Strip 'Done' from command output """ output = super(NetscalerSSH, self).strip_prompt(a_string) lines = output.split(self.RESPONSE_RETURN) if "Done" in lines[-1]: return self.RESPONSE_RETURN.join(lines[:-1]) else: retur...
[ "Strip", "Done", "from", "command", "output" ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/citrix/netscaler_ssh.py#L53-L60
[ "def", "strip_prompt", "(", "self", ",", "a_string", ")", ":", "output", "=", "super", "(", "NetscalerSSH", ",", "self", ")", ".", "strip_prompt", "(", "a_string", ")", "lines", "=", "output", ".", "split", "(", "self", ".", "RESPONSE_RETURN", ")", "if",...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
UbiquitiEdgeSSH.save_config
Saves configuration.
netmiko/ubiquiti/edge_ssh.py
def save_config(self, cmd="write memory", confirm=False, confirm_response=""): """Saves configuration.""" return super(UbiquitiEdgeSSH, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
def save_config(self, cmd="write memory", confirm=False, confirm_response=""): """Saves configuration.""" return super(UbiquitiEdgeSSH, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
[ "Saves", "configuration", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/ubiquiti/edge_ssh.py#L43-L47
[ "def", "save_config", "(", "self", ",", "cmd", "=", "\"write memory\"", ",", "confirm", "=", "False", ",", "confirm_response", "=", "\"\"", ")", ":", "return", "super", "(", "UbiquitiEdgeSSH", ",", "self", ")", ".", "save_config", "(", "cmd", "=", "cmd", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
SCPConn.establish_scp_conn
Establish the secure copy connection.
netmiko/scp_handler.py
def establish_scp_conn(self): """Establish the secure copy connection.""" ssh_connect_params = self.ssh_ctl_chan._connect_params_dict() self.scp_conn = self.ssh_ctl_chan._build_ssh_client() self.scp_conn.connect(**ssh_connect_params) self.scp_client = scp.SCPClient(self.scp_conn....
def establish_scp_conn(self): """Establish the secure copy connection.""" ssh_connect_params = self.ssh_ctl_chan._connect_params_dict() self.scp_conn = self.ssh_ctl_chan._build_ssh_client() self.scp_conn.connect(**ssh_connect_params) self.scp_client = scp.SCPClient(self.scp_conn....
[ "Establish", "the", "secure", "copy", "connection", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/scp_handler.py#L31-L36
[ "def", "establish_scp_conn", "(", "self", ")", ":", "ssh_connect_params", "=", "self", ".", "ssh_ctl_chan", ".", "_connect_params_dict", "(", ")", "self", ".", "scp_conn", "=", "self", ".", "ssh_ctl_chan", ".", "_build_ssh_client", "(", ")", "self", ".", "scp_...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
BaseFileTransfer.remote_space_available
Return space available on remote device.
netmiko/scp_handler.py
def remote_space_available(self, search_pattern=r"(\d+) \w+ free"): """Return space available on remote device.""" remote_cmd = "dir {}".format(self.file_system) remote_output = self.ssh_ctl_chan.send_command_expect(remote_cmd) match = re.search(search_pattern, remote_output) if ...
def remote_space_available(self, search_pattern=r"(\d+) \w+ free"): """Return space available on remote device.""" remote_cmd = "dir {}".format(self.file_system) remote_output = self.ssh_ctl_chan.send_command_expect(remote_cmd) match = re.search(search_pattern, remote_output) if ...
[ "Return", "space", "available", "on", "remote", "device", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/scp_handler.py#L106-L113
[ "def", "remote_space_available", "(", "self", ",", "search_pattern", "=", "r\"(\\d+) \\w+ free\"", ")", ":", "remote_cmd", "=", "\"dir {}\"", ".", "format", "(", "self", ".", "file_system", ")", "remote_output", "=", "self", ".", "ssh_ctl_chan", ".", "send_command...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
BaseFileTransfer._remote_space_available_unix
Return space available on *nix system (BSD/Linux).
netmiko/scp_handler.py
def _remote_space_available_unix(self, search_pattern=""): """Return space available on *nix system (BSD/Linux).""" self.ssh_ctl_chan._enter_shell() remote_cmd = "/bin/df -k {}".format(self.file_system) remote_output = self.ssh_ctl_chan.send_command( remote_cmd, expect_string...
def _remote_space_available_unix(self, search_pattern=""): """Return space available on *nix system (BSD/Linux).""" self.ssh_ctl_chan._enter_shell() remote_cmd = "/bin/df -k {}".format(self.file_system) remote_output = self.ssh_ctl_chan.send_command( remote_cmd, expect_string...
[ "Return", "space", "available", "on", "*", "nix", "system", "(", "BSD", "/", "Linux", ")", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/scp_handler.py#L115-L148
[ "def", "_remote_space_available_unix", "(", "self", ",", "search_pattern", "=", "\"\"", ")", ":", "self", ".", "ssh_ctl_chan", ".", "_enter_shell", "(", ")", "remote_cmd", "=", "\"/bin/df -k {}\"", ".", "format", "(", "self", ".", "file_system", ")", "remote_out...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
BaseFileTransfer.verify_space_available
Verify sufficient space is available on destination file system (return boolean).
netmiko/scp_handler.py
def verify_space_available(self, search_pattern=r"(\d+) \w+ free"): """Verify sufficient space is available on destination file system (return boolean).""" if self.direction == "put": space_avail = self.remote_space_available(search_pattern=search_pattern) elif self.direction == "get...
def verify_space_available(self, search_pattern=r"(\d+) \w+ free"): """Verify sufficient space is available on destination file system (return boolean).""" if self.direction == "put": space_avail = self.remote_space_available(search_pattern=search_pattern) elif self.direction == "get...
[ "Verify", "sufficient", "space", "is", "available", "on", "destination", "file", "system", "(", "return", "boolean", ")", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/scp_handler.py#L155-L163
[ "def", "verify_space_available", "(", "self", ",", "search_pattern", "=", "r\"(\\d+) \\w+ free\"", ")", ":", "if", "self", ".", "direction", "==", "\"put\"", ":", "space_avail", "=", "self", ".", "remote_space_available", "(", "search_pattern", "=", "search_pattern"...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
BaseFileTransfer._check_file_exists_unix
Check if the dest_file already exists on the file system (return boolean).
netmiko/scp_handler.py
def _check_file_exists_unix(self, remote_cmd=""): """Check if the dest_file already exists on the file system (return boolean).""" if self.direction == "put": self.ssh_ctl_chan._enter_shell() remote_cmd = "ls {}".format(self.file_system) remote_out = self.ssh_ctl_chan...
def _check_file_exists_unix(self, remote_cmd=""): """Check if the dest_file already exists on the file system (return boolean).""" if self.direction == "put": self.ssh_ctl_chan._enter_shell() remote_cmd = "ls {}".format(self.file_system) remote_out = self.ssh_ctl_chan...
[ "Check", "if", "the", "dest_file", "already", "exists", "on", "the", "file", "system", "(", "return", "boolean", ")", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/scp_handler.py#L185-L196
[ "def", "_check_file_exists_unix", "(", "self", ",", "remote_cmd", "=", "\"\"", ")", ":", "if", "self", ".", "direction", "==", "\"put\"", ":", "self", ".", "ssh_ctl_chan", ".", "_enter_shell", "(", ")", "remote_cmd", "=", "\"ls {}\"", ".", "format", "(", "...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
BaseFileTransfer.remote_file_size
Get the file size of the remote file.
netmiko/scp_handler.py
def remote_file_size(self, remote_cmd="", remote_file=None): """Get the file size of the remote file.""" if remote_file is None: if self.direction == "put": remote_file = self.dest_file elif self.direction == "get": remote_file = self.source_file ...
def remote_file_size(self, remote_cmd="", remote_file=None): """Get the file size of the remote file.""" if remote_file is None: if self.direction == "put": remote_file = self.dest_file elif self.direction == "get": remote_file = self.source_file ...
[ "Get", "the", "file", "size", "of", "the", "remote", "file", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/scp_handler.py#L198-L222
[ "def", "remote_file_size", "(", "self", ",", "remote_cmd", "=", "\"\"", ",", "remote_file", "=", "None", ")", ":", "if", "remote_file", "is", "None", ":", "if", "self", ".", "direction", "==", "\"put\"", ":", "remote_file", "=", "self", ".", "dest_file", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
BaseFileTransfer._remote_file_size_unix
Get the file size of the remote file.
netmiko/scp_handler.py
def _remote_file_size_unix(self, remote_cmd="", remote_file=None): """Get the file size of the remote file.""" if remote_file is None: if self.direction == "put": remote_file = self.dest_file elif self.direction == "get": remote_file = self.source_...
def _remote_file_size_unix(self, remote_cmd="", remote_file=None): """Get the file size of the remote file.""" if remote_file is None: if self.direction == "put": remote_file = self.dest_file elif self.direction == "get": remote_file = self.source_...
[ "Get", "the", "file", "size", "of", "the", "remote", "file", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/scp_handler.py#L224-L253
[ "def", "_remote_file_size_unix", "(", "self", ",", "remote_cmd", "=", "\"\"", ",", "remote_file", "=", "None", ")", ":", "if", "remote_file", "is", "None", ":", "if", "self", ".", "direction", "==", "\"put\"", ":", "remote_file", "=", "self", ".", "dest_fi...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
BaseFileTransfer.file_md5
Compute MD5 hash of file.
netmiko/scp_handler.py
def file_md5(self, file_name): """Compute MD5 hash of file.""" with open(file_name, "rb") as f: file_contents = f.read() file_hash = hashlib.md5(file_contents).hexdigest() return file_hash
def file_md5(self, file_name): """Compute MD5 hash of file.""" with open(file_name, "rb") as f: file_contents = f.read() file_hash = hashlib.md5(file_contents).hexdigest() return file_hash
[ "Compute", "MD5", "hash", "of", "file", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/scp_handler.py#L255-L260
[ "def", "file_md5", "(", "self", ",", "file_name", ")", ":", "with", "open", "(", "file_name", ",", "\"rb\"", ")", "as", "f", ":", "file_contents", "=", "f", ".", "read", "(", ")", "file_hash", "=", "hashlib", ".", "md5", "(", "file_contents", ")", "....
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
BaseFileTransfer.process_md5
Process the string to retrieve the MD5 hash Output from Cisco IOS (ASA is similar) .MD5 of flash:file_name Done! verify /md5 (flash:file_name) = 410db2a7015eaa42b1fe71f1bf3d59a2
netmiko/scp_handler.py
def process_md5(md5_output, pattern=r"=\s+(\S+)"): """ Process the string to retrieve the MD5 hash Output from Cisco IOS (ASA is similar) .MD5 of flash:file_name Done! verify /md5 (flash:file_name) = 410db2a7015eaa42b1fe71f1bf3d59a2 """ match = re.search(pattern,...
def process_md5(md5_output, pattern=r"=\s+(\S+)"): """ Process the string to retrieve the MD5 hash Output from Cisco IOS (ASA is similar) .MD5 of flash:file_name Done! verify /md5 (flash:file_name) = 410db2a7015eaa42b1fe71f1bf3d59a2 """ match = re.search(pattern,...
[ "Process", "the", "string", "to", "retrieve", "the", "MD5", "hash" ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/scp_handler.py#L263-L275
[ "def", "process_md5", "(", "md5_output", ",", "pattern", "=", "r\"=\\s+(\\S+)\"", ")", ":", "match", "=", "re", ".", "search", "(", "pattern", ",", "md5_output", ")", "if", "match", ":", "return", "match", ".", "group", "(", "1", ")", "else", ":", "rai...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
BaseFileTransfer.compare_md5
Compare md5 of file on network device to md5 of local file.
netmiko/scp_handler.py
def compare_md5(self): """Compare md5 of file on network device to md5 of local file.""" if self.direction == "put": remote_md5 = self.remote_md5() return self.source_md5 == remote_md5 elif self.direction == "get": local_md5 = self.file_md5(self.dest_file) ...
def compare_md5(self): """Compare md5 of file on network device to md5 of local file.""" if self.direction == "put": remote_md5 = self.remote_md5() return self.source_md5 == remote_md5 elif self.direction == "get": local_md5 = self.file_md5(self.dest_file) ...
[ "Compare", "md5", "of", "file", "on", "network", "device", "to", "md5", "of", "local", "file", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/scp_handler.py#L277-L284
[ "def", "compare_md5", "(", "self", ")", ":", "if", "self", ".", "direction", "==", "\"put\"", ":", "remote_md5", "=", "self", ".", "remote_md5", "(", ")", "return", "self", ".", "source_md5", "==", "remote_md5", "elif", "self", ".", "direction", "==", "\...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
BaseFileTransfer.transfer_file
SCP transfer file.
netmiko/scp_handler.py
def transfer_file(self): """SCP transfer file.""" if self.direction == "put": self.put_file() elif self.direction == "get": self.get_file()
def transfer_file(self): """SCP transfer file.""" if self.direction == "put": self.put_file() elif self.direction == "get": self.get_file()
[ "SCP", "transfer", "file", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/scp_handler.py#L301-L306
[ "def", "transfer_file", "(", "self", ")", ":", "if", "self", ".", "direction", "==", "\"put\"", ":", "self", ".", "put_file", "(", ")", "elif", "self", ".", "direction", "==", "\"get\"", ":", "self", ".", "get_file", "(", ")" ]
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
BaseFileTransfer.put_file
SCP copy the file from the local system to the remote device.
netmiko/scp_handler.py
def put_file(self): """SCP copy the file from the local system to the remote device.""" destination = "{}/{}".format(self.file_system, self.dest_file) self.scp_conn.scp_transfer_file(self.source_file, destination) # Must close the SCP connection to get the file written (flush) se...
def put_file(self): """SCP copy the file from the local system to the remote device.""" destination = "{}/{}".format(self.file_system, self.dest_file) self.scp_conn.scp_transfer_file(self.source_file, destination) # Must close the SCP connection to get the file written (flush) se...
[ "SCP", "copy", "the", "file", "from", "the", "local", "system", "to", "the", "remote", "device", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/scp_handler.py#L314-L319
[ "def", "put_file", "(", "self", ")", ":", "destination", "=", "\"{}/{}\"", ".", "format", "(", "self", ".", "file_system", ",", "self", ".", "dest_file", ")", "self", ".", "scp_conn", ".", "scp_transfer_file", "(", "self", ".", "source_file", ",", "destina...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
BaseFileTransfer.enable_scp
Enable SCP on remote device. Defaults to Cisco IOS command
netmiko/scp_handler.py
def enable_scp(self, cmd=None): """ Enable SCP on remote device. Defaults to Cisco IOS command """ if cmd is None: cmd = ["ip scp server enable"] elif not hasattr(cmd, "__iter__"): cmd = [cmd] self.ssh_ctl_chan.send_config_set(cmd)
def enable_scp(self, cmd=None): """ Enable SCP on remote device. Defaults to Cisco IOS command """ if cmd is None: cmd = ["ip scp server enable"] elif not hasattr(cmd, "__iter__"): cmd = [cmd] self.ssh_ctl_chan.send_config_set(cmd)
[ "Enable", "SCP", "on", "remote", "device", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/scp_handler.py#L325-L335
[ "def", "enable_scp", "(", "self", ",", "cmd", "=", "None", ")", ":", "if", "cmd", "is", "None", ":", "cmd", "=", "[", "\"ip scp server enable\"", "]", "elif", "not", "hasattr", "(", "cmd", ",", "\"__iter__\"", ")", ":", "cmd", "=", "[", "cmd", "]", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
BaseFileTransfer.disable_scp
Disable SCP on remote device. Defaults to Cisco IOS command
netmiko/scp_handler.py
def disable_scp(self, cmd=None): """ Disable SCP on remote device. Defaults to Cisco IOS command """ if cmd is None: cmd = ["no ip scp server enable"] elif not hasattr(cmd, "__iter__"): cmd = [cmd] self.ssh_ctl_chan.send_config_set(cmd)
def disable_scp(self, cmd=None): """ Disable SCP on remote device. Defaults to Cisco IOS command """ if cmd is None: cmd = ["no ip scp server enable"] elif not hasattr(cmd, "__iter__"): cmd = [cmd] self.ssh_ctl_chan.send_config_set(cmd)
[ "Disable", "SCP", "on", "remote", "device", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/scp_handler.py#L337-L347
[ "def", "disable_scp", "(", "self", ",", "cmd", "=", "None", ")", ":", "if", "cmd", "is", "None", ":", "cmd", "=", "[", "\"no ip scp server enable\"", "]", "elif", "not", "hasattr", "(", "cmd", ",", "\"__iter__\"", ")", ":", "cmd", "=", "[", "cmd", "]...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
PaloAltoPanosBase.exit_config_mode
Exit configuration mode.
netmiko/paloalto/paloalto_panos.py
def exit_config_mode(self, exit_config="exit", pattern=r">"): """Exit configuration mode.""" return super(PaloAltoPanosBase, self).exit_config_mode( exit_config=exit_config, pattern=pattern )
def exit_config_mode(self, exit_config="exit", pattern=r">"): """Exit configuration mode.""" return super(PaloAltoPanosBase, self).exit_config_mode( exit_config=exit_config, pattern=pattern )
[ "Exit", "configuration", "mode", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/paloalto/paloalto_panos.py#L51-L55
[ "def", "exit_config_mode", "(", "self", ",", "exit_config", "=", "\"exit\"", ",", "pattern", "=", "r\">\"", ")", ":", "return", "super", "(", "PaloAltoPanosBase", ",", "self", ")", ".", "exit_config_mode", "(", "exit_config", "=", "exit_config", ",", "pattern"...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
PaloAltoPanosBase.commit
Commit the candidate configuration. Commit the entered configuration. Raise an error and return the failure if the commit fails. Automatically enters configuration mode default: command_string = commit (device_and_network or policy_and_objects or vsys or ...
netmiko/paloalto/paloalto_panos.py
def commit( self, force=False, partial=False, device_and_network=False, policy_and_objects=False, vsys="", no_vsys=False, delay_factor=0.1, ): """ Commit the candidate configuration. Commit the entered configuration. Raise an e...
def commit( self, force=False, partial=False, device_and_network=False, policy_and_objects=False, vsys="", no_vsys=False, delay_factor=0.1, ): """ Commit the candidate configuration. Commit the entered configuration. Raise an e...
[ "Commit", "the", "candidate", "configuration", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/paloalto/paloalto_panos.py#L57-L123
[ "def", "commit", "(", "self", ",", "force", "=", "False", ",", "partial", "=", "False", ",", "device_and_network", "=", "False", ",", "policy_and_objects", "=", "False", ",", "vsys", "=", "\"\"", ",", "no_vsys", "=", "False", ",", "delay_factor", "=", "0...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
PaloAltoPanosBase.strip_command
Strip command_string from output string.
netmiko/paloalto/paloalto_panos.py
def strip_command(self, command_string, output): """Strip command_string from output string.""" output_list = output.split(command_string) return self.RESPONSE_RETURN.join(output_list)
def strip_command(self, command_string, output): """Strip command_string from output string.""" output_list = output.split(command_string) return self.RESPONSE_RETURN.join(output_list)
[ "Strip", "command_string", "from", "output", "string", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/paloalto/paloalto_panos.py#L125-L128
[ "def", "strip_command", "(", "self", ",", "command_string", ",", "output", ")", ":", "output_list", "=", "output", ".", "split", "(", "command_string", ")", "return", "self", ".", "RESPONSE_RETURN", ".", "join", "(", "output_list", ")" ]
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
PaloAltoPanosBase.strip_prompt
Strip the trailing router prompt from the output.
netmiko/paloalto/paloalto_panos.py
def strip_prompt(self, a_string): """Strip the trailing router prompt from the output.""" response_list = a_string.split(self.RESPONSE_RETURN) new_response_list = [] for line in response_list: if self.base_prompt not in line: new_response_list.append(line) ...
def strip_prompt(self, a_string): """Strip the trailing router prompt from the output.""" response_list = a_string.split(self.RESPONSE_RETURN) new_response_list = [] for line in response_list: if self.base_prompt not in line: new_response_list.append(line) ...
[ "Strip", "the", "trailing", "router", "prompt", "from", "the", "output", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/paloalto/paloalto_panos.py#L130-L139
[ "def", "strip_prompt", "(", "self", ",", "a_string", ")", ":", "response_list", "=", "a_string", ".", "split", "(", "self", ".", "RESPONSE_RETURN", ")", "new_response_list", "=", "[", "]", "for", "line", "in", "response_list", ":", "if", "self", ".", "base...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
PaloAltoPanosBase.strip_context_items
Strip PaloAlto-specific output. PaloAlto will also put a configuration context: [edit] This method removes those lines.
netmiko/paloalto/paloalto_panos.py
def strip_context_items(self, a_string): """Strip PaloAlto-specific output. PaloAlto will also put a configuration context: [edit] This method removes those lines. """ strings_to_strip = [r"\[edit.*\]"] response_list = a_string.split(self.RESPONSE_RETURN) ...
def strip_context_items(self, a_string): """Strip PaloAlto-specific output. PaloAlto will also put a configuration context: [edit] This method removes those lines. """ strings_to_strip = [r"\[edit.*\]"] response_list = a_string.split(self.RESPONSE_RETURN) ...
[ "Strip", "PaloAlto", "-", "specific", "output", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/paloalto/paloalto_panos.py#L141-L158
[ "def", "strip_context_items", "(", "self", ",", "a_string", ")", ":", "strings_to_strip", "=", "[", "r\"\\[edit.*\\]\"", "]", "response_list", "=", "a_string", ".", "split", "(", "self", ".", "RESPONSE_RETURN", ")", "last_line", "=", "response_list", "[", "-", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
PaloAltoPanosBase.send_command
Palo Alto requires an extra delay
netmiko/paloalto/paloalto_panos.py
def send_command(self, *args, **kwargs): """Palo Alto requires an extra delay""" kwargs["delay_factor"] = kwargs.get("delay_factor", 2.5) return super(PaloAltoPanosBase, self).send_command(*args, **kwargs)
def send_command(self, *args, **kwargs): """Palo Alto requires an extra delay""" kwargs["delay_factor"] = kwargs.get("delay_factor", 2.5) return super(PaloAltoPanosBase, self).send_command(*args, **kwargs)
[ "Palo", "Alto", "requires", "an", "extra", "delay" ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/paloalto/paloalto_panos.py#L164-L167
[ "def", "send_command", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "\"delay_factor\"", "]", "=", "kwargs", ".", "get", "(", "\"delay_factor\"", ",", "2.5", ")", "return", "super", "(", "PaloAltoPanosBase", ",", "self"...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
PaloAltoPanosBase.cleanup
Gracefully exit the SSH session.
netmiko/paloalto/paloalto_panos.py
def cleanup(self): """Gracefully exit the SSH session.""" try: self.exit_config_mode() except Exception: # Always try to send 'exit' regardless of whether exit_config_mode works or not. pass self._session_log_fin = True self.write_channel("exit...
def cleanup(self): """Gracefully exit the SSH session.""" try: self.exit_config_mode() except Exception: # Always try to send 'exit' regardless of whether exit_config_mode works or not. pass self._session_log_fin = True self.write_channel("exit...
[ "Gracefully", "exit", "the", "SSH", "session", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/paloalto/paloalto_panos.py#L169-L177
[ "def", "cleanup", "(", "self", ")", ":", "try", ":", "self", ".", "exit_config_mode", "(", ")", "except", "Exception", ":", "# Always try to send 'exit' regardless of whether exit_config_mode works or not.", "pass", "self", ".", "_session_log_fin", "=", "True", "self", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
CoriantSSH.set_base_prompt
Sets self.base_prompt: used as delimiter for stripping of trailing prompt in output.
netmiko/coriant/coriant_ssh.py
def set_base_prompt( self, pri_prompt_terminator=":", alt_prompt_terminator=">", delay_factor=2 ): """Sets self.base_prompt: used as delimiter for stripping of trailing prompt in output.""" super(CoriantSSH, self).set_base_prompt( pri_prompt_terminator=pri_prompt_terminator, ...
def set_base_prompt( self, pri_prompt_terminator=":", alt_prompt_terminator=">", delay_factor=2 ): """Sets self.base_prompt: used as delimiter for stripping of trailing prompt in output.""" super(CoriantSSH, self).set_base_prompt( pri_prompt_terminator=pri_prompt_terminator, ...
[ "Sets", "self", ".", "base_prompt", ":", "used", "as", "delimiter", "for", "stripping", "of", "trailing", "prompt", "in", "output", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/coriant/coriant_ssh.py#L31-L40
[ "def", "set_base_prompt", "(", "self", ",", "pri_prompt_terminator", "=", "\":\"", ",", "alt_prompt_terminator", "=", "\">\"", ",", "delay_factor", "=", "2", ")", ":", "super", "(", "CoriantSSH", ",", "self", ")", ".", "set_base_prompt", "(", "pri_prompt_termina...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
CiscoIosBase.check_config_mode
Checks if the device is in configuration mode or not. Cisco IOS devices abbreviate the prompt at 20 chars in config mode
netmiko/cisco/cisco_ios.py
def check_config_mode(self, check_string=")#", pattern="#"): """ Checks if the device is in configuration mode or not. Cisco IOS devices abbreviate the prompt at 20 chars in config mode """ return super(CiscoIosBase, self).check_config_mode( check_string=check_string...
def check_config_mode(self, check_string=")#", pattern="#"): """ Checks if the device is in configuration mode or not. Cisco IOS devices abbreviate the prompt at 20 chars in config mode """ return super(CiscoIosBase, self).check_config_mode( check_string=check_string...
[ "Checks", "if", "the", "device", "is", "in", "configuration", "mode", "or", "not", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_ios.py#L25-L33
[ "def", "check_config_mode", "(", "self", ",", "check_string", "=", "\")#\"", ",", "pattern", "=", "\"#\"", ")", ":", "return", "super", "(", "CiscoIosBase", ",", "self", ")", ".", "check_config_mode", "(", "check_string", "=", "check_string", ",", "pattern", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
CiscoIosBase.save_config
Saves Config Using Copy Run Start
netmiko/cisco/cisco_ios.py
def save_config(self, cmd="write mem", confirm=False, confirm_response=""): """Saves Config Using Copy Run Start""" return super(CiscoIosBase, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
def save_config(self, cmd="write mem", confirm=False, confirm_response=""): """Saves Config Using Copy Run Start""" return super(CiscoIosBase, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
[ "Saves", "Config", "Using", "Copy", "Run", "Start" ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_ios.py#L35-L39
[ "def", "save_config", "(", "self", ",", "cmd", "=", "\"write mem\"", ",", "confirm", "=", "False", ",", "confirm_response", "=", "\"\"", ")", ":", "return", "super", "(", "CiscoIosBase", ",", "self", ")", ".", "save_config", "(", "cmd", "=", "cmd", ",", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
InLineTransfer._tcl_newline_rationalize
When using put inside a TCL {} section the newline is considered a new TCL statement and causes a missing curly-brace message. Convert "\n" to "\r". TCL will convert the "\r" to a "\n" i.e. you will see a "\n" inside the file on the Cisco IOS device.
netmiko/cisco/cisco_ios.py
def _tcl_newline_rationalize(tcl_string): """ When using put inside a TCL {} section the newline is considered a new TCL statement and causes a missing curly-brace message. Convert "\n" to "\r". TCL will convert the "\r" to a "\n" i.e. you will see a "\n" inside the file on the C...
def _tcl_newline_rationalize(tcl_string): """ When using put inside a TCL {} section the newline is considered a new TCL statement and causes a missing curly-brace message. Convert "\n" to "\r". TCL will convert the "\r" to a "\n" i.e. you will see a "\n" inside the file on the C...
[ "When", "using", "put", "inside", "a", "TCL", "{}", "section", "the", "newline", "is", "considered", "a", "new", "TCL", "statement", "and", "causes", "a", "missing", "curly", "-", "brace", "message", ".", "Convert", "\\", "n", "to", "\\", "r", ".", "TC...
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_ios.py#L109-L122
[ "def", "_tcl_newline_rationalize", "(", "tcl_string", ")", ":", "NEWLINE", "=", "r\"\\n\"", "CARRIAGE_RETURN", "=", "r\"\\r\"", "tmp_string", "=", "re", ".", "sub", "(", "NEWLINE", ",", "CARRIAGE_RETURN", ",", "tcl_string", ")", "if", "re", ".", "search", "(",...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
InLineTransfer.file_md5
Compute MD5 hash of file.
netmiko/cisco/cisco_ios.py
def file_md5(self, file_name): """Compute MD5 hash of file.""" file_contents = self._read_file(file_name) file_contents = file_contents + "\n" # Cisco IOS automatically adds this file_contents = file_contents.encode("UTF-8") return hashlib.md5(file_contents).hexdigest()
def file_md5(self, file_name): """Compute MD5 hash of file.""" file_contents = self._read_file(file_name) file_contents = file_contents + "\n" # Cisco IOS automatically adds this file_contents = file_contents.encode("UTF-8") return hashlib.md5(file_contents).hexdigest()
[ "Compute", "MD5", "hash", "of", "file", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_ios.py#L167-L172
[ "def", "file_md5", "(", "self", ",", "file_name", ")", ":", "file_contents", "=", "self", ".", "_read_file", "(", "file_name", ")", "file_contents", "=", "file_contents", "+", "\"\\n\"", "# Cisco IOS automatically adds this", "file_contents", "=", "file_contents", "...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
InLineTransfer.config_md5
Compute MD5 hash of file.
netmiko/cisco/cisco_ios.py
def config_md5(self, source_config): """Compute MD5 hash of file.""" file_contents = source_config + "\n" # Cisco IOS automatically adds this file_contents = file_contents.encode("UTF-8") return hashlib.md5(file_contents).hexdigest()
def config_md5(self, source_config): """Compute MD5 hash of file.""" file_contents = source_config + "\n" # Cisco IOS automatically adds this file_contents = file_contents.encode("UTF-8") return hashlib.md5(file_contents).hexdigest()
[ "Compute", "MD5", "hash", "of", "file", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_ios.py#L174-L178
[ "def", "config_md5", "(", "self", ",", "source_config", ")", ":", "file_contents", "=", "source_config", "+", "\"\\n\"", "# Cisco IOS automatically adds this", "file_contents", "=", "file_contents", ".", "encode", "(", "\"UTF-8\"", ")", "return", "hashlib", ".", "md...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
HPComwareBase.session_preparation
Prepare the session after the connection has been established. Extra time to read HP banners.
netmiko/hp/hp_comware.py
def session_preparation(self): """ Prepare the session after the connection has been established. Extra time to read HP banners. """ delay_factor = self.select_delay_factor(delay_factor=0) i = 1 while i <= 4: # Comware can have a banner that prompts yo...
def session_preparation(self): """ Prepare the session after the connection has been established. Extra time to read HP banners. """ delay_factor = self.select_delay_factor(delay_factor=0) i = 1 while i <= 4: # Comware can have a banner that prompts yo...
[ "Prepare", "the", "session", "after", "the", "connection", "has", "been", "established", ".", "Extra", "time", "to", "read", "HP", "banners", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/hp/hp_comware.py#L8-L30
[ "def", "session_preparation", "(", "self", ")", ":", "delay_factor", "=", "self", ".", "select_delay_factor", "(", "delay_factor", "=", "0", ")", "i", "=", "1", "while", "i", "<=", "4", ":", "# Comware can have a banner that prompts you to continue", "# 'Press Y or ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
HPComwareBase.exit_config_mode
Exit config mode.
netmiko/hp/hp_comware.py
def exit_config_mode(self, exit_config="return", pattern=r">"): """Exit config mode.""" return super(HPComwareBase, self).exit_config_mode( exit_config=exit_config, pattern=pattern )
def exit_config_mode(self, exit_config="return", pattern=r">"): """Exit config mode.""" return super(HPComwareBase, self).exit_config_mode( exit_config=exit_config, pattern=pattern )
[ "Exit", "config", "mode", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/hp/hp_comware.py#L36-L40
[ "def", "exit_config_mode", "(", "self", ",", "exit_config", "=", "\"return\"", ",", "pattern", "=", "r\">\"", ")", ":", "return", "super", "(", "HPComwareBase", ",", "self", ")", ".", "exit_config_mode", "(", "exit_config", "=", "exit_config", ",", "pattern", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
HPComwareBase.set_base_prompt
Sets self.base_prompt Used as delimiter for stripping of trailing prompt in output. Should be set to something that is general and applies in multiple contexts. For Comware this will be the router prompt with < > or [ ] stripped off. This will be set on logging in, but not when enteri...
netmiko/hp/hp_comware.py
def set_base_prompt( self, pri_prompt_terminator=">", alt_prompt_terminator="]", delay_factor=1 ): """ Sets self.base_prompt Used as delimiter for stripping of trailing prompt in output. Should be set to something that is general and applies in multiple contexts. For Comwar...
def set_base_prompt( self, pri_prompt_terminator=">", alt_prompt_terminator="]", delay_factor=1 ): """ Sets self.base_prompt Used as delimiter for stripping of trailing prompt in output. Should be set to something that is general and applies in multiple contexts. For Comwar...
[ "Sets", "self", ".", "base_prompt" ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/hp/hp_comware.py#L46-L69
[ "def", "set_base_prompt", "(", "self", ",", "pri_prompt_terminator", "=", "\">\"", ",", "alt_prompt_terminator", "=", "\"]\"", ",", "delay_factor", "=", "1", ")", ":", "prompt", "=", "super", "(", "HPComwareBase", ",", "self", ")", ".", "set_base_prompt", "(",...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
HPComwareBase.save_config
Save Config.
netmiko/hp/hp_comware.py
def save_config(self, cmd="save force", confirm=False, confirm_response=""): """Save Config.""" return super(HPComwareBase, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
def save_config(self, cmd="save force", confirm=False, confirm_response=""): """Save Config.""" return super(HPComwareBase, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
[ "Save", "Config", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/hp/hp_comware.py#L83-L87
[ "def", "save_config", "(", "self", ",", "cmd", "=", "\"save force\"", ",", "confirm", "=", "False", ",", "confirm_response", "=", "\"\"", ")", ":", "return", "super", "(", "HPComwareBase", ",", "self", ")", ".", "save_config", "(", "cmd", "=", "cmd", ","...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
SNMPDetect._get_snmpv3
Try to send an SNMP GET operation using SNMPv3 for the specified OID. Parameters ---------- oid : str The SNMP OID that you want to get. Returns ------- string : str The string as part of the value from the OID you are trying to retrieve.
netmiko/snmp_autodetect.py
def _get_snmpv3(self, oid): """ Try to send an SNMP GET operation using SNMPv3 for the specified OID. Parameters ---------- oid : str The SNMP OID that you want to get. Returns ------- string : str The string as part of the value ...
def _get_snmpv3(self, oid): """ Try to send an SNMP GET operation using SNMPv3 for the specified OID. Parameters ---------- oid : str The SNMP OID that you want to get. Returns ------- string : str The string as part of the value ...
[ "Try", "to", "send", "an", "SNMP", "GET", "operation", "using", "SNMPv3", "for", "the", "specified", "OID", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/snmp_autodetect.py#L233-L266
[ "def", "_get_snmpv3", "(", "self", ",", "oid", ")", ":", "snmp_target", "=", "(", "self", ".", "hostname", ",", "self", ".", "snmp_port", ")", "cmd_gen", "=", "cmdgen", ".", "CommandGenerator", "(", ")", "(", "error_detected", ",", "error_status", ",", "...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
SNMPDetect._get_snmpv2c
Try to send an SNMP GET operation using SNMPv2 for the specified OID. Parameters ---------- oid : str The SNMP OID that you want to get. Returns ------- string : str The string as part of the value from the OID you are trying to retrieve.
netmiko/snmp_autodetect.py
def _get_snmpv2c(self, oid): """ Try to send an SNMP GET operation using SNMPv2 for the specified OID. Parameters ---------- oid : str The SNMP OID that you want to get. Returns ------- string : str The string as part of the value...
def _get_snmpv2c(self, oid): """ Try to send an SNMP GET operation using SNMPv2 for the specified OID. Parameters ---------- oid : str The SNMP OID that you want to get. Returns ------- string : str The string as part of the value...
[ "Try", "to", "send", "an", "SNMP", "GET", "operation", "using", "SNMPv2", "for", "the", "specified", "OID", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/snmp_autodetect.py#L268-L295
[ "def", "_get_snmpv2c", "(", "self", ",", "oid", ")", ":", "snmp_target", "=", "(", "self", ".", "hostname", ",", "self", ".", "snmp_port", ")", "cmd_gen", "=", "cmdgen", ".", "CommandGenerator", "(", ")", "(", "error_detected", ",", "error_status", ",", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
SNMPDetect._get_snmp
Wrapper for generic SNMP call.
netmiko/snmp_autodetect.py
def _get_snmp(self, oid): """Wrapper for generic SNMP call.""" if self.snmp_version in ["v1", "v2c"]: return self._get_snmpv2c(oid) else: return self._get_snmpv3(oid)
def _get_snmp(self, oid): """Wrapper for generic SNMP call.""" if self.snmp_version in ["v1", "v2c"]: return self._get_snmpv2c(oid) else: return self._get_snmpv3(oid)
[ "Wrapper", "for", "generic", "SNMP", "call", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/snmp_autodetect.py#L297-L302
[ "def", "_get_snmp", "(", "self", ",", "oid", ")", ":", "if", "self", ".", "snmp_version", "in", "[", "\"v1\"", ",", "\"v2c\"", "]", ":", "return", "self", ".", "_get_snmpv2c", "(", "oid", ")", "else", ":", "return", "self", ".", "_get_snmpv3", "(", "...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
SNMPDetect.autodetect
Try to guess the device_type using SNMP GET based on the SNMP_MAPPER dict. The type which is returned is directly matching the name in *netmiko.ssh_dispatcher.CLASS_MAPPER_BASE* dict. Thus you can use this name to retrieve automatically the right ConnectionClass Returns -------...
netmiko/snmp_autodetect.py
def autodetect(self): """ Try to guess the device_type using SNMP GET based on the SNMP_MAPPER dict. The type which is returned is directly matching the name in *netmiko.ssh_dispatcher.CLASS_MAPPER_BASE* dict. Thus you can use this name to retrieve automatically the right Connec...
def autodetect(self): """ Try to guess the device_type using SNMP GET based on the SNMP_MAPPER dict. The type which is returned is directly matching the name in *netmiko.ssh_dispatcher.CLASS_MAPPER_BASE* dict. Thus you can use this name to retrieve automatically the right Connec...
[ "Try", "to", "guess", "the", "device_type", "using", "SNMP", "GET", "based", "on", "the", "SNMP_MAPPER", "dict", ".", "The", "type", "which", "is", "returned", "is", "directly", "matching", "the", "name", "in", "*", "netmiko", ".", "ssh_dispatcher", ".", "...
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/snmp_autodetect.py#L304-L342
[ "def", "autodetect", "(", "self", ")", ":", "# Convert SNMP_MAPPER to a list and sort by priority", "snmp_mapper_list", "=", "[", "]", "for", "k", ",", "v", "in", "SNMP_MAPPER", ".", "items", "(", ")", ":", "snmp_mapper_list", ".", "append", "(", "{", "k", ":"...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
FlexvnfSSH.enter_cli_mode
Check if at shell prompt root@ and go into CLI.
netmiko/flexvnf/flexvnf_ssh.py
def enter_cli_mode(self): """Check if at shell prompt root@ and go into CLI.""" delay_factor = self.select_delay_factor(delay_factor=0) count = 0 cur_prompt = "" while count < 50: self.write_channel(self.RETURN) time.sleep(0.1 * delay_factor) c...
def enter_cli_mode(self): """Check if at shell prompt root@ and go into CLI.""" delay_factor = self.select_delay_factor(delay_factor=0) count = 0 cur_prompt = "" while count < 50: self.write_channel(self.RETURN) time.sleep(0.1 * delay_factor) c...
[ "Check", "if", "at", "shell", "prompt", "root" ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/flexvnf/flexvnf_ssh.py#L26-L44
[ "def", "enter_cli_mode", "(", "self", ")", ":", "delay_factor", "=", "self", ".", "select_delay_factor", "(", "delay_factor", "=", "0", ")", "count", "=", "0", "cur_prompt", "=", "\"\"", "while", "count", "<", "50", ":", "self", ".", "write_channel", "(", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
FlexvnfSSH.exit_config_mode
Exit configuration mode.
netmiko/flexvnf/flexvnf_ssh.py
def exit_config_mode(self, exit_config="exit configuration-mode"): """Exit configuration mode.""" output = "" if self.check_config_mode(): output = self.send_command_timing( exit_config, strip_prompt=False, strip_command=False ) # if 'Exit with...
def exit_config_mode(self, exit_config="exit configuration-mode"): """Exit configuration mode.""" output = "" if self.check_config_mode(): output = self.send_command_timing( exit_config, strip_prompt=False, strip_command=False ) # if 'Exit with...
[ "Exit", "configuration", "mode", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/flexvnf/flexvnf_ssh.py#L66-L80
[ "def", "exit_config_mode", "(", "self", ",", "exit_config", "=", "\"exit configuration-mode\"", ")", ":", "output", "=", "\"\"", "if", "self", ".", "check_config_mode", "(", ")", ":", "output", "=", "self", ".", "send_command_timing", "(", "exit_config", ",", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
FlexvnfSSH.commit
Commit the candidate configuration. Commit the entered configuration. Raise an error and return the failure if the commit fails. Automatically enters configuration mode default: command_string = commit check and (confirm or confirm_dely or comment): Exc...
netmiko/flexvnf/flexvnf_ssh.py
def commit( self, confirm=False, confirm_delay=None, check=False, comment="", and_quit=False, delay_factor=1, ): """ Commit the candidate configuration. Commit the entered configuration. Raise an error and return the failure if...
def commit( self, confirm=False, confirm_delay=None, check=False, comment="", and_quit=False, delay_factor=1, ): """ Commit the candidate configuration. Commit the entered configuration. Raise an error and return the failure if...
[ "Commit", "the", "candidate", "configuration", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/flexvnf/flexvnf_ssh.py#L82-L171
[ "def", "commit", "(", "self", ",", "confirm", "=", "False", ",", "confirm_delay", "=", "None", ",", "check", "=", "False", ",", "comment", "=", "\"\"", ",", "and_quit", "=", "False", ",", "delay_factor", "=", "1", ",", ")", ":", "delay_factor", "=", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
FlexvnfSSH.strip_prompt
Strip the trailing router prompt from the output.
netmiko/flexvnf/flexvnf_ssh.py
def strip_prompt(self, *args, **kwargs): """Strip the trailing router prompt from the output.""" a_string = super(FlexvnfSSH, self).strip_prompt(*args, **kwargs) return self.strip_context_items(a_string)
def strip_prompt(self, *args, **kwargs): """Strip the trailing router prompt from the output.""" a_string = super(FlexvnfSSH, self).strip_prompt(*args, **kwargs) return self.strip_context_items(a_string)
[ "Strip", "the", "trailing", "router", "prompt", "from", "the", "output", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/flexvnf/flexvnf_ssh.py#L173-L176
[ "def", "strip_prompt", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "a_string", "=", "super", "(", "FlexvnfSSH", ",", "self", ")", ".", "strip_prompt", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "self", ".", "str...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
RuckusFastironBase.enable
Enter enable mode. With RADIUS can prompt for User Name SSH@Lab-ICX7250>en User Name:service_netmiko Password: SSH@Lab-ICX7250#
netmiko/ruckus/ruckus_fastiron.py
def enable( self, cmd="enable", pattern=r"(ssword|User Name)", re_flags=re.IGNORECASE ): """Enter enable mode. With RADIUS can prompt for User Name SSH@Lab-ICX7250>en User Name:service_netmiko Password: SSH@Lab-ICX7250# """ output = "" ...
def enable( self, cmd="enable", pattern=r"(ssword|User Name)", re_flags=re.IGNORECASE ): """Enter enable mode. With RADIUS can prompt for User Name SSH@Lab-ICX7250>en User Name:service_netmiko Password: SSH@Lab-ICX7250# """ output = "" ...
[ "Enter", "enable", "mode", ".", "With", "RADIUS", "can", "prompt", "for", "User", "Name", "SSH" ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/ruckus/ruckus_fastiron.py#L21-L59
[ "def", "enable", "(", "self", ",", "cmd", "=", "\"enable\"", ",", "pattern", "=", "r\"(ssword|User Name)\"", ",", "re_flags", "=", "re", ".", "IGNORECASE", ")", ":", "output", "=", "\"\"", "if", "not", "self", ".", "check_enable_mode", "(", ")", ":", "co...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
RuckusFastironBase.save_config
Saves configuration.
netmiko/ruckus/ruckus_fastiron.py
def save_config(self, cmd="write mem", confirm=False, confirm_response=""): """Saves configuration.""" return super(RuckusFastironBase, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
def save_config(self, cmd="write mem", confirm=False, confirm_response=""): """Saves configuration.""" return super(RuckusFastironBase, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
[ "Saves", "configuration", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/ruckus/ruckus_fastiron.py#L61-L65
[ "def", "save_config", "(", "self", ",", "cmd", "=", "\"write mem\"", ",", "confirm", "=", "False", ",", "confirm_response", "=", "\"\"", ")", ":", "return", "super", "(", "RuckusFastironBase", ",", "self", ")", ".", "save_config", "(", "cmd", "=", "cmd", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
RuckusFastironTelnet._process_option
Ruckus FastIron/ICX does not always echo commands to output by default. If server expresses interest in 'ECHO' option, then reply back with 'DO ECHO'
netmiko/ruckus/ruckus_fastiron.py
def _process_option(self, tsocket, command, option): """ Ruckus FastIron/ICX does not always echo commands to output by default. If server expresses interest in 'ECHO' option, then reply back with 'DO ECHO' """ if option == ECHO: tsocket.sendall(IAC + DO + ECH...
def _process_option(self, tsocket, command, option): """ Ruckus FastIron/ICX does not always echo commands to output by default. If server expresses interest in 'ECHO' option, then reply back with 'DO ECHO' """ if option == ECHO: tsocket.sendall(IAC + DO + ECH...
[ "Ruckus", "FastIron", "/", "ICX", "does", "not", "always", "echo", "commands", "to", "output", "by", "default", ".", "If", "server", "expresses", "interest", "in", "ECHO", "option", "then", "reply", "back", "with", "DO", "ECHO" ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/ruckus/ruckus_fastiron.py#L74-L85
[ "def", "_process_option", "(", "self", ",", "tsocket", ",", "command", ",", "option", ")", ":", "if", "option", "==", "ECHO", ":", "tsocket", ".", "sendall", "(", "IAC", "+", "DO", "+", "ECHO", ")", "elif", "command", "in", "(", "DO", ",", "DONT", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
show_version_queue
Use Netmiko to execute show version. Use a queue to pass the data back to the main process.
examples/use_cases/case16_concurrency/processes_netmiko_queue.py
def show_version_queue(a_device, output_q): """ Use Netmiko to execute show version. Use a queue to pass the data back to the main process. """ output_dict = {} remote_conn = ConnectHandler(**a_device) hostname = remote_conn.base_prompt output = ("#" * 80) + "\n" output += remote_con...
def show_version_queue(a_device, output_q): """ Use Netmiko to execute show version. Use a queue to pass the data back to the main process. """ output_dict = {} remote_conn = ConnectHandler(**a_device) hostname = remote_conn.base_prompt output = ("#" * 80) + "\n" output += remote_con...
[ "Use", "Netmiko", "to", "execute", "show", "version", ".", "Use", "a", "queue", "to", "pass", "the", "data", "back", "to", "the", "main", "process", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/examples/use_cases/case16_concurrency/processes_netmiko_queue.py#L15-L27
[ "def", "show_version_queue", "(", "a_device", ",", "output_q", ")", ":", "output_dict", "=", "{", "}", "remote_conn", "=", "ConnectHandler", "(", "*", "*", "a_device", ")", "hostname", "=", "remote_conn", ".", "base_prompt", "output", "=", "(", "\"#\"", "*",...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
main
Use processes and Netmiko to connect to each of the devices. Execute 'show version' on each device. Use a queue to pass the output back to the parent process. Record the amount of time required to do this.
examples/use_cases/case16_concurrency/processes_netmiko_queue.py
def main(): """ Use processes and Netmiko to connect to each of the devices. Execute 'show version' on each device. Use a queue to pass the output back to the parent process. Record the amount of time required to do this. """ start_time = datetime.now() output_q = Queue(maxsize=20) proc...
def main(): """ Use processes and Netmiko to connect to each of the devices. Execute 'show version' on each device. Use a queue to pass the output back to the parent process. Record the amount of time required to do this. """ start_time = datetime.now() output_q = Queue(maxsize=20) proc...
[ "Use", "processes", "and", "Netmiko", "to", "connect", "to", "each", "of", "the", "devices", ".", "Execute", "show", "version", "on", "each", "device", ".", "Use", "a", "queue", "to", "pass", "the", "output", "back", "to", "the", "parent", "process", "."...
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/examples/use_cases/case16_concurrency/processes_netmiko_queue.py#L30-L55
[ "def", "main", "(", ")", ":", "start_time", "=", "datetime", ".", "now", "(", ")", "output_q", "=", "Queue", "(", "maxsize", "=", "20", ")", "procs", "=", "[", "]", "for", "a_device", "in", "devices", ":", "my_proc", "=", "Process", "(", "target", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
CiscoAsaSSH.session_preparation
Prepare the session after the connection has been established.
netmiko/cisco/cisco_asa_ssh.py
def session_preparation(self): """Prepare the session after the connection has been established.""" self._test_channel_read() self.set_base_prompt() if self.secret: self.enable() else: self.asa_login() self.disable_paging(command="terminal pager 0"...
def session_preparation(self): """Prepare the session after the connection has been established.""" self._test_channel_read() self.set_base_prompt() if self.secret: self.enable() else: self.asa_login() self.disable_paging(command="terminal pager 0"...
[ "Prepare", "the", "session", "after", "the", "connection", "has", "been", "established", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_asa_ssh.py#L12-L30
[ "def", "session_preparation", "(", "self", ")", ":", "self", ".", "_test_channel_read", "(", ")", "self", ".", "set_base_prompt", "(", ")", "if", "self", ".", "secret", ":", "self", ".", "enable", "(", ")", "else", ":", "self", ".", "asa_login", "(", "...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
CiscoAsaSSH.send_command_timing
If the ASA is in multi-context mode, then the base_prompt needs to be updated after each context change.
netmiko/cisco/cisco_asa_ssh.py
def send_command_timing(self, *args, **kwargs): """ If the ASA is in multi-context mode, then the base_prompt needs to be updated after each context change. """ output = super(CiscoAsaSSH, self).send_command_timing(*args, **kwargs) if len(args) >= 1: command_s...
def send_command_timing(self, *args, **kwargs): """ If the ASA is in multi-context mode, then the base_prompt needs to be updated after each context change. """ output = super(CiscoAsaSSH, self).send_command_timing(*args, **kwargs) if len(args) >= 1: command_s...
[ "If", "the", "ASA", "is", "in", "multi", "-", "context", "mode", "then", "the", "base_prompt", "needs", "to", "be", "updated", "after", "each", "context", "change", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_asa_ssh.py#L32-L44
[ "def", "send_command_timing", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "output", "=", "super", "(", "CiscoAsaSSH", ",", "self", ")", ".", "send_command_timing", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "len", "("...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
CiscoAsaSSH.send_command
If the ASA is in multi-context mode, then the base_prompt needs to be updated after each context change.
netmiko/cisco/cisco_asa_ssh.py
def send_command(self, *args, **kwargs): """ If the ASA is in multi-context mode, then the base_prompt needs to be updated after each context change. """ if len(args) >= 1: command_string = args[0] else: command_string = kwargs["command_string"] ...
def send_command(self, *args, **kwargs): """ If the ASA is in multi-context mode, then the base_prompt needs to be updated after each context change. """ if len(args) >= 1: command_string = args[0] else: command_string = kwargs["command_string"] ...
[ "If", "the", "ASA", "is", "in", "multi", "-", "context", "mode", "then", "the", "base_prompt", "needs", "to", "be", "updated", "after", "each", "context", "change", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_asa_ssh.py#L46-L66
[ "def", "send_command", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "args", ")", ">=", "1", ":", "command_string", "=", "args", "[", "0", "]", "else", ":", "command_string", "=", "kwargs", "[", "\"command_string...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
CiscoAsaSSH.set_base_prompt
Cisco ASA in multi-context mode needs to have the base prompt updated (if you switch contexts i.e. 'changeto') This switch of ASA contexts can occur in configuration mode. If this happens the trailing '(config*' needs stripped off.
netmiko/cisco/cisco_asa_ssh.py
def set_base_prompt(self, *args, **kwargs): """ Cisco ASA in multi-context mode needs to have the base prompt updated (if you switch contexts i.e. 'changeto') This switch of ASA contexts can occur in configuration mode. If this happens the trailing '(config*' needs stripped off....
def set_base_prompt(self, *args, **kwargs): """ Cisco ASA in multi-context mode needs to have the base prompt updated (if you switch contexts i.e. 'changeto') This switch of ASA contexts can occur in configuration mode. If this happens the trailing '(config*' needs stripped off....
[ "Cisco", "ASA", "in", "multi", "-", "context", "mode", "needs", "to", "have", "the", "base", "prompt", "updated", "(", "if", "you", "switch", "contexts", "i", ".", "e", ".", "changeto", ")" ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_asa_ssh.py#L72-L85
[ "def", "set_base_prompt", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "cur_base_prompt", "=", "super", "(", "CiscoAsaSSH", ",", "self", ")", ".", "set_base_prompt", "(", "*", "args", ",", "*", "*", "kwargs", ")", "match", "=", "...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
CiscoAsaSSH.asa_login
Handle ASA reaching privilege level 15 using login twb-dc-fw1> login Username: admin Password: ************
netmiko/cisco/cisco_asa_ssh.py
def asa_login(self): """ Handle ASA reaching privilege level 15 using login twb-dc-fw1> login Username: admin Password: ************ """ delay_factor = self.select_delay_factor(0) i = 1 max_attempts = 50 self.write_channel("login" + self....
def asa_login(self): """ Handle ASA reaching privilege level 15 using login twb-dc-fw1> login Username: admin Password: ************ """ delay_factor = self.select_delay_factor(0) i = 1 max_attempts = 50 self.write_channel("login" + self....
[ "Handle", "ASA", "reaching", "privilege", "level", "15", "using", "login" ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_asa_ssh.py#L87-L111
[ "def", "asa_login", "(", "self", ")", ":", "delay_factor", "=", "self", ".", "select_delay_factor", "(", "0", ")", "i", "=", "1", "max_attempts", "=", "50", "self", ".", "write_channel", "(", "\"login\"", "+", "self", ".", "RETURN", ")", "while", "i", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
CiscoAsaSSH.save_config
Saves Config
netmiko/cisco/cisco_asa_ssh.py
def save_config(self, cmd="write mem", confirm=False, confirm_response=""): """Saves Config""" return super(CiscoAsaSSH, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
def save_config(self, cmd="write mem", confirm=False, confirm_response=""): """Saves Config""" return super(CiscoAsaSSH, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
[ "Saves", "Config" ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_asa_ssh.py#L113-L117
[ "def", "save_config", "(", "self", ",", "cmd", "=", "\"write mem\"", ",", "confirm", "=", "False", ",", "confirm_response", "=", "\"\"", ")", ":", "return", "super", "(", "CiscoAsaSSH", ",", "self", ")", ".", "save_config", "(", "cmd", "=", "cmd", ",", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
CiscoXrSSH.send_config_set
IOS-XR requires you not exit from configuration mode.
netmiko/cisco/cisco_xr_ssh.py
def send_config_set(self, config_commands=None, exit_config_mode=True, **kwargs): """IOS-XR requires you not exit from configuration mode.""" return super(CiscoXrSSH, self).send_config_set( config_commands=config_commands, exit_config_mode=False, **kwargs )
def send_config_set(self, config_commands=None, exit_config_mode=True, **kwargs): """IOS-XR requires you not exit from configuration mode.""" return super(CiscoXrSSH, self).send_config_set( config_commands=config_commands, exit_config_mode=False, **kwargs )
[ "IOS", "-", "XR", "requires", "you", "not", "exit", "from", "configuration", "mode", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_xr_ssh.py#L20-L24
[ "def", "send_config_set", "(", "self", ",", "config_commands", "=", "None", ",", "exit_config_mode", "=", "True", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "CiscoXrSSH", ",", "self", ")", ".", "send_config_set", "(", "config_commands", "=", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
CiscoXrSSH.commit
Commit the candidate configuration. default (no options): command_string = commit confirm and confirm_delay: command_string = commit confirmed <confirm_delay> label (which is a label name): command_string = commit label <label> comment: co...
netmiko/cisco/cisco_xr_ssh.py
def commit( self, confirm=False, confirm_delay=None, comment="", label="", delay_factor=1 ): """ Commit the candidate configuration. default (no options): command_string = commit confirm and confirm_delay: command_string = commit confirmed <confirm_de...
def commit( self, confirm=False, confirm_delay=None, comment="", label="", delay_factor=1 ): """ Commit the candidate configuration. default (no options): command_string = commit confirm and confirm_delay: command_string = commit confirmed <confirm_de...
[ "Commit", "the", "candidate", "configuration", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_xr_ssh.py#L26-L118
[ "def", "commit", "(", "self", ",", "confirm", "=", "False", ",", "confirm_delay", "=", "None", ",", "comment", "=", "\"\"", ",", "label", "=", "\"\"", ",", "delay_factor", "=", "1", ")", ":", "delay_factor", "=", "self", ".", "select_delay_factor", "(", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
CiscoXrSSH.check_config_mode
Checks if the device is in configuration mode or not. IOS-XR, unfortunately, does this: RP/0/RSP0/CPU0:BNG(admin)#
netmiko/cisco/cisco_xr_ssh.py
def check_config_mode(self, check_string=")#", pattern=r"[#\$]"): """Checks if the device is in configuration mode or not. IOS-XR, unfortunately, does this: RP/0/RSP0/CPU0:BNG(admin)# """ self.write_channel(self.RETURN) output = self.read_until_pattern(pattern=pattern) ...
def check_config_mode(self, check_string=")#", pattern=r"[#\$]"): """Checks if the device is in configuration mode or not. IOS-XR, unfortunately, does this: RP/0/RSP0/CPU0:BNG(admin)# """ self.write_channel(self.RETURN) output = self.read_until_pattern(pattern=pattern) ...
[ "Checks", "if", "the", "device", "is", "in", "configuration", "mode", "or", "not", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_xr_ssh.py#L120-L131
[ "def", "check_config_mode", "(", "self", ",", "check_string", "=", "\")#\"", ",", "pattern", "=", "r\"[#\\$]\"", ")", ":", "self", ".", "write_channel", "(", "self", ".", "RETURN", ")", "output", "=", "self", ".", "read_until_pattern", "(", "pattern", "=", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
CiscoXrFileTransfer.process_md5
IOS-XR defaults with timestamps enabled # show md5 file /bootflash:/boot/grub/grub.cfg Sat Mar 3 17:49:03.596 UTC c84843f0030efd44b01343fdb8c2e801
netmiko/cisco/cisco_xr_ssh.py
def process_md5(self, md5_output, pattern=r"^([a-fA-F0-9]+)$"): """ IOS-XR defaults with timestamps enabled # show md5 file /bootflash:/boot/grub/grub.cfg Sat Mar 3 17:49:03.596 UTC c84843f0030efd44b01343fdb8c2e801 """ match = re.search(pattern, md5_output, flag...
def process_md5(self, md5_output, pattern=r"^([a-fA-F0-9]+)$"): """ IOS-XR defaults with timestamps enabled # show md5 file /bootflash:/boot/grub/grub.cfg Sat Mar 3 17:49:03.596 UTC c84843f0030efd44b01343fdb8c2e801 """ match = re.search(pattern, md5_output, flag...
[ "IOS", "-", "XR", "defaults", "with", "timestamps", "enabled" ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_xr_ssh.py#L156-L168
[ "def", "process_md5", "(", "self", ",", "md5_output", ",", "pattern", "=", "r\"^([a-fA-F0-9]+)$\"", ")", ":", "match", "=", "re", ".", "search", "(", "pattern", ",", "md5_output", ",", "flags", "=", "re", ".", "M", ")", "if", "match", ":", "return", "m...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
DellOS10SSH.save_config
Saves Config
netmiko/dell/dell_os10_ssh.py
def save_config( self, cmd="copy running-configuration startup-configuration", confirm=False, confirm_response="", ): """Saves Config""" return super(DellOS10SSH, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
def save_config( self, cmd="copy running-configuration startup-configuration", confirm=False, confirm_response="", ): """Saves Config""" return super(DellOS10SSH, self).save_config( cmd=cmd, confirm=confirm, confirm_response=confirm_response )
[ "Saves", "Config" ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/dell/dell_os10_ssh.py#L12-L21
[ "def", "save_config", "(", "self", ",", "cmd", "=", "\"copy running-configuration startup-configuration\"", ",", "confirm", "=", "False", ",", "confirm_response", "=", "\"\"", ",", ")", ":", "return", "super", "(", "DellOS10SSH", ",", "self", ")", ".", "save_con...
54e6116c0b4664de2123081937e0a9a27bdfdfea
train
DellOS10FileTransfer.remote_file_size
Get the file size of the remote file.
netmiko/dell/dell_os10_ssh.py
def remote_file_size(self, remote_cmd="", remote_file=None): """Get the file size of the remote file.""" if remote_file is None: if self.direction == "put": remote_file = self.dest_file elif self.direction == "get": remote_file = self.source_file ...
def remote_file_size(self, remote_cmd="", remote_file=None): """Get the file size of the remote file.""" if remote_file is None: if self.direction == "put": remote_file = self.dest_file elif self.direction == "get": remote_file = self.source_file ...
[ "Get", "the", "file", "size", "of", "the", "remote", "file", "." ]
ktbyers/netmiko
python
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/dell/dell_os10_ssh.py#L41-L57
[ "def", "remote_file_size", "(", "self", ",", "remote_cmd", "=", "\"\"", ",", "remote_file", "=", "None", ")", ":", "if", "remote_file", "is", "None", ":", "if", "self", ".", "direction", "==", "\"put\"", ":", "remote_file", "=", "self", ".", "dest_file", ...
54e6116c0b4664de2123081937e0a9a27bdfdfea