id stringlengths 30 32 | content stringlengths 139 2.8k |
|---|---|
codereview_new_python_data_9103 | def is_program_installed(basename):
osp.join('/usr', 'local', 'bin'),
]
- a = [home, '/opt']
b = ['mambaforge', 'miniforge3', 'miniforge',
'miniconda3', 'anaconda3', 'miniconda', 'anaconda']
else:
pyenv = [osp.join(home, '.pyenv', 'pyenv-win', 'bin')]... |
codereview_new_python_data_9104 | def is_program_installed(basename):
osp.join('/usr', 'local', 'bin'),
]
- a = [home, '/opt']
b = ['mambaforge', 'miniforge3', 'miniforge',
'miniconda3', 'anaconda3', 'miniconda', 'anaconda']
else:
pyenv = [osp.join(home, '.pyenv', 'pyenv-win', 'bin')]... |
codereview_new_python_data_9105 | def replace_find_all(self):
else:
pattern = re.escape(search_text)
replace_text = replace_text.replace('\\', r'\\')
- if word: # match whole words only
pattern = r'\b{pattern}\b'.format(pattern=pattern)
# Check regexp before proceeding
```suggestion
... |
codereview_new_python_data_9106 | def test_plots_scroll(main_window, qtbot):
" plt.plot([1, 2, 3, 4], '.')\n"
" plt.show()\n"
" time.sleep(.1)")
- qtbot.waitUntil(lambda: sb._first_thumbnail_shown, timeout=SHELL_TIMEOUT)
sb.set_current_index(5)
scrollbar.setValue(scrollbar.minimu... |
codereview_new_python_data_9107 | def get_conda_activation_script(quote=False):
exe = get_spyder_umamba_path() or find_conda()
if osp.basename(exe) in ('micromamba.exe', 'conda.exe'):
- # For stadalone conda, use the executable
script_path = exe
else:
# Conda activation script is relative to executable
Should... |
codereview_new_python_data_9108 | def translate_gettext(x):
#==============================================================================
def running_in_mac_app(pyexec=sys.executable):
"""
- Check if Spyder is running as a macOS bundle app.
- Checks for SPYDER_APP environment variable to determine this.
- If python executable is pr... |
codereview_new_python_data_9109 | def translate_gettext(x):
#==============================================================================
def running_in_mac_app(pyexec=sys.executable):
"""
- Check if Spyder is running as a macOS bundle app.
- Checks for SPYDER_APP environment variable to determine this.
- If python executable is pr... |
codereview_new_python_data_9110 | def translate_gettext(x):
#==============================================================================
def running_in_mac_app(pyexec=sys.executable):
"""
- Check if Spyder is running as a macOS bundle app.
- Checks for SPYDER_APP environment variable to determine this.
- If python executable is pr... |
codereview_new_python_data_9111 | def get_conda_activation_script(quote=False):
exe = get_spyder_umamba_path() or find_conda()
if osp.basename(exe) in ('micromamba.exe', 'conda.exe'):
- # For stadalone conda, use the executable
script_path = exe
else:
# Conda activation script is relative to executable
```sug... |
codereview_new_python_data_9112 | def get_user_environment_variables():
try:
k, v = kv.split('=', 1)
env_var[k] = v
- except:
pass
return env_var
```suggestion
except Exception:
```
It's usually not a good idea to leave bare excepts.
def get_user_environment_variables():
... |
codereview_new_python_data_9113 |
from qtpy.QtCore import Qt
from qtpy.QtTest import QTest
from qtpy.QtWidgets import QApplication, QFileDialog, QLineEdit, QTabBar
-from qtpy import QtWebEngineWidgets
import psutil
import pytest
```suggestion
# This is required to run our tests in VSCode or Spyder-unittest
from qtpy import QtWebEngineWidgets... |
codereview_new_python_data_9114 |
"""Tests for gotoline.py"""
# Third party imports
-from qtpy.QtWidgets import QDialogButtonBox, QPushButton, QTableWidget, QLineEdit
# Local imports
from spyder.plugins.editor.widgets.gotoline import GoToLineDialog
def test_gotolinedialog_has_cancel_button(codeeditor, qtbot, tmpdir):
"""
Test that... |
codereview_new_python_data_9115 | def test_dedicated_consoles(main_window, qtbot):
text = control.toPlainText()
assert ('runfile' in text) and not ('Python' in text or 'IPython' in text)
- # --- Clean retained after re-execution ---
with qtbot.waitSignal(shell.executed):
shell.execute('zz = -1')
Maybe this comment could... |
codereview_new_python_data_9116 | def start_installation(self, latest_release):
def set_download_progress(self, current_value, total):
percentage_progress = 0
if total > 0:
- percentage_progress = int(current_value/total*100)
self.custom_widget.setText(f"{percentage_progress} %")
def set_status_pending... |
codereview_new_python_data_9117 | def start_installation(self, latest_release):
def set_download_progress(self, current_value, total):
percentage_progress = 0
if total > 0:
- percentage_progress = int((current_value/total) * 100)
- self.custom_widget.setText(f"{percentage_progress} %")
def set_status_pen... |
codereview_new_python_data_9118 |
if boot_branch_file.exists():
prev_branch = boot_branch_file.read_text()
- res, err = run_program(
find_git(), ['merge-base', '--fork-point', 'master']
).communicate()
- branch = "master" if res else "not master"
boot_branch_file.write_text(branch)
logger.info("Previous ... |
codereview_new_python_data_9119 |
if boot_branch_file.exists():
prev_branch = boot_branch_file.read_text()
- res, err = run_program(
find_git(), ['merge-base', '--fork-point', 'master']
).communicate()
- branch = "master" if res else "not master"
boot_branch_file.write_text(branch)
logger.info("Previous ... |
codereview_new_python_data_9120 | class UpdateInstallerDialog(QDialog):
current_value: int
Size of the data downloaded until now.
total: int
- Total size file expected to be downloaded.
"""
sig_installation_status = Signal(str, str)
```suggestion
Total size of the file expected to be downloaded.
```
c... |
codereview_new_python_data_9121 | class WorkerDownloadInstaller(QObject):
current_value: int
Size of the data downloaded until now.
total: int
- Total size file expected to be downloaded.
"""
def __init__(self, parent, latest_release_version):
```suggestion
Total size of the file expected to be downloade... |
codereview_new_python_data_9122 | def on_initialize(self):
self.create_action(
BreakpointsActions.ListBreakpoints,
_("List breakpoints"),
- triggered=self.switch_to_plugin,
icon=self.get_icon(),
)
Instead of calling this directly, please emit `sig_switch_to_plugin_requested`.
def... |
codereview_new_python_data_9123 | def set_filename(self, filename):
self.filecombo.selected()
- @Slot()
def start_code_analysis(self, filename=None):
"""
Perform code analysis for given `filename`.
Is this `Slot` really necessary? It seems we only need it in the `start_code_analysis` method of the plugin, not he... |
codereview_new_python_data_9124 | def pdb_execute(self, line, hidden=False, echo_stack_entry=True,
# --- To Sort --------------------------------------------------
def stop_debugging(self):
"""Stop debugging."""
- if (self.spyder_kernel_ready and not self.is_waiting_pdb_input()):
self.interrupt_kernel()
... |
codereview_new_python_data_9125 | def _when_kernel_is_ready(self):
"""
Configuration after the prompt is shown.
- Note:
- This is not called on restart. For kernel setup,
- use ShellWidget.handle_kernel_is_ready
"""
if self.kernel_handler.connection_state not in [
Ker... |
codereview_new_python_data_9126 | def handle_kernel_is_ready(self):
return
def handle_kernel_connection_error(self):
- """An error occured."""
if self.kernel_handler.connection_state == KernelConnectionState.Error:
# A wrong version is connected
self.append_html_message(
```suggestion
... |
codereview_new_python_data_9127 | def save(self, index=None, force=False, save_new_files=True):
self.set_os_eol_chars(osname=osname)
try:
- if (self.format_on_save and
- finfo.editor.formatting_enabled and
- finfo.editor.is_python()):
# Wait for document autoform... |
codereview_new_python_data_9128 | def run_selection(self, prefix=None):
"""
if prefix is None:
prefix = ''
text = self.get_current_editor().get_selection_as_executable_code()
if text:
self.exec_in_extconsole.emit(
prefix + text.rstrip(), self.focus_to_editor)
r... |
codereview_new_python_data_9129 | def run_selection(self, prefix=None):
"""
if prefix is None:
prefix = ''
text = self.get_current_editor().get_selection_as_executable_code()
if text:
self.exec_in_extconsole.emit(
prefix + text.rstrip(), self.focus_to_editor)
r... |
codereview_new_python_data_9130 | def setup(self):
goto_cursor_action = self.create_action(
DebuggerWidgetActions.GotoCursor,
- text=_("Show in editor"),
icon=self.create_icon('fromcursor'),
triggered=self.goto_current_step,
register_shortcut=True
```suggestion
tex... |
codereview_new_python_data_9131 | def update_pdb_state(self, state, filename, line_number):
):
self.debugger_panel.start_clean()
self.debugger_panel.set_current_line_arrow(line_number)
-
return
self.debugger_panel.stop_clean()
def set_filename(self, filename):
```suggestion
... |
codereview_new_python_data_9132 | def test_project_path(main_window, tmpdir, qtbot):
projects = main_window.projects
# Create a project
- path = to_text_string(tmpdir.mkdir('project_path'))
assert path not in projects.get_conf('spyder_pythonpath', section='main')
```suggestion
path = str(tmpdir.mkdir('project_path'))
```... |
codereview_new_python_data_9133 | class ShellWidget(NamepaceBrowserWidget, HelpWidget, DebuggingWidget,
# For DebuggingWidget
sig_pdb_step = Signal(str, int)
"""Called when pdb reaches a new line"""
sig_pdb_stack = Signal(object, int)
"""Called when the pdb stack changed"""
sig_pdb_state_changed = Signal(bool, dict)
... |
codereview_new_python_data_9134 | def setup_page(self):
_("Process execute events while debugging"), 'pdb_execute_events',
tip=_("This option lets you decide if the debugger should "
"process the 'execute events' after each prompt, such as "
- "matplotlib 'show' command."))
debug_l... |
codereview_new_python_data_9135 | def run_script(self, filename, wdir, args='',
focus_to_editor: bool, optional
Leave focus in the editor after execution.
method : str or None
- method to run the file. must accept the same arguments as runfile.
force_wdir: bool
- the working directory is ig... |
codereview_new_python_data_9136 | def run_script(self, filename, wdir, args='',
focus_to_editor: bool, optional
Leave focus in the editor after execution.
method : str or None
- method to run the file. must accept the same arguments as runfile.
force_wdir: bool
- the working directory is ig... |
codereview_new_python_data_9137 | def pre_visible_setup(self):
pass
# Register custom layouts
- for plugin_name in PLUGIN_REGISTRY.external_plugins:
- plugin_instance = PLUGIN_REGISTRY.get_plugin(plugin_name)
- if hasattr(plugin_instance, 'CUSTOM_LAYOUTS'):
- if isinstance(plu... |
codereview_new_python_data_9138 | def get_interpreter_info(path):
try:
out, __ = run_program(path, ['-V']).communicate()
out = out.decode()
- # Needed to prevent showing unexpected output.
# See spyder-ide/spyder#19000
if not re.search(r'^Python \d+\.\d+\.\d+$', out):
out = ''
```suggestion... |
codereview_new_python_data_9139 | def run_terminal_thread():
raise NotImplementedError
-def check_version_range(module_version, version):
"""
- Check version string of a module against a required version.
"""
if ';' in version:
versions = version.split(';')
```suggestion
Check if a module's version lies in... |
codereview_new_python_data_9140 | def create_client_for_kernel(self, connection_file, hostname, sshkey,
# Assign kernel manager and client to shellwidget
kernel_client.start_channels()
shellwidget = client.shellwidget
if not known_spyder_kernel:
shellwidget.sig_is_spykernel.connect(
sel... |
codereview_new_python_data_9141 |
IPython Console plugin based on QtConsole
"""
# Required version of Spyder-kernels
SPYDER_KERNELS_MIN_VERSION = '2.3.0'
SPYDER_KERNELS_MAX_VERSION = '2.4.0'
```suggestion
# Required version of Spyder-kernels
```
IPython Console plugin based on QtConsole
"""
+
# Required version of Spyder-kernels
SP... |
codereview_new_python_data_9142 |
import os
from qtpy.QtWidgets import QApplication, QMessageBox
-if not os.name == 'nt':
- import pexpect
from spyder.config.base import _
```suggestion
import pexpect
```
Now we really on `pexpect` on all operating systems.
import os
from qtpy.QtWidgets import QApplication, QMessageBox
+import ... |
codereview_new_python_data_9143 | def unmaximize(self):
"""Unmaximize the currently maximized plugin, if not self."""
if self.main:
layouts = self.get_plugin(Plugins.Layout)
- last_plugin = layouts.get_last_plugin()
- is_maximized = False
-
- if last_plugin is not None:
- t... |
codereview_new_python_data_9144 | def _unmaximize_plugin(self):
Notes
-----
- We assume that users want to check output in the IPython console after
after running or debugging code. And for that we need to unmaximize any
plugin that is currently maximized.
"""
```suggestion
We assume that... |
codereview_new_python_data_9145 | def _change_client_conf(self, client, client_conf_func, value):
sw.set_pdb_ignore_lib,
sw.set_pdb_execute_events,
sw.set_pdb_use_exclamation_mark,
- sw.set_pdb_stop_first_line,
- ]:
# Execute immediate... |
codereview_new_python_data_9146 |
get_home_dir, get_conf_path, get_module_path, running_in_ci)
from spyder.config.manager import CONF
from spyder.dependencies import DEPENDENCIES
-from spyder.plugins.completion.api import DiagnosticSeverity
from spyder.plugins.help.widgets import ObjectComboBox
from spyder.plugins.help.tests.test_plugin impor... |
codereview_new_python_data_9147 | def _update(self):
editor = self.editor
if editor is None:
return
try:
font = editor.font()
```suggestion
return
```
For clarity.
def _update(self):
editor = self.editor
if editor is None:
return
+
try:... |
codereview_new_python_data_9148 | def get_passed_tests():
with open('pytest_log.txt') as f:
logfile = f.readlines()
- # All lines that start with 'spyder' are tests. The rest are
- # informative messages.
test_re = re.compile(r'(spyder.*) (SKIPPED|PASSED|XFAIL) ')
tests = []
for line in ... |
codereview_new_python_data_9149 | def block_safe(block):
"""
Check if the block is safe to work with.
- A BlockUserData must have been set on the block while it was known safe.
If an editor is cleared by editor.clear() or editor.set_text() for example,
- all the old blocks will continue to report block.isValid() == True
- b... |
codereview_new_python_data_9150 | def block_safe(block):
"""
Check if the block is safe to work with.
- A BlockUserData must have been set on the block while it was known safe.
If an editor is cleared by editor.clear() or editor.set_text() for example,
- all the old blocks will continue to report block.isValid() == True
- b... |
codereview_new_python_data_9151 | def block_safe(block):
"""
Check if the block is safe to work with.
- A BlockUserData must have been set on the block while it was known safe.
If an editor is cleared by editor.clear() or editor.set_text() for example,
- all the old blocks will continue to report block.isValid() == True
- b... |
codereview_new_python_data_9152 | def set_value(self, value):
elif value == PENDING:
self.tooltip = value
else:
- value = versions['spyder']
self.tooltip = self.BASE_TOOLTIP
self.setVisible(True)
self.update_tooltip()
Following the changes to the install `NO_STATUS`, then this l... |
codereview_new_python_data_9153 | def continue_install(self):
reply.setWindowTitle("Spyder")
reply.setAttribute(Qt.WA_ShowWithoutActivating)
reply.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
- reply.buttonClicked.connect(
- lambda button:
- self.start_inst... |
codereview_new_python_data_9154 | def on_statusbar_available(self):
@on_plugin_teardown(plugin=Plugins.StatusBar)
def on_statusbar_teardown(self):
- # Add status widget
statusbar = self.get_plugin(Plugins.StatusBar)
statusbar.remove_status_widget(self.application_update_status.ID)
```suggestion
# Remove... |
codereview_new_python_data_9155 |
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
-"""Widgets for the application plugin."""
```suggestion
"""Widgets for the Application plugin."""
```
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
+"""Widgets for the Application p... |
codereview_new_python_data_9156 | def cancel_install(self):
QMessageBox.Yes, QMessageBox.No)
if reply == QMessageBox.Yes:
self.cancelled = True
- self.cancell_thread_install_update()
self.setup()
self.accept()
return True
```suggestion
self.cancel_thread... |
codereview_new_python_data_9157 | def set_value(self, value):
self.tooltip = self.BASE_TOOLTIP
self.setVisible(True)
self.update_tooltip()
- value = "Spyder: {0}".format(value)
super().set_value(value)
def get_tooltip(self):
Lets add here a debug log entry and change to use f-string to format. For... |
codereview_new_python_data_9158 | def _download_install(self):
reporthook=self._progress_reporter)
self._change_update_installation_status(status=INSTALLING)
cmd = ('start' if os.name == 'nt' else 'open')
- subprocess.run([cmd, destination], shell=True)
except UpdateIn... |
codereview_new_python_data_9159 | def _download_install(self):
reporthook=self._progress_reporter)
self._change_update_installation_status(status=INSTALLING)
cmd = ('start' if os.name == 'nt' else 'open')
- subprocess.run(' '.join([cmd, destination]), shell=True)
e... |
codereview_new_python_data_9160 | def _check_updates_ready(self):
header = _("<b>Spyder {} is available!</b> ",
"<i>(you have {})</i><br><br>").format(
- latest_release,)
footer = _(
"For more information visit our "
"<a href=\"... |
codereview_new_python_data_9161 |
FINISHED = _("Installation finished")
PENDING = _("Update available")
CHECKING = _("Checking for updates")
-CANCELLED = _("Cancelled")
INSTALL_INFO_MESSAGES = {
- DOWNLOADING_INSTALLER: _("Downloading Spyder latest "
- "release installer executable"),
- INSTALLING: _("Installing... |
codereview_new_python_data_9162 | def _check_updates_ready(self):
if update_available:
self.application_update_status.set_status_pending()
- header = _("<b>Spyder {} is available!</b> ",
"<i>(you have {})</i><br><br>").format(
latest_release, __version__)
... |
codereview_new_python_data_9163 |
CANCELLED = _("Cancelled update")
INSTALL_INFO_MESSAGES = {
- DOWNLOADING_INSTALLER: _("Downloading latest Spyder update"),
- INSTALLING: _("Installing Spyder update"),
- FINISHED: _("Spyder update installation finished"),
- PENDING: _("Spyder update available to download"),
- CHECKING: _("Checking ... |
codereview_new_python_data_9164 | def __init__(self, parent):
self.setLayout(general_layout)
- def update_installation_status(self, status, latestVersion):
"""Update installation status (downloading, installing, finished)."""
self._progress_label.setText(status)
self.install_info.setText(INSTALL_INFO_MESSAGES... |
codereview_new_python_data_9165 | def get_cwd_of_new_client():
# Simulate a specific directory
cwd_dir = str(tmpdir.mkdir('ipyconsole_cwd_test'))
- ipyconsole.get_widget().current_working_directory = cwd_dir
# Get cwd of new client and assert is the expected one
assert get_cwd_of_new_client() == cwd_dir
You will be able to ... |
codereview_new_python_data_9166 | def _set_initial_cwd(self):
if project_path is not None:
cwd_path = project_path
elif self.get_conf('console/use_cwd', section='workingdir'):
- cwd_path = self.container.current_working_directory
elif self.get_conf(
'c... |
codereview_new_python_data_9167 | def interrupt_kernel(self):
self.call_kernel(interrupt=True).raise_interrupt_signal()
else:
self._append_plain_text(
- 'Cannot interrupt a non-spyder kernel I did not start.\n')
def execute(self, source=None, hidden=False, interactive=False):
"""
```su... |
codereview_new_python_data_9168 | def on_variable_explorer_teardown(self):
self.get_widget().sig_show_namespace.disconnect(
self.show_namespace_in_variable_explorer)
def show_namespace_in_variable_explorer(self, namespace, shellwidget):
"""
Find the right variable explorer widget and show the namespace.
... |
codereview_new_python_data_9169 |
# Constants
VALID_VARIABLE_CHARS = r"[^\w+*=¡!¿?'\"#$%&()/<>\-\[\]{}^`´;,|¬]*\w"
# Max time before giving up when making a blocking call to the kernel
CALL_KERNEL_TIMEOUT = 30
```suggestion
# Max time before giving up when making a blocking call to the kernel
```
# Constants
VALID_VARIABLE_C... |
codereview_new_python_data_9170 | def setup(self):
# Tools actions
if os.name == 'nt':
- tip = ("Show and edit current user environment variables in "
- "Windows registry (i.e. for all sessions)")
else:
- tip = ("Show current user environment variables (i.e. for all "
- ... |
codereview_new_python_data_9171 | def setup(self):
# Tools actions
if os.name == 'nt':
- tip = ("Show and edit current user environment variables in "
- "Windows registry (i.e. for all sessions)")
else:
- tip = ("Show current user environment variables (i.e. for all "
- ... |
codereview_new_python_data_9297 | def _make_boundary(cls, text=None):
def _compile_re(cls, s, flags):
return re.compile(s, flags)
class BytesGenerator(Generator):
"""Generates a bytes version of a Message object tree.
Add a newline, for PEP8 compliance
```suggestion
```
def _make_boundary(cls, text=None):
def _c... |
codereview_new_python_data_9298 |
from concurrent.futures import _base
import queue
import multiprocessing as mp
from multiprocessing.queues import Queue
import threading
import weakref
This one is actually necessary. It is later relied on when `mp.connection.wait` is called on L407. Without this import we are not guaranteed that `import multip... |
codereview_new_python_data_9299 |
from queue import Empty, Full
from . import connection
from . import context
_ForkingPickler = context.reduction.ForkingPickler
How sure are you that this import doesn't have a sneaky side effect that's relied upon here? After all it's the C accelerator, things would presumably keep working without it, just s... |
codereview_new_python_data_9301 | def expanduser(self):
"""
if (not (self._drv or self._root) and
self._parts and self._parts[0][:1] == '~'):
- homedir = self._flavour.expanduser(self)
if homedir[:1] == "~":
raise RuntimeError("Could not determine home directory.")
- re... |
codereview_new_python_data_9305 | def powtest(self, type):
self.assertEqual(pow(2, i), pow2)
if i != 30 : pow2 = pow2*2
- for othertype in (int,):
for i in list(range(-10, 0)) + list(range(1, 10)):
ii = type(i)
inv = pow(ii, -1) # inverse of ii
`... |
codereview_new_python_data_9306 | def powtest(self, type):
self.assertEqual(pow(2, i), pow2)
if i != 30 : pow2 = pow2*2
- for othertype in (int,):
for i in list(range(-10, 0)) + list(range(1, 10)):
ii = type(i)
inv = pow(ii, -1) # inverse of ii
`... |
codereview_new_python_data_9307 | def powtest(self, type):
self.assertEqual(pow(2, i), pow2)
if i != 30 : pow2 = pow2*2
- for othertype in (int,):
for i in list(range(-10, 0)) + list(range(1, 10)):
ii = type(i)
inv = pow(ii, -1) # inverse of ii
M... |
codereview_new_python_data_9326 | def test_add_dir_getmember(self):
self.add_dir_and_getmember('bar')
self.add_dir_and_getmember('a'*101)
def add_dir_and_getmember(self, name):
def filter(tarinfo):
tarinfo.uid = tarinfo.gid = 100
Please skip the test if hasattr(os, 'getuid') is false or hasattr(os, 'getg... |
codereview_new_python_data_9327 | def setswitchinterval(interval):
interval = minimum_interval
return sys.setswitchinterval(interval)
def get_pagesize():
"""Get size of a page in bytes."""
try:
I'll change https://github.com/python/cpython/blob/main/Lib/test/memory_watchdog.py#L13 to get_pagesize in other pr.
def sets... |
codereview_new_python_data_9328 | def test_async_and_await_are_keywords(self):
def test_match_and_case_are_soft_keywords(self):
self.assertIn("match", keyword.softkwlist)
self.assertIn("case", keyword.softkwlist)
-
def test_keywords_are_sorted(self):
self.assertSequenceEqual(sorted(keyword.kwlist), keyword.kwlist)
... |
codereview_new_python_data_9331 | def test_HTTPError_interface(self):
def test_gh_98778(self):
x = urllib.error.HTTPError("url", 405, "METHOD NOT ALLOWED", None, None)
self.assertEqual(getattr(x, "__notes__", ()), ())
- self.assertEqual(isinstance(x.fp.read(), bytes), True)
def test_parse_proxy(self):
pars... |
codereview_new_python_data_9334 | class Label:
def assertInstructionsMatch(self, actual_, expected_):
# get two lists where each entry is a label or
# an instruction tuple. Normalize the labels to the
- # instruction count of the target, adn compare the lists.
self.assertIsInstance(actual_, list)
self.... |
codereview_new_python_data_9336 | def __exit__(self, *args, **kwargs):
# gh-101766: glboal cache should be cleaned-up
# if there is no more _blocking_on for this thread.
del _blocking_on[self.thread_id]
class _DeadlockError(RuntimeError):
Would it be worth completely undoing what `__enter__()` did?
```su... |
codereview_new_python_data_9339 | def is_integer(self):
def as_integer_ratio(self):
"""Return a pair of integers, whose ratio is equal to the original Fraction.
- The ratio is in lowest terms and with a positive denominator.
"""
return (self._numerator, self._denominator)
```suggestion
The ratio is ... |
codereview_new_python_data_9341 | def from_decimal(cls, dec):
@classmethod
def _from_pair(cls, numerator, denominator, /):
- """Convert a pair of int's to a rational number, for internal use.
The ratio of integers should be in lowest terms and
the denominator is positive.
Nitpick: I'd prefer `ints` to `int's`.
... |
codereview_new_python_data_9342 | def from_decimal(cls, dec):
@classmethod
def _from_pair(cls, numerator, denominator, /):
- """Convert a pair of int's to a rational number, for internal use.
The ratio of integers should be in lowest terms and
the denominator is positive.
Can we rename `_from_pair` to something ... |
codereview_new_python_data_9345 | def library_recipes():
dict(
name="OpenSSL 1.1.1t",
url="https://www.openssl.org/source/openssl-1.1.1t.tar.gz",
- checksum='8dee9b24bdb1dcbf0c3d1e9b02fb8f6bf22165e807f45adeb7c9677536859d3b',
buildrecipe=build_universal_openssl,
configu... |
codereview_new_python_data_9346 | def library_recipes():
dict(
name="OpenSSL 1.1.1t",
url="https://www.openssl.org/source/openssl-1.1.1t.tar.gz",
- checksum='8dee9b24bdb1dcbf0c3d1e9b02fb8f6bf22165e807f45adeb7c9677536859d3b',
buildrecipe=build_universal_openssl,
configu... |
codereview_new_python_data_9347 | def _execute_child(self, args, executable, preexec_fn, close_fds,
raise FileNotFoundError('shell not found: neither %ComSpec% nor %SystemRoot% is set')
if os.path.isabs(comspec):
executable = comspec
args = '{} /c "{}"'.forma... |
codereview_new_python_data_9348 | def _execute_child(self, args, executable, preexec_fn, close_fds,
raise FileNotFoundError('shell not found: neither %ComSpec% nor %SystemRoot% is set')
if os.path.isabs(comspec):
executable = comspec
args = '{} /c "{}"'.forma... |
codereview_new_python_data_9349 | def _execute_child(self, args, executable, preexec_fn, close_fds,
raise FileNotFoundError('shell not found: neither %ComSpec% nor %SystemRoot% is set')
if os.path.isabs(comspec):
executable = comspec
args = '{} /c "{}"'.forma... |
codereview_new_python_data_9350 | def _execute_child(self, args, executable, preexec_fn, close_fds,
raise FileNotFoundError('shell not found: neither %ComSpec% nor %SystemRoot% is set')
if os.path.isabs(comspec):
executable = comspec
args = '{} /c "{}"'.forma... |
codereview_new_python_data_9354 | def _parse_parts(cls, parts):
else:
raise TypeError(
"argument should be a str object or an os.PathLike "
- "object returning str, not %r"
- % type(path))
if altsep:
path = path.replace(altsep, sep)
drv, root, rel = cls... |
codereview_new_python_data_9358 | def continue_in_while():
self.assertEqual(None, opcodes[1].argval)
self.assertEqual('RETURN_VALUE', opcodes[2].opname)
- def test_unloop_break_continue(self):
- for stmt in ('break', 'continue'):
- with self.subTest(stmt=stmt):
- with self.assertRaises(Sy... |
codereview_new_python_data_9359 | class DynOptionMenu(OptionMenu):
def __init__(self, master, variable, value, *values, **kwargs):
highlightthickness = kwargs.pop('highlightthickness', None)
OptionMenu.__init__(self, master, variable, value, *values, **kwargs)
- self.config(highlightthickness=highlightthickness)
... |
codereview_new_python_data_9361 | def commonpath(paths):
try:
- # The genericpath's isdir and isfile implementations uses os.stat internally.
- # This is overkill on Windows - just pass the path to GetFileAttributesW
- # and check the attribute from there.
from nt import _isdir as isdir
from nt import _isfile as isfile
fro... |
codereview_new_python_data_9362 | def test_isjunction(self):
@unittest.skipIf(sys.platform != 'win32', "drive letters are a windows concept")
def test_isfile_driveletter(self):
- current_drive = os.path.splitdrive(os.path.abspath(__file__))[0] + "\\"
self.assertFalse(os.path.isfile(current_drive))
@unittest.skipIf(sy... |
codereview_new_python_data_9363 | def test_isjunction(self):
@unittest.skipIf(sys.platform != 'win32', "drive letters are a windows concept")
def test_isfile_driveletter(self):
- current_drive = "\\\\.\\" + os.path.splitdrive(os.path.abspath(__file__))[0]
- self.assertFalse(os.path.isfile(current_drive))
@unittest.skip... |
codereview_new_python_data_9364 | def commonpath(paths):
# The isdir(), isfile(), islink() and exists() implementations in
# genericpath use os.stat(). This is overkill on Windows. Use simpler
# builtin functions if they are available.
- from nt import _isdir as isdir
- from nt import _isfile as isfile
- from nt import _islink ... |
codereview_new_python_data_9368 | def test_repr(self):
def test_hash(self):
self.assertEqual(hash(slice(5)), slice(5).__hash__())
self.assertNotEqual(slice(5), slice(6))
def test_cmp(self):
s1 = slice(1, 2, 3)
s2 = slice(1, 2, 3)
Can we add more tests here?
For example, test that `hash(slice(1, 2, ... |
codereview_new_python_data_9369 | def test_hash(self):
self.assertEqual(hash(slice(5)), slice(5).__hash__())
self.assertEqual(hash(slice(1, 2)), slice(1, 2).__hash__())
self.assertEqual(hash(slice(1, 2, 3)), slice(1, 2, 3).__hash__())
- self.assertEqual(hash((slice(4, 2), slice(2, 6))), (slice(4, 2), slice(2, 6)).__ha... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.