text stringlengths 81 112k |
|---|
Setup the main layout of the widget.
def setup_gui(self):
"""Setup the main layout of the widget."""
layout = QGridLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.canvas, 0, 1)
layout.addLayout(self.setup_toolbar(), 0, 3, 2, 1)
layout.setColumnS... |
Setup the toolbar.
def setup_toolbar(self):
"""Setup the toolbar."""
self.savefig_btn = create_toolbutton(
self, icon=ima.icon('filesave'),
tip=_("Save Image As..."),
triggered=self.emit_save_figure)
self.delfig_btn = create_toolbutton(
self, icon... |
Set a colored frame around the FigureCanvas if highlight is True.
def highlight_canvas(self, highlight):
"""
Set a colored frame around the FigureCanvas if highlight is True.
"""
colorname = self.canvas.palette().highlight().color().name()
if highlight:
self.canvas.s... |
A filter that is used to send a signal when the figure canvas is
clicked.
def eventFilter(self, widget, event):
"""
A filter that is used to send a signal when the figure canvas is
clicked.
"""
if event.type() == QEvent.MouseButtonPress:
if event.button() == ... |
Emit a signal when the toolbutton to save the figure is clicked.
def emit_save_figure(self):
"""
Emit a signal when the toolbutton to save the figure is clicked.
"""
self.sig_save_figure.emit(self.canvas.fig, self.canvas.fmt) |
Popup context menu.
def context_menu_requested(self, event):
"""Popup context menu."""
if self.fig:
pos = QPoint(event.x(), event.y())
context_menu = QMenu(self)
context_menu.addAction(ima.icon('editcopy'), "Copy Image",
self.copy_f... |
Copy figure to clipboard.
def copy_figure(self):
"""Copy figure to clipboard."""
if self.fmt in ['image/png', 'image/jpeg']:
qpixmap = QPixmap()
qpixmap.loadFromData(self.fig, self.fmt.upper())
QApplication.clipboard().setImage(qpixmap.toImage())
elif self.fm... |
Blink figure once.
def blink_figure(self):
"""Blink figure once."""
if self.fig:
self._blink_flag = not self._blink_flag
self.repaint()
if self._blink_flag:
timer = QTimer()
timer.singleShot(40, self.blink_figure) |
Clear the figure that was painted on the widget.
def clear_canvas(self):
"""Clear the figure that was painted on the widget."""
self.fig = None
self.fmt = None
self._qpix_buffer = []
self.repaint() |
Load the figure from a png, jpg, or svg image, convert it in
a QPixmap, and force a repaint of the widget.
def load_figure(self, fig, fmt):
"""
Load the figure from a png, jpg, or svg image, convert it in
a QPixmap, and force a repaint of the widget.
"""
self.fig = fig
... |
Qt method override to paint a custom image on the Widget.
def paintEvent(self, event):
"""Qt method override to paint a custom image on the Widget."""
super(FigureCanvas, self).paintEvent(event)
# Prepare the rect on which the image is going to be painted :
fw = self.frameWidth()
... |
Custom Python executable value has been changed
def python_executable_changed(self, pyexec):
"""Custom Python executable value has been changed"""
if not self.cus_exec_radio.isChecked():
return False
def_pyexec = get_python_executable()
if not is_text_string(pyexec):
... |
Set UMR excluded modules name list
def set_umr_namelist(self):
"""Set UMR excluded modules name list"""
arguments, valid = QInputDialog.getText(self, _('UMR'),
_("Set the list of excluded modules as "
"this: <i>numpy, scipy</i>")... |
Update the list of interpreters used and the current one.
def set_custom_interpreters_list(self, value):
"""Update the list of interpreters used and the current one."""
custom_list = self.get_option('custom_interpreters_list')
if value not in custom_list and value != get_python_executable():... |
Check that the used custom interpreters are still valid.
def validate_custom_interpreters_list(self):
"""Check that the used custom interpreters are still valid."""
custom_list = self.get_option('custom_interpreters_list')
valid_custom_list = []
for value in custom_list:
... |
Extends :meth:`spyder.api.EditorExtension.on_install` method to set the
editor instance as the parent widget.
.. warning:: Don't forget to call **super** if you override this
method!
:param editor: editor instance
:type editor: spyder.plugins.editor.widgets.codeeditor.CodeE... |
Fills the panel background using QPalette.
def paintEvent(self, event):
"""Fills the panel background using QPalette."""
if self.isVisible() and self.position != self.Position.FLOATING:
# fill background
self._background_brush = QBrush(QColor(
self.editor.sideare... |
Shows/Hides the panel.
Automatically call PanelsManager.refresh_panels.
:param visible: Visible state
def setVisible(self, visible):
"""
Shows/Hides the panel.
Automatically call PanelsManager.refresh_panels.
:param visible: Visible state
"""
logger.d... |
Set geometry for floating panels.
Normally you don't need to override this method, you should override
`geometry` instead.
def set_geometry(self, crect):
"""Set geometry for floating panels.
Normally you don't need to override this method, you should override
`geometry` instea... |
We decided to replace pyzmq's openssh_tunnel method to work around
issue https://github.com/zeromq/pyzmq/issues/589 which was solved
in pyzmq https://github.com/zeromq/pyzmq/pull/615
def openssh_tunnel(self, lport, rport, server, remoteip='127.0.0.1',
keyfile=None, password=None, timeout=0.4... |
Configure associated namespace browser widget
def configure_namespacebrowser(self):
"""Configure associated namespace browser widget"""
# Update namespace view
self.sig_namespace_view.connect(lambda data:
self.namespacebrowser.process_remote_view(data))
# Update properties ... |
Set the namespace view settings
def set_namespace_view_settings(self):
"""Set the namespace view settings"""
if self.namespacebrowser:
settings = to_text_string(
self.namespacebrowser.get_view_settings())
code =(u"get_ipython().kernel.namespace_view_settings = %s... |
Ask kernel for a value
def get_value(self, name):
"""Ask kernel for a value"""
code = u"get_ipython().kernel.get_value('%s')" % name
if self._reading:
method = self.kernel_client.input
code = u'!' + code
else:
method = self.silent_execute
# W... |
Set value for a variable
def set_value(self, name, value):
"""Set value for a variable"""
value = to_text_string(value)
code = u"get_ipython().kernel.set_value('%s', %s, %s)" % (name, value,
PY2)
if self._reading:
... |
Remove a variable
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) |
Copy a variable
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)
... |
Handle internal spyder messages
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:
... |
Reimplemented to handle communications between Spyder
and the kernel
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'].ge... |
Reimplemented to refresh the namespacebrowser after kernel
restarts
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('m... |
Reimplement Qt method.
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 |
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
def initialize_plugin_in_mainwindow_layout(self):
"""
If this is the first time the p... |
Update plugin margins
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_marg... |
Update plugin title, i.e. dockwidget or window title
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
... |
Add to parent QMainWindow as a dock widget
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")
... |
Create configuration dialog box page widget
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 configwi... |
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.
def get_plugin_font(self, rich_text=False):
"""
Return plugin font option.
All plugins in Spyder use a global... |
Show message in main window's status bar
def show_message(self, message, timeout=0):
"""Show message in main window's status bar"""
self.main.statusBar().showMessage(message, timeout) |
Associate a toggle view action with each plugin
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 =... |
Toggle view
def toggle_view(self, checked):
"""Toggle view"""
if not self.dockwidget:
return
if checked:
self.dockwidget.show()
self.dockwidget.raise_()
else:
self.dockwidget.hide() |
Close QMainWindow instance that contains this plugin.
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 ... |
Create a QMainWindow instance containing this plugin.
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(... |
Actions to perform when a plugin is undocked to be moved.
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) |
Cut text
def cut(self):
"""Cut text"""
self.truncate_selection(self.header_end_pos)
if self.has_selected_text():
CodeEditor.cut(self) |
Reimplemented Qt Method to avoid removing the header.
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_p... |
Action to take when pressing the submit button.
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 t... |
Show traceback on its own dialog
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().setPl... |
Activate submit_btn.
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_CH... |
Checks if there is an unmatched brackets in the 'text'.
The brackets type can be general or specified by closing_brackets_type
(')', ']' or '}')
def unmatched_brackets_in_line(self, text, closing_brackets_type=None):
"""
Checks if there is an unmatched brackets in the 'text'.
... |
Control automatic insertation of brackets in various situations.
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')
... |
---------------------------------------------------------------------------------------------
author: Kyle Hounslow
---------------------------------------------------------------------------------------------
Converts a list of single images into a list of 'montage' images of specified rows and columns.
... |
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.):
"""
Adju... |
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,
... |
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... |
function to take the corners from cv2.GoodFeaturesToTrack and return cv2.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... |
Convert a path to a file: URL. The path will be made absolute and have
quoted path parts.
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:",... |
Return True if `path` is a directory containing a setup.py file.
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 Tr... |
Retrieve a setting value.
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
... |
Returns a list of requirements for building, as strings
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)
retu... |
Builds a wheel, places it in 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... |
Builds an sdist, places it in sdist_directory
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 un... |
Returns all external incompatibilities in this incompatibility's
derivation graph.
def external_incompatibilities(self): # type: () -> Generator[Incompatibility]
"""
Returns all external incompatibilities in this incompatibility's
derivation graph.
"""
if isinstance(sel... |
Adds an assignment of package as a decision
and increments the decision level.
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, c... |
Adds an assignment of package as a derivation.
def derive(
self, dependency, is_positive, cause
): # type: (Dependency, bool, Incompatibility) -> None
"""
Adds an assignment of package as a derivation.
"""
self._assign(
Assignment.derivation(
dep... |
Adds an Assignment to _assignments and _positive or _negative.
def _assign(self, assignment): # type: (Assignment) -> None
"""
Adds an Assignment to _assignments and _positive or _negative.
"""
self._assignments.append(assignment)
self._register(assignment) |
Resets the current decision level to decision_level, and removes all
assignments made after that level.
def backtrack(self, decision_level): # type: (int) -> None
"""
Resets the current decision level to decision_level, and removes all
assignments made after that level.
"""
... |
Registers an Assignment in _positive or _negative.
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 N... |
Returns the first Assignment in this solution such that the sublist of
assignments up to and including that entry collectively satisfies term.
def satisfier(self, term): # type: (Term) -> Assignment
"""
Returns the first Assignment in this solution such that the sublist of
assignments ... |
Checks the validity of a configuration
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_objec... |
Discover subpackages and data.
It also retrieves necessary files.
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)
... |
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
def clean_tarinfo(cls, tar_info):
"""
Clean metadata from a TarInfo object t... |
Retrieve the current shell.
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):
... |
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.
def search_for(self, dependency): # type: (Dependency) -> List[Package]
"""
Search for the specifications... |
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]
"""
Se... |
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... |
Finds a set of dependencies that match the root package's constraints,
or raises an error if no such set is available.
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.
... |
Performs unit propagation on incompatibilities transitively
related to package to derive new assignments for _solution.
def _propagate(self, package): # type: (str) -> None
"""
Performs unit propagation on incompatibilities transitively
related to package to derive new assignments for ... |
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... |
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... |
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.
def _choose_package_version(self): # type: () -> Union[str, None]
... |
Creates a #SolverResult from the decisions in _solution
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 decis... |
Run a command inside the Python environment.
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... |
Return path to the given executable.
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_... |
This helper will help in transforming
disjunctive constraint into proper constraint.
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 abbreviated implementation name.
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 implementation version.
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 |
Use a fallback method for determining SOABI flags if the needed config
var is unset or unavailable.
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 ... |
Determines if the given package matches this dependency.
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(packag... |
Set the dependency as optional.
def deactivate(self):
"""
Set the dependency as optional.
"""
if not self._optional:
self._optional = True
self._activated = False |
Installs Poetry in $POETRY_HOME.
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()
... |
Packs everything into a single lib/ directory.
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(POET... |
Tries to update the $PATH automatically.
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()
add... |
Returns whether this term satisfies another.
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 the relationship between the package versions
allowed by this term and another.
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.depe... |
Returns a Term that represents the packages
allowed by both this term and another
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.d... |
Finds all files to add to the tarball
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... |
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.
def parse(
version, strict=False # type: str # type: bool
): ... |
Checks whether the lock file is still up to date with the current hash.
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"... |
Searches and returns a repository of locked packages.
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.reposi... |
Returns the sha256 hash of the sorted content of the pyproject file.
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... |
Load installed packages.
For now, it uses the pip "freeze" command.
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")
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.