function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def test_plot_fcc23():
assert os.path.exists("output/fcc23.png") | ghislainv/deforestprob | [
97,
21,
97,
8,
1480589112
] |
def test_dataset(gstart):
assert gstart["dataset"].iloc[0, 0] == 30.0 | ghislainv/deforestprob | [
97,
21,
97,
8,
1480589112
] |
def test_model_binomial_iCAR(gstart):
p = np.array([0.34388896, 0.29002158, 0.51594223, 0.48436339,
0.60838453, 0.61257058, 0.55034979, 0.58819568,
0.51087469, 0.58819568, 0.64149789, 0.57400436,
0.59570952, 0.63212285, 0.566676, 0.62562204,
0... | ghislainv/deforestprob | [
97,
21,
97,
8,
1480589112
] |
def test_interpolate_rho():
assert os.path.exists("output/rho.tif") | ghislainv/deforestprob | [
97,
21,
97,
8,
1480589112
] |
def test_countpix(gstart):
assert gstart["fc"] == [83999.25, 79015.5] | ghislainv/deforestprob | [
97,
21,
97,
8,
1480589112
] |
def test_plot_fcc123():
assert os.path.exists("output/fcc123.png") | ghislainv/deforestprob | [
97,
21,
97,
8,
1480589112
] |
def test_plot_prob():
assert os.path.exists("output/prob.png") | ghislainv/deforestprob | [
97,
21,
97,
8,
1480589112
] |
def __init__(self, name, identifier, oLeftToken, oRightToken, iLines):
length.Rule.__init__(self, name=name, identifier=identifier)
self.length = iLines
self.oLeftToken = oLeftToken
self.oRightToken = oRightToken | jeremiah-c-leary/vhdl-style-guide | [
129,
31,
129,
57,
1499106283
] |
def is_periodic(bcs):
"Check if boundary conditions are periodic"
return all(isinstance(bc, PeriodicBC) for bc in bcs) | Juanlu001/CBC.Solve | [
1,
7,
1,
1,
1427993651
] |
def timestep_range(T, dt):
"""Return a matching time step range for given end time and time
step. Note that the time step may be adjusted so that it matches
the given end time.""" | Juanlu001/CBC.Solve | [
1,
7,
1,
1,
1427993651
] |
def timestep_range_cfl(problem, mesh):
"""Return a sensible default time step and time step range based
on an approximate CFL condition.""" | Juanlu001/CBC.Solve | [
1,
7,
1,
1,
1427993651
] |
def __init__(self, config):
self.printer = config.get_printer()
self.reactor = self.printer.get_reactor()
self.default_prefix = config.getchoice('default_type', respond_types,
'echo')
self.default_prefix = config.get('default_prefix', self.d... | KevinOConnor/klipper | [
6307,
4329,
6307,
57,
1464190926
] |
def cmd_RESPOND(self, gcmd):
respond_type = gcmd.get('TYPE', None)
prefix = self.default_prefix
if(respond_type != None):
respond_type = respond_type.lower()
if(respond_type in respond_types):
prefix = respond_types[respond_type]
else:
... | KevinOConnor/klipper | [
6307,
4329,
6307,
57,
1464190926
] |
def __init__(self, cpu_factory, registers):
for group, register_list in registers.iteritems():
registers[group] = [Register(x) for x in register_list]
super(GenericCpu, self).__init__(cpu_factory, registers) | dholm/voidwalker | [
129,
15,
129,
1,
1351059142
] |
def architecture(cls):
return Architecture.Generic | dholm/voidwalker | [
129,
15,
129,
1,
1351059142
] |
def compute(files, output_filename, thresholds, n_samples=1024):
thresholds = thresholds.astype(float)
data_stream = event_stream(files)
# data_stream = trigger.fill_event_type(data_stream, flag=8)
data_stream = filters.filter_event_types(data_stream,
flags... | calispac/digicampipe | [
3,
3,
3,
38,
1504526984
] |
def clean(self):
"""
Check for instances with null values in unique_together fields.
"""
from django.core.exceptions import ValidationError
super(BaseModel, self).clean()
for field_tuple in self._meta.unique_together[:]:
unique_filter = {}
unique... | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def __str__(self):
return self.nome | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def parents(self):
if not self.parent:
return []
parents = self.parent.parents + [self.parent, ]
return parents | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def __str__(self):
return self.descricao | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def __str__(self):
if self.content_object:
assert hasattr(self.content_object, 'epigrafe'), _(
'Modelos integrados aos Textos Articulados devem possuir a '
'property "epigrafe"')
return str(self.content_object.epigrafe)
else:
numero = s... | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def can_use_dynamic_editing(self, user):
return not self.editing_locked and\
(not self.editable_only_by_owners and
user.has_perm(
'compilacao.change_dispositivo_edicao_dinamica') or
self.editable_only_by_owners and user in self.owners.all() and
... | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def has_edit_permission(self, request):
if self.privacidade == STATUS_TA_PRIVATE:
if request.user not in self.owners.all():
raise Http404()
if not self.can_use_dynamic_editing(request.user):
messages.error(request, _(
'Usuário sem per... | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def update_or_create(cls, view_integracao, obj):
map_fields = view_integracao.map_fields
ta_values = getattr(view_integracao, 'ta_values', {})
related_object_type = ContentType.objects.get_for_model(obj)
ta = TextoArticulado.objects.filter(
object_id=obj.pk,
con... | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def reagrupar_ordem_de_dispositivos(self):
dpts = Dispositivo.objects.filter(ta=self)
if not dpts.exists():
return
ordem_max = dpts.last().ordem
dpts.update(ordem=F('ordem') + ordem_max)
dpts = Dispositivo.objects.filter(
ta=self).values_list('pk', fla... | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def update(dpk):
Dispositivo.objects.filter(pk=dpk).update(ordem=count[0])
count[0] = count[0] + Dispositivo.INTERVALO_ORDEM
filhos = Dispositivo.objects.filter(
dispositivo_pai_id=dpk).values_list(
'pk', flat=True).order_by('ordem')
for d... | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def __str__(self):
return '%s: %s' % (self.sigla, self.nome) | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def __str__(self):
return '%s: %s' % (self.sigla, self.nome) | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def __str__(self):
return self.nome | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def permitido_variacao(self, base, perfil_pk=None):
perfil = PerfilEstruturalTextoArticulado.objects.all()
if not perfil_pk:
perfil = perfil.filter(padrao=True)
else:
perfil = perfil.filter(pk=perfil_pk)
if not perfil.exists():
return False
... | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def __str__(self):
return '%s - %s' % (
self.pai.nome,
self.filho_permitido.nome if self.filho_permitido else '') | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def __str__(self):
return self.nome | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def __str__(self):
return '%s: %s' % (self.sigla, self.nome) | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def __str__(self):
return _('%s realizada em %s \n <small>%s</small>') % (
self.tipo_publicacao,
defaultfilters.date(self.data, "d \d\e F \d\e Y"),
self.ta) | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def ws_sync(self):
return self.ta and self.ta.privacidade in (
STATUS_TA_IMMUTABLE_PUBLIC, STATUS_TA_PUBLIC) | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def save(self, force_insert=False, force_update=False, using=None,
update_fields=None, clean=True):
self.dispositivo_raiz = self.get_raiz()
if self.dispositivo_raiz == self:
self.dispositivo_raiz = None
self.contagem_continua = self.tipo_dispositivo.contagem_continua
... | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def get_raiz(self):
dp = self
while dp.dispositivo_pai is not None:
dp = dp.dispositivo_pai
return dp | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def get_profundidade(self):
numero = self.get_numero_completo()
for i in range(len(numero)):
if numero[i] != 0 or i == 0:
continue
return i - 1
return i | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def transform_in_prior(self, profundidade=-1):
numero = self.get_numero_completo()
numero.reverse()
if profundidade != -1:
profundidade = len(numero) - profundidade - 1
for i in range(len(numero)):
if not numero[i]:
continue
if i < ... | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def get_numero_completo(self):
return [
self.dispositivo0,
self.dispositivo1,
self.dispositivo2,
self.dispositivo3,
self.dispositivo4,
self.dispositivo5] | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def criar_espaco(self, espaco_a_criar, local=None):
if local == 'json_add_next':
proximo_bloco = Dispositivo.objects.filter(
ordem__gt=self.ordem,
nivel__lte=self.nivel,
ta_id=self.ta_id).first()
elif local == 'json_add_in':
proxim... | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def get_parents(self, ordem='desc'):
dp = self
p = []
while dp.dispositivo_pai:
dp = dp.dispositivo_pai
if ordem == 'desc':
p.append(dp)
else:
p.insert(0, dp)
return p | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def incrementar_irmaos(self, variacao=0, tipoadd=[], force=True):
if not self.tipo_dispositivo.contagem_continua:
irmaos = list(Dispositivo.objects.filter(
Q(ordem__gt=self.ordem) | Q(dispositivo0=0),
dispositivo_pai_id=self.dispositivo_pai_id,
tipo_d... | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def select_next_root(self):
return self.select_roots().filter(ordem__gt=self.ordem).first() | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def is_relative_auto_insert__obsoleto(self, perfil_pk=None):
if self.dispositivo_pai is not None:
# pp possiveis_pais
if not perfil_pk:
perfis = PerfilEstruturalTextoArticulado.objects.filter(
padrao=True)[:1]
if perfis.exists():
... | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def new_instance_based_on(dispositivo_base, tipo_base, base_alteracao=None):
dp = Dispositivo()
dp.tipo_dispositivo = tipo_base
dp.set_numero_completo(
dispositivo_base.get_numero_completo())
dp.nivel = dispositivo_base.nivel
dp.texto = ''
dp.visibilidade = ... | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def set_numero_for_add_in(dispositivo_base, dispositivo, tipo_base):
if tipo_base.contagem_continua:
raiz = dispositivo_base.get_raiz()
disps = Dispositivo.objects.order_by('-ordem').filter(
tipo_dispositivo_id=tipo_base.pk,
ordem__lte=dispositivo_base.o... | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def __str__(self):
return _('Vide %s') % self.texto | interlegis/sapl | [
74,
74,
74,
294,
1435330918
] |
def ftrace(func):
"""Decorator used for marking the beginning and end of function calls.
Automatically indents nested calls.
"""
def w(*args, **kargs):
global __ftraceDepth
pfx = " " * __ftraceDepth
print(pfx + func.__name__ + " start")
__ftraceDepth += 1
try:
... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def __init__(self):
self.count = 0
self.stack = [] | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def stop(self):
sys.settrace(None) | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def frameInfo(self, fr):
filename = fr.f_code.co_filename
funcname = fr.f_code.co_name
lineno = fr.f_lineno
callfr = sys._getframe(3)
callline = "%s %d" % (callfr.f_code.co_name, callfr.f_lineno)
args, _, _, value_dict = inspect.getargvalues(fr)
if len(args) and a... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def w(*args, **kwds):
try:
func(*args, **kwds)
except:
printExc('Ignored exception:') | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def getExc(indent=4, prefix='| ', skip=1):
lines = formatException(*sys.exc_info(), skip=skip)
lines2 = []
for l in lines:
lines2.extend(l.strip('\n').split('\n'))
lines3 = [" "*indent + prefix + l for l in lines2]
return '\n'.join(lines3) | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def printTrace(msg='', indent=4, prefix='|'):
"""Print an error message followed by an indented stack trace"""
trace = backtrace(1)
#exc = getExc(indent, prefix + ' ')
print("[%s] %s\n" % (time.strftime("%H:%M:%S"), msg))
print(" "*indent + prefix + '='*30 + '>>')
for line in trace.split('\n')... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def backtrace(skip=0):
return ''.join(traceback.format_stack()[:-(skip+1)]) | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def printException(exctype, value, traceback):
"""Print an exception with its full traceback. | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def listObjs(regex='Q', typ=None):
"""List all objects managed by python gc with class name matching regex.
Finds 'Q...' classes by default."""
if typ is not None:
return [x for x in gc.get_objects() if isinstance(x, typ)]
else:
return [x for x in gc.get_objects() if re.match(regex, type... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def findRefPath(startObj, endObj, maxLen=8, restart=True, seen={}, path=None, ignore=None):
"""Determine all paths of object references from startObj to endObj"""
refs = []
if path is None:
path = [endObj]
if ignore is None:
ignore = {}
ignore[id(sys._getframe())] = None
ignore[i... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def objString(obj):
"""Return a short but descriptive string for any object"""
try:
if type(obj) in [int, float]:
return str(obj)
elif isinstance(obj, dict):
if len(obj) > 5:
return "<dict {%s,...}>" % (",".join(list(obj.keys())[:5]))
else:
... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def objectSize(obj, ignore=None, verbose=False, depth=0, recursive=False):
"""Guess how much memory an object is using"""
ignoreTypes = ['MethodType', 'UnboundMethodType', 'BuiltinMethodType', 'FunctionType', 'BuiltinFunctionType']
ignoreTypes = [getattr(types, key) for key in ignoreTypes if hasattr(types, ... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def __init__(self):
self.objs = weakref.WeakValueDictionary()
self.allNames = [] | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def add(self, obj, name):
self.objs[name] = obj
self.allNames.append(name) | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def __setitem__(self, name, obj):
self.add(obj, name) | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def check(self):
"""Print a list of all watched objects and whether they have been collected."""
gc.collect()
dead = self.allNames[:]
alive = []
for k in self.objs:
dead.remove(k)
alive.append(k)
print("Deleted objects:", dead)
print("Live ... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def __getitem__(self, item):
return self.objs[item] | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def function(...):
profiler = Profiler()
... do stuff ...
profiler('did stuff')
... do other stuff ...
profiler('did other stuff')
# profiler is garbage-collected and flushed at function end | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def __init__(self, *args, **kwds):
pass | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def finish(self):
pass | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def __new__(cls, msg=None, disabled='env', delayed=True):
"""Optionally create a new profiler based on caller's qualname.
"""
if disabled is True or (disabled == 'env' and len(cls._profilers) == 0):
return cls._disabledProfiler | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def __call__(self, msg=None):
"""Register or print a new message with timing information.
"""
if self.disable:
return
if msg is None:
msg = str(self._markCount)
self._markCount += 1
newTime = ptime.time()
self._newMsg(" %s: %0.4f ms",
... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def mark(self, msg=None):
self(msg) | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def __del__(self):
self.finish() | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def finish(self, msg=None):
"""Add a final message; flush the message list if no parent profiler.
"""
if self._finished or self.disable:
return
self._finished = True
if msg is not None:
self(msg)
self._newMsg("< Exiting %s, total time: %0.4... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def flush(self):
if self._msgs:
print("\n".join([m[0]%m[1] for m in self._msgs]))
type(self)._msgs = [] | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def _getr(slist, olist, first=True):
i = 0
for e in slist: | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def get_all_objects():
"""Return a list of all live Python objects (excluding int and long), not including the list itself."""
gc.collect()
gcl = gc.get_objects()
olist = {}
_getr(gcl, olist) | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def lookup(oid, objects=None):
"""Return an object given its ID, if it exists."""
if objects is None:
objects = get_all_objects()
return objects[oid] | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def __init__(self):
self.startRefs = {} ## list of objects that exist when the tracker is initialized {oid: weakref}
## (If it is not possible to weakref the object, then the value is None)
self.startCount = {}
self.newRefs = {} ## list... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def findNew(self, regex):
"""Return all objects matching regex that were considered 'new' when the last diff() was run."""
return self.findTypes(self.newRefs, regex) | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def findPersistent(self, regex):
"""Return all objects matching regex that were considered 'persistent' when the last diff() was run."""
return self.findTypes(self.persistentRefs, regex) | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def start(self):
"""
Remember the current set of objects as the comparison for all future calls to diff()
Called automatically on init, but can be called manually as well.
"""
refs, count, objs = self.collect()
for r in self.startRefs:
self.forgetRef(self.star... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def __del__(self):
self.startRefs.clear()
self.startCount.clear()
self.newRefs.clear()
self.persistentRefs.clear() | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def isObjVar(cls, o):
return type(o) is cls or id(o) in cls.allObjs | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def collect(self):
print("Collecting list of all objects...")
gc.collect()
objs = get_all_objects()
frame = sys._getframe()
del objs[id(frame)] ## ignore the current frame
del objs[id(frame.f_code)] | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def forgetRef(self, ref):
if ref is not None:
del ObjTracker.allObjs[id(ref)] | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def rememberRef(self, ref):
## Record the address of the weakref object so it is not included in future object counts.
if ref is not None:
ObjTracker.allObjs[id(ref)] = None | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def lookup(self, oid, ref, objs=None):
if ref is None or ref() is None:
try:
obj = lookup(oid, objects=objs)
except:
obj = None
else:
obj = ref()
return obj | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def report(self, refs, allobjs=None, showIDs=False):
if allobjs is None:
allobjs = get_all_objects() | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def findTypes(self, refs, regex):
allObjs = get_all_objects()
ids = {}
objs = []
r = re.compile(regex)
for k in refs:
if r.search(self.objTypes[k]):
objs.append(self.lookup(k, refs[k], allObjs))
return objs | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def describeObj(obj, depth=4, path=None, ignore=None):
"""
Trace all reference paths backward, printing a list of different ways this object can be accessed.
Attempts to answer the question "who has a reference to this object"
"""
if path is None:
path = [obj]
if ignore is None:
... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def typeStr(obj):
"""Create a more useful type string by making <instance> types report their class."""
typ = type(obj)
if typ == getattr(types, 'InstanceType', None):
return "<instance of %s>" % obj.__class__.__name__
else:
return str(typ) | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def searchRefs(obj, *args):
"""Pseudo-interactive function for tracing references backward.
**Arguments:** | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def slen(o):
if hasattr(o, '__len__'):
return len(o)
else:
return None | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def allFrameObjs():
"""Return list of frame objects in current stack. Useful if you want to ignore these objects in refernece searches"""
f = sys._getframe()
objs = []
while f is not None:
objs.append(f)
objs.append(f.f_code)
#objs.append(f.f_locals)
#objs.append(f.f_glob... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def findObj(regex):
"""Return a list of objects whose typeStr matches regex"""
allObjs = get_all_objects()
objs = []
r = re.compile(regex)
for i in allObjs:
obj = allObjs[i]
if r.search(typeStr(obj)):
objs.append(obj)
return objs | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def listRedundantModules():
"""List modules that have been imported more than once via different paths."""
mods = {}
for name, mod in sys.modules.items():
if not hasattr(mod, '__file__'):
continue
mfile = os.path.abspath(mod.__file__)
if mfile[-1] == 'c':
mfil... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def walkQObjectTree(obj, counts=None, verbose=False, depth=0):
"""
Walk through a tree of QObjects, doing nothing to them.
The purpose of this function is to find dead objects and generate a crash
immediately rather than stumbling upon them later.
Prints a count of the objects encountered, for fun. ... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def qObjectReport(verbose=False):
"""Generate a report counting all QObjects and their types"""
global qObjCache
count = {}
for obj in findObj('PyQt'):
if isinstance(obj, QtCore.QObject):
oid = id(obj)
if oid not in QObjCache:
QObjCache[oid] = typeStr(obj)... | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
def __init__(self):
self.stdout = sys.stdout
sys.stdout = self | ArteliaTelemac/PostTelemac | [
16,
7,
16,
6,
1450199695
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.