input stringlengths 11 7.65k | target stringlengths 22 8.26k |
|---|---|
def __init__(self,params,parent):
self.params=params
self.parent=parent | def message(self):
return self.protocol.messages[int(self.ui.spinBoxFuzzMessage.value() - 1)] |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_rule_300(self):
oRule = iteration_scheme.rule_300()
self.assertTrue(oRule)
self.assertEqual(oRule.name, 'iteration_scheme')
self.assertEqual(oRule.identifier, '300')
lExpected = [13, 17]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extrac... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def current_label_index(self):
return self.ui.comboBoxFuzzingLabel.currentIndex() |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def current_label(self) -> ProtocolLabel:
if len(self.message.message_type) == 0:
return None
cur_label = self.message.message_type[self.current_label_index].get_copy()
self.message.message_type[self.current_label_index] = cur_label
cur_label.fuzz_values = [fv for fv in cur_... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def current_label_start(self):
if self.current_label and self.message:
return self.message.get_label_range(self.current_label, self.proto_view, False)[0]
else:
return -1 |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def current_label_end(self):
if self.current_label and self.message:
return self.message.get_label_range(self.current_label, self.proto_view, False)[1]
else:
return -1 |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def message_data(self):
if self.proto_view == 0:
return self.message.plain_bits_str
elif self.proto_view == 1:
return self.message.plain_hex_str
elif self.proto_view == 2:
return self.message.plain_ascii_str
else:
return None |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def create_connects(self):
self.ui.spinBoxFuzzingStart.valueChanged.connect(self.on_fuzzing_start_changed)
self.ui.spinBoxFuzzingEnd.valueChanged.connect(self.on_fuzzing_end_changed)
self.ui.comboBoxFuzzingLabel.currentIndexChanged.connect(self.on_combo_box_fuzzing_label_current_index_changed)
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def update_message_data_string(self):
fuz_start = self.current_label_start
fuz_end = self.current_label_end
num_proto_bits = 10
num_fuz_bits = 16
proto_start = fuz_start - num_proto_bits
preambel = "... "
if proto_start <= 0:
proto_start = 0
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def closeEvent(self, event: QCloseEvent):
settings.write("{}/geometry".format(self.__class__.__name__), self.saveGeometry())
super().closeEvent(event) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_fuzzing_start_changed(self, value: int):
self.ui.spinBoxFuzzingEnd.setMinimum(self.ui.spinBoxFuzzingStart.value())
new_start = self.message.convert_index(value - 1, self.proto_view, 0, False)[0]
self.current_label.start = new_start
self.current_label.fuzz_values[:] = []
se... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_fuzzing_end_changed(self, value: int):
self.ui.spinBoxFuzzingStart.setMaximum(self.ui.spinBoxFuzzingEnd.value())
new_end = self.message.convert_index(value - 1, self.proto_view, 0, False)[1] + 1
self.current_label.end = new_end
self.current_label.fuzz_values[:] = []
self.u... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_combo_box_fuzzing_label_current_index_changed(self, index: int):
self.fuzz_table_model.fuzzing_label = self.current_label
self.fuzz_table_model.update()
self.update_message_data_string()
self.ui.tblFuzzingValues.resize_me()
self.ui.spinBoxFuzzingStart.blockSignals(True)
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_btn_add_row_clicked(self):
self.current_label.add_fuzz_value()
self.fuzz_table_model.update() |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_btn_del_row_clicked(self):
min_row, max_row, _, _ = self.ui.tblFuzzingValues.selection_range()
self.delete_lines(min_row, max_row) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def delete_lines(self, min_row, max_row):
if min_row == -1:
self.current_label.fuzz_values = self.current_label.fuzz_values[:-1]
else:
self.current_label.fuzz_values = self.current_label.fuzz_values[:min_row] + self.current_label.fuzz_values[
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_remove_duplicates_state_changed(self):
self.fuzz_table_model.remove_duplicates = self.ui.chkBRemoveDuplicates.isChecked()
self.fuzz_table_model.update()
self.remove_duplicates() |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def set_add_spinboxes_maximum_on_label_change(self):
nbits = self.current_label.end - self.current_label.start # Use Bit Start/End for maximum calc.
if nbits >= 32:
nbits = 31
max_val = 2 ** nbits - 1
self.ui.sBAddRangeStart.setMaximum(max_val - 1)
self.ui.sBAddRange... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_fuzzing_range_start_changed(self, value: int):
self.ui.sBAddRangeEnd.setMinimum(value)
self.ui.sBAddRangeStep.setMaximum(self.ui.sBAddRangeEnd.value() - value) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_fuzzing_range_end_changed(self, value: int):
self.ui.sBAddRangeStart.setMaximum(value - 1)
self.ui.sBAddRangeStep.setMaximum(value - self.ui.sBAddRangeStart.value()) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_lower_bound_checked_changed(self):
if self.ui.checkBoxLowerBound.isChecked():
self.ui.spinBoxLowerBound.setEnabled(True)
self.ui.spinBoxBoundaryNumber.setEnabled(True)
elif not self.ui.checkBoxUpperBound.isChecked():
self.ui.spinBoxLowerBound.setEnabled(False)
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_upper_bound_checked_changed(self):
if self.ui.checkBoxUpperBound.isChecked():
self.ui.spinBoxUpperBound.setEnabled(True)
self.ui.spinBoxBoundaryNumber.setEnabled(True)
elif not self.ui.checkBoxLowerBound.isChecked():
self.ui.spinBoxUpperBound.setEnabled(False)
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_lower_bound_changed(self):
self.ui.spinBoxUpperBound.setMinimum(self.ui.spinBoxLowerBound.value())
self.ui.spinBoxBoundaryNumber.setMaximum(math.ceil((self.ui.spinBoxUpperBound.value()
- self.ui.spinBoxLowerBound.value()) / 2)) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_upper_bound_changed(self):
self.ui.spinBoxLowerBound.setMaximum(self.ui.spinBoxUpperBound.value() - 1)
self.ui.spinBoxBoundaryNumber.setMaximum(math.ceil((self.ui.spinBoxUpperBound.value()
- self.ui.spinBoxLowerBound.value()) / 2)) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_random_range_min_changed(self):
self.ui.spinBoxRandomMaximum.setMinimum(self.ui.spinBoxRandomMinimum.value()) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_random_range_max_changed(self):
self.ui.spinBoxRandomMinimum.setMaximum(self.ui.spinBoxRandomMaximum.value() - 1) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_btn_add_fuzzing_values_clicked(self):
if self.ui.comboBoxStrategy.currentIndex() == 0:
self.__add_fuzzing_range()
elif self.ui.comboBoxStrategy.currentIndex() == 1:
self.__add_fuzzing_boundaries()
elif self.ui.comboBoxStrategy.currentIndex() == 2:
self.... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __add_fuzzing_range(self):
start = self.ui.sBAddRangeStart.value()
end = self.ui.sBAddRangeEnd.value()
step = self.ui.sBAddRangeStep.value()
self.fuzz_table_model.add_range(start, end + 1, step) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __add_fuzzing_boundaries(self):
lower_bound = -1
if self.ui.spinBoxLowerBound.isEnabled():
lower_bound = self.ui.spinBoxLowerBound.value()
upper_bound = -1
if self.ui.spinBoxUpperBound.isEnabled():
upper_bound = self.ui.spinBoxUpperBound.value()
num_... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __add_random_fuzzing_values(self):
n = self.ui.spinBoxNumberRandom.value()
minimum = self.ui.spinBoxRandomMinimum.value()
maximum = self.ui.spinBoxRandomMaximum.value()
self.fuzz_table_model.add_random(n, minimum, maximum) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def remove_duplicates(self):
if self.ui.chkBRemoveDuplicates.isChecked():
for lbl in self.message.message_type:
seq = lbl.fuzz_values[:]
seen = set()
add_seen = seen.add
lbl.fuzz_values = [l for l in seq if not (l in seen or add_seen(l)... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def set_current_label_name(self):
self.current_label.name = self.ui.comboBoxFuzzingLabel.currentText()
self.ui.comboBoxFuzzingLabel.setItemText(self.ui.comboBoxFuzzingLabel.currentIndex(), self.current_label.name) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def on_fuzz_msg_changed(self, index: int):
self.ui.comboBoxFuzzingLabel.setDisabled(False)
sel_label_ind = self.ui.comboBoxFuzzingLabel.currentIndex()
self.ui.comboBoxFuzzingLabel.blockSignals(True)
self.ui.comboBoxFuzzingLabel.clear()
if len(self.message.message_type) == 0:
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(address)
sock.listen(5)
sock.setbl... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | async def echo_client(loop, client):
try:
client.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
except (OSError, NameError):
pass
with client:
while True:
data = await loop.sock_recv(client, 1000000)
if not data:
break
await... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | async def echo_client_streams(reader, writer):
sock = writer.get_extra_info('socket')
try:
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
except (OSError, NameError):
pass
if PRINT:
print('Connection from', sock.getpeername())
while True:
data = await read... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def connection_made(self, transport):
self.transport = transport |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def connection_lost(self, exc):
self.transport = None |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def data_received(self, data):
self.transport.write(data) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def connection_made(self, transport):
self.transport = transport
# Here the buffer is intended to be copied, so that the outgoing buffer
# won't be wrongly updated by next read
self.buffer = bytearray(256 * 1024) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def get_buffer(self, sizehint):
return self.buffer |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def buffer_updated(self, nbytes):
self.transport.write(self.buffer[:nbytes]) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | async def print_debug(loop):
while True:
print(chr(27) + "[2J") # clear screen
loop.print_debug_info()
await asyncio.sleep(0.5) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_error_on_wrong_value_for_consumed_capacity():
resource = boto3.resource("dynamodb", region_name="ap-northeast-3")
client = boto3.client("dynamodb", region_name="ap-northeast-3")
client.create_table(
TableName="jobs",
KeySchema=[{"AttributeName": "job_id", "KeyType": "HASH"}],
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def index(self, request):
queryset = Condition.objects.select_related('source', 'target_option')
serializer = ConditionIndexSerializer(queryset, many=True)
return Response(serializer.data) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_consumed_capacity_get_unknown_item():
conn = boto3.client("dynamodb", region_name="us-east-1")
conn.create_table(
TableName="test_table",
KeySchema=[{"AttributeName": "u", "KeyType": "HASH"}],
AttributeDefinitions=[{"AttributeName": "u", "AttributeType": "S"}],
BillingMo... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def export(self, request):
serializer = ConditionExportSerializer(self.get_queryset(), many=True)
xml = ConditionRenderer().render(serializer.data)
return XMLResponse(xml, name='conditions') |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_only_return_consumed_capacity_when_required(
capacity, should_have_capacity, should_have_table
):
resource = boto3.resource("dynamodb", region_name="ap-northeast-3")
client = boto3.client("dynamodb", region_name="ap-northeast-3")
client.create_table(
TableName="jobs",
KeySchema=... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def detail_export(self, request, pk=None):
serializer = ConditionExportSerializer(self.get_object())
xml = ConditionRenderer().render([serializer.data])
return XMLResponse(xml, name=self.get_object().key) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def __init__(self, translations_path, domain_name: str):
super().__init__()
self.update_types = self.process_update_types()
self.path = translations_path
self.domain = domain_name
self.translations = self.find_translations() |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def opengl_lamp_buttons(column, lamp):
split = column.row()
split.prop(lamp, "use", text="", icon='OUTLINER_OB_LAMP' if lamp.use else 'LAMP_DATA')
col = split.column()
col.active = lamp.use
row = col.row()
row.label(text="Diffuse:")
row.prop(lamp, "diffuse_color", text="")
row = col.ro... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def available_translations(self):
return list(self.translations) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw(self, context):
layout = self.layout
layout.template_header()
userpref = context.user_preferences
layout.operator_context = 'EXEC_AREA'
layout.operator("wm.save_userpref")
layout.operator_context = 'INVOKE_DEFAULT'
if userpref.active_section == 'INPU... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def gettext(self, text: str, lang: str = None):
"""
Singular translations
"""
if lang is None:
lang = self.context_lang.get()
if lang not in self.translations:
return text
translator = self.translations[lang]
return translator.gettext(te... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw(self, context):
layout = self.layout
userpref = context.user_preferences
layout.prop(userpref, "active_section", expand=True) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def ngettext(self, singular: str, plural: str, lang: str = None, n=1):
"""
Plural translations
"""
if lang is None:
lang = self.context_lang.get()
if lang not in self.translations:
if n == 1:
return singular
return plural
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw(self, context):
self.layout.operator("wm.appconfig_default", text="Blender (default)")
# now draw the presets
Menu.draw_preset(self, context) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def lazy_gettext(self, text: str, lang: str = None):
if not babel_imported:
raise RuntimeError('babel module is not imported. Check that you installed it.')
return LazyProxy(self.gettext, text, lang, enable_cache=False) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw(self, context):
layout = self.layout
split = layout.split()
row = split.row()
row.label("")
row = split.row()
row.label("Interaction:")
text = bpy.path.display_name(context.window_manager.keyconfigs.active.name)
if not text:
text = "... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def lazy_ngettext(self, singular: str, plural: str, lang: str = None, n=1):
if not babel_imported:
raise RuntimeError('babel module is not imported. Check that you installed it.')
return LazyProxy(self.ngettext, singular, plural, lang, n, enable_cache=False) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | async def get_user_language(self, obj):
"""
You need to override this method and return user language
"""
raise NotImplementedError |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'INTERFACE') |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def process_update_types(self) -> list:
"""
You need to override this method and return any update types which you want to be processed
"""
raise NotImplementedError |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw(self, context):
import sys
layout = self.layout
userpref = context.user_preferences
view = userpref.view
row = layout.row()
col = row.column()
col.label(text="Display:")
col.prop(view, "show_tooltips")
col.prop(view, "show_tooltips_pyth... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | async def pre_process(self, message, data):
"""
context language variable will be set each time when update from 'process_update_types' comes
value is the result of 'get_user_language' method
"""
self.context_lang.set(await self.get_user_language(obj=message)) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'EDITING') |
def __init__(self,params,parent):
self.params=params
self.parent=parent | async def post_process(self, message, data, exception):
pass |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw(self, context):
layout = self.layout
userpref = context.user_preferences
edit = userpref.edit
row = layout.row()
col = row.column()
col.label(text="Link Materials To:")
col.prop(edit, "material_link", text="")
col.separator()
col.separ... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'SYSTEM') |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw(self, context):
import sys
layout = self.layout
userpref = context.user_preferences
system = userpref.system
split = layout.split()
# 1. Column
column = split.column()
colsplit = column.split(percentage=0.85)
col = colsplit.column()
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def theme_generic_recurse(data):
col.label(data.rna_type.name)
row = col.row()
subsplit = row.split(percentage=0.95)
padding1 = subsplit.split(percentage=0.15)
padding1.column()
subsplit = row.split(percentage=0.85)
padding2 = subspl... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _theme_widget_style(layout, widget_style):
row = layout.row()
subsplit = row.split(percentage=0.95)
padding = subsplit.split(percentage=0.15)
colsub = padding.column()
colsub = padding.column()
colsub.row().prop(widget_style, "outline")
colsub.row().prop(wi... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def _ui_font_style(layout, font_style):
split = layout.split()
col = split.column()
col.label(text="Kerning Style:")
col.row().prop(font_style, "font_kerning_style", expand=True)
col.prop(font_style, "points")
col = split.column()
col.label(text="Shadow Offset:... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'THEMES') |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw(self, context):
layout = self.layout
theme = context.user_preferences.themes[0]
split_themes = layout.split(percentage=0.2)
sub = split_themes.column()
sub.label(text="Presets:")
subrow = sub.row(align=True)
subrow.menu("USERPREF_MT_interface_theme_p... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'FILES') |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw(self, context):
layout = self.layout
userpref = context.user_preferences
paths = userpref.filepaths
system = userpref.system
split = layout.split(percentage=0.7)
col = split.column()
col.label(text="File Paths:")
colsplit = col.split(percentag... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw(self, context):
layout = self.layout
input_prefs = context.user_preferences.inputs
is_view3d = context.space_data.type == 'VIEW_3D'
layout.prop(input_prefs, "ndof_sensitivity")
layout.prop(input_prefs, "ndof_orbit_sensitivity")
layout.prop(input_prefs, "ndof_d... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw(self, context):
props = self.layout.operator("wm.context_set_value", text="Blender (default)")
props.data_path = "window_manager.keyconfigs.active"
props.value = "context.window_manager.keyconfigs.default"
# now draw the presets
Menu.draw_preset(self, context) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'INPUT') |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw_input_prefs(inputs, layout):
import sys
# General settings
row = layout.row()
col = row.column()
sub = col.column()
sub.label(text="Presets:")
subrow = sub.row(align=True)
subrow.menu("USERPREF_MT_interaction_presets", text=bpy.types.USERPREF_M... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw(self, context):
from rna_keymap_ui import draw_keymaps
layout = self.layout
#import time
#start = time.time()
userpref = context.user_preferences
inputs = userpref.inputs
split = layout.split(percentage=0.25)
# Input settings
self.d... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw(self, context):
layout = self.layout
layout.operator(
"wm.url_open", text="Add-ons Catalog", icon='URL',
).url = "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts"
layout.separator()
layout.operator(
"wm.url_open", te... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'ADDONS') |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def is_user_addon(mod, user_addon_paths):
import os
if not user_addon_paths:
for path in (bpy.utils.script_path_user(),
bpy.utils.script_path_pref()):
if path is not None:
user_addon_paths.append(os.path.join(path, "addons"))
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw_error(layout, message):
lines = message.split("\n")
box = layout.box()
sub = box.row()
sub.label(lines[0])
sub.label(icon='ERROR')
for l in lines[1:]:
box.label(l) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def draw(self, context):
import os
import addon_utils
layout = self.layout
userpref = context.user_preferences
used_ext = {ext.module for ext in userpref.addons}
userpref_addons_folder = os.path.join(userpref.filepaths.script_directory, "addons")
scripts_addons... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def define_tables(cls, metadata):
Table(
"table1",
metadata,
Column(
"id", Integer, primary_key=True, test_needs_autoincrement=True
),
Column("data", String(30)),
)
Table(
"table2",
metadata,
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def memoized(*args):
try:
return stored_results[args]
except KeyError:
result = stored_results[args] = fn(*args)
return result |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_basic(self):
table2, table1 = self.tables.table2, self.tables.table1
Session = scoped_session(sa.orm.sessionmaker(testing.db))
class CustomQuery(query.Query):
pass
class SomeObject(fixtures.ComparableEntity):
query = Session.query_property()
c... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def get_folder_size(folder):
total_size = os.path.getsize(folder)
for item in os.listdir(folder):
itempath = os.path.join(folder, item)
if os.path.isfile(itempath):
total_size += os.path.getsize(itempath)
elif os.path.isdir(itempath):
total_size += get_folder_size... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_config_errors(self):
Session = scoped_session(sa.orm.sessionmaker())
s = Session() # noqa
assert_raises_message(
sa.exc.InvalidRequestError,
"Scoped session is already present",
Session,
bind=testing.db,
)
assert_warns_m... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def usage_iter(root):
root = os.path.abspath(root)
root_size = get_folder_size(root)
root_string = "{0}\n{1}".format(root, root_size)
yield [root_string, None, root_size] |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_call_with_kwargs(self):
mock_scope_func = Mock()
SessionMaker = sa.orm.sessionmaker()
Session = scoped_session(sa.orm.sessionmaker(), mock_scope_func)
s0 = SessionMaker()
assert s0.autoflush == True
mock_scope_func.return_value = 0
s1 = Session()
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def json_usage(root):
root = os.path.abspath(root)
result = [['Path', 'Parent', 'Usage']]
result.extend(entry for entry in usage_iter(root))
return json.dumps(result) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def test_methods_etc(self):
mock_session = Mock()
mock_session.bind = "the bind"
sess = scoped_session(lambda: mock_session)
sess.add("add")
sess.delete("delete")
sess.get("Cls", 5)
eq_(sess.bind, "the bind")
eq_(
mock_session.mock_calls,
... |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def main(args):
'''Populates an html template using JSON-formatted output from the
Linux 'du' utility and prints the result'''
html = ''' |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def get_bind(self, mapper=None, **kwargs):
return super().get_bind(mapper=mapper, **kwargs) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def get_bind(self, mapper=None, *args, **kwargs):
return super().get_bind(mapper, *args, **kwargs) |
def __init__(self,params,parent):
self.params=params
self.parent=parent | def get_bind(self, mapper=None, *args, **kwargs):
return super(MySession, self).get_bind(
mapper, *args, **kwargs
) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.