bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def _display_help(): import sys sys.stderr.write("""
def _display_help(): import sys sys.stderr.write("""
445,700
def _display_help(): import sys sys.stderr.write("""
def _display_help(): import sys sys.stderr.write("""
445,701
def __eq__(self, other): if isinstance(other, self.__class__): return self.task_id == other.task_id return self == other
def __eq__(self, other): if isinstance(other, self.__class__): return self.task_id == other.task_id return self == other
445,702
def __init__(self, task_id): super(AsyncResult, self).__init__(task_id, backend=default_backend)
def __init__(self, task_id): super(AsyncResult, self).__init__(task_id, backend=default_backend)
445,703
def iterate(self): """Iterate over the return values of the tasks as they finish one by one.
def iterate(self): """Iterate over the return values of the tasks as they finish one by one.
445,704
def iterate(self): """Iterate over the return values of the tasks as they finish one by one.
def iterate(self): """Iterate over the return values of the tasks as they finish one by one.
445,705
def safe_ref(target, on_delete=None): """Return a *safe* weak reference to a callable target :param target: the object to be weakly referenced, if it's a bound method reference, will create a :class:`BoundMethodWeakref`, otherwise creates a simple :class:`weakref.ref`. :keyword on_delete: if provided, will have a har...
def safe_ref(target, on_delete=None): """Return a *safe* weak reference to a callable target :param target: the object to be weakly referenced, if it's a bound method reference, will create a :class:`BoundMethodWeakref`, otherwise creates a simple :class:`weakref.ref`. :keyword on_delete: if provided, will have a har...
445,706
def run(self): self.init_loader() self.init_queues() self.worker_init() self.redirect_stdouts_to_logger() print("celery@%s v%s is starting." % (self.hostname, __version__))
def run(self): self.init_loader() self.init_queues() self.worker_init() self.redirect_stdouts_to_logger() print("celery@%s v%s is starting." % (self.hostname, __version__))
445,707
def get(self, argv, cmd): wanted = argv[0] p = NamespacedOptionParser(argv[1:]) for name, worker, _ in multi_args(p, cmd): print("NAME: %s WANTED: %s" % (name, wanted)) if name == wanted: print(" ".join(worker)) return
def get(self, argv, cmd): wanted = argv[0] p = NamespacedOptionParser(argv[1:]) for name, worker, _ in multi_args(p, cmd): if name == wanted: print(" ".join(worker)) return
445,708
def button_action(button): name=button._get_text() if name=="LoadRobot": if not noTkinter: root = Tkinter.Tk() root.withdraw() filename = tkFileDialog.askopenfilename() root.destroy() self.loadRobot(filename) else: warnings.warn("Tkinter not available") elif name=="LoadMotion": if not noTkinter: root = Tkinter.Tk() roo...
def button_action(button): name=button._get_text() if name=="LoadRobot": if not noTkinter: root = Tkinter.Tk() root.withdraw() filename = tkFileDialog.askopenfilename() root.destroy() self.loadRobot(filename) else: warnings.warn("Tkinter not available") elif name=="LoadMotion": if not noTkinter: root = Tkinter.Tk() roo...
445,709
def on_draw_scene(self): self.w2.clear() self.count+=1 glLoadIdentity() p=self.camera.position f=self.camera.lookat u=self.camera.up gluLookAt(p[0],p[1],p[2],f[0],f[1],f[2],u[0],u[1],u[2]) draw_floor()
def on_draw_scene(self): self.w2.clear() self.count+=1 glLoadIdentity() p=self.camera.position f=self.camera.lookat u=self.camera.up gluLookAt(p[0],p[1],p[2],f[0],f[1],f[2],u[0],u[1],u[2]) draw_floor()
445,710
def on_draw_scene(self): self.w2.clear() self.count+=1 glLoadIdentity() p=self.camera.position f=self.camera.lookat u=self.camera.up gluLookAt(p[0],p[1],p[2],f[0],f[1],f[2],u[0],u[1],u[2]) draw_floor()
defon_draw_scene(self):self.w2.clear()self.count+=1glLoadIdentity()p=self.camera.positionf=self.camera.lookatu=self.camera.upgluLookAt(p[0],p[1],p[2],f[0],f[1],f[2],u[0],u[1],u[2])draw_floor()
445,711
def on_draw_scene(self): self.w2.clear() self.count+=1 glLoadIdentity() p=self.camera.position f=self.camera.lookat u=self.camera.up gluLookAt(p[0],p[1],p[2],f[0],f[1],f[2],u[0],u[1],u[2]) draw_floor()
def on_draw_scene(self): self.w2.clear() self.count+=1 glLoadIdentity() p=self.camera.position f=self.camera.lookat u=self.camera.up gluLookAt(p[0],p[1],p[2],f[0],f[1],f[2],u[0],u[1],u[2]) draw_floor()
445,712
def on_draw_scene(self): self.w2.clear() self.count+=1 glLoadIdentity() p=self.camera.position f=self.camera.lookat u=self.camera.up gluLookAt(p[0],p[1],p[2],f[0],f[1],f[2],u[0],u[1],u[2]) draw_floor()
def on_draw_scene(self): self.w2.clear() self.count+=1 glLoadIdentity() p=self.camera.position f=self.camera.lookat u=self.camera.up gluLookAt(p[0],p[1],p[2],f[0],f[1],f[2],u[0],u[1],u[2]) draw_floor()
445,713
def draw_skeleton(robot): # draw_skeleton a sphere at each mobile joint if robot.jointType in ["free","rotate"]: pos=robot.globalTransformation[0:3,3] glPushMatrix() glTranslatef(pos[0], pos[1], pos[2]) sphere = gluNewQuadric() gluSphere(sphere,0.01,10,10) glPopMatrix() if robot.jointType=="rotate": parent=robot.paren...
defdraw_skeleton(robot):#draw_skeletonasphereateachmobilejointifrobot.jointTypein["free","rotate"]:pos=robot.globalTransformation[0:3,3]glPushMatrix()glTranslatef(pos[0],pos[1],pos[2])sphere=gluNewQuadric()gluSphere(sphere,0.01,10,10)glPopMatrix()ifrobot.jointType=="rotate":parent=robot.parentparent_pos=parent.globalTr...
445,714
def draw_skeleton(robot): # draw_skeleton a sphere at each mobile joint if robot.jointType in ["free","rotate"]: pos=robot.globalTransformation[0:3,3] glPushMatrix() glTranslatef(pos[0], pos[1], pos[2]) sphere = gluNewQuadric() gluSphere(sphere,0.01,10,10) glPopMatrix() if robot.jointType=="rotate": parent=robot.paren...
def draw_skeleton(robot): # draw_skeleton a sphere at each mobile joint if robot.jointType in ["free","rotate"]: pos=robot.globalTransformation[0:3,3] glPushMatrix() glTranslatef(pos[0], pos[1], pos[2]) sphere = gluNewQuadric() gluSphere(sphere,0.01,10,10) if robot.jointType=="rotate": parent=robot.parent parent_pos=p...
445,715
def draw_skeleton(robot): # draw_skeleton a sphere at each mobile joint if robot.jointType in ["free","rotate"]: pos=robot.globalTransformation[0:3,3] glPushMatrix() glTranslatef(pos[0], pos[1], pos[2]) sphere = gluNewQuadric() gluSphere(sphere,0.01,10,10) glPopMatrix() if robot.jointType=="rotate": parent=robot.paren...
def draw_skeleton(robot): # draw_skeleton a sphere at each mobile joint if robot.jointType in ["free","rotate"]: pos=robot.globalTransformation[0:3,3] glPushMatrix() glTranslatef(pos[0], pos[1], pos[2]) sphere = gluNewQuadric() gluSphere(sphere,0.01,10,10) glPopMatrix() if robot.jointType=="rotate": parent=robot.paren...
445,716
def init(self): if self.type=="baseNode": self.update() from collections import deque pile=deque() pile.append(self) while not len(pile)==0: an_element=pile.pop()
def init(self): if self.type=="baseNode": self.update() self.joint_list=[] self.mesh_list=[] pile=deque() pile.append(self) while not len(pile)==0: an_element=pile.pop()
445,717
def __init__(self,translation=[0,0,0],rotation=[1,0,0,0],children=[]): self.type= "baseNode" self.jointType="" self.name=None self.id=-999 self.translation=translation self.rotation=rotation self.children=children self.parent=None self.localTransformation=np.zeros([4,4]) self.globalTransformation=np.zeros([4,4]) self.j...
def __init__(self): self.type= "baseNode" self.jointType="" self.name=None self.id=-999 self.translation=translation self.rotation=rotation self.children=children self.parent=None self.localTransformation=np.zeros([4,4]) self.globalTransformation=np.zeros([4,4]) self.joint_list=[] self.joint_dict=dict() self.rpy=[0,0,0...
445,718
def __init__(self,translation=[0,0,0],rotation=[1,0,0,0],children=[]): self.type= "baseNode" self.jointType="" self.name=None self.id=-999 self.translation=translation self.rotation=rotation self.children=children self.parent=None self.localTransformation=np.zeros([4,4]) self.globalTransformation=np.zeros([4,4]) self.j...
def __init__(self,translation=[0,0,0],rotation=[1,0,0,0],children=[]): self.type= "baseNode" self.jointType="" self.name=None self.id=-999 self.translation=[0,0,0] self.rotation=[1,0,0,0] self.children=[] self.parent=None self.localTransformation=np.zeros([4,4]) self.globalTransformation=np.zeros([4,4]) self.joint_list...
445,719
def __init__(self,translation=[0,0,0],rotation=[1,0,0,0],children=[]): self.type= "baseNode" self.jointType="" self.name=None self.id=-999 self.translation=translation self.rotation=rotation self.children=children self.parent=None self.localTransformation=np.zeros([4,4]) self.globalTransformation=np.zeros([4,4]) self.j...
def __init__(self,translation=[0,0,0],rotation=[1,0,0,0],children=[]): self.type= "baseNode" self.jointType="" self.name=None self.id=-999 self.translation=translation self.rotation=rotation self.children=children self.parent=None self.localTransformation=np.zeros([4,4]) self.globalTransformation=np.zeros([4,4]) self.j...
445,720
def htmlparse(self,data): ''' Input: can be html code or raw JavaScript code Output: an array of [headers, raw JavaScript] ''' outheader, out = '', '' data = re.sub('\x00','',data) soup = BeautifulSoup.BeautifulSoup(data) for tag,attrib,invals,format,outvals in self.html_parse_rules: for htm in soup.findAll(tag,attrib...
def htmlparse(self,data): ''' Input: can be html code or raw JavaScript code Output: an array of [headers, raw JavaScript] ''' outheader, out = '', '' data = re.sub('\x00','',data) soup = BeautifulSoup.BeautifulSoup(data) for tag,attrib,invals,format,outvals in self.html_parse_rules: for htm in soup.findAll(tag,attrib...
445,721
def main(): global ENABLE_NIDS global ENABLE_MAGIC socket.setdefaulttimeout(10) #network capable only if -a (--active) parameter specified message = '\n\t./jsunpackn.py [fileName]\n\t./jsunpackn.py -i [interfaceName]\n\tjsunpack-network version %s' % (jsunpack.version) if not ENABLE_NIDS: message += '\n\t[warning] py...
def main(): global ENABLE_NIDS global ENABLE_MAGIC socket.setdefaulttimeout(10) #network capable only if -a (--active) parameter specified message = '\n\t./jsunpackn.py [fileName]\n\t./jsunpackn.py -i [interfaceName]\n\tjsunpack-network version %s' % (jsunpack.version) if not ENABLE_NIDS: message += '\n\t[warning] py...
445,722
def getJavaScript(self): out = '' pagenow = 0 for jskey in self.list_obj: #(self.objects.keys()): if self.objects[jskey].staticScript: out += self.objects[jskey].staticScript
def getJavaScript(self): out = '' pagenow = 0 for jskey in self.list_obj: #(self.objects.keys()): if self.objects[jskey].staticScript: out += self.objects[jskey].staticScript
445,723
def decodeJS(self,content,isPDF): #return values are: #(decoded scripts) try: to_write_headers, to_write = self.hparser.htmlparse(content) except Exception, e: pass #print 'Error in htmlparsing', str(e)
def decodeJS(self,content,isPDF): #return values are: #(decoded scripts) try: to_write_headers, to_write = self.hparser.htmlparse(content) except Exception, e: pass #print 'Error in htmlparsing', str(e)
445,724
def internal_addr(self,ipin): '''returns True if 127.*, or other internal addr''' #ip = socket.inet_aton(ip) try: ip = struct.unpack('L',socket.inet_aton(ipin))[0] except: #is this a python 2.6 problem where inet_aton return value is integer? ip = socket.inet_aton(ipin)
def internal_addr(self,ipin): '''returns True if 127.*, or other internal addr''' #ip = socket.inet_aton(ip) try: ip = struct.unpack('L',socket.inet_aton(ipin))[0] except: #is this a python 2.6 problem where inet_aton return value is integer? ip = socket.inet_aton(ipin)
445,725
def internal_addr(self,ipin): '''returns True if 127.*, or other internal addr''' #ip = socket.inet_aton(ip) try: ip = struct.unpack('L',socket.inet_aton(ipin))[0] except: #is this a python 2.6 problem where inet_aton return value is integer? ip = socket.inet_aton(ipin)
def internal_addr(self,ipin): '''returns True if 127.*, or other internal addr''' #ip = socket.inet_aton(ip) try: ip = struct.unpack('L',socket.inet_aton(ipin))[0] except: #is this a python 2.6 problem where inet_aton return value is integer? ip = socket.inet_aton(ipin)
445,726
def decodeVersions(self,to_write,isPDF): decodings = [] #there may be multiple decodings if we get different results for version strings duration = 0 #total elapsed time runningTime = 0 #previous evaluation time
def decodeVersions(self,to_write,isPDF): decodings = [] #there may be multiple decodings if we get different results for version strings duration = 0 #total elapsed time runningTime = 0 #previous evaluation time
445,727
def parse(self):
def parse(self):
445,728
def __init__(self, To=None, From=None, Subject=None, Body=None, Html=None, attachments=None, charset=None): self.attachments = [] if attachments: for attachment in attachments: if isinstance(attachment, basestring): self.attachments.append((attachment, None)) else: try: filename, cid = attachment except (TypeError, Ind...
def __init__(self, To=None, From=None, Subject=None, Body=None, Html=None, Date=None, attachments=None, charset=None): self.attachments = [] if attachments: for attachment in attachments: if isinstance(attachment, basestring): self.attachments.append((attachment, None)) else: try: filename, cid = attachment except (Typ...
445,729
def __init__(self, host="localhost", port=0): self.host = host self.port = port self._usr = None self._pwd = None
def __init__(self, host="localhost", port=0): self.host = host self.port = port self._usr = None self._pwd = None
445,730
def send(self, msg): """ Send one message or a sequence of messages.
def send(self, msg): """ Send one message or a sequence of messages.
445,731
def send(self, msg): """ Send one message or a sequence of messages.
def def _get_mailserver(self): mailserver = smtplib.SMTP(self.host) if self._usr and self._pwd: server.login(self._usr, self._pwd) return mailserver def _get_gmail_server(self): if not self._usr and self._pwd: err = 'Cannot send through %s without a name and password.' raise ValueError(err % self.host) mailserver = sm...
445,732
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
445,733
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
445,734
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
445,735
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
445,736
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
445,737
def as_string(self): """Get the email as a string to send in the mailer"""
def as_string(self): """Get the email as a string to send in the mailer"""
445,738
def _plaintext(self): """Plain text email with no attachments"""
def _plaintext(self): """Plain text email with no attachments"""
445,739
def _with_html(self): """There's an html part"""
def _with_html(self): """There's an html part"""
445,740
def _with_html(self): """There's an html part"""
def _with_html(self): """There's an html part"""
445,741
def _multipart(self): """The email has attachments"""
def _multipart(self): """The email has attachments"""
445,742
def __init__(self, host="localhost", port=0): self.host = host self.port = port self._usr = None self._pwd = None
def __init__(self, host="localhost", port=25, useTls=False): self.host = host self.port = port self._usr = None self._pwd = None
445,743
def send(self, msg): """ Send one message or a sequence of messages.
def send(self, msg): """ Send one message or a sequence of messages.
445,744
def send(self, msg): """ Send one message or a sequence of messages.
def send(self, msg): """ Send one message or a sequence of messages.
445,745
def __init__(self, host="localhost", port=0): self.host = host self.port = port self._usr = None self._pwd = None
def __init__(self, host="localhost", port=0, use_tls=False, usr=None, pwd=None): self.host = host self.port = port self._usr = None self._pwd = None
445,746
def __init__(self, host="localhost", port=0): self.host = host self.port = port self._usr = None self._pwd = None
def __init__(self, host="localhost", port=0): self.host = host self.port = port self._usr = None self._pwd = None
445,747
def send(self, msg): """ Send one message or a sequence of messages.
def send(self, msg): """ Send one message or a sequence of messages.
445,748
def send(self, msg): """ Send one message or a sequence of messages.
def send(self, msg): """ Send one message or a sequence of messages.
445,749
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): to = [msg.To] else: to = list(msg.To) cc = [] if msg.CC: if isinstance(msg.CC, basestring): cc = [msg.CC] else: cc = list(msg.CC) bcc = [] if msg.BCC: if isinstance(msg.B...
445,750
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
445,751
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
445,752
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
445,753
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
445,754
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
def _send(self, server, msg): """ Sends a single message using the server we created in send() """ me = msg.From if isinstance(msg.To, basestring): you = [msg.To] else: you = list(msg.To) server.sendmail(me, you, msg.as_string())
445,755
def __init__(self, To=None, From=None, Subject=None, Body=None, Html=None, attachments=None, charset=None): self.attachments = [] if attachments: for attachment in attachments: if isinstance(attachment, basestring): self.attachments.append((attachment, None)) else: try: filename, cid = attachment except (TypeError, Ind...
def __init__(self, To=None, From=None, Subject=None, Body=None, Html=None, Date=None, attachments=None, charset=None): self.attachments = [] if attachments: for attachment in attachments: if isinstance(attachment, basestring): self.attachments.append((attachment, None)) else: try: filename, cid = attachment except (Typ...
445,756
def as_string(self): """Get the email as a string to send in the mailer"""
def as_string(self): """Get the email as a string to send in the mailer"""
445,757
def _plaintext(self): """Plain text email with no attachments"""
def _plaintext(self): """Plain text email with no attachments"""
445,758
def _with_html(self): """There's an html part"""
def _with_html(self): """There's an html part"""
445,759
def _with_html(self): """There's an html part"""
def _with_html(self): """There's an html part"""
445,760
def _multipart(self): """The email has attachments"""
def _multipart(self): """The email has attachments"""
445,761
def extid_to_oeid(self, cr, uid, ids, external_referential_id): #First get the external key field name #conversion external id -> OpenERP object using Object mapping_column_name key! mapping_id = self.pool.get('external.mapping').search(cr, uid, [('model', '=', self._name), ('referential_id', '=', external_referential_...
def extid_to_oeid(self, cr, uid, ids, external_referential_id): #First get the external key field name #conversion external id -> OpenERP object using Object mapping_column_name key! mapping_id = self.pool.get('external.mapping').search(cr, uid, [('model', '=', self._name), ('referential_id', '=', external_referential_...
445,762
def oevals_from_extdata(self, cr, uid, external_referential_id, data_record, key_field, mapping_lines, defaults, context): vals = {} #Dictionary for create record for each_mapping_line in mapping_lines: #Type cast if the expression exists if each_mapping_line['external_field'] in data_record.keys(): try: if each_mappin...
def oevals_from_extdata(self, cr, uid, external_referential_id, data_record, key_field, mapping_lines, defaults, context): vals = {} #Dictionary for create record for each_mapping_line in mapping_lines: #Type cast if the expression exists if each_mapping_line['external_field'] in data_record.keys(): try: if each_mappin...
445,763
def oevals_from_extdata(self, cr, uid, external_referential_id, data_record, key_field, mapping_lines, defaults, context): if context is None: context = {} vals = {} #Dictionary for create record for each_mapping_line in mapping_lines: #Type cast if the expression exists if each_mapping_line['external_field'] in data_r...
def oevals_from_extdata(self, cr, uid, external_referential_id, data_record, key_field, mapping_lines, defaults, context): if context is None: context = {} vals = {} #Dictionary for create record for each_mapping_line in mapping_lines: #Type cast if the expression exists if each_mapping_line['external_field'] in data_r...
445,764
def oevals_from_extdata(self, cr, uid, external_referential_id, data_record, key_field, mapping_lines, defaults, context): if context is None: context = {} vals = {} #Dictionary for create record for each_mapping_line in mapping_lines: #Type cast if the expression exists if each_mapping_line['external_field'] in data_r...
def oevals_from_extdata(self, cr, uid, external_referential_id, data_record, key_field, mapping_lines, defaults, context): if context is None: context = {} vals = {} #Dictionary for create record for each_mapping_line in mapping_lines: #Type cast if the expression exists if each_mapping_line['external_field'] in data_r...
445,765
def extdata_from_oevals(self, cr, uid, external_referential_id, data_record, mapping_lines, defaults, context=None): if context is None: context = {} vals = {} #Dictionary for record for each_mapping_line in mapping_lines: #Build the space for expr space = { 'self':self, 'cr':cr, 'uid':uid, 'external_referential_id':ex...
def extdata_from_oevals(self, cr, uid, external_referential_id, data_record, mapping_lines, defaults, context=None): if context is None: context = {} vals = {} #Dictionary for record for each_mapping_line in mapping_lines: #Build the space for expr space = { 'self':self, 'cr':cr, 'uid':uid, 'external_referential_id':ex...
445,766
def extdata_from_oevals(self, cr, uid, external_referential_id, data_record, mapping_lines, defaults, context=None): if context is None: context = {} vals = {} #Dictionary for record for each_mapping_line in mapping_lines: #Build the space for expr space = { 'self':self, 'cr':cr, 'uid':uid, 'external_referential_id':ex...
def extdata_from_oevals(self, cr, uid, external_referential_id, data_record, mapping_lines, defaults, context=None): if context is None: context = {} vals = {} #Dictionary for record for each_mapping_line in mapping_lines: #Build the space for expr space = { 'self':self, 'cr':cr, 'uid':uid, 'external_referential_id':ex...
445,767
def ext_export(self, cr, uid, ids, external_referential_ids=[], defaults={}, context=None): if context is None: context = {} #external_referential_ids has to be a list logger = netsvc.Logger() write_ids = [] #Will record ids of records modified, not sure if will be used create_ids = [] #Will record ids of newly create...
def ext_export(self, cr, uid, ids, external_referential_ids=[], defaults={}, context=None): if context is None: context = {} #external_referential_ids has to be a list logger = netsvc.Logger() write_ids = [] #Will record ids of records modified, not sure if will be used create_ids = [] #Will record ids of newly create...
445,768
def ext_export(self, cr, uid, ids, external_referential_ids=[], defaults={}, context=None): if context is None: context = {} #external_referential_ids has to be a list logger = netsvc.Logger() write_ids = [] #Will record ids of records modified, not sure if will be used create_ids = [] #Will record ids of newly create...
def ext_export(self, cr, uid, ids, external_referential_ids=[], defaults={}, context=None): if context is None: context = {} #external_referential_ids has to be a list logger = netsvc.Logger() write_ids = [] #Will record ids of records modified, not sure if will be used create_ids = [] #Will record ids of newly create...
445,769
def _get_external_referential_id(self, cr, uid, ids, name, arg, context=None): res = {} for model_data in self.browse(cr, uid, ids, context): s = model_data.module.split('.') #we assume a module name with a '.' means external referential if len(s) > 1: res[model_data.id] = self.pool.get('external.referential').search(c...
def _get_external_referential_id(self, cr, uid, ids, name, arg, context=None): res = {} for model_data in self.browse(cr, uid, ids, context): s = model_data.module.split('.') #we assume a module name with a '.' means external referential if len(s) > 1: ref_ids = self.pool.get('external.referential').search(cr, uid, [['...
445,770
def _get_external_referential_id(self, cr, uid, ids, name, arg, context=None): res = {} for model_data in self.browse(cr, uid, ids, context): s = model_data.module.split('.') #we assume a module name with a '.' means external referential if len(s) > 1: ref_ids = self.pool.get('external.referential').search(cr, uid, [['...
def _get_external_referential_id(self, cr, uid, ids, name, arg, context=None): res = {} for model_data in self.browse(cr, uid, ids, context): s = model_data.module.split('.') #we assume a module name with a '.' means external referential if len(s) > 1: ref_ids = self.pool.get('external.referential').search(cr, uid, [['...
445,771
def status_string(self): ''' Display the status (probably a computed field based on tasks: "Scan scheduled", "Scan in progress" ''' return self.STATUS_TABLE[task.status]
def status_string(self): ''' Display the status (probably a computed field based on tasks: "Scan scheduled", "Scan in progress" ''' return self.STATUS_TABLE[task.status]
445,772
def _wait_until(self, key, event): max = 50 # 5 seconds max while not exists(join(self.tempdir, key + event)) and max: time.sleep(0.1) max -= 1 if not max: self.fail("Timeout")
def _wait_until(self, key, event): max = 100 # 5 seconds max while not exists(join(self.tempdir, key + event)) and max: time.sleep(0.1) max -= 1 if not max: self.fail("Timeout")
445,773
def _wait_until(self, key, event): max = 50 # 5 seconds max while not exists(join(self.tempdir, key + event)) and max: time.sleep(0.1) max -= 1 if not max: self.fail("Timeout")
def _wait_until(self, key, event): max = 50 # 5 seconds max while not exists(join(self.tempdir, key + event)) and max: time.sleep(0.1) max -= 1 if not max: self.fail("Timeout on key=%s, event=%s" % (key, event))
445,774
def run_function_task(self): function = _to_function(self.function_name) return function()
def run_function_task(self): function = _to_function(self.function_name) return function()
445,775
def test_tasks_run_cancel_scheduled(self): task = self._create_task(TestModel.run_something_long, join(self.tempdir, 'key1')) with LogCheck(self): Task.objects._do_schedule() Task.objects.run_task(task.pk) Task.objects.cancel_task(task.pk) with LogCheck(self, "INFO: Cancelling task " + str(task.pk) + "...\nINFO: Task "...
def test_tasks_run_cancel_scheduled(self): task = self._create_task(TestModel.run_something_long, join(self.tempdir, 'key1')) with LogCheck(self): Task.objects._do_schedule() Task.objects.run_task(task.pk) Task.objects.cancel_task(task.pk) with LogCheck(self, "INFO: Cancelling task " + str(task.pk) + "...\nINFO: Task "...
445,776
def test_tasks_exception_in_thread(self): task = self._create_task(TestModel.run_something_long, join(self.tempdir, 'key1')) Task.objects.run_task(task.pk) task = self._create_task(TestModel.run_something_long, join(self.tempdir, 'key1')) task_delete = self._create_task(TestModel.run_something_long, join(self.tempdir, ...
def test_tasks_exception_in_thread(self): task = self._create_task(TestModel.run_something_long, join(self.tempdir, 'key1')) Task.objects.run_task(task.pk) task = self._create_task(TestModel.run_something_long, join(self.tempdir, 'key1')) task_delete = self._create_task(TestModel.run_something_long, join(self.tempdir, ...
445,777
def titles_in_state(request, state, page_number=1, order='name_normal'): state = unpack_url_path(state) page_title = "Titles in State: %s" % state titles = models.Title.objects.all() if state: titles = titles.filter(places__state__iexact=state) titles = titles.order_by(order) titles = titles.disticnt() if titles.count...
def titles_in_state(request, state, page_number=1, order='name_normal'): state = unpack_url_path(state) page_title = "Titles in State: %s" % state titles = models.Title.objects.all() if state: titles = titles.filter(places__state__iexact=state) titles = titles.order_by(order) titles = titles.distinct() if titles.count...
445,778
def handle(self, flickr_key, **options): _log.debug("looking for chronam page content on flickr") for flickr_url, chronam_url in flickr_chronam_links(flickr_key): _log.info("found flickr/chronam link: %s, %s" % (flickr_url, chronam_url)) path = urlparse(chronam_url).path page = Page.lookup(path) if page: f, created = F...
def handle(self, key, **options): _log.debug("looking for chronam page content on flickr") for flickr_url, chronam_url in flickr_chronam_links(flickr_key): _log.info("found flickr/chronam link: %s, %s" % (flickr_url, chronam_url)) path = urlparse(chronam_url).path page = Page.lookup(path) if page: f, created = FlickrUr...
445,779
def handle(self, flickr_key, **options): _log.debug("looking for chronam page content on flickr") for flickr_url, chronam_url in flickr_chronam_links(flickr_key): _log.info("found flickr/chronam link: %s, %s" % (flickr_url, chronam_url)) path = urlparse(chronam_url).path page = Page.lookup(path) if page: f, created = F...
def handle(self, flickr_key, **options): _log.debug("looking for chronam page content on flickr") create_count = 0 for flickr_url, chronam_url in flickr_chronam_links(key): _log.info("found flickr/chronam link: %s, %s" % (flickr_url, chronam_url)) path = urlparse(chronam_url).path page = Page.lookup(path) if page: f, ...
445,780
def handle(self, flickr_key, **options): _log.debug("looking for chronam page content on flickr") for flickr_url, chronam_url in flickr_chronam_links(flickr_key): _log.info("found flickr/chronam link: %s, %s" % (flickr_url, chronam_url)) path = urlparse(chronam_url).path page = Page.lookup(path) if page: f, created = F...
def handle(self, flickr_key, **options): _log.debug("looking for chronam page content on flickr") for flickr_url, chronam_url in flickr_chronam_links(flickr_key): _log.info("found flickr/chronam link: %s, %s" % (flickr_url, chronam_url)) path = urlparse(chronam_url).path page = Page.lookup(path) if not page: _log.error...
445,781
def handle(self, flickr_key, **options): _log.debug("looking for chronam page content on flickr") for flickr_url, chronam_url in flickr_chronam_links(flickr_key): _log.info("found flickr/chronam link: %s, %s" % (flickr_url, chronam_url)) path = urlparse(chronam_url).path page = Page.lookup(path) if page: f, created = F...
def handle(self, flickr_key, **options): _log.debug("looking for chronam page content on flickr") for flickr_url, chronam_url in flickr_chronam_links(flickr_key): _log.info("found flickr/chronam link: %s, %s" % (flickr_url, chronam_url)) path = urlparse(chronam_url).path page = Page.lookup(path) if page: f, created = F...
445,782
def chronam_url(photo_id): u = 'http://api.flickr.com/services/rest/?method=flickr.photos.getInfo&api_key=%s&photo_id=%s&format=json&nojsoncallback=1' % (settings.FLICKR_KEY, photo_id) j = json.loads(urllib.urlopen(u).read()) for tag in j['photo']['tags']['tag']: if 'chroniclingamerica.loc.gov' in tag['raw']: return ta...
def chronam_url(photo_id, key): """ Looks at complete information for a Flickr image, and tries to find the first chroniclingamerica.loc.gov identifier in the machine tags. """ u = 'http://api.flickr.com/services/rest/?method=flickr.photos.getInfo&api_key=%s&photo_id=%s&format=json&nojsoncallback=1' % (key, photo_id) ...
445,783
def __init__(self, query): self.query = query.copy()
def __init__(self, query): self.query = query.copy()
445,784
def __init__(self, query): self.query = query.copy()
def __init__(self, query): self.query = query.copy()
445,785
def setUp(self): # wipe the slate clean Title.objects.all().delete() # load a title loader = TitleLoader() marcxml = os.path.join(os.path.dirname(chronam.web.__file__), 'test-data', 'bib.xml') loader.load_file(marcxml)
def setUp(self): # wipe the slate clean Title.objects.all().delete() # load a title loader = TitleLoader() marcxml = os.path.join(os.path.dirname(chronam.web.__file__), 'test-data', 'bib.xml') loader.load_file(marcxml)
445,786
def test_title(self): t = Title.objects.get(lccn='sn83030846') self.assertEqual(t.name, 'The living issue.') self.assertEqual(t.name_normal, 'living issue.') self.assertEqual(t.lccn, 'sn83030846') self.assertEqual(t.place_of_publication, 'Albany, N.Y.') self.assertEqual(t.publisher, 'The Living Issue Co.') self.assertE...
def test_title(self): t = Title.objects.get(lccn='sn83030846') self.assertEqual(t.name, 'The living issue.') self.assertEqual(t.name_normal, 'living issue.') self.assertEqual(t.lccn, 'sn83030846') self.assertEqual(t.place_of_publication, 'Albany, N.Y.') self.assertEqual(t.publisher, 'The Living Issue Co.') self.assertE...
445,787
def test_subjects(self): t = Title.objects.get(lccn='sn83030846') # test different types and first and last subjects = list(t.subjects.all()) self.assertEqual(len(subjects), 8) self.assertEqual(subjects[0].heading, 'Albany (N.Y.)--Newspapers.') self.assertEqual(subjects[0].type, 'g') # for topic self.assertEqual(subjec...
def test_subjects(self): t = Title.objects.get(lccn='sn83030846') # test different types and first and last subjects = list(t.subjects.all()) self.assertEqual(len(subjects), 8) self.assertEqual(subjects[0].heading, 'Albany (N.Y.)--Newspapers.') self.assertEqual(subjects[0].type, 'g') # for topic self.assertEqual(subjec...
445,788
def test_notes(self): t = Title.objects.get(lccn='sn83030846') notes = list(t.notes.all()) self.assertEqual(len(notes), 5) self.assertEqual(notes[0].text, 'Description based on: Vol. 1, no. 8 (Apr. 12, 1873).')
def test_notes(self): t = Title.objects.get(lccn='sn83030846') notes = list(t.notes.all()) self.assertEqual(len(notes), 5) self.assertEqual(notes[0].text, 'Description based on: Vol. 1, no. 8 (Apr. 12, 1873).')
445,789
def test_alt_titles(self): t = Title.objects.get(lccn='sn83030846') alt_titles = list(t.alt_titles.all()) self.assertEqual(len(alt_titles), 2) self.assertEqual(alt_titles[0].name, 'Fake uncontrolled non-analytic title') self.assertEqual(alt_titles[1].name, 'Living issue. Prohibition') self.assertEqual(alt_titles[1].da...
def test_alt_titles(self): t = Title.objects.get(lccn='sn83030846') alt_titles = list(t.alt_titles.all()) self.assertEqual(len(alt_titles), 2) self.assertEqual(alt_titles[0].name, 'Fake uncontrolled non-analytic title') self.assertEqual(alt_titles[1].name, 'Living issue. Prohibition') self.assertEqual(alt_titles[1].da...
445,790
def test_succeeding_titles(self): t = Title.objects.get(lccn='sn83030846') links = list(t.succeeding_title_links.all()) self.assertEqual(len(links), 3) self.assertEqual(links[0].name, 'Living issue and the new republic') self.assertEqual(links[0].lccn, 'sn89071335') self.assertEqual(links[0].oclc, None) self.assertEqua...
def test_succeeding_titles(self): t = Title.objects.get(lccn='sn83030846') links = list(t.succeeding_title_links.all()) self.assertEqual(len(links), 3) self.assertEqual(links[0].name, 'Living issue and the new republic') self.assertEqual(links[0].lccn, 'sn89071335') self.assertEqual(links[0].oclc, None) self.assertEqua...
445,791
def test_succeeding_titles(self): t = Title.objects.get(lccn='sn83030846') links = list(t.succeeding_title_links.all()) self.assertEqual(len(links), 3) self.assertEqual(links[0].name, 'Living issue and the new republic') self.assertEqual(links[0].lccn, 'sn89071335') self.assertEqual(links[0].oclc, None) self.assertEqua...
def test_succeeding_titles(self): t = Title.objects.get(lccn='sn83030846') links = list(t.succeeding_title_links.all()) self.assertEqual(len(links), 3) self.assertEqual(links[0].name, 'Living issue and the new republic') self.assertEqual(links[0].lccn, 'sn89071335') self.assertEqual(links[0].oclc, None) self.assertEqua...
445,792
def test_oclc_num(self): t = TitleLoader() t.load_file('web/test-data/sn86069873.xml') t = Title.objects.get(lccn='sn86069873') self.assertEqual(t.oclc, '13528482')
def test_oclc_num(self): t = TitleLoader() t.load_file(abs_filename('./test-data/sn86069873.xml')) t = Title.objects.get(lccn='sn86069873') self.assertEqual(t.oclc, '13528482')
445,793
def test_vague_dates(self): loader = TitleLoader() loader.load_file('web/test-data/bib-with-vague-dates.xml') t = Title.objects.get(lccn='00062183') self.assertEqual(t.start_year_int, 1900) self.assertEqual(t.end_year_int, 1999)
def test_vague_dates(self): loader = TitleLoader() filename = abs_filename('./test-data/bib-with-vague-dates.xml') loader.load_file(filename) t = Title.objects.get(lccn='00062183') self.assertEqual(t.start_year_int, 1900) self.assertEqual(t.end_year_int, 1999)
445,794
def test_etitle(self): # we shouldn't load in [electronic resource] records for # chronicling america titles, since they muddle up search results # https://rdc.lctl.gov/trac/ndnp/ticket/375 loader = TitleLoader() loader.load_file('web/test-data/etitle.xml') self.assertRaises(Title.DoesNotExist, Title.objects.get, lccn=...
def test_etitle(self): # we shouldn't load in [electronic resource] records for # chronicling america titles, since they muddle up search results # https://rdc.lctl.gov/trac/ndnp/ticket/375 loader = TitleLoader() loader.load_file(abs_filename('./test-data/etitle.xml')) self.assertRaises(Title.DoesNotExist, Title.object...
445,795
def path(self): """Absolute path of batch directory""" return os.path.join(STORAGE, self.awardee.org_code, self.name, "data")
def path(self): """Absolute path of batch directory""" return os.path.join(settings.STORAGE, self.awardee.org_code, self.name, "data")
445,796
def setup_virtual_env(): if not os.path.exists(VIRTUAL_ENV) or new_requirements(): print "Initializing virtualenv at %s" % VIRTUAL_ENV try: subprocess.check_call( ['virtualenv', '--quiet', '--no-site-packages', VIRTUAL_ENV]) subprocess.check_call([ os.path.join(VIRTUAL_ENV, 'bin', 'easy_install'), '--quiet', 'pip']) ...
def setup_virtual_env(): if not os.path.exists(VIRTUAL_ENV) or new_requirements(): print "Initializing virtualenv at %s" % VIRTUAL_ENV try: subprocess.check_call( ['virtualenv', '--quiet', '--no-site-packages', VIRTUAL_ENV]) subprocess.check_call([ os.path.join(VIRTUAL_ENV, 'bin', 'easy_install'), '--quiet', 'pip']) ...
445,797
def newspapers(request, state=None, format='html'): titles = models.Title.objects.distinct().filter(issues__isnull=False) if state: template = 'newspapers_state' state = unpack_url_path(state) if state is None: raiseHttp404 titles = titles.filter(country__name__iexact=state) if titles.count() == 0: raise Http404 page_t...
def newspapers(request, state=None, format='html'): titles = models.Title.objects.distinct().filter(issues__isnull=False) if state: template = 'newspapers_state' state = unpack_url_path(state) if state is None: raiseHttp404 titles = titles.filter(country__name__iexact=state) if titles.count() == 0: raise Http404 state ...
445,798
def load_batch(self, batch_name, strict=True): """Load a batch, and return a Batch instance for the batch that was loaded.
def load_batch(self, batch_name, strict=True): """Load a batch, and return a Batch instance for the batch that was loaded.
445,799