prompt
large_stringlengths 72
9.34k
| completion
large_stringlengths 0
7.61k
|
---|---|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
<|fim_middle|>
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
<|fim_middle|>
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
<|fim_middle|>
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
<|fim_middle|>
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
<|fim_middle|>
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
for i in self.chain:
self.invoke_with_context(i, "done")
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
<|fim_middle|>
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
<|fim_middle|>
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
return len(self.chain)
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
<|fim_middle|>
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
return pprint.pformat([str(i) for i in self.chain])
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
<|fim_middle|>
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
<|fim_middle|>
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
<|fim_middle|>
<|fim▁end|>
|
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
<|fim_middle|>
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
raise ValueError("No addons specified.")
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
<|fim_middle|>
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
return True
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
<|fim_middle|>
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
<|fim_middle|>
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def <|fim_middle|>(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
_get_name
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def <|fim_middle|>(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
__init__
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def <|fim_middle|>(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
options_update
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def <|fim_middle|>(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
add
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def <|fim_middle|>(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
remove
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def <|fim_middle|>(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
done
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def <|fim_middle|>(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
has_addon
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def <|fim_middle|>(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
__len__
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def <|fim_middle|>(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
__str__
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def <|fim_middle|>(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
invoke_with_context
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def <|fim_middle|>(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def __call__(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
invoke
|
<|file_name|>addons.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, print_function, division
from mitmproxy import exceptions
import pprint
def _get_name(itm):
return getattr(itm, "name", itm.__class__.__name__)
class Addons(object):
def __init__(self, master):
self.chain = []
self.master = master
master.options.changed.connect(self.options_update)
def options_update(self, options, updated):
for i in self.chain:
with self.master.handlecontext():
i.configure(options, updated)
def add(self, options, *addons):
if not addons:
raise ValueError("No addons specified.")
self.chain.extend(addons)
for i in addons:
self.invoke_with_context(i, "start")
self.invoke_with_context(
i,
"configure",
self.master.options,
self.master.options.keys()
)
def remove(self, addon):
self.chain = [i for i in self.chain if i is not addon]
self.invoke_with_context(addon, "done")
def done(self):
for i in self.chain:
self.invoke_with_context(i, "done")
def has_addon(self, name):
"""
Is an addon with this name registered?
"""
for i in self.chain:
if _get_name(i) == name:
return True
def __len__(self):
return len(self.chain)
def __str__(self):
return pprint.pformat([str(i) for i in self.chain])
def invoke_with_context(self, addon, name, *args, **kwargs):
with self.master.handlecontext():
self.invoke(addon, name, *args, **kwargs)
def invoke(self, addon, name, *args, **kwargs):
func = getattr(addon, name, None)
if func:
if not callable(func):
raise exceptions.AddonError(
"Addon handler %s not callable" % name
)
func(*args, **kwargs)
def <|fim_middle|>(self, name, *args, **kwargs):
for i in self.chain:
self.invoke(i, name, *args, **kwargs)
<|fim▁end|>
|
__call__
|
<|file_name|>de.py<|end_file_name|><|fim▁begin|># Authors: David Goodger; Gunnar Schwant
# Contact: goodger@users.sourceforge.net
# Revision: $Revision: 21817 $
# Date: $Date: 2005-07-21 13:39:57 -0700 (Thu, 21 Jul 2005) $
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must be
# translated for each language: one in docutils/languages, the other in
# docutils/parsers/rst/languages.
"""
German language mappings for language-dependent features of Docutils.
"""
__docformat__ = 'reStructuredText'
labels = {
'author': 'Autor',
'authors': 'Autoren',
'organization': 'Organisation',
'address': 'Adresse',
'contact': 'Kontakt',
'version': 'Version',
'revision': 'Revision',
'status': 'Status',
'date': 'Datum',
'dedication': 'Widmung',
'copyright': 'Copyright',
'abstract': 'Zusammenfassung',
'attention': 'Achtung!',
'caution': 'Vorsicht!',
'danger': '!GEFAHR!',
'error': 'Fehler',
'hint': 'Hinweis',
'important': 'Wichtig',
'note': 'Bemerkung',
'tip': 'Tipp',
'warning': 'Warnung',
'contents': 'Inhalt'}
"""Mapping of node class name to label text."""<|fim▁hole|>bibliographic_fields = {
'autor': 'author',
'autoren': 'authors',
'organisation': 'organization',
'adresse': 'address',
'kontakt': 'contact',
'version': 'version',
'revision': 'revision',
'status': 'status',
'datum': 'date',
'copyright': 'copyright',
'widmung': 'dedication',
'zusammenfassung': 'abstract'}
"""German (lowcased) to canonical name mapping for bibliographic fields."""
author_separators = [';', ',']
"""List of separator strings for the 'Authors' bibliographic field. Tried in
order."""<|fim▁end|>
| |
<|file_name|>connectivity_source_py3.py<|end_file_name|><|fim▁begin|># coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class ConnectivitySource(Model):
"""Parameters that define the source of the connection.
All required parameters must be populated in order to send to Azure.
:param resource_id: Required. The ID of the resource from which a
connectivity check will be initiated.
:type resource_id: str
:param port: The source port from which a connectivity check will be
performed.
:type port: int
"""
_validation = {<|fim▁hole|> }
_attribute_map = {
'resource_id': {'key': 'resourceId', 'type': 'str'},
'port': {'key': 'port', 'type': 'int'},
}
def __init__(self, *, resource_id: str, port: int=None, **kwargs) -> None:
super(ConnectivitySource, self).__init__(**kwargs)
self.resource_id = resource_id
self.port = port<|fim▁end|>
|
'resource_id': {'required': True},
|
<|file_name|>connectivity_source_py3.py<|end_file_name|><|fim▁begin|># coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class ConnectivitySource(Model):
<|fim_middle|>
<|fim▁end|>
|
"""Parameters that define the source of the connection.
All required parameters must be populated in order to send to Azure.
:param resource_id: Required. The ID of the resource from which a
connectivity check will be initiated.
:type resource_id: str
:param port: The source port from which a connectivity check will be
performed.
:type port: int
"""
_validation = {
'resource_id': {'required': True},
}
_attribute_map = {
'resource_id': {'key': 'resourceId', 'type': 'str'},
'port': {'key': 'port', 'type': 'int'},
}
def __init__(self, *, resource_id: str, port: int=None, **kwargs) -> None:
super(ConnectivitySource, self).__init__(**kwargs)
self.resource_id = resource_id
self.port = port
|
<|file_name|>connectivity_source_py3.py<|end_file_name|><|fim▁begin|># coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class ConnectivitySource(Model):
"""Parameters that define the source of the connection.
All required parameters must be populated in order to send to Azure.
:param resource_id: Required. The ID of the resource from which a
connectivity check will be initiated.
:type resource_id: str
:param port: The source port from which a connectivity check will be
performed.
:type port: int
"""
_validation = {
'resource_id': {'required': True},
}
_attribute_map = {
'resource_id': {'key': 'resourceId', 'type': 'str'},
'port': {'key': 'port', 'type': 'int'},
}
def __init__(self, *, resource_id: str, port: int=None, **kwargs) -> None:
<|fim_middle|>
<|fim▁end|>
|
super(ConnectivitySource, self).__init__(**kwargs)
self.resource_id = resource_id
self.port = port
|
<|file_name|>connectivity_source_py3.py<|end_file_name|><|fim▁begin|># coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class ConnectivitySource(Model):
"""Parameters that define the source of the connection.
All required parameters must be populated in order to send to Azure.
:param resource_id: Required. The ID of the resource from which a
connectivity check will be initiated.
:type resource_id: str
:param port: The source port from which a connectivity check will be
performed.
:type port: int
"""
_validation = {
'resource_id': {'required': True},
}
_attribute_map = {
'resource_id': {'key': 'resourceId', 'type': 'str'},
'port': {'key': 'port', 'type': 'int'},
}
def <|fim_middle|>(self, *, resource_id: str, port: int=None, **kwargs) -> None:
super(ConnectivitySource, self).__init__(**kwargs)
self.resource_id = resource_id
self.port = port
<|fim▁end|>
|
__init__
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))<|fim▁hole|> else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
<|fim_middle|>
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
<|fim_middle|>
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
<|fim_middle|>
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
<|fim_middle|>
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
<|fim_middle|>
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
<|fim_middle|>
<|fim▁end|>
|
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
<|fim_middle|>
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
<|fim_middle|>
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
<|fim_middle|>
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
<|fim_middle|>
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
<|fim_middle|>
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
<|fim_middle|>
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
<|fim_middle|>
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
<|fim_middle|>
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
<|fim_middle|>
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
<|fim_middle|>
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
<|fim_middle|>
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
<|fim_middle|>
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
<|fim_middle|>
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
<|fim_middle|>
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def <|fim_middle|>(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
combine_browsers_logs
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def <|fim_middle|>(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
combine_logs
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def <|fim_middle|>():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
zip_logs
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def <|fim_middle|>():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
zip_browsers_logs
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def <|fim_middle|>():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def delete_previous_logs_browser():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
delete_previous_logs
|
<|file_name|>logs.py<|end_file_name|><|fim▁begin|>import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\\browserlogs\\" + device + "\output.xml "
else:
cmd += os.getcwd() + "/browserlogs/" + device + "/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "\\browserlogs\\" + device + "\\" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "\\", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
else:
for idx, device in enumerate(udid):
pngs += glob.glob(os.getcwd() + "/browserlogs/" + device + "/" + "*.png")
for p in pngs:
shutil.copy(p, p.replace(device + "/", ""))
#remove those that have been moved/copied
pngs = [p for p in pngs if not p]
def combine_logs(udid):
cmd = 'rebot -N Combined --outputdir logs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system() == "Windows":
cmd += os.getcwd() + "\logs\\" + device + "_" + "*\output.xml "
else:
cmd += os.getcwd() + "/logs/" + device + "_" + "*/output.xml "
cr.run_command(cmd)
pngs = []
#For screenshot images
if platform.system() == "Windows":
pngs = glob.glob(os.getcwd() + "\logs\**\*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('\\')+1:]
k = p.rfind("\logs\\")
path = p[:k]
newPath = path + "\logs\\" + imgname
shutil.move(p,newPath)
else:
pngs = glob.glob(os.getcwd() + "/logs/**/*.png")
for idx, device in enumerate(udid):
for p in pngs:
if Path(p).is_file(): #If image exist
imgname = p[p.rindex('/')+1:]
k = p.rfind("/logs/")
path = p[:k]
newPath = path + "/logs/" + imgname
shutil.move(p,newPath)
def zip_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive logs logs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr logs-$(date +%Y-%m-%d-%H%M).zip" + " logs/"
cr.run_command(cmd)
def zip_browsers_logs():
if platform.system() == "Windows":
cmd = "Compress-Archive browserlogs browserlogs-$(date +%Y-%m-%d-%H%M).zip"
subprocess.call(["powershell.exe", cmd])
elif platform.system() == "Linux" or platform.system() == "Darwin":
cmd = "zip -vr browserlogs-$(date +%Y-%m-%d-%H%M).zip" + " browserlogs/"
cr.run_command(cmd)
def delete_previous_logs():
cmd = 'rm -rf logs/*'
cr.run_command(cmd)
def <|fim_middle|>():
cmd = 'rm -rf browserlogs/*'
cr.run_command(cmd)<|fim▁end|>
|
delete_previous_logs_browser
|
<|file_name|>test_client_authorize.py<|end_file_name|><|fim▁begin|>import collections
import json
import unittest
import responses
from requests import HTTPError
from mock import patch
from batfish import Client
from batfish.__about__ import __version__
class TestClientAuthorize(unittest.TestCase):
def setUp(self):
with patch('batfish.client.read_token_from_conf',
return_value=None):
self.cli = Client()
@responses.activate
def test_authorize_error(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,<|fim▁hole|> with self.assertRaises(HTTPError):
self.cli.authorize("test_token")
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/kura"
body = {'id': "unauthorized", 'message': "Unable to authenticate you."}
responses.add(responses.GET, url, body=json.dumps(body), status=401,
content_type="application/json")
self.cli.authorize("test_token")
self.assertEquals(responses.calls[0].response.status_code, 401)
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=200,
content_type="application/json")
auth = self.cli.authorize("test_token")
self.assertEquals(auth, "OK")
self.assertEquals(responses.calls[0].response.status_code, 200)<|fim▁end|>
|
body='{"error": "something"}', status=500,
content_type="application/json")
|
<|file_name|>test_client_authorize.py<|end_file_name|><|fim▁begin|>import collections
import json
import unittest
import responses
from requests import HTTPError
from mock import patch
from batfish import Client
from batfish.__about__ import __version__
class TestClientAuthorize(unittest.TestCase):
<|fim_middle|>
<|fim▁end|>
|
def setUp(self):
with patch('batfish.client.read_token_from_conf',
return_value=None):
self.cli = Client()
@responses.activate
def test_authorize_error(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=500,
content_type="application/json")
with self.assertRaises(HTTPError):
self.cli.authorize("test_token")
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/kura"
body = {'id': "unauthorized", 'message': "Unable to authenticate you."}
responses.add(responses.GET, url, body=json.dumps(body), status=401,
content_type="application/json")
self.cli.authorize("test_token")
self.assertEquals(responses.calls[0].response.status_code, 401)
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=200,
content_type="application/json")
auth = self.cli.authorize("test_token")
self.assertEquals(auth, "OK")
self.assertEquals(responses.calls[0].response.status_code, 200)
|
<|file_name|>test_client_authorize.py<|end_file_name|><|fim▁begin|>import collections
import json
import unittest
import responses
from requests import HTTPError
from mock import patch
from batfish import Client
from batfish.__about__ import __version__
class TestClientAuthorize(unittest.TestCase):
def setUp(self):
<|fim_middle|>
@responses.activate
def test_authorize_error(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=500,
content_type="application/json")
with self.assertRaises(HTTPError):
self.cli.authorize("test_token")
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/kura"
body = {'id': "unauthorized", 'message': "Unable to authenticate you."}
responses.add(responses.GET, url, body=json.dumps(body), status=401,
content_type="application/json")
self.cli.authorize("test_token")
self.assertEquals(responses.calls[0].response.status_code, 401)
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=200,
content_type="application/json")
auth = self.cli.authorize("test_token")
self.assertEquals(auth, "OK")
self.assertEquals(responses.calls[0].response.status_code, 200)
<|fim▁end|>
|
with patch('batfish.client.read_token_from_conf',
return_value=None):
self.cli = Client()
|
<|file_name|>test_client_authorize.py<|end_file_name|><|fim▁begin|>import collections
import json
import unittest
import responses
from requests import HTTPError
from mock import patch
from batfish import Client
from batfish.__about__ import __version__
class TestClientAuthorize(unittest.TestCase):
def setUp(self):
with patch('batfish.client.read_token_from_conf',
return_value=None):
self.cli = Client()
@responses.activate
def test_authorize_error(self):
<|fim_middle|>
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/kura"
body = {'id': "unauthorized", 'message': "Unable to authenticate you."}
responses.add(responses.GET, url, body=json.dumps(body), status=401,
content_type="application/json")
self.cli.authorize("test_token")
self.assertEquals(responses.calls[0].response.status_code, 401)
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=200,
content_type="application/json")
auth = self.cli.authorize("test_token")
self.assertEquals(auth, "OK")
self.assertEquals(responses.calls[0].response.status_code, 200)
<|fim▁end|>
|
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=500,
content_type="application/json")
with self.assertRaises(HTTPError):
self.cli.authorize("test_token")
|
<|file_name|>test_client_authorize.py<|end_file_name|><|fim▁begin|>import collections
import json
import unittest
import responses
from requests import HTTPError
from mock import patch
from batfish import Client
from batfish.__about__ import __version__
class TestClientAuthorize(unittest.TestCase):
def setUp(self):
with patch('batfish.client.read_token_from_conf',
return_value=None):
self.cli = Client()
@responses.activate
def test_authorize_error(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=500,
content_type="application/json")
with self.assertRaises(HTTPError):
self.cli.authorize("test_token")
@responses.activate
def test_authorize_unauthorized(self):
<|fim_middle|>
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=200,
content_type="application/json")
auth = self.cli.authorize("test_token")
self.assertEquals(auth, "OK")
self.assertEquals(responses.calls[0].response.status_code, 200)
<|fim▁end|>
|
url = "https://api.digitalocean.com/v2/kura"
body = {'id': "unauthorized", 'message': "Unable to authenticate you."}
responses.add(responses.GET, url, body=json.dumps(body), status=401,
content_type="application/json")
self.cli.authorize("test_token")
self.assertEquals(responses.calls[0].response.status_code, 401)
|
<|file_name|>test_client_authorize.py<|end_file_name|><|fim▁begin|>import collections
import json
import unittest
import responses
from requests import HTTPError
from mock import patch
from batfish import Client
from batfish.__about__ import __version__
class TestClientAuthorize(unittest.TestCase):
def setUp(self):
with patch('batfish.client.read_token_from_conf',
return_value=None):
self.cli = Client()
@responses.activate
def test_authorize_error(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=500,
content_type="application/json")
with self.assertRaises(HTTPError):
self.cli.authorize("test_token")
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/kura"
body = {'id': "unauthorized", 'message': "Unable to authenticate you."}
responses.add(responses.GET, url, body=json.dumps(body), status=401,
content_type="application/json")
self.cli.authorize("test_token")
self.assertEquals(responses.calls[0].response.status_code, 401)
@responses.activate
def test_authorize_unauthorized(self):
<|fim_middle|>
<|fim▁end|>
|
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=200,
content_type="application/json")
auth = self.cli.authorize("test_token")
self.assertEquals(auth, "OK")
self.assertEquals(responses.calls[0].response.status_code, 200)
|
<|file_name|>test_client_authorize.py<|end_file_name|><|fim▁begin|>import collections
import json
import unittest
import responses
from requests import HTTPError
from mock import patch
from batfish import Client
from batfish.__about__ import __version__
class TestClientAuthorize(unittest.TestCase):
def <|fim_middle|>(self):
with patch('batfish.client.read_token_from_conf',
return_value=None):
self.cli = Client()
@responses.activate
def test_authorize_error(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=500,
content_type="application/json")
with self.assertRaises(HTTPError):
self.cli.authorize("test_token")
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/kura"
body = {'id': "unauthorized", 'message': "Unable to authenticate you."}
responses.add(responses.GET, url, body=json.dumps(body), status=401,
content_type="application/json")
self.cli.authorize("test_token")
self.assertEquals(responses.calls[0].response.status_code, 401)
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=200,
content_type="application/json")
auth = self.cli.authorize("test_token")
self.assertEquals(auth, "OK")
self.assertEquals(responses.calls[0].response.status_code, 200)
<|fim▁end|>
|
setUp
|
<|file_name|>test_client_authorize.py<|end_file_name|><|fim▁begin|>import collections
import json
import unittest
import responses
from requests import HTTPError
from mock import patch
from batfish import Client
from batfish.__about__ import __version__
class TestClientAuthorize(unittest.TestCase):
def setUp(self):
with patch('batfish.client.read_token_from_conf',
return_value=None):
self.cli = Client()
@responses.activate
def <|fim_middle|>(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=500,
content_type="application/json")
with self.assertRaises(HTTPError):
self.cli.authorize("test_token")
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/kura"
body = {'id': "unauthorized", 'message': "Unable to authenticate you."}
responses.add(responses.GET, url, body=json.dumps(body), status=401,
content_type="application/json")
self.cli.authorize("test_token")
self.assertEquals(responses.calls[0].response.status_code, 401)
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=200,
content_type="application/json")
auth = self.cli.authorize("test_token")
self.assertEquals(auth, "OK")
self.assertEquals(responses.calls[0].response.status_code, 200)
<|fim▁end|>
|
test_authorize_error
|
<|file_name|>test_client_authorize.py<|end_file_name|><|fim▁begin|>import collections
import json
import unittest
import responses
from requests import HTTPError
from mock import patch
from batfish import Client
from batfish.__about__ import __version__
class TestClientAuthorize(unittest.TestCase):
def setUp(self):
with patch('batfish.client.read_token_from_conf',
return_value=None):
self.cli = Client()
@responses.activate
def test_authorize_error(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=500,
content_type="application/json")
with self.assertRaises(HTTPError):
self.cli.authorize("test_token")
@responses.activate
def <|fim_middle|>(self):
url = "https://api.digitalocean.com/v2/kura"
body = {'id': "unauthorized", 'message': "Unable to authenticate you."}
responses.add(responses.GET, url, body=json.dumps(body), status=401,
content_type="application/json")
self.cli.authorize("test_token")
self.assertEquals(responses.calls[0].response.status_code, 401)
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=200,
content_type="application/json")
auth = self.cli.authorize("test_token")
self.assertEquals(auth, "OK")
self.assertEquals(responses.calls[0].response.status_code, 200)
<|fim▁end|>
|
test_authorize_unauthorized
|
<|file_name|>test_client_authorize.py<|end_file_name|><|fim▁begin|>import collections
import json
import unittest
import responses
from requests import HTTPError
from mock import patch
from batfish import Client
from batfish.__about__ import __version__
class TestClientAuthorize(unittest.TestCase):
def setUp(self):
with patch('batfish.client.read_token_from_conf',
return_value=None):
self.cli = Client()
@responses.activate
def test_authorize_error(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=500,
content_type="application/json")
with self.assertRaises(HTTPError):
self.cli.authorize("test_token")
@responses.activate
def test_authorize_unauthorized(self):
url = "https://api.digitalocean.com/v2/kura"
body = {'id': "unauthorized", 'message': "Unable to authenticate you."}
responses.add(responses.GET, url, body=json.dumps(body), status=401,
content_type="application/json")
self.cli.authorize("test_token")
self.assertEquals(responses.calls[0].response.status_code, 401)
@responses.activate
def <|fim_middle|>(self):
url = "https://api.digitalocean.com/v2/actions"
responses.add(responses.GET, url,
body='{"error": "something"}', status=200,
content_type="application/json")
auth = self.cli.authorize("test_token")
self.assertEquals(auth, "OK")
self.assertEquals(responses.calls[0].response.status_code, 200)
<|fim▁end|>
|
test_authorize_unauthorized
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|>
|
from pony.orm.core import *
|
<|file_name|>0003_auto_20160810_1219.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-10 04:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('article', '0002_auto_20160810_0134'),
]
operations = [
migrations.RemoveField(
model_name='article',
name='content_1',
),<|fim▁hole|> name='content',
field=models.CharField(default=0, max_length=10000, verbose_name='内容'),
preserve_default=False,
),
migrations.AlterField(
model_name='article',
name='title',
field=models.CharField(max_length=100, verbose_name='标题'),
),
]<|fim▁end|>
|
migrations.AddField(
model_name='article',
|
<|file_name|>0003_auto_20160810_1219.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-10 04:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_middle|>
<|fim▁end|>
|
dependencies = [
('article', '0002_auto_20160810_0134'),
]
operations = [
migrations.RemoveField(
model_name='article',
name='content_1',
),
migrations.AddField(
model_name='article',
name='content',
field=models.CharField(default=0, max_length=10000, verbose_name='内容'),
preserve_default=False,
),
migrations.AlterField(
model_name='article',
name='title',
field=models.CharField(max_length=100, verbose_name='标题'),
),
]
|
<|file_name|>checkbutton.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# example checkbutton.py
import pygtk
pygtk.require('2.0')
import gtk
class CheckButton:
# Our callback.
# The data passed to this method is printed to stdout
def callback(self, widget, data=None):
print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
# This callback quits the program
def delete_event(self, widget, event, data=None):
gtk.main_quit()
return False
def __init__(self):
# Create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)<|fim▁hole|>
# Set a handler for delete_event that immediately
# exits GTK.
self.window.connect("delete_event", self.delete_event)
# Sets the border width of the window.
self.window.set_border_width(20)
# Create a vertical box
vbox = gtk.VBox(True, 2)
# Put the vbox in the main window
self.window.add(vbox)
# Create first button
button = gtk.CheckButton("check button 1")
# When the button is toggled, we call the "callback" method
# with a pointer to "button" as its argument
button.connect("toggled", self.callback, "check button 1")
# Insert button 1
vbox.pack_start(button, True, True, 2)
button.show()
# Create second button
button = gtk.CheckButton("check button 2")
# When the button is toggled, we call the "callback" method
# with a pointer to "button 2" as its argument
button.connect("toggled", self.callback, "check button 2")
# Insert button 2
vbox.pack_start(button, True, True, 2)
button.show()
# Create "Quit" button
button = gtk.Button("Quit")
# When the button is clicked, we call the mainquit function
# and the program exits
button.connect("clicked", lambda wid: gtk.main_quit())
# Insert the quit button
vbox.pack_start(button, True, True, 2)
button.show()
vbox.show()
self.window.show()
def main():
gtk.main()
return 0
if __name__ == "__main__":
CheckButton()
main()<|fim▁end|>
|
# Set the window title
self.window.set_title("Check Button")
|
<|file_name|>checkbutton.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# example checkbutton.py
import pygtk
pygtk.require('2.0')
import gtk
class CheckButton:
# Our callback.
# The data passed to this method is printed to stdout
<|fim_middle|>
def main():
gtk.main()
return 0
if __name__ == "__main__":
CheckButton()
main()
<|fim▁end|>
|
def callback(self, widget, data=None):
print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
# This callback quits the program
def delete_event(self, widget, event, data=None):
gtk.main_quit()
return False
def __init__(self):
# Create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
# Set the window title
self.window.set_title("Check Button")
# Set a handler for delete_event that immediately
# exits GTK.
self.window.connect("delete_event", self.delete_event)
# Sets the border width of the window.
self.window.set_border_width(20)
# Create a vertical box
vbox = gtk.VBox(True, 2)
# Put the vbox in the main window
self.window.add(vbox)
# Create first button
button = gtk.CheckButton("check button 1")
# When the button is toggled, we call the "callback" method
# with a pointer to "button" as its argument
button.connect("toggled", self.callback, "check button 1")
# Insert button 1
vbox.pack_start(button, True, True, 2)
button.show()
# Create second button
button = gtk.CheckButton("check button 2")
# When the button is toggled, we call the "callback" method
# with a pointer to "button 2" as its argument
button.connect("toggled", self.callback, "check button 2")
# Insert button 2
vbox.pack_start(button, True, True, 2)
button.show()
# Create "Quit" button
button = gtk.Button("Quit")
# When the button is clicked, we call the mainquit function
# and the program exits
button.connect("clicked", lambda wid: gtk.main_quit())
# Insert the quit button
vbox.pack_start(button, True, True, 2)
button.show()
vbox.show()
self.window.show()
|
<|file_name|>checkbutton.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# example checkbutton.py
import pygtk
pygtk.require('2.0')
import gtk
class CheckButton:
# Our callback.
# The data passed to this method is printed to stdout
def callback(self, widget, data=None):
<|fim_middle|>
# This callback quits the program
def delete_event(self, widget, event, data=None):
gtk.main_quit()
return False
def __init__(self):
# Create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
# Set the window title
self.window.set_title("Check Button")
# Set a handler for delete_event that immediately
# exits GTK.
self.window.connect("delete_event", self.delete_event)
# Sets the border width of the window.
self.window.set_border_width(20)
# Create a vertical box
vbox = gtk.VBox(True, 2)
# Put the vbox in the main window
self.window.add(vbox)
# Create first button
button = gtk.CheckButton("check button 1")
# When the button is toggled, we call the "callback" method
# with a pointer to "button" as its argument
button.connect("toggled", self.callback, "check button 1")
# Insert button 1
vbox.pack_start(button, True, True, 2)
button.show()
# Create second button
button = gtk.CheckButton("check button 2")
# When the button is toggled, we call the "callback" method
# with a pointer to "button 2" as its argument
button.connect("toggled", self.callback, "check button 2")
# Insert button 2
vbox.pack_start(button, True, True, 2)
button.show()
# Create "Quit" button
button = gtk.Button("Quit")
# When the button is clicked, we call the mainquit function
# and the program exits
button.connect("clicked", lambda wid: gtk.main_quit())
# Insert the quit button
vbox.pack_start(button, True, True, 2)
button.show()
vbox.show()
self.window.show()
def main():
gtk.main()
return 0
if __name__ == "__main__":
CheckButton()
main()
<|fim▁end|>
|
print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
|
<|file_name|>checkbutton.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# example checkbutton.py
import pygtk
pygtk.require('2.0')
import gtk
class CheckButton:
# Our callback.
# The data passed to this method is printed to stdout
def callback(self, widget, data=None):
print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
# This callback quits the program
def delete_event(self, widget, event, data=None):
<|fim_middle|>
def __init__(self):
# Create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
# Set the window title
self.window.set_title("Check Button")
# Set a handler for delete_event that immediately
# exits GTK.
self.window.connect("delete_event", self.delete_event)
# Sets the border width of the window.
self.window.set_border_width(20)
# Create a vertical box
vbox = gtk.VBox(True, 2)
# Put the vbox in the main window
self.window.add(vbox)
# Create first button
button = gtk.CheckButton("check button 1")
# When the button is toggled, we call the "callback" method
# with a pointer to "button" as its argument
button.connect("toggled", self.callback, "check button 1")
# Insert button 1
vbox.pack_start(button, True, True, 2)
button.show()
# Create second button
button = gtk.CheckButton("check button 2")
# When the button is toggled, we call the "callback" method
# with a pointer to "button 2" as its argument
button.connect("toggled", self.callback, "check button 2")
# Insert button 2
vbox.pack_start(button, True, True, 2)
button.show()
# Create "Quit" button
button = gtk.Button("Quit")
# When the button is clicked, we call the mainquit function
# and the program exits
button.connect("clicked", lambda wid: gtk.main_quit())
# Insert the quit button
vbox.pack_start(button, True, True, 2)
button.show()
vbox.show()
self.window.show()
def main():
gtk.main()
return 0
if __name__ == "__main__":
CheckButton()
main()
<|fim▁end|>
|
gtk.main_quit()
return False
|
<|file_name|>checkbutton.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# example checkbutton.py
import pygtk
pygtk.require('2.0')
import gtk
class CheckButton:
# Our callback.
# The data passed to this method is printed to stdout
def callback(self, widget, data=None):
print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
# This callback quits the program
def delete_event(self, widget, event, data=None):
gtk.main_quit()
return False
def __init__(self):
# Create a new window
<|fim_middle|>
def main():
gtk.main()
return 0
if __name__ == "__main__":
CheckButton()
main()
<|fim▁end|>
|
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
# Set the window title
self.window.set_title("Check Button")
# Set a handler for delete_event that immediately
# exits GTK.
self.window.connect("delete_event", self.delete_event)
# Sets the border width of the window.
self.window.set_border_width(20)
# Create a vertical box
vbox = gtk.VBox(True, 2)
# Put the vbox in the main window
self.window.add(vbox)
# Create first button
button = gtk.CheckButton("check button 1")
# When the button is toggled, we call the "callback" method
# with a pointer to "button" as its argument
button.connect("toggled", self.callback, "check button 1")
# Insert button 1
vbox.pack_start(button, True, True, 2)
button.show()
# Create second button
button = gtk.CheckButton("check button 2")
# When the button is toggled, we call the "callback" method
# with a pointer to "button 2" as its argument
button.connect("toggled", self.callback, "check button 2")
# Insert button 2
vbox.pack_start(button, True, True, 2)
button.show()
# Create "Quit" button
button = gtk.Button("Quit")
# When the button is clicked, we call the mainquit function
# and the program exits
button.connect("clicked", lambda wid: gtk.main_quit())
# Insert the quit button
vbox.pack_start(button, True, True, 2)
button.show()
vbox.show()
self.window.show()
|
<|file_name|>checkbutton.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# example checkbutton.py
import pygtk
pygtk.require('2.0')
import gtk
class CheckButton:
# Our callback.
# The data passed to this method is printed to stdout
def callback(self, widget, data=None):
print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
# This callback quits the program
def delete_event(self, widget, event, data=None):
gtk.main_quit()
return False
def __init__(self):
# Create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
# Set the window title
self.window.set_title("Check Button")
# Set a handler for delete_event that immediately
# exits GTK.
self.window.connect("delete_event", self.delete_event)
# Sets the border width of the window.
self.window.set_border_width(20)
# Create a vertical box
vbox = gtk.VBox(True, 2)
# Put the vbox in the main window
self.window.add(vbox)
# Create first button
button = gtk.CheckButton("check button 1")
# When the button is toggled, we call the "callback" method
# with a pointer to "button" as its argument
button.connect("toggled", self.callback, "check button 1")
# Insert button 1
vbox.pack_start(button, True, True, 2)
button.show()
# Create second button
button = gtk.CheckButton("check button 2")
# When the button is toggled, we call the "callback" method
# with a pointer to "button 2" as its argument
button.connect("toggled", self.callback, "check button 2")
# Insert button 2
vbox.pack_start(button, True, True, 2)
button.show()
# Create "Quit" button
button = gtk.Button("Quit")
# When the button is clicked, we call the mainquit function
# and the program exits
button.connect("clicked", lambda wid: gtk.main_quit())
# Insert the quit button
vbox.pack_start(button, True, True, 2)
button.show()
vbox.show()
self.window.show()
def main():
<|fim_middle|>
if __name__ == "__main__":
CheckButton()
main()
<|fim▁end|>
|
gtk.main()
return 0
|
<|file_name|>checkbutton.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# example checkbutton.py
import pygtk
pygtk.require('2.0')
import gtk
class CheckButton:
# Our callback.
# The data passed to this method is printed to stdout
def callback(self, widget, data=None):
print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
# This callback quits the program
def delete_event(self, widget, event, data=None):
gtk.main_quit()
return False
def __init__(self):
# Create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
# Set the window title
self.window.set_title("Check Button")
# Set a handler for delete_event that immediately
# exits GTK.
self.window.connect("delete_event", self.delete_event)
# Sets the border width of the window.
self.window.set_border_width(20)
# Create a vertical box
vbox = gtk.VBox(True, 2)
# Put the vbox in the main window
self.window.add(vbox)
# Create first button
button = gtk.CheckButton("check button 1")
# When the button is toggled, we call the "callback" method
# with a pointer to "button" as its argument
button.connect("toggled", self.callback, "check button 1")
# Insert button 1
vbox.pack_start(button, True, True, 2)
button.show()
# Create second button
button = gtk.CheckButton("check button 2")
# When the button is toggled, we call the "callback" method
# with a pointer to "button 2" as its argument
button.connect("toggled", self.callback, "check button 2")
# Insert button 2
vbox.pack_start(button, True, True, 2)
button.show()
# Create "Quit" button
button = gtk.Button("Quit")
# When the button is clicked, we call the mainquit function
# and the program exits
button.connect("clicked", lambda wid: gtk.main_quit())
# Insert the quit button
vbox.pack_start(button, True, True, 2)
button.show()
vbox.show()
self.window.show()
def main():
gtk.main()
return 0
if __name__ == "__main__":
<|fim_middle|>
<|fim▁end|>
|
CheckButton()
main()
|
<|file_name|>checkbutton.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# example checkbutton.py
import pygtk
pygtk.require('2.0')
import gtk
class CheckButton:
# Our callback.
# The data passed to this method is printed to stdout
def <|fim_middle|>(self, widget, data=None):
print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
# This callback quits the program
def delete_event(self, widget, event, data=None):
gtk.main_quit()
return False
def __init__(self):
# Create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
# Set the window title
self.window.set_title("Check Button")
# Set a handler for delete_event that immediately
# exits GTK.
self.window.connect("delete_event", self.delete_event)
# Sets the border width of the window.
self.window.set_border_width(20)
# Create a vertical box
vbox = gtk.VBox(True, 2)
# Put the vbox in the main window
self.window.add(vbox)
# Create first button
button = gtk.CheckButton("check button 1")
# When the button is toggled, we call the "callback" method
# with a pointer to "button" as its argument
button.connect("toggled", self.callback, "check button 1")
# Insert button 1
vbox.pack_start(button, True, True, 2)
button.show()
# Create second button
button = gtk.CheckButton("check button 2")
# When the button is toggled, we call the "callback" method
# with a pointer to "button 2" as its argument
button.connect("toggled", self.callback, "check button 2")
# Insert button 2
vbox.pack_start(button, True, True, 2)
button.show()
# Create "Quit" button
button = gtk.Button("Quit")
# When the button is clicked, we call the mainquit function
# and the program exits
button.connect("clicked", lambda wid: gtk.main_quit())
# Insert the quit button
vbox.pack_start(button, True, True, 2)
button.show()
vbox.show()
self.window.show()
def main():
gtk.main()
return 0
if __name__ == "__main__":
CheckButton()
main()
<|fim▁end|>
|
callback
|
<|file_name|>checkbutton.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# example checkbutton.py
import pygtk
pygtk.require('2.0')
import gtk
class CheckButton:
# Our callback.
# The data passed to this method is printed to stdout
def callback(self, widget, data=None):
print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
# This callback quits the program
def <|fim_middle|>(self, widget, event, data=None):
gtk.main_quit()
return False
def __init__(self):
# Create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
# Set the window title
self.window.set_title("Check Button")
# Set a handler for delete_event that immediately
# exits GTK.
self.window.connect("delete_event", self.delete_event)
# Sets the border width of the window.
self.window.set_border_width(20)
# Create a vertical box
vbox = gtk.VBox(True, 2)
# Put the vbox in the main window
self.window.add(vbox)
# Create first button
button = gtk.CheckButton("check button 1")
# When the button is toggled, we call the "callback" method
# with a pointer to "button" as its argument
button.connect("toggled", self.callback, "check button 1")
# Insert button 1
vbox.pack_start(button, True, True, 2)
button.show()
# Create second button
button = gtk.CheckButton("check button 2")
# When the button is toggled, we call the "callback" method
# with a pointer to "button 2" as its argument
button.connect("toggled", self.callback, "check button 2")
# Insert button 2
vbox.pack_start(button, True, True, 2)
button.show()
# Create "Quit" button
button = gtk.Button("Quit")
# When the button is clicked, we call the mainquit function
# and the program exits
button.connect("clicked", lambda wid: gtk.main_quit())
# Insert the quit button
vbox.pack_start(button, True, True, 2)
button.show()
vbox.show()
self.window.show()
def main():
gtk.main()
return 0
if __name__ == "__main__":
CheckButton()
main()
<|fim▁end|>
|
delete_event
|
<|file_name|>checkbutton.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# example checkbutton.py
import pygtk
pygtk.require('2.0')
import gtk
class CheckButton:
# Our callback.
# The data passed to this method is printed to stdout
def callback(self, widget, data=None):
print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
# This callback quits the program
def delete_event(self, widget, event, data=None):
gtk.main_quit()
return False
def <|fim_middle|>(self):
# Create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
# Set the window title
self.window.set_title("Check Button")
# Set a handler for delete_event that immediately
# exits GTK.
self.window.connect("delete_event", self.delete_event)
# Sets the border width of the window.
self.window.set_border_width(20)
# Create a vertical box
vbox = gtk.VBox(True, 2)
# Put the vbox in the main window
self.window.add(vbox)
# Create first button
button = gtk.CheckButton("check button 1")
# When the button is toggled, we call the "callback" method
# with a pointer to "button" as its argument
button.connect("toggled", self.callback, "check button 1")
# Insert button 1
vbox.pack_start(button, True, True, 2)
button.show()
# Create second button
button = gtk.CheckButton("check button 2")
# When the button is toggled, we call the "callback" method
# with a pointer to "button 2" as its argument
button.connect("toggled", self.callback, "check button 2")
# Insert button 2
vbox.pack_start(button, True, True, 2)
button.show()
# Create "Quit" button
button = gtk.Button("Quit")
# When the button is clicked, we call the mainquit function
# and the program exits
button.connect("clicked", lambda wid: gtk.main_quit())
# Insert the quit button
vbox.pack_start(button, True, True, 2)
button.show()
vbox.show()
self.window.show()
def main():
gtk.main()
return 0
if __name__ == "__main__":
CheckButton()
main()
<|fim▁end|>
|
__init__
|
<|file_name|>checkbutton.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# example checkbutton.py
import pygtk
pygtk.require('2.0')
import gtk
class CheckButton:
# Our callback.
# The data passed to this method is printed to stdout
def callback(self, widget, data=None):
print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
# This callback quits the program
def delete_event(self, widget, event, data=None):
gtk.main_quit()
return False
def __init__(self):
# Create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
# Set the window title
self.window.set_title("Check Button")
# Set a handler for delete_event that immediately
# exits GTK.
self.window.connect("delete_event", self.delete_event)
# Sets the border width of the window.
self.window.set_border_width(20)
# Create a vertical box
vbox = gtk.VBox(True, 2)
# Put the vbox in the main window
self.window.add(vbox)
# Create first button
button = gtk.CheckButton("check button 1")
# When the button is toggled, we call the "callback" method
# with a pointer to "button" as its argument
button.connect("toggled", self.callback, "check button 1")
# Insert button 1
vbox.pack_start(button, True, True, 2)
button.show()
# Create second button
button = gtk.CheckButton("check button 2")
# When the button is toggled, we call the "callback" method
# with a pointer to "button 2" as its argument
button.connect("toggled", self.callback, "check button 2")
# Insert button 2
vbox.pack_start(button, True, True, 2)
button.show()
# Create "Quit" button
button = gtk.Button("Quit")
# When the button is clicked, we call the mainquit function
# and the program exits
button.connect("clicked", lambda wid: gtk.main_quit())
# Insert the quit button
vbox.pack_start(button, True, True, 2)
button.show()
vbox.show()
self.window.show()
def <|fim_middle|>():
gtk.main()
return 0
if __name__ == "__main__":
CheckButton()
main()
<|fim▁end|>
|
main
|
<|file_name|>date_and_time.py<|end_file_name|><|fim▁begin|>"""Template filters and tags for helping with dates and datetimes"""
# pylint: disable=W0702,C0103
from django import template
from nav.django.settings import DATETIME_FORMAT, SHORT_TIME_FORMAT
from django.template.defaultfilters import date, time
from datetime import timedelta
register = template.Library()
@register.filter
def default_datetime(value):
"""Returns the date as represented by the default datetime format"""
try:
v = date(value, DATETIME_FORMAT)
except:
return value
return v
<|fim▁hole|>
The SHORT_TIME_FORMAT is a custom format not available in the template
"""
try:
return time(value, SHORT_TIME_FORMAT)
except:
return value
@register.filter
def remove_microseconds(delta):
"""Removes microseconds from timedelta"""
try:
return delta - timedelta(microseconds=delta.microseconds)
except:
return delta<|fim▁end|>
|
@register.filter
def short_time_format(value):
"""Returns the value formatted as a short time format
|
<|file_name|>date_and_time.py<|end_file_name|><|fim▁begin|>"""Template filters and tags for helping with dates and datetimes"""
# pylint: disable=W0702,C0103
from django import template
from nav.django.settings import DATETIME_FORMAT, SHORT_TIME_FORMAT
from django.template.defaultfilters import date, time
from datetime import timedelta
register = template.Library()
@register.filter
def default_datetime(value):
<|fim_middle|>
@register.filter
def short_time_format(value):
"""Returns the value formatted as a short time format
The SHORT_TIME_FORMAT is a custom format not available in the template
"""
try:
return time(value, SHORT_TIME_FORMAT)
except:
return value
@register.filter
def remove_microseconds(delta):
"""Removes microseconds from timedelta"""
try:
return delta - timedelta(microseconds=delta.microseconds)
except:
return delta
<|fim▁end|>
|
"""Returns the date as represented by the default datetime format"""
try:
v = date(value, DATETIME_FORMAT)
except:
return value
return v
|
<|file_name|>date_and_time.py<|end_file_name|><|fim▁begin|>"""Template filters and tags for helping with dates and datetimes"""
# pylint: disable=W0702,C0103
from django import template
from nav.django.settings import DATETIME_FORMAT, SHORT_TIME_FORMAT
from django.template.defaultfilters import date, time
from datetime import timedelta
register = template.Library()
@register.filter
def default_datetime(value):
"""Returns the date as represented by the default datetime format"""
try:
v = date(value, DATETIME_FORMAT)
except:
return value
return v
@register.filter
def short_time_format(value):
<|fim_middle|>
@register.filter
def remove_microseconds(delta):
"""Removes microseconds from timedelta"""
try:
return delta - timedelta(microseconds=delta.microseconds)
except:
return delta
<|fim▁end|>
|
"""Returns the value formatted as a short time format
The SHORT_TIME_FORMAT is a custom format not available in the template
"""
try:
return time(value, SHORT_TIME_FORMAT)
except:
return value
|
<|file_name|>date_and_time.py<|end_file_name|><|fim▁begin|>"""Template filters and tags for helping with dates and datetimes"""
# pylint: disable=W0702,C0103
from django import template
from nav.django.settings import DATETIME_FORMAT, SHORT_TIME_FORMAT
from django.template.defaultfilters import date, time
from datetime import timedelta
register = template.Library()
@register.filter
def default_datetime(value):
"""Returns the date as represented by the default datetime format"""
try:
v = date(value, DATETIME_FORMAT)
except:
return value
return v
@register.filter
def short_time_format(value):
"""Returns the value formatted as a short time format
The SHORT_TIME_FORMAT is a custom format not available in the template
"""
try:
return time(value, SHORT_TIME_FORMAT)
except:
return value
@register.filter
def remove_microseconds(delta):
<|fim_middle|>
<|fim▁end|>
|
"""Removes microseconds from timedelta"""
try:
return delta - timedelta(microseconds=delta.microseconds)
except:
return delta
|
<|file_name|>date_and_time.py<|end_file_name|><|fim▁begin|>"""Template filters and tags for helping with dates and datetimes"""
# pylint: disable=W0702,C0103
from django import template
from nav.django.settings import DATETIME_FORMAT, SHORT_TIME_FORMAT
from django.template.defaultfilters import date, time
from datetime import timedelta
register = template.Library()
@register.filter
def <|fim_middle|>(value):
"""Returns the date as represented by the default datetime format"""
try:
v = date(value, DATETIME_FORMAT)
except:
return value
return v
@register.filter
def short_time_format(value):
"""Returns the value formatted as a short time format
The SHORT_TIME_FORMAT is a custom format not available in the template
"""
try:
return time(value, SHORT_TIME_FORMAT)
except:
return value
@register.filter
def remove_microseconds(delta):
"""Removes microseconds from timedelta"""
try:
return delta - timedelta(microseconds=delta.microseconds)
except:
return delta
<|fim▁end|>
|
default_datetime
|
<|file_name|>date_and_time.py<|end_file_name|><|fim▁begin|>"""Template filters and tags for helping with dates and datetimes"""
# pylint: disable=W0702,C0103
from django import template
from nav.django.settings import DATETIME_FORMAT, SHORT_TIME_FORMAT
from django.template.defaultfilters import date, time
from datetime import timedelta
register = template.Library()
@register.filter
def default_datetime(value):
"""Returns the date as represented by the default datetime format"""
try:
v = date(value, DATETIME_FORMAT)
except:
return value
return v
@register.filter
def <|fim_middle|>(value):
"""Returns the value formatted as a short time format
The SHORT_TIME_FORMAT is a custom format not available in the template
"""
try:
return time(value, SHORT_TIME_FORMAT)
except:
return value
@register.filter
def remove_microseconds(delta):
"""Removes microseconds from timedelta"""
try:
return delta - timedelta(microseconds=delta.microseconds)
except:
return delta
<|fim▁end|>
|
short_time_format
|
<|file_name|>date_and_time.py<|end_file_name|><|fim▁begin|>"""Template filters and tags for helping with dates and datetimes"""
# pylint: disable=W0702,C0103
from django import template
from nav.django.settings import DATETIME_FORMAT, SHORT_TIME_FORMAT
from django.template.defaultfilters import date, time
from datetime import timedelta
register = template.Library()
@register.filter
def default_datetime(value):
"""Returns the date as represented by the default datetime format"""
try:
v = date(value, DATETIME_FORMAT)
except:
return value
return v
@register.filter
def short_time_format(value):
"""Returns the value formatted as a short time format
The SHORT_TIME_FORMAT is a custom format not available in the template
"""
try:
return time(value, SHORT_TIME_FORMAT)
except:
return value
@register.filter
def <|fim_middle|>(delta):
"""Removes microseconds from timedelta"""
try:
return delta - timedelta(microseconds=delta.microseconds)
except:
return delta
<|fim▁end|>
|
remove_microseconds
|
<|file_name|>py_choose.py<|end_file_name|><|fim▁begin|>#<pycode(py_choose)>
class Choose:
"""
Choose - class for choose() with callbacks
"""
def __init__(self, list, title, flags=0, deflt=1, icon=37):
self.list = list
self.title = title
self.flags = flags
self.x0 = -1
self.x1 = -1
self.y0 = -1
self.y1 = -1
self.width = -1
self.deflt = deflt
self.icon = icon
# HACK: Add a circular reference for non-modal choosers. This prevents the GC
# from collecting the class object the callbacks need. Unfortunately this means
# that the class will never be collected, unless refhack is set to None explicitly.
if (flags & Choose2.CH_MODAL) == 0:
self.refhack = self
def sizer(self):
"""
Callback: sizer - returns the length of the list
"""
return len(self.list)
def getl(self, n):
"""
Callback: getl - get one item from the list
"""
if n == 0:
return self.title
if n <= self.sizer():
return str(self.list[n-1])
else:
return "<Empty>"
def ins(self):
pass
def update(self, n):
pass
def edit(self, n):
pass
def enter(self, n):
print "enter(%d) called" % n
def destroy(self):
pass
def get_icon(self, n):
pass
def choose(self):
"""
choose - Display the choose dialogue
"""
old = set_script_timeout(0)
n = _idaapi.choose_choose(
self,
self.flags,
self.x0,
self.y0,
self.x1,
self.y1,
self.width,
self.deflt,
self.icon)
set_script_timeout(old)
return n<|fim▁hole|><|fim▁end|>
|
#</pycode(py_choose)>
|
<|file_name|>py_choose.py<|end_file_name|><|fim▁begin|>
#<pycode(py_choose)>
class Choose:
<|fim_middle|>
#</pycode(py_choose)>
<|fim▁end|>
|
"""
Choose - class for choose() with callbacks
"""
def __init__(self, list, title, flags=0, deflt=1, icon=37):
self.list = list
self.title = title
self.flags = flags
self.x0 = -1
self.x1 = -1
self.y0 = -1
self.y1 = -1
self.width = -1
self.deflt = deflt
self.icon = icon
# HACK: Add a circular reference for non-modal choosers. This prevents the GC
# from collecting the class object the callbacks need. Unfortunately this means
# that the class will never be collected, unless refhack is set to None explicitly.
if (flags & Choose2.CH_MODAL) == 0:
self.refhack = self
def sizer(self):
"""
Callback: sizer - returns the length of the list
"""
return len(self.list)
def getl(self, n):
"""
Callback: getl - get one item from the list
"""
if n == 0:
return self.title
if n <= self.sizer():
return str(self.list[n-1])
else:
return "<Empty>"
def ins(self):
pass
def update(self, n):
pass
def edit(self, n):
pass
def enter(self, n):
print "enter(%d) called" % n
def destroy(self):
pass
def get_icon(self, n):
pass
def choose(self):
"""
choose - Display the choose dialogue
"""
old = set_script_timeout(0)
n = _idaapi.choose_choose(
self,
self.flags,
self.x0,
self.y0,
self.x1,
self.y1,
self.width,
self.deflt,
self.icon)
set_script_timeout(old)
return n
|
<|file_name|>py_choose.py<|end_file_name|><|fim▁begin|>
#<pycode(py_choose)>
class Choose:
"""
Choose - class for choose() with callbacks
"""
def __init__(self, list, title, flags=0, deflt=1, icon=37):
<|fim_middle|>
def sizer(self):
"""
Callback: sizer - returns the length of the list
"""
return len(self.list)
def getl(self, n):
"""
Callback: getl - get one item from the list
"""
if n == 0:
return self.title
if n <= self.sizer():
return str(self.list[n-1])
else:
return "<Empty>"
def ins(self):
pass
def update(self, n):
pass
def edit(self, n):
pass
def enter(self, n):
print "enter(%d) called" % n
def destroy(self):
pass
def get_icon(self, n):
pass
def choose(self):
"""
choose - Display the choose dialogue
"""
old = set_script_timeout(0)
n = _idaapi.choose_choose(
self,
self.flags,
self.x0,
self.y0,
self.x1,
self.y1,
self.width,
self.deflt,
self.icon)
set_script_timeout(old)
return n
#</pycode(py_choose)>
<|fim▁end|>
|
self.list = list
self.title = title
self.flags = flags
self.x0 = -1
self.x1 = -1
self.y0 = -1
self.y1 = -1
self.width = -1
self.deflt = deflt
self.icon = icon
# HACK: Add a circular reference for non-modal choosers. This prevents the GC
# from collecting the class object the callbacks need. Unfortunately this means
# that the class will never be collected, unless refhack is set to None explicitly.
if (flags & Choose2.CH_MODAL) == 0:
self.refhack = self
|
<|file_name|>py_choose.py<|end_file_name|><|fim▁begin|>
#<pycode(py_choose)>
class Choose:
"""
Choose - class for choose() with callbacks
"""
def __init__(self, list, title, flags=0, deflt=1, icon=37):
self.list = list
self.title = title
self.flags = flags
self.x0 = -1
self.x1 = -1
self.y0 = -1
self.y1 = -1
self.width = -1
self.deflt = deflt
self.icon = icon
# HACK: Add a circular reference for non-modal choosers. This prevents the GC
# from collecting the class object the callbacks need. Unfortunately this means
# that the class will never be collected, unless refhack is set to None explicitly.
if (flags & Choose2.CH_MODAL) == 0:
self.refhack = self
def sizer(self):
<|fim_middle|>
def getl(self, n):
"""
Callback: getl - get one item from the list
"""
if n == 0:
return self.title
if n <= self.sizer():
return str(self.list[n-1])
else:
return "<Empty>"
def ins(self):
pass
def update(self, n):
pass
def edit(self, n):
pass
def enter(self, n):
print "enter(%d) called" % n
def destroy(self):
pass
def get_icon(self, n):
pass
def choose(self):
"""
choose - Display the choose dialogue
"""
old = set_script_timeout(0)
n = _idaapi.choose_choose(
self,
self.flags,
self.x0,
self.y0,
self.x1,
self.y1,
self.width,
self.deflt,
self.icon)
set_script_timeout(old)
return n
#</pycode(py_choose)>
<|fim▁end|>
|
"""
Callback: sizer - returns the length of the list
"""
return len(self.list)
|
<|file_name|>py_choose.py<|end_file_name|><|fim▁begin|>
#<pycode(py_choose)>
class Choose:
"""
Choose - class for choose() with callbacks
"""
def __init__(self, list, title, flags=0, deflt=1, icon=37):
self.list = list
self.title = title
self.flags = flags
self.x0 = -1
self.x1 = -1
self.y0 = -1
self.y1 = -1
self.width = -1
self.deflt = deflt
self.icon = icon
# HACK: Add a circular reference for non-modal choosers. This prevents the GC
# from collecting the class object the callbacks need. Unfortunately this means
# that the class will never be collected, unless refhack is set to None explicitly.
if (flags & Choose2.CH_MODAL) == 0:
self.refhack = self
def sizer(self):
"""
Callback: sizer - returns the length of the list
"""
return len(self.list)
def getl(self, n):
<|fim_middle|>
def ins(self):
pass
def update(self, n):
pass
def edit(self, n):
pass
def enter(self, n):
print "enter(%d) called" % n
def destroy(self):
pass
def get_icon(self, n):
pass
def choose(self):
"""
choose - Display the choose dialogue
"""
old = set_script_timeout(0)
n = _idaapi.choose_choose(
self,
self.flags,
self.x0,
self.y0,
self.x1,
self.y1,
self.width,
self.deflt,
self.icon)
set_script_timeout(old)
return n
#</pycode(py_choose)>
<|fim▁end|>
|
"""
Callback: getl - get one item from the list
"""
if n == 0:
return self.title
if n <= self.sizer():
return str(self.list[n-1])
else:
return "<Empty>"
|
<|file_name|>py_choose.py<|end_file_name|><|fim▁begin|>
#<pycode(py_choose)>
class Choose:
"""
Choose - class for choose() with callbacks
"""
def __init__(self, list, title, flags=0, deflt=1, icon=37):
self.list = list
self.title = title
self.flags = flags
self.x0 = -1
self.x1 = -1
self.y0 = -1
self.y1 = -1
self.width = -1
self.deflt = deflt
self.icon = icon
# HACK: Add a circular reference for non-modal choosers. This prevents the GC
# from collecting the class object the callbacks need. Unfortunately this means
# that the class will never be collected, unless refhack is set to None explicitly.
if (flags & Choose2.CH_MODAL) == 0:
self.refhack = self
def sizer(self):
"""
Callback: sizer - returns the length of the list
"""
return len(self.list)
def getl(self, n):
"""
Callback: getl - get one item from the list
"""
if n == 0:
return self.title
if n <= self.sizer():
return str(self.list[n-1])
else:
return "<Empty>"
def ins(self):
<|fim_middle|>
def update(self, n):
pass
def edit(self, n):
pass
def enter(self, n):
print "enter(%d) called" % n
def destroy(self):
pass
def get_icon(self, n):
pass
def choose(self):
"""
choose - Display the choose dialogue
"""
old = set_script_timeout(0)
n = _idaapi.choose_choose(
self,
self.flags,
self.x0,
self.y0,
self.x1,
self.y1,
self.width,
self.deflt,
self.icon)
set_script_timeout(old)
return n
#</pycode(py_choose)>
<|fim▁end|>
|
pass
|
<|file_name|>py_choose.py<|end_file_name|><|fim▁begin|>
#<pycode(py_choose)>
class Choose:
"""
Choose - class for choose() with callbacks
"""
def __init__(self, list, title, flags=0, deflt=1, icon=37):
self.list = list
self.title = title
self.flags = flags
self.x0 = -1
self.x1 = -1
self.y0 = -1
self.y1 = -1
self.width = -1
self.deflt = deflt
self.icon = icon
# HACK: Add a circular reference for non-modal choosers. This prevents the GC
# from collecting the class object the callbacks need. Unfortunately this means
# that the class will never be collected, unless refhack is set to None explicitly.
if (flags & Choose2.CH_MODAL) == 0:
self.refhack = self
def sizer(self):
"""
Callback: sizer - returns the length of the list
"""
return len(self.list)
def getl(self, n):
"""
Callback: getl - get one item from the list
"""
if n == 0:
return self.title
if n <= self.sizer():
return str(self.list[n-1])
else:
return "<Empty>"
def ins(self):
pass
def update(self, n):
<|fim_middle|>
def edit(self, n):
pass
def enter(self, n):
print "enter(%d) called" % n
def destroy(self):
pass
def get_icon(self, n):
pass
def choose(self):
"""
choose - Display the choose dialogue
"""
old = set_script_timeout(0)
n = _idaapi.choose_choose(
self,
self.flags,
self.x0,
self.y0,
self.x1,
self.y1,
self.width,
self.deflt,
self.icon)
set_script_timeout(old)
return n
#</pycode(py_choose)>
<|fim▁end|>
|
pass
|
<|file_name|>py_choose.py<|end_file_name|><|fim▁begin|>
#<pycode(py_choose)>
class Choose:
"""
Choose - class for choose() with callbacks
"""
def __init__(self, list, title, flags=0, deflt=1, icon=37):
self.list = list
self.title = title
self.flags = flags
self.x0 = -1
self.x1 = -1
self.y0 = -1
self.y1 = -1
self.width = -1
self.deflt = deflt
self.icon = icon
# HACK: Add a circular reference for non-modal choosers. This prevents the GC
# from collecting the class object the callbacks need. Unfortunately this means
# that the class will never be collected, unless refhack is set to None explicitly.
if (flags & Choose2.CH_MODAL) == 0:
self.refhack = self
def sizer(self):
"""
Callback: sizer - returns the length of the list
"""
return len(self.list)
def getl(self, n):
"""
Callback: getl - get one item from the list
"""
if n == 0:
return self.title
if n <= self.sizer():
return str(self.list[n-1])
else:
return "<Empty>"
def ins(self):
pass
def update(self, n):
pass
def edit(self, n):
<|fim_middle|>
def enter(self, n):
print "enter(%d) called" % n
def destroy(self):
pass
def get_icon(self, n):
pass
def choose(self):
"""
choose - Display the choose dialogue
"""
old = set_script_timeout(0)
n = _idaapi.choose_choose(
self,
self.flags,
self.x0,
self.y0,
self.x1,
self.y1,
self.width,
self.deflt,
self.icon)
set_script_timeout(old)
return n
#</pycode(py_choose)>
<|fim▁end|>
|
pass
|
<|file_name|>py_choose.py<|end_file_name|><|fim▁begin|>
#<pycode(py_choose)>
class Choose:
"""
Choose - class for choose() with callbacks
"""
def __init__(self, list, title, flags=0, deflt=1, icon=37):
self.list = list
self.title = title
self.flags = flags
self.x0 = -1
self.x1 = -1
self.y0 = -1
self.y1 = -1
self.width = -1
self.deflt = deflt
self.icon = icon
# HACK: Add a circular reference for non-modal choosers. This prevents the GC
# from collecting the class object the callbacks need. Unfortunately this means
# that the class will never be collected, unless refhack is set to None explicitly.
if (flags & Choose2.CH_MODAL) == 0:
self.refhack = self
def sizer(self):
"""
Callback: sizer - returns the length of the list
"""
return len(self.list)
def getl(self, n):
"""
Callback: getl - get one item from the list
"""
if n == 0:
return self.title
if n <= self.sizer():
return str(self.list[n-1])
else:
return "<Empty>"
def ins(self):
pass
def update(self, n):
pass
def edit(self, n):
pass
def enter(self, n):
<|fim_middle|>
def destroy(self):
pass
def get_icon(self, n):
pass
def choose(self):
"""
choose - Display the choose dialogue
"""
old = set_script_timeout(0)
n = _idaapi.choose_choose(
self,
self.flags,
self.x0,
self.y0,
self.x1,
self.y1,
self.width,
self.deflt,
self.icon)
set_script_timeout(old)
return n
#</pycode(py_choose)>
<|fim▁end|>
|
print "enter(%d) called" % n
|
<|file_name|>py_choose.py<|end_file_name|><|fim▁begin|>
#<pycode(py_choose)>
class Choose:
"""
Choose - class for choose() with callbacks
"""
def __init__(self, list, title, flags=0, deflt=1, icon=37):
self.list = list
self.title = title
self.flags = flags
self.x0 = -1
self.x1 = -1
self.y0 = -1
self.y1 = -1
self.width = -1
self.deflt = deflt
self.icon = icon
# HACK: Add a circular reference for non-modal choosers. This prevents the GC
# from collecting the class object the callbacks need. Unfortunately this means
# that the class will never be collected, unless refhack is set to None explicitly.
if (flags & Choose2.CH_MODAL) == 0:
self.refhack = self
def sizer(self):
"""
Callback: sizer - returns the length of the list
"""
return len(self.list)
def getl(self, n):
"""
Callback: getl - get one item from the list
"""
if n == 0:
return self.title
if n <= self.sizer():
return str(self.list[n-1])
else:
return "<Empty>"
def ins(self):
pass
def update(self, n):
pass
def edit(self, n):
pass
def enter(self, n):
print "enter(%d) called" % n
def destroy(self):
<|fim_middle|>
def get_icon(self, n):
pass
def choose(self):
"""
choose - Display the choose dialogue
"""
old = set_script_timeout(0)
n = _idaapi.choose_choose(
self,
self.flags,
self.x0,
self.y0,
self.x1,
self.y1,
self.width,
self.deflt,
self.icon)
set_script_timeout(old)
return n
#</pycode(py_choose)>
<|fim▁end|>
|
pass
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.