text stringlengths 0 828 |
|---|
if kwargs.get('async'): |
return cls._list_all_promotions_with_http_info(**kwargs) |
else: |
(data) = cls._list_all_promotions_with_http_info(**kwargs) |
return data" |
4142,"def pip_upgrade_all_user(line): |
""""""Attempt to upgrade all packages installed with --user"""""" |
import pip |
for dist in pip.get_installed_distributions(user_only=True): |
do_pip([""install"", ""--upgrade"", ""--user"", dist.project_name])" |
4143,"def pip_upgrade_all(line): |
""""""Attempt to upgrade all packages"""""" |
from pip import get_installed_distributions |
user = set(d.project_name for d in get_installed_distributions(user_only=True)) |
all = set(d.project_name for d in get_installed_distributions()) |
for dist in all - user: |
do_pip([""install"", ""--upgrade"", dist]) |
for dist in user: |
do_pip([""install"", ""--upgrade"", ""--user"", dist])" |
4144,"def enc_name_descr(name, descr, color=a99.COLOR_DESCR): |
""""""Encodes html given name and description."""""" |
return enc_name(name, color)+""<br>""+descr" |
4145,"def style_checkboxes(widget): |
"""""" |
Iterates over widget children to change checkboxes stylesheet. |
The default rendering of checkboxes does not allow to tell a focused one |
from an unfocused one. |
"""""" |
ww = widget.findChildren(QCheckBox) |
for w in ww: |
w.setStyleSheet(""QCheckBox:focus {border: 1px solid #000000;}"")" |
4146,"def check_return_space(event, callable_): |
""""""Checks if event corresponds to Return/Space being pressed and calls callable_ if so."""""" |
if event.type() == QEvent.KeyPress: |
if event.key() in [Qt.Key_Return, Qt.Key_Space]: |
callable_() |
return True |
return False" |
4147,"def are_you_sure(flag_changed, evt, parent=None, title=""File has been changed"", |
msg=""Are you sure you want to exit?""): |
"""""" |
""Are you sure you want to exit"" question dialog. |
If flag_changed, shows question dialog. If answer is not yes, calls evt.ignore() |
Arguments: |
flag_changed |
evt -- QCloseEvent instance |
parent=None -- parent form, used to centralize the question dialog at |
title -- title for question dialog |
msg -- text of question dialog |
Returns True or False. True means: ""yes, I want to exit"" |
"""""" |
if flag_changed: |
r = QMessageBox.question(parent, title, msg, |
QMessageBox.Yes|QMessageBox.No, QMessageBox.Yes) |
if r != QMessageBox.Yes: |
evt.ignore()" |
4148,"def reset_table_widget(t, rowCount, colCount): |
""""""Clears and resizes a table widget."""""" |
t.reset() |
t.horizontalHeader().reset() |
t.clear() |
t.sortItems(-1) |
t.setRowCount(rowCount) |
t.setColumnCount(colCount)" |
4149,"def show_edit_form(obj, attrs=None, title="""", toolTips=None): |
""""""Shows parameters editor modal form. |
Arguments: |
obj: object to extract attribute values from, or a dict-like |
attrs: list of attribute names |
title: |
toolTips: |
"""""" |
if attrs is None: |
if hasattr(obj, ""keys""): |
attrs = list(obj.keys()) |
else: |
raise RuntimeError(""attrs is None and cannot determine it from obj"") |
specs = [] |
for i, name in enumerate(attrs): |
# Tries as attribute, then as key |
try: |
value = obj.__getattribute__(name) |
except AttributeError: |
value = obj[name] |
if value is None: |
value = """" # None becomes str |
dict_ = {""value"": value} |
if toolTips is not None: |
dict_[""toolTip""] = toolTips[i] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.