rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
dev1 = self.fit_to_scale( deviation_vector[pos] ) dev2 = self.fit_to_scale( deviation_vector[pos+1] ) mean1 = self.fit_to_scale( mean_vector[pos] ) mean2 = self.fit_to_scale( mean_vector[pos+1] )
dev1 = self.fit_to_scale(mean_vector[pos] + deviation_vector[pos]) dev2 = self.fit_to_scale(mean_vector[pos+1] + deviation_vector[pos+1]) mean1 = self.fit_to_scale(mean_vector[pos]) mean2 = self.fit_to_scale(mean_vector[pos+1])
def draw_line_profile(self): # Calculate vector mean_vector = self.node.profile deviation_vector = self.node.deviation if mean_vector is None: return
if dev1!= 0 and dev2!=0: dev_up_y1 = (mean1+dev1 - self.min_value) * y_alpha dev_down_y1 = (mean1-dev1 - self.min_value) * y_alpha dev_up_y2 = (mean2+dev2 - self.min_value) * y_alpha dev_down_y2 = (mean2-dev2 - self.min_value) * y_alpha p.setPen(QtGui.QColor("red")) p.drawLine(x1,dev_up_y1, x2, dev_up_y2) p.setP...
def draw_line_profile(self): # Calculate vector mean_vector = self.node.profile deviation_vector = self.node.deviation if mean_vector is None: return
except ImportError:
def square_euclidean_dist(v1,v2): if (v1 == v2).all(): return 0.0 valids = 0 distance= 0.0 for i in xrange(len(v1)): if numpy.isfinite(v1[i]) and numpy.isfinite(v2[i]): valids += 1 d = v1[i]-v2[i] distance += d*d if valids==0: raise ValueError, "Cannot calculate values" return distance/valids
if not node.is_leaf():
if not node.is_leaf() and node.img_style["draw_descendants"] == 1:
def update_node_areas(self,node): """ This recursive function scans all nodes hunging from the given root node and calculates the coordinates and room necessary to draw a rectangular tree. IT reads the face content of each node, which ones have to be drawn, and how much room they use. """ child_rects = [] # First, go f...
for n in self.traverse(strategy="levelorder"):
for n in self.traverse(strategy="preorder"):
def iter_leaves(self): """ Returns an iterator over the leaves under this node. """ for n in self.traverse(strategy="levelorder"): if n.is_leaf(): yield n
matrix_max = numpy.max(node.arraytable._matrix_map)
matrix_max = numpy.max(node.arraytable._matrix_max)
def cluster_cbars(node): # Extras node info node.collapsed = False # Color and style node.img_style["fgcolor"] = "#3333FF" node.img_style["size"] = 4 matrix_max = numpy.max(node.arraytable._matrix_map) matrix_min = numpy.min(node.arraytable._matrix_min) matrix_avg = matrix_min+((matrix_max-matrix_min)/2) ProfileFace =...
if re.match (' +\d+\.\.\d+ +\d\.\d+ ', all_lines [i+1]): _get_values (all_lines [i+1])
if re.match (' +( +\d+\.\d+){8}', all_lines [i+1]): _get_values (model, line.split ()[0]+' '+all_lines [i+1])
def parse_paml (pamout, model): ''' parser function for codeml files, with values of w,dN,dS etc... dependending of the model tested. ''' # if multiple dataset in same file we divide the outfile and model.name+x if not '*' in str (model.properties['params']['ndata']): divide_data (pamout, model) return # starts parsing...
def prune(self, leaves, method="keep"):
def prune(self, nodes):
def prune(self, leaves, method="keep"): """ Prunes the topology of this node in order to conserve only a selected list of leaf nodes. The algorithm deletes nodes until getting a consistent topology with a subset of nodes. Topology relationships among kept nodes is maintained.
selected list of leaf nodes. The algorithm deletes nodes until getting a consistent topology with a subset of nodes. Topology relationships among kept nodes is maintained.
selected list of leaf or internal nodes. The algorithm deletes nodes until getting a consistent topology with a subset of nodes. Topology relationships among kept nodes is maintained.
def prune(self, leaves, method="keep"): """ Prunes the topology of this node in order to conserve only a selected list of leaf nodes. The algorithm deletes nodes until getting a consistent topology with a subset of nodes. Topology relationships among kept nodes is maintained.
* 'leaves' is a list of node names or node objects that must be 'kept' or 'cropped' (depending on the selected method). * 'method' can take two values: 'keep' or 'crop'. If 'keep', only leaf nodes NOT PRESENT IN in the 'leaves' list will be removed. By contrast, if 'crop' method is selected, only leaf nodes WITHIN the...
* 'nodes' is a list of node names or node objects that must be kept.
def prune(self, leaves, method="keep"): """ Prunes the topology of this node in order to conserve only a selected list of leaf nodes. The algorithm deletes nodes until getting a consistent topology with a subset of nodes. Topology relationships among kept nodes is maintained.
t = tree.Tree("(((A:0.1, B:0.01):0.001, C:0.0001):1.0[&&NHX:name=I], (D:0.00001):0.000001[&&NHX:name=J]):2.0[&&NHX:name=root];")
t = Tree("(((A:0.1, B:0.01):0.001, C:0.0001):1.0[&&NHX:name=I], (D:0.00001):0.000001[&&NHX:name=J]):2.0[&&NHX:name=root];")
def prune(self, leaves, method="keep"): """ Prunes the topology of this node in order to conserve only a selected list of leaf nodes. The algorithm deletes nodes until getting a consistent topology with a subset of nodes. Topology relationships among kept nodes is maintained.
t.prune(["A","D", node_C], method="keep")
t.prune(["A","D", node_C])
def prune(self, leaves, method="keep"): """ Prunes the topology of this node in order to conserve only a selected list of leaf nodes. The algorithm deletes nodes until getting a consistent topology with a subset of nodes. Topology relationships among kept nodes is maintained.
""" to_delete = set([]) node_instances = set([]) for l in leaves: if type(l) == str: node_instances.update(self.get_leaves_by_name(l)) elif type(l) == self.__class__: node_instances.add(l) nodes_leaves = set(self.get_leaves()) if not node_instances.issubset(nodes_leaves): raise TreeError, 'Not all leaves are present i...
""" to_keep = set(_translate_nodes(self, *nodes)) to_detach = [] for node in self.traverse("postorder"): for c in node.children: if c in to_keep: to_keep.add(node) break if node not in to_keep: to_detach.append(node) for c in node.children: to_detach.remove(c) for node in to_detach: node.detach() for node in to_keep: ...
def prune(self, leaves, method="keep"): """ Prunes the topology of this node in order to conserve only a selected list of leaf nodes. The algorithm deletes nodes until getting a consistent topology with a subset of nodes. Topology relationships among kept nodes is maintained.
<table>
def update_features_avail(feature_key, name, col, fsize, fcolor, prefix, suffix): text_features_avail.setdefault(feature_key, [name, 0, col, fsize, fcolor, prefix, suffix]) text_features_avail[feature_key][1] += 1
html_features += "</table>"
def update_features_avail(feature_key, name, col, fsize, fcolor, prefix, suffix): text_features_avail.setdefault(feature_key, [name, 0, col, fsize, fcolor, prefix, suffix]) text_features_avail[feature_key][1] += 1
<img width=16 height=16 src="webplugin/icon_tools.png" alt="Select Tree features">
<img width=16 height=16 src="/webplugin/icon_tools.png" alt="Select Tree features">
def update_features_avail(feature_key, name, col, fsize, fcolor, prefix, suffix): text_features_avail.setdefault(feature_key, [name, 0, col, fsize, fcolor, prefix, suffix]) text_features_avail[feature_key][1] += 1
<img width=16 height=16 src="webplugin/icon_attachment.png" alt="Download tree image">
<img width=16 height=16 src="/webplugin/icon_attachment.png" alt="Download tree image">
def update_features_avail(feature_key, name, col, fsize, fcolor, prefix, suffix): text_features_avail.setdefault(feature_key, [name, 0, col, fsize, fcolor, prefix, suffix]) text_features_avail[feature_key][1] += 1
<img width=16 height=16 src="webplugin/icon_search.png" alt="Search in tree">
<img width=16 height=16 src="/webplugin/icon_search.png" alt="Search in tree">
def update_features_avail(feature_key, name, col, fsize, fcolor, prefix, suffix): text_features_avail.setdefault(feature_key, [name, 0, col, fsize, fcolor, prefix, suffix]) text_features_avail[feature_key][1] += 1
<img width=16 height=16 src="webplugin/icon_cancel_search.png" alt="Clear search results">
<img width=16 height=16 src="/webplugin/icon_cancel_search.png" alt="Clear search results">
def update_features_avail(feature_key, name, col, fsize, fcolor, prefix, suffix): text_features_avail.setdefault(feature_key, [name, 0, col, fsize, fcolor, prefix, suffix]) text_features_avail[feature_key][1] += 1
<img src="webplugin/close.png" onclick='$(this).closest("
<img src="/webplugin/close.png" onclick='$(this).closest("
def update_features_avail(feature_key, name, col, fsize, fcolor, prefix, suffix): text_features_avail.setdefault(feature_key, [name, 0, col, fsize, fcolor, prefix, suffix]) text_features_avail[feature_key][1] += 1
contextMenu.addAction( "Add childs" , self.add_childs)
contextMenu.addAction( "Add children" , self.add_childs)
def showActionPopup(self): contextMenu = QtGui.QMenu() if self.node.collapsed: contextMenu.addAction( "Expand" , self.toggle_collapse) else: contextMenu.addAction( "Collapse" , self.toggle_collapse)
n,ok = QtGui.QInputDialog.getInteger(None,"Add childs","Number of childs to add:",1,1)
n,ok = QtGui.QInputDialog.getInteger(None,"Add children","Number of children to add:",1,1)
def add_childs(self): n,ok = QtGui.QInputDialog.getInteger(None,"Add childs","Number of childs to add:",1,1) if ok: for i in xrange(n): ch = self.node.add_child() self.scene().set_style_from(self.scene().startNode,self.scene().layout_func)
obj.setPos(x+ f.margin_right, y+f.margin_top)
obj.setPos(x+ f.margin_left, y+f.margin_top)
def render(self): x = 0 for c in self.columns: faces = self.column2faces.get(c, []) w, h = self.column2size[c] # Starting y position. Center columns y = (self.h / 2) - (h/2) for f in faces: if f.type == "text": obj = _TextFaceItem(f, self.node, f.get_text()) obj.setFont(f.font) obj.setBrush(QtGui.QBrush(f.fgcolor)) obj...
buffered_support = quien_va_ser_padre.support
def set_outgroup(self, outgroup): """ Sets a descendant node as the outgroup of a tree. This function can be used to root a tree or even an internal node.
def iter_descendants(self, strategy="preorder"):
def iter_descendants(self, strategy="levelorder"):
def iter_descendants(self, strategy="preorder"): """ Returns an iterator over descendant nodes. """ for n in self.traverse(strategy=strategy): if n != self: yield n
def _iter_descendants_preorder(self):
def _iter_descendants_levelorder(self):
def _iter_descendants_preorder(self): """ Iterator over all desdecendant nodes. """ tovisit = [self] while len(tovisit)>0: current = tovisit.pop(0) yield current tovisit.extend(current.children)
def traverse(self, strategy="preorder"):
def _iter_descendants_preorder(self): """ Iterator over all desdecendant nodes. """ to_visit = [] node = self while node: yield node to_visit = node.children + to_visit try: node = to_visit.pop(0) except IndexError: node = None def traverse(self, strategy="levelorder"):
def traverse(self, strategy="preorder"): """ Returns an iterator that traverse the tree structure under this node.
def get_descendants(self, strategy="preorder"):
def get_descendants(self, strategy="levelorder"):
def get_descendants(self, strategy="preorder"): """ Returns the list of all nodes (leaves and internal) under this node. re buil See iter_descendants method. """ return [n for n in self.traverse(strategy="preorder") if n != self]
return [n for n in self.traverse(strategy="preorder") if n != self]
return [n for n in self.traverse(strategy=strategy) if n != self]
def get_descendants(self, strategy="preorder"): """ Returns the list of all nodes (leaves and internal) under this node. re buil See iter_descendants method. """ return [n for n in self.traverse(strategy="preorder") if n != self]
code = (request and getattr(request, 'LANGUAGE_CODE')) or settings.LANGUAGE_CODE
code = (request and getattr(request, 'LANGUAGE_CODE', None)) or settings.LANGUAGE_CODE
def language_code(request=None): code = (request and getattr(request, 'LANGUAGE_CODE')) or settings.LANGUAGE_CODE cut = re.split('[_-]', code) code = cut[0] return code.lower()
res = func(value) if len(res) > 2: collections, items, value = res else: collections, items = res
try: res = func(value) if len(res) > 2: collections, items, value = res else: collections, items = res except ObjectDoesNotExist: collections = collections.none() items = items.none()
def search(self, request, type = None): """Perform a search through collections and items metadata""" collections = MediaCollection.objects.enriched() items = MediaItem.objects.enriched() input = request.REQUEST criteria = {}
'WHERE r.location_id = media_items.location_id AND l2.type = ' + str(Location.COUNTRY) + ' ))'
'WHERE r.location_id = media_items.location_id AND l2.type = ' + str(Location.COUNTRY) + ' LIMIT 1))'
def virtual(self, *args): qs = self need_collection = False related = [] from telemeta.models import Location for f in args: if f == 'apparent_collector': related.append('collection') qs = qs.extra(select={f: 'IF(collector_from_collection, ' 'IF(media_collections.collector_is_creator, ' 'media_collections.creator, ' 'm...
"Test the MediaCollection.get_countries() method" self.assertEquals(self.volonte.get_countries(), [self.belgique, self.france])
"Test the MediaCollection.countries() method" self.assertEquals(self.volonte.countries(), [self.belgique, self.france])
def testCollectionCountries(self): "Test the MediaCollection.get_countries() method" self.assertEquals(self.volonte.get_countries(), [self.belgique, self.france])
print collections.query
def search(self, request, type = None): """Perform a search through collections and items metadata""" collections = MediaCollection.objects.enriched() items = MediaItem.objects.enriched() input = request.REQUEST criteria = {}
if self.code: return self.code return self.old_code
if self.title and not re.match('^ *N *$', self.title): title = self.title else: title = unicode(self.collection) if self.track: title += ' ' + self.track return title
def __unicode__(self): if self.code: return self.code return self.old_code
item.file = media
item.file = self.media_item_dir + media
def media_import(self): import telemeta.models self.collection_name = 'awdio' self.collection = self.set_collection(self.collection_name)
null=True, default=None)
null=True)
def is_well_formed_id(cls, value): "Check if the media id is well formed" regex = re.compile(r"^" + media_id_regex + r"$") if regex.match(value): return True else: return False
filename = models.CharField(max_length=250, default="")
file = models.FileField(upload_to='items/%Y/%m/%d', db_column="filename", default='')
def save_by_user(self, user, force_insert=False, force_update=False, using=None): "Save a collection and add a revision" super(MediaCollection, self).save(force_insert, force_update, using) Revision(element_type='collection', element_id=self.id, user=user).touch()
import telemeta.models
def __init__(self, media_dir, log_file): self.logger = Logger(log_file) self.media_dir = media_dir + os.sep + 'items' self.medias = os.listdir(self.media_dir) self.buffer_size = 0x1000 import telemeta.models
groups.sort(self.__name_cmp)
cmp = lambda a, b: unaccent_icmp(a.value, b.value) groups.sort(cmp)
def ethnic_groups(self): "Return the ethnic groups of the items" groups = [] items = self.items.all() for item in items: if item.ethnic_group and not item.ethnic_group in groups: groups.append(item.ethnic_group)
media = settings.TELEMETA_EXPORT_DATA_DIR + os.sep + public_id + '_' + grapher_id + '_' + width + '_' + height + '.png'
media = settings.TELEMETA_DATA_CACHE_DIR + \ os.sep + '_'.join([public_id, grapher_id, width, height]) + '.png'
def item_visualize(self, request, public_id, visualizer_id, width, height): grapher_id = visualizer_id for grapher in self.graphers: if grapher.id() == grapher_id: break
print decoder.format(), mime_type
def item_export(self, request, public_id, extension): """Export a given media item in the specified format (OGG, FLAC, ...)"""
decoder = timeside.decoder.FileDecoder(item.file.path)
audio = os.path.join(os.path.dirname(__file__), item.file.path) decoder = timeside.decoder.FileDecoder(audio)
def item_export(self, request, public_id, extension): """Export a given media item in the specified format (OGG, FLAC, ...)"""
response = HttpResponse(stream_from_file(item.file.path), mimetype = mime_type)
response = HttpResponse(stream_from_file(audio), mimetype = mime_type)
def item_export(self, request, public_id, extension): """Export a given media item in the specified format (OGG, FLAC, ...)"""
result=self.collections.by_ethnic_group("a").order_by("title")
result=self.collections.by_ethnic_group(self.a).order_by("title")
def testEthnicGroup(self): "Test by_ethnic_group property of MediaCollection class" result=self.collections.by_ethnic_group("a").order_by("title") self.assertEquals(result[0], self.persepolis) self.assertEquals(result[1], self.volonte)
approx_value = int(round(analyzer['value'])) item.approx_duration = approx_value
value = analyzer['value'] time = value.split(':') time[2] = time[2].split('.')[0] time = ':'.join(time) item.approx_duration = time
def item_detail(self, request, public_id, template='telemeta/mediaitem_detail.html'): """Show the details of a given item""" item = MediaItem.objects.get(public_id=public_id) formats = [] for encoder in self.encoders: formats.append({'name': encoder.format(), 'extension': encoder.file_extension()})
regex = '^' + self.collection.code + '_[0-9]{2}(_[0-9]{2})?$'
if self.collection.is_published: regex = '^' + self.collection.code + '_[0-9]{2}(_[0-9]{2})?$' else: regex = '^' + self.collection.code + '_[0-9]{3}(_[0-9]{2})?(_[0-9]{2})?$'
def is_valid_code(self, code): "Check if the item code is well formed" regex = '^' + self.collection.code + '_[0-9]{2}(_[0-9]{2})?$' if re.match(regex, self.code): return True
self.assertEqual(pixels[0], 730044) self.assertTrue(qs.getGeometry(730044).contains(poly))
self.assertEqual(pixels[0], 182720) self.assertTrue(qs.getGeometry(182720).contains(poly))
def testImageToPixels(self): """Tests intersection of an image (WCS and dimensions) with a quad-sphere pixelization. """ #metadata taken from CFHT data v695856-e0/v695856-e0-c000-a00.sci_img.fits metadata = dafBase.PropertySet() metadata.set("SIMPLE", "T") metadata.set("BITPIX", -32) metadata.set("NAXIS", 2) metadata.s...
AbstractFunction.__init__(self,1)
AbstractFunction.__init__(self,find_parameter(func,'dimensions',1))
def __init__(self,func): AbstractFunction.__init__(self,1) transientFunctions[self]=func
terminations=[n.addDecodedTermination(name,[matrix[i]],tauPSC,isModulatory) for i,n in enumerate(self._nodes)]
if self.multidimensional: terminations=[n.addDecodedTermination(name,matrix[i],tauPSC,isModulatory) for i,n in enumerate(self._nodes)] else: terminations=[n.addDecodedTermination(name,[matrix[i]],tauPSC,isModulatory) for i,n in enumerate(self._nodes)]
def addDecodedTermination(self,name,matrix,tauPSC,isModulatory): """Create a new termination. A new termination is created on each of the ensembles, which are then grouped together.""" terminations=[n.addDecodedTermination(name,[matrix[i]],tauPSC,isModulatory) for i,n in enumerate(self._nodes)] termination=EnsembleTer...
def make_array(self,name,neurons,length,**args):
def make_array(self,name,neurons,length,dimensions=1,**args):
def make_array(self,name,neurons,length,**args): """Create and return an array of ensembles. Each ensemble will be 1-dimensional. All of the parameters from Network.make() can be used.""" #ensemble=EnsembleArray(name,[self.make('%d'%i,neurons,1,add_to_network=False,**args) for i in range(length)]) ensemble=NetworkArr...
ensemble=NetworkArray(name,[self.make('%d'%i,neurons,1,add_to_network=False,**args) for i in range(length)])
ensemble=NetworkArray(name,[self.make('%d'%i,neurons,dimensions,add_to_network=False,**args) for i in range(length)])
def make_array(self,name,neurons,length,**args): """Create and return an array of ensembles. Each ensemble will be 1-dimensional. All of the parameters from Network.make() can be used.""" #ensemble=EnsembleArray(name,[self.make('%d'%i,neurons,1,add_to_network=False,**args) for i in range(length)]) ensemble=NetworkArr...
origin=pre.getOrigin(fname)
try: origin=pre.getOrigin(fname) except StructuralException: origin=None
def _parse_pre(self,pre,func,origin_name): if isinstance(pre,Origin): assert func==None return pre elif isinstance(pre,FunctionInput): assert func==None return pre.getOrigin('origin') elif isinstance(pre,NEFEnsemble) or (hasattr(pre,'getOrigin') and hasattr(pre,'addDecodedOrigin')): if func is not None: if origin_name ...
self.points=[]
self.points=points
def __init__(self,points): self.points=[]
self.listeners=[]
def __init__(self,name): self.listeners=[] self._origins={} self._terminations={} self._name=name self._states=java.util.Properties() self.setMode(SimulationMode.DEFAULT)
VisiblyMutableUtils.nameChanged(self, self.getName(), name, self.listeners)
VisiblyMutableUtils.nameChanged(self, self.getName(), name, BaseNode.listeners.get(self,[]))
def setName(self,name): VisiblyMutableUtils.nameChanged(self, self.getName(), name, self.listeners) self._name=name
self.listeners.append(listener)
if self not in BaseNode.listeners: BaseNode.listeners[self]=[listener] else: BaseNode.listeners[self].append(listener)
def addChangeListener(self,listener): self.listeners.append(listener)
self.listeners.remove(listener)
if self in BaseNode.listeners: BaseNode.listeners[self].remove(listener)
def removeChangeListener(self,listener): self.listeners.remove(listener)
if not java.io.File(storage_name+'.nef').exists():
if not java.io.File(storage_name+'.'+FileManager.ENSEMBLE_EXTENSION).exists():
def make(self,name,neurons,dimensions, tau_rc=0.02,tau_ref=0.002, max_rate=(200,400),intercept=(-1,1), radius=1,encoders=None, decoder_noise=0.1, eval_points=None, noise=None,noise_frequency=1000, mode='spike',add_to_network=True, quick=False,storage_code=''): """Create and return an ensemble of LIF neurons.
w=MU.prod(encoder,MU.transpose(decoder))
w=MU.prod(encoder,MU.prod(transform,MU.transpose(decoder)))
def connect(self,pre,post, transform=None,weight=1,index_pre=None,index_post=None, pstc=0.01,func=None,weight_func=None,origin_name=None, modulatory=False): """Connect two nodes in the network.
n.reset()
n.reset(randomize)
def reset(self,randomize=False): for n in self._nodes: n.reset()
n.reset(randomize=randomize)
n.reset()
def reset(self,randomize=False): for n in self._nodes: n.reset(randomize=randomize)
storage_name='quick'+java.io.File.pathSeparator+storage_name
storage_name='quick'+java.io.File.separator+storage_name
def make(self,name,neurons,dimensions, tau_rc=0.02,tau_ref=0.002, max_rate=(200,400),intercept=(-1,1), radius=1,encoders=None, decoder_noise=0.1, eval_points=None, noise=None,noise_frequency=1000, mode='spike',add_to_network=True, quick=False,storage_code=''): """Create and return an ensemble of LIF neurons.
for i in range(len(defaults)): if args[-i-1]==param: return defaults[-i-1]
if defaults is not None: for i in range(len(defaults)): if args[-i-1]==param: return defaults[-i-1]
def find_parameter(func,param,default): args,varags,varkw,defaults=inspect.getargspec(func) for i in range(len(defaults)): if args[-i-1]==param: return defaults[-i-1] return default
import inspect def find_parameter(func,param,default): args,varags,varkw,defaults=inspect.getargspec(func) if defaults is not None: for i in range(len(defaults)): if args[-i-1]==param: return defaults[-i-1] return default
def genVectors(self,number,dimensions): points=[] while len(points)<number: points.extend(self.points) return points[:number]
def __init__(self,func): AbstractFunction.__init__(self,find_parameter(func,'dimensions',1))
def __init__(self,func,dimensions=1): AbstractFunction.__init__(self,dimensions)
def __init__(self,func): AbstractFunction.__init__(self,find_parameter(func,'dimensions',1)) transientFunctions[self]=func
origin=pre.addDecodedOrigin(fname,[PythonFunction(func)],'AXON')
if isinstance(pre,NetworkArray): dim=pre._nodes[0].dimension else: dim=pre.dimension origin=pre.addDecodedOrigin(fname,[PythonFunction(func,dim)],'AXON')
def _parse_pre(self,pre,func,origin_name): if isinstance(pre,Origin): assert func==None return pre elif isinstance(pre,FunctionInput): assert func==None return pre.getOrigin('origin') elif isinstance(pre,NEFEnsemble) or (hasattr(pre,'getOrigin') and hasattr(pre,'addDecodedOrigin')): if func is not None: if origin_name ...
db.add_column('main_pageversion', 'page', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['main.Page']), keep_default=False)
db.add_column('main_pageversion', 'page', self.gf('django.db.models.fields.related.ForeignKey')(default=0, to=orm['main.Page']), keep_default=False)
def forwards(self, orm): # Adding field 'PageVersion.page' db.add_column('main_pageversion', 'page', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['main.Page']), keep_default=False)
res = self.move_journal_id_payment_get(cr, uid, ids)
res = self.ret_payment_get(cr, uid, ids)
def test_retenida(self, cr, uid, ids, type, *args): res = self.move_journal_id_payment_get(cr, uid, ids) if not res: return False ok = True
cr.execute("select id from account_journal where id in (%s) and type=%s", (','.join(map(str,res)),type))
cr.execute('select \ l.id \ from account_move_line l \ inner join account_journal j on (j.id=l.journal_id) \ where l.id in ('+','.join(map(str,res))+') and j.type='+ '\''+type+'\'')
def test_retenida(self, cr, uid, ids, type, *args): res = self.move_journal_id_payment_get(cr, uid, ids) if not res: return False ok = True
def move_journal_id_payment_get(self, cr, uid, ids, *args): res = [] if not ids: return res cr.execute('select distinct\ l.journal_id \ from account_move_line l \ left join account_invoice i on (i.move_id=l.move_id) \ where i.id in ('+','.join(map(str,ids))+') and l.account_id=i.account_id') res = map(lambda x: x[0], c...
def ret_payment_get(self, cr, uid, ids, *args): for invoice in self.browse(cr, uid, ids): moves = self.move_line_id_payment_get(cr, uid, [invoice.id]) src = [] lines = [] for m in self.pool.get('account.move.line').browse(cr, uid, moves): temp_lines = [] if m.reconcile_id: temp_lines = map(lambda x: x.id, m.reconcile_i...
def test_retenida(self, cr, uid, ids, type, *args): res = self.move_journal_id_payment_get(cr, uid, ids) if not res: return False ok = True
'group_tax':self._group_tax,
def __init__(self, cr, uid, name, context): super(pur_sal_wh_book, self).__init__(cr, uid, name, context) self.localcontext.update({ 'time': time, 'get_partner_addr': self._get_partner_addr, 'get_alicuota': self._get_alicuota, 'get_rif': self._get_rif, 'get_data':self._get_data, 'get_exc':self._get_exc, 'get_month':sel...
def _group_tax(self,list_tax=[]): tax_obj = self.pool.get('account.tax') tax_ids = tax_obj.search(self.cr,self.uid,[]) tax = tax_obj.browse(self.cr,self.uid, tax_ids) tax_detail = [] if len(list_tax) > 1: print list_tax for taxes in list_tax: if taxes.tax_amount/taxes.base_ret*100: print "TAXES......................",t...
def _get_exc(self,obj_rl): excent=0.0 for taxes in obj_rl.tax_line: if not taxes.tax_amount: excent=excent + taxes.base_amount return excent
if obj_inv.parent_id and obj_inv.parent_id.id:
if invtype!='in_refund' and obj_inv.parent_id and obj_inv.parent_id.id:
def action_number(self, cr, uid, ids, *args): cr.execute('SELECT id, type, number, move_id, reference ' \ 'FROM account_invoice ' \ 'WHERE id IN ('+','.join(map(str,ids))+')') obj_inv = self.browse(cr, uid, ids)[0] for (id, invtype, number, move_id, reference) in cr.fetchall(): if not number: if obj_inv.journal_id.invo...
if invtype!='in_refund' and obj_inv.parent_id and obj_inv.parent_id.id:
if invtype not in ('in_refund','out_refund') and obj_inv.parent_id and obj_inv.parent_id.id:
def action_number(self, cr, uid, ids, *args): cr.execute('SELECT id, type, number, move_id, reference ' \ 'FROM account_invoice ' \ 'WHERE id IN ('+','.join(map(str,ids))+')') obj_inv = self.browse(cr, uid, ids)[0] for (id, invtype, number, move_id, reference) in cr.fetchall(): if not number: if obj_inv.journal_id.invo...
'get_tot_gral_retencion': self._get_tot_gral_retencion
'get_tot_gral_retencion': self._get_tot_gral_retencion, 'get_rif': self._get_rif
def __init__(self, cr, uid, name, context): super(rep_comprobante, self).__init__(cr, uid, name, context) self.localcontext.update({ 'time': time, 'get_partner_addr': self._get_partner_addr, 'get_alicuota': self._get_alicuota, 'get_tipo_doc': self._get_tipo_doc, 'get_totales': self._get_totales, 'get_tot_gral_compra': ...
print 'devoluciones: ',scl_ids
def find_parent(self, cr, uid, ids): sc_line_obj = self.pool.get('stock.card.line') sp_obj = self.pool.get('stock.picking') scl_ids = self.find_return(cr, uid, ids) print 'devoluciones: ',scl_ids for scl in sc_line_obj.browse(cr,uid,scl_ids): nb =scl.picking_id.name[:scl.picking_id.name.lower().find('return')-1].strip(...
print 'a buscar: ',nb
def find_parent(self, cr, uid, ids): sc_line_obj = self.pool.get('stock.card.line') sp_obj = self.pool.get('stock.picking') scl_ids = self.find_return(cr, uid, ids) print 'devoluciones: ',scl_ids for scl in sc_line_obj.browse(cr,uid,scl_ids): nb =scl.picking_id.name[:scl.picking_id.name.lower().find('return')-1].strip(...
print 'posible picking padre: ',sp_ids
def find_parent(self, cr, uid, ids): sc_line_obj = self.pool.get('stock.card.line') sp_obj = self.pool.get('stock.picking') scl_ids = self.find_return(cr, uid, ids) print 'devoluciones: ',scl_ids for scl in sc_line_obj.browse(cr,uid,scl_ids): nb =scl.picking_id.name[:scl.picking_id.name.lower().find('return')-1].strip(...
print 'linea padre: ',scl_ids
def find_parent(self, cr, uid, ids): sc_line_obj = self.pool.get('stock.card.line') sp_obj = self.pool.get('stock.picking') scl_ids = self.find_return(cr, uid, ids) print 'devoluciones: ',scl_ids for scl in sc_line_obj.browse(cr,uid,scl_ids): nb =scl.picking_id.name[:scl.picking_id.name.lower().find('return')-1].strip(...
print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom
def compute_compra(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des): subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom q_des+=q_mov print 'realizando calculo compra:' subtot = scl_obj.invoice_price_unit*q_mov tot += subtot i...
print 'realizando calculo compra:' subtot = scl_obj.invoice_price_unit*q_mov
subtot = scl_obj.invoice_line_id.price_subtotal
def compute_compra(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des): subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom q_des+=q_mov print 'realizando calculo compra:' subtot = scl_obj.invoice_price_unit*q_mov tot += subtot i...
print 'subtotal despues: ',subtot print 'total despues: ',tot print 'avg despues: ',prom print 'qda despues:',q_des
def compute_compra(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des): subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom q_des+=q_mov print 'realizando calculo compra:' subtot = scl_obj.invoice_price_unit*q_mov tot += subtot i...
print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom
def compute_nc_vta(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des): subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom if scl_obj.parent_id and scl_obj.parent_id.avg: prom_pad = scl_obj.parent_id.avg else: print 'PADRE SIN P...
print 'PADRE SIN PRECIO PROMEDIOOOOOO' prom_pad = 0.0 print 'precio avg del padre:',prom_pad
prom_pad = prom
def compute_nc_vta(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des): subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom if scl_obj.parent_id and scl_obj.parent_id.avg: prom_pad = scl_obj.parent_id.avg else: print 'PADRE SIN P...
print 'realizando calculo nc venta:'
def compute_nc_vta(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des): subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom if scl_obj.parent_id and scl_obj.parent_id.avg: prom_pad = scl_obj.parent_id.avg else: print 'PADRE SIN P...
print 'subtotal despues: ',subtot print 'total despues: ',tot print 'avg despues: ',prom print 'qda despues:',q_des
def compute_nc_vta(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des): subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom if scl_obj.parent_id and scl_obj.parent_id.avg: prom_pad = scl_obj.parent_id.avg else: print 'PADRE SIN P...
print 'validando padre NC VENTA: ',scl_obj.parent_id
def validate_nc_vta(self, cr, uid, ids, scl_obj,q_mov,tot,prom,q_des,no_cp,lst_org,act_sml_id,s_ord): if scl_obj.parent_id: print 'validando padre NC VENTA: ',scl_obj.parent_id if scl_obj.parent_id.id in lst_org or scl_obj.parent_id.id in no_cp: no_cp.append(act_sml_id) else: print 'procesoooo NC VTA padre procesado:' ...
print 'procesoooo NC VTA padre procesado:'
def validate_nc_vta(self, cr, uid, ids, scl_obj,q_mov,tot,prom,q_des,no_cp,lst_org,act_sml_id,s_ord): if scl_obj.parent_id: print 'validando padre NC VENTA: ',scl_obj.parent_id if scl_obj.parent_id.id in lst_org or scl_obj.parent_id.id in no_cp: no_cp.append(act_sml_id) else: print 'procesoooo NC VTA padre procesado:' ...
print 'procesoooo NC VTA:'
def validate_nc_vta(self, cr, uid, ids, scl_obj,q_mov,tot,prom,q_des,no_cp,lst_org,act_sml_id,s_ord): if scl_obj.parent_id: print 'validando padre NC VENTA: ',scl_obj.parent_id if scl_obj.parent_id.id in lst_org or scl_obj.parent_id.id in no_cp: no_cp.append(act_sml_id) else: print 'procesoooo NC VTA padre procesado:' ...
print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom
def compute_venta(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des): subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom q_des-=q_mov print 'realizando calculo venta:' subtot = prom*q_mov tot -= subtot
print 'realizando calculo venta:'
def compute_venta(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des): subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom q_des-=q_mov print 'realizando calculo venta:' subtot = prom*q_mov tot -= subtot
print 'subtotal despues: ',subtot print 'total despues: ',tot print 'avg despues: ',prom print 'qda despues:',q_des
def compute_venta(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des): subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom q_des-=q_mov print 'realizando calculo venta:' subtot = prom*q_mov tot -= subtot
print 'procesooo venta:'
def validate_venta(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des,no_cp,lst_org,act_sml_id,s_ord): if not no_cp and q_des >= q_mov: print 'procesooo venta:' q_bef = q_des q_des,subtot,tot,prom = self.compute_venta(cr, uid, ids, scl_obj, q_mov,tot,prom,q_des) #REALIZAR EL WRITE DE LA LINEA value = { 'subtotal':subtot...
print 'no procesoooo vta:'
def validate_venta(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des,no_cp,lst_org,act_sml_id,s_ord): if not no_cp and q_des >= q_mov: print 'procesooo venta:' q_bef = q_des q_des,subtot,tot,prom = self.compute_venta(cr, uid, ids, scl_obj, q_mov,tot,prom,q_des) #REALIZAR EL WRITE DE LA LINEA value = { 'subtotal':subtot...
subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom
print "scl_obj", scl_obj subtot = 0.0
def compute_nc_compra(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des): subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom if scl_obj.parent_id and scl_obj.parent_id.invoice_price_unit: cost_pad = scl_obj.parent_id.invoice_pr...
cost_pad = scl_obj.parent_id.invoice_price_unit
cost_pad = scl_obj.parent_id.invoice_line_id.price_subtotal / q_mov
def compute_nc_compra(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des): subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom if scl_obj.parent_id and scl_obj.parent_id.invoice_price_unit: cost_pad = scl_obj.parent_id.invoice_pr...
print 'PADRE SIN PRECIO UNITARIOOOO' cost_pad = 0.0 print 'precio unitario del padre:',cost_pad
cost_pad = scl_obj.invoice_line_id.price_subtotal / q_mov
def compute_nc_compra(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des): subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom if scl_obj.parent_id and scl_obj.parent_id.invoice_price_unit: cost_pad = scl_obj.parent_id.invoice_pr...
print 'realizando calculo nc compra:'
def compute_nc_compra(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des): subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom if scl_obj.parent_id and scl_obj.parent_id.invoice_price_unit: cost_pad = scl_obj.parent_id.invoice_pr...
print 'subtotal despues: ',subtot print 'total despues: ',tot print 'avg despues: ',prom print 'qda despues:',q_des
def compute_nc_compra(self, cr, uid, ids, scl_obj, q_mov,tot,prom,q_des): subtot = 0.0 print 'q mov: ',q_mov print 'qda antes: ',q_des print 'subtotal antes: ',subtot print 'total antes: ',tot print 'avg antes: ',prom if scl_obj.parent_id and scl_obj.parent_id.invoice_price_unit: cost_pad = scl_obj.parent_id.invoice_pr...