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
NamepaceBrowserWidget.remove_value
Remove a variable
spyder/plugins/ipythonconsole/widgets/namespacebrowser.py
def remove_value(self, name): """Remove a variable""" code = u"get_ipython().kernel.remove_value('%s')" % name if self._reading: self.kernel_client.input(u'!' + code) else: self.silent_execute(code)
def remove_value(self, name): """Remove a variable""" code = u"get_ipython().kernel.remove_value('%s')" % name if self._reading: self.kernel_client.input(u'!' + code) else: self.silent_execute(code)
[ "Remove", "a", "variable" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L121-L127
[ "def", "remove_value", "(", "self", ",", "name", ")", ":", "code", "=", "u\"get_ipython().kernel.remove_value('%s')\"", "%", "name", "if", "self", ".", "_reading", ":", "self", ".", "kernel_client", ".", "input", "(", "u'!'", "+", "code", ")", "else", ":", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
NamepaceBrowserWidget.copy_value
Copy a variable
spyder/plugins/ipythonconsole/widgets/namespacebrowser.py
def copy_value(self, orig_name, new_name): """Copy a variable""" code = u"get_ipython().kernel.copy_value('%s', '%s')" % (orig_name, new_name) if self._reading: self.kernel_client.input(u'!' + code) else: ...
def copy_value(self, orig_name, new_name): """Copy a variable""" code = u"get_ipython().kernel.copy_value('%s', '%s')" % (orig_name, new_name) if self._reading: self.kernel_client.input(u'!' + code) else: ...
[ "Copy", "a", "variable" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L129-L136
[ "def", "copy_value", "(", "self", ",", "orig_name", ",", "new_name", ")", ":", "code", "=", "u\"get_ipython().kernel.copy_value('%s', '%s')\"", "%", "(", "orig_name", ",", "new_name", ")", "if", "self", ".", "_reading", ":", "self", ".", "kernel_client", ".", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
NamepaceBrowserWidget._handle_spyder_msg
Handle internal spyder messages
spyder/plugins/ipythonconsole/widgets/namespacebrowser.py
def _handle_spyder_msg(self, msg): """ Handle internal spyder messages """ spyder_msg_type = msg['content'].get('spyder_msg_type') if spyder_msg_type == 'data': # Deserialize data try: if PY2: value = cloudpickle.loads(m...
def _handle_spyder_msg(self, msg): """ Handle internal spyder messages """ spyder_msg_type = msg['content'].get('spyder_msg_type') if spyder_msg_type == 'data': # Deserialize data try: if PY2: value = cloudpickle.loads(m...
[ "Handle", "internal", "spyder", "messages" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L176-L206
[ "def", "_handle_spyder_msg", "(", "self", ",", "msg", ")", ":", "spyder_msg_type", "=", "msg", "[", "'content'", "]", ".", "get", "(", "'spyder_msg_type'", ")", "if", "spyder_msg_type", "==", "'data'", ":", "# Deserialize data", "try", ":", "if", "PY2", ":",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
NamepaceBrowserWidget._handle_execute_reply
Reimplemented to handle communications between Spyder and the kernel
spyder/plugins/ipythonconsole/widgets/namespacebrowser.py
def _handle_execute_reply(self, msg): """ Reimplemented to handle communications between Spyder and the kernel """ msg_id = msg['parent_header']['msg_id'] info = self._request_info['execute'].get(msg_id) # unset reading flag, because if execute finished, raw_input...
def _handle_execute_reply(self, msg): """ Reimplemented to handle communications between Spyder and the kernel """ msg_id = msg['parent_header']['msg_id'] info = self._request_info['execute'].get(msg_id) # unset reading flag, because if execute finished, raw_input...
[ "Reimplemented", "to", "handle", "communications", "between", "Spyder", "and", "the", "kernel" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L209-L234
[ "def", "_handle_execute_reply", "(", "self", ",", "msg", ")", ":", "msg_id", "=", "msg", "[", "'parent_header'", "]", "[", "'msg_id'", "]", "info", "=", "self", ".", "_request_info", "[", "'execute'", "]", ".", "get", "(", "msg_id", ")", "# unset reading f...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
NamepaceBrowserWidget._handle_status
Reimplemented to refresh the namespacebrowser after kernel restarts
spyder/plugins/ipythonconsole/widgets/namespacebrowser.py
def _handle_status(self, msg): """ Reimplemented to refresh the namespacebrowser after kernel restarts """ state = msg['content'].get('execution_state', '') msg_type = msg['parent_header'].get('msg_type', '') if state == 'starting': # This is needed to...
def _handle_status(self, msg): """ Reimplemented to refresh the namespacebrowser after kernel restarts """ state = msg['content'].get('execution_state', '') msg_type = msg['parent_header'].get('msg_type', '') if state == 'starting': # This is needed to...
[ "Reimplemented", "to", "refresh", "the", "namespacebrowser", "after", "kernel", "restarts" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L236-L261
[ "def", "_handle_status", "(", "self", ",", "msg", ")", ":", "state", "=", "msg", "[", "'content'", "]", ".", "get", "(", "'execution_state'", ",", "''", ")", "msg_type", "=", "msg", "[", "'parent_header'", "]", ".", "get", "(", "'msg_type'", ",", "''",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
PluginWindow.closeEvent
Reimplement Qt method.
spyder/plugins/base.py
def closeEvent(self, event): """Reimplement Qt method.""" self.plugin.dockwidget.setWidget(self.plugin) self.plugin.dockwidget.setVisible(True) self.plugin.switch_to_plugin() QMainWindow.closeEvent(self, event) self.plugin.undocked_window = None
def closeEvent(self, event): """Reimplement Qt method.""" self.plugin.dockwidget.setWidget(self.plugin) self.plugin.dockwidget.setVisible(True) self.plugin.switch_to_plugin() QMainWindow.closeEvent(self, event) self.plugin.undocked_window = None
[ "Reimplement", "Qt", "method", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L38-L44
[ "def", "closeEvent", "(", "self", ",", "event", ")", ":", "self", ".", "plugin", ".", "dockwidget", ".", "setWidget", "(", "self", ".", "plugin", ")", "self", ".", "plugin", ".", "dockwidget", ".", "setVisible", "(", "True", ")", "self", ".", "plugin",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BasePluginMixin.initialize_plugin_in_mainwindow_layout
If this is the first time the plugin is shown, perform actions to initialize plugin position in Spyder's window layout. Use on_first_registration to define the actions to be run by your plugin
spyder/plugins/base.py
def initialize_plugin_in_mainwindow_layout(self): """ If this is the first time the plugin is shown, perform actions to initialize plugin position in Spyder's window layout. Use on_first_registration to define the actions to be run by your plugin """ if self.get_...
def initialize_plugin_in_mainwindow_layout(self): """ If this is the first time the plugin is shown, perform actions to initialize plugin position in Spyder's window layout. Use on_first_registration to define the actions to be run by your plugin """ if self.get_...
[ "If", "this", "is", "the", "first", "time", "the", "plugin", "is", "shown", "perform", "actions", "to", "initialize", "plugin", "position", "in", "Spyder", "s", "window", "layout", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L76-L89
[ "def", "initialize_plugin_in_mainwindow_layout", "(", "self", ")", ":", "if", "self", ".", "get_option", "(", "'first_time'", ",", "True", ")", ":", "try", ":", "self", ".", "on_first_registration", "(", ")", "except", "NotImplementedError", ":", "return", "self...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BasePluginMixin.update_margins
Update plugin margins
spyder/plugins/base.py
def update_margins(self): """Update plugin margins""" layout = self.layout() if self.default_margins is None: self.default_margins = layout.getContentsMargins() if CONF.get('main', 'use_custom_margin'): margin = CONF.get('main', 'custom_margin') layout...
def update_margins(self): """Update plugin margins""" layout = self.layout() if self.default_margins is None: self.default_margins = layout.getContentsMargins() if CONF.get('main', 'use_custom_margin'): margin = CONF.get('main', 'custom_margin') layout...
[ "Update", "plugin", "margins" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L91-L100
[ "def", "update_margins", "(", "self", ")", ":", "layout", "=", "self", ".", "layout", "(", ")", "if", "self", ".", "default_margins", "is", "None", ":", "self", ".", "default_margins", "=", "layout", ".", "getContentsMargins", "(", ")", "if", "CONF", "."...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BasePluginMixin.update_plugin_title
Update plugin title, i.e. dockwidget or window title
spyder/plugins/base.py
def update_plugin_title(self): """Update plugin title, i.e. dockwidget or window title""" if self.dockwidget is not None: win = self.dockwidget elif self.undocked_window is not None: win = self.undocked_window else: return win.setWindowTitle(se...
def update_plugin_title(self): """Update plugin title, i.e. dockwidget or window title""" if self.dockwidget is not None: win = self.dockwidget elif self.undocked_window is not None: win = self.undocked_window else: return win.setWindowTitle(se...
[ "Update", "plugin", "title", "i", ".", "e", ".", "dockwidget", "or", "window", "title" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L102-L110
[ "def", "update_plugin_title", "(", "self", ")", ":", "if", "self", ".", "dockwidget", "is", "not", "None", ":", "win", "=", "self", ".", "dockwidget", "elif", "self", ".", "undocked_window", "is", "not", "None", ":", "win", "=", "self", ".", "undocked_wi...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BasePluginMixin.create_dockwidget
Add to parent QMainWindow as a dock widget
spyder/plugins/base.py
def create_dockwidget(self): """Add to parent QMainWindow as a dock widget""" # Creating dock widget dock = SpyderDockWidget(self.get_plugin_title(), self.main) # Set properties dock.setObjectName(self.__class__.__name__+"_dw") dock.setAllowedAreas(self.ALLOWED_AREAS) ...
def create_dockwidget(self): """Add to parent QMainWindow as a dock widget""" # Creating dock widget dock = SpyderDockWidget(self.get_plugin_title(), self.main) # Set properties dock.setObjectName(self.__class__.__name__+"_dw") dock.setAllowedAreas(self.ALLOWED_AREAS) ...
[ "Add", "to", "parent", "QMainWindow", "as", "a", "dock", "widget" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L112-L131
[ "def", "create_dockwidget", "(", "self", ")", ":", "# Creating dock widget", "dock", "=", "SpyderDockWidget", "(", "self", ".", "get_plugin_title", "(", ")", ",", "self", ".", "main", ")", "# Set properties", "dock", ".", "setObjectName", "(", "self", ".", "__...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BasePluginMixin.create_configwidget
Create configuration dialog box page widget
spyder/plugins/base.py
def create_configwidget(self, parent): """Create configuration dialog box page widget""" if self.CONFIGWIDGET_CLASS is not None: configwidget = self.CONFIGWIDGET_CLASS(self, parent) configwidget.initialize() return configwidget
def create_configwidget(self, parent): """Create configuration dialog box page widget""" if self.CONFIGWIDGET_CLASS is not None: configwidget = self.CONFIGWIDGET_CLASS(self, parent) configwidget.initialize() return configwidget
[ "Create", "configuration", "dialog", "box", "page", "widget" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L133-L138
[ "def", "create_configwidget", "(", "self", ",", "parent", ")", ":", "if", "self", ".", "CONFIGWIDGET_CLASS", "is", "not", "None", ":", "configwidget", "=", "self", ".", "CONFIGWIDGET_CLASS", "(", "self", ",", "parent", ")", "configwidget", ".", "initialize", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BasePluginMixin.get_plugin_font
Return plugin font option. All plugins in Spyder use a global font. This is a convenience method in case some plugins will have a delta size based on the default size.
spyder/plugins/base.py
def get_plugin_font(self, rich_text=False): """ Return plugin font option. All plugins in Spyder use a global font. This is a convenience method in case some plugins will have a delta size based on the default size. """ if rich_text: option = 'rich_font' ...
def get_plugin_font(self, rich_text=False): """ Return plugin font option. All plugins in Spyder use a global font. This is a convenience method in case some plugins will have a delta size based on the default size. """ if rich_text: option = 'rich_font' ...
[ "Return", "plugin", "font", "option", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L155-L170
[ "def", "get_plugin_font", "(", "self", ",", "rich_text", "=", "False", ")", ":", "if", "rich_text", ":", "option", "=", "'rich_font'", "font_size_delta", "=", "self", ".", "RICH_FONT_SIZE_DELTA", "else", ":", "option", "=", "'font'", "font_size_delta", "=", "s...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BasePluginMixin.show_message
Show message in main window's status bar
spyder/plugins/base.py
def show_message(self, message, timeout=0): """Show message in main window's status bar""" self.main.statusBar().showMessage(message, timeout)
def show_message(self, message, timeout=0): """Show message in main window's status bar""" self.main.statusBar().showMessage(message, timeout)
[ "Show", "message", "in", "main", "window", "s", "status", "bar" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L183-L185
[ "def", "show_message", "(", "self", ",", "message", ",", "timeout", "=", "0", ")", ":", "self", ".", "main", ".", "statusBar", "(", ")", ".", "showMessage", "(", "message", ",", "timeout", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BasePluginMixin.create_toggle_view_action
Associate a toggle view action with each plugin
spyder/plugins/base.py
def create_toggle_view_action(self): """Associate a toggle view action with each plugin""" title = self.get_plugin_title() if self.CONF_SECTION == 'editor': title = _('Editor') if self.shortcut is not None: action = create_action(self, title, ...
def create_toggle_view_action(self): """Associate a toggle view action with each plugin""" title = self.get_plugin_title() if self.CONF_SECTION == 'editor': title = _('Editor') if self.shortcut is not None: action = create_action(self, title, ...
[ "Associate", "a", "toggle", "view", "action", "with", "each", "plugin" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L187-L200
[ "def", "create_toggle_view_action", "(", "self", ")", ":", "title", "=", "self", ".", "get_plugin_title", "(", ")", "if", "self", ".", "CONF_SECTION", "==", "'editor'", ":", "title", "=", "_", "(", "'Editor'", ")", "if", "self", ".", "shortcut", "is", "n...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BasePluginMixin.toggle_view
Toggle view
spyder/plugins/base.py
def toggle_view(self, checked): """Toggle view""" if not self.dockwidget: return if checked: self.dockwidget.show() self.dockwidget.raise_() else: self.dockwidget.hide()
def toggle_view(self, checked): """Toggle view""" if not self.dockwidget: return if checked: self.dockwidget.show() self.dockwidget.raise_() else: self.dockwidget.hide()
[ "Toggle", "view" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L202-L210
[ "def", "toggle_view", "(", "self", ",", "checked", ")", ":", "if", "not", "self", ".", "dockwidget", ":", "return", "if", "checked", ":", "self", ".", "dockwidget", ".", "show", "(", ")", "self", ".", "dockwidget", ".", "raise_", "(", ")", "else", ":...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BasePluginMixin.close_window
Close QMainWindow instance that contains this plugin.
spyder/plugins/base.py
def close_window(self): """Close QMainWindow instance that contains this plugin.""" if self.undocked_window is not None: self.undocked_window.close() self.undocked_window = None # Oddly, these actions can appear disabled after the Dock # action is pressed...
def close_window(self): """Close QMainWindow instance that contains this plugin.""" if self.undocked_window is not None: self.undocked_window.close() self.undocked_window = None # Oddly, these actions can appear disabled after the Dock # action is pressed...
[ "Close", "QMainWindow", "instance", "that", "contains", "this", "plugin", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L213-L222
[ "def", "close_window", "(", "self", ")", ":", "if", "self", ".", "undocked_window", "is", "not", "None", ":", "self", ".", "undocked_window", ".", "close", "(", ")", "self", ".", "undocked_window", "=", "None", "# Oddly, these actions can appear disabled after the...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BasePluginMixin.create_window
Create a QMainWindow instance containing this plugin.
spyder/plugins/base.py
def create_window(self): """Create a QMainWindow instance containing this plugin.""" self.undocked_window = window = PluginWindow(self) window.setAttribute(Qt.WA_DeleteOnClose) icon = self.get_plugin_icon() if is_text_string(icon): icon = self.get_icon(icon) w...
def create_window(self): """Create a QMainWindow instance containing this plugin.""" self.undocked_window = window = PluginWindow(self) window.setAttribute(Qt.WA_DeleteOnClose) icon = self.get_plugin_icon() if is_text_string(icon): icon = self.get_icon(icon) w...
[ "Create", "a", "QMainWindow", "instance", "containing", "this", "plugin", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L225-L241
[ "def", "create_window", "(", "self", ")", ":", "self", ".", "undocked_window", "=", "window", "=", "PluginWindow", "(", "self", ")", "window", ".", "setAttribute", "(", "Qt", ".", "WA_DeleteOnClose", ")", "icon", "=", "self", ".", "get_plugin_icon", "(", "...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BasePluginMixin.on_top_level_changed
Actions to perform when a plugin is undocked to be moved.
spyder/plugins/base.py
def on_top_level_changed(self, top_level): """Actions to perform when a plugin is undocked to be moved.""" if top_level: self.undock_action.setDisabled(True) else: self.undock_action.setDisabled(False)
def on_top_level_changed(self, top_level): """Actions to perform when a plugin is undocked to be moved.""" if top_level: self.undock_action.setDisabled(True) else: self.undock_action.setDisabled(False)
[ "Actions", "to", "perform", "when", "a", "plugin", "is", "undocked", "to", "be", "moved", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L244-L249
[ "def", "on_top_level_changed", "(", "self", ",", "top_level", ")", ":", "if", "top_level", ":", "self", ".", "undock_action", ".", "setDisabled", "(", "True", ")", "else", ":", "self", ".", "undock_action", ".", "setDisabled", "(", "False", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
DescriptionWidget.cut
Cut text
spyder/widgets/reporterror.py
def cut(self): """Cut text""" self.truncate_selection(self.header_end_pos) if self.has_selected_text(): CodeEditor.cut(self)
def cut(self): """Cut text""" self.truncate_selection(self.header_end_pos) if self.has_selected_text(): CodeEditor.cut(self)
[ "Cut", "text" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/reporterror.py#L76-L80
[ "def", "cut", "(", "self", ")", ":", "self", ".", "truncate_selection", "(", "self", ".", "header_end_pos", ")", "if", "self", ".", "has_selected_text", "(", ")", ":", "CodeEditor", ".", "cut", "(", "self", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
DescriptionWidget.keyPressEvent
Reimplemented Qt Method to avoid removing the header.
spyder/widgets/reporterror.py
def keyPressEvent(self, event): """Reimplemented Qt Method to avoid removing the header.""" event, text, key, ctrl, shift = restore_keyevent(event) cursor_position = self.get_position('cursor') if cursor_position < self.header_end_pos: self.restrict_cursor_position(self.head...
def keyPressEvent(self, event): """Reimplemented Qt Method to avoid removing the header.""" event, text, key, ctrl, shift = restore_keyevent(event) cursor_position = self.get_position('cursor') if cursor_position < self.header_end_pos: self.restrict_cursor_position(self.head...
[ "Reimplemented", "Qt", "Method", "to", "avoid", "removing", "the", "header", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/reporterror.py#L82-L104
[ "def", "keyPressEvent", "(", "self", ",", "event", ")", ":", "event", ",", "text", ",", "key", ",", "ctrl", ",", "shift", "=", "restore_keyevent", "(", "event", ")", "cursor_position", "=", "self", ".", "get_position", "(", "'cursor'", ")", "if", "cursor...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
SpyderErrorDialog._submit_to_github
Action to take when pressing the submit button.
spyder/widgets/reporterror.py
def _submit_to_github(self): """Action to take when pressing the submit button.""" # Get reference to the main window if self.parent() is not None: if getattr(self.parent(), 'main', False): # This covers the case when the dialog is attached # to the in...
def _submit_to_github(self): """Action to take when pressing the submit button.""" # Get reference to the main window if self.parent() is not None: if getattr(self.parent(), 'main', False): # This covers the case when the dialog is attached # to the in...
[ "Action", "to", "take", "when", "pressing", "the", "submit", "button", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/reporterror.py#L250-L305
[ "def", "_submit_to_github", "(", "self", ")", ":", "# Get reference to the main window", "if", "self", ".", "parent", "(", ")", "is", "not", "None", ":", "if", "getattr", "(", "self", ".", "parent", "(", ")", ",", "'main'", ",", "False", ")", ":", "# Thi...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
SpyderErrorDialog._show_details
Show traceback on its own dialog
spyder/widgets/reporterror.py
def _show_details(self): """Show traceback on its own dialog""" if self.details.isVisible(): self.details.hide() self.details_btn.setText(_('Show details')) else: self.resize(570, 700) self.details.document().setPlainText('') self.detai...
def _show_details(self): """Show traceback on its own dialog""" if self.details.isVisible(): self.details.hide() self.details_btn.setText(_('Show details')) else: self.resize(570, 700) self.details.document().setPlainText('') self.detai...
[ "Show", "traceback", "on", "its", "own", "dialog" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/reporterror.py#L311-L323
[ "def", "_show_details", "(", "self", ")", ":", "if", "self", ".", "details", ".", "isVisible", "(", ")", ":", "self", ".", "details", ".", "hide", "(", ")", "self", ".", "details_btn", ".", "setText", "(", "_", "(", "'Show details'", ")", ")", "else"...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
SpyderErrorDialog._contents_changed
Activate submit_btn.
spyder/widgets/reporterror.py
def _contents_changed(self): """Activate submit_btn.""" desc_chars = (len(self.input_description.toPlainText()) - self.initial_chars) if desc_chars < DESC_MIN_CHARS: self.desc_chars_label.setText( u"{} {}".format(DESC_MIN_CHARS - desc_chars, ...
def _contents_changed(self): """Activate submit_btn.""" desc_chars = (len(self.input_description.toPlainText()) - self.initial_chars) if desc_chars < DESC_MIN_CHARS: self.desc_chars_label.setText( u"{} {}".format(DESC_MIN_CHARS - desc_chars, ...
[ "Activate", "submit_btn", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/reporterror.py#L325-L346
[ "def", "_contents_changed", "(", "self", ")", ":", "desc_chars", "=", "(", "len", "(", "self", ".", "input_description", ".", "toPlainText", "(", ")", ")", "-", "self", ".", "initial_chars", ")", "if", "desc_chars", "<", "DESC_MIN_CHARS", ":", "self", ".",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
CloseBracketsExtension.unmatched_brackets_in_line
Checks if there is an unmatched brackets in the 'text'. The brackets type can be general or specified by closing_brackets_type (')', ']' or '}')
spyder/plugins/editor/extensions/closebrackets.py
def unmatched_brackets_in_line(self, text, closing_brackets_type=None): """ Checks if there is an unmatched brackets in the 'text'. The brackets type can be general or specified by closing_brackets_type (')', ']' or '}') """ if closing_brackets_type is None: ...
def unmatched_brackets_in_line(self, text, closing_brackets_type=None): """ Checks if there is an unmatched brackets in the 'text'. The brackets type can be general or specified by closing_brackets_type (')', ']' or '}') """ if closing_brackets_type is None: ...
[ "Checks", "if", "there", "is", "an", "unmatched", "brackets", "in", "the", "text", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/closebrackets.py#L44-L71
[ "def", "unmatched_brackets_in_line", "(", "self", ",", "text", ",", "closing_brackets_type", "=", "None", ")", ":", "if", "closing_brackets_type", "is", "None", ":", "opening_brackets", "=", "self", ".", "BRACKETS_LEFT", ".", "values", "(", ")", "closing_brackets"...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
CloseBracketsExtension._autoinsert_brackets
Control automatic insertation of brackets in various situations.
spyder/plugins/editor/extensions/closebrackets.py
def _autoinsert_brackets(self, key): """Control automatic insertation of brackets in various situations.""" char = self.BRACKETS_CHAR[key] pair = self.BRACKETS_PAIR[key] line_text = self.editor.get_text('sol', 'eol') line_to_cursor = self.editor.get_text('sol', 'cursor') ...
def _autoinsert_brackets(self, key): """Control automatic insertation of brackets in various situations.""" char = self.BRACKETS_CHAR[key] pair = self.BRACKETS_PAIR[key] line_text = self.editor.get_text('sol', 'eol') line_to_cursor = self.editor.get_text('sol', 'cursor') ...
[ "Control", "automatic", "insertation", "of", "brackets", "in", "various", "situations", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/closebrackets.py#L73-L114
[ "def", "_autoinsert_brackets", "(", "self", ",", "key", ")", ":", "char", "=", "self", ".", "BRACKETS_CHAR", "[", "key", "]", "pair", "=", "self", ".", "BRACKETS_PAIR", "[", "key", "]", "line_text", "=", "self", ".", "editor", ".", "get_text", "(", "'s...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
build_montages
--------------------------------------------------------------------------------------------- author: Kyle Hounslow --------------------------------------------------------------------------------------------- Converts a list of single images into a list of 'montage' images of specified rows and columns. ...
imutils/convenience.py
def build_montages(image_list, image_shape, montage_shape): """ --------------------------------------------------------------------------------------------- author: Kyle Hounslow --------------------------------------------------------------------------------------------- Converts a list of single ...
def build_montages(image_list, image_shape, montage_shape): """ --------------------------------------------------------------------------------------------- author: Kyle Hounslow --------------------------------------------------------------------------------------------- Converts a list of single ...
[ "---------------------------------------------------------------------------------------------", "author", ":", "Kyle", "Hounslow", "---------------------------------------------------------------------------------------------", "Converts", "a", "list", "of", "single", "images", "into", "a...
jrosebr1/imutils
python
https://github.com/jrosebr1/imutils/blob/4430083199793bd66db64e574379cbe18414d420/imutils/convenience.py#L238-L301
[ "def", "build_montages", "(", "image_list", ",", "image_shape", ",", "montage_shape", ")", ":", "if", "len", "(", "image_shape", ")", "!=", "2", ":", "raise", "Exception", "(", "'image shape must be list or tuple of length 2 (rows, cols)'", ")", "if", "len", "(", ...
4430083199793bd66db64e574379cbe18414d420
train
adjust_brightness_contrast
Adjust the brightness and/or contrast of an image :param image: OpenCV BGR image :param contrast: Float, contrast adjustment with 0 meaning no change :param brightness: Float, brightness adjustment with 0 meaning no change
imutils/convenience.py
def adjust_brightness_contrast(image, brightness=0., contrast=0.): """ Adjust the brightness and/or contrast of an image :param image: OpenCV BGR image :param contrast: Float, contrast adjustment with 0 meaning no change :param brightness: Float, brightness adjustment with 0 meaning no change "...
def adjust_brightness_contrast(image, brightness=0., contrast=0.): """ Adjust the brightness and/or contrast of an image :param image: OpenCV BGR image :param contrast: Float, contrast adjustment with 0 meaning no change :param brightness: Float, brightness adjustment with 0 meaning no change "...
[ "Adjust", "the", "brightness", "and", "/", "or", "contrast", "of", "an", "image" ]
jrosebr1/imutils
python
https://github.com/jrosebr1/imutils/blob/4430083199793bd66db64e574379cbe18414d420/imutils/convenience.py#L304-L319
[ "def", "adjust_brightness_contrast", "(", "image", ",", "brightness", "=", "0.", ",", "contrast", "=", "0.", ")", ":", "beta", "=", "0", "# See the OpenCV docs for more info on the `beta` parameter to addWeighted", "# https://docs.opencv.org/3.4.2/d2/de8/group__core__array.html#g...
4430083199793bd66db64e574379cbe18414d420
train
put_text
Utility for drawing text with line breaks :param img: Image. :param text: Text string to be drawn. :param org: Bottom-left corner of the first line of the text string in the image. :param font_face: Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN, FONT_HERSHEY_DUPLEX, ...
imutils/text.py
def put_text(img, text, org, font_face, font_scale, color, thickness=1, line_type=8, bottom_left_origin=False): """Utility for drawing text with line breaks :param img: Image. :param text: Text string to be drawn. :param org: Bottom-left corner of the first line of the text string in the image. :pa...
def put_text(img, text, org, font_face, font_scale, color, thickness=1, line_type=8, bottom_left_origin=False): """Utility for drawing text with line breaks :param img: Image. :param text: Text string to be drawn. :param org: Bottom-left corner of the first line of the text string in the image. :pa...
[ "Utility", "for", "drawing", "text", "with", "line", "breaks" ]
jrosebr1/imutils
python
https://github.com/jrosebr1/imutils/blob/4430083199793bd66db64e574379cbe18414d420/imutils/text.py#L4-L52
[ "def", "put_text", "(", "img", ",", "text", ",", "org", ",", "font_face", ",", "font_scale", ",", "color", ",", "thickness", "=", "1", ",", "line_type", "=", "8", ",", "bottom_left_origin", "=", "False", ")", ":", "# Break out drawing coords", "x", ",", ...
4430083199793bd66db64e574379cbe18414d420
train
put_centered_text
Utility for drawing vertically & horizontally centered text with line breaks :param img: Image. :param text: Text string to be drawn. :param font_face: Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN, FONT_HERSHEY_DUPLEX, FONT_HERSHEY_COMPLEX, FONT_HERSHEY_TRIPLEX, FONT...
imutils/text.py
def put_centered_text(img, text, font_face, font_scale, color, thickness=1, line_type=8): """Utility for drawing vertically & horizontally centered text with line breaks :param img: Image. :param text: Text string to be drawn. :param font_face: Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN...
def put_centered_text(img, text, font_face, font_scale, color, thickness=1, line_type=8): """Utility for drawing vertically & horizontally centered text with line breaks :param img: Image. :param text: Text string to be drawn. :param font_face: Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN...
[ "Utility", "for", "drawing", "vertically", "&", "horizontally", "centered", "text", "with", "line", "breaks" ]
jrosebr1/imutils
python
https://github.com/jrosebr1/imutils/blob/4430083199793bd66db64e574379cbe18414d420/imutils/text.py#L55-L107
[ "def", "put_centered_text", "(", "img", ",", "text", ",", "font_face", ",", "font_scale", ",", "color", ",", "thickness", "=", "1", ",", "line_type", "=", "8", ")", ":", "# Save img dimensions", "img_h", ",", "img_w", "=", "img", ".", "shape", "[", ":", ...
4430083199793bd66db64e574379cbe18414d420
train
corners_to_keypoints
function to take the corners from cv2.GoodFeaturesToTrack and return cv2.KeyPoints
imutils/feature/helpers.py
def corners_to_keypoints(corners): """function to take the corners from cv2.GoodFeaturesToTrack and return cv2.KeyPoints""" if corners is None: keypoints = [] else: keypoints = [cv2.KeyPoint(kp[0][0], kp[0][1], 1) for kp in corners] return keypoints
def corners_to_keypoints(corners): """function to take the corners from cv2.GoodFeaturesToTrack and return cv2.KeyPoints""" if corners is None: keypoints = [] else: keypoints = [cv2.KeyPoint(kp[0][0], kp[0][1], 1) for kp in corners] return keypoints
[ "function", "to", "take", "the", "corners", "from", "cv2", ".", "GoodFeaturesToTrack", "and", "return", "cv2", ".", "KeyPoints" ]
jrosebr1/imutils
python
https://github.com/jrosebr1/imutils/blob/4430083199793bd66db64e574379cbe18414d420/imutils/feature/helpers.py#L4-L11
[ "def", "corners_to_keypoints", "(", "corners", ")", ":", "if", "corners", "is", "None", ":", "keypoints", "=", "[", "]", "else", ":", "keypoints", "=", "[", "cv2", ".", "KeyPoint", "(", "kp", "[", "0", "]", "[", "0", "]", ",", "kp", "[", "0", "]"...
4430083199793bd66db64e574379cbe18414d420
train
path_to_url
Convert a path to a file: URL. The path will be made absolute and have quoted path parts.
poetry/packages/utils/utils.py
def path_to_url(path): """ Convert a path to a file: URL. The path will be made absolute and have quoted path parts. """ path = os.path.normpath(os.path.abspath(path)) url = urlparse.urljoin("file:", urllib2.pathname2url(path)) return url
def path_to_url(path): """ Convert a path to a file: URL. The path will be made absolute and have quoted path parts. """ path = os.path.normpath(os.path.abspath(path)) url = urlparse.urljoin("file:", urllib2.pathname2url(path)) return url
[ "Convert", "a", "path", "to", "a", "file", ":", "URL", ".", "The", "path", "will", "be", "made", "absolute", "and", "have", "quoted", "path", "parts", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/packages/utils/utils.py#L49-L56
[ "def", "path_to_url", "(", "path", ")", ":", "path", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "abspath", "(", "path", ")", ")", "url", "=", "urlparse", ".", "urljoin", "(", "\"file:\"", ",", "urllib2", ".", "pathname2url"...
2d27acd76c165dd49f11934520a7973de7a3762a
train
is_installable_dir
Return True if `path` is a directory containing a setup.py file.
poetry/packages/utils/utils.py
def is_installable_dir(path): """Return True if `path` is a directory containing a setup.py file.""" if not os.path.isdir(path): return False setup_py = os.path.join(path, "setup.py") if os.path.isfile(setup_py): return True return False
def is_installable_dir(path): """Return True if `path` is a directory containing a setup.py file.""" if not os.path.isdir(path): return False setup_py = os.path.join(path, "setup.py") if os.path.isfile(setup_py): return True return False
[ "Return", "True", "if", "path", "is", "a", "directory", "containing", "a", "setup", ".", "py", "file", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/packages/utils/utils.py#L90-L97
[ "def", "is_installable_dir", "(", "path", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "return", "False", "setup_py", "=", "os", ".", "path", ".", "join", "(", "path", ",", "\"setup.py\"", ")", "if", "os", ".", "pa...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Config.setting
Retrieve a setting value.
poetry/config.py
def setting(self, setting_name, default=None): # type: (str) -> Any """ Retrieve a setting value. """ keys = setting_name.split(".") config = self._content for key in keys: if key not in config: return default config = config[key...
def setting(self, setting_name, default=None): # type: (str) -> Any """ Retrieve a setting value. """ keys = setting_name.split(".") config = self._content for key in keys: if key not in config: return default config = config[key...
[ "Retrieve", "a", "setting", "value", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/config.py#L36-L49
[ "def", "setting", "(", "self", ",", "setting_name", ",", "default", "=", "None", ")", ":", "# type: (str) -> Any", "keys", "=", "setting_name", ".", "split", "(", "\".\"", ")", "config", "=", "self", ".", "_content", "for", "key", "in", "keys", ":", "if"...
2d27acd76c165dd49f11934520a7973de7a3762a
train
get_requires_for_build_wheel
Returns a list of requirements for building, as strings
poetry/masonry/api.py
def get_requires_for_build_wheel(config_settings=None): """ Returns a list of requirements for building, as strings """ poetry = Poetry.create(".") main, _ = SdistBuilder.convert_dependencies(poetry.package, poetry.package.requires) return main
def get_requires_for_build_wheel(config_settings=None): """ Returns a list of requirements for building, as strings """ poetry = Poetry.create(".") main, _ = SdistBuilder.convert_dependencies(poetry.package, poetry.package.requires) return main
[ "Returns", "a", "list", "of", "requirements", "for", "building", "as", "strings" ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/api.py#L19-L27
[ "def", "get_requires_for_build_wheel", "(", "config_settings", "=", "None", ")", ":", "poetry", "=", "Poetry", ".", "create", "(", "\".\"", ")", "main", ",", "_", "=", "SdistBuilder", ".", "convert_dependencies", "(", "poetry", ".", "package", ",", "poetry", ...
2d27acd76c165dd49f11934520a7973de7a3762a
train
build_wheel
Builds a wheel, places it in wheel_directory
poetry/masonry/api.py
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): """Builds a wheel, places it in wheel_directory""" poetry = Poetry.create(".") return unicode( WheelBuilder.make_in( poetry, SystemEnv(Path(sys.prefix)), NullIO(), Path(wheel_directory) ) )
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): """Builds a wheel, places it in wheel_directory""" poetry = Poetry.create(".") return unicode( WheelBuilder.make_in( poetry, SystemEnv(Path(sys.prefix)), NullIO(), Path(wheel_directory) ) )
[ "Builds", "a", "wheel", "places", "it", "in", "wheel_directory" ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/api.py#L54-L62
[ "def", "build_wheel", "(", "wheel_directory", ",", "config_settings", "=", "None", ",", "metadata_directory", "=", "None", ")", ":", "poetry", "=", "Poetry", ".", "create", "(", "\".\"", ")", "return", "unicode", "(", "WheelBuilder", ".", "make_in", "(", "po...
2d27acd76c165dd49f11934520a7973de7a3762a
train
build_sdist
Builds an sdist, places it in sdist_directory
poetry/masonry/api.py
def build_sdist(sdist_directory, config_settings=None): """Builds an sdist, places it in sdist_directory""" poetry = Poetry.create(".") path = SdistBuilder(poetry, SystemEnv(Path(sys.prefix)), NullIO()).build( Path(sdist_directory) ) return unicode(path.name)
def build_sdist(sdist_directory, config_settings=None): """Builds an sdist, places it in sdist_directory""" poetry = Poetry.create(".") path = SdistBuilder(poetry, SystemEnv(Path(sys.prefix)), NullIO()).build( Path(sdist_directory) ) return unicode(path.name)
[ "Builds", "an", "sdist", "places", "it", "in", "sdist_directory" ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/api.py#L65-L73
[ "def", "build_sdist", "(", "sdist_directory", ",", "config_settings", "=", "None", ")", ":", "poetry", "=", "Poetry", ".", "create", "(", "\".\"", ")", "path", "=", "SdistBuilder", "(", "poetry", ",", "SystemEnv", "(", "Path", "(", "sys", ".", "prefix", ...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Incompatibility.external_incompatibilities
Returns all external incompatibilities in this incompatibility's derivation graph.
poetry/mixology/incompatibility.py
def external_incompatibilities(self): # type: () -> Generator[Incompatibility] """ Returns all external incompatibilities in this incompatibility's derivation graph. """ if isinstance(self._cause, ConflictCause): cause = self._cause # type: ConflictCause ...
def external_incompatibilities(self): # type: () -> Generator[Incompatibility] """ Returns all external incompatibilities in this incompatibility's derivation graph. """ if isinstance(self._cause, ConflictCause): cause = self._cause # type: ConflictCause ...
[ "Returns", "all", "external", "incompatibilities", "in", "this", "incompatibility", "s", "derivation", "graph", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/incompatibility.py#L88-L101
[ "def", "external_incompatibilities", "(", "self", ")", ":", "# type: () -> Generator[Incompatibility]", "if", "isinstance", "(", "self", ".", "_cause", ",", "ConflictCause", ")", ":", "cause", "=", "self", ".", "_cause", "# type: ConflictCause", "for", "incompatibilit...
2d27acd76c165dd49f11934520a7973de7a3762a
train
PartialSolution.decide
Adds an assignment of package as a decision and increments the decision level.
poetry/mixology/partial_solution.py
def decide(self, package): # type: (Package) -> None """ Adds an assignment of package as a decision and increments the decision level. """ # When we make a new decision after backtracking, count an additional # attempted solution. If we backtrack multiple times in a row...
def decide(self, package): # type: (Package) -> None """ Adds an assignment of package as a decision and increments the decision level. """ # When we make a new decision after backtracking, count an additional # attempted solution. If we backtrack multiple times in a row...
[ "Adds", "an", "assignment", "of", "package", "as", "a", "decision", "and", "increments", "the", "decision", "level", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/partial_solution.py#L73-L90
[ "def", "decide", "(", "self", ",", "package", ")", ":", "# type: (Package) -> None", "# When we make a new decision after backtracking, count an additional", "# attempted solution. If we backtrack multiple times in a row, though, we", "# only want to count one, since we haven't actually starte...
2d27acd76c165dd49f11934520a7973de7a3762a
train
PartialSolution.derive
Adds an assignment of package as a derivation.
poetry/mixology/partial_solution.py
def derive( self, dependency, is_positive, cause ): # type: (Dependency, bool, Incompatibility) -> None """ Adds an assignment of package as a derivation. """ self._assign( Assignment.derivation( dependency, is_positive, ...
def derive( self, dependency, is_positive, cause ): # type: (Dependency, bool, Incompatibility) -> None """ Adds an assignment of package as a derivation. """ self._assign( Assignment.derivation( dependency, is_positive, ...
[ "Adds", "an", "assignment", "of", "package", "as", "a", "derivation", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/partial_solution.py#L92-L106
[ "def", "derive", "(", "self", ",", "dependency", ",", "is_positive", ",", "cause", ")", ":", "# type: (Dependency, bool, Incompatibility) -> None", "self", ".", "_assign", "(", "Assignment", ".", "derivation", "(", "dependency", ",", "is_positive", ",", "cause", "...
2d27acd76c165dd49f11934520a7973de7a3762a
train
PartialSolution._assign
Adds an Assignment to _assignments and _positive or _negative.
poetry/mixology/partial_solution.py
def _assign(self, assignment): # type: (Assignment) -> None """ Adds an Assignment to _assignments and _positive or _negative. """ self._assignments.append(assignment) self._register(assignment)
def _assign(self, assignment): # type: (Assignment) -> None """ Adds an Assignment to _assignments and _positive or _negative. """ self._assignments.append(assignment) self._register(assignment)
[ "Adds", "an", "Assignment", "to", "_assignments", "and", "_positive", "or", "_negative", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/partial_solution.py#L108-L113
[ "def", "_assign", "(", "self", ",", "assignment", ")", ":", "# type: (Assignment) -> None", "self", ".", "_assignments", ".", "append", "(", "assignment", ")", "self", ".", "_register", "(", "assignment", ")" ]
2d27acd76c165dd49f11934520a7973de7a3762a
train
PartialSolution.backtrack
Resets the current decision level to decision_level, and removes all assignments made after that level.
poetry/mixology/partial_solution.py
def backtrack(self, decision_level): # type: (int) -> None """ Resets the current decision level to decision_level, and removes all assignments made after that level. """ self._backtracking = True packages = set() while self._assignments[-1].decision_level > dec...
def backtrack(self, decision_level): # type: (int) -> None """ Resets the current decision level to decision_level, and removes all assignments made after that level. """ self._backtracking = True packages = set() while self._assignments[-1].decision_level > dec...
[ "Resets", "the", "current", "decision", "level", "to", "decision_level", "and", "removes", "all", "assignments", "made", "after", "that", "level", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/partial_solution.py#L115-L139
[ "def", "backtrack", "(", "self", ",", "decision_level", ")", ":", "# type: (int) -> None", "self", ".", "_backtracking", "=", "True", "packages", "=", "set", "(", ")", "while", "self", ".", "_assignments", "[", "-", "1", "]", ".", "decision_level", ">", "d...
2d27acd76c165dd49f11934520a7973de7a3762a
train
PartialSolution._register
Registers an Assignment in _positive or _negative.
poetry/mixology/partial_solution.py
def _register(self, assignment): # type: (Assignment) -> None """ Registers an Assignment in _positive or _negative. """ name = assignment.dependency.name old_positive = self._positive.get(name) if old_positive is not None: self._positive[name] = old_positive...
def _register(self, assignment): # type: (Assignment) -> None """ Registers an Assignment in _positive or _negative. """ name = assignment.dependency.name old_positive = self._positive.get(name) if old_positive is not None: self._positive[name] = old_positive...
[ "Registers", "an", "Assignment", "in", "_positive", "or", "_negative", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/partial_solution.py#L141-L169
[ "def", "_register", "(", "self", ",", "assignment", ")", ":", "# type: (Assignment) -> None", "name", "=", "assignment", ".", "dependency", ".", "name", "old_positive", "=", "self", ".", "_positive", ".", "get", "(", "name", ")", "if", "old_positive", "is", ...
2d27acd76c165dd49f11934520a7973de7a3762a
train
PartialSolution.satisfier
Returns the first Assignment in this solution such that the sublist of assignments up to and including that entry collectively satisfies term.
poetry/mixology/partial_solution.py
def satisfier(self, term): # type: (Term) -> Assignment """ Returns the first Assignment in this solution such that the sublist of assignments up to and including that entry collectively satisfies term. """ assigned_term = None # type: Term for assignment in self._assi...
def satisfier(self, term): # type: (Term) -> Assignment """ Returns the first Assignment in this solution such that the sublist of assignments up to and including that entry collectively satisfies term. """ assigned_term = None # type: Term for assignment in self._assi...
[ "Returns", "the", "first", "Assignment", "in", "this", "solution", "such", "that", "the", "sublist", "of", "assignments", "up", "to", "and", "including", "that", "entry", "collectively", "satisfies", "term", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/partial_solution.py#L171-L202
[ "def", "satisfier", "(", "self", ",", "term", ")", ":", "# type: (Term) -> Assignment", "assigned_term", "=", "None", "# type: Term", "for", "assignment", "in", "self", ".", "_assignments", ":", "if", "assignment", ".", "dependency", ".", "name", "!=", "term", ...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Poetry.check
Checks the validity of a configuration
poetry/poetry.py
def check(cls, config, strict=False): # type: (dict, bool) -> Dict[str, List[str]] """ Checks the validity of a configuration """ result = {"errors": [], "warnings": []} # Schema validation errors validation_errors = validate_object(config, "poetry-schema") resu...
def check(cls, config, strict=False): # type: (dict, bool) -> Dict[str, List[str]] """ Checks the validity of a configuration """ result = {"errors": [], "warnings": []} # Schema validation errors validation_errors = validate_object(config, "poetry-schema") resu...
[ "Checks", "the", "validity", "of", "a", "configuration" ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/poetry.py#L220-L265
[ "def", "check", "(", "cls", ",", "config", ",", "strict", "=", "False", ")", ":", "# type: (dict, bool) -> Dict[str, List[str]]", "result", "=", "{", "\"errors\"", ":", "[", "]", ",", "\"warnings\"", ":", "[", "]", "}", "# Schema validation errors", "validation_...
2d27acd76c165dd49f11934520a7973de7a3762a
train
SdistBuilder.find_packages
Discover subpackages and data. It also retrieves necessary files.
poetry/masonry/builders/sdist.py
def find_packages(self, include): """ Discover subpackages and data. It also retrieves necessary files. """ pkgdir = None if include.source is not None: pkgdir = str(include.base) base = str(include.elements[0].parent) pkg_name = include.pac...
def find_packages(self, include): """ Discover subpackages and data. It also retrieves necessary files. """ pkgdir = None if include.source is not None: pkgdir = str(include.base) base = str(include.elements[0].parent) pkg_name = include.pac...
[ "Discover", "subpackages", "and", "data", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/builders/sdist.py#L189-L259
[ "def", "find_packages", "(", "self", ",", "include", ")", ":", "pkgdir", "=", "None", "if", "include", ".", "source", "is", "not", "None", ":", "pkgdir", "=", "str", "(", "include", ".", "base", ")", "base", "=", "str", "(", "include", ".", "elements...
2d27acd76c165dd49f11934520a7973de7a3762a
train
SdistBuilder.clean_tarinfo
Clean metadata from a TarInfo object to make it more reproducible. - Set uid & gid to 0 - Set uname and gname to "" - Normalise permissions to 644 or 755 - Set mtime if not None
poetry/masonry/builders/sdist.py
def clean_tarinfo(cls, tar_info): """ Clean metadata from a TarInfo object to make it more reproducible. - Set uid & gid to 0 - Set uname and gname to "" - Normalise permissions to 644 or 755 - Set mtime if not None """ ti = copy(tar_info)...
def clean_tarinfo(cls, tar_info): """ Clean metadata from a TarInfo object to make it more reproducible. - Set uid & gid to 0 - Set uname and gname to "" - Normalise permissions to 644 or 755 - Set mtime if not None """ ti = copy(tar_info)...
[ "Clean", "metadata", "from", "a", "TarInfo", "object", "to", "make", "it", "more", "reproducible", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/builders/sdist.py#L321-L337
[ "def", "clean_tarinfo", "(", "cls", ",", "tar_info", ")", ":", "ti", "=", "copy", "(", "tar_info", ")", "ti", ".", "uid", "=", "0", "ti", ".", "gid", "=", "0", "ti", ".", "uname", "=", "\"\"", "ti", ".", "gname", "=", "\"\"", "ti", ".", "mode",...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Shell.get
Retrieve the current shell.
poetry/utils/shell.py
def get(cls): # type: () -> Shell """ Retrieve the current shell. """ if cls._shell is not None: return cls._shell try: name, path = detect_shell(os.getpid()) except (RuntimeError, ShellDetectionFailure): raise RuntimeError("Unable to...
def get(cls): # type: () -> Shell """ Retrieve the current shell. """ if cls._shell is not None: return cls._shell try: name, path = detect_shell(os.getpid()) except (RuntimeError, ShellDetectionFailure): raise RuntimeError("Unable to...
[ "Retrieve", "the", "current", "shell", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/utils/shell.py#L27-L41
[ "def", "get", "(", "cls", ")", ":", "# type: () -> Shell", "if", "cls", ".", "_shell", "is", "not", "None", ":", "return", "cls", ".", "_shell", "try", ":", "name", ",", "path", "=", "detect_shell", "(", "os", ".", "getpid", "(", ")", ")", "except", ...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Provider.search_for
Search for the specifications that match the given dependency. The specifications in the returned list will be considered in reverse order, so the latest version ought to be last.
poetry/puzzle/provider.py
def search_for(self, dependency): # type: (Dependency) -> List[Package] """ Search for the specifications that match the given dependency. The specifications in the returned list will be considered in reverse order, so the latest version ought to be last. """ if depende...
def search_for(self, dependency): # type: (Dependency) -> List[Package] """ Search for the specifications that match the given dependency. The specifications in the returned list will be considered in reverse order, so the latest version ought to be last. """ if depende...
[ "Search", "for", "the", "specifications", "that", "match", "the", "given", "dependency", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/puzzle/provider.py#L100-L158
[ "def", "search_for", "(", "self", ",", "dependency", ")", ":", "# type: (Dependency) -> List[Package]", "if", "dependency", ".", "is_root", ":", "return", "PackageCollection", "(", "dependency", ",", "[", "self", ".", "_package", "]", ")", "for", "constraint", "...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Provider.search_for_vcs
Search for the specifications that match the given VCS dependency. Basically, we clone the repository in a temporary directory and get the information we need by checking out the specified reference.
poetry/puzzle/provider.py
def search_for_vcs(self, dependency): # type: (VCSDependency) -> List[Package] """ Search for the specifications that match the given VCS dependency. Basically, we clone the repository in a temporary directory and get the information we need by checking out the specified reference. ...
def search_for_vcs(self, dependency): # type: (VCSDependency) -> List[Package] """ Search for the specifications that match the given VCS dependency. Basically, we clone the repository in a temporary directory and get the information we need by checking out the specified reference. ...
[ "Search", "for", "the", "specifications", "that", "match", "the", "given", "VCS", "dependency", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/puzzle/provider.py#L160-L200
[ "def", "search_for_vcs", "(", "self", ",", "dependency", ")", ":", "# type: (VCSDependency) -> List[Package]", "if", "dependency", ".", "vcs", "!=", "\"git\"", ":", "raise", "ValueError", "(", "\"Unsupported VCS dependency {}\"", ".", "format", "(", "dependency", ".",...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Provider.incompatibilities_for
Returns incompatibilities that encapsulate a given package's dependencies, or that it can't be safely selected. If multiple subsequent versions of this package have the same dependencies, this will return incompatibilities that reflect that. It won't return incompatibilities that have a...
poetry/puzzle/provider.py
def incompatibilities_for( self, package ): # type: (DependencyPackage) -> List[Incompatibility] """ Returns incompatibilities that encapsulate a given package's dependencies, or that it can't be safely selected. If multiple subsequent versions of this package have the same...
def incompatibilities_for( self, package ): # type: (DependencyPackage) -> List[Incompatibility] """ Returns incompatibilities that encapsulate a given package's dependencies, or that it can't be safely selected. If multiple subsequent versions of this package have the same...
[ "Returns", "incompatibilities", "that", "encapsulate", "a", "given", "package", "s", "dependencies", "or", "that", "it", "can", "t", "be", "safely", "selected", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/puzzle/provider.py#L393-L449
[ "def", "incompatibilities_for", "(", "self", ",", "package", ")", ":", "# type: (DependencyPackage) -> List[Incompatibility]", "if", "package", ".", "is_root", "(", ")", ":", "dependencies", "=", "package", ".", "all_requires", "else", ":", "dependencies", "=", "pac...
2d27acd76c165dd49f11934520a7973de7a3762a
train
VersionSolver.solve
Finds a set of dependencies that match the root package's constraints, or raises an error if no such set is available.
poetry/mixology/version_solver.py
def solve(self): # type: () -> SolverResult """ Finds a set of dependencies that match the root package's constraints, or raises an error if no such set is available. """ start = time.time() root_dependency = Dependency(self._root.name, self._root.version) root_d...
def solve(self): # type: () -> SolverResult """ Finds a set of dependencies that match the root package's constraints, or raises an error if no such set is available. """ start = time.time() root_dependency = Dependency(self._root.name, self._root.version) root_d...
[ "Finds", "a", "set", "of", "dependencies", "that", "match", "the", "root", "package", "s", "constraints", "or", "raises", "an", "error", "if", "no", "such", "set", "is", "available", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/version_solver.py#L62-L90
[ "def", "solve", "(", "self", ")", ":", "# type: () -> SolverResult", "start", "=", "time", ".", "time", "(", ")", "root_dependency", "=", "Dependency", "(", "self", ".", "_root", ".", "name", ",", "self", ".", "_root", ".", "version", ")", "root_dependency...
2d27acd76c165dd49f11934520a7973de7a3762a
train
VersionSolver._propagate
Performs unit propagation on incompatibilities transitively related to package to derive new assignments for _solution.
poetry/mixology/version_solver.py
def _propagate(self, package): # type: (str) -> None """ Performs unit propagation on incompatibilities transitively related to package to derive new assignments for _solution. """ changed = set() changed.add(package) while changed: package = changed...
def _propagate(self, package): # type: (str) -> None """ Performs unit propagation on incompatibilities transitively related to package to derive new assignments for _solution. """ changed = set() changed.add(package) while changed: package = changed...
[ "Performs", "unit", "propagation", "on", "incompatibilities", "transitively", "related", "to", "package", "to", "derive", "new", "assignments", "for", "_solution", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/version_solver.py#L92-L127
[ "def", "_propagate", "(", "self", ",", "package", ")", ":", "# type: (str) -> None", "changed", "=", "set", "(", ")", "changed", ".", "add", "(", "package", ")", "while", "changed", ":", "package", "=", "changed", ".", "pop", "(", ")", "# Iterate in revers...
2d27acd76c165dd49f11934520a7973de7a3762a
train
VersionSolver._propagate_incompatibility
If incompatibility is almost satisfied by _solution, adds the negation of the unsatisfied term to _solution. If incompatibility is satisfied by _solution, returns _conflict. If incompatibility is almost satisfied by _solution, returns the unsatisfied term's package name. Otherw...
poetry/mixology/version_solver.py
def _propagate_incompatibility( self, incompatibility ): # type: (Incompatibility) -> Union[str, _conflict, None] """ If incompatibility is almost satisfied by _solution, adds the negation of the unsatisfied term to _solution. If incompatibility is satisfied by _solution, r...
def _propagate_incompatibility( self, incompatibility ): # type: (Incompatibility) -> Union[str, _conflict, None] """ If incompatibility is almost satisfied by _solution, adds the negation of the unsatisfied term to _solution. If incompatibility is satisfied by _solution, r...
[ "If", "incompatibility", "is", "almost", "satisfied", "by", "_solution", "adds", "the", "negation", "of", "the", "unsatisfied", "term", "to", "_solution", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/version_solver.py#L129-L181
[ "def", "_propagate_incompatibility", "(", "self", ",", "incompatibility", ")", ":", "# type: (Incompatibility) -> Union[str, _conflict, None]", "# The first entry in incompatibility.terms that's not yet satisfied by", "# _solution, if one exists. If we find more than one, _solution is", "# inc...
2d27acd76c165dd49f11934520a7973de7a3762a
train
VersionSolver._resolve_conflict
Given an incompatibility that's satisfied by _solution, The `conflict resolution`_ constructs a new incompatibility that encapsulates the root cause of the conflict and backtracks _solution until the new incompatibility will allow _propagate() to deduce new assignments. Adds the new inc...
poetry/mixology/version_solver.py
def _resolve_conflict( self, incompatibility ): # type: (Incompatibility) -> Incompatibility """ Given an incompatibility that's satisfied by _solution, The `conflict resolution`_ constructs a new incompatibility that encapsulates the root cause of the conflict and backtrack...
def _resolve_conflict( self, incompatibility ): # type: (Incompatibility) -> Incompatibility """ Given an incompatibility that's satisfied by _solution, The `conflict resolution`_ constructs a new incompatibility that encapsulates the root cause of the conflict and backtrack...
[ "Given", "an", "incompatibility", "that", "s", "satisfied", "by", "_solution", "The", "conflict", "resolution", "_", "constructs", "a", "new", "incompatibility", "that", "encapsulates", "the", "root", "cause", "of", "the", "conflict", "and", "backtracks", "_soluti...
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/version_solver.py#L183-L316
[ "def", "_resolve_conflict", "(", "self", ",", "incompatibility", ")", ":", "# type: (Incompatibility) -> Incompatibility", "self", ".", "_log", "(", "\"conflict: {}\"", ".", "format", "(", "incompatibility", ")", ")", "new_incompatibility", "=", "False", "while", "not...
2d27acd76c165dd49f11934520a7973de7a3762a
train
VersionSolver._choose_package_version
Tries to select a version of a required package. Returns the name of the package whose incompatibilities should be propagated by _propagate(), or None indicating that version solving is complete and a solution has been found.
poetry/mixology/version_solver.py
def _choose_package_version(self): # type: () -> Union[str, None] """ Tries to select a version of a required package. Returns the name of the package whose incompatibilities should be propagated by _propagate(), or None indicating that version solving is complete and a solutio...
def _choose_package_version(self): # type: () -> Union[str, None] """ Tries to select a version of a required package. Returns the name of the package whose incompatibilities should be propagated by _propagate(), or None indicating that version solving is complete and a solutio...
[ "Tries", "to", "select", "a", "version", "of", "a", "required", "package", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/version_solver.py#L318-L402
[ "def", "_choose_package_version", "(", "self", ")", ":", "# type: () -> Union[str, None]", "unsatisfied", "=", "self", ".", "_solution", ".", "unsatisfied", "if", "not", "unsatisfied", ":", "return", "# Prefer packages with as few remaining versions as possible,", "# so that ...
2d27acd76c165dd49f11934520a7973de7a3762a
train
VersionSolver._result
Creates a #SolverResult from the decisions in _solution
poetry/mixology/version_solver.py
def _result(self): # type: () -> SolverResult """ Creates a #SolverResult from the decisions in _solution """ decisions = self._solution.decisions return SolverResult( self._root, [p for p in decisions if not p.is_root()], self._solution.atte...
def _result(self): # type: () -> SolverResult """ Creates a #SolverResult from the decisions in _solution """ decisions = self._solution.decisions return SolverResult( self._root, [p for p in decisions if not p.is_root()], self._solution.atte...
[ "Creates", "a", "#SolverResult", "from", "the", "decisions", "in", "_solution" ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/version_solver.py#L407-L417
[ "def", "_result", "(", "self", ")", ":", "# type: () -> SolverResult", "decisions", "=", "self", ".", "_solution", ".", "decisions", "return", "SolverResult", "(", "self", ".", "_root", ",", "[", "p", "for", "p", "in", "decisions", "if", "not", "p", ".", ...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Env.run
Run a command inside the Python environment.
poetry/utils/env.py
def run(self, bin, *args, **kwargs): """ Run a command inside the Python environment. """ bin = self._bin(bin) cmd = [bin] + list(args) shell = kwargs.get("shell", False) call = kwargs.pop("call", False) input_ = kwargs.pop("input_", None) if she...
def run(self, bin, *args, **kwargs): """ Run a command inside the Python environment. """ bin = self._bin(bin) cmd = [bin] + list(args) shell = kwargs.get("shell", False) call = kwargs.pop("call", False) input_ = kwargs.pop("input_", None) if she...
[ "Run", "a", "command", "inside", "the", "Python", "environment", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/utils/env.py#L345-L381
[ "def", "run", "(", "self", ",", "bin", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "bin", "=", "self", ".", "_bin", "(", "bin", ")", "cmd", "=", "[", "bin", "]", "+", "list", "(", "args", ")", "shell", "=", "kwargs", ".", "get", "(...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Env._bin
Return path to the given executable.
poetry/utils/env.py
def _bin(self, bin): # type: (str) -> str """ Return path to the given executable. """ bin_path = (self._bin_dir / bin).with_suffix(".exe" if self._is_windows else "") if not bin_path.exists(): return bin return str(bin_path)
def _bin(self, bin): # type: (str) -> str """ Return path to the given executable. """ bin_path = (self._bin_dir / bin).with_suffix(".exe" if self._is_windows else "") if not bin_path.exists(): return bin return str(bin_path)
[ "Return", "path", "to", "the", "given", "executable", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/utils/env.py#L391-L399
[ "def", "_bin", "(", "self", ",", "bin", ")", ":", "# type: (str) -> str", "bin_path", "=", "(", "self", ".", "_bin_dir", "/", "bin", ")", ".", "with_suffix", "(", "\".exe\"", "if", "self", ".", "_is_windows", "else", "\"\"", ")", "if", "not", "bin_path",...
2d27acd76c165dd49f11934520a7973de7a3762a
train
format_python_constraint
This helper will help in transforming disjunctive constraint into proper constraint.
poetry/version/helpers.py
def format_python_constraint(constraint): """ This helper will help in transforming disjunctive constraint into proper constraint. """ if isinstance(constraint, Version): if constraint.precision >= 3: return "=={}".format(str(constraint)) # Transform 3.6 or 3 if ...
def format_python_constraint(constraint): """ This helper will help in transforming disjunctive constraint into proper constraint. """ if isinstance(constraint, Version): if constraint.precision >= 3: return "=={}".format(str(constraint)) # Transform 3.6 or 3 if ...
[ "This", "helper", "will", "help", "in", "transforming", "disjunctive", "constraint", "into", "proper", "constraint", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/version/helpers.py#L19-L56
[ "def", "format_python_constraint", "(", "constraint", ")", ":", "if", "isinstance", "(", "constraint", ",", "Version", ")", ":", "if", "constraint", ".", "precision", ">=", "3", ":", "return", "\"=={}\"", ".", "format", "(", "str", "(", "constraint", ")", ...
2d27acd76c165dd49f11934520a7973de7a3762a
train
get_abbr_impl
Return abbreviated implementation name.
poetry/masonry/utils/tags.py
def get_abbr_impl(env): """Return abbreviated implementation name.""" impl = env.python_implementation if impl == "PyPy": return "pp" elif impl == "Jython": return "jy" elif impl == "IronPython": return "ip" elif impl == "CPython": return "cp" raise LookupEr...
def get_abbr_impl(env): """Return abbreviated implementation name.""" impl = env.python_implementation if impl == "PyPy": return "pp" elif impl == "Jython": return "jy" elif impl == "IronPython": return "ip" elif impl == "CPython": return "cp" raise LookupEr...
[ "Return", "abbreviated", "implementation", "name", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/utils/tags.py#L15-L28
[ "def", "get_abbr_impl", "(", "env", ")", ":", "impl", "=", "env", ".", "python_implementation", "if", "impl", "==", "\"PyPy\"", ":", "return", "\"pp\"", "elif", "impl", "==", "\"Jython\"", ":", "return", "\"jy\"", "elif", "impl", "==", "\"IronPython\"", ":",...
2d27acd76c165dd49f11934520a7973de7a3762a
train
get_impl_ver
Return implementation version.
poetry/masonry/utils/tags.py
def get_impl_ver(env): """Return implementation version.""" impl_ver = env.config_var("py_version_nodot") if not impl_ver or get_abbr_impl(env) == "pp": impl_ver = "".join(map(str, get_impl_version_info(env))) return impl_ver
def get_impl_ver(env): """Return implementation version.""" impl_ver = env.config_var("py_version_nodot") if not impl_ver or get_abbr_impl(env) == "pp": impl_ver = "".join(map(str, get_impl_version_info(env))) return impl_ver
[ "Return", "implementation", "version", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/utils/tags.py#L31-L37
[ "def", "get_impl_ver", "(", "env", ")", ":", "impl_ver", "=", "env", ".", "config_var", "(", "\"py_version_nodot\"", ")", "if", "not", "impl_ver", "or", "get_abbr_impl", "(", "env", ")", "==", "\"pp\"", ":", "impl_ver", "=", "\"\"", ".", "join", "(", "ma...
2d27acd76c165dd49f11934520a7973de7a3762a
train
get_flag
Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.
poetry/masonry/utils/tags.py
def get_flag(env, var, fallback, expected=True, warn=True): """Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.""" val = env.config_var(var) if val is None: if warn: warnings.warn( "Config variable '{0}' is unset, Pyt...
def get_flag(env, var, fallback, expected=True, warn=True): """Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.""" val = env.config_var(var) if val is None: if warn: warnings.warn( "Config variable '{0}' is unset, Pyt...
[ "Use", "a", "fallback", "method", "for", "determining", "SOABI", "flags", "if", "the", "needed", "config", "var", "is", "unset", "or", "unavailable", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/utils/tags.py#L50-L63
[ "def", "get_flag", "(", "env", ",", "var", ",", "fallback", ",", "expected", "=", "True", ",", "warn", "=", "True", ")", ":", "val", "=", "env", ".", "config_var", "(", "var", ")", "if", "val", "is", "None", ":", "if", "warn", ":", "warnings", "....
2d27acd76c165dd49f11934520a7973de7a3762a
train
Dependency.accepts
Determines if the given package matches this dependency.
poetry/packages/dependency.py
def accepts(self, package): # type: (poetry.packages.Package) -> bool """ Determines if the given package matches this dependency. """ return ( self._name == package.name and self._constraint.allows(package.version) and (not package.is_prerelease() or...
def accepts(self, package): # type: (poetry.packages.Package) -> bool """ Determines if the given package matches this dependency. """ return ( self._name == package.name and self._constraint.allows(package.version) and (not package.is_prerelease() or...
[ "Determines", "if", "the", "given", "package", "matches", "this", "dependency", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/packages/dependency.py#L166-L174
[ "def", "accepts", "(", "self", ",", "package", ")", ":", "# type: (poetry.packages.Package) -> bool", "return", "(", "self", ".", "_name", "==", "package", ".", "name", "and", "self", ".", "_constraint", ".", "allows", "(", "package", ".", "version", ")", "a...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Dependency.deactivate
Set the dependency as optional.
poetry/packages/dependency.py
def deactivate(self): """ Set the dependency as optional. """ if not self._optional: self._optional = True self._activated = False
def deactivate(self): """ Set the dependency as optional. """ if not self._optional: self._optional = True self._activated = False
[ "Set", "the", "dependency", "as", "optional", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/packages/dependency.py#L282-L289
[ "def", "deactivate", "(", "self", ")", ":", "if", "not", "self", ".", "_optional", ":", "self", ".", "_optional", "=", "True", "self", ".", "_activated", "=", "False" ]
2d27acd76c165dd49f11934520a7973de7a3762a
train
Installer.install
Installs Poetry in $POETRY_HOME.
get-poetry.py
def install(self, version, upgrade=False): """ Installs Poetry in $POETRY_HOME. """ print("Installing version: " + colorize("info", version)) self.make_lib(version) self.make_bin() self.make_env() self.update_path() return 0
def install(self, version, upgrade=False): """ Installs Poetry in $POETRY_HOME. """ print("Installing version: " + colorize("info", version)) self.make_lib(version) self.make_bin() self.make_env() self.update_path() return 0
[ "Installs", "Poetry", "in", "$POETRY_HOME", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/get-poetry.py#L453-L464
[ "def", "install", "(", "self", ",", "version", ",", "upgrade", "=", "False", ")", ":", "print", "(", "\"Installing version: \"", "+", "colorize", "(", "\"info\"", ",", "version", ")", ")", "self", ".", "make_lib", "(", "version", ")", "self", ".", "make_...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Installer.make_lib
Packs everything into a single lib/ directory.
get-poetry.py
def make_lib(self, version): """ Packs everything into a single lib/ directory. """ if os.path.exists(POETRY_LIB_BACKUP): shutil.rmtree(POETRY_LIB_BACKUP) # Backup the current installation if os.path.exists(POETRY_LIB): shutil.copytree(POETRY_LIB,...
def make_lib(self, version): """ Packs everything into a single lib/ directory. """ if os.path.exists(POETRY_LIB_BACKUP): shutil.rmtree(POETRY_LIB_BACKUP) # Backup the current installation if os.path.exists(POETRY_LIB): shutil.copytree(POETRY_LIB,...
[ "Packs", "everything", "into", "a", "single", "lib", "/", "directory", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/get-poetry.py#L466-L490
[ "def", "make_lib", "(", "self", ",", "version", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "POETRY_LIB_BACKUP", ")", ":", "shutil", ".", "rmtree", "(", "POETRY_LIB_BACKUP", ")", "# Backup the current installation", "if", "os", ".", "path", ".", ...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Installer.update_path
Tries to update the $PATH automatically.
get-poetry.py
def update_path(self): """ Tries to update the $PATH automatically. """ if WINDOWS: return self.add_to_windows_path() # Updating any profile we can on UNIX systems export_string = self.get_export_string() addition = "\n{}\n".format(export_string) ...
def update_path(self): """ Tries to update the $PATH automatically. """ if WINDOWS: return self.add_to_windows_path() # Updating any profile we can on UNIX systems export_string = self.get_export_string() addition = "\n{}\n".format(export_string) ...
[ "Tries", "to", "update", "the", "$PATH", "automatically", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/get-poetry.py#L588-L613
[ "def", "update_path", "(", "self", ")", ":", "if", "WINDOWS", ":", "return", "self", ".", "add_to_windows_path", "(", ")", "# Updating any profile we can on UNIX systems", "export_string", "=", "self", ".", "get_export_string", "(", ")", "addition", "=", "\"\\n{}\\n...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Term.satisfies
Returns whether this term satisfies another.
poetry/mixology/term.py
def satisfies(self, other): # type: (Term) -> bool """ Returns whether this term satisfies another. """ return ( self.dependency.name == other.dependency.name and self.relation(other) == SetRelation.SUBSET )
def satisfies(self, other): # type: (Term) -> bool """ Returns whether this term satisfies another. """ return ( self.dependency.name == other.dependency.name and self.relation(other) == SetRelation.SUBSET )
[ "Returns", "whether", "this", "term", "satisfies", "another", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/term.py#L36-L43
[ "def", "satisfies", "(", "self", ",", "other", ")", ":", "# type: (Term) -> bool", "return", "(", "self", ".", "dependency", ".", "name", "==", "other", ".", "dependency", ".", "name", "and", "self", ".", "relation", "(", "other", ")", "==", "SetRelation",...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Term.relation
Returns the relationship between the package versions allowed by this term and another.
poetry/mixology/term.py
def relation(self, other): # type: (Term) -> int """ Returns the relationship between the package versions allowed by this term and another. """ if self.dependency.name != other.dependency.name: raise ValueError( "{} should refer to {}".format(other, ...
def relation(self, other): # type: (Term) -> int """ Returns the relationship between the package versions allowed by this term and another. """ if self.dependency.name != other.dependency.name: raise ValueError( "{} should refer to {}".format(other, ...
[ "Returns", "the", "relationship", "between", "the", "package", "versions", "allowed", "by", "this", "term", "and", "another", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/term.py#L45-L107
[ "def", "relation", "(", "self", ",", "other", ")", ":", "# type: (Term) -> int", "if", "self", ".", "dependency", ".", "name", "!=", "other", ".", "dependency", ".", "name", ":", "raise", "ValueError", "(", "\"{} should refer to {}\"", ".", "format", "(", "o...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Term.intersect
Returns a Term that represents the packages allowed by both this term and another
poetry/mixology/term.py
def intersect(self, other): # type: (Term) -> Union[Term, None] """ Returns a Term that represents the packages allowed by both this term and another """ if self.dependency.name != other.dependency.name: raise ValueError( "{} should refer to {}".forma...
def intersect(self, other): # type: (Term) -> Union[Term, None] """ Returns a Term that represents the packages allowed by both this term and another """ if self.dependency.name != other.dependency.name: raise ValueError( "{} should refer to {}".forma...
[ "Returns", "a", "Term", "that", "represents", "the", "packages", "allowed", "by", "both", "this", "term", "and", "another" ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/mixology/term.py#L109-L141
[ "def", "intersect", "(", "self", ",", "other", ")", ":", "# type: (Term) -> Union[Term, None]", "if", "self", ".", "dependency", ".", "name", "!=", "other", ".", "dependency", ".", "name", ":", "raise", "ValueError", "(", "\"{} should refer to {}\"", ".", "forma...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Builder.find_files_to_add
Finds all files to add to the tarball
poetry/masonry/builders/builder.py
def find_files_to_add(self, exclude_build=True): # type: (bool) -> list """ Finds all files to add to the tarball """ to_add = [] for include in self._module.includes: for file in include.elements: if "__pycache__" in str(file): c...
def find_files_to_add(self, exclude_build=True): # type: (bool) -> list """ Finds all files to add to the tarball """ to_add = [] for include in self._module.includes: for file in include.elements: if "__pycache__" in str(file): c...
[ "Finds", "all", "files", "to", "add", "to", "the", "tarball" ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/builders/builder.py#L89-L156
[ "def", "find_files_to_add", "(", "self", ",", "exclude_build", "=", "True", ")", ":", "# type: (bool) -> list", "to_add", "=", "[", "]", "for", "include", "in", "self", ".", "_module", ".", "includes", ":", "for", "file", "in", "include", ".", "elements", ...
2d27acd76c165dd49f11934520a7973de7a3762a
train
parse
Parse the given version string and return either a :class:`Version` object or a LegacyVersion object depending on if the given version is a valid PEP 440 version or a legacy version. If strict=True only PEP 440 versions will be accepted.
poetry/version/__init__.py
def parse( version, strict=False # type: str # type: bool ): # type:(...) -> Union[Version, LegacyVersion] """ Parse the given version string and return either a :class:`Version` object or a LegacyVersion object depending on if the given version is a valid PEP 440 version or a legacy version. ...
def parse( version, strict=False # type: str # type: bool ): # type:(...) -> Union[Version, LegacyVersion] """ Parse the given version string and return either a :class:`Version` object or a LegacyVersion object depending on if the given version is a valid PEP 440 version or a legacy version. ...
[ "Parse", "the", "given", "version", "string", "and", "return", "either", "a", ":", "class", ":", "Version", "object", "or", "a", "LegacyVersion", "object", "depending", "on", "if", "the", "given", "version", "is", "a", "valid", "PEP", "440", "version", "or...
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/version/__init__.py#L28-L44
[ "def", "parse", "(", "version", ",", "strict", "=", "False", "# type: str # type: bool", ")", ":", "# type:(...) -> Union[Version, LegacyVersion]", "try", ":", "return", "Version", "(", "version", ")", "except", "InvalidVersion", ":", "if", "strict", ":", "raise", ...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Locker.is_fresh
Checks whether the lock file is still up to date with the current hash.
poetry/packages/locker.py
def is_fresh(self): # type: () -> bool """ Checks whether the lock file is still up to date with the current hash. """ lock = self._lock.read() metadata = lock.get("metadata", {}) if "content-hash" in metadata: return self._content_hash == lock["metadata"]["...
def is_fresh(self): # type: () -> bool """ Checks whether the lock file is still up to date with the current hash. """ lock = self._lock.read() metadata = lock.get("metadata", {}) if "content-hash" in metadata: return self._content_hash == lock["metadata"]["...
[ "Checks", "whether", "the", "lock", "file", "is", "still", "up", "to", "date", "with", "the", "current", "hash", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/packages/locker.py#L45-L55
[ "def", "is_fresh", "(", "self", ")", ":", "# type: () -> bool", "lock", "=", "self", ".", "_lock", ".", "read", "(", ")", "metadata", "=", "lock", ".", "get", "(", "\"metadata\"", ",", "{", "}", ")", "if", "\"content-hash\"", "in", "metadata", ":", "re...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Locker.locked_repository
Searches and returns a repository of locked packages.
poetry/packages/locker.py
def locked_repository( self, with_dev_reqs=False ): # type: (bool) -> poetry.repositories.Repository """ Searches and returns a repository of locked packages. """ if not self.is_locked(): return poetry.repositories.Repository() lock_data = self.lock_data...
def locked_repository( self, with_dev_reqs=False ): # type: (bool) -> poetry.repositories.Repository """ Searches and returns a repository of locked packages. """ if not self.is_locked(): return poetry.repositories.Repository() lock_data = self.lock_data...
[ "Searches", "and", "returns", "a", "repository", "of", "locked", "packages", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/packages/locker.py#L57-L121
[ "def", "locked_repository", "(", "self", ",", "with_dev_reqs", "=", "False", ")", ":", "# type: (bool) -> poetry.repositories.Repository", "if", "not", "self", ".", "is_locked", "(", ")", ":", "return", "poetry", ".", "repositories", ".", "Repository", "(", ")", ...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Locker._get_content_hash
Returns the sha256 hash of the sorted content of the pyproject file.
poetry/packages/locker.py
def _get_content_hash(self): # type: () -> str """ Returns the sha256 hash of the sorted content of the pyproject file. """ content = self._local_config relevant_content = {} for key in self._relevant_keys: relevant_content[key] = content.get(key) c...
def _get_content_hash(self): # type: () -> str """ Returns the sha256 hash of the sorted content of the pyproject file. """ content = self._local_config relevant_content = {} for key in self._relevant_keys: relevant_content[key] = content.get(key) c...
[ "Returns", "the", "sha256", "hash", "of", "the", "sorted", "content", "of", "the", "pyproject", "file", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/packages/locker.py#L165-L179
[ "def", "_get_content_hash", "(", "self", ")", ":", "# type: () -> str", "content", "=", "self", ".", "_local_config", "relevant_content", "=", "{", "}", "for", "key", "in", "self", ".", "_relevant_keys", ":", "relevant_content", "[", "key", "]", "=", "content"...
2d27acd76c165dd49f11934520a7973de7a3762a
train
InstalledRepository.load
Load installed packages. For now, it uses the pip "freeze" command.
poetry/repositories/installed_repository.py
def load(cls, env): # type: (Env) -> InstalledRepository """ Load installed packages. For now, it uses the pip "freeze" command. """ repo = cls() freeze_output = env.run("pip", "freeze") for line in freeze_output.split("\n"): if "==" in line: ...
def load(cls, env): # type: (Env) -> InstalledRepository """ Load installed packages. For now, it uses the pip "freeze" command. """ repo = cls() freeze_output = env.run("pip", "freeze") for line in freeze_output.split("\n"): if "==" in line: ...
[ "Load", "installed", "packages", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/repositories/installed_repository.py#L11-L44
[ "def", "load", "(", "cls", ",", "env", ")", ":", "# type: (Env) -> InstalledRepository", "repo", "=", "cls", "(", ")", "freeze_output", "=", "env", ".", "run", "(", "\"pip\"", ",", "\"freeze\"", ")", "for", "line", "in", "freeze_output", ".", "split", "(",...
2d27acd76c165dd49f11934520a7973de7a3762a
train
VersionSelector.find_best_candidate
Given a package name and optional version, returns the latest Package that matches
poetry/version/version_selector.py
def find_best_candidate( self, package_name, # type: str target_package_version=None, # type: Union[str, None] allow_prereleases=False, # type: bool ): # type: (...) -> Union[Package, bool] """ Given a package name and optional version, returns the latest...
def find_best_candidate( self, package_name, # type: str target_package_version=None, # type: Union[str, None] allow_prereleases=False, # type: bool ): # type: (...) -> Union[Package, bool] """ Given a package name and optional version, returns the latest...
[ "Given", "a", "package", "name", "and", "optional", "version", "returns", "the", "latest", "Package", "that", "matches" ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/version/version_selector.py#L13-L47
[ "def", "find_best_candidate", "(", "self", ",", "package_name", ",", "# type: str", "target_package_version", "=", "None", ",", "# type: Union[str, None]", "allow_prereleases", "=", "False", ",", "# type: bool", ")", ":", "# type: (...) -> Union[Package, bool]", "if", "t...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Page.clean_link
Makes sure a link is fully encoded. That is, if a ' ' shows up in the link, it will be rewritten to %20 (while not over-quoting % or other characters).
poetry/repositories/legacy_repository.py
def clean_link(self, url): """Makes sure a link is fully encoded. That is, if a ' ' shows up in the link, it will be rewritten to %20 (while not over-quoting % or other characters).""" return self._clean_re.sub(lambda match: "%%%2x" % ord(match.group(0)), url)
def clean_link(self, url): """Makes sure a link is fully encoded. That is, if a ' ' shows up in the link, it will be rewritten to %20 (while not over-quoting % or other characters).""" return self._clean_re.sub(lambda match: "%%%2x" % ord(match.group(0)), url)
[ "Makes", "sure", "a", "link", "is", "fully", "encoded", ".", "That", "is", "if", "a", "shows", "up", "in", "the", "link", "it", "will", "be", "rewritten", "to", "%20", "(", "while", "not", "over", "-", "quoting", "%", "or", "other", "characters", ")"...
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/repositories/legacy_repository.py#L143-L147
[ "def", "clean_link", "(", "self", ",", "url", ")", ":", "return", "self", ".", "_clean_re", ".", "sub", "(", "lambda", "match", ":", "\"%%%2x\"", "%", "ord", "(", "match", ".", "group", "(", "0", ")", ")", ",", "url", ")" ]
2d27acd76c165dd49f11934520a7973de7a3762a
train
LegacyRepository.package
Retrieve the release information. This is a heavy task which takes time. We have to download a package to get the dependencies. We also need to download every file matching this release to get the various hashes. Note that, this will be cached so the subsequent operations ...
poetry/repositories/legacy_repository.py
def package( self, name, version, extras=None ): # type: (...) -> poetry.packages.Package """ Retrieve the release information. This is a heavy task which takes time. We have to download a package to get the dependencies. We also need to download every file matching...
def package( self, name, version, extras=None ): # type: (...) -> poetry.packages.Package """ Retrieve the release information. This is a heavy task which takes time. We have to download a package to get the dependencies. We also need to download every file matching...
[ "Retrieve", "the", "release", "information", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/repositories/legacy_repository.py#L246-L325
[ "def", "package", "(", "self", ",", "name", ",", "version", ",", "extras", "=", "None", ")", ":", "# type: (...) -> poetry.packages.Package", "try", ":", "index", "=", "self", ".", "_packages", ".", "index", "(", "poetry", ".", "packages", ".", "Package", ...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Command.run
Initialize command.
poetry/console/commands/command.py
def run(self, i, o): # type: () -> int """ Initialize command. """ self.input = i self.output = PoetryStyle(i, o) for logger in self._loggers: self.register_logger(logging.getLogger(logger)) return super(BaseCommand, self).run(i, o)
def run(self, i, o): # type: () -> int """ Initialize command. """ self.input = i self.output = PoetryStyle(i, o) for logger in self._loggers: self.register_logger(logging.getLogger(logger)) return super(BaseCommand, self).run(i, o)
[ "Initialize", "command", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/console/commands/command.py#L67-L77
[ "def", "run", "(", "self", ",", "i", ",", "o", ")", ":", "# type: () -> int", "self", ".", "input", "=", "i", "self", ".", "output", "=", "PoetryStyle", "(", "i", ",", "o", ")", "for", "logger", "in", "self", ".", "_loggers", ":", "self", ".", "r...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Command.register_logger
Register a new logger.
poetry/console/commands/command.py
def register_logger(self, logger): """ Register a new logger. """ handler = CommandHandler(self) handler.setFormatter(CommandFormatter()) logger.handlers = [handler] logger.propagate = False output = self.output level = logging.WARNING if ...
def register_logger(self, logger): """ Register a new logger. """ handler = CommandHandler(self) handler.setFormatter(CommandFormatter()) logger.handlers = [handler] logger.propagate = False output = self.output level = logging.WARNING if ...
[ "Register", "a", "new", "logger", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/console/commands/command.py#L79-L95
[ "def", "register_logger", "(", "self", ",", "logger", ")", ":", "handler", "=", "CommandHandler", "(", "self", ")", "handler", ".", "setFormatter", "(", "CommandFormatter", "(", ")", ")", "logger", ".", "handlers", "=", "[", "handler", "]", "logger", ".", ...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Uploader._register
Register a package to a repository.
poetry/masonry/publishing/uploader.py
def _register(self, session, url): """ Register a package to a repository. """ dist = self._poetry.file.parent / "dist" file = dist / "{}-{}.tar.gz".format( self._package.name, normalize_version(self._package.version.text) ) if not file.exists(): ...
def _register(self, session, url): """ Register a package to a repository. """ dist = self._poetry.file.parent / "dist" file = dist / "{}-{}.tar.gz".format( self._package.name, normalize_version(self._package.version.text) ) if not file.exists(): ...
[ "Register", "a", "package", "to", "a", "repository", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/publishing/uploader.py#L256-L282
[ "def", "_register", "(", "self", ",", "session", ",", "url", ")", ":", "dist", "=", "self", ".", "_poetry", ".", "file", ".", "parent", "/", "\"dist\"", "file", "=", "dist", "/", "\"{}-{}.tar.gz\"", ".", "format", "(", "self", ".", "_package", ".", "...
2d27acd76c165dd49f11934520a7973de7a3762a
train
PyPiRepository.find_packages
Find packages on the remote server.
poetry/repositories/pypi_repository.py
def find_packages( self, name, # type: str constraint=None, # type: Union[VersionConstraint, str, None] extras=None, # type: Union[list, None] allow_prereleases=False, # type: bool ): # type: (...) -> List[Package] """ Find packages on the remote server. ...
def find_packages( self, name, # type: str constraint=None, # type: Union[VersionConstraint, str, None] extras=None, # type: Union[list, None] allow_prereleases=False, # type: bool ): # type: (...) -> List[Package] """ Find packages on the remote server. ...
[ "Find", "packages", "on", "the", "remote", "server", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/repositories/pypi_repository.py#L83-L148
[ "def", "find_packages", "(", "self", ",", "name", ",", "# type: str", "constraint", "=", "None", ",", "# type: Union[VersionConstraint, str, None]", "extras", "=", "None", ",", "# type: Union[list, None]", "allow_prereleases", "=", "False", ",", "# type: bool", ")", "...
2d27acd76c165dd49f11934520a7973de7a3762a
train
PyPiRepository.get_package_info
Return the package information given its name. The information is returned from the cache if it exists or retrieved from the remote server.
poetry/repositories/pypi_repository.py
def get_package_info(self, name): # type: (str) -> dict """ Return the package information given its name. The information is returned from the cache if it exists or retrieved from the remote server. """ if self._disable_cache: return self._get_package_info(...
def get_package_info(self, name): # type: (str) -> dict """ Return the package information given its name. The information is returned from the cache if it exists or retrieved from the remote server. """ if self._disable_cache: return self._get_package_info(...
[ "Return", "the", "package", "information", "given", "its", "name", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/repositories/pypi_repository.py#L230-L242
[ "def", "get_package_info", "(", "self", ",", "name", ")", ":", "# type: (str) -> dict", "if", "self", ".", "_disable_cache", ":", "return", "self", ".", "_get_package_info", "(", "name", ")", "return", "self", ".", "_cache", ".", "store", "(", "\"packages\"", ...
2d27acd76c165dd49f11934520a7973de7a3762a
train
PyPiRepository.get_release_info
Return the release information given a package name and a version. The information is returned from the cache if it exists or retrieved from the remote server.
poetry/repositories/pypi_repository.py
def get_release_info(self, name, version): # type: (str, str) -> dict """ Return the release information given a package name and a version. The information is returned from the cache if it exists or retrieved from the remote server. """ if self._disable_cache: ...
def get_release_info(self, name, version): # type: (str, str) -> dict """ Return the release information given a package name and a version. The information is returned from the cache if it exists or retrieved from the remote server. """ if self._disable_cache: ...
[ "Return", "the", "release", "information", "given", "a", "package", "name", "and", "a", "version", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/repositories/pypi_repository.py#L251-L276
[ "def", "get_release_info", "(", "self", ",", "name", ",", "version", ")", ":", "# type: (str, str) -> dict", "if", "self", ".", "_disable_cache", ":", "return", "self", ".", "_get_release_info", "(", "name", ",", "version", ")", "cached", "=", "self", ".", "...
2d27acd76c165dd49f11934520a7973de7a3762a
train
WheelBuilder.make
Build a wheel in the dist/ directory, and optionally upload it.
poetry/masonry/builders/wheel.py
def make(cls, poetry, env, io): """Build a wheel in the dist/ directory, and optionally upload it.""" cls.make_in(poetry, env, io)
def make(cls, poetry, env, io): """Build a wheel in the dist/ directory, and optionally upload it.""" cls.make_in(poetry, env, io)
[ "Build", "a", "wheel", "in", "the", "dist", "/", "directory", "and", "optionally", "upload", "it", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/builders/wheel.py#L55-L57
[ "def", "make", "(", "cls", ",", "poetry", ",", "env", ",", "io", ")", ":", "cls", ".", "make_in", "(", "poetry", ",", "env", ",", "io", ")" ]
2d27acd76c165dd49f11934520a7973de7a3762a
train
WheelBuilder._write_entry_points
Write entry_points.txt.
poetry/masonry/builders/wheel.py
def _write_entry_points(self, fp): """ Write entry_points.txt. """ entry_points = self.convert_entry_points() for group_name in sorted(entry_points): fp.write("[{}]\n".format(group_name)) for ep in sorted(entry_points[group_name]): fp.writ...
def _write_entry_points(self, fp): """ Write entry_points.txt. """ entry_points = self.convert_entry_points() for group_name in sorted(entry_points): fp.write("[{}]\n".format(group_name)) for ep in sorted(entry_points[group_name]): fp.writ...
[ "Write", "entry_points", ".", "txt", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/builders/wheel.py#L288-L299
[ "def", "_write_entry_points", "(", "self", ",", "fp", ")", ":", "entry_points", "=", "self", ".", "convert_entry_points", "(", ")", "for", "group_name", "in", "sorted", "(", "entry_points", ")", ":", "fp", ".", "write", "(", "\"[{}]\\n\"", ".", "format", "...
2d27acd76c165dd49f11934520a7973de7a3762a
train
_get_win_folder_from_registry
This is a fallback technique at best. I'm not sure if using the registry for this guarantees us the correct answer for all CSIDL_* names.
poetry/utils/appdirs.py
def _get_win_folder_from_registry(csidl_name): """ This is a fallback technique at best. I'm not sure if using the registry for this guarantees us the correct answer for all CSIDL_* names. """ import _winreg shell_folder_name = { "CSIDL_APPDATA": "AppData", "CSIDL_COMMON_APP...
def _get_win_folder_from_registry(csidl_name): """ This is a fallback technique at best. I'm not sure if using the registry for this guarantees us the correct answer for all CSIDL_* names. """ import _winreg shell_folder_name = { "CSIDL_APPDATA": "AppData", "CSIDL_COMMON_APP...
[ "This", "is", "a", "fallback", "technique", "at", "best", ".", "I", "m", "not", "sure", "if", "using", "the", "registry", "for", "this", "guarantees", "us", "the", "correct", "answer", "for", "all", "CSIDL_", "*", "names", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/utils/appdirs.py#L180-L199
[ "def", "_get_win_folder_from_registry", "(", "csidl_name", ")", ":", "import", "_winreg", "shell_folder_name", "=", "{", "\"CSIDL_APPDATA\"", ":", "\"AppData\"", ",", "\"CSIDL_COMMON_APPDATA\"", ":", "\"Common AppData\"", ",", "\"CSIDL_LOCAL_APPDATA\"", ":", "\"Local AppDat...
2d27acd76c165dd49f11934520a7973de7a3762a
train
Installer.lock
Prepare the installer for locking only.
poetry/installation/installer.py
def lock(self): # type: () -> Installer """ Prepare the installer for locking only. """ self.update() self.execute_operations(False) self._lock = True return self
def lock(self): # type: () -> Installer """ Prepare the installer for locking only. """ self.update() self.execute_operations(False) self._lock = True return self
[ "Prepare", "the", "installer", "for", "locking", "only", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/installation/installer.py#L111-L119
[ "def", "lock", "(", "self", ")", ":", "# type: () -> Installer", "self", ".", "update", "(", ")", "self", ".", "execute_operations", "(", "False", ")", "self", ".", "_lock", "=", "True", "return", "self" ]
2d27acd76c165dd49f11934520a7973de7a3762a
train
Installer._execute
Execute a given operation.
poetry/installation/installer.py
def _execute(self, operation): # type: (Operation) -> None """ Execute a given operation. """ method = operation.job_type getattr(self, "_execute_{}".format(method))(operation)
def _execute(self, operation): # type: (Operation) -> None """ Execute a given operation. """ method = operation.job_type getattr(self, "_execute_{}".format(method))(operation)
[ "Execute", "a", "given", "operation", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/installation/installer.py#L300-L306
[ "def", "_execute", "(", "self", ",", "operation", ")", ":", "# type: (Operation) -> None", "method", "=", "operation", ".", "job_type", "getattr", "(", "self", ",", "\"_execute_{}\"", ".", "format", "(", "method", ")", ")", "(", "operation", ")" ]
2d27acd76c165dd49f11934520a7973de7a3762a
train
Installer._get_extra_packages
Returns all packages required by extras. Maybe we just let the solver handle it?
poetry/installation/installer.py
def _get_extra_packages(self, repo): """ Returns all packages required by extras. Maybe we just let the solver handle it? """ if self._update: extras = {k: [d.name for d in v] for k, v in self._package.extras.items()} else: extras = self._locker.l...
def _get_extra_packages(self, repo): """ Returns all packages required by extras. Maybe we just let the solver handle it? """ if self._update: extras = {k: [d.name for d in v] for k, v in self._package.extras.items()} else: extras = self._locker.l...
[ "Returns", "all", "packages", "required", "by", "extras", "." ]
sdispater/poetry
python
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/installation/installer.py#L480-L510
[ "def", "_get_extra_packages", "(", "self", ",", "repo", ")", ":", "if", "self", ".", "_update", ":", "extras", "=", "{", "k", ":", "[", "d", ".", "name", "for", "d", "in", "v", "]", "for", "k", ",", "v", "in", "self", ".", "_package", ".", "ext...
2d27acd76c165dd49f11934520a7973de7a3762a
train
LuigiGrep._fetch_json
Returns the json representation of the dep graph
luigi/tools/luigi_grep.py
def _fetch_json(self): """Returns the json representation of the dep graph""" print("Fetching from url: " + self.graph_url) resp = urlopen(self.graph_url).read() return json.loads(resp.decode('utf-8'))
def _fetch_json(self): """Returns the json representation of the dep graph""" print("Fetching from url: " + self.graph_url) resp = urlopen(self.graph_url).read() return json.loads(resp.decode('utf-8'))
[ "Returns", "the", "json", "representation", "of", "the", "dep", "graph" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/luigi_grep.py#L21-L25
[ "def", "_fetch_json", "(", "self", ")", ":", "print", "(", "\"Fetching from url: \"", "+", "self", ".", "graph_url", ")", "resp", "=", "urlopen", "(", "self", ".", "graph_url", ")", ".", "read", "(", ")", "return", "json", ".", "loads", "(", "resp", "....
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
LuigiGrep.prefix_search
Searches for jobs matching the given ``job_name_prefix``.
luigi/tools/luigi_grep.py
def prefix_search(self, job_name_prefix): """Searches for jobs matching the given ``job_name_prefix``.""" json = self._fetch_json() jobs = json['response'] for job in jobs: if job.startswith(job_name_prefix): yield self._build_results(jobs, job)
def prefix_search(self, job_name_prefix): """Searches for jobs matching the given ``job_name_prefix``.""" json = self._fetch_json() jobs = json['response'] for job in jobs: if job.startswith(job_name_prefix): yield self._build_results(jobs, job)
[ "Searches", "for", "jobs", "matching", "the", "given", "job_name_prefix", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/luigi_grep.py#L38-L44
[ "def", "prefix_search", "(", "self", ",", "job_name_prefix", ")", ":", "json", "=", "self", ".", "_fetch_json", "(", ")", "jobs", "=", "json", "[", "'response'", "]", "for", "job", "in", "jobs", ":", "if", "job", ".", "startswith", "(", "job_name_prefix"...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
LuigiGrep.status_search
Searches for jobs matching the given ``status``.
luigi/tools/luigi_grep.py
def status_search(self, status): """Searches for jobs matching the given ``status``.""" json = self._fetch_json() jobs = json['response'] for job in jobs: job_info = jobs[job] if job_info['status'].lower() == status.lower(): yield self._build_resul...
def status_search(self, status): """Searches for jobs matching the given ``status``.""" json = self._fetch_json() jobs = json['response'] for job in jobs: job_info = jobs[job] if job_info['status'].lower() == status.lower(): yield self._build_resul...
[ "Searches", "for", "jobs", "matching", "the", "given", "status", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/luigi_grep.py#L46-L53
[ "def", "status_search", "(", "self", ",", "status", ")", ":", "json", "=", "self", ".", "_fetch_json", "(", ")", "jobs", "=", "json", "[", "'response'", "]", "for", "job", "in", "jobs", ":", "job_info", "=", "jobs", "[", "job", "]", "if", "job_info",...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
LocalFileSystem.move
Move file atomically. If source and destination are located on different filesystems, atomicity is approximated but cannot be guaranteed.
luigi/local_target.py
def move(self, old_path, new_path, raise_if_exists=False): """ Move file atomically. If source and destination are located on different filesystems, atomicity is approximated but cannot be guaranteed. """ if raise_if_exists and os.path.exists(new_path): raise ...
def move(self, old_path, new_path, raise_if_exists=False): """ Move file atomically. If source and destination are located on different filesystems, atomicity is approximated but cannot be guaranteed. """ if raise_if_exists and os.path.exists(new_path): raise ...
[ "Move", "file", "atomically", ".", "If", "source", "and", "destination", "are", "located", "on", "different", "filesystems", "atomicity", "is", "approximated", "but", "cannot", "be", "guaranteed", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/local_target.py#L100-L120
[ "def", "move", "(", "self", ",", "old_path", ",", "new_path", ",", "raise_if_exists", "=", "False", ")", ":", "if", "raise_if_exists", "and", "os", ".", "path", ".", "exists", "(", "new_path", ")", ":", "raise", "FileAlreadyExists", "(", "'Destination exists...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
LocalFileSystem.rename_dont_move
Rename ``path`` to ``dest``, but don't move it into the ``dest`` folder (if it is a folder). This method is just a wrapper around the ``move`` method of LocalTarget.
luigi/local_target.py
def rename_dont_move(self, path, dest): """ Rename ``path`` to ``dest``, but don't move it into the ``dest`` folder (if it is a folder). This method is just a wrapper around the ``move`` method of LocalTarget. """ self.move(path, dest, raise_if_exists=True)
def rename_dont_move(self, path, dest): """ Rename ``path`` to ``dest``, but don't move it into the ``dest`` folder (if it is a folder). This method is just a wrapper around the ``move`` method of LocalTarget. """ self.move(path, dest, raise_if_exists=True)
[ "Rename", "path", "to", "dest", "but", "don", "t", "move", "it", "into", "the", "dest", "folder", "(", "if", "it", "is", "a", "folder", ")", ".", "This", "method", "is", "just", "a", "wrapper", "around", "the", "move", "method", "of", "LocalTarget", ...
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/local_target.py#L122-L128
[ "def", "rename_dont_move", "(", "self", ",", "path", ",", "dest", ")", ":", "self", ".", "move", "(", "path", ",", "dest", ",", "raise_if_exists", "=", "True", ")" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
LocalTarget.makedirs
Create all parent folders if they do not exist.
luigi/local_target.py
def makedirs(self): """ Create all parent folders if they do not exist. """ normpath = os.path.normpath(self.path) parentfolder = os.path.dirname(normpath) if parentfolder: try: os.makedirs(parentfolder) except OSError: ...
def makedirs(self): """ Create all parent folders if they do not exist. """ normpath = os.path.normpath(self.path) parentfolder = os.path.dirname(normpath) if parentfolder: try: os.makedirs(parentfolder) except OSError: ...
[ "Create", "all", "parent", "folders", "if", "they", "do", "not", "exist", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/local_target.py#L146-L156
[ "def", "makedirs", "(", "self", ")", ":", "normpath", "=", "os", ".", "path", ".", "normpath", "(", "self", ".", "path", ")", "parentfolder", "=", "os", ".", "path", ".", "dirname", "(", "normpath", ")", "if", "parentfolder", ":", "try", ":", "os", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
track_job
Tracking is done by requesting each job and then searching for whether the job has one of the following states: - "RUN", - "PEND", - "SSUSP", - "EXIT" based on the LSF documentation
luigi/contrib/lsf.py
def track_job(job_id): """ Tracking is done by requesting each job and then searching for whether the job has one of the following states: - "RUN", - "PEND", - "SSUSP", - "EXIT" based on the LSF documentation """ cmd = "bjobs -noheader -o stat {}".format(job_id) track_job_pro...
def track_job(job_id): """ Tracking is done by requesting each job and then searching for whether the job has one of the following states: - "RUN", - "PEND", - "SSUSP", - "EXIT" based on the LSF documentation """ cmd = "bjobs -noheader -o stat {}".format(job_id) track_job_pro...
[ "Tracking", "is", "done", "by", "requesting", "each", "job", "and", "then", "searching", "for", "whether", "the", "job", "has", "one", "of", "the", "following", "states", ":", "-", "RUN", "-", "PEND", "-", "SSUSP", "-", "EXIT", "based", "on", "the", "L...
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/lsf.py#L74-L88
[ "def", "track_job", "(", "job_id", ")", ":", "cmd", "=", "\"bjobs -noheader -o stat {}\"", ".", "format", "(", "job_id", ")", "track_job_proc", "=", "subprocess", ".", "Popen", "(", "cmd", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "shell", "=", "...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
LSFJobTask.fetch_task_failures
Read in the error file from bsub
luigi/contrib/lsf.py
def fetch_task_failures(self): """ Read in the error file from bsub """ error_file = os.path.join(self.tmp_dir, "job.err") if os.path.isfile(error_file): with open(error_file, "r") as f_err: errors = f_err.readlines() else: errors =...
def fetch_task_failures(self): """ Read in the error file from bsub """ error_file = os.path.join(self.tmp_dir, "job.err") if os.path.isfile(error_file): with open(error_file, "r") as f_err: errors = f_err.readlines() else: errors =...
[ "Read", "in", "the", "error", "file", "from", "bsub" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/lsf.py#L119-L129
[ "def", "fetch_task_failures", "(", "self", ")", ":", "error_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "tmp_dir", ",", "\"job.err\"", ")", "if", "os", ".", "path", ".", "isfile", "(", "error_file", ")", ":", "with", "open", "(", "e...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
LSFJobTask.fetch_task_output
Read in the output file
luigi/contrib/lsf.py
def fetch_task_output(self): """ Read in the output file """ # Read in the output file if os.path.isfile(os.path.join(self.tmp_dir, "job.out")): with open(os.path.join(self.tmp_dir, "job.out"), "r") as f_out: outputs = f_out.readlines() else: ...
def fetch_task_output(self): """ Read in the output file """ # Read in the output file if os.path.isfile(os.path.join(self.tmp_dir, "job.out")): with open(os.path.join(self.tmp_dir, "job.out"), "r") as f_out: outputs = f_out.readlines() else: ...
[ "Read", "in", "the", "output", "file" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/lsf.py#L131-L141
[ "def", "fetch_task_output", "(", "self", ")", ":", "# Read in the output file", "if", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", "join", "(", "self", ".", "tmp_dir", ",", "\"job.out\"", ")", ")", ":", "with", "open", "(", "os", ".",...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9